abstract screenshare selection

This commit is contained in:
LordGrimmauld 2024-04-11 10:56:21 +02:00
parent 36252de722
commit d29fabb044
7 changed files with 63 additions and 20 deletions

View file

@ -12,6 +12,15 @@ in
xdg-desktop-portal-kde xdg-desktop-portal-kde
xdg-desktop-portal-gtk xdg-desktop-portal-gtk
]; ];
wlr.settings = lib.mapAttrs'
(name: value: lib.nameValuePair ("screencast_" + name) {
output_name = value.id;
max_fps = value.fps;
chooser_type = "simple";
chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or";
})
cfg.screens;
}; };
environment.sessionVariables = { environment.sessionVariables = {

View file

@ -37,6 +37,12 @@ in
text = lib.strings.concatLines ( text = lib.strings.concatLines (
(build_conf cfg.sway.config) (build_conf cfg.sway.config)
++ lib.optional cfg.sway.bar.enable bar_config ++ lib.optional cfg.sway.bar.enable bar_config
++ (lib.mapAttrsToList
(name: value:
"output ${value.id} mode ${value.mode}@${toString value.fps}Hz"
+ (lib.optionalString (value.pos != null) " position ${value.pos}")
)
cfg.screens)
); );
sway_conf = pkgs.writeText "sway.conf" text; sway_conf = pkgs.writeText "sway.conf" text;

View file

@ -17,6 +17,34 @@ let
}; };
}); });
screen = types.submodule {
options = {
fps = mkOption {
type = types.int;
default = 60;
description = "max framerate of screen";
};
mode = mkOption {
type = types.nonEmptyStr;
default = "1920x1080";
description = "pixel format of the screen";
};
id = mkOption {
type = types.nonEmptyStr;
description = "ID of the screen";
};
pos = mkOption {
type = types.nullOr types.nonEmptyStr;
default = null;
example = "0,0";
description = "position where to place the screen";
};
};
};
sway_conf = types.submodule ({ config, ... }: rec { sway_conf = types.submodule ({ config, ... }: rec {
options = { options = {
keybinds = mkOption { keybinds = mkOption {
@ -135,6 +163,12 @@ in
}; };
}; };
screens = mkOption {
type = types.attrsOf screen;
default = { };
description = "Screens to initialize";
};
sway = { sway = {
enable = mkEnableOption "grimm-sway"; enable = mkEnableOption "grimm-sway";

View file

@ -2,7 +2,6 @@
imports = [ imports = [
# Include the results of the hardware scan. # Include the results of the hardware scan.
./hardware-configuration.nix ./hardware-configuration.nix
./screenshare-select.nix
]; ];
age.identityPaths = [ "/home/grimmauld/.ssh/id_rsa" ]; age.identityPaths = [ "/home/grimmauld/.ssh/id_rsa" ];

View file

@ -32,6 +32,18 @@
size = 48 * 1024; size = 48 * 1024;
}]; }];
grimmShared.screens = {
external = {
id = "HDMI-A-1";
pos = "0,0";
};
internal = {
id = "eDP-1";
fps = 144;
};
};
nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux"; nixpkgs.hostPlatform = lib.mkDefault "x86_64-linux";
powerManagement.cpuFreqGovernor = lib.mkDefault "performance"; powerManagement.cpuFreqGovernor = lib.mkDefault "performance";
hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware; hardware.cpu.intel.updateMicrocode = lib.mkDefault config.hardware.enableRedistributableFirmware;

View file

@ -1,17 +0,0 @@
{ pkgs, ... }:
{
xdg.portal.wlr.settings = {
screencastExternal = {
output_name = "HDMI-A-1";
max_fps = 60;
chooser_type = "simple";
chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or";
};
screencastInternal = {
output_name = "eDP-1";
max_fps = 144;
chooser_type = "simple";
chooser_cmd = "${pkgs.slurp}/bin/slurp -f %o -or";
};
};
}

View file

@ -148,8 +148,7 @@
]; ];
extraConfig = '' extraConfig = ''
output * bg ${./wallpapers/switzerland.jpg} fill output * bg ${./wallpapers/switzerland.jpg} fill
output HDMI-A-1 mode 1920x1080@60Hz position 0,0
for_window [app_id="lxqt-policykit-agent"] floating enable;
floating_modifier $mod normal floating_modifier $mod normal
input type:keyboard xkb_numlock enabled input type:keyboard xkb_numlock enabled
@ -172,6 +171,7 @@
for_window [app_id="swaymux"] floating enable for_window [app_id="swaymux"] floating enable
for_window [app_id="rmenu"] floating enable for_window [app_id="rmenu"] floating enable
for_window [app_id="lxqt-policykit-agent"] floating enable;
''; '';
modes.resize.keybinds = { modes.resize.keybinds = {