-
Notifications
You must be signed in to change notification settings - Fork 0
/
utils.sh
187 lines (152 loc) · 5.91 KB
/
utils.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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/usr/bin/env bash
#Installing utils
# Ask for the administrator password upfront.
sudo -v
# Keep-alive: update existing `sudo` time stamp until the script has finished.
while true; do sudo -n true; sleep 60; kill -0 "$$" || exit; done 2>/dev/null &
#Variables
latitude=19.04
longitude=73.02
####################################### XPAD #######################################
read -p "Install XPAD? (press y for yes)" -n 1;
echo "";
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "";
echo "#######################################################";
echo "### XPAD ###";
echo "#######################################################";
echo "";
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Installing XPAD<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";
sudo apt-get install xpad;
echo "";
# Confirmation of installation
sudo dpkg -l xpad
echo "";
fi
####################################### REDSHIFT ###################################
read -p "Install Redshift? (press y for yes)" -n 1;
echo "";
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "";
echo "#######################################################";
echo "### Redshift ###";
echo "#######################################################";
echo "";
echo ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>Installing Redshift<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<";
sudo apt-get install redshift redshift-gtk
echo "";
echo "Writing ~/.config/redshift.conf";
cat >~/.config/redshift.conf <<EOL
; Global settings for redshift
[redshift]
; Set the day and night screen temperatures
temp-day=5700
temp-night=3500
; Enable/Disable a smooth transition between day and night
; 0 will cause a direct change from day to night screen temperature.
; 1 will gradually increase or decrease the screen temperature.
transition=1
; Set the screen brightness. Default is 1.0.
;brightness=0.9
; It is also possible to use different settings for day and nightP
; since version 1.8.
;brightness-day=0.7
;brightness-night=0.4
; Set the screen gamma (for all colors, or each color channel
; individually)
gamma=0.8
;gamma=0.8:0.7:0.8
; This can also be set individually for day and night since
; version 1.10.
;gamma-day=0.8:0.7:0.8
;gamma-night=0.6
; Set the location-provider: 'geoclue', 'geoclue2', 'manual'
; type 'redshift -l list' to see possible values.
; The location provider settings are in a different section.
location-provider=manual
; Set the adjustment-method: 'randr', 'vidmode'
; type 'redshift -m list' to see all possible values.
; 'randr' is the preferred method, 'vidmode' is an older API.
; but works in some cases when 'randr' does not.
; The adjustment method settings are in a different section.
adjustment-method=randr
; Configuration of the location-provider:
; type 'redshift -l PROVIDER:help' to see the settings.
; ex: 'redshift -l manual:help'
; Keep in mind that longitudes west of Greenwich (e.g. the Americas)
; are negative numbers.
[manual]
lat=${latitude}
lon=${longitude}
; Configuration of the adjustment-method
; type 'redshift -m METHOD:help' to see the settings.
; ex: 'redshift -m randr:help'
; In this example, randr is configured to adjust screen 1.
; Note that the numbering starts from 0, so this is actually the
; second screen. If this option is not specified, Redshift will try
; to adjust _all_ screens.
[randr]
;screen=1
EOL
echo "Finished Writing ~/.config/redshift.conf";
echo "---------------------------------------------------------------------------------------";
echo "---Setting redshift to autostart on system startup---";
### using sed to replace string
# Like this:
# sed -i 's/foo.*/bar/g' filename.txt
# to update the file pass -i option
# s stands for search and replace
# .* is for wild card characters
# If you want to guarantee that foo is at the start of the line, make it:
# sed 's/^foo.*/bar/g'
sleep 2s;
echo "";
echo "!!!!!!!!!!!!!!! READ INSTRUCTION !!!!!!!!!!!!!!!!!";
read -n 1 -p "Start redshift manually and press any key";
sudo sed -i 's/^X-GNOME-Autostart-enabled=false/X-GNOME-Autostart-enabled=true/g' ~/.config/autostart/redshift-gtk.desktop
sudo sed -i 's/^Hidden=true/Hidden=false/g' ~/.config/autostart/redshift-gtk.desktop
echo "---------------------------------------------------------------------------------------";
echo "";
fi
####################################### Terminator ###################################
read -p "Install Terminator? (press y for yes)" -n 1;
echo "";
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "";
echo "#######################################################";
echo "### Terminator ###";
echo "#######################################################";
echo "";
sudo add-apt-repository ppa:gnome-terminator
sudo apt-get update
sudo apt-get install terminator
echo "";
fi
####################################### Vim Editor ###################################
read -p "Install Vim Editor? (press y for yes)" -n 1;
echo "";
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "";
echo "#######################################################";
echo "### Vim Editor ###";
echo "#######################################################";
echo "";
sudo apt install vim
echo "";
fi
####################################### Safe Eyes ###################################
read -p "Install Safe Eyes? (press y for yes)" -n 1;
echo "";
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "";
echo "#######################################################";
echo "### Safe Eyes ###";
echo "#######################################################";
echo "";
sudo add-apt-repository ppa:slgobinath/safeeyes
sudo apt update
sudo apt install safeeyes
echo "";
fi
#Install dependencies
sudo apt-get install -f