diff --git a/.config/dmenu/dmenu_bspwm_desktop b/.config/dmenu/dmenu_bspwm_desktop index cd4409a5..90bcec3f 100755 --- a/.config/dmenu/dmenu_bspwm_desktop +++ b/.config/dmenu/dmenu_bspwm_desktop @@ -1,6 +1,10 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh -dmenu_string="Wrong parameter" +if [[ -f $HOME/.zsh_alias ]]; then + source $HOME/.zsh_alias +fi + +local dmenu_string="Wrong parameter" case $1 in "rename") @@ -13,11 +17,13 @@ case $1 in dmenu_string="Swap and follow desktop with desktop: " ;; esac +local desktop="" + if [[ $1 == "delete" || $1 == "rename" ]]; then - desktop=$(echo "" | dmenu -i -fn Hack -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string") + desktop=$(echo "" | dmenu -i -fn $(get-font) -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string") else if [[ $1 != "bubbleprev" && $1 != "bubblenext" ]]; then - desktop=$(bspc query -m focused -D --names | dmenu -i -fn Hack -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string") + desktop=$(bspc query -m focused -D --names | dmenu -i -fn $(get-font) -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string") fi fi diff --git a/.config/dmenu/dmenu_bspwm_desktop_content b/.config/dmenu/dmenu_bspwm_desktop_content index 706c772c..2c3a59a9 100755 --- a/.config/dmenu/dmenu_bspwm_desktop_content +++ b/.config/dmenu/dmenu_bspwm_desktop_content @@ -1,6 +1,10 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh -dmenu_string="Wrong parameter" +if [[ -f $HOME/.zsh_alias ]]; then + source $HOME/.zsh_alias +fi + +local dmenu_string="Wrong parameter" case $1 in "goto") @@ -11,15 +15,15 @@ case $1 in dmenu_string="Move and follow node to desktop: " ;; esac -desktop=$(bspc query -m focused -D --names | dmenu -i -fn Hack -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string") +local desktop=$(bspc query -m focused -D --names | dmenu -i -fn $(get-font) -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string") -found=false +local found=false -desktop_list=$(bspc query -m focused -D --names | tr '\n' ' ') +local desktop_list=$(bspc query -m focused -D --names) +local desktop_array=("${(f)desktop_list}") -if [[ $desktop != "" ]]; -then - for name in $desktop_list; do +if [[ $desktop != "" ]]; then + for name in $desktop_array; do if [[ $name == $desktop ]]; then found=true fi @@ -27,7 +31,7 @@ then fi if [ ! $found = true ]; then - bspc monitor -d $desktop_list $desktop + bspc monitor -d $desktop_array $desktop fi case $1 in diff --git a/.config/dmenu/dmenu_bspwm_monitor b/.config/dmenu/dmenu_bspwm_monitor index cf5f0e87..d69a313e 100755 --- a/.config/dmenu/dmenu_bspwm_monitor +++ b/.config/dmenu/dmenu_bspwm_monitor @@ -1,6 +1,10 @@ -#!/usr/bin/env bash +#!/usr/bin/env zsh -dmenu_string="Wrong parameter" +if [[ -f $HOME/.zsh_alias ]]; then + source $HOME/.zsh_alias +fi + +local dmenu_string="Wrong parameter" case $1 in "goto") @@ -17,7 +21,7 @@ case $1 in dmenu_string="Move and follow desktop to monitor: " ;; esac -monitor=$(bspc query -M --names | dmenu -i -fn Hack -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string") +local monitor=$(bspc query -M --names | dmenu -i -fn $(font-name) -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" -p "$dmenu_string") case $1 in "goto") diff --git a/.config/dmenu/dmenu_run_with_aliases b/.config/dmenu/dmenu_run_with_aliases index ebfcdcc5..5eb6ca0d 100755 --- a/.config/dmenu/dmenu_run_with_aliases +++ b/.config/dmenu/dmenu_run_with_aliases @@ -4,14 +4,6 @@ if [[ -f $HOME/.zsh_alias ]]; then source $HOME/.zsh_alias fi -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" "$@") +command_to_run=$({ alias | awk '{split($0,alias,"="); print alias[1];}' ; dmenu_path ; } | sort | dmenu -i -fn $(get-font) -nb "#282a36" -nf "#f8f8f2" -sb "#44475a" -sf "#f8f8f2" "$@") eval ${command_to_run} & diff --git a/.zsh_alias b/.zsh_alias index 713d22df..f907cd01 100644 --- a/.zsh_alias +++ b/.zsh_alias @@ -14,6 +14,18 @@ function screenkey-obs-func() { } alias screenkey-obs='screenkey-obs-func' +function get-font-func() { + 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 + echo "$font" +} +alias get-font='get-font-func' + alias tmate-obs='tmate -k tmk-ET35fx5m9cA7cxOt4jjWkSmaOy -r DustVoice' alias xfce-polkit='/usr/lib/xfce-polkit/xfce-polkit'