Based on6b71b580de/bin/timer
and6b71b580de/bin/_timer
.
This commit is contained in:
parent
c676972d0b
commit
e5ae3a4be7
4 changed files with 43 additions and 0 deletions
|
@ -105,6 +105,7 @@
|
|||
move-firefox-screenshots
|
||||
setbg
|
||||
tag-release
|
||||
timer
|
||||
todos-add
|
||||
unmounter
|
||||
update-all-git-repos
|
||||
|
|
19
packages/_timer.nix
Normal file
19
packages/_timer.nix
Normal file
|
@ -0,0 +1,19 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "_timer";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
coreutils
|
||||
libnotify
|
||||
];
|
||||
|
||||
text = ''
|
||||
mins=$1
|
||||
message=''${2:-Time out!}
|
||||
|
||||
sleep $((mins * 60))
|
||||
|
||||
notify-send -t 0 "''${message}" "Your timer of $mins min is over" -u normal
|
||||
'';
|
||||
}
|
|
@ -6,6 +6,7 @@ let
|
|||
vimPlugins = callPackage ./vim-plugins { };
|
||||
in
|
||||
{
|
||||
_timer = callPackage ./_timer.nix { };
|
||||
backup-websites = callPackage ./backup-websites.nix { };
|
||||
build-glove80 = callPackage ./build-glove80.nix { };
|
||||
create-script = callPackage ./create-script.nix { };
|
||||
|
@ -17,6 +18,7 @@ in
|
|||
passmenu-otp = callPackage ./passmenu-otp.nix { };
|
||||
setbg = callPackage ./setbg.nix { };
|
||||
tag-release = callPackage ./tag-release.nix { };
|
||||
timer = callPackage ./timer.nix { };
|
||||
tmux-sessionizer = callPackage ./tmux-sessionizer { };
|
||||
todos-add = callPackage ./todos-add.nix { };
|
||||
unmounter = callPackage ./unmounter.nix { };
|
||||
|
|
21
packages/timer.nix
Normal file
21
packages/timer.nix
Normal file
|
@ -0,0 +1,21 @@
|
|||
{ pkgs }:
|
||||
|
||||
pkgs.writeShellApplication {
|
||||
name = "timer";
|
||||
|
||||
runtimeInputs = with pkgs; [
|
||||
_timer
|
||||
coreutils
|
||||
systemdMinimal
|
||||
];
|
||||
|
||||
text = ''
|
||||
mins=$1
|
||||
message="''${2:-}"
|
||||
|
||||
nohup _timer "$mins" "$message" &> /dev/null &
|
||||
|
||||
echo "timer started for $mins min"
|
||||
echo "timer started for $mins min, message: '$message'" | systemd-cat -t timer
|
||||
'';
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue