2023-12-28 00:19:57 -05:00
|
|
|
import App from 'resource:///com/github/Aylur/ags/app.js';
|
|
|
|
|
|
|
|
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
|
|
|
|
|
2024-01-13 23:38:31 -05:00
|
|
|
import Audio from '../hovers/audio.ts';
|
|
|
|
import Bluetooth from '../hovers/bluetooth.ts';
|
|
|
|
import Brightness from '../hovers/brightness.ts';
|
|
|
|
import KeyboardLayout from '../hovers/keyboard-layout.ts';
|
|
|
|
import Network from '../hovers/network.ts';
|
2023-12-28 00:19:57 -05:00
|
|
|
|
2024-01-13 23:38:31 -05:00
|
|
|
import CursorBox from '../../misc/cursorbox.ts';
|
|
|
|
import Separator from '../../misc/separator.ts';
|
2023-12-28 00:19:57 -05:00
|
|
|
|
|
|
|
const SPACING = 4;
|
|
|
|
|
2024-01-13 11:15:08 -05:00
|
|
|
// Types
|
2024-01-13 23:38:31 -05:00
|
|
|
import AgsRevealer from 'types/widgets/revealer.ts';
|
|
|
|
import AgsBox from 'types/widgets/box.ts';
|
|
|
|
import AgsWindow from 'types/widgets/window.ts';
|
2024-01-13 11:15:08 -05:00
|
|
|
|
2023-12-28 00:19:57 -05:00
|
|
|
|
|
|
|
export default () => {
|
|
|
|
const hoverRevealers = [
|
|
|
|
KeyboardLayout(),
|
|
|
|
|
|
|
|
Brightness(),
|
|
|
|
|
|
|
|
Audio(),
|
|
|
|
|
|
|
|
Bluetooth(),
|
|
|
|
|
|
|
|
Network(),
|
|
|
|
];
|
|
|
|
|
|
|
|
return CursorBox({
|
|
|
|
class_name: 'toggle-off',
|
|
|
|
|
|
|
|
on_primary_click_release: (self) => {
|
2024-01-13 11:15:08 -05:00
|
|
|
(App.getWindow('quick-settings') as AgsWindow)
|
|
|
|
?.attribute.set_x_pos(
|
|
|
|
self.get_allocation(),
|
|
|
|
'right',
|
|
|
|
);
|
2023-12-28 00:19:57 -05:00
|
|
|
|
|
|
|
App.toggleWindow('quick-settings');
|
|
|
|
},
|
|
|
|
|
|
|
|
setup: (self) => {
|
|
|
|
self.hook(App, (_, windowName, visible) => {
|
|
|
|
if (windowName === 'quick-settings') {
|
|
|
|
self.toggleClassName('toggle-on', visible);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
},
|
|
|
|
|
|
|
|
attribute: {
|
2024-01-13 11:15:08 -05:00
|
|
|
hoverRevealers: hoverRevealers.map((rev) => {
|
|
|
|
const box = rev.child as AgsBox;
|
|
|
|
|
|
|
|
return box.children[1];
|
|
|
|
}),
|
2023-12-28 00:19:57 -05:00
|
|
|
},
|
|
|
|
on_hover_lost: (self) => {
|
|
|
|
self.attribute.hoverRevealers.forEach(
|
2024-01-13 11:15:08 -05:00
|
|
|
(rev: AgsRevealer) => {
|
2023-12-28 00:19:57 -05:00
|
|
|
rev.reveal_child = false;
|
|
|
|
},
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
|
|
|
child: Box({
|
|
|
|
class_name: 'quick-settings-toggle',
|
|
|
|
vertical: false,
|
|
|
|
children: [
|
|
|
|
Separator(SPACING),
|
|
|
|
|
|
|
|
...hoverRevealers,
|
|
|
|
|
|
|
|
Label(' '),
|
|
|
|
|
|
|
|
Separator(SPACING),
|
|
|
|
],
|
|
|
|
}),
|
|
|
|
});
|
|
|
|
};
|