summaryrefslogtreecommitdiff
path: root/.config/sway/fix_sway.sh
blob: 61a3d7217fa176a66b681c9e87fba35027647ea0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
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