Persist screen brightness, enable universal evdev key/lid wake, and add *+# screenshot combo

This commit is contained in:
Luxferre committed 2026-10-27 22:24:39 +02:00
1 parent eef8584a8d
commit 2e2adcc7f2
38 files changed
+574 -161

No files matched your search

+23 -2
View File
@@ -357,13 +357,27 @@ class PhoneController {
"Microphone", false, 0, 1, 1, (dec1 > 0) ? 1 : 0});
// 8. Screen brightness (slider 1..screenMax_)
int scrCur = std::clamp(readIntFile(backlightDir_ + "/brightness", screenMax_), 1, screenMax_);
int rawScr = readIntFile(backlightDir_ + "/brightness", -1);
if (rawScr < 1) {
rawScr = readIntFile("/tmp/sxmo_saved_brightness", -1);
}
if (rawScr < 1) {
rawScr = readIntFile(getSxmoCfgDir() + "/brightness", screenMax_);
}
int scrCur = std::clamp(rawScr, 1, screenMax_);
int scrStep = std::max(1, screenMax_ / 14);
items_.push_back({ControlId::ScreenBright, kIconBrightness, kIconBrightness,
"Screen", true, 1, screenMax_, scrStep, scrCur});
// 9. Keyboard brightness (slider if max_brightness > 1, toggle otherwise)
int kbdCur = std::clamp(readIntFile(kbdDir_ + "/brightness", 0), 0, kbdMax_);
int rawKbd = readIntFile(kbdDir_ + "/brightness", -1);
if (rawKbd < 0) {
rawKbd = readIntFile("/tmp/sxmo_saved_kbd_brightness", -1);
}
if (rawKbd < 0) {
rawKbd = readIntFile(getSxmoCfgDir() + "/kbd_brightness", 0);
}
int kbdCur = std::clamp(rawKbd, 0, kbdMax_);
if (kbdSupportsSlider_) {
int kbdStep = std::max(1, kbdMax_ / 10);
items_.push_back({ControlId::KbdBright, kIconKeyboard, kIconKeyboard,
@@ -593,13 +607,20 @@ class PhoneController {
break;
}
case ControlId::ScreenBright: {
std::string cfg = getSxmoCfgDir();
::mkdir(cfg.c_str(), 0755);
writeIntFile(backlightDir_ + "/bl_power", 0);
writeIntFile(backlightDir_ + "/brightness", it.value);
writeIntFile("/tmp/sxmo_saved_brightness", it.value);
writeIntFile(cfg + "/brightness", it.value);
break;
}
case ControlId::KbdBright: {
int v = kbdSupportsSlider_ ? it.value : (it.value ? kbdMax_ : 0);
std::string cfg = getSxmoCfgDir();
::mkdir(cfg.c_str(), 0755);
writeIntFile("/tmp/sxmo_saved_kbd_brightness", v);
writeIntFile(cfg + "/kbd_brightness", v);
if (!writeIntFile(kbdDir_ + "/brightness", v)) {
char cmd[128];
std::snprintf(cmd, sizeof(cmd),