Add caffeine
This commit is contained in:
20
home/scripts/caffeine.nix
Normal file
20
home/scripts/caffeine.nix
Normal file
@@ -0,0 +1,20 @@
|
||||
{ pkgs, config, ... }:
|
||||
let
|
||||
homedir = config.home.homeDirectory;
|
||||
|
||||
caffeine-status = pkgs.writeShellScriptBin "caffeine-status" ''
|
||||
[[ -f /tmp/caffeine ]] && echo "active" || echo "inactive"
|
||||
'';
|
||||
|
||||
caffeine = pkgs.writeShellScriptBin "caffeine" ''
|
||||
if [[ -f /tmp/caffeine ]]; then
|
||||
rm /tmp/caffeine
|
||||
${pkgs.hypridle}/bin/hypridle &
|
||||
${pkgs.libnotify}/bin/notify-send " Caffeine Deactivated"
|
||||
else
|
||||
touch /tmp/caffeine
|
||||
pkill hypridle && ${pkgs.libnotify}/bin/notify-send " Caffeine Activated"
|
||||
fi
|
||||
'';
|
||||
|
||||
in { home.packages = with pkgs; [ caffeine-status caffeine ]; }
|
||||
@@ -1,4 +1,10 @@
|
||||
{
|
||||
imports =
|
||||
[ ./scripts.nix ./nerdfetch.nix ./nixy.nix ./sounds.nix ./brightness.nix ];
|
||||
imports = [
|
||||
./scripts.nix
|
||||
./nerdfetch.nix
|
||||
./nixy.nix
|
||||
./sounds.nix
|
||||
./brightness.nix
|
||||
./caffeine.nix
|
||||
];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user