4 ms·
This is how I do it under Sway (Wayland): #!/bin/bash swaymsg create_output OUTPUT=$(swaymsg -r -t get_outputs | jq '.[].name' | grep HEADLESS | tr -d '"') #
by tasn 2y ago
This is how I do it under Sway (Wayland):
#!/bin/bash
swaymsg create_output
OUTPUT=$(swaymsg -r -t get_outputs | jq '.[].name' | grep HEADLESS | tr -d '"')
# No need to reduce res, it defualts to 1080p
#swaymsg output "$OUTPUT" resolution 1280x720
wl-mirror "$OUTPUT"
swaymsg output "$OUTPUT" unplug
When I was still in X11 land I used to just use Xephyr.
- arjvik 2y agoOoh, creating a headless display and then wl-mirroring it is incredibly smart! Have been looking for something like this!
- tasn 2y agoI just realized formatting is a bit broken. :( Fixed: #!/bin/bash swaymsg create_output OUTPUT=$(swaymsg -r -t get_outputs | jq '.[].name' | grep HEADLESS | tr -d '"') # No need to reduce res, it defualts to 1080p # swaymsg output "$OUTPUT" resolution 1280x720 wl-mirror "$OUTPUT" swaymsg output "$OUTPUT" unplug
- craftkiller 2y agoYou can do code blocks on HN by prefixing your lines with four spaces. #!/bin/bash swaymsg create_output OUTPUT=$(swaymsg -r -t get_outputs | jq '.[].name' | grep HEADLESS | tr -d '"') # No need to reduce res, it defualts to 1080p # swaymsg output "$OUTPUT" resolution 1280x720 wl-mirror "$OUTPUT" swaymsg output "$OUTPUT" unplug
- deleted 2y ago[deleted]
- mmh0000 2y agoFour spaces!? Absurd! Think of how many bytes you're wasting! In just your last code block your flooded the internet with 28 needless bytes!?!?!?!! If this keeps up soon we'll all just be downloading whitespace. Only two spaces are needed: https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc function trim { sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' } /end sarcasm
- craftkiller 2y agoYou just cut my tedious space-bar-smashing time in half, thank you!
- tasn 2y agoOh, thanks! I remembered there was something, skimmed through https://news.ycombinator.com/formatdoc https://news.ycombinator.com/formatdoc and completely missed it.
- djbusby 2y agoHN needs a dedicated pastebin (remember those?)
- yjftsjthsd-h 2y agoWhat "remember"? I'm in multiple Matrix channels right now that tell people to use them.