Transition to pure zsh for dmenu

This commit is contained in:
David Holland 2020-08-17 20:04:10 +02:00
parent 4f893f5002
commit 2738ca97b2
Signed by: DustVoice
GPG key ID: 47068995A14EDCA9
5 changed files with 43 additions and 25 deletions

View file

@ -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

View file

@ -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

View file

@ -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")

View file

@ -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} &

View file

@ -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'