ssm
Signed-off-by: fbt <fbt@fleshless.org>
This commit is contained in:
parent
22eac4d45f
commit
7e99d071c0
33
homedir/.config/ssm/services/lockd
Executable file
33
homedir/.config/ssm/services/lockd
Executable file
|
@ -0,0 +1,33 @@
|
|||
#!/usr/bin/env ssm
|
||||
# vim: ft=sh
|
||||
|
||||
service_respawn='true'
|
||||
service_command="$HOME/bin/lockd"
|
||||
service_args=( i3lock-extra -s -o ~/pics/lock.png -g -p )
|
||||
|
||||
function do_notify {
|
||||
declare output; var output
|
||||
output = "$( "$@" )"
|
||||
|
||||
if output; then
|
||||
notify-send "ssm ($service_name)" "$output"
|
||||
fi
|
||||
}
|
||||
|
||||
function start_or_lock {
|
||||
if status; then
|
||||
notify-send 'ssm' "Starting $service_name"
|
||||
start
|
||||
else
|
||||
notify-send 'ssm' "Locking..."
|
||||
kill -USR1 "$service_pid"
|
||||
fi
|
||||
}
|
||||
|
||||
function toggle {
|
||||
if status; then
|
||||
do_notify "$0" "$service_name" stop
|
||||
else
|
||||
do_notify "$0" "$service_name" start
|
||||
fi
|
||||
}
|
|
@ -1,30 +0,0 @@
|
|||
#!/usr/bin/env ssm
|
||||
# vim: ft=sh
|
||||
|
||||
service_respawn='true'
|
||||
service_command="$HOME/bin/lockd"
|
||||
service_args=( i3lock-extra -s -o ~/pics/lock.png -g -p )
|
||||
|
||||
function _lock {
|
||||
kill -USR1 "$service_pid"
|
||||
}
|
||||
|
||||
function lock {
|
||||
status || {
|
||||
start; sleep 1
|
||||
"$0" "$service_name" lock
|
||||
return "$?"
|
||||
}
|
||||
|
||||
_lock
|
||||
}
|
||||
|
||||
function toggle {
|
||||
if status; then
|
||||
out=$( "$0" "$service_name" stop 2>&1 )
|
||||
notify-send "ssm" "$out"
|
||||
else
|
||||
out=$( "$0" "$service_name" start 2>&1 )
|
||||
notify-send "ssm" "$out"
|
||||
fi
|
||||
}
|
Loading…
Reference in New Issue
Block a user