KDE Plasma: save display/desktop/taskbar settings in a profile?

6,285

The config file to save is ~/.config/plasma-org.kde.plasma.desktop-appletsrc. You can save multiple versions of this file elsewhere, then copy it back. You will need to restart Plasma after replacing the file. I use the following script, which attempts to kill plasma in increasingly more vicious ways.

#!/usr/bin/env bash
# Replace current instance of plasmashell

kbuildsycoca5
timeout 5 kquitapp5 plasmashell
pgrep -U $USER -x plasmashell &>/dev/null && pkill -U $USER -x plasmashell
pgrep -U $USER -x plasmashell &>/dev/null && pkill -U $USER -x -9 plasmashell
pgrep -U $USER -x plasmashell &>/dev/null && echo "ERROR: cannot kill plasmashell"
plasmashell &

Also note that Plasma takes a minute or so to update the config file, so perhaps save a copy of the file, make your changes, then diff the two configs until you see the change written.

Also, I find Plasma a bit buggy with multiple monitors. Sometimes it gets confused, and a monitor will revert to the default setting. Basically, you can just set it up again and save the new config. You'll then have duplicate layouts for two variants of the same monitor, but it works fine. (If you check the config file, one will be, e.g. lastScreen=4, and the other lastScreen=5. I have no idea why.)

Share:
6,285

Related videos on Youtube

Akif
Author by

Akif

Updated on September 18, 2022

Comments

  • Akif
    Akif almost 2 years

    I am using default Manjaro (17.0.5) install with KDE Plasma on my laptop. On my work I connect two external displays. Everything works fine but my settings for display configuration and my taksbar get messed up almost every time I connect the external displays.

    Is there a way to save my configuration so I can reset to it? Or even better would be if I would be able to create profiles for my specific settings. Such as "work" and "home".

    Btw, I am looking for a "nice" intuitive solution. Best would be a menu somewhere where I can switch between profiles.

  • Akif
    Akif over 6 years
    Thanks for you solution! I didn't try it yet. I was hoping for a gui enabled solution. How are you using this? Are you just coping files back and forth? I am switching working envoirements multiple times a day, so that is not very intuitive. Are there possibilitis to bind a gui menu to all the actions needed to switch back and forth between configurations? If yes, where can I start researching? I am new to Linux customization.
  • Sparhawk
    Sparhawk over 6 years
    There's not really a custom-made GUI for this, although you could always use Dolphin to copy the files! 😁 I find Plasma stable enough maybe 90% of the time, but it bugs out 10% and I need to make the manual fix. Instead of a GUI, you might be able to automate it based on wifi signal or whatever is indicative of location.
  • Sparhawk
    Sparhawk over 6 years
    I have a script that is triggered by a network change. It checks for wifi connection and my assigned ip address. If it matches, then I'm at home, and it triggers a script that changes my hosts file.
  • Ped7g
    Ped7g over 6 years
    It's certainly possible to connect script also on connecting/disconnecting screen (it's probably some event on dbus/systemd/...), although writing something robust/intelligent (like probably waiting a second or two upon display connect/disconnect and then re-check before killing plasma to avoid some spurious events) would take some skill. I'll maybe tinker with it in future, as I would prefer fixed stored config for each case, but not sure how much effort I want to put into it. (As I already have restart plasma icon created for the suspend/resume gfx glitch, I may add config chooser there?)