aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/lumina-desktop-unified
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/lumina-desktop-unified')
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp22
-rw-r--r--src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h2
2 files changed, 24 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp
index 1b5512ff..143a3667 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.cpp
@@ -64,6 +64,17 @@ void DesktopContextMenu::UpdateMenu(bool fast){
this->addAction(LXDG::findIcon("system-log-out",""), tr("Leave"), this, SIGNAL(showLeaveDialog()) );
}
+// === PRIVATE ===
+void DesktopContextMenu::AddWindowToMenu(NativeWindow *win){
+ QString label = win->property(NativeWindow::ShortTitle).toString();
+ if(label.isEmpty()){ label = win->property(NativeWindow::Title).toString(); }
+ if(label.isEmpty()){ label = win->property(NativeWindow::Name).toString(); }
+ QAction *tmp = winMenu->addAction( win->property(NativeWindow::Icon).value<QIcon>(), label, win, SLOT(toggleVisibility()) );
+ //Need to change the visual somehow to indicate whether it is visible or not
+ //bool visible = win->property(NativeWindow::Visible).toBool();
+ // TODO
+}
+
// === PUBLIC ===
DesktopContextMenu::DesktopContextMenu(QWidget *parent) : QMenu(parent){
if(parent!=0){
@@ -150,4 +161,15 @@ void DesktopContextMenu::updateWinMenu(){
winMenu = new QMenu(this);
winMenu->setTitle( tr("Task Manager") );
}
+ winMenu->clear();
+ QList<NativeWindow*> wins = Lumina::NWS->currentWindows();
+ unsigned int wkspace = Lumina::NWS->currentWorkspace();
+ for(int i=0; i<wins.length(); i++){
+ //First check if this window is in the current workspace (or is "sticky")
+ if(wins.at(i)->property(NativeWindow::Workspace).toUInt() != wkspace
+ && wins.at(i)->property(NativeWindow::States).value< QList<NativeWindow::State> >().contains(NativeWindow::S_STICKY) ){
+ continue;
+ }
+ AddWindowToMenu(wins.at(i));
+ }
}
diff --git a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h
index ee6fdcc9..78756e8c 100644
--- a/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h
+++ b/src-qt5/core/lumina-desktop-unified/src-desktop/ContextMenu.h
@@ -21,6 +21,8 @@ private:
QMenu *appMenu, *winMenu;
bool usewinmenu;
+ void AddWindowToMenu(NativeWindow*);
+
public:
DesktopContextMenu(QWidget *parent = 0);
~DesktopContextMenu();
bgstack15