summaryrefslogtreecommitdiff
path: root/.config/sway/fix_sway.sh
diff options
context:
space:
mode:
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