forked from Shinonome/dots-hyprland
better click area for right side of the bar
This commit is contained in:
@@ -38,6 +38,37 @@ export default () => {
|
|||||||
}
|
}
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
const SpaceRightDefaultClicks = (child) => Widget.EventBox({
|
||||||
|
onScrollUp: () => {
|
||||||
|
if (!Audio.speaker) return;
|
||||||
|
if (Audio.speaker.volume <= 0.09) Audio.speaker.volume += 0.01;
|
||||||
|
else Audio.speaker.volume += 0.03;
|
||||||
|
Indicator.popup(1);
|
||||||
|
},
|
||||||
|
onScrollDown: () => {
|
||||||
|
if (!Audio.speaker) return;
|
||||||
|
if (Audio.speaker.volume <= 0.09) Audio.speaker.volume -= 0.01;
|
||||||
|
else Audio.speaker.volume -= 0.03;
|
||||||
|
Indicator.popup(1);
|
||||||
|
},
|
||||||
|
onHover: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', true) },
|
||||||
|
onHoverLost: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', false) },
|
||||||
|
onPrimaryClick: () => App.toggleWindow('sideright'),
|
||||||
|
onSecondaryClick: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` &']).catch(print),
|
||||||
|
onMiddleClick: () => execAsync('playerctl play-pause').catch(print),
|
||||||
|
setup: (self) => self.on('button-press-event', (self, event) => {
|
||||||
|
if (event.get_button()[1] === 8)
|
||||||
|
execAsync('playerctl previous').catch(print)
|
||||||
|
}),
|
||||||
|
child: child,
|
||||||
|
});
|
||||||
|
const emptyArea = SpaceRightDefaultClicks(Widget.Box({ hexpand: true, })),
|
||||||
|
const indicatorArea = SpaceRightDefaultClicks(Widget.Box({
|
||||||
|
children: [
|
||||||
|
separatorDot,
|
||||||
|
barStatusIcons
|
||||||
|
],
|
||||||
|
}));
|
||||||
const actualContent = Widget.Box({
|
const actualContent = Widget.Box({
|
||||||
hexpand: true,
|
hexpand: true,
|
||||||
className: 'spacing-h-5 txt',
|
className: 'spacing-h-5 txt',
|
||||||
@@ -46,37 +77,9 @@ export default () => {
|
|||||||
hexpand: true,
|
hexpand: true,
|
||||||
className: 'spacing-h-5 txt',
|
className: 'spacing-h-5 txt',
|
||||||
children: [
|
children: [
|
||||||
Widget.Box({ hexpand: true, }),
|
emptyArea,
|
||||||
barTray,
|
barTray,
|
||||||
Widget.EventBox({
|
indicatorArea
|
||||||
onScrollUp: () => {
|
|
||||||
if (!Audio.speaker) return;
|
|
||||||
if (Audio.speaker.volume <= 0.09) Audio.speaker.volume += 0.01;
|
|
||||||
else Audio.speaker.volume += 0.03;
|
|
||||||
Indicator.popup(1);
|
|
||||||
},
|
|
||||||
onScrollDown: () => {
|
|
||||||
if (!Audio.speaker) return;
|
|
||||||
if (Audio.speaker.volume <= 0.09) Audio.speaker.volume -= 0.01;
|
|
||||||
else Audio.speaker.volume -= 0.03;
|
|
||||||
Indicator.popup(1);
|
|
||||||
},
|
|
||||||
onHover: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', true) },
|
|
||||||
onHoverLost: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', false) },
|
|
||||||
onPrimaryClick: () => App.toggleWindow('sideright'),
|
|
||||||
onSecondaryClick: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` &']).catch(print),
|
|
||||||
onMiddleClick: () => execAsync('playerctl play-pause').catch(print),
|
|
||||||
setup: (self) => self.on('button-press-event', (self, event) => {
|
|
||||||
if (event.get_button()[1] === 8)
|
|
||||||
execAsync('playerctl previous').catch(print)
|
|
||||||
}),
|
|
||||||
child: Widget.Box({
|
|
||||||
children: [
|
|
||||||
separatorDot,
|
|
||||||
barStatusIcons,
|
|
||||||
],
|
|
||||||
}),
|
|
||||||
}),
|
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user