aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/i3blocks/.local/bin/i3blocks-title
blob: c014adcbf341bc6d1640a41eb034fde762bdf7d2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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
'