mirror of
https://github.com/Theaninova/TheaninovOS.git
synced 2026-01-03 06:12:51 +00:00
feat: update ags
This commit is contained in:
77
home/desktops/hyprland/ags/js/osd/OSD.js
Normal file
77
home/desktops/hyprland/ags/js/osd/OSD.js
Normal file
@@ -0,0 +1,77 @@
|
||||
import Widget from "resource:///com/github/Aylur/ags/widget.js";
|
||||
import * as Utils from "resource:///com/github/Aylur/ags/utils.js";
|
||||
import FontIcon from "../misc/FontIcon.js";
|
||||
import Progress from "../misc/Progress.js";
|
||||
import Indicator from "../services/onScreenIndicator.js";
|
||||
|
||||
export const OnScreenIndicator = ({ height = 300, width = 48 } = {}) =>
|
||||
Widget.Box({
|
||||
class_name: "indicator",
|
||||
css: "padding: 1px;",
|
||||
child: Widget.Revealer({
|
||||
transition: "slide_left",
|
||||
connections: [
|
||||
[
|
||||
Indicator,
|
||||
(revealer, value) => {
|
||||
revealer.reveal_child = value > -1;
|
||||
},
|
||||
],
|
||||
],
|
||||
child: Progress({
|
||||
width,
|
||||
height,
|
||||
vertical: true,
|
||||
connections: [
|
||||
[Indicator, (progress, value) => progress.setValue(value)],
|
||||
],
|
||||
child: Widget.Stack({
|
||||
vpack: "start",
|
||||
hpack: "center",
|
||||
hexpand: false,
|
||||
items: [
|
||||
[
|
||||
"true",
|
||||
Widget.Icon({
|
||||
hpack: "center",
|
||||
size: width,
|
||||
connections: [
|
||||
[Indicator, (icon, _v, name) => (icon.icon = name || "")],
|
||||
],
|
||||
}),
|
||||
],
|
||||
[
|
||||
"false",
|
||||
FontIcon({
|
||||
hpack: "center",
|
||||
hexpand: true,
|
||||
css: `font-size: ${width}px;`,
|
||||
connections: [
|
||||
[Indicator, (icon, _v, name) => (icon.icon = name || "")],
|
||||
],
|
||||
}),
|
||||
],
|
||||
],
|
||||
connections: [
|
||||
[
|
||||
Indicator,
|
||||
(stack, _v, name) => {
|
||||
stack.shown = `${!!Utils.lookUpIcon(name)}`;
|
||||
},
|
||||
],
|
||||
],
|
||||
}),
|
||||
}),
|
||||
}),
|
||||
});
|
||||
|
||||
/** @param {number} monitor */
|
||||
export default (monitor) =>
|
||||
Widget.Window({
|
||||
name: `indicator${monitor}`,
|
||||
monitor,
|
||||
class_name: "indicator",
|
||||
layer: "overlay",
|
||||
anchor: ["right"],
|
||||
child: OnScreenIndicator(),
|
||||
});
|
||||
Reference in New Issue
Block a user