feat: support new monitor
This commit is contained in:
parent
b234bdbd06
commit
271cbb359b
6 changed files with 139 additions and 58 deletions
|
|
@ -31,6 +31,15 @@ in
|
|||
description = "list of keyboard layouts";
|
||||
default = [ "de" "us" ];
|
||||
};
|
||||
monitors = mkOption {
|
||||
type = types.listOf types.str;
|
||||
description = "monitor settings";
|
||||
default = [ ",preferred,auto,1" ];
|
||||
};
|
||||
extraConfig = mkOption {
|
||||
type = types.str;
|
||||
default = "";
|
||||
};
|
||||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
|
|
@ -70,6 +79,7 @@ in
|
|||
|
||||
settings = {
|
||||
mainBar = {
|
||||
start_hidden = true;
|
||||
layer = "top";
|
||||
position = "top";
|
||||
height = 20;
|
||||
|
|
@ -81,46 +91,50 @@ in
|
|||
};
|
||||
|
||||
# lock screen after timeout
|
||||
home-manager.users.moritz = {
|
||||
services.swayidle = {
|
||||
enable = true;
|
||||
events = [
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = "${getExe pkgs.swaylock} -fF";
|
||||
}
|
||||
{
|
||||
event = "lock";
|
||||
command = "${getExe pkgs.swaylock} -fF";
|
||||
}
|
||||
];
|
||||
timeouts =
|
||||
let
|
||||
lockTimeout = 10;
|
||||
in
|
||||
[
|
||||
{
|
||||
timeout = lockTimeout * 60 - 10;
|
||||
command = "${pkgs.libnotify}/bin/notify-send 'Locking screen!'";
|
||||
}
|
||||
{
|
||||
timeout = lockTimeout * 60;
|
||||
command = "${hyprland}/bin/hyprctl dispatch dpms off";
|
||||
resumeCommand = "${hyprland}/bin/hyprctl dispatch dpms on";
|
||||
}
|
||||
{
|
||||
timeout = lockTimeout * 60 + 10;
|
||||
command = "${pkgs.systemd}/bin/loginctl lock-session";
|
||||
}
|
||||
] ++ optional
|
||||
(!cfg.nvidiaSupport) # TODO https://github.com/hyprwm/Hyprland/issues/1728
|
||||
{
|
||||
timeout = 30 * 60;
|
||||
command = "${pkgs.systemd}/bin/systemctl suspend-and-hibernate";
|
||||
};
|
||||
systemdTarget = "hyprland-session.target";
|
||||
home-manager.users.moritz.programs.swaylock = {
|
||||
enable = true;
|
||||
settings = {
|
||||
color = "000000";
|
||||
};
|
||||
};
|
||||
home-manager.users.moritz.services.swayidle = {
|
||||
enable = true;
|
||||
events = [
|
||||
{
|
||||
event = "before-sleep";
|
||||
command = "${getExe pkgs.swaylock} -fF";
|
||||
}
|
||||
{
|
||||
event = "lock";
|
||||
command = "${getExe pkgs.swaylock} -fF";
|
||||
}
|
||||
];
|
||||
timeouts =
|
||||
let
|
||||
lockTimeout = 10;
|
||||
in
|
||||
[
|
||||
{
|
||||
timeout = lockTimeout * 60 - 10;
|
||||
command = "${pkgs.libnotify}/bin/notify-send 'Locking screen!'";
|
||||
}
|
||||
{
|
||||
timeout = lockTimeout * 60;
|
||||
command = "${hyprland}/bin/hyprctl dispatch dpms off";
|
||||
resumeCommand = "${hyprland}/bin/hyprctl dispatch dpms on";
|
||||
}
|
||||
{
|
||||
timeout = lockTimeout * 60 + 10;
|
||||
command = "${pkgs.systemd}/bin/loginctl lock-session";
|
||||
}
|
||||
] ++ optional
|
||||
(!cfg.nvidiaSupport) # TODO https://github.com/hyprwm/Hyprland/issues/1728
|
||||
{
|
||||
timeout = 30 * 60;
|
||||
command = "${pkgs.systemd}/bin/systemctl suspend-and-hibernate";
|
||||
};
|
||||
systemdTarget = "hyprland-session.target";
|
||||
};
|
||||
|
||||
# adds pam module for swaylock
|
||||
security.pam.services.swaylock = { };
|
||||
|
|
@ -184,17 +198,30 @@ in
|
|||
alsa.support32Bit = true;
|
||||
pulse.enable = true;
|
||||
};
|
||||
xserver = {
|
||||
greetd = {
|
||||
enable = true;
|
||||
displayManager = {
|
||||
lightdm.enable = true;
|
||||
autoLogin = {
|
||||
enable = true;
|
||||
user = "moritz";
|
||||
settings =
|
||||
let
|
||||
hyprlandCommand = getExe' hyprland "Hyprland";
|
||||
in
|
||||
{
|
||||
initial_session = {
|
||||
command = hyprlandCommand;
|
||||
user = "moritz";
|
||||
};
|
||||
default_session = {
|
||||
command = ''
|
||||
${pkgs.greetd.tuigreet}/bin/tuigreet \
|
||||
--time \
|
||||
--asterisks \
|
||||
--user-menu \
|
||||
--remember \
|
||||
--power-shutdown 'systemctl poweroff' \
|
||||
--power-reboot 'systemctl reboot' \
|
||||
--cmd ${hyprlandCommand}
|
||||
'';
|
||||
};
|
||||
};
|
||||
defaultSession = "hyprland";
|
||||
sessionPackages = [ hyprland ]; # can't set the defaultSession otherwise
|
||||
};
|
||||
};
|
||||
};
|
||||
security.rtkit.enable = true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue