- 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:
1 parent
ebdd330eb5
commit
68912f6d64
11 files changed
+909
-1
No files matched your search
@@ -331,6 +331,16 @@ pub(all) struct ChandraCompositor {
|
||||
/// Output rotation (`0=0`, `1=90 CW`, `2=180 flip`, `3=270 CW`) and pending backend switch.
|
||||
mut rotation : Int
|
||||
mut pending_rotation : Int?
|
||||
/// Audio volume control and OSD (volume.mbt).
|
||||
mut vol_run : VolRun?
|
||||
vol_queue : Array[(VolCmd, Bool)]
|
||||
mut vol_osd : VolOsd?
|
||||
mut vol_pct : Int
|
||||
mut vol_muted : Bool
|
||||
mut vol_repeat_key : UInt
|
||||
mut vol_repeat_action : @shell.ShortcutAction?
|
||||
mut vol_repeat_next_ms : UInt64
|
||||
mut vol_runner : ((VolCmd) -> (Int, Bool)?)?
|
||||
}
|
||||
|
||||
///|
|
||||
@@ -485,6 +495,15 @@ pub fn ChandraCompositor::new(
|
||||
osk_pointer_grab: false,
|
||||
rotation: initial_rotation_from_env(),
|
||||
pending_rotation: None,
|
||||
vol_run: None,
|
||||
vol_queue: [],
|
||||
vol_osd: None,
|
||||
vol_pct: 0,
|
||||
vol_muted: false,
|
||||
vol_repeat_key: 0U,
|
||||
vol_repeat_action: None,
|
||||
vol_repeat_next_ms: 0UL,
|
||||
vol_runner: None,
|
||||
}
|
||||
// Client popups (menus) are placed to stay on screen: the server asks for the output's
|
||||
// rectangle relative to the parent's content origin when it applies constraint adjustment.
|
||||
@@ -634,6 +653,7 @@ pub fn ChandraCompositor::close(self : ChandraCompositor) -> Unit {
|
||||
release_snapshot(win.surface)
|
||||
}
|
||||
self.stop_control()
|
||||
self.volume_shutdown()
|
||||
self.auth_shutdown()
|
||||
self.shell.shutdown()
|
||||
match self.settings_portal {
|
||||
@@ -751,6 +771,7 @@ pub fn ChandraCompositor::step(self : ChandraCompositor) -> Unit {
|
||||
self.auth_tick()
|
||||
self.face_window_tick()
|
||||
self.control_tick()
|
||||
self.volume_tick()
|
||||
self.shell.launch_tick()
|
||||
let events = self.server.poll_events()
|
||||
for ev in events {
|
||||
@@ -1067,6 +1088,8 @@ pub fn ChandraCompositor::wake_timeout(self : ChandraCompositor, idle_ms : Int)
|
||||
let d = if g >= 0 && (d < 0 || g < d) { g } else { d }
|
||||
let l = self.shell.launch_wake_ms(now)
|
||||
let d = if l >= 0 && (d < 0 || l < d) { l } else { d }
|
||||
let v = self.volume_wake_ms(now)
|
||||
let d = if v >= 0 && (d < 0 || v < d) { v } else { d }
|
||||
if d >= 0 && d < idle_ms {
|
||||
d
|
||||
} else {
|
||||
@@ -1282,6 +1305,7 @@ fn ChandraCompositor::build_scene(
|
||||
panel_ops.append(self.auth_ops())
|
||||
panel_ops.append(self.auth_notice_ops())
|
||||
panel_ops.append(self.osk_ops())
|
||||
panel_ops.append(self.volume_ops())
|
||||
self.frames_built = self.frames_built + 1
|
||||
self.run_shell_actions()
|
||||
// The wallpaper (the first ops) is cached by the renderer; the desktop card after it changes.
|
||||
@@ -2211,12 +2235,22 @@ fn ChandraCompositor::handle_input_inner(
|
||||
self.note_activity(@sys.monotonic_ms())
|
||||
} else {
|
||||
self.manual_screen_off = true
|
||||
self.stop_volume_repeat()
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
if self.manual_screen_off || self.screen_off {
|
||||
match ev {
|
||||
Key(code, pressed) =>
|
||||
if self.handle_screen_off_volume_key(code, pressed) {
|
||||
return
|
||||
}
|
||||
_ => ()
|
||||
}
|
||||
}
|
||||
if self.manual_screen_off {
|
||||
return
|
||||
}
|
||||
@@ -2235,6 +2269,10 @@ fn ChandraCompositor::dispatch_input_inner(
|
||||
time_ms : UInt,
|
||||
) -> Unit {
|
||||
match ev {
|
||||
Key(code, false) =>
|
||||
if code == self.vol_repeat_key {
|
||||
self.stop_volume_repeat()
|
||||
}
|
||||
Modifiers(dep, lat, lock, group) => {
|
||||
self.mods_latched = lat
|
||||
self.mods_locked = lock
|
||||
|
||||
Reference in new issue
Block a user