feat(x11): migrate to pure Xlibre + dwm/dmenu/st stack, fix fcitx5-t9 bottom bar, PM8909 PON shutdown, and remove Wayland
This commit is contained in:
@@ -8,6 +8,15 @@
|
||||
# shellcheck source=configs/default_hooks/sxmo_hook_icons.sh
|
||||
. sxmo_hook_icons.sh
|
||||
|
||||
APPS_CACHE="${XDG_RUNTIME_DIR:-/tmp}/sxmo_apps.cache"
|
||||
if [ -f "$APPS_CACHE" ] && [ ! "$0" -nt "$APPS_CACHE" ] && [ ! /usr/bin -nt "$APPS_CACHE" ] && [ ! /usr/local/bin -nt "$APPS_CACHE" ]; then
|
||||
cat "$APPS_CACHE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec 3>&1 > "$APPS_CACHE.tmp"
|
||||
trap 'mv -f "$APPS_CACHE.tmp" "$APPS_CACHE" 2>/dev/null; cat "$APPS_CACHE" >&3 2>/dev/null' EXIT
|
||||
|
||||
write_line() {
|
||||
printf "%s ^ 0 ^ %s\n" "$1" "$2"
|
||||
}
|
||||
@@ -69,8 +78,6 @@ write_line_app firefox-esr "$icon_ffx Firefox ESR" "firefox-esr"
|
||||
write_line_app flare "$icon_msg Flare" "flare"
|
||||
write_line_app flowtime "$icon_hrg Flowtime" "flowtime"
|
||||
write_line_app foliate "$icon_bok Foliate" "foliate"
|
||||
( [ -n "$WAYLAND_DISPLAY" ] && command -v foot >/dev/null) && \
|
||||
write_line "$icon_trm Foot" "foot $SHELL"
|
||||
write_line_app foxtrotgps "$icon_gps Foxtrotgps" "foxtrotgps"
|
||||
write_line_app fractal "$icon_msg Fractal" "fractal"
|
||||
write_line_app fragments "$icon_rld Fragments" "fragments"
|
||||
@@ -195,8 +202,7 @@ write_line_app siglo "$icon_clk Siglo" "siglo"
|
||||
write_line_app simple-scan "$icon_scn Simple Scan" "simple-scan"
|
||||
write_line_app snapshot "$icon_cam Snapshot" "snapshot"
|
||||
write_line_app solanum "$icon_pom Solanum" "solanum"
|
||||
([ -z "$WAYLAND_DISPLAY" ] && command -v st >/dev/null) && \
|
||||
write_line "$icon_trm St" "st -e $SHELL"
|
||||
write_line_app st "$icon_trm St" "st -e ${SHELL:-/bin/sh}"
|
||||
write_line_app supertuxkart "$icon_krt SuperTuxKart" "supertuxkart"
|
||||
write_line_app surf "$icon_glb Surf" "surf"
|
||||
write_line_app syncthing "$icon_rld Syncthing" "syncthing"
|
||||
|
||||
@@ -1,30 +1,64 @@
|
||||
#!/bin/sh
|
||||
# configversion: d031535bc22ba19d69704317b8d50560
|
||||
|
||||
load_data() {
|
||||
data="$(upower -i "$1" | grep . | sed -e 's|^ \+||' -e 's|: \+|:|')"
|
||||
type="$(printf "%b" "$data" | grep -m1 -v : | sed -e 's|^ \+||')"
|
||||
}
|
||||
|
||||
data_get() {
|
||||
printf "%b" "$data" | grep "^$1:" | cut -d: -f2
|
||||
}
|
||||
|
||||
SET_LED_PATH="$XDG_RUNTIME_DIR/sxmo_hook_battery_set_led"
|
||||
|
||||
device_changed() {
|
||||
name="$(data_get "native-path")"
|
||||
state="$(data_get "state")"
|
||||
percentage="$(data_get "percentage" | cut -d% -f1)"
|
||||
object="${1:-/org/freedesktop/UPower/devices/battery_default}"
|
||||
event="${2:-device changed}"
|
||||
|
||||
if [ -z "$name" ] || [ -z "$state" ]; then
|
||||
return
|
||||
fi
|
||||
case "$event" in
|
||||
"device changed") ;;
|
||||
*) exit 0 ;;
|
||||
esac
|
||||
|
||||
if [ "$state" = unknown ]; then
|
||||
return
|
||||
fi
|
||||
case "$object" in
|
||||
*/battery_*)
|
||||
raw_name="${object##*/battery_}"
|
||||
;;
|
||||
*)
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
|
||||
sysfs_dir=""
|
||||
if [ -d "/sys/class/power_supply/$raw_name" ]; then
|
||||
sysfs_dir="/sys/class/power_supply/$raw_name"
|
||||
name="$raw_name"
|
||||
else
|
||||
for d in /sys/class/power_supply/*; do
|
||||
[ -r "$d/type" ] || continue
|
||||
read -r pstype < "$d/type" 2>/dev/null || continue
|
||||
if [ "$pstype" = "Battery" ]; then
|
||||
sysfs_dir="$d"
|
||||
name="${d##*/}"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$sysfs_dir" ] && [ -r "$sysfs_dir/capacity" ] && [ -r "$sysfs_dir/status" ]; then
|
||||
read -r percentage < "$sysfs_dir/capacity" 2>/dev/null || percentage=""
|
||||
read -r raw_status < "$sysfs_dir/status" 2>/dev/null || raw_status=""
|
||||
case "$raw_status" in
|
||||
"Full"|"full") state="fully-charged" ;;
|
||||
"Charging"|"charging") state="charging" ;;
|
||||
"Discharging"|"discharging"|"Not charging"|"not charging") state="discharging" ;;
|
||||
*) state="unknown" ;;
|
||||
esac
|
||||
else
|
||||
data="$(upower -i "$object" | grep . | sed -e 's|^ \+||' -e 's|: \+|:|')"
|
||||
type="$(printf "%b" "$data" | grep -m1 -v : | sed -e 's|^ \+||')"
|
||||
[ "$type" = "battery" ] || exit 0
|
||||
name="$(printf "%b" "$data" | grep "^native-path:" | cut -d: -f2)"
|
||||
state="$(printf "%b" "$data" | grep "^state:" | cut -d: -f2)"
|
||||
percentage="$(printf "%b" "$data" | grep "^percentage:" | cut -d: -f2 | cut -d% -f1)"
|
||||
fi
|
||||
|
||||
if [ -z "$name" ] || [ -z "$state" ] || [ -z "$percentage" ] || [ "$state" = "unknown" ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||
if [ "$percentage" -lt 25 ] && [ ! -f "$SET_LED_PATH" ]; then
|
||||
touch "$SET_LED_PATH"
|
||||
sxmo_led.sh set red 100
|
||||
@@ -32,21 +66,17 @@ device_changed() {
|
||||
rm "$SET_LED_PATH"
|
||||
sxmo_led.sh set red 0
|
||||
fi
|
||||
|
||||
sxmo_hook_statusbar.sh battery "$name" "$state" "$percentage"
|
||||
}
|
||||
|
||||
object="$1"
|
||||
event="$2"
|
||||
|
||||
load_data "$object"
|
||||
|
||||
if [ "$type" != "battery" ]; then
|
||||
exit
|
||||
fi
|
||||
|
||||
case "$event" in
|
||||
"device changed")
|
||||
device_changed "$object"
|
||||
;;
|
||||
esac
|
||||
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=""
|
||||
if [ "$OLD_VAL" = "$NEW_VAL" ]; then
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
printf '%s\n' "$NEW_VAL" > "$CACHE_FILE"
|
||||
|
||||
sxmo_hook_statusbar.sh battery "$name" "$state" "$percentage"
|
||||
|
||||
@@ -23,6 +23,20 @@ sxmo_service_isrunning() {
|
||||
sxmo_jobs.sh running "$1" -q
|
||||
}
|
||||
|
||||
bt_is_unblocked() {
|
||||
for rfk in /sys/class/rfkill/rfkill*; do
|
||||
[ -r "$rfk/type" ] || continue
|
||||
read -r rtype < "$rfk/type" 2>/dev/null || continue
|
||||
if [ "$rtype" = "bluetooth" ]; then
|
||||
read -r soft < "$rfk/soft" 2>/dev/null || soft=0
|
||||
read -r hard < "$rfk/hard" 2>/dev/null || hard=0
|
||||
[ "$soft" = "0" ] && [ "$hard" = "0" ] && return 0
|
||||
return 1
|
||||
fi
|
||||
done
|
||||
rfkill list bluetooth -no ID,SOFT,HARD 2>/dev/null | grep -vq " blocked"
|
||||
}
|
||||
|
||||
case "$WMCLASS" in
|
||||
scripts)
|
||||
# Scripts menu
|
||||
@@ -43,11 +57,8 @@ case "$WMCLASS" in
|
||||
printf %b "$icon_ton ^ 1 ^ superctl stop sxmo_modemmonitor" ||
|
||||
printf %b "$icon_tof ^ 1 ^ superctl start sxmo_modemmonitor"
|
||||
) && sxmo_hook_statusbar.sh modem
|
||||
$icon_wrh Restart System Daemons ^ 1 ^ sxmo_hook_restart_modem_daemons.sh && sxmo_hook_statusbar.sh modem
|
||||
$icon_inf Modem Info ^ 0 ^ sxmo_modeminfo.sh
|
||||
$icon_phl Modem Log ^ 0 ^ sxmo_modemlog.sh
|
||||
$icon_img Config MMS ^ 1 ^ sxmo_mmsdconfig.sh
|
||||
$icon_img Config VVM ^ 1 ^ sxmo_vvmdconfig.sh
|
||||
"
|
||||
WINNAME=Modem
|
||||
;;
|
||||
@@ -56,27 +67,12 @@ case "$WMCLASS" in
|
||||
CHOICES="
|
||||
$icon_aru Brightness ^ 1 ^ sxmo_brightness.sh up
|
||||
$icon_ard Brightness ^ 1 ^ sxmo_brightness.sh down
|
||||
$icon_cfg Touch $(
|
||||
sxmo_wm.sh inputevent touchscreen | grep -q on && \
|
||||
printf %b "$icon_ton ^ 1 ^ sxmo_wm.sh inputevent touchscreen off" || \
|
||||
printf %b "$icon_tof ^ 1 ^ sxmo_wm.sh inputevent touchscreen on"
|
||||
)
|
||||
$icon_cfg Stylus $(
|
||||
sxmo_wm.sh inputevent stylus | grep -q on && \
|
||||
printf %b "$icon_ton ^ 1 ^ sxmo_wm.sh inputevent stylus off" || \
|
||||
printf %b "$icon_tof ^ 1 ^ sxmo_wm.sh inputevent stylus on"
|
||||
)
|
||||
$icon_cfg Gestures $(
|
||||
superd_service_isrunning "sxmo_hook_lisgd" &&
|
||||
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
|
||||
) ^ 1 ^ supertoggle_daemon 'sxmo_hook_lisgd' && (rm $XDG_CACHE_HOME/sxmo/sxmo.nogesture 2>/dev/null || touch $XDG_CACHE_HOME/sxmo/sxmo.nogesture)
|
||||
$icon_cfg Toggle Bar ^ 0 ^ sxmo_wm.sh togglebar
|
||||
$icon_bth Bluetooth $(
|
||||
rfkill list bluetooth -no ID,SOFT,HARD | grep -vq " blocked" &&
|
||||
bt_is_unblocked &&
|
||||
printf %b "$icon_ton" || printf %b "$icon_tof";
|
||||
printf %b "^ 1 ^ doas sxmo_bluetoothtoggle.sh && sxmo_hook_statusbar.sh bluetooth"
|
||||
)
|
||||
$(test "$SXMO_WM" = dwm && printf %b "$icon_cfg Invert Colors ^ 1 ^ xcalib -a -invert")
|
||||
$icon_clk Change Timezone ^ 1 ^ sxmo_timezonechange.sh
|
||||
$icon_zzz Auto-suspend $(
|
||||
[ -e "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend ] && printf "%s" "$icon_tof" || printf "%s" "$icon_ton"
|
||||
@@ -84,24 +80,7 @@ case "$WMCLASS" in
|
||||
$icon_zzz Auto-screen-off $(
|
||||
[ -e "$XDG_CACHE_HOME/sxmo/sxmo.noidle" ] && printf "%s" "$icon_tof" || printf "%s" "$icon_ton"
|
||||
) ^ 1 ^ (rm $XDG_CACHE_HOME/sxmo/sxmo.noidle 2>/dev/null || touch $XDG_CACHE_HOME/sxmo/sxmo.noidle) && sxmo_state.sh set unlock
|
||||
$icon_ror Autorotate $(
|
||||
sxmo_jobs.sh running autorotate -q &&
|
||||
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
|
||||
) ^ 1 ^ toggle_daemon 'Autorotate' autorotate sxmo_autorotate.sh
|
||||
$([ -n "$SXMO_KEYBOARD_SLIDER_EVENT_DEVICE" ] && echo "$icon_ror Autorotate on Keyboard Open/Close $(
|
||||
sxmo_jobs.sh running kb_autorotate -q &&
|
||||
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
|
||||
) ^ 1 ^ toggle_daemon 'Keyboard Autorotate' kb_autorotate sxmo_keyboard_autorotate.sh")
|
||||
$icon_ror Rotate ^ 1 ^ sxmo_rotate.sh rotate
|
||||
$icon_brightness Adaptive Brightness $(
|
||||
superd_service_isrunning sxmo_adaptivebrightness &&
|
||||
printf "%s" "$icon_ton" || printf "%s" "$icon_tof"
|
||||
) ^ 1 ^ supertoggle_daemon sxmo_adaptivebrightness
|
||||
$icon_trm Hooks ^ 0 ^ sxmo_hookmenu.sh
|
||||
$icon_upc Upgrade Pkgs ^ 0 ^ sxmo_terminal.sh sxmo_upgrade.sh
|
||||
$icon_sfl Migrate configuration ^ 0 ^ sxmo_terminal.sh sxmo_migrate.sh
|
||||
$(sxmo_wm.sh configmenuentry)
|
||||
$(command -v pmos-tweaks >/dev/null && echo "$icon_cfg PostmarketOS Tweaks ^ 0 ^ GDK_SCALE=1 pmos-tweaks")
|
||||
$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 Version ^ 0 ^ sxmo_terminal.sh sxmo_version.sh --block
|
||||
@@ -114,7 +93,6 @@ case "$WMCLASS" in
|
||||
$icon_lck Lock ^ 0 ^ sxmo_state.sh set lock
|
||||
$icon_lck Lock (Screen off) ^ 0 ^ sxmo_state.sh set screenoff
|
||||
$icon_out Logout ^ 0 ^ confirm Logout && sxmo_power.sh logout
|
||||
$icon_rol Switch WM ^ 0 ^ sxmo_power.sh togglewm
|
||||
$icon_rld Reboot ^ 0 ^ confirm Reboot && sxmo_power.sh reboot
|
||||
$icon_pwr Poweroff ^ 0 ^ confirm Poweroff && sxmo_power.sh poweroff
|
||||
"
|
||||
@@ -213,7 +191,7 @@ case "$WMCLASS" in
|
||||
"
|
||||
WINNAME=St
|
||||
;;
|
||||
*foot*|st|st-*|*terminal*|org.gnome.vte.application|org.gnome.vte.app.gtk4|*alacritty*)
|
||||
st|st-*|*terminal*|org.gnome.vte.application|org.gnome.vte.app.gtk4|*alacritty*)
|
||||
|
||||
# These git commands only launch the editor.
|
||||
case "$WMNAME" in
|
||||
@@ -458,6 +436,8 @@ case "$WMCLASS" in
|
||||
case "$WMCLASS" in
|
||||
st|st-*)
|
||||
CHOICES="
|
||||
$icon_trm New Terminal ^ 0 ^ sxmo_terminal.sh
|
||||
$icon_cls Close Terminal ^ 0 ^ sxmo_killwindow.sh
|
||||
$icon_itm Type complete ^ 0 ^ sxmo_type -M Ctrl -M Shift -k u
|
||||
$icon_itm Toggle Selmode ^ 0 ^ sxmo_type -M Ctrl -M Shift -k s
|
||||
$icon_cpy Copy complete ^ 0 ^ sxmo_type -M Ctrl -M Shift -k i
|
||||
@@ -472,29 +452,6 @@ case "$WMCLASS" in
|
||||
"
|
||||
WINNAME=St
|
||||
;;
|
||||
*foot*)
|
||||
CHOICES="
|
||||
$icon_win Next Window ^ 0 ^ swaymsg focus next
|
||||
$icon_rld Toggle Layout ^ 0 ^ sxmo_wm.sh togglelayout
|
||||
$icon_mnu Tile Vertical ^ 0 ^ swaymsg layout splitv && swaymsg splitv
|
||||
$icon_grd Tile Horizontal ^ 0 ^ swaymsg layout splith && swaymsg splith
|
||||
$icon_trm New Terminal ^ 0 ^ sxmo_terminal.sh
|
||||
$icon_cls Close Terminal ^ 0 ^ sxmo_killwindow.sh
|
||||
$icon_cpy Copy ^ 0 ^ sxmo_type -M Shift -M Ctrl c
|
||||
$icon_pst Paste ^ 0 ^ sxmo_type -M Shift -M Ctrl v
|
||||
$icon_zmi Zoom in ^ 1 ^ sxmo_type -M Ctrl +
|
||||
$icon_zmo Zoom out ^ 1 ^ sxmo_type -M Ctrl -k Minus
|
||||
$icon_aru Scroll up ^ 1 ^ sxmo_type -M Shift -k Prior
|
||||
$icon_ard Scroll down ^ 1 ^ sxmo_type -M Shift -k Next
|
||||
$icon_lnk URL Mode ^ 0 ^ sxmo_type -M Shift -M Ctrl -k u
|
||||
$icon_kbd Hotkeys ^ 0 ^ sxmo_appmenu.sh sthotkeys
|
||||
$icon_fnd Search Field ^ 0 ^ sxmo_type -M Ctrl -M Shift -k r
|
||||
$icon_aru Search Back ^ 0 ^ sxmo_type -M Ctrl -k r
|
||||
$icon_ard Search Forward ^ 0 ^ sxmo_type -M Ctrl -k s
|
||||
$icon_itm Search Extend ^ 0 ^ sxmo_type -M Ctrl -k w
|
||||
"
|
||||
WINNAME=Foot
|
||||
;;
|
||||
*terminal*|org.gnome.vte.application|org.gnome.vte.app.gtk4)
|
||||
CHOICES="$icon_kbd Hotkeys ^ 0 ^ sxmo_appmenu.sh sthotkeys"
|
||||
WINNAME=Terminal
|
||||
@@ -806,30 +763,28 @@ case "$WMCLASS" in
|
||||
*)
|
||||
# Default system menu (no matches)
|
||||
CHOICES="
|
||||
$icon_grd Scripts ^ 0 ^ sxmo_appmenu.sh scripts
|
||||
$icon_trm St ^ 0 ^ st -e ${SHELL:-/bin/sh}
|
||||
$icon_grd Apps ^ 0 ^ sxmo_appmenu.sh applications
|
||||
$([ "$SXMO_MENU" = "wofi" ] && echo "$icon_grd All Apps ^ 0 ^ wofi -O alphabetical -i --show drun")
|
||||
$([ "$SXMO_MENU" != "wofi" ] && command -v j4-dmenu-desktop > /dev/null && echo "$icon_grd All Apps ^ 0 ^ j4-dmenu-desktop --dmenu=sxmo_dmenu.sh --term=sxmo_terminal.sh")
|
||||
$icon_grd Binaries ^ 0 ^ sxmo_brun.sh
|
||||
$icon_grd Scripts ^ 0 ^ sxmo_appmenu.sh scripts
|
||||
$icon_dir Files ^ 0 ^ sxmo_files.sh
|
||||
$icon_phn Dialer ^ 0 ^ sxmo_modemdial.sh
|
||||
$icon_msg Texts ^ 0 ^ sxmo_modemtext.sh
|
||||
$icon_usr Contacts ^ 0 ^ sxmo_contactmenu.sh
|
||||
$(
|
||||
rfkill list bluetooth -no ID,SOFT,HARD | grep -vq " blocked" &&
|
||||
bt_is_unblocked &&
|
||||
printf %b "$icon_bth Bluetooth ^ 1 ^ sxmo_bluetoothmenu.sh"
|
||||
)
|
||||
$icon_cam Camera ^ 0 ^ bananarchy-photo --menu
|
||||
$(
|
||||
if command -v bananarchy-photo >/dev/null; then
|
||||
echo "$icon_cam Camera ^ 0 ^ bananarchy-photo --menu"
|
||||
elif command -v megapixels >/dev/null; then
|
||||
echo "$icon_cam Camera ^ 0 ^ GDK_SCALE=2 megapixels"
|
||||
brightness=""
|
||||
if [ -r /sys/class/leds/white:torch/brightness ]; then
|
||||
read -r brightness < /sys/class/leds/white:torch/brightness 2>/dev/null || brightness=""
|
||||
elif [ -r /sys/class/leds/white:flash/brightness ]; then
|
||||
read -r brightness < /sys/class/leds/white:flash/brightness 2>/dev/null || brightness=""
|
||||
fi
|
||||
)
|
||||
$(
|
||||
if brightness="$(brightnessctl -l -m | grep -e "white:torch" -e "white:flash" | cut -d ',' -f 3)" && [ -n "$brightness" ]; then
|
||||
if [ -n "$brightness" ]; then
|
||||
printf "%s Flashlight " "$icon_fll"
|
||||
[ "$brightness" -gt 0 ] &&
|
||||
[ "$brightness" -gt 0 ] 2>/dev/null &&
|
||||
printf %b "$icon_ton" || printf %b "$icon_tof";
|
||||
printf %b "^ 1 ^ sxmo_flashtoggle.sh"
|
||||
fi
|
||||
@@ -839,7 +794,6 @@ case "$WMCLASS" in
|
||||
$icon_phn Modem ^ 0 ^ sxmo_appmenu.sh modem
|
||||
$icon_win Windows ^ 0 ^ sxmo_wmmenu.sh
|
||||
$icon_cfg Config ^ 0 ^ sxmo_appmenu.sh config
|
||||
$icon_inf Help ^ 0 ^ sxmo_terminal.sh man sxmo
|
||||
$icon_pwr Power ^ 0 ^ sxmo_appmenu.sh power
|
||||
"
|
||||
WINNAME=Sys
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
# for all the variables we define here
|
||||
# shellcheck disable=SC2034
|
||||
|
||||
[ -n "$SXMO_ICONS_LOADED" ] && return 0 2>/dev/null
|
||||
SXMO_ICONS_LOADED=1
|
||||
|
||||
#this script is meant to be sourced
|
||||
#the glyphs are often in the private use area and
|
||||
#therefore require a font like those in https://github.com/ryanoasis/nerd-fonts/ for proper display
|
||||
|
||||
@@ -17,38 +17,51 @@ stop_proximity_lock() {
|
||||
sxmo_jobs.sh stop proximity_lock
|
||||
}
|
||||
|
||||
exec 0<<EOF
|
||||
STATE_FILE="${SXMO_STATE:-$XDG_RUNTIME_DIR/sxmo.state}"
|
||||
if [ -r "$STATE_FILE" ]; then
|
||||
read -r CURRENT_STATE < "$STATE_FILE" || CURRENT_STATE=""
|
||||
else
|
||||
CURRENT_STATE="$(sxmo_state.sh get)"
|
||||
fi
|
||||
|
||||
if [ "$CURRENT_STATE" != "unlock" ] && sxmo_state.sh is_locked; then
|
||||
case "$ACTION" in
|
||||
"powerbutton_one"|"powerbutton_two"|"powerbutton_three"|"menuleft_one"|"menuright_one"|"enter_one"|"enter_two"|"enter_three")
|
||||
if [ -n "$WAYLAND_DISPLAY" ]; then
|
||||
wlopm --on "*" >/dev/null 2>&1 || sxmo_wm.sh display on
|
||||
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
|
||||
;;
|
||||
"voldown_one"|"volup_one")
|
||||
exec 0<<EOF
|
||||
$(sxmo_wm.sh focusedwindow -r)
|
||||
EOF
|
||||
read -r WMCLASS
|
||||
read -r WMNAME
|
||||
|
||||
sxmo_debug "STATE: $(sxmo_state.sh get) ACTION: $ACTION WMCLASS: $WMCLASS WMNAME: $WMNAME"
|
||||
|
||||
if sxmo_state.sh is_locked; then
|
||||
case "$WMNAME" in # Handle programs
|
||||
*"epy"*|*"epr"*)
|
||||
case "$ACTION" in
|
||||
"voldown_one")
|
||||
sxmo_type.sh l
|
||||
exit 0
|
||||
;;
|
||||
"volup_one")
|
||||
sxmo_type.sh h
|
||||
read -r WMCLASS
|
||||
read -r WMNAME
|
||||
case "$WMNAME" in
|
||||
*"epy"*|*"epr"*)
|
||||
if [ "$ACTION" = "voldown_one" ]; then
|
||||
sxmo_type.sh l
|
||||
else
|
||||
sxmo_type.sh h
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
case "$ACTION" in
|
||||
"powerbutton_one"|"powerbutton_two"|"powerbutton_three"|"menuleft_one"|"menuright_one"|"enter_one"|"enter_two"|"enter_three")
|
||||
brightnessctl -d white:kbd_backlight set 255 >/dev/null 2>&1 || true
|
||||
sxmo_state.sh set unlock
|
||||
sxmo_wm.sh display on
|
||||
;;
|
||||
"voldown_one")
|
||||
sxmo_audio.sh vol down 5
|
||||
exit
|
||||
if [ "$ACTION" = "voldown_one" ]; then
|
||||
sxmo_audio.sh vol down 5
|
||||
else
|
||||
sxmo_audio.sh vol up 5
|
||||
fi
|
||||
exit 0
|
||||
;;
|
||||
"voldown_two")
|
||||
sxmo_audio.sh vol down 10
|
||||
@@ -58,10 +71,6 @@ if sxmo_state.sh is_locked; then
|
||||
sxmo_audio.sh vol down 15
|
||||
exit
|
||||
;;
|
||||
"volup_one")
|
||||
sxmo_audio.sh vol up 5
|
||||
exit
|
||||
;;
|
||||
"volup_two")
|
||||
sxmo_audio.sh vol up 10
|
||||
exit
|
||||
@@ -75,6 +84,31 @@ if sxmo_state.sh is_locked; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
case "$ACTION" in
|
||||
"menuleft"*|"enter_two"|"enter_three"|"powerbutton_two"|"powerbutton_three"|"voldown_two"|"volup_two"|"volup_three"|"topleftcorner"|"toprightcorner"|"bottomrightcorner")
|
||||
WMCLASS=""
|
||||
WMNAME=""
|
||||
;;
|
||||
*)
|
||||
if [ -r "$XDG_RUNTIME_DIR/sxmo.focusedwin" ]; then
|
||||
{
|
||||
read -r WMCLASS || WMCLASS=""
|
||||
read -r WMNAME || WMNAME=""
|
||||
} < "$XDG_RUNTIME_DIR/sxmo.focusedwin"
|
||||
else
|
||||
exec 0<<EOF
|
||||
$(sxmo_wm.sh focusedwindow -r)
|
||||
EOF
|
||||
read -r WMCLASS
|
||||
read -r WMNAME
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ -n "$SXMO_DEBUG" ]; then
|
||||
sxmo_debug "STATE: $CURRENT_STATE ACTION: $ACTION WMCLASS: $WMCLASS WMNAME: $WMNAME"
|
||||
fi
|
||||
|
||||
#special context-sensitive handling
|
||||
case "$WMCLASS" in
|
||||
*"mpv"*)
|
||||
@@ -367,7 +401,7 @@ case "$ACTION" in
|
||||
exit 0
|
||||
;;
|
||||
"enter_one")
|
||||
if pidof -q sxmo_RepeatRing.sh; then
|
||||
if pidof -s sxmo_RepeatRing.sh >/dev/null; then
|
||||
sxmo_hook_pickup.sh
|
||||
else
|
||||
sxmo_appmenu.sh "$WMCLASS" "$WMNAME"
|
||||
|
||||
@@ -17,13 +17,19 @@
|
||||
|
||||
# This hook is called when the system reaches a locked state
|
||||
|
||||
sxmo_led.sh blink blue &
|
||||
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||
sxmo_led.sh blink blue &
|
||||
fi
|
||||
|
||||
[ "$SXMO_WM" = "sway" ] && swaymsg mode default
|
||||
sxmo_wm.sh display on
|
||||
sxmo_wm.sh inputevent touchscreen off
|
||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
|
||||
sxmo_wm.sh inputevent touchscreen off
|
||||
fi
|
||||
|
||||
sxmo_jobs.sh stop periodic_blink
|
||||
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||
sxmo_jobs.sh stop periodic_blink
|
||||
fi
|
||||
sxmo_jobs.sh stop periodic_wakelock_check
|
||||
|
||||
# Go down after 8 seconds of inactivity
|
||||
|
||||
@@ -17,13 +17,20 @@
|
||||
|
||||
# This hook is called when the system reaches a off state (screen off)
|
||||
|
||||
sxmo_led.sh blink red blue &
|
||||
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
|
||||
fi
|
||||
sxmo_wm.sh display off
|
||||
sxmo_wm.sh inputevent touchscreen off
|
||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ]; then
|
||||
sxmo_wm.sh inputevent touchscreen off
|
||||
fi
|
||||
|
||||
if [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend ]; then
|
||||
if [ -z "$SXMO_DISABLE_LEDS" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nosuspend ]; then
|
||||
sxmo_jobs.sh start periodic_blink \
|
||||
sxmo_run_periodically.sh -w 2 -- sxmo_led.sh blink red blue
|
||||
fi
|
||||
@@ -44,7 +51,7 @@ wait
|
||||
|
||||
case "$SXMO_WM" in
|
||||
sway)
|
||||
if command -v peanutbutter > /dev/null; then
|
||||
if [ -n "$SXMO_HAS_PEANUTBUTTER" ] && command -v peanutbutter > /dev/null; then
|
||||
peanutbutter --font Sxmo --statuscommand sxmo_hook_lockstatusbar.sh && sxmo_hook_statusbar.sh state_change &
|
||||
fi
|
||||
;;
|
||||
|
||||
@@ -11,18 +11,38 @@
|
||||
# shellcheck source=configs/default_hooks/sxmo_hook_icons.sh
|
||||
. sxmo_hook_icons.sh
|
||||
|
||||
SCRIPTS_CACHE="${XDG_RUNTIME_DIR:-/tmp}/sxmo_scripts.cache"
|
||||
APPSCRIPTS_DIR="$(xdg_data_path sxmo/appscripts)"
|
||||
if [ -f "$SCRIPTS_CACHE" ] && [ ! "$0" -nt "$SCRIPTS_CACHE" ] && \
|
||||
[ ! "$APPSCRIPTS_DIR" -nt "$SCRIPTS_CACHE" ] && \
|
||||
{ [ ! -e "$XDG_CONFIG_HOME/sxmo/userscripts" ] || [ ! "$XDG_CONFIG_HOME/sxmo/userscripts" -nt "$SCRIPTS_CACHE" ]; }; then
|
||||
cat "$SCRIPTS_CACHE"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec 3>&1 > "$SCRIPTS_CACHE.tmp"
|
||||
trap 'mv -f "$SCRIPTS_CACHE.tmp" "$SCRIPTS_CACHE" 2>/dev/null; cat "$SCRIPTS_CACHE" >&3 2>/dev/null' EXIT
|
||||
|
||||
write_line() {
|
||||
printf "%s ^ 0 ^ %s\n" "$1" "$2"
|
||||
}
|
||||
|
||||
get_title() {
|
||||
title=""
|
||||
eval "$(head "$1" | grep '# title="[^\\"]*"' | sed 's/^# //g')"
|
||||
while IFS= read -r line; do
|
||||
case "$line" in
|
||||
"# title=\""*"\"")
|
||||
title="${line#*# title=\"}"
|
||||
title="${title%\"*}"
|
||||
title="$(eval "printf '%s' \"$title\"" 2>/dev/null || printf '%s' "$title")"
|
||||
break
|
||||
;;
|
||||
esac
|
||||
done < "$1"
|
||||
if [ -n "$title" ]; then
|
||||
echo "$title"
|
||||
printf "%s\n" "$title"
|
||||
else
|
||||
basename="$(basename "$1")"
|
||||
echo "$icon_itm $basename"
|
||||
printf "%s %s\n" "$icon_itm" "${1##*/}"
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -33,12 +53,18 @@ elif [ -d "$XDG_CONFIG_HOME/sxmo/userscripts" ]; then
|
||||
title="$(get_title "$script")"
|
||||
write_line "$title" "$script"
|
||||
done
|
||||
write_line "$icon_cfg Edit Userscripts" "sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/userscripts/*"
|
||||
fi
|
||||
|
||||
write_line "$icon_cfg Edit Userscripts" "sxmo_terminal.sh $EDITOR $XDG_CONFIG_HOME/sxmo/userscripts/*"
|
||||
|
||||
# System Scripts
|
||||
find "$(xdg_data_path sxmo/appscripts)" -type f -o -type l | sort -f | while read -r script; do
|
||||
title="$(get_title "$script")"
|
||||
write_line "$title" "$script"
|
||||
done
|
||||
if [ -n "$APPSCRIPTS_DIR" ]; then
|
||||
find "$APPSCRIPTS_DIR" -type f -o -type l | sort -f | while read -r script; do
|
||||
case "${script##*/}" in
|
||||
sxmo_record.sh|sxmo_screenshot.sh|sxmo_websearch.sh|sxmo_youtube*.sh)
|
||||
continue
|
||||
;;
|
||||
esac
|
||||
title="$(get_title "$script")"
|
||||
write_line "$title" "$script"
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -10,13 +10,18 @@
|
||||
. sxmo_common.sh
|
||||
|
||||
# Create xdg user directories, such as ~/Pictures
|
||||
xdg-user-dirs-update
|
||||
[ -d "$HOME/Pictures" ] || xdg-user-dirs-update &
|
||||
|
||||
# Ensure fontconfig cache is valid without forcing a full rescan on every boot
|
||||
if command -v fc-cache > /dev/null && [ -z "$(ls -A /var/cache/fontconfig 2>/dev/null)" ]; then
|
||||
fc-cache >/dev/null 2>&1 &
|
||||
fi
|
||||
|
||||
sxmo_jobs.sh start daemon_manager superd
|
||||
|
||||
# let time to superd to start correctly
|
||||
while ! superctl status > /dev/null 2>&1; do
|
||||
sleep 0.5
|
||||
sleep 0.05
|
||||
done
|
||||
|
||||
# Not dangerous if "locker" isn't an available state
|
||||
@@ -54,48 +59,14 @@ superctl start dunst
|
||||
# start adaptive brightness at boot
|
||||
# superctl start sxmo_adaptivebrightness
|
||||
|
||||
# load some other little things here too.
|
||||
case "$SXMO_WM" in
|
||||
river)
|
||||
superctl start sxmo_wob
|
||||
[ "$(command -v bonsaid)" ] && superctl start bonsaid
|
||||
[ "$(command -v fcitx5)" ] && superctl start fcitx5
|
||||
superctl start sxmo_riverbar
|
||||
;;
|
||||
sway)
|
||||
superctl start sxmo_wob
|
||||
superctl start sxmo_menumode_toggler
|
||||
[ "$(command -v bonsaid)" ] && superctl start bonsaid
|
||||
[ "$(command -v fcitx5)" ] && superctl start fcitx5
|
||||
;;
|
||||
dwm|i3)
|
||||
superctl start sxmo_xob
|
||||
|
||||
# Auto hide cursor with touchscreen, Show it with a mouse
|
||||
if command -v "unclutter-xfixes" > /dev/null; then
|
||||
set -- unclutter-xfixes
|
||||
else
|
||||
set -- unclutter
|
||||
fi
|
||||
superctl start "$1"
|
||||
|
||||
superctl start autocutsel
|
||||
superctl start autocutsel-primary
|
||||
superctl start sxmo-x11-status
|
||||
[ "$(command -v bonsaid)" ] && superctl start bonsaid
|
||||
[ "$(command -v fcitx5)" ] && superctl start fcitx5
|
||||
[ -n "$SXMO_MONITOR" ] && xrandr --output "$SXMO_MONITOR" --primary
|
||||
# Set onboard to auto-hide in config first
|
||||
if [ "$KEYBOARD" = "onboard" ]; then
|
||||
onboard "$KEYBOARD_ARGS"
|
||||
fi
|
||||
case "$SXMO_WM" in
|
||||
i3)
|
||||
xbindkeys -f "$XDG_CONFIG_HOME/sxmo/xbindkeysrc_$SXMO_BINDING_PROVIDER"
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
esac
|
||||
# load X11 dwm services
|
||||
[ "$(command -v sxmo_xob)" ] && superctl start sxmo_xob
|
||||
pidof -s sxmo_status_xsetroot.sh >/dev/null 2>&1 || superctl start sxmo-x11-status
|
||||
[ "$(command -v bonsaid)" ] && superctl start bonsaid
|
||||
if ! pidof -s fcitx5 >/dev/null 2>&1 && [ "$(command -v fcitx5)" ]; then
|
||||
superctl start fcitx5
|
||||
fi
|
||||
[ -n "$SXMO_MONITOR" ] && xrandr --output "$SXMO_MONITOR" --primary
|
||||
|
||||
# Turn on auto-suspend
|
||||
if sxmo_wakelock.sh isenabled; then
|
||||
@@ -106,8 +77,8 @@ fi
|
||||
# To setup initial unlock state
|
||||
sxmo_state.sh set unlock
|
||||
|
||||
# Turn on lisgd
|
||||
if [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
|
||||
# Turn on lisgd only on touch devices
|
||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
|
||||
superctl start sxmo_hook_lisgd
|
||||
fi
|
||||
|
||||
@@ -120,11 +91,8 @@ if [ -z "$SXMO_NO_MODEM" ] && command -v ModemManager > /dev/null; then
|
||||
sxmo_wakelock.sh lock sxmo_modem_warming_up 120s
|
||||
fi
|
||||
|
||||
# Start the desktop wallpaper
|
||||
superctl start sxmo_bg
|
||||
|
||||
# Start the desktop widget (e.g. clock)
|
||||
superctl start sxmo_conky
|
||||
pidof -s conky >/dev/null 2>&1 || superctl start sxmo_conky
|
||||
|
||||
# Monitor the battery
|
||||
superctl start sxmo_battery_monitor
|
||||
@@ -135,25 +103,8 @@ superctl start sxmo_networkmonitor
|
||||
# The daemon that display notifications popup messages
|
||||
superctl start sxmo_notificationmonitor
|
||||
|
||||
# Play a funky startup tune if you want (disabled by default)
|
||||
#mpv --quiet --no-video ~/welcome.ogg &
|
||||
|
||||
# mmsd and vvmd
|
||||
if [ -z "$SXMO_NO_MODEM" ]; then
|
||||
if [ -f "${SXMO_MMS_BASE_DIR:-"$HOME"/.mms/modemmanager}/mms" ]; then
|
||||
superctl start mmsd-tng
|
||||
fi
|
||||
|
||||
if [ -f "${SXMO_VVM_BASE_DIR:-"$HOME"/.vvm/modemmanager}/vvm" ]; then
|
||||
superctl start vvmd
|
||||
fi
|
||||
fi
|
||||
|
||||
# add some warnings if things are not setup correctly
|
||||
if ! command -v "sxmo_deviceprofile_$SXMO_DEVICE_NAME.sh"; then
|
||||
sxmo_notify_user.sh --urgency=critical \
|
||||
"No deviceprofile found $SXMO_DEVICE_NAME. See: https://sxmo.org/deviceprofile"
|
||||
fi
|
||||
|
||||
sxmo_migrate.sh state || sxmo_notify_user.sh --urgency=critical \
|
||||
"Config needs migration" "$? file(s) in your sxmo configuration are out of date and disabled - using defaults until you migrate (run sxmo_migrate.sh)"
|
||||
# Pre-warm app and script menu caches in background
|
||||
(
|
||||
sxmo_hook_apps.sh >/dev/null 2>&1 || true
|
||||
sxmo_hook_scripts.sh >/dev/null 2>&1 || true
|
||||
) &
|
||||
|
||||
@@ -18,14 +18,7 @@
|
||||
# right and "variable" icons (that come and go) on the left.
|
||||
|
||||
set_time() {
|
||||
if pidof peanutbutter > /dev/null; then
|
||||
#peanutbutter already features a clock, no need for one in the icon bar
|
||||
sxmobar -d time
|
||||
else
|
||||
date "+${SXMO_STATUS_DATE_FORMAT:-%H:%M}" | while read -r date; do
|
||||
sxmobar -a time 99 "$date"
|
||||
done
|
||||
fi
|
||||
sxmobar -a time 99 " $(date "+${SXMO_STATUS_DATE_FORMAT:-%H:%M}")"
|
||||
}
|
||||
|
||||
set_state() {
|
||||
@@ -38,13 +31,8 @@ set_state() {
|
||||
return
|
||||
fi
|
||||
|
||||
if command -v peanutbutter > /dev/null; then
|
||||
# no need for a state icon in this (default) scenario, the state will be obvious, either peanutbutter is on or it isn't
|
||||
sxmobar -d state
|
||||
return
|
||||
fi
|
||||
|
||||
case "$(sxmo_state.sh get)" in
|
||||
read -r cur_state < "$SXMO_STATE" 2>/dev/null || cur_state=""
|
||||
case "$cur_state" in
|
||||
screenoff)
|
||||
sxmobar -a -e bold -f red state 90 "$icon_state_screenoff" # filled circle
|
||||
;;
|
||||
@@ -52,7 +40,7 @@ set_state() {
|
||||
sxmobar -a -e bold -f red state 90 "$icon_state_lock" # open circle with slash
|
||||
;;
|
||||
unlock)
|
||||
sxmobar -a -e bold state 90 "$icon_state_unlock" # open circle
|
||||
sxmobar -d state
|
||||
;;
|
||||
esac
|
||||
}
|
||||
@@ -211,7 +199,7 @@ set_modem() {
|
||||
# $2 = interface name (wlan0, tun0)
|
||||
set_wifi() {
|
||||
|
||||
if rfkill list wifi | grep -q "yes"; then
|
||||
if /usr/sbin/rfkill list wifi 2>/dev/null | grep -q "yes"; then
|
||||
sxmobar -d wifi-status
|
||||
return
|
||||
fi
|
||||
@@ -238,7 +226,7 @@ set_wifi() {
|
||||
wifivpn=0
|
||||
fi
|
||||
|
||||
wifi_signal="$(nmcli -f IN-USE,SIGNAL,SSID device wifi | awk '/^\*/{if (NR!=1) {print $2}}')"
|
||||
wifi_signal="$(nmcli -f IN-USE,SIGNAL,SSID device wifi list --rescan no 2>/dev/null | awk '/^\*/{if (NR!=1) {print $2}}')"
|
||||
if [ -z "$wifi_signal" ]; then
|
||||
icon_wif="$icon_wifi_signal_exclam"
|
||||
elif [ "$wifi_signal" -lt 20 ]; then
|
||||
@@ -406,33 +394,33 @@ set_volume() {
|
||||
*Headset*)
|
||||
VOLCMP="$icon_hst"
|
||||
;;
|
||||
*)
|
||||
VOLCMP="$icon_mic"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if sxmo_audio.sh vol ismuted; then
|
||||
VOLCMP="$VOLCMP $icon_mut"
|
||||
VOLCMP="${VOLCMP:+$VOLCMP }$icon_mut"
|
||||
else
|
||||
case "$(sxmo_audio.sh device get 2>/dev/null)" in
|
||||
*Speaker*|"")
|
||||
# nothing for default or pulse devices
|
||||
;;
|
||||
*Headphone*)
|
||||
VOLCMP="$VOLCMP $icon_hdp"
|
||||
VOLCMP="${VOLCMP:+$VOLCMP }$icon_hdp"
|
||||
;;
|
||||
*Earpiece*)
|
||||
VOLCMP="$VOLCMP $icon_ear"
|
||||
VOLCMP="${VOLCMP:+$VOLCMP }$icon_ear"
|
||||
;;
|
||||
esac
|
||||
VOL="$(sxmo_audio.sh vol get)"
|
||||
VOL="$(sxmo_audio.sh vol get 2>/dev/null)"
|
||||
case "$VOL" in
|
||||
''|*[!0-9]*) VOL=0 ;;
|
||||
esac
|
||||
if [ "$VOL" -gt 66 ]; then
|
||||
VOLCMP="$VOLCMP $icon_spk"
|
||||
VOLCMP="${VOLCMP:+$VOLCMP }$icon_spk"
|
||||
elif [ "$VOL" -gt 33 ]; then
|
||||
VOLCMP="$VOLCMP $icon_spm"
|
||||
VOLCMP="${VOLCMP:+$VOLCMP }$icon_spm"
|
||||
elif [ "$VOL" -ge 0 ]; then
|
||||
VOLCMP="$VOLCMP $icon_spl"
|
||||
VOLCMP="${VOLCMP:+$VOLCMP }$icon_spl"
|
||||
fi
|
||||
fi
|
||||
sxmobar -a volume 50 "$VOLCMP"
|
||||
@@ -446,6 +434,17 @@ set_notch() {
|
||||
fi
|
||||
}
|
||||
|
||||
set_inputmethod() {
|
||||
im_file="${XDG_RUNTIME_DIR:-/run/user/10000}/sxmo_t9_mode"
|
||||
if [ -r "$im_file" ]; then
|
||||
read -r im_mode < "$im_file" 2>/dev/null || im_mode="[abc]"
|
||||
else
|
||||
im_mode="[abc]"
|
||||
fi
|
||||
[ -n "$im_mode" ] || im_mode="[abc]"
|
||||
sxmobar -a input-method 5 "$im_mode"
|
||||
}
|
||||
|
||||
sxmo_debug "$@"
|
||||
case "$1" in
|
||||
network)
|
||||
@@ -456,20 +455,28 @@ case "$1" in
|
||||
shift
|
||||
set_battery "$@"
|
||||
;;
|
||||
time|modem|volume|state|notifications|notch)
|
||||
time|modem|volume|state|notifications|notch|inputmethod)
|
||||
set_"$1"
|
||||
;;
|
||||
periodics|state_change) # 55 s loop and screenlock triggers
|
||||
state_change)
|
||||
set_state
|
||||
set_time
|
||||
set_inputmethod
|
||||
;;
|
||||
periodics) # 55 s loop
|
||||
set_time
|
||||
set_inputmethod
|
||||
if [ -z "$SXMO_NO_MODEM" ]; then
|
||||
set_modem
|
||||
fi
|
||||
set_notch
|
||||
set_state
|
||||
set_network wifi wlan0
|
||||
sxmo_hook_battery.sh 2>/dev/null || true
|
||||
;;
|
||||
all)
|
||||
sxmobar -r
|
||||
set_inputmethod
|
||||
set_time
|
||||
if [ -z "$SXMO_NO_MODEM" ]; then
|
||||
set_modem
|
||||
@@ -481,8 +488,13 @@ case "$1" in
|
||||
set_notifications
|
||||
set_notch
|
||||
set_network wifi wlan0
|
||||
sxmo_hook_battery.sh 2>/dev/null || true
|
||||
;;
|
||||
*)
|
||||
exit # swallow it !
|
||||
;;
|
||||
esac
|
||||
|
||||
if [ "${SXMO_WM:-dwm}" = "dwm" ] && command -v xsetroot >/dev/null 2>&1; then
|
||||
DISPLAY="${DISPLAY:-:0}" xsetroot -name "$(sxmo_status.sh)" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
@@ -9,12 +9,21 @@
|
||||
|
||||
# This hook is called when the system becomes unlocked again
|
||||
|
||||
sxmo_led.sh blink red green &
|
||||
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||
sxmo_led.sh blink red green &
|
||||
fi
|
||||
|
||||
sxmo_wm.sh display on
|
||||
sxmo_wm.sh inputevent touchscreen 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
|
||||
|
||||
sxmo_jobs.sh stop periodic_blink
|
||||
if [ -z "$SXMO_DISABLE_LEDS" ]; then
|
||||
sxmo_jobs.sh stop periodic_blink
|
||||
fi
|
||||
sxmo_jobs.sh stop periodic_wakelock_check
|
||||
|
||||
# Go to the next idle state after 120 seconds of inactivity
|
||||
|
||||
Reference in New Issue
Block a user