diff --git a/flake.nix b/flake.nix index 557eb41..17dbb08 100644 --- a/flake.nix +++ b/flake.nix @@ -49,7 +49,6 @@ pkgs.glib pkgs.bluez-tools pkgs.grimblast - pkgs.gpu-screen-recorder pkgs.brightnessctl pkgs.gnome-bluetooth (pkgs.python3.withPackages (python-pkgs: with python-pkgs; [ @@ -67,7 +66,7 @@ pkgs.gvfs pkgs.swww pkgs.pywal - ]; + ] ++ (nixpkgs.lib.optionals (system == "x86_64-linux") [pkgs.gpu-screen-recorder]); }; }); diff --git a/scripts/checkUpdates.sh b/scripts/checkUpdates.sh index 39bf6ec..ab36d3c 100755 --- a/scripts/checkUpdates.sh +++ b/scripts/checkUpdates.sh @@ -3,14 +3,19 @@ check_arch_updates() { official_updates=0 aur_updates=0 + if command -v paru &> /dev/null; then + aur_helper="paru" + else + aur_helper="yay" + fi if [ "$1" = "-y" ]; then - aur_updates=$(yay -Qum 2>/dev/null | wc -l) + aur_updates=$($aur_helper -Qum 2>/dev/null | wc -l) elif [ "$1" = "-p" ]; then official_updates=$(checkupdates 2>/dev/null | wc -l) else official_updates=$(checkupdates 2>/dev/null | wc -l) - aur_updates=$(yay -Qum 2>/dev/null | wc -l) + aur_updates=$($aur_helper -Qum 2>/dev/null | wc -l) fi total_updates=$((official_updates + aur_updates)) diff --git a/src/components/bar/modules/netstat/index.tsx b/src/components/bar/modules/netstat/index.tsx index 8a515e6..ae0f7f5 100644 --- a/src/components/bar/modules/netstat/index.tsx +++ b/src/components/bar/modules/netstat/index.tsx @@ -19,6 +19,8 @@ const { rateUnit, dynamicIcon, icon, + networkInLabel, + networkOutLabel, round, leftClick, rightClick, @@ -47,11 +49,11 @@ export const Netstat = (): BarBoxChild => { const renderNetworkLabel = (lblType: NetstatLabelType, networkService: NetworkResourceData): string => { switch (lblType) { case 'in': - return `↓ ${networkService.in}`; + return `${networkInLabel.get()} ${networkService.in}`; case 'out': - return `↑ ${networkService.out}`; + return `${networkOutLabel.get()} ${networkService.out}`; default: - return `↓ ${networkService.in} ↑ ${networkService.out}`; + return `${networkInLabel.get()} ${networkService.in} ${networkOutLabel.get()} ${networkService.out}`; } }; diff --git a/src/components/bar/modules/updates/index.tsx b/src/components/bar/modules/updates/index.tsx index 6887c17..c2460bf 100644 --- a/src/components/bar/modules/updates/index.tsx +++ b/src/components/bar/modules/updates/index.tsx @@ -10,6 +10,7 @@ const { updateCommand, label, padZero, + autoHide, pollingInterval, icon, leftClick, @@ -21,6 +22,7 @@ const { const pendingUpdates: Variable = Variable('0'); const postInputUpdater = Variable(true); +const isVis = Variable(!autoHide.get()); const processUpdateCount = (updateCount: string): string => { if (!padZero.get()) return updateCount; @@ -37,9 +39,14 @@ const updatesPoller = new BashPoller( updatesPoller.initialize('updates'); +Variable.derive([bind(autoHide)], (autoHideModule) => { + isVis.set(!autoHideModule || (autoHideModule && parseFloat(pendingUpdates.get()) > 0)); +}); + const updatesIcon = Variable.derive( [bind(icon.pending), bind(icon.updated), bind(pendingUpdates)], (pendingIcon, updatedIcon, pUpdates) => { + isVis.set(!autoHide.get() || (autoHide.get() && parseFloat(pUpdates) > 0)); return parseFloat(pUpdates) === 0 ? updatedIcon : pendingIcon; }, ); @@ -49,6 +56,7 @@ export const Updates = (): BarBoxChild => { textIcon: updatesIcon(), tooltipText: bind(pendingUpdates).as((v) => `${v} updates available`), boxClass: 'updates', + isVis: isVis, label: bind(pendingUpdates), showLabelBinding: bind(label), props: { diff --git a/src/components/bar/modules/workspaces/helpers/index.ts b/src/components/bar/modules/workspaces/helpers/index.ts index 8403117..fd20d2c 100644 --- a/src/components/bar/modules/workspaces/helpers/index.ts +++ b/src/components/bar/modules/workspaces/helpers/index.ts @@ -162,7 +162,7 @@ const navigateWorkspace = ( while (attempts < workspacesList.length) { const targetWS = workspacesList[newIndex]; if (!isWorkspaceIgnored(ignoredWorkspaces, targetWS)) { - hyprlandService.message_async(`dispatch workspace ${targetWS}`); + hyprlandService.dispatch('workspace', targetWS.toString()); return; } newIndex = (newIndex + step + workspacesList.length) % workspacesList.length; diff --git a/src/components/bar/modules/workspaces/index.tsx b/src/components/bar/modules/workspaces/index.tsx index 6940d8a..eeb7196 100644 --- a/src/components/bar/modules/workspaces/index.tsx +++ b/src/components/bar/modules/workspaces/index.tsx @@ -1,10 +1,11 @@ import options from 'src/options'; import { createThrottledScrollHandlers, getCurrentMonitorWorkspaces } from './helpers'; -import { BarBoxChild, SelfButton } from 'src/lib/types/bar'; +import { BarBoxChild } from 'src/lib/types/bar'; import { WorkspaceModule } from './workspaces'; import { bind, Variable } from 'astal'; import { GtkWidget } from 'src/lib/types/widget'; -import { Gdk } from 'astal/gtk3'; +import { Astal, Gdk } from 'astal/gtk3'; +import { isScrollDown, isScrollUp } from 'src/lib/utils'; const { workspaces, scroll_speed } = options.bar.workspaces; @@ -27,23 +28,27 @@ const Workspaces = (monitor = -1): BarBoxChild => { boxClass: 'workspaces', isBox: true, props: { - setup: (self: SelfButton): void => { + setup: (self: Astal.EventBox): void => { + let scrollHandlers: number; Variable.derive([bind(scroll_speed)], (scroll_speed) => { + if (scrollHandlers) { + self.disconnect(scrollHandlers); + } + const { throttledScrollUp, throttledScrollDown } = createThrottledScrollHandlers( scroll_speed, currentMonitorWorkspaces, ); - const scrollHandlers = self.connect('scroll-event', (_: GtkWidget, event: Gdk.Event) => { - const eventDirection = event.get_scroll_direction()[1]; - if (eventDirection === Gdk.ScrollDirection.UP) { - throttledScrollUp(); - } else if (eventDirection === Gdk.ScrollDirection.DOWN) { + scrollHandlers = self.connect('scroll-event', (_: GtkWidget, event: Gdk.Event) => { + if (isScrollUp(event)) { throttledScrollDown(); } - }); - self.disconnect(scrollHandlers); + if (isScrollDown(event)) { + throttledScrollUp(); + } + }); }); }, }, diff --git a/src/components/bar/settings/config.tsx b/src/components/bar/settings/config.tsx index e43fc37..931e46b 100644 --- a/src/components/bar/settings/config.tsx +++ b/src/components/bar/settings/config.tsx @@ -154,6 +154,12 @@ export const CustomModuleSettings = (): JSX.Element => { />