aboutsummaryrefslogtreecommitdiffstats
path: root/.config/herbstluftwm
diff options
context:
space:
mode:
authorkatherine <ageha@airen-no-jikken.icu>2022-12-30 11:48:11 -0700
committerkatherine <ageha@airen-no-jikken.icu>2022-12-30 11:48:11 -0700
commitdadd29d63f7d4b6cd9f4eb397bd543c6d788d185 (patch)
tree6142fa34419c0f6d8457c274839cedabacb6eb6a /.config/herbstluftwm
parentd1bf3c5d667d64bdfb3aeb1afa7553f0ea3ca666 (diff)
downloaddotfiles-dadd29d63f7d4b6cd9f4eb397bd543c6d788d185.tar.gz
use hc for panel winlist
hc using functionality added since this panel was first written? think, at least
Diffstat (limited to '.config/herbstluftwm')
-rwxr-xr-x.config/herbstluftwm/panel.sh35
1 files changed, 11 insertions, 24 deletions
diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh
index aa42a8f..d12fa77 100755
--- a/.config/herbstluftwm/panel.sh
+++ b/.config/herbstluftwm/panel.sh
@@ -75,36 +75,23 @@ update_taglist() {
}
update_winlist() {
- tag_id=$(hc get_attr tags.focus.index)
- focus_id=$(hc get_attr clients.focus.winid | sed 's/^0x0*//')
+ focus_id=$(hc get_attr clients.focus.winid)
if [[ -z "$focus_id" ]]; then
focus_id=0
fi
- lines=$(wmctrl -l | sed -e 's/^0x0*//' -e 's/\\/\\\\/g')
-
- # kind of messy. use hc dump's ordering but wmctrl -l for pairing
- # ids with titles
- for c in $(hc dump | grep -Eo '0x[0-9a-f]*' | sed 's/^0x0*//'); do
- echo "$lines" | grep "$c"
- done | while read -ra line
+ hc list_clients | while read -r c
do
- # is it focussed?
- if [[ "$((16#${line[0]}))" -eq "$((16#$focus_id))" ]]; then
- echo -n "%{B${bg_focus} F${fg_focus}} "
- else
- echo -n "%{B${bg_normal} F${fg_normal}} "
- fi
- {
- if [[ -z "${line[@]:3}" ]]; then
- echo -n "(has no name)"
- else
- echo -n "${line[@]:3}"
- fi
- } | sed -r 's/(.{37})...*/\1\.\.\./'
- echo -n " "
- done
+ [[ $(($c)) -eq $(($focus_id)) ]] \
+ && echo -n "%{B${bg_focus} F${fg_focus}} " \
+ || echo -n "%{B${bg_normal} F${fg_normal}} "
+
+ hc get_attr clients.$c.title | sed -r \
+ -e 's/^$/(has no name)/' \
+ -e 's/(.{37})...*/\1\.\.\./'
+ done | tr '\n' ' '
+
echo -n "%{B${bg_normal} F${fg_normal}}"
}