sway/bin: don't run multiple instances of swaylock
This commit is contained in:
parent
e6355b12ad
commit
773bf1899a
2 changed files with 10 additions and 0 deletions
|
@ -22,6 +22,15 @@ function _check_inhibit() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function _check_running() {
|
||||||
|
pgrep $1
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -eq 0 ]; then
|
||||||
|
_log _check_running: INFO already running $1
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
function _set_inhibit() {
|
function _set_inhibit() {
|
||||||
file=$1
|
file=$1
|
||||||
action=$2
|
action=$2
|
||||||
|
|
|
@ -16,6 +16,7 @@ function _clean() {
|
||||||
function _lock() {
|
function _lock() {
|
||||||
_check_inhibit $INHIBIT_FILE
|
_check_inhibit $INHIBIT_FILE
|
||||||
$MEDIA_APP stop
|
$MEDIA_APP stop
|
||||||
|
_check_running $LOCK_APP
|
||||||
$LOCK_APP $LOCK_ARGS
|
$LOCK_APP $LOCK_ARGS
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue