aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--libLumina/LuminaX11.cpp69
-rw-r--r--libLumina/LuminaX11.h14
2 files changed, 81 insertions, 2 deletions
diff --git a/libLumina/LuminaX11.cpp b/libLumina/LuminaX11.cpp
index 048333b4..a5592c8e 100644
--- a/libLumina/LuminaX11.cpp
+++ b/libLumina/LuminaX11.cpp
@@ -1504,15 +1504,82 @@ void LXCB::WM_Set_Window_Supported(WId win){
}
// _NET_WM_NAME
+QString LXCB::WM_Get_Name(WId win){
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_name_unchecked(&EWMH, win);
+ xcb_ewmh_get_utf8_strings_reply_t reply;
+ QString out;
+ if(1==xcb_ewmh_get_wm_name_reply(&EWMH, cookie,&reply, NULL) ){
+ out = QString::fromUtf8(reply.strings);
+ }
+ return out;
+}
+void LXCB::WM_Set_Name(WId win, QString txt){
+ xcb_ewmh_set_wm_name(&EWMH, win, txt.length(), txt.toUtf8().data());
+}
// _NET_WM_VISIBLE_NAME
+QString LXCB::WM_Get_Visible_Name(WId win){
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_visible_name_unchecked(&EWMH, win);
+ xcb_ewmh_get_utf8_strings_reply_t reply;
+ QString out;
+ if(1==xcb_ewmh_get_wm_visible_name_reply(&EWMH, cookie,&reply, NULL) ){
+ out = QString::fromUtf8(reply.strings);
+ }
+ return out;
+}
+void LXCB::WM_Set_Visible_Name(WId win, QString txt){
+ xcb_ewmh_set_wm_visible_name(&EWMH, win, txt.length(), txt.toUtf8().data());
+}
// _NET_WM_ICON_NAME
+QString LXCB::WM_Get_Icon_Name(WId win){
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_icon_name_unchecked(&EWMH, win);
+ xcb_ewmh_get_utf8_strings_reply_t reply;
+ QString out;
+ if(1==xcb_ewmh_get_wm_icon_name_reply(&EWMH, cookie,&reply, NULL) ){
+ out = QString::fromUtf8(reply.strings);
+ }
+ return out;
+}
+void LXCB::WM_Set_Icon_Name(WId win, QString txt){
+ xcb_ewmh_set_wm_icon_name(&EWMH, win, txt.length(), txt.toUtf8().data());
+}
// _NET_WM_VISIBLE_ICON_NAME
+QString LXCB::WM_Get_Visible_Icon_Name(WId win){
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_visible_icon_name_unchecked(&EWMH, win);
+ xcb_ewmh_get_utf8_strings_reply_t reply;
+ QString out;
+ if(1==xcb_ewmh_get_wm_visible_icon_name_reply(&EWMH, cookie,&reply, NULL) ){
+ out = QString::fromUtf8(reply.strings);
+ }
+ return out;
+}
+void LXCB::WM_Set_Visible_Icon_Name(WId win, QString txt){
+ xcb_ewmh_set_wm_visible_icon_name(&EWMH, win, txt.length(), txt.toUtf8().data());
+}
// _NET_WM_DESKTOP
-
+int LXCB::WM_Get_Desktop(WId win){
+ //returns -1 if window on all desktops
+ xcb_get_property_cookie_t cookie = xcb_ewmh_get_wm_desktop_unchecked(&EWMH, win);
+ uint32_t num = 0;
+ int out = -1;
+ if(1==xcb_ewmh_get_wm_desktop_reply(&EWMH, cookie, &num, NULL) ){
+ if(num!=0xFFFFFFFF){ out = num; }
+ }else{
+ //Error in fetching property (not set?)
+ // - put it on the current screen
+ out = WM_Get_Current_Desktop();
+ }
+ return out;
+}
+
+void LXCB::WM_Set_Desktop(WId win, int num){
+ //use -1 to set it for all desktops
+ xcb_ewmh_set_wm_desktop(&EWMH, win, (num<0 ? 0xFFFFFFFF : qAbs(num) ) );
+}
+
// _NET_WM_WINDOW_TYPE
// _NET_WM_STATE
diff --git a/libLumina/LuminaX11.h b/libLumina/LuminaX11.h
index be1ea069..6ec8ca32 100644
--- a/libLumina/LuminaX11.h
+++ b/libLumina/LuminaX11.h
@@ -238,15 +238,27 @@ public:
// -- WINDOW PROPERTIES
// _NET_SUPPORTED
void WM_Set_Window_Supported(WId win); //set the atom list of supported features on the given window
+
// _NET_WM_NAME
+ QString WM_Get_Name(WId win);
+ void WM_Set_Name(WId win, QString txt);
// _NET_WM_VISIBLE_NAME
+ QString WM_Get_Visible_Name(WId win);
+ void WM_Set_Visible_Name(WId win, QString txt);
// _NET_WM_ICON_NAME
+ QString WM_Get_Icon_Name(WId win);
+ void WM_Set_Icon_Name(WId win, QString txt);
// _NET_WM_VISIBLE_ICON_NAME
+ QString WM_Get_Visible_Icon_Name(WId win);
+ void WM_Set_Visible_Icon_Name(WId win, QString txt);
// _NET_WM_DESKTOP
+ // Note: This refers to the virtual workspace, not the monitor/screen number
+ int WM_Get_Desktop(WId win); //returns -1 if window on all desktops
+ void WM_Set_Desktop(WId win, int num); //use -1 to set it for all desktops
// _NET_WM_WINDOW_TYPE
@@ -283,7 +295,7 @@ private:
void createWMAtoms(); //fill the private lists above
};
-//Now also declare the flags for Qt to use
+//Now also declare the flags for Qt to be able to use normal operations on them
Q_DECLARE_OPERATORS_FOR_FLAGS(LXCB::ICCCM_PROTOCOLS);
Q_DECLARE_OPERATORS_FOR_FLAGS(LXCB::MOVERESIZE_WINDOW_FLAGS);
bgstack15