- Add compositor/shell/backlight.mbt for backlight control in the shell - Update wit/capabilities.wit and wit/host/plasmoids.wit, then regenerate the component and interface ffi.mbt bindings (mostly export reordering) - Add world/launcher-widget/README.md
This commit is contained in:
1 parent
2e00009c79
commit
74235cb0ca
84 files changed
+1525
-864
No files matched your search
@@ -214,6 +214,8 @@ pub fn ChandraCompositor::control_command(self : ChandraCompositor, line : Strin
|
||||
"windows each window: frame, layout, box, shadow, size limits; and what is under the pointer",
|
||||
"screenshot [PATH] save a full-screen PNG directly (without opening the editor)",
|
||||
"rotate [cw|ccw|flip|0|90|180|270|status] rotate or flip the display",
|
||||
"screen [on|off|toggle|status] blank or wake the display",
|
||||
"brightness [PCT|status] read or set display backlight percent (5..100)",
|
||||
"auth-demo [MODE] show the password dialog with a pretend check (password \"demo\"); MODE: " +
|
||||
@polkit.demo_modes.join(", "),
|
||||
"auth-status the password dialog's agent: running, registered, or why not",
|
||||
@@ -398,6 +400,64 @@ pub fn ChandraCompositor::control_command(self : ChandraCompositor, line : Strin
|
||||
_ => (["error usage: rotate [cw|ccw|flip|0|90|180|270|status]"], false)
|
||||
}
|
||||
}
|
||||
"screen" => {
|
||||
let arg = if words.length() >= 2 { words[1] } else { "status" }
|
||||
if words.length() > 2 {
|
||||
return (["error usage: screen [on|off|toggle|status]"], false)
|
||||
}
|
||||
match arg {
|
||||
"status" => (["ok " + (if self.screen_off || self.manual_screen_off { "off" } else { "on" })], true)
|
||||
"off" => {
|
||||
self.set_manual_screen_off(true)
|
||||
(["ok off"], true)
|
||||
}
|
||||
"on" => {
|
||||
self.set_manual_screen_off(false)
|
||||
(["ok on"], true)
|
||||
}
|
||||
"toggle" => {
|
||||
let next_off = !(self.screen_off || self.manual_screen_off)
|
||||
self.set_manual_screen_off(next_off)
|
||||
(["ok " + (if next_off { "off" } else { "on" })], true)
|
||||
}
|
||||
_ => (["error usage: screen [on|off|toggle|status]"], false)
|
||||
}
|
||||
}
|
||||
"brightness" => {
|
||||
let arg = if words.length() >= 2 { words[1] } else { "status" }
|
||||
if words.length() > 2 {
|
||||
return (["error usage: brightness [PCT|status]"], false)
|
||||
}
|
||||
if arg == "status" {
|
||||
let cur = @shell.read_backlight_percent()
|
||||
if cur < 0 {
|
||||
(["error no backlight"], false)
|
||||
} else {
|
||||
(["ok " + cur.to_string()], true)
|
||||
}
|
||||
} else {
|
||||
let mut val = 0
|
||||
let mut valid = arg.length() > 0
|
||||
for ch in arg {
|
||||
let c = ch.to_int()
|
||||
if c >= 48 && c <= 57 {
|
||||
val = val * 10 + (c - 48)
|
||||
} else {
|
||||
valid = false
|
||||
break
|
||||
}
|
||||
}
|
||||
if !valid {
|
||||
return (["error usage: brightness [PCT|status]"], false)
|
||||
}
|
||||
let next = self.shell.set_brightness(val)
|
||||
if next < 0 {
|
||||
(["error no backlight"], false)
|
||||
} else {
|
||||
(["ok " + next.to_string()], true)
|
||||
}
|
||||
}
|
||||
}
|
||||
other => (["error unknown command '" + other + "' (try: help)"], false)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user