@@ -16,6 +16,7 @@ Options:
1616 -o, --output-folder directory in which to save screenshot
1717 -f, --filename the file name of the resulting screenshot
1818 -d, --debug print debug information
19+ -s, --silent don't send notification when screenshot is saved
1920 --clipboard-only copy screenshot to clipboard and don't save image in disk
2021 -- [command] open screenshot with a command of your choosing. e.g. hyprshot -m window -- mirage
2122
@@ -30,6 +31,14 @@ function Print() {
3031 [ $DEBUG -eq 1 ] && printf " $@ " >&2
3132}
3233
34+ function send_notification() {
35+ [ $SILENT -eq 0 ] && {
36+ notify-send " Screenshot saved" \
37+ " Image saved in <i>${1} </i> and copied to the clipboard." \
38+ -i " ${1} "
39+ }
40+ }
41+
3342function save_geometry() {
3443 [ -z " ${1} " ] && Print " no geometry\n" && exit 1;
3544
@@ -41,9 +50,7 @@ function save_geometry() {
4150 # outside the monitor
4251 convert $output -trim +repage $output
4352 wl-copy < " $output "
44- notify-send " Screenshot saved" \
45- " Image saved in <i>$output </i> and copied to the clipboard." \
46- -i " $output "
53+ send_notification $output
4754 [ -z " $COMMAND " ] || {
4855 " $COMMAND " " $output "
4956 }
@@ -81,7 +88,7 @@ function grab_window() {
8188}
8289
8390function args() {
84- local options=$( getopt -o hf:o:m:d --long help,filename:,output-folder:,mode:,clipboard-only,debug -- " $@ " )
91+ local options=$( getopt -o hf:o:m:ds --long help,filename:,output-folder:,mode:,clipboard-only,debug,silent -- " $@ " )
8592 [ $? -eq 0 ] || {
8693 Print " Invalid option provided\n"
8794 exit 2
@@ -116,6 +123,9 @@ function args() {
116123 -d | --debug)
117124 DEBUG=1
118125 ;;
126+ -s | --silent)
127+ SILENT=1
128+ ;;
119129 --)
120130 shift # Skip -- argument
121131 COMMAND=${@: 2}
@@ -137,6 +147,7 @@ function args() {
137147
138148CLIPBOARD=0
139149DEBUG=0
150+ SILENT=0
140151FILENAME=" $( date +' %Y-%m-%d-%H%M%S_hyprshot.png' ) "
141152[ -z " $HYPRSHOT_DIR " ] && SAVEDIR=${XDG_PICTURES_DIR:= ~} || SAVEDIR=${HYPRSHOT_DIR}
142153
0 commit comments