|
12 | 12 | mpv "$(wl-paste)" |
13 | 13 | ''; |
14 | 14 |
|
| 15 | + grimblast = "${inputs.hyprland-contrib.packages.${pkgs.system}.grimblast}/bin/grimblast"; |
15 | 16 | playerctl = "${pkgs.playerctl}/bin/playerctl"; |
16 | 17 | brightnessctl = "${pkgs.brightnessctl}/bin/brightnessctl"; |
17 | 18 | pactl = "${pkgs.pulseaudio}/bin/pactl"; |
| 19 | + notify-send = "${pkgs.libnotify}/bin/notify-send"; |
| 20 | + |
| 21 | + snapshot = pkgs.writeShellScriptBin "snapshot" '' |
| 22 | + outputDir="$HOME/Pictures/Screenshots/" |
| 23 | + outputFile="snapshot_$(date +%Y-%m-%d_%H-%M-%S).png" |
| 24 | + outputPath="$outputDir/$outputFile" |
| 25 | + mkdir -p "$outputDir" |
| 26 | +
|
| 27 | + mode=''${1:-area} |
| 28 | +
|
| 29 | + case "$mode" in |
| 30 | + active) |
| 31 | + command="${grimblast} copysave active $outputPath" |
| 32 | + ;; |
| 33 | + output) |
| 34 | + command="${grimblast} copysave output $outputPath" |
| 35 | + ;; |
| 36 | + area) |
| 37 | + command="${grimblast} copysave area $outputPath" |
| 38 | + ;; |
| 39 | + *) |
| 40 | + echo "Invalid option: $mode" |
| 41 | + echo "Usage: $0 {active|output|area}" |
| 42 | + exit 1 |
| 43 | + ;; |
| 44 | + esac |
| 45 | +
|
| 46 | +
|
| 47 | + if eval "$command"; then |
| 48 | + recentFile=$(find "$outputDir" -name 'snapshot_*.png' -printf '%T+ %p\n' | sort -r | head -n 1 | cut -d' ' -f2-) |
| 49 | + ${notify-send} "Grimblast" "Your snapshot has been saved." \ |
| 50 | + -i video-x-generic \ |
| 51 | + -a "Grimblast" \ |
| 52 | + -t 7000 \ |
| 53 | + -u normal \ |
| 54 | + --action="scriptAction:-xdg-open $outputDir=Directory" \ |
| 55 | + --action="scriptAction:-xdg-open $recentFile=View" |
| 56 | + fi |
| 57 | + ''; |
18 | 58 | in |
19 | 59 | { |
20 | 60 | xdg.desktopEntries."org.gnome.Settings" = { |
|
26 | 66 | terminal = false; |
27 | 67 | }; |
28 | 68 |
|
| 69 | + home.packages = [ |
| 70 | + inputs.hyprland-contrib.packages.${pkgs.system}.grimblast # or any other package |
| 71 | + ]; |
| 72 | + |
29 | 73 | wayland.windowManager.hyprland = { |
30 | 74 | enable = true; |
31 | 75 | package = null; |
|
171 | 215 | # ",XF86PowerOff, ${e} -r 'powermenu.shutdown()'" |
172 | 216 | # "SUPER, bracketleft, ${e} -r 'recorder.start()'" |
173 | 217 | # "SUPER, bracketright, ${e} -r 'recorder.stop()'" |
174 | | - # ",Print, ${e} -r 'recorder.screenshot()'" |
| 218 | + ",Print, exec, ${snapshot}/bin/snapshot" |
175 | 219 | # "SHIFT,Print, ${e} -r 'recorder.screenshot(true)'" |
176 | 220 | # "SUPER, V, ${e} -r 'launcher.open(\":ch \")'" |
177 | 221 | "SUPER, V, exec, rofi -modi clipboard:${pkgs.cliphist}/bin/cliphist-rofi-img -show clipboard -show-icons" |
|
185 | 229 | "SUPER, X, exec, zeditor" |
186 | 230 | "SUPER, D, exec, vesktop" |
187 | 231 | "SUPER, M, exec, spotify" |
188 | | - "SUPER, E, exec, gtk-launch org.gnome.Nautilus" |
| 232 | + "SUPER, E, exec, nautilus" |
189 | 233 | "SUPER, I, exec, gtk-launch org.gnome.Settings" |
190 | 234 |
|
191 | 235 | # youtube |
|
0 commit comments