diff --git a/files/sddm-i3-theme/LICENSE b/files/sddm-i3-theme/LICENSE new file mode 100644 index 0000000..fa9ccc5 --- /dev/null +++ b/files/sddm-i3-theme/LICENSE @@ -0,0 +1,16 @@ + maya +---------------------------------------------------------------------- + +This theme follow the licencing policy of SDDM. + +1) All QML files are available under terms of the MIT License. + +2) The material design icons from https://design.google.com/icons/ + have been used in the theme. + These icon are available under the Creative Common Attribution 4.0 + International License (CC-BY 4.0). + +3) Open Sans Condensed font downloaded from Font Squirrel is available + under the Apache License version 2.0. + (https://www.fontsquirrel.com/license/open-sans-condensed) +---------------------------------------------------------------------- diff --git a/files/sddm-i3-theme/Main.qml b/files/sddm-i3-theme/Main.qml new file mode 100644 index 0000000..1c18017 --- /dev/null +++ b/files/sddm-i3-theme/Main.qml @@ -0,0 +1,374 @@ +// +// [maya] main.qml +// +// Main script for the SDDM theme +// +// (c) 2016 Sanjeev Premi (spremi@ymail.com) +// +// SPDX-License-Identifier: MIT +// (https://spdx.org/licenses/MIT.html) +// + + +import QtQuick 2.15 +import QtQuick.Controls 2.0 +import SddmComponents 2.0 +import "components" + +Rectangle { + id : gRoot + + property color cTextNormal : "#ffffff" + property color cTextFailure : "#f43841" + property color cTextSuccess : "#00ff00" + property color cBackgroundRoot : "#000000" + property color cBackgroundNormal : "#333333" + property color cBackgroundActive : "#285577" + property color cBorderNormal : "#222222" + property color cBorderActive : "#4c7899" + + property string fontFamily : "monospace" + property int fontSize : 16 + + property string defaultUser : "" + + property int panelSize : 420 + property int offset : 96 + + color: cBackgroundRoot + + property int activeInput : initInputs() + property int currentSessionsIndex : sessionModel.lastIndex + property string currentSession: sessionModel.data(sessionModel.index(currentSessionsIndex, 0), Qt.UserRole + 4) + + function xCenter(sz) { + return gRoot.width / 2 - sz / 2; + } + + function yCenter(sz) { + return gRoot.height / 2 - sz / 2; + } + + function initInputs() { + if(defaultUser != "") { + gPasswordInput.forceActiveFocus(); + return 1; + } else { + gLoginInput.forceActiveFocus(); + return 0; + } + } + + function initInfoText() { + var text = ""; + if(sddm.canPowerOff) { + text += "f1 shutdown" + } + if(sddm.canReboot) { + if(text != "") { + text += " " + } + text += "f2 reboot" + } + return text; + } + + function sessionsCycleSelectPrev() { + if(timer.running) { + return; + } + if (currentSessionsIndex - 1 < 0) { + currentSessionsIndex = sessionModel.rowCount() - 1; + } else { + currentSessionsIndex--; + } + } + + function sessionsCycleSelectNext() { + if(timer.running) { + return; + } + if (currentSessionsIndex >= sessionModel.rowCount() - 1) { + currentSessionsIndex = 0; + } else { + currentSessionsIndex++; + } + } + + function focusNext() { + if(timer.running) { + return; + } + if(gRoot.activeInput == 0) { + gPasswordInput.forceActiveFocus(); + gRoot.activeInput = 1; + } else if(gRoot.activeInput == -1) { + gLoginInput.forceActiveFocus(); + gRoot.activeInput = 0; + } + } + + function focusPrev() { + if(timer.running) { + return; + } + if(gRoot.activeInput == 1) { + gLoginInput.forceActiveFocus(); + gRoot.activeInput = 0; + } else if(gRoot.activeInput == 0) { + gSessionBox.forceActiveFocus(); + gRoot.activeInput = -1; + } + } + + function setInputLock(lock) { + gLoginInput.readOnly = lock; + gPasswordInput.readOnly = lock; + gLoginInput.enabled = !lock; + gPasswordInput.enabled = !lock; + gSessionBox.enabled = !lock; + } + + Timer { + id: timer + interval: 750 + repeat: true + running: false + onTriggered: { + gInfoLabel.text += "."; + } + } + + function tryLogin() { + gInfoLabel.color = cTextNormal; + gInfoLabel.text = "."; + timer.start(); + + setInputLock(true); + + sddm.login(gLoginInput.text, gPasswordInput.text, currentSessionsIndex); + } + + Connections { + target: sddm + function onLoginSucceeded() { + timer.stop(); + gInfoLabel.color = cTextSuccess + gInfoLabel.text = "success" + } + + function onLoginFailed() { + timer.stop(); + gInfoLabel.color = cTextFailure + gInfoLabel.text = "auth failure" + setInputLock(false); + } + } + + Shortcut { + sequence: "Down" + onActivated: focusNext(); + } + + Shortcut { + sequence: "Up" + onActivated: focusPrev(); + } + + Shortcut { + sequence: "F1" + onActivated: { + sddm.powerOff(); + } + } + + Shortcut { + sequence: "F2" + onActivated: { + sddm.reboot(); + } + } + + Text { + x: xCenter(panelSize) + y: yCenter(panelSize) + width: panelSize + height: 2 * fontSize + + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + + font.pixelSize: fontSize + font.family: fontFamily + + color: cTextNormal + + text: sddm.hostName; + } + + Text { + x: 0 + y: gRoot.height - 2 * fontSize + width: gRoot.width + height: 2 * fontSize + + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + + font.pixelSize: fontSize + font.family: fontFamily + + color: cTextNormal + text: initInfoText(); + } + + Rectangle { + x: xCenter(panelSize) + y: yCenter(panelSize) + 3 * fontSize + + Text { + width: panelSize + height: 2 * fontSize + + horizontalAlignment: Qt.AlignHLeft + verticalAlignment: Qt.AlignVCenter + + font.pixelSize: fontSize + font.family: fontFamily + + color: cTextNormal + + text: "session:" + } + + SessionSelect { + id: gSessionBox + + x: offset + + width: panelSize - offset + height: fontSize * 2 + + text: currentSession + + onPrevClicked: sessionsCycleSelectPrev(); + onNextClicked: sessionsCycleSelectNext(); + + KeyNavigation.tab : gLoginInput + + Keys.onPressed: function (event) { + if(event.key == Qt.Key_Return || event.key == Qt.Key_Enter) { + focusNext(); + event.accepted = true; + } + } + } + } + + Rectangle { + x: xCenter(panelSize) + y: yCenter(panelSize) + 2 * 3 * fontSize + + Text { + width: panelSize + height: 2 * fontSize + + horizontalAlignment: Qt.AlignHLeft + verticalAlignment: Qt.AlignVCenter + + font.pixelSize: fontSize + font.family: fontFamily + + color: cTextNormal + + text: "login:" + } + + TextBoxCustom { + id: gLoginInput + + x: offset + width: panelSize - offset + height: 2 * fontSize + + font.pixelSize: fontSize + font.family: fontFamily + + cText: cTextNormal + // TODO set the remaining colors + + text: defaultUser + + KeyNavigation.tab : gPasswordInput + KeyNavigation.backtab : gSessionBox + + Keys.onPressed: function (event) { + if(event.key == Qt.Key_Return || event.key == Qt.Key_Enter) { + focusNext(); + event.accepted = true; + } + } + + } + } + Rectangle { + x: xCenter(panelSize) + y: yCenter(panelSize) + 3 * 3 * fontSize + + Text { + width: panelSize + height: 2 * fontSize + + horizontalAlignment: Qt.AlignHLeft + verticalAlignment: Qt.AlignVCenter + + font.pixelSize: fontSize + font.family: fontFamily + + color: cTextNormal + + text: "password:" + } + + TextBoxCustom { + id: gPasswordInput + + x: offset + width: panelSize - offset + height: 2 * fontSize + + font.pixelSize: fontSize + font.family: fontFamily + + cText: cTextNormal + // todo set the remaining colors here + + echoMode: TextInput.Password + + Keys.onPressed: function(event) { + if(event.key == Qt.Key_Return || event.key == Qt.Key_Enter) { + tryLogin(); + event.accepted = true; + } + } + } + } + + Text { + id: gInfoLabel + + text: "" + + x: xCenter(panelSize) + y: yCenter(panelSize) + 4 * 3 * fontSize + + width: panelSize + height: 2 * fontSize + + horizontalAlignment: Qt.AlignHCenter + verticalAlignment: Qt.AlignVCenter + + color: cTextNormal + } +} + diff --git a/files/sddm-i3-theme/README b/files/sddm-i3-theme/README new file mode 100644 index 0000000..1ee5821 --- /dev/null +++ b/files/sddm-i3-theme/README @@ -0,0 +1,31 @@ +1. INTRODUCTION + + In Hindi, 'maya' refers to 'material wealth'. + + This is a simple 'material' inspired SDDM theme. + + +2. BACKGROUND + + While contributing new translations, I tried testing them on + my working Linux machine. But only few strings appeared to be + translated. + + Took some time, to discover that SDDM theme on my desktop was + not using strings from SDDM. Few other themes I tried, weren't + using all the strings. + + Necessity to test translations was the driving force behind + this theme. The 'material' inspiration helps in keeping focus + on original intent. + + +3. ACKNOWLEDGEMENTS + + 1. The basic theme and colors are material inspired. + + 2. Material Icons have been used from: + https://design.google.com/icons/ + + 3. Open Sans Condensed font from Font Squirrel. + https://www.fontsquirrel.com/ diff --git a/files/sddm-i3-theme/components/SessionSelect.qml b/files/sddm-i3-theme/components/SessionSelect.qml new file mode 100644 index 0000000..4d5c86d --- /dev/null +++ b/files/sddm-i3-theme/components/SessionSelect.qml @@ -0,0 +1,121 @@ +import QtQuick 2.15 +import QtQuick.Controls 2.0 + +FocusScope { + id: root + + signal prevClicked() + signal nextClicked() + + property string fontFamily: "monospace" + property int fontSize: 16 + property string prevText: "<" + property string nextText: ">" + property string text: "" + property color textColor: "#ffffff" + + property color cNormalBorder : "#222222" + property color cNormalBackground : "#333333" + property color cFocusBorder : "#4c7899" + property color cFocusBackground : "#285577" + + Shortcut { + sequence: "Left" + onActivated: { + prevClicked() + } + } + + Shortcut { + sequence: "Right" + onActivated: { + nextClicked() + } + } + + Rectangle { + id: main + + anchors.fill: root + + color: cNormalBackground + border.color: cNormalBorder + border.width: 1 + + states: [ + State { + name: "focus" + when: root.activeFocus + PropertyChanges { + target: main + color: cFocusBackground + border.color: cFocusBorder + border.width: 1 + } + } + ] + + MouseArea { + anchors.fill: parent + onClicked: { + root.focus = true; + } + } + + Text { + id: sessionName + horizontalAlignment: Text.AlignHCenter + verticalAlignment: Text.AlignVCenter + font.pixelSize: root.fontSize + font.family: root.fontFamily + color: textColor + text: root.text + anchors { + horizontalCenter: parent.horizontalCenter + verticalCenter: parent.verticalCenter + } + } + + Text { + id: prevButton + text: root.prevText + color: textColor + font.pixelSize: root.fontSize + font.family: root.fontFamily + anchors { + left: parent.left + verticalCenter: parent.verticalCenter + rightMargin: 10 + leftMargin: 8 + } + MouseArea { + anchors.fill: parent + onClicked: { + root.prevClicked(); + root.focus = true; + } + } + } + + Text { + id: nextButton + text: root.nextText + color: textColor + font.pixelSize: root.fontSize + font.family: "monospace" + anchors { + right: parent.right + verticalCenter: parent.verticalCenter + leftMargin: 10 + rightMargin: 8 + } + MouseArea { + anchors.fill: parent + onClicked: { + root.nextClicked(); + root.focus = true; + } + } + } + } +} diff --git a/files/sddm-i3-theme/components/SpButton.qml b/files/sddm-i3-theme/components/SpButton.qml new file mode 100644 index 0000000..65c2577 --- /dev/null +++ b/files/sddm-i3-theme/components/SpButton.qml @@ -0,0 +1,206 @@ +// +// [maya] components/SpButton.qml +// +// Implements custom action button with label +// +// (c) 2016 Sanjeev Premi (spremi@ymail.com) +// +// SPDX-License-Identifier: MIT +// (https://spdx.org/licenses/MIT.html) +// + + +import QtQuick 2.0 + +Item { + id : sp_button + + property bool enabled : true + + property alias icon : sp_button_icon.source + property alias label : sp_button_label.text + property alias font : sp_button_label.font + + property color iconColor : "#aaaaaa" + property color labelColor : "#424242" + + property color hoverIconColor : "#cccccc" + property color hoverLabelColor : "#808080" + + property color pressIconColor : "#dcdcdc" + property color pressLabelColor : "#a0a0a0" + + property color disableColor : "#888888" + + signal pressed() + signal released() + signal clicked() + + Row { + x : 4 + y : 4 + + spacing : 8 + + Rectangle { + id : sp_button_bg + + width : 40 + height : 40 + + radius : 20 + + color : iconColor + + Image { + id : sp_button_icon + + width : 40 + height : 40 + + source : "./blank.svg" + + fillMode : Image.Pad + horizontalAlignment : Image.AlignHCenter + verticalAlignment : Image.AlignVCenter + } + } + + Text { + id : sp_button_label + + height : 40 + + text : "" + color : labelColor + + font.pixelSize : 24 + font.weight : Font.DemiBold + + fontSizeMode : Text.VerticalFit + horizontalAlignment : Text.AlignRight + verticalAlignment : Text.AlignVCenter + } + } + + + // + // States and associated visual attributes + // + states: [ + State { + name : "disabled" + when : (sp_button.enabled === false) + + PropertyChanges { + target : sp_button_bg + color : disableColor + } + + PropertyChanges { + target : sp_button_label + color : disableColor + } + + }, + State { + name : "hover" + + PropertyChanges { + target : sp_button_label + color : hoverLabelColor + } + + PropertyChanges { + target : sp_button_bg + color : hoverIconColor + } + }, + State { + name : "pressed" + + PropertyChanges { + target : sp_button_label + color : hoverLabelColor + } + + PropertyChanges { + target : sp_button_bg + color : pressIconColor + } + } + ] + + // + // Behavior on state transitions + // + transitions: [ + Transition { + from : "" + to : "hover" + + ColorAnimation { + duration: 250 + } + }, + Transition { + from : "" + to : "pressed" + + ColorAnimation { + duration: 25 + } + }, + Transition { + from : "disabled" + to : "enabled" + + ColorAnimation { + duration: 50 + } + }, + Transition { + from : "enabled" + to : "disabled" + + ColorAnimation { + duration: 50 + } + } + ] + + // + // Area to react to mouse actions + // + MouseArea { + anchors.fill : sp_button + + hoverEnabled : true + cursorShape : Qt.PointingHandCursor + acceptedButtons : Qt.LeftButton + + onEntered : { + sp_button.state = "hover" + } + + onExited : { + sp_button.state = "" + } + + onPressed : { + sp_button.state = "pressed" + } + + onClicked : { + sp_button.clicked() + } + + onReleased : { + if (containsMouse) { + sp_button.state = "hover" + } else { + sp_button.state = "" + } + } + } +} diff --git a/files/sddm-i3-theme/components/SpClock.qml b/files/sddm-i3-theme/components/SpClock.qml new file mode 100644 index 0000000..e660976 --- /dev/null +++ b/files/sddm-i3-theme/components/SpClock.qml @@ -0,0 +1,49 @@ +// +// [maya] components/SpClock.qml +// +// Implements custom clock component +// +// (c) 2016 Sanjeev Premi (spremi@ymail.com) +// +// SPDX-License-Identifier: MIT +// (https://spdx.org/licenses/MIT.html) +// + + +import QtQuick 2.0 + + +Item { + id : sp_clock + + property date value : new Date() + + property color tColor : "white" + property alias tFont : sp_clock_text.font + + implicitWidth : sp_clock_text.implicitWidth + implicitHeight : sp_clock_text.implicitHeight + + + Timer { + interval : 100 + running : true + repeat : true; + onTriggered : sp_clock.value = new Date() + } + + Text { + id : sp_clock_text + + text : Qt.formatDateTime(sp_clock.value, "dddd, dd MMMM yyyy HH:mm AP") + + color : sp_clock.tColor + + font.pixelSize : 24 + + fontSizeMode : Text.VerticalFit + + horizontalAlignment : Text.AlignHCenter + verticalAlignment : Text.AlignVCenter + } +} diff --git a/files/sddm-i3-theme/components/TextBoxCustom.qml b/files/sddm-i3-theme/components/TextBoxCustom.qml new file mode 100644 index 0000000..6d77ac2 --- /dev/null +++ b/files/sddm-i3-theme/components/TextBoxCustom.qml @@ -0,0 +1,87 @@ +/*************************************************************************** +* Copyright (c) 2013 Abdurrahman AVCI +* +* Permission is hereby granted, free of charge, to any person +* obtaining a copy of this software and associated documentation +* files (the "Software"), to deal in the Software without restriction, +* including without limitation the rights to use, copy, modify, merge, +* publish, distribute, sublicense, and/or sell copies of the Software, +* and to permit persons to whom the Software is furnished to do so, +* subject to the following conditions: +* +* The above copyright notice and this permission notice shall be included +* in all copies or substantial portions of the Software. +* +* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR +* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE +* OR OTHER DEALINGS IN THE SOFTWARE. +* +***************************************************************************/ + +import QtQuick 2.0 + +FocusScope { + id: container + width: 80; height: 30 + + property color cNormalBorder : "#222222" + property color cNormalBackground : "#333333" + property color cFocusBorder : "#4c7899" + property color cFocusBackground : "#285577" + + property alias font: txtMain.font + property alias cText: txtMain.color + property alias echoMode: txtMain.echoMode + property alias text: txtMain.text + property alias readOnly: txtMain.readOnly + + Rectangle { + id: main + + anchors.fill: parent + + color: container.cNormalBackground + border.color: container.cNormalBorder + border.width: 1 + + states: [ + State { + name: "focus" + when: container.activeFocus + PropertyChanges { + target: main + color: container.cFocusBackground + border.color: container.cFocusBorder + border.width: 1; + } + } + ] + } + + MouseArea { + id: mouseArea + anchors.fill: container + + cursorShape: Qt.IBeamCursor + + onClicked: container.focus = true; + } + + TextInput { + id: txtMain + width: parent.width - 16 + anchors.centerIn: parent + + color: "black" + + clip: true + focus: true + + passwordCharacter: "*" + } +} + diff --git a/files/sddm-i3-theme/fonts/OpenSans_CondLight.ttf b/files/sddm-i3-theme/fonts/OpenSans_CondLight.ttf new file mode 100644 index 0000000..97c355b Binary files /dev/null and b/files/sddm-i3-theme/fonts/OpenSans_CondLight.ttf differ diff --git a/files/sddm-i3-theme/images/ic_arrow_drop_down_white_24px.svg b/files/sddm-i3-theme/images/ic_arrow_drop_down_white_24px.svg new file mode 100644 index 0000000..f377a43 --- /dev/null +++ b/files/sddm-i3-theme/images/ic_arrow_drop_down_white_24px.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/files/sddm-i3-theme/images/ic_power_settings_new_white_24px.svg b/files/sddm-i3-theme/images/ic_power_settings_new_white_24px.svg new file mode 100644 index 0000000..5a2e5fd --- /dev/null +++ b/files/sddm-i3-theme/images/ic_power_settings_new_white_24px.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/files/sddm-i3-theme/images/ic_refresh_white_24px.svg b/files/sddm-i3-theme/images/ic_refresh_white_24px.svg new file mode 100644 index 0000000..7a8d303 --- /dev/null +++ b/files/sddm-i3-theme/images/ic_refresh_white_24px.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/files/sddm-i3-theme/images/ic_warning_white_24px.svg b/files/sddm-i3-theme/images/ic_warning_white_24px.svg new file mode 100644 index 0000000..d27ad14 --- /dev/null +++ b/files/sddm-i3-theme/images/ic_warning_white_24px.svg @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/files/sddm-i3-theme/metadata.desktop b/files/sddm-i3-theme/metadata.desktop new file mode 100644 index 0000000..1814ba2 --- /dev/null +++ b/files/sddm-i3-theme/metadata.desktop @@ -0,0 +1,13 @@ +[SddmGreeterTheme] +Name=sddm-i3 +Description=Simple i3 inspired theme +Author=krizej +Copyright=(c) 2024, krizej +License=MIT +Type=sddm-theme +Version=1 +Website=https://github.com/krizej +MainScript=Main.qml +ConfigFile=theme.conf +Theme-Id=sddm-i3 +Theme-API=2.0 diff --git a/files/sddm-i3-theme/screenshots/hi_IN.png b/files/sddm-i3-theme/screenshots/hi_IN.png new file mode 100644 index 0000000..7fe1362 Binary files /dev/null and b/files/sddm-i3-theme/screenshots/hi_IN.png differ diff --git a/files/sddm-i3-theme/theme.conf b/files/sddm-i3-theme/theme.conf new file mode 100644 index 0000000..e228fe2 --- /dev/null +++ b/files/sddm-i3-theme/theme.conf @@ -0,0 +1,24 @@ +[General] +primaryShade= +primaryLight= +primaryDark= + +primaryHue1= +primaryHue2= +primaryHue3= + +accentShade= +accentLight= + +accentHue1= +accentHue2= +accentHue3= + +normalText= + +successText= +failureText= +warningText= + +rebootColor= +powerColor= diff --git a/files/sddm-i3-theme/theme.nix b/files/sddm-i3-theme/theme.nix new file mode 100644 index 0000000..1c382c9 --- /dev/null +++ b/files/sddm-i3-theme/theme.nix @@ -0,0 +1,20 @@ +{ lib, stdenv, fetchzip }: +stdenv.mkDerivation rec { + pname = "sddm-i3-theme"; + version = "1"; + + src = fetchzip { + url = "http://192.168.1.12/${pname}.tar.gz"; + hash = "sha256-587c+T7SflqYshPxRRcVD4xmY2pc4UBw+bYJQm04ZjU="; + }; + + installPhase = '' + mkdir -p $out/share/sddm/themes/${pname}/ + cp -r $src/* $out/share/sddm/themes/${pname}/ + ''; + + meta = { + license = lib.licenses.mit; + platforms = lib.platforms.linux; + }; +} diff --git a/pkgs/sddm-i3-theme.nix b/pkgs/sddm-i3-theme.nix index 8564ea6..d9905c8 100644 --- a/pkgs/sddm-i3-theme.nix +++ b/pkgs/sddm-i3-theme.nix @@ -7,11 +7,7 @@ stdenv.mkDerivation rec { pname = "sddm-i3-theme"; version = "1"; - src = fetchzip { - # lol - url = "http://192.168.1.12/${pname}.tar.gz"; - hash = "sha256-WGvjW3Z8TfJhAsbxUyYRKSYFucEwYzTIbpDZsLTPbyo="; - }; + src = ../files/sddm-i3-theme; installPhase = '' mkdir -p $out/share/sddm/themes/${pname}/