Repository navigation
Expand file tree
/
Copy pathsetup_sway_isomode.bash
More file actions
126 lines (104 loc) · 3.65 KB
/
Copy pathsetup_sway_isomode.bash
File metadata and controls
126 lines (104 loc) · 3.65 KB
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
#!/usr/bin/env bash
username="$1"
# Clone the repo
echo "Cloning the EOS Community Sway repo..."
git clone https://github.com/EndeavourOS-Community-Editions/sway.git
# Check if nvidia-inst is installed
# If it is, do the Nvidia stuff
if pacman -Qq | grep -Eq '^nvidia(|-dkms|-open|-open-dkms)$'; then
echo "Adding the --unsupported-gpu flag to the sway call in greetd.conf..."
sed -i 's|sway -c|sway --unsupported-gpu -c|' sway/etc/greetd/greetd.conf
echo "Adding a custom desktop file for Nvidia sessions..."
mkdir -p /usr/share/wayland-sessions
cat <<EOF > /usr/share/wayland-sessions/sway-nvidia.desktop
[Desktop Entry]
Name=Sway-Nvidia
Comment=Sway with Nvidia
Exec=sway --unsupported-gpu
Type=Application
EOF
echo "Adding dracut config for early module loading..."
cat <<EOF > /etc/dracut.conf.d/nvidia-modules.conf
force_drivers+=" nvidia nvidia_modeset nvidia_uvm nvidia_drm "
EOF
echo "Regenerating initrds..."
reinstall-kernels || dracut-rebuild
fi
# Install the custom package list
echo "Installing needed packages..."
pacman -S --noconfirm --noprogressbar --needed --disable-download-timeout $(< ./sway/packages-repository.txt)
# Deploy user configs
echo "Deploying user configs..."
rsync -a sway/.config "/home/${username}/"
rsync -a sway/home_config/ "/home/${username}/"
# Add "NoDisplay" property to desktop files we don't want in the launcher
echo "Adding custom local desktop files..."
src=/usr/share/applications
dst="/home/${username}/.local/share/applications"
mkdir -p "$dst"
for file in \
avahi-discover.desktop \
bssh.desktop \
bvnc.desktop \
eos-log-tool.desktop \
eos-quickstart.desktop \
eos-update.desktop \
foot-server.desktop \
footclient.desktop \
nm-connection-editor.desktop \
org.gnome.FileRoller.desktop \
qv4l2.desktop \
qvidcap.desktop \
reflector-simple.desktop \
stoken-gui.desktop \
stoken-gui-small.desktop \
thunar-bulk-rename.desktop \
thunar-settings.desktop \
thunar-volman-settings.desktop \
xfce4-about.desktop \
yad-icon-browser.desktop \
yad-settings.desktop
do
srcfile="$src/$file"
dstfile="$dst/$file"
if [[ -f "$srcfile" ]]; then
cp "$srcfile" "$dstfile"
printf 'NoDisplay=true\n' >> "$dstfile"
echo "Updated: $file"
else
echo "Missing: $srcfile" >&2
fi
done
# Restore user ownership
chown -R "${username}:${username}" "/home/${username}"
# If autologin has been configured, update greetd.conf accordingly
if getent group autologin | grep -qw "${username}"; then
echo "autologin group detected, configuring autologin in greetd.conf..."
sway_command="sway"
# Add --unsupported-gpu when nvidia-inst is installed
if pacman -Qq | grep -Eq '^nvidia(|-dkms|-open|-open-dkms)$'; then
echo "nvidia-inst detected, enabling --unsupported-gpu..."
sway_command="sway --unsupported-gpu"
fi
cat <<EOF >> sway/etc/greetd/greetd.conf
[initial_session]
command = "${sway_command}"
user = "${username}"
EOF
fi
# Deploy system configs
echo "Deploying system configs..."
rsync -a --chown=root:root sway/etc/ /etc/
# Check if the script is running in a virtual machine
if systemd-detect-virt | grep -vq "none"; then
echo "Virtual machine detected; enabling WLR_RENDERER_ALLOW_SOFTWARE variable in ReGreet config..."
# Uncomment WLR_RENDERER_ALLOW_SOFTWARE variable in ReGreet config
sed -i '/^#WLR_RENDERER_ALLOW_SOFTWARE/s/^#//' /etc/greetd/regreet.toml
fi
# Remove the repo
echo "Removing the EOS Community Sway repo..."
rm -rf sway
# Enable the Greetd service
echo "Enabling the Greetd service..."
systemctl enable greetd.service
echo "Installation complete."