AvengeMedia / AvengeMedia/DankMaterialShell
Control Center: closing it with the WiFi section expanded leaves the 10s WiFi autoscan running (periodic latency spikes)
- Dominant language
- QML
- Stars
- 8.1k
- Forks
- 515
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 102
Description
### Compositor
Hyprland
### Distribution
CachyOS
### Select your Installation Method
Distro Packaging
### Was this your original Installation method?
Yes
### dms doctor -vC
Click to expand
```
## DMS Doctor Report
**System**
- [ok] Operating System: CachyOS
- ID: cachyos, Version: rolling, Arch: amd64
- [ok] Architecture: amd64
- [ok] Display Server: Wayland
- WAYLAND_DISPLAY=wayland-1
**Versions**
- [ok] DMS CLI: dms v1.6.1
- /usr/bin/dms
- [ok] Quickshell: Quickshell 0.3.1 (revision , distributed by Arch Linux)
- /usr/bin/qs
- [ok] DMS Shell: v1.6.1
- /run/user/1000/danklinux-shell/d83248ba9119b48a
**Installation**
- [ok] DMS Configuration: Found
- /run/user/1000/danklinux-shell/d83248ba9119b48a
- [ok] shell.qml: Present
- /run/user/1000/danklinux-shell/d83248ba9119b48a/shell.qml
- [info] Install Type: Unknown
- /run/user/1000/danklinux-shell/d83248ba9119b48a
**Compositor**
- [ok] Hyprland: 0.56.2
- /usr/bin/hyprland
- [info] Active: Hyprland
- [ok] Background Blur: Supported
- Compositor supports ext-background-effect-v1
**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)
- [ok] BackgroundBlur: Available
- Background blur API support in Quickshell
**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
- [ok] I2C/DDC: 3 monitor(s) detected
- External monitor brightness control
- [ok] qt6-imageformats: Installed (5 formats)
- Formats: WebP, TIFF, GIF, JP2, ICNS (/usr/lib/qt6/plugins/imageformats:/usr/lib/qt/plugins/imageformats:/usr/lib64/qt6/plugins/imageformats)
- [ok] kimageformats: Installed (4 formats)
- Formats: AVIF, HEIF, JXL, EXR (/usr/lib/qt6/plugins/imageformats:/usr/lib64/qt6/plugins/imageformats)
- [ok] Terminal: ghostty
- [ok] Network: NetworkManager
- NetworkManager present. Using NM API.
- [ok] matugen: Installed
- Dynamic theming
- [ok] cava: Installed
- Audio visualizer
- [ok] khal: Installed
- Calendar events
- [ok] danksearch: Installed
- File search
- [ok] dankcalendar: Installed
- Calendar app
- [ok] fprintd: Installed
- Fingerprint auth
- [ok] adw-gtk3: Installed
- GTK3 dynamic theming (system copy, applied on next theme apply)
**Config Files**
- [ok] settings.json: Present
- /home/wreck/.config/DankMaterialShell/settings.json
- [info] clsettings.json: Not yet created
- /home/wreck/.config/DankMaterialShell/clsettings.json
- [ok] plugin_settings.json: Present
- /home/wreck/.config/DankMaterialShell/plugin_settings.json
- [ok] session.json: Present
- /home/wreck/.local/state/DankMaterialShell/session.json
- [ok] dms-colors.json: Present
- /home/wreck/.cache/DankMaterialShell/dms-colors.json
**Services**
- [ok] dms.service: enabled, active
- [ok] greetd: enabled
**Environment**
- [info] QT_QPA_PLATFORMTHEME: qt6ct
- [ok] qt6ct plugin (Qt6): Installed
- /usr/lib/qt6/plugins/platformthemes/libqt6ct.so
- [info] QT_QPA_PLATFORMTHEME_QT6: Not set
- [info] QS_ICON_THEME: Not set
- [info] XDG_MENU_PREFIX: plasma-
**Fonts**
- [ok] Normal Font: Manrope
- Available via fontconfig
- [ok] Monospace Font: JetBrainsMono Nerd Font
- Available via fontconfig
---
**Summary:** 0 error(s), 0 warning(s), 40 ok
```
### Description
If Control Center is closed while the WiFi/network section is expanded, `DMSNetworkService` keeps its 10-second autoscan running indefinitely. Each NetworkManager scan takes the radio off-channel for several seconds, so on WiFi this causes constant latency spikes. It was very noticeable in Dota 2 as movement stutter.
Measured on the affected machine (MT7922, 5 GHz, router one wall away):
- `iw event -t` showed `scan started` every 10 s, each full scan lasting ~6 s (2.4/5/6 GHz).
- The `RequestScan` D-Bus calls came from `dms run --session`.
- Ping to the LAN gateway: min 0.8 / avg 35 / max 170 ms, with every spike above 30 ms inside a scan window.
- After `systemctl --user restart dms`: 0 scans in 30 s, ping avg 6 ms.
This is likely the cause behind #189.
### Cause (traced in v1.6.1)
1. `NetworkDetail` takes a ref on creation and releases it only on destruction ([NetworkDetail.qml#L38-L44](https://github.com/AvengeMedia/DankMaterialShell/blob/v1.6.1/quickshell/Modules/ControlCenter/Details/NetworkDetail.qml#L38-L44)). While `refCount > 0`, the 10 s scan timer runs ([DMSNetworkService.qml#L296-L308](https://github.com/AvengeMedia/DankMaterialShell/blob/v1.6.1/quickshell/Services/DMSNetworkService.qml#L296-L308), [#L898-L903](https://github.com/AvengeMedia/DankMaterialShell/blob/v1.6.1/quickshell/Services/DMSNetworkService.qml#L898-L903)).
2. Popout content stays loaded after close via `_contentWarm` ([DankPopoutConnected.qml#L1360-L1361](https://github.com/AvengeMedia/DankMaterialShell/blob/v1.6.1/quickshell/Widgets/DankPopoutConnected.qml#L1360-L1361), same in [DankPopoutStandalone.qml#L944-L945](https://github.com/AvengeMedia/DankMaterialShell/blob/v1.6.1/quickshell/Widgets/DankPopoutStandalone.qml#L944-L945)). Warm content is only reclaimed on lock or monitors-off.
3. `ControlCenterPopout` runs `collapseAll()` only when it opens. The close branch of `onShouldBeVisibleChanged` resets `autoRefreshEnabled` and Bluetooth discovery but doesn't collapse ([ControlCenterPopout.qml#L122-L140](https://github.com/AvengeMedia/DankMaterialShell/blob/v1.6.1/quickshell/Modules/ControlCenter/ControlCenterPopout.qml#L122-L140)). The `onVisibleChanged` collapse ([#L71-L75](https://github.com/AvengeMedia/DankMaterialShell/blob/v1.6.1/quickshell/Modules/ControlCenter/ControlCenterPopout.qml#L71-L75)) never fires, because the popout root's `visible` doesn't change on close.
As a result, `expandedSection` stays `"wifi"`, the `DetailHost` loader keeps `NetworkDetail` alive, its ref is never released, and autoscan continues until Control Center is reopened, the screen locks, or monitors turn off.
A possible fix is to call `collapseAll()` in the close branch of `onShouldBeVisibleChanged`. Alternatively, `NetworkDetail` could tie its ref to the popout being shown rather than to its own lifetime.
### Expected Behavior
WiFi autoscan stops when Control Center is closed.
### Steps to Reproduce
1. Run `iw event -t | grep scan` in a terminal.
2. Open Control Center and expand the WiFi section.
3. Close Control Center without collapsing the section.
4. `scan started` keeps appearing every 10 s. It stops once Control Center is opened again, since opening collapses all sections.
Confirmed with this exact sequence: after closing with WiFi expanded, scans started at a steady 10 s interval (4 in a row). After reopening, there were none in the following 46 s.
### Error Messages/Logs
No errors are logged. One side effect: scans keep firing while WiFi reconnects, which produces:
```
ERROR go: DMS API Error: ... error=scan request failed: Scanning not allowed while unavailable
WARN qml: [DMSNetworkService:603] WiFi scan failed: scan request failed: Scanning not allowed while unavailable
```
Contributor guide
Research direction
Start with quickshell/Modules/ControlCenter/ControlCenterPopout.qml, especially the visibility handlers and collapseAll() call. Trace the referenced NetworkDetail.qml, DMSNetworkService.qml, and popout content-loading paths to understand the lifetime and scan timer behavior. Reproduce with iw event -t, then verify that closing the Control Center with WiFi expanded stops subsequent scans.
Written by the indexing model from the issue text.
Assessment
- Domain
- desktop, networking, performance
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 90/100