#planetkde

alex_l@sechat.org

Pytivity by Quentin Dawans: manage Plasma Activities from command line and some automation

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.

#planetkde #kde #plasma

alex_l@sechat.org

Firefox and Plasma Activities

You may know that when you stop an Activity some opened apps can “hibernate”, they free RAM but when you restart the Activity they reappear in the same state (Dolphin at the same path, Kate and Okular with the same documents etc) and the same size and position on the screen. This generally works for KDE applications. But at the moment KDE misses a good web browser and so I use Firefox.

Mozilla’s browser has an option to automatically restore the previous session (tabs) when you start it. I use this feature a lot but sometimes I want to keep a session “saved” while I open a new one for another task (work vs study vs entertainment etc). This is why I tried to combine Firefox’s profiles (each one has its own “session”) with Plasma Activities.

I wrote a script that copies the “default” Firefox profile (with history, addons, settings, everything) into the same folder with a new name, create an entry in the app menu and link it to the current Activity. So if you set you desktop to show the files linked to current Activities (or if you set a folder view as explained here to make a by-activity app menu) you will get a different Firefox launcher for each Activity.

Just run the script and it will ask you a name to let you identify the launcher, for example if you reply “Study” the launcher will be “Firefox (Study)”.

The following image show a folder view plasmoid set to show *.desktop files linked to the current Activity:

Start the script using the right click menu on Firefox launcher

If you want a quick entry to start the script, I suggest you to edit the Firefox launcher in ~/.local/share/applications with an action as in the following image:

You have to add to firefox.desktop the follow:

Actions=Activity

[Desktop Action Activity]
Exec=path/to/the/script/ff-kactivities
Icon=list-add-user
Name=New profile for current Activity

```### Warnings

Before using the script, be sure that there is firefox.desktop in `~/.local/share/applications` and Firefox stores profiles in `~/.mozilla/firefox`. If not, edit the script to use the right paths for your system.

Also: don’t exaggerate with Firefox profiles because each of the is approximately hundred megabytes.

I didn’t add any way to delete the profiles, just go to `~/.mozilla/firefox` and manually delete them. And manually delete the entries in `~/.local/share/applications`.

If you restart the script in an Activity that already has a profile linked it will be overwritten.

I hope this could help you as it does for my workflow.

\#kde #firefox #planetkde  
Originally posted at: [http://www.alexl.netsons.org/blogposts/firefox-and-plasma-activities/](http://www.alexl.netsons.org/blogposts/firefox-and-plasma-activities/ "Permalink")
alex_l@sechat.org

10 reasons why Ubuntu should use KDE Plasma instead of GNOME

This is not a GNOME vs Plasma comparison, this specifically for Ubuntu and its users, considering the innovative vision they had till now. Just very personal thoughs ordered by importance for Ubuntu success in my opinion.

1. Windows-like experience by default

The most important reason for me is that the new Ubuntu user generally was a Windows user. Plasma by default has a Windows-like look and feel: panel at the bottom with an icon to open a menu and search/launch applications and files, a task manager and a system tray. I installed Plasma to many Windows users during the years and they found it more intuitive than Ubuntu Unity and probably than GNOME 3. In fact I tried GNOME 3 many times but it took a while before I was able to understand the GNOME’s vision for workflow. It’s very interesting and innovative, but it’s imposed by default and you will learn how to use it well only if you want to do so or if you are a very experinced user of other particular UI. The Windows user that try Linux just want a working environment. I saw that Windows users that tried Plasma were satisfied from the first moment, start working and after a while (days, weeks) they customized their UI and explore new workflows, probably when they have free time and aren’t stressed by work.

2. Unity-like experience with one click

Who like Unity experience can easily get it from a fresh Plasma installation by using a Look&Feel package. There is already a package for that on KDE Store. Eventually, the Ubuntu installer could provide a choice at the end of the process asking which experience the user prefer (Windows-like/Plasma-default, Unity-like, Mac OS-like etc).

3. Simple by default, powerful when needed

KDE software, including Plasma and KDE Applications, is generally very simple and intuitive by default, but provides advanced features that user can easily discover with its own curiosity. Instead GNOME has a precise vision about minimalism, that means very elegant product but often also missing very important features for productivity.

4. Plasma Mobile

KDE is developing its alternative to Android with many tech things in common with Ubuntu Touch. Ubuntu enthusiasts’ experience with Qt and QML could be used in Plasma Mobile world. At the moment Ubuntu Touch apps can run in Plasma Mobile.

5. Convergence is the future

The original idea about convergence of UIs born in KDE. Canonical developed it with Ubuntu Touch and now Plasma Mobile and Kirigami are continuing that vision. Convergence is pursued also by Google and Microsoft and in the future it will be a very common feature. Smartphones becoming desktop PCs when plugged to keyboard, mouse and monitor, tablet becoming laptop, files and configurations shared across different form-factor devices are here. Plasma and Kirigami takes advantage of the best technologies for this purpose like Qt/QML and Wayland.

6. Kirigami apps that run everywhere

Let’s be honest: Plasma Mobile and others will not be real alternatives to Android in the short term. But being in the mobile world, on Android or iOS, is very important for every software manufacturer and in fact KDE litterally did a revolution with KDE Connect that improve the desktop experience with Android. But think also to apps like Nextcloud, both available on Linux desktop and Android that sync our files. To provide a better Plasma and KDE software experience we need this kind of companion apps on Android and iOS. Kirigami is here to provide a cross-platform UI framework for Linux Desktop, Windows, Mac OS, Android, iOS and Plasma Mobile.

7. Qt is not a Linux-thing only

Though Gtk could be a good product, its focus is on Linux desktop and it’s developed mostly for GNOME’s vision. KDE software uses Qt instead, that is one of the best products in the industry and it’s available on Windows, Mac OS, Android and iOS. While many developers prefer Gtk for their Linux apps, if the purpose is promoting FOSS we should open to other platforms and as I said, especially on Android and iOS because we currently don’t have a mobile alternative platform.

8. KDE Neon and its innovations

KDE Neon provides a new way to join development by providing a complete set of builds, including directly from git-stable and git-unstable repositories. Also, using Docker images of KDE Neon users are able to quickly test new features providing feedbacks or to hunt bugs. I find very useful to try a daily build to check if a bug was fixed before I report it.

9. Integration with KDE Store

KDE software, including Plasma and Applications, can download very different types of addons from KDE Store without visiting any Web page, directly from applications: Plasma widgets, Plasma themes, Freedesktop icons, Service Menus for Dolphins, skins for Yakuake and many many others. We all see the success of Google Play Store and Apple’s one, the KDE Store and OpenDesktop in general is a step forward hosting addons. KDE integrations for them is continously improving: also Plasma Discover, the KDE’s software center, can manage addons from the KDE Store.

10. Breeze

Very personal thought: Breeze theme looks more modern and it’s adopted also in non-KDE products, for example Breeze icons are now used in Libreoffice.

#planetkde #kde #ubuntu