-
Notifications
You must be signed in to change notification settings - Fork 1
/
installer.sh
executable file
·86 lines (64 loc) · 2.91 KB
/
installer.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
#Creating directories and copying files
BASEDIR=$(dirname "$0")
mkdir ~/.CoPaScripts
mkdir ~/.CoPaScripts/Night-Light-Switch-Script-Gnome
cp $BASEDIR/nightLight.sh ~/.CoPaScripts/Night-Light-Switch-Script-Gnome/
cp $BASEDIR/LICENSE ~/.CoPaScripts/Night-Light-Switch-Script-Gnome/
cp $BASEDIR/README.md ~/.CoPaScripts/Night-Light-Switch-Script-Gnome/
#Changing execution privileges
chmod u+x ~/.CoPaScripts/Night-Light-Switch-Script-Gnome/*
#gsettings set org.gnome.desktop.wm.keybindings Gnome-Night-Light-Switch ['<Shift><Control>l']
#Setting up NightLight
gsettings set org.gnome.settings-daemon.plugins.color active true
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-from 1e-08
gsettings set org.gnome.settings-daemon.plugins.color night-light-schedule-to 24
#Adding a new custom keyboard shortcut
firstlist=$(gsettings get org.gnome.settings-daemon.plugins.media-keys custom-keybindings)
echo "$firstlist
Enter the number of the last custom shortcut .../custom{NUMBER}/']'"
read lastcustom
sure=$true
while [[ $sure ]]; do
echo 'Are you sure ? And is this a number ? (yes/no)'
read response
if [[ $response="yes" ]]; then
sure=$false
elif [[ $response="no" ]]; then
echo 'Enter the number of the last custom shortcut'
read lastcustom
fi
done
lastcustom=$(($lastcustom+1))
addedString=", '/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom"$lastcustom"/']"
firstlist=${firstlist:0:-1}$addedString
echo "$firstlist"
echo "Change would be added.
Press Ctrl+C if you want to leave or Press Enter to continue..."
read lol
sure=true
while [[ $sure ]]; do
echo "By default the shortcut would be Ctrl+Shift+L
Do you want modify it? A shortcut code will be asked. (yes/no)"
read response
if [[ $response="no" ]]; then
sure=$false
shortcutcode="<Shift><Control>l"
elif [[ $response="yes" ]]; then
echo 'Enter the custom shortcut code'
read shortcutcode
fi
done
echo "You will be able to modify the shortcut in the Gnome settings"
#Making the change
gsettings set org.gnome.settings-daemon.plugins.media-keys custom-keybindings "$firstlist"
read lolll
#configuring the shortcut
echo "Enter the shortcut name"
read shortcutname
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom"$lastcustom"/ name "$shortcutname"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom"$lastcustom"/ command "/home/$USER/.CoPaScripts/Night-Light-Switch-Script-Gnome/nightLight.sh"
gsettings set org.gnome.settings-daemon.plugins.media-keys.custom-keybinding:/org/gnome/settings-daemon/plugins/media-keys/custom-keybindings/custom"$lastcustom"/ binding "$shortcutcode"
echo "-----------DONE-----------
Now your shortcut should be enabled. Enjoy :D
Project Creator: Paul Coral"