CI / test (push) Failing after 30s
The panel had a task list and, beside it, a dock showing the same running
apps again. They are now one module, the dock, in the task list's place:
- Pinned apps, then running ones; an app with windows is a pill with its
window's title (or name and window count) while there is room, an icon
when the panel is crowded ("Show window titles" in Dock settings).
- Its right-click menu has the task list's window commands (Minimize /
Restore, Maximize) for a single window, or the app's windows by title.
- It stretches like the task list did; new panels get it instead of
tasks. A saved panel's "tasks" becomes the dock (one dock, where the
task list was); pins are the dock's own setting, so they carry over.
- An empty dock shows a "+ Add apps" tile that opens the Applications
menu, where right-clicking an app offers Open and Pin to dock (adding a
dock to the panel if there is none).
- Super+1 .. Super+9 open the dock's first nine apps like a click
(shortcut "dock-apps", rebindable in Settings > Shortcuts).
- "New window" / "Open" only for apps the catalog can start.
The tasks component, lib/panel's pill geometry and the taskbar-widget
world are gone.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DPL5hiPCFHRxaJQvwex6ry
149 lines
5.6 KiB
MoonBit
149 lines
5.6 KiB
MoonBit
///| Keyboard shortcuts: the compositor's end of the shortcut table (compositor/shell/shortcuts.mbt).
|
|
///
|
|
/// Every key press that isn't a modifier is looked up as a combo (the held modifiers plus the key)
|
|
/// and, when a shortcut has it, runs that shortcut's action instead of reaching a client; its
|
|
/// release is swallowed too. A Super tap (Super pressed and let go alone) runs the shortcut bound to
|
|
/// "Super", the launcher by default. Window switching is driven from switcher.mbt, which reads its
|
|
/// combo from the same table. While the settings module's Shortcuts tab waits for a new combo
|
|
/// (`shell.shortcut_capturing()`), the next combo pressed is taken for it here and does nothing else.
|
|
|
|
///| The modifiers held now, as combo bits. The Super and Alt keys are tracked from their own key
|
|
/// events as well, as the nested host doesn't always report them in the modifier mask.
|
|
pub fn ChandraCompositor::held_mods(self : ChandraCompositor) -> UInt {
|
|
let mut m = self.mods & @shell.combo_mods
|
|
if self.super_down {
|
|
m = m | @shell.mod_logo
|
|
}
|
|
if self.alt_down {
|
|
m = m | @shell.mod_alt
|
|
}
|
|
m
|
|
}
|
|
|
|
///| Keep track of the Super and Alt keys (for combos and the Super tap).
|
|
fn ChandraCompositor::track_modifier_key(self : ChandraCompositor, code : UInt, pressed : Bool) -> Unit {
|
|
if code == key_lsuper || code == key_rsuper {
|
|
self.super_down = pressed
|
|
} else if code == key_lalt || code == key_ralt {
|
|
self.alt_down = pressed
|
|
}
|
|
}
|
|
|
|
///| While the Shortcuts tab waits for a combo: take the next one for it. Escape cancels, Backspace
|
|
/// unbinds; a Super tap binds "Super". True when the key was used (it goes nowhere else).
|
|
fn ChandraCompositor::capture_key(self : ChandraCompositor, code : UInt, pressed : Bool) -> Bool {
|
|
let shell = self.shell
|
|
if shell.shortcut_capturing() < 0 {
|
|
// The release of a key the capture took.
|
|
if !pressed && self.capture_swallow.contains(code) {
|
|
self.capture_swallow.retain(c => c != code)
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
self.super_solo = false
|
|
if code == key_lsuper || code == key_rsuper {
|
|
if pressed {
|
|
self.capture_super = true
|
|
} else if self.capture_super {
|
|
self.capture_super = false
|
|
ignore(shell.finish_shortcut_capture(Some({ mods: 0U, key: @shell.key_super })))
|
|
}
|
|
return true // Super never reaches clients
|
|
}
|
|
if @shell.is_modifier_key(code) {
|
|
return false // other modifiers pass, so clients keep their state right
|
|
}
|
|
self.capture_super = false
|
|
if !pressed {
|
|
return true
|
|
}
|
|
self.capture_swallow.push(code)
|
|
let mods = self.held_mods()
|
|
if mods == 0U && code == key_esc {
|
|
shell.cancel_shortcut_capture()
|
|
} else if mods == 0U && code == key_backspace {
|
|
ignore(shell.finish_shortcut_capture(None))
|
|
} else {
|
|
ignore(shell.finish_shortcut_capture(Some({ mods, key: code })))
|
|
}
|
|
self.damage.mark_full()
|
|
true
|
|
}
|
|
|
|
///| A key for the shortcut table: runs the action bound to the combo it makes with the held
|
|
/// 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 self.sc_swallow.contains(code) {
|
|
self.sc_swallow.retain(c => c != code)
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
if @shell.is_modifier_key(code) || self.shell.inspecting() {
|
|
return false
|
|
}
|
|
let combo : @shell.KeyCombo = { mods: self.held_mods(), key: code }
|
|
match self.shell.shortcuts.lookup(combo) {
|
|
// Window switching is the switcher's (switcher_key runs before this).
|
|
Some(SwitchWindows) => false
|
|
// Super+2 .. Super+9 aren't in the table: they follow the "Open dock app" combo.
|
|
None | Some(DockApps) =>
|
|
match self.shell.shortcuts.dock_app(combo) {
|
|
Some(n) if self.open_dock_app(n) => {
|
|
self.sc_swallow.push(code)
|
|
self.super_solo = false
|
|
true
|
|
}
|
|
Some(_) => false
|
|
None => false
|
|
}
|
|
Some(action) => {
|
|
self.sc_swallow.push(code)
|
|
self.run_shortcut(action)
|
|
true
|
|
}
|
|
}
|
|
}
|
|
|
|
///| A Super tap: the shortcut bound to "Super" (the launcher by default), if any.
|
|
fn ChandraCompositor::super_tap(self : ChandraCompositor) -> Unit {
|
|
match self.shell.shortcuts.lookup({ mods: 0U, key: @shell.key_super }) {
|
|
None | Some(SwitchWindows) => ()
|
|
Some(action) => self.run_shortcut(action)
|
|
}
|
|
}
|
|
|
|
///| Do what a shortcut stands for.
|
|
pub fn ChandraCompositor::run_shortcut(self : ChandraCompositor, action : @shell.ShortcutAction) -> Unit {
|
|
self.super_solo = false
|
|
match action {
|
|
Launcher => if !self.shell.inspecting() { self.shell.toggle_launcher() }
|
|
ShowDesktop => self.toggle_show_desktop()
|
|
SwitchWindows => ()
|
|
ShotRegion => self.take_screenshot(ShotMode::Region)
|
|
ShotFull => self.take_screenshot(ShotMode::FullScreen)
|
|
ShotActiveWindow => self.take_screenshot(ShotMode::ActiveWindow)
|
|
ShotWindowUnderCursor => self.take_screenshot(ShotMode::WindowUnderCursor)
|
|
RecordRegion => self.toggle_recording(ShotMode::Region)
|
|
RecordScreen => self.toggle_recording(ShotMode::FullScreen)
|
|
RecordWindow => self.toggle_recording(ShotMode::WindowUnderCursor)
|
|
DockApps => ignore(self.open_dock_app(1))
|
|
}
|
|
}
|
|
|
|
///| Super+`n`: the dock's `n`-th app, as if its icon were clicked. False when there is no dock
|
|
/// or no such app (the key then goes to the focused window as usual).
|
|
fn ChandraCompositor::open_dock_app(self : ChandraCompositor, n : Int) -> Bool {
|
|
if self.shell.inspecting() || !self.shell.open_dock_item(n) {
|
|
return false
|
|
}
|
|
self.run_shell_actions()
|
|
self.damage.mark_full()
|
|
true
|
|
}
|
|
|
|
///| evdev code of Backspace (unbinds while capturing).
|
|
let key_backspace : UInt = 14
|