From 38c9f989bb261eb77153755d283ad05b4916f4ba Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 29 Sep 2016 15:26:10 -0400 Subject: 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-, where is 0+ ) 3) Add detection of workspace changes to the session, and update the background wallpaper on change as needed. --- src-qt5/core/lumina-desktop/LDesktop.cpp | 11 ++++++----- src-qt5/core/lumina-desktop/LSession.h | 1 + src-qt5/core/lumina-desktop/LXcbEventFilter.cpp | 4 ++++ 3 files changed, 11 insertions(+), 5 deletions(-) (limited to 'src-qt5/core/lumina-desktop') 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()-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(); -- cgit