feat(ags bar): improve hover state on hover revealers
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
731b85c948
commit
99545ac48e
4 changed files with 16 additions and 4 deletions
|
@ -13,9 +13,9 @@ export default () => HoverRevealer({
|
||||||
}),
|
}),
|
||||||
|
|
||||||
label: Label().hook(Audio, (self) => {
|
label: Label().hook(Audio, (self) => {
|
||||||
if (Audio.speaker?.volume) {
|
if (Audio.speaker.volume) {
|
||||||
self.label =
|
self.label =
|
||||||
`${Math.round(Audio.speaker?.volume * 100)}%`;
|
`${Math.round(Audio.speaker.volume * 100)}%`;
|
||||||
}
|
}
|
||||||
}, 'speaker-changed'),
|
}, 'speaker-changed'),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
const { Box, Revealer } = Widget;
|
const { Box, Revealer } = Widget;
|
||||||
|
|
||||||
|
import Gtk from 'gi://Gtk?version=3.0';
|
||||||
|
|
||||||
import Separator from '../../misc/separator.ts';
|
import Separator from '../../misc/separator.ts';
|
||||||
import CursorBox from '../../misc/cursorbox.ts';
|
import CursorBox from '../../misc/cursorbox.ts';
|
||||||
|
|
||||||
|
@ -12,6 +14,9 @@ export default ({
|
||||||
}) => {
|
}) => {
|
||||||
const hoverRevLabel = Revealer({
|
const hoverRevLabel = Revealer({
|
||||||
transition: 'slide_right',
|
transition: 'slide_right',
|
||||||
|
attribute: {
|
||||||
|
var: Variable(Box()),
|
||||||
|
},
|
||||||
|
|
||||||
child: Box({
|
child: Box({
|
||||||
|
|
||||||
|
@ -26,6 +31,7 @@ export default ({
|
||||||
const widget = CursorBox({
|
const widget = CursorBox({
|
||||||
on_hover: () => {
|
on_hover: () => {
|
||||||
hoverRevLabel.reveal_child = true;
|
hoverRevLabel.reveal_child = true;
|
||||||
|
hoverRevLabel.attribute.var.value.set_state_flags(Gtk.StateFlags.PRELIGHT, false);
|
||||||
},
|
},
|
||||||
|
|
||||||
child: Box({
|
child: Box({
|
||||||
|
|
|
@ -28,7 +28,7 @@ export default () => {
|
||||||
Network(),
|
Network(),
|
||||||
];
|
];
|
||||||
|
|
||||||
return CursorBox({
|
const widget = CursorBox({
|
||||||
class_name: 'toggle-off',
|
class_name: 'toggle-off',
|
||||||
|
|
||||||
on_primary_click_release: (self) => {
|
on_primary_click_release: (self) => {
|
||||||
|
@ -76,4 +76,10 @@ export default () => {
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
widget.attribute.hoverRevealers.forEach((hv) => {
|
||||||
|
hv.attribute.var.setValue(widget);
|
||||||
|
});
|
||||||
|
|
||||||
|
return widget;
|
||||||
};
|
};
|
||||||
|
|
|
@ -41,7 +41,7 @@ export default () => Box({
|
||||||
setup: (self) => {
|
setup: (self) => {
|
||||||
self
|
self
|
||||||
.hook(Audio, () => {
|
.hook(Audio, () => {
|
||||||
self.value = Audio.speaker?.volume || 0;
|
self.value = Audio.speaker.volume || 0;
|
||||||
}, 'speaker-changed')
|
}, 'speaker-changed')
|
||||||
|
|
||||||
// OnClick
|
// OnClick
|
||||||
|
|
Loading…
Reference in a new issue