-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmanjaro_setup.sh
553 lines (483 loc) · 18.8 KB
/
manjaro_setup.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
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
#!/usr/bin/env bash
## Partitioning
## https://wiki.archlinux.org/title/Partitioning
## Btrfs
## https://wiki.archlinux.org/title/btrfs
## https://blog.kaaass.net/archives/1748
## New install
# https://arch.icekylin.online/
# 1. Terminal Emulator
# sudo pacman-mirrors -i --geoip --timeout 2 -m rank
# sudo pacman -Syy
# 2. GParted:
# sudo pacman -S gparted
# Device→Create partition table→gpt
# +8MB→unformatted→BIOS_GRUB
# +512MB→fat32→EFI
# +8192MB→linux-swap→Swap
# +20480MB→ext4→root
# +30720MB→ext4→usr
# +51200MB→ext4→var
# +...→ext4→home
# 3. Launch installer
# BIOS_GRUB→delete→create→unformatted→bios_grub
# EFI→/boot/efi
# root→/
# usr→/usr
# var→/var
# home→/home
## Mount NFTS Drive & fix read-only mount NFTS Drive
# sudo fdisk -l
# sudo lsblk
# sudo blkid
# sudo ntfsfix /dev/sdb1
# sudo mkdir -p /mnt/sdb1
# sudo mount -t ntfs-3g /dev/sdb1 /mnt/sdb1
# sudo findmnt
# sudo umount /mnt/sdb1
## Automount
# echo "UUID=$(sudo blkid | grep '/dev/sdb1' | grep -Eo '\s+UUID="[^"]*"' | cut -d\" -f2) /mnt/sdb1 ntfs-3g defaults 0 0" | sudo tee -a "/etc/fstab"
## Reinstall Manjaro preserving the $USER files and settings
## https://forum.manjaro.org/t/reinstall-manjaro-preserving-the-user-files-and-settings/104721
## https://wiki.archlinux.org/title/Migrate_installation_to_new_hardware
## kill jobs with jobspec
# jobs && kill %1
trap 'rm -rf "${WORKDIR}"' EXIT
[[ -z "${WORKDIR}" || "${WORKDIR}" != "/tmp/"* || ! -d "${WORKDIR}" ]] && WORKDIR="$(mktemp -d)"
[[ -z "${CURRENT_DIR}" || ! -d "${CURRENT_DIR}" ]] && CURRENT_DIR=$(pwd)
[[ -z "${MY_SHELL_SCRIPTS}" ]] && MY_SHELL_SCRIPTS="$HOME/.dotfiles"
# Load custom functions
if type 'colorEcho' 2>/dev/null | grep -q 'function'; then
:
else
if [[ -s "${MY_SHELL_SCRIPTS}/custom_functions.sh" ]]; then
source "${MY_SHELL_SCRIPTS}/custom_functions.sh"
else
echo "${MY_SHELL_SCRIPTS}/custom_functions.sh does not exist!"
exit 0
fi
fi
[[ -z "${OS_INFO_DESKTOP}" ]] && get_os_desktop
# Setup pacman repository & AUR & install pre-requisite packages
[[ -s "${MY_SHELL_SCRIPTS}/manjaro/packages_setup.sh" ]] && source "${MY_SHELL_SCRIPTS}/manjaro/packages_setup.sh"
# Setup network proxy in desktop environment
[[ -s "${MY_SHELL_SCRIPTS}/manjaro/desktop_proxy.sh" ]] && source "${MY_SHELL_SCRIPTS}/manjaro/desktop_proxy.sh"
# SSH
mkdir -p "$HOME/.ssh" && chmod 700 "$HOME/.ssh"
# cp -f ./ssh/* "$HOME/.ssh" && chmod 600 "$HOME/.ssh/"*
# Force the creation of English-named directories
# [XDG user directories](https://wiki.archlinux.org/title/XDG_user_directories)
sudo pacman --noconfirm --needed -S xdg-user-dirs
LC_ALL=C xdg-user-dirs-update --force
FOLDER_EN=(Desktop Documents Downloads Pictures Music Videos Public Templates)
FOLDER_CN=(桌面 文档 下载 图片 音乐 视频 公共 模板)
FOLDER_INDEX=-1
for TargetFolder in "${FOLDER_CN[@]}"; do
FOLDER_INDEX=$((FOLDER_INDEX + 1))
if [[ -d "${HOME:-/home/$(id -nu)}/${TargetFolder}" ]]; then
FOLDER_SRC="${HOME:-/home/$(id -nu)}/${TargetFolder}"
FOLDER_DEST="${HOME:-/home/$(id -nu)}/${FOLDER_EN[$FOLDER_INDEX]}"
[[ "$(ls -A "${FOLDER_SRC}")" ]] && cp -r "${FOLDER_SRC}/"* "${FOLDER_DEST}"
rm -rf "${HOME:-/home/$(id -nu)}/${TargetFolder}"
fi
# Dolphin places
if [[ -s "$HOME/.local/share/user-places.xbel" ]]; then
FOLDER_ENCODE=$(tr -d '\n' <<<"${TargetFolder}" | od -An -tx1 | tr ' ' %)
sed -i -e "s/${FOLDER_ENCODE}/${FOLDER_EN[$FOLDER_INDEX]}/g" "$HOME/.local/share/user-places.xbel"
sed -i -e "s/${FOLDER_ENCODE^^}/${FOLDER_EN[$FOLDER_INDEX]}/g" "$HOME/.local/share/user-places.xbel"
fi
done
# sed -i -e 's|XDG_DESKTOP_DIR=.*|XDG_DESKTOP_DIR="$HOME/Desktop"|' \
# -e 's|XDG_DOCUMENTS_DIR=.*|XDG_DOCUMENTS_DIR="$HOME/Documents"|' \
# -e 's|XDG_DOWNLOAD_DIR=.*|XDG_DOWNLOAD_DIR="$HOME/Downloads"|' \
# -e 's|XDG_PICTURES_DIR=.*|XDG_PICTURES_DIR="$HOME/Pictures"|' \
# -e 's|XDG_MUSIC_DIR=.*|XDG_MUSIC_DIR="$HOME/Music"|' \
# -e 's|XDG_VIDEOS_DIR=.*|XDG_VIDEOS_DIR="$HOME/Videos"|' \
# -e 's|XDG_PUBLICSHARE_DIR=.*|XDG_PUBLICSHARE_DIR="$HOME/Public"|' \
# -e 's|XDG_TEMPLATES_DIR=.*|XDG_TEMPLATES_DIR="$HOME/Templates"|' \
# "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
# FOLDER_INDEX=-1
# for TargetFolder in "${FOLDER_CN[@]}"; do
# FOLDER_INDEX=$((FOLDER_INDEX + 1))
# [[ -d "${HOME:-/home/$(id -nu)}/${TargetFolder}" ]] && mv "${HOME:-/home/$(id -nu)}/${TargetFolder}" "${HOME:-/home/$(id -nu)}/${FOLDER_EN[$FOLDER_INDEX]}"
# done
# for TargetFolder in "${FOLDER_EN[@]}"; do
# [[ ! -d "${HOME:-/home/$(id -nu)}/${TargetFolder}" ]] && mkdir -p "${HOME:-/home/$(id -nu)}/${TargetFolder}"
# done
## Configuration for locking the user after multiple failed authentication attempts
# sudo sed -i 's/[#]*[ ]*deny.*/deny = 5/' "/etc/security/faillock.conf"
# sudo sed -i 's/[#]*[ ]*unlock_time.*/unlock_time = 60/' "/etc/security/faillock.conf"
# snap
[[ -s "${MY_SHELL_SCRIPTS}/installer/snap_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/installer/snap_installer.sh"
# Network
[[ -s "${MY_SHELL_SCRIPTS}/manjaro/network_setup.sh" ]] && source "${MY_SHELL_SCRIPTS}/manjaro/network_setup.sh"
# Fonts & Input Methods for CJK locale
[[ -s "${MY_SHELL_SCRIPTS}/manjaro/cjk_locale_setup.sh" ]] && source "${MY_SHELL_SCRIPTS}/manjaro/cjk_locale_setup.sh"
# Python
[[ -s "${MY_SHELL_SCRIPTS}/installer/python_pip_config.sh" ]] && source "${MY_SHELL_SCRIPTS}/installer/python_pip_config.sh"
# iTerm2-Color-Schemes
# https://github.com/mbadolato/iTerm2-Color-Schemes
if [[ -x "$(command -v xfce4-terminal)" ]]; then
colorEcho "${BLUE}Installing ${FUCHSIA}iTerm2-Color-Schemes${BLUE}..."
Git_Clone_Update_Branch "mbadolato/iTerm2-Color-Schemes" "$HOME/iTerm2-Color-Schemes"
if [[ -d "$HOME/iTerm2-Color-Schemes" ]]; then
mkdir -p "$HOME/.local/share/xfce4/terminal/colorschemes" && \
cp "$HOME/iTerm2-Color-Schemes/xfce4terminal/colorschemes/"*.theme \
"$HOME/.local/share/xfce4/terminal/colorschemes"
fi
fi
# Install apps
sudo pacman --noconfirm -R p7zip 2>/dev/null # replace `p7zip` with `extra/7zip`
## [Konsole: Support OSC 52 (copy to clipboard)](https://bugs.kde.org/show_bug.cgi?id=372116)
# sudo pacman --noconfirm -R konsole 2>/dev/null
# sudo pacman --noconfirm --needed -S "konsole-osc52"
# Maybe load app list from `$HOME/.dotfiles.env.local` in `zsh_custom_conf.sh`
if [[ -z "${AppManjaroInstallList[*]}" ]]; then
AppManjaroInstallList=(
"7zip"
## RDP Server
# "xrdp"
## RDP Client
"freerdp"
"remmina"
"rustdesk-bin"
## Desktop
# "dmenu"
## picom: a standalone compositor for Xorg, a fork of compton
## rofi: a window switcher, run dialog, ssh-launcher and dmenu replacement
## feh: Fast and light imlib2-based image viewer
## inkscape: Professional vector graphics editor
## mate-power-manager: Power management tool for the MATE desktop
## mpd: Flexible, powerful, server-side application for playing music
## ncmpcpp: Fully featured MPD client using ncurses
## polybar: A fast and easy-to-use status bar
## scrot: command-line screenshot utility for X
## xcompmgr: Composite Window-effects manager for X.org
"picom"
"rofi"
"feh"
"inkscape"
"mate-power-manager"
"mpd"
"ncmpcpp"
"polybar"
"scrot"
## xmonad https://xmonad.org/
# "xmonad"
# "xmonad-contrib"
# "xmonad-utils"
# "slock"
# "xmobar"
## i3 https://i3wm.org/
## https://www.zhihu.com/question/62251457
## https://github.com/levinit/i3wm-config
## https://zocoxx.com/archlinux-i3wm.html
# "i3-gaps"
# "i3-scripts"
# "i3-scrot"
# "i3blocks"
# "i3lock"
# "i3status"
# "i3exit"
# "arc-icon-theme"
# "adwaita-icon-theme"
# "lxappearance"
# "manjaro-wallpapers-by-lunix-i3"
## Broswer
"chromium"
"google-chrome"
# "google-chrome-beta"
"google-chrome-dev"
# "microsoft-edge-stable-bin"
"profile-sync-daemon"
## Clipborad
"copyq"
## Develop
"hub"
# "jdk-openjdk"
# "jre-openjdk"
"dbgate-bin"
"dbeaver"
"dbeaver-plugin-apache-poi"
"dbeaver-plugin-batik"
"dbeaver-plugin-office"
"dbeaver-plugin-svg-format"
"wireshark-qt"
"visual-studio-code-bin"
# "aur/powershell-bin"
"extra/geany"
"extra/geany-plugins"
"aur/geany-themes"
# "extra/notepadqq"
"archlinuxcn/notepad---git"
"aur/cudatext-qt5-bin"
## Dictionary
# "goldendict-git"
## Download & Upload
"aria2"
"filezilla"
"archlinuxcn/qbittorrent-enhanced-git"
## Docker
"docker"
"docker-compose"
# "kitematic"
"distrobox"
## [Podman](https://wiki.archlinux.org/title/Podman)
# "extra/podman"
# "extra/cni-plugins"
# "extra/buildah"
# "extra/podman-docker"
# "extra/podman-compose"
# "chaotic-aur/podman-desktop"
## File & dir compare
"meld"
## Free disk space and maintain privacy
"bleachbit"
## IM
"telegram-desktop"
# "aur/linuxqq"
"slirp4netns"
"socat"
"aur/linuxqq-nt-bwrap"
# "aur/deepin-wine-qq"
"aur/deepin-wine-tim"
"aur/wechat-universal-bwrap"
# "aur/deepin-wine-wechat"
# "archlinuxcn/wine-wechat-setup"
# "archlinuxcn/wine-for-wechat"
"aur/wemeet-bin"
## Markdown
"vnote-git"
#"typora"
## Note
#"leanote"
#"wiznote"
#"cherrytree"
## Netdisk
"baidunetdisk-bin"
## Password manager
"enpass"
"keepass"
"bitwarden"
## PDF Reader
"evince"
#"foxitreader"
## PDF editor
"scribus" # Open Source Desktop Publishing
## Player
"netease-cloud-music"
#"qqmusic-bin"
"smplayer"
"smplayer-skins"
"smplayer-themes"
# Video & Audio
"kdenlive"
## Proxy
"aur/frps-bin"
"aur/frpc-bin"
## Screenshot
# "deepin-screenshot"
"flameshot"
#"xfce4-screenshooter"
## Quick search
"synapse"
"utools"
## Linux Advanced Power Management
# "power-profiles-daemon"
"tlp"
"tlp-rdw"
"tlpui"
## System
"filelight"
"peek"
"redshift"
"ventoy-bin"
"wsysmon-git"
"archlinuxcn/mission-center"
#"easystroke"
## WPS
"wps-office-cn"
"wps-office-mui-zh-cn"
"wps-office-mime-cn"
"wps-office-fonts"
"ttf-wps-fonts"
"wps-office-all-dicts-win-languages"
# [LibreOffice](https://wiki.archlinux.org/title/LibreOffice)
"extra/libreoffice-fresh"
"extra/libreoffice-fresh-zh-cn"
"extra/libreoffice-extension-writer2latex"
"extra/libreoffice-extension-texmaths"
"archlinuxcn/libreoffice-extension-languagetool"
# [Lutris - Open Gaming Platform](https://lutris.net/)
"lutris"
## [TeX Live](https://wiki.archlinux.org/title/TeX_Live)
"texlive"
"texlive-langchinese"
# XeLaTex Compiler: Options -> configure TeXstudio -> Default Compiler -> XeLaTex
"texstudio"
# "lyx"
## Beamer
# "beamerpresenter"
# "beamer-theme-metropolis"
# "bed-latex"
"zed"
)
fi
InstallSystemPackages "" "${AppManjaroInstallList[@]}"
# Snap apps
if [[ -z "${AppSnapInstallList[*]}" ]]; then
AppSnapInstallList=(
"motrix"
)
fi
for TargetApp in "${AppSnapInstallList[@]}"; do
colorEcho "${BLUE}Installing ${FUCHSIA}${TargetApp}${BLUE}..."
sudo snap install "${TargetApp}"
done
# Flatpak apps
if [[ -z "${AppFlatpakInstallList[*]}" ]]; then
AppFlatpakInstallList=(
# [Run Windows in a Bottle](https://usebottles.com/)
"flathub#com.usebottles.bottles"
)
fi
for TargetApp in "${AppFlatpakInstallList[@]}"; do
TargetRemote=$(cut -d# -f1 <<<"${TargetApp}")
TargetApp=$(cut -d# -f2 <<<"${TargetApp}")
colorEcho "${BLUE}Installing ${FUCHSIA}${TargetApp}${BLUE}..."
flatpak install "${TargetRemote}" "${TargetApp}"
done
## RDP Server
## http://www.xrdp.org/
## https://wiki.archlinux.org/index.php/xrdp
# colorEcho "${BLUE}Installing ${FUCHSIA}xrdp${BLUE}..."
# echo 'allowed_users=anybody' | sudo tee -a /etc/X11/Xwrapper.config
# sudo systemctl enable xrdp xrdp-sesman && \
# sudo systemctl start xrdp xrdp-sesman
## DWM
## https://wiki.archlinux.org/index.php/Dwm_(%E7%AE%80%E4%BD%93%E4%B8%AD%E6%96%87)
## https://github.com/GoDzM4TT3O/dotfiles
# git clone --recurse-submodules https://github.com/GoDzM4TT3O/dotfiles && \
# cd dotfiles && \
# cp -r .{config,vim*,z*,x*,X*,alias*,p10k.zsh,local} $HOME && \
# cp -r dwm $HOME
# [NotePad--](https://gitee.com/cxasm/notepad--)
if [[ -x "$(command -v NotePad--)" ]]; then
if [[ -s "/usr/share/applications/io.gitee.cxasm.notepad--.desktop" ]]; then
sudo sed -i -e 's/notepad--/NotePad--/g' \
-e 's/Notepad--/NotePad--/g' \
-e 's/Icon=NotePad--/Icon=notepad--/' \
"/usr/share/applications/io.gitee.cxasm.notepad--.desktop"
fi
if [[ -s "$HOME/.local/share/applications/io.gitee.cxasm.notepad--.desktop" ]]; then
sed -i -e 's/notepad--/NotePad--/g' \
-e 's/Notepad--/NotePad--/g' \
-e 's/Icon=NotePad--/Icon=notepad--/' \
"$HOME/.local/share/applications/io.gitee.cxasm.notepad--.desktop"
fi
fi
# Wayland IME for WPS Office
setWaylandIMEWPSOffice
# wechat-universal-bwrap
if [[ ! -f "$HOME/.config/wechat-universal/binds.list" ]]; then
mkdir -p "$HOME/.config/wechat-universal"
tee "$HOME/.config/wechat-universal/binds.list" >/dev/null <<-'EOF'
Desktop/
Documents/
Downloads/
Music/
Pictures/
Videos/
EOF
fi
## Linux Advanced Power Management
if [[ -x "$(command -v tlp)" ]]; then
sudo systemctl enable --now tlp.service
fi
# sudo tlp start
# sudo tlp-stat -s # System Info
# sudo tlp-stat -b # Battery Care
## [Virtualbox](https://wiki.archlinux.org/title/VirtualBox)
# yay --noconfirm --needed -S extra/virtualbox extra/virtualbox-guest-iso
# yay --noconfirm --needed -S aur/virtualbox-bin aur/virtualbox-bin-guest-iso aur/virtualbox-ext-oracle
# sudo usermod -aG vboxusers "$USER"
## pyenv
## https://segmentfault.com/a/1190000006174123
# sudo pacman --noconfirm --needed -S pyenv
# pyenv init
# pyenv install --list
# pyenv install <version>
# v=3.9.8;wget https://npmmirror.com/mirrors/python/$v/Python-$v.tar.xz -P ~/.pyenv/cache/;pyenv install $v
# pyenv versions
# pyenv uninstall <version>
# pyenv global <version>
## penetration testing
# sudo pacman --noconfirm --needed -S metasploit msfdb nmap hydra sqlmap
# sudo msfdb-blackarch init
# sudo msfdb-blackarch start
# KVM & QEMU
[[ -s "${MY_SHELL_SCRIPTS}/manjaro/qemu_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/manjaro/qemu_installer.sh"
# Conky
[[ -s "${MY_SHELL_SCRIPTS}/manjaro/conky_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/manjaro/conky_installer.sh"
# Go
[[ -s "${MY_SHELL_SCRIPTS}/installer/goup_go_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/installer/goup_go_installer.sh"
# Rust
[[ -s "${MY_SHELL_SCRIPTS}/installer/cargo_rust_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/installer/cargo_rust_installer.sh"
# Node
[[ -s "${MY_SHELL_SCRIPTS}/nodejs/nvm_node_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/nodejs/nvm_node_installer.sh"
# Flutter & Android Studio
[[ -s "${MY_SHELL_SCRIPTS}/installer/flutter_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/installer/flutter_installer.sh"
# Homebrew
[[ -s "${MY_SHELL_SCRIPTS}/installer/homebrew_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/installer/homebrew_installer.sh"
# [He3](https://he3.app/)
[[ -s "${MY_SHELL_SCRIPTS}/installer/he3_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/installer/he3_installer.sh"
# [洛雪音乐助手桌面版](https://github.com/lyswhut/lx-music-desktop)
[[ -s "${MY_SHELL_SCRIPTS}/installer/lx-music-desktop_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/installer/lx-music-desktop_installer.sh"
# Notepadqq
# [[ -s "${MY_SHELL_SCRIPTS}/installer/notepadqq_installer.sh" ]] && source "${MY_SHELL_SCRIPTS}/installer/notepadqq_installer.sh"
# Themes
# [[ -s "${MY_SHELL_SCRIPTS}/installer/desktop_themes.sh" ]] && source "${MY_SHELL_SCRIPTS}/installer/desktop_themes.sh"
## [Profile-sync-daemon](https://wiki.archlinux.org/title/Profile-sync-daemon)
## $HOME/.config/psd/psd.conf
# systemctl --user enable --now psd.service
# psd parse
# [Environment variables](https://wiki.archlinux.org/title/environment_variables)
# [Session Environment Variables](https://userbase.kde.org/Session_Environment_Variables)
if [[ -s "$HOME/.dotfiles/manjaro/desktop_environment_variables.sh" ]]; then
ENV_VAR_FILE=""
[[ "${OS_INFO_DESKTOP}" == "KDE" ]] && ENV_VAR_FILE="$HOME/.config/plasma-workspace/env/desktop_environment_variables.sh"
if [[ -n "${ENV_VAR_FILE}" && ! -s "${ENV_VAR_FILE}" ]]; then
cp "$HOME/.dotfiles/manjaro/desktop_environment_variables.sh" "${ENV_VAR_FILE}"
fi
fi
## Others
# mute tone when logout
echo -e "\n# Disable BIOS sound\nxset -b" | sudo tee -a "/etc/xprofile" > /dev/null
# Disable PC speaker
# su -c 'modprobe -r pcspkr && echo "blacklist pcspkr" >> /etc/modprobe.d/50-blacklist.conf'
echo -e "\n# Disable PC speaker\nblacklist pcspkr" | sudo tee "/etc/modprobe.d/nobeep.conf"
## Disable swap
## sudo sysctl -a | grep "vm.swappiness"
# SWAP_DISK=$(swapon --noheadings | awk '{print $1}')
# if [[ -n "${SWAP_DISK}" ]]; then
# sudo swapoff "${SWAP_DISK}"
# sudo systemctl mask swap
# sudo sed -i -e 's/.*swap.*/# &/g' /etc/fstab
# echo 'vm.swappiness=0' | sudo tee /etc/sysctl.d/99-swappiness.conf >/dev/null
# fi
# [Using the KDE Wallet to store ssh key passphrases](https://wiki.archlinux.org/title/KDE_Wallet)
if [[ -x "$(command -v ksshaskpass)" ]]; then
mkdir -p "$HOME/.config/environment.d"
echo -e "SSH_ASKPASS=/usr/bin/ksshaskpass\nSH_ASKPASS_REQUIRE=prefer" > "$HOME/.config/environment.d/ssh_askpass.conf"
fi
# Clean jobs
# sudo pacman -Rns $(pacman -Qtdq)
colorEcho "${BLUE}Cleaning pacman cache..."
yay --noconfirm -Sc && yay --noconfirm -Yc
sudo sh -c 'rm -rf /var/lib/snapd/cache/*'
## Change default data location for some applications: docker, kvm...
# [[ -s "${MY_SHELL_SCRIPTS}/manjaro/change_apps_data_location.sh" ]] && \
# source "${MY_SHELL_SCRIPTS}/manjaro/change_apps_data_location.sh"
# Auto shutdown at 20:00
# (crontab -l 2>/dev/null || true; echo "0 20 * * * sync && shutdown -h now") | crontab -
cd "${CURRENT_DIR}" || exit