-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #366 from nwg-piotr/submap
Add HyprlandSubmap module, improve SwayMode module
- Loading branch information
Showing
9 changed files
with
334 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,143 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- Generated with glade 3.40.0 --> | ||
<interface> | ||
<requires lib="gtk+" version="3.24"/> | ||
<object class="GtkFrame" id="frame"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="label-xalign">0.5</property> | ||
<property name="shadow-type">out</property> | ||
<child> | ||
<!-- n-columns=3 n-rows=4 --> | ||
<object class="GtkGrid" id="grid"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="margin-start">6</property> | ||
<property name="margin-end">6</property> | ||
<property name="margin-top">6</property> | ||
<property name="margin-bottom">6</property> | ||
<property name="row-spacing">10</property> | ||
<property name="column-spacing">10</property> | ||
<child> | ||
<object class="GtkEntry" id="css-name"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">True</property> | ||
<property name="placeholder-text" translatable="yes">executor-label</property> | ||
</object> | ||
<packing> | ||
<property name="left-attach">1</property> | ||
<property name="top-attach">1</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkLabel" id="lbl-css-name"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="halign">end</property> | ||
<property name="label" translatable="yes">CSS name:</property> | ||
</object> | ||
<packing> | ||
<property name="left-attach">0</property> | ||
<property name="top-attach">1</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkLabel" id="lbl-icon-size"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="halign">end</property> | ||
<property name="label" translatable="yes">Icon size:</property> | ||
</object> | ||
<packing> | ||
<property name="left-attach">0</property> | ||
<property name="top-attach">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkSpinButton" id="icon-size"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">True</property> | ||
</object> | ||
<packing> | ||
<property name="left-attach">1</property> | ||
<property name="top-attach">0</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkComboBoxText" id="angle"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<items> | ||
<item id="0.0" translatable="yes">0°</item> | ||
<item id="90.0" translatable="yes">90°</item> | ||
<item id="270.0" translatable="yes">270°</item> | ||
</items> | ||
</object> | ||
<packing> | ||
<property name="left-attach">1</property> | ||
<property name="top-attach">2</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkLabel" id="lbl-angle"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="halign">end</property> | ||
<property name="label" translatable="yes">Angle:</property> | ||
</object> | ||
<packing> | ||
<property name="left-attach">0</property> | ||
<property name="top-attach">2</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkCheckButton" id="show-icon"> | ||
<property name="label" translatable="yes">Show icon</property> | ||
<property name="name">all-outputs</property> | ||
<property name="visible">True</property> | ||
<property name="can-focus">True</property> | ||
<property name="receives-default">False</property> | ||
<property name="draw-indicator">True</property> | ||
</object> | ||
<packing> | ||
<property name="left-attach">0</property> | ||
<property name="top-attach">3</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<object class="GtkCheckButton" id="show-default"> | ||
<property name="label" translatable="yes">Show 'default'</property> | ||
<property name="name">all-outputs</property> | ||
<property name="visible">True</property> | ||
<property name="can-focus">True</property> | ||
<property name="receives-default">False</property> | ||
<property name="draw-indicator">True</property> | ||
</object> | ||
<packing> | ||
<property name="left-attach">1</property> | ||
<property name="top-attach">3</property> | ||
</packing> | ||
</child> | ||
<child> | ||
<placeholder/> | ||
</child> | ||
<child> | ||
<placeholder/> | ||
</child> | ||
<child> | ||
<placeholder/> | ||
</child> | ||
<child> | ||
<placeholder/> | ||
</child> | ||
</object> | ||
</child> | ||
<child type="label"> | ||
<object class="GtkLabel"> | ||
<property name="visible">True</property> | ||
<property name="can-focus">False</property> | ||
<property name="label" translatable="yes">Module: SwayMode</property> | ||
</object> | ||
</child> | ||
</object> | ||
</interface> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/usr/bin/env python3 | ||
|
||
from gi.repository import Gtk, GLib | ||
|
||
from nwg_panel.tools import check_key, update_image, hyprctl | ||
|
||
|
||
class HyprlandSubmap(Gtk.Box): | ||
def __init__(self, settings, icons_path=""): | ||
Gtk.Box.__init__(self, orientation=Gtk.Orientation.HORIZONTAL, spacing=0) | ||
self.settings = settings | ||
self.label = Gtk.Label.new("default") | ||
self.submap = "default" | ||
|
||
icon = Gtk.Image() | ||
|
||
defaults = { | ||
"show-default": False, | ||
"show-icon": True, | ||
"css-name": "executor-label", | ||
"icon-size": 16, | ||
"angle": 0.0 | ||
} | ||
for key in defaults: | ||
check_key(settings, key, defaults[key]) | ||
|
||
update_image(icon, "mode", self.settings["icon-size"], icons_path) | ||
|
||
if self.settings["css-name"]: | ||
self.set_property("name", self.settings["css-name"]) | ||
else: | ||
self.set_property("name", "executor-label") | ||
|
||
if settings["angle"] != 0.0: | ||
self.set_orientation(Gtk.Orientation.VERTICAL) | ||
self.label.set_angle(settings["angle"]) | ||
|
||
if settings["show-icon"]: | ||
self.pack_start(icon, False, False, 0) | ||
|
||
self.pack_start(self.label, False, False, 6) | ||
|
||
self.refresh() | ||
|
||
if self.submap == "default" and not self.settings["show-default"]: | ||
GLib.idle_add(self.hide, priority=GLib.PRIORITY_HIGH) | ||
|
||
def refresh(self): | ||
self.submap = hyprctl("submap").strip() | ||
self.label.set_text(self.submap) | ||
if self.submap != "default" or self.settings["show-default"]: | ||
self.show_all() | ||
else: | ||
self.hide() |
Oops, something went wrong.