Remove unnecessary background services and polling loops to improve battery life

This commit is contained in:
Luxferre committed 2026-10-27 08:08:05 +02:00
1 parent 726500085a
commit 68cf9c515b
17 files changed
+159 -22

No files matched your search

+14
View File
@@ -0,0 +1,14 @@
# /etc/inittab
::sysinit:/sbin/openrc sysinit
::sysinit:/sbin/openrc boot
::wait:/sbin/openrc default
# Keep a single console getty on tty1
tty1::respawn:/sbin/getty 38400 tty1
# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
::shutdown:/sbin/openrc shutdown
@@ -76,9 +76,8 @@ superctl start dunst
# 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
if [ "$(command -v fcitx5)" ]; then
superctl start fcitx5
fi
[ -n "$SXMO_MONITOR" ] && xrandr --output "$SXMO_MONITOR" --primary
@@ -109,9 +108,6 @@ 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
# Monitor the battery
superctl start sxmo_battery_monitor
# It watch network changes and update the status bar icon by example
superctl start sxmo_networkmonitor
@@ -67,18 +67,12 @@ mainloop() {
echo "$line" | grep -qE "^signal" && sxmo_modem.sh checkfornewtexts
done &
# Check for new texts periodically
sxmo_run_aligned.sh 300 sxmo_modem.sh checkfornewtexts &
# Monitor for finished calls
dbus-monitor --system "interface='org.freedesktop.DBus.Properties',member='PropertiesChanged',arg0='org.freedesktop.ModemManager1.Call'" |
while read -r line; do
echo "$line" | grep -qE "^signal" && sxmo_modem.sh checkforfinishedcalls
done &
# Periodically remove finished calls
sxmo_run_aligned.sh 300 sxmo_modem.sh checkforfinishedcalls &
# Monitor for modem state change
dbus-monitor --system "interface='org.freedesktop.ModemManager1.Modem',type='signal',member='StateChanged'" |
while read -r line; do
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,4 @@
[D-BUS Service]
Name=org.freedesktop.UPower
Exec=/bin/false
User=root
@@ -46,12 +46,7 @@ if [ -n "$sysfs_dir" ] && [ -r "$sysfs_dir/capacity" ] && [ -r "$sysfs_dir/statu
*) 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)"
exit 0
fi
if [ -z "$name" ] || [ -z "$state" ] || [ -z "$percentage" ] || [ "$state" = "unknown" ]; then
@@ -76,7 +76,6 @@ superctl start dunst
# 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 [ "$(command -v fcitx5)" ]; then
superctl start fcitx5
@@ -109,9 +108,6 @@ 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
# Monitor the battery
superctl start sxmo_battery_monitor
# It watch network changes and update the status bar icon by example
superctl start sxmo_networkmonitor
@@ -520,6 +520,7 @@ case "$1" in
set_state
set_time
set_inputmethod
sxmo_hook_battery.sh 2>/dev/null || true
;;
periodics) # 55 s loop
set_time