I would like to run several programs on startup, targeting them to specific display-virtual desktop-activity combinations. I’ve never tried making a Kwin script before, but that seems like the way to do it. As Plasma 6 brought a bunch of breaking changes, I would just like to make it for Plasma 6.x and not bother with 5.x.
I asked ChatGPT for some help, it gave me commands to get the IDs of activities, and this works:
for uuid in $(qdbus6 org.kde.ActivityManager /ActivityManager/Activities ListActivities); do
name=$(qdbus6 org.kde.ActivityManager /ActivityManager/Activities ActivityName "$uuid")
name2=$(echo $name | sed 's/\.//g')
echo "activity$name2=$name" >> ~/.config/kwin-scripts/activity_ids.conf
done
Unfortunately, it suggested saving them to a file, and it seems that Kwin scripts cannot read variables from a file. It also suggested some ways to run dbus commands from within the kwin script js, but those did not work.
I was under the impression that I should be able to see it listed by running qdbus6 org.kde.KWin /KWin | grep -i ListActivities, but it was not there, in spite of the above qdbus command working.
So if someone has a full working solution for my objective, that would be wonderful. If not, perhaps I can get some guidance about obtaining activityIDs from activity names inside a kwin script?
I would prefer to simply open a specified program on a specified activity-desktop-display combo once on startup rather than have a rule that windows from that program are forced to afterwards. Am I correct that I would need a Kwin script to do this?
I will look more into window rules though, I probably should have given them more consideration without assuming the above.
Edit: OK great, I see that “Window Rules” has options for whether to force it or not. Now I just need to figure out how to get window class names under Wayland.