Files
custum-hyprpanel/modules/osd/icon/index.ts
Jas Singh bb3b3dfdfb Added strict type checking to the project. (#236)
* Implement strict typing (WIP).

* changes

* Finish type checks

* Fix notification icon, matugen settings and update tsconfig.

* OSD Styling updates and added the ability to configure OSD duration.
2024-09-09 00:44:51 -07:00

37 lines
1.3 KiB
TypeScript

import brightness from "services/Brightness"
const audio = await Service.import("audio")
export const OSDIcon = () => {
return Widget.Box({
class_name: "osd-icon-container",
hexpand: true,
child: Widget.Label({
class_name: "osd-icon txt-icon",
hexpand: true,
vexpand: true,
hpack: "center",
vpack: "center",
setup: self => {
self.hook(brightness, () => {
self.label = "󱍖";
}, "notify::screen")
self.hook(brightness, () => {
self.label = "󰥻";
}, "notify::kbd")
self.hook(audio.microphone, () => {
self.label = audio.microphone.is_muted ? "󰍭" : "󰍬";
}, "notify::volume")
self.hook(audio.microphone, () => {
self.label = audio.microphone.is_muted ? "󰍭" : "󰍬";
}, "notify::is-muted")
self.hook(audio.speaker, () => {
self.label = audio.speaker.is_muted ? "󰝟" : "󰕾";
}, "notify::volume")
self.hook(audio.speaker, () => {
self.label = audio.speaker.is_muted ? "󰝟" : "󰕾";
}, "notify::is-muted")
}
})
});
}