From d2da4e5d2866083b8159f57eb04da01662b0dc17 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 10 Dec 2017 14:34:27 +0100 Subject: Make dotfiles stow compatible --- bspwm/.config/bspwm/bspwmrc | 31 +++++++++++++ bspwm/.config/bspwm/panel | 100 ++++++++++++++++++++++++++++++++++++++++++ bspwm/.config/bspwm/panel_bar | 96 ++++++++++++++++++++++++++++++++++++++++ bspwm/bspwmrc | 31 ------------- bspwm/panel | 100 ------------------------------------------ bspwm/panel_bar | 96 ---------------------------------------- 6 files changed, 227 insertions(+), 227 deletions(-) create mode 100755 bspwm/.config/bspwm/bspwmrc create mode 100755 bspwm/.config/bspwm/panel create mode 100755 bspwm/.config/bspwm/panel_bar delete mode 100755 bspwm/bspwmrc delete mode 100755 bspwm/panel delete mode 100755 bspwm/panel_bar (limited to 'bspwm') diff --git a/bspwm/.config/bspwm/bspwmrc b/bspwm/.config/bspwm/bspwmrc new file mode 100755 index 0000000..1485f63 --- /dev/null +++ b/bspwm/.config/bspwm/bspwmrc @@ -0,0 +1,31 @@ +#! /bin/sh + +export PANEL_FIFO=/home/drobilla/bspwmpanel.fifo +export PANEL_HEIGHT=48 +export PANEL_FONT="DejaVu Sans Mono-16" +export TRAY_HEIGHT=28 +export SCREEN_WIDTH="$(xrandr | grep '*' | sed 's/ *\([0-9]*\)x.*/\1/')" +export TRAY_X="$(echo "$SCREEN_WIDTH - 300" | bc)" +export TRAY_Y=4 + +bspc config border_width 2 +bspc config window_gap 12 + +bspc config split_ratio 0.50 +bspc config borderless_monocle true +bspc config gapless_monocle true +bspc config focus_by_distance true + +bspc config normal_border_color "#2D3232" +bspc config focused_border_color "#6F7372" +bspc config top_padding $PANEL_HEIGHT +bspc config focus_follows_pointer true + +bspc monitor -d 1 2 3 4 5 6 7 8 9 + +hsetroot -solid "#000" +xmodmap ~/.Xmodmap +sxhkd & +#~/.config/bspwm/panel & +#stalonetray -bg "#000" --geometry "1x1+$TRAY_X+$TRAY_Y" --grow-gravity E -i $TRAY_HEIGHT & +#xdotool search --classname stalonetray windowraise diff --git a/bspwm/.config/bspwm/panel b/bspwm/.config/bspwm/panel new file mode 100755 index 0000000..ca1ae02 --- /dev/null +++ b/bspwm/.config/bspwm/panel @@ -0,0 +1,100 @@ +#! /bin/sh + +export COLOR_FOREGROUND='#FFCCCCCC' +export COLOR_BACKGROUND='#FF000000' +export COLOR_ACTIVE_MONITOR_FG='#FF000000' +export COLOR_ACTIVE_MONITOR_BG='#FF000000' +export COLOR_INACTIVE_MONITOR_FG='#FF58C5F1' +export COLOR_INACTIVE_MONITOR_BG='#FF000000' +export COLOR_FOCUSED_OCCUPIED_FG='#FFF6F9FF' +export COLOR_FOCUSED_OCCUPIED_BG='#FF000000' +export COLOR_FOCUSED_FREE_FG='#FFF6F9FF' +export COLOR_FOCUSED_FREE_BG='#FF000000' +export COLOR_FOCUSED_URGENT_FG='#FF000000' +export COLOR_FOCUSED_URGENT_BG='#FFF9A299' +export COLOR_OCCUPIED_FG='#FFA3A6AB' +export COLOR_OCCUPIED_BG='#FF000000' +export COLOR_FREE_FG='#FF6F7277' +export COLOR_FREE_BG='#FF000000' +export COLOR_URGENT_FG='#FFF9A299' +export COLOR_URGENT_BG='#FF000000' +export COLOR_LAYOUT_FG='#FFA3A6AB' +export COLOR_LAYOUT_BG='#FF000000' +export COLOR_TITLE_FG='#FFDDDDDD' +export COLOR_TITLE_BG='#FF000000' +export COLOR_STATUS_FG='#FFCCCCCC' +export COLOR_STATUS_BG='#FF000000' +export COLOR_STATUS_READ="#859900" +export COLOR_STATUS_WRITE="#990A1B" + +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" & +xtitle -sf 'T%s' > "$PANEL_FIFO" & +clock -sf 'S%a %Y-%m-%d %H:%M' > "$PANEL_FIFO" & +LC_TIME=en_DK.UTF-8 mpstat 1 | stdbuf -oL tail -n +4 | stdbuf -oL awk '$12 ~ /[0-9.]+/ { printf "L%3d\n", 100 - $12 }' > "$PANEL_FIFO" & +free -m -s 1 | stdbuf -oL awk '/^Mem:.*/ { printf "M%02d%%\n", $3 / $2 * 100 }' > "$PANEL_FIFO" & +iostat -y -d 1 | stdbuf -oL awk '/Device.*/ { printf("\nI"); next } /^[0-9a-z]* / { printf " %s %04.0f↓ %04.0f↑", $1, $3, $4 } END { printf "\n" }' > "$PANEL_FIFO" & + +# Battery +while :; do + acpi -b | sed 's/.*, /B/' > "$PANEL_FIFO" + sleep 5 +done & + +# Temperature +while :; do + cat /sys/devices/virtual/thermal/thermal_zone0/temp | sed 's/[0-9][0-9][0-9]$//' | sed 's/^/C/' > "$PANEL_FIFO" + sleep 2 +done & + +# Network throughput +while :; do + net_info=$( + ip -4 -o addr show | grep -v ' lo ' | + while read line; do + iface=$(echo $line | cut -d ' ' -f 2); + # addr=$(echo $line | cut -d ' ' -f 4 | sed 's/\/.*//'); + + if [ ! -d /sys/class/net/$iface ]; then + sleep 1; + continue; + fi + + rf=/sys/class/net/$iface/statistics/rx_bytes; + tf=/sys/class/net/$iface/statistics/tx_bytes; + + # Get RX and TX bytes then sleep for ~1 second + r1=`cat $rf`; + t1=`cat $tf`; + sleep 1 + + # Get RX and TX bytes and print rates in KBPS + r2=`cat $rf`; + t2=`cat $tf`; + rr="$(((r2-r1)/1024))"; + tr="$(((t2-t1)/1024))"; + # printf "$iface $addr %04.0f↓ %04.0f↑ " $rr $tr + printf "$iface %04.0f↓ %04.0f↑ " $rr $tr + done) + if [ -z "$net_info" ]; then + sleep 5; + else + echo "N$net_info" > "$PANEL_FIFO" + fi +done & + +#. ./panel_colors + +cat "$PANEL_FIFO" | ~/.config/bspwm/panel_bar | lemonbar -g x$PANEL_HEIGHT -f "$PANEL_FONT" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" & + +wait diff --git a/bspwm/.config/bspwm/panel_bar b/bspwm/.config/bspwm/panel_bar new file mode 100755 index 0000000..bf0fc6d --- /dev/null +++ b/bspwm/.config/bspwm/panel_bar @@ -0,0 +1,96 @@ +#! /bin/sh + +#. panel_colors + +n_monitors=$(bspc query -M | wc -l) + +while read -r line ; do + case $line in + S*) + # Clock + sys_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%{B-}%{F-}" + ;; + T*) + # Title + title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG}${line#?}%{B-}%{F-}" + ;; + I*) + # IO + io_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%{B-}%{F-}" + ;; + B*) + # Battery + bat_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%{B-}%{F-}" + ;; + C*) + # CPU temperature + temp_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}°%{B-}%{F-}" + ;; + L*) + # CPU load + load_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%%{B-}%{F-}" + ;; + M*) + # Memory usage + mem_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%{B-}%{F-}" + ;; + N*) + # Network throughput + net_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%{B-}%{F-}" + ;; + W*) + # Window manager state + wm_info="" + IFS=':' + set -- ${line#?} + while [ $# -gt 0 ] ; do + item=$1 + name=${item#?} + case $item in + M*) + # active monitor + if [ $n_monitors -gt 1 ] ; then + wm_info="$wm_info %{F$COLOR_ACTIVE_MONITOR_FG}%{B$COLOR_ACTIVE_MONITOR_BG}${name} %{B-}%{F-} " + fi + ;; + m*) + # inactive monitor + if [ $n_monitors -gt 1 ] ; then + wm_info="$wm_info %{F$COLOR_INACTIVE_MONITOR_FG}%{B$COLOR_INACTIVE_MONITOR_BG}${name}%{B-}%{F-} " + fi + ;; + O*) + # focused occupied desktop + wm_info="${wm_info}%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u}${name}%{-u}%{B-}%{F-} " + ;; + F*) + # focused free desktop + wm_info="${wm_info}%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}%{U$COLOR_FOREGROUND}%{+u}${name}%{-u}%{B-}%{F-} " + ;; + U*) + # focused urgent desktop + wm_info="${wm_info}%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}%{U$COLOR_FOREGROUND}%{+u}${name}%{-u}%{B-}%{F-} " + ;; + o*) + # occupied desktop + wm_info="${wm_info}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG}${name}%{B-}%{F-} " + ;; + f*) + # free desktop + wm_info="${wm_info}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG}${name}%{B-}%{F-} " + ;; + u*) + # urgent desktop + wm_info="${wm_info}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG}${name}%{B-}%{F-} " + ;; + L*) + # layout + wm_info="$wm_info%{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG}${name}%{B-}%{F-}" + ;; + esac + shift + done + ;; + esac + printf "%s\n" "%{l}${wm_info} cpu ${load_info} ${temp_info} mem ${mem_info} ${io_info} ${net_info} bat ${bat_info} %{c} ${title} %{r} ${sys_info}" +done diff --git a/bspwm/bspwmrc b/bspwm/bspwmrc deleted file mode 100755 index 1485f63..0000000 --- a/bspwm/bspwmrc +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/sh - -export PANEL_FIFO=/home/drobilla/bspwmpanel.fifo -export PANEL_HEIGHT=48 -export PANEL_FONT="DejaVu Sans Mono-16" -export TRAY_HEIGHT=28 -export SCREEN_WIDTH="$(xrandr | grep '*' | sed 's/ *\([0-9]*\)x.*/\1/')" -export TRAY_X="$(echo "$SCREEN_WIDTH - 300" | bc)" -export TRAY_Y=4 - -bspc config border_width 2 -bspc config window_gap 12 - -bspc config split_ratio 0.50 -bspc config borderless_monocle true -bspc config gapless_monocle true -bspc config focus_by_distance true - -bspc config normal_border_color "#2D3232" -bspc config focused_border_color "#6F7372" -bspc config top_padding $PANEL_HEIGHT -bspc config focus_follows_pointer true - -bspc monitor -d 1 2 3 4 5 6 7 8 9 - -hsetroot -solid "#000" -xmodmap ~/.Xmodmap -sxhkd & -#~/.config/bspwm/panel & -#stalonetray -bg "#000" --geometry "1x1+$TRAY_X+$TRAY_Y" --grow-gravity E -i $TRAY_HEIGHT & -#xdotool search --classname stalonetray windowraise diff --git a/bspwm/panel b/bspwm/panel deleted file mode 100755 index ca1ae02..0000000 --- a/bspwm/panel +++ /dev/null @@ -1,100 +0,0 @@ -#! /bin/sh - -export COLOR_FOREGROUND='#FFCCCCCC' -export COLOR_BACKGROUND='#FF000000' -export COLOR_ACTIVE_MONITOR_FG='#FF000000' -export COLOR_ACTIVE_MONITOR_BG='#FF000000' -export COLOR_INACTIVE_MONITOR_FG='#FF58C5F1' -export COLOR_INACTIVE_MONITOR_BG='#FF000000' -export COLOR_FOCUSED_OCCUPIED_FG='#FFF6F9FF' -export COLOR_FOCUSED_OCCUPIED_BG='#FF000000' -export COLOR_FOCUSED_FREE_FG='#FFF6F9FF' -export COLOR_FOCUSED_FREE_BG='#FF000000' -export COLOR_FOCUSED_URGENT_FG='#FF000000' -export COLOR_FOCUSED_URGENT_BG='#FFF9A299' -export COLOR_OCCUPIED_FG='#FFA3A6AB' -export COLOR_OCCUPIED_BG='#FF000000' -export COLOR_FREE_FG='#FF6F7277' -export COLOR_FREE_BG='#FF000000' -export COLOR_URGENT_FG='#FFF9A299' -export COLOR_URGENT_BG='#FF000000' -export COLOR_LAYOUT_FG='#FFA3A6AB' -export COLOR_LAYOUT_BG='#FF000000' -export COLOR_TITLE_FG='#FFDDDDDD' -export COLOR_TITLE_BG='#FF000000' -export COLOR_STATUS_FG='#FFCCCCCC' -export COLOR_STATUS_BG='#FF000000' -export COLOR_STATUS_READ="#859900" -export COLOR_STATUS_WRITE="#990A1B" - -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" & -xtitle -sf 'T%s' > "$PANEL_FIFO" & -clock -sf 'S%a %Y-%m-%d %H:%M' > "$PANEL_FIFO" & -LC_TIME=en_DK.UTF-8 mpstat 1 | stdbuf -oL tail -n +4 | stdbuf -oL awk '$12 ~ /[0-9.]+/ { printf "L%3d\n", 100 - $12 }' > "$PANEL_FIFO" & -free -m -s 1 | stdbuf -oL awk '/^Mem:.*/ { printf "M%02d%%\n", $3 / $2 * 100 }' > "$PANEL_FIFO" & -iostat -y -d 1 | stdbuf -oL awk '/Device.*/ { printf("\nI"); next } /^[0-9a-z]* / { printf " %s %04.0f↓ %04.0f↑", $1, $3, $4 } END { printf "\n" }' > "$PANEL_FIFO" & - -# Battery -while :; do - acpi -b | sed 's/.*, /B/' > "$PANEL_FIFO" - sleep 5 -done & - -# Temperature -while :; do - cat /sys/devices/virtual/thermal/thermal_zone0/temp | sed 's/[0-9][0-9][0-9]$//' | sed 's/^/C/' > "$PANEL_FIFO" - sleep 2 -done & - -# Network throughput -while :; do - net_info=$( - ip -4 -o addr show | grep -v ' lo ' | - while read line; do - iface=$(echo $line | cut -d ' ' -f 2); - # addr=$(echo $line | cut -d ' ' -f 4 | sed 's/\/.*//'); - - if [ ! -d /sys/class/net/$iface ]; then - sleep 1; - continue; - fi - - rf=/sys/class/net/$iface/statistics/rx_bytes; - tf=/sys/class/net/$iface/statistics/tx_bytes; - - # Get RX and TX bytes then sleep for ~1 second - r1=`cat $rf`; - t1=`cat $tf`; - sleep 1 - - # Get RX and TX bytes and print rates in KBPS - r2=`cat $rf`; - t2=`cat $tf`; - rr="$(((r2-r1)/1024))"; - tr="$(((t2-t1)/1024))"; - # printf "$iface $addr %04.0f↓ %04.0f↑ " $rr $tr - printf "$iface %04.0f↓ %04.0f↑ " $rr $tr - done) - if [ -z "$net_info" ]; then - sleep 5; - else - echo "N$net_info" > "$PANEL_FIFO" - fi -done & - -#. ./panel_colors - -cat "$PANEL_FIFO" | ~/.config/bspwm/panel_bar | lemonbar -g x$PANEL_HEIGHT -f "$PANEL_FONT" -F "$COLOR_FOREGROUND" -B "$COLOR_BACKGROUND" & - -wait diff --git a/bspwm/panel_bar b/bspwm/panel_bar deleted file mode 100755 index bf0fc6d..0000000 --- a/bspwm/panel_bar +++ /dev/null @@ -1,96 +0,0 @@ -#! /bin/sh - -#. panel_colors - -n_monitors=$(bspc query -M | wc -l) - -while read -r line ; do - case $line in - S*) - # Clock - sys_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%{B-}%{F-}" - ;; - T*) - # Title - title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG}${line#?}%{B-}%{F-}" - ;; - I*) - # IO - io_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%{B-}%{F-}" - ;; - B*) - # Battery - bat_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%{B-}%{F-}" - ;; - C*) - # CPU temperature - temp_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}°%{B-}%{F-}" - ;; - L*) - # CPU load - load_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%%{B-}%{F-}" - ;; - M*) - # Memory usage - mem_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%{B-}%{F-}" - ;; - N*) - # Network throughput - net_info="%{F$COLOR_STATUS_FG}%{B$COLOR_STATUS_BG}${line#?}%{B-}%{F-}" - ;; - W*) - # Window manager state - wm_info="" - IFS=':' - set -- ${line#?} - while [ $# -gt 0 ] ; do - item=$1 - name=${item#?} - case $item in - M*) - # active monitor - if [ $n_monitors -gt 1 ] ; then - wm_info="$wm_info %{F$COLOR_ACTIVE_MONITOR_FG}%{B$COLOR_ACTIVE_MONITOR_BG}${name} %{B-}%{F-} " - fi - ;; - m*) - # inactive monitor - if [ $n_monitors -gt 1 ] ; then - wm_info="$wm_info %{F$COLOR_INACTIVE_MONITOR_FG}%{B$COLOR_INACTIVE_MONITOR_BG}${name}%{B-}%{F-} " - fi - ;; - O*) - # focused occupied desktop - wm_info="${wm_info}%{F$COLOR_FOCUSED_OCCUPIED_FG}%{B$COLOR_FOCUSED_OCCUPIED_BG}%{U$COLOR_FOREGROUND}%{+u}${name}%{-u}%{B-}%{F-} " - ;; - F*) - # focused free desktop - wm_info="${wm_info}%{F$COLOR_FOCUSED_FREE_FG}%{B$COLOR_FOCUSED_FREE_BG}%{U$COLOR_FOREGROUND}%{+u}${name}%{-u}%{B-}%{F-} " - ;; - U*) - # focused urgent desktop - wm_info="${wm_info}%{F$COLOR_FOCUSED_URGENT_FG}%{B$COLOR_FOCUSED_URGENT_BG}%{U$COLOR_FOREGROUND}%{+u}${name}%{-u}%{B-}%{F-} " - ;; - o*) - # occupied desktop - wm_info="${wm_info}%{F$COLOR_OCCUPIED_FG}%{B$COLOR_OCCUPIED_BG}${name}%{B-}%{F-} " - ;; - f*) - # free desktop - wm_info="${wm_info}%{F$COLOR_FREE_FG}%{B$COLOR_FREE_BG}${name}%{B-}%{F-} " - ;; - u*) - # urgent desktop - wm_info="${wm_info}%{F$COLOR_URGENT_FG}%{B$COLOR_URGENT_BG}${name}%{B-}%{F-} " - ;; - L*) - # layout - wm_info="$wm_info%{F$COLOR_LAYOUT_FG}%{B$COLOR_LAYOUT_BG}${name}%{B-}%{F-}" - ;; - esac - shift - done - ;; - esac - printf "%s\n" "%{l}${wm_info} cpu ${load_info} ${temp_info} mem ${mem_info} ${io_info} ${net_info} bat ${bat_info} %{c} ${title} %{r} ${sys_info}" -done -- cgit v1.2.1