added lock.sh and unlock.sh
This commit is contained in:
parent
27304c4927
commit
f9fdad44c4
2 changed files with 22 additions and 0 deletions
11
lock.sh
Executable file
11
lock.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
loginctl lock-session
|
||||
exit_code=$?
|
||||
time=$(date +"%r")
|
||||
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
kdeconnect-cli -d "$(kdeconnect-cli -l | grep -oP '(?<=: )\w{8}_\w{4}_\w{4}_\w{4}_\w{12}')" --ping-msg "Locked $HOSTNAME ($time)"
|
||||
else
|
||||
kdeconnect-cli -d "$(kdeconnect-cli -l | grep -oP '(?<=: )\w{8}_\w{4}_\w{4}_\w{4}_\w{12}')" --ping-msg "Failed to lock $HOSTNAME ($time) - Error code: $exit_code"
|
||||
fi
|
11
unlock.sh
Executable file
11
unlock.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/bash
|
||||
|
||||
loginctl unlock-session
|
||||
exit_code=$?
|
||||
time=$(date +"%r")
|
||||
|
||||
if [ $exit_code -eq 0 ]; then
|
||||
kdeconnect-cli -d "$(kdeconnect-cli -l | grep -oP '(?<=: )\w{8}_\w{4}_\w{4}_\w{4}_\w{12}')" --ping-msg "Unlocked $HOSTNAME ($time)"
|
||||
else
|
||||
kdeconnect-cli -d "$(kdeconnect-cli -l | grep -oP '(?<=: )\w{8}_\w{4}_\w{4}_\w{4}_\w{12}')" --ping-msg "Failed to unlock $HOSTNAME ($time) - Error code: $exit_code"
|
||||
fi
|
Loading…
Reference in a new issue