sway: Enable screencasts via xdg-desktop-portal-wlr
This also adds a blinking indicator to the status bar so it is obvious when the screen is shared.
This commit is contained in:
parent
2d0a2b7316
commit
f546f737fe
|
@ -8,6 +8,17 @@ lib.mkIf config.sbruder.gui.enable {
|
||||||
extraPackages = [ ];
|
extraPackages = [ ];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
xdg = {
|
||||||
|
portal = {
|
||||||
|
enable = true;
|
||||||
|
extraPortals = with pkgs; [
|
||||||
|
xdg-desktop-portal-wlr
|
||||||
|
xdg-desktop-portal-gtk
|
||||||
|
];
|
||||||
|
gtkUsePortal = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
# steam (and other high quality software) still ships 32 bit binaries
|
# steam (and other high quality software) still ships 32 bit binaries
|
||||||
hardware.opengl.driSupport32Bit = lib.mkDefault pkgs.stdenv.isx86_64;
|
hardware.opengl.driSupport32Bit = lib.mkDefault pkgs.stdenv.isx86_64;
|
||||||
|
|
||||||
|
|
|
@ -156,3 +156,13 @@ window#waybar {
|
||||||
background-color: @base3@;
|
background-color: @base3@;
|
||||||
color: @base03@;
|
color: @base03@;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#custom-screencast {
|
||||||
|
background-color: @red@;
|
||||||
|
color: @base03@;
|
||||||
|
animation-name: blink;
|
||||||
|
animation-duration: 0.5s;
|
||||||
|
animation-timing-function: cubic-bezier(1, 0, 0, 1);
|
||||||
|
animation-iteration-count: infinite;
|
||||||
|
animation-direction: alternate;
|
||||||
|
}
|
||||||
|
|
|
@ -343,9 +343,9 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
];
|
];
|
||||||
modules-right = [
|
modules-right = [
|
||||||
"tray"
|
"tray"
|
||||||
|
"custom/screencast"
|
||||||
"custom/redshift"
|
"custom/redshift"
|
||||||
"idle_inhibitor"
|
"idle_inhibitor"
|
||||||
"custom/notification_inhibitor"
|
|
||||||
"backlight"
|
"backlight"
|
||||||
"mpd"
|
"mpd"
|
||||||
"pulseaudio"
|
"pulseaudio"
|
||||||
|
@ -386,6 +386,38 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
deactivated = " ";
|
deactivated = " ";
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
"custom/screencast" = {
|
||||||
|
exec = pkgs.writeScript "screencast-monitor" ''
|
||||||
|
#!${pkgs.python3}/bin/python3
|
||||||
|
import subprocess
|
||||||
|
import sys
|
||||||
|
|
||||||
|
active_outputs = 0
|
||||||
|
|
||||||
|
with subprocess.Popen(
|
||||||
|
["${pkgs.coreutils}/bin/stdbuf", "-o0", "${nixosConfig.services.pipewire.package}/bin/pw-link", "-m", "-o", "xdg-desktop-portal-wlr"],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
text=True,
|
||||||
|
) as proc:
|
||||||
|
for line in proc.stdout:
|
||||||
|
action = line.split(" ")[0]
|
||||||
|
if action == "=" or action == "+":
|
||||||
|
active_outputs += 1
|
||||||
|
elif action == "-":
|
||||||
|
active_outputs -= 1
|
||||||
|
else:
|
||||||
|
print(f"Invalid action {action} (in line {line})", file=sys.stderr)
|
||||||
|
|
||||||
|
if active_outputs > 0:
|
||||||
|
print("${lrm} ")
|
||||||
|
else:
|
||||||
|
print()
|
||||||
|
|
||||||
|
sys.stdout.flush()
|
||||||
|
'';
|
||||||
|
format = "{}";
|
||||||
|
tooltip = false;
|
||||||
|
};
|
||||||
backlight = {
|
backlight = {
|
||||||
format = "{percent}% {icon}";
|
format = "{percent}% {icon}";
|
||||||
format-icons = [ " " " " " " " " " " " " " " ];
|
format-icons = [ " " " " " " " " " " " " " " ];
|
||||||
|
@ -596,4 +628,13 @@ lib.mkIf nixosConfig.sbruder.gui.enable {
|
||||||
night = 3500;
|
night = 3500;
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
# screen recording/sharing with pipewire
|
||||||
|
xdg.configFile."xdg-desktop-portal-wlr/config".text = lib.generators.toINI { } {
|
||||||
|
screencast = {
|
||||||
|
max_fps = 30;
|
||||||
|
chooser_type = "simple";
|
||||||
|
chooser_cmd = "slurp -f %o -or";
|
||||||
|
};
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue