diff options
Diffstat (limited to 'pkgs/by-name/lo/lock')
-rwxr-xr-x | pkgs/by-name/lo/lock/lock.sh | 18 | ||||
-rw-r--r-- | pkgs/by-name/lo/lock/package.nix | 15 |
2 files changed, 33 insertions, 0 deletions
diff --git a/pkgs/by-name/lo/lock/lock.sh b/pkgs/by-name/lo/lock/lock.sh new file mode 100755 index 00000000..3101ef9a --- /dev/null +++ b/pkgs/by-name/lo/lock/lock.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="2.1.2" . %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 diff --git a/pkgs/by-name/lo/lock/package.nix b/pkgs/by-name/lo/lock/package.nix new file mode 100644 index 00000000..0e6e38d0 --- /dev/null +++ b/pkgs/by-name/lo/lock/package.nix @@ -0,0 +1,15 @@ +{ + sysLib, + taskwarrior, + swaylock, +}: +sysLib.writeShellScript { + name = "lock"; + src = ./lock.sh; + generateCompletions = false; + keepPath = false; + dependencies = [ + taskwarrior + swaylock + ]; +} |