Installing KDE in a debian-13 template

Below are steps for setting up a functional KDE 6 in Qubes debian-13 templates. Note this does not include unifying KDE/Qt/Gnome/GTK appearance settings and file dialogs…

  1. In dom0 make a clone of a ‘debian-13’ template (which is Gnome-based).

  2. In the new template run sudo tasksel then select “KDE” and de-select “Gnome”.

  3. After tasksel is finished installing KDE, run sudo apt autopurge gnome* to remove Gnome – this is important.

  4. Add a file to the template’s /etc/profile.d to set the required desktop session variable:

$ sudo nano /etc/profile.d/kde4qubes.sh

The content of the file:

export XDG_CURRENT_DESKTOP=KDE
  1. Create a link in /etc/xdg/menus. This allows apps like Dolphin to associate file types:
$ sudo ln -s /etc/xdg/menus/plasma-applications.menu /etc/xdg/menus/applications.menu
  1. Copy the desktop definitions for Qubes file browser actions (Copy to other qube, etc.) from their old locations to the KDE 6 compatible locations:
$ sudo apt install zenity
$ sudo cp -a /usr/share/kde4/services/qvm-convert-pdf.desktop /usr/share/kio/servicemenus
$ sudo cp -av /usr/share/kservices5/ServiceMenus/qvm-* /usr/share/kio/servicemenus

The last set from ‘kservices5/’ will lack necessary info now required by KDE 6. Add the lines for copy, move, and dvm edit:

$ sudo sed -ri 's|^(\[Desktop Action)|X-KDE-Submenu=Actions\nMimeType=inode/directory;all/allfiles\n\n\1|' /usr/share/kio/servicemenus/qvm-{copy,move}*
$ sudo sed -ri 's|^(\[Desktop Action)|X-KDE-Submenu=Actions\nMimeType=all/allfiles\n\n\1|' /usr/share/kio/servicemenus/qvm-dvm*
  1. Shutdown the template.

  2. Change template and appVM settings under the “Applications” tab to include the new utilities. Adding “Open file manager” and “Run terminal” will run the default file browser and terminal (in this case, Dolphin and Konsole) assigned for the template’s environment, but you can also add “Dolphin” and “Konsole” as app entries to access them directly.

  3. (Optional) Run Dolphin and under “Configure Dolphin → Context Menu” de-select the “Send file via KDE Connect” plugin. This will prevent Dolphin from freezing for 30sec when you first access a file’s context menu. (It would be preferable to configure KDE Connect to prevent this delay… suggestions are welcome!)

These instructions can probably be adapted for Fedora templates as well with some changes to the tasksel and apt steps. They may also work when starting from an Xfce template; in that case an additional apt autopurge xfce* step (in addition to purging gnome*) will be very important for removing the Xfce environment settings as simply removing the packages doesn’t work.

6 Likes

I am using KDE for many years in Qubes OS (based on fedora-*-minimal, though).

That’s why I do not understand, why no qt5ct/qt6ct was mentioned? What load/save dialogs do you have in your setup, ones from KDE or not?

Is it a debian-related bug? I never had it in Fedora-based templates.

Not an optimal approach. I think, the better one is to start with minimal template and add all necessary (including some of xfce stuff that is required for software to work properly in KDE templates.

I’m not sure that full “portal” integration between toolkits is in this scope. The point here is that KDE programs work as expected without creating issues for non-KDE or non-Qt programs; that is the type of setup that has worked for me for many years. File picker dialogs do seem to depend on whether the app is Qt or Gtk based. OTOH, using portal mode would unify the file dialogs but also interfere with the non-Qt apps UI rendering (TBH, it doesn’t look good).

Are there other instructions that work well for you?

I don’t know. Previous versions of Debian didn’t have this delay, and it may not even be a bug (just a preference in Debian 13 to more aggressively scan networks on startup). Its only an issue when Dolphin is the first thing you use on VM startup.

Perhaps. Or it may make more sense to use a starting point that the user is more likely to have on hand. I’m interested to know what xfce stuff is needed by software despite not being listed as dependencies.

Well, qt5ct/qt6ct is not only about Qt load/save dialogs in apps, it also about appearance, theme colors, controls, button icons, dialogs scale and etc.

The KDE environment is providing the settings for Qt-only apps. They seem to be following theme & colors correctly.

BTW, for those who wish to make the KDE theme / colors settings the default in newly-created VMs, its fairly simple to do the following: Run systemsettings as a regular user in the template and set your preferred theme (such as “Breeze Dark”), then copy the ‘./config/kdeglobals’ file to ‘/etc/skel/.config’ and shut down the template.