From b0a8649d522ca19ed9a85090a915a0709b916e85 Mon Sep 17 00:00:00 2001 From: David Luevano Alvarado <55825613+luevano@users.noreply.github.com> Date: Sun, 20 Dec 2020 12:18:39 -0700 Subject: Rename status bar to panel --- .local/bin/statusbar/panel | 55 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100755 .local/bin/statusbar/panel (limited to '.local/bin/statusbar/panel') diff --git a/.local/bin/statusbar/panel b/.local/bin/statusbar/panel new file mode 100755 index 0000000..c54338b --- /dev/null +++ b/.local/bin/statusbar/panel @@ -0,0 +1,55 @@ +#!/bin/sh +# General script that manages the panel/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_panel +. panel_colors + + +if xdo id -a "$STATUSBAR_WM_NAME" > /dev/null ; then + printf "%s\n" "The status bar is already running. Try pkill -x panel." >&2 + exit 1 +fi + +trap 'trap - TERM; kill 0' INT TERM QUIT EXIT + + +# Create a new FIFO. (Pipe) +[ -e "$STATUSBAR_FIFO" ] && rm "$STATUSBAR_FIFO" +mkfifo "$STATUSBAR_FIFO" + + +# Here is where all the 'plugins' or 'blocks' for the panel +# 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. +panel_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 "$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 "$STATUSBAR_WM_NAME" | while read wid; do + xdo above -t "$bspid" "$wid" +done + +wait -- cgit v1.2.3-54-g00ecf