set up swayidle

This commit is contained in:
Rouven Seifert 2023-02-28 23:00:18 +01:00
parent 89604624c9
commit 82a05531c3
Signed by: rouven.seifert
GPG key ID: B95E8FE6B11C4D09
5 changed files with 97 additions and 34 deletions

View file

@ -111,11 +111,14 @@
services.logind = { services.logind = {
lidSwitch = "suspend-then-hibernate"; lidSwitch = "suspend-then-hibernate";
lidSwitchDocked = "hybrid-sleep"; lidSwitchDocked = "suspend-then-hibernate";
lidSwitchExternalPower = "suspend"; lidSwitchExternalPower = "suspend";
extraConfig = ''
HandlePowerKey = ignore
'';
}; };
systemd.sleep.extraConfig = '' systemd.sleep.extraConfig = ''
HibernateDelaySec=1h HibernateDelaySec=3min
''; '';
environment.systemPackages = with pkgs; [ environment.systemPackages = with pkgs; [

View file

@ -2,6 +2,7 @@
{ {
imports = [ imports = [
./hyprpaper.nix ./hyprpaper.nix
./session.nix
./waybar.nix ./waybar.nix
]; ];
wayland.windowManager.hyprland.enable = true; wayland.windowManager.hyprland.enable = true;
@ -17,25 +18,11 @@
grim grim
slurp slurp
swappy swappy
swaylock-effects
wlogout
]; ];
xdg.configFile = { xdg.configFile = {
"hypr/hyprland.conf".source = ./hyprland.conf; "hypr/hyprland.conf".source = ./hyprland.conf;
"swaylock/config".text = ''
indicator-radius=200
indicator-thickness=3
inside-color=00000000
inside-ver-color=${config.colorScheme.colors.base0D}
inside-clear-color=${config.colorScheme.colors.base0B}
ring-color=${config.colorScheme.colors.base03}
ring-wrong-color=${config.colorScheme.colors.base08}
screenshot
effect-blur=7x5
'';
"wofi/config".text = '' "wofi/config".text = ''
allow_images = true allow_images = true
term = alacritty term = alacritty

View file

@ -1,17 +1,9 @@
# See https://wiki.hyprland.org/Configuring/Monitors/ # See https://wiki.hyprland.org/Configuring/Monitors/
monitor=eDP-1, 1920x1080, 0x0, 1 monitor=eDP-1, 1920x1080, 0x0, 1
# See https://wiki.hyprland.org/Configuring/Keywords/ for more # manually start the systemd target
exec-once = systemctl --user start hyprland-session.target
# Execute your favorite apps at launch
#exec-once = waybar & hyprpaper
#exec-once = hyprpaper
# manually start the systemd target
exec-once = systemctl --user start hyprland-session.target
# Source a file (multi-file configs)
# source = ~/.config/hypr/myColors.conf
# For all categories, see https://wiki.hyprland.org/Configuring/Variables/ # For all categories, see https://wiki.hyprland.org/Configuring/Variables/
input { input {
@ -81,7 +73,7 @@ master {
gestures { gestures {
# See https://wiki.hyprland.org/Configuring/Variables/ for more # See https://wiki.hyprland.org/Configuring/Variables/ for more
workspace_swipe = off # doesn't really work workspace_swipe = on
} }
misc { misc {
@ -165,10 +157,7 @@ binde = SHIFT, XF86AudioLowerVolume, exec, pactl set-source-volume @DEFAULT_SOUR
bind = ,XF86Messenger, exec, makoctl dismiss bind = ,XF86Messenger, exec, makoctl dismiss
bind = SHIFT ,XF86Messenger, exec, makoctl restore bind = SHIFT ,XF86Messenger, exec, makoctl restore
bind = ,XF86Go, exec, makoctl invoke bind = ,XF86Go, exec, makoctl invoke
bind = SHIFT, XF86Go, exec, sh ~/.config/mako/do-not-disturb.sh bind = ,XF86Cancel, exec, sh ~/.config/mako/do-not-disturb.sh
bind = ,XF86Display, exec, hyprpaper bind = ,XF86Display, exec, hyprpaper
bind = ,XF86Favorites, exec, swaylock bind = ,XF86Favorites, exec, loginctl lock-session
bind = ,Cancel, exec, wlogout bind = ,XF86PowerOff, exec, wlogout
# lock on lid
bindl = ,switch:Lid Switch, exec, swaylock

View file

@ -0,0 +1,83 @@
{ config, pkgs, ... }:
{
home.packages = with pkgs; [
swaylock-effects
wlogout
];
services.swayidle = {
enable = true;
systemdTarget = "hyprland-session.target";
events = [
{ event = "before-sleep"; command = "${pkgs.swaylock-effects}/bin/swaylock"; }
{ event = "lock"; command = "${pkgs.swaylock-effects}/bin/swaylock"; }
];
timeouts = [
{ timeout = 300; command = "${pkgs.swaylock-effects}/bin/swaylock"; }
];
};
xdg.configFile = {
"swaylock/config".text = ''
indicator-radius=200
indicator-thickness=3
inside-color=00000000
inside-ver-color=${config.colorScheme.colors.base0D}
inside-clear-color=${config.colorScheme.colors.base0B}
ring-color=${config.colorScheme.colors.base03}
ring-wrong-color=${config.colorScheme.colors.base08}
screenshot
effect-blur=7x5
'';
"wlogout/style.css".text = ''
* {
background-image: none;
}
window {
background-color: rgba(12, 12, 12, 0);
}
button {
color: #${config.colorScheme.colors.base05};
background-color: #${config.colorScheme.colors.base00};
border-style: solid;
border-width: 2px;
border-radius: 30px;
margin: 5px;
background-repeat: no-repeat;
background-position: center;
background-size: 25%;
}
button:active, button:hover {
background-color: #${config.colorScheme.colors.base03};
outline-style: none;
}
#lock {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/lock.png"));
}
#logout {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/logout.png"));
}
#suspend {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/suspend.png"));
}
#hibernate {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/hibernate.png"));
}
#shutdown {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/shutdown.png"));
}
#reboot {
background-image: image(url("${pkgs.wlogout}/share/wlogout/icons/reboot.png"));
}
'';
};
}

View file

@ -149,6 +149,7 @@
}; };
extraPlugins = with pkgs.vimPlugins; extraPlugins = with pkgs.vimPlugins;
[ [
vim-nix
dracula-vim dracula-vim
nerdcommenter nerdcommenter
]; ];