SDDM theming for KDE/Plasma 5

This commit is contained in:
Aurélien COUDERC
2016-09-23 23:45:32 +00:00
parent 1156500b52
commit b1313767d0
11 changed files with 401 additions and 6 deletions
+12 -2
View File
@@ -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/
+4 -4
View File
@@ -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
+4
View File
@@ -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 <coucouf@Grumly> Tue, 06 Sep 2016 08:14:12 +0200
+14
View File
@@ -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)
+11
View File
@@ -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 \

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

+67
View File
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
id="Layer_1"
x="0px"
y="0px"
width="1920px"
height="1200px"
viewBox="0 0 1920 1200"
enable-background="new 0 0 1920 1200"
xml:space="preserve"
inkscape:version="0.91 r13725"
sodipodi:docname="background.svg"><metadata
id="metadata183"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs181" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="866"
inkscape:window-height="480"
id="namedview179"
showgrid="false"
inkscape:zoom="0.19666667"
inkscape:cx="960"
inkscape:cy="600"
inkscape:window-x="173"
inkscape:window-y="124"
inkscape:window-maximized="0"
inkscape:current-layer="Layer_1" /><g
id="gradient"><radialGradient
id="SVGID_1_"
cx="2778.9287"
cy="1248.3542"
r="2425.5203"
fx="2526.0498"
fy="1262.03"
gradientTransform="matrix(1.1643 0 0 -1.1024 -973.8126 1394.5897)"
gradientUnits="userSpaceOnUse"><stop
offset="0"
style="stop-color:#073246"
id="stop5" /><stop
offset="0.4409"
style="stop-color:#489291"
id="stop7" /><stop
offset="0.9891"
style="stop-color:#063246"
id="stop9" /></radialGradient><rect
x="-196"
y="-146.776"
fill="url(#SVGID_1_)"
width="2731.465"
height="1496.775"
id="rect11" /></g></svg>

After

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 28 KiB

+275
View File
@@ -0,0 +1,275 @@
/*
* Copyright 2014 David Edmundson <davidedmundson@kde.org>
*
* 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()
}
}
}
}
}
}
+12
View File
@@ -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 dalternatives
Type=sddm-theme
Version=0.1
Screenshot=sddm-preview.jpg
MainScript=Main.qml
ConfigFile=theme.conf
Theme-Id=debian-theme
Theme-API=2.0
+2
View File
@@ -0,0 +1,2 @@
[General]
background=/usr/share/images/desktop-base/login-background.svg