Bug 348983

Summary: Running KGpg when minimized does not bring the application to foreground
Product: [Applications] kgpg Reporter: Antti Poikela <antti.poikela>
Component: generalAssignee: Rolf Eike Beer <kde>
Status: REPORTED ---    
Severity: minor CC: bugskde, wolftune
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Antti Poikela 2015-06-10 14:22:28 UTC
When KGpg is closed, the application remains in the system tray, where it may be hidden within a menu of secondary applications. Starting KGpg again when application is still running does nothing, easily leading to a conclusion that the application is broken.

Reproducible: Always

Steps to Reproduce:
1. Start KGpg
2. Close KGpg
3. Start KGpg again

Actual Results:  
Nothing happens. Output when running kgpg from command line:

QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.
QDBusConnection: session D-Bus connection created before QCoreApplication. Application may misbehave.

Expected Results:  
The minimized KGpg instance is brought to foreground.

While this could be seen as a feature request, I almost filed a bug report with a workaround of removing the kgpgrc file before noticing the icon hidden in the secondary icons area in the KDE system tray (Plasma 5.3).

This behavior seems to have raised some bugreports for Ubuntu, such as https://bugs.launchpad.net/ubuntu/+source/kgpg/+bug/1400817 and
http://do-the-right-things.blogspot.de/2012/12/cavaet-in-using-kgpg-in-ubuntu.html.
Comment 1 Rolf Eike Beer 2015-06-15 20:33:19 UTC
It behaves the same way as if the program would not be running: it does not show a window. Use "kgpg -k" or "kgpg -d" to show a the keymanager or editor window.
Comment 2 Aaron Wolf 2017-01-14 05:26:46 UTC
In my experience, this is really frustrating. It affects GUI things like using a dolphin menu to encrypt or decrypt. It can fail to do anything because kgpg is already running in the background. It doesn't then even open the dialog for the encryption process.
Comment 3 Rolf Eike Beer 2017-08-09 17:55:18 UTC
There are 2 things: if KGpg is started without options it just goes into the systray. This is intended behavior to allow it in autostart.

That is would not show up if called (again) with kgpg -k is a bug introduced ~16.08 which is fixed in 17.08.
Comment 4 Justin Zobel 2022-11-08 06:50:12 UTC
Thank you for reporting this issue in KDE software. As it has been a while since this issue was reported, can we please ask you to see if you can reproduce the issue with a recent software version?

If you can reproduce the issue, please change the status to "REPORTED" when replying. Thank you!
Comment 5 Aaron Wolf 2022-11-08 18:10:18 UTC
(In reply to Justin Zobel from comment #4)
> Thank you for reporting this issue in KDE software. As it has been a while
> since this issue was reported, can we please ask you to see if you can
> reproduce the issue with a recent software version?
> 
> If you can reproduce the issue, please change the status to "REPORTED" when
> replying. Thank you!

The bug is outstanding and unchanged
Comment 6 André 2022-12-29 07:08:32 UTC
I do have almost the same problem with KGPG. If the autostart option for KGPG is set, you can see the process with 'ps -ef | grep kgpg', but there is no icon on the taskbar to launch the kgpg interface. If you try to luanch KGPG from the menu of your desktop environment or from the command prompt, you do not see the the user interface. If the autostart option is not set for KGPG the user interface also is not showing up when you start KGPG from the menu of your desktop environment or from the command prompt. Starting KGPG with -e, -k, -d, -s, -S, -V works. As a workaround in the Linux Mint 21 Menu editor I changed the the command 'kgpg %U' in 'kgpg -k'.
The problem with not showing the KGPG user interface occurs with recent versions of Debian, Ubuntu (tested with xfce version), Linux Mint (tested with Cinnamon) and Zorin OS (tested with core and light). (Other distros I did not test.)
Comment 7 Rolf Eike Beer 2022-12-30 19:14:44 UTC
So it basically looks to me as if this affects only non-Plasma desktops, right? Which would explain why I have never seen that. What would the "%U" do in the menu anyway?
Comment 8 Aaron Wolf 2022-12-30 21:48:33 UTC
(In reply to Rolf Eike Beer from comment #7)
> So it basically looks to me as if this affects only non-Plasma desktops,
> right? Which would explain why I have never seen that. What would the "%U"
> do in the menu anyway?

I don't know if you are replying only to the other latest comment, but this bug is definitely within plasma. All this time I've followed this ticket, confirmed, etc, I've only been on full plasma systems.
Comment 9 André 2023-01-01 09:35:04 UTC
Thank you for your reply. I'm using Linux for a couple of years. Until now I never considered which desktop manager I'm using. I used the desktop manager that was shipped with the distribution and that's it.
In Viritual Box I made a Fresh Install of Linux Mint 21 Cinnamon and installed kde-plasma-desktop. After restarting and using KDE Plasma I installed KGPG. The result was the same: When I reboot after the setup wizard KGPG only starts with KGPG -k

On https://askubuntu.com/questions/30210/what-does-u-mean-when-calling-a-command I found an answer for the use of %u
Comment 10 André 2023-01-01 14:02:55 UTC
(In reply to André from comment #9)
> In Viritual Box I made a Fresh Install of Linux Mint 21 Cinnamon and
> installed kde-plasma-desktop. After restarting and using KDE Plasma I
> installed KGPG. The result was the same: When I reboot after the setup
> wizard KGPG only starts with KGPG -k
> 
I forgot to look at the hidden icons in the system tray! The icon for KGPG is present there and I can open KGPG. The problem of not showing the KGPG desktop is related to the standard desktop Linux Mint installs during installation.
Comment 11 Aaron Wolf 2023-01-01 15:01:37 UTC
(In reply to André from comment #10)
> (In reply to André from comment #9)
> > In Viritual Box I made a Fresh Install of Linux Mint 21 Cinnamon and
> > installed kde-plasma-desktop. After restarting and using KDE Plasma I
> > installed KGPG. The result was the same: When I reboot after the setup
> > wizard KGPG only starts with KGPG -k
> > 
> I forgot to look at the hidden icons in the system tray! The icon for KGPG
> is present there and I can open KGPG. The problem of not showing the KGPG
> desktop is related to the standard desktop Linux Mint installs during
> installation.

The problem this ticket describes applies to all systems, including plasma. The problem is not that it is impossible to get the UI. In the hidden system tray icons, clicking there will indeed bring the UI forward. The problem is that running KGpg either in Krunner or via launcher or via terminal, none of them will show the UI because it will just go right back to being hidden. That is a design bug. Running KGpg via any of those options should bring the UI forward, the same as clicking the system tray icon.