diff --git a/Makefile b/Makefile index 1529f0d..d41b006 100644 --- a/Makefile +++ b/Makefile @@ -92,7 +92,19 @@ install: $(INSTALL) $(wildcard ksplash-theme/joy/1920x1080/*) $(DESTDIR)/usr/share/kde4/apps/ksplash/Themes/joy/1920x1080 install -d $(DESTDIR)/usr/share/kde4/apps/ksplash/Themes/joy/1920x1200 $(INSTALL) $(wildcard ksplash-theme/joy/1920x1200/*) $(DESTDIR)/usr/share/kde4/apps/ksplash/Themes/joy/1920x1200 + + ## SDDM meta theme (configured with alternatives) + install -d $(DESTDIR)/usr/share/sddm/themes/debian-theme + $(INSTALL) $(wildcard sddm-debian/*) $(DESTDIR)/usr/share/sddm/themes/debian-theme + + ## Lines + install -d $(DESTDIR)/usr/share/desktop-base/lines-theme + # login background + $(INSTALL) lines-theme/login-background.svg $(DESTDIR)/usr/share/desktop-base/lines-theme/ + $(INSTALL) lines-theme/login-background-with-logo.svg $(DESTDIR)/usr/share/desktop-base/lines-theme/ + $(INSTALL) lines-theme/sddm-preview.jpg $(DESTDIR)/usr/share/desktop-base/lines-theme/ + install -d $(DESTDIR)/usr/share/kde4/apps/ksplash/Themes/lines/images $(INSTALL) $(wildcard ksplash-theme/lines/*.qml) $(DESTDIR)/usr/share/kde4/apps/ksplash/Themes/lines $(INSTALL) $(wildcard ksplash-theme/lines/*.png) $(DESTDIR)/usr/share/kde4/apps/ksplash/Themes/lines @@ -106,8 +118,6 @@ install: # GNOME background descriptor mkdir -p $(DESTDIR)/usr/share/gnome-background-properties $(INSTALL) gnome-backgrounds.xml $(DESTDIR)/usr/share/gnome-background-properties/debian.xml - # login background - $(INSTALL) login/background.svg $(DESTDIR)/usr/share/images/desktop-base/login-background.svg # grub $(INSTALL) grub/lines-grub.png $(DESTDIR)/usr/share/images/desktop-base/ diff --git a/debian/README.Debian b/debian/README.Debian index 0c1667e..911b4e6 100644 --- a/debian/README.Debian +++ b/debian/README.Debian @@ -20,7 +20,7 @@ README for desktop-base 1.2. Pixmaps /usr/share/pixmaps/debian-security.png -1.3. Splash, wallpapers and grub images +1.3. Grub, boot, login and wallpapers themes Wallpapers are provided in two svg variant, one standard aspect (4/3) and one widescreen (16/9). You can switch from one another using the alternatives. @@ -29,16 +29,16 @@ that changing alternative means at the next package upgrade it won't be automatically reverted to the default choice. For wallpaper you can run: - sudo update-alternatives --config desktop-background For splash screens you can run: - sudo update-alternatives --config desktop-splash +For login screen (only SDDM for now) you can run: + sudo update-alternatives --config desktop-login-background + For grub, you can select standard or widescreen version too. Widescreen can be better in particular for UEFI firmwares: - sudo update-alternatives --config desktop-grub 2. Desktop files diff --git a/debian/changelog b/debian/changelog index 52a1fba..9d2b0ec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -7,6 +7,10 @@ desktop-base (9.0.0~exp1) UNRELEASED; urgency=medium (Closes #659549) * README.Debian: inform about updating initrds too. (Closes #612163) * Document use of sync use before grub update in postinst. (Closes #611364) + * Add SDDM theming for KDE/Plasma 5: + - Based on default SDDM theme breeze + Debian theme background. + - Can be configured with alternatives (also works in lightdm). + (Closes: #415064, #608523, #611170, #670866, #762276) -- Coucouf Tue, 06 Sep 2016 08:14:12 +0200 diff --git a/debian/postinst b/debian/postinst index 12c0f4d..3b88ba2 100644 --- a/debian/postinst +++ b/debian/postinst @@ -52,6 +52,20 @@ spacefun-splash.svg 50 moreblue-orbit-splash.png 40 EOF + # Login theme + update-alternatives --install /usr/share/images/desktop-base/login-background.svg \ + desktop-login-background \ + /usr/share/desktop-base/lines-theme/login-background.svg 70 \ + --slave /usr/share/sddm/themes/debian-theme/sddm-preview.jpg \ + desktop-sddm-preview \ + /usr/share/desktop-base/lines-theme/sddm-preview.jpg + update-alternatives --install /usr/share/images/desktop-base/login-background.svg \ + desktop-login-background \ + /usr/share/desktop-base/lines-theme/login-background-with-logo.svg 65 \ + --slave /usr/share/sddm/themes/debian-theme/sddm-preview.jpg \ + desktop-sddm-preview \ + /usr/share/desktop-base/lines-theme/sddm-preview.jpg + # Alternatives for grub ## Favor widescreen / hi-res background for efi installations num_grub_efi_installed=$(dpkg-query --list "grub-efi*" | grep "^i" | wc -l) diff --git a/debian/prerm b/debian/prerm index f6b58f0..fcff04f 100644 --- a/debian/prerm +++ b/debian/prerm @@ -32,6 +32,17 @@ if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]; then update-alternatives --remove desktop-background.xml /usr/share/images/desktop-base/$desktopbackground done + # remove login theme alternatives + # secondaire alternatives + update-alternatives --remove desktop-sddm-preview \ + /usr/share/desktop-base/lines-theme/sddm-preview.jpg + # main alternatives + update-alternatives --remove desktop-login-background \ + /usr/share/desktop-base/lines-theme/login-background.svg + update-alternatives --remove desktop-login-background \ + /usr/share/desktop-base/lines-theme/login-background-no-logo.svg + + # remove splash alternatives for splash in \ spacefun-splash.svg \ diff --git a/login/background.svg b/lines-theme/login-background-with-logo.svg similarity index 100% rename from login/background.svg rename to lines-theme/login-background-with-logo.svg diff --git a/lines-theme/login-background.svg b/lines-theme/login-background.svg new file mode 100644 index 0000000..19ee6ec --- /dev/null +++ b/lines-theme/login-background.svg @@ -0,0 +1,67 @@ + +image/svg+xml \ No newline at end of file diff --git a/lines-theme/sddm-preview.jpg b/lines-theme/sddm-preview.jpg new file mode 100644 index 0000000..254dc8e Binary files /dev/null and b/lines-theme/sddm-preview.jpg differ diff --git a/sddm-debian/Main.qml b/sddm-debian/Main.qml new file mode 100644 index 0000000..2fa6546 --- /dev/null +++ b/sddm-debian/Main.qml @@ -0,0 +1,275 @@ +/* + * Copyright 2014 David Edmundson + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU Library General Public License as + * published by the Free Software Foundation; either version 2 or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU Library General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +import QtQuick 2.2 +import QtQuick.Layouts 1.1 +import QtQuick.Controls 1.1 as Controls + +import org.kde.plasma.core 2.0 as PlasmaCore +import org.kde.plasma.components 2.0 as PlasmaComponents + +import SddmComponents 2.0 + +import "../breeze/components" + +Image { + id: root + width: 1000 + height: 1000 + + LayoutMirroring.enabled: Qt.application.layoutDirection === Qt.RightToLeft + LayoutMirroring.childrenInherit: true + + Repeater { + model: screenModel + Background { + x: geometry.x; y: geometry.y; width: geometry.width; height:geometry.height + source: config.background + fillMode: Image.PreserveAspectCrop + onStatusChanged: { + if (status == Image.Error && source != config.defaultBackground) { + source = config.defaultBackground + } + } + } + } + + property bool debug: false + + Rectangle { + id: debug3 + color: "green" + visible: debug + width: 3 + height: parent.height + anchors.horizontalCenter: root.horizontalCenter + } + + Controls.StackView { + id: stackView + + //Display the loginpromt only in the primary screen + readonly property rect geometry: screenModel.geometry(screenModel.primary) + width: geometry.width + x: geometry.x + height: units.largeSpacing*14 + //Display the BreezeBlock in the middle of each screen + y: geometry.y + (geometry.height / 2) - (height / 2) + + initialItem: BreezeBlock { + id: loginPrompt + + //Enable clipping whilst animating, otherwise the items would be shifted to other screens in multiscreen setups + //As there are only 2 items (loginPrompt and logoutScreenComponent), it's sufficient to do it only in this component + //Remember to enable clipping whilst animating when creating additional items for the StackView! + Controls.Stack.onStatusChanged: { + if(Controls.Stack.status === Controls.Stack.Activating || Controls.Stack.status === Controls.Stack.Deactivating){ + stackView.clip = true; + }else if(Controls.Stack.status === Controls.Stack.Active || Controls.Stack.status === Controls.Stack.Inactive){ + stackView.clip = false; + } + } + + main: UserSelect { + model: userModel + selectedIndex: userModel.lastIndex + + //Resets the "Login Failed" notification after 3 seconds + Timer { + id: notificationResetTimer + interval: 3000 + onTriggered: notification = "" + } + + Connections { + target: sddm + onLoginFailed: { + notificationResetTimer.restart() + notification = i18nd("plasma_lookandfeel_org.kde.lookandfeel", "Login Failed") + } + } + + } + + controls: Item { + height: childrenRect.height + + property alias password: passwordInput.text + property alias sessionIndex: sessionCombo.currentIndex + property alias buttonEnabled: loginButton.enabled + property alias pwFieldEnabled: passwordInput.enabled + + ColumnLayout { + anchors.horizontalCenter: parent.horizontalCenter + spacing: 0 + RowLayout { + anchors.horizontalCenter: parent.horizontalCenter + + PlasmaComponents.Button { + id: kbdLayoutButton + implicitWidth: minimumWidth + text: keyboard.layouts[keyboard.currentLayout].shortName + visible: keyboard.layouts.length > 1 + + onClicked: { + var idx = (keyboard.currentLayout + 1) % keyboard.layouts.length; + keyboard.currentLayout = idx; + } + + KeyNavigation.tab: sessionCombo + } + + PlasmaComponents.TextField { + id: passwordInput + placeholderText: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Password") + echoMode: TextInput.Password + onAccepted: loginPrompt.startLogin() + focus: true + + //focus works in qmlscene + //but this seems to be needed when loaded from SDDM + //I don't understand why, but we have seen this before in the old lock screen + Timer { + interval: 200 + running: true + onTriggered: passwordInput.forceActiveFocus() + } + //end hack + + Keys.onEscapePressed: { + loginPrompt.mainItem.forceActiveFocus(); + } + + //if empty and left or right is pressed change selection in user switch + //this cannot be in keys.onLeftPressed as then it doesn't reach the password box + Keys.onPressed: { + if (event.key == Qt.Key_Left && !text) { + loginPrompt.mainItem.decrementCurrentIndex(); + event.accepted = true + } + if (event.key == Qt.Key_Right && !text) { + loginPrompt.mainItem.incrementCurrentIndex(); + event.accepted = true + } + } + + KeyNavigation.backtab: loginPrompt.mainItem + } + + PlasmaComponents.Button { + id: loginButton + //this keeps the buttons the same width and thus line up evenly around the centre + Layout.minimumWidth: passwordInput.width + text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Login") + onClicked: loginPrompt.startLogin(); + + KeyNavigation.tab: kbdLayoutButton + } + } + + BreezeLabel { + id: capsLockWarning + text: i18nd("plasma_lookandfeel_org.kde.lookandfeel","Caps Lock is on") + visible: keystateSource.data["Caps Lock"]["Locked"] + + anchors.horizontalCenter: parent.horizontalCenter + font.weight: Font.Bold + + PlasmaCore.DataSource { + id: keystateSource + engine: "keystate" + connectedSources: "Caps Lock" + } + } + } + + PlasmaComponents.ComboBox { + id: sessionCombo + model: sessionModel + currentIndex: sessionModel.lastIndex + + width: 200 + textRole: "name" + + anchors.left: parent.left + } + + LogoutOptions { + mode: "" + canShutdown: true + canReboot: true + canLogout: false + exclusive: false + + anchors { + right: parent.right + } + + onModeChanged: { + if (mode) { + stackView.push(logoutScreenComponent, {"mode": mode}) + } + } + onVisibleChanged: if(visible) { + mode = "" + } + } + + Connections { + target: sddm + onLoginFailed: { + //Re-enable button and textfield + passwordInput.enabled = true + passwordInput.selectAll() + passwordInput.forceActiveFocus() + loginButton.enabled = true; + } + } + + } + + function startLogin () { + //Disable button and textfield while password check is running + controlsItem.pwFieldEnabled = false; + controlsItem.buttonEnabled = false; + //Clear notification in case the notificationResetTimer hasn't expired yet + mainItem.notification = "" + sddm.login(mainItem.selectedUser, controlsItem.password, controlsItem.sessionIndex) + } + + Component { + id: logoutScreenComponent + LogoutScreen { + onCancel: { + stackView.pop() + } + + onShutdownRequested: { + sddm.powerOff() + } + + onRebootRequested: { + sddm.reboot() + } + } + } + } + + } +} diff --git a/sddm-debian/metadata.desktop b/sddm-debian/metadata.desktop new file mode 100644 index 0000000..e6f22e0 --- /dev/null +++ b/sddm-debian/metadata.desktop @@ -0,0 +1,12 @@ +[SddmGreeterTheme] +Name=Debian Theme +Name[fr]=Défaut pour Debian +Description=Debian theme powered by alternatives system +Description[fr]=Thème Debian configurables par le sytème d’alternatives +Type=sddm-theme +Version=0.1 +Screenshot=sddm-preview.jpg +MainScript=Main.qml +ConfigFile=theme.conf +Theme-Id=debian-theme +Theme-API=2.0 diff --git a/sddm-debian/theme.conf b/sddm-debian/theme.conf new file mode 100644 index 0000000..7e7929f --- /dev/null +++ b/sddm-debian/theme.conf @@ -0,0 +1,2 @@ +[General] +background=/usr/share/images/desktop-base/login-background.svg