The cool part of sharing your knowledge is that often others pop up and improve what you shared. Time ago Quentin linked me his tool to manage Plasma Activities from command line. It’s a tool written in Python, so it’s named Pytivity and you can get it from GitHub.
With Pytivity you can create, edit, delete, start, stop and activate Activities. But the true power of this tool relies on a feature of Activities that is still not exposed in the graphical user interface: placing scripts and *.desktop launchers in some particular hidden folders you will be able to define which apps or scripts will be executed when you start, stop, activate or deactivate an Activity.
Pytivity simply exposes it as command line interface, the syntax to create an Activity and set Dolphin to open when you activate the Activity is the following:
pytivity create --started dolphin MyNewActivity
My main use case is to start/stop software and restart them if needed when I come back to the activity, like a browser, mail client or a project in pycharm. I also use it to open tabs in Yakuake and execute some shell commands (ssh, change directory, activate python env, …).
Quentin Dawans, developer of Pytivity
The use cases are not limited to starting apps, you could use it to start/stop services. If like me you use Docker you will appreciate how setting an Activity to start/stop Docker is easy:
pytivity create --started "systemctl start docker" --stopped "systemctl stop docker" ActivityName
You could also set an Activity to start Docker and run a container from KDE Neon to have a Plasma desktop from git-stable or git-unstable repos confined in an Activity.
Another use case is starting Kontact with an Activity and close it killing Akonadi (that uses a lot of my 2GB of RAM also when Kontact is not running anymore) when you stop the Activity.
I imagine that it could be used also with
kwriteconfig, that is a tool to edit apps settings, to change the preferences of an app before starting it. I would appreciate if will be possible to change system color scheme from command line but at the moment it seems impossible from
kwriteconfig. Also, some apps, especially command line apps, often let you define the path of config file. With Pytivity you could specifying a different config file according to the running Activity.
Now you have another article you can link to those users that every time they read about Plasma Activities replies “Activities are useless”, “I can’t get what are the advantages of Activities” and “what’s the difference between Activities and virtual desktops?”. To the last question you can also reply: “virtual desktops are a way to manage windows, Activities are a way to manage tasks and related apps, services and configurations“.
Be sure to don’t miss the future realease of Plasma Vault by Ivan, the developer of Activities: it will let you encrypt and decrypt specific folders when you start/stop Activities. You can easily imagine it combined with an encrypted Firefox profile.
Meta: I updated my blog with some UX improvements, like categories/tags filter options in the sidebar to let you quickly find contents you are interested in. I also added a “subscribe” button that appear when you are visiting a category, a tag or a combination of them; that button will generate the RSS feed for the category/tag you selected. This because I will post on my blog stuff not strictly related to KDE. The post that are displayed in Planet KDE are the one from “Blog posts” category (that is the category that gather all the stuff in English) tagged as “For Planet KDE”.
I’m also experimenting a way to link blog articles to related Diaspora posts. You should see a button below to see comments on Diaspora. Sadly because of the decentralized nature of Diaspora, you need to be registered to my same pod to comment using the link I provide with the article. Alternatively you have to find me on Diaspora from your pod to add a comment.