Machine translation from Turkish (Cloudflare Workers AI), not reviewed by the author. Read the Turkish original

← Posts

Quickshell IPC and System Events: Hyprland and D-Bus Integration

Score —

Managing instant desktop notifications and OSD windows with socket-based IPC, Hyprland event listeners, and D-Bus signals.

· 2 min read
Contents

Summary: Three examples explain how Quickshell connects to system events: media control via MPRIS2 over D-Bus, an OSD indicator that appears when volume or brightness changes, and telemetry read from hardware sensors.

The most critical test for desktop shells is how quickly and efficiently they can react to events occurring in the system. Even a 100-millisecond delay in the OSD indicator that appears on screen when you press the volume up key makes the desktop feel sluggish.

Quickshell delivers microsecond-level response times by connecting its event loop directly to the Linux kernel, the D-Bus message bus and Hyprland IPC sockets.

1. D-Bus and Media Controls (MPRIS2)

By listening to the org.mpris.MediaPlayer2 protocol, Quickshell instantly captures the state of applications such as Spotify, Firefox or VLC:

import QtQuick 2.15
import Quickshell.Services.Mpris 1.0

Item {
    id: mediaTracker
    
    readonly property var player: Mpris.players.values[0]
    
    Text {
        text: player ? (player.trackTitle + " — " + player.trackArtist) : "Medya çalmıyor"
        font.family: "JetBrains Mono"
        color: "#00ffcc"
    }
}

The moment the application changes the song, the D-Bus signal is captured directly by Quickshell; no additional polling loop is run.

2. Volume and Brightness OSD Indicator

On Wayland, WlrLayershell.layer: WlrLayer.Overlay is used for temporary OSD windows. The OSD structure that appears when the volume level changes and fades away smoothly after 1.5 seconds:

import QtQuick 2.15
import Quickshell 1.0
import Quickshell.Wayland 1.0

PanelWindow {
    id: volumeOsd
    
    anchors {
        bottom: true
        horizontalCenter: true
    }
    anchors.bottomMargin: 80
    
    width: 240
    height: 48
    color: "#0e1117"
    radius: 10
    
    WlrLayershell.layer: WlrLayer.Overlay
    visible: false
    
    Timer {
        id: hideTimer
        interval: 1500
        onTriggered: volumeOsd.visible = false
    }
    
    function trigger(level) {
        progressBar.value = level;
        volumeOsd.visible = true;
        hideTimer.restart();
    }
}

3. Hardware and Sensor Telemetry

Quickshell's C++ backend provides reactive providers that can directly read battery, thermal sensor and CPU frequencies from the Linux /sys/class/ directory. It consumes no resources while the shell process is asleep; it refreshes the interface only when the relevant sensor value changes.

My reading

  • Desktop events are already being published: by listening to D-Bus and Hyprland sockets, you can react without writing additional services.
  • The OSD appears only when needed: it opens when there is a change and closes shortly after.