confOS/arch-kde.sh
2025-06-20 10:53:32 +02:00

126 lines
3.8 KiB
Bash
Executable file

#!/usr/bin/env bash
set -o errexit # crash the script when a command crash
set -o pipefail # same as above for piped command
set -o nounset # crash when a variable doesnt exist
# TRACE=1 for debug
if [[ "${TRACE-0}" == "1" ]]; then
set -o xtrace
fi
cd "$(dirname "$0")" # change script directory
function main {
# === Variables ==
local repo
repo=https://git.mylloon.fr/Anri/confOS/raw/branch/main
# === Admin privileges ==
sudo usermod -aG wheel "$USER"
curl -s $repo/polkitrules/49-nopasswd_global.rules > /etc/polkit-1/rules.d/49-nopasswd_global.rules
# === Global OS configuration set-up ==
curl $repo/meta.sh -s | bash -s -- $repo
curl $repo/arch.sh -s | bash -s -- $repo
# === Add pacman hooks ==
local hooks
hooks=("honkai-shortcut" "genshin-shortcut" "zzz-shortcut" "vesktop")
for hook in "${hooks[@]}"
do
sudo wget -q --show-progress $repo/pacman.d/hooks/"$hook".hook -O /etc/pacman.d/hooks/"$hook".hook
done
# === Normal packages ==
sudo pacman -S --noconfirm \
wl-clipboard kdepim-runtime libetebase korganizer kdepim-addons xournalpp obs-studio krita \
godot kdenlive dolphin-emu ffmpegthumbs lact gamescope easyeffects
# === AUR packages ==
paru -S --noconfirm \
cubiomes-viewer sleepy-launcher-bin an-anime-game-launcher-bin escrcpy-bin ryujinx \
auto-cpufreq opentabletdriver the-honkers-railway-launcher-bin krita-ai-tools \
gpu-screen-recorder-ui sunshine-bin
# === Fish ==
# Custom KDE configuration
curl -s $repo/.config/fish/conf.d/abbr_kde.fish >> "$HOME"/.config/fish/conf.d/abbr.fish
curl -s $repo/.config/fish/conf.d/alias_kde.fish >> "$HOME"/.config/fish/conf.d/alias.fish
# === Theme ==
mkdir -p "$HOME"/.local/share/konsole
wget -q $repo/.local/share/konsole/dark.profile -O "$HOME"/.local/share/konsole/dark.profile
wget -q $repo/.local/share/konsole/light.profile -O "$HOME"/.local/share/konsole/light.profile
wget -q $repo/.config/scripts/turn_dark.sh -O "$HOME"/.config/turn_dark.sh
wget -q $repo/.config/scripts/turn_light.sh -O "$HOME"/.config/turn_light.sh
# use dark for the purpose of the installation since we need to choose one, doesn't really matter
bash "$HOME"/.config/turn-dark.sh
# === OpenTabletDriver
sudo mkinitcpio -P
sudo rmmod hid_uclogic
# === UFW (pare-feu) ==
# => Sunshine
sudo ufw allow 47984/tcp
sudo ufw allow 47989/tcp
sudo ufw allow 48010/tcp
sudo ufw allow 47998:48000/udp
# => Allow router traffic
sudo ufw allow from 192.168.1.1
# Reload
sudo ufw reload; sudo systemctl restart ufw
# === LACT ==
sudo systemctl enable --now lactd
# === Power management ==
sudo systemctl enable --now auto-cpufreq
# === SMB shares ==
grep -q "192.168.1.200" /etc/fstab || {
local userpid usergid creds settings
userpid=$(id -u "$USER")
usergid=$(id -g "$USER")
creds=$HOME/.config/.smb_creds
settings=credentials=$creds,vers=3.0,noserverino,rw,user,auto,uid=$userpid,gid=$usergid
sudo mkdir -p /serveur/appdata /serveur/data /serveur/media
{
echo "//192.168.1.200/Appdata /serveur/appdata cifs $settings 0 0"
echo "//192.168.1.200/Data /serveur/data cifs $settings 0 0"
echo "//192.168.1.200/Media /serveur/media cifs $settings 0 0"
} | sudo tee -a /etc/fstab > /dev/null
echo -e "username=\npassword=" > "$creds"
sudo chown root:root "$creds"
sudo chmod 600 "$creds"
sudo mount -a
sudo systemctl daemon-reload
}
echo -e "For CS2, use this:\n\t LD_PRELOAD="" gamescope -f -w 1440 -h 1080 -r 144 -S stretch --force-grab-cursor --adaptive-sync -- %command% -noreflex"
echo -e "\n\nInstallation terminée.\nIl faut redémarrer l'ordinateur."
}
if echo "$DESKTOP_SESSION" | grep "plasma" > /dev/null;
then
main "$@"
else
echo "Ce script ne fonctionne que sur KDE Plasma." >&2
fi