diff --git a/bspwm/bspwmrc b/bspwm/bspwmrc new file mode 100755 index 0000000..4abd557 --- /dev/null +++ b/bspwm/bspwmrc @@ -0,0 +1,21 @@ +#!/bin/sh + +bspc config border_width 2 +bspc config window_gap 5 + +bspc config split_ratio 0.5 +bspc config borderless_monocle true +bspc config gapless_monocle true +bspc config focus_by_distance true +bspc config focus_follows_pointer true + +bspc config initial_polarity second_child + +bspc monitor -d 1 2 3 4 5 6 7 8 9 10 + +echo 'xss-lock' +xss-lock -- i3lock -e -i ~/images/lockscreen.png & +echo 'nitrogen' +nitrogen --restore & +echo 'panel' +$PANEL_CONFIG_DIR/panel & diff --git a/etc/.profile b/etc/.profile index 01f8125..2401c2c 100644 --- a/etc/.profile +++ b/etc/.profile @@ -3,3 +3,11 @@ export VISUAL=$EDITOR export WORKON_HOME=$HOME/.virtualenvs source /usr/bin/virtualenvwrapper.sh + +export XDG_CONFIG_HOME=$HOME/.config + +PANEL_CONFIG_DIR=$XDG_CONFIG_HOME/panel +PANEL_FIFO=/tmp/panel-fifo +PANEL_HEIGHT=24 +PANEL_FONT_FAMILY="-*-terminus-medium-r-normal-*-12-*-*-*-c-*-*-1" +export PANEL_FIFO PANEL_HEIGHT PANEL_FONT_FAMILY PANEL_CONFIG_DIR diff --git a/install.conf.yaml b/install.conf.yaml index 5bf9a2c..656068d 100644 --- a/install.conf.yaml +++ b/install.conf.yaml @@ -19,3 +19,6 @@ ~/.urlview: urlview/.urlview ~/.config/user-dirs.dirs: etc/user-dirs.dirs ~/.tmux.conf: tmux/.tmux.conf + ~/.config/bspwm: bspwm/ + ~/.config/sxhkd: sxhkd/ + ~/.config/panel: panel/ diff --git a/panel/battery b/panel/battery new file mode 100755 index 0000000..679359a --- /dev/null +++ b/panel/battery @@ -0,0 +1,12 @@ +#!/bin/sh + +prefix=$1 +suffix=$2 + +while [ true ]; do + echo -n "$prefix" + echo -n $(acpi --battery | cut -d, -f2 | tr -d ' ') + echo -n "$suffix" + echo + sleep 1s +done diff --git a/panel/clock b/panel/clock new file mode 100755 index 0000000..e18a7a2 --- /dev/null +++ b/panel/clock @@ -0,0 +1,11 @@ +#/bin/sh + +prefix=$1 +format=$2 + +while [ true ]; do + echo -n "$prefix" + echo -n $(date "$format") + echo + sleep 1s +done diff --git a/panel/panel b/panel/panel new file mode 100755 index 0000000..7e28041 --- /dev/null +++ b/panel/panel @@ -0,0 +1,28 @@ +#!/bin/sh + +PATH=$PATH:"$PANEL_CONFIG_DIR" + +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 bottom_padding $PANEL_HEIGHT +bspc control --subscribe > "$PANEL_FIFO" & +sleep 0.3s +clock 'C' '+%a %H:%M:%S' > "$PANEL_FIFO" & +sleep 0.3s +battery 'B' '%' > "$PANEL_FIFO" & +sleep 0.3s +volume 'V' '%' > "$PANEL_FIFO" & + +source panel_colors + +cat "$PANEL_FIFO" | panel_bar | lemonbar -g x$PANEL_HEIGHT -f "$PANEL_FONT_FAMILY" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" -b & + +wait diff --git a/panel/panel_bar b/panel/panel_bar new file mode 100755 index 0000000..6c47e13 --- /dev/null +++ b/panel/panel_bar @@ -0,0 +1,80 @@ +#!/bin/sh +# +# Example panel for LemonBoy's bar + +source "$PANEL_CONFIG_DIR/panel_colors" + +num_mon=$(bspc query -M | wc -l) + +divider=' | ' + +while read -r line ; do + case $line in + C*) + # clock output + sys_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?} %{B-}%{F-}" + ;; + 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} ${name} %{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} ${name} %{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} ${name} %{-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} ${name} %{-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} ${name} %{-u}%{B-}%{F-}" + ;; + o*) + # occupied desktop + wm_infos="${wm_infos}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG} ${name} %{B-}%{F-}" + ;; + f*) + # free desktop + # wm_infos="${wm_infos}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG} ${name} %{B-}%{F-}" + ;; + u*) + # urgent desktop + wm_infos="${wm_infos}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG} ${name} %{B-}%{F-}" + ;; + L*) + # layout + # wm_infos="$wm_infos %{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG} ${name} %{B-}%{F-}" + ;; + esac + shift + done + ;; + B*) + # battery output + battery_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?} %{B-}%{F-}" + ;; + V*) + # volume output + volume_infos="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG} ${line#?} %{B-}%{F-}" + ;; + esac + printf "%s\n" "%{l}${wm_infos}%{c}${title}%{r}${battery_infos}${divider}${volume_infos}${divider}${sys_infos}" +done diff --git a/panel/panel_colors b/panel/panel_colors new file mode 100644 index 0000000..a7fad64 --- /dev/null +++ b/panel/panel_colors @@ -0,0 +1,24 @@ +COLOR_FOREGROUND='#FFA3A6AB' +COLOR_BACKGROUND='#FF34322E' +COLOR_ACTIVE_MONITOR_FG='#FF34322E' +COLOR_ACTIVE_MONITOR_BG='#FF58C5F1' +COLOR_INACTIVE_MONITOR_FG='#FF58C5F1' +COLOR_INACTIVE_MONITOR_BG='#FF34322E' +COLOR_FOCUSED_OCCUPIED_FG='#FFF6F9FF' +COLOR_FOCUSED_OCCUPIED_BG='#FF5C5955' +COLOR_FOCUSED_FREE_FG='#FFF6F9FF' +COLOR_FOCUSED_FREE_BG='#FF6D561C' +COLOR_FOCUSED_URGENT_FG='#FF34322E' +COLOR_FOCUSED_URGENT_BG='#FFF9A299' +COLOR_OCCUPIED_FG='#FFA3A6AB' +COLOR_OCCUPIED_BG='#FF34322E' +COLOR_FREE_FG='#FF6F7277' +COLOR_FREE_BG='#FF34322E' +COLOR_URGENT_FG='#FFF9A299' +COLOR_URGENT_BG='#FF34322E' +COLOR_LAYOUT_FG='#FFA3A6AB' +COLOR_LAYOUT_BG='#FF34322E' +COLOR_TITLE_FG='#FFA3A6AB' +COLOR_TITLE_BG='#FF34322E' +COLOR_STATUS_FG='#FFA3A6AB' +COLOR_STATUS_BG='#FF34322E' diff --git a/panel/volume b/panel/volume new file mode 100755 index 0000000..8a2d0b6 --- /dev/null +++ b/panel/volume @@ -0,0 +1,16 @@ +#/bin/sh + +prefix=$1 +suffix=$2 + +while [ true ]; do + echo -n "$prefix" + volume=$( + pulseaudio-ctl | grep 'Volume level' | cut -d: -f2 | tr -d ' ' \ + | sed -r "s/\x1B\[([0-9]{1,2}(;[0-9]{1,2})?)?[m|K]//g" + ) + echo -n $volume + echo -n "$suffix" + echo + sleep 1 +done diff --git a/sxhkd/sxhkdrc b/sxhkd/sxhkdrc new file mode 100644 index 0000000..10a56c3 --- /dev/null +++ b/sxhkd/sxhkdrc @@ -0,0 +1,94 @@ +# +# bspwm hotkeys +# + +super + alt + Escape + pkill -x panel; bspc quit + +super + shift + q + 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 + +super + shift + semicolon + i3lock -e -i ~/images/lockscreen.png