nixos-configs/devices/wim/config/ags/js/bar/buttons/quick-settings.js

62 lines
1.3 KiB
JavaScript
Raw Normal View History

import App from 'resource:///com/github/Aylur/ags/app.js';
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
2023-09-05 15:10:25 -04:00
import Audio from './audio.js';
import Bluetooth from './bluetooth.js';
import Brightness from './brightness.js';
import KeyboardLayout from './keyboard-layout.js';
import Network from './network.js';
2023-11-16 00:48:50 -05:00
import EventBox from '../../misc/cursorbox.js';
import Separator from '../../misc/separator.js';
const SPACING = 4;
2023-09-11 19:57:21 -04:00
export default () => EventBox({
className: 'toggle-off',
onHoverLost: () => { /**/ },
onPrimaryClickRelease: (self) => {
2023-12-18 18:00:30 -05:00
// @ts-expect-error
App.getWindow('notification-center').setXPos(
self.get_allocation(),
'right',
);
App.toggleWindow('quick-settings');
},
setup: (self) => {
self.hook(App, (_, windowName, visible) => {
if (windowName === 'quick-settings') {
self.toggleClassName('toggle-on', visible);
}
});
},
child: Box({
2023-12-18 18:00:30 -05:00
class_name: 'quick-settings-toggle',
vertical: false,
children: [
Separator(SPACING),
KeyboardLayout(),
Brightness(),
Audio(),
Bluetooth(),
Network(),
Label(' '),
Separator(SPACING),
],
2023-09-05 15:10:25 -04:00
}),
});