From 997c4ec7518210bff402097849c598d144176c80 Mon Sep 17 00:00:00 2001 From: Mihai Fufezan Date: Tue, 12 Dec 2023 18:02:11 +0200 Subject: [PATCH] ags: use *pack instead of *align ags/bar: use default exports --- home/programs/ags/windows/bar/main.js | 21 +++++++++---------- .../ags/windows/bar/modules/battery.js | 2 +- .../ags/windows/bar/modules/bluetooth.js | 2 +- home/programs/ags/windows/bar/modules/date.js | 2 +- home/programs/ags/windows/bar/modules/net.js | 2 +- .../ags/windows/bar/modules/system_info.js | 2 +- .../ags/windows/bar/modules/workspaces.js | 2 +- home/programs/ags/windows/music/controls.js | 4 ++-- .../programs/ags/windows/music/player_info.js | 12 +++++++---- home/programs/ags/windows/music/time_info.js | 4 ++-- .../ags/windows/system-menu/battery_info.js | 5 ++--- .../ags/windows/system-menu/toggles.js | 3 +-- 12 files changed, 31 insertions(+), 30 deletions(-) diff --git a/home/programs/ags/windows/bar/main.js b/home/programs/ags/windows/bar/main.js index 5136f83c..3e12e069 100644 --- a/home/programs/ags/windows/bar/main.js +++ b/home/programs/ags/windows/bar/main.js @@ -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: [ @@ -23,7 +22,7 @@ const Center = Widget.Box({ const End = Widget.Box({ hexpand: true, - halign: Gtk.Align.END, + hpack: "end", children: [ // Tray, @@ -33,8 +32,8 @@ const End = Widget.Box({ child: Widget.Box({ children: [ Net, - BluetoothModule, - BatteryModule, + Bluetooth, + Battery, ], }), }), diff --git a/home/programs/ags/windows/bar/modules/battery.js b/home/programs/ags/windows/bar/modules/battery.js index 9f6cd8c4..fc53ca3e 100644 --- a/home/programs/ags/windows/bar/modules/battery.js +++ b/home/programs/ags/windows/bar/modules/battery.js @@ -1,6 +1,6 @@ import { Battery, Widget } from "../../../imports.js"; -export const BatteryModule = Widget.Icon({ +export default Widget.Icon({ className: "battery module", binds: [ diff --git a/home/programs/ags/windows/bar/modules/bluetooth.js b/home/programs/ags/windows/bar/modules/bluetooth.js index be32039b..e608f409 100644 --- a/home/programs/ags/windows/bar/modules/bluetooth.js +++ b/home/programs/ags/windows/bar/modules/bluetooth.js @@ -1,6 +1,6 @@ import { Bluetooth, Icons, Widget } from "../../../imports.js"; -export const BluetoothModule = Widget.Icon({ +export default Widget.Icon({ className: "bluetooth module", binds: [ diff --git a/home/programs/ags/windows/bar/modules/date.js b/home/programs/ags/windows/bar/modules/date.js index 28c4d529..9555894c 100644 --- a/home/programs/ags/windows/bar/modules/date.js +++ b/home/programs/ags/windows/bar/modules/date.js @@ -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: [ diff --git a/home/programs/ags/windows/bar/modules/net.js b/home/programs/ags/windows/bar/modules/net.js index d58b4951..fbb42241 100644 --- a/home/programs/ags/windows/bar/modules/net.js +++ b/home/programs/ags/windows/bar/modules/net.js @@ -1,6 +1,6 @@ import { Network, Widget } from "../../../imports.js"; -export const Net = Widget.Icon({ +export default Widget.Icon({ className: "net module", binds: [ diff --git a/home/programs/ags/windows/bar/modules/system_info.js b/home/programs/ags/windows/bar/modules/system_info.js index a0161457..0de0da9c 100644 --- a/home/programs/ags/windows/bar/modules/system_info.js +++ b/home/programs/ags/windows/bar/modules/system_info.js @@ -1,6 +1,6 @@ import { Utils, Widget } from "../../../imports.js"; -export const SystemInfo = Widget.Box({ +export default Widget.Box({ className: "system-info module", children: [ diff --git a/home/programs/ags/windows/bar/modules/workspaces.js b/home/programs/ags/windows/bar/modules/workspaces.js index f0a615b7..5c42b7be 100644 --- a/home/programs/ags/windows/bar/modules/workspaces.js +++ b/home/programs/ags/windows/bar/modules/workspaces.js @@ -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"), diff --git a/home/programs/ags/windows/music/controls.js b/home/programs/ags/windows/music/controls.js index 4a1f018b..ba9dc5b9 100644 --- a/home/programs/ags/windows/music/controls.js +++ b/home/programs/ags/windows/music/controls.js @@ -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(), diff --git a/home/programs/ags/windows/music/player_info.js b/home/programs/ags/windows/music/player_info.js index db4411c0..c8b25f1c 100644 --- a/home/programs/ags/windows/music/player_info.js +++ b/home/programs/ags/windows/music/player_info.js @@ -1,15 +1,15 @@ -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 ?? "", @@ -17,7 +17,11 @@ export default (player) => "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; + }, ]], }), ], diff --git a/home/programs/ags/windows/music/time_info.js b/home/programs/ags/windows/music/time_info.js index 010b69e7..0a77eee0 100644 --- a/home/programs/ags/windows/music/time_info.js +++ b/home/programs/ags/windows/music/time_info.js @@ -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) => @@ -63,7 +63,7 @@ export default (player) => Widget.Box({ vertical: true, vexpand: true, - valign: Gtk.Align.END, + vpack: "end", children: [ Widget.Box({ diff --git a/home/programs/ags/windows/system-menu/battery_info.js b/home/programs/ags/windows/system-menu/battery_info.js index 70bbcf1b..03a6b588 100644 --- a/home/programs/ags/windows/system-menu/battery_info.js +++ b/home/programs/ags/windows/system-menu/battery_info.js @@ -1,6 +1,5 @@ import { Battery, - Gtk, Icons, systemMenuVisible, Utils, @@ -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], @@ -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; diff --git a/home/programs/ags/windows/system-menu/toggles.js b/home/programs/ags/windows/system-menu/toggles.js index 0692a16e..c3da61ca 100644 --- a/home/programs/ags/windows/system-menu/toggles.js +++ b/home/programs/ags/windows/system-menu/toggles.js @@ -1,6 +1,5 @@ import { Bluetooth, - Gtk, Icons, Network, systemMenuVisible, @@ -13,7 +12,7 @@ const Toggle = (args) => ...args.props ?? {}, className: `toggle ${args.name}`, hexpand: true, - halign: Gtk.Align.START, + hpack: "start", children: [ Widget.Button({