The Complete Computer

KDE is a Base for my Emacs Desktop

LifeTechEmacsArcology
emacs-lisp source: :tangle kde-desktop.el
(provide 'cce/kde-desktop)

Since I first started using Linux from a live-image collection DVD in the back of Fry's Electronics magazine, I have been a use of the various KDE desktop environments, or more specifically the KDE desktop's various incarnations over the years from KDE 3.5.9.

I've spent time exploring basically every other Desktop Environment under the sun over the years, but KDE is the right balance of smart design choices, and malleable user-choices. This is one of the few desktop environments that still, for example, make it easy to swap your window manager software easily.

If I wanted to install EXWM as my default window manager, rather than allowing it to kill kwin when EXWM is ready to load, I could simply place this in ~/.config/plasma-workspace/env/ and KDE will read the file, and use it.

shell source: 
KDEWM=/usr/bin/emacs

And EXWM works really well with most of the KDE Plasma system. I don't really see my desktop of course, but the panel which has my list of X11 applications, my "system tray", etc, are still fully functional, once I learned that [[id:cce/exwmshould_ignoreplasma_notifications][EXWM [can and] should ignore Plasma notifications]].

I have a simple function M-x logout that will signal to KDE's Session Manager via D-BUS to trigger a desktop logout, as though I'd hit the logout button on the Application Launcher:

emacs-lisp source: :tangle kde-desktop.el
(defun logout-kde () (interactive) (background-shell-command "qdbus org.kde.ksmserver /KSMServer logout -1 2 3"))

Installing KDE on My NixOS configuration

This is the bare-minimum for me; most of the applications are arbitrarily managed in home-manager e.g. Applications I Use so that they're available on home-manager+linux systems.

I customize my KDE installation a fair bit both within home-manager and without. Look at my use of Plasma Manager , and How I use KDE Plasma (Primarily) with a Keyboard .

nix source: :tangle ~/arroyo-nix/nixos/kde.nix
{ config, pkgs, ... }: { environment.variables = { QT_LOGGING_RULES = "kwin_*.debug=true"; }; security.pam.services.login = { enableKwallet = true; startSession = true; }; # use plasma5 services.desktopManager.plasma6.enable = true; environment.systemPackages = (with pkgs.kdePackages; [ breeze-gtk kde-gtk-config breeze kdesu plasma-systemmonitor kio-extras # kipi-plugins plasma-browser-integration xdg-desktop-portal-kde systemsettings bluedevil ark dolphin filelight gwenview konsole okular partitionmanager ]) ++ (with pkgs; [ # core kde applications libreoffice-qt gparted ]) ++ (with pkgs; [ # extra utilities to make desktop bearable wl-clipboard-x11 ]); environment.sessionVariables = { QT_LOGGING_CONFIG = "kwin_xwl.debug=true"; }; # auto login services.xserver.enable = true; services.displayManager = { autoLogin.enable = true; autoLogin.user = "rrix"; # defaultSession = "plasma"; }; # services.xserver.displayManager.lightdm.enable = true; }

How I use KDE Plasma (Primarily) with a Keyboard

look ma, no pointer!

Driving A Laptop with Krohnkite

When I used X11 one of the window managers I preferred the most was XMonad. I can't claim to "know haskell", but I can copy and customize haskell I find on wiki pages and from friends, so when my friend Tor showed me his linux tiling WM setup and tossed me his config I was hooked. It allowed me to move really quickly through my windows, roughly organized with a few workspaces for swapping between code, docs, reference code, communications apps, media players... all in their own little place just a single keychord away from me. For years meta-s has taken me to a virtual desktop with my communication methods, a mere muscle twitch away. Double-edged sword dark laughter

And having an auto-tiler, boy howdy. Windows just show up and get out of the way, you can move things around without taking your hands off the keyboard, have them reorganized with separate organization strategies for each virtual desktop. things just zoom around and then stay where you want them to be.

For years I could just run XMonad with Plasma under X11 and that was great. Now I run Wayland. I tried RiverWM , I used a few KWin Scripts krohnkite, bismuth, etc, but Plasma 6 temporarily broke a lot of them and I was happy enough with Karousel especially on my laptop and on the ultra-wide monitor, but it was a bummer that it doesn't support multimonitor. I meant to get around asking some folks to give me a nudge toward fixing that for myself, but Krohnkite works again, and it's a great option for managing your desktop windows with only a tiny little keyboard like The Monticello Drive or a Framework Laptop

nix source: :tangle ~/arroyo-nix/hm/kde-config-shortcuts-krohnkite.nix :noweb tangle
{ pkgs, config, ... }: { # home.packages = [ pkgs.kdePackages.krohnkite pkgs.kwin-effects-forceblur pkgs.karess ]; programs.plasma.shortcuts = { <<shortcuts_str(shortcuts_tbl_krohnkite)>> <<shortcuts_str(shortcuts_tbl_common)>> <<unset_str()>> }; }

Now this set of tables is used to generate shortcuts suitable for using the roam:Karousel tiling WM on The Monticello Drive and Framework Laptop .

All keys here use the Windows/Meta/Super key...

  • Use asdf to switch between four virtual desktops, use those with the Shift key ASDF to move a window to that desktop.

  • Use jk to move to the next/previous windows. Use shifted JK to move the window up and down the stack.

  • Use um to increase the number of windows in the primary part of the split

  • Use HL to move the primary split left/right

  • Use r to rotate the layout

And, also, but:

groupkeyvalue
kwinKrohnkiteShrinkWidthMeta+H,
kwinKrohnkiteFocusNextMeta+J,
kwinKrohnkiteFocusPrevMeta+K,
kwinKrohnkitegrowWidthMeta+L,
kwinKrohnkiteGrowHeightMeta+Shift+H,
kwinKrohnkiteShiftDownMeta+Shift+J,
kwinKrohnkiteShiftUpMeta+Shift+K,
kwinKrohnkiteShrinkHeightMeta+Shift+L,
kwinKrohnkiteIncreaseMeta+U,
kwinKrohnkiteDecreaseMeta+M,
kwinKrohnkiteRotateMeta+R,
kwinKrohnkiteRotatePartMeta+Shift+R,
kwinKrohnkiteSetMasterMeta+Return,
kwinExposeMeta+X,
kwinExposeClassMeta+Shift+X,
kwinSwitch to Next ScreenMeta+I,
kwinSwitch to Previous ScreenMeta+\\,,,
kwinWindow to Next ScreenMeta+Ctrl+I,
kwinWindow to Previous ScreenMeta+Ctrl+\\,,,
filegroupkeyvaluenote
kwinrcPluginskrohnkiteEnabledtrue
kwinrcScript-krohnkitedirectionalKeyDwmtrue
kwinrcScript-krohnkitedirectionalKeyFocusfalse
kwinrcScript-krohnkitescreenGapBetween3
kwinrcScript-krohnkitescreenGapBottom5
kwinrcScript-krohnkitescreenGapLeft5
kwinrcScript-krohnkitescreenGapRight5
kwinrcScript-krohnkitescreenGapTop5
kwinrcScript-krohnkitebinaryTreeLayoutOrder0
kwinrcScript-krohnkitecascadeLayoutOrder0
kwinrcScript-krohnkitefloatingLayoutOrder0
kwinrcScript-krohnkitespiralLayoutOrder0
kwinrcScript-krohnkitespreadLayoutOrder0
kwinrcScript-krohnkitestairLayoutOrder0
kwinrcScript-krohnkitelimitTileWidthtrue

Common Keybindings

groupkeyvalue
kwinWindow On All DesktopsMeta+Z,
kwinWindow CloseAlt+F4,Meta+Backspace,
kwinKill WindowMeta+Ctrl+Esc,
kwinOverviewMeta+G,
kwinExposeAllLaunch (C),Meta+T,
kwinShow DesktopMeta+Q,
plasmashellshow-on-mouse-posMeta+V,
kwinActivate Window Demanding AttentionMeta+Ctrl+A,
kwinCubeMeta+C,
kwinWindow MaximizeMeta+N,
kwinMoveMouseToCenterMeta+[,
kwinMoveMouseToFocusMeta+],
yakuaketoggle-window-stateMeta+Y,
kwinSwitch to Desktop 1Meta+A,
kwinSwitch to Desktop 2Meta+S,
kwinSwitch to Desktop 3Meta+D,
kwinSwitch to Desktop 4Meta+F,
kwinWindow to Desktop 1Meta+Shift+A,
kwinWindow to Desktop 2Meta+Shift+S,
kwinWindow to Desktop 3Meta+Shift+D,
kwinWindow to Desktop 4Meta+Shift+F,
kwinviewactual_sizeMeta+0,
kwinviewzoom_inMeta++, Meta+=,
kwinviewzoom_outMeta+-,

Panels and Desktop Widgets

configuration example

nix source: :tangle ~/arroyo-nix/hm/kde-config-plasma-workspace.nix :noweb tangle
{ ... }: { programs.plasma.panels = [ { alignment = "center"; floating = true; lengthMode = "fit"; location = "top"; height = 48; hiding = "autohide"; widgets = [ "org.kde.plasma.digitalclock" { name = "org.kde.plasma.fuzzyclock"; config.Appearance.fuzzyness = 2; } { name = "org.kde.plasma.fuzzyclock"; config.Appearance.fuzzyness = 3; } { name = "org.kde.plasma.fuzzyclock"; config.Appearance.fuzzyness = 4; } { name = "org.kde.plasma.fuzzyclock"; config.Appearance.fuzzyness = 5; } ]; } { alignment = "center"; floating = true; lengthMode = "fill"; location = "bottom"; height = 32; widgets = [ "org.kde.plasma.pager" "org.kde.plasma.panelspacer" "org.kde.plasma.kickoff" { name = "org.kde.plasma.fuzzyclock"; config.Appearance.fuzzyness = 2; } { name = "org.kde.plasma.icontasks"; config.General = { launchers="preferred://browser,applications:emacs.desktop"; showOnlyCurrentDesktop="false"; groupingStrategy="0"; # disable grouping sortingStrategy="3"; # by desktop }; } "org.kde.plasma.panelspacer" "org.kde.plasma.marginsseparator" { systemTray.items = { # We explicitly show bluetooth and battery # shown = [ # "org.kde.plasma.battery" # "org.kde.plasma.bluetooth" # ]; hidden = [ "chrome_status_icon_1" # electron apps lol sob "Syncthing Tray" "org.kde.plasma.bluetooth" "Yakuake" ]; }; } ]; } ]; programs.plasma.workspace = { clickItemTo = "select"; lookAndFeel = "org.kde.breezedark.desktop"; colorScheme = "Breeze Dark Evo"; # wallpaperPictureOfTheDay.provider = "apod"; }; }

Desktop and Lockscreen Wallpapers

nix source: :tangle ~/arroyo-nix/hm/kde-config-plasma-wallpapers.nix :noweb tangle
{ ... }: let wpssc = { interval = 180; path = [ "/home/rrix/sync/wallpapers/" "/home/rrix/Pictures/Backgrounds/" "/home/rrix/Pictures/Incoming/Game Captures/art of rally/" "/home/rrix/.nix-profile/share/wallpapers/" "/run/current-system/sw/share/wallpapers/" ]; }; in { programs.plasma.kscreenlocker.appearance.wallpaperSlideShow = wpssc; programs.plasma.workspace.wallpaperSlideShow = wpssc; }

KWin effects configuration

filegroupkeyvaluenote
kwinrcDesktopsName1🂱 Hearts
kwinrcDesktopsName2🃁 Diamonds
kwinrcDesktopsName3🃑 Clubs
kwinrcDesktopsName4🂡 Spades
kwinrcDesktopsId1ea4af40e-ac2e-47a6-a7fe-d8c96fe19498
kwinrcDesktopsId26b27887c-168b-47c0-afec-1e2c4fb7569c
kwinrcDesktopsId35fad8a00-140c-48b9-bce8-e387e1897532
kwinrcDesktopsId4a16fda83-8a7c-4abf-a525-f6cad58b173e
kwinrcEffect-PresentWindowsLayoutMode2Layout Mode = Closest
kwinrcEffect-overviewLayoutMode0Layout Mode = Closest
kwinrcModifierOnlyShortcutsMetaDisable Meta/Super/Windows "start button" behavior.
kwinrcNightColorActivetrueEnable night color temperatures
kwinrcNightColorModeTimesI had issues with the location-based changing...
kwinrcNightColorMorningBeginFixed0700
kwinrcNightColorEveningBeginFixed2000
kwinrcNightColorNightTemperature3600Change to 3600k at night
kwinrcXwaylandScale1X11 Apps will scale themselves
kwinrcXwaylandXwaylandEavesdropsCombinations"All keys, but only while Meta, Ctrl, Alt, or Shift keys are pressed"
kwinrcModifierOnlyShortcutsMetaDisable Meta/Super/Windows "start button" behavior.
breezercWindecoButtonSizeButtonSmall
nix source: :tangle ~/arroyo-nix/hm/kde-config-kwin.nix :noweb tangle
{ ... }: { programs.plasma.kwin = { borderlessMaximizedWindows = false; effects = { blur.enable = true; cube.enable = true; desktopSwitching.animation = "fade"; dimAdminMode.enable = true; minimization.animation = "magiclamp"; minimization.duration = 150; shakeCursor.enable = true; slideBack.enable = false; snapHelper.enable = true; translucency.enable = true; windowOpenClose.animation = "glide"; wobblyWindows.enable = true; }; nightLight = { enable = true; mode = "location"; location.latitude = "44.0"; location.longitude = "-123.1"; transitionTime = 30; }; virtualDesktops.number = 4; virtualDesktops.rows = 2; }; }

NEXT Draft programs.plasma.window-rules

nix source: :tangle ~/arroyo-nix/hm/kde-config-window-rules.nix :noweb tangle
{ ... }: { programs.plasma.window-rules = [ # { # description = "Cantata -> D2"; # match.window-class = { # value = "cantata"; # type = "substring"; # }; # match.window-types = ["normal" ]; # apply.desktops = { # value = ""; # apply = "initially"; # }; # } ]; }

CANCELLED Temporarily having gnome-shell fall-back session

I've been experiencing a desktop crash for like 3 months now. I have to do my job.

#+ARROYO_NIXOS_MODULE: nixos/gnome.nix
nix source: :tangle ~/arroyo-nix/nixos/gnome.nix
{ pkgs, lib, ... }: { # services.xserver.desktopManager.gnome.enable = true; # services.gnome.gnome-browser-connector.enable = true; # hardware.pulseaudio.enable = false; # programs.ssh.askPassword = lib.mkForce "${pkgs.ksshaskpass}/bin/ksshaskpass"; # services.xserver.displayManager.defaultSession = lib.mkForce "gnome"; # programs.kdeconnect.package = pkgs.gnomeExtensions.gsconnect; # environment.systemPackages = with pkgs.gnomeExtensions; [ # activate-window-by-title # appindicator # paperwm # pixel-saver # yakuake # ]; }

CANCELLED Package for Karousel kwin script [and maybe a plasma-manager module]

no longer needed, this is in nixpkgs

Available in rixpkgs , kept up to date in Nix Version Pins .

nix source: :tangle ~/arroyo-nix/pkgs/karousel.nix
{ lib , callPackage , mkDerivation , plasma-framework , typescript , nodejs , kwindowsystem }: mkDerivation rec { pname = "karousel"; version = lib.pkgVersions.karousel.version; src = callPackage lib.pkgVersions.karousel.src {}; postPatch = '' patchShebangs --build . ''; buildInputs = [ typescript nodejs plasma-framework ]; # 1. --global still installs to $HOME/.local/share so we use --packageroot # 2. plasmapkg2 doesn't copy metadata.desktop into place, so we do that manually installPhase = '' runHook preInstall plasmapkg2 --type kwinscript --install ./package --packageroot $out/share/kwin/scripts runHook postInstall ''; meta = with lib; { description = "Scrollable tiling script for kwin"; license = licenses.gpl2; inherit (src.meta) homepage; inherit (kwindowsystem.meta) platforms; }; }

DONE put this in Nix Version Pins so that it's up to date.

Package for KWin Better Blur

You know the drill...

nix source: :tangle ~/arroyo-nix/pkgs/kwin-effects-forceblur.nix
{ lib , stdenv , callPackage , cmake , extra-cmake-modules , kwin , wrapQtAppsHook , qttools }: stdenv.mkDerivation rec { pname = "kwin-better-blur"; version = lib.pkgVersions.kwin-force-blur.version; src = callPackage lib.pkgVersions.kwin-force-blur.src {}; nativeBuildInputs = [ cmake extra-cmake-modules wrapQtAppsHook ]; buildInputs = [ kwin qttools ]; meta = with lib; { description = "Fork of the KWin Blur effect for KDE Plasma 6 with additional features (including force blur) and bug fixes"; license = licenses.gpl3; homepage = "https://github.com/taj-ny/kwin-effects-forceblur"; }; }

INPROGRESS Package for Karess

It lets u set up ur computer to have shortcuts bound to touchpad gestures

In to rixpkgs with u. In to Nix Version Pins with u.

nix source: :tangle ~/arroyo-nix/pkgs/karess.nix
{ lib , callPackage , stdenv , plasma-framework , kwin }: stdenv.mkDerivation (finalAttrs: { pname = "karess"; version = lib.pkgVersions.karess.version; src = callPackage lib.pkgVersions.karess.src {}; buildInputs = [ kwin plasma-framework ]; dontWrapQtApps = true; installPhase = '' runHook preInstall plasmapkg2 --type kwinscript --install ./src --packageroot $out/share/kwin/scripts runHook postInstall ''; meta = { description = "KWin Effect to enable touchpad gestures with Karousel"; homepage = "https://github.com/lavafroth/karess"; license = lib.licenses.mit; maintainers = with lib.maintainers; [ rrix ]; platforms = lib.platforms.all; }; })