-
Notifications
You must be signed in to change notification settings - Fork 0
/
gnomescrlock.sh
executable file
·50 lines (47 loc) · 1.72 KB
/
gnomescrlock.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/bin/bash
# Copyright (C) 2019 Jark255
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
function help () {
echo 'gnome3-screenlock-cli - Simple control script for gnome3 screensaver'
echo ''
echo 'gnome3-screenlock-cli Copyright (C) 2019 Jark255'
echo 'This program comes with ABSOLUTELY NO WARRANTY'
echo 'This is free software, and you are welcome to redistribute it'
echo 'under certain conditions.'
echo ''
echo 'Usage: ./gnomescrlock.sh [lock | unlock | help]'
echo 'lock - lock session'
echo 'unlock - remove lock (screen still will be turned off)'
echo 'help - shows this help screen'
exit 1
}
COMMAND=$1
if [ -z $COMMAND ]
then
echo 'No command provided. Showing help screen'
help
elif [ $COMMAND == 'help' ]
then
help
elif [ $COMMAND == 'lock' ]
then
dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.Lock
elif [ $COMMAND == 'unlock' ]
then
dbus-send --type=method_call --dest=org.gnome.ScreenSaver /org/gnome/ScreenSaver org.gnome.ScreenSaver.SetActive boolean:false
else
echo 'Something went wrong. Showing help screen'
help
fi