Lock: add session lock from power button and chandra-ctl lock
CI / test (push) Waiting to run

- Lock the session from the power button or `chandra-ctl lock`
- Unlock with a face or the password; the password always works
- Add compositor lock module with tests, and a polkit unlock policy (org.chandra.unlock)
- Document the lock flow in docs/lock.md and link it from the README
- Add generated interface bindings for the compositor and widget components
This commit is contained in:
nandi committed 2026-11-29 03:24:46 -08:00
1 parent 7501fc3ad9
commit c790f96e58
131 files changed
+4693 -274

No files matched your search

+46
View File
@@ -12,22 +12,60 @@ pub let binary_config : ClockConfig
pub fn binary_info() -> (String, String, Int32, Int32, Int32)
pub fn days_in_month(Int32, Int32) -> Int32
pub let digital_config : ClockConfig
pub fn digital_info() -> (String, String, Int32, Int32, Int32)
pub fn is_leap(Int32) -> Bool
pub fn iso_week(Int32, Int32, Int32) -> Int32
pub fn long_date(@types.Datetime) -> String
pub fn month_grid(Int32, Int32, Bool) -> Array[DayCell]
pub fn render_binary(@types.Size, @theme.Tokens, @types.Datetime, seconds? : Bool) -> Array[@types.DrawOp]
pub fn render_digital(@types.Size, @theme.Tokens, @types.Datetime, hour12? : Bool, show_date? : Bool, ampm? : Bool) -> Array[@types.DrawOp]
pub fn weekday_of(Int32, Int32, Int32) -> Int32
// Errors
// Types and methods
pub(all) struct Calendar {
mut open : Bool
mut year : Int32
mut month : Int32
mut monday_first : Bool
mut week_numbers : Bool
mut hover : CalendarHit
}
pub fn Calendar::go_today(Self, @types.Datetime) -> Unit
pub fn Calendar::handle(Self, Bool, @types.InputEvent, @types.Datetime) -> Bool
pub fn Calendar::hit(Self, Int32, Int32) -> CalendarHit
pub fn Calendar::new() -> Self
pub fn Calendar::render(Self, @theme.Tokens, @types.Datetime, hour12? : Bool, ampm? : Bool) -> Array[@types.DrawOp]
pub fn Calendar::shift(Self, Int32) -> Unit
pub fn Calendar::size(Self) -> (Int32, Int32)
pub fn Calendar::toggle(Self, @types.Datetime) -> Unit
#derive(Eq, @debug.Debug)
pub(all) enum CalendarHit {
Prev
Next
Today
Nothing
}
pub(all) struct ClockConfig {
mut hour12 : Bool
mut show_date : Bool
mut seconds : Bool
mut ampm : Bool
cal : Calendar
}
pub fn ClockConfig::binary_items(Self) -> Array[ConfigEntry]
pub fn ClockConfig::digital_items(Self) -> Array[ConfigEntry]
@@ -42,6 +80,14 @@ pub(all) struct ConfigEntry {
value : String
}
#derive(Eq, @debug.Debug)
pub(all) struct DayCell {
year : Int32
month : Int32
day : Int32
in_month : Bool
}
// Type aliases
// Traits
+2
View File
@@ -58,6 +58,8 @@ pub let size_choices : Array[String]
pub fn tile_color(String) -> @types.Color
pub fn titled_at(Array[DockItem], DockConfig, Int32, Int32, Int32) -> Bool
pub fn toggle_pin(Array[String], String) -> Array[String]
// Errors
+190
View File
@@ -0,0 +1,190 @@
// Generated using `moon info`, DON'T EDIT IT
package "chandra/desktop/lib/gamelib"
import {
"chandra/desktop/interface/chandra/desktop/theme",
"chandra/desktop/interface/chandra/desktop/types",
"moonbitlang/core/debug",
}
// Values
pub fn approx_width(String, Int32) -> Int32
pub let background_choices : Array[String]
pub let categories : Array[Category]
pub fn category_badge(String) -> String
pub let colors_choices : Array[String]
pub fn count_in(Array[Game], Category) -> Int32
pub fn draw_glyph(Array[@types.DrawOp], String, Int32, Int32, Int32, @types.Color, letter? : String) -> Unit
pub fn ellipsize(String, Int32, Int32) -> String
pub fn error_message(String) -> String
pub fn filter_games(Array[Game], Category, String) -> Array[Game]
pub fn grid_fit(Array[Game], Int32, Int32) -> (Array[(Int32, Int32, Int32, Int32, Int32)], Int32, Int32, Int32)
pub fn grid_layout(Array[Game], Int32, lv? : Int32, min_w? : Int32) -> (Array[(Int32, Int32, Int32, Int32, Int32)], Int32, Int32)
pub fn modes_of(Array[Mode], String) -> Array[Mode]
pub fn parse_int(String) -> Int32
pub fn parse_state(String) -> Result[State, String]
pub let state : Library
pub fn wrap(String, Int32, Int32, Int32) -> Array[String]
// Errors
// Types and methods
#derive(Eq, @debug.Debug)
pub(all) enum Action {
NoAction
Launch(String, String)
Stop(String)
Focus(String)
Refresh
}
#derive(Eq, @debug.Debug)
pub(all) enum Category {
All
Games
Launchers
Tools
Running
}
pub fn Category::key(Self) -> String
pub fn Category::label(Self) -> String
pub fn Category::parse(String) -> Self
pub fn Category::title(Self) -> String
#derive(Eq, @debug.Debug)
pub(all) struct ConfigEntry {
key : String
label : String
choices : Array[String]
value : String
}
#derive(Eq, @debug.Debug)
pub(all) struct Game {
id : String
name : String
category : String
description : String
icon : String
install_hint : String
featured : Bool
installed : Bool
running : Bool
}
pub fn Game::status(Self) -> Status
#derive(Eq, @debug.Debug)
pub(all) enum Hit {
NoHit
Cat(Category)
Search
ClearSearch
RefreshButton
Card(String)
Button(String, String)
StopButton(String)
FocusButton(String)
RunningRow(String)
RunningStop(String)
}
pub(all) struct Library {
mut category : Category
mut query : String
mut scroll : Int32
mut hover : Hit
mut press : Hit
mut selected : String
mut focused : Bool
mut colors : String
mut background : String
regions : Array[(@types.Rect, Hit)]
mut shown : Array[(String, Int32, Int32)]
mut content_h : Int32
mut view_h : Int32
mut games : Array[Game]
}
pub fn Library::config_items(Self) -> Array[ConfigEntry]
pub fn Library::handle(Self, @types.InputEvent) -> (Bool, Action)
pub fn Library::hit(Self, @types.Point) -> Hit
pub fn Library::new() -> Self
pub fn Library::render(Self, Array[Game], Array[Mode], Rig, @types.Size, @theme.Tokens) -> Array[@types.DrawOp]
pub fn Library::scroll_by(Self, Int32) -> Bool
pub fn Library::set_config(Self, String, String) -> Bool
#derive(Eq, @debug.Debug)
pub(all) struct Mode {
game : String
id : String
label : String
}
pub(all) struct Pal {
bg : @types.Color
panel : @types.Color
card : @types.Color
card_hover : @types.Color
row_sel : @types.Color
border : @types.Color
fg : @types.Color
muted : @types.Color
faint : @types.Color
accent : @types.Color
accent_fg : @types.Color
ok : @types.Color
ok_bg : @types.Color
badge_bg : @types.Color
badge_fg : @types.Color
warn : @types.Color
dark : Bool
}
pub fn Pal::dark() -> Self
pub fn Pal::light() -> Self
#derive(Eq, @debug.Debug)
pub(all) struct Rig {
connected : Bool
error : String
gpu : String
resolution : String
display : String
audio : String
audio_ok : Bool
hostname : String
}
pub fn Rig::unknown() -> Self
#derive(Eq, @debug.Debug)
pub(all) struct State {
rig : Rig
games : Array[Game]
modes : Array[Mode]
}
#derive(Eq, @debug.Debug)
pub(all) enum Status {
Running
Ready
NotInstalled
}
pub fn Status::label(Self) -> String
// Type aliases
// Traits
+70
View File
@@ -0,0 +1,70 @@
// Generated using `moon info`, DON'T EDIT IT
package "chandra/desktop/lib/icondesk"
import {
"chandra/desktop/interface/chandra/desktop/theme",
"chandra/desktop/interface/chandra/desktop/types",
"moonbitlang/core/debug",
}
// Values
pub let count_choices : Array[String]
pub let size_choices : Array[String]
pub let state : Desk
// Errors
// Types and methods
#derive(Eq, @debug.Debug)
pub(all) enum Action {
NoAction
Launch(String)
}
#derive(Eq, @debug.Debug)
pub(all) struct ConfigEntry {
key : String
label : String
choices : Array[String]
value : String
}
pub(all) struct Desk {
mut count : String
mut size : String
places : Map[String, (Int32, Int32)]
seen : Map[String, Int32]
mut next_seen : Int32
mut w : Int32
mut h : Int32
mut bottom : Int32
mut hover : String
mut selected : String
mut focused : Bool
mut press_id : String
mut press_x : Int32
mut press_y : Int32
mut dragging : Bool
mut ptr_x : Int32
mut ptr_y : Int32
}
pub fn Desk::app_at(Self, Array[@types.AppEntry], Int32, Int32) -> String
pub fn Desk::cell(Self) -> (Int32, Int32, Int32)
pub fn Desk::cell_at(Self, Int32, Int32) -> (Int32, Int32)
pub fn Desk::cell_origin(Self, Int32, Int32) -> (Int32, Int32)
pub fn Desk::config_items(Self) -> Array[ConfigEntry]
pub fn Desk::decode_places(Self, String) -> Unit
pub fn Desk::encode_places(Self) -> String
pub fn Desk::grid(Self) -> (Int32, Int32)
pub fn Desk::handle(Self, Array[@types.AppEntry], @types.InputEvent) -> (Bool, Action)
pub fn Desk::layout(Self, Array[@types.AppEntry]) -> Array[(Int32, Int32)]
pub fn Desk::new() -> Self
pub fn Desk::render(Self, Array[@types.AppEntry], @types.Size, @theme.Tokens, (String) -> UInt32) -> Array[@types.DrawOp]
pub fn Desk::set_config(Self, String, String) -> Bool
pub fn Desk::shown(Self, Array[@types.AppEntry]) -> Array[@types.AppEntry]
// Type aliases
// Traits
+27 -2
View File
@@ -7,11 +7,29 @@ import {
}
// Values
pub fn action_at(Array[@types.AppEntry], State, @types.Point) -> Int32
pub let action_logout : Int32
pub let action_power_off : Int32
pub let action_reload : Int32
pub let action_restart : Int32
pub let action_suspend : Int32
pub fn categories(Array[@types.AppEntry]) -> Array[String]
pub fn close(State) -> Unit
pub fn filter(Array[@types.AppEntry], String) -> Array[@types.AppEntry]
pub fn handle_event(Array[@types.AppEntry], State, Target, @types.InputEvent, (String) -> Result[Unit, String]) -> Bool
pub fn handle_event(Array[@types.AppEntry], State, Target, @types.InputEvent, (String) -> Result[Unit, String], session? : (Int32) -> Unit) -> Bool
pub fn listed(Array[@types.AppEntry], State) -> Array[@types.AppEntry]
pub fn needs_confirm(Int32) -> Bool
pub fn popup_size(Array[@types.AppEntry], State) -> @types.Size
@@ -19,10 +37,12 @@ pub let popup_w : Int32
pub fn render_button(@types.Size, @theme.Tokens, State) -> Array[@types.DrawOp]
pub fn render_popup(Array[@types.AppEntry], @theme.Tokens, State, icon? : (String) -> UInt) -> Array[@types.DrawOp]
pub fn render_popup(Array[@types.AppEntry], @theme.Tokens, State, icon? : (String) -> UInt32) -> Array[@types.DrawOp]
pub fn row_at(Array[@types.AppEntry], State, @types.Point) -> Int32
pub let session_actions : Array[String]
pub fn shown_rows(Array[@types.AppEntry], State) -> Array[@types.AppEntry]
// Errors
@@ -33,6 +53,11 @@ pub struct State {
mut query : String
mut hover : Int32
mut error : String
mut hover_action : Int32
mut armed : Int32
mut category : String
mut scroll : Int32
mut hover_category : Int32
}
pub fn State::new() -> Self
+63
View File
@@ -0,0 +1,63 @@
// Generated using `moon info`, DON'T EDIT IT
package "chandra/desktop/lib/starfield"
import {
"chandra/desktop/interface/chandra/desktop/theme",
"chandra/desktop/interface/chandra/desktop/types",
"moonbitlang/core/debug",
}
// Values
pub let density_choices : Array[String]
pub let frame_ms : UInt32
pub let motion_choices : Array[String]
pub let speed_choices : Array[String]
pub let state : Field
// Errors
// Types and methods
#derive(Eq, @debug.Debug)
pub(all) struct ConfigEntry {
key : String
label : String
choices : Array[String]
value : String
}
pub(all) struct Field {
stars : Array[Star]
mut seed : UInt32
mut speed : String
mut density : String
mut motion : String
mut boost : Double
mut pulse : Double
mut cx : Double
mut cy : Double
mut tx : Double
mut ty : Double
mut w : Int32
mut h : Int32
mut last : Int32
mut frames : Int32
}
pub fn Field::animating(Self) -> Bool
pub fn Field::config_items(Self) -> Array[ConfigEntry]
pub fn Field::handle(Self, @types.InputEvent) -> Bool
pub fn Field::new() -> Self
pub fn Field::render(Self, @types.Size, @theme.Tokens) -> Array[@types.DrawOp]
pub fn Field::scroll(Self, Int32) -> Bool
pub fn Field::set_config(Self, String, String) -> Bool
pub fn Field::step(Self, Double) -> Unit
pub fn Field::tick(Self, UInt32) -> UInt32
type Star
// Type aliases
// Traits