mirror of
https://github.com/swaywm/sway.git
synced 2024-11-14 14:34:07 +01:00
Created Tricks (markdown)
parent
16871c9a52
commit
68cfee1268
29
Tricks.md
Normal file
29
Tricks.md
Normal file
@ -0,0 +1,29 @@
|
||||
# Get workspace dimensions
|
||||
|
||||
swaymsg -t get_outputs | jq -r '.[] | select(.focused) | (.current_mode.width | tostring) + "x" + (.current_mode.height | tostring)'
|
||||
|
||||
|
||||
# Tamefox - suspend Firefox when loses focus
|
||||
```
|
||||
#!/bin/sh
|
||||
firefox=
|
||||
swaymsg -m -t subscribe '["window"]' | \
|
||||
jq -r --unbuffered '.change +" "+ .container.app_id + " " + (.container.pid | tostring)' | \
|
||||
grep --line-buffered '^focus ' | \
|
||||
while read -r x app pid; do
|
||||
#echo "# x=$x app=$app pid=$pid" >&2
|
||||
if [ "$app" = 'firefox' ]; then
|
||||
echo "CONT $pid" >&2
|
||||
firefox=$pid
|
||||
kill -CONT $pid
|
||||
pkill -CONT -P $pid
|
||||
elif [ -n "$firefox" ]; then
|
||||
echo "STOP $firefox" >&2
|
||||
pkill -STOP -P $firefox
|
||||
kill -STOP $firefox
|
||||
fi
|
||||
done
|
||||
```
|
||||
save it as `$HOME/bin/tamefox` and add this to your `.config/sway/config`:
|
||||
|
||||
exec [ -x $HOME/bin/tamefox ] && $HOME/bin/tamefox
|
Loading…
Reference in New Issue
Block a user