diff options
author | Ken Moore <moorekou@gmail.com> | 2020-04-24 19:46:53 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2020-04-24 19:46:53 -0400 |
commit | a12bd680f39a0503cb93413d3420fd80158835d9 (patch) | |
tree | 831243bb1c126498df9fcf520f26757c4bcc2ab1 /src-qt5/core/lumina-desktop | |
parent | More updates. (diff) | |
download | lumina-a12bd680f39a0503cb93413d3420fd80158835d9.tar.gz lumina-a12bd680f39a0503cb93413d3420fd80158835d9.tar.bz2 lumina-a12bd680f39a0503cb93413d3420fd80158835d9.zip |
Some more updates to the desktop.
Get the screensaver checks working
Diffstat (limited to 'src-qt5/core/lumina-desktop')
5 files changed, 22 insertions, 20 deletions
diff --git a/src-qt5/core/lumina-desktop/LSession.cpp b/src-qt5/core/lumina-desktop/LSession.cpp index 0b82fdc2..f1d5973d 100644 --- a/src-qt5/core/lumina-desktop/LSession.cpp +++ b/src-qt5/core/lumina-desktop/LSession.cpp @@ -164,8 +164,8 @@ void LSession::setupSession(){ splash.showScreen("init"); qDebug() << "Initializing Session"; if(QFile::exists("/tmp/.luminastopping")){ QFile::remove("/tmp/.luminastopping"); } - QTime* timer = 0; - if(DEBUG){ timer = new QTime(); timer->start(); qDebug() << " - Init srand:" << timer->elapsed();} + QElapsedTimer* timer = 0; + if(DEBUG){ timer = new QElapsedTimer(); timer->start(); qDebug() << " - Init srand:" << timer->elapsed();} //Setup the QSettings default paths splash.showScreen("settings"); @@ -344,6 +344,8 @@ void LSession::NewCommunication(QStringList list){ screensChanged(); }else if(list[i]=="--show-start"){ emit StartButtonActivated(); + }else if(list[i]=="--lock"){ + QTimer::singleShot(10, ScreenSaver, SLOT(LockScreenNow()) ); }else if(list[i]=="--logout"){ QTimer::singleShot(1000, this, SLOT(StartLogout()));} } } @@ -400,6 +402,10 @@ void LSession::StartReboot(bool skipupdates){ QCoreApplication::exit(0); } +void LSession::LockScreen(){ + QTimer::singleShot(10, ScreenSaver, SLOT(LockScreenNow()) ); +} + void LSession::reloadIconTheme(){ //Wait a moment for things to settle before sending out the signal to the interfaces QApplication::processEvents(); diff --git a/src-qt5/core/lumina-desktop/LSession.h b/src-qt5/core/lumina-desktop/LSession.h index 71036b09..0cd9f1d2 100644 --- a/src-qt5/core/lumina-desktop/LSession.h +++ b/src-qt5/core/lumina-desktop/LSession.h @@ -154,6 +154,7 @@ public slots: void StartLogout(); void StartShutdown(bool skipupdates = false); void StartReboot(bool skipupdates = false); + void LockScreen(); void reloadIconTheme(); diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp index 56ad0788..83aaceea 100644 --- a/src-qt5/core/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp +++ b/src-qt5/core/lumina-desktop/panel-plugins/systemdashboard/SysMenuQuick.cpp @@ -92,22 +92,11 @@ void LSysMenuQuick::UpdateMenu(){ if(hasBat){ ui->group_battery->setVisible(true); val = LOS::batteryCharge(); - if(LOS::batteryIsCharging()){ - if(val < 15){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging-low","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 30){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging-caution","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 50){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging-040","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 70){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging-060","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 90){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging-080","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else{ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-charging","").pixmap(ui->label_bat_icon->maximumSize()) ); } + bool charging = LOS::batteryIsCharging(); + ui->label_bat_icon->setPixmap( LXDG::findIcon(LSession::batteryIconName(val,charging), "").pixmap(ui->label_bat_icon->maximumSize()) ); + if(charging){ ui->label_bat_text->setText( QString("%1%\n(%2)").arg(QString::number(val), tr("connected")) ); }else{ - if(val < 1){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-missing","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 15){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-low","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 30){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-caution","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 50){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-040","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 70){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-060","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else if(val < 90){ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-080","").pixmap(ui->label_bat_icon->maximumSize()) ); } - else{ ui->label_bat_icon->setPixmap( LXDG::findIcon("battery-100","").pixmap(ui->label_bat_icon->maximumSize()) ); } ui->label_bat_text->setText( QString("%1%\n(%2)").arg(QString::number(val), getRemainingTime()) ); } }else{ diff --git a/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp b/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp index 9b8aa649..8cf78fdf 100644 --- a/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp +++ b/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.cpp @@ -8,6 +8,7 @@ #include <QScreen> #include <QApplication> +#include <LSession.h> #define DEBUG 0 LScreenSaver::LScreenSaver() : QWidget(0,Qt::BypassWindowManagerHint | Qt::WindowStaysOnTopHint){ @@ -102,14 +103,18 @@ void LScreenSaver::checkInputEvents(){ change = true; } //Check the last keyboard input timestamp - //unsigned int timecode = WM_Get_User_Time( WM_Get_Active_Window() ); - unsigned int timecode = 0; //Not done yet - read the _NET_WM_USER_TIME number on the active window + WId active = LSession::handle()->XCB->WM_Get_Active_Window(); + if(active != lastActiveWindow){ + lastActiveWindow = active; + change = true; + } + unsigned int timecode = LSession::handle()->XCB->WM_Get_User_Time(active); if(timecode > lastTimeCode){ lastTimeCode = timecode; change = true; } - //If there was an input event detected, update timers and such - if(change){ newInputEvent(); } + //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(); } } void LScreenSaver::ShowScreenSaver(){ diff --git a/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.h b/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.h index 571eea18..5d154e64 100644 --- a/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.h +++ b/src-qt5/core/lumina-desktop/src-screensaver/LScreenSaver.h @@ -26,6 +26,7 @@ private: LLockScreen *LOCKER; QPoint lastMousePos; unsigned int lastTimeCode; + WId lastActiveWindow; int cBright; bool SSRunning, SSLocked, updating; |