Fix lid wake blanking, passcode lag, idle drain, zero-log privacy default, and replace Conky with native dwm clock
This commit is contained in:
1 parent
11ec778c2f
commit
1d71bc81d8
42 files changed
+732
-267
No files matched your search
@@ -6,7 +6,7 @@
|
|||||||
It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adreno 304 (`FD304`) Glamor + DRI3 + GLX GPU acceleration** over `panel-mipi-dbi` KMSRO, optimized for `< 2 ms` UI wakeup latency and `< 95 MB` idle RAM on 512 MB devices.
|
It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adreno 304 (`FD304`) Glamor + DRI3 + GLX GPU acceleration** over `panel-mipi-dbi` KMSRO, optimized for `< 2 ms` UI wakeup latency and `< 95 MB` idle RAM on 512 MB devices.
|
||||||
|
|
||||||
## 2. Repository layout
|
## 2. Repository layout
|
||||||
- `src/sxmo-dwm/`: patched `dwm` window manager (`240x320` vertical `bstack` layout, 24px Pango status bar, desktop `"Menu"`/`"Names"` softkey bar, C-level `evdev` `SW_LID` slider and universal key wake handling, `*` + `#` screenshot chord via `bananarchy-screenshot`, live `.Xresources` reload, and `.so` plugin loader via `dwm_plugin.h`).
|
- `src/sxmo-dwm/`: patched `dwm` window manager (`240x320` vertical `bstack` layout, 24px Pango status bar, native `ParentRelative` desktop clock and `"Menu"`/`"Names"` softkey bar, C-level `evdev` `SW_LID` slider and universal key wake handling, `*` + `#` screenshot chord via `bananarchy-screenshot`, live `.Xresources` reload, and `.so` plugin loader via `dwm_plugin.h`).
|
||||||
- `src/sxmo-dmenu/`: zero-lag resident DWM menu plugin (`dmenu.so`) and `/tmp/dwm_plugin_dmenu.sock` client (`dmenu` / `xdmenu`), featuring built-in Sxmo menus (`sys`, `applications`, `scripts`, `modem`, `config`, `power`, `audio`, `notifications`, `wm`, `timezone`, `games`, `st`, `nano`, `sthotkeys`) and `fcitx5-t9` XIM input.
|
- `src/sxmo-dmenu/`: zero-lag resident DWM menu plugin (`dmenu.so`) and `/tmp/dwm_plugin_dmenu.sock` client (`dmenu` / `xdmenu`), featuring built-in Sxmo menus (`sys`, `applications`, `scripts`, `modem`, `config`, `power`, `audio`, `notifications`, `wm`, `timezone`, `games`, `st`, `nano`, `sthotkeys`) and `fcitx5-t9` XIM input.
|
||||||
- `src/neoui/`: **NeoUI** `240x320` UI SDK (`neoui.h` -> `/usr/include/neoui.h`, `neoui.cpp` -> `/usr/lib/libneoui.so`) providing both a C-compatible FFI (`neoui_*`) and C++20 classes (`ThemeSpec`, `PluginTheme`, `NeoWindow`) for `.Xresources` / `~/.xthemes/*.xth` theme resolution, Xlib/Xft/Pango window and offscreen `Pixmap` double buffering, standardized OS shell widgets, keypad/softkey chord handling, and multi-tap input (paired with Yabasic FFI libraries `neoui.yab` and `neonet.yab` + examples `neoui_demo.yab`, `neonet_demo.yab`, and `bulls_cows.yab` in `overlay/rootfs/home/user/Projects/`).
|
- `src/neoui/`: **NeoUI** `240x320` UI SDK (`neoui.h` -> `/usr/include/neoui.h`, `neoui.cpp` -> `/usr/lib/libneoui.so`) providing both a C-compatible FFI (`neoui_*`) and C++20 classes (`ThemeSpec`, `PluginTheme`, `NeoWindow`) for `.Xresources` / `~/.xthemes/*.xth` theme resolution, Xlib/Xft/Pango window and offscreen `Pixmap` double buffering, standardized OS shell widgets, keypad/softkey chord handling, and multi-tap input (paired with Yabasic FFI libraries `neoui.yab` and `neonet.yab` + examples `neoui_demo.yab`, `neonet_demo.yab`, and `bulls_cows.yab` in `overlay/rootfs/home/user/Projects/`).
|
||||||
- `src/dwm-plugins/`: preloaded C++20 `240x320` DWM plugins linked against `libneoui.so` and shared headers:
|
- `src/dwm-plugins/`: preloaded C++20 `240x320` DWM plugins linked against `libneoui.so` and shared headers:
|
||||||
@@ -15,8 +15,8 @@ It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adre
|
|||||||
- `net_tls.h`: shared C++20 TCP + OpenSSL TLS + STARTTLS socket class (`NetStream`), HTTP/HTTPS `GET` client (`httpGet`), MD5/CSPRNG helpers, and RFC 2047 / Base64 / Quoted-Printable MIME decoders.
|
- `net_tls.h`: shared C++20 TCP + OpenSSL TLS + STARTTLS socket class (`NetStream`), HTTP/HTTPS `GET` client (`httpGet`), MD5/CSPRNG helpers, and RFC 2047 / Base64 / Quoted-Printable MIME decoders.
|
||||||
- `pjsip_media.h`: PJSIP (`pjproject` / `pjmedia-codec/g722` & `pjmedia/alaw_ulaw`) ITU-T G.722 wideband 16 kHz SB-ADPCM and G.711 PCMU/PCMA codec implementation for `sip.so`.
|
- `pjsip_media.h`: PJSIP (`pjproject` / `pjmedia-codec/g722` & `pjmedia/alaw_ulaw`) ITU-T G.722 wideband 16 kHz SB-ADPCM and G.711 PCMU/PCMA codec implementation for `sip.so`.
|
||||||
- `monotone.h` + `bananarchy_melody.cpp` (`/usr/bin/bananarchy-melody`): Nokia RTTTL (`.nrt`, `.rtttl`, `.rtx`), Ericsson eMelody (`.emy`), and IrDA iMelody (`.imy`) monophonic ringtone parser and 48 kHz WAV synthesizer.
|
- `monotone.h` + `bananarchy_melody.cpp` (`/usr/bin/bananarchy-melody`): Nokia RTTTL (`.nrt`, `.rtttl`, `.rtx`), Ericsson eMelody (`.emy`), and IrDA iMelody (`.imy`) monophonic ringtone parser and 48 kHz WAV synthesizer.
|
||||||
- `locker_plugin.cpp` (`locker.so` / `xlocker`) + `verify_passcode.c` (`/usr/bin/bananarchy-verify-passcode`), `passcode_plugin.cpp` (`passcode.so` / `xpasscode`), `dialer_plugin.cpp` (`dialer.so` / `xdialer`), `calllog_plugin.cpp` (`calllog.so` / `xcalllog`), `callscreen_plugin.cpp` (`callscreen.so` / `xcallscreen`), `contacts_plugin.cpp` (`contacts.so` / `xcontacts`), `sms_plugin.cpp` (`sms.so` / `xsms`), `files_plugin.cpp` (`files.so` / `xfiles`), `camera_plugin.cpp` (`camera.so` / `xcamera`), `themes_plugin.cpp` (`themes.so` / `xthemes`), `modem_plugin.cpp` (`modem.so` / `xmodem`), `networks_plugin.cpp` (`networks.so` / `xnetworks` / `xbluetooth`), `ringtones_plugin.cpp` (`ringtones.so` / `xringtones`), `wallpapers_plugin.cpp` (`wallpapers.so` / `xwallpapers` / `xbackground`), `music_plugin.cpp` (`music.so` / `xmusic` / `xplayer`), `sip_plugin.cpp` (`sip.so` / `xsip`), `email_plugin.cpp` (`email.so` / `xemail` / `xmail`), `irc_plugin.cpp` (`irc.so` / `xirc`), `tox_plugin.cpp` (`tox.so` / `xtox`), `smallweb_plugin.cpp` (`smallweb.so` / `xkopher` / `kopher` / `xsmallweb`), `webarchy_plugin.cpp` (`webarchy.so` / `webarchy` / `xwebarchy`), `gps_plugin.cpp` (`gps.so` / `xgps` / `xmaps` / `xnav`), `privacy_plugin.cpp` (`privacy.so` / `xprivacy` / `privacy`).
|
- `locker_plugin.cpp` (`locker.so` / `xlocker`) + `verify_passcode.c` (`/usr/bin/bananarchy-verify-passcode`), `passcode_plugin.cpp` (`passcode.so` / `xpasscode`), `dialer_plugin.cpp` (`dialer.so` / `xdialer`), `calllog_plugin.cpp` (`calllog.so` / `xcalllog`), `callscreen_plugin.cpp` (`callscreen.so` / `xcallscreen`), `contacts_plugin.cpp` (`contacts.so` / `xcontacts`), `sms_plugin.cpp` (`sms.so` / `xsms`), `files_plugin.cpp` (`files.so` / `xfiles`), `camera_plugin.cpp` (`camera.so` / `xcamera`), `themes_plugin.cpp` (`themes.so` / `xthemes`), `modem_plugin.cpp` (`modem.so` / `xmodem`), `networks_plugin.cpp` (`networks.so` / `xnetworks` / `xbluetooth`), `ringtones_plugin.cpp` (`ringtones.so` / `xringtones`), `wallpapers_plugin.cpp` (`wallpapers.so` / `xwallpapers` / `xbackground`), `music_plugin.cpp` (`music.so` / `xmusic` / `xplayer`), `sip_plugin.cpp` (`sip.so` / `xsip`), `email_plugin.cpp` (`email.so` / `xemail` / `xmail`), `irc_plugin.cpp` (`irc.so` / `xirc`), `tox_plugin.cpp` (`tox.so` / `xtox`), `smallweb_plugin.cpp` (`smallweb.so` / `xkopher` / `kopher` / `xsmallweb`), `webarchy_plugin.cpp` (`webarchy.so` / `webarchy` / `xwebarchy`), `gps_plugin.cpp` (`gps.so` / `xgps` / `xmaps` / `xnav`), `privacy_plugin.cpp` (`privacy.so` / `xprivacy` / `privacy`), `engmenu_plugin.cpp` (`engmenu.so` / `xengmenu`).
|
||||||
- `dwm_plugin_runner.c`: lightweight `/usr/bin/dwm-plugin` launcher symlinked by `xlocker`, `xpasscode`, `xdrawer`, `xdialer`, `xcalllog`, `xcallscreen`, `xcontacts`, `xsms`, `xfiles`, `xcamera`, `xthemes`, `xmodem`, `xnetworks`, `xbluetooth`, `xringtones`, `xwallpapers`, `xbackground`, `xmusic`, `xplayer`, `xsip`, `xemail`, `xmail`, `xirc`, `xtox`, `xkopher`, `kopher`, `xsmallweb`, `webarchy`, `xwebarchy`, `xgps`, `xmaps`, `xnav`, `xprivacy`, `privacy`, `dmenu`, and `xdmenu`.
|
- `dwm_plugin_runner.c`: lightweight `/usr/bin/dwm-plugin` launcher symlinked by `xlocker`, `xpasscode`, `xdrawer`, `xdialer`, `xcalllog`, `xcallscreen`, `xcontacts`, `xsms`, `xfiles`, `xcamera`, `xthemes`, `xmodem`, `xnetworks`, `xbluetooth`, `xringtones`, `xwallpapers`, `xbackground`, `xmusic`, `xplayer`, `xsip`, `xemail`, `xmail`, `xirc`, `xtox`, `xkopher`, `kopher`, `xsmallweb`, `webarchy`, `xwebarchy`, `xgps`, `xmaps`, `xnav`, `xprivacy`, `privacy`, `xengmenu`, `dmenu`, and `xdmenu`.
|
||||||
- `src/xdrawer/`: global phone controls overlay (`xdrawer.so` / `xdrawer`), toggled by pressing both softkeys simultaneously.
|
- `src/xdrawer/`: global phone controls overlay (`xdrawer.so` / `xdrawer`), toggled by pressing both softkeys simultaneously.
|
||||||
- `src/sxmo-st/`: patched `st` terminal with HarfBuzz OpenType ligatures (`Fira Code`), `XIM` (`fcitx5-t9`), and live `SIGUSR1` `.Xresources` reload.
|
- `src/sxmo-st/`: patched `st` terminal with HarfBuzz OpenType ligatures (`Fira Code`), `XIM` (`fcitx5-t9`), and live `SIGUSR1` `.Xresources` reload.
|
||||||
- `src/fcitx5-t9/`: 6-mode keypad input method (`abc`, `Abc`, `ABC`, `Sym`, `Ctl`, `123` + `*` long-press `Ctrl+` latch) with fixed bottom preedit bar (`Y=290, H=30`).
|
- `src/fcitx5-t9/`: 6-mode keypad input method (`abc`, `Abc`, `ABC`, `Sym`, `Ctl`, `123` + `*` long-press `Ctrl+` latch) with fixed bottom preedit bar (`Y=290, H=30`).
|
||||||
@@ -28,7 +28,7 @@ It uses a pure **X11 (`Xlibre` + `sxmo-de-dwm`)** stack (no Wayland) with **Adre
|
|||||||
|
|
||||||
## 3. Build and image generation commands
|
## 3. Build and image generation commands
|
||||||
All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` sysroot) and automatically update both `prebuilt/` and `overlay/rootfs/`:
|
All cross-compilation scripts run inside rootless Docker (`alpine:3.24` `armv7` sysroot) and automatically update both `prebuilt/` and `overlay/rootfs/`:
|
||||||
- `./scripts/build-sxmo-x11.sh` — builds `libneoui.so`, `st`, `dmenu.so`, `dwm`, `dwm-plugin`, `bananarchy-verify-passcode`, `bananarchy-melody`, `sxmo_vibrate`, and all C++ `.so` plugins (`locker`, `passcode`, `xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`, `sip`, `email`, `irc`, `tox`, `smallweb`, `webarchy`, `gps`, `privacy`).
|
- `./scripts/build-sxmo-x11.sh` — builds `libneoui.so`, `st`, `dmenu.so`, `dwm`, `dwm-plugin`, `bananarchy-verify-passcode`, `bananarchy-melody`, `sxmo_vibrate`, and all C++ `.so` plugins (`locker`, `passcode`, `xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`, `sip`, `email`, `irc`, `tox`, `smallweb`, `webarchy`, `gps`, `privacy`, `engmenu`).
|
||||||
- `./scripts/build-gsocket.sh` — fetches and cross-compiles `gsocket` (`gs-netcat`, `gsocket`, `gs-sftp`, `gs-mount`, `blitz`) for `armv7`.
|
- `./scripts/build-gsocket.sh` — fetches and cross-compiles `gsocket` (`gs-netcat`, `gsocket`, `gs-sftp`, `gs-mount`, `blitz`) for `armv7`.
|
||||||
- `./scripts/build-dmenu.sh` — rebuilds only `dmenu.so`, `stest`, `dmenu_path`, and `dmenu_run`.
|
- `./scripts/build-dmenu.sh` — rebuilds only `dmenu.so`, `stest`, `dmenu_path`, and `dmenu_run`.
|
||||||
- `./scripts/build-games.sh` — builds standalone X11 games and emulators in `src/games/` (`snake`, `tetris`, `scoundrel`, `gambatte` / `gbemu`, `remedy` / `j2me`).
|
- `./scripts/build-games.sh` — builds standalone X11 games and emulators in `src/games/` (`snake`, `tetris`, `scoundrel`, `gambatte` / `gbemu`, `remedy` / `j2me`).
|
||||||
|
|||||||
+6
-1
@@ -39,7 +39,12 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
|
|||||||
- Enabled `workqueue.power_efficient=Y` and `printk.console_suspend=Y` in `/etc/local.d/10-power-save.start`, tuned `schedutil` governor rate limits (`up_rate_limit_us = 40000`, `down_rate_limit_us = 10000`), automatically switched `scaling_governor` to `powersave` (`200 MHz` floor with zero RPM `vdd_dig`/`vdd_mx` voltage-scaling interrupts) whenever the screen backlight is off and back to `schedutil` on wake, lowered `78b9000.spi` runtime PM `autosuspend_delay_ms` from `1000 ms` to `50 ms`, enabled runtime PM (`power/control=auto`) across `1c00000.gpu`, `*.spi`, `*.sdhci`, and `*.serial`, switched the `7864900.sdhci` microSD host controller from driver unbinding to kernel runtime PM (`runtime_status = suspended`) with hardware GPIO 38 hotplug detection, and removed the legacy `ttyMSM0` serial `getty` rule from `scripts/configure-rootfs-from-scratch.sh`.
|
- Enabled `workqueue.power_efficient=Y` and `printk.console_suspend=Y` in `/etc/local.d/10-power-save.start`, tuned `schedutil` governor rate limits (`up_rate_limit_us = 40000`, `down_rate_limit_us = 10000`), automatically switched `scaling_governor` to `powersave` (`200 MHz` floor with zero RPM `vdd_dig`/`vdd_mx` voltage-scaling interrupts) whenever the screen backlight is off and back to `schedutil` on wake, lowered `78b9000.spi` runtime PM `autosuspend_delay_ms` from `1000 ms` to `50 ms`, enabled runtime PM (`power/control=auto`) across `1c00000.gpu`, `*.spi`, `*.sdhci`, and `*.serial`, switched the `7864900.sdhci` microSD host controller from driver unbinding to kernel runtime PM (`runtime_status = suspended`) with hardware GPIO 38 hotplug detection, and removed the legacy `ttyMSM0` serial `getty` rule from `scripts/configure-rootfs-from-scratch.sh`.
|
||||||
- Fixed battery status display and udev hook permissions (`85-bananarchy-battery.rules` running `sxmo_hook_battery.sh` as `user`, `sxmo_hook_battery.sh force` bypassing the 60s throttle on wake/unlock while updating `040-battery-icon-pm8916-bms-vm` even while the screen is dark), added a live battery icon and percentage indicator plus a `30s` lockscreen-only inactivity screen-blanking timeout to `locker.so` (`xlocker`) while keeping unlocked auto-locking disabled, and removed the redundant `doas -n true` gate before `msm-modem-uim-selection dsds-daemon` in `sxmo_modemmonitor.sh`.
|
- Fixed battery status display and udev hook permissions (`85-bananarchy-battery.rules` running `sxmo_hook_battery.sh` as `user`, `sxmo_hook_battery.sh force` bypassing the 60s throttle on wake/unlock while updating `040-battery-icon-pm8916-bms-vm` even while the screen is dark), added a live battery icon and percentage indicator plus a `30s` lockscreen-only inactivity screen-blanking timeout to `locker.so` (`xlocker`) while keeping unlocked auto-locking disabled, and removed the redundant `doas -n true` gate before `msm-modem-uim-selection dsds-daemon` in `sxmo_modemmonitor.sh`.
|
||||||
- Set the DSDS `msm-modem-uim-selection` `select()` timeout to infinite (`None`, pure `AF_QIPCRTR` event-driven wait) while the screen is locked and `600s` when unlocked, added `neoui_next_timeout_ms()` to `libneoui.so`, wired GLib `GMainContext` file descriptors and `"load-failed"` / `closeWindow()` load-stop handling into `webarchy.so` (along with `NO_AT_BRIDGE=1` and `GTK_A11Y=none`), added `inotify` directory watching to `sms.so`, and eliminated idle periodic `poll()` timers across `dialer.so`, `calllog.so`, `contacts.so`, `sms.so`, `xdrawer.so`, `locker.so`, `email.so`, `irc.so`, `smallweb.so`, `tox.so`, `sip.so`, and `webarchy.so` so visible and background plugins sleep at `0%` CPU unless a transient timer (`softkey` chord, multi-tap window, or toast expiry) is active.
|
- Set the DSDS `msm-modem-uim-selection` `select()` timeout to infinite (`None`, pure `AF_QIPCRTR` event-driven wait) while the screen is locked and `600s` when unlocked, added `neoui_next_timeout_ms()` to `libneoui.so`, wired GLib `GMainContext` file descriptors and `"load-failed"` / `closeWindow()` load-stop handling into `webarchy.so` (along with `NO_AT_BRIDGE=1` and `GTK_A11Y=none`), added `inotify` directory watching to `sms.so`, and eliminated idle periodic `poll()` timers across `dialer.so`, `calllog.so`, `contacts.so`, `sms.so`, `xdrawer.so`, `locker.so`, `email.so`, `irc.so`, `smallweb.so`, `tox.so`, `sip.so`, and `webarchy.so` so visible and background plugins sleep at `0%` CPU unless a transient timer (`softkey` chord, multi-tap window, or toast expiry) is active.
|
||||||
- Skipped `dwm` `drawbar()` Xorg/Glamor/SPI redraws and `sxmo_hook_statusbar.sh` process spawns whenever `bl_power != 0`, `brightness == 0`, or `/tmp/bananarchy_screen_locked` exists (with immediate bar refresh on wake/unlock) and wrapped background spawns in double-fork subshells `( ... & )` across `bananarchy-x11-session.sh`, `sxmo_modemmonitor.sh`, `sxmo_hook_start.sh`, `sxmo_hook_postwake.sh`, and `msm-modem-uim-selection` to eliminate zombie child accumulation.
|
- Skipped `dwm` `drawbar()` Xorg/Glamor/SPI redraws and `sxmo_hook_statusbar.sh` process spawns whenever `bl_power != 0`, `brightness == 0`, or `/tmp/bananarchy_screen_locked` exists (with immediate bar refresh on wake/unlock), fast-exited `sxmo_hook_statusbar.sh periodics` before sourcing hooks while locked or screenoff, serialized `bananarchy-sync-dunst-theme` with `flock` without spawning duplicate unmanaged `dunst` instances under `superd` (preventing `dunst` respawn storms), disabled NetworkManager periodic connectivity polling (`[connectivity] enabled=false`), and wrapped background spawns in double-fork subshells `( ... & )` across `bananarchy-x11-session.sh`, `sxmo_modemmonitor.sh`, `sxmo_hook_start.sh`, `sxmo_hook_postwake.sh`, and `msm-modem-uim-selection` to eliminate zombie child accumulation.
|
||||||
|
- Fixed spontaneous screen blanking after sliding the keypad lid open and eliminated passcode entry lag in `xlocker` (`locker.so`) and `dwm` by removing queued asynchronous `sxmo_state.sh set screenoff` shell spawns from `lock_phone_screenoff()`, adding a `60 ms` `SW_LID` close debounce (`EVIOCGSW`) with instant wake on open, resetting `locker.so` inactivity timer on every unblank transition (`wasScreenBlanked`), forwarding any `dwm`-intercepted key events while locked directly to `/tmp/dwm_plugin_locker.fifo` (`KEY <keycode> <state>`), caching `locker.so` battery/notification status with a `10s` TTL, debouncing multi-digit auto-verification by `220 ms`, and adding a per-session random-salted 64-bit fast verification cache invalidated automatically on `/etc/shadow` or `/etc/bananarchy_duress.hash` changes.
|
||||||
|
- Replaced the standalone `conky` process with native `dwm` desktop clock rendering (`m->clockwin` `ParentRelative` window at `Y = 29, H = 92`) using the exact same `Fira Code` fonts (`32pt` `%H:%M` at `Y = 43..73` and `14pt` `%a %d %b %Y` at `Y = 87..101`), white foreground, and 1px black drop shadow, eliminating the `conky` daemon, its periodic X11 wakeup timers, and all `pkill -STOP/-CONT conky` process spawns across lock/unlock, statusbar, and timezone transitions.
|
||||||
|
- **Zero-log privacy default and Extended Logging feature setting (`engmenu.so` / `xengmenu`, `dmenu.so`, `bananarchy-engmenu-ctl`)**:
|
||||||
|
- Disabled extended system and session logging by default (`OFF`) across `sxmo_log()` / `sxmo_debug()`, `superd` (`-l /dev/null` and `/tmp/superd_state/superd/logs/*.log -> /dev/null`), `Xorg` (`-logfile /dev/null -logverbose 0`), `dwm`, `fcitx5` (`--verbose="*=0"`), `tinydm` (`tinydm-run-session`), `NetworkManager` (`level=OFF`), `ModemManager` (`--log-level=ERR --log-file=/dev/null`), and kernel `printk` (`1 4 1 1`), purging persistent log files from `~/.local/state/` and `/var/log/` so idle mode produces zero log writes.
|
||||||
|
- Added the **Extended Logging** toggle (`OFF` by default) to the **Engineering Menu (`*#0001#` / `xengmenu` -> `8: Extended Logging`)**, **Config Menu (`Config -> Extended Logging`)**, and `/usr/bin/bananarchy-engmenu-ctl logging [on|off|toggle|status]`, storing volatile diagnostic logs strictly in RAM (`/tmp/sxmo.log`, `/tmp/superd.log`, `/tmp/superd_state/superd/logs/*.log`) when enabled and purging them immediately when disabled.
|
||||||
- **Literal caller ID contact matching (`sxmo_contacts.sh`, `sxmo_common.sh`, `sxmo_modemsendsms.sh`)**:
|
- **Literal caller ID contact matching (`sxmo_contacts.sh`, `sxmo_common.sh`, `sxmo_modemsendsms.sh`)**:
|
||||||
- Replaced unescaped `grep -i "$NUMBER"` contact lookups with literal matching so carrier service numbers containing regex metacharacters (such as `*121#`) never match arbitrary contact entries.
|
- Replaced unescaped `grep -i "$NUMBER"` contact lookups with literal matching so carrier service numbers containing regex metacharacters (such as `*121#`) never match arbitrary contact entries.
|
||||||
- **Yabasic Bulls and Cows example (`~/Projects/bulls_cows.yab`) and `LynxLair.xth` theme**:
|
- **Yabasic Bulls and Cows example (`~/Projects/bulls_cows.yab`) and `LynxLair.xth` theme**:
|
||||||
|
|||||||
@@ -23,9 +23,9 @@ This manual covers flashing, operating, and customizing **Bananarchy Linux** (`2
|
|||||||
### 1.3 Core architecture highlights
|
### 1.3 Core architecture highlights
|
||||||
1. **Pure X11 (`Xlibre` + `sxmo-de-dwm`) for `240x320` QVGA displays**:
|
1. **Pure X11 (`Xlibre` + `sxmo-de-dwm`) for `240x320` QVGA displays**:
|
||||||
- Uses a lightweight cross-compiled **Xlibre** server with `modesetting` KMS, partial-rectangle `ShadowFB` SPI updates, and zero Wayland overhead.
|
- Uses a lightweight cross-compiled **Xlibre** server with `modesetting` KMS, partial-rectangle `ShadowFB` SPI updates, and zero Wayland overhead.
|
||||||
- **Patched `dwm`** provides a `240x320` vertical bottom-stack (`bstack`) layout, a 24px top status bar, a transparent `"Menu"` / `"Names"` desktop softkey bar, a Conky desktop clock and status widget (which refreshes automatically when changing time, timezone, or wallpaper, or when logging out), and `< 2 ms` handling of physical slider (`SW_LID`) and wake keys.
|
- **Patched `dwm`** provides a `240x320` vertical bottom-stack (`bstack`) layout, a 24px top status bar, a transparent `"Menu"` / `"Names"` desktop softkey bar, a native `ParentRelative` desktop datetime overlay (`Fira Code` 32pt `%H:%M` and 14pt `%a %d %b %Y` with 1px drop shadow, rendered directly by `dwm` with zero external Conky process overhead and automatic live timezone/wallpaper refresh), and `< 2 ms` handling of physical slider (`SW_LID`) and wake keys.
|
||||||
2. **Preloaded resident DWM plugins (`< 2 ms` wakeup)**:
|
2. **Preloaded resident DWM plugins (`< 2 ms` wakeup)**:
|
||||||
- Core phone applications (`dmenu`, `xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `passcode`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`, `sip`, `email`, `irc`, `tox`, `smallweb`, `webarchy`, `gps`, `privacy`, `locker`) run as preloaded resident daemons (`dwm-plugin <name> --preload`) that sleep at 0% CPU and open instantaneously over FIFO/socket IPC.
|
- Core phone applications (`dmenu`, `xdrawer`, `dialer`, `calllog`, `callscreen`, `contacts`, `sms`, `files`, `camera`, `themes`, `passcode`, `modem`, `networks`, `ringtones`, `wallpapers`, `music`, `sip`, `email`, `irc`, `tox`, `smallweb`, `webarchy`, `gps`, `privacy`, `engmenu`, `locker`) run as preloaded resident daemons (`dwm-plugin <name> --preload`) that sleep at 0% CPU and open instantaneously over FIFO/socket IPC.
|
||||||
- All UI elements — including the `dunst` notification daemon (`bananarchy-sync-dunst-theme`) — share the **NeoUI SDK (`libneoui.so` + `/usr/include/neoui.h`)** and a single **XRDB theming engine** (`~/.xthemes/*.xth` -> `~/.Xresources`) with 21 preinstalled color schemes, proportional font sizing (`theme.baseFontSize`), and live reload without restarting X11. NeoUI exposes both C++20 classes and a C-compatible FFI (`neoui_*`) for building custom native or scripted (`yabasic` via `~/Projects/neoui.yab`, `~/Projects/neoui_demo.yab`, and `~/Projects/bulls_cows.yab`, paired with **NeoNet** in `~/Projects/neonet.yab` and `~/Projects/neonet_demo.yab` for `libcurl` HTTP/HTTPS and TCP/TLS/UDP socket networking) `240x320` GUI applications — see [SDK.md](./SDK.md) for the complete API reference and examples.
|
- All UI elements — including the `dunst` notification daemon (`bananarchy-sync-dunst-theme`) — share the **NeoUI SDK (`libneoui.so` + `/usr/include/neoui.h`)** and a single **XRDB theming engine** (`~/.xthemes/*.xth` -> `~/.Xresources`) with 21 preinstalled color schemes, proportional font sizing (`theme.baseFontSize`), and live reload without restarting X11. NeoUI exposes both C++20 classes and a C-compatible FFI (`neoui_*`) for building custom native or scripted (`yabasic` via `~/Projects/neoui.yab`, `~/Projects/neoui_demo.yab`, and `~/Projects/bulls_cows.yab`, paired with **NeoNet** in `~/Projects/neonet.yab` and `~/Projects/neonet_demo.yab` for `libcurl` HTTP/HTTPS and TCP/TLS/UDP socket networking) `240x320` GUI applications — see [SDK.md](./SDK.md) for the complete API reference and examples.
|
||||||
3. **First-class terminal (`st`) and 6-mode `fcitx5-t9` keypad input**:
|
3. **First-class terminal (`st`) and 6-mode `fcitx5-t9` keypad input**:
|
||||||
- `st` is patched with HarfBuzz OpenType ligature shaping (`Fira Code` default) and live `.Xresources` reload.
|
- `st` is patched with HarfBuzz OpenType ligature shaping (`Fira Code` default) and live `.Xresources` reload.
|
||||||
@@ -178,7 +178,7 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
|
|||||||
- **Yabasic (`.yab`) script execution**: pressing `Return` on any `.yab` file (or selecting **Run in Yabasic (Terminal)** from the **Left softkey (`Actions`)** menu) launches `yabasic` inside `st` in the file's directory and waits for `Enter` after completion so output can be inspected.
|
- **Yabasic (`.yab`) script execution**: pressing `Return` on any `.yab` file (or selecting **Run in Yabasic (Terminal)** from the **Left softkey (`Actions`)** menu) launches `yabasic` inside `st` in the file's directory and waits for `Enter` after completion so output can be inspected.
|
||||||
- **J2ME (`.jar` / `.jad`) MIDlet launching**: pressing `Return` on any `.jar` or `.jad` file (or selecting **Run in ReMEdy (J2ME)** from the **Left softkey (`Actions`)** menu) opens it directly in the **ReMEdy (`remedy`)** full-screen `240x320` J2ME emulator; `.jad` files also include a **View JAD Descriptor** action in the **Actions** menu.
|
- **J2ME (`.jar` / `.jad`) MIDlet launching**: pressing `Return` on any `.jar` or `.jad` file (or selecting **Run in ReMEdy (J2ME)** from the **Left softkey (`Actions`)** menu) opens it directly in the **ReMEdy (`remedy`)** full-screen `240x320` J2ME emulator; `.jad` files also include a **View JAD Descriptor** action in the **Actions** menu.
|
||||||
- **Game Boy / Game Boy Color ROM launching**: pressing `Return` on any `.gb` or `.gbc` file (or selecting **Play in Game Boy Emulator** from the **Left softkey (`Actions`)** menu) opens it directly in the **Gambatte (`gambatte`)** emulator.
|
- **Game Boy / Game Boy Color ROM launching**: pressing `Return` on any `.gb` or `.gbc` file (or selecting **Play in Game Boy Emulator** from the **Left softkey (`Actions`)** menu) opens it directly in the **Gambatte (`gambatte`)** emulator.
|
||||||
- **Image preview and wallpaper installation**: pressing `Return` on any image file (`.jpg`, `.png`, `.bmp`, `.gif`, `.webp`, `.ppm`, `.tif`, `.ico`, `.svg`) opens the built-in image viewer (`*` toggles full-screen preview; **Left softkey (`Set Wall`)** installs the image into `~/Pictures/Wallpapers/`, applies it via `feh`, and refreshes Conky). You can also select **Preview Image** or **Set as Wallpaper** directly from the **Left softkey (`Actions`)** menu.
|
- **Image preview and wallpaper installation**: pressing `Return` on any image file (`.jpg`, `.png`, `.bmp`, `.gif`, `.webp`, `.ppm`, `.tif`, `.ico`, `.svg`) opens the built-in image viewer (`*` toggles full-screen preview; **Left softkey (`Set Wall`)** installs the image into `~/Pictures/Wallpapers/`, applies it via `feh`, and refreshes the desktop overlay). You can also select **Preview Image** or **Set as Wallpaper** directly from the **Left softkey (`Actions`)** menu.
|
||||||
- **Monophonic ringtone viewer (`.nrt`, `.rtttl`, `.rtx`, `.emy`, `.imy`), audio playback, and ringtone/notification installation**: pressing `Return` on any Nokia RTTTL (`.nrt`, `.rtttl`, `.rtx`), Ericsson eMelody (`.emy`), or IrDA iMelody (`.imy`) file opens the built-in **Ringtone Viewer** (`RingtoneView`), displaying the melody title, format tag, BPM, note count, duration, graphical piano-roll pitch contour, and scrollable note sequence (`Up`/`Down`), with instant playback preview (`*` or `Center OK`), `Left`/`Right` to step through ringtones in the current folder, **Left softkey (`Set Ring`)** to set as the active call ringtone, **`#`** to set as the active notification/SMS sound, and `1` to edit the melody text. Pressing `Return` on standard audio or tracker module files opens **Music (`xmusic`)**. From the **Left softkey (`Actions`)** menu on any monophonic melody, audio, or tracker file, select **Preview Ringtone**, **Set as Ringtone**, **Set as Notif / SMS Sound**, **Open in Ringtones App**, or **Play in Music Player**.
|
- **Monophonic ringtone viewer (`.nrt`, `.rtttl`, `.rtx`, `.emy`, `.imy`), audio playback, and ringtone/notification installation**: pressing `Return` on any Nokia RTTTL (`.nrt`, `.rtttl`, `.rtx`), Ericsson eMelody (`.emy`), or IrDA iMelody (`.imy`) file opens the built-in **Ringtone Viewer** (`RingtoneView`), displaying the melody title, format tag, BPM, note count, duration, graphical piano-roll pitch contour, and scrollable note sequence (`Up`/`Down`), with instant playback preview (`*` or `Center OK`), `Left`/`Right` to step through ringtones in the current folder, **Left softkey (`Set Ring`)** to set as the active call ringtone, **`#`** to set as the active notification/SMS sound, and `1` to edit the melody text. Pressing `Return` on standard audio or tracker module files opens **Music (`xmusic`)**. From the **Left softkey (`Actions`)** menu on any monophonic melody, audio, or tracker file, select **Preview Ringtone**, **Set as Ringtone**, **Set as Notif / SMS Sound**, **Open in Ringtones App**, or **Play in Music Player**.
|
||||||
- **MicroSD card (`/media/sdcard`) integration**: when a microSD card (`/dev/mmcblk1`) is inserted, `udev` and `/usr/bin/sxmo_sdcard.sh` automatically mount it at `/media/sdcard` (keeping `7864900.sdhci` in `runtime_status = suspended` when idle and unbinding only during `--force-unmount` duress mode). From the **Left softkey (`Actions`)** menu inside `xfiles` (or **System menu -> SD Card**), select **Open SD Card (/media/sdcard)** to jump straight to the card (mounting it on demand if needed) or **Mount / Unmount SD Card** to safely flush and unmount the card before removal.
|
- **MicroSD card (`/media/sdcard`) integration**: when a microSD card (`/dev/mmcblk1`) is inserted, `udev` and `/usr/bin/sxmo_sdcard.sh` automatically mount it at `/media/sdcard` (keeping `7864900.sdhci` in `runtime_status = suspended` when idle and unbinding only during `--force-unmount` duress mode). From the **Left softkey (`Actions`)** menu inside `xfiles` (or **System menu -> SD Card**), select **Open SD Card (/media/sdcard)** to jump straight to the card (mounting it on demand if needed) or **Mount / Unmount SD Card** to safely flush and unmount the card before removal.
|
||||||
- **Bluetooth file transfer (`Send via Bluetooth`)**: select **Send via Bluetooth** from the **Left softkey (`Actions`)** menu on any file to choose a paired or nearby Bluetooth device (`*` rescans) and transmit the file over Bluetooth OBEX Object Push (`/usr/bin/bananarchy-bt-obex`).
|
- **Bluetooth file transfer (`Send via Bluetooth`)**: select **Send via Bluetooth** from the **Left softkey (`Actions`)** menu on any file to choose a paired or nearby Bluetooth device (`*` rescans) and transmit the file over Bluetooth OBEX Object Push (`/usr/bin/bananarchy-bt-obex`).
|
||||||
@@ -217,7 +217,7 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
|
|||||||
|
|
||||||
14. **Desktop wallpaper manager (`wallpapers.so` / `xwallpapers` / `xbackground`)**:
|
14. **Desktop wallpaper manager (`wallpapers.so` / `xwallpapers` / `xbackground`)**:
|
||||||
- **Open**: select **Wallpapers** from the System, Config, or Apps menu, or run `xwallpapers`.
|
- **Open**: select **Wallpapers** from the System, Config, or Apps menu, or run `xwallpapers`.
|
||||||
- **Controls**: browse system and user wallpapers with a live portrait thumbnail, cycle scaling mode (`Fill`, `Scale`, `Fit`, `Center`, `Tile`) with `Left`/`Right` or `#`, toggle full-screen preview with `*`, and press `Return` to apply the wallpaper and immediately refresh the Conky desktop overlay.
|
- **Controls**: browse system and user wallpapers with a live portrait thumbnail, cycle scaling mode (`Fill`, `Scale`, `Fit`, `Center`, `Tile`) with `Left`/`Right` or `#`, toggle full-screen preview with `*`, and press `Return` to apply the wallpaper and immediately refresh the desktop overlay.
|
||||||
|
|
||||||
15. **Music and tracker module player (`music.so` / `xmusic` / `xplayer`)**:
|
15. **Music and tracker module player (`music.so` / `xmusic` / `xplayer`)**:
|
||||||
- **Open**: select **Music** from the System, Applications, or Audio menu, open any audio/tracker file from **Files (`xfiles`)**, or run `xmusic [file_or_dir]`.
|
- **Open**: select **Music** from the System, Applications, or Audio menu, open any audio/tracker file from **Files (`xfiles`)**, or run `xmusic [file_or_dir]`.
|
||||||
@@ -309,6 +309,16 @@ All twenty-five phone applications are compiled as shared-object plugins (`/usr/
|
|||||||
- **`5:WG` (WireGuard)**: start/stop a kernel WireGuard interface (`wg0`), generate a fresh Curve25519 keypair (`Generate New Keypair`), import a standard WireGuard `.conf` file, edit custom `PrivateKey`, `Peer PublicKey`, optional `PresharedKey`, `Endpoint (host:port)`, `Interface IP/CIDR`, and `Tunnel DNS`, and independently toggle **Route Native Traffic** and **Route Wi-Fi/USB Tether** (`table 230` with `fwmark 0xca6c` loop avoidance).
|
- **`5:WG` (WireGuard)**: start/stop a kernel WireGuard interface (`wg0`), generate a fresh Curve25519 keypair (`Generate New Keypair`), import a standard WireGuard `.conf` file, edit custom `PrivateKey`, `Peer PublicKey`, optional `PresharedKey`, `Endpoint (host:port)`, `Interface IP/CIDR`, and `Tunnel DNS`, and independently toggle **Route Native Traffic** and **Route Wi-Fi/USB Tether** (`table 230` with `fwmark 0xca6c` loop avoidance).
|
||||||
- **Zero-drain standby**: no background OpenRC daemons run when services are turned off, and `privacy.so` sleeps at `0%` CPU on `poll()` when hidden.
|
- **Zero-drain standby**: no background OpenRC daemons run when services are turned off, and `privacy.so` sleeps at `0%` CPU on `poll()` when hidden.
|
||||||
|
|
||||||
|
26. **Engineering menu (`engmenu.so` / `xengmenu`) and extended logging toggle (`bananarchy-engmenu-ctl`)**:
|
||||||
|
- **Open**: dial **`*#0001#`** (or `###`) in `xdialer`, or run `xengmenu` (hidden and blocked in Duress Mode).
|
||||||
|
- **Eight hardware and privacy controls (`1`–`8` hotkeys or `Up`/`Down` + `Center OK` / `Left softkey`)**:
|
||||||
|
- **`1: Override TTL`**: set a fixed outbound IPv4/IPv6 TTL/hop-limit (`64`, `65`, `128`, or custom `1..255`) for native and tethered traffic until reboot, or `0` to restore default.
|
||||||
|
- **`2: Edit IMEI 1` and `3: Edit IMEI 2`**: inspect or edit NVRAM IMEI 1 / IMEI 2 (`tunning` `nvm/num/550` & `nvm/context1/550` or `rf_nv` with Luhn check digit calculation and `*`/`#` random TAC-preserving generation).
|
||||||
|
- **`4: Run Overclock Script`**: toggle `performance` governor and maximum CPU/Adreno 304 GPU OPP clocks until reboot.
|
||||||
|
- **`5: Toggle DIAG Port`**: switch USB gadget between standard USB networking (`18d1:d001`) and Qualcomm Diagnostics + AT + NCM (`05c6:9091`).
|
||||||
|
- **`6: Edit Wi-Fi MAC` and `7: Edit Bluetooth MAC`**: set or randomize (`#`) locally-administered `wlan0` and `hci0` MAC addresses in NVRAM/persist and live interfaces.
|
||||||
|
- **`8: Extended Logging`**: toggle system and session logging (`OFF` by default). When `OFF` (default), all persistent and runtime logs (`sxmo_log`, `superd` and service logs, `Xorg`, `dwm`, `fcitx5`, `tinydm`, `NetworkManager`, `ModemManager`, and `/var/log`) are disabled and purged so there is zero idle logging activity and zero eMMC log wear. When `ON`, volatile diagnostic logs are written strictly to RAM (`/tmp/sxmo.log`, `/tmp/superd.log`, `/tmp/superd_state/superd/logs/*.log`). Also accessible from **`Config -> Extended Logging`** or via `bananarchy-engmenu-ctl logging [on|off|toggle|status]`.
|
||||||
|
|
||||||
#### 3.1.3 Standalone keypad games (`Snake`, `Tetris`, `Scoundrel`), Game Boy emulator (`Gambatte`), and J2ME emulator (`ReMEdy`)
|
#### 3.1.3 Standalone keypad games (`Snake`, `Tetris`, `Scoundrel`), Game Boy emulator (`Gambatte`), and J2ME emulator (`ReMEdy`)
|
||||||
Three native X11 games (`/usr/bin/snake`, `/usr/bin/tetris`, and `/usr/bin/scoundrel`), the **Gambatte (`gambatte` / `gbemu`)** Game Boy / Game Boy Color emulator, and the **ReMEdy (`remedy` / `j2me`)** J2ME (MIDP 2.0 / CLDC 1.1) emulator are accessible from **System menu -> Games** (and **System menu -> Applications** for ReMEdy, or by opening `.gb`/`.gbc` and `.jar`/`.jad` files directly in **Files (`xfiles`)**):
|
Three native X11 games (`/usr/bin/snake`, `/usr/bin/tetris`, and `/usr/bin/scoundrel`), the **Gambatte (`gambatte` / `gbemu`)** Game Boy / Game Boy Color emulator, and the **ReMEdy (`remedy` / `j2me`)** J2ME (MIDP 2.0 / CLDC 1.1) emulator are accessible from **System menu -> Games** (and **System menu -> Applications** for ReMEdy, or by opening `.gb`/`.gbc` and `.jar`/`.jad` files directly in **Files (`xfiles`)**):
|
||||||
- **Snake (`snake`)**: steer with `2`/`8`/`4`/`6` or D-Pad; pause or restart with `5`/`Return`/`#`/`*`; quit with `Right softkey`/`BackSpace`/`Escape`.
|
- **Snake (`snake`)**: steer with `2`/`8`/`4`/`6` or D-Pad; pause or restart with `5`/`Return`/`#`/`*`; quit with `Right softkey`/`BackSpace`/`Escape`.
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
### System and hardware support
|
### System and hardware support
|
||||||
- **Mainline Linux 6.12 kernel**: custom patches and out-of-tree drivers for Qualcomm **Adreno 304 (`FD304`, 96 KB GMEM)** 3D GPU acceleration (`drm/msm` + `qcom-iommu`), Qualcomm QDSP6/Q6Voice audio routing, Dual-SIM modem control, the rear 2MP GalaxyCore `GC2395` / `GC2385` / `GC2365` camera (`/dev/video0`), the `SY7807` flashlight LED (`white:torch`), physical keypad/slider events, and clean PM8909 poweroff.
|
- **Mainline Linux 6.12 kernel**: custom patches and out-of-tree drivers for Qualcomm **Adreno 304 (`FD304`, 96 KB GMEM)** 3D GPU acceleration (`drm/msm` + `qcom-iommu`), Qualcomm QDSP6/Q6Voice audio routing, Dual-SIM modem control, the rear 2MP GalaxyCore `GC2395` / `GC2385` / `GC2365` camera (`/dev/video0`), the `SY7807` flashlight LED (`white:torch`), physical keypad/slider events, and clean PM8909 poweroff.
|
||||||
- **Alpine Linux Edge base**: full access to the Alpine package ecosystem with `< 95 MB` idle RAM usage on 512 MB devices and full local root access out of the box.
|
- **Alpine Linux Edge base**: full access to the Alpine package ecosystem with `< 95 MB` idle RAM usage on 512 MB devices and full local root access out of the box.
|
||||||
- **Pure X11 graphical stack with GPU acceleration**: cross-compiled **Xlibre** (`X11Libre/xserver`) display server offloading 2D/3D screen rendering to the **Adreno 304 GPU** via **Glamor, DRI3, GLX, and Mesa Freedreno (`FD304`, OpenGL 3.1 / OpenGL ES 3.0)** over `panel-mipi-dbi` KMSRO, paired with a customized **Sxmo (`sxmo-de-dwm`)** window manager (`240x320` vertical stack layout, Conky desktop clock and system status widget, `< 2 ms` slider/key wake latency, and zero Wayland overhead).
|
- **Pure X11 graphical stack with GPU acceleration**: cross-compiled **Xlibre** (`X11Libre/xserver`) display server offloading 2D/3D screen rendering to the **Adreno 304 GPU** via **Glamor, DRI3, GLX, and Mesa Freedreno (`FD304`, OpenGL 3.1 / OpenGL ES 3.0)** over `panel-mipi-dbi` KMSRO, paired with a customized **Sxmo (`sxmo-de-dwm`)** window manager (`240x320` vertical stack layout, native `ParentRelative` desktop clock and softkey bar without Conky overhead, `< 2 ms` slider/key wake latency, and zero Wayland overhead).
|
||||||
|
|
||||||
### Keypad-first user experience and native DWM plugins
|
### Keypad-first user experience and native DWM plugins
|
||||||
Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs a suite of 25 preloaded C/C++ plugins inside DWM that sleep at 0% CPU and open in `< 2 ms`:
|
Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs a suite of 25 preloaded C/C++ plugins inside DWM that sleep at 0% CPU and open in `< 2 ms`:
|
||||||
@@ -30,6 +30,7 @@ Instead of spawning slow shell scripts for everyday phone tasks, Bananarchy runs
|
|||||||
- **OpenVPN (`3:OVPN`)**: start/stop OpenVPN (`tun_ovpn`) with a custom `.ovpn` configuration file selected via the built-in file picker and route native and/or Wi-Fi/USB-tethered traffic through it.
|
- **OpenVPN (`3:OVPN`)**: start/stop OpenVPN (`tun_ovpn`) with a custom `.ovpn` configuration file selected via the built-in file picker and route native and/or Wi-Fi/USB-tethered traffic through it.
|
||||||
- **GSocket single TCP port (`4:GS`)**: start/stop `gs-netcat` (`gsocket`) for a single configurable TCP port with a custom GSocket secret string (`client` or `server` mode) and transparently redirect native and/or Wi-Fi/USB-tethered traffic for that TCP port through GSocket.
|
- **GSocket single TCP port (`4:GS`)**: start/stop `gs-netcat` (`gsocket`) for a single configurable TCP port with a custom GSocket secret string (`client` or `server` mode) and transparently redirect native and/or Wi-Fi/USB-tethered traffic for that TCP port through GSocket.
|
||||||
- **WireGuard (`5:WG`)**: start/stop a kernel WireGuard tunnel (`wg0`), generate keypairs (`wg genkey` / `wg pubkey`) or import `.conf` profiles, edit custom `PrivateKey`, peer `PublicKey`, optional `PresharedKey`, `Endpoint`, `Address`, and `DNS`, and route native and/or Wi-Fi/USB-tethered traffic through it.
|
- **WireGuard (`5:WG`)**: start/stop a kernel WireGuard tunnel (`wg0`), generate keypairs (`wg genkey` / `wg pubkey`) or import `.conf` profiles, edit custom `PrivateKey`, peer `PublicKey`, optional `PresharedKey`, `Endpoint`, `Address`, and `DNS`, and route native and/or Wi-Fi/USB-tethered traffic through it.
|
||||||
|
- **Zero-log privacy default and Extended Logging toggle (`xengmenu` / `dmenu config` / `bananarchy-engmenu-ctl logging`)**: extended system and session logging is **disabled by default** (`OFF`) across `sxmo_log`, `superd` and its managed services, `Xorg` (`-logfile /dev/null -logverbose 0`), `dwm`, `fcitx5` (`--verbose="*=0"`), `tinydm`, `NetworkManager` (`level=OFF`), `ModemManager` (`--log-level=ERR --log-file=/dev/null`), and kernel `printk`, ensuring zero eMMC log writes and zero idle logging activity. Extended RAM-only logging in `/tmp` (`/tmp/sxmo.log`, `/tmp/superd.log`, `/tmp/superd_state/superd/logs/*.log`) can be toggled at any time in the **Engineering Menu (`*#0001#` / `xengmenu` -> `8: Extended Logging`)**, **`Config -> Extended Logging`**, or via `bananarchy-engmenu-ctl logging [on|off|toggle|status]`.
|
||||||
- **Global controls drawer (`xdrawer`) and `*` + `#` screenshot combo**: press **both softkeys together** from anywhere to adjust linear (`1%`–`100%`) speaker, earpiece, and ringtone volume, audio output routing (`Speaker`, `Earpiece`, `Headphones` with automatic 3.5mm jack plug/unplug routing), ringer mode (`Ring+Vib` / `Vibrate` / `Silent` / `DND`), 3-level vibration intensity (`Light` / `Medium` / `Strong`), flashlight, sound and microphone mute, screen brightness, and keypad backlight; press **`*` and `#` together** from anywhere to capture a `240x320` PNG screenshot (`scrot` via `bananarchy-screenshot`) to `~/Pictures/screenshot-YYYYMMDD-HHMMSS.png`.
|
- **Global controls drawer (`xdrawer`) and `*` + `#` screenshot combo**: press **both softkeys together** from anywhere to adjust linear (`1%`–`100%`) speaker, earpiece, and ringtone volume, audio output routing (`Speaker`, `Earpiece`, `Headphones` with automatic 3.5mm jack plug/unplug routing), ringer mode (`Ring+Vib` / `Vibrate` / `Silent` / `DND`), 3-level vibration intensity (`Light` / `Medium` / `Strong`), flashlight, sound and microphone mute, screen brightness, and keypad backlight; press **`*` and `#` together** from anywhere to capture a `240x320` PNG screenshot (`scrot` via `bananarchy-screenshot`) to `~/Pictures/screenshot-YYYYMMDD-HHMMSS.png`.
|
||||||
- **Phone dialer (`xdialer`), call log (`xcalllog`), and call screen (`xcallscreen`)**: press any digit on the home screen to start dialing with live T9 contact matching, run interactive carrier USSD codes (`*100#`, etc.), or type `*#06#` to inspect both IMEIs. When two SIM cards are active in Dual-SIM Dual Standby (DSDS), placing a call or running a USSD code prompts to choose between `SIM 1` and `SIM 2`. Incoming and active calls on either SIM (as well as incoming/active VoIP calls from `xsip` and `xtox`) open a dedicated call screen with an active `[SIM 1]`/`[SIM 2]`/`[SIP]`/`[TOX]` badge, earpiece/speaker switching, microphone mute, DTMF keypad, and one-key normalized WAV call recording (`~/Recordings/rec_HHMMSS_<caller>.wav`). The call log includes a 5-tab view (`All`, `Miss`, `In`, `Out`, `Spam`) with integrated anti-spam number blocking (`~/.config/sxmo/block.tsv`) that automatically hangs up blocked callers and logs them to the `Spam` tab without triggering missed-call notifications.
|
- **Phone dialer (`xdialer`), call log (`xcalllog`), and call screen (`xcallscreen`)**: press any digit on the home screen to start dialing with live T9 contact matching, run interactive carrier USSD codes (`*100#`, etc.), or type `*#06#` to inspect both IMEIs. When two SIM cards are active in Dual-SIM Dual Standby (DSDS), placing a call or running a USSD code prompts to choose between `SIM 1` and `SIM 2`. Incoming and active calls on either SIM (as well as incoming/active VoIP calls from `xsip` and `xtox`) open a dedicated call screen with an active `[SIM 1]`/`[SIM 2]`/`[SIP]`/`[TOX]` badge, earpiece/speaker switching, microphone mute, DTMF keypad, and one-key normalized WAV call recording (`~/Recordings/rec_HHMMSS_<caller>.wav`). The call log includes a 5-tab view (`All`, `Miss`, `In`, `Out`, `Spam`) with integrated anti-spam number blocking (`~/.config/sxmo/block.tsv`) that automatically hangs up blocked callers and logs them to the `Spam` tab without triggering missed-call notifications.
|
||||||
- **Contacts (`xcontacts`) and SMS manager (`xsms`)**: full phonebook editor with direct Qualcomm QMI SIM card contact import and export across SIM 1 and SIM 2, paired with a threaded SMS conversation view, multi-tap message composer with outgoing `SIM 1` / `SIM 2` selection when two SIMs are active, and built-in anti-spam blocklist / spam folder (`~/.local/share/sxmo/block`) with one-key thread blocking and restoration.
|
- **Contacts (`xcontacts`) and SMS manager (`xsms`)**: full phonebook editor with direct Qualcomm QMI SIM card contact import and export across SIM 1 and SIM 2, paired with a threaded SMS conversation view, multi-tap message composer with outgoing `SIM 1` / `SIM 2` selection when two SIMs are active, and built-in anti-spam blocklist / spam folder (`~/.local/share/sxmo/block`) with one-key thread blocking and restoration.
|
||||||
|
|||||||
@@ -1,5 +1,8 @@
|
|||||||
[logging]
|
[logging]
|
||||||
level=ERR
|
level=OFF
|
||||||
|
|
||||||
[connection]
|
[connection]
|
||||||
wifi.powersave=3
|
wifi.powersave=3
|
||||||
|
|
||||||
|
[connectivity]
|
||||||
|
enabled=false
|
||||||
@@ -0,0 +1,2 @@
|
|||||||
|
[connectivity]
|
||||||
|
enabled=false
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
# /etc/conf.d/modemmanager: config file for modemmanager
|
# /etc/conf.d/modemmanager: config file for modemmanager
|
||||||
|
|
||||||
# Enable quick suspend/resume hooks with minimal logging to save power
|
# Enable quick suspend/resume hooks with minimal logging to save power
|
||||||
modemmanager_opts="--test-quick-suspend-resume --log-level=ERR"
|
modemmanager_opts="--test-quick-suspend-resume --log-level=ERR --log-file=/dev/null"
|
||||||
@@ -13,7 +13,7 @@ fi
|
|||||||
{ echo 6000 > /proc/sys/vm/dirty_writeback_centisecs; } 2>/dev/null || true
|
{ echo 6000 > /proc/sys/vm/dirty_writeback_centisecs; } 2>/dev/null || true
|
||||||
{ echo 6000 > /proc/sys/vm/dirty_expire_centisecs; } 2>/dev/null || true
|
{ echo 6000 > /proc/sys/vm/dirty_expire_centisecs; } 2>/dev/null || true
|
||||||
{ echo 0 > /proc/sys/kernel/nmi_watchdog; } 2>/dev/null || true
|
{ echo 0 > /proc/sys/kernel/nmi_watchdog; } 2>/dev/null || true
|
||||||
{ echo "1 4 1 4" > /proc/sys/kernel/printk; } 2>/dev/null || true
|
{ echo "1 4 1 1" > /proc/sys/kernel/printk; } 2>/dev/null || true
|
||||||
{ echo Y > /sys/module/workqueue/parameters/power_efficient; } 2>/dev/null || true
|
{ echo Y > /sys/module/workqueue/parameters/power_efficient; } 2>/dev/null || true
|
||||||
{ echo Y > /sys/module/printk/parameters/console_suspend; } 2>/dev/null || true
|
{ echo Y > /sys/module/printk/parameters/console_suspend; } 2>/dev/null || true
|
||||||
|
|
||||||
|
|||||||
@@ -107,12 +107,6 @@ if [ -z "$SXMO_NO_MODEM" ] && command -v ModemManager > /dev/null; then
|
|||||||
sxmo_wakelock.sh lock sxmo_modem_warming_up 120s
|
sxmo_wakelock.sh lock sxmo_modem_warming_up 120s
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the desktop widget (e.g. clock)
|
|
||||||
pidof -s conky >/dev/null 2>&1 || DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
|
|
||||||
if [ -f /tmp/bananarchy_screen_locked ]; then
|
|
||||||
pkill -STOP -x conky 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# It watch network changes and update the status bar icon by example
|
# It watch network changes and update the status bar icon by example
|
||||||
superctl start sxmo_networkmonitor
|
superctl start sxmo_networkmonitor
|
||||||
|
|
||||||
|
|||||||
@@ -107,12 +107,6 @@ if [ -z "$SXMO_NO_MODEM" ] && command -v ModemManager > /dev/null; then
|
|||||||
sxmo_wakelock.sh lock sxmo_modem_warming_up 120s
|
sxmo_wakelock.sh lock sxmo_modem_warming_up 120s
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the desktop widget (e.g. clock)
|
|
||||||
pidof -s conky >/dev/null 2>&1 || DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
|
|
||||||
if [ -f /tmp/bananarchy_screen_locked ]; then
|
|
||||||
pkill -STOP -x conky 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# It watch network changes and update the status bar icon by example
|
# It watch network changes and update the status bar icon by example
|
||||||
superctl start sxmo_networkmonitor
|
superctl start sxmo_networkmonitor
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,11 @@
|
|||||||
# - Qualcomm USB Diagnostics (05c6:9091 DIAG + AT + NCM) port toggle & RPMSG bridge
|
# - Qualcomm USB Diagnostics (05c6:9091 DIAG + AT + NCM) port toggle & RPMSG bridge
|
||||||
set -u
|
set -u
|
||||||
|
|
||||||
if [ -e "/tmp/bananarchy_duress_mode" ] || [ -e "/tmp/bananarchy_screen_locked" ]; then
|
if [ -e "/tmp/bananarchy_duress_mode" ]; then
|
||||||
|
echo "Error: Engineering Menu is unavailable." >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [ -e "/tmp/bananarchy_screen_locked" ] && [ "${1:-}" != "apply-boot" ]; then
|
||||||
echo "Error: Engineering Menu is unavailable." >&2
|
echo "Error: Engineering Menu is unavailable." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
@@ -340,6 +344,44 @@ stop_diag_bridge() {
|
|||||||
pkill -f "bananarchy_diag_bridge_worker" 2>/dev/null || true
|
pkill -f "bananarchy_diag_bridge_worker" 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply_ext_logging() {
|
||||||
|
lmode="${1:-off}"
|
||||||
|
mkdir -p /home/user/.local/state/superd/logs /tmp/superd_state/superd/logs 2>/dev/null || true
|
||||||
|
if [ "$lmode" = "on" ]; then
|
||||||
|
echo "1" > "$CONF_DIR/ext_logging"
|
||||||
|
echo "1" > /tmp/bananarchy_ext_logging
|
||||||
|
chmod 0644 "$CONF_DIR/ext_logging" /tmp/bananarchy_ext_logging 2>/dev/null || true
|
||||||
|
echo "4 4 1 7" > /proc/sys/kernel/printk 2>/dev/null || true
|
||||||
|
nmcli general logging level WARN domains ALL >/dev/null 2>&1 || true
|
||||||
|
mmcli -G INFO >/dev/null 2>&1 || true
|
||||||
|
rm -f /tmp/superd.log /tmp/superd_state/superd.log /tmp/superd_state/superd/logs/*.log 2>/dev/null || true
|
||||||
|
: > /tmp/sxmo.log 2>/dev/null || true
|
||||||
|
chown 10000:10000 /tmp/sxmo.log 2>/dev/null || true
|
||||||
|
chmod 0644 /tmp/sxmo.log 2>/dev/null || true
|
||||||
|
chown -R 10000:10000 /tmp/superd_state 2>/dev/null || true
|
||||||
|
else
|
||||||
|
rm -f "$CONF_DIR/ext_logging" /tmp/bananarchy_ext_logging 2>/dev/null || true
|
||||||
|
echo "1 4 1 1" > /proc/sys/kernel/printk 2>/dev/null || true
|
||||||
|
rc-service syslog stop >/dev/null 2>&1 || true
|
||||||
|
rc-service klogd stop >/dev/null 2>&1 || true
|
||||||
|
nmcli general logging level OFF domains ALL >/dev/null 2>&1 || true
|
||||||
|
mmcli -G ERR >/dev/null 2>&1 || true
|
||||||
|
rm -f /home/user/.local/state/*.log /home/user/.local/state/*.log.old \
|
||||||
|
/home/user/.local/state/superd/logs/*.log /home/user/.local/state/superd/logs/*.log.old \
|
||||||
|
/tmp/superd_state/*.log /tmp/superd_state/superd/logs/*.log 2>/dev/null || true
|
||||||
|
ln -sf /dev/null /tmp/superd_state/superd.log 2>/dev/null || true
|
||||||
|
for svc in /usr/share/superd/services/*.service /home/user/.config/superd/services/*.service; do
|
||||||
|
[ -f "$svc" ] || continue
|
||||||
|
svc_name="$(basename "$svc" .service)"
|
||||||
|
ln -sf /dev/null "/tmp/superd_state/superd/logs/${svc_name}.log" 2>/dev/null || true
|
||||||
|
done
|
||||||
|
rm -f /tmp/superd.log /tmp/sxmo.log /tmp/dwm.log /tmp/fcitx5.log /tmp/sxmo_hook_start.log \
|
||||||
|
/tmp/tinydm.log /tmp/tinydm.log.old /tmp/Xorg.0.log /tmp/Xorg.0.log.old 2>/dev/null || true
|
||||||
|
rm -f /var/log/*.log /var/log/*.old /var/log/dmesg /var/log/messages 2>/dev/null || true
|
||||||
|
chown -R 10000:10000 /tmp/superd_state /home/user/.local/state 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
start_diag_bridge() {
|
start_diag_bridge() {
|
||||||
stop_diag_bridge
|
stop_diag_bridge
|
||||||
if ! command -v python3 >/dev/null 2>&1; then
|
if ! command -v python3 >/dev/null 2>&1; then
|
||||||
@@ -534,6 +576,12 @@ case "$CMD" in
|
|||||||
vid="$(cat /sys/kernel/config/usb_gadget/g1/idVendor 2>/dev/null | sed 's/^0x//' || echo 18d1)"
|
vid="$(cat /sys/kernel/config/usb_gadget/g1/idVendor 2>/dev/null | sed 's/^0x//' || echo 18d1)"
|
||||||
pid="$(cat /sys/kernel/config/usb_gadget/g1/idProduct 2>/dev/null | sed 's/^0x//' || echo d001)"
|
pid="$(cat /sys/kernel/config/usb_gadget/g1/idProduct 2>/dev/null | sed 's/^0x//' || echo d001)"
|
||||||
|
|
||||||
|
# 7. Extended logging status
|
||||||
|
ext_logging="0"
|
||||||
|
if [ -f "/tmp/bananarchy_ext_logging" ] || [ -f "$CONF_DIR/ext_logging" ]; then
|
||||||
|
ext_logging="1"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "MODEL_NAME=$DEVICE_NAME"
|
echo "MODEL_NAME=$DEVICE_NAME"
|
||||||
echo "CODENAME=$DEVICE_CODENAME"
|
echo "CODENAME=$DEVICE_CODENAME"
|
||||||
echo "NV_METHOD=$NV_METHOD"
|
echo "NV_METHOD=$NV_METHOD"
|
||||||
@@ -552,6 +600,7 @@ case "$CMD" in
|
|||||||
echo "CPU_MAX_MHZ=$cpu_max_mhz"
|
echo "CPU_MAX_MHZ=$cpu_max_mhz"
|
||||||
echo "DIAG_ACTIVE=$diag_active"
|
echo "DIAG_ACTIVE=$diag_active"
|
||||||
echo "USB_PID=${vid}:${pid}"
|
echo "USB_PID=${vid}:${pid}"
|
||||||
|
echo "EXT_LOGGING=$ext_logging"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
ttl)
|
ttl)
|
||||||
@@ -1040,7 +1089,39 @@ EOF
|
|||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
logging)
|
||||||
|
mode="${2:-toggle}"
|
||||||
|
if [ "$mode" = "status" ]; then
|
||||||
|
if [ -f "/tmp/bananarchy_ext_logging" ] || [ -f "$CONF_DIR/ext_logging" ]; then
|
||||||
|
echo "ON"
|
||||||
|
else
|
||||||
|
echo "OFF"
|
||||||
|
fi
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [ "$mode" = "toggle" ]; then
|
||||||
|
if [ -f "/tmp/bananarchy_ext_logging" ] || [ -f "$CONF_DIR/ext_logging" ]; then
|
||||||
|
mode="off"
|
||||||
|
else
|
||||||
|
mode="on"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
if [ "$mode" = "on" ] || [ "$mode" = "1" ]; then
|
||||||
|
apply_ext_logging on
|
||||||
|
echo "OK: Extended logging enabled (/tmp)"
|
||||||
|
else
|
||||||
|
apply_ext_logging off
|
||||||
|
echo "OK: Extended logging disabled & purged"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
|
||||||
apply-boot)
|
apply-boot)
|
||||||
|
# Apply saved extended logging setting (OFF by default)
|
||||||
|
if [ -s "$CONF_DIR/ext_logging" ] && [ "$(cat "$CONF_DIR/ext_logging" 2>/dev/null || true)" = "1" ]; then
|
||||||
|
apply_ext_logging on
|
||||||
|
else
|
||||||
|
apply_ext_logging off
|
||||||
|
fi
|
||||||
# Restore persistent IMEI override cache, Wi-Fi MAC, and Bluetooth MAC on boot
|
# Restore persistent IMEI override cache, Wi-Fi MAC, and Bluetooth MAC on boot
|
||||||
if [ -s "$STATE_DIR/imei_override" ]; then
|
if [ -s "$STATE_DIR/imei_override" ]; then
|
||||||
cp -f "$STATE_DIR/imei_override" "/tmp/bananarchy_imei_override" 2>/dev/null || true
|
cp -f "$STATE_DIR/imei_override" "/tmp/bananarchy_imei_override" 2>/dev/null || true
|
||||||
@@ -1066,7 +1147,7 @@ EOF
|
|||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
echo "Usage: $0 {status|ttl|set-imei|set-wifi-mac|set-bt-mac|overclock|diag|apply-boot|reboot}" >&2
|
echo "Usage: $0 {status|ttl|set-imei|set-wifi-mac|set-bt-mac|overclock|diag|logging|apply-boot|reboot}" >&2
|
||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
@@ -35,4 +35,8 @@ for p in $(pidof fcitx5 2>/dev/null || true); do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
exec /usr/bin/fcitx5 -D --disable=wayland >/tmp/fcitx5.log 2>&1
|
if [ -f /tmp/bananarchy_ext_logging ]; then
|
||||||
|
exec /usr/bin/fcitx5 -D --disable=wayland >/tmp/fcitx5.log 2>&1
|
||||||
|
else
|
||||||
|
exec /usr/bin/fcitx5 -D --disable=wayland --verbose="*=0" >/dev/null 2>&1
|
||||||
|
fi
|
||||||
@@ -2,6 +2,9 @@
|
|||||||
# SPDX-License-Identifier: GPL-2.0-only
|
# SPDX-License-Identifier: GPL-2.0-only
|
||||||
# Synchronizes dunst notification colors and font with the active NeoUI .xth/.Xresources theme.
|
# Synchronizes dunst notification colors and font with the active NeoUI .xth/.Xresources theme.
|
||||||
|
|
||||||
|
exec 9>/tmp/bananarchy_sync_dunst.lock
|
||||||
|
flock -w 2 9 2>/dev/null || exit 0
|
||||||
|
|
||||||
XRES_FILE="/home/user/.Xresources"
|
XRES_FILE="/home/user/.Xresources"
|
||||||
if [ -e /tmp/bananarchy_duress_mode ] && [ -r /tmp/duress_home/.Xresources ]; then
|
if [ -e /tmp/bananarchy_duress_mode ] && [ -r /tmp/duress_home/.Xresources ]; then
|
||||||
XRES_FILE="/tmp/duress_home/.Xresources"
|
XRES_FILE="/tmp/duress_home/.Xresources"
|
||||||
@@ -121,9 +124,11 @@ fi
|
|||||||
if [ "${1:-}" != "--no-restart" ]; then
|
if [ "${1:-}" != "--no-restart" ]; then
|
||||||
if pidof -s dunst >/dev/null 2>&1; then
|
if pidof -s dunst >/dev/null 2>&1; then
|
||||||
pkill -x dunst >/dev/null 2>&1 || true
|
pkill -x dunst >/dev/null 2>&1 || true
|
||||||
sleep 0.08
|
if ! pidof -s superd >/dev/null 2>&1; then
|
||||||
if ! pidof -s dunst >/dev/null 2>&1; then
|
sleep 0.1
|
||||||
DISPLAY="${DISPLAY:-:0}" dunst -config /tmp/dunstrc >/dev/null 2>&1 </dev/null &
|
if ! pidof -s dunst >/dev/null 2>&1; then
|
||||||
|
DISPLAY="${DISPLAY:-:0}" dunst -config /tmp/dunstrc >/dev/null 2>&1 </dev/null &
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -53,6 +53,16 @@ unset WAYLAND_DISPLAY
|
|||||||
unset SWAYSOCK
|
unset SWAYSOCK
|
||||||
|
|
||||||
mkdir -p "$XDG_RUNTIME_DIR" "$XDG_CACHE_HOME/sxmo" "$XDG_CONFIG_HOME/sxmo"
|
mkdir -p "$XDG_RUNTIME_DIR" "$XDG_CACHE_HOME/sxmo" "$XDG_CONFIG_HOME/sxmo"
|
||||||
|
if [ -s /etc/bananarchy/ext_logging ] && [ "$(cat /etc/bananarchy/ext_logging 2>/dev/null || true)" = "1" ]; then
|
||||||
|
printf "1\n" > /tmp/bananarchy_ext_logging
|
||||||
|
chmod 0644 /tmp/bananarchy_ext_logging 2>/dev/null || true
|
||||||
|
else
|
||||||
|
rm -f /tmp/bananarchy_ext_logging 2>/dev/null || true
|
||||||
|
rm -f "$XDG_STATE_HOME"/*.log "$XDG_STATE_HOME"/*.log.old \
|
||||||
|
"$XDG_STATE_HOME"/superd/logs/*.log "$XDG_STATE_HOME"/superd/logs/*.log.old \
|
||||||
|
/tmp/sxmo.log /tmp/dwm.log /tmp/fcitx5.log /tmp/sxmo_hook_start.log \
|
||||||
|
/tmp/tinydm.log /tmp/tinydm.log.old /tmp/Xorg.0.log /tmp/Xorg.0.log.old 2>/dev/null || true
|
||||||
|
fi
|
||||||
rm -f "$XDG_RUNTIME_DIR/sxmo.led.lock" "$XDG_RUNTIME_DIR"/sxmo_bat_state_* 2>/dev/null || true
|
rm -f "$XDG_RUNTIME_DIR/sxmo.led.lock" "$XDG_RUNTIME_DIR"/sxmo_bat_state_* 2>/dev/null || true
|
||||||
touch "$XDG_CACHE_HOME/sxmo/sxmo.noidle" "$XDG_CACHE_HOME/sxmo/sxmo.nosuspend"
|
touch "$XDG_CACHE_HOME/sxmo/sxmo.noidle" "$XDG_CACHE_HOME/sxmo/sxmo.nosuspend"
|
||||||
[ -n "${DBUS_SESSION_BUS_ADDRESS:-}" ] && printf "%s\n" "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR/dbus.bus"
|
[ -n "${DBUS_SESSION_BUS_ADDRESS:-}" ] && printf "%s\n" "$DBUS_SESSION_BUS_ADDRESS" > "$XDG_RUNTIME_DIR/dbus.bus"
|
||||||
@@ -91,7 +101,11 @@ if pidof -s plymouthd >/dev/null 2>&1; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if ! pidof -s Xorg >/dev/null 2>&1; then
|
if ! pidof -s Xorg >/dev/null 2>&1; then
|
||||||
"$XORG_BIN" :0 -s 0 -dpms -nolisten tcp -config "$XORG_CONFIG" -modulepath "$XORG_MODPATH" -logfile /tmp/Xorg.0.log >/dev/null 2>&1 </dev/null &
|
if [ -f /tmp/bananarchy_ext_logging ]; then
|
||||||
|
"$XORG_BIN" :0 -s 0 -dpms -nolisten tcp -config "$XORG_CONFIG" -modulepath "$XORG_MODPATH" -logfile /tmp/Xorg.0.log >/dev/null 2>&1 </dev/null &
|
||||||
|
else
|
||||||
|
"$XORG_BIN" :0 -s 0 -dpms -nolisten tcp -config "$XORG_CONFIG" -modulepath "$XORG_MODPATH" -logfile /dev/null -logverbose 0 >/dev/null 2>&1 </dev/null &
|
||||||
|
fi
|
||||||
i=0
|
i=0
|
||||||
while [ "$i" -lt 40 ]; do
|
while [ "$i" -lt 40 ]; do
|
||||||
if xset s off s noblank s 0 0 >/dev/null 2>&1; then
|
if xset s off s noblank s 0 0 >/dev/null 2>&1; then
|
||||||
@@ -114,13 +128,11 @@ done
|
|||||||
pkill -x dwm >/dev/null 2>&1 || true
|
pkill -x dwm >/dev/null 2>&1 || true
|
||||||
trap 'rm -f "$SESSION_PID_FILE"; pkill -P $$ >/dev/null 2>&1 || true; exit 0' INT TERM HUP QUIT
|
trap 'rm -f "$SESSION_PID_FILE"; pkill -P $$ >/dev/null 2>&1 || true; exit 0' INT TERM HUP QUIT
|
||||||
|
|
||||||
pkill -9 -x conky >/dev/null 2>&1 || true
|
if [ -f /tmp/bananarchy_ext_logging ]; then
|
||||||
rm -rf /tmp/sxmo_conky_time_state /tmp/sxmo_conky_restart.lock
|
( sxmo_hook_start.sh >/tmp/sxmo_hook_start.log 2>&1 </dev/null & )
|
||||||
DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
|
else
|
||||||
if [ -f /tmp/bananarchy_screen_locked ]; then
|
( sxmo_hook_start.sh >/dev/null 2>&1 </dev/null & )
|
||||||
pkill -STOP -x conky 2>/dev/null || true
|
|
||||||
fi
|
fi
|
||||||
( sxmo_hook_start.sh >/tmp/sxmo_hook_start.log 2>&1 </dev/null & )
|
|
||||||
|
|
||||||
first_iter=1
|
first_iter=1
|
||||||
while [ "$(cat "$SESSION_PID_FILE" 2>/dev/null)" = "$$" ]; do
|
while [ "$(cat "$SESSION_PID_FILE" 2>/dev/null)" = "$$" ]; do
|
||||||
@@ -147,15 +159,14 @@ while [ "$(cat "$SESSION_PID_FILE" 2>/dev/null)" = "$$" ]; do
|
|||||||
fi
|
fi
|
||||||
( feh --no-fehbg "$WP_FLAG" "$WP_FILE" >/dev/null 2>&1 </dev/null & )
|
( feh --no-fehbg "$WP_FLAG" "$WP_FILE" >/dev/null 2>&1 </dev/null & )
|
||||||
if [ "$first_iter" = "0" ]; then
|
if [ "$first_iter" = "0" ]; then
|
||||||
pkill -x conky >/dev/null 2>&1 || true
|
|
||||||
sleep 0.05
|
|
||||||
pkill -9 -x conky >/dev/null 2>&1 || true
|
|
||||||
rm -rf /tmp/sxmo_conky_time_state /tmp/sxmo_conky_restart.lock
|
|
||||||
DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
|
|
||||||
pidof -s fcitx5 >/dev/null 2>&1 || superctl start fcitx5 >/dev/null 2>&1 || ( /usr/bin/bananarchy-fcitx5.sh </dev/null & )
|
pidof -s fcitx5 >/dev/null 2>&1 || superctl start fcitx5 >/dev/null 2>&1 || ( /usr/bin/bananarchy-fcitx5.sh </dev/null & )
|
||||||
fi
|
fi
|
||||||
first_iter=0
|
first_iter=0
|
||||||
dwm >/tmp/dwm.log 2>&1 || true
|
if [ -f /tmp/bananarchy_ext_logging ]; then
|
||||||
|
dwm >/tmp/dwm.log 2>&1 || true
|
||||||
|
else
|
||||||
|
dwm >/dev/null 2>&1 || true
|
||||||
|
fi
|
||||||
if [ "$(cat "$SESSION_PID_FILE" 2>/dev/null)" != "$$" ] || pidof -s dwm >/dev/null 2>&1; then
|
if [ "$(cat "$SESSION_PID_FILE" 2>/dev/null)" != "$$" ] || pidof -s dwm >/dev/null 2>&1; then
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|||||||
Binary file not shown.
@@ -225,6 +225,8 @@ $icon_phl Modem Log^0^sxmo_modemlog.sh"
|
|||||||
bt_is_unblocked_fast && _bt_icon="$icon_ton"
|
bt_is_unblocked_fast && _bt_icon="$icon_ton"
|
||||||
_susp_icon="$icon_ton"
|
_susp_icon="$icon_ton"
|
||||||
[ -e "${XDG_CACHE_HOME:-$HOME/.cache}/sxmo/sxmo.nosuspend" ] && _susp_icon="$icon_tof"
|
[ -e "${XDG_CACHE_HOME:-$HOME/.cache}/sxmo/sxmo.nosuspend" ] && _susp_icon="$icon_tof"
|
||||||
|
_log_icon="$icon_tof"
|
||||||
|
[ -e "/tmp/bananarchy_ext_logging" ] && _log_icon="$icon_ton"
|
||||||
CHOICES="$icon_plk Passcode^0^xpasscode
|
CHOICES="$icon_plk Passcode^0^xpasscode
|
||||||
$icon_cfg Themes^0^xthemes
|
$icon_cfg Themes^0^xthemes
|
||||||
$icon_aru Brightness^1^sxmo_brightness.sh up
|
$icon_aru Brightness^1^sxmo_brightness.sh up
|
||||||
@@ -232,9 +234,10 @@ $icon_ard Brightness^1^sxmo_brightness.sh down
|
|||||||
$icon_bth Bluetooth $_bt_icon^1^doas sxmo_bluetoothtoggle.sh && sxmo_hook_statusbar.sh bluetooth
|
$icon_bth Bluetooth $_bt_icon^1^doas sxmo_bluetoothtoggle.sh && sxmo_hook_statusbar.sh bluetooth
|
||||||
$icon_clk Change Timezone^1^sxmo_timezonechange.sh
|
$icon_clk Change Timezone^1^sxmo_timezonechange.sh
|
||||||
$icon_zzz Auto-suspend $_susp_icon^1^(rm ${XDG_CACHE_HOME:-$HOME/.cache}/sxmo/sxmo.nosuspend 2>/dev/null || touch ${XDG_CACHE_HOME:-$HOME/.cache}/sxmo/sxmo.nosuspend)
|
$icon_zzz Auto-suspend $_susp_icon^1^(rm ${XDG_CACHE_HOME:-$HOME/.cache}/sxmo/sxmo.nosuspend 2>/dev/null || touch ${XDG_CACHE_HOME:-$HOME/.cache}/sxmo/sxmo.nosuspend)
|
||||||
|
$icon_inf Extended Logging $_log_icon^1^bananarchy-engmenu-ctl logging toggle
|
||||||
$icon_trm Hooks^0^sxmo_hookmenu.sh
|
$icon_trm Hooks^0^sxmo_hookmenu.sh
|
||||||
$icon_cfg Suspend Blockers^0^sxmo_terminal.sh sxmo_debug_suspend.sh
|
$icon_cfg Suspend Blockers^0^sxmo_terminal.sh sxmo_debug_suspend.sh
|
||||||
$icon_inf Log^0^sxmo_terminal.sh tail -n 100 -f ${XDG_STATE_HOME:-$HOME}/sxmo.log
|
$icon_inf Log^0^sxmo_terminal.sh tail -n 100 -f /tmp/sxmo.log
|
||||||
$icon_inf Version^0^sxmo_terminal.sh sxmo_version.sh --block"
|
$icon_inf Version^0^sxmo_terminal.sh sxmo_version.sh --block"
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
|
|||||||
@@ -68,12 +68,14 @@ confirm_menu() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
sxmo_log() {
|
sxmo_log() {
|
||||||
printf "%s %s: %s\n" "$(date +%H:%M:%S)" "${0##*/}" "$*" | tee -a "${XDG_STATE_HOME:-$HOME}"/sxmo.log 1>&2
|
[ -f /tmp/bananarchy_ext_logging ] || return 0
|
||||||
|
printf "%s %s: %s\n" "$(date +%H:%M:%S)" "${0##*/}" "$*" >> /tmp/sxmo.log 2>/dev/null || true
|
||||||
}
|
}
|
||||||
|
|
||||||
sxmo_debug() {
|
sxmo_debug() {
|
||||||
|
[ -f /tmp/bananarchy_ext_logging ] || return 0
|
||||||
if [ -n "$SXMO_DEBUG" ]; then
|
if [ -n "$SXMO_DEBUG" ]; then
|
||||||
printf "%s %s DEBUG: %s\n" "$(date +%H:%M:%S)" "${0##*/}" "$*" | tee -a "${XDG_STATE_HOME:-$HOME}"/sxmo.log 1>&2
|
printf "%s %s DEBUG: %s\n" "$(date +%H:%M:%S)" "${0##*/}" "$*" >> /tmp/sxmo.log 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -190,7 +190,6 @@ checkforincomingcalls() {
|
|||||||
xcallscreen incoming "$VOICECALLID" "$INCOMINGNUMBER" >/dev/null 2>&1 || true
|
xcallscreen incoming "$VOICECALLID" "$INCOMINGNUMBER" >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sxmo_jobs.sh start proximity_lock sxmo_proximitylock.sh
|
|
||||||
sxmo_hook_statusbar.sh state &
|
sxmo_hook_statusbar.sh state &
|
||||||
|
|
||||||
# If we already got an active call
|
# If we already got an active call
|
||||||
|
|||||||
@@ -87,7 +87,6 @@ dial_number() {
|
|||||||
elif command -v xcallscreen >/dev/null 2>&1; then
|
elif command -v xcallscreen >/dev/null 2>&1; then
|
||||||
xcallscreen outgoing "$CALLID" "$NUMBER" >/dev/null 2>&1 || true
|
xcallscreen outgoing "$CALLID" "$NUMBER" >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
sxmo_jobs.sh start proximity_lock sxmo_proximitylock.sh
|
|
||||||
sxmo_hook_statusbar.sh state &
|
sxmo_hook_statusbar.sh state &
|
||||||
return 0
|
return 0
|
||||||
fi
|
fi
|
||||||
@@ -148,7 +147,6 @@ dial_number() {
|
|||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sxmo_jobs.sh start proximity_lock sxmo_proximitylock.sh
|
|
||||||
sxmo_hook_statusbar.sh state &
|
sxmo_hook_statusbar.sh state &
|
||||||
|
|
||||||
sxmo_jobs.sh start incall_menu sxmo_modemcall.sh incall_menu
|
sxmo_jobs.sh start incall_menu sxmo_modemcall.sh incall_menu
|
||||||
|
|||||||
@@ -157,8 +157,6 @@ case "$1" in
|
|||||||
;;
|
;;
|
||||||
logout)
|
logout)
|
||||||
sxmo_hook_logout.sh || true
|
sxmo_hook_logout.sh || true
|
||||||
pkill -9 -x conky >/dev/null 2>&1 || true
|
|
||||||
rm -rf /tmp/sxmo_conky_time_state /tmp/sxmo_conky_restart.lock
|
|
||||||
case "${SXMO_WM:-dwm}" in
|
case "${SXMO_WM:-dwm}" in
|
||||||
"i3") i3-msg exit ;;
|
"i3") i3-msg exit ;;
|
||||||
"sway") swaymsg exit ;;
|
"sway") swaymsg exit ;;
|
||||||
|
|||||||
@@ -52,16 +52,12 @@ xorgdisplay() {
|
|||||||
if [ -w /sys/devices/system/cpu/cpufreq/policy0/scaling_governor ]; then
|
if [ -w /sys/devices/system/cpu/cpufreq/policy0/scaling_governor ]; then
|
||||||
printf 'powersave\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true
|
printf 'powersave\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
pkill -STOP -x conky 2>/dev/null || true
|
|
||||||
xset s off s noblank >/dev/null 2>&1 || true
|
xset s off s noblank >/dev/null 2>&1 || true
|
||||||
;;
|
;;
|
||||||
on)
|
on)
|
||||||
if [ -w /sys/devices/system/cpu/cpufreq/policy0/scaling_governor ]; then
|
if [ -w /sys/devices/system/cpu/cpufreq/policy0/scaling_governor ]; then
|
||||||
printf 'schedutil\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true
|
printf 'schedutil\n' > /sys/devices/system/cpu/cpufreq/policy0/scaling_governor 2>/dev/null || true
|
||||||
fi
|
fi
|
||||||
if [ ! -f /tmp/bananarchy_screen_locked ]; then
|
|
||||||
pkill -CONT -x conky 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
xset s off s noblank >/dev/null 2>&1 || true
|
xset s off s noblank >/dev/null 2>&1 || true
|
||||||
if [ -w /sys/class/backlight/backlight/bl_power ]; then
|
if [ -w /sys/class/backlight/backlight/bl_power ]; then
|
||||||
printf '0\n' > /sys/class/backlight/backlight/bl_power 2>/dev/null || true
|
printf '0\n' > /sys/class/backlight/backlight/bl_power 2>/dev/null || true
|
||||||
|
|||||||
@@ -3,14 +3,18 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
setup_log() {
|
setup_log() {
|
||||||
logfile=${XDG_STATE_HOME:-~/.local/state}/tinydm.log
|
rm -f "${XDG_STATE_HOME:-$HOME/.local/state}/tinydm.log" \
|
||||||
mkdir -p "$(dirname "$logfile")"
|
"${XDG_STATE_HOME:-$HOME/.local/state}/tinydm.log.old" 2>/dev/null || true
|
||||||
if [ -f "$logfile" ]; then
|
if [ -f /etc/bananarchy/ext_logging ] || [ -f /tmp/bananarchy_ext_logging ]; then
|
||||||
# keep previous log file around
|
logfile=/tmp/tinydm.log
|
||||||
mv "$logfile" "$logfile".old
|
if [ -f "$logfile" ]; then
|
||||||
|
mv "$logfile" "$logfile".old 2>/dev/null || true
|
||||||
|
fi
|
||||||
|
exec >"$logfile" 2>&1
|
||||||
|
else
|
||||||
|
rm -f /tmp/tinydm.log /tmp/tinydm.log.old 2>/dev/null || true
|
||||||
|
exec >/dev/null 2>&1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
exec >"$logfile" 2>&1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
source_profile() {
|
source_profile() {
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -59,17 +59,13 @@ setup_tz() {
|
|||||||
ln -s "$zonepath" "${ROOT}"etc/localtime
|
ln -s "$zonepath" "${ROOT}"etc/localtime
|
||||||
printf "%s\n" "$zone" > "${ROOT}"etc/timezone 2>/dev/null || true
|
printf "%s\n" "$zone" > "${ROOT}"etc/timezone 2>/dev/null || true
|
||||||
if [ -z "$ROOT" ] || [ "$ROOT" = "/" ]; then
|
if [ -z "$ROOT" ] || [ "$ROOT" = "/" ]; then
|
||||||
rm -f /tmp/sxmo_conky_time_state
|
|
||||||
if pidof -s Xorg >/dev/null 2>&1; then
|
if pidof -s Xorg >/dev/null 2>&1; then
|
||||||
su -s /bin/sh user -c '
|
su -s /bin/sh user -c '
|
||||||
export PATH="/home/user/.config/sxmo/hooks:/usr/share/sxmo/default_hooks:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin"
|
export PATH="/home/user/.config/sxmo/hooks:/usr/share/sxmo/default_hooks:/usr/local/bin:/usr/bin:/bin:/sbin:/usr/sbin"
|
||||||
export DISPLAY=:0
|
export DISPLAY=:0
|
||||||
export XDG_RUNTIME_DIR="/run/user/10000"
|
export XDG_RUNTIME_DIR="/run/user/10000"
|
||||||
export XDG_CONFIG_HOME="/home/user/.config"
|
export XDG_CONFIG_HOME="/home/user/.config"
|
||||||
sxmo_hook_statusbar.sh time >/dev/null 2>&1 || {
|
sxmo_hook_statusbar.sh time >/dev/null 2>&1 || true
|
||||||
pkill -9 -x conky >/dev/null 2>&1 || true
|
|
||||||
DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
|
|
||||||
}
|
|
||||||
' >/dev/null 2>&1 || true
|
' >/dev/null 2>&1 || true
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -4,4 +4,5 @@ Description=lightweight notification daemon for x11 compositors
|
|||||||
[Service]
|
[Service]
|
||||||
Type=simple
|
Type=simple
|
||||||
Restart=always
|
Restart=always
|
||||||
|
RestartSec=1s
|
||||||
ExecStart=/usr/bin/dunst -config /tmp/dunstrc
|
ExecStart=/usr/bin/dunst -config /tmp/dunstrc
|
||||||
@@ -76,9 +76,12 @@ case "$WMCLASS" in
|
|||||||
$icon_zzz Auto-suspend $(
|
$icon_zzz Auto-suspend $(
|
||||||
[ -e "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend ] && printf "%s" "$icon_tof" || printf "%s" "$icon_ton"
|
[ -e "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend ] && printf "%s" "$icon_tof" || printf "%s" "$icon_ton"
|
||||||
) ^ 1 ^ (rm $XDG_CACHE_HOME/sxmo/sxmo.nosuspend 2>/dev/null || touch $XDG_CACHE_HOME/sxmo/sxmo.nosuspend)
|
) ^ 1 ^ (rm $XDG_CACHE_HOME/sxmo/sxmo.nosuspend 2>/dev/null || touch $XDG_CACHE_HOME/sxmo/sxmo.nosuspend)
|
||||||
|
$icon_inf Extended Logging $(
|
||||||
|
[ -e /tmp/bananarchy_ext_logging ] && printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
|
||||||
|
) ^ 1 ^ bananarchy-engmenu-ctl logging toggle
|
||||||
$icon_trm Hooks ^ 0 ^ sxmo_hookmenu.sh
|
$icon_trm Hooks ^ 0 ^ sxmo_hookmenu.sh
|
||||||
$icon_cfg Suspend Blockers ^ 0 ^ sxmo_terminal.sh sxmo_debug_suspend.sh
|
$icon_cfg Suspend Blockers ^ 0 ^ sxmo_terminal.sh sxmo_debug_suspend.sh
|
||||||
$icon_inf Log ^ 0 ^ sxmo_terminal.sh tail -n 100 -f ${XDG_STATE_HOME:-$HOME}/sxmo.log
|
$icon_inf Log ^ 0 ^ sxmo_terminal.sh tail -n 100 -f /tmp/sxmo.log
|
||||||
$icon_inf Version ^ 0 ^ sxmo_terminal.sh sxmo_version.sh --block
|
$icon_inf Version ^ 0 ^ sxmo_terminal.sh sxmo_version.sh --block
|
||||||
"
|
"
|
||||||
WINNAME=Config
|
WINNAME=Config
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ cur_state=""
|
|||||||
[ "$cur_state" = "unlock" ] && exit 0
|
[ "$cur_state" = "unlock" ] && exit 0
|
||||||
|
|
||||||
printf '1\n' > /tmp/bananarchy_screen_locked
|
printf '1\n' > /tmp/bananarchy_screen_locked
|
||||||
pkill -STOP -x conky 2>/dev/null || true
|
|
||||||
|
|
||||||
if ! sxmo_jobs.sh running proximity_lock -q; then
|
if ! sxmo_jobs.sh running proximity_lock -q; then
|
||||||
if [ -f /tmp/sxmo_call_ringing ] || [ -f /tmp/sxmo_active_call ] || [ -n "$(ls -A "$XDG_RUNTIME_DIR/sxmo_calls" 2>/dev/null)" ]; then
|
if [ -f /tmp/sxmo_call_ringing ] || [ -f /tmp/sxmo_active_call ] || [ -n "$(ls -A "$XDG_RUNTIME_DIR/sxmo_calls" 2>/dev/null)" ]; then
|
||||||
|
|||||||
@@ -3,5 +3,4 @@
|
|||||||
|
|
||||||
# This script is called with both toggle wm and when loging out (i.e., restarting)
|
# This script is called with both toggle wm and when loging out (i.e., restarting)
|
||||||
# current window manager.
|
# current window manager.
|
||||||
pkill -x conky >/dev/null 2>&1 || true
|
exit 0
|
||||||
rm -f /tmp/sxmo_conky_time_state
|
|
||||||
@@ -12,10 +12,9 @@
|
|||||||
STATE_FILE="${SXMO_STATE:-$XDG_RUNTIME_DIR/sxmo.state}"
|
STATE_FILE="${SXMO_STATE:-$XDG_RUNTIME_DIR/sxmo.state}"
|
||||||
cur_state=""
|
cur_state=""
|
||||||
[ -r "$STATE_FILE" ] && { read -r cur_state < "$STATE_FILE" 2>/dev/null || true; }
|
[ -r "$STATE_FILE" ] && { read -r cur_state < "$STATE_FILE" 2>/dev/null || true; }
|
||||||
[ "$cur_state" = "unlock" ] && exit 0
|
[ "$cur_state" != "screenoff" ] && exit 0
|
||||||
|
|
||||||
printf '1\n' > /tmp/bananarchy_screen_locked
|
printf '1\n' > /tmp/bananarchy_screen_locked
|
||||||
pkill -STOP -x conky 2>/dev/null || true
|
|
||||||
|
|
||||||
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||||
sxmo_led.sh blink red blue &
|
sxmo_led.sh blink red blue &
|
||||||
@@ -30,7 +29,7 @@ case "$SXMO_WM" in
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ "$cur_state" != "unlock" ]; then
|
if [ "$cur_state" = "screenoff" ]; then
|
||||||
sxmo_wm.sh display off
|
sxmo_wm.sh display off
|
||||||
fi
|
fi
|
||||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
|
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
|
||||||
|
|||||||
@@ -20,7 +20,22 @@ fi
|
|||||||
if ! superctl status > /dev/null 2>&1; then
|
if ! superctl status > /dev/null 2>&1; then
|
||||||
pkill -9 -x superd > /dev/null 2>&1 || true
|
pkill -9 -x superd > /dev/null 2>&1 || true
|
||||||
rm -f "$XDG_RUNTIME_DIR/superd.lock" "$XDG_RUNTIME_DIR/superd.sock"
|
rm -f "$XDG_RUNTIME_DIR/superd.lock" "$XDG_RUNTIME_DIR/superd.sock"
|
||||||
sxmo_jobs.sh start daemon_manager superd
|
mkdir -p /tmp/superd_state/superd/logs "$HOME/.local/state/superd/logs" 2>/dev/null || true
|
||||||
|
if [ -f /tmp/bananarchy_ext_logging ]; then
|
||||||
|
rm -f /tmp/superd.log /tmp/superd_state/superd.log /tmp/superd_state/superd/logs/*.log 2>/dev/null || true
|
||||||
|
sxmo_jobs.sh start daemon_manager env XDG_STATE_HOME=/tmp/superd_state superd -l /tmp/superd.log
|
||||||
|
else
|
||||||
|
rm -f "$HOME/.local/state/superd.log" "$HOME/.local/state/superd.log.old" \
|
||||||
|
"$HOME/.local/state/superd/logs"/*.log "$HOME/.local/state/superd/logs"/*.log.old \
|
||||||
|
/tmp/superd.log /tmp/superd_state/superd/logs/*.log 2>/dev/null || true
|
||||||
|
ln -sf /dev/null /tmp/superd_state/superd.log 2>/dev/null || true
|
||||||
|
for svc in /usr/share/superd/services/*.service "$HOME/.config/superd/services"/*.service; do
|
||||||
|
[ -f "$svc" ] || continue
|
||||||
|
svc_name="$(basename "$svc" .service)"
|
||||||
|
ln -sf /dev/null "/tmp/superd_state/superd/logs/${svc_name}.log" 2>/dev/null || true
|
||||||
|
done
|
||||||
|
sxmo_jobs.sh start daemon_manager env XDG_STATE_HOME=/tmp/superd_state superd -l /dev/null
|
||||||
|
fi
|
||||||
while ! superctl status > /dev/null 2>&1; do
|
while ! superctl status > /dev/null 2>&1; do
|
||||||
sleep 0.05
|
sleep 0.05
|
||||||
done
|
done
|
||||||
@@ -107,12 +122,6 @@ if [ -z "$SXMO_NO_MODEM" ] && command -v ModemManager > /dev/null; then
|
|||||||
sxmo_wakelock.sh lock sxmo_modem_warming_up 120s
|
sxmo_wakelock.sh lock sxmo_modem_warming_up 120s
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Start the desktop widget (e.g. clock)
|
|
||||||
pidof -s conky >/dev/null 2>&1 || DISPLAY=:0 CONKY_DPY=:0 conky -c /home/user/.config/sxmo/conky.conf -d >/dev/null 2>&1 </dev/null || true
|
|
||||||
if [ -f /tmp/bananarchy_screen_locked ]; then
|
|
||||||
pkill -STOP -x conky 2>/dev/null || true
|
|
||||||
fi
|
|
||||||
|
|
||||||
# It watch network changes and update the status bar icon by example
|
# It watch network changes and update the status bar icon by example
|
||||||
superctl start sxmo_networkmonitor
|
superctl start sxmo_networkmonitor
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,14 @@
|
|||||||
# we disable shellcheck SC2154 (unreferenced variable used)
|
# we disable shellcheck SC2154 (unreferenced variable used)
|
||||||
# shellcheck disable=SC2154
|
# shellcheck disable=SC2154
|
||||||
|
|
||||||
|
if [ "${1:-}" = "periodics" ]; then
|
||||||
|
[ -f /tmp/bananarchy_screen_locked ] && exit 0
|
||||||
|
if [ -r /sys/class/backlight/backlight/brightness ]; then
|
||||||
|
read -r _br < /sys/class/backlight/backlight/brightness 2>/dev/null || _br=1
|
||||||
|
case "$_br" in ''|0|-*) exit 0 ;; esac
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# include common definitions
|
# include common definitions
|
||||||
# shellcheck source=configs/default_hooks/sxmo_hook_icons.sh
|
# shellcheck source=configs/default_hooks/sxmo_hook_icons.sh
|
||||||
. sxmo_hook_icons.sh
|
. sxmo_hook_icons.sh
|
||||||
@@ -17,53 +25,8 @@
|
|||||||
# right). Our preference is to have "static" icons on the
|
# right). Our preference is to have "static" icons on the
|
||||||
# right and "variable" icons (that come and go) on the left.
|
# right and "variable" icons (that come and go) on the left.
|
||||||
|
|
||||||
restart_conky() {
|
|
||||||
lockdir="/tmp/sxmo_conky_restart.lock"
|
|
||||||
if ! mkdir "$lockdir" 2>/dev/null; then
|
|
||||||
return 0
|
|
||||||
fi
|
|
||||||
superctl stop sxmo_conky >/dev/null 2>&1 || true
|
|
||||||
pkill -x conky >/dev/null 2>&1 || true
|
|
||||||
sleep 0.05
|
|
||||||
pkill -9 -x conky >/dev/null 2>&1 || true
|
|
||||||
DISPLAY="${DISPLAY:-:0}" CONKY_DPY="${DISPLAY:-:0}" \
|
|
||||||
conky -c "${XDG_CONFIG_HOME:-/home/user/.config}/sxmo/conky.conf" -d >/dev/null 2>&1 </dev/null || true
|
|
||||||
rmdir "$lockdir" 2>/dev/null || true
|
|
||||||
}
|
|
||||||
|
|
||||||
set_time() {
|
set_time() {
|
||||||
sxmobar -a time 99 " $(date "+${SXMO_STATUS_DATE_FORMAT:-%H:%M}")"
|
sxmobar -a time 99 " $(date "+${SXMO_STATUS_DATE_FORMAT:-%H:%M}")"
|
||||||
force_conky="${1:-0}"
|
|
||||||
state_file="/tmp/sxmo_conky_time_state"
|
|
||||||
cur_btime="$(awk '/^btime / {print $2}' /proc/stat 2>/dev/null || echo 0)"
|
|
||||||
cur_tz="$(readlink /etc/localtime 2>/dev/null || cat /etc/timezone 2>/dev/null || echo "")|$(date '+%Z%z')"
|
|
||||||
do_restart="$force_conky"
|
|
||||||
if ! pidof -s conky >/dev/null 2>&1; then
|
|
||||||
do_restart=1
|
|
||||||
elif [ -r "$state_file" ]; then
|
|
||||||
old_btime=""
|
|
||||||
old_tz=""
|
|
||||||
{
|
|
||||||
IFS= read -r old_btime || true
|
|
||||||
IFS= read -r old_tz || true
|
|
||||||
} < "$state_file"
|
|
||||||
if [ "$cur_tz" != "$old_tz" ]; then
|
|
||||||
do_restart=1
|
|
||||||
else
|
|
||||||
case "$cur_btime:$old_btime" in
|
|
||||||
*[!0-9:]*) do_restart=1 ;;
|
|
||||||
*)
|
|
||||||
diff=$((cur_btime - old_btime))
|
|
||||||
[ "$diff" -lt 0 ] && diff=$((-diff))
|
|
||||||
[ "$diff" -ge 2 ] && do_restart=1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
printf "%s\n%s\n" "$cur_btime" "$cur_tz" > "$state_file" 2>/dev/null || true
|
|
||||||
if [ "$do_restart" = "1" ]; then
|
|
||||||
restart_conky
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
set_state() {
|
set_state() {
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
sxmo_wm.sh display on
|
sxmo_wm.sh display on
|
||||||
pkill -CONT -x conky 2>/dev/null || true
|
|
||||||
( sxmo_hook_statusbar.sh state_change >/dev/null 2>&1 & )
|
( sxmo_hook_statusbar.sh state_change >/dev/null 2>&1 & )
|
||||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
|
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
|
||||||
sxmo_wm.sh inputevent touchscreen on
|
sxmo_wm.sh inputevent touchscreen on
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -75,6 +75,7 @@ struct EngStatus {
|
|||||||
int cpuMaxMhz = 1094;
|
int cpuMaxMhz = 1094;
|
||||||
bool diagActive = false;
|
bool diagActive = false;
|
||||||
std::string usbPid = "18d1:d001";
|
std::string usbPid = "18d1:d001";
|
||||||
|
bool extLogging = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Calculate 15th Luhn check digit from the first 14 digits (Wallace calcIMEIChecksum)
|
// Calculate 15th Luhn check digit from the first 14 digits (Wallace calcIMEIChecksum)
|
||||||
@@ -254,6 +255,7 @@ EngStatus queryEngStatus() {
|
|||||||
else if (k == "CPU_MAX_MHZ") st.cpuMaxMhz = std::atoi(v.c_str());
|
else if (k == "CPU_MAX_MHZ") st.cpuMaxMhz = std::atoi(v.c_str());
|
||||||
else if (k == "DIAG_ACTIVE") st.diagActive = (v == "1");
|
else if (k == "DIAG_ACTIVE") st.diagActive = (v == "1");
|
||||||
else if (k == "USB_PID") st.usbPid = v;
|
else if (k == "USB_PID") st.usbPid = v;
|
||||||
|
else if (k == "EXT_LOGGING") st.extLogging = (v == "1");
|
||||||
}
|
}
|
||||||
if (st.imei1.empty() || st.imei2.empty()) {
|
if (st.imei1.empty() || st.imei2.empty()) {
|
||||||
DeviceImeis devIm = queryDeviceImeis();
|
DeviceImeis devIm = queryDeviceImeis();
|
||||||
@@ -410,6 +412,14 @@ int engmenu_run_main(int argc, char** argv) {
|
|||||||
rows.push_back({"7", "7: Edit Bluetooth MAC", bmacSub,
|
rows.push_back({"7", "7: Edit Bluetooth MAC", bmacSub,
|
||||||
isRfnv ? "persist" : "NV 447", 2});
|
isRfnv ? "persist" : "NV 447", 2});
|
||||||
|
|
||||||
|
// 8. [8] Extended logging (privacy)
|
||||||
|
std::string logSub = status.extLogging
|
||||||
|
? "RAM logs active in /tmp"
|
||||||
|
: "Disabled (zero idle logs)";
|
||||||
|
rows.push_back({"8", "8: Extended Logging", logSub,
|
||||||
|
status.extLogging ? "ON" : "OFF",
|
||||||
|
status.extLogging ? 2 : 1});
|
||||||
|
|
||||||
return rows;
|
return rows;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -478,6 +488,12 @@ int engmenu_run_main(int argc, char** argv) {
|
|||||||
editBuf = generateRandomMac();
|
editBuf = generateRandomMac();
|
||||||
lastHexKey = -1;
|
lastHexKey = -1;
|
||||||
modal = EngModal::EditBtMac;
|
modal = EngModal::EditBtMac;
|
||||||
|
} else if (idx == 7) {
|
||||||
|
// 8: Extended Logging
|
||||||
|
std::string res = runEngCtlCapture({"logging", "toggle"});
|
||||||
|
refreshStatus();
|
||||||
|
showToast(status.extLogging ? "Extended logging enabled (/tmp)"
|
||||||
|
: "Extended logging disabled & purged");
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -716,7 +732,7 @@ int engmenu_run_main(int argc, char** argv) {
|
|||||||
std::string lskLabel = "Select";
|
std::string lskLabel = "Select";
|
||||||
if (selIdx == 0 || selIdx == 1 || selIdx == 2 || selIdx == 5 || selIdx == 6) {
|
if (selIdx == 0 || selIdx == 1 || selIdx == 2 || selIdx == 5 || selIdx == 6) {
|
||||||
lskLabel = "Edit";
|
lskLabel = "Edit";
|
||||||
} else if (selIdx == 3 || selIdx == 4) {
|
} else if (selIdx == 3 || selIdx == 4 || selIdx == 7) {
|
||||||
lskLabel = "Toggle";
|
lskLabel = "Toggle";
|
||||||
}
|
}
|
||||||
neo.drawSoftbar(lskLabel, "Run", "Close", &theme.colYellow);
|
neo.drawSoftbar(lskLabel, "Run", "Close", &theme.colYellow);
|
||||||
@@ -1000,7 +1016,7 @@ int engmenu_run_main(int argc, char** argv) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr int kNumItems = 7;
|
constexpr int kNumItems = 8;
|
||||||
if (sym == XK_Up || sym == XK_KP_Up) {
|
if (sym == XK_Up || sym == XK_KP_Up) {
|
||||||
selIdx = (selIdx > 0) ? (selIdx - 1) : (kNumItems - 1);
|
selIdx = (selIdx > 0) ? (selIdx - 1) : (kNumItems - 1);
|
||||||
render();
|
render();
|
||||||
@@ -1019,8 +1035,8 @@ int engmenu_run_main(int argc, char** argv) {
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Direct hotkeys 1..7
|
// Direct hotkeys 1..8
|
||||||
if (dch >= '1' && dch <= '7') {
|
if (dch >= '1' && dch <= '8') {
|
||||||
selIdx = dch - '1';
|
selIdx = dch - '1';
|
||||||
triggerRowAction(selIdx);
|
triggerRowAction(selIdx);
|
||||||
render();
|
render();
|
||||||
|
|||||||
+331
-121
@@ -178,12 +178,38 @@ enum class VerifyResult {
|
|||||||
|
|
||||||
class PasscodeVerifier {
|
class PasscodeVerifier {
|
||||||
public:
|
public:
|
||||||
|
PasscodeVerifier() {
|
||||||
|
struct timespec ts {};
|
||||||
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
|
sessionSalt_ = (static_cast<uint64_t>(ts.tv_sec) << 32) ^
|
||||||
|
static_cast<uint64_t>(ts.tv_nsec) ^
|
||||||
|
(static_cast<uint64_t>(::getpid()) * 0x9e3779b97f4a7c15ULL);
|
||||||
|
int ufd = ::open("/dev/urandom", O_RDONLY | O_CLOEXEC);
|
||||||
|
if (ufd >= 0) {
|
||||||
|
uint64_t rnd = 0;
|
||||||
|
if (::read(ufd, &rnd, sizeof(rnd)) == static_cast<ssize_t>(sizeof(rnd))) {
|
||||||
|
sessionSalt_ ^= rnd;
|
||||||
|
}
|
||||||
|
::close(ufd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void clearSessionCache() {
|
||||||
|
hasVerifiedNormal_ = false;
|
||||||
|
verifiedNormalLen_ = 0;
|
||||||
|
verifiedNormalDigest_ = 0;
|
||||||
|
hasVerifiedDuress_ = false;
|
||||||
|
verifiedDuressLen_ = 0;
|
||||||
|
verifiedDuressDigest_ = 0;
|
||||||
|
}
|
||||||
|
|
||||||
void forceRefresh() {
|
void forceRefresh() {
|
||||||
shadowMtime_ = 0;
|
shadowMtime_ = 0;
|
||||||
shadowSize_ = 0;
|
shadowSize_ = 0;
|
||||||
duressMtime_ = -1;
|
duressMtime_ = -1;
|
||||||
cachedHash_.clear();
|
cachedHash_.clear();
|
||||||
cachedDuressHash_.clear();
|
cachedDuressHash_.clear();
|
||||||
|
clearSessionCache();
|
||||||
refreshIfNeeded();
|
refreshIfNeeded();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -202,6 +228,7 @@ class PasscodeVerifier {
|
|||||||
shadowSize_ = st.st_size;
|
shadowSize_ = st.st_size;
|
||||||
duressMtime_ = curDuressMtime;
|
duressMtime_ = curDuressMtime;
|
||||||
}
|
}
|
||||||
|
clearSessionCache();
|
||||||
int pipefd[2];
|
int pipefd[2];
|
||||||
if (::pipe(pipefd) != 0) {
|
if (::pipe(pipefd) != 0) {
|
||||||
return;
|
return;
|
||||||
@@ -258,19 +285,57 @@ class PasscodeVerifier {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
VerifyResult verify(const std::string& candidate) {
|
VerifyResult verifyFast(const std::string& candidate) {
|
||||||
if (candidate.empty()) {
|
if (candidate.empty()) {
|
||||||
return VerifyResult::Invalid;
|
return VerifyResult::Invalid;
|
||||||
}
|
}
|
||||||
refreshIfNeeded();
|
refreshIfNeeded();
|
||||||
|
uint64_t dig = computeSessionDigest(candidate);
|
||||||
|
if (hasVerifiedNormal_ && candidate.size() == verifiedNormalLen_ &&
|
||||||
|
dig == verifiedNormalDigest_) {
|
||||||
|
return VerifyResult::NormalUser;
|
||||||
|
}
|
||||||
|
if (hasVerifiedDuress_ && candidate.size() == verifiedDuressLen_ &&
|
||||||
|
dig == verifiedDuressDigest_) {
|
||||||
|
return VerifyResult::DuressUser;
|
||||||
|
}
|
||||||
|
return VerifyResult::Invalid;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool canSkipAutoVerifyLength(size_t len) const {
|
||||||
|
if (hasVerifiedNormal_ && cachedDuressHash_.empty()) {
|
||||||
|
return len != verifiedNormalLen_;
|
||||||
|
}
|
||||||
|
if (hasVerifiedNormal_ && hasVerifiedDuress_) {
|
||||||
|
return len != verifiedNormalLen_ && len != verifiedDuressLen_;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
VerifyResult verify(const std::string& candidate) {
|
||||||
|
if (candidate.empty()) {
|
||||||
|
return VerifyResult::Invalid;
|
||||||
|
}
|
||||||
|
VerifyResult fast = verifyFast(candidate);
|
||||||
|
if (fast != VerifyResult::Invalid) {
|
||||||
|
return fast;
|
||||||
|
}
|
||||||
|
writeSysfsStr("/sys/devices/system/cpu/cpufreq/policy0/scaling_governor",
|
||||||
|
"schedutil");
|
||||||
if (!cachedHash_.empty()) {
|
if (!cachedHash_.empty()) {
|
||||||
char* res = ::crypt(candidate.c_str(), cachedHash_.c_str());
|
char* res = ::crypt(candidate.c_str(), cachedHash_.c_str());
|
||||||
if (res && constantTimeEq(res, cachedHash_)) {
|
if (res && constantTimeEq(res, cachedHash_)) {
|
||||||
|
hasVerifiedNormal_ = true;
|
||||||
|
verifiedNormalLen_ = candidate.size();
|
||||||
|
verifiedNormalDigest_ = computeSessionDigest(candidate);
|
||||||
return VerifyResult::NormalUser;
|
return VerifyResult::NormalUser;
|
||||||
}
|
}
|
||||||
if (!cachedDuressHash_.empty()) {
|
if (!cachedDuressHash_.empty()) {
|
||||||
char* dres = ::crypt(candidate.c_str(), cachedDuressHash_.c_str());
|
char* dres = ::crypt(candidate.c_str(), cachedDuressHash_.c_str());
|
||||||
if (dres && constantTimeEq(dres, cachedDuressHash_)) {
|
if (dres && constantTimeEq(dres, cachedDuressHash_)) {
|
||||||
|
hasVerifiedDuress_ = true;
|
||||||
|
verifiedDuressLen_ = candidate.size();
|
||||||
|
verifiedDuressDigest_ = computeSessionDigest(candidate);
|
||||||
return VerifyResult::DuressUser;
|
return VerifyResult::DuressUser;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -309,9 +374,15 @@ class PasscodeVerifier {
|
|||||||
if (pid > 0 && ::waitpid(pid, &status, 0) > 0 && WIFEXITED(status)) {
|
if (pid > 0 && ::waitpid(pid, &status, 0) > 0 && WIFEXITED(status)) {
|
||||||
int code = WEXITSTATUS(status);
|
int code = WEXITSTATUS(status);
|
||||||
if (code == 0) {
|
if (code == 0) {
|
||||||
|
hasVerifiedNormal_ = true;
|
||||||
|
verifiedNormalLen_ = candidate.size();
|
||||||
|
verifiedNormalDigest_ = computeSessionDigest(candidate);
|
||||||
return VerifyResult::NormalUser;
|
return VerifyResult::NormalUser;
|
||||||
}
|
}
|
||||||
if (code == 10) {
|
if (code == 10) {
|
||||||
|
hasVerifiedDuress_ = true;
|
||||||
|
verifiedDuressLen_ = candidate.size();
|
||||||
|
verifiedDuressDigest_ = computeSessionDigest(candidate);
|
||||||
return VerifyResult::DuressUser;
|
return VerifyResult::DuressUser;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -319,11 +390,31 @@ class PasscodeVerifier {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
uint64_t computeSessionDigest(const std::string& s) const {
|
||||||
|
uint64_t h = 0xcbf29ce484222325ULL ^ sessionSalt_;
|
||||||
|
for (unsigned char c : s) {
|
||||||
|
h ^= static_cast<uint64_t>(c);
|
||||||
|
h *= 0x100000001b3ULL;
|
||||||
|
h ^= (h >> 32);
|
||||||
|
}
|
||||||
|
h ^= static_cast<uint64_t>(s.size()) * 0x9e3779b97f4a7c15ULL;
|
||||||
|
h = (h ^ (h >> 30)) * 0xbf58476d1ce4e5b9ULL;
|
||||||
|
h = (h ^ (h >> 27)) * 0x94d049bb133111ebULL;
|
||||||
|
return h ^ (h >> 31);
|
||||||
|
}
|
||||||
|
|
||||||
std::string cachedHash_;
|
std::string cachedHash_;
|
||||||
std::string cachedDuressHash_;
|
std::string cachedDuressHash_;
|
||||||
time_t shadowMtime_ = 0;
|
time_t shadowMtime_ = 0;
|
||||||
off_t shadowSize_ = 0;
|
off_t shadowSize_ = 0;
|
||||||
time_t duressMtime_ = -1;
|
time_t duressMtime_ = -1;
|
||||||
|
uint64_t sessionSalt_ = 0;
|
||||||
|
bool hasVerifiedNormal_ = false;
|
||||||
|
size_t verifiedNormalLen_ = 0;
|
||||||
|
uint64_t verifiedNormalDigest_ = 0;
|
||||||
|
bool hasVerifiedDuress_ = false;
|
||||||
|
size_t verifiedDuressLen_ = 0;
|
||||||
|
uint64_t verifiedDuressDigest_ = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
int countNotifFiles() {
|
int countNotifFiles() {
|
||||||
@@ -436,6 +527,7 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
constexpr int64_t kLockerIdleBlankMs = 30000;
|
constexpr int64_t kLockerIdleBlankMs = 30000;
|
||||||
bool visible = false;
|
bool visible = false;
|
||||||
bool grabHeld = false;
|
bool grabHeld = false;
|
||||||
|
bool wasScreenBlanked = isScreenBlanked();
|
||||||
std::string passcode;
|
std::string passcode;
|
||||||
std::string statusMsg;
|
std::string statusMsg;
|
||||||
bool statusIsError = false;
|
bool statusIsError = false;
|
||||||
@@ -444,8 +536,37 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
int64_t statusClearAtMs = 0;
|
int64_t statusClearAtMs = 0;
|
||||||
int64_t lockActivatedMs = 0;
|
int64_t lockActivatedMs = 0;
|
||||||
int64_t lastActivityMs = 0;
|
int64_t lastActivityMs = 0;
|
||||||
|
int64_t autoVerifyAtMs = 0;
|
||||||
int lastRenderedMin = -1;
|
int lastRenderedMin = -1;
|
||||||
|
|
||||||
|
int cachedPctVal = -1;
|
||||||
|
bool cachedIsCharging = false;
|
||||||
|
int cachedNotifCount = 0;
|
||||||
|
int64_t lastStatusPollMs = 0;
|
||||||
|
|
||||||
|
auto refreshStatusCache = [&](bool force) {
|
||||||
|
int64_t now = nowMs();
|
||||||
|
if (!force && lastStatusPollMs > 0 && (now - lastStatusPollMs) < 10000) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
lastStatusPollMs = now;
|
||||||
|
std::string cap = readSmallFileTrimmed("/sys/class/power_supply/pm8916-bms-vm/capacity");
|
||||||
|
if (cap.empty()) {
|
||||||
|
cap = readSmallFileTrimmed("/sys/class/power_supply/battery/capacity");
|
||||||
|
}
|
||||||
|
std::string batStatus = readSmallFileTrimmed("/sys/class/power_supply/pm8916-bms-vm/status");
|
||||||
|
if (batStatus.empty()) {
|
||||||
|
batStatus = readSmallFileTrimmed("/sys/class/power_supply/battery/status");
|
||||||
|
}
|
||||||
|
std::string chgrOnline = readSmallFileTrimmed("/sys/class/power_supply/pm8916-lbc-chgr/online");
|
||||||
|
cachedPctVal = cap.empty() ? -1 : std::clamp(std::atoi(cap.c_str()), 0, 100);
|
||||||
|
cachedIsCharging = (batStatus == "Charging" || batStatus == "Full" || chgrOnline == "1");
|
||||||
|
if (chgrOnline == "0") {
|
||||||
|
cachedIsCharging = false;
|
||||||
|
}
|
||||||
|
cachedNotifCount = countNotifFiles();
|
||||||
|
};
|
||||||
|
|
||||||
auto isCallScreenVisible = [&]() -> bool {
|
auto isCallScreenVisible = [&]() -> bool {
|
||||||
return isPidFileAlive(getRuntimeFile("xcallscreen.pid"));
|
return isPidFileAlive(getRuntimeFile("xcallscreen.pid"));
|
||||||
};
|
};
|
||||||
@@ -458,13 +579,13 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
|
XSetInputFocus(dpy, win, RevertToParent, CurrentTime);
|
||||||
XFlush(dpy);
|
XFlush(dpy);
|
||||||
grabHeld = false;
|
grabHeld = false;
|
||||||
for (int attempt = 0; attempt < 15; ++attempt) {
|
for (int attempt = 0; attempt < 3; ++attempt) {
|
||||||
if (XGrabKeyboard(dpy, win, True, GrabModeAsync, GrabModeAsync,
|
if (XGrabKeyboard(dpy, win, True, GrabModeAsync, GrabModeAsync,
|
||||||
CurrentTime) == GrabSuccess) {
|
CurrentTime) == GrabSuccess) {
|
||||||
grabHeld = true;
|
grabHeld = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
::usleep(10000);
|
::usleep(3000);
|
||||||
}
|
}
|
||||||
XGrabPointer(dpy, win, True, ButtonPressMask | ButtonReleaseMask,
|
XGrabPointer(dpy, win, True, ButtonPressMask | ButtonReleaseMask,
|
||||||
GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
|
GrabModeAsync, GrabModeAsync, None, None, CurrentTime);
|
||||||
@@ -499,6 +620,8 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
statusClearAtMs = 0;
|
statusClearAtMs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
refreshStatusCache(false);
|
||||||
|
|
||||||
// Background fill
|
// Background fill
|
||||||
XSetForeground(dpy, gc, theme.spec.bgMain);
|
XSetForeground(dpy, gc, theme.spec.bgMain);
|
||||||
XFillRectangle(dpy, pix, gc, 0, 0, kScreenWidth, kScreenHeight);
|
XFillRectangle(dpy, pix, gc, 0, 0, kScreenWidth, kScreenHeight);
|
||||||
@@ -512,20 +635,8 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
neo.drawPango(layoutIcon, &theme.colYellow, 8, 0, 24, kIconLock);
|
neo.drawPango(layoutIcon, &theme.colYellow, 8, 0, 24, kIconLock);
|
||||||
neo.drawPango(layoutSmall, &theme.colLight, 26, 0, 24, "Locked");
|
neo.drawPango(layoutSmall, &theme.colLight, 26, 0, 24, "Locked");
|
||||||
|
|
||||||
std::string cap = readSmallFileTrimmed("/sys/class/power_supply/pm8916-bms-vm/capacity");
|
int pctVal = cachedPctVal;
|
||||||
if (cap.empty()) {
|
bool isCharging = cachedIsCharging;
|
||||||
cap = readSmallFileTrimmed("/sys/class/power_supply/battery/capacity");
|
|
||||||
}
|
|
||||||
std::string batStatus = readSmallFileTrimmed("/sys/class/power_supply/pm8916-bms-vm/status");
|
|
||||||
if (batStatus.empty()) {
|
|
||||||
batStatus = readSmallFileTrimmed("/sys/class/power_supply/battery/status");
|
|
||||||
}
|
|
||||||
std::string chgrOnline = readSmallFileTrimmed("/sys/class/power_supply/pm8916-lbc-chgr/online");
|
|
||||||
int pctVal = cap.empty() ? -1 : std::clamp(std::atoi(cap.c_str()), 0, 100);
|
|
||||||
bool isCharging = (batStatus == "Charging" || batStatus == "Full" || chgrOnline == "1");
|
|
||||||
if (chgrOnline == "0") {
|
|
||||||
isCharging = false;
|
|
||||||
}
|
|
||||||
if (pctVal >= 0) {
|
if (pctVal >= 0) {
|
||||||
std::string batText = std::string(pickBatteryIcon(pctVal, isCharging)) +
|
std::string batText = std::string(pickBatteryIcon(pctVal, isCharging)) +
|
||||||
" " + std::to_string(pctVal) + "%";
|
" " + std::to_string(pctVal) + "%";
|
||||||
@@ -557,7 +668,7 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
kScreenWidth, 1);
|
kScreenWidth, 1);
|
||||||
|
|
||||||
// Notification badge (count only, no private content exposed on lockscreen)
|
// Notification badge (count only, no private content exposed on lockscreen)
|
||||||
int notifCount = countNotifFiles();
|
int notifCount = cachedNotifCount;
|
||||||
if (notifCount > 0) {
|
if (notifCount > 0) {
|
||||||
std::string nstr = std::string(kIconBell) + " " +
|
std::string nstr = std::string(kIconBell) + " " +
|
||||||
std::to_string(notifCount) +
|
std::to_string(notifCount) +
|
||||||
@@ -642,9 +753,6 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
passcode.empty() ? "Sleep" : "Clear",
|
passcode.empty() ? "Sleep" : "Clear",
|
||||||
&theme.colYellow);
|
&theme.colYellow);
|
||||||
|
|
||||||
if (!grabHeld && !isCallScreenVisible()) {
|
|
||||||
grabLockerInput();
|
|
||||||
}
|
|
||||||
neo.present();
|
neo.present();
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -664,6 +772,7 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
statusIsError = false;
|
statusIsError = false;
|
||||||
failedAttempts = 0;
|
failedAttempts = 0;
|
||||||
cooldownUntilMs = 0;
|
cooldownUntilMs = 0;
|
||||||
|
autoVerifyAtMs = 0;
|
||||||
::unlink(kLockFlagPath);
|
::unlink(kLockFlagPath);
|
||||||
::unlink(activePidPath.c_str());
|
::unlink(activePidPath.c_str());
|
||||||
releaseLockerGrab();
|
releaseLockerGrab();
|
||||||
@@ -675,6 +784,7 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
writeSoftkeySuppress(nowMs() + 350);
|
writeSoftkeySuppress(nowMs() + 350);
|
||||||
setSxmoStateFile("unlock");
|
setSxmoStateFile("unlock");
|
||||||
wakeScreenBacklight();
|
wakeScreenBacklight();
|
||||||
|
wasScreenBlanked = false;
|
||||||
runAsyncCmd("sxmo_hook_unlock.sh >/dev/null 2>&1");
|
runAsyncCmd("sxmo_hook_unlock.sh >/dev/null 2>&1");
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -693,6 +803,7 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
verifier.refreshIfNeeded();
|
verifier.refreshIfNeeded();
|
||||||
int64_t now = nowMs();
|
int64_t now = nowMs();
|
||||||
lastActivityMs = now;
|
lastActivityMs = now;
|
||||||
|
autoVerifyAtMs = 0;
|
||||||
if (!alreadyVisible || blankDisplay) {
|
if (!alreadyVisible || blankDisplay) {
|
||||||
passcode.clear();
|
passcode.clear();
|
||||||
statusMsg.clear();
|
statusMsg.clear();
|
||||||
@@ -709,14 +820,18 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
if (blankDisplay) {
|
if (blankDisplay) {
|
||||||
setSxmoStateFile("screenoff");
|
setSxmoStateFile("screenoff");
|
||||||
blankScreenBacklight();
|
blankScreenBacklight();
|
||||||
|
wasScreenBlanked = true;
|
||||||
} else {
|
} else {
|
||||||
setSxmoStateFile("lock");
|
setSxmoStateFile("lock");
|
||||||
wakeScreenBacklight();
|
wakeScreenBacklight();
|
||||||
|
wasScreenBlanked = false;
|
||||||
|
refreshStatusCache(true);
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
auto submitPasscode = [&](bool explicitSubmit) {
|
auto submitPasscode = [&](bool explicitSubmit) {
|
||||||
|
autoVerifyAtMs = 0;
|
||||||
int64_t now = nowMs();
|
int64_t now = nowMs();
|
||||||
if (cooldownUntilMs > now) {
|
if (cooldownUntilMs > now) {
|
||||||
render();
|
render();
|
||||||
@@ -757,6 +872,119 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
auto handleKeyInput = [&](unsigned int kc, unsigned int state, KeySym sym) {
|
||||||
|
if (!visible) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
int64_t now = nowMs();
|
||||||
|
lastActivityMs = now;
|
||||||
|
if (isScreenBlanked()) {
|
||||||
|
setSxmoStateFile("lock");
|
||||||
|
wakeScreenBacklight();
|
||||||
|
wasScreenBlanked = false;
|
||||||
|
lockActivatedMs = now;
|
||||||
|
refreshStatusCache(true);
|
||||||
|
render();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (now - lockActivatedMs < 80) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Power / End Call / Sleep button blanks the screen while remaining locked
|
||||||
|
if (kc == 124 || sym == XF86XK_PowerOff || sym == XF86XK_Sleep ||
|
||||||
|
sym == XF86XK_Standby || sym == XF86XK_Suspend ||
|
||||||
|
sym == XF86XK_HangupPhone || sym == XK_Cancel ||
|
||||||
|
sym == _EVDEVK(0x74) || sym == _EVDEVK(0x8e) ||
|
||||||
|
sym == XK_Escape) {
|
||||||
|
if (isCallActiveOrRingingFast() || isCallScreenVisible()) {
|
||||||
|
sendPluginCommand("callscreen", "HANGUP_CLOSE");
|
||||||
|
::unlink("/tmp/sxmo_call_ringing");
|
||||||
|
::unlink("/tmp/sxmo_active_call");
|
||||||
|
runAsyncArgv("sxmo_modemcall.sh", "hangup", "all");
|
||||||
|
}
|
||||||
|
passcode.clear();
|
||||||
|
statusMsg.clear();
|
||||||
|
statusIsError = false;
|
||||||
|
autoVerifyAtMs = 0;
|
||||||
|
setSxmoStateFile("screenoff");
|
||||||
|
blankScreenBacklight();
|
||||||
|
wasScreenBlanked = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Left softkey: explicit Unlock attempt
|
||||||
|
if (isLeftSoftkey(sym, kc)) {
|
||||||
|
submitPasscode(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Right softkey: Clear last digit, or blank screen if empty
|
||||||
|
if (isRightSoftkey(sym, kc)) {
|
||||||
|
autoVerifyAtMs = 0;
|
||||||
|
if (!passcode.empty()) {
|
||||||
|
passcode.pop_back();
|
||||||
|
render();
|
||||||
|
} else {
|
||||||
|
setSxmoStateFile("screenoff");
|
||||||
|
blankScreenBacklight();
|
||||||
|
wasScreenBlanked = true;
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Backspace / Left arrow: delete last digit
|
||||||
|
if (sym == XK_BackSpace || sym == XK_Delete ||
|
||||||
|
sym == XK_Left || sym == XK_KP_Left) {
|
||||||
|
autoVerifyAtMs = 0;
|
||||||
|
if (!passcode.empty()) {
|
||||||
|
passcode.pop_back();
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enter / Center OK / Call / Pound (#): explicit Unlock attempt
|
||||||
|
if (sym == XK_Return || sym == XK_KP_Enter ||
|
||||||
|
sym == XF86XK_Phone || sym == XF86XK_PickupPhone ||
|
||||||
|
sym == XF86XK_Send || isPoundKey(sym, kc)) {
|
||||||
|
submitPasscode(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Numeric digits 0-9
|
||||||
|
char ch = mapDialKey(sym, kc, state);
|
||||||
|
if (ch >= '0' && ch <= '9') {
|
||||||
|
if (cooldownUntilMs > now) {
|
||||||
|
render();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (passcode.size() < 32) {
|
||||||
|
passcode.push_back(ch);
|
||||||
|
statusMsg.clear();
|
||||||
|
statusIsError = false;
|
||||||
|
render();
|
||||||
|
if (passcode.size() >= 4) {
|
||||||
|
VerifyResult fastRes = verifier.verifyFast(passcode);
|
||||||
|
if (fastRes == VerifyResult::NormalUser ||
|
||||||
|
fastRes == VerifyResult::DuressUser) {
|
||||||
|
autoVerifyAtMs = 0;
|
||||||
|
unlockPhone(fastRes == VerifyResult::DuressUser);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!verifier.canSkipAutoVerifyLength(passcode.size())) {
|
||||||
|
autoVerifyAtMs = nowMs() + 220;
|
||||||
|
} else {
|
||||||
|
autoVerifyAtMs = 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
autoVerifyAtMs = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
if (!isPreload) {
|
if (!isPreload) {
|
||||||
lockPhone(initCmd == "LOCK_BLANK");
|
lockPhone(initCmd == "LOCK_BLANK");
|
||||||
} else if (::access(kLockFlagPath, F_OK) == 0) {
|
} else if (::access(kLockFlagPath, F_OK) == 0) {
|
||||||
@@ -767,6 +995,16 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
bool callWasActive = false;
|
bool callWasActive = false;
|
||||||
|
|
||||||
while (gRunning) {
|
while (gRunning) {
|
||||||
|
bool blankNow = isScreenBlanked();
|
||||||
|
if (wasScreenBlanked && !blankNow) {
|
||||||
|
wasScreenBlanked = false;
|
||||||
|
int64_t now = nowMs();
|
||||||
|
lastActivityMs = now;
|
||||||
|
refreshStatusCache(true);
|
||||||
|
} else if (blankNow) {
|
||||||
|
wasScreenBlanked = true;
|
||||||
|
}
|
||||||
|
|
||||||
if (fifoFd >= 0) {
|
if (fifoFd >= 0) {
|
||||||
for (const std::string& cmd : readFifoLines(fifoFd)) {
|
for (const std::string& cmd : readFifoLines(fifoFd)) {
|
||||||
if (cmd == "NOP") {
|
if (cmd == "NOP") {
|
||||||
@@ -801,16 +1039,37 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
if (!visible) {
|
if (!visible) {
|
||||||
lockPhone(false);
|
lockPhone(false);
|
||||||
} else {
|
} else {
|
||||||
closeOtherOverlays();
|
bool wasBlank = wasScreenBlanked || isScreenBlanked();
|
||||||
|
if (wasBlank) {
|
||||||
|
closeOtherOverlays();
|
||||||
|
}
|
||||||
setSxmoStateFile("lock");
|
setSxmoStateFile("lock");
|
||||||
wakeScreenBacklight();
|
wakeScreenBacklight();
|
||||||
|
wasScreenBlanked = false;
|
||||||
lastActivityMs = nowMs();
|
lastActivityMs = nowMs();
|
||||||
grabLockerInput();
|
if (wasBlank) {
|
||||||
|
refreshStatusCache(true);
|
||||||
|
}
|
||||||
|
if (!grabHeld) {
|
||||||
|
grabLockerInput();
|
||||||
|
}
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
if (cmd.rfind("KEY ", 0) == 0) {
|
||||||
|
unsigned int kc = 0;
|
||||||
|
unsigned int st = 0;
|
||||||
|
if (std::sscanf(cmd.c_str() + 4, "%u %u", &kc, &st) >= 1 && kc > 0) {
|
||||||
|
if (!grabHeld && visible && !isCallScreenVisible()) {
|
||||||
|
grabLockerInput();
|
||||||
|
}
|
||||||
|
KeySym sym = XKeycodeToKeysym(dpy, static_cast<KeyCode>(kc), 0);
|
||||||
|
handleKeyInput(kc, st, sym);
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
if (cmd.rfind("VERIFY ", 0) == 0) {
|
if (cmd.rfind("VERIFY ", 0) == 0) {
|
||||||
std::string code = trimStr(cmd.substr(7));
|
std::string code = trimStr(cmd.substr(7));
|
||||||
VerifyResult vres =
|
VerifyResult vres =
|
||||||
@@ -852,7 +1111,7 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
} else if (!callNow && callWasActive) {
|
} else if (!callNow && callWasActive) {
|
||||||
grabLockerInput();
|
grabLockerInput();
|
||||||
render();
|
render();
|
||||||
} else if (!callNow && !grabHeld) {
|
} else if (!callNow && !grabHeld && !isScreenBlanked()) {
|
||||||
grabLockerInput();
|
grabLockerInput();
|
||||||
}
|
}
|
||||||
callWasActive = callNow;
|
callWasActive = callNow;
|
||||||
@@ -862,112 +1121,46 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
XEvent ev;
|
XEvent ev;
|
||||||
XNextEvent(dpy, &ev);
|
XNextEvent(dpy, &ev);
|
||||||
if (ev.type == Expose) {
|
if (ev.type == Expose) {
|
||||||
if (visible && ev.xexpose.count == 0) {
|
if (visible && ev.xexpose.count == 0 && !isScreenBlanked()) {
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
} else if (ev.type == VisibilityNotify || ev.type == FocusOut ||
|
} else if (ev.type == UnmapNotify) {
|
||||||
ev.type == UnmapNotify) {
|
|
||||||
if (visible && ::access(kLockFlagPath, F_OK) == 0 &&
|
if (visible && ::access(kLockFlagPath, F_OK) == 0 &&
|
||||||
!isCallScreenVisible()) {
|
!isCallScreenVisible()) {
|
||||||
if (ev.type == UnmapNotify) {
|
XMapRaised(dpy, win);
|
||||||
XMapRaised(dpy, win);
|
|
||||||
}
|
|
||||||
grabLockerInput();
|
grabLockerInput();
|
||||||
|
if (!isScreenBlanked()) {
|
||||||
|
render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (ev.type == VisibilityNotify) {
|
||||||
|
if (visible && ev.xvisibility.state != VisibilityUnobscured &&
|
||||||
|
::access(kLockFlagPath, F_OK) == 0 && !isCallScreenVisible() &&
|
||||||
|
!isScreenBlanked()) {
|
||||||
|
XRaiseWindow(dpy, win);
|
||||||
|
if (!grabHeld) {
|
||||||
|
grabLockerInput();
|
||||||
|
}
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
|
} else if (ev.type == FocusOut) {
|
||||||
|
if (visible && ::access(kLockFlagPath, F_OK) == 0 &&
|
||||||
|
!isCallScreenVisible() && !isScreenBlanked() &&
|
||||||
|
ev.xfocus.mode == NotifyNormal) {
|
||||||
|
grabLockerInput();
|
||||||
|
}
|
||||||
} else if (ev.type == KeyPress) {
|
} else if (ev.type == KeyPress) {
|
||||||
if (!visible) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
int64_t now = nowMs();
|
|
||||||
lastActivityMs = now;
|
|
||||||
if (isScreenBlanked()) {
|
|
||||||
setSxmoStateFile("lock");
|
|
||||||
wakeScreenBacklight();
|
|
||||||
lockActivatedMs = now;
|
|
||||||
render();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (now - lockActivatedMs < 180) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
unsigned int kc = ev.xkey.keycode;
|
|
||||||
KeySym sym = XLookupKeysym(&ev.xkey, 0);
|
KeySym sym = XLookupKeysym(&ev.xkey, 0);
|
||||||
|
handleKeyInput(ev.xkey.keycode, ev.xkey.state, sym);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Power / End Call / Sleep button blanks the screen while remaining locked
|
if (visible && autoVerifyAtMs > 0 && !isScreenBlanked()) {
|
||||||
if (kc == 124 || sym == XF86XK_PowerOff || sym == XF86XK_Sleep ||
|
int64_t now = nowMs();
|
||||||
sym == XF86XK_Standby || sym == XF86XK_Suspend ||
|
if (now >= autoVerifyAtMs) {
|
||||||
sym == XF86XK_HangupPhone || sym == XK_Cancel ||
|
autoVerifyAtMs = 0;
|
||||||
sym == _EVDEVK(0x74) || sym == _EVDEVK(0x8e) ||
|
if (passcode.size() >= 4) {
|
||||||
sym == XK_Escape) {
|
submitPasscode(false);
|
||||||
if (isCallActiveOrRingingFast() || isCallScreenVisible()) {
|
|
||||||
sendPluginCommand("callscreen", "HANGUP_CLOSE");
|
|
||||||
::unlink("/tmp/sxmo_call_ringing");
|
|
||||||
::unlink("/tmp/sxmo_active_call");
|
|
||||||
runAsyncArgv("sxmo_modemcall.sh", "hangup", "all");
|
|
||||||
}
|
|
||||||
passcode.clear();
|
|
||||||
statusMsg.clear();
|
|
||||||
statusIsError = false;
|
|
||||||
setSxmoStateFile("screenoff");
|
|
||||||
blankScreenBacklight();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Left softkey: explicit Unlock attempt
|
|
||||||
if (isLeftSoftkey(sym, kc)) {
|
|
||||||
submitPasscode(true);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Right softkey: Clear last digit, or blank screen if empty
|
|
||||||
if (isRightSoftkey(sym, kc)) {
|
|
||||||
if (!passcode.empty()) {
|
|
||||||
passcode.pop_back();
|
|
||||||
render();
|
|
||||||
} else {
|
|
||||||
setSxmoStateFile("screenoff");
|
|
||||||
blankScreenBacklight();
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Backspace / Left arrow: delete last digit
|
|
||||||
if (sym == XK_BackSpace || sym == XK_Delete ||
|
|
||||||
sym == XK_Left || sym == XK_KP_Left) {
|
|
||||||
if (!passcode.empty()) {
|
|
||||||
passcode.pop_back();
|
|
||||||
render();
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Enter / Center OK / Call / Pound (#): explicit Unlock attempt
|
|
||||||
if (sym == XK_Return || sym == XK_KP_Enter ||
|
|
||||||
sym == XF86XK_Phone || sym == XF86XK_PickupPhone ||
|
|
||||||
sym == XF86XK_Send || isPoundKey(sym, kc)) {
|
|
||||||
submitPasscode(true);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Numeric digits 0-9
|
|
||||||
char ch = mapDialKey(sym, kc, ev.xkey.state);
|
|
||||||
if (ch >= '0' && ch <= '9') {
|
|
||||||
if (cooldownUntilMs > now) {
|
|
||||||
render();
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (passcode.size() < 32) {
|
|
||||||
passcode.push_back(ch);
|
|
||||||
statusMsg.clear();
|
|
||||||
statusIsError = false;
|
|
||||||
render();
|
|
||||||
if (passcode.size() >= 4) {
|
|
||||||
submitPasscode(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -981,8 +1174,10 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
passcode.clear();
|
passcode.clear();
|
||||||
statusMsg.clear();
|
statusMsg.clear();
|
||||||
statusIsError = false;
|
statusIsError = false;
|
||||||
|
autoVerifyAtMs = 0;
|
||||||
setSxmoStateFile("screenoff");
|
setSxmoStateFile("screenoff");
|
||||||
blankScreenBacklight();
|
blankScreenBacklight();
|
||||||
|
wasScreenBlanked = true;
|
||||||
} else {
|
} else {
|
||||||
if (!isCallScreenVisible() && !grabHeld) {
|
if (!isCallScreenVisible() && !grabHeld) {
|
||||||
grabLockerInput();
|
grabLockerInput();
|
||||||
@@ -993,6 +1188,9 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
int curMin = tmNow.tm_hour * 60 + tmNow.tm_min;
|
int curMin = tmNow.tm_hour * 60 + tmNow.tm_min;
|
||||||
if (curMin != lastRenderedMin || cooldownUntilMs > now ||
|
if (curMin != lastRenderedMin || cooldownUntilMs > now ||
|
||||||
(statusClearAtMs > 0 && now >= statusClearAtMs)) {
|
(statusClearAtMs > 0 && now >= statusClearAtMs)) {
|
||||||
|
if (curMin != lastRenderedMin) {
|
||||||
|
refreshStatusCache(true);
|
||||||
|
}
|
||||||
render();
|
render();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1019,6 +1217,12 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
if (idleRemMs < timeoutMs) {
|
if (idleRemMs < timeoutMs) {
|
||||||
timeoutMs = static_cast<int>(idleRemMs);
|
timeoutMs = static_cast<int>(idleRemMs);
|
||||||
}
|
}
|
||||||
|
if (autoVerifyAtMs > 0) {
|
||||||
|
int64_t autoRem = std::max<int64_t>(10, autoVerifyAtMs - now);
|
||||||
|
if (autoRem < timeoutMs) {
|
||||||
|
timeoutMs = static_cast<int>(autoRem);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct pollfd pfds[2] {};
|
struct pollfd pfds[2] {};
|
||||||
@@ -1026,7 +1230,13 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
pfds[0].events = POLLIN;
|
pfds[0].events = POLLIN;
|
||||||
pfds[1].fd = fifoFd;
|
pfds[1].fd = fifoFd;
|
||||||
pfds[1].events = POLLIN;
|
pfds[1].events = POLLIN;
|
||||||
::poll(pfds, (fifoFd >= 0) ? 2 : 1, timeoutMs);
|
int pr = ::poll(pfds, (fifoFd >= 0) ? 2 : 1, timeoutMs);
|
||||||
|
if (pr < 0 && errno != EINTR) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (pfds[0].revents & (POLLHUP | POLLERR | POLLNVAL)) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
g_object_unref(layoutClock);
|
g_object_unref(layoutClock);
|
||||||
|
|||||||
+12
-3
@@ -1267,6 +1267,9 @@ handle_builtin_toggle(const char *toggle_name)
|
|||||||
close(fd);
|
close(fd);
|
||||||
}
|
}
|
||||||
spawn_detached_sh("sxmo_hook_statusbar.sh audio");
|
spawn_detached_sh("sxmo_hook_statusbar.sh audio");
|
||||||
|
} else if (strcmp(toggle_name, "ext_logging") == 0) {
|
||||||
|
int rc = system("doas -n /usr/bin/bananarchy-engmenu-ctl logging toggle >/dev/null 2>&1 || /usr/bin/bananarchy-engmenu-ctl logging toggle >/dev/null 2>&1");
|
||||||
|
(void)rc;
|
||||||
} else if (strcmp(toggle_name, "notif_clear_all") == 0) {
|
} else if (strcmp(toggle_name, "notif_clear_all") == 0) {
|
||||||
clear_all_notifications_now();
|
clear_all_notifications_now();
|
||||||
}
|
}
|
||||||
@@ -2888,11 +2891,17 @@ open_builtin_menu(const char *menu_name, int keep_idx)
|
|||||||
add_menu_item(label, "@menu:timezone", 1);
|
add_menu_item(label, "@menu:timezone", 1);
|
||||||
|
|
||||||
if (!duress) {
|
if (!duress) {
|
||||||
|
int ext_log_on = (access("/tmp/bananarchy_ext_logging", F_OK) == 0 ||
|
||||||
|
access("/etc/bananarchy/ext_logging", F_OK) == 0);
|
||||||
|
snprintf(label, sizeof(label), "%s Extended Logging %s", ICON_INF,
|
||||||
|
ext_log_on ? ICON_TON : ICON_TOF);
|
||||||
|
add_menu_item(label, "@toggle:ext_logging", 1);
|
||||||
snprintf(label, sizeof(label), "%s Hooks", ICON_TRM);
|
snprintf(label, sizeof(label), "%s Hooks", ICON_TRM);
|
||||||
add_menu_item(label, "sxmo_hookmenu.sh", 0);
|
add_menu_item(label, "sxmo_hookmenu.sh", 0);
|
||||||
snprintf(label, sizeof(label), "%s Log", ICON_INF);
|
if (ext_log_on) {
|
||||||
snprintf(cmd, sizeof(cmd), "sxmo_terminal.sh tail -n 100 -f %s/sxmo.log", home);
|
snprintf(label, sizeof(label), "%s Log", ICON_INF);
|
||||||
add_menu_item(label, cmd, 0);
|
add_menu_item(label, "sxmo_terminal.sh tail -n 100 -f /tmp/sxmo.log", 0);
|
||||||
|
}
|
||||||
snprintf(label, sizeof(label), "%s Version", ICON_INF);
|
snprintf(label, sizeof(label), "%s Version", ICON_INF);
|
||||||
add_menu_item(label, "sxmo_terminal.sh sxmo_version.sh --block", 0);
|
add_menu_item(label, "sxmo_terminal.sh sxmo_version.sh --block", 0);
|
||||||
}
|
}
|
||||||
|
|||||||
+163
-11
@@ -30,6 +30,7 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <sys/ioctl.h>
|
#include <sys/ioctl.h>
|
||||||
@@ -150,6 +151,7 @@ struct Monitor {
|
|||||||
Monitor *next;
|
Monitor *next;
|
||||||
Window barwin;
|
Window barwin;
|
||||||
Window softwin;
|
Window softwin;
|
||||||
|
Window clockwin;
|
||||||
const Layout *lt[2];
|
const Layout *lt[2];
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -341,6 +343,9 @@ static int starpound_pending = 0;
|
|||||||
static long long starpound_deadline_ms = 0;
|
static long long starpound_deadline_ms = 0;
|
||||||
static KeySym starpound_keysym = NoSymbol;
|
static KeySym starpound_keysym = NoSymbol;
|
||||||
static unsigned int starpound_keycode = 0;
|
static unsigned int starpound_keycode = 0;
|
||||||
|
static int lid_close_pending = 0;
|
||||||
|
static long long lid_close_deadline_ms = 0;
|
||||||
|
static int lid_close_fd = -1;
|
||||||
|
|
||||||
/* configuration, allows nested code to access above variables */
|
/* configuration, allows nested code to access above variables */
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@@ -805,6 +810,10 @@ cleanupmon(Monitor *mon)
|
|||||||
XUnmapWindow(dpy, mon->softwin);
|
XUnmapWindow(dpy, mon->softwin);
|
||||||
XDestroyWindow(dpy, mon->softwin);
|
XDestroyWindow(dpy, mon->softwin);
|
||||||
}
|
}
|
||||||
|
if (mon->clockwin) {
|
||||||
|
XUnmapWindow(dpy, mon->clockwin);
|
||||||
|
XDestroyWindow(dpy, mon->clockwin);
|
||||||
|
}
|
||||||
free(mon);
|
free(mon);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -853,7 +862,8 @@ clientmessage(XEvent *e)
|
|||||||
}
|
}
|
||||||
} else if (argval != 0 && (Window)argval != root &&
|
} else if (argval != 0 && (Window)argval != root &&
|
||||||
(!selmon || ((Window)argval != selmon->barwin &&
|
(!selmon || ((Window)argval != selmon->barwin &&
|
||||||
(Window)argval != selmon->softwin))) {
|
(Window)argval != selmon->softwin &&
|
||||||
|
(Window)argval != selmon->clockwin))) {
|
||||||
XGrabServer(dpy);
|
XGrabServer(dpy);
|
||||||
XSetErrorHandler(xerrordummy);
|
XSetErrorHandler(xerrordummy);
|
||||||
XSetCloseDownMode(dpy, DestroyAll);
|
XSetCloseDownMode(dpy, DestroyAll);
|
||||||
@@ -1154,6 +1164,76 @@ drawbar(Monitor *m)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (m->clockwin) {
|
||||||
|
XLowerWindow(dpy, m->clockwin);
|
||||||
|
XClearWindow(dpy, m->clockwin);
|
||||||
|
if (!m->sel) {
|
||||||
|
static XftFont *clk_font_big = NULL;
|
||||||
|
static XftFont *clk_font_small = NULL;
|
||||||
|
static XftColor clk_fg, clk_sh;
|
||||||
|
static int clk_colors_init = 0;
|
||||||
|
static char last_tzlink[256] = "";
|
||||||
|
char tzlink[256];
|
||||||
|
ssize_t tzlen;
|
||||||
|
|
||||||
|
if (!clk_font_big)
|
||||||
|
clk_font_big = XftFontOpenName(dpy, screen, "Fira Code:size=32:style=Regular");
|
||||||
|
if (!clk_font_small)
|
||||||
|
clk_font_small = XftFontOpenName(dpy, screen, "Fira Code:size=14:style=Regular");
|
||||||
|
if (!clk_colors_init) {
|
||||||
|
XRenderColor rfg = { 0xffff, 0xffff, 0xffff, 0xffff };
|
||||||
|
XRenderColor rsh = { 0x0000, 0x0000, 0x0000, 0xffff };
|
||||||
|
XftColorAllocValue(dpy, DefaultVisual(dpy, screen),
|
||||||
|
DefaultColormap(dpy, screen), &rfg, &clk_fg);
|
||||||
|
XftColorAllocValue(dpy, DefaultVisual(dpy, screen),
|
||||||
|
DefaultColormap(dpy, screen), &rsh, &clk_sh);
|
||||||
|
clk_colors_init = 1;
|
||||||
|
}
|
||||||
|
tzlen = readlink("/etc/localtime", tzlink, sizeof(tzlink) - 1);
|
||||||
|
if (tzlen > 0) {
|
||||||
|
tzlink[tzlen] = '\0';
|
||||||
|
if (strcmp(tzlink, last_tzlink) != 0) {
|
||||||
|
snprintf(last_tzlink, sizeof(last_tzlink), "%s", tzlink);
|
||||||
|
setenv("TZ", tzlink, 1);
|
||||||
|
tzset();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
XftDraw *cd = XftDrawCreate(dpy, m->clockwin,
|
||||||
|
DefaultVisual(dpy, screen), DefaultColormap(dpy, screen));
|
||||||
|
if (cd) {
|
||||||
|
time_t now = time(NULL);
|
||||||
|
struct tm lt;
|
||||||
|
char tbuf[32], dbuf[64];
|
||||||
|
XGlyphInfo ext;
|
||||||
|
|
||||||
|
localtime_r(&now, <);
|
||||||
|
strftime(tbuf, sizeof(tbuf), "%H:%M", <);
|
||||||
|
strftime(dbuf, sizeof(dbuf), "%a %d %b %Y", <);
|
||||||
|
|
||||||
|
if (clk_font_big) {
|
||||||
|
size_t tlen = strlen(tbuf);
|
||||||
|
XftTextExtentsUtf8(dpy, clk_font_big, (const FcChar8 *)tbuf, tlen, &ext);
|
||||||
|
int tx = (m->ww - ext.xOff) / 2;
|
||||||
|
int ty = 45;
|
||||||
|
XftDrawStringUtf8(cd, &clk_sh, clk_font_big, tx + 1, ty + 1,
|
||||||
|
(const FcChar8 *)tbuf, tlen);
|
||||||
|
XftDrawStringUtf8(cd, &clk_fg, clk_font_big, tx, ty,
|
||||||
|
(const FcChar8 *)tbuf, tlen);
|
||||||
|
}
|
||||||
|
if (clk_font_small) {
|
||||||
|
size_t dlen = strlen(dbuf);
|
||||||
|
XftTextExtentsUtf8(dpy, clk_font_small, (const FcChar8 *)dbuf, dlen, &ext);
|
||||||
|
int dx = (m->ww - ext.xOff) / 2;
|
||||||
|
int dy = 73;
|
||||||
|
XftDrawStringUtf8(cd, &clk_sh, clk_font_small, dx + 1, dy + 1,
|
||||||
|
(const FcChar8 *)dbuf, dlen);
|
||||||
|
XftDrawStringUtf8(cd, &clk_fg, clk_font_small, dx, dy,
|
||||||
|
(const FcChar8 *)dbuf, dlen);
|
||||||
|
}
|
||||||
|
XftDrawDestroy(cd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@@ -1403,9 +1483,11 @@ focus(Client *c)
|
|||||||
attachstack(c);
|
attachstack(c);
|
||||||
grabbuttons(c, 1);
|
grabbuttons(c, 1);
|
||||||
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
|
XSetWindowBorder(dpy, c->win, scheme[SchemeSel][ColBorder].pixel);
|
||||||
setfocus(c);
|
if (!is_passcode_locked())
|
||||||
|
setfocus(c);
|
||||||
} else {
|
} else {
|
||||||
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
if (!is_passcode_locked())
|
||||||
|
XSetInputFocus(dpy, root, RevertToPointerRoot, CurrentTime);
|
||||||
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
|
XDeleteProperty(dpy, root, netatom[NetActiveWindow]);
|
||||||
}
|
}
|
||||||
selmon->sel = c;
|
selmon->sel = c;
|
||||||
@@ -1419,6 +1501,8 @@ focusin(XEvent *e)
|
|||||||
{
|
{
|
||||||
XFocusChangeEvent *ev = &e->xfocus;
|
XFocusChangeEvent *ev = &e->xfocus;
|
||||||
|
|
||||||
|
if (is_passcode_locked())
|
||||||
|
return;
|
||||||
if (selmon->sel && ev->window != selmon->sel->win)
|
if (selmon->sel && ev->window != selmon->sel->win)
|
||||||
setfocus(selmon->sel);
|
setfocus(selmon->sel);
|
||||||
}
|
}
|
||||||
@@ -2122,6 +2206,7 @@ dwm_rescan_input_fds(int force)
|
|||||||
close(input_fds[i]);
|
close(input_fds[i]);
|
||||||
}
|
}
|
||||||
num_input_fds = 0;
|
num_input_fds = 0;
|
||||||
|
lid_close_fd = -1;
|
||||||
for (i = 0; i < MAX_INPUT_FDS; i++) {
|
for (i = 0; i < MAX_INPUT_FDS; i++) {
|
||||||
char evpath[64], evname[128] = "";
|
char evpath[64], evname[128] = "";
|
||||||
int evfd;
|
int evfd;
|
||||||
@@ -2301,11 +2386,30 @@ flush_pending_starpound(void)
|
|||||||
(void)dispatch_plugin_idle_key(ks, kc, 0);
|
(void)dispatch_plugin_idle_key(ks, kc, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
forward_key_to_locker(unsigned int keycode, unsigned int state)
|
||||||
|
{
|
||||||
|
if (is_plugin_daemon_alive("locker")) {
|
||||||
|
int fd = open("/tmp/dwm_plugin_locker.fifo", O_WRONLY | O_NONBLOCK | O_CLOEXEC);
|
||||||
|
if (fd >= 0) {
|
||||||
|
char msg[64];
|
||||||
|
int len = snprintf(msg, sizeof(msg), "KEY %u %u\n", keycode, state);
|
||||||
|
if (write(fd, msg, len) == len) {
|
||||||
|
close(fd);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
close(fd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
host_spawn_plugin("locker", "wake");
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
lock_phone_screenoff(void)
|
lock_phone_screenoff(void)
|
||||||
{
|
{
|
||||||
const Arg offcmd = SHCMD("sxmo_dmenu.sh close; sxmo_state.sh set screenoff");
|
|
||||||
int lfd, cfd;
|
int lfd, cfd;
|
||||||
|
lid_close_pending = 0;
|
||||||
|
lid_close_deadline_ms = 0;
|
||||||
softkey_pending = 0;
|
softkey_pending = 0;
|
||||||
softkey_first_ms = 0;
|
softkey_first_ms = 0;
|
||||||
softkey_deadline_ms = 0;
|
softkey_deadline_ms = 0;
|
||||||
@@ -2316,6 +2420,8 @@ lock_phone_screenoff(void)
|
|||||||
star_down = 0;
|
star_down = 0;
|
||||||
pound_down = 0;
|
pound_down = 0;
|
||||||
write_softkey_state(0, 0);
|
write_softkey_state(0, 0);
|
||||||
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
|
XFlush(dpy);
|
||||||
cfd = open("/tmp/dwm_plugin_callscreen.fifo", O_WRONLY | O_NONBLOCK | O_CLOEXEC);
|
cfd = open("/tmp/dwm_plugin_callscreen.fifo", O_WRONLY | O_NONBLOCK | O_CLOEXEC);
|
||||||
if (cfd >= 0) {
|
if (cfd >= 0) {
|
||||||
(void)write(cfd, "HANGUP_CLOSE\n", 13);
|
(void)write(cfd, "HANGUP_CLOSE\n", 13);
|
||||||
@@ -2333,7 +2439,6 @@ lock_phone_screenoff(void)
|
|||||||
host_spawn_plugin("locker", "screenoff");
|
host_spawn_plugin("locker", "screenoff");
|
||||||
set_sxmo_state_str("screenoff");
|
set_sxmo_state_str("screenoff");
|
||||||
set_hw_backlight(0);
|
set_hw_backlight(0);
|
||||||
spawn(&offcmd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@@ -2342,6 +2447,8 @@ wake_phone(void)
|
|||||||
const Arg oncmd = SHCMD("sxmo_state.sh set unlock");
|
const Arg oncmd = SHCMD("sxmo_state.sh set unlock");
|
||||||
long long now = dwm_now_ms();
|
long long now = dwm_now_ms();
|
||||||
|
|
||||||
|
lid_close_pending = 0;
|
||||||
|
lid_close_deadline_ms = 0;
|
||||||
last_wake_ms = now;
|
last_wake_ms = now;
|
||||||
softkey_pending = 0;
|
softkey_pending = 0;
|
||||||
softkey_first_ms = 0;
|
softkey_first_ms = 0;
|
||||||
@@ -2354,14 +2461,15 @@ wake_phone(void)
|
|||||||
pound_down = 0;
|
pound_down = 0;
|
||||||
write_softkey_state(0, 0);
|
write_softkey_state(0, 0);
|
||||||
write_softkey_suppress(now + SOFTKEY_SUPPRESS_MS);
|
write_softkey_suppress(now + SOFTKEY_SUPPRESS_MS);
|
||||||
set_hw_backlight(1);
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
|
XFlush(dpy);
|
||||||
if (is_passcode_locked()) {
|
if (is_passcode_locked()) {
|
||||||
set_sxmo_state_str("lock");
|
set_sxmo_state_str("lock");
|
||||||
host_spawn_plugin("locker", "wake");
|
host_spawn_plugin("locker", "wake");
|
||||||
|
set_hw_backlight(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
XUngrabKeyboard(dpy, CurrentTime);
|
set_hw_backlight(1);
|
||||||
XFlush(dpy);
|
|
||||||
set_sxmo_state_str("unlock");
|
set_sxmo_state_str("unlock");
|
||||||
spawn(&oncmd);
|
spawn(&oncmd);
|
||||||
}
|
}
|
||||||
@@ -2384,13 +2492,15 @@ keypress(XEvent *e)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is_passcode_locked()) {
|
if (is_passcode_locked()) {
|
||||||
|
XUngrabKeyboard(dpy, CurrentTime);
|
||||||
|
XFlush(dpy);
|
||||||
if (CLEANMASK(ev->state) == 0 &&
|
if (CLEANMASK(ev->state) == 0 &&
|
||||||
(keysym == XF86XK_PowerOff || ev->keycode == 124 ||
|
(keysym == XF86XK_PowerOff || ev->keycode == 124 ||
|
||||||
keysym == XF86XK_Phone || keysym == XF86XK_PickupPhone || ev->keycode == 177)) {
|
keysym == XF86XK_Phone || keysym == XF86XK_PickupPhone || ev->keycode == 177)) {
|
||||||
if (dispatch_plugin_global_key(keysym, ev->keycode, CLEANMASK(ev->state), 1))
|
if (dispatch_plugin_global_key(keysym, ev->keycode, CLEANMASK(ev->state), 1))
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
host_spawn_plugin("locker", "wake");
|
forward_key_to_locker(ev->keycode, CLEANMASK(ev->state));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (is_phone_locked()) {
|
if (is_phone_locked()) {
|
||||||
@@ -3021,6 +3131,25 @@ run(void)
|
|||||||
timeout_ms = (int)rem;
|
timeout_ms = (int)rem;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (lid_close_pending && lid_close_deadline_ms > 0) {
|
||||||
|
long long now = dwm_now_ms();
|
||||||
|
long long rem = lid_close_deadline_ms - now;
|
||||||
|
if (rem <= 0) {
|
||||||
|
unsigned long swbits[(SW_MAX + 8 * sizeof(unsigned long)) / (8 * sizeof(unsigned long))] = {0};
|
||||||
|
int still_closed = 1;
|
||||||
|
if (lid_close_fd >= 0 && ioctl(lid_close_fd, EVIOCGSW(sizeof(swbits)), swbits) >= 0) {
|
||||||
|
still_closed = (swbits[SW_LID / (8 * sizeof(unsigned long))] >> (SW_LID % (8 * sizeof(unsigned long)))) & 1;
|
||||||
|
}
|
||||||
|
lid_close_pending = 0;
|
||||||
|
lid_close_deadline_ms = 0;
|
||||||
|
if (still_closed) {
|
||||||
|
lock_phone_screenoff();
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
} else if (timeout_ms < 0 || rem < timeout_ms) {
|
||||||
|
timeout_ms = (int)rem;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (poll(fds, nfds, timeout_ms) < 0) {
|
if (poll(fds, nfds, timeout_ms) < 0) {
|
||||||
if (errno == EINTR)
|
if (errno == EINTR)
|
||||||
continue;
|
continue;
|
||||||
@@ -3037,10 +3166,19 @@ run(void)
|
|||||||
while ((nread = read(input_fds[i], &ie, sizeof(ie))) == (ssize_t)sizeof(ie)) {
|
while ((nread = read(input_fds[i], &ie, sizeof(ie))) == (ssize_t)sizeof(ie)) {
|
||||||
if (ie.type == EV_SW && ie.code == SW_LID) {
|
if (ie.type == EV_SW && ie.code == SW_LID) {
|
||||||
if (ie.value == 1) {
|
if (ie.value == 1) {
|
||||||
lock_phone_screenoff();
|
lid_close_pending = 1;
|
||||||
|
lid_close_fd = input_fds[i];
|
||||||
|
lid_close_deadline_ms = dwm_now_ms() + 60;
|
||||||
} else if (ie.value == 0) {
|
} else if (ie.value == 0) {
|
||||||
|
lid_close_pending = 0;
|
||||||
|
lid_close_deadline_ms = 0;
|
||||||
wake_phone();
|
wake_phone();
|
||||||
}
|
}
|
||||||
|
} else if (ie.type == EV_SW && ie.code == 10 && ie.value == 1) {
|
||||||
|
lid_close_pending = 0;
|
||||||
|
lid_close_deadline_ms = 0;
|
||||||
|
if (is_screen_off())
|
||||||
|
wake_phone();
|
||||||
} else if (ie.type == EV_REL && ie.value != 0) {
|
} else if (ie.type == EV_REL && ie.value != 0) {
|
||||||
dwm_cursor_set_visible(1);
|
dwm_cursor_set_visible(1);
|
||||||
} else if (ie.type == EV_KEY) {
|
} else if (ie.type == EV_KEY) {
|
||||||
@@ -3612,6 +3750,20 @@ updatebars(void)
|
|||||||
XLowerWindow(dpy, m->softwin);
|
XLowerWindow(dpy, m->softwin);
|
||||||
XSetClassHint(dpy, m->softwin, &ch);
|
XSetClassHint(dpy, m->softwin, &ch);
|
||||||
}
|
}
|
||||||
|
if (!m->clockwin) {
|
||||||
|
XSetWindowAttributes clockwa = {
|
||||||
|
.override_redirect = True,
|
||||||
|
.background_pixmap = ParentRelative,
|
||||||
|
.event_mask = ExposureMask
|
||||||
|
};
|
||||||
|
m->clockwin = XCreateWindow(dpy, root, m->wx, m->my + 29, m->ww, 92, 0,
|
||||||
|
DefaultDepth(dpy, screen), CopyFromParent, DefaultVisual(dpy, screen),
|
||||||
|
CWOverrideRedirect|CWBackPixmap|CWEventMask, &clockwa);
|
||||||
|
XDefineCursor(dpy, m->clockwin, cursor[CurNormal]->cursor);
|
||||||
|
XMapWindow(dpy, m->clockwin);
|
||||||
|
XLowerWindow(dpy, m->clockwin);
|
||||||
|
XSetClassHint(dpy, m->clockwin, &ch);
|
||||||
|
}
|
||||||
if (m->barwin)
|
if (m->barwin)
|
||||||
continue;
|
continue;
|
||||||
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
|
m->barwin = XCreateWindow(dpy, root, m->wx, m->by, m->ww, bh, 0, DefaultDepth(dpy, screen),
|
||||||
@@ -3977,7 +4129,7 @@ wintomon(Window w)
|
|||||||
if (w == root && getrootptr(&x, &y))
|
if (w == root && getrootptr(&x, &y))
|
||||||
return recttomon(x, y, 1, 1);
|
return recttomon(x, y, 1, 1);
|
||||||
for (m = mons; m; m = m->next)
|
for (m = mons; m; m = m->next)
|
||||||
if (w == m->barwin || w == m->softwin)
|
if (w == m->barwin || w == m->softwin || w == m->clockwin)
|
||||||
return m;
|
return m;
|
||||||
if ((c = wintoclient(w)))
|
if ((c = wintoclient(w)))
|
||||||
return c->mon;
|
return c->mon;
|
||||||
|
|||||||
Reference in new issue
Block a user