From b8120a6fef4792f216c3411f2556e7cc8b6e7f6b Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sun, 2 Jul 2023 21:03:44 -0400 Subject: [PATCH] feat: switch to blueberry for cleaner UI --- configs/hypr/main.conf | 2 +- nixos/cfg/extra-hardware.nix | 2 - nixos/cfg/packages.nix | 8 ++- nixos/configuration.nix | 3 +- nixos/home/packages.nix | 11 ++++ nixos/overlays/blueberry.nix | 10 +++ nixos/overlays/list.nix | 1 + nixos/overlays/patches/wayland.patch | 95 ++++++++++++++++++++++++++++ 8 files changed, 126 insertions(+), 6 deletions(-) create mode 100644 nixos/overlays/blueberry.nix create mode 100644 nixos/overlays/patches/wayland.patch diff --git a/configs/hypr/main.conf b/configs/hypr/main.conf index 6798849..46bf9ab 100644 --- a/configs/hypr/main.conf +++ b/configs/hypr/main.conf @@ -18,7 +18,7 @@ exec-once = $HOME/.config/lisgd/config & # Execute your favorite apps at launch exec-once = bash -c "sleep 3; nm-applet" -exec-once = bash -c "sleep 4; blueman-applet" +exec-once = bash -c "sleep 4; blueberry-tray" exec-once = bash -c "sleep 5; nextcloud --background" exec-once = bash -c "sleep 6; tutanota-desktop -a" exec-once = bash -c "sleep 7; GalaxyBudsClient /StartMinimized" diff --git a/nixos/cfg/extra-hardware.nix b/nixos/cfg/extra-hardware.nix index 526e09f..742be2d 100644 --- a/nixos/cfg/extra-hardware.nix +++ b/nixos/cfg/extra-hardware.nix @@ -6,8 +6,6 @@ powerOnBoot = true; }; - services.blueman.enable = true; - services.udev.extraRules = '' # give permanent path to keyboard XF86* binds SUBSYSTEMS=="input", ATTRS{id/product}=="0006", ATTRS{id/vendor}=="0000", SYMLINK += "video-bus" diff --git a/nixos/cfg/packages.nix b/nixos/cfg/packages.nix index 0b1b00d..d2f4a25 100644 --- a/nixos/cfg/packages.nix +++ b/nixos/cfg/packages.nix @@ -43,7 +43,13 @@ }; }; - xdg.portal.enable = true; + xdg.portal = { + enable = true; + wlr.enable = true; + extraPortals = [ + pkgs.xdg-desktop-portal-gtk + ]; + }; programs = { diff --git a/nixos/configuration.nix b/nixos/configuration.nix index a0936cd..8dd0c72 100644 --- a/nixos/configuration.nix +++ b/nixos/configuration.nix @@ -14,8 +14,7 @@ networking.networkmanager.wifi.backend = "iwd"; # Set your time zone. - #time.timeZone = "America/Montreal"; - time.timeZone = "Europe/Paris"; + time.timeZone = "America/Montreal"; # Select internationalisation properties. i18n.defaultLocale = "en_CA.UTF-8"; diff --git a/nixos/home/packages.nix b/nixos/home/packages.nix index 14ece66..e1d3832 100644 --- a/nixos/home/packages.nix +++ b/nixos/home/packages.nix @@ -1,11 +1,20 @@ { pkgs, ... }: { + home.shellAliases = { + rg = "rga"; + }; + programs = { btop = { enable = true; }; + ripgrep = { + enable = true; + package = pkgs.ripgrep-all; + }; + waybar = { enable = true; # https://discourse.nixos.org/t/how-to-use-waybar-hyprland/27638/6 @@ -61,6 +70,8 @@ '') swayosd + blueberry + libayatana-appindicator qt5.qtwayland qt6.qtwayland httrack diff --git a/nixos/overlays/blueberry.nix b/nixos/overlays/blueberry.nix new file mode 100644 index 0000000..a6dfd3a --- /dev/null +++ b/nixos/overlays/blueberry.nix @@ -0,0 +1,10 @@ +final: prev: { + blueberry = prev.blueberry.overrideAttrs (o: { + patches = (o.patches or [ ]) ++ [ + ./patches/wayland.patch + ]; + buildInputs = (o.buildInputs or [ ]) ++ [ + prev.libappindicator + ]; + }); +} diff --git a/nixos/overlays/list.nix b/nixos/overlays/list.nix index c014db8..fc89769 100644 --- a/nixos/overlays/list.nix +++ b/nixos/overlays/list.nix @@ -3,5 +3,6 @@ { nixpkgs.overlays = [ (import ./swayosd.nix) + (import ./blueberry.nix) ]; } diff --git a/nixos/overlays/patches/wayland.patch b/nixos/overlays/patches/wayland.patch new file mode 100644 index 0000000..54a27cf --- /dev/null +++ b/nixos/overlays/patches/wayland.patch @@ -0,0 +1,95 @@ +# https://github.com/linuxmint/blueberry/issues/120 +--- /usr/lib/blueberry/blueberry-tray.py.org 2021-12-13 01:02:56.923349069 -0800 ++++ /usr/lib/blueberry/blueberry-tray.py 2021-12-13 02:21:23.253300141 -0800 +@@ -5,8 +5,8 @@ + import gi + gi.require_version('Gtk', '3.0') + gi.require_version('GnomeBluetooth', '1.0') +-gi.require_version('XApp', '1.0') +-from gi.repository import Gtk, Gdk, GnomeBluetooth, Gio, XApp ++gi.require_version('AppIndicator3', '0.1') ++from gi.repository import AppIndicator3, Gtk, Gdk, GnomeBluetooth, Gio + import rfkillMagic + import setproctitle + import subprocess +@@ -53,12 +53,16 @@ + self.model.connect('row-deleted', self.update_icon_callback) + self.model.connect('row-inserted', self.update_icon_callback) + +- self.icon = XApp.StatusIcon() +- self.icon.set_name("blueberry") +- self.icon.set_tooltip_text(_("Bluetooth")) +- self.icon.connect("activate", self.on_statusicon_activated) +- self.icon.connect("button-release-event", self.on_statusicon_released) +- ++ self.paired_devices = {} ++ ++ self.icon = AppIndicator3.Indicator.new( ++ 'BlueBerry', ++ 'blueberry', ++ AppIndicator3.IndicatorCategory.SYSTEM_SERVICES ++ ) ++ self.icon.set_status(AppIndicator3.IndicatorStatus.ACTIVE) ++ self.icon.set_menu(self.build_menu()) ++ + self.update_icon_callback(None, None, None) + + def on_settings_changed_cb(self, setting, key, data=None): +@@ -71,21 +75,23 @@ + return + + if self.rfkill.hard_block or self.rfkill.soft_block: +- self.icon.set_icon_name(self.tray_disabled_icon) +- self.icon.set_tooltip_text(_("Bluetooth is disabled")) ++ self.icon.set_title(_("Bluetooth is disabled")) ++ self.icon.set_icon(self.tray_disabled_icon) ++ self.icon.set_menu(self.build_menu()) + else: +- self.icon.set_icon_name(self.tray_icon) ++ self.icon.set_icon(self.tray_icon) ++ self.icon.set_menu(self.build_menu()) + self.update_connected_state() + + def update_connected_state(self): + self.get_devices() + + if len(self.connected_devices) > 0: +- self.icon.set_icon_name(self.tray_active_icon) +- self.icon.set_tooltip_text(_("Bluetooth: Connected to %s") % (", ".join(self.connected_devices))) ++ self.icon.set_title(_("Bluetooth: Connected to %s") % (", ".join(self.connected_devices))) ++ self.icon.set_icon(self.tray_active_icon) + else: +- self.icon.set_icon_name(self.tray_icon) +- self.icon.set_tooltip_text(_("Bluetooth")) ++ self.icon.set_title(_("Bluetooth")) ++ self.icon.set_icon(self.tray_icon) + + def get_devices(self): + self.connected_devices = [] +@@ -117,13 +118,11 @@ + + iter = self.model.iter_next(iter) + +- def on_statusicon_activated(self, icon, button, time): +- if button == Gdk.BUTTON_PRIMARY: +- subprocess.Popen(["blueberry"]) ++ def start_blueberry(self, _ignored): ++ subprocess.Popen(["blueberry"]) + +- def on_statusicon_released(self, icon, x, y, button, time, position): +- if button == 3: ++ def build_menu(self): + menu = Gtk.Menu() + + if not self.rfkill.hard_block: + if self.rfkill.soft_block: +@@ -168,7 +170,7 @@ + menu.append(item) + + menu.show_all() +- icon.popup_menu(menu, x, y, button, time, position) ++ return menu + + def toggle_connect_cb(self, item, data = None): + proxy = self.paired_devices[data] +