diff --git a/README.md b/README.md index 98a716b4..185b158d 100644 --- a/README.md +++ b/README.md @@ -40,7 +40,9 @@ ttf-font-awesome, otf-font-awesome, ttf-material-symbols-variable-git, ttf-googl # ToDo -- [ ] Add wifi, bluetooth, shrunner widget +- [x] Add bluetooth widget +- [ ] Add shrunner widget +- [ ] Add wifi widget - [ ] Dashboard - [ ] Notification panel - [ ] Better css diff --git a/config/quickbar/modules/launcher/launcher.py b/config/quickbar/modules/launcher/launcher.py index 72ddd180..e1bc7739 100644 --- a/config/quickbar/modules/launcher/launcher.py +++ b/config/quickbar/modules/launcher/launcher.py @@ -6,6 +6,7 @@ from fabric.widgets.wayland import WaylandWindow as Window from gi.repository import Gdk, GLib from modules.launcher.widgets import ( AppLauncher, + BluetoothManager, Cliphist, Emoji, PowerMenu, @@ -29,11 +30,13 @@ class Launcher(Window): self.emoji = Emoji() self.cliphist = Cliphist() self.todo = TodoManager() + self.bluetooth = BluetoothManager() # Initialize viewports as None self._emoji_viewport = None self._cliphist_viewport = None self._todo_viewport = None + self._bluetooth_viewport = None self.stack = Stack( name="launcher-content", @@ -48,6 +51,7 @@ class Launcher(Window): self.emoji, self.cliphist, self.todo, + self.bluetooth, ], ) @@ -89,6 +93,8 @@ class Launcher(Window): def close(self): self.set_keyboard_mode("none") self.hide() + if self.bluetooth.is_active: + self.bluetooth.stop_device_polling() for widget in [ self.launcher, @@ -97,6 +103,7 @@ class Launcher(Window): self.emoji, self.cliphist, self.todo, + self.bluetooth, ]: widget.remove_style_class("open") @@ -120,6 +127,9 @@ class Launcher(Window): if widget == self.todo and hasattr(widget, "viewport") and widget.viewport: widget.viewport.hide() + if widget == self.bluetooth and widget.viewport: + widget.viewport.children = [] + style_classes = [ "launcher", "wallpapers", @@ -127,6 +137,7 @@ class Launcher(Window): "emoji", "cliphist", "todo", + "bluetooth", ] for style_class in style_classes: if self.stack.get_style_context().has_class(style_class): @@ -145,6 +156,7 @@ class Launcher(Window): "emoji": self.emoji, "cliphist": self.cliphist, "todo": self.todo, + "bluetooth": self.bluetooth, } style_classes = list(widgets.keys()) @@ -193,6 +205,11 @@ class Launcher(Window): self.todo.todo_entry.set_text("") self.todo.todo_entry.grab_focus() + elif widget == "bluetooth": + self.bluetooth.open_launcher() + self.bluetooth.search_entry.set_text("") + self.bluetooth.search_entry.grab_focus() + else: if hasattr(self.wallpapers, "viewport"): self.wallpapers.viewport.hide() diff --git a/config/quickbar/styles/launcher/bluetooth.css b/config/quickbar/styles/launcher/bluetooth.css index e69de29b..032e880b 100644 --- a/config/quickbar/styles/launcher/bluetooth.css +++ b/config/quickbar/styles/launcher/bluetooth.css @@ -0,0 +1,10 @@ +#device-slot { + background-color: @suraceVariant; + border-radius: 5px; + padding: 8px; +} + +#device-slot:hover, +#device-slot:focus { + background-color: mix(@onSurface, @surface, 0.92); +} diff --git a/config/quickbar/styles/main.css b/config/quickbar/styles/main.css index 6f869569..d41d8a2c 100644 --- a/config/quickbar/styles/main.css +++ b/config/quickbar/styles/main.css @@ -9,6 +9,7 @@ @import "./launcher/todo.css"; @import "./launcher/emoji.css"; @import "./launcher/cliphist.css"; +@import "./launcher/bluetooth.css"; * { all: unset;