Useful snippets around KDE / Plasma (wayland)

Disable desktop icons completely

  • Right-click desktop =>
  • Desktop and Wallpaper =>
  • Wallpaper =>
  • Layout: Desktop (instead of Folder View)

Remap keys

Previous versions of Plasma apparently alowed users to do this through Settings => Shortcuts, but not anymore.

I found a guide for how to do this in a displayserver-agnostic way. This works in general, but I caught a serious snag in my particular situation. I wanted to remap a key to represent the Menu key (i.e. the key that pops up the context menu as if you right-clicked the currently active item), but - at least on my Plasma - this is not called Menu but Compose!

I have edited

/etc/udev/hwdb.d/99-builtin-keyboard-remap-prtsc.hwdb

evdev:name:AT Translated Set 2 keyboard:*
 KEYBOARD_KEY_b7=compose

And executed

systemd-hwdb update
udevadm trigger

Now the PrtScr key is the menu key, in all applications.

Notifications

While most of Plasma is highly configurable, the look of notifications is not. I can’t even switch off icons!

Under Xorg I have used Dunst for a long time.

To get it working under Plasma/wayland, first make sure that you disable the native notifications by clicking on the > at the end of the system tray, then the “Configure System tray …” icon, then locate Notifications and set it to “Never show (disabled)”.

Then - after dunst is installed - I had to amend its systemd service like this:

$ cat ~/.config/systemd/user/dunst.service.d/override.conf 

[Install]
WantedBy=graphical-session.target

Log out/in, then try notify-send Hi to be 100% sure that it works now.

Make sure it runs under wayland natively. It will fall back to Xwayland if something isn’t right. Check the journal:

journalctl -e --user -u dunst
...
WARNING: Couldn't initialize wayland output. Falling back to X11 output.
...

Another fine option is glassosd.

Hacking (user-installed) Plasmoids

Adjust Plasmoid Opacity

KDE does not provide a mechanism for this.
You can remove the background completely, but you might still wish to reduce the opacity of what is visible.

Thankfully most if not all widgets are made in QML which is a scripting language, so hacking them is possible:

  • Open ~/.local/share/plasma/<id_of_plasmoid>/content/ui/main.qml (I think it’s always main.qml)
  • Find where the main widget is defined (again, I think it’s always main)
  • Add the desired opacity:

    qml PlasmoidItem { id: main opacity: 0.6 ... }

  • Save and restart the Plasma shell:

    systemctl –user restart plasma-plasmashell.service

Remove tooltip

Again, in main.qml, find toolTipMainText and toolTipSubText and instead of commenting them out, make them an empty string:

toolTipMainText: ""
toolTipSubText: ""

Markdown Preview in Kate

Enable Configure => Plugins => Document Preview.
Show previews with Alt+p.

It requires the “KPart for rendering Markdown content” package, usually named markdownpart, to be installed.

Open a specific page of Plasma Settings

$ kcmshell6
Usage: kcmshell6 [options] module
...
  --list   List all possible modules

Example:

kcmshell6 --caption "Keyboard Shortcuts" kcm_keys

Now you can tie that to a specific key.

Things I read

  • If the application you’re launching with “open with” has StartupNotify=false, then not all the environment variables get passed. (source)

  • “Run kbuildsycoca6 --noincremental in the terminal (to rebuild some cache).”
    man kbuildsycoca6: “Rebuilds the KService desktop file system configuration cache”