{pkgs, ...}: with pkgs; { home.packages = [ (writeScriptBin "screenshot" '' notify_user() { ${pulseaudio}/bin/paplay ${sound-theme-freedesktop}/share/sounds/freedesktop/stereo/screen-capture.oga 2>/dev/null & ${libnotify}/bin/notify-send \ -a Clipboard \ -i ${builtins.toString ./clipboard.svg} \ -u low \ -r 699 "Clipboard" "Screenshot saved on clipboard" } screen() { ${maim}/bin/maim -u -f png | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png notify_user } window() { ${maim}/bin/maim -u -f png -i "$(${xdotool}/bin/xdotool getactivewindow)" | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png notify_user } area() { ${maim}/bin/maim -u -f png -s -b 2 -c 0.35,0.55,0.85,0.25 -l | ${pkgs.xclip}/bin/xclip -selection clipboard -t image/png notify_user } menu() { screen="󰍹" area="󰒉" window="" chosen="$(printf "%s\n%s\n%s\n%s\n" "$screen" "$area" "$window" | rofi -theme ${builtins.toString ./screenshot.rasi} -p 'Take Screenshot' -dmenu -selected-row 0 -theme-str 'listview {lines: 3;}')" case $chosen in "$screen") screen ;; "$area") area ;; "$window") window ;; esac } docs() { echo " Usage: screenshot [Options] --help - Prints this message Options: --screen - Take screenshot of the screen --window - Take screenshot of the focused window --area - Take screenshot of the selected area --menu - Opens a gui selector " } case $1 in --screen) screen ;; --window) window ;; --area) area ;; --menu) menu ;; --help | *) docs ;; esac '') ]; }