Bug 486106

Summary: some applications pinned to taskbar are started inside `plasma-plasmashell.service` instead of their own cgroup
Product: [Plasma] plasmashell Reporter: Bruno Pitrus <brunopitrus>
Component: Task Manager and Icons-Only Task Manager widgetsAssignee: Plasma Bugs List <plasma-bugs-null>
Status: RESOLVED DUPLICATE    
Severity: normal CC: nate, qydwhotmail
Priority: NOR    
Version First Reported In: 6.0.4   
Target Milestone: 1.0   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Bruno Pitrus 2024-04-25 10:53:22 UTC
SUMMARY
When vscode (OSS build from the openSUSE repo) is pinned to taskbar, clicking the icon does not result in it being correctly launched in a new cgroup, instead remaining in `plasma-plasmashell.service`.
This results in `systemctl --user restart plasma-plasmashell` (to fix a hung/misbehaving plasma) causing VSCode to crash.

If VSCode was launched from the start menu or from KRunner, it gets correctly assigned its own cgroup.

STEPS TO REPRODUCE
1. Pin `code.desktop` to taskbar
2. Click the pinned icon to launch vscode
3. `systemctl --user restart plasma-plasmashell`

OBSERVED RESULT
VSCode crashes. 

EXPECTED RESULT
Any apps opened are unaffected.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: openSUSE Tumbleweed 20240423
(available in About System)
KDE Plasma Version: 6.0.4
KDE Frameworks Version: 6.1.0
Qt Version: 6.7.0

ADDITIONAL INFORMATION
Content of `/usr/share/applications/code.desktop`:

[Desktop Entry]
Name=Code - OSS
Comment=Code Editing. Redefined.
GenericName=Text Editor
Exec=code --unity-launch %F
Icon=code-oss
Type=Application
StartupNotify=false
StartupWMClass=Code
Categories=TextEditor;Development;IDE;
MimeType=text/plain;inode/directory;application/x-code-workspace;
Actions=new-empty-window;
Keywords=vscode;

[Desktop Action new-empty-window]
Name=New Empty Window
Name[de]=Neues leeres Fenster
Name[es]=Nueva ventana vacía
Name[fr]=Nouvelle fenêtre vide
Name[it]=Nuova finestra vuota
Name[ja]=新しい空のウィンドウ
Name[ko]=새 빈 창
Name[ru]=Новое пустое окно
Name[zh_CN]=新建空窗口
Name[zh_TW]=開新空視窗
Exec=code --new-window %F
Icon=code-oss
Comment 1 Bruno Pitrus 2024-04-25 11:04:31 UTC
Likely cause:

`/usr/bin/code` forks on startup and exits immediately.
If i replace the script with `exec xterm`, the xterm gets correctly put into `app-code-BLAHBLAHBLAH.scope`.
This suggests that there's a race condition somewhere.

This may be related to bug 450810 but i'm not using Latte and don't know what a Latte is.
Comment 2 Nate Graham 2024-08-16 15:46:50 UTC
Thanks, it is indeed Bug 450810. Well spotted.

*** This bug has been marked as a duplicate of bug 450810 ***