From 006509941bf908b60e95cbff2e1ddaed2c8c5bea Mon Sep 17 00:00:00 2001 From: DustVoice Date: Sun, 9 Aug 2020 19:21:31 +0200 Subject: [PATCH] Make dmenu use .Xresources with fallback --- .Xresources | 2 +- .config/dmenu/dmenu_run_with_aliases | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.Xresources b/.Xresources index 83fae7a..1a1fe6b 100644 --- a/.Xresources +++ b/.Xresources @@ -19,7 +19,7 @@ *.color13: #FF92D0 *.color14: #9AEDFE *.color15: #E6E6E6 -*.font = "Hack:size=10:antialias=true:autohint=true" +*.font: "Hack:size=10:antialias=true:autohint=true" *.termName: xterm-256color *.shell: /usr/bin/zsh *.tabspaces: 4 diff --git a/.config/dmenu/dmenu_run_with_aliases b/.config/dmenu/dmenu_run_with_aliases index 310b8a2..ebfcdcc 100755 --- a/.config/dmenu/dmenu_run_with_aliases +++ b/.config/dmenu/dmenu_run_with_aliases @@ -4,6 +4,14 @@ if [[ -f $HOME/.zsh_alias ]]; then source $HOME/.zsh_alias fi -command_to_run=$({ alias | awk '{split($0,alias,"="); print alias[1];}' ; dmenu_path ; } | sort | dmenu -i -fn Hack -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" "$@") +fallback_font="Hack:size=10:antialias=true:autohint=true" +font="" +if [ -x $(command -v xgetres) ]; then + font=$(xgetres font || echo $fallback_font); +else + font=$fallback_font; +fi + +command_to_run=$({ alias | awk '{split($0,alias,"="); print alias[1];}' ; dmenu_path ; } | sort | dmenu -i -fn $font -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" "$@") eval ${command_to_run} &