Skip to content

Commit ea15ce5

Browse files
authored
Merge branch 'master' into master
2 parents b6ca883 + f26ea6c commit ea15ce5

File tree

23 files changed

+188
-78
lines changed

23 files changed

+188
-78
lines changed

flake.nix

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
pkgs.glib
5050
pkgs.bluez-tools
5151
pkgs.grimblast
52-
pkgs.gpu-screen-recorder
5352
pkgs.brightnessctl
5453
pkgs.gnome-bluetooth
5554
(pkgs.python3.withPackages (python-pkgs: with python-pkgs; [
@@ -67,7 +66,7 @@
6766
pkgs.gvfs
6867
pkgs.swww
6968
pkgs.pywal
70-
];
69+
] ++ (nixpkgs.lib.optionals (system == "x86_64-linux") [pkgs.gpu-screen-recorder]);
7170
};
7271
});
7372

scripts/checkUpdates.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@
33
check_arch_updates() {
44
official_updates=0
55
aur_updates=0
6+
if command -v paru &> /dev/null; then
7+
aur_helper="paru"
8+
else
9+
aur_helper="yay"
10+
fi
611

712
if [ "$1" = "-y" ]; then
8-
aur_updates=$(yay -Qum 2>/dev/null | wc -l)
13+
aur_updates=$($aur_helper -Qum 2>/dev/null | wc -l)
914
elif [ "$1" = "-p" ]; then
1015
official_updates=$(checkupdates 2>/dev/null | wc -l)
1116
else
1217
official_updates=$(checkupdates 2>/dev/null | wc -l)
13-
aur_updates=$(yay -Qum 2>/dev/null | wc -l)
18+
aur_updates=$($aur_helper -Qum 2>/dev/null | wc -l)
1419
fi
1520

1621
total_updates=$((official_updates + aur_updates))

src/components/bar/modules/netstat/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ const {
1919
rateUnit,
2020
dynamicIcon,
2121
icon,
22+
networkInLabel,
23+
networkOutLabel,
2224
round,
2325
leftClick,
2426
rightClick,
@@ -47,11 +49,11 @@ export const Netstat = (): BarBoxChild => {
4749
const renderNetworkLabel = (lblType: NetstatLabelType, networkService: NetworkResourceData): string => {
4850
switch (lblType) {
4951
case 'in':
50-
return ` ${networkService.in}`;
52+
return `${networkInLabel.get()} ${networkService.in}`;
5153
case 'out':
52-
return ` ${networkService.out}`;
54+
return `${networkOutLabel.get()} ${networkService.out}`;
5355
default:
54-
return ` ${networkService.in} ${networkService.out}`;
56+
return `${networkInLabel.get()} ${networkService.in} ${networkOutLabel.get()} ${networkService.out}`;
5557
}
5658
};
5759

src/components/bar/modules/updates/index.tsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ const {
1010
updateCommand,
1111
label,
1212
padZero,
13+
autoHide,
1314
pollingInterval,
1415
icon,
1516
leftClick,
@@ -21,6 +22,7 @@ const {
2122

2223
const pendingUpdates: Variable<string> = Variable('0');
2324
const postInputUpdater = Variable(true);
25+
const isVis = Variable(!autoHide.get());
2426

2527
const processUpdateCount = (updateCount: string): string => {
2628
if (!padZero.get()) return updateCount;
@@ -37,9 +39,14 @@ const updatesPoller = new BashPoller<string, []>(
3739

3840
updatesPoller.initialize('updates');
3941

42+
Variable.derive([bind(autoHide)], (autoHideModule) => {
43+
isVis.set(!autoHideModule || (autoHideModule && parseFloat(pendingUpdates.get()) > 0));
44+
});
45+
4046
const updatesIcon = Variable.derive(
4147
[bind(icon.pending), bind(icon.updated), bind(pendingUpdates)],
4248
(pendingIcon, updatedIcon, pUpdates) => {
49+
isVis.set(!autoHide.get() || (autoHide.get() && parseFloat(pUpdates) > 0));
4350
return parseFloat(pUpdates) === 0 ? updatedIcon : pendingIcon;
4451
},
4552
);
@@ -49,6 +56,7 @@ export const Updates = (): BarBoxChild => {
4956
textIcon: updatesIcon(),
5057
tooltipText: bind(pendingUpdates).as((v) => `${v} updates available`),
5158
boxClass: 'updates',
59+
isVis: isVis,
5260
label: bind(pendingUpdates),
5361
showLabelBinding: bind(label),
5462
props: {

src/components/bar/modules/workspaces/helpers/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ const navigateWorkspace = (
162162
while (attempts < workspacesList.length) {
163163
const targetWS = workspacesList[newIndex];
164164
if (!isWorkspaceIgnored(ignoredWorkspaces, targetWS)) {
165-
hyprlandService.message_async(`dispatch workspace ${targetWS}`);
165+
hyprlandService.dispatch('workspace', targetWS.toString());
166166
return;
167167
}
168168
newIndex = (newIndex + step + workspacesList.length) % workspacesList.length;

src/components/bar/modules/workspaces/index.tsx

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import options from 'src/options';
22
import { createThrottledScrollHandlers, getCurrentMonitorWorkspaces } from './helpers';
3-
import { BarBoxChild, SelfButton } from 'src/lib/types/bar';
3+
import { BarBoxChild } from 'src/lib/types/bar';
44
import { WorkspaceModule } from './workspaces';
55
import { bind, Variable } from 'astal';
66
import { GtkWidget } from 'src/lib/types/widget';
7-
import { Gdk } from 'astal/gtk3';
7+
import { Astal, Gdk } from 'astal/gtk3';
8+
import { isScrollDown, isScrollUp } from 'src/lib/utils';
89

910
const { workspaces, scroll_speed } = options.bar.workspaces;
1011

@@ -27,23 +28,27 @@ const Workspaces = (monitor = -1): BarBoxChild => {
2728
boxClass: 'workspaces',
2829
isBox: true,
2930
props: {
30-
setup: (self: SelfButton): void => {
31+
setup: (self: Astal.EventBox): void => {
32+
let scrollHandlers: number;
3133
Variable.derive([bind(scroll_speed)], (scroll_speed) => {
34+
if (scrollHandlers) {
35+
self.disconnect(scrollHandlers);
36+
}
37+
3238
const { throttledScrollUp, throttledScrollDown } = createThrottledScrollHandlers(
3339
scroll_speed,
3440
currentMonitorWorkspaces,
3541
);
3642

37-
const scrollHandlers = self.connect('scroll-event', (_: GtkWidget, event: Gdk.Event) => {
38-
const eventDirection = event.get_scroll_direction()[1];
39-
if (eventDirection === Gdk.ScrollDirection.UP) {
40-
throttledScrollUp();
41-
} else if (eventDirection === Gdk.ScrollDirection.DOWN) {
43+
scrollHandlers = self.connect('scroll-event', (_: GtkWidget, event: Gdk.Event) => {
44+
if (isScrollUp(event)) {
4245
throttledScrollDown();
4346
}
44-
});
4547

46-
self.disconnect(scrollHandlers);
48+
if (isScrollDown(event)) {
49+
throttledScrollUp();
50+
}
51+
});
4752
});
4853
},
4954
},

src/components/bar/settings/config.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,12 @@ export const CustomModuleSettings = (): JSX.Element => {
154154
/>
155155
<Option opt={options.bar.customModules.netstat.icon} title="Netstat Icon" type="string" />
156156
<Option opt={options.bar.customModules.netstat.label} title="Show Label" type="boolean" />
157+
<Option opt={options.bar.customModules.netstat.networkInLabel} title="Network In Label" type="string" />
158+
<Option
159+
opt={options.bar.customModules.netstat.networkOutLabel}
160+
title="Network Out Label"
161+
type="string"
162+
/>
157163
<Option
158164
opt={options.bar.customModules.netstat.rateUnit}
159165
title="Rate Unit"
@@ -170,7 +176,7 @@ export const CustomModuleSettings = (): JSX.Element => {
170176
<Option opt={options.bar.customModules.netstat.round} title="Round" type="boolean" />
171177
<Option
172178
opt={options.bar.customModules.netstat.pollingInterval}
173-
title="Polling Interval"
179+
title="Polling Interval (ms)"
174180
type="number"
175181
min={100}
176182
max={60 * 24 * 1000}
@@ -221,6 +227,12 @@ export const CustomModuleSettings = (): JSX.Element => {
221227
/>
222228
<Option opt={options.bar.customModules.updates.icon.updated} title="No Updates Icon" type="string" />
223229
<Option opt={options.bar.customModules.updates.label} title="Show Label" type="boolean" />
230+
<Option
231+
opt={options.bar.customModules.updates.autoHide}
232+
title="Auto Hide"
233+
subtitle="Hides module when no updates are available."
234+
type="boolean"
235+
/>
224236
<Option opt={options.bar.customModules.updates.padZero} title="Pad with 0" type="boolean" />
225237
<Option opt={options.theme.bar.buttons.modules.updates.spacing} title="Spacing" type="string" />
226238
<Option

src/components/bar/shared/Module.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export const Module = ({
1414
label,
1515
tooltipText,
1616
boxClass,
17+
isVis,
1718
props = {},
1819
showLabelBinding = bind(undefinedVar),
1920
showLabel,
@@ -86,7 +87,7 @@ export const Module = ({
8687
return {
8788
component,
8889
tooltip_text: tooltipText,
89-
isVisible: true,
90+
isVis: isVis,
9091
boxClass,
9192
props,
9293
};

src/components/bar/shared/WidgetContainer.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,9 @@ export const WidgetContainer = (child: BarBoxChild): JSX.Element => {
2626

2727
if (child.isBox) {
2828
return (
29-
<box className={buttonClassName} visible={computeVisible(child)}>
30-
{child.component}
31-
</box>
29+
<eventbox visible={computeVisible(child)} {...child.props}>
30+
<box className={buttonClassName}>{child.component}</box>
31+
</eventbox>
3232
);
3333
}
3434

src/components/menus/audio/active/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const Header = (): JSX.Element => (
1616
<box className={'menu-label-container volume selected'} halign={Gtk.Align.FILL}>
1717
<label className={'menu-label audio volume'} halign={Gtk.Align.START} hexpand label={'Volume'} />
1818
<button
19-
className={'menu-label slider-toggle'}
19+
className={'menu-icon-button menu-label slider-toggle volume'}
2020
onClick={(_, event) => {
2121
if (!isPrimaryClick(event)) {
2222
return;

src/components/menus/audio/active/sliderItem/Slider.tsx

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { bind } from 'astal';
22
import { Gdk, Gtk } from 'astal/gtk3';
33
import AstalWp from 'gi://AstalWp?version=0.1';
4-
import { capitalizeFirstLetter } from 'src/lib/utils';
4+
import { capitalizeFirstLetter, isScrollDown, isScrollUp } from 'src/lib/utils';
55
import options from 'src/options';
66

77
const { raiseMaximumVolume } = options.menus.volume;
@@ -34,16 +34,15 @@ export const Slider = ({ device, type }: SliderProps): JSX.Element => {
3434
}}
3535
setup={(self) => {
3636
self.connect('scroll-event', (_, event: Gdk.Event) => {
37-
const [directionSuccess, direction] = event.get_scroll_direction();
38-
const [deltasSuccess, , yScroll] = event.get_scroll_deltas();
39-
40-
if (directionSuccess) {
41-
const newVolume = device.volume + (direction === Gdk.ScrollDirection.DOWN ? 0.05 : -0.05);
42-
device.set_volume(Math.min(newVolume, 1));
43-
} else if (deltasSuccess) {
44-
const newVolume = device.volume - yScroll / 100;
37+
if (isScrollUp(event)) {
38+
const newVolume = device.volume + 0.05;
4539
device.set_volume(Math.min(newVolume, 1));
4640
}
41+
42+
if (isScrollDown(event)) {
43+
const newVolume = device.volume - 0.05;
44+
device.set_volume(newVolume);
45+
}
4746
});
4847
}}
4948
/>

src/components/menus/bluetooth/header/Controls/DiscoverButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { isDiscovering } from './helper';
66

77
export const DiscoverButton = (): JSX.Element => (
88
<button
9-
className="menu-icon-button search"
9+
className="menu-icon-button search bluetooth"
1010
valign={Gtk.Align.CENTER}
1111
onClick={(_, self) => {
1212
if (!isPrimaryClick(self)) {

src/components/menus/dashboard/profile/Profile.tsx

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { bind, exec } from 'astal';
2-
import GdkPixbuf from 'gi://GdkPixbuf';
32
import { Gtk } from 'astal/gtk3';
43
import options from 'src/options.js';
4+
import { normalizePath, isAnImage } from 'src/lib/utils.js';
55

66
const { image, name } = options.menus.dashboard.powermenu.avatar;
77

@@ -11,12 +11,11 @@ const ProfilePicture = (): JSX.Element => {
1111
className={'profile-picture'}
1212
halign={Gtk.Align.CENTER}
1313
css={bind(image).as((img) => {
14-
try {
15-
GdkPixbuf.Pixbuf.new_from_file(img);
16-
return `background-image: url("${img}")`;
17-
} catch {
18-
return `background-image: url("${SRC_DIR}/assets/hyprpanel.png")`;
14+
if (isAnImage(img)) {
15+
return `background-image: url("${normalizePath(img)}")`;
1916
}
17+
18+
return `background-image: url("${SRC_DIR}/assets/hyprpanel.png")`;
2019
})}
2120
/>
2221
);

src/components/menus/dashboard/shortcuts/buttons/ShortcutButtons.tsx

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,60 @@ const ShortcutButton = ({ shortcut, ...props }: ShortcutButtonProps): JSX.Elemen
2424
};
2525

2626
export const LeftShortcut1 = (): JSX.Element => {
27+
if (!hasCommand(left.shortcut1)) {
28+
return <box />;
29+
}
30+
2731
return (
2832
<ShortcutButton
2933
shortcut={left.shortcut1}
30-
className={`dashboard-button top-button ${hasCommand(left.shortcut1) ? 'paired' : ''}`}
34+
className={`dashboard-button top-button ${hasCommand(left.shortcut2) ? 'paired' : ''}`}
3135
/>
3236
);
3337
};
3438

3539
export const LeftShortcut2 = (): JSX.Element => {
40+
if (!hasCommand(left.shortcut2)) {
41+
return <box />;
42+
}
43+
3644
return <ShortcutButton shortcut={left.shortcut2} className={`dashboard-button`} />;
3745
};
3846

3947
export const LeftShortcut3 = (): JSX.Element => {
48+
if (!hasCommand(left.shortcut3)) {
49+
return <box />;
50+
}
51+
4052
return (
4153
<ShortcutButton
4254
shortcut={left.shortcut3}
43-
className={`dashboard-button top-button ${hasCommand(left.shortcut3) ? 'paired' : ''}`}
55+
className={`dashboard-button top-button ${hasCommand(left.shortcut4) ? 'paired' : ''}`}
4456
/>
4557
);
4658
};
4759

4860
export const LeftShortcut4 = (): JSX.Element => {
61+
if (!hasCommand(left.shortcut4)) {
62+
return <box />;
63+
}
64+
4965
return <ShortcutButton shortcut={left.shortcut4} className={`dashboard-button `} />;
5066
};
5167

5268
export const RightShortcut1 = (): JSX.Element => {
69+
if (!hasCommand(right.shortcut1)) {
70+
return <box />;
71+
}
72+
5373
return <ShortcutButton shortcut={right.shortcut1} className={`dashboard-button top-button paired`} />;
5474
};
5575

5676
export const RightShortcut3 = (): JSX.Element => {
77+
if (!hasCommand(right.shortcut3)) {
78+
return <box />;
79+
}
80+
5781
return <ShortcutButton shortcut={right.shortcut3} className={`dashboard-button top-button paired`} />;
5882
};
5983

src/components/menus/dashboard/shortcuts/sections/Column.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
import { BindableChild } from 'astal/gtk3/astalify';
22

3-
export const LeftColumn = ({ visibleClass, children }: LeftColumnProps): JSX.Element => {
3+
export const LeftColumn = ({ isVisible, children }: LeftColumnProps): JSX.Element => {
44
return (
5-
<box className={`card-button-section-container ${visibleClass ? 'visible' : ''}`}>
6-
{visibleClass ? (
5+
<box className={`card-button-section-container ${isVisible ? 'visible' : ''}`}>
6+
{isVisible ? (
77
<box vertical hexpand vexpand>
88
{children}
99
</box>
@@ -25,7 +25,7 @@ export const RightColumn = ({ children }: RightColumnProps): JSX.Element => {
2525
};
2626

2727
interface LeftColumnProps {
28-
visibleClass?: boolean;
28+
isVisible?: boolean;
2929
children?: BindableChild | BindableChild[];
3030
}
3131

0 commit comments

Comments
 (0)