From fb1f13989c5c6b69ff04515d276b864bb842fb96 Mon Sep 17 00:00:00 2001 From: Ludovic Ortega Date: Mon, 23 Dec 2024 18:05:54 +0100 Subject: [PATCH 01/11] fix(nixos): wrap hyprpanel in a script --- flake.nix | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/flake.nix b/flake.nix index 681ac538e..4ef7b3da7 100644 --- a/flake.nix +++ b/flake.nix @@ -73,7 +73,13 @@ # Define .overlay to expose the package as pkgs.hyprpanel based on the system overlay = final: prev: { - hyprpanel = self.packages.${prev.stdenv.system}.default; + hyprpanel = prev.writeShellScriptBin "hyprpanel" '' + if [ "$#" -eq 0 ]; then + exec ${self.packages.${final.stdenv.system}.default}/bin/hyprpanel + else + exec ${astal.packages.${final.stdenv.system}.io}/bin/astal -i hyprpanel "$@" + fi + ''; }; }; } From af88c267f495bd77fd216632203c76aaece549f9 Mon Sep 17 00:00:00 2001 From: Jas Singh Date: Mon, 23 Dec 2024 14:03:01 -0800 Subject: [PATCH 02/11] Added the ability to adjust application specific audio levels. (#608) * Added a playback volume module in audio menu. * Finish playback source volume adjuster. --- .../bar/modules/window_title/helpers/title.ts | 19 +++-- .../bar/modules/workspaces/workspaces.tsx | 2 +- src/components/bar/settings/config.tsx | 78 ++++++++++++++++++- src/components/bar/settings/theme.tsx | 50 ++++++++++++ .../menus/audio/active/devices/index.tsx | 25 ++++++ src/components/menus/audio/active/index.tsx | 70 +++++++++++------ .../menus/audio/active/playbacks/index.tsx | 30 +++++++ .../active/{device => sliderItem}/Slider.tsx | 23 +++++- .../{device => sliderItem}/SliderIcon.tsx | 0 .../index.tsx => sliderItem/SliderItem.tsx} | 4 +- .../SliderPercentage.tsx | 0 src/components/menus/audio/index.tsx | 4 +- .../settings/pages/theme/bar/index.tsx | 71 +++++++++++++++++ src/options.ts | 3 + src/scss/style/menus/audiomenu.scss | 29 +++++++ src/scss/style/menus/bluetooth.scss | 2 +- src/scss/style/menus/menu.scss | 2 +- src/scss/style/menus/network.scss | 2 +- 18 files changed, 368 insertions(+), 46 deletions(-) create mode 100644 src/components/menus/audio/active/devices/index.tsx create mode 100644 src/components/menus/audio/active/playbacks/index.tsx rename src/components/menus/audio/active/{device => sliderItem}/Slider.tsx (53%) rename src/components/menus/audio/active/{device => sliderItem}/SliderIcon.tsx (100%) rename src/components/menus/audio/active/{device/index.tsx => sliderItem/SliderItem.tsx} (84%) rename src/components/menus/audio/active/{device => sliderItem}/SliderPercentage.tsx (100%) diff --git a/src/components/bar/modules/window_title/helpers/title.ts b/src/components/bar/modules/window_title/helpers/title.ts index 333b18ab4..4fdb6aea5 100644 --- a/src/components/bar/modules/window_title/helpers/title.ts +++ b/src/components/bar/modules/window_title/helpers/title.ts @@ -8,11 +8,11 @@ import AstalHyprland from 'gi://AstalHyprland?version=0.1'; * This function searches for a matching window title in the predefined `windowTitleMap` based on the class of the provided window. * If a match is found, it returns an object containing the icon and label for the window. If no match is found, it returns a default icon and label. * - * @param windowtitle The window object containing the class information. + * @param client The window object containing the class information. * * @returns An object containing the icon and label for the window. */ -export const getWindowMatch = (windowtitle: AstalHyprland.Client): Record => { +export const getWindowMatch = (client: AstalHyprland.Client): Record => { const windowTitleMap = [ // user provided values ...options.bar.windowtitle.title_map.get(), @@ -119,17 +119,17 @@ export const getWindowMatch = (windowtitle: AstalHyprland.Client): Record RegExp(wt[0]).test(windowtitle?.class.toLowerCase())); + const foundMatch = windowTitleMap.find((wt) => RegExp(wt[0]).test(client?.class.toLowerCase())); if (!foundMatch || foundMatch.length !== 3) { return { @@ -157,13 +157,12 @@ export const getWindowMatch = (windowtitle: AstalHyprland.Client): Record { - if (client === null) return getWindowMatch(client).label; - - if (useCustomTitle) return getWindowMatch(client).label; - if (useClassName) return client.class; + if (client === null || useCustomTitle) return getWindowMatch(client).label; const title = client.title; - // If the title is empty or only filled with spaces, fallback to the class name + + if (!title || useClassName) return client.class; + if (title.length === 0 || title.match(/^ *$/)) { return client.class; } diff --git a/src/components/bar/modules/workspaces/workspaces.tsx b/src/components/bar/modules/workspaces/workspaces.tsx index 65122d4ef..fa3f924cc 100644 --- a/src/components/bar/modules/workspaces/workspaces.tsx +++ b/src/components/bar/modules/workspaces/workspaces.tsx @@ -152,7 +152,7 @@ export const WorkspaceModule = ({ monitor }: WorkspaceModuleProps): JSX.Element self.toggleClassName('active', activeWorkspace === wsId); self.toggleClassName( 'occupied', - (hyprlandService.get_workspace(wsId)?.get_clients().length || 0) > 0, + (hyprlandService.get_workspace(wsId)?.get_clients()?.length || 0) > 0, ); }} /> diff --git a/src/components/bar/settings/config.tsx b/src/components/bar/settings/config.tsx index c3a940a2e..e43fc37fe 100644 --- a/src/components/bar/settings/config.tsx +++ b/src/components/bar/settings/config.tsx @@ -140,7 +140,10 @@ export const CustomModuleSettings = (): JSX.Element => {