aboutsummaryrefslogtreecommitdiff
path: root/lumina-desktop/LWinInfo.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lumina-desktop/LWinInfo.cpp')
-rw-r--r--lumina-desktop/LWinInfo.cpp60
1 files changed, 60 insertions, 0 deletions
diff --git a/lumina-desktop/LWinInfo.cpp b/lumina-desktop/LWinInfo.cpp
new file mode 100644
index 00000000..227dc2d9
--- /dev/null
+++ b/lumina-desktop/LWinInfo.cpp
@@ -0,0 +1,60 @@
+//===========================================
+// Lumina-DE source code
+// Copyright (c) 2014, Ken Moore
+// Available under the 3-clause BSD license
+// See the LICENSE file for full details
+//===========================================
+#include "LWinInfo.h"
+
+#include <LuminaX11.h>
+
+#include "LSession.h"
+
+//Information Retrieval
+ // Don't cache these results because they can change regularly
+QString LWinInfo::text(){
+ qDebug() << "Window Visible Icon Name:" << window;
+ if(window==0){ return ""; }
+ QString nm = LSession::handle()->XCB->WindowVisibleIconName(window);
+ if(nm.isEmpty()){ qDebug() << " - Window Icon Name"; nm = LSession::handle()->XCB->WindowIconName(window); }
+ if(nm.isEmpty()){ qDebug() << " - Window Visible Name";nm = LSession::handle()->XCB->WindowVisibleName(window); }
+ if(nm.isEmpty()){ qDebug() << " - Window Name";nm = LSession::handle()->XCB->WindowName(window); }
+ return nm;
+}
+
+QIcon LWinInfo::icon(bool &noicon){
+ if(window==0){ noicon = true; return QIcon();}
+ qDebug() << "Check for Window Icon:" << window;
+ noicon = false;
+ QIcon ico = LX11::WindowIcon(window);
+ //Check for a null icon, and supply one if necessary
+ if(ico.isNull()){ qDebug() << " - Class Icon"; ico = LXDG::findIcon( this->Class().toLower(),""); }
+ if(ico.isNull()){qDebug() << " - Default Icon"; ico = LXDG::findIcon("preferences-system-windows",""); noicon=true;}
+ return ico;
+}
+
+QString LWinInfo::Class(){
+ qDebug() << "Window Class:" << window;
+ return LSession::handle()->XCB->WindowClass(window);
+}
+
+Lumina::STATES LWinInfo::status(){
+ if(window==0){ return Lumina::NOSHOW; }
+ LXCB::WINDOWSTATE ws = LSession::handle()->XCB->WindowState(window);
+ //LX11::WINDOWSTATE ws = LX11::GetWindowState(window);
+ Lumina::STATES state;
+ switch(ws){
+ case LXCB::VISIBLE:
+ state = Lumina::VISIBLE; break;
+ case LXCB::INVISIBLE:
+ state = Lumina::INVISIBLE; break;
+ case LXCB::ACTIVE:
+ state = Lumina::ACTIVE; break;
+ case LXCB::ATTENTION:
+ state = Lumina::NOTIFICATION; break;
+ default:
+ state = Lumina::NOSHOW;
+ }
+ //qDebug() << "Window State:" << ws << state;
+ return state;
+} \ No newline at end of file
bgstack15