Bug 445195

Summary: Yakuake scripting at system startup brakes KDE's general theme
Product: [Applications] yakuake Reporter: Nuno Gomes <nunogomes.pt+kde>
Component: generalAssignee: Eike Hein <hein>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: 21.08.2   
Target Milestone: ---   
Platform: Manjaro   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Attachments: Left: broken theme in Dolphin when invoked by a keyboard shortcut; Right: dark theme correctly shown when Dolphin is invoked from Application Launcher or Latte Dock.

Description Nuno Gomes 2021-11-09 10:36:05 UTC
Created attachment 143365 [details]
Left: broken theme in Dolphin when invoked by a keyboard shortcut; Right: dark theme correctly shown when Dolphin is invoked from Application Launcher or Latte Dock.

SUMMARY
I use a general dark theme (WhiteSurDark) in my environment. Recently, I created a script for Yakuake in order to have it started with the configuration I want: two tabs, several windows in each, with commands already executed when I call Yakuake. I saved my script in "~/.config/plasma-workspace/env/".
However, if I start the system with this script, parts of my theme get broken when I invoke some applications using a shortcut: instead of dark frames, I get white ones.
For instance, when executing Dolphin from the Application Launcher or Latte Dock, everything works fine; but pressing "Meta+E" to call Dolphin (my shortcut), brakes the theme and Dolphin gets a white frame (see attached figures).
This happens not only with Dolphin, but with other applications, such as Spectacle, Gimp, and general dialogues, just to name a few.
Nothing of this "weird" behaviour happens if I don't have a Yakuake script upon starting of the system.

STEPS TO REPRODUCE
1. Create a Yakuake script and put it in "~/.config/plasma-workspace/env";
2. Restart the computer or log out and log in;
3. Open Dolphin using Application Launcher or Latte Dock: all good;
4. Open Dolphin using the keyboard shortcuts ("Meta+E", in my case): theme in Dolphin is broken, i.e., the frame becomes white, instead of dark;
5. Restart the system without any Yakuake scripting: everything works fine.

OBSERVED RESULT
The dark theme is broken when applications are invoked using a keyboard shortcut.

EXPECTED RESULT
The theme is not affected by Yakuake scripting.

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Manjaro Linux KDE
(available in About System)
KDE Plasma Version: 5.22.5
KDE Frameworks Version: 5.87.0
Qt Version: 5.15.2

ADDITIONAL INFORMATION
Kernel Version: 5.14.10-1-MANJARO (64-bit)

Structure of my Yakuake script

```
#!/bin/bash

sleep 2

function runit {
cmd="qdbus org.kde.yakuake $1"
eval $cmd &> /dev/null
sleep 0.5
}

# get session ids
TERMID00=$(runit "/yakuake/sessions org.kde.yakuake.terminalIdsForSessionId 0")
TERMID01=$((TERMID00 + 1))
TERMID02=$((TERMID00 + 2))
TERMID11=$((TERMID00 + 3))

# change tab's name
runit "/yakuake/tabs setTabTitle 0 'Main'"
# split terminal
runit "/yakuake/sessions org.kde.yakuake.splitTerminalTopBottom '$TERMID00'"
runit "/yakuake/sessions org.kde.yakuake.splitTerminalLeftRight '$TERMID00'"
# run 'htop' in first terminal
runit "/yakuake/sessions runCommandInTerminal '$TERMID00' 'htop'"
# run 'Vimwiki' in second terminal
runit "/yakuake/sessions runCommandInTerminal '$TERMID01' 'nvim ~/.vimwiki/index.wiki'"
# run 'TaskWarrior' in third terminal
runit "/yakuake/sessions runCommandInTerminal '$TERMID02' 'task'"

# start new session
runit "/yakuake/sessions org.kde.yakuake.addSession"
runit "/yakuake/tabs setTabTitle 1 'Extra'"
runit "/yakuake/sessions org.kde.yakuake.splitTerminalLeftRight '$TERMID11'"
runit "/yakuake/sessions runCommandInTerminal '$TERMID11' 'clear'"
runit "/yakuake/sessions runCommandInTerminal '$TERMID11' 'neofetch'"
```
Comment 1 Nuno Gomes 2021-11-11 13:35:29 UTC
I tried to debug the problem and realised that as soon as a `qdbus` command is issued inside the script, the theme of applications launched using a keyboard shortcut is broken.
In order to replicate this issue, we need to log out and log in again. If we run the script from the terminal without re-logging in, we do not see the theme changing.