Kiosk mode: --kiosk CMD runs one fullscreen app, locked down, restarted when it exits
CI / test (push) Successful in 4m10s
CI / test (push) Successful in 4m10s
No panel, no compositor shortcuts or desktop menus, the focused window fullscreen (dialogs float), CMD restarted with backoff. Ctrl+Alt+Shift+Escape or chandra-ctl kiosk lock|unlock|status for admin work. --app-id sets the X11 WM_CLASS / Wayland app id of Chandra's own window. scripts/gamerig-kiosk.sh runs Chandra as a gamerig rig's library window on its NVIDIA Xorg. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DPL5hgvjzw8hHirxRsXSsE
This commit is contained in:
11 files changed
+635
-16
No files matched your search
+25
-3
@@ -10,6 +10,10 @@
|
||||
/// --drm runs as a login session: the host takes the display (DRM/KMS) and input (libinput).
|
||||
/// With --gfx-out alone one frame is written and the program exits; add --serve to keep running
|
||||
/// and rewrite the PNG about twice a second (for looking at a live compositor without a display).
|
||||
/// --kiosk CMD: kiosk mode (docs/kiosk.md): no panel, no shortcuts or desktop menus, every window
|
||||
/// fullscreen, CMD started and started again when its window goes ("" starts nothing);
|
||||
/// Ctrl+Alt+Shift+Escape unlocks it for admin work. --app-id NAME: the X11 WM_CLASS / Wayland app
|
||||
/// id of Chandra's own window (--x11, --window), so a window manager or wmctrl can find it.
|
||||
|
||||
///| Parse a decimal integer; None unless every character is a digit.
|
||||
fn parse_dec(s : String) -> Int? {
|
||||
@@ -57,6 +61,8 @@ pub fn run(args : Array[String]) -> Int {
|
||||
let mut fullscreen = false
|
||||
let mut login = false
|
||||
let mut restore = true
|
||||
let mut kiosk : String? = None
|
||||
let mut app_id = "chandra"
|
||||
let mut width = 1280
|
||||
let mut height = 720
|
||||
|
||||
@@ -87,6 +93,13 @@ pub fn run(args : Array[String]) -> Int {
|
||||
} else if a == "--no-restore" {
|
||||
restore = false // don't reopen the apps of the last session
|
||||
i = i + 1
|
||||
} else if a == "--kiosk" && i + 1 < args.length() {
|
||||
kiosk = Some(args[i + 1]) // one fullscreen app, locked down
|
||||
restore = false
|
||||
i = i + 2
|
||||
} else if a == "--app-id" && i + 1 < args.length() {
|
||||
app_id = args[i + 1]
|
||||
i = i + 2
|
||||
} else if a == "--profile" {
|
||||
profile = true
|
||||
i = i + 1
|
||||
@@ -148,7 +161,7 @@ pub fn run(args : Array[String]) -> Int {
|
||||
"" => ":0"
|
||||
d => d
|
||||
}
|
||||
match @x11.X11Window::open(display, "Chandra", "chandra", width, height, fullscreen) {
|
||||
match @x11.X11Window::open(display, "Chandra", app_id, width, height, fullscreen) {
|
||||
Some(x) => {
|
||||
width = x.width
|
||||
height = x.height
|
||||
@@ -217,7 +230,7 @@ pub fn run(args : Array[String]) -> Int {
|
||||
"" => "/tmp"
|
||||
d => d
|
||||
}
|
||||
match @nested.NestedWindow::open(display, rt, "chandra", "chandra", width, height) {
|
||||
match @nested.NestedWindow::open(display, rt, "chandra", app_id, width, height) {
|
||||
Some(n) => Some(n)
|
||||
None => {
|
||||
@sys.log("failed to open a window on the host Wayland display")
|
||||
@@ -235,6 +248,13 @@ pub fn run(args : Array[String]) -> Int {
|
||||
@sys.log("chandra compositor listening on " + socket_path)
|
||||
// chandra-ctl's socket (reload panel modules from a script); SIGUSR1 reloads too.
|
||||
ignore(comp.start_control(@host.control_socket_path(@sys.getenv("XDG_RUNTIME_DIR"), socket_path)))
|
||||
match kiosk {
|
||||
Some(cmd) => {
|
||||
@sys.log("kiosk mode" + (if cmd.length() > 0 { ": " + cmd } else { "" }))
|
||||
comp.start_kiosk(cmd)
|
||||
}
|
||||
None => ()
|
||||
}
|
||||
if login {
|
||||
comp.start_auth_agent() // polkit's password prompts (run0, pkexec): Chandra's dialog
|
||||
}
|
||||
@@ -459,7 +479,9 @@ pub fn run(args : Array[String]) -> Int {
|
||||
ignore(@sys.wait_readable(wait_fds, comp.wake_timeout(idle.timeout())))
|
||||
}
|
||||
}
|
||||
comp.save_session() // what is open now is reopened at the next start
|
||||
if kiosk is None {
|
||||
comp.save_session() // what is open now is reopened at the next start
|
||||
}
|
||||
match kms {
|
||||
Some(k) => k.close()
|
||||
None => ()
|
||||
|
||||
Reference in new issue
Block a user