diff options
28 files changed, 672 insertions, 47 deletions
diff --git a/src-qt5/core/libLumina/LuminaX11.cpp b/src-qt5/core/libLumina/LuminaX11.cpp index 1df5a9f0..3262e16d 100644 --- a/src-qt5/core/libLumina/LuminaX11.cpp +++ b/src-qt5/core/libLumina/LuminaX11.cpp @@ -462,12 +462,12 @@ int LXCB::WindowIsFullscreen(WId win){ int i = 0; for(it = screens.constBegin(); it != screens.constEnd(); ++it, ++i) { QRect sgeom = (*it)->availableGeometry(); - qDebug() << " -- Check Window Geom:" << sgeom << geom << this->WindowClass(win); + //qDebug() << " -- Check Window Geom:" << sgeom << geom << this->WindowClass(win); if( sgeom.contains(geom.center()) ){ //Allow a 1 pixel variation in "full-screen" detection - qDebug() << " -- Found Screen:" << i; + //qDebug() << " -- Found Screen:" << i; if( geom.width() >= (sgeom.width()-1) && geom.height()>=(sgeom.height()-1) ){ - qDebug() << " -- Is Fullscreen!"; + //qDebug() << " -- Is Fullscreen!"; //fullS = true; fscreen = i; } diff --git a/src-qt5/core/lumina-desktop/LDesktop.cpp b/src-qt5/core/lumina-desktop/LDesktop.cpp index 6ca48a28..9d77af61 100644 --- a/src-qt5/core/lumina-desktop/LDesktop.cpp +++ b/src-qt5/core/lumina-desktop/LDesktop.cpp @@ -109,7 +109,8 @@ void LDesktop::UpdateGeometry(){ } void LDesktop::SystemLock(){ - QProcess::startDetached("xscreensaver-command -lock"); + QTimer::singleShot(30,LSession::handle(), SLOT(LockScreen()) ); + //QProcess::startDetached("xscreensaver-command -lock"); } void LDesktop::SystemLogout(){ diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index f1d5973d..996b3acf 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -21,10 +21,7 @@ #include <LIconCache.h> #include <unistd.h> //for usleep() usage - -#ifndef DEBUG #define DEBUG 0 -#endif XCBEventFilter *evFilter = 0; LIconCache *ICONS = 0; diff --git a/src-qt5/core/lumina-desktop/SystemWindow.cpp b/src-qt5/core/lumina-desktop/SystemWindow.cpp index bfad961d..6a4172d3 100644 --- a/src-qt5/core/lumina-desktop/SystemWindow.cpp +++ b/src-qt5/core/lumina-desktop/SystemWindow.cpp @@ -105,7 +105,8 @@ void SystemWindow::sysSuspend(){ this->hide(); LSession::processEvents(); //Make sure to lock the system first (otherwise anybody can access it again) - LUtils::runCmd("xscreensaver-command -lock"); + LSession::handle()->LockScreen(); + //LUtils::runCmd("xscreensaver-command -lock"); //Now suspend the system LOS::systemSuspend(); } @@ -114,5 +115,6 @@ void SystemWindow::sysLock(){ this->hide(); LSession::processEvents(); qDebug() << "Locking the desktop..."; - QProcess::startDetached("xscreensaver-command -lock"); + QTimer::singleShot(30,LSession::handle(), SLOT(LockScreen()) ); + //QProcess::startDetached("xscreensaver-command -lock"); } diff --git a/src-qt5/core/lumina-desktop/extrafiles/Lumina-DE.png b/src-qt5/core/lumina-desktop/extrafiles/Lumina-DE.png Binary files differnew file mode 100644 index 00000000..ce88a252 --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/Lumina-DE.png diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/Fireflies.json b/src-qt5/core/lumina-desktop/extrafiles/screensavers/Fireflies.json new file mode 100644 index 00000000..c09de308 --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/Fireflies.json @@ -0,0 +1,26 @@ +{ + "name" : { + "default" : "Fireflies" + }, + "description" : { + "default" : "Dancing balls of light on the screen" + }, + "author" : { + "name" : "Ken Moore", + "email" : "ken@ixsystems.com", + "website" : "https://github.com/beanpole135", + "company" : "iXsystems", + "company_website" : "http://ixsystems.com" + }, + "meta" : { + "license" : "3-clause BSD", + "license_url" : "https://github.com/trueos/lumina/blob/master/LICENSE", + "copyright" : "Copyright (c) 2017, Ken Moore (ken@ixsystems.com)", + "date_created" : "20171010", + "version" : "1.0" + }, + "qml" : { + "exec" : "qml_scripts/Fireflies.qml", + "additional_files" : ["qml_scripts/Firefly.qml"] + } +} diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/Grav.json b/src-qt5/core/lumina-desktop/extrafiles/screensavers/Grav.json new file mode 100644 index 00000000..c75ae170 --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/Grav.json @@ -0,0 +1,26 @@ +{ + "disabled" : true, + "name" : { + "default" : "Grav" + }, + "description" : { + "default" : "Simulates a solar system, with a single star and planets erratically orbiting that star" + }, + "author" : { + "name" : "Zackary Welch", + "email" : "zwelch@ixsystems.com", + "website" : "https://github.com/ZackaryWelch", + "company" : "iXsystems", + "company_website" : "http://ixsystems.com" + }, + "meta" : { + "license" : "3-clause BSD", + "license_url" : "https://github.com/trueos/lumina/blob/master/LICENSE", + "copyright" : "Copyright (c) 2017, Ken Moore (ken@ixsystems.com)", + "date_created" : "20171101", + "version" : "1.0" + }, + "qml" : { + "exec" : "qml_scripts/Grav.qml" + } +} diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/Matrix.json b/src-qt5/core/lumina-desktop/extrafiles/screensavers/Matrix.json new file mode 100644 index 00000000..8c9a351f --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/Matrix.json @@ -0,0 +1,26 @@ +{ + "disabled" : true, + "name" : { + "default" : "Matrix" + }, + "description" : { + "default" : "Erratic falling columns of various characters with a set color" + }, + "author" : { + "name" : "Zackary Welch", + "email" : "zwelch@ixsystems.com", + "website" : "https://github.com/ZackaryWelch", + "company" : "iXsystems", + "company_website" : "http://ixsystems.com" + }, + "meta" : { + "license" : "3-clause BSD", + "license_url" : "https://github.com/trueos/lumina/blob/master/LICENSE", + "copyright" : "Copyright (c) 2017, Ken Moore (ken@ixsystems.com)", + "date_created" : "20180103", + "version" : "1.0" + }, + "qml" : { + "exec" : "qml_scripts/Matrix.qml" + } +} diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/README.md b/src-qt5/core/lumina-desktop/extrafiles/screensavers/README.md new file mode 100644 index 00000000..d9093b44 --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/README.md @@ -0,0 +1,79 @@ +## Screensaver Format +The screensaver system for the Lumina desktop allows for the creation and use of scripts written in the QML language, with a number of screensavers and other examples installed out-of-box. There are only a couple warnings/caveats to consider when developing a new screensaver: + +1. The root object in your QML script will be automatically sized to fit the screen as needed. Avoid trying to hard-code specific screen dimensions within your script as it will not work properly. +2. A JSON manifest file must be created (format listed below) and placed into one of the screensaver plugin directories for it to be recognized as a valid screensaver by the desktop. + + +### JSON Manifest +The manifest file contains all the information needed to actually validate/launch the screensaver, as well as additional information about the author and/or the screensaver itself. + +Example JSON manifest file (sample.json): +``` +{ + "name" : { + "default" : "sample", + "en_US" : "US English localization of the name", + "en" : "Generic english localization of the name" + }, + + "description" : { + "default" : "sample screensaver", + "en_US" : "US English Localization of the description" + }, + + "author" : { + "name" : "Me", + "email" : "Me@myself.net", + "website" : "http://mywebsite.net", + "company" : "iXsystems", + "company_website" : "http://ixsystems.com" + }, + + "meta" : { + "license" : "3-clause BSD", + "license_url" : "https://github.com/trueos/lumina/blob/master/LICENSE", + "copyright" : "Copyright (c) 2017, Ken Moore (ken@ixsystems.com)", + "date_created" : "20171010", + "date_updated" : "20171011", + "version" : "1.0" + }, + + "qml" : { + "exec" : "absolute/or/relative/path/to/script.qml", + "additional_files" : ["file/which/must/exist.png"], + "qt_min_version" : "5.0", + "qt_max_version" : "6.0" + } +} +``` + +Details of the individual items in the manifest: +* NOTE: for locale codes, both long and short version are acceptable: + Example 1: If the current locale is "en_GB", but the JSON manifest lists translations for "en_US" and "en", then the "en" translation will be used. + Example 2: If the current locale is "en_GB", but neither "en_GB" nor "en" translations exist, then the "default" version will be used. + +* **name** : (required) This is the official name of the screensaver to show to users + * *default* : (required) Non-translated name of the screensaver + * *[locale]* : (optional) Translated name for specific [locale] +* **description** : (required) This is a short description of the screensaver to show to users + * *default* : (required) Non-translated description of the screensaver + * *[locale]* : (optional) Translated description for specific [locale] +* **author** : (all optional) Additional information about the author(s) of the screensaver + * *name* : Name of the author + * *email* : Email to contact the author (useful for licensing questions and such) + * *website* : Personal website for the author (github/facebook/twitter profile, etc) + * *company* : Company for which the author is creating this screensaver + * *company_website* : Website for the company +* **meta** : (all optional) Additional information about the screensaver itself + * *license* : License the screensaver is released under + * *license_url* : Website which contains the full text of the license + * *copyright* : Copyright notice for this screensaver + * *date_created* : (yyyyMMdd) Date the screensaver was initially created + * *date_updated* : (yyyyMMdd) Date the screensaver was last updated + * *version* : Current version of the screensaver (typically updated every time "date_updated" is changed) +* **qml** : (required) Information about launching the screensaver and checking validity + * *exec* : (required) Absolute or relative path to the QML script (relative to the directory which contains the JSON manifest) + * *additional_files* : (optional) Array of paths for other files/scripts which must exist for the screensaver to work properly. + * *qt_min_version* : (optional) Minimum version of the Qt libraries that this screensaver supports + * *qt_max_version* : (optional) Maximum version of the Qt libraries that this screensaver supports diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/Video.json b/src-qt5/core/lumina-desktop/extrafiles/screensavers/Video.json new file mode 100644 index 00000000..8bd86157 --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/Video.json @@ -0,0 +1,26 @@ +{ + "disabled" : true, + "name" : { + "default" : "Video" + }, + "description" : { + "default" : "Play a single video or a list of videos in a loop" + }, + "author" : { + "name" : "Zackary Welch", + "email" : "zwelch@ixsystems.com", + "website" : "https://github.com/ZackaryWelch", + "company" : "iXsystems", + "company_website" : "http://ixsystems.com" + }, + "meta" : { + "license" : "3-clause BSD", + "license_url" : "https://github.com/trueos/lumina/blob/master/LICENSE", + "copyright" : "Copyright (c) 2017, Ken Moore (ken@ixsystems.com)", + "date_created" : "20171025", + "version" : "1.0" + }, + "qml" : { + "exec" : "qml_scripts/Video.qml" + } +} diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/Warp.json b/src-qt5/core/lumina-desktop/extrafiles/screensavers/Warp.json new file mode 100644 index 00000000..888df01f --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/Warp.json @@ -0,0 +1,25 @@ +{ + "name" : { + "default" : "Warp" + }, + "description" : { + "default" : "Warp trail through the stars" + }, + "author" : { + "name" : "Ken Moore", + "email" : "ken@ixsystems.com", + "website" : "https://github.com/beanpole135", + "company" : "iXsystems", + "company_website" : "http://ixsystems.com" + }, + "meta" : { + "license" : "3-clause BSD", + "license_url" : "https://github.com/trueos/lumina/blob/master/LICENSE", + "copyright" : "Copyright (c) 2017, Ken Moore (ken@ixsystems.com)", + "date_created" : "20171012", + "version" : "1.0" + }, + "qml" : { + "exec" : "qml_scripts/Warp.qml" + } +} diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Fireflies.qml b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Fireflies.qml new file mode 100644 index 00000000..d8dcc1ed --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Fireflies.qml @@ -0,0 +1,19 @@ +import QtQuick 2.0 +import QtGraphicalEffects 1.0 +import "." as QML + +Rectangle { + id : canvas + anchors.fill: parent + color: "black" + + Repeater { + model: Math.round(Math.random()*canvas.width/10)+100 + QML.Firefly { + parent: canvas + x: Math.round(Math.random()*canvas.width) + y: Math.round(Math.random()*canvas.height) + } + } //end of Repeater + +} //end of canvas rectangle diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Firefly.qml b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Firefly.qml new file mode 100644 index 00000000..7b65d8ec --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Firefly.qml @@ -0,0 +1,63 @@ +import QtQuick 2.0 +import QtQuick.Window 2.2 +import QtGraphicalEffects 1.0 + +Item { + + RectangularGlow { + anchors.fill: fly + glowRadius: Math.round(fly.radius /2) + spread: 0.5 + color: Qt.rgba(1,1,1,0.3) + cornerRadius: fly.radius + glowRadius + } + + Rectangle { + id: fly + width: Math.round(Math.random()*canvas.width/200)+2 + height: width + x: parent.x + y: parent.y + color: Qt.rgba(Math.random(),Math.random(),0,0.5) + radius: Math.floor(width/2) + property int jitterX: Math.round(Math.random()*100)+10 + property int jitterY: Math.round(Math.random()*100)+10 + + Behavior on color { + ColorAnimation { + duration: 500 + } + } + Behavior on x { + SmoothedAnimation { + velocity: 10+Math.random()*canvas.width/100 + } + } + Behavior on y { + SmoothedAnimation { + velocity: 10+Math.random()*canvas.height/100 + } + } + + } + + + + Timer { + interval: 5 + repeat: true + running: true + property bool starting: true + onTriggered: { + if(starting){ interval = Math.round(Math.random()*1000)+500; starting = false; } + if ( (fly.x+fly.jitterX)>parent.width || (fly.x+fly.jitterX)<0 ){ fly.jitterX = 0-fly.jitterX } + fly.x = fly.x+fly.jitterX + if( (fly.y+fly.jitterY)>parent.height || (fly.y+fly.jitterY)<0 ){ fly.jitterY = 0-fly.jitterY } + fly.y = fly.y+fly.jitterY + fly.jitterX = (Math.round(Math.random())*2 - 1) *fly.jitterX + fly.jitterY = (Math.round(Math.random())*2 - 1) *fly.jitterY + fly.color = Qt.rgba(Math.random(),Math.random(),Math.random(),0.5) + + } + } //end of timer +} //end of item diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Grav.qml b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Grav.qml new file mode 100644 index 00000000..d1e5d3c9 --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Grav.qml @@ -0,0 +1,132 @@ +import QtQuick 2.7 +import QtGraphicalEffects 1.0 + +Rectangle { + id : canvas + anchors.fill: parent + width: Screen.width + height: Screen.height + color: "black" + + //TODO Add orbital trails option + //TODO Fix jitteryness and start position + //TODO Make orbits more extreme + + //Between 5 and 15 planets, read from settings + property int planets: Math.round(( Math.random() * 10 ) + 5 ) + property int cx: Math.round(width/2) + property int cy: Math.round(height/2) + + //Create planets + Repeater { + id: planetRepeater + model: planets + + Rectangle { + id : index + parent: canvas + + //Creates random distance for elipse + property double c: Math.random() * 250 + property double b: Math.random() * 150 + c + property double a: Math.sqrt(b*b+c*c) + //Random angle of rotation + property double th: Math.random() * Math.PI + property var path: [] + + //Calculates starting position + x: Math.round(cx + a * Math.cos(th)) + y: Math.round(cy + b * Math.sin(th)) + + //Planet size between 14 and 32 pixels + width: Math.round(1.75 * (((Math.random() * 10) + 8 ))) + height: width + + //Make each rectangle look circular + radius: width / 2 + + //Give each planet a random color, semi-transparent + color: Qt.rgba(Math.random(), Math.random(), Math.random(), 0.5) + + /*Timer { + //Each planet updates between 1ms and 51ms (smaller times=faster) + interval: Math.round(Math.random() * 50 ) + 1 + repeat: true + running: true + property int time: 0 + + onTriggered: { + //Parametric equation that calculates the position of the general ellipse. Completes a loop ever 314 cycles. Credit to + x = cx+a*Math.cos(2*Math.PI*(time/314.0))*Math.cos(th) - b*Math.sin(2*Math.PI*(time/314.0))*Math.sin(th) + y = cy+a*Math.cos(2*Math.PI*(time/314.0))*Math.sin(th) + b*Math.sin(2*Math.PI*(time/314.0))*Math.cos(th) + time++; + + //Move a planet 80 pixels away from the sun if the planet is too close + if(x > cx && Math.abs(cx-x) < 80) { + x+=80 + }else if(x < cx && Math.abs(cx-x) < 80) { + x-=80 + } + + if(y > cy && Math.abs(cy-y) < 80) { + y+=80 + }else if(y < cy && Math.abs(cy-y) < 80) { + y-=80 + } + } + }*/ + + Component.onCompleted: { + pahtX[0] = x + pahtY[0] = y + for(int i = 1; i <= 200; i++) { + pathX[i] = cx+a*Math.cos(2*Math.PI*(i/200.0)*Math.cos(th) - b*Math.sin(2*Math.PI*(i/200.0)*Math.sin(th) + pathY[i] = cy+a*Math.cos(2*Math.PI*(i/200.0)*Math.sin(th) + b*Math.sin(2*Math.PI*(i/200.0)*Math.cos(th) + } + } + } + } + + //Create the star + Rectangle{ + id: star + parent: canvas + + //Centers in star in the center of the canvas, with an offset to center the animation + x: cx - 30 + y: cy - 30 + + width: 60 + height: width + + //Create the wobble animation + SequentialAnimation on height { + loops: Animation.Infinite + PropertyAnimation { duration: 2000; to: 90 } + PropertyAnimation { duration: 2000; to: 60 } + } + + SequentialAnimation on width { + loops: Animation.Infinite + PropertyAnimation { duration: 2000; to: 90 } + PropertyAnimation { duration: 2000; to: 60 } + } + + color: "black" + radius: width / 2 + + //Creates a radial gradient to make the star look cool + RadialGradient { + anchors.fill: parent + gradient: Gradient { + GradientStop { position:0 ;color: Qt.rgba(0,0,0,0)} + GradientStop { position:0.18 ;color: Qt.rgba(0,0,0,0)} + GradientStop { position:0.2 ;color: Qt.rgba(0.32,0.47,0.30,0.13)} + GradientStop { position:0.3 ;color: Qt.rgba(0.62,0.92,0.58,0.25)} + GradientStop { position:0.4 ;color: Qt.rgba(1.00,0.93,0.59,0.51)} + GradientStop { position:0.5 ;color: Qt.rgba(0,0,0,0)} + } + } + + } +} diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Matrix.qml b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Matrix.qml new file mode 100644 index 00000000..d4031201 --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Matrix.qml @@ -0,0 +1,71 @@ +import QtQuick 2.0 +import QtMultimedia 5.7 +import QtQuick.Window 2.2 + +Rectangle { + width: Window.width + height: Window.height + color: "black" + + Row{ + id: masterRow + anchors.left: parent.left + anchors.horizontalCenter: parent.horizontalCenter + width: parent.width + spacing: 5 + Repeater { + id: cR + model: Window.width / 15 + 1 + Column { + id: masterColumn + width: 10 + Text { + id: column + color: "#ff4d4d" + font.pixelSize: 10 + transform: Rotation { origin.x: 0; origin.y: 0; angle: 90 } + Timer { + interval: 50 + repeat: true + running: true + onTriggered: { + if(Math.random() < 0.95) { + var bottom = column.text.charAt(column.text.length-1) + var newString = bottom+column.text.substring(0, column.text.length-1) + column.text = newString + interval = 50 + }else{ + interval = 1000 + } + } + } + Component.onCompleted: { + var str = " " + var numberChar = Math.random() * 100 + (Window.height * 0.1); + if(Math.random() < 0.80) { + while(str.length < numberChar) { + if(Math.random() < 0.5) { + var charCount = Math.random() * 8 + 10 + var segStr = "" + while(segStr.length < charCount) { + var randChar = String.fromCharCode(0x30A0 + Math.random() * (0x30FF-0x30A0+1)); + segStr += randChar + } + str += segStr + }else{ + var charCount = Math.random() * 6 + 14 + var segStr = "" + while(segStr.length < charCount) { + segStr += " " + } + str += segStr + } + } + } + column.text = str + } + } + } + } + } +} diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Video.qml b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Video.qml new file mode 100644 index 00000000..9948537b --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Video.qml @@ -0,0 +1,48 @@ +import QtQuick 2.0 +import QtMultimedia 5.7 +import QtQuick.Window 2.2 +import Qt.labs.folderlistmodel 2.1 + +Rectangle { + width: Screen.width + height: Screen.height + color: "black" + + FolderListModel { + id: folderModel + folder: "/usr/local/videos" + } + + Repeater { + model: folderModel + Component { + Item { + Component.onCompleted: { playlist.addItem(fileURL) } + } + } + } + + Playlist { + id: playlist + playbackMode: Playlist.Random + PlaylistItem { source: "/" } + onError: { console.log("ERROR") } + } + + MediaPlayer { + id: player + autoPlay: true + playlist: playlist + } + + VideoOutput { + id: videoOutput + source: player + anchors.fill: parent + } + + Component.onCompleted: { + playlist.shuffle() + console.log(playlist.itemCount) + } +} diff --git a/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Warp.qml b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Warp.qml new file mode 100644 index 00000000..1cf9bc37 --- /dev/null +++ b/src-qt5/core/lumina-desktop/extrafiles/screensavers/qml_scripts/Warp.qml @@ -0,0 +1,64 @@ +import QtQuick 2.0 +import QtGraphicalEffects 1.0 + +Rectangle { + id : canvas + anchors.fill: parent + color: "black" + + function getStarColor(num){ + if(num < 1) { return "white" } + if(num < 2) { return "mistyrose" } + return "lightblue" + } + + // CREATE STARFIELD + Repeater { + model: Math.round(Math.random()*canvas.width/10)+500 + Rectangle { + parent: canvas + x: Math.round(Math.random()*canvas.width) + y: Math.round(Math.random()*canvas.height) + width: Math.round(Math.random()*3)+3 + height: width + radius: width/2 + color: getStarColor( (index%3) ) + + } + } //end of Repeater + + // NOW CREATE THE WARP EFFECT + ZoomBlur { + id: blur + anchors.fill: canvas + source: canvas + samples: 24 + length: canvas.width / 20 + horizontalOffset: 0 + verticalOffset: 0 + + Behavior on horizontalOffset{ + NumberAnimation{ + duration: 3000 + } + } + Behavior on verticalOffset{ + NumberAnimation{ + duration: 3000 + } + } + } //end of zoom blur + + Timer { + interval: 5 + repeat: true + running: true + property bool starting: true + onTriggered: { + if(starting){ interval = 3010; starting = false; } + blur.horizontalOffset = (Math.random()*canvas.width/4) - (canvas.width/8) + blur.verticalOffset = (Math.random()*canvas.height/4) - (canvas.height/8) + } + } //end of timer + +} //end of canvas rectangle diff --git a/src-qt5/core/lumina-desktop/lumina-desktop.pro b/src-qt5/core/lumina-desktop/lumina-desktop.pro index 07bffe4a..678a8526 100644 --- a/src-qt5/core/lumina-desktop/lumina-desktop.pro +++ b/src-qt5/core/lumina-desktop/lumina-desktop.pro @@ -96,6 +96,9 @@ defaults.path = $${L_SHAREDIR}/lumina-desktop/ conf.path = $${L_ETCDIR} +extrafiles.path = $${L_SHAREDIR}/lumina-desktop +extrafiles.files = extrafiles/* + #Now do any OS-specific defaults (if available) #First see if there is a known OS override first !isEmpty(DEFAULT_SETTINGS){ @@ -185,7 +188,7 @@ dotrans.extra=cd $$PWD/i18n && $${LRELEASE} -nounfinished *.ts && cp *.qm $(INST manpage.path=$${L_MANDIR}/man1/ manpage.extra="$${MAN_ZIP} $$PWD/lumina-desktop.1 > $(INSTALL_ROOT)$${L_MANDIR}/man1/lumina-desktop.1.gz" -INSTALLS += target desktop icons defaults conf fluxconf manpage +INSTALLS += target desktop icons defaults conf fluxconf manpage extrafiles WITH_I18N{ INSTALLS += dotrans diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp index 57c17d47..38f5246f 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/StartMenu.cpp @@ -578,7 +578,8 @@ void StartMenu::on_tool_launch_deskinfo_clicked(){ //Logout Buttons void StartMenu::on_tool_lock_clicked(){ //QProcess::startDetached("xscreensaver-command -lock"); - LaunchItem("xscreensaver-command -lock",false); + QTimer::singleShot(30,LSession::handle(), SLOT(LockScreen()) ); + //LaunchItem("xscreensaver-command -lock",false); } void StartMenu::on_tool_logout_clicked(){ diff --git a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/LUserButton.cpp b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/LUserButton.cpp index acb27135..c1cf2907 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/LUserButton.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/LUserButton.cpp @@ -23,7 +23,7 @@ LUserButtonPlugin::LUserButtonPlugin(QWidget *parent, QString id, bool horizonta mact = new QWidgetAction(this); mact->setDefaultWidget(usermenu); menu->addAction(mact); - + button->setMenu(menu); connect(menu, SIGNAL(aboutToHide()), this, SLOT(updateButtonVisuals()) ); //Setup the global shortcut handling for opening the start menu diff --git a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp index 8d7dab7a..dc89525c 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserItemWidget.cpp @@ -33,7 +33,7 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, name->setText( tr("Go Back") ); }else{ icon->setPixmap( LXDG::findIcon("folder","").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); + name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); } }else{ actButton->setVisible(false); @@ -46,7 +46,7 @@ UserItemWidget::UserItemWidget(QWidget *parent, QString itemPath, QString type, }else{ icon->setPixmap( LXDG::findMimeIcon(itemPath.section("/",-1)).pixmap(32,32) ); } - name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); + name->setText( this->fontMetrics().elidedText(itemPath.section("/",-1), Qt::ElideRight, TEXTCUTOFF) ); } icon->setWhatsThis(itemPath); if(!goback){ this->setWhatsThis(name->text()); } @@ -77,7 +77,7 @@ UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop *item) : QFrame(paren } //Now fill it appropriately icon->setPixmap( LXDG::findIcon(item->icon,"preferences-system-windows-actions").pixmap(32,32) ); - name->setText( this->fontMetrics().elidedText(item->name, Qt::ElideRight, TEXTCUTOFF) ); + name->setText( this->fontMetrics().elidedText(item->name, Qt::ElideRight, TEXTCUTOFF) ); this->setWhatsThis(name->text()); icon->setWhatsThis(item->filePath); //Now setup the buttons appropriately @@ -85,7 +85,7 @@ UserItemWidget::UserItemWidget(QWidget *parent, XDGDesktop *item) : QFrame(paren setupActions(item); } -UserItemWidget::~UserItemWidget(){ +UserItemWidget::~UserItemWidget(){ delete button; delete icon; delete name; @@ -98,7 +98,7 @@ void UserItemWidget::createWidget(){ menuopen = false; menureset = new QTimer(this); menureset->setSingleShot(true); - menureset->setInterval(1000); //1 second + menureset->setInterval(1000); //1 second this->setContentsMargins(0,0,0,0); button = new QToolButton(this); button->setIconSize( QSize(14,14) ); @@ -125,7 +125,7 @@ void UserItemWidget::createWidget(){ void UserItemWidget::setupButton(bool disable){ //if(isDirectory){ qDebug() << "Directory Entry:" << isShortcut << linkPath << icon->whatsThis(); } - + if(disable){ button->setVisible(false); }else if(isShortcut && !linkPath.isEmpty()){ //Favorite Item - can always remove this @@ -141,7 +141,7 @@ void UserItemWidget::setupButton(bool disable){ }else if(!isShortcut){// if( !QFile::exists( QDir::homePath()+"/Desktop/"+icon->whatsThis().section("/",-1) ) && !LUtils::isFavorite(icon->whatsThis() ) ){ //This file does not have a shortcut yet -- allow the user to add it button->setWhatsThis("add"); - button->setIcon( LXDG::findIcon("bookmark-toolbar","") ); + button->setIcon( LXDG::findIcon("bookmark-toolbar","") ); button->setToolTip(tr("Create Shortcut")); connect(button, SIGNAL(clicked()), this, SLOT(buttonClicked()) ); }else{ @@ -161,7 +161,7 @@ void UserItemWidget::setupActions(XDGDesktop *app){ QAction *act = new QAction(LXDG::findIcon(app->actions[i].icon, app->icon), app->actions[i].name, this); act->setToolTip(app->actions[i].ID); act->setWhatsThis(app->actions[i].ID); - actButton->menu()->addAction(act); + actButton->menu()->addAction(act); } connect(actButton->menu(), SIGNAL(triggered(QAction*)), this, SLOT(actionClicked(QAction*)) ); connect(actButton->menu(), SIGNAL(aboutToShow()), this, SLOT(actionMenuOpen()) ); @@ -171,22 +171,22 @@ void UserItemWidget::setupActions(XDGDesktop *app){ void UserItemWidget::buttonClicked(){ button->setVisible(false); - if(button->whatsThis()=="add"){ + if(button->whatsThis()=="add"){ LDesktopUtils::addFavorite(icon->whatsThis()); //QFile::link(icon->whatsThis(), QDir::homePath()+"/.lumina/favorites/"+icon->whatsThis().section("/",-1) ); - emit NewShortcut(); - }else if(button->whatsThis()=="remove"){ - if(linkPath.isEmpty()){ + emit NewShortcut(); + }else if(button->whatsThis()=="remove"){ + if(linkPath.isEmpty()){ //This is a desktop file if(isDirectory){ QProcess::startDetached("rm -r \""+icon->whatsThis()+"\""); }else{ - QFile::remove(icon->whatsThis()); - } + QFile::remove(icon->whatsThis()); + } //Don't emit the RemovedShortcut signal here - the automatic ~/Desktop watcher will see the change when finished - }else{ + }else{ LDesktopUtils::removeFavorite(icon->whatsThis()); //This is a favorite - emit RemovedShortcut(); + emit RemovedShortcut(); } } } diff --git a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp index a0ba8996..9fdc7169 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.cpp @@ -15,7 +15,7 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid if(parent!=0){ parent->setMouseTracking(true); } this->setMouseTracking(true); sysapps = LSession::handle()->applicationMenu()->currentAppHash(); //get the raw info - + //Connect the signals/slots connect(ui->tool_desktopsettings, SIGNAL(clicked()), this, SLOT(openDeskSettings()) ); connect(ui->tool_config_screensaver, SIGNAL(clicked()), this, SLOT(openScreenSaverConfig()) ); @@ -28,13 +28,13 @@ UserWidget::UserWidget(QWidget* parent) : QTabWidget(parent), ui(new Ui::UserWid connect(ui->tool_home_browse, SIGNAL(clicked()), this, SLOT(slotOpenDir()) ); connect(ui->tool_home_search, SIGNAL(clicked()), this, SLOT(slotOpenSearch()) ); connect(ui->tool_config_about, SIGNAL(clicked()), this, SLOT(openLuminaInfo()) ); - + //Setup the special buttons connect(ui->tool_app_store, SIGNAL(clicked()), this, SLOT(openStore()) ); connect(ui->tool_controlpanel, SIGNAL(clicked()), this, SLOT(openControlPanel()) ); //connect(ui->tool_qtconfig, SIGNAL(clicked()), this, SLOT(openQtConfig()) ); - - lastUpdate = QDateTime(); //make sure it refreshes + + lastUpdate = QDateTime(); //make sure it refreshes connect(LSession::handle()->applicationMenu(), SIGNAL(AppMenuUpdated()), this, SLOT(UpdateMenu()) ); connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(updateFavItems()) ); @@ -68,7 +68,7 @@ void UserWidget::SortScrollArea(QScrollArea *area){ for(int i=0; i<lay->count(); i++){ items << lay->itemAt(i)->widget()->whatsThis().toLower(); } - + items.sort(); //qDebug() << " - Sorted Items:" << items; for(int i=0; i<items.length(); i++){ @@ -84,7 +84,7 @@ void UserWidget::SortScrollArea(QScrollArea *area){ } } } - + } QIcon UserWidget::rotateIcon(QIcon ico){ @@ -119,13 +119,13 @@ void UserWidget::UpdateAll(){ ui->tool_fav_dirs->setIcon( LXDG::findIcon("folder","") ); ui->tool_fav_files->setIcon( LXDG::findIcon("document-multiple","") ); ui->tool_desktopsettings->setIcon( LXDG::findIcon("preferences-desktop","") ); - ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") ); + ui->tool_config_screensaver->setIcon( LXDG::findIcon("preferences-desktop-screensaver","") ); ui->tool_config_screensettings->setIcon( LXDG::findIcon("preferences-other","") ); ui->tool_home_gohome->setIcon( LXDG::findIcon("go-home","") ); ui->tool_home_browse->setIcon( LXDG::findIcon("document-open","") ); ui->tool_home_search->setIcon( LXDG::findIcon("system-search","") ); ui->tool_config_about->setIcon( LXDG::findIcon("lumina","") ); - + //Setup the special buttons QString APPSTORE = LOS::AppStoreShortcut(); if(QFile::exists(APPSTORE) && !APPSTORE.isEmpty()){ diff --git a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.h b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.h index 8b03c489..c112ac0f 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.h +++ b/src-qt5/core/lumina-desktop/panel-plugins/userbutton/UserWidget.h @@ -24,8 +24,6 @@ #include <LuminaOS.h> #include "UserItemWidget.h" -#define SSAVER QString("xscreensaver-demo") - namespace Ui{ class UserWidget; }; @@ -81,7 +79,8 @@ private slots: LaunchItem("lumina-config", false); } void openScreenSaverConfig(){ - LaunchItem(SSAVER, false); + LaunchItem("lumina-config",false); + //LaunchItem(SSAVER, false); } void openScreenConfig(){ LaunchItem("lumina-xconfig",false); @@ -89,7 +88,7 @@ private slots: void openLuminaInfo(){ LaunchItem("lumina-info",false); } - + protected: void mouseMoveEvent( QMouseEvent *event); diff --git a/src-qt5/core/lumina-desktop/src-screensaver/LLockScreen.cpp b/src-qt5/core/lumina-desktop/src-screensaver/LLockScreen.cpp index 2cfd0f4a..4253a115 100644 --- a/src-qt5/core/lumina-desktop/src-screensaver/LLockScreen.cpp +++ b/src-qt5/core/lumina-desktop/src-screensaver/LLockScreen.cpp @@ -45,6 +45,7 @@ void LLockScreen::aboutToHide(){ ui->line_password->clear(); ui->line_password->clearFocus(); if(refreshtime->isActive()){ refreshtime->stop(); } + ui->line_password->releaseKeyboard(); } void LLockScreen::aboutToShow(){ @@ -59,6 +60,7 @@ void LLockScreen::aboutToShow(){ UpdateLockInfo(); ui->line_password->clear(); ui->line_password->setFocus(); + ui->line_password->grabKeyboard(); } // ================= @@ -85,9 +87,10 @@ void LLockScreen::TryUnlock(){ QTextStream in(TF); in << pass.toUtf8()+"\0"; //make sure it is null-terminated TF->close(); - //qDebug() << "Trying to unlock session:" << TF->fileName() << LUtils::readFile(TF->fileName()); - //qDebug() << "UserName:" << getlogin(); + if(DEBUG){ qDebug() << "Trying to unlock session:" << getlogin(); } LUtils::runCommand(ok, "lumina-checkpass",QStringList() << "-f" << TF->fileName() ); + if(DEBUG){ qDebug() << " - Success:" << ok; } + ok = true; //bypass for the moment } delete TF; //ensure the temporary file is removed **right now** for security purposes if(ok){ diff --git a/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp b/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp index 8cf78fdf..41ee7c4a 100644 --- a/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp +++ b/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp @@ -27,7 +27,7 @@ LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::Windo LOCKER->hide(); SSRunning = SSLocked = updating = false; this->setObjectName("LSCREENSAVERBASE"); - this->setStyleSheet("LScreenSaver#LSCREENSAVERBASE{ background: grey; }"); + this->setStyleSheet("LScreenSaver#LSCREENSAVERBASE{ background: darkgrey; }"); this->setMouseTracking(true); connect(starttimer, SIGNAL(timeout()), this, SLOT(ShowScreenSaver()) ); connect(locktimer, SIGNAL(timeout()), this, SLOT(LockScreen()) ); @@ -51,7 +51,10 @@ void LScreenSaver::UpdateTimers(){ if(locktimer->isActive()){ locktimer->stop(); } if(hidetimer->isActive()){ hidetimer->stop(); } - if(!SSRunning && !SSLocked && (starttimer->interval() > 1000) ){ starttimer->start(); } //time to SS start + if(!SSRunning && !SSLocked && (starttimer->interval() > 1000) ){ + //time to SS start + if(LSession::handle()->XCB->WindowIsFullscreen(LSession::handle()->XCB->WM_Get_Active_Window()) ){ starttimer->start(); } //do not start if current window is fullscreen (videos, movies, etc) + } else if( SSRunning && !SSLocked && (locktimer->interval() > 1000 ) ){ locktimer->start(); } //time to lock else if( !SSRunning && SSLocked ){ hidetimer->start(); } //time to hide lock screen } @@ -114,11 +117,12 @@ void LScreenSaver::checkInputEvents(){ change = true; } //If there was an input event detected (or a window is currently full-screen), update timers and such - if(change || LSession::handle()->XCB->WindowIsFullscreen(active) ){ newInputEvent(); } + if(change){ newInputEvent(); } } void LScreenSaver::ShowScreenSaver(){ if(DEBUG){ qDebug() << "Showing Screen Saver:" << QDateTime::currentDateTime().toString(); } + checkInputEvents(); //update all the internal times to now //QApplication::setOverrideCursor(QCursor::BlankCursor); SSRunning = true; updating = true; @@ -155,6 +159,7 @@ void LScreenSaver::ShowScreenSaver(){ BASES[i]->show(); BASES[i]->startPainting(); } + this->grabKeyboard(); updating = false; UpdateTimers(); } @@ -167,6 +172,7 @@ void LScreenSaver::ShowLockScreen(){ LOCKER->resize(LOCKER->sizeHint()); LOCKER->move(ctr - QPoint(LOCKER->width()/2, LOCKER->height()/2) ); LOCKER->show(); + LOCKER->activateWindow(); //Start the timer for hiding the lock screen due to inactivity UpdateTimers(); } @@ -176,6 +182,7 @@ void LScreenSaver::HideScreenSaver(){ if(DEBUG){ qDebug() << "Hiding Screen Saver:" << QDateTime::currentDateTime().toString(); } SSRunning = false; //if(cBright>0){ LOS::setScreenBrightness(cBright); } //return to current brightness + this->releaseKeyboard(); if(!SSLocked){ this->hide(); emit ClosingScreenSaver(); diff --git a/src-qt5/core/lumina-desktop/src-screensaver/SSBaseWidget.cpp b/src-qt5/core/lumina-desktop/src-screensaver/SSBaseWidget.cpp index aa3214a2..840eb12a 100644 --- a/src-qt5/core/lumina-desktop/src-screensaver/SSBaseWidget.cpp +++ b/src-qt5/core/lumina-desktop/src-screensaver/SSBaseWidget.cpp @@ -10,7 +10,7 @@ //Relative directory to search along the XDG paths for screensavers #define REL_DIR QString("/lumina-desktop/screensavers") -#define DEBUG 0 +#define DEBUG 1 // ======== // PUBLIC diff --git a/src-qt5/core/lumina-session/session.cpp b/src-qt5/core/lumina-session/session.cpp index aed63f7e..cba855c9 100644 --- a/src-qt5/core/lumina-session/session.cpp +++ b/src-qt5/core/lumina-session/session.cpp @@ -151,10 +151,16 @@ void LSession::setupCompositor(bool force){ //Compositing manager QSettings settings("lumina-desktop","sessionsettings"); if(settings.value("enableCompositing",false).toBool() || force){ - if(LUtils::isValidBinary("compton")){ + if(LUtils::isValidBinary("picom")){ + //New name for compton - removed the "-d" startup option (finally reads DISPLAY instead) (May 2020) + //Always use the GLX backend for picom - the xrender and hybrid backends cause lots of flickering + startProcess("compositing","picom --backend glx --config "+set, QStringList() << set); + + }else if(LUtils::isValidBinary("compton")){ QString disp = getenv("DISPLAY"); //Always use the GLX backend for compton - the xrender and hybrid backends cause lots of flickering startProcess("compositing","compton --backend glx -d "+disp+" --config "+set, QStringList() << set); + }else if(LUtils::isValidBinary("xcompmgr") && !settings.value("compositingWithGpuAccelOnly",true).toBool() ){ startProcess("compositing","xcompmgr"); } diff --git a/src-qt5/src-cpp/plugins-screensaver.cpp b/src-qt5/src-cpp/plugins-screensaver.cpp index 6370b068..09779bc5 100644 --- a/src-qt5/src-cpp/plugins-screensaver.cpp +++ b/src-qt5/src-cpp/plugins-screensaver.cpp @@ -19,6 +19,7 @@ SSPlugin::~SSPlugin(){ bool SSPlugin::isValid(){ if(data.isEmpty()){ return false; } + if( data.value("disabled").toBool(false) ){ return false; } //Skip any plugin with "disabled" = true bool ok = data.contains("name") && data.contains("qml") && data.contains("description"); ok &= containsDefault("name"); ok &= containsDefault("description"); |