diff options
| author | srdusr <trevorgray@srdusr.com> | 2025-08-30 19:22:59 +0200 |
|---|---|---|
| committer | srdusr <trevorgray@srdusr.com> | 2025-08-30 19:22:59 +0200 |
| commit | 19120d4f9761c67d99ed1ce3da6084b83f5a49c9 (patch) | |
| tree | f234cad1bdad88114a63c9702144da487024967a /.config/ags/widget/bar/buttons/SystemIndicators.ts | |
| parent | 5928998af5404ae2be84c6cecc10ebf84bd3f3ed (diff) | |
| download | dotfiles-19120d4f9761c67d99ed1ce3da6084b83f5a49c9.tar.gz dotfiles-19120d4f9761c67d99ed1ce3da6084b83f5a49c9.zip | |
Linux-specific dotfiles
Diffstat (limited to '.config/ags/widget/bar/buttons/SystemIndicators.ts')
| -rw-r--r-- | .config/ags/widget/bar/buttons/SystemIndicators.ts | 107 |
1 files changed, 0 insertions, 107 deletions
diff --git a/.config/ags/widget/bar/buttons/SystemIndicators.ts b/.config/ags/widget/bar/buttons/SystemIndicators.ts deleted file mode 100644 index cc98548..0000000 --- a/.config/ags/widget/bar/buttons/SystemIndicators.ts +++ /dev/null @@ -1,107 +0,0 @@ -import PanelButton from '../PanelButton'; -import icons from 'lib/icons'; -import asusctl from 'service/asusctl'; - -const notifications = await Service.import('notifications'); -const bluetooth = await Service.import('bluetooth'); -const audio = await Service.import('audio'); -const network = await Service.import('network'); -const powerprof = await Service.import('powerprofiles'); - -const ProfileIndicator = () => { - const visible = asusctl.available ? asusctl.bind('profile').as(p => p !== 'Balanced') : powerprof.bind('active_profile').as(p => p !== 'balanced'); - - const icon = asusctl.available ? asusctl.bind('profile').as(p => icons.asusctl.profile[p]) : powerprof.bind('active_profile').as(p => icons.powerprofile[p]); - - return Widget.Icon({ visible, icon }); -}; - -const ModeIndicator = () => { - if (!asusctl.available) { - return Widget.Icon({ - setup(self) { - Utils.idle(() => (self.visible = false)); - }, - }); - } - - return Widget.Icon({ - visible: asusctl.bind('mode').as(m => m !== 'Hybrid'), - icon: asusctl.bind('mode').as(m => icons.asusctl.mode[m]), - }); -}; - -const MicrophoneIndicator = () => - Widget.Icon() - .hook(audio, self => (self.visible = audio.recorders.length > 0 || audio.microphone.is_muted || false)) - .hook(audio.microphone, self => { - const vol = audio.microphone.is_muted ? 0 : audio.microphone.volume; - const { muted, low, medium, high } = icons.audio.mic; - const cons = [ - [67, high], - [34, medium], - [1, low], - [0, muted], - ] as const; - self.icon = cons.find(([n]) => n <= vol * 100)?.[1] || ''; - }); - -const DNDIndicator = () => - Widget.Icon({ - visible: notifications.bind('dnd'), - icon: icons.notifications.silent, - }); - -const BluetoothIndicator = () => - Widget.Overlay({ - class_name: 'bluetooth', - passThrough: true, - child: Widget.Icon({ - icon: icons.bluetooth.enabled, - visible: bluetooth.bind('enabled'), - }), - overlay: Widget.Label({ - hpack: 'end', - vpack: 'start', - label: bluetooth.bind('connected_devices').as(c => `${c.length}`), - visible: bluetooth.bind('connected_devices').as(c => c.length > 0), - }), - }); - -const NetworkIndicator = () => - Widget.Icon().hook(network, self => { - const icon = network[network.primary || 'wifi']?.icon_name; - self.icon = icon || ''; - self.visible = !!icon; - }); - -const AudioIndicator = () => - Widget.Icon().hook(audio.speaker, self => { - const vol = audio.speaker.is_muted ? 0 : audio.speaker.volume; - const { muted, low, medium, high, overamplified } = icons.audio.volume; - const cons = [ - [101, overamplified], - [67, high], - [34, medium], - [1, low], - [0, muted], - ] as const; - self.icon = cons.find(([n]) => n <= vol * 100)?.[1] || ''; - }); - -export default () => - PanelButton({ - window: 'quicksettings', - on_clicked: () => App.toggleWindow('quicksettings'), - on_scroll_up: () => (audio.speaker.volume += 0.02), - on_scroll_down: () => (audio.speaker.volume -= 0.02), - child: Widget.Box([ - //ProfileIndicator(), - ModeIndicator(), - DNDIndicator(), - BluetoothIndicator(), - MicrophoneIndicator(), - AudioIndicator(), - NetworkIndicator(), - ]), - }); |
