diff options
Diffstat (limited to '')
-rw-r--r-- | hm/soispha/pkgs/scripts.nix | 12 | ||||
-rwxr-xr-x | hm/soispha/pkgs/scripts/wrappers/lock | 19 |
2 files changed, 31 insertions, 0 deletions
diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix index f366b138..d1a78c29 100644 --- a/hm/soispha/pkgs/scripts.nix +++ b/hm/soispha/pkgs/scripts.nix @@ -147,6 +147,17 @@ # path = "wrappers"; # dependencies = builtins.attrValues {inherit (pkgs) lf ueberzug;}; # }; + lock-scr = write_script { + name = "lock"; + path = "wrappers"; + dependencies = builtins.attrValues { + inherit + (pkgs) + taskwarrior + swaylock + ; + }; + }; lyrics-scr = write_script { name = "lyrics"; path = "wrappers"; @@ -194,6 +205,7 @@ in [ fupdate-scr hibernate-scr ll-scr + lock-scr lyrics-scr mpc-rm-scr neorg-scr diff --git a/hm/soispha/pkgs/scripts/wrappers/lock b/hm/soispha/pkgs/scripts/wrappers/lock new file mode 100755 index 00000000..ecc8c1a3 --- /dev/null +++ b/hm/soispha/pkgs/scripts/wrappers/lock @@ -0,0 +1,19 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.10.0" . %SHELL_LIBRARY_PATH + + +context="$(task _get rc.context)"; +[ "$context" ] && task context none + +# We have ensured that only one task is active +active="$(task +ACTIVE _ids)"; +[ "$active" ] && task stop "$active" + +swaylock + +[ "$active" ] && task start "$active" + +[ "$context" ] && task context "$context" +# vim: ft=sh |