diff options
author | Ken Moore <ken@pcbsd.org> | 2016-09-29 15:26:10 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2016-09-29 15:26:10 -0400 |
commit | 38c9f989bb261eb77153755d283ad05b4916f4ba (patch) | |
tree | 125ca5910c26fb3c97fa5f733ad53e36345677e8 /src-qt5/core/lumina-desktop | |
parent | Add an additional default-valued constructor for LFileInfo. (diff) | |
download | lumina-38c9f989bb261eb77153755d283ad05b4916f4ba.tar.gz lumina-38c9f989bb261eb77153755d283ad05b4916f4ba.tar.bz2 lumina-38c9f989bb261eb77153755d283ad05b4916f4ba.zip |
A few changes to the desktop:
1) Randomize the background image *every time* it changes.
2) Add support for per-workspace wallpaper image settings (background/filelist-workspace-<number>, where <number> is 0+ )
3) Add detection of workspace changes to the session, and update the background wallpaper on change as needed.
Diffstat (limited to 'src-qt5/core/lumina-desktop')
-rw-r--r-- | src-qt5/core/lumina-desktop/LDesktop.cpp | 11 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LSession.h | 1 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/LXcbEventFilter.cpp | 4 |
3 files changed, 11 insertions, 5 deletions
diff --git a/src-qt5/core/lumina-desktop/LDesktop.cpp b/src-qt5/core/lumina-desktop/LDesktop.cpp index f1b73bc0..980b3e5e 100644 --- a/src-qt5/core/lumina-desktop/LDesktop.cpp +++ b/src-qt5/core/lumina-desktop/LDesktop.cpp @@ -209,6 +209,7 @@ void LDesktop::InitDesktop(){ connect(QApplication::instance(), SIGNAL(DesktopConfigChanged()), this, SLOT(SettingsChanged()) ); connect(QApplication::instance(), SIGNAL(DesktopFilesChanged()), this, SLOT(UpdateDesktop()) ); connect(QApplication::instance(), SIGNAL(LocaleChanged()), this, SLOT(LocaleChanged()) ); + connect(QApplication::instance(), SIGNAL(WorkspaceChanged()), this, SLOT(UpdateBackground()) ); if(DEBUG){ qDebug() << "Create bgWindow"; } bgWindow = new LDesktopBackground(); @@ -478,7 +479,9 @@ void LDesktop::UpdateBackground(){ bgupdating = true; if(DEBUG){ qDebug() << " - Update Desktop Background for screen:" << desktopnumber; } //Get the list of background(s) to show - QStringList bgL = settings->value(DPREFIX+"background/filelist", QStringList()).toStringList(); + QStringList bgL = settings->value(DPREFIX+"background/filelist-workspace-"+QString::number( LSession::handle()->XCB->CurrentWorkspace()), QStringList()).toStringList(); + if(bgL.isEmpty()){ bgL = settings->value(DPREFIX+"background/filelist", QStringList()).toStringList(); } + //qDebug() << " - List:" << bgL << CBG; //Remove any invalid files for(int i=0; i<bgL.length(); i++){ @@ -495,11 +498,9 @@ void LDesktop::UpdateBackground(){ } oldBGL = bgL; //save this for later //Determine which background to use next - int index; - if(CBG.isEmpty()){ index = ( qrand() % bgL.length() ); } //random first wallpaper - else{ + int index ( qrand() % bgL.length() ); + if(index== bgL.indexOf(CBG)){ //if the current wallpaper was selected by the randomization again //Go to the next in the list - index = bgL.indexOf(CBG); if(index < 0 || index >= bgL.length()-1){ index = 0; } //if invalid or last item in the list - go to first else{ index++; } //go to next } diff --git a/src-qt5/core/lumina-desktop/LSession.h b/src-qt5/core/lumina-desktop/LSession.h index c19b3f09..d19cf70c 100644 --- a/src-qt5/core/lumina-desktop/LSession.h +++ b/src-qt5/core/lumina-desktop/LSession.h @@ -185,6 +185,7 @@ signals: void DesktopConfigChanged(); void SessionConfigChanged(); void DesktopFilesChanged(); + void WorkspaceChanged(); }; diff --git a/src-qt5/core/lumina-desktop/LXcbEventFilter.cpp b/src-qt5/core/lumina-desktop/LXcbEventFilter.cpp index c8321c49..3c92c050 100644 --- a/src-qt5/core/lumina-desktop/LXcbEventFilter.cpp +++ b/src-qt5/core/lumina-desktop/LXcbEventFilter.cpp @@ -46,6 +46,10 @@ bool XCBEventFilter::nativeEventFilter(const QByteArray &eventType, void *messag && ( ( ((xcb_property_notify_event_t*)ev)->atom == session->XCB->EWMH._NET_DESKTOP_GEOMETRY) \ || (((xcb_property_notify_event_t*)ev)->atom == session->XCB->EWMH._NET_WORKAREA) )){ session->RootSizeChange(); + }else if( ((xcb_property_notify_event_t*)ev)->window == QX11Info::appRootWindow() \ + && ( ( ((xcb_property_notify_event_t*)ev)->atom == session->XCB->EWMH._NET_CURRENT_DESKTOP) )){ + qDebug() << "Got Workspace Change"; + session->emit WorkspaceChanged(); }else if( SysNotifyAtoms.contains( ((xcb_property_notify_event_t*)ev)->atom ) ){ //Update the status/list of all running windows session->WindowPropertyEvent(); |