Advertisement
Guest User

Untitled

a guest
Oct 16th, 2019
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. #!/bin/bash
  2. RES="$1"
  3. #p.e. RES=640x480@60Hz
  4. CMD=${@:2}
  5. ACTIVE_OUTPUT=$(swaymsg -t get_outputs -r | egrep "name|focused" | grep -C 1 '"focused": true' | head -n 1 | sed 's/.*name": "\(.*\)".$/\1/g' )
  6. #RESOLUTION=$(xdpyinfo | awk '/dimensions:/ { print $2 }')
  7. CUR_RESOLUTION=$(swaymsg -t get_outputs --pretty | grep 'focused' -C 2 | grep "Current mode" | sed "s/.*:\(.*\)$/\1/"| tr -d ' ')
  8. wlr-randr --output $ACTIVE_OUTPUT --custom-mode $RES
  9. $CMD &
  10. PID=$!
  11. sleep 1
  12. WID=$(xdotool search -all --pid $PID)
  13. xdotool set_window --class "fullscreenapp" $WID
  14. swaymsg "[class=\"fullscreenapp\"]" fullscreen enable
  15. wait "$PID"
  16. wlr-randr --output $ACTIVE_OUTPUT --custom-mode $CUR_RESOLUTION
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement