From 16117c1502b986dc0b9e0df06dbdfacdb2763b9a Mon Sep 17 00:00:00 2001 From: Stephan Raabe Date: Wed, 20 Dec 2023 11:46:07 +0100 Subject: [PATCH] Add SDDM toogle --- .install/displaymanager.sh | 111 +++++++++--------- .../modules/sddm/background/config.sh | 4 + .../modules/sddm/background/module.sh | 23 ++++ hypr/settings/modules/sddm/config.sh | 4 +- .../modules/sddm/enabledisable/config.sh | 4 + .../modules/sddm/enabledisable/module.sh | 18 +++ hypr/settings/modules/sddm/module.sh | 23 +--- hypr/settings/modules/system/config.sh | 1 - 8 files changed, 106 insertions(+), 82 deletions(-) create mode 100644 hypr/settings/modules/sddm/background/config.sh create mode 100755 hypr/settings/modules/sddm/background/module.sh create mode 100644 hypr/settings/modules/sddm/enabledisable/config.sh create mode 100755 hypr/settings/modules/sddm/enabledisable/module.sh diff --git a/.install/displaymanager.sh b/.install/displaymanager.sh index acc25e6..5381094 100755 --- a/.install/displaymanager.sh +++ b/.install/displaymanager.sh @@ -3,7 +3,6 @@ # ------------------------------------------------------ disman=0 profile="Hyprland" -if [ -f /etc/systemd/system/display-manager.service ]; then echo -e "${GREEN}" cat <<"EOF" ____ _ _ __ __ @@ -15,60 +14,60 @@ cat <<"EOF" EOF echo -e "${NONE}" - echo "An active display manager has been detected." +if [[ $profile == *"Hyprland"* ]]; then + echo "IMPORTANT: Starting Hyprland works from tty (terminal) with command Hyprland (recommended)" + echo "or with the display manager SDDM (> 0.20.0 already installed) or the latest git version (yay -S sddm-git)." + 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" + echo "at any time with the Hyprland settings script from Waybar or with SUPER+CTRL-S." echo "" - if [[ $profile == *"Hyprland"* ]]; then - echo "IMPORTANT: Starting Hyprland works from tty (terminal) with command Hyprland or with the display manager SDDM (> 0.20.0 already installed or the latest git version (yay -S sddm-git)." - 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 "" - 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 - fi - 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 - - if gum confirm "Do you want to enable/update to sddm or disable the display manager?" --affirmative "Enable" --negative "Disable" ;then - if [ -f /etc/systemd/system/display-manager.service ]; then - sudo rm /etc/systemd/system/display-manager.service - fi - sudo systemctl enable sddm.service - - if [ ! -d /etc/sddm.conf.d/ ]; then - sudo mkdir /etc/sddm.conf.d - echo "Folder /etc/sddm.conf.d created." - fi - - sudo cp sddm/sddm.conf /etc/sddm.conf.d/ - echo "File /etc/sddm.conf.d/sddm.conf updated." - - if [ -f /usr/share/sddm/themes/sugar-candy/theme.conf ]; then - if [ -f ~/.cache/current_wallpaper.jpg ]; then - sudo cp ~/.cache/current_wallpaper.jpg /usr/share/sddm/themes/sugar-candy/Backgrounds/current_wallpaper.jpg - echo "Current wallpaper copied into /usr/share/sddm/themes/sugar-candy/Backgrounds/" - else - sudo cp wallpapers/default.jpg /usr/share/sddm/themes/sugar-candy/Backgrounds/current_wallpaper.jpg - echo "Default wallpaper copied into /usr/share/sddm/themes/sugar-candy/Backgrounds/" - fi - - sudo cp sddm/theme.conf /usr/share/sddm/themes/sugar-candy/ - echo "File theme.conf updated in /usr/share/sddm/themes/sugar-candy/" - fi - elif [ $? -eq 130 ]; then - exit 130 - else - if [ -f /etc/systemd/system/display-manager.service ]; then - sudo rm /etc/systemd/system/display-manager.service - echo "Current display manager removed." - fi - disman=1 - fi - echo "" -else - disman=1 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 + fi + 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 + +if gum confirm "Do you want to enable/update to sddm?" ;then + if [ -f /etc/systemd/system/display-manager.service ]; then + sudo rm /etc/systemd/system/display-manager.service + fi + sudo systemctl enable sddm.service + + if [ ! -d /etc/sddm.conf.d/ ]; then + sudo mkdir /etc/sddm.conf.d + echo "Folder /etc/sddm.conf.d created." + fi + + sudo cp sddm/sddm.conf /etc/sddm.conf.d/ + echo "File /etc/sddm.conf.d/sddm.conf updated." + + if [ -f /usr/share/sddm/themes/sugar-candy/theme.conf ]; then + if [ -f ~/.cache/current_wallpaper.jpg ]; then + sudo cp ~/.cache/current_wallpaper.jpg /usr/share/sddm/themes/sugar-candy/Backgrounds/current_wallpaper.jpg + echo "Current wallpaper copied into /usr/share/sddm/themes/sugar-candy/Backgrounds/" + else + sudo cp wallpapers/default.jpg /usr/share/sddm/themes/sugar-candy/Backgrounds/current_wallpaper.jpg + echo "Default wallpaper copied into /usr/share/sddm/themes/sugar-candy/Backgrounds/" + fi + + sudo cp sddm/theme.conf /usr/share/sddm/themes/sugar-candy/ + echo "File theme.conf updated in /usr/share/sddm/themes/sugar-candy/" + fi +elif [ $? -eq 130 ]; then + exit 130 +else + if [ -f /etc/systemd/system/display-manager.service ]; then + if gum confirm "Do you want to deactivate the current display manager?" ;then + sudo rm /etc/systemd/system/display-manager.service + echo "Current display manager deactivated." + disman=1 + fi + fi +fi +echo "" diff --git a/hypr/settings/modules/sddm/background/config.sh b/hypr/settings/modules/sddm/background/config.sh new file mode 100644 index 0000000..e74d3a4 --- /dev/null +++ b/hypr/settings/modules/sddm/background/config.sh @@ -0,0 +1,4 @@ +name="Background" +desxription="Update the background wallpaper of sddm to the current wallpaper." +order=50 +author="Stephan Raabe ML4W" diff --git a/hypr/settings/modules/sddm/background/module.sh b/hypr/settings/modules/sddm/background/module.sh new file mode 100755 index 0000000..c0f8dd0 --- /dev/null +++ b/hypr/settings/modules/sddm/background/module.sh @@ -0,0 +1,23 @@ +#!/bin/bash +_getHeader "$name" "$author" + +if gum confirm "Do you want to update the SDDM background with the current wallpaper?" ;then + if [ ! -d /etc/sddm.conf.d/ ]; then + sudo mkdir /etc/sddm.conf.d + echo "Folder /etc/sddm.conf.d created." + fi + + sudo cp ~/dotfiles/sddm/sddm.conf /etc/sddm.conf.d/ + echo "File /etc/sddm.conf.d/sddm.conf updated." + + sudo cp ~/.cache/current_wallpaper.jpg /usr/share/sddm/themes/sugar-candy/Backgrounds/ + echo "Current wallpaper copied into /usr/share/sddm/themes/sugar-candy/Backgrounds/" + + sudo cp ~/dotfiles/sddm/theme.conf /usr/share/sddm/themes/sugar-candy/ + echo "File theme.conf updated in /usr/share/sddm/themes/sugar-candy/" + + echo "" + echo "SDDM background successfully updated!" + sleep 2 +fi +_goBack diff --git a/hypr/settings/modules/sddm/config.sh b/hypr/settings/modules/sddm/config.sh index fd9e80a..586821f 100644 --- a/hypr/settings/modules/sddm/config.sh +++ b/hypr/settings/modules/sddm/config.sh @@ -1,4 +1,2 @@ name="SDDM" -desxription="Update the background wallpaper of sddm to the current wallpaper." -order=50 -author="Stephan Raabe ML4W" +order=30 \ No newline at end of file diff --git a/hypr/settings/modules/sddm/enabledisable/config.sh b/hypr/settings/modules/sddm/enabledisable/config.sh new file mode 100644 index 0000000..bd52b11 --- /dev/null +++ b/hypr/settings/modules/sddm/enabledisable/config.sh @@ -0,0 +1,4 @@ +name="Enable Disable" +desxription="Update the background wallpaper of sddm to the current wallpaper." +order=50 +author="Stephan Raabe ML4W" diff --git a/hypr/settings/modules/sddm/enabledisable/module.sh b/hypr/settings/modules/sddm/enabledisable/module.sh new file mode 100755 index 0000000..f695451 --- /dev/null +++ b/hypr/settings/modules/sddm/enabledisable/module.sh @@ -0,0 +1,18 @@ +#!/bin/bash +_getHeader "$name" "$author" + +if [ -f /etc/systemd/system/display-manager.service ]; then + if gum confirm "Do you want to disable the current display manager?" ;then + sudo rm /etc/systemd/system/display-manager.service + echo "Current display manager removed. Please reboot your system." + sleep 2 + fi +else + if gum confirm "Do you want to enable SDDM as your display manager?" ;then + sudo systemctl enable sddm.service + echo "Display manager SDDM has been enabled. Please reboot your system." + sleep 2 + fi +fi + +_goBack diff --git a/hypr/settings/modules/sddm/module.sh b/hypr/settings/modules/sddm/module.sh index c0f8dd0..e3efe99 100755 --- a/hypr/settings/modules/sddm/module.sh +++ b/hypr/settings/modules/sddm/module.sh @@ -1,23 +1,2 @@ #!/bin/bash -_getHeader "$name" "$author" - -if gum confirm "Do you want to update the SDDM background with the current wallpaper?" ;then - if [ ! -d /etc/sddm.conf.d/ ]; then - sudo mkdir /etc/sddm.conf.d - echo "Folder /etc/sddm.conf.d created." - fi - - sudo cp ~/dotfiles/sddm/sddm.conf /etc/sddm.conf.d/ - echo "File /etc/sddm.conf.d/sddm.conf updated." - - sudo cp ~/.cache/current_wallpaper.jpg /usr/share/sddm/themes/sugar-candy/Backgrounds/ - echo "Current wallpaper copied into /usr/share/sddm/themes/sugar-candy/Backgrounds/" - - sudo cp ~/dotfiles/sddm/theme.conf /usr/share/sddm/themes/sugar-candy/ - echo "File theme.conf updated in /usr/share/sddm/themes/sugar-candy/" - - echo "" - echo "SDDM background successfully updated!" - sleep 2 -fi -_goBack +_getHeader "$name" diff --git a/hypr/settings/modules/system/config.sh b/hypr/settings/modules/system/config.sh index 3844a8e..0193508 100644 --- a/hypr/settings/modules/system/config.sh +++ b/hypr/settings/modules/system/config.sh @@ -1,3 +1,2 @@ name="System" order=30 -author="Stephan Raabe ML4W"