refactor(ags): change some stuff

This commit is contained in:
matt1432 2023-09-05 19:57:34 -04:00
parent 47013dd498
commit 3f6682a7e3
3 changed files with 14 additions and 8 deletions

View file

@ -19,7 +19,7 @@ export const Bar = Window({
child: CenterBox({ child: CenterBox({
className: 'transparent', className: 'transparent',
halign: 'fill', halign: 'fill',
style: 'margin-top: 5px; margin-left: 5px; margin-right: 5px', style: 'margin: 5px',
vertical: false, vertical: false,
children: [ children: [
@ -41,7 +41,7 @@ export const Bar = Window({
Separator(12), Separator(12),
Workspaces(), Workspaces,
], ],
}), }),

View file

@ -3,13 +3,17 @@ const { execAsync } = ags.Utils;
const { DateTime } = imports.gi.GLib; const { DateTime } = imports.gi.GLib;
const ClockModule = ({ const ClockModule = ({
format = '%a. %e %b. %H:%M',
interval = 1000, interval = 1000,
...props ...props
}) => Label({ }) => Label({
...props, ...props,
className: 'clock', className: 'clock',
connections: [[interval, label => label.label = DateTime.new_now_local().format(format)]], connections: [
[interval, label => {
var time = DateTime.new_now_local();
label.label = time.format('%a. ') + time.get_day_of_month() + time.format(' %b. %H:%M');
}],
],
}); });
export const Clock = Box({ export const Clock = Box({

View file

@ -4,7 +4,7 @@ const { Box, Button, Label, Revealer } = ags.Widget;
import { EventBox } from '../common.js'; import { EventBox } from '../common.js';
const Workspace = ({ i } = {}) => const WorkspaceModule = ({ i } = {}) =>
Revealer({ Revealer({
transition: "slide_right", transition: "slide_right",
child: EventBox({ child: EventBox({
@ -25,11 +25,11 @@ Revealer({
}), }),
}); });
export const Workspaces = props => Box({ const Workspace = props => Box({
className: 'workspaces', className: 'workspaces',
children: [EventBox({ children: [EventBox({
child: Box({ child: Box({
children: Array.from({ length: 15 }, (_, i) => i + 1).map(i => Workspace({ i: i})), children: Array.from({ length: 15 }, (_, i) => i + 1).map(i => WorkspaceModule({ i: i})),
connections: [[Hyprland, box => { connections: [[Hyprland, box => {
let workspaces = []; let workspaces = [];
Hyprland.workspaces.forEach(ws => { Hyprland.workspaces.forEach(ws => {
@ -44,3 +44,5 @@ export const Workspaces = props => Box({
}), }),
})], })],
}); });
export const Workspaces = Workspace();