shutter-project / shutter

Screenshot tool for Linux
https://shutter-project.org/
GNU General Public License v3.0
541 stars 35 forks source link

Shutter fails to detect active window #161

Open Photon89 opened 4 years ago

Photon89 commented 4 years ago

Scenario 1: there's a single window in the workspace and it is active.

Running shutter -c -d 3 -a for the first time works as expected.

However, repeating the command again (with shutter still running) fails to detect the (same) active window correctly: error message window 'no window with name pattern shutter detected' is displayed

Scenario 2: there are more than one window in the workspace. Last of them is active.

Running shutter -c -d 3 -a for the first time works as expected.

However, repeating the command again (with shutter still running) fails to detect the (same) active window correctly: shutter focuses and captures what appears to be first window in the workspace (even if it was not active initially)

additional console output in scenario 2: 'Exiting eval via last at /usr/share/shutter/resources/modules/Shutter/Screenshot/WindowName.pm line 75.'

shutter 0.93.1 Rev.1278 3.16.7.4-1-MANJARO x86_64 (64 bit gcc: 4.9.2) Desktop: LXDE (Openbox 3.5.2, lxpanel 0.8.0) X.Org 1.16.3, Mesa 10.4.2

Launchpad Details: #LP1418149 Mindaugas Jakutis - 2015-02-04 17:57:56 +0000

Photon89 commented 4 years ago

I replaced the default printscreen function command with 'shutter --active'. It pretty much works the same way as the author of the bug report described. For the profile settings, I use the filename: 'ToS_%NNN' and have it correctly save in a valid path.

I am a big fan of the feature not copying to clipboard. I tried the other settings but still end up as the same result.

From observation, it seems as though its buffering the image inside the shutter program itself instead of automatically being saved to the folder specified. When taking the screenshot, the shutter icon in the task panel momentarily disappears but then reappears after screenshot either succeeded or failed.

When it fails, it produces the error message "No window with name pattern 'shutter' detected" with the error title being: 'Error while taking the screenshot.' When it fails it just crashes shutter it seems.

It is weird that it worked fine in previous versions of shutter.

Shutter 0.93.1 Rev.1278 Linux mint 17.1 x86_64 Desktop: KDE

Launchpad Details: #LPC Harrison - 2015-02-15 06:53:19 +0000

Photon89 commented 4 years ago

I didn't have this issue under KDE4, but after an upgrade to fedora 22 with KDE5 and adding a global shortcut 'shutter -a' I get the failed to detect error. Interestingly, running shutter -a from a terminal works just fine. Perhaps something to do with the environment the global shortcut gets executed in?

Launchpad Details: #LPC random - 2015-08-07 04:42:57 +0000

Photon89 commented 4 years ago

I was able to work around the issue by changing my keybinding to use shutter -w which allows selecting the window to screenshot by clicking on it. Not as fluid as active window would be but at least I can easily take a screenshot of a particular window now.

Launchpad Details: #LPC nicholas - 2015-08-25 00:13:05 +0000

Photon89 commented 4 years ago

There is a problem with -w: it can't detect a full screen window of Chrome. Furthermore, under KDE, it draws window titles in incorrect encodings, but I guess that's a GTK or Qt issue.

This got broken after I upgraded from 0.90 to 0.93.1. Before, shutter could capture active windows just fine (but occasionally freezed after being launched with a shortcut, sometimes to the point that I had to pkill it).

Launchpad Details: #LPC Pastafarianist - 2015-09-02 18:34:38 +0000

Photon89 commented 4 years ago

I've defined a Keyboard Macro for "Shift-Print" to launch "shutter --active".

First call is ok. Second time varies: a) First time is ok. b) Second and other time varies. b1) mostly: wrong window taken. b2) or: 'no window with name pattern shutter detected' # ?? It was just an active "Terminal" window. c) Launch via terminal is ok d) If Shutter is terminated via "Quit" button then the next time will be is the first time, it's ok again. Therefore this is a valid workaround: You may quit shutter also with Ctrl-Q in case it was the wrong window and redo the snapshot again.

Xubuntu 15.04; XFCE shutter --version defined(@array) is deprecated at /usr/bin/shutter line 3727. (Maybe you should just omit the defined()?) defined(@array) is deprecated at /usr/bin/shutter line 3738. (Maybe you should just omit the defined()?) WARNING: gnome-web-photo is missing --> screenshots of websites will be disabled!

WARNING: Image::ExifTool is missing --> writing Exif information will be disabled!

0.92 Rev.1269

Launchpad Details: #LPC Andreas Wehler - 2015-09-05 12:18:54 +0000

Photon89 commented 4 years ago

I haven't seen this bug under 0.91, but have seen it multiple times under 0.93.1. Therefore, the problem is somewhere in https://bazaar.launchpad.net/~mario-kemper/shutter/devel/revision/1278?remember=1260&compare_revid=1260#bin/shutter

Launchpad Details: #LPC Pastafarianist - 2015-09-23 14:53:13 +0000

Photon89 commented 4 years ago

Correction: it also shows up in 0.92 (rev 1269).

https://bazaar.launchpad.net/~mario-kemper/shutter/devel/revision/1269?remember=1260&compare_revid=1260#bin/shutter

I don't know anything about the internals of Shutter, but maybe line 328 in rev 1269 contains the bug?

Launchpad Details: #LPC Pastafarianist - 2015-12-24 12:56:12 +0000

Photon89 commented 4 years ago

Hi.

SUCCESS!

Ubuntu 16.04; shutter 0.93.1 Rev.1278

@random seems to be right. Keyboard shortcut may be wrapped within a separate bash, then it works:

Shortcut for Shift+Print

This fails:

shutter --active

This works:

bash -c "shatter --active"

Have fun!

Thanks for he great shutter, Andreas

Launchpad Details: #LPC Andreas Wehler - 2016-06-29 07:33:42 +0000

Photon89 commented 4 years ago

Attachment: Snap_002.png

Hi.

Ok, 2nd time shutter will not find a window with pattern "shutter". So, it's a bit tricky, but this finally works:

Shortcut for Shift+Print

bash -c "pkill shutter ; shutter --active"

Keep in mind to adjust shutter preferences as needed,

e.g. (see screenshot).

Andreas

Launchpad Details: #LPC Andreas Wehler - 2016-06-29 08:54:36 +0000

Photon89 commented 4 years ago

@andreas-wehler, you're workaround works perfectly for me. Hopefully this can get fixed in the next version.

Doug

Launchpad Details: #LPC Doug Rohm - 2016-07-17 23:04:23 +0000

Photon89 commented 4 years ago

I am getting "No window with name pattern 'shutter' detected", but the solution bash -c "shutter --active" doesn't work. Installation was a couple of days ago from the repositor.

I am using shutter 0.93.1 Rev.1278 System: Host: maccin18 Kernel: 4.4.0-62-generic x86_64 (64 bit gcc: 5.4.0) Desktop: Cinnamon 3.2.7 (Gtk 3.18.9-1ubuntu3.1) dm: mdm Distro: Linux Mint 18.1 Serena

Launchpad Details: #LPC ineuw - 2017-02-07 01:30:51 +0000

Photon89 commented 4 years ago

For me the issue is that with bash -c "shutter --active" it only takes a screenshot of my browser (chromium) window. It's weird. Terminal commands work like a charm. Even menu items work as expected. But the keys shortcut option not.

My system is:

Linux eftvlap 3.16.0-4-686-pae #1 SMP Debian 3.16.39-1+deb8u1 (2017-02-22) i686 GNU/Linux

Distributor ID: Debian Description: Debian GNU/Linux 8.7 (jessie) Release: 8.7 Codename: jessie

Shutter version: 0.92 Rev.1269

The terminal shows me also a couple of notices or errors:

defined(@array) is deprecated at /usr/bin/shutter line 3727. (Maybe you should just omit the defined()?) defined(@array) is deprecated at /usr/bin/shutter line 3738. (Maybe you should just omit the defined()?)

and lot kind of these:

GLib-GObject-WARNING **: /build/glib2.0-3vWc1h/glib2.0-2.42.1/./gobject/gsignal.c:2461: signal 'child-added' is invalid for instance '0xacab070' of type 'GtkMenu' at /usr/lib/i386-linux-gnu/perl5/5.20/Gtk2/AppIndicator.pm line 177, line 19.

Launchpad Details: #LPC elviseftv - 2017-03-18 21:42:30 +0000

Photon89 commented 4 years ago

Attachment: scrot application.png

here's the solution: my linux distribution is: Linux Mint xfce 19.3

1) install the application: scrot (Linux command-line screenshot) in the terminal type: sudo apt install scrot or at the application manager search for scrot and install it

2)at the application manager search for the keyboard settings editor and in the application shortcuts tab, click the add button and paste the command: scrot '/tmp/image%F%T.png' --focused --exec 'shutter $f' click the ok button and then choose the key or shortcut key combination(see attached screenshot "keyboard shortcut.png"). You can change the /tmp folder to a different folder to save the screenshots.

here it worked perfectly!

Launchpad Details: #LPC Olavo Lucena - 2020-05-17 00:09:04 +0000