feat(ags bar): improve hover state on hover revealers
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-04-23 22:26:13 -04:00
parent 731b85c948
commit 99545ac48e
4 changed files with 16 additions and 4 deletions

View file

@ -13,9 +13,9 @@ export default () => HoverRevealer({
}),
label: Label().hook(Audio, (self) => {
if (Audio.speaker?.volume) {
if (Audio.speaker.volume) {
self.label =
`${Math.round(Audio.speaker?.volume * 100)}%`;
`${Math.round(Audio.speaker.volume * 100)}%`;
}
}, 'speaker-changed'),
});

View file

@ -1,5 +1,7 @@
const { Box, Revealer } = Widget;
import Gtk from 'gi://Gtk?version=3.0';
import Separator from '../../misc/separator.ts';
import CursorBox from '../../misc/cursorbox.ts';
@ -12,6 +14,9 @@ export default ({
}) => {
const hoverRevLabel = Revealer({
transition: 'slide_right',
attribute: {
var: Variable(Box()),
},
child: Box({
@ -26,6 +31,7 @@ export default ({
const widget = CursorBox({
on_hover: () => {
hoverRevLabel.reveal_child = true;
hoverRevLabel.attribute.var.value.set_state_flags(Gtk.StateFlags.PRELIGHT, false);
},
child: Box({

View file

@ -28,7 +28,7 @@ export default () => {
Network(),
];
return CursorBox({
const widget = CursorBox({
class_name: 'toggle-off',
on_primary_click_release: (self) => {
@ -76,4 +76,10 @@ export default () => {
],
}),
});
widget.attribute.hoverRevealers.forEach((hv) => {
hv.attribute.var.setValue(widget);
});
return widget;
};

View file

@ -41,7 +41,7 @@ export default () => Box({
setup: (self) => {
self
.hook(Audio, () => {
self.value = Audio.speaker?.volume || 0;
self.value = Audio.speaker.volume || 0;
}, 'speaker-changed')
// OnClick