diff --git a/debian/compat b/debian/compat new file mode 100644 index 0000000..3cacc0b --- /dev/null +++ b/debian/compat @@ -0,0 +1 @@ +12 \ No newline at end of file diff --git a/debian/control b/debian/control index dce1990..514f02d 100644 --- a/debian/control +++ b/debian/control @@ -1,7 +1,8 @@ Source: lingmo-core Section: devel Priority: optional -Maintainer: LingmoOS +Maintainer: Lingmo OS Team + Build-Depends: cmake, debhelper-compat (= 13), extra-cmake-modules, @@ -64,4 +65,4 @@ Depends: accountsservice, appmenu-gtk3-module, ${misc:Depends}, ${shlibs:Depends} -Description: LingmoOS System Components +Description: Lingmo OS System Components diff --git a/polkit-agent/Button.qml b/polkit-agent/Button.qml new file mode 100644 index 0000000..e67f018 --- /dev/null +++ b/polkit-agent/Button.qml @@ -0,0 +1,128 @@ +import QtQuick 2.12 +import QtQuick.Templates 2.12 as T +import QtGraphicalEffects 1.0 +import LingmoUI 1.0 as LingmoUI +import QtQuick.Controls.impl 2.12 + +T.Button { + id: control + implicitWidth: Math.max(background.implicitWidth, contentItem.implicitWidth + LingmoUI.Units.largeSpacing) + implicitHeight: background.implicitHeight + hoverEnabled: true + + icon.width: LingmoUI.Units.iconSizes.small + icon.height: LingmoUI.Units.iconSizes.small + + icon.color: control.enabled ? (control.highlighted ? control.LingmoUI.Theme.highlightColor : control.LingmoUI.Theme.textColor) : control.LingmoUI.Theme.disabledTextColor + spacing: LingmoUI.Units.smallSpacing + + // property color hoveredColor: LingmoUI.Theme.darkMode ? Qt.lighter(LingmoUI.Theme.alternateBackgroundColor, 1.2) + // : Qt.darker(LingmoUI.Theme.alternateBackgroundColor, 1.1) + + // property color pressedColor: LingmoUI.Theme.darkMode ? Qt.lighter(LingmoUI.Theme.alternateBackgroundColor, 1.1) + // : Qt.darker(LingmoUI.Theme.alternateBackgroundColor, 1.2) + + property color hoveredColor: Qt.tint(LingmoUI.Theme.textColor, Qt.rgba(LingmoUI.Theme.backgroundColor.r, + LingmoUI.Theme.backgroundColor.g, + LingmoUI.Theme.backgroundColor.b, 0.9)) + property color pressedColor: Qt.tint(LingmoUI.Theme.textColor, Qt.rgba(LingmoUI.Theme.backgroundColor.r, + LingmoUI.Theme.backgroundColor.g, + LingmoUI.Theme.backgroundColor.b, 0.8)) + + + // property color borderColor: Qt.rgba(LingmoUI.Theme.highlightColor.r, + // LingmoUI.Theme.highlightColor.g, + // LingmoUI.Theme.highlightColor.b, 0.5) + + // property color flatHoveredColor: Qt.rgba(LingmoUI.Theme.highlightColor.r, + // LingmoUI.Theme.highlightColor.g, + // LingmoUI.Theme.highlightColor.b, 0.2) + // property color flatPressedColor: Qt.rgba(LingmoUI.Theme.highlightColor.r, + // LingmoUI.Theme.highlightColor.g, + // LingmoUI.Theme.highlightColor.b, 0.25) + + property color flatHoveredColor: Qt.lighter(LingmoUI.Theme.highlightColor, 1.1) + property color flatPressedColor: Qt.darker(LingmoUI.Theme.highlightColor, 1.1) + + contentItem: IconLabel { + text: control.text + font: control.font + icon: control.icon + color: !control.enabled ? control.LingmoUI.Theme.disabledTextColor : control.flat ? LingmoUI.Theme.highlightedTextColor : LingmoUI.Theme.textColor + spacing: control.spacing + mirrored: control.mirrored + display: control.display + alignment: Qt.AlignCenter + } + + background: Item { + implicitWidth: (LingmoUI.Units.iconSizes.medium * 3) + LingmoUI.Units.largeSpacing + implicitHeight: LingmoUI.Units.iconSizes.medium + LingmoUI.Units.smallSpacing + + Rectangle { + id: _flatBackground + anchors.fill: parent + radius: LingmoUI.Theme.mediumRadius + border.width: 1 + border.color: control.enabled ? control.activeFocus ? LingmoUI.Theme.highlightColor : "transparent" + : "transparent" + visible: control.flat + + + color: { + if (!control.enabled) + return LingmoUI.Theme.alternateBackgroundColor + + if (control.pressed) + return control.flatPressedColor + + if (control.hovered) + return control.flatHoveredColor + + return Qt.rgba(LingmoUI.Theme.highlightColor.r, + LingmoUI.Theme.highlightColor.g, + LingmoUI.Theme.highlightColor.b, 0.1) + } + + gradient: Gradient { + orientation: Gradient.Vertical + GradientStop { position: 0.0; color: Qt.rgba(_flatBackground.color.r, + _flatBackground.color.g, + _flatBackground.color.b, 0.85) } + GradientStop { position: 1.0; color: Qt.rgba(_flatBackground.color.r, + _flatBackground.color.g, + _flatBackground.color.b, 1) } + } + + // Behavior on color { + // ColorAnimation { + // duration: 200 + // easing.type: Easing.Linear + // } + // } + } + + Rectangle { + id: _background + anchors.fill: parent + radius: LingmoUI.Theme.hugeRadius + border.width: 1 + visible: !control.flat + border.color: control.enabled ? control.activeFocus ? LingmoUI.Theme.highlightColor : "transparent" + : "transparent" + + color: { + if (!control.enabled) + return LingmoUI.Theme.alternateBackgroundColor + + if (control.pressed) + return control.pressedColor + + if (control.hovered) + return control.hoveredColor + + return LingmoUI.Theme.alternateBackgroundColor + } + } + } +} \ No newline at end of file diff --git a/polkit-agent/TextField.qml b/polkit-agent/TextField.qml new file mode 100644 index 0000000..51c4432 --- /dev/null +++ b/polkit-agent/TextField.qml @@ -0,0 +1,91 @@ +import QtQuick 2.6 +import QtQuick.Window 2.1 +import QtQuick.Controls 2.3 as Controls +import QtQuick.Templates 2.3 as T +import LingmoUI 1.0 as LingmoUI + +T.TextField { + id: control + + implicitWidth: Math.max(200, + placeholderText ? placeholder.implicitWidth + leftPadding + rightPadding : 0) + || contentWidth + leftPadding + rightPadding + LingmoUI.Units.extendBorderWidth + implicitHeight: Math.max(contentHeight + topPadding + bottomPadding, + background ? background.implicitHeight : 0, + placeholder.implicitHeight + topPadding + bottomPadding + LingmoUI.Units.extendBorderWidth) + + // padding: 6 + leftPadding: LingmoUI.Units.smallSpacing + LingmoUI.Units.extendBorderWidth + rightPadding: LingmoUI.Units.smallSpacing + LingmoUI.Units.extendBorderWidth + + //Text.NativeRendering is broken on non integer pixel ratios + // renderType: Window.devicePixelRatio % 1 !== 0 ? Text.QtRendering : Text.NativeRendering + renderType: LingmoUI.Theme.renderType + + color: control.enabled ? LingmoUI.Theme.textColor : LingmoUI.Theme.disabledTextColor + selectionColor: LingmoUI.Theme.highlightColor + selectedTextColor: LingmoUI.Theme.highlightedTextColor + selectByMouse: true + + horizontalAlignment: Text.AlignLeft + verticalAlignment: TextInput.AlignVCenter + + opacity: control.enabled ? 1.0 : 0.5 + + // cursorDelegate: CursorDelegate { } + + Controls.Label { + id: placeholder + x: control.leftPadding + y: control.topPadding + width: control.width - (control.leftPadding + control.rightPadding) + height: control.height - (control.topPadding + control.bottomPadding) + + text: control.placeholderText + font: control.font + color: LingmoUI.Theme.textColor + opacity: 0.4 + horizontalAlignment: Text.AlignLeft + verticalAlignment: control.verticalAlignment + visible: !control.length && !control.preeditText && (!control.activeFocus || control.horizontalAlignment !== Qt.AlignHCenter) + elide: Text.ElideRight + wrapMode: Text.NoWrap + } + + background: Rectangle { + implicitWidth: (LingmoUI.Units.iconSizes.medium * 3) + LingmoUI.Units.smallSpacing + LingmoUI.Units.extendBorderWidth + implicitHeight: LingmoUI.Units.iconSizes.medium + LingmoUI.Units.smallSpacing + LingmoUI.Units.extendBorderWidth + // color: control.activeFocus ? Qt.lighter(LingmoUI.Theme.backgroundColor, 1.4) : LingmoUI.Theme.backgroundColor + color: LingmoUI.Theme.alternateBackgroundColor + radius: LingmoUI.Theme.smallRadius + + border.width: 1 + border.color: control.activeFocus ? LingmoUI.Theme.highlightColor : LingmoUI.Theme.alternateBackgroundColor + + // Rectangle { + // id: _border + // anchors.fill: parent + // color: "transparent" + // border.color: control.activeFocus ? Qt.rgba(LingmoUI.Theme.highlightColor.r, + // LingmoUI.Theme.highlightColor.g, + // LingmoUI.Theme.highlightColor.b, 0.2) : "transparent" + // border.width: LingmoUI.Units.extendBorderWidth + // radius: LingmoUI.Theme.smallRadius + LingmoUI.Units.extendBorderWidth + + // Behavior on border.color { + // ColorAnimation { + // duration: 50 + // } + // } + // } + + // Rectangle { + // anchors.fill: parent + // anchors.margins: LingmoUI.Units.extendBorderWidth + // radius: LingmoUI.Theme.smallRadius + // color: LingmoUI.Theme.backgroundColor + // border.color: control.activeFocus ? LingmoUI.Theme.highlightColor : Qt.tint(LingmoUI.Theme.textColor, Qt.rgba(LingmoUI.Theme.backgroundColor.r, LingmoUI.Theme.backgroundColor.g, LingmoUI.Theme.backgroundColor.b, 0.7)) + // border.width: 1 + // } + } +} \ No newline at end of file diff --git a/polkit-agent/dialog.cpp b/polkit-agent/dialog.cpp index e58fa8f..aafd4b3 100644 --- a/polkit-agent/dialog.cpp +++ b/polkit-agent/dialog.cpp @@ -79,4 +79,4 @@ void Dialog::show() void Dialog::authenticationFailure() { emit failure(); -} +} \ No newline at end of file diff --git a/polkit-agent/main.qml b/polkit-agent/main.qml index 3983b9a..b9669e3 100644 --- a/polkit-agent/main.qml +++ b/polkit-agent/main.qml @@ -1,6 +1,7 @@ import QtQuick 2.12 import QtQuick.Controls 2.5 import QtQuick.Layouts 1.3 +import "./" import LingmoUI.Compatible 3.0 as LingmoUI Item { diff --git a/polkit-agent/qml.qrc b/polkit-agent/qml.qrc index 04adae1..199949d 100644 --- a/polkit-agent/qml.qrc +++ b/polkit-agent/qml.qrc @@ -1,6 +1,8 @@ main.qml + Button.qml + TextField.qml svg/emblem-warning.svg diff --git a/session/CMakeLists.txt b/session/CMakeLists.txt index 8c6d1d9..e2cbff4 100644 --- a/session/CMakeLists.txt +++ b/session/CMakeLists.txt @@ -41,4 +41,4 @@ target_link_libraries(${TARGET} ) install(TARGETS ${TARGET} DESTINATION ${CMAKE_INSTALL_BINDIR}) -install(FILES lingmo-xsession.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xsessions/) +# install(FILES lingmo-xsession.desktop DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xsessions/) diff --git a/session/processmanager.cpp b/session/processmanager.cpp index 00dabeb..028425d 100644 --- a/session/processmanager.cpp +++ b/session/processmanager.cpp @@ -1,5 +1,5 @@ /* - * Copyright (C) 2023-2024 Lingmo OS Team. + * Copyright (C) 2023-2025 Lingmo OS Team. */ #include "processmanager.h" @@ -17,6 +17,8 @@ #include #include +#include +#include #include #include @@ -50,6 +52,7 @@ void ProcessManager::start() { startWindowManager(); startDaemonProcess(); + checkAndDeactivateScreenSaver(); } void ProcessManager::logout() @@ -97,15 +100,23 @@ void ProcessManager::startDesktopProcess() QList> list; // Desktop components + list << qMakePair(QString("kwin_x11"), QStringList("--replace")); list << qMakePair(QString("lingmo-notificationd"), QStringList()); + list << qMakePair(QString("lingmo-desktop"), QStringList()); + list << qMakePair(QString("lingmo-filemanager"), QStringList("--runtime")); list << qMakePair(QString("lingmo-statusbar"), QStringList()); list << qMakePair(QString("lingmo-dock"), QStringList()); - list << qMakePair(QString("lingmo-filemanager"), QStringList("--desktop")); list << qMakePair(QString("lingmo-launcher"), QStringList()); list << qMakePair(QString("lingmo-powerman"), QStringList()); list << qMakePair(QString("lingmo-clipboard"), QStringList()); list << qMakePair(QString("lingmo-wallpaper-color-pick"), QStringList()); + if (QFile(QDir::homePath() + "/.islin_install_lock").exists() && + !QFile("/run/live/medium/live/filesystem.squashfs").exists()) { + list << qMakePair(QString("/usr/bin/lingmo-welcome"), QStringList()); + // list << qMakePair(QString("config-installer"), QStringList()); + } + m_desktopAutoStartD = std::make_shared(list); // Auto start @@ -119,7 +130,7 @@ void ProcessManager::startDaemonProcess() list << qMakePair(QString("lingmo-xembedsniproxy"), QStringList()); list << qMakePair(QString("lingmo-gmenuproxy"), QStringList()); list << qMakePair(QString("lingmo-permission-surveillance"),QStringList()); -// list << qMakePair(QString("lingmo-clipboard"), QStringList()); + list << qMakePair(QString("lingmo-clipboard"), QStringList()); list << qMakePair(QString("lingmo-chotkeys"), QStringList()); m_daemonAutoStartD = std::make_shared(list); @@ -196,3 +207,22 @@ bool ProcessManager::nativeEventFilter(const QByteArray &eventType, void *messag return false; } + +void ProcessManager::checkAndDeactivateScreenSaver() +{ + QDBusInterface interface("org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", QDBusConnection::sessionBus()); + if (interface.isValid()) { + QDBusPendingCall call = interface.asyncCall("GetActive"); + QDBusPendingCallWatcher *watcher = new QDBusPendingCallWatcher(call, this); + connect(watcher, &QDBusPendingCallWatcher::finished, this, [this, watcher]() { + QDBusPendingReply reply = *watcher; + if (reply.isValid() && reply.value()) { + QDBusInterface setActiveInterface("org.freedesktop.ScreenSaver", "/ScreenSaver", "org.freedesktop.ScreenSaver", QDBusConnection::sessionBus()); + setActiveInterface.call("SetActive", false); + } + watcher->deleteLater(); + }); + } else { + qWarning() << "Cannot find org.freedesktop.ScreenSaver interface."; + } +} diff --git a/session/processmanager.h b/session/processmanager.h index dedece6..add0273 100644 --- a/session/processmanager.h +++ b/session/processmanager.h @@ -45,6 +45,7 @@ class ProcessManager : public QObject, public QAbstractNativeEventFilter void startWindowManager(); void startDesktopProcess(); void startDaemonProcess(); + void checkAndDeactivateScreenSaver(); /** * @brief Start the user defined autostart process.