summaryrefslogtreecommitdiff
path: root/.config/sway/fix_sway.sh
diff options
context:
space:
mode:
authorJoe Rayhawk <jrayhawk@fairlystable.org>2024-09-10 18:25:25 -0700
committerJoe Rayhawk <jrayhawk@fairlystable.org>2024-09-10 18:31:04 -0700
commitaa661ce61b9f3ff83615d4da8b6b782a7bbaa3c4 (patch)
treea54dd6ddcda0992fcec5670787847fbf8e3b4cbb /.config/sway/fix_sway.sh
downloadjrayhawk-dotfiles-aa661ce61b9f3ff83615d4da8b6b782a7bbaa3c4.tar.gz
jrayhawk-dotfiles-aa661ce61b9f3ff83615d4da8b6b782a7bbaa3c4.zip
Initial gitignore and wlroots session management
Diffstat (limited to '.config/sway/fix_sway.sh')
-rwxr-xr-x.config/sway/fix_sway.sh20
1 files changed, 20 insertions, 0 deletions
diff --git a/.config/sway/fix_sway.sh b/.config/sway/fix_sway.sh
new file mode 100755
index 0000000..61a3d72
--- /dev/null
+++ b/.config/sway/fix_sway.sh
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+sway "$(
+ swaymsg -p -t get_outputs \
+ | sway-output-parse.sh --mode \
+ | sed -ne s/1024x768@.........Hz/1280x1024@60Hz/p \
+ | head -n 1
+)"
+
+# shove the last active unnamed DP monitor downward by a monitor's-worth
+
+dp_regex="^output +(DP-[0-9]) +mode +--custom +1280x1024@.+Hz +pos +([0-9]+) +([0-9]+)"
+
+IFS=$'\n'
+
+line="$( swaymsg -p -t get_outputs | sway-output-parse.sh --basic | egrep " DP-[0-9] +mode " | tail -n 1 )"
+
+if [[ "$line" =~ $dp_regex ]]; then
+ sway "output "${BASH_REMATCH[1]}" pos $(( ${BASH_REMATCH[2]} )) $(( ${BASH_REMATCH[3]} + 1024 ))"
+fi