Bug 502075

Summary: konsole --tabs-from-file window remains invisible / unmapped
Product: [Applications] konsole Reporter: Cyril42e <cyril42e>
Component: generalAssignee: Konsole Bugs <konsole-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: carlo, christoph, john.kizer
Priority: NOR    
Version First Reported In: 24.12.3   
Target Milestone: ---   
Platform: Fedora RPMs   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:
Bug Depends on: 176902    
Bug Blocks:    

Description Cyril42e 2025-03-27 15:26:43 UTC
SUMMARY

After switching from Fedora 38 to Fedora 40 (fresh install), I noticed that my automation running Konsole --tabs-from-file was not working anymore, i.e. the Konsole window appeared in the activity tab but there was no visible window per se on the screen.

After investigating a bit, I found that:
- 'xwininfo' shows that the window is unmapped (Map State: IsUnMapped)
- 'xdotool windowmap' fixes the issue and make it appear on the screen

Note that I am running Gnome desktop with Mutter and X11, not KDE.

STEPS TO REPRODUCE
1. Create file /tmp/konsole-tab with a single line "title: Home ;; workdir:/home ;; command: /bin/zsh"
2. Run "konsole --tabs-from-file /tmp/konsole-tab"

OBSERVED RESULT

No window appears

EXPECTED RESULT

The konsole window appears

SOFTWARE/OS VERSIONS

Linux version : 6.13.7-100.fc40.x86_64
X.Org version: 1.20.14
Gnome version : 46.9
Mutter version : 46.8
Konsole version : 24.12.3
Qt version : 6.8.2

ADDITIONAL INFORMATION
Comment 1 John Kizer 2025-04-09 18:00:37 UTC
Hi - just to check:

* Does the Konsole window appear as normal without the --tabs-from-file option?
* Does the --tabs-from-file option work as expected in a Wayland session?

(Thinking this may be a recurrence of https://bugs.kde.org/show_bug.cgi?id=488396 )

Thanks!
Comment 2 Cyril42e 2025-04-23 23:01:40 UTC
Hi, yes it works ok without --tabs-from-file, and in a Wayland I don't really know as it seems that I don't have it installed in my version of Fedora 40... However I was indeed using Wayland on my Fedora 38 (when I did not have the issue), and on my other laptop with Gentoo and X I have the similar issue https://bugs.kde.org/show_bug.cgi?id=488396, though it it is slightly different (the window appears a split second before disappearing, it sometimes works, and more importantly the window is not listed with wmctrl, contrary to this issue)
Comment 3 Carlo Wood 2025-12-28 17:37:25 UTC
I ran into the same issue - although in my case it seems necessary to rapidly open a few windows; it doesn't happen *every* time that you use --tabs-from-file.
Comment 4 Carlo Wood 2025-12-30 18:02:46 UTC
There is clearly a race condition here (I'm heavily testing this because I am writing a "konsole session store/restore" service).
I worked around the fact that sometimes a `konsole --tabs-from-file ...` isn't managed afterwards by running `wmctrl -ia $WID` afterwards where I use xdotool to find the newly created window.

See the project here (link to the konsole-load script): https://github.com/CarloWood/konsole-session-restore/blob/master/konsole-load
Currently in function apply_window_properties(), on line 130+ we have:
```
    # Activate the window in case it isn't (see https://bugs.kde.org/show_bug.cgi?id=487896).
    wmctrl -ia "$wid"

    # Move window to the correct workspace.
    wmctrl -ir "$wid" -t "${WIN_WORKSPACES[$i]}" || true

    # Fix the geometry.
    wmctrl -ir "$wid" -e "0,${WIN_GEOM_X[$i]},${WIN_GEOM_Y[$i]},${WIN_GEOM_W[$i]},${WIN_GEOM_H[$i]}" || true
```
Comment 5 Carlo Wood 2025-12-30 18:05:33 UTC
Huh - I can't edit my own comments? ... Anyway, I fixed that url in the script now.
Comment 6 Christoph Cullmann 2026-01-10 18:37:02 UTC
In 

 Application::createTabFromArgs(MainWindow *window, const QHash<QString, QString> &tokens)

we have some hack


    // FIXME: this ugly hack here is to make the session start running, so that
    // its tab title is displayed as expected.
    //
    // This is another side effect of the commit fixing BKO 176902.
    window->show();
    window->hide();