Last active
November 7, 2022 13:30
-
-
Save jinyeow/dd51376dfff1b8947c2f to your computer and use it in GitHub Desktop.
Config files related to bspwm and panel (lemonbar)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
ws1= # main | |
ws2= # web | |
ws3= # mail | |
ws4= # code | |
ws5= # math [infinity] (term icon) | |
ws6= # media | |
ws7= # misc (9 squares icon) | |
ws8= # notes/docs (pdf icon) | |
ws9= # settings (1 cog settings icon) | |
ws10= # security | |
bspc config border_width 5 | |
bspc config window_gap 10 | |
bspc config focus_follows_pointer true | |
bspc config split_ratio 0.50 | |
bspc config borderless_monocle true | |
bspc config gapless_monocle true | |
bspc config focus_by_distance true | |
# bspc monitor -d i ii iii iv v vi vii viii ix x | |
bspc monitor -d $ws1 $ws2 $ws3 $ws4 $ws5 $ws6 $ws7 $ws8 $ws9 $ws10 | |
bspc config -d $ws1 window_gap 0 | |
bspc config -d $ws2 window_gap 0 | |
bspc desktop $ws2 -l monocle | |
bspc rule -a Firefox desktop=^2 | |
bspc rule -a Dwb desktop=^2 | |
bspc rule -a Thunderbird desktop=^3 | |
bspc rule -a Thunar desktop=^7 | |
bspc rule -a Vlc desktop=^6 | |
bspc rule -a VirtualBox desktop=^10 | |
bspc rule -a Cherrytree desktop=^8 | |
bspc rule -a libreoffice desktop=^8 | |
bspc rule -a Wireshark desktop=^10 | |
bspc rule -a Lxappearance desktop=^9 | |
bspc rule -a Nitrogen desktop=^9 | |
bspc rule -a burp-StartBurp desktop=^10 | |
bspc rule -a Evince desktop=^8 | |
bspc rule -a Feh desktop=^6 | |
bspc rule -a Gpicview desktop=^6 | |
~/scripts/panel & |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/zsh | |
PANEL_FIFO=/tmp/panel-fifo | |
PANEL_HEIGHT=30 | |
# PANEL_FONT_FAMILY="-misc-dejavu serif-bold-r-normal--11-*-*-*-p-*-adobe-standard" | |
PANEL_FONT_FAMILY="-gohu-gohufont-medium-r-normal--14-100-100-100-c-80-iso10646-1" | |
ICON_FONT2="-misc-fontawesome-medium-r-normal--14-*-*-*-p-*-iso10646-1" | |
ICON_FONT3="-misc-symbola-medium-r-semicondensed--14-*-*-*-p-*-iso10646-1" | |
ICON_FONT="-misc-icons-medium-r-normal--14-*-*-*-p-*-iso10646-1" | |
# export PANEL_FIFO PANEL_HEIGHT PANEL_FONT_FAMILY | |
# setup | |
if [ $(pgrep -cx panel) -gt 1 ] ; then | |
printf "%s\n" "The panel is already running." >&2 | |
exit 1 | |
fi | |
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT | |
[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO" | |
mkfifo "$PANEL_FIFO" | |
bspc config top_padding $PANEL_HEIGHT | |
bspc control --subscribe > "$PANEL_FIFO" & | |
# find out how to make this scroll | |
xtitle -sf 'T[%s]' -t 20 > "$PANEL_FIFO" & | |
# clock | |
while true; | |
do | |
echo 'C\uf017' $(date +"%l:%M %p"); | |
sleep 5; | |
done > "$PANEL_FIFO" & | |
# date | |
while true; | |
do echo 'D\uf073' $(date +'%b %d') | |
sleep 5 | |
done > $PANEL_FIFO & | |
# battery | |
while true; | |
do | |
BAT_LEVEL_0=$(upower -i /org/freedesktop/UPower/devices/battery_BAT1 | grep "percentage" | sed 's/\s//g' | cut -d: -f2 | sed 's/%//') | |
BAT_LEVEL_1=$(upower -i /org/freedesktop/UPower/devices/battery_BAT0 | grep "percentage" | sed 's/\s//g' | cut -d: -f2 | sed 's/%//') | |
echo 'B BAT0:'$BAT_LEVEL_0' BAT1:'$BAT_LEVEL_1 | |
# if [ $BAT_LEVEL_0 -ge 80 ] | |
# then | |
# echo 'B' $BAT_LEVEL_0% | |
# fi | |
# | |
# if [ $BAT_LEVEL_0 -ge 30 -a $BAT_LEVEL_0 -lt 80 ] | |
# then | |
# echo 'B' $BAT_LEVEL_0% | |
# fi | |
# | |
# if [ $BAT_LEVEL_0 -lt 30 ] | |
# then | |
# echo 'B%{T3}%{T1}' $BAT_LEVEL_0% | |
# fi | |
# | |
# if [ $BAT_LEVEL_1 -ge 80 ] | |
# then | |
# echo 'B' $BAT_LEVEL_1% | |
# fi | |
# | |
# if [ $BAT_LEVEL_1 -ge 30 -a $BAT_LEVEL_1 -lt 80 ] | |
# then | |
# echo 'B' $BAT_LEVEL_1% | |
# fi | |
# | |
# if [ $BAT_LEVEL_1 -lt 30 ] | |
# then | |
# echo 'B%{T3}%{T1}' $BAT_LEVEL_1% | |
# fi | |
sleep 30; | |
done > "$PANEL_FIFO" & | |
# alsa volume | |
while true; | |
do | |
ALSA_VOLUME=$(amixer -c 1 get Master | grep 'Mono: Playback' | grep -o '...%' | sed 's/\[//' | sed 's/%//' | sed 's/ //') | |
ALSA_STATE=$(amixer -c 1 get Master | grep 'Mono: Playback' | grep -o '\[on]') | |
if [ $ALSA_STATE ] | |
then | |
if [ $ALSA_VOLUME -ge 70 ] | |
then | |
echo V'\uf028' $ALSA_VOLUME | |
fi | |
if [ $ALSA_VOLUME -gt 0 -a $ALSA_VOLUME -lt 70 ] | |
then | |
echo V'\uf027' $ALSA_VOLUME | |
fi | |
if [ $ALSA_VOLUME -eq 0 ] | |
then | |
echo V'\uf026' $ALSA_VOLUME | |
fi | |
else | |
echo V'\uf026 mute' | |
fi | |
sleep 0.1 | |
done > $PANEL_FIFO & | |
# wifi | |
while true; | |
do | |
WIFI_SSID=$(iw wlp3s0 link | grep 'SSID' | sed 's/SSID: //' | sed 's/\t//') | |
WIFI_SIGNAL=$(iw wlp3s0 link | grep 'signal' | sed 's/signal: //' | sed 's/ dBm//' | sed 's/\t//') | |
WIFI_IP=$(ifconfig wlp3s0 | grep "inet " | cut -d' ' -f10) | |
echo L'' $WIFI_SSID '|' $WIFI_IP | |
sleep 10 | |
done > $PANEL_FIFO & | |
# disk space | |
while true; | |
do | |
DIR=$(df -hlP /home | grep /home | sed 's/ \+/ /g' | cut -d' ' -f6) | |
FREE_SPACE=$(df -hlP /home | grep /home | sed 's/ \+/ /g' | cut -d' ' -f4) | |
echo F'' $DIR $FREE_SPACE 'free' | |
sleep 10 | |
done > $PANEL_FIFO & | |
# power | |
echo P'\uf011' > $PANEL_FIFO & | |
# music controls | |
# while true; | |
# do | |
# SONG_NAME=$(mpc | head -n1) | |
# if [[ -n $(mpc status | grep paused) ]] | |
# then | |
# echo "R%{T3}%{A:mpc prev:}\uf19c%{A} %{A:mpc play:}\uf198%{A} %{A:mpc next:}\uf17c%{A}%{T1} $SONG_NAME" | |
# else | |
# echo "R%{T3}%{A:mpc prev:}\uf19c%{A} %{A:mpc pause:}\uf191%{A} %{A:mpc next:}\uf17c%{A}%{T1} $SONG_NAME" | |
# fi | |
# | |
# sleep 1 | |
# done > $PANEL_FIFO & | |
. panel_colors | |
cat "$PANEL_FIFO" | panel_bar | lemonbar -g x$PANEL_HEIGHT -f "$PANEL_FONT_FAMILY" -f "$ICON_FONT" -f "$ICON_FONT2" -f "$ICON_FONT3" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" -u 2 | zsh & | |
wait |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /bin/sh | |
# | |
# Example panel for LemonBoy's bar | |
. panel_colors | |
num_mon=$(bspc query -M | wc -l) | |
PADDING=" " | |
SEP="//" | |
while read -r line ; do | |
case $line in | |
D*) | |
# date output | |
date="$PADDING${line#?}$PADDING" | |
;; | |
R*) | |
# music info | |
music="%{B$COLOR_FOCUSED_OCCUPIED_BG}%{F$COLOR_FOCUSED_OCCUPIED_FG}$PADDING${line#?}$PADDING%{F-}%{B-}" | |
;; | |
C*) | |
# clock output | |
clock="$PADDING${line#?}$PADDING" | |
;; | |
B*) | |
# battery percent output | |
# battery="%{A:bat.sh:}$PADDING${line#?}$PADDING%{A}" | |
battery="$PADDING${line#?}$PADDING" | |
;; | |
T*) | |
# xtitle output | |
title="${line#?}$PADDING$SEP" | |
;; | |
V*) | |
# alsa volume | |
volume="$PADDING${line#?}$PADDING" | |
;; | |
L*) | |
# wifi link | |
wifi="$PADDING${line#?}$PADDING" | |
;; | |
F*) | |
# free space /home | |
free="$PADDING${line#?}$PADDING" | |
;; | |
P*) | |
# power | |
power="%{A2:poweroff.sh:}%{A3:reboot.sh:}$PADDING${line#?}$PADDING%{A}%{A}" | |
;; | |
W*) | |
# bspwm internal state | |
wm_infos="" | |
IFS=':' | |
set -- ${line#?} | |
while [ $# -gt 0 ] ; do | |
item=$1 | |
name=${item#?} | |
case $item in | |
M*) | |
# active monitor | |
if [ $num_mon -gt 1 ] ; then | |
wm_infos="$wm_infos %{F$COLOR_ACTIVE_MONITOR_FG}%{B$COLOR_ACTIVE_MONITOR_BG}$PADDING${name}$PADDING%{B-}%{F-} " | |
fi | |
;; | |
m*) | |
# inactive monitor | |
if [ $num_mon -gt 1 ] ; then | |
wm_infos="$wm_infos %{F$COLOR_INACTIVE_MONITOR_FG}%{B$COLOR_INACTIVE_MONITOR_BG}$PADDING${name}$PADDING%{B-}%{F-} " | |
fi | |
;; | |
O*) | |
# focused occupied desktop | |
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u}$PADDING${name}$PADDING%{-u}%{B-}%{F-}" | |
;; | |
F*) | |
# focused free desktop | |
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}%{U$COLOR_FOREGROUND}%{+u}$PADDING${name}$PADDING%{-u}%{B-}%{F-}" | |
;; | |
U*) | |
# focused urgent desktop | |
wm_infos="${wm_infos}%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}%{U$COLOR_FOREGROUND}%{+u}$PADDING${name}$PADDING%{-u}%{B-}%{F-}" | |
;; | |
o*) | |
# occupied desktop | |
wm_infos="${wm_infos}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG}%{A:bspc desktop -f ${name}:}$PADDING${name}$PADDING%{A}%{B-}%{F-}" | |
;; | |
f*) | |
# free desktop | |
wm_infos="${wm_infos}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG}%{A:bspc desktop -f ${name}:}$PADDING${name}$PADDING%{A}%{B-}%{F-}" | |
;; | |
u*) | |
# urgent desktop | |
wm_infos="${wm_infos}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG}$PADDING${name}$PADDING%{B-}%{F-}" | |
;; | |
esac | |
shift | |
done | |
;; | |
esac | |
printf "%s\n" "%{l}${wm_infos}%{r}${title}${free}${wifi}${battery}${date}${clock}${volume}${power}" | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# bspwm hotkeys | |
# | |
super + alt + Escape | |
pkill -x panel; bspc quit | |
super + w | |
bspc window -c | |
super + t | |
bspc desktop -l next | |
super + b | |
bspc desktop -B | |
super + {s,f} | |
bspc window -t {floating,fullscreen} | |
super + {grave,Tab} | |
bspc {window,desktop} -f last | |
super + apostrophe | |
bspc window -s last | |
super + {o,i} | |
bspc control --record-history off; \ | |
bspc window {older,newer} -f; \ | |
bspc control --record-history on | |
super + y | |
bspc window -w last.manual | |
super + m | |
bspc window -s biggest | |
super + {_,shift + }{h,j,k,l} | |
bspc window -{f,s} {left,down,up,right} | |
super + {_,shift + }c | |
bspc window -f {next,prev} | |
super + {comma,period} | |
bspc desktop -C {backward,forward} | |
super + bracket{left,right} | |
bspc desktop -f {prev,next} | |
super + ctrl + {h,j,k,l} | |
bspc window -p {left,down,up,right} | |
super + ctrl + {_,shift + }space | |
bspc {window -p cancel,desktop -c} | |
super + alt + {h,j,k,l} | |
bspc window -e {left -10,down +10,up -10,right +10} | |
super + alt + shift + {h,j,k,l} | |
bspc window -e {right -10,up +10,down -10,left +10} | |
super + ctrl + {1-9} | |
bspc window -r 0.{1-9} | |
super + {_,shift + }{1-9,0} | |
bspc {desktop -f,window -d} ^{1-9,10} | |
~button1 | |
bspc pointer -g focus | |
super + button{1-3} | |
bspc pointer -g {move,resize_side,resize_corner} | |
super + !button{1-3} | |
bspc pointer -t %i %i | |
super + @button{1-3} | |
bspc pointer -u | |
# | |
# wm independent hotkeys | |
# | |
super + Return | |
urxvt | |
super + space | |
dmenu_run | |
# make sxhkd reload its configuration files: | |
super + Escape | |
pkill -USR1 -x sxhkd | |
# | |
# my hotkeys | |
# | |
super + q | |
firefox | |
XF86AudioMute | |
amixer -c 1 sset Master toggle | |
XF86AudioLowerVolume | |
amixer -c 1 sset Master 3%- | |
XF86AudioRaiseVolume | |
amixer -c 1 sset Master 3%+ | |
XF86AudioMicMute | |
sh -c "if amixer get Capture,0 | grep -q '\[on\]' ; then amixer -q set Capture,0 nocap ; else amixer -q set Capture,0 cap; fi" | |
XF86MonBrightnessUp | |
xbacklight -inc 5% | |
XF86MonBrightnessDown | |
xbacklight -dec 5% | |
# XF86Display => F7 | |
# XF86WLAN => F8 | |
# XF86Tools => F9 | |
# XF86Search => F10 | |
# XF86LaunchA => F11 | |
# XF86Explorer => F12 | |
scrot '%Y%m%d_$wx$h.png' -e 'mv $f ~/Pictures/screenshots/' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment