Hyprland-dotfiles/.install/displaymanager.sh

121 lines
5.2 KiB
Bash
Raw Normal View History

2023-11-10 16:12:15 -05:00
# ------------------------------------------------------
# Disable display manager
# ------------------------------------------------------
disman=0
2024-06-03 07:34:49 -04:00
profile="Hyprland"
2023-11-17 07:48:02 -05:00
echo -e "${GREEN}"
2023-12-21 15:57:44 -05:00
figlet "Display Manager"
2023-11-17 07:48:02 -05:00
echo -e "${NONE}"
2023-12-20 05:46:07 -05:00
if [[ $profile == *"Hyprland"* ]]; then
2024-01-01 07:33:32 -05:00
echo "IMPORTANT: Starting Hyprland works from tty (terminal) with command Hyprland (recommended)."
2024-02-19 12:14:24 -05:00
echo "or you can try the display manager SDDM (> 0.20.0 already installed) or the latest git version (yay -S sddm)."
2023-12-20 05:46:07 -05:00
echo "Please check: https://wiki.hyprland.org/hyprland-wiki/pages/Getting-Started/Master-Tutorial/#launching-hyprland"
echo "Login with other display managers could fail and could have negative side effects on some devices."
echo "If you have issues with SDDM or other display managers, you can deactivate the display manager"
2024-01-01 07:33:32 -05:00
echo "at any time with the Hyprland settings script (Start from Waybar or with SUPER+CTRL+S)."
2023-11-10 16:12:15 -05:00
echo ""
2023-12-20 05:46:07 -05:00
fi
if [[ $profile == *"Qtile"* ]]; then
if [ -f /usr/share/wayland-sessions/qtile-wayland.desktop ]; then
sudo mv /usr/share/wayland-sessions/qtile-wayland.desktop /usr/share/wayland-sessions/qtile-wayland.bak
2023-12-20 14:55:30 -05:00
echo "Qtile Wayland Session removed."
2023-11-10 16:12:15 -05:00
fi
2023-12-20 05:46:07 -05:00
echo "PLEASE NOTE: Qtile works with Display Managers."
echo "But if you want to use the tty based (terminal) login instead, you can disable the display manager now."
echo "If you install the aliases with the included .bashrc, you can start Qtile with the command Qtile."
echo ""
fi
2023-11-21 15:19:51 -05:00
2024-01-01 07:33:32 -05:00
if [ ! -d ~/dotfiles ];then
if [ -f /etc/systemd/system/display-manager.service ]; then
2024-01-25 11:39:50 -05:00
disman=0
2024-01-01 07:33:32 -05:00
echo "You have already installed a display manager on your system."
2024-02-19 12:14:24 -05:00
echo "How do you want to proceed?"
2024-05-27 07:39:44 -04:00
echo
2024-04-22 08:46:08 -04:00
dmsel=$(gum choose "Keep current setup" "Deactivate current display manager" "Install sddm and theme")
2024-01-01 07:33:32 -05:00
else
2024-01-25 11:39:50 -05:00
disman=1
2024-01-01 07:33:32 -05:00
echo "There is no display manager installed on your system."
echo "After the installation/update of the dotfiles, you can start Hyprland with command Hyprland and Qtile with commmand Qtile (or startx)."
2024-02-19 12:14:24 -05:00
echo "How do you want to proceed?"
2024-05-27 07:39:44 -04:00
echo
2024-04-22 08:46:08 -04:00
dmsel=$(gum choose "Keep current setup" "Install sddm and theme")
2024-01-01 07:33:32 -05:00
fi
else
if [ -f /etc/systemd/system/display-manager.service ]; then
2024-01-25 11:39:50 -05:00
disman=0
2024-01-01 07:33:32 -05:00
echo "You have already installed a display manager. If your display manager is working fine, you can keep the current setup."
2024-02-19 12:14:24 -05:00
echo "How do you want to proceed?"
2024-05-27 07:39:44 -04:00
echo
2024-04-22 08:46:08 -04:00
dmsel=$(gum choose "Keep current setup" "Deactivate current display manager" "Install sddm and theme")
2024-01-01 07:33:32 -05:00
else
2024-01-25 11:39:50 -05:00
disman=1
2024-01-01 07:33:32 -05:00
echo "There is no display manager installed on your system. You're starting Hyprland/Qtile with commands on tty."
2024-02-19 12:14:24 -05:00
echo "How do you want to proceed?"
2024-05-27 07:39:44 -04:00
echo
2024-04-22 08:46:08 -04:00
dmsel=$(gum choose "Keep current setup" "Install sddm and theme")
2024-01-01 07:33:32 -05:00
fi
fi
2024-02-19 12:14:24 -05:00
if [ -z "${dmsel}" ] ;then
2024-05-27 07:39:44 -04:00
echo ":: Installation canceled."
2024-02-19 12:14:24 -05:00
exit
fi
2024-04-22 08:46:08 -04:00
if [ "$dmsel" == "Install sddm and theme" ] ;then
2023-12-21 11:22:43 -05:00
2024-01-25 11:39:50 -05:00
disman=0
# Try to force the installation of sddm
2024-06-03 08:24:58 -04:00
echo ":: Install sddm"
2024-06-03 07:34:49 -04:00
yay -S --noconfirm sddm --ask 4
2023-12-21 11:25:21 -05:00
2024-06-03 08:24:58 -04:00
# Enable sddm
2023-12-20 05:46:07 -05:00
if [ -f /etc/systemd/system/display-manager.service ]; then
sudo rm /etc/systemd/system/display-manager.service
fi
sudo systemctl enable sddm.service
2023-12-20 03:27:39 -05:00
2024-06-03 08:24:58 -04:00
# Create sddm.conf.d folder
2023-12-20 05:46:07 -05:00
if [ ! -d /etc/sddm.conf.d/ ]; then
sudo mkdir /etc/sddm.conf.d
2024-05-29 08:09:01 -04:00
echo ":: Folder /etc/sddm.conf.d created."
2023-12-20 05:46:07 -05:00
fi
2023-12-20 03:27:39 -05:00
2024-06-03 08:24:58 -04:00
# Copy sddm.conf
2023-12-20 05:46:07 -05:00
sudo cp sddm/sddm.conf /etc/sddm.conf.d/
2024-05-29 08:09:01 -04:00
echo ":: File /etc/sddm.conf.d/sddm.conf updated."
2023-12-20 03:27:39 -05:00
2024-06-03 08:24:58 -04:00
# Download and install sugar candy theme if not exists
if [ ! -d /usr/share/sddm/themes/sugar-candy ]; then
2024-06-03 07:34:49 -04:00
if [ -f ~/Downloads/sddm-sugar-candy-master.zip ] ;then
rm ~/Downloads/sddm-sugar-candy-master.zip
fi
wget -P ~/Downloads/ https://framagit.org/MarianArlt/sddm-sugar-candy/-/archive/master/sddm-sugar-candy-master.zip
unzip -o -q ~/Downloads/sddm-sugar-candy-master.zip -d ~/Downloads/
if [ ! -d /usr/share/sddm/themes/sugar-candy ] ;then
sudo mkdir -p /usr/share/sddm/themes/sugar-candy
fi
sudo cp -r ~/Downloads/sddm-sugar-candy-master/* /usr/share/sddm/themes/sugar-candy
echo ":: SDDM Sugar Candy Theme installed"
fi
2024-06-03 08:24:58 -04:00
# Install background wallpaper for sddm
2023-12-20 05:46:07 -05:00
if [ -f /usr/share/sddm/themes/sugar-candy/theme.conf ]; then
2023-12-21 12:30:37 -05:00
sudo cp wallpapers/default.jpg /usr/share/sddm/themes/sugar-candy/Backgrounds/current_wallpaper.jpg
2024-05-29 08:09:01 -04:00
echo ":: Default wallpaper copied into /usr/share/sddm/themes/sugar-candy/Backgrounds/"
2023-12-20 05:46:07 -05:00
sudo cp sddm/theme.conf /usr/share/sddm/themes/sugar-candy/
2023-12-21 12:30:37 -05:00
sudo sed -i 's/CURRENTWALLPAPER/'"current_wallpaper.jpg"'/' /usr/share/sddm/themes/sugar-candy/theme.conf
2024-05-29 08:09:01 -04:00
echo ":: File theme.conf updated in /usr/share/sddm/themes/sugar-candy/"
2023-12-20 05:46:07 -05:00
fi
2024-01-01 07:33:32 -05:00
elif [ "$dmsel" == "Deactivate current display manager" ] ;then
sudo rm /etc/systemd/system/display-manager.service
2024-05-29 08:09:01 -04:00
echo ":: Current display manager deactivated."
2024-01-01 07:33:32 -05:00
disman=1
elif [ "$dmsel" == "Keep current setup" ] ;then
2024-05-29 08:09:01 -04:00
echo ":: sddm setup skipped."
2023-12-20 05:46:07 -05:00
else
2024-05-29 08:09:01 -04:00
echo ":: sddm setup skipped."
2023-11-10 16:12:15 -05:00
fi