KDE: Difference between revisions

From NixOS Wiki
imported>Nix
m (add Software/Applications subcategory)
imported>SuperSamus
(Restructored the article, now more similar to Gnome)
Line 1: Line 1:
== Installation ==
KDE Plasma is a desktop environment that aims to be simple by default, powerful when needed.
{{file|/etc/nixos/configuration.nix|nix|<nowiki>
services.xserver.desktopManager.plasma5.enable = true;
</nowiki>}}


== Tips and Tricks ==
== Installing KDE Plasma ==
=== Enable GTK themes in KDE ===


==== Enable GTK themes in KDE in KDE System Settings ====
To use KDE Plasma, add this to your configuration.nix:


Nixpkgs now provides the GTK configuration module for KDE system settings, which you can install with:
<syntaxHighlight lang=nix>
 
services.xserver.enable = true;
<syntaxhighlight lang="console">$ nix-env -i kde-gtk-config</syntaxhighlight>
services.xserver.displayManager.ssdm.enable = true;
 
services.xserver.desktopManager.plasma5.enable = true;
You should also install any GTK themes you like. You can choose a GTK theme and set related options in <code>System Settings > Application Appearance > GTK</code>.
</syntaxHighlight>
 
==== Enable GTK themes in KDE manually ====
 
As a normal nix user you can install the Oxygen GTK theme:
 
<syntaxhighlight lang="console">$ nix-env -i oxygen-gtk</syntaxhighlight>
 
KDE will run any scripts you place in ~/.kde/env on startup so this is a good place to set the GTK_PATH so that applications can find the theme engine. If the path is wrong/unset you will see errors like this:


<code>Gtk-WARNING **: Unable to locate theme engine in module_path</code>
== Excluding some KDE Plasma applications from the default install ==
Not all applications that come pre-installed with the KDE Plasma desktop environment are desirable for everyone to have on their machines. There's a way to edit configuration.nix to exclude these kinds of packages, for example as follows:


To set Oxygen-GTK as the gtk theme create the following file and make it executable: ~/.kde/env/set-gtk-theme.sh
<syntaxHighlight lang=nix>
<syntaxhighlight lang="bash">
services.xserver.desktopManager.plasma5.excludePackages = with pkgs.libsForQt5; [
#!/bin/sh
  elisa
  gwenview
  okular
  oxygen
  khelpcenter
  konsole
  plasma-browser-integration
  print-manager
];
</syntaxHighlight>


export GTK_PATH=$GTK_PATH:~/.nix-profile/lib/gtk-2.0
== Troubleshoots ==
export GTK2_RC_FILES=$GTK2_RC_FILES:~/.nix-profile/share/themes/oxygen-gtk/gtk-2.0/gtkrc
=== Qt/KDE applications segfault on start ===
</syntaxhighlight>
This is caused by a stale QML cache [https://github.com/NixOS/nixpkgs/issues/177720 (see this issue)]. A dirty way to fix this is by running on a terminal the following command:


Alternatively, on NixOS:
<syntaxHighlight lang=sh>
find ${XDG_CACHE_HOME:-$HOME/.cache}/**/qmlcache -type f -delete
</syntaxHighlight>


{{file|configuration.nix|nix|<nowiki>
=== GTK themes are not applied in Wayland applications ===
environment = {
Add to your configuration.nix the following line:
  systemPackages = [ pkgs.oxygen_gtk ];
  shellInit = ''
    export GTK_PATH=$GTK_PATH:${pkgs.oxygen_gtk}/lib/gtk-2.0
    export GTK2_RC_FILES=$GTK2_RC_FILES:${pkgs.oxygen_gtk}/share/themes/oxygen-gtk/gtk-2.0/gtkrc
  '';
};
</nowiki>}}


Or alternatively, copy the themes folder in the home directory
<syntaxHighlight lang=nix>
programs.dconf.enable = true;
</syntaxHighlight>


<syntaxhighlight lang="console">
[https://github.com/NixOS/nixpkgs/issues/180720 (See this issue)]
$ cp -R ~/.nix-profile/share/themes/ ~/.themes
</syntaxhighlight>


[[Category:Desktop environments]]
[[Category:Desktop environments]]
[[Category:Applications]]
[[Category:Applications]]

Revision as of 22:32, 18 September 2022

KDE Plasma is a desktop environment that aims to be simple by default, powerful when needed.

Installing KDE Plasma

To use KDE Plasma, add this to your configuration.nix:

services.xserver.enable = true;
services.xserver.displayManager.ssdm.enable = true;
services.xserver.desktopManager.plasma5.enable = true;

Excluding some KDE Plasma applications from the default install

Not all applications that come pre-installed with the KDE Plasma desktop environment are desirable for everyone to have on their machines. There's a way to edit configuration.nix to exclude these kinds of packages, for example as follows:

services.xserver.desktopManager.plasma5.excludePackages = with pkgs.libsForQt5; [
  elisa
  gwenview
  okular
  oxygen
  khelpcenter
  konsole
  plasma-browser-integration
  print-manager
];

Troubleshoots

Qt/KDE applications segfault on start

This is caused by a stale QML cache (see this issue). A dirty way to fix this is by running on a terminal the following command:

find ${XDG_CACHE_HOME:-$HOME/.cache}/**/qmlcache -type f -delete

GTK themes are not applied in Wayland applications

Add to your configuration.nix the following line:

programs.dconf.enable = true;

(See this issue)