From cd5d3c0e4cb007de65447b55550edb99dc526d1c Mon Sep 17 00:00:00 2001 From: Tobias Powalowski Date: Fri, 4 Aug 2023 14:57:22 +0200 Subject: [PATCH] move functions to their respective destination --- usr/bin/archboot-update.sh | 2 - usr/lib/archboot/update/desktop.sh | 198 ---------------------- usr/lib/archboot/update/gnome-wayland.sh | 16 -- usr/lib/archboot/update/gnome.sh | 45 +++++ usr/lib/archboot/update/manage.sh | 2 +- usr/lib/archboot/update/plasma-wayland.sh | 16 -- usr/lib/archboot/update/plasma.sh | 79 +++++++++ usr/lib/archboot/update/sway.sh | 101 ++++++++++- 8 files changed, 225 insertions(+), 234 deletions(-) delete mode 100644 usr/lib/archboot/update/gnome-wayland.sh delete mode 100644 usr/lib/archboot/update/plasma-wayland.sh diff --git a/usr/bin/archboot-update.sh b/usr/bin/archboot-update.sh index 6ec9b8922..e4c6494a4 100755 --- a/usr/bin/archboot-update.sh +++ b/usr/bin/archboot-update.sh @@ -10,9 +10,7 @@ . /usr/lib/archboot/update/desktop.sh . /usr/lib/archboot/update/xfce.sh . /usr/lib/archboot/update/gnome.sh -. /usr/lib/archboot/update/gnome-wayland.sh . /usr/lib/archboot/update/plasma.sh -. /usr/lib/archboot/update/plasma-wayland.sh . /usr/lib/archboot/update/sway.sh [[ -z "${1}" ]] && usage diff --git a/usr/lib/archboot/update/desktop.sh b/usr/lib/archboot/update/desktop.sh index 6ffd10982..ccff6d358 100644 --- a/usr/lib/archboot/update/desktop.sh +++ b/usr/lib/archboot/update/desktop.sh @@ -108,204 +108,6 @@ _prepare_graphic() { systemctl reload dbus-org.freedesktop.login1.service } -_prepare_gnome() { - if ! [[ -e /usr/bin/gnome-session ]]; then - _prepare_graphic "${_PACKAGES}" - _configure_gnome >"${_LOG}" 2>&1 - fi -} - -_prepare_plasma() { - if ! [[ -e /usr/bin/startplasma-x11 ]]; then - _prepare_graphic "${_PACKAGES}" - _configure_plasma >"${_LOG}" 2>&1 - fi -} - -_prepare_sway() { - if ! [[ -e /usr/bin/sway ]]; then - _prepare_graphic "${_PACKAGES}" - _configure_sway >"${_LOG}" 2>&1 - fi -} - -_configure_gnome() { - echo "Configuring Gnome..." - [[ "${_STANDARD_BROWSER}" == "firefox" ]] && gsettings set org.gnome.shell favorite-apps "['org.gnome.Settings.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', 'firefox.desktop', 'org.gnome.DiskUtility.desktop', 'gparted.desktop', 'archboot.desktop']" - [[ "${_STANDARD_BROWSER}" == "chromium" ]] && gsettings set org.gnome.shell favorite-apps "['org.gnome.Settings.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', 'chromium.desktop', 'org.gnome.DiskUtility.desktop', 'gparted.desktop', 'archboot.desktop']" - echo "Setting wallpaper..." - gsettings set org.gnome.desktop.background picture-uri file:////usr/share/archboot/grub/archboot-background.png - echo "Autostarting setup..." - cat << EOF > /etc/xdg/autostart/archboot.desktop -[Desktop Entry] -Type=Application -Name=Archboot Setup -GenericName=Installer -Exec=gnome-terminal -- /usr/bin/setup -Icon=system-software-install -EOF - cp /etc/xdg/autostart/archboot.desktop /usr/share/applications/ - _HIDE_MENU="avahi-discover bssh bvnc org.gnome.Extensions org.gnome.FileRoller org.gnome.gThumb org.gnome.gedit fluid vncviewer qvidcap qv4l2" - echo "Hiding ${_HIDE_MENU} menu entries..." - for i in ${_HIDE_MENU}; do - echo "[DESKTOP ENTRY]" > /usr/share/applications/"${i}".desktop - echo 'NoDisplay=true' >> /usr/share/applications/"${i}".desktop - done -} - -_configure_plasma() { - echo "Configuring KDE..." - sed -i -e "s#applications:.*#applications:systemsettings.desktop,applications:org.kde.konsole.desktop,preferred://filemanager,applications:${_STANDARD_BROWSER}.desktop,applications:gparted.desktop,applications:archboot.desktop#g" /usr/share/plasma/plasmoids/org.kde.plasma.tasvconsoleanager/contents/config/main.xml - echo "Replacing wallpaper..." - for i in /usr/share/wallpapers/Next/contents/images/*; do - cp /usr/share/archboot/grub/archboot-background.png "${i}" - done - echo "Replacing menu structure..." - cat << EOF >/etc/xdg/menus/applications.menu - - - - Applications - kde-main.directory - - - - - - - - More - - - - - Applications - - - Settingsmenu - kf5-settingsmenu.directory - - Settings - - - - - archboot.desktop - ${_STANDARD_BROWSER}.desktop - org.kde.dolphin.desktop - gparted.desktop - org.kde.konsole.desktop - - -EOF - echo "Autostarting setup..." - cat << EOF > /etc/xdg/autostart/archboot.desktop -[Desktop Entry] -Type=Application -Name=Archboot Setup -GenericName=Installer -Exec=konsole -p colors=Linux -e /usr/bin/setup -Icon=system-software-install -EOF - cp /etc/xdg/autostart/archboot.desktop /usr/share/applications/ -} - -_configure_sway() { - echo "Configuring Sway..." - echo "Configuring bemenu..." - sed -i -e 's|^set $menu.*|set $menu j4-dmenu-desktop --dmenu=\x27bemenu -i --tf "#00ff00" --hf "#00ff00" --nf "#dcdccc" --fn "pango:Terminus 12" -H 30\x27 --no-generic --term="foot"|g' /etc/sway/config - echo "Configuring wallpaper..." - sed -i -e 's|^output .*|output * bg /usr/share/archboot/grub/archboot-background.png fill|g' /etc/sway/config - echo "Configuring foot..." - if ! grep -q 'archboot colors' /etc/xdg/foot/foot.ini; then -cat <> /etc/xdg/foot/foot.ini -# archboot colors -[colors] -background=000000 -foreground=ffffff - -## Normal/regular colors (color palette 0-7) -regular0=000000 # bright black -regular1=ff0000 # bright red -regular2=00ff00 # bright green -regular3=ffff00 # bright yellow -regular4=005fff # bright blue -regular5=ff00ff # bright magenta -regular6=00ffff # bright cyan -regular7=ffffff # bright white - -## Bright colors (color palette 8-15) -bright0=000000 # bright black -bright1=ff0000 # bright red -bright2=00ff00 # bright green -bright3=ffff00 # bright yellow -bright4=005fff # bright blue -bright5=ff00ff # bright magenta -bright6=00ffff # bright cyan -bright7=ffffff # bright white - -[main] -font=monospace:size=12 -EOF - - fi - echo "Autostarting setup..." - grep -q 'exec foot' /etc/sway/config ||\ - echo "exec foot -- /usr/bin/setup" >> /etc/sway/config - if ! grep -q firefox /etc/sway/config; then - cat <> /etc/sway/config -# from https://wiki.gentoo.org/wiki/Sway -# automatic floating -for_window [window_role = "pop-up"] floating enable -for_window [window_role = "bubble"] floating enable -for_window [window_role = "dialog"] floating enable -for_window [window_type = "dialog"] floating enable -for_window [window_role = "task_dialog"] floating enable -for_window [window_type = "menu"] floating enable -for_window [app_id = "floating"] floating enable -for_window [app_id = "floating_update"] floating enable, resize set width 1000px height 600px -for_window [class = "(?i)pinentry"] floating enable -for_window [title = "Administrator privileges required"] floating enable -# firefox tweaks -for_window [title = "About Mozilla Firefox"] floating enable -for_window [window_role = "About"] floating enable -for_window [app_id="firefox" title="Library"] floating enable, border pixel 1, sticky enable -for_window [title = "Firefox - Sharing Indicator"] kill -for_window [title = "Firefox — Sharing Indicator"] kill -EOF - fi - echo "Configuring desktop files..." - cat << EOF > /usr/share/applications/archboot.desktop -[Desktop Entry] -Type=Application -Name=Archboot Setup -GenericName=Installer -Exec=foot -- /usr/bin/setup -Icon=system-software-install -EOF - _HIDE_MENU="avahi-discover bssh bvnc org.codeberg.dnkl.foot-server org.codeberg.dnkl.footclient qvidcap qv4l2" - echo "Hiding ${_HIDE_MENU} menu entries..." - for i in ${_HIDE_MENU}; do - echo "[DESKTOP ENTRY]" > /usr/share/applications/"${i}".desktop - echo 'NoDisplay=true' >> /usr/share/applications/"${i}".desktop - done - echo "Configuring waybar..." - if ! grep -q 'exec waybar' /etc/sway/config; then - # hide sway-bar - sed -i '/position top/a mode invisible' /etc/sway/config - # diable not usable plugins - echo "exec waybar" >> /etc/sway/config - sed -i -e 's#, "custom/media"##g' /etc/xdg/waybar/config - sed -i -e 's#"mpd", "idle_inhibitor", "pulseaudio",##g' /etc/xdg/waybar/config - fi - echo "Configuring wayvnc..." - if ! grep -q wayvnc /etc/sway/config; then - echo "address=0.0.0.0" > /etc/wayvnc - echo "exec wayvnc -C /etc/wayvnc &" >> /etc/sway/config - fi -} - _custom_wayland_xorg() { if [[ -n "${_CUSTOM_WAYLAND}" ]]; then echo -e "\e[1mStep 1/2:\e[m Installing custom wayland..." diff --git a/usr/lib/archboot/update/gnome-wayland.sh b/usr/lib/archboot/update/gnome-wayland.sh deleted file mode 100644 index aea41d748..000000000 --- a/usr/lib/archboot/update/gnome-wayland.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-2.0-only -# created by Tobias Powalowski -_install_gnome_wayland() { - _PACKAGES="${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES} ${_STANDARD_BROWSER} ${_GNOME_PACKAGES}" - _prepare_gnome -} - -_start_gnome_wayland() { - _progress "100" "Launching GNOME Wayland now, logging is done on /dev/tty8..." - sleep 2 - echo "MOZ_ENABLE_WAYLAND=1 QT_QPA_PLATFORM=wayland XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session >/dev/tty7 2>&1" > /usr/bin/gnome-wayland - chmod 755 /usr/bin/gnome-wayland - gnome-wayland -} -# vim: set ft=sh ts=4 sw=4 et: diff --git a/usr/lib/archboot/update/gnome.sh b/usr/lib/archboot/update/gnome.sh index 2e6d4a7f5..6ddc6082f 100644 --- a/usr/lib/archboot/update/gnome.sh +++ b/usr/lib/archboot/update/gnome.sh @@ -1,11 +1,56 @@ #!/usr/bin/env bash # SPDX-License-Identifier: GPL-2.0-only # created by Tobias Powalowski + +_configure_gnome() { + echo "Configuring Gnome..." + [[ "${_STANDARD_BROWSER}" == "firefox" ]] && gsettings set org.gnome.shell favorite-apps "['org.gnome.Settings.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', 'firefox.desktop', 'org.gnome.DiskUtility.desktop', 'gparted.desktop', 'archboot.desktop']" + [[ "${_STANDARD_BROWSER}" == "chromium" ]] && gsettings set org.gnome.shell favorite-apps "['org.gnome.Settings.desktop', 'org.gnome.Terminal.desktop', 'org.gnome.Nautilus.desktop', 'chromium.desktop', 'org.gnome.DiskUtility.desktop', 'gparted.desktop', 'archboot.desktop']" + echo "Setting wallpaper..." + gsettings set org.gnome.desktop.background picture-uri file:////usr/share/archboot/grub/archboot-background.png + echo "Autostarting setup..." + cat << EOF > /etc/xdg/autostart/archboot.desktop +[Desktop Entry] +Type=Application +Name=Archboot Setup +GenericName=Installer +Exec=gnome-terminal -- /usr/bin/setup +Icon=system-software-install +EOF + cp /etc/xdg/autostart/archboot.desktop /usr/share/applications/ + _HIDE_MENU="avahi-discover bssh bvnc org.gnome.Extensions org.gnome.FileRoller org.gnome.gThumb org.gnome.gedit fluid vncviewer qvidcap qv4l2" + echo "Hiding ${_HIDE_MENU} menu entries..." + for i in ${_HIDE_MENU}; do + echo "[DESKTOP ENTRY]" > /usr/share/applications/"${i}".desktop + echo 'NoDisplay=true' >> /usr/share/applications/"${i}".desktop + done +} + +_prepare_gnome() { + if ! [[ -e /usr/bin/gnome-session ]]; then + _prepare_graphic "${_PACKAGES}" + _configure_gnome >"${_LOG}" 2>&1 + fi +} + +_install_gnome_wayland() { + _PACKAGES="${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES} ${_STANDARD_BROWSER} ${_GNOME_PACKAGES}" + _prepare_gnome +} + _install_gnome() { _PACKAGES="${_XORG_PACKAGE} ${_VNC_PACKAGE} ${_STANDARD_PACKAGES} ${_STANDARD_BROWSER} ${_GNOME_PACKAGES}" _prepare_gnome } +_start_gnome_wayland() { + _progress "100" "Launching GNOME Wayland now, logging is done on /dev/tty8..." + sleep 2 + echo "MOZ_ENABLE_WAYLAND=1 QT_QPA_PLATFORM=wayland XDG_SESSION_TYPE=wayland exec dbus-run-session gnome-session >/dev/tty7 2>&1" > /usr/bin/gnome-wayland + chmod 755 /usr/bin/gnome-wayland + gnome-wayland +} + _start_gnome() { _progress "100" "Launching GNOME now, logging is done on /dev/tty8..." sleep 2 diff --git a/usr/lib/archboot/update/manage.sh b/usr/lib/archboot/update/manage.sh index 44874b804..6a425b2a6 100644 --- a/usr/lib/archboot/update/manage.sh +++ b/usr/lib/archboot/update/manage.sh @@ -158,7 +158,7 @@ _download_latest() { wget -q "${_SOURCE}${_LIB}/${i}?inline=false" -O "${_LIB}/${i}" done # update libs - LIBS="update.sh manage.sh desktop.sh xfce.sh gnome.sh gnome-wayland.sh plasma.sh plasma-wayland.sh sway.sh" + LIBS="update.sh manage.sh desktop.sh xfce.sh gnome.sh plasma.sh sway.sh" for i in ${LIBS}; do wget -q "${_SOURCE}${_UPDATE}/${i}?inline=false" -O "${_UPDATE}/${i}" done diff --git a/usr/lib/archboot/update/plasma-wayland.sh b/usr/lib/archboot/update/plasma-wayland.sh deleted file mode 100644 index 8aac40f2b..000000000 --- a/usr/lib/archboot/update/plasma-wayland.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/usr/bin/env bash -# SPDX-License-Identifier: GPL-2.0-only -# created by Tobias Powalowski -_install_plasma_wayland() { - _PACKAGES="${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES} ${_STANDARD_BROWSER} ${_PLASMA_PACKAGES}" - _prepare_plasma -} - -_start_plasma_wayland() { - _progress "100" "Launching Plasma/KDE Wayland now, logging is done on /dev/tty8..." - sleep 2 - echo "MOZ_ENABLE_WAYLAND=1 QT_QPA_PLATFORM=wayland XDG_SESSION_TYPE=wayland exec dbus-run-session startplasma-wayland >/dev/tty7 2>&1" > /usr/bin/plasma-wayland - chmod 755 /usr/bin/plasma-wayland - plasma-wayland -} -# vim: set ft=sh ts=4 sw=4 et: diff --git a/usr/lib/archboot/update/plasma.sh b/usr/lib/archboot/update/plasma.sh index d5bf952d1..6048e9a94 100644 --- a/usr/lib/archboot/update/plasma.sh +++ b/usr/lib/archboot/update/plasma.sh @@ -1,11 +1,90 @@ #!/usr/bin/env bash # SPDX-License-Identifier: GPL-2.0-only # created by Tobias Powalowski + +_configure_plasma() { + echo "Configuring KDE..." + sed -i -e "s#applications:.*#applications:systemsettings.desktop,applications:org.kde.konsole.desktop,preferred://filemanager,applications:${_STANDARD_BROWSER}.desktop,applications:gparted.desktop,applications:archboot.desktop#g" /usr/share/plasma/plasmoids/org.kde.plasma.tasvconsoleanager/contents/config/main.xml + echo "Replacing wallpaper..." + for i in /usr/share/wallpapers/Next/contents/images/*; do + cp /usr/share/archboot/grub/archboot-background.png "${i}" + done + echo "Replacing menu structure..." + cat << EOF >/etc/xdg/menus/applications.menu + + + + Applications + kde-main.directory + + + + + + + + More + + + + + Applications + + + Settingsmenu + kf5-settingsmenu.directory + + Settings + + + + + archboot.desktop + ${_STANDARD_BROWSER}.desktop + org.kde.dolphin.desktop + gparted.desktop + org.kde.konsole.desktop + + +EOF + echo "Autostarting setup..." + cat << EOF > /etc/xdg/autostart/archboot.desktop +[Desktop Entry] +Type=Application +Name=Archboot Setup +GenericName=Installer +Exec=konsole -p colors=Linux -e /usr/bin/setup +Icon=system-software-install +EOF + cp /etc/xdg/autostart/archboot.desktop /usr/share/applications/ +} + +_prepare_plasma() { + if ! [[ -e /usr/bin/startplasma-x11 ]]; then + _prepare_graphic "${_PACKAGES}" + _configure_plasma >"${_LOG}" 2>&1 + fi +} + +_install_plasma_wayland() { + _PACKAGES="${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES} ${_STANDARD_BROWSER} ${_PLASMA_PACKAGES}" + _prepare_plasma +} + _install_plasma() { _PACKAGES="${_XORG_PACKAGE} ${_VNC_PACKAGE} ${_STANDARD_PACKAGES} ${_STANDARD_BROWSER} ${_PLASMA_PACKAGES}" _prepare_plasma } +_start_plasma_wayland() { + _progress "100" "Launching Plasma/KDE Wayland now, logging is done on /dev/tty8..." + sleep 2 + echo "MOZ_ENABLE_WAYLAND=1 QT_QPA_PLATFORM=wayland XDG_SESSION_TYPE=wayland exec dbus-run-session startplasma-wayland >/dev/tty7 2>&1" > /usr/bin/plasma-wayland + chmod 755 /usr/bin/plasma-wayland + plasma-wayland +} + _start_plasma() { _progress "100" "Launching Plasma/KDE now, logging is done on /dev/tty8..." sleep 2 diff --git a/usr/lib/archboot/update/sway.sh b/usr/lib/archboot/update/sway.sh index 5f64d2d60..3bf285a75 100644 --- a/usr/lib/archboot/update/sway.sh +++ b/usr/lib/archboot/update/sway.sh @@ -1,9 +1,108 @@ #!/usr/bin/env bash # SPDX-License-Identifier: GPL-2.0-only # created by Tobias Powalowski + +_configure_sway() { + echo "Configuring Sway..." + echo "Configuring bemenu..." + sed -i -e 's|^set $menu.*|set $menu j4-dmenu-desktop --dmenu=\x27bemenu -i --tf "#00ff00" --hf "#00ff00" --nf "#dcdccc" --fn "pango:Terminus 12" -H 30\x27 --no-generic --term="foot"|g' /etc/sway/config + echo "Configuring wallpaper..." + sed -i -e 's|^output .*|output * bg /usr/share/archboot/grub/archboot-background.png fill|g' /etc/sway/config + echo "Configuring foot..." + if ! grep -q 'archboot colors' /etc/xdg/foot/foot.ini; then +cat <> /etc/xdg/foot/foot.ini +# archboot colors +[colors] +background=000000 +foreground=ffffff + +## Normal/regular colors (color palette 0-7) +regular0=000000 # bright black +regular1=ff0000 # bright red +regular2=00ff00 # bright green +regular3=ffff00 # bright yellow +regular4=005fff # bright blue +regular5=ff00ff # bright magenta +regular6=00ffff # bright cyan +regular7=ffffff # bright white + +## Bright colors (color palette 8-15) +bright0=000000 # bright black +bright1=ff0000 # bright red +bright2=00ff00 # bright green +bright3=ffff00 # bright yellow +bright4=005fff # bright blue +bright5=ff00ff # bright magenta +bright6=00ffff # bright cyan +bright7=ffffff # bright white + +[main] +font=monospace:size=12 +EOF + + fi + echo "Autostarting setup..." + grep -q 'exec foot' /etc/sway/config ||\ + echo "exec foot -- /usr/bin/setup" >> /etc/sway/config + if ! grep -q firefox /etc/sway/config; then + cat <> /etc/sway/config +# from https://wiki.gentoo.org/wiki/Sway +# automatic floating +for_window [window_role = "pop-up"] floating enable +for_window [window_role = "bubble"] floating enable +for_window [window_role = "dialog"] floating enable +for_window [window_type = "dialog"] floating enable +for_window [window_role = "task_dialog"] floating enable +for_window [window_type = "menu"] floating enable +for_window [app_id = "floating"] floating enable +for_window [app_id = "floating_update"] floating enable, resize set width 1000px height 600px +for_window [class = "(?i)pinentry"] floating enable +for_window [title = "Administrator privileges required"] floating enable +# firefox tweaks +for_window [title = "About Mozilla Firefox"] floating enable +for_window [window_role = "About"] floating enable +for_window [app_id="firefox" title="Library"] floating enable, border pixel 1, sticky enable +for_window [title = "Firefox - Sharing Indicator"] kill +for_window [title = "Firefox — Sharing Indicator"] kill +EOF + fi + echo "Configuring desktop files..." + cat << EOF > /usr/share/applications/archboot.desktop +[Desktop Entry] +Type=Application +Name=Archboot Setup +GenericName=Installer +Exec=foot -- /usr/bin/setup +Icon=system-software-install +EOF + _HIDE_MENU="avahi-discover bssh bvnc org.codeberg.dnkl.foot-server org.codeberg.dnkl.footclient qvidcap qv4l2" + echo "Hiding ${_HIDE_MENU} menu entries..." + for i in ${_HIDE_MENU}; do + echo "[DESKTOP ENTRY]" > /usr/share/applications/"${i}".desktop + echo 'NoDisplay=true' >> /usr/share/applications/"${i}".desktop + done + echo "Configuring waybar..." + if ! grep -q 'exec waybar' /etc/sway/config; then + # hide sway-bar + sed -i '/position top/a mode invisible' /etc/sway/config + # diable not usable plugins + echo "exec waybar" >> /etc/sway/config + sed -i -e 's#, "custom/media"##g' /etc/xdg/waybar/config + sed -i -e 's#"mpd", "idle_inhibitor", "pulseaudio",##g' /etc/xdg/waybar/config + fi + echo "Configuring wayvnc..." + if ! grep -q wayvnc /etc/sway/config; then + echo "address=0.0.0.0" > /etc/wayvnc + echo "exec wayvnc -C /etc/wayvnc &" >> /etc/sway/config + fi +} + _install_sway() { _PACKAGES="${_WAYLAND_PACKAGE} ${_STANDARD_PACKAGES} ${_STANDARD_BROWSER} ${_SWAY_PACKAGES}" - _prepare_sway + if ! [[ -e /usr/bin/sway ]]; then + _prepare_graphic "${_PACKAGES}" + _configure_sway >"${_LOG}" 2>&1 + fi } _start_sway() {