summaryrefslogtreecommitdiff
path: root/.local
diff options
context:
space:
mode:
authorDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-12-20 12:16:15 -0700
committerDavid Luevano Alvarado <55825613+luevano@users.noreply.github.com>2020-12-20 12:16:15 -0700
commit562ccc7d9514d60bcbc13072da6ed50e478b94f1 (patch)
tree79f578d1a8fbc76643bc1d76bf7ecd523369e6e9 /.local
parentb8e8d75bdfb7017deb46249f2b3fb9725f2713ab (diff)
Leave this bar for good, for now
Diffstat (limited to '.local')
-rwxr-xr-x.local/bin/statusbar/statusbar54
-rwxr-xr-x.local/bin/statusbar/statusbar_main (renamed from .local/bin/statusbar/statusbar_bar1)10
2 files changed, 38 insertions, 26 deletions
diff --git a/.local/bin/statusbar/statusbar b/.local/bin/statusbar/statusbar
index 7c2b0be..1bebb31 100755
--- a/.local/bin/statusbar/statusbar
+++ b/.local/bin/statusbar/statusbar
@@ -1,38 +1,54 @@
#!/bin/sh
-PANEL_FIFO=/tmp/panel-fifo
-PANEL_HEIGHT=20
-PANEL_FONT="Noto Sans Mono:size=10"
-PANEL_EMOJI_FONT0="Noto Color Emoji"
-PANEL_EMOJI_FONT1="Font Awesome 5 Free"
-PANEL_EMOJI_FONT2="Font Awesome 5 Brands"
-PANEL_EMOJI_FONT3="Font Awesome 5 Free Solid"
-PANEL_WM_NAME=bspwm_statusbar
-
-if xdo id -a "$PANEL_WM_NAME" > /dev/null ; then
+# General script that manages the statusbar/panel.
+
+STATUSBAR_FIFO=/tmp/panel-fifo
+STATUSBAR_HEIGHT=20
+STATUSBAR_FONT="Noto Sans Mono:size=10"
+STATUSBAR_EMOJI_FONT0="Noto Color Emoji"
+STATUSBAR_EMOJI_FONT1="Font Awesome 5 Free"
+STATUSBAR_EMOJI_FONT2="Font Awesome 5 Brands"
+STATUSBAR_EMOJI_FONT3="Font Awesome 5 Free Solid"
+STATUSBAR_WM_NAME=bspwm_statusbar
+. statusbar_colors
+
+
+if xdo id -a "$STATUSBAR_WM_NAME" > /dev/null ; then
printf "%s\n" "The status bar is already running. Try pkill -x statusbar." >&2
exit 1
fi
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
-[ -e "$PANEL_FIFO" ] && rm "$PANEL_FIFO"
-mkfifo "$PANEL_FIFO"
-xtitle -sf 'T%s\n' > "$PANEL_FIFO" &
-# date +"S%d/%m%y %r" > "$PANEL_FIFO" &
-bspc subscribe report > "$PANEL_FIFO" &
+# Create a new FIFO. (Pipe)
+[ -e "$STATUSBAR_FIFO" ] && rm "$STATUSBAR_FIFO"
+mkfifo "$STATUSBAR_FIFO"
-. statusbar_colors
-statusbar_bar1 < "$PANEL_FIFO" | lemonbar -a 32 -u 2 -n "$PANEL_WM_NAME" -g x$PANEL_HEIGHT -f "$PANEL_FONT" -f "$PANEL_EMOJI_FONT0" -f "$PANEL_EMOJI_FONT1" -f "$PANEL_EMOJI_FONT2" -f "$PANEL_EMOJI_FONT3" -F "$COLOR_DEFAULT_FG" -B "$COLOR_DEFAULT_BG" | sh &
+# Here is where all the 'plugins' or 'blocks' for the statusbar
+# are run. They're piped into the FIFO for later reading.
+# In general you want them to print a letter at the beginning and then
+# the actual stuff to show on scren, so you can distinguish between them on the actual bars.
+xtitle -sf 'T%s\n' > "$STATUSBAR_FIFO" &
+# date +"C%d/%m%y %r" > "$STATUSBAR_FIFO" &
+bspc subscribe report > "$STATUSBAR_FIFO" &
+
+
+# Here you can start N amount of bars and each one would be
+# different if required. Piping into 'sh' is required for interaction
+# with the bar.
+statusbar_main < "$STATUSBAR_FIFO" | lemonbar -a 32 -u 2 -n "$STATUSBAR_WM_NAME" -g x$STATUSBAR_HEIGHT -f "$STATUSBAR_FONT" -f "$STATUSBAR_EMOJI_FONT0" -f "$STATUSBAR_EMOJI_FONT1" -f "$STATUSBAR_EMOJI_FONT2" -f "$STATUSBAR_EMOJI_FONT3" -F "$COLOR_DEFAULT_FG" -B "$COLOR_DEFAULT_BG" | sh &
+
# This only really works for one monitor.
-# wid=$(xdo id -m -a "$PANEL_WM_NAME")
+# wid=$(xdo id -m -a "$STATUSBAR_WM_NAME")
# xdo above -t "$(xdo id -N Bspwm -n root | sort | head -n 1)" "$wid"
+# Set the bar only on top of the 'root' window, which is bspwm itself.
+# This, so you can fullscreen a program and it stays on top.
bspid="$(xdo id -N Bspwm -n root | sort | head -n 1)"
# The first part of the pipe is the "wid"
-xdo id -m -a "$PANEL_WM_NAME" | while read wid; do
+xdo id -m -a "$STATUSBAR_WM_NAME" | while read wid; do
xdo above -t "$bspid" "$wid"
done
diff --git a/.local/bin/statusbar/statusbar_bar1 b/.local/bin/statusbar/statusbar_main
index 16297ef..7cf27db 100755
--- a/.local/bin/statusbar/statusbar_bar1
+++ b/.local/bin/statusbar/statusbar_main
@@ -2,16 +2,12 @@
. statusbar_colors
-num_mon=$(bspc query -M | wc -l)
-
while read -r line ; do
case $line in
- S*)
- # clock output
- sys="%{F$COLOR_SYS_FG}%{B$COLOR_SYS_BG} ${line#?} %{B-}%{F-}"
+ C*)
+ clock="%{F$COLOR_SYS_FG}%{B$COLOR_SYS_BG} ${line#?} %{B-}%{F-}"
;;
T*)
- # xtitle output
title="%{F$COLOR_TITLE_FG}%{B$COLOR_TITLE_BG} ${line#?} %{B-}%{F-}"
;;
W*)
@@ -112,5 +108,5 @@ while read -r line ; do
done
;;
esac
- printf "%s\n" "%{l}${wm}%{c}${title}%{r}${sys}"
+ printf "%s\n" "%{l}${wm}%{c}${title}%{r}${clock}"
done