AvengeMedia / AvengeMedia/DankMaterialShell

IPC latency is very high

Open
#2,060 3 comments 4 reactions 0 assignees View on GitHub
feature request
Dominant language
QML
Stars
8.1k
Forks
515
Avg merge
1d 8h
Merged PRs (30d)
102

Description

### Compositor

Niri

### Distribution

NixOS

### If Other, please specify

_No response_

### Select your Installation Method

Distro Packaging

### Was this your original Installation method?

Yes

### If no, specify

_No response_

### dms doctor -vC

Click to expand
## DMS Doctor Report

**System**
- [ok] Operating System: NixOS 26.05 (Yarara)
- Supported for runtime (install via NixOS module or Flake)
- [ok] Architecture: amd64
- [ok] Display Server: Wayland
- WAYLAND_DISPLAY=wayland-1

**Versions**
- [ok] DMS CLI: dms 1.4.4+date=2026-03-20_1f64bb8
- /nix/store/srrs2h9rvaibfvx7mr4ahv0c12shvdsg-dms-shell-1.4.4+date=2026-03-20_1f64bb8/bin/.dms-wrapped
- [ok] Quickshell: quickshell 0.2.1, revision 41828c4180fb921df7992a5405f5ff05d2ac2fff, distributed by: Official-Nix-Flake
- /etc/profiles/per-user/alex/bin/qs
- [ok] DMS Shell: 1.4.4+date=2026-03-20_1f64bb8
- /nix/store/srrs2h9rvaibfvx7mr4ahv0c12shvdsg-dms-shell-1.4.4+date=2026-03-20_1f64bb8/share/quickshell/dms

**Installation**
- [ok] DMS Configuration: Found
- /nix/store/srrs2h9rvaibfvx7mr4ahv0c12shvdsg-dms-shell-1.4.4+date=2026-03-20_1f64bb8/share/quickshell/dms
- [ok] shell.qml: Present
- /nix/store/srrs2h9rvaibfvx7mr4ahv0c12shvdsg-dms-shell-1.4.4+date=2026-03-20_1f64bb8/share/quickshell/dms/shell.qml
- [info] Install Type: Nix store
- /nix/store/srrs2h9rvaibfvx7mr4ahv0c12shvdsg-dms-shell-1.4.4+date=2026-03-20_1f64bb8/share/quickshell/dms

**Compositor**
- [ok] niri: niri unstable 2026-03-10 (commit b07bde3ee82dd73115e6b949e4f3f63695da35ea)
- /run/current-system/sw/bin/niri
- [info] Active: niri

**Quickshell Features**
- [ok] Polkit: Available
- Authentication prompts
- [ok] IdleMonitor: Available
- Idle detection
- [ok] IdleInhibitor: Available
- Prevent idle/sleep
- [ok] ShortcutInhibitor: Available
- Allow shortcut management (niri)

**Optional Features**
- [ok] accountsservice: Available
- User accounts
- [ok] power-profiles-daemon: Available
- Power profile management
- [ok] logind: Available
- Session management
- [ok] cups-pk-helper: Available
- Printer management
- [info] I2C/DDC: No monitors detected
- External monitor brightness control
- [ok] qt6-imageformats: Installed (4 formats)
- Formats: WebP, TIFF, JP2, ICNS (/nix/store/qzsfgk79hv21dksvmc38rl5fz9xlfcr5-qtimageformats-6.10.2/lib/qt-6/plugins/imageformats)
- [ok] kimageformats: Installed (4 formats)
- Formats: AVIF, HEIF, JXL, EXR (/nix/store/4dbjqmnphycqjapsm3b8chpp9gvm9blh-kimageformats-6.24.0/lib/qt-6/plugins/imageformats)
- [ok] Terminal: alacritty
- [ok] Network: NetworkManager
- NetworkManager present. Using NM API.
- [ok] matugen: Installed
- Dynamic theming
- [ok] dgop: Installed
- System monitoring
- [ok] cava: Installed
- Audio visualizer
- [ok] khal: Installed
- Calendar events
- [info] danksearch: Not installed
- File search
- [info] fprintd: Not installed
- Fingerprint auth

**Config Files**
- [ok] settings.json: Present
- /home/alex/.config/DankMaterialShell/settings.json
- [info] clsettings.json: Not yet created
- /home/alex/.config/DankMaterialShell/clsettings.json
- [info] plugin_settings.json: Not yet created
- /home/alex/.config/DankMaterialShell/plugin_settings.json
- [ok] session.json: Present
- /home/alex/.local/state/DankMaterialShell/session.json
- [ok] dms-colors.json: Present
- /home/alex/.cache/DankMaterialShell/dms-colors.json

**Services**
- [ok] dms.service: enabled, active
- [ok] greetd: enabled

**Environment**
- [info] QT_QPA_PLATFORMTHEME: Not set
- [info] QS_ICON_THEME: Not set

---
**Summary:** 0 error(s), 0 warning(s), 30 ok

### Description

Internal `dms ipc` command adds high latency. `qs ipc` works much faster:

- `dms ipc spotlight toggle`: p50 ~190 ms, avg ~193 ms
- `qs ipc --pid call spotlight toggle`: p50 ~100 ms, avg ~142 ms

`qs ipc` still has noticeably more latency than niri-native actions, so it will be good if dms and qs ipc will be optimized to near-instant speed.

### Expected Behavior

Dms ipc wrapper adds ~0 latency

### Steps to Reproduce

Performance testing script and report from GPT-5.4:

# `dms ipc` latency is noticeable/high for interactive actions

## Summary

`dms ipc` feels noticeably slow for interactive actions like launcher, notifications, and power menu toggles.

On my machine, even simple `dms ipc` calls have a visible baseline latency, and UI toggle actions are slower still. Direct `qs ipc` calls against the running shell are materially faster than `dms ipc` for equivalent actions.

This makes it look like a significant part of the delay is in the `dms ipc` client path itself, not only in the shell action handler.

## Environment

- DMS: `1.4.4+date=2026-03-20_1f64bb8`
- Quickshell: `0.2.1`
- OS: NixOS
- Session: niri
- DMS is running as a long-lived user systemd service

## What I measured

### CLI baseline

- `dms version`: ~76–95 ms

### Simple IPC read

- `dms ipc theme getMode`: p50 ~160 ms, avg ~185 ms

### Interactive toggles via `dms ipc`

- `dms ipc spotlight toggle`: p50 ~190 ms, avg ~193 ms
- `dms ipc notifications toggle`: p50 ~177 ms, avg ~176 ms

In some earlier spot measurements, toggle actions also reached the ~300–560 ms range.

### Direct `qs ipc` against the running shell

Using the live Quickshell PID directly:

- `qs ipc --pid call theme getMode`: p50 ~74 ms, avg ~108 ms
- `qs ipc --pid call spotlight toggle`: p50 ~100 ms, avg ~142 ms
- `qs ipc --pid call notifications toggle`: p50 ~77 ms, avg ~118 ms

So direct `qs ipc` is consistently faster than `dms ipc` for equivalent actions.

## Reproduction

### 1. Make sure DMS is already running

```bash
systemctl --user status dms.service --no-pager
```

### 2. Measure `dms ipc`

```bash
python - <<'PY'
import subprocess, time, statistics
batches = {
'dms_theme': [["dms","ipc","theme","getMode"] for _ in range(8)],
'dms_spotlight': [["dms","ipc","spotlight","toggle"] for _ in range(8)],
'dms_notifications': [["dms","ipc","notifications","toggle"] for _ in range(8)],
}
for name, cmds in batches.items():
vals=[]
for cmd in cmds:
t0=time.perf_counter()
p=subprocess.run(cmd, capture_output=True, text=True)
dt=(time.perf_counter()-t0)*1000
if p.returncode==0:
vals.append(dt)
print(f"{name} count={len(vals)} min_ms={min(vals):.1f} p50_ms={statistics.median(vals):.1f} avg_ms={statistics.mean(vals):.1f} max_ms={max(vals):.1f}")
PY
```

### 3. Measure direct `qs ipc` against the live shell

Find the Quickshell PID first from `systemctl --user status dms.service` or similar, then:

```bash
qs ipc --pid show
```

```bash
python - <<'PY'
import subprocess, time, statistics
PID = ""
batches = {
'qs_theme': [["qs","ipc","--pid",PID,"call","theme","getMode"] for _ in range(8)],
'qs_spotlight': [["qs","ipc","--pid",PID,"call","spotlight","toggle"] for _ in range(8)],
'qs_notifications': [["qs","ipc","--pid",PID,"call","notifications","toggle"] for _ in range(8)],
}
for name, cmds in batches.items():
vals=[]
for cmd in cmds:
t0=time.perf_counter()
p=subprocess.run(cmd, capture_output=True, text=True)
dt=(time.perf_counter()-t0)*1000
if p.returncode==0:
vals.append(dt)
print(f"{name} count={len(vals)} min_ms={min(vals):.1f} p50_ms={statistics.median(vals):.1f} avg_ms={statistics.mean(vals):.1f} max_ms={max(vals):.1f}")
PY
```

## Expected behavior

Interactive actions like launcher, notifications, and power menu toggles should feel near-instant, especially when DMS is already running.

## Actual behavior

`dms ipc` has noticeable latency on every invocation, enough to feel laggy on hotkeys. The daemon is already warm, but the command path still feels slow.

### Error Messages/Logs

_No response_

### Screenshots/Recordings

_No response_

Contributor guide

Open the contributing guide

Research direction

Start with the dms ipc command path and compare it with the direct qs ipc commands against the running shell. Reproduce the measurements using the provided Python benchmark and inspect the dms.service execution context. Done means the wrapper's added latency is near zero and interactive IPC actions are measurably closer to direct qs ipc performance.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
cli, desktop, performance
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.