Browse Source

Move panel variables to zprofile

master
Riyyi 6 years ago
parent
commit
95b1292562
  1. 5
      .config/zsh/.zprofile
  2. 3
      .scripts/panel/brightness.sh
  3. 36
      .scripts/panel/lemonbar.sh
  4. 3
      .scripts/panel/volume.sh

5
.config/zsh/.zprofile

@ -32,6 +32,11 @@ export LESS_TERMCAP_se="$(printf '%b' '\e[0m')" # reset reverse video
export LESS_TERMCAP_us="$(printf '%b' '\e[04;95m')" # begin underline
export LESS_TERMCAP_ue="$(printf '%b' '\e[0m')" # reset underline
# Panel
export PANEL_HEIGHT=38
export PANEL_NAME="lemonbar_panel"
export PANEL_PIPE="/tmp/lemonbar_pipe"
# Qt5
export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCREEN_SCALE_FACTORS=2

3
.scripts/panel/brightness.sh

@ -19,6 +19,5 @@ fi
INPUT="%{$R}%{$U}%{$D}"
END="%{A}%{A}%{A}"
PIPE="$("$(dirname "$0")"/lemonbar.sh get_pipe)"
printf "%s\n" "brightness$INPUT$ICON $PERCENTAGE%$END" > "$PIPE" &
printf "%s\n" "brightness$INPUT$ICON $PERCENTAGE%$END" > "$PANEL_PIPE" &

36
.scripts/panel/lemonbar.sh

@ -1,9 +1,5 @@
#!/bin/sh
PIPE="/tmp/lemonbar_pipe"
PANEL="lemonbar_panel"
PANEL_HEIGHT=38
title() {
# Grab focused window's ID
if [ -n "$1" ]; then
@ -35,7 +31,7 @@ clock() {
bar() {
lemonbar \
-a 20 -g x$PANEL_HEIGHT -n "$PANEL" \
-a 20 -g x$PANEL_HEIGHT -n "$PANEL_NAME" \
-f "DejaVu Sans-8" -o 0 \
-f "FontAwesome5Free Solid-8" -o -3 \
-f "FontAwesome5Free Regular-8" -o -3 \
@ -53,8 +49,8 @@ start() {
trap 'trap - TERM; kill 0' INT TERM QUIT EXIT
# Create named pipe
[ -p $PIPE ] && rm "$PIPE"
mkfifo "$PIPE"
[ -p $PANEL_PIPE ] && rm "$PANEL_PIPE"
mkfifo "$PANEL_PIPE"
# Directory of this script
DIR="$(dirname "$0")"
@ -62,23 +58,23 @@ start() {
# Setup workspaces block with xprop events
xprop -root -spy _NET_CURRENT_DESKTOP _NET_NUMBER_OF_DESKTOPS | while read -r line; do
"$DIR"/workspaces.sh
done > "$PIPE" &
done > "$PANEL_PIPE" &
# Setup window title block with xprop events
xprop -root -spy '\t$0\n' _NET_ACTIVE_WINDOW | while read -r line; do
title "$line"
done > "$PIPE" &
done > "$PANEL_PIPE" &
# Setup interrupt blocks
"$DIR"/volume.sh
"$DIR"/brightness.sh
# Setup block timers
while :; do title; sleep 1; done > "$PIPE" &
while :; do "$DIR"/wifi.sh; sleep 10; done > "$PIPE" &
while :; do "$DIR"/iface.sh; sleep 10; done > "$PIPE" &
while :; do "$DIR"/battery.sh; sleep 30; done > "$PIPE" &
while :; do clock; sleep 5; done > "$PIPE" &
while :; do title; sleep 1; done > "$PANEL_PIPE" &
while :; do "$DIR"/wifi.sh; sleep 10; done > "$PANEL_PIPE" &
while :; do "$DIR"/iface.sh; sleep 10; done > "$PANEL_PIPE" &
while :; do "$DIR"/battery.sh; sleep 30; done > "$PANEL_PIPE" &
while :; do clock; sleep 5; done > "$PANEL_PIPE" &
while read -r line ; do
case $line in
@ -108,21 +104,13 @@ start() {
;;
esac
printf "%s\n" "%{l}$workspaces%{c}$title%{r}$volume $brightness $wifi $iface $battery $clock "
done < "$PIPE" | bar | sh &
done < "$PANEL_PIPE" | bar | sh &
wait
}
get_height() {
printf "%s" "$PANEL_HEIGHT"
}
get_pipe() {
printf "%s" "$PIPE"
}
case "$1" in
start | get_height | get_pipe)
start)
"$1"
;;
"")

3
.scripts/panel/volume.sh

@ -30,6 +30,5 @@ fi
INPUT="%{$L}%{$S}%{$R}%{$U}%{$D}"
END="%{A}%{A}%{A}%{A}%{A}"
PIPE="$("$(dirname "$0")"/lemonbar.sh get_pipe)"
printf "%s\n" "volume%{F$COLOR}$INPUT$SYMBOL $VOLUME%$END%{F-}" > "$PIPE" &
printf "%s\n" "volume%{F$COLOR}$INPUT$SYMBOL $VOLUME%$END%{F-}" > "$PANEL_PIPE" &

Loading…
Cancel
Save