diff --git a/README.md b/README.md index f02242a..5ab7735 100644 --- a/README.md +++ b/README.md @@ -95,7 +95,7 @@ It runs these steps, in this order, and every one of them is idempotent: | 6. User units | installs the session services into `~/.config/systemd/user` and enables them | | 7. systemd drop-ins | writes the shutdown timeouts, oomd thresholds, plocate prune paths, and sleep hooks under `/etc` | | 8. System services | enables NetworkManager, resolved, bluetooth, cups, avahi, docker, power-profiles-daemon, and oomd, masks `NetworkManager-wait-online`, sets the boot splash to `branding/blob_boot.png`, and sets GRUB up with every other installed OS in its menu | -| 9. Login screen | installs the session entry and the SDDM config, enables `sddm.service`, and sets the default target to `graphical.target` | +| 9. Login screen | installs the session entry, the SDDM config and the Blob login theme, enables `sddm.service`, and sets the default target to `graphical.target` | | 10. Reload | reloads systemd, restarts the running user services, and in a running session re-renders the theme, reloads Hyprland, and restarts the Blob shell | | 11. Launch | offers a reboot, or starts the login screen straight away if you decline | diff --git a/bin/blob-plymouth-set b/bin/blob-plymouth-set index 7a1b14f..28315af 100755 --- a/bin/blob-plymouth-set +++ b/bin/blob-plymouth-set @@ -206,7 +206,7 @@ run_root_transaction() { ) plymouth_default_assets=("${plymouth_theme_assets[@]}" logos/oma.png) sddm_theme_assets=(Main.qml bullet.png entry-failed.png entry.png lock-failed.png lock.png logo.png) - sddm_default_assets=("${sddm_theme_assets[@]}" metadata.desktop theme.conf) + sddm_default_assets=(Main.qml metadata.desktop theme.conf) plymouth_assets=() sddm_assets=() diff --git a/default/sddm/blob/Main.qml b/default/sddm/blob/Main.qml new file mode 100644 index 0000000..c45036b --- /dev/null +++ b/default/sddm/blob/Main.qml @@ -0,0 +1,242 @@ +import QtQuick + +Rectangle { + id: root + + readonly property color backgroundColor: "#1a1b26" + readonly property color textColor: "#ffffff" + readonly property color errorColor: "#f7768e" + readonly property string fontFamily: "monospace" + + property int sessionIndex: sessionModel.lastIndex >= 0 ? sessionModel.lastIndex : 0 + property string statusMessage: "" + property bool loggingIn: false + + width: 1920 + height: 1080 + color: root.backgroundColor + + function sessionName(index) { + var session = sessionNames.itemAt(index) + return session ? session.sessionName : "" + } + + function nextSession() { + if (sessionNames.count > 0) root.sessionIndex = (root.sessionIndex + 1) % sessionNames.count + } + + function login() { + if (root.loggingIn) return + if (usernameInput.text.length === 0) { + usernameInput.forceActiveFocus() + return + } + root.loggingIn = true + root.statusMessage = "" + sddm.login(usernameInput.text, passwordInput.text, root.sessionIndex) + } + + Repeater { + id: sessionNames + model: sessionModel + + Item { + required property string name + readonly property string sessionName: name + } + } + + Connections { + target: sddm + + function onLoginFailed() { + root.loggingIn = false + root.statusMessage = "Wrong password" + passwordInput.text = "" + passwordInput.forceActiveFocus() + } + + function onLoginSucceeded() { + root.statusMessage = "" + } + } + + Column { + anchors.centerIn: parent + spacing: 28 + + Image { + id: logo + anchors.horizontalCenter: parent.horizontalCenter + source: "logo.png" + sourceSize.width: 160 + sourceSize.height: 160 + fillMode: Image.PreserveAspectFit + onStatusChanged: if (status === Image.Error && source.toString().endsWith("logo.png")) source = "logo.svg" + } + + Text { + anchors.horizontalCenter: parent.horizontalCenter + text: Qt.formatTime(clock.now, "HH:mm") + color: root.textColor + font.family: root.fontFamily + font.pixelSize: 56 + } + + Column { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 12 + + Rectangle { + width: 320 + height: 44 + radius: 6 + color: "transparent" + border.width: 1 + border.color: usernameInput.activeFocus ? root.textColor : Qt.rgba(root.textColor.r, root.textColor.g, root.textColor.b, 0.35) + + TextInput { + id: usernameInput + anchors.fill: parent + anchors.leftMargin: 14 + anchors.rightMargin: 14 + verticalAlignment: TextInput.AlignVCenter + text: userModel.lastUser + color: root.textColor + font.family: root.fontFamily + font.pixelSize: 16 + clip: true + KeyNavigation.tab: passwordInput + Keys.onReturnPressed: passwordInput.forceActiveFocus() + Keys.onEnterPressed: passwordInput.forceActiveFocus() + + Text { + anchors.verticalCenter: parent.verticalCenter + visible: usernameInput.text.length === 0 + text: "Username" + color: Qt.rgba(root.textColor.r, root.textColor.g, root.textColor.b, 0.5) + font: usernameInput.font + } + } + } + + Rectangle { + width: 320 + height: 44 + radius: 6 + color: "transparent" + border.width: 1 + border.color: root.statusMessage.length > 0 ? root.errorColor + : passwordInput.activeFocus ? root.textColor + : Qt.rgba(root.textColor.r, root.textColor.g, root.textColor.b, 0.35) + + TextInput { + id: passwordInput + anchors.fill: parent + anchors.leftMargin: 14 + anchors.rightMargin: 14 + verticalAlignment: TextInput.AlignVCenter + echoMode: TextInput.Password + passwordCharacter: "•" + color: root.textColor + font.family: root.fontFamily + font.pixelSize: 16 + clip: true + focus: usernameInput.text.length > 0 + KeyNavigation.backtab: usernameInput + Keys.onReturnPressed: root.login() + Keys.onEnterPressed: root.login() + + Text { + anchors.verticalCenter: parent.verticalCenter + visible: passwordInput.text.length === 0 + text: root.loggingIn ? "Logging in..." : "Password" + color: Qt.rgba(root.textColor.r, root.textColor.g, root.textColor.b, 0.5) + font.family: root.fontFamily + font.pixelSize: 16 + } + } + } + + Text { + anchors.horizontalCenter: parent.horizontalCenter + height: 20 + text: root.statusMessage + color: root.errorColor + font.family: root.fontFamily + font.pixelSize: 14 + } + } + } + + Row { + anchors.left: parent.left + anchors.bottom: parent.bottom + anchors.margins: 24 + + Text { + text: "Session: " + root.sessionName(root.sessionIndex) + color: root.textColor + opacity: sessionArea.containsMouse ? 1 : 0.6 + font.family: root.fontFamily + font.pixelSize: 14 + + MouseArea { + id: sessionArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: root.nextSession() + } + } + } + + Row { + anchors.right: parent.right + anchors.bottom: parent.bottom + anchors.margins: 24 + spacing: 24 + + Repeater { + model: [ + { label: "Reboot", available: sddm.canReboot, action: "reboot" }, + { label: "Shut down", available: sddm.canPowerOff, action: "powerOff" } + ] + + Text { + required property var modelData + visible: modelData.available + text: modelData.label + color: root.textColor + opacity: powerArea.containsMouse ? 1 : 0.6 + font.family: root.fontFamily + font.pixelSize: 14 + + MouseArea { + id: powerArea + anchors.fill: parent + hoverEnabled: true + cursorShape: Qt.PointingHandCursor + onClicked: modelData.action === "reboot" ? sddm.reboot() : sddm.powerOff() + } + } + } + } + + QtObject { + id: clock + property date now: new Date() + } + + Timer { + interval: 1000 + running: true + repeat: true + onTriggered: clock.now = new Date() + } + + Component.onCompleted: { + if (usernameInput.text.length > 0) passwordInput.forceActiveFocus() + else usernameInput.forceActiveFocus() + } +} diff --git a/default/sddm/blob/metadata.desktop b/default/sddm/blob/metadata.desktop new file mode 100644 index 0000000..f0039d3 --- /dev/null +++ b/default/sddm/blob/metadata.desktop @@ -0,0 +1,10 @@ +[SddmGreeterTheme] +Name=Blob +Description=Blob login screen +Type=sddm-theme +Version=1.0 +MainScript=Main.qml +ConfigFile=theme.conf +QtVersion=6 +Theme-Id=blob +Theme-API=2.0 diff --git a/default/sddm/blob/theme.conf b/default/sddm/blob/theme.conf new file mode 100644 index 0000000..9aad9e5 --- /dev/null +++ b/default/sddm/blob/theme.conf @@ -0,0 +1,3 @@ +[General] +type=color +color=#1a1b26 diff --git a/default/sddm/zz-blob.conf b/default/sddm/zz-blob.conf index 590a6a5..f8ce042 100644 --- a/default/sddm/zz-blob.conf +++ b/default/sddm/zz-blob.conf @@ -5,7 +5,7 @@ DisplayServer=wayland CompositorCommand=start-hyprland -- --config /etc/sddm/hyprland-greeter.lua [Theme] -Current= +Current=blob [Autologin] User= diff --git a/docs/install.md b/docs/install.md index b3ea61b..0923b05 100644 --- a/docs/install.md +++ b/docs/install.md @@ -126,7 +126,8 @@ with `--check`. | File | Why | | --- | --- | | `/usr/local/share/wayland-sessions/blob.desktop` | the session SDDM offers | - | `/etc/sddm.conf.d/zz-blob.conf` | Wayland greeter, run on Hyprland, stock theme, remember the last session | + | `/etc/sddm.conf.d/zz-blob.conf` | Wayland greeter, run on Hyprland, Blob theme, remember the last session | +| `/usr/share/sddm/themes/blob/` | the Blob login screen, from `default/sddm/blob/` and `branding/blob_icon.svg` | | `/etc/sddm/hyprland-greeter.lua` | the greeter's own tiny Hyprland config | | `/usr/local/bin/blob-hw-gpu-accelerated` | the renderer check that config runs, where SDDM's user can read it | | `/etc/pam.d/blob-lock-password` | the PAM stack the lock screen authenticates against | @@ -145,8 +146,8 @@ with `--check`. The `zz-` prefix is load-bearing. SDDM reads `/etc/sddm.conf.d` in alphabetical order and the last file wins, so a leftover `10-wayland.conf`, `10-theme.conf` or `autologin.conf` from another desktop would otherwise - override Blob's. For the same reason `zz-blob.conf` blanks `Theme` and - `Autologin`: a greeter pointed at an uninstalled theme, or an autologin + override Blob's. For the same reason `zz-blob.conf` pins `Theme` to `blob` + and blanks `Autologin`: a greeter pointed at an uninstalled theme, or an autologin pointed at a session entry that no longer exists, leaves SDDM on a black screen it never falls back from, and the only way in is a TTY. diff --git a/install/steps/login.sh b/install/steps/login.sh index c981b30..7e8de24 100644 --- a/install/steps/login.sh +++ b/install/steps/login.sh @@ -9,12 +9,15 @@ greeter_compositor_config=/etc/sddm/hyprland-greeter.lua blob_greeter_conf="$greeter_config_dir/zz-blob.conf" blob_autologin_conf="$greeter_config_dir/zzz-blob-autologin.conf" greeter_gpu_detector=/usr/local/bin/blob-hw-gpu-accelerated +greeter_theme_dir=/usr/share/sddm/themes/blob +greeter_theme_files=(Main.qml metadata.desktop theme.conf) # SDDM's stock Wayland greeter runs on weston, which Blob does not install. # Point it at Hyprland with a greeter-only config instead. That config is Lua: # Hyprland dropped the old hyprlang format, and a config it cannot parse leaves # the greeter with no compositor and the screen black. install_login_config() { + install_greeter_theme install_root_file "$repo_dir/default/sddm/hyprland-greeter.lua" \ "$greeter_compositor_config" "sddm/hyprland-greeter.lua" install_root_file "$repo_dir/default/sddm/zz-blob.conf" \ @@ -25,6 +28,16 @@ install_login_config() { /etc/pam.d/blob-lock-password "pam.d/blob-lock-password" } +install_greeter_theme() { + local file + for file in "${greeter_theme_files[@]}"; do + install_root_file "$repo_dir/default/sddm/blob/$file" \ + "$greeter_theme_dir/$file" "sddm/themes/blob/$file" + done + install_root_file "$repo_dir/branding/blob_icon.svg" \ + "$greeter_theme_dir/logo.svg" "sddm/themes/blob/logo.svg" +} + install_session_entry() { install_root_file "$repo_dir/session/blob.desktop" \ "$session_entry_dir/blob.desktop" "wayland session entry" @@ -75,8 +88,9 @@ report_greeter_compositor() { say " SDDM cannot draw a greeter without it; it is set in $blob_greeter_conf" } -# zz-blob.conf blanks Theme and Autologin, so a leftover drop-in cannot point the -# greeter at a theme that was uninstalled or autolog into a session that no +# zz-blob.conf pins Theme to Blob's own and blanks Autologin, so a leftover +# drop-in cannot point the greeter at a theme that was uninstalled or autolog +# into a session that no # longer exists. Either one leaves SDDM on a black screen it never falls back # from. Report the leftovers anyway: the file is confusing to find later, and the # Omarchy ISO wrote an autologin that no package owns, so it outlives Omarchy. diff --git a/uninstall.sh b/uninstall.sh index e54a2bd..7951b0f 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -17,6 +17,10 @@ root_files=( /etc/sddm.conf.d/10-blob.conf /etc/sddm.conf.d/99-blob-autologin.conf /etc/sddm/hyprland-greeter.lua + /usr/share/sddm/themes/blob/Main.qml + /usr/share/sddm/themes/blob/metadata.desktop + /usr/share/sddm/themes/blob/theme.conf + /usr/share/sddm/themes/blob/logo.svg /etc/systemd/system.conf.d/10-blob.conf /etc/systemd/system/user@.service.d/10-blob.conf /etc/systemd/oomd.conf.d/10-blob.conf