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

@ -8,7 +8,7 @@ import { Heart } from './heart.js';
import { TabletToggle } from './tablet-toggle.js';
import { QsToggle } from './quick-settings.js';
import { NotifButton } from './notif-button.js';
import { Clock } from './clock.js';
import { Clock } from './clock.js';
export const Bar = Window({
name: 'left-bar',
@ -19,7 +19,7 @@ export const Bar = Window({
child: CenterBox({
className: 'transparent',
halign: 'fill',
style: 'margin-top: 5px; margin-left: 5px; margin-right: 5px',
style: 'margin: 5px',
vertical: false,
children: [
@ -41,7 +41,7 @@ export const Bar = Window({
Separator(12),
Workspaces(),
Workspaces,
],
}),

View file

@ -3,13 +3,17 @@ const { execAsync } = ags.Utils;
const { DateTime } = imports.gi.GLib;
const ClockModule = ({
format = '%a. %e %b. %H:%M',
interval = 1000,
...props
}) => Label({
...props,
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({

View file

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