refactor(ags): change some stuff
This commit is contained in:
parent
47013dd498
commit
3f6682a7e3
3 changed files with 14 additions and 8 deletions
|
@ -8,7 +8,7 @@ import { Heart } from './heart.js';
|
||||||
import { TabletToggle } from './tablet-toggle.js';
|
import { TabletToggle } from './tablet-toggle.js';
|
||||||
import { QsToggle } from './quick-settings.js';
|
import { QsToggle } from './quick-settings.js';
|
||||||
import { NotifButton } from './notif-button.js';
|
import { NotifButton } from './notif-button.js';
|
||||||
import { Clock } from './clock.js';
|
import { Clock } from './clock.js';
|
||||||
|
|
||||||
export const Bar = Window({
|
export const Bar = Window({
|
||||||
name: 'left-bar',
|
name: 'left-bar',
|
||||||
|
@ -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,
|
||||||
|
|
||||||
],
|
],
|
||||||
}),
|
}),
|
||||||
|
|
|
@ -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({
|
||||||
|
|
|
@ -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();
|
||||||
|
|
Loading…
Reference in a new issue