4
# FILE NAME lock-and-suspend.sh
6
# Lock and suspend a LightDM Session.
9
# Gustav Hartvigsson 2024
10
# Distributed under the Cool Licence 1.1
15
#FIXME: Auto detect DM?
16
__DM_TOOL="dm-tool lock"
19
function __auto_system () {
20
if [[ -n $(which systemctl) ]]; then
22
elif [[ -n $(which dbus-send) ]]; then
24
elif [[ $(which loginctl) ]]; then
26
elif [[ -n $(which pm-suspend) ]]; then
29
echo "UNSUPORTED SYSTEM!?"
34
function __suspend() {
36
if [[ $__SYSTEM == "systemd" ]]; then
38
systemctl suspend-then-hibernate
39
elif [[ $__SYSTEM == "dbus" ]]; then
41
bus-send --system --print-reply\
42
--dest=org.freedesktop.login1 /org/freedesktop/login
43
"org.freedesktop.login1.Manager.Suspend"\
45
elif [[ $__SYSTEM == "loginctl" ]]; then
48
elif [[ $__SYSTEM == "pm" ]]; then
52
echo "UNSUPORTED SYSTEM!?"
57
function __parse_args() {
59
echo "Argurment parsing is not implemented yet!"
63
if [[ $# != 0 ]]; then