Persist screen brightness, enable universal evdev key/lid wake, and add *+# screenshot combo
This commit is contained in:
1 parent
eef8584a8d
commit
2e2adcc7f2
38 files changed
+574
-161
No files matched your search
@@ -110,11 +110,14 @@ CACHE_FILE="${XDG_RUNTIME_DIR:-/tmp}/sxmo_bat_state_${name}"
|
||||
ICON_FILE="${XDG_RUNTIME_DIR:-/run/user/10000}/sxmo_status/${SXMO_STATUS_NAME:-default}/040-battery-icon-${name}"
|
||||
NEW_VAL="${state}:${percentage}"
|
||||
if [ -r "$CACHE_FILE" ] && [ -f "$ICON_FILE" ]; then
|
||||
read -r OLD_VAL < "$CACHE_FILE" 2>/dev/null || OLD_VAL=""
|
||||
OLD_VAL=""
|
||||
read -r OLD_VAL < "$CACHE_FILE" 2>/dev/null || true
|
||||
if [ "$OLD_VAL" = "$NEW_VAL" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
printf '%s\n' "$NEW_VAL" > "$CACHE_FILE"
|
||||
chown 10000:10000 "$CACHE_FILE" 2>/dev/null || true
|
||||
|
||||
sxmo_hook_statusbar.sh battery "$name" "$state" "$percentage"
|
||||
chown -R 10000:10000 "${XDG_RUNTIME_DIR:-/run/user/10000}/sxmo_status" 2>/dev/null || true
|
||||
@@ -19,7 +19,8 @@ stop_proximity_lock() {
|
||||
|
||||
STATE_FILE="${SXMO_STATE:-$XDG_RUNTIME_DIR/sxmo.state}"
|
||||
if [ -r "$STATE_FILE" ]; then
|
||||
read -r CURRENT_STATE < "$STATE_FILE" || CURRENT_STATE=""
|
||||
CURRENT_STATE=""
|
||||
read -r CURRENT_STATE < "$STATE_FILE" 2>/dev/null || true
|
||||
else
|
||||
CURRENT_STATE="$(sxmo_state.sh get)"
|
||||
fi
|
||||
@@ -32,11 +33,6 @@ if [ "$CURRENT_STATE" != "unlock" ] && sxmo_state.sh is_locked; then
|
||||
else
|
||||
sxmo_wm.sh display on
|
||||
fi
|
||||
if [ -w /sys/class/leds/white:kbd_backlight/brightness ]; then
|
||||
printf '255' > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
|
||||
else
|
||||
brightnessctl -d white:kbd_backlight set 255 >/dev/null 2>&1 || true
|
||||
fi
|
||||
sxmo_state.sh set unlock &
|
||||
exit 0
|
||||
;;
|
||||
@@ -431,7 +427,7 @@ case "$ACTION" in
|
||||
exit 0
|
||||
;;
|
||||
"powerbutton_two")
|
||||
sxmo_state.sh click 2
|
||||
sxmo_state.sh set screenoff
|
||||
exit 0
|
||||
;;
|
||||
"powerbutton_three")
|
||||
|
||||
@@ -17,29 +17,37 @@
|
||||
|
||||
# This hook is called when the system reaches a locked state
|
||||
|
||||
STATE_FILE="${SXMO_STATE:-$XDG_RUNTIME_DIR/sxmo.state}"
|
||||
cur_state=""
|
||||
[ -r "$STATE_FILE" ] && { read -r cur_state < "$STATE_FILE" 2>/dev/null || true; }
|
||||
[ "$cur_state" = "unlock" ] && exit 0
|
||||
|
||||
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||
sxmo_led.sh blink blue &
|
||||
fi
|
||||
|
||||
[ "$SXMO_WM" = "sway" ] && swaymsg mode default
|
||||
sxmo_wm.sh display on
|
||||
cur_state=""
|
||||
[ -r "$STATE_FILE" ] && { read -r cur_state < "$STATE_FILE" 2>/dev/null || true; }
|
||||
if [ "$cur_state" != "unlock" ]; then
|
||||
sxmo_wm.sh display off
|
||||
fi
|
||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
|
||||
sxmo_wm.sh inputevent touchscreen off
|
||||
fi
|
||||
|
||||
case "$SXMO_WM" in
|
||||
dwm)
|
||||
if ! sxmo_jobs.sh running proximity_lock -q; then
|
||||
sxmo_dmenu.sh close
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||
sxmo_jobs.sh stop periodic_blink
|
||||
fi
|
||||
sxmo_jobs.sh stop periodic_wakelock_check
|
||||
|
||||
# Re-enable automatic screen-off on idle to save battery. The phone only
|
||||
# locks on explicit request; once locked we blank the screen after a short
|
||||
# idle period.
|
||||
if [ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ]; then
|
||||
sxmo_jobs.sh stop idle_locker
|
||||
else
|
||||
sxmo_jobs.sh start idle_locker sxmo_idle.sh -w \
|
||||
timeout "${SXMO_LOCK_IDLE_TIME:-8}" 'sh -c "sxmo_state.sh set screenoff"'
|
||||
fi
|
||||
sxmo_jobs.sh stop idle_locker
|
||||
|
||||
wait
|
||||
@@ -17,15 +17,21 @@
|
||||
|
||||
# This hook is called when the system reaches a off state (screen off)
|
||||
|
||||
STATE_FILE="${SXMO_STATE:-$XDG_RUNTIME_DIR/sxmo.state}"
|
||||
cur_state=""
|
||||
[ -r "$STATE_FILE" ] && { read -r cur_state < "$STATE_FILE" 2>/dev/null || true; }
|
||||
[ "$cur_state" = "unlock" ] && exit 0
|
||||
|
||||
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||
sxmo_led.sh blink red blue &
|
||||
fi
|
||||
|
||||
[ "$SXMO_WM" = "sway" ] && swaymsg mode default
|
||||
if [ -w /sys/class/leds/white:kbd_backlight/brightness ]; then
|
||||
printf '0' > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
|
||||
cur_state=""
|
||||
[ -r "$STATE_FILE" ] && { read -r cur_state < "$STATE_FILE" 2>/dev/null || true; }
|
||||
if [ "$cur_state" != "unlock" ]; then
|
||||
sxmo_wm.sh display off
|
||||
fi
|
||||
sxmo_wm.sh display off
|
||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
|
||||
sxmo_wm.sh inputevent touchscreen off
|
||||
fi
|
||||
|
||||
@@ -84,10 +84,11 @@ if [ "$(command -v fcitx5)" ]; then
|
||||
fi
|
||||
[ -n "$SXMO_MONITOR" ] && xrandr --output "$SXMO_MONITOR" --primary
|
||||
|
||||
# Turn on auto-suspend
|
||||
# Keep system awake so keypad, lid, and power keys always wake the screen immediately
|
||||
mkdir -p "$XDG_CACHE_HOME/sxmo"
|
||||
touch "$XDG_CACHE_HOME/sxmo/sxmo.nosuspend"
|
||||
if sxmo_wakelock.sh isenabled; then
|
||||
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
|
||||
superctl start sxmo_autosuspend
|
||||
fi
|
||||
|
||||
# To setup initial unlock state
|
||||
|
||||
@@ -76,7 +76,8 @@ set_state() {
|
||||
return
|
||||
fi
|
||||
|
||||
read -r cur_state < "$SXMO_STATE" 2>/dev/null || cur_state=""
|
||||
cur_state=""
|
||||
read -r cur_state < "$SXMO_STATE" 2>/dev/null || true
|
||||
case "$cur_state" in
|
||||
screenoff)
|
||||
sxmobar -a -e bold -f red state 90 "$icon_state_screenoff" # filled circle
|
||||
|
||||
@@ -14,9 +14,6 @@ if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||
fi
|
||||
|
||||
sxmo_wm.sh display on
|
||||
if [ -w /sys/class/leds/white:kbd_backlight/brightness ]; then
|
||||
printf '255' > /sys/class/leds/white:kbd_backlight/brightness 2>/dev/null || true
|
||||
fi
|
||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
|
||||
sxmo_wm.sh inputevent touchscreen on
|
||||
fi
|
||||
|
||||
Reference in new issue
Block a user