diff options
Diffstat (limited to 'libLumina')
-rw-r--r-- | libLumina/LuminaX11.cpp | 73 | ||||
-rw-r--r-- | libLumina/LuminaX11.h | 8 | ||||
-rw-r--r-- | libLumina/LuminaXDG.cpp | 10 |
3 files changed, 78 insertions, 13 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp index 3509d262..03a33dd0 100644 --- a/libLumina/LuminaX11.cpp +++ b/libLumina/LuminaX11.cpp @@ -858,12 +858,12 @@ LXCB::~LXCB(){ // === WindowList() === QList<WId> LXCB::WindowList(bool rawlist){ QList<WId> output; - qDebug() << "Get Client list cookie"; + //qDebug() << "Get Client list cookie"; xcb_get_property_cookie_t cookie = xcb_ewmh_get_client_list_unchecked( &EWMH, 0); xcb_ewmh_get_windows_reply_t winlist; - qDebug() << "Get client list"; + //qDebug() << "Get client list"; if( 1 == xcb_ewmh_get_client_list_reply( &EWMH, cookie, &winlist, NULL) ){ - qDebug() << " - Loop over items"; + //qDebug() << " - Loop over items"; unsigned int wkspace = CurrentWorkspace(); for(unsigned int i=0; i<winlist.windows_len; i++){ //Filter out the Lumina Desktop windows @@ -880,11 +880,11 @@ QList<WId> LXCB::WindowList(bool rawlist){ // === CurrentWorkspace() === unsigned int LXCB::CurrentWorkspace(){ - qDebug() << "Get Current Workspace"; + //qDebug() << "Get Current Workspace"; xcb_get_property_cookie_t cookie = xcb_ewmh_get_current_desktop_unchecked(&EWMH, 0); uint32_t wkspace = 0; xcb_ewmh_get_current_desktop_reply(&EWMH, cookie, &wkspace, NULL); - qDebug() << " - done:" << wkspace; + //qDebug() << " - done:" << wkspace; return wkspace; } @@ -892,27 +892,30 @@ unsigned int LXCB::CurrentWorkspace(){ QString LXCB::WindowClass(WId win){ QString out; xcb_get_property_cookie_t cookie = xcb_icccm_get_wm_class_unchecked(QX11Info::connection(), win); + if(cookie.sequence == 0){ return out; } xcb_icccm_get_wm_class_reply_t value; if( 1== xcb_icccm_get_wm_class_reply( QX11Info::connection(), cookie, &value, NULL) ){ - out = QString(value.class_name); + out = QString::fromUtf8(value.class_name); + xcb_icccm_get_wm_class_reply_wipe(&value); } - xcb_icccm_get_wm_class_reply_wipe(&value); return out; } // === WindowWorkspace() === unsigned int LXCB::WindowWorkspace(WId win){ - qDebug() << "Get Window Workspace"; + //qDebug() << "Get Window Workspace"; uint32_t wkspace = 0; xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_desktop_unchecked(&EWMH, win); + if(cookie.sequence == 0){ return wkspace; } xcb_ewmh_get_wm_desktop_reply(&EWMH, cookie, &wkspace, NULL); - qDebug() << " - done: " << wkspace; + //qDebug() << " - done: " << wkspace; return wkspace; } // === WindowState() === LXCB::WINDOWSTATE LXCB::WindowState(WId win){ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_state_unchecked(&EWMH, win); + if(cookie.sequence == 0){ return IGNORE; } xcb_ewmh_get_atoms_reply_t states; WINDOWSTATE cstate = IGNORE; //First Check for special states (ATTENTION in particular); @@ -951,6 +954,54 @@ LXCB::WINDOWSTATE LXCB::WindowState(WId win){ return cstate; } +// === WindowVisibleIconName() === +QString LXCB::WindowVisibleIconName(WId win){ //_WM_VISIBLE_ICON_NAME + QString out; + xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_visible_icon_name_unchecked(&EWMH, win); + if(cookie.sequence == 0){ return out; } + xcb_ewmh_get_utf8_strings_reply_t data; + if( 1 == xcb_ewmh_get_wm_visible_icon_name_reply(&EWMH, cookie, &data, NULL) ){ + out = QString::fromUtf8(data.strings, data.strings_len); + } + return out; +} + +// === WindowIconName() === +QString LXCB::WindowIconName(WId win){ //_WM_ICON_NAME + QString out; + xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_icon_name_unchecked(&EWMH, win); + if(cookie.sequence == 0){ return out; } + xcb_ewmh_get_utf8_strings_reply_t data; + if( 1 == xcb_ewmh_get_wm_icon_name_reply(&EWMH, cookie, &data, NULL) ){ + out = QString::fromUtf8(data.strings, data.strings_len); + } + return out; +} + +// === WindowVisibleName() === +QString LXCB::WindowVisibleName(WId win){ //_WM_VISIBLE_NAME + QString out; + xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_visible_name_unchecked(&EWMH, win); + if(cookie.sequence == 0){ return out; } + xcb_ewmh_get_utf8_strings_reply_t data; + if( 1 == xcb_ewmh_get_wm_visible_name_reply(&EWMH, cookie, &data, NULL) ){ + out = QString::fromUtf8(data.strings, data.strings_len); + } + return out; +} + +// === WindowName() === +QString LXCB::WindowName(WId win){ //_WM_NAME + QString out; + xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked(&EWMH, win); + if(cookie.sequence == 0){ return out; } + xcb_ewmh_get_utf8_strings_reply_t data; + if( 1 == xcb_ewmh_get_wm_name_reply(&EWMH, cookie, &data, NULL) ){ + out = QString::fromUtf8(data.strings, data.strings_len); + } + return out; +} + // === SetAsSticky() === void LXCB::SetAsSticky(WId win){ //Need to send a client message event for the window so the WM picks it up @@ -972,6 +1023,10 @@ void LXCB::SetAsSticky(WId win){ xcb_flush(QX11Info::connection()); //apply it right away*/ } +// === CloseWindow() === +void LXCB::CloseWindow(WId win){ + xcb_ewmh_request_close_window(&EWMH, 0, win, QX11Info::getTimestamp(), XCB_EWMH_CLIENT_SOURCE_TYPE_OTHER); +} // === SetScreenWorkArea() === /*void LXCB::SetScreenWorkArea(unsigned int screen, QRect rect){ //This is only useful because Fluxbox does not set the _NET_WORKAREA root atom diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h index ac232de1..6e229729 100644 --- a/libLumina/LuminaX11.h +++ b/libLumina/LuminaX11.h @@ -132,9 +132,15 @@ public: QString WindowClass(WId); unsigned int WindowWorkspace(WId); WINDOWSTATE WindowState(WId win); //Visible state of window + QString WindowVisibleIconName(WId win); //_WM_VISIBLE_ICON_NAME + QString WindowIconName(WId win); //_WM_ICON_NAME + QString WindowVisibleName(WId win); //_WM_VISIBLE_NAME + QString WindowName(WId win); //_WM_NAME //Window Modification - void SetAsSticky(WId); + void SetAsSticky(WId); //Stick to all workspaces + void CloseWindow(WId); //request that the window be closed + }; #endif
\ No newline at end of file diff --git a/libLumina/LuminaXDG.cpp b/libLumina/LuminaXDG.cpp index 84a6f665..b58f4326 100644 --- a/libLumina/LuminaXDG.cpp +++ b/libLumina/LuminaXDG.cpp @@ -272,13 +272,17 @@ void LXDG::setEnvironmentVars(){ QIcon LXDG::findIcon(QString iconName, QString fallback){ //Check if the icon is an absolute path and exists + bool DEBUG =false; + if(DEBUG){ qDebug() << "[LXDG] Find icon for:" << iconName; } if(QFile::exists(iconName) && iconName.startsWith("/")){ return QIcon(iconName); } else if(iconName.startsWith("/")){ iconName.section("/",-1); } //Invalid absolute path, just looks for the icon //Check if the icon is actually given - if(iconName.isEmpty()){ return QIcon(fallback); } + if(iconName.isEmpty()){ + if(fallback.isEmpty()){ return QIcon(); } + else{ return LXDG::findIcon(fallback, ""); } + } //Now try to find the icon from the theme - bool DEBUG = false; - if(DEBUG){ qDebug() << "[LXDG] Find icon for:" << iconName; } + if(DEBUG){ qDebug() << "[LXDG] Start search for icon"; } //Check the default theme search paths QStringList paths = QIcon::themeSearchPaths(); if(paths.isEmpty()){ |