aboutsummaryrefslogtreecommitdiff
path: root/.config
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2021-03-08 13:47:25 +0100
committerPatrick Spek <p.spek@tyil.nl>2021-08-14 12:01:15 +0200
commitb424b8f40c3b4f3b0d8ae6629f170f1431bb12e6 (patch)
tree6dde9ef9157098ab829537b7b6be543706132758 /.config
parentf4439fb9bb24edbb75437a31600dc5080207a1c3 (diff)
Add a tray to hlwm
Diffstat (limited to '.config')
-rwxr-xr-x.config/herbstluftwm/autostart23
-rwxr-xr-x.config/herbstluftwm/panel-top.sh6
2 files changed, 25 insertions, 4 deletions
diff --git a/.config/herbstluftwm/autostart b/.config/herbstluftwm/autostart
index 69c6d40..9d36317 100755
--- a/.config/herbstluftwm/autostart
+++ b/.config/herbstluftwm/autostart
@@ -86,6 +86,8 @@ hc mousebind $Mod-Button2 zoom
hc mousebind $Mod-Button3 resize
# focus
+hc set focus_follows_mouse 1
+
hc keybind $Mod-Control+j cycle_monitor -1
hc keybind $Mod-Control+k cycle_monitor +1
hc keybind $Mod-Tab cycle_all +1
@@ -149,7 +151,7 @@ hc unlock
# or simply:
hc detect_monitors
-# find the top panel
+# Handle panels
panel_top=~/.config/herbstluftwm/panel-top.sh
[ -x "$panel_top" ] || panel_top=/etc/xdg/herbstluftwm/panel.sh
@@ -163,3 +165,22 @@ for monitor in $(hc list_monitors | cut -d: -f1) ; do
"$panel_top" "$monitor" &
"$panel_bot" "$monitor" &
done
+
+# Handle tray
+if command -v stalonetray > /dev/null
+then
+ tray_monitor_offset=$(hc monitor_rect 0 | awk '{ print $1 }')
+ tray_monitor_width=$(hc monitor_rect 0 | awk '{ print $3 }')
+ tray_date_offset=$(xftwidth "Liberation Mono:size=9" "$(date +"%F %H:%M")")
+ tray_offset_x=$(( tray_monitor_offset + tray_monitor_width - tray_date_offset - 40 ))
+
+ stalonetray \
+ --grow-gravity E \
+ --icon-size 16 \
+ --parent-bg \
+ --config /dev/null \
+ --skip-taskbar \
+ --sticky \
+ --geometry "1x1+$tray_offset_x+2" \
+ &
+fi
diff --git a/.config/herbstluftwm/panel-top.sh b/.config/herbstluftwm/panel-top.sh
index 536f674..976968c 100755
--- a/.config/herbstluftwm/panel-top.sh
+++ b/.config/herbstluftwm/panel-top.sh
@@ -72,7 +72,7 @@ fi
while true ; do
# "date" output is checked once a second, but an event is only
# generated if the output changed compared to the previous run.
- date +$'date\t^fg(#efefef)%H:%M^fg(#909090), %Y-%m-^fg(#efefef)%d'
+ date +$'date\t^fg(#909090)%F ^fg(#efefef)%H:%M'
sleep 1 || break
done > >(uniq_linebuffered) &
childpid=$!
@@ -121,10 +121,10 @@ fi
echo -n "$separator"
echo -n "^bg()^fg() ${windowtitle//^/^^}"
# small adjustments
- right="$separator^bg() $date $separator"
+ right="$separator^bg() $date"
right_text_only=$(echo -n "$right" | sed 's.\^[^(]*([^)]*)..g')
# get width of right aligned text.. and add some space..
- width=$($textwidth "$font" "$right_text_only ")
+ width=$($textwidth "$font" "$right_text_only ")
echo -n "^pa($(($panel_width - $width)))$right"
echo