Prevent duplicate xlocker activation during X11 session startup
This commit is contained in:
1 parent
b8dea31b59
commit
dbd8cef2e1
8 files changed
+39
-21
No files matched your search
@@ -10,11 +10,11 @@
|
|||||||
. sxmo_common.sh
|
. sxmo_common.sh
|
||||||
|
|
||||||
# Create xdg user directories, such as ~/Pictures
|
# Create xdg user directories, such as ~/Pictures
|
||||||
[ -d "$HOME/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
|
# 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
|
if command -v fc-cache > /dev/null && [ -z "$(ls -A /var/cache/fontconfig 2>/dev/null)" ]; then
|
||||||
fc-cache >/dev/null 2>&1 &
|
( fc-cache >/dev/null 2>&1 & )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! superctl status > /dev/null 2>&1; then
|
if ! superctl status > /dev/null 2>&1; then
|
||||||
@@ -45,11 +45,13 @@ if [ -z "$SXMO_NO_AUDIO" ]; then
|
|||||||
|
|
||||||
# monitor for headphone for statusbar
|
# monitor for headphone for statusbar
|
||||||
superctl start sxmo_soundmonitor
|
superctl start sxmo_soundmonitor
|
||||||
|
(
|
||||||
(
|
(
|
||||||
sleep 1
|
sleep 1
|
||||||
sxmo_audio.sh device apply >/dev/null 2>&1 || true
|
sxmo_audio.sh device apply >/dev/null 2>&1 || true
|
||||||
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
||||||
) &
|
) &
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Periodically update some status bar components
|
# Periodically update some status bar components
|
||||||
@@ -58,6 +60,7 @@ sxmo_jobs.sh start statusbar_periodics sxmo_run_aligned.sh 60 \
|
|||||||
sxmo_hook_statusbar.sh periodics
|
sxmo_hook_statusbar.sh periodics
|
||||||
|
|
||||||
# dunst is required for warnings.
|
# dunst is required for warnings.
|
||||||
|
/usr/bin/bananarchy-sync-dunst-theme --no-restart >/dev/null 2>&1 || true
|
||||||
superctl start dunst
|
superctl start dunst
|
||||||
|
|
||||||
# start adaptive brightness at boot
|
# start adaptive brightness at boot
|
||||||
@@ -78,9 +81,10 @@ if sxmo_wakelock.sh isenabled; then
|
|||||||
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
|
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Activate lockscreen upon GUI startup
|
# Ensure lockscreen is active if session is still locked and locker has not yet mapped
|
||||||
printf '1\n' > /tmp/bananarchy_screen_locked
|
if [ -f /tmp/bananarchy_screen_locked ] && [ ! -f "$XDG_RUNTIME_DIR/xlocker.pid" ]; then
|
||||||
sxmo_state.sh set lock
|
( xlocker >/dev/null 2>&1 & )
|
||||||
|
fi
|
||||||
|
|
||||||
# Turn on lisgd only on touch devices
|
# Turn on lisgd only on touch devices
|
||||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
|
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
|
||||||
@@ -100,7 +104,6 @@ fi
|
|||||||
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
|
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
|
if [ -f /tmp/bananarchy_screen_locked ]; then
|
||||||
pkill -STOP -x conky 2>/dev/null || true
|
pkill -STOP -x conky 2>/dev/null || true
|
||||||
xlocker wake >/dev/null 2>&1 &
|
|
||||||
fi
|
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
|
||||||
@@ -110,7 +113,9 @@ superctl start sxmo_networkmonitor
|
|||||||
superctl start sxmo_notificationmonitor
|
superctl start sxmo_notificationmonitor
|
||||||
|
|
||||||
# Pre-warm app and script menu caches in background
|
# Pre-warm app and script menu caches in background
|
||||||
|
(
|
||||||
(
|
(
|
||||||
sxmo_hook_apps.sh >/dev/null 2>&1 || true
|
sxmo_hook_apps.sh >/dev/null 2>&1 || true
|
||||||
sxmo_hook_scripts.sh >/dev/null 2>&1 || true
|
sxmo_hook_scripts.sh >/dev/null 2>&1 || true
|
||||||
) &
|
) &
|
||||||
|
)
|
||||||
@@ -10,11 +10,11 @@
|
|||||||
. sxmo_common.sh
|
. sxmo_common.sh
|
||||||
|
|
||||||
# Create xdg user directories, such as ~/Pictures
|
# Create xdg user directories, such as ~/Pictures
|
||||||
[ -d "$HOME/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
|
# 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
|
if command -v fc-cache > /dev/null && [ -z "$(ls -A /var/cache/fontconfig 2>/dev/null)" ]; then
|
||||||
fc-cache >/dev/null 2>&1 &
|
( fc-cache >/dev/null 2>&1 & )
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ! superctl status > /dev/null 2>&1; then
|
if ! superctl status > /dev/null 2>&1; then
|
||||||
@@ -45,11 +45,13 @@ if [ -z "$SXMO_NO_AUDIO" ]; then
|
|||||||
|
|
||||||
# monitor for headphone for statusbar
|
# monitor for headphone for statusbar
|
||||||
superctl start sxmo_soundmonitor
|
superctl start sxmo_soundmonitor
|
||||||
|
(
|
||||||
(
|
(
|
||||||
sleep 1
|
sleep 1
|
||||||
sxmo_audio.sh device apply >/dev/null 2>&1 || true
|
sxmo_audio.sh device apply >/dev/null 2>&1 || true
|
||||||
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
sxmo_hook_statusbar.sh volume >/dev/null 2>&1 || true
|
||||||
) &
|
) &
|
||||||
|
)
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Periodically update some status bar components
|
# Periodically update some status bar components
|
||||||
@@ -58,6 +60,7 @@ sxmo_jobs.sh start statusbar_periodics sxmo_run_aligned.sh 60 \
|
|||||||
sxmo_hook_statusbar.sh periodics
|
sxmo_hook_statusbar.sh periodics
|
||||||
|
|
||||||
# dunst is required for warnings.
|
# dunst is required for warnings.
|
||||||
|
/usr/bin/bananarchy-sync-dunst-theme --no-restart >/dev/null 2>&1 || true
|
||||||
superctl start dunst
|
superctl start dunst
|
||||||
|
|
||||||
# start adaptive brightness at boot
|
# start adaptive brightness at boot
|
||||||
@@ -78,9 +81,10 @@ if sxmo_wakelock.sh isenabled; then
|
|||||||
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
|
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Activate lockscreen upon GUI startup
|
# Ensure lockscreen is active if session is still locked and locker has not yet mapped
|
||||||
printf '1\n' > /tmp/bananarchy_screen_locked
|
if [ -f /tmp/bananarchy_screen_locked ] && [ ! -f "$XDG_RUNTIME_DIR/xlocker.pid" ]; then
|
||||||
sxmo_state.sh set lock
|
( xlocker >/dev/null 2>&1 & )
|
||||||
|
fi
|
||||||
|
|
||||||
# Turn on lisgd only on touch devices
|
# Turn on lisgd only on touch devices
|
||||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
|
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
|
||||||
@@ -100,7 +104,6 @@ fi
|
|||||||
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
|
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
|
if [ -f /tmp/bananarchy_screen_locked ]; then
|
||||||
pkill -STOP -x conky 2>/dev/null || true
|
pkill -STOP -x conky 2>/dev/null || true
|
||||||
xlocker wake >/dev/null 2>&1 &
|
|
||||||
fi
|
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
|
||||||
@@ -110,7 +113,9 @@ superctl start sxmo_networkmonitor
|
|||||||
superctl start sxmo_notificationmonitor
|
superctl start sxmo_notificationmonitor
|
||||||
|
|
||||||
# Pre-warm app and script menu caches in background
|
# Pre-warm app and script menu caches in background
|
||||||
|
(
|
||||||
(
|
(
|
||||||
sxmo_hook_apps.sh >/dev/null 2>&1 || true
|
sxmo_hook_apps.sh >/dev/null 2>&1 || true
|
||||||
sxmo_hook_scripts.sh >/dev/null 2>&1 || true
|
sxmo_hook_scripts.sh >/dev/null 2>&1 || true
|
||||||
) &
|
) &
|
||||||
|
)
|
||||||
@@ -56,7 +56,8 @@ mkdir -p "$XDG_RUNTIME_DIR" "$XDG_CACHE_HOME/sxmo" "$XDG_CONFIG_HOME/sxmo"
|
|||||||
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"
|
||||||
printf "unlock\n" > "$XDG_RUNTIME_DIR/sxmo.state"
|
printf "1\n" > /tmp/bananarchy_screen_locked
|
||||||
|
printf "lock\n" > "$XDG_RUNTIME_DIR/sxmo.state"
|
||||||
|
|
||||||
_init_bl=""
|
_init_bl=""
|
||||||
if [ -r "$XDG_CONFIG_HOME/sxmo/brightness" ]; then
|
if [ -r "$XDG_CONFIG_HOME/sxmo/brightness" ]; then
|
||||||
@@ -116,6 +117,9 @@ trap 'rm -f "$SESSION_PID_FILE"; pkill -P $$ >/dev/null 2>&1 || true; exit 0' IN
|
|||||||
pkill -9 -x conky >/dev/null 2>&1 || true
|
pkill -9 -x conky >/dev/null 2>&1 || true
|
||||||
rm -rf /tmp/sxmo_conky_time_state /tmp/sxmo_conky_restart.lock
|
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
|
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
|
||||||
( sxmo_hook_start.sh >/tmp/sxmo_hook_start.log 2>&1 </dev/null & )
|
( sxmo_hook_start.sh >/tmp/sxmo_hook_start.log 2>&1 </dev/null & )
|
||||||
|
|
||||||
first_iter=1
|
first_iter=1
|
||||||
|
|||||||
Binary file not shown.
@@ -26,7 +26,7 @@ case "$SXMO_WM" in
|
|||||||
if ! sxmo_jobs.sh running proximity_lock -q; then
|
if ! sxmo_jobs.sh running proximity_lock -q; then
|
||||||
sxmo_dmenu.sh close
|
sxmo_dmenu.sh close
|
||||||
fi
|
fi
|
||||||
xlocker >/dev/null 2>&1 &
|
[ -f "$XDG_RUNTIME_DIR/xlocker.pid" ] || xlocker >/dev/null 2>&1 &
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
|||||||
@@ -81,9 +81,10 @@ if sxmo_wakelock.sh isenabled; then
|
|||||||
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
|
sxmo_wakelock.sh lock sxmo_not_suspendable infinite
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Activate lockscreen upon GUI startup
|
# Ensure lockscreen is active if session is still locked and locker has not yet mapped
|
||||||
printf '1\n' > /tmp/bananarchy_screen_locked
|
if [ -f /tmp/bananarchy_screen_locked ] && [ ! -f "$XDG_RUNTIME_DIR/xlocker.pid" ]; then
|
||||||
sxmo_state.sh set lock
|
( xlocker >/dev/null 2>&1 & )
|
||||||
|
fi
|
||||||
|
|
||||||
# Turn on lisgd only on touch devices
|
# Turn on lisgd only on touch devices
|
||||||
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
|
if [ -z "$SXMO_NO_VIRTUAL_KEYBOARD" ] && [ ! -e "$XDG_CACHE_HOME"/sxmo/sxmo.nogesture ]; then
|
||||||
@@ -103,7 +104,6 @@ fi
|
|||||||
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
|
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
|
if [ -f /tmp/bananarchy_screen_locked ]; then
|
||||||
pkill -STOP -x conky 2>/dev/null || true
|
pkill -STOP -x conky 2>/dev/null || true
|
||||||
( xlocker wake >/dev/null 2>&1 & )
|
|
||||||
fi
|
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
|
||||||
|
|||||||
Binary file not shown.
@@ -674,16 +674,20 @@ int locker_run_main(int argc, char** argv) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
auto lockPhone = [&](bool blankDisplay) {
|
auto lockPhone = [&](bool blankDisplay) {
|
||||||
|
bool alreadyVisible = visible;
|
||||||
writeSmallFileStr(kLockFlagPath, "1\n");
|
writeSmallFileStr(kLockFlagPath, "1\n");
|
||||||
writeIntFile(activePidPath, static_cast<int>(::getpid()));
|
writeIntFile(activePidPath, static_cast<int>(::getpid()));
|
||||||
closeOtherOverlays();
|
closeOtherOverlays();
|
||||||
verifier.refreshIfNeeded();
|
verifier.refreshIfNeeded();
|
||||||
|
int64_t now = nowMs();
|
||||||
|
lastActivityMs = now;
|
||||||
|
if (!alreadyVisible || blankDisplay) {
|
||||||
passcode.clear();
|
passcode.clear();
|
||||||
statusMsg.clear();
|
statusMsg.clear();
|
||||||
statusIsError = false;
|
statusIsError = false;
|
||||||
lockActivatedMs = nowMs();
|
lockActivatedMs = now;
|
||||||
lastActivityMs = lockActivatedMs;
|
writeSoftkeySuppress(now + 400);
|
||||||
writeSoftkeySuppress(lockActivatedMs + 400);
|
}
|
||||||
if (!visible) {
|
if (!visible) {
|
||||||
XMapRaised(dpy, win);
|
XMapRaised(dpy, win);
|
||||||
XMoveResizeWindow(dpy, win, 0, 0, kScreenWidth, kScreenHeight);
|
XMoveResizeWindow(dpy, win, 0, 0, kScreenWidth, kScreenHeight);
|
||||||
|
|||||||
Reference in new issue
Block a user