sway: Fix swayidle config, set wallpaper for rofi from nix

This commit is contained in:
Erwin Boskma 2023-10-09 14:38:07 +02:00
parent 45fd0f135b
commit 6f68c9a354
Signed by: erwin
SSH key fingerprint: SHA256:9LmFDe1C6jSrEyqxxvX8NtJBmcbB105XoqyUZF092bg
2 changed files with 10 additions and 10 deletions

View file

@ -7,7 +7,8 @@ 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";
rofiPower = pkgs.writeShellScriptBin "rofi-power" (builtins.readFile ./powermenu.sh);
rofiPower = pkgs.writeShellScriptBin "rofi-power"
(builtins.replaceStrings [ "{WALLPAPER}" ] [ (builtins.toString cfg.lock-wallpaper) ] (builtins.readFile ./powermenu.sh));
in
{
options.eboskma.programs.sway = {
@ -304,14 +305,13 @@ in
services = {
swayidle = {
enable = true;
events = {
lock = [
{
name = "lock";
command = "lock";
}
];
};
events = [
{
event = "lock";
command = swaylockcmd;
}
];
timeouts = [
{
timeout = 900;

View file

@ -23,7 +23,7 @@ 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 /home/erwin/.wallpapers/river-2560.png --scaling fill"
lockcmd="swaylock --ignore-empty-password --daemonize --show-failed-attempts --indicator-caps-lock --image {WALLPAPER} --scaling fill"
chosen="$(echo -e "${options}" | rofi -theme power -p "Uptime: ${uptime}" -dmenu -selected-row 2)"