blob: cf85b969d86443dac539e7986452f380fa5d6eeb (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#!/bin/sh
# From https://github.com/tardypad/dotfiles/blob/1ea889a6d98b44d97fcf183e97ec2933dafef8b2/files/scripts/sway/sway-subscribe-events-run#L3
# Working on rewrite of https://aduros.com/blog/hacking-i3-automatic-layout/
# and potentionally even https://aduros.com/blog/hacking-i3-window-promoting/
{
swaymsg -t subscribe -m '[ "workspace" ]' |
while read -r EVENT; do
CHANGE=$( echo "${EVENT}" | jq -r '.change' )
if [ "${CHANGE}" != 'focus' ] \
&& [ "${CHANGE}" != 'urgent' ]; then
sway-renumber-workspaces
fi
if [ "${CHANGE}" = 'focus' ] \
|| [ "${CHANGE}" = 'move' ]; then
pkill -x -RTMIN+8 i3blocks
fi
done
}&
{
swaymsg -t subscribe -m '[ "window" ]' |
jq --unbuffered 'select(.change == "focus").container.id' |
while read -r CURRENT_WINDOW; do
pkill -x -RTMIN+8 i3blocks
swaymsg "[con_id=${PREV_WINDOW}] mark --add _prev" > /dev/null
PREV_WINDOW="${CURRENT_WINDOW}"
done
}&
|