nix/lock: add service to update image cache
This commit is contained in:
parent
1c8d04a6e3
commit
f1bcf6fc0c
10 changed files with 78 additions and 22 deletions
|
@ -47,8 +47,12 @@ in
|
|||
|
||||
# user interface
|
||||
ui = {
|
||||
wm.xmonad.enable = true;
|
||||
bar.polybar.enable = true;
|
||||
# windows manager
|
||||
xmonad.enable = true;
|
||||
# bar
|
||||
polybar.enable = true;
|
||||
# lock
|
||||
betterlockscreen.enable = true;
|
||||
};
|
||||
|
||||
# shell
|
||||
|
@ -96,14 +100,6 @@ in
|
|||
accounts = secrets.emailAccounts;
|
||||
};
|
||||
|
||||
# TODO: add module for lock screen
|
||||
services.screen-locker = {
|
||||
enable = true;
|
||||
|
||||
lockCmd = "/bin/bash -c ${config.home.homeDirectory}/scripts/lock.sh";
|
||||
|
||||
inactiveInterval = 15;
|
||||
};
|
||||
|
||||
home.file = {
|
||||
"scripts" = {
|
||||
|
|
|
@ -1 +0,0 @@
|
|||
[ ./polybar ]
|
59
home/ui/betterlockscreen.nix
Normal file
59
home/ui/betterlockscreen.nix
Normal file
|
@ -0,0 +1,59 @@
|
|||
{ lib, config, pkgs, ...}:
|
||||
|
||||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.ui.betterlockscreen;
|
||||
|
||||
package = config.services.betterlockscreen.package;
|
||||
in
|
||||
{
|
||||
options.ui.betterlockscreen = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
description = "Enable betterlockscreen";
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
services.betterlockscreen = {
|
||||
enable = true;
|
||||
inactiveInterval = 15;
|
||||
};
|
||||
|
||||
systemd.user.timers.updateBetterlockscreenImage = {
|
||||
Unit = {
|
||||
Description = "Update betterlockscreen image timer";
|
||||
After = [ "graphical-session.target" "timers.target" ];
|
||||
};
|
||||
|
||||
Timer = {
|
||||
OnUnitActiveSec = "60min";
|
||||
OnBootSec = "10s";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" "timers.target" ];
|
||||
};
|
||||
};
|
||||
|
||||
systemd.user.services.updateBetterlockscreenImage = {
|
||||
Unit = {
|
||||
Description = "Update betterlockscreen image";
|
||||
After = [ "graphical-session.target" ];
|
||||
};
|
||||
|
||||
Service = {
|
||||
Type = "oneshot";
|
||||
Environment = "PATH=/run/current-system/sw/bin";
|
||||
ExecStart = "${package}/bin/betterlockscreen --update ${config.home.homeDirectory}/pictures/wallpapers";
|
||||
};
|
||||
|
||||
Install = {
|
||||
WantedBy = [ "graphical-session.target" ];
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
|
@ -1 +1,6 @@
|
|||
(import ./wm) ++ (import ./bar)
|
||||
[
|
||||
./xmonad
|
||||
./polybar
|
||||
./betterlockscreen.nix
|
||||
]
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ with lib;
|
|||
};
|
||||
};
|
||||
|
||||
"module/xmonad" = mkIf config.ui.wm.xmonad.enable {
|
||||
"module/xmonad" = mkIf config.ui.xmonad.enable {
|
||||
type = "custom/script";
|
||||
exec = "${pkgs.xmonad-log}/bin/xmonad-log";
|
||||
tail = true;
|
|
@ -3,7 +3,7 @@
|
|||
with lib;
|
||||
|
||||
let
|
||||
cfg = config.ui.bar.polybar;
|
||||
cfg = config.ui.polybar;
|
||||
pcfg = config.services.polybar;
|
||||
|
||||
# TODO: create a theme
|
||||
|
@ -14,7 +14,7 @@ let
|
|||
polybarConfig = import ./config.nix { inherit lib config pkgs colors; };
|
||||
in
|
||||
{
|
||||
options.ui.bar.polybar = {
|
||||
options.ui.polybar = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
|
@ -1 +0,0 @@
|
|||
[ ./xmonad ]
|
|
@ -290,7 +290,7 @@ myKeys conf = mkKeymap conf $
|
|||
|
||||
|
||||
-- Lock screen
|
||||
, ("M4-l", spawn "bash ~/scripts/lock.sh")
|
||||
, ("M4-l", spawn "betterlockscreen --lock")
|
||||
|
||||
-- Change volume
|
||||
, ("<XF86AudioMute>", spawn "amixer -q sset Master toggle")
|
|
@ -4,10 +4,10 @@ with lib;
|
|||
|
||||
let
|
||||
uiCfg = config.ui;
|
||||
cfg = uiCfg.wm.xmonad;
|
||||
cfg = uiCfg.xmonad;
|
||||
in
|
||||
{
|
||||
options.ui.wm.xmonad = {
|
||||
options.ui.xmonad = {
|
||||
enable = mkOption {
|
||||
type = types.bool;
|
||||
default = false;
|
||||
|
@ -30,7 +30,7 @@ in
|
|||
enable = true;
|
||||
enableContribAndExtras = true;
|
||||
config = ./config.hs;
|
||||
extraPackages = mkIf uiCfg.bar.polybar.enable (hp: [
|
||||
extraPackages = mkIf uiCfg.polybar.enable (hp: [
|
||||
hp.dbus
|
||||
hp.monad-logger
|
||||
]);
|
|
@ -1,2 +0,0 @@
|
|||
#!/bin/bash
|
||||
/usr/bin/i3lock -eti $(ls $HOME/pictures/wallpapers/*.png | awk '{ print $1 }' | sort -R | head -n 1)
|
Loading…
Reference in a new issue