ags: update to new syntax

This commit is contained in:
end-4
2024-01-11 16:50:12 +07:00
parent c61db15a88
commit 85704218e3
74 changed files with 2155 additions and 1898 deletions
+9 -34
View File
@@ -1,5 +1,5 @@
const { GLib, Gdk, Gtk } = imports.gi;
import { Utils, Widget } from '../../imports.js';
import Widget from 'resource:///com/github/Aylur/ags/widget.js';
import * as Utils from 'resource:///com/github/Aylur/ags/utils.js';
const { execAsync, exec } = Utils;
const { Box, EventBox } = Widget;
import {
@@ -17,44 +17,19 @@ import {
import ModuleNotificationList from "./notificationlist.js";
import { ModuleCalendar } from "./calendar.js";
// const NUM_OF_TOGGLES_PER_LINE = 5;
// const togglesFlowBox = Widget.FlowBox({
// className: 'sidebar-group spacing-h-10',
// setup: (self) => {
// self.set_max_children_per_line(NUM_OF_TOGGLES_PER_LINE);
// self.add(ToggleIconWifi({ hexpand: true }));
// self.add(ToggleIconBluetooth({ hexpand: true }));
// self.add(HyprToggleIcon('mouse', 'Raw input', 'input:force_no_accel', { hexpand: true }));
// self.add(HyprToggleIcon('front_hand', 'No touchpad while typing', 'input:touchpad:disable_while_typing', { hexpand: true }));
// self.add(ModuleNightLight({ hexpand: true }));
// // Setup flowbox rearrange
// self.connect('child-activated', (self, child) => {
// if (child.get_index() === 0) {
// self.reorder_child(child, self.get_children().length - 1);
// } else {
// self.reorder_child(child, 0);
// }
// });
// }
// })
const timeRow = Box({
className: 'spacing-h-5 sidebar-group-invisible-morehorizpad',
children: [
// Widget.Label({
// className: 'txt-title txt',
// connections: [[5000, label => {
// label.label = GLib.DateTime.new_now_local().format("%H:%M");
// }]],
// }),
Widget.Label({
hpack: 'center',
className: 'txt-small txt',
connections: [[5000, label => {
execAsync(['bash', '-c', `uptime -p | sed -e 's/up //;s/ hours,/h/;s/ minutes/m/'`]).then(upTimeString => {
label.label = `System uptime: ${upTimeString}`;
}).catch(print);
}]],
setup: (self) => self
.poll(5000, label => {
execAsync(['bash', '-c', `uptime -p | sed -e 's/up //;s/ hours,/h/;s/ minutes/m/'`]).then(upTimeString => {
label.label = `Uptime: ${upTimeString}`;
}).catch(print);
})
,
}),
Widget.Box({ hexpand: true }),
// ModuleEditIcon({ hpack: 'end' }), // TODO: Make this work