aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sway/.local
diff options
context:
space:
mode:
authorToby Vincent <tobyv@tobyvin.dev>2024-10-05 13:25:34 -0500
committerToby Vincent <tobyv@tobyvin.dev>2024-10-05 13:25:34 -0500
commit49af7de8ce8d83bd0d8766cb91bd83f4117cb340 (patch)
tree45d8f8663f47ade9bc9792be66ed7e25bdc818e6 /sway/.local
parent23c03cd2fde16eeaac9a0647f70d89f1f9661fcc (diff)
fix(sway): import env vars and add vrr script
Diffstat (limited to 'sway/.local')
-rwxr-xr-xsway/.local/bin/import-gsettings (renamed from sway/.local/lib/sway/import-gsettings)0
-rwxr-xr-xsway/.local/bin/sway-vrr24
2 files changed, 24 insertions, 0 deletions
diff --git a/sway/.local/lib/sway/import-gsettings b/sway/.local/bin/import-gsettings
index 93cd75b..93cd75b 100755
--- a/sway/.local/lib/sway/import-gsettings
+++ b/sway/.local/bin/import-gsettings
diff --git a/sway/.local/bin/sway-vrr b/sway/.local/bin/sway-vrr
new file mode 100755
index 0000000..e989ce9
--- /dev/null
+++ b/sway/.local/bin/sway-vrr
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+swaymsg -t subscribe -m '[ "window" ]' |
+ jq -c --unbuffered 'select(.change == "focus" or .change == "fullscreen_mode") | .container |
+ if .fullscreen_mode == 1 then
+ { "id": .id, "sync": "enabled", "rt": 1 }
+ else
+ { "id": .id, "sync": "disabled", "rt": 0 }
+ end' |
+ while read -r vals; do
+ swaymsg -t get_tree | jq -r --argjson vals "$vals" --arg regex "$1" '.nodes[] |
+ select((.. | .nodes?[]?.nodes?[]?.id == $vals.id) and (.name | test($regex))) |
+ if .adaptive_sync_status != $vals.sync then
+ [ .name, "adaptive_sync", $vals.sync ] | @sh
+ else
+ empty
+ end,
+ if .max_render_time != $vals.rt then
+ [ .name, "max_render_time", ($vals.rt | if . == 0 then "off" else . end) ] | @sh
+ else
+ empty
+ end'
+ done |
+ xargs -l1 swaymsg output