add some handy buttons to the bar

This commit is contained in:
Daniel Flanagan 2016-11-12 14:18:20 -06:00
parent f2a6005019
commit 3e98d4c4e0
6 changed files with 33 additions and 10 deletions

17
env/wm/extras/bar/bar_commands.bash vendored Executable file
View file

@ -0,0 +1,17 @@
#!/usr/bin/env bash
while read -r line; do
COMMAND=$(echo "$line" | awk '{print $1;}')
ARGS=$(echo "$line" | awk '{for (i=2; i<=NF; i++) print $i}')
case $COMMAND in
switch_desktop)
bspc desktop -f $ARGS
;;
launcher)
rofi -show run -font "$PRIMARY_FONT_FAMILY $PRIMARY_FONT_SIZE" -lines 16 -width 10 -padding 8 -fuzzy -bw "$BORDER_WIDTH" -color-enabled -color-window "#$(get_color 00)","#$(get_color 0D)","#$(get_color 0D)","#$(get_color 00)" -color-normal "#$(get_color 00)","#$(get_color 06)","#$(get_color 00)","#$(get_color 0D)","#$(get_color 00)" -separator-style none -hide-scrollbar
;;
launcher2)
rofi -show drun -font "$PRIMARY_FONT_FAMILY $PRIMARY_FONT_SIZE" -lines 16 -width 10 -padding 8 -fuzzy -bw "$BORDER_WIDTH" -color-enabled -color-window "#$(get_color 00)","#$(get_color 0D)","#$(get_color 0D)","#$(get_color 00)" -color-normal "#$(get_color 00)","#$(get_color 06)","#$(get_color 00)","#$(get_color 0D)","#$(get_color 00)" -separator-style none -hide-scrollbar
;;
esac
done

View file

@ -11,6 +11,8 @@ reload_colors() {
# trap reload_colors SIGUSR1
LAUNCHER_BUTTONS="%{F$COLOR_DARK}%{A3:launcher2:}%{A:launcher:}!%{A}%{A}%{F-}"
export MODULE_MATCH=()
export MODULE_CALLBACK=()
export MODULE_DATA=()
@ -67,7 +69,7 @@ while read -r line; do
fi
done
printf "%s\n" "%{l} $l_content %{c}$c_content %{r}$r_content "
printf "%s\n" "%{l} $LAUNCHER_BUTTONS $l_content %{c}$c_content %{r}$r_content "
done
# echo -e "\nEND BAR LOG" >> "$BAR_LOG"

View file

@ -11,6 +11,8 @@ MATCH="$MATCH_PREFIX*"
DESKTOP_SPACER=" "
SWITCH_DESKTOP_COMMAND="switch_desktop"
ul="u"
if [ $BAR_UNDERLINE -eq 1 ]; then
:
@ -27,24 +29,25 @@ bar_module_bspwm() {
item=$1
name=${item#?}
cname="$name"
bname="%{A:$SWITCH_DESKTOP_COMMAND $cname:}${cname}%{A}"
case $item in
O*) # focused occupied desktop
content="${content}%{F$COLOR_HIGHLIGHT}%{U$COLOR_HIGHLIGHT}%{+${ul}}${cname}%{-${ul}}%{U-}%{F-}$DESKTOP_SPACER"
content="${content}%{F$COLOR_HIGHLIGHT}%{U$COLOR_HIGHLIGHT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}$DESKTOP_SPACER"
;;
F*) # focused free desktop
content="${content}%{F$COLOR_DARK}%{U$COLOR_DARK}%{+${ul}}${cname}%{-${ul}}%{U-}%{F-}$DESKTOP_SPACER"
content="${content}%{F$COLOR_DARK}%{U$COLOR_DARK}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}$DESKTOP_SPACER"
;;
U*) # focused occupied desktop
content="${content}%{F$COLOR_URGENT}%{U$COLOR_URGENT}%{+${ul}}${cname}%{-${ul}}%{U-}%{F-}$DESKTOP_SPACER"
content="${content}%{F$COLOR_URGENT}%{U$COLOR_URGENT}%{+${ul}}${bname}%{-${ul}}%{U-}%{F-}$DESKTOP_SPACER"
;;
o*) # occupied desktop
content="${content}%{F$COLOR_FOREGROUND}${cname}%{F-}$DESKTOP_SPACER"
content="${content}%{F$COLOR_FOREGROUND}${bname}%{F-}$DESKTOP_SPACER"
;;
f*) # free desktop
content="${content}%{F$COLOR_DARK}${cname}%{F-}$DESKTOP_SPACER"
content="${content}%{F$COLOR_DARK}${bname}%{F-}$DESKTOP_SPACER"
;;
u*) # urgent desktop
content="${content}%{F$COLOR_URGENT}${cname}%{F-}$DESKTOP_SPACER"
content="${content}%{F$COLOR_URGENT}${bname}%{F-}$DESKTOP_SPACER"
;;
esac
shift

View file

View file

@ -50,4 +50,6 @@ fi
source "$BAR_PATH/colors.bash"
cat "$BAR_FIFO" | "$BAR_PATH/formatter.bash" | \
lemonbar $BAR_B -g "$WIDTH"x"$BAR_HEIGHT"+"$OFFSET"+"$POS_Y" -u "$BAR_BORDER_WIDTH" -f "$BAR_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B"$COLOR_BACKGROUND" -n "$BAR_WID"
lemonbar -a 12 $BAR_B -g "$WIDTH"x"$BAR_HEIGHT"+"$OFFSET"+"$POS_Y" -u "$BAR_BORDER_WIDTH" -f "$BAR_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B"$COLOR_BACKGROUND" -n "$BAR_WID" | \
"$BAR_PATH/bar_commands.bash"

3
env/wm/sxhkdrc vendored
View file

@ -174,8 +174,7 @@ super + Return
# spawn the app launcher
super + space
rofi -show run -font "Monaco 9" -fuzzy -bw $BORDER_WIDTH -bg "#$(get_color 00)" -fg "#$(get_color 0A)" -hlfg "#$(get_color 0D)" -hlbg "#$(get_color 01)"
# dmenu_run -fn "$PRIMARY_FONT_FAMILY_WITH_SIZE" -i -nb "#$(get_color 00)" -sb "#$(get_color 00)" -sf "#$(get_color 0A)" -nf "#$(get_color 04)" -h "$BAR_HEIGHT"
rofi -show run -font "$PRIMARY_FONT_FAMILY $PRIMARY_FONT_SIZE" -lines 16 -width 10 -padding 8 -fuzzy -bw "$BORDER_WIDTH" -color-enabled -color-window "#$(get_color 00)","#$(get_color 0D)","#$(get_color 0D)","#$(get_color 00)" -color-normal "#$(get_color 00)","#$(get_color 06)","#$(get_color 00)","#$(get_color 0D)","#$(get_color 00)" -separator-style none -hide-scrollbar
# lock the desktop
super + ctrl + shift + l