Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#41 fixing effectless --preview-text parameter for file output #42

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 16 additions & 10 deletions fontpreview
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,7 @@ generate_preview(){
-flatten "$2"
}

main(){
# Checkig if needed dependencies are installed
dependencies=(xdotool sxiv convert fzf)
for dependency in "${dependencies[@]}"; do
type -p "$dependency" &>/dev/null || {
echo "error: Could not find '${dependency}', is it installed?" >&2
exit 1
}
done

prepare_defaults() {
# Checking for enviornment variables which the user might have set.
# This config file for fontpreview is pretty much the bashrc, zshrc, etc
# Majority of the variables in fontpreview can changed using the enviornment variables
Expand All @@ -85,6 +76,19 @@ main(){
[[ $FONTPREVIEW_BG_COLOR != "" ]] && BG_COLOR=$FONTPREVIEW_BG_COLOR
[[ $FONTPREVIEW_FG_COLOR != "" ]] && FG_COLOR=$FONTPREVIEW_FG_COLOR
[[ $FONTPREVIEW_PREVIEW_TEXT != "" ]] && PREVIEW_TEXT=$FONTPREVIEW_PREVIEW_TEXT
}



main(){
# Checkig if needed dependencies are installed
dependencies=(xdotool sxiv convert fzf)
for dependency in "${dependencies[@]}"; do
type -p "$dependency" &>/dev/null || {
echo "error: Could not find '${dependency}', is it installed?" >&2
exit 1
}
done

# Save the window ID of the terminal window fontpreview is executed in.
# This is so that when we open up sxiv, we can change the focus back to
Expand Down Expand Up @@ -214,6 +218,8 @@ while true; do
shift
done

# Both main() and following commands need an environment variables fallback setup
prepare_defaults

# Point a font file to fontpreview and it will preview it.
# Example:
Expand Down