Skip to content

Commit

Permalink
More tweaks
Browse files Browse the repository at this point in the history
  • Loading branch information
elParaguayo committed Dec 20, 2023
1 parent 8768237 commit 1239ec1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
2-23-11-17: [BUGFIX] Prevent double hooks for Mpris2 widget
2023-12-20: [FEATURE] Add `IWD` widget
2023-11-17: [BUGFIX] Prevent double hooks for Mpris2 widget
2023-11-13: [BUGFIX] A neater fix for the `Visualiser` CPU bug
2023-11-13: [BUGFIX] Fix `fraction` KeyError in `UpowerWidget`
2023-11-13: [FEATURE] Add `invert` option to `Visualiser` to draw bars from top down
Expand Down
9 changes: 8 additions & 1 deletion qtile_extras/widget/iwd.py
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ class IWD(base._TextBox, base.MarginMixin, MenuMixin):
NB you cannot join 802.1x networks unless they have already been configured.
"""

_experimental = True

defaults = [
(
"interface",
Expand Down Expand Up @@ -283,6 +285,7 @@ def __init__(self, **config):
self.timer = None
self._setting_up = False
self.add_callbacks({"Button1": self.do_menu})
self._can_connect = False

def _configure(self, qtile, bar):
base._TextBox._configure(self, qtile, bar)
Expand Down Expand Up @@ -345,6 +348,7 @@ async def _register_agent(self):
proxy = await self.get_proxy("/net/connman/iwd")
self.manager = proxy.get_interface(IWD_MANAGER)
await self.manager.call_register_agent(path)
self._can_connect = True

async def _get_managed_objects(self):
"""
Expand Down Expand Up @@ -502,9 +506,12 @@ def connect(n):
task = create_task(n.connect())
task.add_done_callback(self.connect_response)

enabled = (self._can_connect and not network.type == "8021x") or network.known

item = PopupMenuItem(
f"{network.name} ({network.type})",
mouse_callbacks={"Button1": lambda n=network: connect(n)},
mouse_callbacks={"Button1": lambda n=network: connect(n)} if enabled else {},
enabled=enabled,
)
menu_items.append(item)

Expand Down

0 comments on commit 1239ec1

Please sign in to comment.