mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	grimshot: Skip creating a temp file when copying
This commit is contained in:
		
							parent
							
								
									f82de63856
								
							
						
					
					
						commit
						9cda5a5bd6
					
				
					 1 changed files with 1 additions and 6 deletions
				
			
		| 
						 | 
					@ -8,7 +8,6 @@
 | 
				
			||||||
##  - `wl-copy`: clipboard utility
 | 
					##  - `wl-copy`: clipboard utility
 | 
				
			||||||
##  - `jq`: json utility to parse swaymsg output
 | 
					##  - `jq`: json utility to parse swaymsg output
 | 
				
			||||||
##  - `notify-send`: to show notifications
 | 
					##  - `notify-send`: to show notifications
 | 
				
			||||||
##  - `mktemp`: to create a temporary file
 | 
					 | 
				
			||||||
## Those are needed to be installed, if unsure, run `grimshot check`
 | 
					## Those are needed to be installed, if unsure, run `grimshot check`
 | 
				
			||||||
##
 | 
					##
 | 
				
			||||||
## See `man 1 grimshot` or `grimshot usage` for further details.
 | 
					## See `man 1 grimshot` or `grimshot usage` for further details.
 | 
				
			||||||
| 
						 | 
					@ -109,7 +108,6 @@ if [ "$ACTION" = "check" ] ; then
 | 
				
			||||||
  check wl-copy
 | 
					  check wl-copy
 | 
				
			||||||
  check jq
 | 
					  check jq
 | 
				
			||||||
  check notify-send
 | 
					  check notify-send
 | 
				
			||||||
  check mktemp
 | 
					 | 
				
			||||||
  exit
 | 
					  exit
 | 
				
			||||||
elif [ "$SUBJECT" = "area" ] ; then
 | 
					elif [ "$SUBJECT" = "area" ] ; then
 | 
				
			||||||
  GEOM=$(slurp -d)
 | 
					  GEOM=$(slurp -d)
 | 
				
			||||||
| 
						 | 
					@ -134,10 +132,7 @@ else
 | 
				
			||||||
fi
 | 
					fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if [ "$ACTION" = "copy" ] ; then
 | 
					if [ "$ACTION" = "copy" ] ; then
 | 
				
			||||||
  TMP=$(mktemp) || die "Unable to create temp file: is mktemp installed?"
 | 
					  takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error"
 | 
				
			||||||
  takeScreenshot "$TMP" "$GEOM" "$OUTPUT"
 | 
					 | 
				
			||||||
  wl-copy --type image/png < "$TMP"  || die "Clipboard error"
 | 
					 | 
				
			||||||
  rm "$TMP"
 | 
					 | 
				
			||||||
  notifyOk "$WHAT copied to buffer"
 | 
					  notifyOk "$WHAT copied to buffer"
 | 
				
			||||||
else
 | 
					else
 | 
				
			||||||
  if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
 | 
					  if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue