gnome-shell-screenshot icon indicating copy to clipboard operation
gnome-shell-screenshot copied to clipboard

open in default image viewer without notification?

Open bradwood opened this issue 5 years ago • 5 comments

Hi,

Is it possible to make the screenshot immediately open in the default image viewer as soon as the screenshot is taken?

Ie, avoiding the notifications at all.

bradwood avatar Sep 21 '19 20:09 bradwood

Just to give more context, I am trying to get behaviour as close as possible to that of a Mac tool called Screenfloat

The use case that this tool does so well is immediately opens the screenshot on the screen after it's taken and sets the window to be always on top and on all desktops. This makes it really handy if you are working on a laptop with limited screen space and you want to grab a bit of stuff and then keep it available when you switch to another desktop.

I have got this more or less working with viewnior as a the viewer, wmctrl to enable the sticky and above window properties, and so now I just need the bit that will immediately open the screenshot without a notification...

Many thanks -- this is a great tool!

bradwood avatar Sep 21 '19 20:09 bradwood

In fact, here is a pretty ropey implementation (especially with the sleeps) but it does work. I disable the notification totally, and rely on dbus-monitor to grab the filename and open it.

#!/usr/bin/env bash
set -x

dbus-monitor "interface='org.gnome.Shell.Screenshot'" | \
	grep --line-buffered "string \"/tmp" | \
	while read line
	do
		filename=$(echo $line | sed -E 's/^.+\"(.+)\"/\1/')
		sleep 0.2
		viewnior $filename & 
		sleep 0.2
		wmctrl -r $(basename $filename) -b add,sticky,above
	done

It would, of course, be much nicer if the plugin just opened the window directly, and, as a bonus, sets the sticky and above window properties on open...

bradwood avatar Sep 21 '19 22:09 bradwood

This is one of these use cases that could be solved with https://github.com/OttoAllmendinger/gnome-shell-screenshot/issues/15

Although in this case it might make sense to just add another option. I'll look into it!

OttoAllmendinger avatar Sep 23 '19 13:09 OttoAllmendinger

You can now configure a custom command after capture https://github.com/OttoAllmendinger/gnome-shell-screenshot/issues/15#issuecomment-748811544

OttoAllmendinger avatar Dec 21 '20 07:12 OttoAllmendinger

I think to emulate Screenfloat you could use feh -x {f}

OttoAllmendinger avatar Dec 21 '20 07:12 OttoAllmendinger