Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.



I 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


You 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


Four 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

  function trim {
    sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//'
  }
/end sarcasm


You just cut my tedious space-bar-smashing time in half, thank you!


Oh, thanks! I remembered there was something, skimmed through https://news.ycombinator.com/formatdoc and completely missed it.


HN needs a dedicated pastebin (remember those?)


What "remember"? I'm in multiple Matrix channels right now that tell people to use them.


Ooh, creating a headless display and then wl-mirroring it is incredibly smart! Have been looking for something like this!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: