-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsunshine-sway
More file actions
executable file
·44 lines (36 loc) · 968 Bytes
/
sunshine-sway
File metadata and controls
executable file
·44 lines (36 loc) · 968 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/bash
our_PPID=$$
set -x
#sunshine_cmd="flatpak run --filesystem=home --socket=wayland dev.lizardbyte.sunshine"
sunshine_cmd="sunshine"
old_outputs=$(swaymsg -r -t get_outputs | jq -r '.[].name')
get_headless() {
swaymsg -t get_outputs | jq -r '.[].name' | grep HEADLESS | tr -d '"'
}
clean_exit() {
for output in $old_outputs; do
swaymsg output $output enable
done
for output in $(get_headless); do
swaymsg output $output unplug
done
pkill -TERM -P $our_PPID
}
trap clean_exit SIGINT
for output in $old_outputs; do
swaymsg output $output disable
done
(get_headless | grep HEADLESS) || swaymsg create_output HEADLESS-1
for output in $(get_headless); do
swaymsg output $output \
mode 1920x1200@59.950Hz \
position 0 0
#mode 2412x1080@60Hz # Phone
xrandr --verbose --output "$output" --primary
done
sleep 2
while true; do
$sunshine_cmd >$HOME/.config/sunshine/sunshine_sway.log 2>&1 || break
sleep 3
done
clean_exit