diff options
author | Toby Vincent <tobyv@tobyvin.dev> | 2024-10-07 13:30:57 -0500 |
---|---|---|
committer | Toby Vincent <tobyv@tobyvin.dev> | 2024-10-07 13:30:57 -0500 |
commit | e842d34c9ae3a48a78bbcaa5b9fc58216e1d49a6 (patch) | |
tree | 9b3b9c8883f5536fddf736a93c29e3dc1dab9446 /i3blocks/.local/bin/i3blocks-title | |
parent | 59dcb091288d60e8c2d2e352711b72f4beeb1ddf (diff) |
refactor(i3blocks): move i3blocks to bin dir
Diffstat (limited to 'i3blocks/.local/bin/i3blocks-title')
-rwxr-xr-x | i3blocks/.local/bin/i3blocks-title | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/i3blocks/.local/bin/i3blocks-title b/i3blocks/.local/bin/i3blocks-title new file mode 100755 index 0000000..c014adc --- /dev/null +++ b/i3blocks/.local/bin/i3blocks-title @@ -0,0 +1,17 @@ +#!/bin/sh + +into_block='{ + "full_text": (.name[0:50] // ""), + "short_text": ([.app_id, .window_title, .name] | map(select(. != null and . != "")) | (first // "") | .[0:25]), +}' + +swaymsg -t get_tree | jq -c '.. | select(.focused? == true and .type == "con") | '"$into_block" + +swaymsg --monitor -t subscribe '["window", "workspace"]' | jq -c --unbuffered ' + select((.change | test("close|focus|title")) and (.current.type == "workspace" or .container.focused)) | + if .current.type == "workspace" or .change == "close" then + { "full_text": "" } + else + .container | '"$into_block"' + end +' |