-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconfigscript
executable file
·593 lines (584 loc) · 26.6 KB
/
configscript
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
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
#!/bin/bash
#
# Authors:
# Alfredo Hernández <[email protected]>
#
# Description:
# A script to manage config files (both system-wide and locally)
#
# Legal Stuff:
# This script 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, version 3.
# This script 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 script. If not, see <http://www.gnu.org/licenses/>.
tabs 2
clear
echo "#--------------------------------------------#"
echo "# Config Files Script #"
echo "#--------------------------------------------#"
#----- FUNCTIONS -----#
function config-general {
show_info 'What would you like to do?'
echo
echo "1) Change pacman.conf? (system)"
echo "2) Change journald.conf? (system)"
echo "3) Create .makepkg.conf? (local)"
echo "4) Set up Qt5 integration? (system)"
echo "5) Set up Qt5 integration? (local)"
echo
echo "8) Symlink zshrc and zsh_history? (WIP)"
echo "9) Symlink bashrc and bash_profile? (WIP)"
echo
echo "r) Return?"
echo
show_info 'Enter your choice:' && read REPLY
case $REPLY in
# Change pacman.conf (system)
1)
show_info 'Changing /etc/pacman.conf...'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
sudo sed -i 's@#CacheDir.*@CacheDir = /tmp@g' /etc/pacman.conf
if [ -d /var/cache/pacman ]; then
sudo rm -rf /var/cache/pacman
fi
sudo sed -i 's@#Color@Color@g' /etc/pacman.conf
sudo sed -i ':a;N;$!ba;s@#\[multilib\]\n#Include = /etc/pacman.d/mirrorlist@\[multilib\]\nInclude = /etc/pacman.d/mirrorlist@g' /etc/pacman.conf
clear && config-general
;;
# Negative action
[Nn]* )
clear && config-general
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-general
;;
esac
;;
# Change journald.conf (system)
2)
show_info 'Changing /etc/systemd/journald.conf...'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
sudo journalctl --vacuum-time=2d
sudo sed -i 's@.*SystemMaxFileSize.*@SystemMaxFileSize=8M@g' /etc/systemd/journald.conf
sudo sed -i 's@.*RuntimeMaxFileSize.*@RuntimeMaxFileSize=8M@g' /etc/systemd/journald.conf
sudo sed -i 's@.*SystemMaxUse.*@SystemMaxUse=64M@g' /etc/systemd/journald.conf
sudo sed -i 's@.*RuntimeMaxUse.*@RuntimeMaxUse=64M@g' /etc/systemd/journald.conf
clear && config-general
;;
# Negative action
[Nn]* )
clear && config-general
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-general
;;
esac
;;
# Create makepkg.conf (local)
3)
show_info 'Creating ~/.makepkg.conf...'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
echo "PKGEXT='.pkg.tar.xz'" > ~/.makepkg.conf
clear && config-general
;;
# Negative action
[Nn]* )
clear && config-general
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-general
;;
esac
;;
# Set up Qt5 integration (system)
4)
show_info 'Seting up Qt5 integration...'
show_info 'This will install qt5ct & qt5-styleplugins, and edit /etc/environment'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
sudo pacman -S qt5ct qt5-styleplugins --needed
if ! grep -q "QT_QPA_PLATFORMTHEME=qt5ct" "/etc/environment"; then
sudo bash -c "echo "QT_QPA_PLATFORMTHEME=qt5ct" >> /etc/environment"
fi
# TODO: modify qt5ct.conf
clear && config-general
;;
# Negative action
[Nn]* )
clear && config-general
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-general
;;
esac
;;
# Set up Qt5 integration (local)
5)
show_info 'Seting up Qt5 integration...'
show_info 'This will install qt5ct & qt5-styleplugins, and add export QT_QPA_PLATFORMTHEME variable'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
sudo pacman -S qt5ct qt5-styleplugins --needed
if [ $SHELL="/usr/bin/zsh" ]; then # ZSH (we assume .zshrc already exists)
show_info 'Integrating using zsh...'
if ! grep -q "QT_QPA_PLATFORMTHEME=qt5ct" "$HOME/.zshrc"; then
bash -c 'echo "export QT_QPA_PLATFORMTHEME=qt5ct" >> $HOME/.zshrc'
fi
else # BASH (we don't assume .profile already exists)
show_info 'Integrating using bash...'
if [[ ! -a $HOME/.profile ]]; then
touch $HOME/.profile
fi
if ! grep -q "QT_QPA_PLATFORMTHEME=qt5ct" "$HOME/.profile"; then
bash -c 'echo "export QT_QPA_PLATFORMTHEME=qt5ct" >> $HOME/.profile'
fi
fi
# TODO: modify qt5ct.conf
clear && config-general
;;
# Negative action
[Nn]* )
clear && config-general
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-general
;;
esac
;;
# Return
[Rr]*)
clear && main;;
# Invalid choice
* )
clear && show_error 'Not an option, try again.' && config-general;;
esac
}
# ----------------------------------------------------------------------
function config-hardware {
show_info 'What would you like to do?'
echo
echo "1) Add mappings for extra mouse buttons? (local)"
echo "2) Fix F11 and F12 special buttons on T480? (system)"
echo "3) Don't suspend when latop lid is closed? (system)"
echo
echo "r) Return?"
echo
show_info 'Enter your choice:' && read REPLY
case $REPLY in
# Mappings for extra mouse buttons
1)
show_info 'Adding mappings for extra mouse buttons...'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
# Install packages
sudo pacman -S xbindkeys xautomation --needed
# Create config file
if [ ! -f $HOME/.xbindkeysrc ]; then
echo "# forward button => workspace up" > $HOME/.xbindkeysrc
echo "\"xte 'keydown Super_L' 'key Page_Up' 'keyup Super_L'\"" >> $HOME/.xbindkeysrc
echo " b:9" >> $HOME/.xbindkeysrc
echo "" >> $HOME/.xbindkeysrc
echo "# backward button => workspace down" >> $HOME/.xbindkeysrc
echo "\"xte 'keydown Super_L' 'key Page_Down' 'keyup Super_L'\"" >> $HOME/.xbindkeysrc
echo " b:8" >> $HOME/.xbindkeysrc
echo "" >> $HOME/.xbindkeysrc
echo "# Shift + forward button => move window up" >> $HOME/.xbindkeysrc
echo "\"xte 'keydown Super_L' 'keydown Shift_L' 'key Page_Up' 'keyup Shift_L' 'keyup Super_L'\"" >> $HOME/.xbindkeysrc
echo " Shift + b:9" >> $HOME/.xbindkeysrc
echo "" >> $HOME/.xbindkeysrc
echo "# Shift + backward button => move window down" >> $HOME/.xbindkeysrc
echo "\"xte 'keydown Super_L' 'keydown Shift_L' 'key Page_Down' 'keyup Shift_L' 'keyup Super_L'\"" >> $HOME/.xbindkeysrc
echo " Shift + b:8" >> $HOME/.xbindkeysrc
else
show_info "The config file already exists"
fi
# Start process
pkill xbindkeys ; xbindkeys
clear && config-hardware
;;
# Negative action
[Nn]* )
clear && config-hardware
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-hardware
;;
esac
;;
# Fix F11 and F12 special buttons on T480
2)
show_info 'Fixing F11 and F12 special buttons...'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
if [ ! -f /etc/udev/hwdb.d/90-thinkpad-keyboard.hwdb ]; then
echo "evdev:name:ThinkPad Extra Buttons:dmi:bvn*:bvr*:bd*:svnLENOVO*:pn*" | sudo tee /etc/udev/hwdb.d/90-thinkpad-keyboard.hwdb
echo " KEYBOARD_KEY_45=prog2" | sudo tee --append /etc/udev/hwdb.d/90-thinkpad-keyboard.hwdb
echo " KEYBOARD_KEY_49=prog1" | sudo tee --append /etc/udev/hwdb.d/90-thinkpad-keyboard.hwdb
else
show_info "The config file already exists"
fi
sudo udevadm hwdb --update
sudo udevadm trigger --sysname-match="event*"
clear && config-hardware
;;
# Negative action
[Nn]* )
clear && config-hardware
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-hardware
;;
esac
;;
# Don't suspend when latop lid is closed (system)
3)
show_info 'Changing /etc/systemd/logind.conf...'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
if ! grep -q "HandleLidSwitch=ignore" "/etc/systemd/logind.conf"; then
sudo bash -c "echo "HandleLidSwitch=ignore" >> /etc/systemd/logind.conf"
fi
clear && config-hardware
;;
# Negative action
[Nn]* )
clear && config-hardware
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-hardware
;;
esac
;;
# Return
[Rr]*)
clear && main;;
# Invalid choice
* )
clear && show_error 'Not an option, try again.' && config-hardware;;
esac
}
# ----------------------------------------------------------------------
function config-apps {
show_info 'What would you like to do?'
echo
echo "1) Create .Rprofile? (local)"
echo "2) Change RStudio settings? (local)"
echo "4) Change mpv config files? (local)"
echo "5) True Solarized Tilix? (local)"
echo
echo "r) Return?"
echo
show_info 'Enter your choice:' && read REPLY
case $REPLY in
# Create .Rprofile
1)
show_info 'Creating ~/.Rprofile...'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
echo '.libPaths( c("~/.R/x86_64-pc-linux-gnu-library/3.5", .libPaths()) )
' > ~/.Rprofile
clear && config-apps
;;
# Negative action
[Nn]* )
clear && config-apps
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-apps
;;
esac
;;
# Change RStudio settings
2)
show_info 'Changing RStudio settings...'
show_info 'This will create/modify ~/.rstudio-desktop/monitored/user-settings'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
if [ ! -d ~/.rstudio-desktop/monitored/user-settings ]; then
mkdir -p ~/.rstudio-desktop/monitored/user-settings
fi
echo 'alwaysSaveHistory="1"' > ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'cleanTexi2DviOutput="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'cleanupAfterRCmdCheck="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'contextIdentifier="442FD176"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'cranMirrorCountry="us"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'cranMirrorHost="RStudio"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'cranMirrorName="Global (CDN)"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'cranMirrorUrl="https://cran.rstudio.com/"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'customShellCommand="/usr/bin/zsh"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'customShellOptions=""' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'defaultTerminalShell="8"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'enableLaTeXShellEscape="0"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'errorHandlerType="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'hideObjectFiles="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'initialWorkingDirectory="~/Code/R"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'lineEndingConversion="2"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'loadRData="0"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'newlineInMakefiles="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'removeHistoryDuplicates="0"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'restoreLastProject="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'reuseSessionsForProjectLinks="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'rprofileOnResume="0"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'saveAction="0"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'securePackageDownload="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'showLastDotValue="0"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'showUserHomePage="sessions"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'uiPrefs="{\n \"always_complete_characters\" : 3,\n \"always_complete_console\" : true,\n \"always_complete_delay\" : 250,\n \"always_enable_concordance\" : true,\n \"ansi_console_mode\" : 1,\n \"auto_append_newline\" : true,\n \"auto_expand_error_tracebacks\" : false,\n \"auto_run_setup_chunk\" : true,\n \"background_diagnostics_delay_ms\" : 2000,\n \"blinking_cursor\" : true,\n \"busy_detection\" : 0,\n \"busy_whitelist\" : [\n \"tmux\",\n \"screen\"\n ],\n \"check_arguments_to_r_function_calls\" : false,\n \"check_for_updates\" : true,\n \"clear_hidden\" : true,\n \"code_complete\" : \"always\",\n \"code_complete_other\" : \"always\",\n \"compile_notebookv2_options\" : {\n \"format\" : \"pdf_document\"\n },\n \"continue_comments_on_newline\" : false,\n \"default_encoding\" : \"\",\n \"default_latex_program\" : \"pdfLaTeX\",\n \"default_project_location\" : \"~/Code/R\",\n \"default_sweave_engine\" : \"Sweave\",\n \"diagnostics_in_function_calls\" : true,\n \"diagnostics_on_save\" : true,\n \"doc_outline_show\" : \"show_sections_only\",\n \"document_author\" : \"Alfredo Hernández\",\n \"enable_background_diagnostics\" : true,\n \"enable_emacs_keybindings\" : false,\n \"enable_rsconnect_publish_ui\" : true,\n \"enable_rstudio_connect\" : false,\n \"enable_snippets\" : true,\n \"enable_style_diagnostics\" : false,\n \"execute_multi_line_statements\" : true,\n \"execution_behavior\" : \"statement\",\n \"export_plot_options\" : {\n \"copyAsMetafile\" : false,\n \"format\" : \"png\",\n \"height\" : 383,\n \"keepRatio\" : false,\n \"viewAfterSave\" : false,\n \"width\" : 767\n },\n \"flat_theme\" : \"default\",\n \"focus_console_after_exec\" : false,\n \"fold_style\" : \"markbegin\",\n \"font_size_points\" : 11,\n \"git_diff_ignore_whitespace\" : false,\n \"handle_errors_in_user_code_only\" : true,\n \"hide_console_on_chunk_execute\" : true,\n \"highlight_code_chunks\" : true,\n \"highlight_r_function_calls\" : true,\n \"highlight_selected_line\" : true,\n \"highlight_selected_word\" : true,\n \"ignore_uppercase_words\" : true,\n \"ignore_words_with_numbers\" : true,\n \"insert_matching\" : true,\n \"insert_numbered_latex_sections\" : false,\n \"insert_parens_after_function_completion\" : true,\n \"insert_spaces_around_equals\" : true,\n \"knit_working_dir\" : \"default\",\n \"latex_preview_on_cursor_idle\" : \"always\",\n \"navigate_to_build_error\" : true,\n \"num_spaces_for_tab\" : 2,\n \"packages_pane_enabled\" : true,\n \"pane_config\" : {\n \"consoleLeftOnTop\" : false,\n \"consoleRightOnTop\" : true,\n \"panes\" : [\n \"Source\",\n \"Console\",\n \"TabSet1\",\n \"TabSet2\"\n ],\n \"tabSet1\" : [\n \"Environment\",\n \"History\",\n \"Connections\",\n \"Build\",\n \"VCS\",\n \"Presentation\"\n ],\n \"tabSet2\" : [\n \"Files\",\n \"Plots\",\n \"Packages\",\n \"Help\",\n \"Viewer\"\n ]\n },\n \"pdf_previewer\" : \"desktop-synctex\",\n \"preferred_document_outline_width\" : 136,\n \"print_margin_column\" : 65,\n \"reindent_on_paste\" : true,\n \"restore_source_documents\" : true,\n \"rmd_chunk_output_inline\" : true,\n \"rmd_preferred_template_path\" : \"/home/aldomann/.R/x86_64-pc-linux-gnu-library/3.3/rticles/rmarkdown/templates/elsevier_article\",\n \"rmd_viewer_type\" : 0,\n \"root_document\" : \"\",\n \"save_before_sourcing\" : true,\n \"save_files_before_build\" : false,\n \"save_plot_as_pdf_options\" : {\n \"cairo_pdf\" : true,\n \"height\" : 5.781250000000000,\n \"portrait\" : false,\n \"viewAfterSave\" : true,\n \"width\" : 6.677083333333333\n },\n \"scroll_past_end_of_document\" : true,\n \"show_diagnostics_cpp\" : true,\n \"show_diagnostics_other\" : true,\n \"show_diagnostics_r\" : true,\n \"show_doc_outline_rmd\" : false,\n \"show_help_tooltip_on_idle\" : false,\n \"show_indent_guides\" : true,\n \"show_inline_toolbar_for_r_code_chunks\" : true,\n \"show_invisibles\" : true,\n \"show_line_numbers\" : true,\n \"show_margin\" : false,\n \"show_publish_diagnostics\" : false,\n \"show_publish_ui\" : true,\n \"show_signature_tooltips\" : true,\n \"show_terminal_tab\" : true,\n \"show_unnamed_chunks_in_document_outline\" : true,\n \"soft_wrap_r_files\" : true,\n \"source_with_echo\" : true,\n \"spelling_dictionary_language\" : \"en_GB\",\n \"strip_trailing_whitespace\" : true,\n \"surround_selection\" : \"quotes_and_brackets\",\n \"syntax_color_console\" : true,\n \"tab_multiline_completion\" : false,\n \"terminal_autoclose\" : true,\n \"terminal_local_echo\" : true,\n \"terminal_track_env\" : true,\n \"terminal_websockets\" : true,\n \"theme\" : \"Solarized Light\",\n \"toolbar_visible\" : true,\n \"truncate_long_lines_in_console\" : 1000,\n \"use_dataimport\" : true,\n \"use_ligatures\" : false,\n \"use_rcpp_template\" : true,\n \"use_roxygen\" : false,\n \"use_spaces_for_tab\" : false,\n \"use_vim_mode\" : false,\n \"valign_argument_indent\" : true,\n \"warn_if_no_such_variable_in_scope\" : false,\n \"warn_if_variable_defined_but_not_used\" : false,\n \"wrap_tab_navigation\" : false\n}"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'useDevtools="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'useInternet2="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'vcsEnabled="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'vcsGitExePath=""' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'vcsSvnExePath=""' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'vcsUseGitBash="1"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
echo 'viewDirAfterRCmdCheck="0"' >> ~/.rstudio-desktop/monitored/user-settings/user-settings
clear && config-apps
;;
# Negative action
[Nn]* )
clear && config-apps
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-apps
;;
esac
;;
# Change mpv config files
4)
show_info 'Changing mpv config files...'
show_info 'This will create/modify mpv.conf & script-opts/osc.conf'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
# General settings
if [ ! -d ~/.config/mpv ]; then
mkdir ~/.config/mpv
fi
echo 'osd-font="Roboto"' > ~/.config/mpv/mpv.conf
echo 'sub-font="Myriad Pro"' >> ~/.config/mpv/mpv.conf
echo '#sub-font="Helvetica Neue LT Std"' >> ~/.config/mpv/mpv.conf
echo 'sub-font-size=60' >> ~/.config/mpv/mpv.conf
echo 'sub-color="#FFFFFFFF"' >> ~/.config/mpv/mpv.conf
echo 'sub-border-color="#FF171717"' >> ~/.config/mpv/mpv.conf
echo 'screenshot-directory="~/Pictures/mpv"' >> ~/.config/mpv/mpv.conf
echo 'screenshot-template=mpv-%F-shot%n-%p' >> ~/.config/mpv/mpv.conf
echo 'ytdl-format=bestvideo[height<=?1080][fps<=?60][vcodec!=?vp9]+bestaudio/best' >> ~/.config/mpv/mpv.conf
# OSC settings
if [ ! -d ~/.config/mpv/script-opts ]; then
mkdir ~/.config/mpv/script-opts
fi
echo '#layout=box' > ~/.config/mpv/script-opts/osc.conf
echo '#seekbarstyle=slider' >> ~/.config/mpv/script-opts/osc.conf
echo 'deadzonesize=0' >> ~/.config/mpv/script-opts/osc.conf
echo 'minmousemove=10' >> ~/.config/mpv/script-opts/osc.conf
echo '#scalewindowed=1.5' >> ~/.config/mpv/script-opts/osc.conf
echo 'scalefullscreen=1.2' >> ~/.config/mpv/script-opts/osc.conf
clear && config-apps
;;
# Negative action
[Nn]* )
clear && config-apps
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-apps
;;
esac
;;
# True Solarized Tilix
5)
show_info 'Changing Tilix scheme files...'
show_info 'This will create ../tilix/schemes'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
if [ ! -d ~/.config/tilix/schemes ]; then
mkdir -p ~/.config/tilix/schemes
fi
# True Solarized Dark
echo '{' > ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "background-color": "#002A35",' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "badge-color": "#FFFFFF",' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "comment": "",' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "cursor-background-color": "#000000",' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "cursor-foreground-color": "#FFFFFF",' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "dim-color": "#000000",' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "foreground-color": "#829395",' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "highlight-background-color": "#000000",' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "highlight-foreground-color": "#FFFFFF",' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "name": "True Solarized Dark",' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "palette": [ "#073542", "#DC312F", "#859900", "#B48800", "#258AD1", "#D23581", "#29A097", "#EDE7D4", "#073542", "#DC312F", "#859900", "#B48800", "#268AD2", "#D33682", "#29A198", "#FCF5E2" ],' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "use-badge-color": false,' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "use-cursor-color": false,' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "use-dim-color": false,' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "use-highlight-color": false,' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo ' "use-theme-colors": false' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
echo '}' >> ~/.config/tilix/schemes/tilix-solarized-dark.json
# True Solarized Light
echo '{' > ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "background-color": "#FCF5E2",' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "badge-color": "#FFFFFF",' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "comment": "",' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "cursor-background-color": "#000000",' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "cursor-foreground-color": "#FFFFFF",' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "dim-color": "#000000",' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "foreground-color": "#647981",' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "highlight-background-color": "#000000",' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "highlight-foreground-color": "#FFFFFF",' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "name": "True Solarized Light",' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "palette": [ "#073542", "#DC312F", "#859900", "#B48800", "#258AD1", "#D23581", "#29A097", "#EDE7D4", "#073542", "#DC312F", "#859900", "#B48800", "#268AD2", "#D33682", "#29A198", " #FCF5E2" ],' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "use-badge-color": false,' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "use-cursor-color": false,' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "use-dim-color": false,' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "use-highlight-color": false,' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo ' "use-theme-colors": false' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
echo '}' >> ~/.config/tilix/schemes/tilix-solarizedlight.json
clear && config-apps
;;
# Negative action
[Nn]* )
clear && config-apps
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-apps
;;
esac
;;
# Return
[Rr]*)
clear && main;;
# Invalid choice
* )
clear && show_error 'Not an option, try again.' && config-apps;;
esac
}
# ----------------------------------------------------------------------
function config-games {
show_info 'What would you like to do?'
echo
echo "1) Retroarch? (WIP)"
echo "2) EmulationStation? (WIP)"
echo "3) Warcraft III? (WIP)"
echo "4) StarCraft? (WIP)"
echo
echo "r) Return?"
echo
show_info 'Enter your choice:' && read REPLY
case $REPLY in
# Set up Systemd Journald configuration
1)
show_info 'Doing something...'
echo
show_info 'Proceed? (Y)es, (N)o :' && read REPLY
case $REPLY in
# Positive action
[Yy]* )
echo "Yes!"
clear && config-games
;;
# Negative action
[Nn]* )
clear && config-games
;;
# Error
* )
clear && show_error 'Sorry, try again.' && config-games
;;
esac
;;
# Return
[Rr]*)
clear && main;;
# Invalid choice
* )
clear && show_error 'Not an option, try again.' && config-games;;
esac
}
# ----------------------------------------------------------------------
#----- MESSAGE FUNCTIONS -----#
show_info() {
echo -e "\033[1;34m$@\033[0m"
}
show_success() {
echo -e "\033[1;32m$@\033[0m"
}
show_error() {
echo -e "\033[1;31m$@\033[m" 1>&2
}
#----- MAIN FUNCTION -----#
function main {
show_info 'What would you like to do?'
echo
echo "1) Change general config files?"
echo "2) Change hardware config files?"
echo "3) Change apps config files?"
echo "4) Change games config files?"
echo
echo "e) Exit?"
echo
show_info 'Enter your choice:' && read REPLY
case $REPLY in
1) clear && config-general;; # General
2) clear && config-hardware;; # Hardware
3) clear && config-apps;; # Apps
4) clear && config-games;; # Games
[Ee]* ) exit 99;; # Quit
[Qq]* ) exit 99;; # Quit
* ) clear && show_error 'Not an option, try again.' && main;;
esac
}
#----- RUN MAIN FUNCTION -----#
main
# END OF SCRIPT