Skip to content

wsdfhjxc/virtual-desktop-bar

Repository files navigation

Virtual Desktop Bar

This is an applet for KDE Plasma panel (or Latte Dock) that lets you switch between virtual desktops and also invoke some actions to dynamically manage them in a convenient way. In order to do it, you can use the mouse, the context menu or user-defined keyboard shortcuts. There are also some extra features related to virtual desktops.

The plasmoid displays virtual desktops as text labels with indicators in various styles. That means there's no graphical icons and window previews like in the Plasma's default Pager applet. Although the intention is to keep it simple, the applet has several configuration options regarding its behavior and visuals. These should be more than enough for desktop customization enthusiasts and folks at /r/unixporn who want to make their panels aesthetic.

And actually, the whole reason for creating this plasmoid was about the aesthetics in the first place, as I consider the Plasma's default Pager applet, with its fixed-size rectangles and window shapes, to be quite ugly, to put it straight.

Features

  • Switching, adding, removing, renaming, moving desktops
  • Mouse dragging, clicking, scrolling support, context menu, keyboard shortcuts
  • Automation: switching, renaming desktops, executing commands, dynamic desktops
  • Customizable size, spacing, font, color and style of desktop buttons and labels
  • Showing a desktop button only for the current desktop or only for occupied desktops
  • Formatting the desktop label's style (name, number, Roman number, window's name, etc.)
  • Limiting the maximum length of desktop labels, displaying them as UPPERCASED
  • Customizable style and colors of desktop indicators in different states (idle, current, occupied etc.)

and a few more not mentioned options...

Screenshots

Adding, renaming, moving, removing a desktop:

Various desktop label styles:

Various desktop indicator styles:

Partial support also for vertical panels:

Installation

To install the applet, either get it as a distro-specific package, or build it from source by yourself.

Packages

  • Arch Linux users can get the latest git version of the applet as an AUR package (thanks @nwwdles)

From source

First, you need to install some required dependencies:

  • On Fedora run: ./scripts/install-dependencies-fedora.sh
  • On openSUSE run: ./scripts/install-dependencies-opensuse.sh
  • On Arch Linux or Manjaro run: ./scripts/install-dependencies-arch.sh
  • On Kubuntu or KDE neon run: ./scripts/install-dependencies-ubuntu.sh

Then, to compile the source code and install the applet run: ./scripts/install-applet.sh

Note: This also applies if you want to upgrade to a newer version.

Note: If you want to remove the applet run: ./scripts/uninstall-applet.sh

After that, you should be able to find Virtual Desktop Bar in the Add Widgets menu.

Configuration

The applet has some options regarding its behavior and visuals. You'll find them in the configuration dialog.

Don't get fooled by an empty Keyboard Shortcuts section though. It's an imposed thing, common for all plasmoids.

There are global keyboard shortcuts, but you have to configure them in the Global Shortcuts System Settings Module. They should be available under KWin, Plasma or Latte Dock component, depending on the Plasma's mood and where have you placed the applet. All of the shortcuts have the Virtual Desktop Bar prefix for easier recognition.

Known issues

  • Virtual desktops are shared by all monitors (KWin's limitation)
  • Support for Plasma Wayland session isn't there yet (this is a long-term goal)
  • The code behind this applet is a mess that doesn't follow the proper way of writing plasmoids
  • Dynamic virtual desktop management doesn't play nice with KWin scripts (see the explanation below)

Compatibility with KWin scripts

The plasmoid does some things which results of are not exposed through the KWin scripting API. This is related to dynamic desktops, moving desktops, removing desktops other than the last one. These are non-native features. Because of that, KWin scripts tracking desktops or windows (for example tiling scripts) in most cases will be confused and will not react properly to performed actions (maybe except the dynamic desktops feature, depends on the script).

Nothing can be done about it, as long as KWin scripting API does not support signals like:

  • desktopRemoved(QString id)
  • desktopsReplaced(QString id1, QString id2)

To avoid issues while using KWin scripts, do not use the features mentioned above.

Compatibility with window managers other than KWin

Some features, even the basic ones, like adding or removing desktops, might not work if KWin is replaced with a different window manager, be it i3, bspwm or any other. Such issues are unlikely to be addressed. However, the plasmoid should still display desktops and their state, so it can act as a visual addition with labels and indicators.