diff options
Diffstat (limited to 'hm')
-rw-r--r-- | hm/soispha/pkgs/scripts.nix | 46 | ||||
-rwxr-xr-x | hm/soispha/pkgs/scripts/small_functions/screenshot_persistent | 25 | ||||
-rwxr-xr-x | hm/soispha/pkgs/scripts/small_functions/screenshot_temporary | 8 |
3 files changed, 69 insertions, 10 deletions
diff --git a/hm/soispha/pkgs/scripts.nix b/hm/soispha/pkgs/scripts.nix index 63a38a34..f97bf50b 100644 --- a/hm/soispha/pkgs/scripts.nix +++ b/hm/soispha/pkgs/scripts.nix @@ -9,12 +9,21 @@ name, path, dependencies, + keep_path ? false, }: - sysLib.writeShellScriptWithLibrary { - inherit name; - src = ./scripts/${path}/${name}; - dependencies = dependencies ++ [pkgs.dash]; - }; + if keep_path + then + sysLib.writeShellScriptWithLibraryAndKeepPath { + inherit name; + src = ./scripts/${path}/${name}; + dependencies = dependencies ++ [pkgs.dash]; + } + else + sysLib.writeShellScriptWithLibrary { + inherit name; + src = ./scripts/${path}/${name}; + dependencies = dependencies ++ [pkgs.dash]; + }; aumo-scr = write_script { name = "aumo"; @@ -49,15 +58,31 @@ path = "small_functions"; dependencies = builtins.attrValues {inherit (pkgs) glib;}; }; - screen_shot-scr = write_script { - name = "screen_shot"; + screenshot_persistent-scr = write_script { + name = "screenshot_persistent"; path = "small_functions"; - dependencies = builtins.attrValues {inherit (pkgs) grim slurp alacritty;}; # TODO: add llp + keep_path = true; + dependencies = builtins.attrValues { + inherit + (pkgs) + grim + slurp + alacritty + rofi + libnotify + lf # TODO: add llp + ; + }; }; mocs-scr = write_script { name = "mocs"; path = "small_functions"; - dependencies = builtins.attrValues {inherit (pkgs) ncmpc procps;}; # TODO: add mymocp + dependencies = []; + }; + screenshot_temporary-scr = write_script { + name = "screenshot_temporary"; + path = "small_functions"; + dependencies = builtins.attrValues {inherit (pkgs) grim slurp wl-clipboard;}; }; neorg-scr = sysLib.writeShellScriptWithLibraryAndKeepPath { name = "neorg"; @@ -131,7 +156,8 @@ in [ # llp-scr # TODO: see above mocs-scr neorg-scr - screen_shot-scr + screenshot_persistent-scr + screenshot_temporary-scr # spodi-scr # # TODO: Reactivate when spotdl builds again <2023-10-31> update-sys-scr virsh-del-scr diff --git a/hm/soispha/pkgs/scripts/small_functions/screenshot_persistent b/hm/soispha/pkgs/scripts/small_functions/screenshot_persistent new file mode 100755 index 00000000..a683af2f --- /dev/null +++ b/hm/soispha/pkgs/scripts/small_functions/screenshot_persistent @@ -0,0 +1,25 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.7.1" . %SHELL_LIBRARY_PATH + +# only generate a path (this could lead to a time-of-check/time-of-use bug) +tmp="$(mktmp --dry-run)" + +if grim -g "$(slurp)" "$tmp" +then + name="$(rofi -dmenu -p "Name of screenshot: " -l 0)"; + screen_shot_path="$HOME/media/pictures/screenshots/$name.png"; + while [ -f "$screen_shot_path" ] + do + notify-send "Warning" 'Screenshot name already in use!' + name="$(rofi -dmenu -p "New name of screenshot: " -l 0)"; + screen_shot_path="$HOME/media/pictures/screenshots/$name.png"; + done + + mv "$tmp" "$screen_shot_path"; + alacritty -e lf -command ":{{ set sortby atime; set reverse!; }}"; +fi + + +# vim: ft=sh diff --git a/hm/soispha/pkgs/scripts/small_functions/screenshot_temporary b/hm/soispha/pkgs/scripts/small_functions/screenshot_temporary new file mode 100755 index 00000000..9dca8774 --- /dev/null +++ b/hm/soispha/pkgs/scripts/small_functions/screenshot_temporary @@ -0,0 +1,8 @@ +#! /usr/bin/env dash + +# shellcheck source=/dev/null +SHELL_LIBRARY_VERSION="1.7.1" . %SHELL_LIBRARY_PATH + +grim -g "$(slurp)" | wl-copy + +# vim: ft=sh |