Add swaylock module and update swaylock calls

This commit is contained in:
Erwin Boskma 2025-01-07 16:48:39 +01:00
parent 1d6b8a63e0
commit 6551644ced
Signed by: erwin
SSH key fingerprint: SHA256:9LmFDe1C6jSrEyqxxvX8NtJBmcbB105XoqyUZF092bg
7 changed files with 100 additions and 27 deletions

View file

@ -9,11 +9,12 @@ let
cfg = config.eboskma.programs.river;
mod = "Mod4";
lockcmd = "${pkgs.swaylock}/bin/swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --image ${cfg.wallpaper} --scaling fill";
# lockcmd = "${pkgs.swaylock}/bin/swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --image ${cfg.wallpaper} --scaling fill";
lockcmd = "${lib.getExe pkgs.swaylock}";
rofiPower = pkgs.writeShellScriptBin "rofi-power" (
builtins.replaceStrings [ "{WALLPAPER}" ] [ (builtins.toString cfg.wallpaper) ] (
builtins.readFile ./powermenu.sh
)
# builtins.replaceStrings [ "{WALLPAPER}" ] [ (builtins.toString cfg.wallpaper) ] (
builtins.readFile ./powermenu.sh
# )
);
menu = "${config.programs.anyrun.package}/bin/anyrun";
@ -136,10 +137,12 @@ in
"None XF86AudioMute" = "spawn '${pkgs.pamedia}/bin/pamedia mute'";
"None XF86Calculator" = "spawn ${pkgs.gnome-calculator}/bin/gnome-calculator";
"${mod} c" = mkIf config.eboskma.programs.emacs.enable "spawn '${config.eboskma.programs.emacs.package}/bin/emacsclient -c'";
"${mod} c" =
mkIf config.eboskma.programs.emacs.enable "spawn '${config.eboskma.programs.emacs.package}/bin/emacsclient -c'";
"${mod} d" = "spawn '${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-panel --skip-wait'";
"${mod}+Shift d" = "spawn '${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-dnd --skip-wait'";
"${mod}+Shift d" =
"spawn '${pkgs.swaynotificationcenter}/bin/swaync-client --toggle-dnd --skip-wait'";
"${mod}+Shift f" = "spawn ${rofiPower}/bin/rofi-power";

View file

@ -23,7 +23,8 @@ exit_wm="󰗼" # Icon: exit_to_app
# Variable passed to rofi
options="${shutdown}\n${reboot}\n${lock}\n${hibernate}\n${exit_wm}"
uptime=$(uptime | awk '{print $1}' || true)
lockcmd="swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --image {WALLPAPER} --scaling fill"
# lockcmd="swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --image {WALLPAPER} --scaling fill"
lockcmd="swaylock"
chosen="$(echo -e "${options}" | rofi -theme power -p "Uptime: ${uptime}" -dmenu -selected-row 2)"

View file

@ -8,11 +8,12 @@ with lib;
let
cfg = config.eboskma.programs.sway;
mod = "Mod4";
swaylockcmd = "${pkgs.swaylock}/bin/swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --image ${cfg.lock-wallpaper} --scaling fill";
# swaylockcmd = "${pkgs.swaylock}/bin/swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --image ${cfg.lock-wallpaper} --scaling fill";
swaylockcmd = "${lib.getExe pkgs.swaylock}";
rofiPower = pkgs.writeShellScriptBin "rofi-power" (
builtins.replaceStrings [ "{WALLPAPER}" ] [ (builtins.toString cfg.lock-wallpaper) ] (
builtins.readFile ./powermenu.sh
)
# builtins.replaceStrings [ "{WALLPAPER}" ] [ (builtins.toString cfg.lock-wallpaper) ] (
builtins.readFile ./powermenu.sh
# )
);
in
{
@ -23,10 +24,10 @@ in
default = true;
};
lock-wallpaper = mkOption {
description = "Wallpaper to use for the lockscreen";
type = types.path;
};
# lock-wallpaper = mkOption {
# description = "Wallpaper to use for the lockscreen";
# type = types.path;
# };
terminal = mkOption {
description = "Default terminal to run";
type = types.str;
@ -152,7 +153,10 @@ in
right = "o";
floating = {
criteria = [ { app_id = "gnome-calculator"; } ];
criteria = [
{ app_id = "gnome-calculator"; }
{ app_id = "dev.deedles.Trayscale"; }
];
modifier = mod;
};
@ -379,13 +383,5 @@ in
};
};
systemd.user = {
targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = [ "sway-session-pre.target" ];
};
};
};
};
}

View file

@ -23,7 +23,8 @@ exit_wm="󰗼" # Icon: exit_to_app
# Variable passed to rofi
options="${shutdown}\n${reboot}\n${lock}\n${hibernate}\n${exit_wm}"
uptime=$(uptime | awk '{print $1}' || true)
lockcmd="swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --image {WALLPAPER} --scaling fill"
# lockcmd="swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --image {WALLPAPER} --scaling fill"
lockcmd="swaylock"
chosen="$(echo -e "${options}" | rofi -theme power -p "Uptime: ${uptime}" -dmenu -selected-row 2)"

View file

@ -0,0 +1,65 @@
{
pkgs,
config,
lib,
...
}:
with lib;
let
cfg = config.eboskma.programs.swaylock;
in
{
options.eboskma.programs.swaylock = {
enable = mkEnableOption "swaylock";
wallpaper = mkOption {
description = "Wallpaper to use for the lockscreen";
type = types.nullOr types.path;
default = null;
};
};
config = mkIf cfg.enable {
programs.swaylock = {
enable = true;
settings = {
ignore-empty-password = true;
daemonize = true;
show-failed-attempts = true;
indicator-caps-lock = true;
image = mkIf (cfg.wallpaper != null) cfg.wallpaper;
scaling = "fill";
# Catppuccin Mocha
color = "1e1e2e";
bs-hl-color = "f5e0dc";
caps-lock-bs-hl-color = "f5e0dc";
caps-lock-key-hl-color = "a6e3a1";
inside-color = "00000000";
inside-clear-color = "00000000";
inside-caps-lock-color = "00000000";
inside-ver-color = "00000000";
inside-wrong-color = "00000000";
key-hl-color = "a6e3a1";
layout-bg-color = "00000000";
layout-border-color = "00000000";
layout-text-color = "cdd6f4";
line-color = "00000000";
line-clear-color = "00000000";
line-caps-lock-color = "00000000";
line-ver-color = "00000000";
line-wrong-color = "00000000";
ring-color = "b4befe";
ring-clear-color = "f5e0dc";
ring-caps-lock-color = "fab387";
ring-ver-color = "89b4fa";
ring-wrong-color = "eba0ac";
separator-color = "00000000";
text-color = "cdd6f4";
text-clear-color = "f5e0dc";
text-caps-lock-color = "fab387";
text-ver-color = "89b4fa";
text-wrong-color = "eba0ac";
};
};
};
}

View file

@ -226,7 +226,6 @@ in
enable = true;
package = pkgs.swayfx;
terminal = lib.getExe pkgs.ghostty;
lock-wallpaper = "${homeCfg.home.homeDirectory}/.wallpapers/river-2560.png";
output = {
"DP-2" = {
bg = "${homeCfg.home.homeDirectory}/.wallpapers/river-2560.png fill";
@ -249,6 +248,10 @@ in
};
};
};
swaylock = {
enable = true;
# wallpaper = "${homeCfg.home.homeDirectory}/.wallpapers/river-2560.png";
};
swaynotificationcenter.enable = true;
tea = {
enable = true;
@ -531,6 +534,10 @@ in
};
playerctld.enable = true;
trayscale = {
enable = true;
};
};
imports =

View file

@ -214,7 +214,6 @@ in
package = pkgs.sway;
terminal = lib.getExe pkgs.ghostty;
swayidle = false;
lock-wallpaper = "${homeCfg.home.homeDirectory}/.wallpapers/river-3840.png";
output = {
"DP-1" = {
bg = "${../../wallpapers/river-3840.png} fill";
@ -252,6 +251,7 @@ in
"--locked Mod4+Ctrl+r" = "output DP-1 disable, output DP-3 disable, output HDMI-A-1 enable";
};
};
swaylock.enable = true;
swaynotificationcenter.enable = true;
tmux.enable = true;
waybar = {