Audio: hardware volume keys, chandra-ctl volume, and an OSD pill
CI / test (push) Failing after 51s

- Map VolumeUp, VolumeDown, and Mute keys to wpctl (PipeWire) or pactl, run asynchronously so the compositor never blocks
- Hold a volume key to repeat it; volume keys also work while the screen is off, without waking it
- Keep volume keys as the shutter when chandra-camera has focus; Mute still toggles system audio
- Add `chandra-ctl volume [up|down|mute|unmute|toggle|PCT|status]` and a transient Volume OSD
- Add volume-up, volume-down, and volume-mute entries to the shortcut table
This commit is contained in:
nandi committed 2026-11-28 20:01:58 -08:00
1 parent ebdd330eb5
commit 68912f6d64
11 files changed
+909 -1

No files matched your search

+21
View File
@@ -75,6 +75,9 @@ fn ChandraCompositor::capture_key(self : ChandraCompositor, code : UInt, pressed
/// modifiers. True when the key was used (neither it nor its release reaches a client).
fn ChandraCompositor::shortcut_key(self : ChandraCompositor, code : UInt, pressed : Bool) -> Bool {
if !pressed {
if code == self.vol_repeat_key {
self.stop_volume_repeat()
}
if self.sc_swallow.contains(code) {
self.sc_swallow.retain(c => c != code)
return true
@@ -99,6 +102,21 @@ fn ChandraCompositor::shortcut_key(self : ChandraCompositor, code : UInt, presse
Some(_) => false
None => false
}
Some(VolumeUp | VolumeDown as act) =>
if self.camera_takes_volume_keys() {
false
} else {
self.sc_swallow.push(code)
self.super_solo = false
self.trigger_volume_shortcut(act, code, true)
true
}
Some(VolumeMute) => {
self.sc_swallow.push(code)
self.super_solo = false
self.trigger_volume_shortcut(VolumeMute, code, true)
true
}
Some(action) => {
self.sc_swallow.push(code)
self.run_shortcut(action)
@@ -136,6 +154,9 @@ pub fn ChandraCompositor::run_shortcut(self : ChandraCompositor, action : @shell
RecordWindow => self.toggle_recording(ShotMode::WindowUnderCursor)
DockApps => ignore(self.open_dock_app(1))
EmojiPicker => self.toggle_emoji_picker()
VolumeUp => self.enqueue_volume(VolCmd::Up, !(self.screen_off || self.manual_screen_off))
VolumeDown => self.enqueue_volume(VolCmd::Down, !(self.screen_off || self.manual_screen_off))
VolumeMute => self.enqueue_volume(VolCmd::MuteToggle, !(self.screen_off || self.manual_screen_off))
}
}