SUMMARY When switching profiles from the context menu or the menu bar, `echo $KONSOLE_PROFILE_NAME` does not get update and holds the name of the default profile. STEPS TO REPRODUCE 1. Run konsole 2. Switch the profile from the context menu 3. `echo $KONSOLE_PROFILE_NAME` OBSERVED RESULT The variable contains the name of the previous profile. EXPECTED RESULT The variable should reflect the name of the new profile.
You are correct
I now remember a similar question was asked before. In Linux, you can't change the environment variables of an already running process. You're better off starting a new session. I wonder if switching profiles needs to be removed all together or perhaps switching profiles is just really a new session in the same tab (using new process).
Good solution would be to provide dbus function and konsole command line argument for getting profile name. (In reply to Kurt Hindenburg from comment #2) > I wonder if switching profiles needs to be removed all together or perhaps > switching profiles is just really a new session in the same tab (using new > process). The problem with profiles is that they represent both session/startup options (mostly first configuration page) and look/feel options. * Startup options are applicable only for new sessions. * Look/feel options are mostly shared between session. Users might want to change those for specific session without restarting it (e.g. swiching to light color scheme when going outside on sunny day). It is currently possible for e.g. scrollback size, tab title format, font size. There are also window settings, which doesn't make sense when opening a new tab (initial window size, "size hint after window resize", etc) or in a kpart. Another problem is lack of option sharing. When an user finds their new favourite font, or finds out some interaction-related option suits them better, in most cases they want to use them in all their profiles.
I agree w/ the dbus suggestions - I don't recall why we started using some of the environment variables.
Git commit 05f5663a90106ee8ddcff024c9b30b2b8f1e0f4f by Kurt Hindenburg. Committed on 27/09/2019 at 02:12. Pushed by hindenburg into branch 'master'. Add dbus profile() to return profile name of current session Instead of relying on env variable KONSOLE_PROFILE_NAME, which is invalid upon switching profiles, use a dbus method profile(). qdbus $KONSOLE_DBUS_SERVICE $KONSOLE_DBUS_SESSION profile M +4 -0 src/Session.cpp M +5 -0 src/Session.h https://invent.kde.org/kde/konsole/commit/05f5663a90106ee8ddcff024c9b30b2b8f1e0f4f
Git commit 05f5663a90106ee8ddcff024c9b30b2b8f1e0f4f by Kurt Hindenburg. Committed on 27/09/2019 at 02:12. Pushed by scmsync into branch 'master'. Add dbus profile() to return profile name of current session Instead of relying on env variable KONSOLE_PROFILE_NAME, which is invalid upon switching profiles, use a dbus method profile(). qdbus $KONSOLE_DBUS_SERVICE $KONSOLE_DBUS_SESSION profile M +4 -0 src/Session.cpp M +5 -0 src/Session.h https://commits.kde.org/konsole/05f5663a90106ee8ddcff024c9b30b2b8f1e0f4f
Git commit 9e3a30fdca2078e04bee2315ebd2adf678a81263 by Kurt Hindenburg. Committed on 27/09/2019 at 02:24. Pushed by hindenburg into branch 'master'. Remove env variable KONSOLE_PROFILE_NAME env variables can not be changed after process creation so this causes this variable to be wrong after profile switching. Use the dbus method profile to determine name. qdbus $KONSOLE_DBUS_SERVICE $KONSOLE_DBUS_SESSION profile M +0 -1 src/SessionManager.cpp https://invent.kde.org/kde/konsole/commit/9e3a30fdca2078e04bee2315ebd2adf678a81263
Git commit 9e3a30fdca2078e04bee2315ebd2adf678a81263 by Kurt Hindenburg. Committed on 27/09/2019 at 02:24. Pushed by scmsync into branch 'master'. Remove env variable KONSOLE_PROFILE_NAME env variables can not be changed after process creation so this causes this variable to be wrong after profile switching. Use the dbus method profile to determine name. qdbus $KONSOLE_DBUS_SERVICE $KONSOLE_DBUS_SESSION profile M +0 -1 src/SessionManager.cpp https://commits.kde.org/konsole/9e3a30fdca2078e04bee2315ebd2adf678a81263