1
0
forked from extern/nix-config

yambar: Add title script

This commit is contained in:
Donovan Glover 2023-05-02 21:36:33 -04:00
parent 6da8592a15
commit 971ce5fb63
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65
2 changed files with 29 additions and 6 deletions

View File

@ -23,13 +23,17 @@ bar:
left-margin: *BMARGIN
center:
-
foreign-toplevel:
script:
path: /home/donovan/.config/yambar/title.sh
args: []
content:
map:
conditions:
~activated: {empty: {}}
activated:
- string: {text: "{title}", max: 90, on-click: 'notify-send "app-id" "{app-id}"'}
string:
on-click:
left: sh -c '~/.config/hypr/swapmaster.sh'
right: sh -c 'hyprctl dispatch movetoworkspace special'
middle: sh -c 'hyprctl dispatch killactive'
text: "{title}"
max: 90
right:
-
battery:

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

19
yambar/.config/yambar/title.sh Executable file
View File

@ -0,0 +1,19 @@
#!/bin/bash
declare title
# LATER: Use hyprevents instead of while true
while true; do
title="$(hyprctl activewindow -j | jq -r '.title')"
if [[ "$title" == "null" ]]; then
title="$(mpc status | head -n 1)"
fi
printf -- '%s\n' "title|string|${title}"
printf -- '%s\n' ""
sleep 0.1
done
unset title