shutter-project / shutter

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

Shutter fails to launch at start in Gnome #372

Open hongyi-zhao opened 3 years ago

hongyi-zhao commented 3 years ago

On Ubuntu 20.04, I installed the latest git master version of shutter and I want to let it start automatically after the user logs in to the desktop.

Any hints for this?

Regards, HY

delinuxco commented 3 years ago

No is not much info...

delinuxco commented 3 years ago

So I did an install of DeLinuxCo (Cinnamon) onto my God Daughters Toshiba Satellite laptop and it also had issue starting, but I found that this laptop is a little older, has one memory module in a dual memory system with spinning rust and it was taking 52 seconds to login from the login prompt. So in this case I had to increase the delay to 30 seconds. Now, depending on the speed of your system and how many startup items you have, it may take more.

here is the fix.

  1. First, start Shutter manually and go to settings and uncheck the auto start.
  2. shutdown Shutter completely
  3. Go to ~/.config/autostart/ and remove the shutter.desktop file if it is still there.
  4. Manually restart shutter and go to options and enable auto start.
  5. Edit the auto start file or use the GUI if available and increase the delay by at least half of the login time.
  6. Adjust delay as needed.
hongyi-zhao commented 3 years ago

@delinuxco You above method seems rather tricky and cumbersome. What about do the trick with gnome-shell-minimize-to-tray or the underlying relevant tools: xdotool, wmctrl, x11-utils, and libwnck-3-0?

delinuxco commented 3 years ago

gnome-shell-minimize-to-tray does not change the delay of the program loading. This is not a Shutter problem, it's a loading issue.

hongyi-zhao commented 3 years ago

What's the underlying mechanism of the loading issue which triggered this problem?

delinuxco commented 3 years ago

Not really sure, but it has to do with the speed of the system, the number of startup items and the resources the starting application needs.

Also for those that may be on a KDE /Plasma dekstop, to enable a delay, you have add a sleep command to the execute line in shutter.desktop

Exec=bash -c “sleep 5 && shutter”

hongyi-zhao commented 3 years ago

Exec=bash -c “sleep 5 && shutter”

This method also does the trick for Gnome:

$ cat ~/.config/autostart/shutter-delay-start.desktop 
[Desktop Entry]
Version=1.0
Name=Shutter
Name[de_DE]=Shutter
Name[pt_BR]=Shutter
GenericName=Screenshot Tool
GenericName[de_DE]=Anwendung für Bildschirmfotos
GenericName[pt_BR]=Captura de tela
Comment=Capture, edit and share screenshots
Comment[de_DE]=Bildschirmfotos aufnehmen, bearbeiten und mit Anderen teilen
Comment[pt_BR]=Aplicativo avançado para capturar imagens da tela
Exec=bash -c "sleep 10 && shutter --min_at_startup"
Icon=shutter
Terminal=false
Type=Application
Categories=Utility;Application;
X-GNOME-Autostart-enabled=true
Hidden=false
DarthGandalf commented 3 years ago

@hongyi-zhao can you show your settings.xml?

hongyi-zhao commented 3 years ago
$ cat ~/.shutter/settings.xml 
<opt>
  <general app_version="0.98Rev.1570" as_help_active="1" asel_h="0" asel_w="0" asel_x="0" asel_y="0" ask_on_delete="" ask_on_fs_delete="" autofs="1" autofs_min="1" autofs_not="" autohide="1" autohide_time="400" autoshape_active="" border="1" bordereffect="2" bordereffect_active="" bordereffect_col="#000000" close_at_close="1" current_monitor_active="" cursor="1" delay="5" delete_on_close="" filename="$name_%NNN" filetype="2" fname_autocopy="" folder="/home/werner/Pictures" ftp_mode="0" ftp_password="" ftp_uri="ftp://host:port/path" ftp_username="" ftp_wurl="http://example.com/screenshots" im_colors="2" im_colors_active="" image_autocopy="1" last_profile="0" last_profile_name="*" menu_delay="10" menu_waround="1" no_autocopy="" notify_after="1" notify_agent="1" notify_ptimeout="1" notify_timeout="1" present_after="1" prog="Built-in Editor" prog_active="" quality="9" save_ask="" save_auto="1" save_no="" session_asc="" session_asc_combo="1" session_desc="1" session_desc_combo="1" thumbnail="50" thumbnail_active="" trans_backg="" trans_check="1" trans_custom="" trans_custom_col="#000000" visible_windows="" web_timeout="30" web_width="2" winresize_active="" winresize_h="500" winresize_w="500" zoom_active="1" />
  <gui btoolbar_active="" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/perl/spbardistortion" binary="/usr/local/share/shutter/resources/system/plugins/perl/spbardistortion/spbardistortion" category="Effect" lang="perl" name_plugin="Barrel Distortion" tooltip="Apply a distortion effect to your screenshot" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/perl/spnegate" binary="/usr/local/share/shutter/resources/system/plugins/perl/spnegate/spnegate" category="Effect" lang="perl" name_plugin="Negate" tooltip="Invert the colours of the image" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/perl/sppolaroid" binary="/usr/local/share/shutter/resources/system/plugins/perl/sppolaroid/sppolaroid" category="Effect" lang="perl" name_plugin="Polaroid" tooltip="Make your screenshot look like a polaroid photo, add a caption, and even rotate it a little" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/perl/spresize" binary="/usr/local/share/shutter/resources/system/plugins/perl/spresize/spresize" category="Tool" lang="perl" name_plugin="Resize" tooltip="Resize your screenshot" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/perl/spsepia" binary="/usr/local/share/shutter/resources/system/plugins/perl/spsepia/spsepia" category="Effect" lang="perl" name_plugin="Sepia" tooltip="Add sepia color toning to the image" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/perl/spshadow" binary="/usr/local/share/shutter/resources/system/plugins/perl/spshadow/spshadow" category="Effect" lang="perl" name_plugin="Hard Shadow" tooltip="Add a shadow to the image on a transparent background" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/perl/spwatermark" binary="/usr/local/share/shutter/resources/system/plugins/perl/spwatermark/spwatermark" category="Effect" lang="perl" name_plugin="Watermark" tooltip="Add a custom text watermark to your screenshot" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/shell/spgrayscale" binary="/usr/local/share/shutter/resources/system/plugins/shell/spgrayscale/spgrayscale" category="Effect" lang="shell" name_plugin="Greyscale" tooltip="Turn the image into a greyscale image (256 shades)" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/shell/spoffset" binary="/usr/local/share/shutter/resources/system/plugins/shell/spoffset/spoffset" category="Effect" lang="shell" name_plugin="Offset" tooltip="Give the picture an offset with itself as background" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/shell/spraise" binary="/usr/local/share/shutter/resources/system/plugins/shell/spraise/spraise" category="Effect" lang="shell" name_plugin="Raise Border" tooltip="Raise a rectangular 3D border" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/shell/spsoftedges" binary="/usr/local/share/shutter/resources/system/plugins/shell/spsoftedges/spsoftedges" category="Effect" lang="shell" name_plugin="Soft Edges" tooltip="Add soft edges around the image" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/shell/spsunk" binary="/usr/local/share/shutter/resources/system/plugins/shell/spsunk/spsunk" category="Effect" lang="shell" name_plugin="Sunk Border" tooltip="Add an inverted 3D border to the image" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/shell/sptornedpaper" binary="/usr/local/share/shutter/resources/system/plugins/shell/sptornedpaper/sptornedpaper" category="Effect" lang="shell" name_plugin="Torn Paper" tooltip="Add a torn-like border to the image" />
  <plugins name="/usr/local/share/shutter/resources/system/plugins/shell/sptrim" binary="/usr/local/share/shutter/resources/system/plugins/shell/sptrim/sptrim" category="Tool" lang="shell" name_plugin="Autocrop" tooltip="Remove empty borders from the image" />
  <plugins name="/usr/share/shutter/resources/system/plugins/perl/spbardistortion" binary="/usr/share/shutter/resources/system/plugins/perl/spbardistortion/spbardistortion" category="Effect" lang="perl" name_plugin="Barrel Distortion" tooltip="Apply a distortion effect to your screenshot" />
  <plugins name="/usr/share/shutter/resources/system/plugins/perl/spnegate" binary="/usr/share/shutter/resources/system/plugins/perl/spnegate/spnegate" category="Effect" lang="perl" name_plugin="Negate" tooltip="Invert the colours of the image" />
  <plugins name="/usr/share/shutter/resources/system/plugins/perl/sppolaroid" binary="/usr/share/shutter/resources/system/plugins/perl/sppolaroid/sppolaroid" category="Effect" lang="perl" name_plugin="Polaroid" tooltip="Make your screenshot look like a polaroid photo, add a caption, and even rotate it a little" />
  <plugins name="/usr/share/shutter/resources/system/plugins/perl/spresize" binary="/usr/share/shutter/resources/system/plugins/perl/spresize/spresize" category="Tool" lang="perl" name_plugin="Resize" tooltip="Resize your screenshot" />
  <plugins name="/usr/share/shutter/resources/system/plugins/perl/spsepia" binary="/usr/share/shutter/resources/system/plugins/perl/spsepia/spsepia" category="Effect" lang="perl" name_plugin="Sepia" tooltip="Add sepia color toning to the image" />
  <plugins name="/usr/share/shutter/resources/system/plugins/perl/spshadow" binary="/usr/share/shutter/resources/system/plugins/perl/spshadow/spshadow" category="Effect" lang="perl" name_plugin="Hard Shadow" tooltip="Add a shadow to the image on a transparent background" />
  <plugins name="/usr/share/shutter/resources/system/plugins/perl/spwatermark" binary="/usr/share/shutter/resources/system/plugins/perl/spwatermark/spwatermark" category="Effect" lang="perl" name_plugin="Watermark" tooltip="Add a custom text watermark to your screenshot" />
  <plugins name="/usr/share/shutter/resources/system/plugins/shell/spgrayscale" binary="/usr/share/shutter/resources/system/plugins/shell/spgrayscale/spgrayscale" category="Effect" lang="shell" name_plugin="Greyscale" tooltip="Turn the image into a greyscale image (256 shades)" />
  <plugins name="/usr/share/shutter/resources/system/plugins/shell/spoffset" binary="/usr/share/shutter/resources/system/plugins/shell/spoffset/spoffset" category="Effect" lang="shell" name_plugin="Offset" tooltip="Give the picture an offset with itself as background" />
  <plugins name="/usr/share/shutter/resources/system/plugins/shell/spraise" binary="/usr/share/shutter/resources/system/plugins/shell/spraise/spraise" category="Effect" lang="shell" name_plugin="Raise Border" tooltip="Raise a rectangular 3D border" />
  <plugins name="/usr/share/shutter/resources/system/plugins/shell/spsoftedges" binary="/usr/share/shutter/resources/system/plugins/shell/spsoftedges/spsoftedges" category="Effect" lang="shell" name_plugin="Soft Edges" tooltip="Add soft edges around the image" />
  <plugins name="/usr/share/shutter/resources/system/plugins/shell/spsunk" binary="/usr/share/shutter/resources/system/plugins/shell/spsunk/spsunk" category="Effect" lang="shell" name_plugin="Sunk Border" tooltip="Add an inverted 3D border to the image" />
  <plugins name="/usr/share/shutter/resources/system/plugins/shell/sptornedpaper" binary="/usr/share/shutter/resources/system/plugins/shell/sptornedpaper/sptornedpaper" category="Effect" lang="shell" name_plugin="Torn Paper" tooltip="Add a torn-like border to the image" />
  <plugins name="/usr/share/shutter/resources/system/plugins/shell/sptrim" binary="/usr/share/shutter/resources/system/plugins/shell/sptrim/sptrim" category="Tool" lang="shell" name_plugin="Autocrop" tooltip="Remove empty borders from the image" />
  <recent ruu_hosting="0" ruu_places="0" ruu_tab="0" />
</opt>
hongyi-zhao commented 3 years ago

Exec=bash -c “sleep 5 && shutter”

This method also does the trick for Gnome:

Based on further experience, even with a 10-second delay, this approach still doesn’t work the first time I log on to the desktop immediately after the OS is started, and it only works if I log out and re-log into the desktop.

delinuxco commented 3 years ago

What happens if you give it 60 seconds?

hongyi-zhao commented 3 years ago

Based on my further experience, even a 60-second delay, doesn’t guarantee the autostart of shutter for the first time of logging on to the desktop immediately after the OS is started, i.e., sometimes it works, and sometimes it doesn't. The .desktop file used for the testing is shown below:

$ cat ~/.config/autostart/shutter1.desktop 
[Desktop Entry]
Version=1.0
Name=Shutter
Name[de_DE]=Shutter
Name[pt_BR]=Shutter
GenericName=Screenshot Tool
GenericName[de_DE]=Anwendung für Bildschirmfotos
GenericName[pt_BR]=Captura de tela
Comment=Capture, edit and share screenshots
Comment[de_DE]=Bildschirmfotos aufnehmen, bearbeiten und mit Anderen teilen
Comment[pt_BR]=Aplicativo avançado para capturar imagens da tela
Exec=bash -c "sleep 60 && shutter --min_at_startup"
Icon=shutter
Terminal=false
Type=Application
Categories=Utility;Application;
X-GNOME-Autostart-enabled=true
Hidden=false

At the moment, I use a 200-second delay, and it seems works.

VladimirMrzv commented 2 years ago

At the moment, I use a 200-second delay, and it seems works.

This does not help me. Shutter not autostart. I am on Ubuntu 22.04 with Unity.

Photon89 commented 2 years ago

Just to make sure: Shutter works as expected if started by hand, just the autostart is an issue?

VladimirMrzv commented 2 years ago

Yes works fine, just the autostart is an issue

delinuxco commented 2 years ago

If Shutter still does not auto start, edit ~/.config/autostart/shutter.desktop and add the following at the end of the file:

X-GNOME-Autostart-Delay=5 Of course you can change the 5 to what ever amount of seconds you want, save and restart your computer.

hongyi-zhao commented 2 years ago

I tried according the above guidance with the following desktop file, but still failed to achieve the aim:

werner@X10DAi-00:~/.config/autostart$ cat shutter.desktop
[Desktop Entry]
Version=1.0
Name=Shutter
Name[de_DE]=Shutter
Name[pt_BR]=Shutter
GenericName=Screenshot Tool
GenericName[de_DE]=Anwendung für Bildschirmfotos
GenericName[pt_BR]=Captura de tela
Comment=Capture, edit and share screenshots
Comment[de_DE]=Bildschirmfotos aufnehmen, bearbeiten und mit Anderen teilen
Comment[pt_BR]=Aplicativo avançado para capturar imagens da tela
Exec=shutter --min_at_startup
Icon=shutter
Terminal=false
Type=Application
Categories=Utility;Application;
X-GNOME-Autostart-enabled=true
Hidden=false
X-GNOME-Autostart-Delay=5
VladimirMrzv commented 2 years ago

Two times autostart works. I think it helps.

cat ~/.config/autostart/shutter.desktop [Desktop Entry] Version=1.0 Name=Shutter Name[de_DE]=Shutter Name[pt_BR]=Shutter GenericName=Screenshot Tool GenericName[de_DE]=Anwendung für Bildschirmfotos GenericName[pt_BR]=Captura de tela Comment=Capture, edit and share screenshots Comment[de_DE]=Bildschirmfotos aufnehmen, bearbeiten und mit Anderen teilen Comment[pt_BR]=Aplicativo avançado para capturar imagens da tela Exec=shutter --min_at_startup Icon=shutter Terminal=false Type=Application Categories=Utility;Application; X-GNOME-Autostart-enabled=true X-GNOME-Autostart-Delay=30 Hidden=false

hongyi-zhao commented 2 years ago

Based on my tries, the X-GNOME-Autostart-Delay=30 setting in ~/.config/autostart/shutter.desktop will be automatically removed by shutter:

werner@X10DAi-00:~$ cat .config/autostart/shutter.desktop 
[Desktop Entry]
Version=1.0
Name=Shutter
Name[de_DE]=Shutter
Name[pt_BR]=Shutter
GenericName=Screenshot Tool
GenericName[de_DE]=Anwendung für Bildschirmfotos
GenericName[pt_BR]=Captura de tela
Comment=Capture, edit and share screenshots
Comment[de_DE]=Bildschirmfotos aufnehmen, bearbeiten und mit Anderen teilen
Comment[pt_BR]=Aplicativo avançado para capturar imagens da tela
Exec=shutter --min_at_startup
Icon=shutter
Terminal=false
Type=Application
Categories=Utility;Application;
X-GNOME-Autostart-enabled=true
Hidden=false

I added another desktop file as follows, and it does the trick:

werner@X10DAi-00:~$ cat .config/autostart/shutter1.desktop 
[Desktop Entry]
Version=1.0
Name=Shutter
Name[de_DE]=Shutter
Name[pt_BR]=Shutter
GenericName=Screenshot Tool
GenericName[de_DE]=Anwendung für Bildschirmfotos
GenericName[pt_BR]=Captura de tela
Comment=Capture, edit and share screenshots
Comment[de_DE]=Bildschirmfotos aufnehmen, bearbeiten und mit Anderen teilen
Comment[pt_BR]=Aplicativo avançado para capturar imagens da tela
Exec=shutter --min_at_startup
Icon=shutter
Terminal=false
Type=Application
Categories=Utility;Application;
X-GNOME-Autostart-enabled=true
X-GNOME-Autostart-Delay=30
Hidden=false
conualfy commented 2 months ago

I can confirm that adding the delay works for me, too (I used the proposed 30 seconds on Ubuntu 24.04, Gnome Shell).

hongyi-zhao commented 2 months ago

@conualfy This is not a real solution, but it seems that the issue has not yet been fixed in the source code, so we can only use this temporary workaround.

Photon89 commented 2 months ago

Do you guys have similar problems with other apps which sit in the systray and are launched via autostart?

conualfy commented 2 months ago

In my case, I don't use many, I have another one that starts but does not minimize/hide its window, not sure if it is related (LocalSend). LocalSend uses the same StartUp mechanism (an entry in ~/.config/autostart/). MateOptimus and LivePatch work fine but they start in a different way, not with the use of ~/.config/autostart/; everything else I have is an extension and I guess those use a different mechanism.

Photon89 commented 2 months ago

@DarthGandalf Maybe we could add the X-GNOME-Autostart-Delay=30 option into the .desktop file generated by Shutter? The option's name suggests that it will only affect Gnome users which are exactly the users that experience the issue. What do you think?

tuyennn commented 2 months ago

delay works for me, too (I used the proposed 30 seconds on Ubuntu 24.04, Gnome Shell).

No, for me only Shutter. I have Mega, telegram, teams, skype