mirror of
https://github.com/kmein/niveum
synced 2026-03-16 10:11:08 +01:00
feat: fix secrets permissions, move ./packages to flake outputs
This commit is contained in:
42
packages/dmenu-scrot.nix
Normal file
42
packages/dmenu-scrot.nix
Normal file
@@ -0,0 +1,42 @@
|
||||
{
|
||||
writers,
|
||||
lib,
|
||||
dmenu,
|
||||
scrot,
|
||||
libnotify,
|
||||
xclip,
|
||||
screenshotsDirectory ? "/tmp",
|
||||
}:
|
||||
writers.writeDashBin "dmenu-scrot" ''
|
||||
# ref https://gitlab.com/dwt1/dotfiles/-/blob/master/.dmenu/dmenu-scrot.sh
|
||||
PATH=$PATH:${lib.makeBinPath [dmenu scrot libnotify xclip]}
|
||||
|
||||
APP_NAME="📸 Scrot"
|
||||
IMG_PATH="${screenshotsDirectory}"
|
||||
TIME=3000 #Miliseconds notification should remain visible
|
||||
|
||||
cmd=$(printf "fullscreen\nsection\nupload_fullscreen\nupload_section\n" | dmenu -p 'Screenshot')
|
||||
|
||||
cd "$IMG_PATH" || exit
|
||||
case ''${cmd%% *} in
|
||||
fullscreen)
|
||||
scrot -d 1 \
|
||||
&& notify-send -u low -t $TIME -a "$APP_NAME" 'Screenshot (full screen) saved.'
|
||||
;;
|
||||
|
||||
section)
|
||||
scrot -s \
|
||||
&& notify-send -u low -t $TIME -a "$APP_NAME" 'Screenshot (section) saved.'
|
||||
;;
|
||||
|
||||
upload_fullscreen)
|
||||
scrot -d 1 -e "kpaste < \$f" | tail --lines=1 | xclip -selection clipboard -in \
|
||||
&& notify-send -u low -t $TIME -a "$APP_NAME" "Screenshot (full screen) uploaded: $(xclip -selection clipboard -out)"
|
||||
;;
|
||||
|
||||
upload_section)
|
||||
scrot -s -e "kpaste < \$f" | tail --lines=1 | xclip -selection clipboard -in \
|
||||
&& notify-send -u low -t $TIME -a "$APP_NAME" "Screenshot (section) uploaded: $(xclip -selection clipboard -out)"
|
||||
;;
|
||||
esac
|
||||
''
|
||||
Reference in New Issue
Block a user