Set menu options per window for taskbar

This commit is contained in:
Maxim Stewart 2020-02-17 13:46:52 -06:00
parent 2904e7817e
commit cee947167d
4 changed files with 35 additions and 9 deletions

View File

@ -2,7 +2,7 @@
Pytop is a Gtk + Python gui to have a custom desktop interface. Pytop is a Gtk + Python gui to have a custom desktop interface.
# Updates # Updates
convirted to using ffmpeg to generate thumbnail. Set taskbar menu option based on window options.
# Notes # Notes
```sudo apt-get install python3 wget steamcmd``` ```sudo apt-get install python3 wget steamcmd```
@ -10,5 +10,4 @@ convirted to using ffmpeg to generate thumbnail.
# TODO # TODO
<ul> <ul>
<li>Detect window title changes</li> <li>Detect window title changes</li>
<li>Set taskbar menu option based on window options.</li>
</ul> </ul>

Binary file not shown.

View File

@ -67,7 +67,6 @@
<property name="can_focus">True</property> <property name="can_focus">True</property>
<property name="margin">6</property> <property name="margin">6</property>
<property name="selection_mode">multiple</property> <property name="selection_mode">multiple</property>
<property name="item_width">72</property>
</object> </object>
</child> </child>
</object> </object>
@ -222,7 +221,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="alwaysOnTopToggle">
<property name="label" translatable="yes">Always On Top</property> <property name="label" translatable="yes">Always On Top</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@ -237,7 +236,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="alwaysBelowToggle">
<property name="label" translatable="yes">Always Below</property> <property name="label" translatable="yes">Always Below</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>
@ -252,7 +251,7 @@
</packing> </packing>
</child> </child>
<child> <child>
<object class="GtkCheckButton"> <object class="GtkCheckButton" id="alwaysOnVisableWorkspace">
<property name="label" translatable="yes">Always On Visible Workspace</property> <property name="label" translatable="yes">Always On Visible Workspace</property>
<property name="visible">True</property> <property name="visible">True</property>
<property name="can_focus">True</property> <property name="can_focus">True</property>

View File

@ -76,14 +76,42 @@ class TaskbarSignals:
def clickEvent(self, widget, e, window): def clickEvent(self, widget, e, window):
if e.type == gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.LEFT_BUTTON: if e.type == gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.LEFT_BUTTON:
if not window.is_minimized(): if window.is_minimized():
window.minimize()
else:
window.activate(1) window.activate(1)
else:
window.minimize()
if e.type == gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.RIGHT_BUTTON: if e.type == gdk.EventType.BUTTON_PRESS and e.button == MouseButtons.RIGHT_BUTTON:
self.window = window self.window = window
self.setTaskbarMenuStates()
self.taskbarMenu.show() self.taskbarMenu.show()
def setTaskbarMenuStates(self):
if not self.window.is_above(): # If above all windows
self.builder.get_object("alwaysOnTopToggle").set_active(False)
else:
self.builder.get_object("alwaysOnTopToggle").set_active(True)
if not self.window.is_below(): # If below all windows
self.builder.get_object("alwaysBelowToggle").set_active(False)
else:
self.builder.get_object("alwaysBelowToggle").set_active(True)
if not self.window.is_pinned(): # If visable on all workspaces
self.builder.get_object("alwaysOnVisableWorkspace").set_active(False)
else:
self.builder.get_object("alwaysOnVisableWorkspace").set_active(True)
if not self.window.is_sticky(): # If visable on all workspaces??
pass
else:
pass
if not self.window.is_active(): # If window has focus
pass
else:
pass
def hideTaskbarMenu(self, widget, eve): def hideTaskbarMenu(self, widget, eve):
widget.hide() widget.hide()