feat(sway-desktop): set up for screensharing of headless outputs

This commit is contained in:
steveej 2024-10-09 00:02:32 +02:00
parent a78bc5488b
commit 9d9ec38477
3 changed files with 44 additions and 1 deletions

View file

@ -1,3 +1,20 @@
/*
TODO: create helper scripts for sharing of a screen portion
```
# this will create a new output named HEADLESS-<n>. <n> increments by 1 with each invocation even if the output is `unplug`ged.
swaymsg create_output
# find the name and the workspace number
swaymsg -t get_outputs | jq '.[] | select(.name | test("HEADLESS-.*")) | (.name, .current_workspace)'
swaymsg output HEADLESS-1 mode 1920@108060Hz
# mirror the headless workspace on the current one
nix run nixpkgs\#wl-mirror -- HEADLESS-1
# shift windows to the workspace and switch the focus to it
*/
{ {
pkgs, pkgs,
config, config,

View file

@ -22,7 +22,14 @@
layer = "top"; layer = "top";
position = "bottom"; position = "bottom";
height = 30; height = 30;
output = ["*"]; output =
# hide the bar on HEADDLESS displays as i use them only for screensharing
(
builtins.genList (i: "!HEADLESS-${builtins.toString i}") 99
)
++ [
"*"
];
# output = [ # output = [
# "eDP-1" # "eDP-1"
# "DP-*" # "DP-*"

View file

@ -40,6 +40,25 @@ in {
wlr = { wlr = {
enable = true; enable = true;
settings = {
screencast = {
chooser_type = "dmenu";
# display the output as a list in favor of the default mouse selection
chooser_cmd = lib.getExe (pkgs.writeShellApplication {
name = "chooser_cmd";
runtimeInputs = [
pkgs.sway
pkgs.jq
pkgs.fuzzel
pkgs.gnused
];
text = ''
swaymsg -t get_outputs | jq '.[] | "\(.name)@\(.current_mode.width)x\(.current_mode.height) on \(.model)"' | sed 's/"//g' | fuzzel -d | sed 's/@.*//'
'';
});
max_fps = 30;
};
};
}; };
# keep the behaviour in < 1.17, which uses the first portal implementation found in lexicographical order, use the following: # keep the behaviour in < 1.17, which uses the first portal implementation found in lexicographical order, use the following: