diff --git a/yambar/.config/yambar/config.yml b/yambar/.config/yambar/config.yml index 1a3d426..cc184a9 100644 --- a/yambar/.config/yambar/config.yml +++ b/yambar/.config/yambar/config.yml @@ -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: diff --git a/yambar/.config/yambar/title.sh b/yambar/.config/yambar/title.sh new file mode 100755 index 0000000..eafa652 --- /dev/null +++ b/yambar/.config/yambar/title.sh @@ -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