Skip to content

Commit

Permalink
ags: use *pack instead of *align
Browse files Browse the repository at this point in the history
ags/bar: use default exports
  • Loading branch information
fufexan committed Dec 12, 2023
1 parent e81314d commit 997c4ec
Show file tree
Hide file tree
Showing 12 changed files with 31 additions and 30 deletions.
21 changes: 10 additions & 11 deletions home/programs/ags/windows/bar/main.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { Gtk, systemMenuVisible } from "../../imports.js";
import { BatteryModule } from "./modules/battery.js";
import { Date } from "./modules/date.js";
import { Widget } from "../../imports.js";
import { Net } from "./modules/net.js";
import { BluetoothModule } from "./modules/bluetooth.js";
import { SystemInfo } from "./modules/system_info.js";
import { Workspaces } from "./modules/workspaces.js";
import { systemMenuVisible, Widget } from "../../imports.js";
import Battery from "./modules/battery.js";
import Bluetooth from "./modules/bluetooth.js";
import Date from "./modules/date.js";
import Music from "./modules/music.js";
import Net from "./modules/net.js";
import SystemInfo from "./modules/system_info.js";
import Workspaces from "./modules/workspaces.js";

const Start = Widget.Box({
children: [
Expand All @@ -23,7 +22,7 @@ const Center = Widget.Box({

const End = Widget.Box({
hexpand: true,
halign: Gtk.Align.END,
hpack: "end",

children: [
// Tray,
Expand All @@ -33,8 +32,8 @@ const End = Widget.Box({
child: Widget.Box({
children: [
Net,
BluetoothModule,
BatteryModule,
Bluetooth,
Battery,
],
}),
}),
Expand Down
2 changes: 1 addition & 1 deletion home/programs/ags/windows/bar/modules/battery.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Battery, Widget } from "../../../imports.js";

export const BatteryModule = Widget.Icon({
export default Widget.Icon({
className: "battery module",

binds: [
Expand Down
2 changes: 1 addition & 1 deletion home/programs/ags/windows/bar/modules/bluetooth.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Bluetooth, Icons, Widget } from "../../../imports.js";

export const BluetoothModule = Widget.Icon({
export default Widget.Icon({
className: "bluetooth module",

binds: [
Expand Down
2 changes: 1 addition & 1 deletion home/programs/ags/windows/bar/modules/date.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Utils, Widget } from "../../../imports.js";

export const Date = Widget.EventBox({
export default Widget.EventBox({
child: Widget.Label({
className: "date module",
connections: [
Expand Down
2 changes: 1 addition & 1 deletion home/programs/ags/windows/bar/modules/net.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Network, Widget } from "../../../imports.js";

export const Net = Widget.Icon({
export default Widget.Icon({
className: "net module",

binds: [
Expand Down
2 changes: 1 addition & 1 deletion home/programs/ags/windows/bar/modules/system_info.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Utils, Widget } from "../../../imports.js";

export const SystemInfo = Widget.Box({
export default Widget.Box({
className: "system-info module",

children: [
Expand Down
2 changes: 1 addition & 1 deletion home/programs/ags/windows/bar/modules/workspaces.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function update(self) {
self.children = makeWorkspaces();
}

export const Workspaces = Widget.EventBox({
export default Widget.EventBox({
onScrollUp: () => dispatch("+1"),
onScrollDown: () => dispatch("-1"),

Expand Down
4 changes: 2 additions & 2 deletions home/programs/ags/windows/music/controls.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Gtk, Icons, Widget } from "../../imports.js";
import { Icons, Widget } from "../../imports.js";
import { mprisStateIcon } from "../../utils/mpris.js";

export default (player) =>
Widget.CenterBox({
className: "controls",
halign: Gtk.Align.CENTER,
hpack: "center",

startWidget: Widget.Button({
onClicked: () => player.previous(),
Expand Down
12 changes: 8 additions & 4 deletions home/programs/ags/windows/music/player_info.js
Original file line number Diff line number Diff line change
@@ -1,23 +1,27 @@
import { Gtk, Icons, Utils, Widget } from "../../imports.js";
import { Icons, Utils, Widget } from "../../imports.js";

export default (player) =>
Widget.Box({
className: "player-info",
vexpand: true,
valign: Gtk.Align.START,
vpack: "start",

children: [
Widget.Icon({
hexpand: true,
halign: Gtk.Align.END,
hpack: "end",
className: "player-icon",
tooltipText: player.identity ?? "",

binds: [[
"icon",
player,
"entry",
(entry) => Utils.lookUpIcon(entry ?? "") ? entry : Icons.media.player,
(entry) => {
// the Spotify icon is called spotify-client
if (entry == "spotify") entry = "spotify-client";
return Utils.lookUpIcon(entry ?? "") ? entry : Icons.media.player;
},
]],
}),
],
Expand Down
4 changes: 2 additions & 2 deletions home/programs/ags/windows/music/time_info.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Gtk, Widget } from "../../imports.js";
import { Widget } from "../../imports.js";
import { lengthStr } from "../../utils/mpris.js";

export const PositionLabel = (player) =>
Expand Down Expand Up @@ -63,7 +63,7 @@ export default (player) =>
Widget.Box({
vertical: true,
vexpand: true,
valign: Gtk.Align.END,
vpack: "end",

children: [
Widget.Box({
Expand Down
5 changes: 2 additions & 3 deletions home/programs/ags/windows/system-menu/battery_info.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Battery,
Gtk,
Icons,
systemMenuVisible,
Utils,
Expand Down Expand Up @@ -51,7 +50,7 @@ const batteryTime = () => {
const BatteryTime = Widget.Label({
className: "time",
vexpand: true,
valign: Gtk.Align.CENTER,
vpack: "center",

binds: [
["label", Battery, "charging", batteryTime],
Expand All @@ -73,7 +72,7 @@ const BatteryBox = Widget.Box({
const PowerButton = Widget.Button({
className: "button disabled",
hexpand: true,
halign: Gtk.Align.END,
hpack: "end",

onPrimaryClick: () => {
systemMenuVisible.value = !systemMenuVisible.value;
Expand Down
3 changes: 1 addition & 2 deletions home/programs/ags/windows/system-menu/toggles.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import {
Bluetooth,
Gtk,
Icons,
Network,
systemMenuVisible,
Expand All @@ -13,7 +12,7 @@ const Toggle = (args) =>
...args.props ?? {},
className: `toggle ${args.name}`,
hexpand: true,
halign: Gtk.Align.START,
hpack: "start",

children: [
Widget.Button({
Expand Down

0 comments on commit 997c4ec

Please sign in to comment.