summaryrefslogtreecommitdiff
path: root/.local/bin/statusbar/lemonbar_panel
blob: c4f400f51ee14cb7ddd60f4ee59abd86488491a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/bin/sh
# General script that manages the bar.

STATUSBAR_FIFO=/tmp/lemonbar-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_lemonbar_panel
. lemonbar_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 bar.
# 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.
lemonbar_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