ags(bar/status): remove bad volume sliders
they got removed because it was not easy to use, scrolling the volume is quicker
This commit is contained in:
@@ -16,12 +16,12 @@ export function Status(): Gtk.Widget {
|
|||||||
onClick: () => Windows.toggle("control-center"),
|
onClick: () => Windows.toggle("control-center"),
|
||||||
child: new Widget.Box({
|
child: new Widget.Box({
|
||||||
children: [
|
children: [
|
||||||
volumeStatusSlider({
|
volumeStatus({
|
||||||
className: "sink",
|
className: "sink",
|
||||||
endpoint: Wireplumber.getDefault().getDefaultSink(),
|
endpoint: Wireplumber.getDefault().getDefaultSink(),
|
||||||
icon: ""
|
icon: ""
|
||||||
}),
|
}),
|
||||||
volumeStatusSlider({
|
volumeStatus({
|
||||||
className: "source",
|
className: "source",
|
||||||
endpoint: Wireplumber.getDefault().getDefaultSource(),
|
endpoint: Wireplumber.getDefault().getDefaultSource(),
|
||||||
icon: ""
|
icon: ""
|
||||||
@@ -32,7 +32,7 @@ export function Status(): Gtk.Widget {
|
|||||||
} as Widget.EventBoxProps);
|
} as Widget.EventBoxProps);
|
||||||
}
|
}
|
||||||
|
|
||||||
function volumeStatusSlider(props: { className?: string, endpoint: AstalWp.Endpoint, icon: string }): Gtk.Widget {
|
function volumeStatus(props: { className?: string, endpoint: AstalWp.Endpoint, icon: string }): Gtk.Widget {
|
||||||
return new Widget.EventBox({
|
return new Widget.EventBox({
|
||||||
className: props.className,
|
className: props.className,
|
||||||
onScroll: (_, event) =>
|
onScroll: (_, event) =>
|
||||||
@@ -40,44 +40,19 @@ function volumeStatusSlider(props: { className?: string, endpoint: AstalWp.Endpo
|
|||||||
Wireplumber.getDefault().decreaseEndpointVolume(props.endpoint, 5)
|
Wireplumber.getDefault().decreaseEndpointVolume(props.endpoint, 5)
|
||||||
:
|
:
|
||||||
Wireplumber.getDefault().increaseEndpointVolume(props.endpoint, 5),
|
Wireplumber.getDefault().increaseEndpointVolume(props.endpoint, 5),
|
||||||
setup: (eventbox) => {
|
child: new Widget.Box({
|
||||||
const connections: Array<number> = [];
|
|
||||||
connections.push(eventbox.connect("destroy-event", () =>
|
|
||||||
connections.map(id => eventbox.disconnect(id))));
|
|
||||||
|
|
||||||
eventbox.add(new Widget.Box({
|
|
||||||
children: [
|
children: [
|
||||||
new Widget.Label({
|
new Widget.Label({
|
||||||
className: "nf",
|
className: "nf",
|
||||||
label: props.icon,
|
label: props.icon,
|
||||||
} as Widget.LabelProps),
|
} as Widget.LabelProps),
|
||||||
new Widget.Revealer({
|
|
||||||
revealChild: false,
|
|
||||||
transitionType: Gtk.RevealerTransitionType.SLIDE_RIGHT,
|
|
||||||
transitionDuration: 350,
|
|
||||||
setup: (revealer) => {
|
|
||||||
connections.push(
|
|
||||||
eventbox.connect("hover", () => revealer.revealChild = true),
|
|
||||||
eventbox.connect("hover-lost", () => revealer.revealChild = false));
|
|
||||||
|
|
||||||
revealer.add(new Widget.Slider({
|
|
||||||
className: "slider",
|
|
||||||
setup: (slider) => slider.set_value(Math.floor(props.endpoint.get_volume() * 100)),
|
|
||||||
onDragged: (slider) => props.endpoint.set_volume(slider.value / 100),
|
|
||||||
value: bind(props.endpoint, "volume").as((volume) =>
|
|
||||||
Math.floor(volume * 100)),
|
|
||||||
max: 100
|
|
||||||
} as Widget.SliderProps));
|
|
||||||
}
|
|
||||||
} as Widget.RevealerProps),
|
|
||||||
new Widget.Label({
|
new Widget.Label({
|
||||||
className: "volume",
|
className: "volume",
|
||||||
label: bind(props.endpoint, "volume").as((volume: number) =>
|
label: bind(props.endpoint, "volume").as((volume: number) =>
|
||||||
Math.floor(volume * 100) + "%")
|
Math.floor(volume * 100) + "%")
|
||||||
} as Widget.LabelProps),
|
} as Widget.LabelProps),
|
||||||
]
|
]
|
||||||
} as Widget.BoxProps))
|
} as Widget.BoxProps)
|
||||||
}
|
|
||||||
} as Widget.EventBoxProps)
|
} as Widget.EventBoxProps)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user