This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Plasma desktop numbering - how?

Tags: None
(comma "," separated)
pause
Registered Member
Posts
6
Karma
0

Plasma desktop numbering - how?

Tue Nov 03, 2020 4:24 am
Hi,

I'm trying to manipulate the desktop from the command line, in particular I'm trying to change the wallpaper. This works all fine and dandy, but the one thing I have not been able to figure out is how Plasma comes up with its desktop numbering. If I run
Code: Select all
qdbus org.kde.plasmashell /PlasmaShell  dumpCurrentLayoutJS
then the relevant part of the returned string looks like this:

Code: Select all
"desktops": [
        {
            "applets": [
            ],
            "config": {
                "/": {
                    "formfactor": "0",
                    "immutability": "1",
                    "lastScreen": "2",
                    "wallpaperplugin": "org.kde.image"
                },
                "/ConfigDialog": {
                    "DialogHeight": "540",
                    "DialogWidth": "720"
                },
                "/Configuration": {
                    "PreloadWeight": "18"
                },
                "/Wallpaper/org.kde.image/General": {
                    "Image": "file:///path/to/image.jpg",
                }
            },
            "wallpaperPlugin": "org.kde.image"
        },
        {
            "applets": [
            ],
            "config": {
                "/": {
                    "formfactor": "0",
                    "immutability": "1",
                    "lastScreen": "1",
                    "wallpaperplugin": "org.kde.image"
                },
                "/ConfigDialog": {
                    "DialogHeight": "540",
                    "DialogWidth": "720"
                },
                "/Configuration": {
                    "PreloadWeight": "10"
                },
                "/Wallpaper/org.kde.image/General": {
                    "Image": "file:///path/to/image.jpg",
                    "SlidePaths": "/usr/share/wallpapers"
                }
            },
            "wallpaperPlugin": "org.kde.image"
        },
        {
            "applets": [
            ],
            "config": {
                "/": {
                    "formfactor": "0",
                    "immutability": "1",
                    "lastScreen": "0",
                    "wallpaperplugin": "org.kde.image"
                },
                "/ConfigDialog": {
                    "DialogHeight": "540",
                    "DialogWidth": "720"
                },
                "/Configuration": {
                    "PreloadWeight": "10"
                },
                "/General": {
                    "ToolBoxButtonState": "topcenter",
                    "ToolBoxButtonX": "582"
                },
                "/Wallpaper/org.kde.image/General": {
                    "Image": "file:///path/to/image.jpg",
                    "SlidePaths": "/usr/share/wallpapers"
                }
            },
            "wallpaperPlugin": "org.kde.image"
        }
    ]


It seems like there are three desktops, I guess that "lastScreen" refers to the desktop id. But why are there three? I restarted my laptop to make sure there is nothing left-over from any previously connected screen, but I still get three. And I need to change the wallpaper of screen with id 2 (i.e., the third one) for anything visible to happen.

Does anybody know how Plasma comes up with that layout and numbering? Is there a way to get more information about each desktop to figure out which one the actual visible one is?

Thanks in advance,
pause


System Info:
Arch Linux with Plasma 5.20.2
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: Plasma desktop numbering - how?

Tue Nov 03, 2020 7:36 am
Hi!
The activities are stored with UUID in ~/.config/kactivitymanagerdrc. The embedded virtual desktops are defined in ~/.config/kwinrc and are applied to every activity.
pause
Registered Member
Posts
6
Karma
0

Re: Plasma desktop numbering - how?

Tue Nov 03, 2020 4:59 pm
Hi koffeinfriedhof,

Thanks for the reply!

Yes, you're right. However, in this case the "desktops" here are connected screens not activites or workspaces. To make that clear lets call them screens from now on.

I noticed that if I connect an external monitor via HDMI I still get exactly three screens with the external monitor having id 1 (the built-in screen has id 2). My guess is that Plasma somehow not only lists actually connected screens but also ports that can support a screen (my laptop has two of those + built-in screen = 3). If that is true then that is kinda annoying since this is somewhat disconnected from what a user actually sees/has. It makes automating things like setting a wallpaper to the actually visible screen virtually impossible (as I don't know yet of a way to distinguish between actual screens and potential screens)...
koffeinfriedhof
Registered Member
Posts
608
Karma
4
OS

Re: Plasma desktop numbering - how?

Tue Nov 03, 2020 6:46 pm
I do not know exactly how it works but there are some things you can look for: The basic thing are the connections. You can get them via `xrandr` running XServer or e.g. `swaymsg -t get_outputs` on Wayland (as I do not know another tool for it). The possible connections (active and inactive) can be listed. Depending on the connection (vga, hdmi, dp) more or less information can be retrieved from connected screens. Older connections even detect a monitor if it is switched off and powerless as the port itself delivers enough voltage to read the EDID.
The next step is to have a look at KScreen-Project, which dynamically changes depending on which Screens are currently connected.

To change wallpapers you do not have to handle this low level as you can use DBus/JS. A bash-example can be found e.g. here: stackoverflow: Change wallpaper programmatically in KDE

The general guide/howto is available at KDE Userbase: Desktop Scripting


Bookmarks



Who is online

Registered users: Bing [Bot], Evergrowing, Google [Bot]