From 281e00c7fe28a6a316d751641c434f3b95133bb1 Mon Sep 17 00:00:00 2001 From: matt1432 Date: Sun, 11 Feb 2024 02:18:59 -0500 Subject: [PATCH] fix(ags): fix latest breaking changes --- modules/ags/config/services/pointers.ts | 4 ++-- modules/ags/config/services/tablet.ts | 4 ++-- modules/ags/config/ts/bar/fullscreen.ts | 8 ++++---- modules/ags/config/ts/bar/hovers/keyboard-layout.ts | 2 +- modules/ags/config/ts/bar/items/heart.ts | 2 +- modules/ags/config/ts/bar/items/systray.ts | 2 +- modules/ags/config/ts/bar/items/workspaces.ts | 2 +- modules/ags/config/ts/media-player/mpris.ts | 8 ++++---- modules/ags/config/ts/misc/audio-icons.ts | 8 ++++---- modules/ags/config/ts/misc/cursorbox.ts | 6 +++--- modules/ags/config/ts/misc/popup.ts | 10 +++++----- modules/ags/config/ts/notifications/base.ts | 12 ++++++------ modules/ags/config/ts/notifications/gesture.ts | 4 ++-- modules/ags/config/ts/on-screen-keyboard/gesture.ts | 8 ++++---- modules/ags/config/ts/on-screen-keyboard/keys.ts | 12 ++++++------ modules/ags/config/ts/osd/osds.ts | 2 +- modules/ags/config/ts/powermenu.ts | 2 +- modules/ags/config/ts/quick-settings/button-grid.ts | 4 ++-- modules/ags/config/ts/quick-settings/network.ts | 2 +- modules/ags/config/ts/setup.ts | 4 ++-- 20 files changed, 53 insertions(+), 53 deletions(-) diff --git a/modules/ags/config/services/pointers.ts b/modules/ags/config/services/pointers.ts index a6b14ca..c8c8ccb 100644 --- a/modules/ags/config/services/pointers.ts +++ b/modules/ags/config/services/pointers.ts @@ -145,10 +145,10 @@ class Pointers extends Service { return; } - Hyprland.sendMessage('j/layers').then((response) => { + Hyprland.messageAsync('j/layers').then((response) => { const layers = JSON.parse(response) as { Layers: Layers }; - Hyprland.sendMessage('j/cursorpos').then((res) => { + Hyprland.messageAsync('j/cursorpos').then((res) => { const pos = JSON.parse(res) as CursorPos; Object.values(layers).forEach((key) => { diff --git a/modules/ags/config/services/tablet.ts b/modules/ags/config/services/tablet.ts index 497e7d1..12076be 100644 --- a/modules/ags/config/services/tablet.ts +++ b/modules/ags/config/services/tablet.ts @@ -133,14 +133,14 @@ class Tablet extends Service { const orientation = ROTATION_MAP[index]; - Hyprland.sendMessage( + Hyprland.messageAsync( `keyword monitor ${SCREEN},transform,${orientation}`, ).catch(print); const batchRotate = DEVICES.map((dev) => `keyword device:${dev}:transform ${orientation}; `); - Hyprland.sendMessage(`[[BATCH]] ${batchRotate.flat()}`); + Hyprland.messageAsync(`[[BATCH]] ${batchRotate.flat()}`); if (TouchGestures.gestureDaemon) { TouchGestures.killDaemon(); diff --git a/modules/ags/config/ts/bar/fullscreen.ts b/modules/ags/config/ts/bar/fullscreen.ts index c1831d5..6faef7d 100644 --- a/modules/ags/config/ts/bar/fullscreen.ts +++ b/modules/ags/config/ts/bar/fullscreen.ts @@ -15,7 +15,7 @@ const BarCloser = (variable: Var) => Window({ child: EventBox({ on_hover: (self) => { - variable.value = false; + variable.setValue(false); const parent = self.get_parent(); if (parent) { @@ -45,12 +45,12 @@ export default (props?: DefaultProps) => { ); if (workspace) { - Revealed.value = !workspace['hasfullscreen']; + Revealed.setValue(!workspace['hasfullscreen']); } }; const checkGlobalFsState = (_: BoxGeneric, fullscreen: boolean) => { - Revealed.value = !fullscreen; + Revealed.setValue(!fullscreen); }; self @@ -73,7 +73,7 @@ export default (props?: DefaultProps) => { child: EventBox({ on_hover: () => { barCloser.visible = true; - Revealed.value = true; + Revealed.setValue(true); }, child: Box({ diff --git a/modules/ags/config/ts/bar/hovers/keyboard-layout.ts b/modules/ags/config/ts/bar/hovers/keyboard-layout.ts index 201bf99..4faa2ab 100644 --- a/modules/ags/config/ts/bar/hovers/keyboard-layout.ts +++ b/modules/ags/config/ts/bar/hovers/keyboard-layout.ts @@ -21,7 +21,7 @@ const getKbdLayout = (self: LabelGeneric, _: string, layout: string) => { } else { // At launch, kb layout is undefined - Hyprland.sendMessage('j/devices').then((obj) => { + Hyprland.messageAsync('j/devices').then((obj) => { const keyboards = Array.from(JSON.parse(obj) .keyboards) as Keyboard[]; const kb = keyboards.find((v) => v.name === DEFAULT_KB); diff --git a/modules/ags/config/ts/bar/items/heart.ts b/modules/ags/config/ts/bar/items/heart.ts index 3bca3d3..d942b5a 100644 --- a/modules/ags/config/ts/bar/items/heart.ts +++ b/modules/ags/config/ts/bar/items/heart.ts @@ -16,7 +16,7 @@ Persist({ export default () => CursorBox({ on_primary_click_release: () => { - HeartState.value = HeartState.value === '' ? '󰣐' : ''; + HeartState.setValue(HeartState.value === '' ? '󰣐' : ''); }, child: Label({ diff --git a/modules/ags/config/ts/bar/items/systray.ts b/modules/ags/config/ts/bar/items/systray.ts index aab0b6d..88a6979 100644 --- a/modules/ags/config/ts/bar/items/systray.ts +++ b/modules/ags/config/ts/bar/items/systray.ts @@ -50,7 +50,7 @@ const SysTray = () => MenuBar({ } self.attribute.items.set(id, w); - self.child = w; + self.add(w); self.show_all(); w.child.reveal_child = true; diff --git a/modules/ags/config/ts/bar/items/workspaces.ts b/modules/ags/config/ts/bar/items/workspaces.ts index b51508b..b7ca7c2 100644 --- a/modules/ags/config/ts/bar/items/workspaces.ts +++ b/modules/ags/config/ts/bar/items/workspaces.ts @@ -26,7 +26,7 @@ const Workspace = ({ id }: { id: number }) => { tooltip_text: `${id}`, on_primary_click_release: () => { - Hyprland.sendMessage(`dispatch workspace ${id}`); + Hyprland.messageAsync(`dispatch workspace ${id}`); }, child: Box({ diff --git a/modules/ags/config/ts/media-player/mpris.ts b/modules/ags/config/ts/media-player/mpris.ts index 6eb2da3..ee7f6f6 100644 --- a/modules/ags/config/ts/media-player/mpris.ts +++ b/modules/ags/config/ts/media-player/mpris.ts @@ -60,17 +60,17 @@ export const CoverArt = ( // Give temp cover art readFileAsync(player.cover_path).catch(() => { if (!colors.value && !player.track_cover_url) { - colors.value = { + colors.setValue({ imageAccent: '#6b4fa2', buttonAccent: '#ecdcff', buttonText: '#25005a', hoverAccent: '#d4baff', - }; + }); self.attribute.bgStyle = ` background: radial-gradient(circle, rgba(0, 0, 0, 0.4) 30%, - ${colors.value.imageAccent}), + ${(colors as Var).value.imageAccent}), rgb(0, 0, 0); background-size: cover; background-position: center; @@ -87,7 +87,7 @@ export const CoverArt = ( return; } - colors.value = JSON.parse(out); + colors.setValue(JSON.parse(out)); self.attribute.bgStyle = ` background: radial-gradient(circle, diff --git a/modules/ags/config/ts/misc/audio-icons.ts b/modules/ags/config/ts/misc/audio-icons.ts index af07c36..fbbd7e0 100644 --- a/modules/ags/config/ts/misc/audio-icons.ts +++ b/modules/ags/config/ts/misc/audio-icons.ts @@ -23,14 +23,14 @@ Audio.connect('speaker-changed', () => { } if (Audio.speaker.stream?.is_muted) { - SpeakerIcon.value = speakerIcons[0]; + SpeakerIcon.setValue(speakerIcons[0]); } else { const vol = Audio.speaker.volume * 100; for (const threshold of [-1, 0, 33, 66, 100]) { if (vol > threshold + 1) { - SpeakerIcon.value = speakerIcons[threshold + 1]; + SpeakerIcon.setValue(speakerIcons[threshold + 1]); } } } @@ -43,14 +43,14 @@ Audio.connect('microphone-changed', () => { } if (Audio.microphone.stream?.is_muted) { - MicIcon.value = micIcons[0]; + MicIcon.setValue(micIcons[0]); } else { const vol = Audio.microphone.volume * 100; for (const threshold of [-1, 0, 33, 66]) { if (vol > threshold + 1) { - MicIcon.value = micIcons[threshold + 1]; + MicIcon.setValue(micIcons[threshold + 1]); } } } diff --git a/modules/ags/config/ts/misc/cursorbox.ts b/modules/ags/config/ts/misc/cursorbox.ts index 536b4fc..28ccde2 100644 --- a/modules/ags/config/ts/misc/cursorbox.ts +++ b/modules/ags/config/ts/misc/cursorbox.ts @@ -70,10 +70,10 @@ export class CursorBox extends Gtk.EventBox { return; } - this.#canRun.value = !( + this.#canRun.setValue(!( x > this.get_allocated_width() || y > this.get_allocated_height() - ); + )); }, 'end'); this.connect('enter-notify-event', (_, event: Gdk.Event) => { @@ -169,7 +169,7 @@ export class CursorBox extends Gtk.EventBox { } set disabled(value: boolean) { - this.#disabled.value = value; + this.#disabled.setValue(value); } get child() { diff --git a/modules/ags/config/ts/misc/popup.ts b/modules/ags/config/ts/misc/popup.ts index 6e28a74..13df374 100644 --- a/modules/ags/config/ts/misc/popup.ts +++ b/modules/ags/config/ts/misc/popup.ts @@ -43,7 +43,7 @@ export class PopupWindow< } set content(value: Gtk.Widget) { - this.#content.value = value; + this.#content.setValue(value); this.child.show_all(); } @@ -79,7 +79,7 @@ export class PopupWindow< const antiClip = Variable(false); if (content) { - contentVar.value = content; + contentVar.setValue(content); } super({ @@ -104,7 +104,7 @@ export class PopupWindow< }); if (blur) { - Hyprland.sendMessage('[[BATCH]] ' + + Hyprland.messageAsync('[[BATCH]] ' + `keyword layerrule ignorealpha[0.97],${name}; ` + `keyword layerrule blur,${name}`); } @@ -254,7 +254,7 @@ export class PopupWindow< alloc.height + 10; if (needsAnticlipping) { - antiClip.value = true; + antiClip.setValue(true); const thisTimeout = timeout( transition_duration, @@ -262,7 +262,7 @@ export class PopupWindow< // Only run the timeout if there isn't a newer timeout if (thisTimeout === currentTimeout) { - antiClip.value = false; + antiClip.setValue(false); } }, ); diff --git a/modules/ags/config/ts/notifications/base.ts b/modules/ags/config/ts/notifications/base.ts index 240eff2..52dd38c 100644 --- a/modules/ags/config/ts/notifications/base.ts +++ b/modules/ags/config/ts/notifications/base.ts @@ -64,15 +64,15 @@ const NotificationIcon = (notif: NotifObj) => { iconCmd = (box) => { if (!getDragState(box)) { if (wmClass === 'thunderbird') { - Hyprland.sendMessage('dispatch ' + + Hyprland.messageAsync('dispatch ' + 'togglespecialworkspace thunder'); } else if (wmClass === 'Spotify') { - Hyprland.sendMessage('dispatch ' + + Hyprland.messageAsync('dispatch ' + 'togglespecialworkspace spot'); } else { - Hyprland.sendMessage('j/clients').then((msg) => { + Hyprland.messageAsync('j/clients').then((msg) => { const clients = JSON.parse(msg) as Array; const classes = [] as Array; @@ -83,11 +83,11 @@ const NotificationIcon = (notif: NotifObj) => { } if (wmClass && classes.includes(wmClass)) { - Hyprland.sendMessage('dispatch ' + + Hyprland.messageAsync('dispatch ' + `focuswindow ^(${wmClass})`); } else { - Hyprland.sendMessage('dispatch workspace empty') + Hyprland.messageAsync('dispatch workspace empty') .then(() => { app.launch(); }); @@ -183,7 +183,7 @@ export const Notification = ({ return; } - HasNotifs.value = Notifications.notifications.length > 0; + HasNotifs.setValue(Notifications.notifications.length > 0); // Init notif const notifWidget = Gesture({ diff --git a/modules/ags/config/ts/notifications/gesture.ts b/modules/ags/config/ts/notifications/gesture.ts index 6d11909..f655ab2 100644 --- a/modules/ags/config/ts/notifications/gesture.ts +++ b/modules/ags/config/ts/notifications/gesture.ts @@ -123,8 +123,8 @@ export default ({ // Kill notif and update HasNotifs after anim is done command(); - HasNotifs.value = Notifications - .notifications.length > 0; + HasNotifs.setValue(Notifications + .notifications.length > 0); (widget.get_parent() as BoxGeneric)?.remove(widget); }); diff --git a/modules/ags/config/ts/on-screen-keyboard/gesture.ts b/modules/ags/config/ts/on-screen-keyboard/gesture.ts index 875cfc9..d2a6c32 100644 --- a/modules/ags/config/ts/on-screen-keyboard/gesture.ts +++ b/modules/ags/config/ts/on-screen-keyboard/gesture.ts @@ -76,7 +76,7 @@ export default (window) => { // Begin drag signals.push( gesture.connect('drag-begin', () => { - Hyprland.sendMessage('j/cursorpos').then((out) => { + Hyprland.messageAsync('j/cursorpos').then((out) => { window.attribute.startY = JSON.parse(out).y; }); }), @@ -85,7 +85,7 @@ export default (window) => { // Update drag signals.push( gesture.connect('drag-update', () => { - Hyprland.sendMessage('j/cursorpos').then((out) => { + Hyprland.messageAsync('j/cursorpos').then((out) => { const currentY = JSON.parse(out).y; const offset = window.attribute.startY - currentY; @@ -117,7 +117,7 @@ export default (window) => { // Begin drag signals.push( gesture.connect('drag-begin', () => { - Hyprland.sendMessage('j/cursorpos').then((out) => { + Hyprland.messageAsync('j/cursorpos').then((out) => { window.attribute.startY = JSON.parse(out).y; }); }), @@ -126,7 +126,7 @@ export default (window) => { // Update drag signals.push( gesture.connect('drag-update', () => { - Hyprland.sendMessage('j/cursorpos').then((out) => { + Hyprland.messageAsync('j/cursorpos').then((out) => { const currentY = JSON.parse(out).y; const offset = window.attribute.startY - currentY; diff --git a/modules/ags/config/ts/on-screen-keyboard/keys.ts b/modules/ags/config/ts/on-screen-keyboard/keys.ts index c9a2658..13cc8ef 100644 --- a/modules/ags/config/ts/on-screen-keyboard/keys.ts +++ b/modules/ags/config/ts/on-screen-keyboard/keys.ts @@ -22,7 +22,7 @@ const RCtrl = Variable(false); const Caps = Variable(false); Brightness.connect('caps', (_, state) => { - Caps.value = state; + Caps.setValue(state); }); // Assume both shifts are the same for key.labelShift @@ -32,10 +32,10 @@ const RShift = Variable(false); const Shift = Variable(false); LShift.connect('changed', () => { - Shift.value = LShift.value || RShift.value; + Shift.setValue(LShift.value || RShift.value); }); RShift.connect('changed', () => { - Shift.value = LShift.value || RShift.value; + Shift.setValue(LShift.value || RShift.value); }); const SPACING = 4; @@ -100,13 +100,13 @@ const ModKey = (key: Key) => { execAsync(`ydotool key ${key.keycode}:${Mod.value ? 0 : 1}`); label.toggleClassName('active', !Mod.value); - Mod.value = !Mod.value; + Mod.setValue(!Mod.value); }, setup: (self) => { self .hook(NormalClick, () => { - Mod.value = false; + Mod.setValue(false); label.toggleClassName('active', false); execAsync(`ydotool key ${key.keycode}:0`); @@ -238,7 +238,7 @@ const RegularKey = (key: Key) => { execAsync(`ydotool key ${key.keycode}:1`); execAsync(`ydotool key ${key.keycode}:0`); - NormalClick.value = true; + NormalClick.setValue(true); }, 'cancelled'); return Box({ diff --git a/modules/ags/config/ts/osd/osds.ts b/modules/ags/config/ts/osd/osds.ts index 272d3b3..3bb76d8 100644 --- a/modules/ags/config/ts/osd/osds.ts +++ b/modules/ags/config/ts/osd/osds.ts @@ -13,7 +13,7 @@ const AUDIO_MAX = 1.5; const ShowSpeaker = Variable(true); globalThis.showSpeaker = () => { - ShowSpeaker.value = !ShowSpeaker.value; + ShowSpeaker.setValue(!ShowSpeaker.value); }; // Types diff --git a/modules/ags/config/ts/powermenu.ts b/modules/ags/config/ts/powermenu.ts index 89a3d9d..c10f8b1 100644 --- a/modules/ags/config/ts/powermenu.ts +++ b/modules/ags/config/ts/powermenu.ts @@ -33,7 +33,7 @@ const PowermenuWidget = () => CenterBox({ end_widget: CursorBox({ class_name: 'logout button', - on_primary_click_release: () => Hyprland.sendMessage('dispatch exit') + on_primary_click_release: () => Hyprland.messageAsync('dispatch exit') .catch(print), child: Label({ diff --git a/modules/ags/config/ts/quick-settings/button-grid.ts b/modules/ags/config/ts/quick-settings/button-grid.ts index 4c941e8..1112920 100644 --- a/modules/ags/config/ts/quick-settings/button-grid.ts +++ b/modules/ags/config/ts/quick-settings/button-grid.ts @@ -132,10 +132,10 @@ const GridButton = ({ on_primary_click_release: () => { ButtonStates.forEach((state) => { if (state !== Activated) { - state.value = false; + state.setValue(false); } }); - Activated.value = !Activated.value; + Activated.setValue(!Activated.value); }, on_hover: (self) => { diff --git a/modules/ags/config/ts/quick-settings/network.ts b/modules/ags/config/ts/quick-settings/network.ts index 0e3b05a..68224db 100644 --- a/modules/ags/config/ts/quick-settings/network.ts +++ b/modules/ags/config/ts/quick-settings/network.ts @@ -170,7 +170,7 @@ export const NetworkMenu = () => { if (accesPoint.strength < ap.strength) { APList.get(ap.ssid).attribute - .ap.value = ap; + .ap.setValue(ap); } } else { diff --git a/modules/ags/config/ts/setup.ts b/modules/ags/config/ts/setup.ts index 35db6e6..36cd80f 100644 --- a/modules/ags/config/ts/setup.ts +++ b/modules/ags/config/ts/setup.ts @@ -50,7 +50,7 @@ export default () => { name: 'swipeSpotify1', gesture: 'LR', edge: 'L', - command: () => Hyprland.sendMessage( + command: () => Hyprland.messageAsync( 'dispatch togglespecialworkspace spot', ), }); @@ -59,7 +59,7 @@ export default () => { name: 'swipeSpotify2', gesture: 'RL', edge: 'L', - command: () => Hyprland.sendMessage( + command: () => Hyprland.messageAsync( 'dispatch togglespecialworkspace spot', ), });