nixos-configs/devices/wim/config/ags/js/osd/caps.js

31 lines
749 B
JavaScript
Raw Normal View History

2023-11-10 23:51:50 -05:00
import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import Brightness from '../../services/brightness.js';
2023-11-10 23:51:50 -05:00
export default () => Box({
className: 'osd',
children: [
Icon({
hpack: 'start',
icon: 'caps-lock-symbolic',
2023-11-10 23:51:50 -05:00
connections: [[Brightness, (self, state) => {
self.icon = state ?
'caps-lock-symbolic' :
'capslock-disabled-symbolic';
2023-11-10 23:51:50 -05:00
const stack = self.get_parent().get_parent();
2023-11-10 23:51:50 -05:00
stack.shown = 'caps';
stack.resetTimer();
}, 'caps']],
}),
Label({
vpack: 'center',
label: 'Caps Lock',
}),
],
});