Disable most of input handler when a locker is running
A problem was introduced in 4562daea67
because it kind-of bypasses the state mechanism. Whenever a locker was
running the state would remain `unlock` and therefore the inputhandler
would be fully enabled and menus could still be opened with gestured
(although they wouldn't show because of the locker).
This patch solves that, it's not an ideal implementation but is
a bit of a minimal temporary patch until we revise/simplify the
entire state locking mechanism.
It also moves the burden of removing icons for peanutbutter to
sxmo_hook_statusbar instead of sxmo_hook_lockstatusbar
Signed-off-by: Willow Barraco <contact@willowbarraco.fr>
This commit is contained in:

committed by
Willow Barraco

parent
84b61f4a72
commit
6bb78da702
@@ -22,7 +22,7 @@ WMNAME="$(printf %s "$XPROPOUT" | grep title: | cut -d" " -f2- | tr '[:upper:]'
|
|||||||
|
|
||||||
sxmo_debug "STATE: $(sxmo_state.sh get) ACTION: $ACTION WMCLASS: $WMCLASS WMNAME: $WMNAME"
|
sxmo_debug "STATE: $(sxmo_state.sh get) ACTION: $ACTION WMCLASS: $WMCLASS WMNAME: $WMNAME"
|
||||||
|
|
||||||
if ! sxmo_state.sh get | grep -q unlock; then
|
if sxmo_state.sh is_locked; then
|
||||||
case "$WMNAME" in # Handle programs
|
case "$WMNAME" in # Handle programs
|
||||||
*"epy"*|*"epr"*)
|
*"epy"*|*"epr"*)
|
||||||
case "$ACTION" in
|
case "$ACTION" in
|
||||||
|
@@ -5,7 +5,8 @@
|
|||||||
# For use with peanutbutter (peanutbutter --font Sxmo --statuscommand sxmo_hook_lockstatusbar.sh)
|
# For use with peanutbutter (peanutbutter --font Sxmo --statuscommand sxmo_hook_lockstatusbar.sh)
|
||||||
# This filters out the last component (which is usually the time and is already displayed more prominently
|
# This filters out the last component (which is usually the time and is already displayed more prominently
|
||||||
|
|
||||||
# obtain status output to pass to peanutbutter, using awk to remove the last
|
# make sure status bar icons are suited for peanutbutter
|
||||||
# column (the time), which we don't need duplicated. We also remove the · symbol which we use in $SXMO_NOTCH
|
sxmo_hook_statusbar.sh state_change
|
||||||
# and is not needed for the lockscreen.
|
|
||||||
sxmo_status_watch.sh -o pango | tr -d "·" | awk 'NF{NF-=1};1'
|
# obtain status output to pass to peanutbutter (this keeps running and updating to stdout)
|
||||||
|
sxmo_status_watch.sh -o pango
|
||||||
|
@@ -43,6 +43,8 @@ wait
|
|||||||
|
|
||||||
case "$SXMO_WM" in
|
case "$SXMO_WM" in
|
||||||
sway)
|
sway)
|
||||||
command -v peanutbutter 2> /dev/null && peanutbutter --font Sxmo --statuscommand sxmo_hook_lockstatusbar.sh &
|
if command -v peanutbutter > /dev/null; then
|
||||||
|
peanutbutter --font Sxmo --statuscommand sxmo_hook_lockstatusbar.sh && sxmo_hook_statusbar.sh state_change &
|
||||||
|
fi
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
@@ -17,9 +17,14 @@
|
|||||||
# right and "variable" icons (that come and go) on the left.
|
# right and "variable" icons (that come and go) on the left.
|
||||||
|
|
||||||
set_time() {
|
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
|
date "+${SXMO_STATUS_DATE_FORMAT:-%H:%M}" | while read -r date; do
|
||||||
sxmobar -a time 99 "$date"
|
sxmobar -a time 99 "$date"
|
||||||
done
|
done
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
set_state() {
|
set_state() {
|
||||||
@@ -32,12 +37,11 @@ set_state() {
|
|||||||
return
|
return
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if command -v peanutbutter 2> /dev/null; then
|
if command -v peanutbutter > /dev/null; then
|
||||||
if [ "$SXMO_STATES" = "unlock screenoff" ]; then
|
|
||||||
# no need for a state icon in this (default) scenario, the state will be obvious, either peanutbutter is on or it isn't
|
# 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
|
return
|
||||||
fi
|
fi
|
||||||
fi
|
|
||||||
|
|
||||||
case "$(sxmo_state.sh get)" in
|
case "$(sxmo_state.sh get)" in
|
||||||
screenoff)
|
screenoff)
|
||||||
@@ -426,8 +430,10 @@ set_volume() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set_notch() {
|
set_notch() {
|
||||||
if [ -n "$SXMO_NOTCH" ]; then
|
if [ -n "$SXMO_NOTCH" ] && ! pidof peanutbutter > /dev/null; then
|
||||||
sxmobar -a notch "${SXMO_NOTCH_PRIO:-29}" "$SXMO_NOTCH"
|
sxmobar -a notch "${SXMO_NOTCH_PRIO:-29}" "$SXMO_NOTCH"
|
||||||
|
else
|
||||||
|
sxmobar -d notch
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -449,6 +455,7 @@ case "$1" in
|
|||||||
if [ -z "$SXMO_NO_MODEM" ]; then
|
if [ -z "$SXMO_NO_MODEM" ]; then
|
||||||
set_modem
|
set_modem
|
||||||
fi
|
fi
|
||||||
|
set_notch
|
||||||
set_state
|
set_state
|
||||||
set_network wifi wlan0
|
set_network wifi wlan0
|
||||||
;;
|
;;
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
. sxmo_common.sh
|
. sxmo_common.sh
|
||||||
|
|
||||||
SXMO_STATE="${SXMO_STATE:-$XDG_RUNTIME_DIR/sxmo.state}"
|
SXMO_STATE="${SXMO_STATE:-$XDG_RUNTIME_DIR/sxmo.state}"
|
||||||
if command -v peanutbutter 2> /dev/null; then
|
if command -v peanutbutter > /dev/null; then
|
||||||
#no separate lock stage needed when peanutbutter is used
|
#no separate lock stage needed when peanutbutter is used
|
||||||
SXMO_STATES="${SXMO_STATES:-unlock screenoff}"
|
SXMO_STATES="${SXMO_STATES:-unlock screenoff}"
|
||||||
else
|
else
|
||||||
@@ -164,6 +164,12 @@ case "$action" in
|
|||||||
read_state
|
read_state
|
||||||
printf %s "$state"
|
printf %s "$state"
|
||||||
;;
|
;;
|
||||||
|
is_locked)
|
||||||
|
pidof peanutbutter swaylock waylock i3lock > /dev/null && exit 0
|
||||||
|
if sxmo_state.sh get | grep -q unlock; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
set)
|
set)
|
||||||
lock_exclusive
|
lock_exclusive
|
||||||
read_state
|
read_state
|
||||||
|
Reference in New Issue
Block a user