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_us="$(printf '%b' '\e[04;95m')" # begin underline
export LESS_TERMCAP_ue="$(printf '%b' '\e[0m')" # reset 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 # Qt5
export QT_AUTO_SCREEN_SCALE_FACTOR=0 export QT_AUTO_SCREEN_SCALE_FACTOR=0
export QT_SCREEN_SCALE_FACTORS=2 export QT_SCREEN_SCALE_FACTORS=2

3
.scripts/panel/brightness.sh

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

3
.scripts/panel/volume.sh

@ -30,6 +30,5 @@ fi
INPUT="%{$L}%{$S}%{$R}%{$U}%{$D}" INPUT="%{$L}%{$S}%{$R}%{$U}%{$D}"
END="%{A}%{A}%{A}%{A}%{A}" 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