forked from Shinonome/dots-hyprland
bar music control: bind side button, act immediately on click
This commit is contained in:
@@ -207,9 +207,13 @@ export default () => {
|
|||||||
return EventBox({
|
return EventBox({
|
||||||
onScrollUp: (self) => switchToRelativeWorkspace(self, -1),
|
onScrollUp: (self) => switchToRelativeWorkspace(self, -1),
|
||||||
onScrollDown: (self) => switchToRelativeWorkspace(self, +1),
|
onScrollDown: (self) => switchToRelativeWorkspace(self, +1),
|
||||||
onPrimaryClickRelease: () => showMusicControls.setValue(!showMusicControls.value),
|
onPrimaryClick: () => showMusicControls.setValue(!showMusicControls.value),
|
||||||
onSecondaryClickRelease: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` &']).catch(print),
|
onSecondaryClick: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` &']).catch(print),
|
||||||
onMiddleClickRelease: () => execAsync('playerctl play-pause').catch(print),
|
onMiddleClick: () => execAsync('playerctl play-pause').catch(print),
|
||||||
|
setup: (self) => self.on('button-press-event', (self, event) => {
|
||||||
|
if (event.get_button()[1] === 8) // Side button
|
||||||
|
execAsync('playerctl previous').catch(print)
|
||||||
|
}),
|
||||||
child: Box({
|
child: Box({
|
||||||
className: 'spacing-h-4',
|
className: 'spacing-h-4',
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
@@ -71,8 +71,12 @@ export default () => {
|
|||||||
onHover: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', true) },
|
onHover: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', true) },
|
||||||
onHoverLost: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', false) },
|
onHoverLost: () => { barStatusIcons.toggleClassName('bar-statusicons-hover', false) },
|
||||||
onPrimaryClick: () => App.toggleWindow('sideright'),
|
onPrimaryClick: () => App.toggleWindow('sideright'),
|
||||||
onSecondaryClickRelease: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` &']).catch(print),
|
onSecondaryClick: () => execAsync(['bash', '-c', 'playerctl next || playerctl position `bc <<< "100 * $(playerctl metadata mpris:length) / 1000000 / 100"` &']).catch(print),
|
||||||
onMiddleClickRelease: () => execAsync('playerctl play-pause').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({
|
child: Widget.Box({
|
||||||
homogeneous: false,
|
homogeneous: false,
|
||||||
children: [
|
children: [
|
||||||
|
|||||||
Reference in New Issue
Block a user