fix(ags): fix latest breaking changes
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-02-11 02:18:59 -05:00
parent 58f2056e41
commit 281e00c7fe
20 changed files with 53 additions and 53 deletions

View file

@ -145,10 +145,10 @@ class Pointers extends Service {
return; return;
} }
Hyprland.sendMessage('j/layers').then((response) => { Hyprland.messageAsync('j/layers').then((response) => {
const layers = JSON.parse(response) as { Layers: Layers }; 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; const pos = JSON.parse(res) as CursorPos;
Object.values(layers).forEach((key) => { Object.values(layers).forEach((key) => {

View file

@ -133,14 +133,14 @@ class Tablet extends Service {
const orientation = ROTATION_MAP[index]; const orientation = ROTATION_MAP[index];
Hyprland.sendMessage( Hyprland.messageAsync(
`keyword monitor ${SCREEN},transform,${orientation}`, `keyword monitor ${SCREEN},transform,${orientation}`,
).catch(print); ).catch(print);
const batchRotate = DEVICES.map((dev) => const batchRotate = DEVICES.map((dev) =>
`keyword device:${dev}:transform ${orientation}; `); `keyword device:${dev}:transform ${orientation}; `);
Hyprland.sendMessage(`[[BATCH]] ${batchRotate.flat()}`); Hyprland.messageAsync(`[[BATCH]] ${batchRotate.flat()}`);
if (TouchGestures.gestureDaemon) { if (TouchGestures.gestureDaemon) {
TouchGestures.killDaemon(); TouchGestures.killDaemon();

View file

@ -15,7 +15,7 @@ const BarCloser = (variable: Var<boolean>) => Window({
child: EventBox({ child: EventBox({
on_hover: (self) => { on_hover: (self) => {
variable.value = false; variable.setValue(false);
const parent = self.get_parent(); const parent = self.get_parent();
if (parent) { if (parent) {
@ -45,12 +45,12 @@ export default (props?: DefaultProps) => {
); );
if (workspace) { if (workspace) {
Revealed.value = !workspace['hasfullscreen']; Revealed.setValue(!workspace['hasfullscreen']);
} }
}; };
const checkGlobalFsState = (_: BoxGeneric, fullscreen: boolean) => { const checkGlobalFsState = (_: BoxGeneric, fullscreen: boolean) => {
Revealed.value = !fullscreen; Revealed.setValue(!fullscreen);
}; };
self self
@ -73,7 +73,7 @@ export default (props?: DefaultProps) => {
child: EventBox({ child: EventBox({
on_hover: () => { on_hover: () => {
barCloser.visible = true; barCloser.visible = true;
Revealed.value = true; Revealed.setValue(true);
}, },
child: Box({ child: Box({

View file

@ -21,7 +21,7 @@ const getKbdLayout = (self: LabelGeneric, _: string, layout: string) => {
} }
else { else {
// At launch, kb layout is undefined // 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) const keyboards = Array.from(JSON.parse(obj)
.keyboards) as Keyboard[]; .keyboards) as Keyboard[];
const kb = keyboards.find((v) => v.name === DEFAULT_KB); const kb = keyboards.find((v) => v.name === DEFAULT_KB);

View file

@ -16,7 +16,7 @@ Persist({
export default () => CursorBox({ export default () => CursorBox({
on_primary_click_release: () => { on_primary_click_release: () => {
HeartState.value = HeartState.value === '' ? '󰣐' : ''; HeartState.setValue(HeartState.value === '' ? '󰣐' : '');
}, },
child: Label({ child: Label({

View file

@ -50,7 +50,7 @@ const SysTray = () => MenuBar({
} }
self.attribute.items.set(id, w); self.attribute.items.set(id, w);
self.child = w; self.add(w);
self.show_all(); self.show_all();
w.child.reveal_child = true; w.child.reveal_child = true;

View file

@ -26,7 +26,7 @@ const Workspace = ({ id }: { id: number }) => {
tooltip_text: `${id}`, tooltip_text: `${id}`,
on_primary_click_release: () => { on_primary_click_release: () => {
Hyprland.sendMessage(`dispatch workspace ${id}`); Hyprland.messageAsync(`dispatch workspace ${id}`);
}, },
child: Box({ child: Box({

View file

@ -60,17 +60,17 @@ export const CoverArt = (
// Give temp cover art // Give temp cover art
readFileAsync(player.cover_path).catch(() => { readFileAsync(player.cover_path).catch(() => {
if (!colors.value && !player.track_cover_url) { if (!colors.value && !player.track_cover_url) {
colors.value = { colors.setValue({
imageAccent: '#6b4fa2', imageAccent: '#6b4fa2',
buttonAccent: '#ecdcff', buttonAccent: '#ecdcff',
buttonText: '#25005a', buttonText: '#25005a',
hoverAccent: '#d4baff', hoverAccent: '#d4baff',
}; });
self.attribute.bgStyle = ` self.attribute.bgStyle = `
background: radial-gradient(circle, background: radial-gradient(circle,
rgba(0, 0, 0, 0.4) 30%, rgba(0, 0, 0, 0.4) 30%,
${colors.value.imageAccent}), ${(colors as Var<Colors>).value.imageAccent}),
rgb(0, 0, 0); rgb(0, 0, 0);
background-size: cover; background-size: cover;
background-position: center; background-position: center;
@ -87,7 +87,7 @@ export const CoverArt = (
return; return;
} }
colors.value = JSON.parse(out); colors.setValue(JSON.parse(out));
self.attribute.bgStyle = ` self.attribute.bgStyle = `
background: radial-gradient(circle, background: radial-gradient(circle,

View file

@ -23,14 +23,14 @@ Audio.connect('speaker-changed', () => {
} }
if (Audio.speaker.stream?.is_muted) { if (Audio.speaker.stream?.is_muted) {
SpeakerIcon.value = speakerIcons[0]; SpeakerIcon.setValue(speakerIcons[0]);
} }
else { else {
const vol = Audio.speaker.volume * 100; const vol = Audio.speaker.volume * 100;
for (const threshold of [-1, 0, 33, 66, 100]) { for (const threshold of [-1, 0, 33, 66, 100]) {
if (vol > threshold + 1) { 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) { if (Audio.microphone.stream?.is_muted) {
MicIcon.value = micIcons[0]; MicIcon.setValue(micIcons[0]);
} }
else { else {
const vol = Audio.microphone.volume * 100; const vol = Audio.microphone.volume * 100;
for (const threshold of [-1, 0, 33, 66]) { for (const threshold of [-1, 0, 33, 66]) {
if (vol > threshold + 1) { if (vol > threshold + 1) {
MicIcon.value = micIcons[threshold + 1]; MicIcon.setValue(micIcons[threshold + 1]);
} }
} }
} }

View file

@ -70,10 +70,10 @@ export class CursorBox<Child extends Gtk.Widget, Attr> extends Gtk.EventBox {
return; return;
} }
this.#canRun.value = !( this.#canRun.setValue(!(
x > this.get_allocated_width() || x > this.get_allocated_width() ||
y > this.get_allocated_height() y > this.get_allocated_height()
); ));
}, 'end'); }, 'end');
this.connect('enter-notify-event', (_, event: Gdk.Event) => { this.connect('enter-notify-event', (_, event: Gdk.Event) => {
@ -169,7 +169,7 @@ export class CursorBox<Child extends Gtk.Widget, Attr> extends Gtk.EventBox {
} }
set disabled(value: boolean) { set disabled(value: boolean) {
this.#disabled.value = value; this.#disabled.setValue(value);
} }
get child() { get child() {

View file

@ -43,7 +43,7 @@ export class PopupWindow<
} }
set content(value: Gtk.Widget) { set content(value: Gtk.Widget) {
this.#content.value = value; this.#content.setValue(value);
this.child.show_all(); this.child.show_all();
} }
@ -79,7 +79,7 @@ export class PopupWindow<
const antiClip = Variable(false); const antiClip = Variable(false);
if (content) { if (content) {
contentVar.value = content; contentVar.setValue(content);
} }
super({ super({
@ -104,7 +104,7 @@ export class PopupWindow<
}); });
if (blur) { if (blur) {
Hyprland.sendMessage('[[BATCH]] ' + Hyprland.messageAsync('[[BATCH]] ' +
`keyword layerrule ignorealpha[0.97],${name}; ` + `keyword layerrule ignorealpha[0.97],${name}; ` +
`keyword layerrule blur,${name}`); `keyword layerrule blur,${name}`);
} }
@ -254,7 +254,7 @@ export class PopupWindow<
alloc.height + 10; alloc.height + 10;
if (needsAnticlipping) { if (needsAnticlipping) {
antiClip.value = true; antiClip.setValue(true);
const thisTimeout = timeout( const thisTimeout = timeout(
transition_duration, transition_duration,
@ -262,7 +262,7 @@ export class PopupWindow<
// Only run the timeout if there isn't a newer timeout // Only run the timeout if there isn't a newer timeout
if (thisTimeout === if (thisTimeout ===
currentTimeout) { currentTimeout) {
antiClip.value = false; antiClip.setValue(false);
} }
}, },
); );

View file

@ -64,15 +64,15 @@ const NotificationIcon = (notif: NotifObj) => {
iconCmd = (box) => { iconCmd = (box) => {
if (!getDragState(box)) { if (!getDragState(box)) {
if (wmClass === 'thunderbird') { if (wmClass === 'thunderbird') {
Hyprland.sendMessage('dispatch ' + Hyprland.messageAsync('dispatch ' +
'togglespecialworkspace thunder'); 'togglespecialworkspace thunder');
} }
else if (wmClass === 'Spotify') { else if (wmClass === 'Spotify') {
Hyprland.sendMessage('dispatch ' + Hyprland.messageAsync('dispatch ' +
'togglespecialworkspace spot'); 'togglespecialworkspace spot');
} }
else { else {
Hyprland.sendMessage('j/clients').then((msg) => { Hyprland.messageAsync('j/clients').then((msg) => {
const clients = JSON.parse(msg) as Array<Client>; const clients = JSON.parse(msg) as Array<Client>;
const classes = [] as Array<string>; const classes = [] as Array<string>;
@ -83,11 +83,11 @@ const NotificationIcon = (notif: NotifObj) => {
} }
if (wmClass && classes.includes(wmClass)) { if (wmClass && classes.includes(wmClass)) {
Hyprland.sendMessage('dispatch ' + Hyprland.messageAsync('dispatch ' +
`focuswindow ^(${wmClass})`); `focuswindow ^(${wmClass})`);
} }
else { else {
Hyprland.sendMessage('dispatch workspace empty') Hyprland.messageAsync('dispatch workspace empty')
.then(() => { .then(() => {
app.launch(); app.launch();
}); });
@ -183,7 +183,7 @@ export const Notification = ({
return; return;
} }
HasNotifs.value = Notifications.notifications.length > 0; HasNotifs.setValue(Notifications.notifications.length > 0);
// Init notif // Init notif
const notifWidget = Gesture({ const notifWidget = Gesture({

View file

@ -123,8 +123,8 @@ export default ({
// Kill notif and update HasNotifs after anim is done // Kill notif and update HasNotifs after anim is done
command(); command();
HasNotifs.value = Notifications HasNotifs.setValue(Notifications
.notifications.length > 0; .notifications.length > 0);
(widget.get_parent() as BoxGeneric)?.remove(widget); (widget.get_parent() as BoxGeneric)?.remove(widget);
}); });

View file

@ -76,7 +76,7 @@ export default (window) => {
// Begin drag // Begin drag
signals.push( signals.push(
gesture.connect('drag-begin', () => { gesture.connect('drag-begin', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => { Hyprland.messageAsync('j/cursorpos').then((out) => {
window.attribute.startY = JSON.parse(out).y; window.attribute.startY = JSON.parse(out).y;
}); });
}), }),
@ -85,7 +85,7 @@ export default (window) => {
// Update drag // Update drag
signals.push( signals.push(
gesture.connect('drag-update', () => { gesture.connect('drag-update', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => { Hyprland.messageAsync('j/cursorpos').then((out) => {
const currentY = JSON.parse(out).y; const currentY = JSON.parse(out).y;
const offset = window.attribute.startY - currentY; const offset = window.attribute.startY - currentY;
@ -117,7 +117,7 @@ export default (window) => {
// Begin drag // Begin drag
signals.push( signals.push(
gesture.connect('drag-begin', () => { gesture.connect('drag-begin', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => { Hyprland.messageAsync('j/cursorpos').then((out) => {
window.attribute.startY = JSON.parse(out).y; window.attribute.startY = JSON.parse(out).y;
}); });
}), }),
@ -126,7 +126,7 @@ export default (window) => {
// Update drag // Update drag
signals.push( signals.push(
gesture.connect('drag-update', () => { gesture.connect('drag-update', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => { Hyprland.messageAsync('j/cursorpos').then((out) => {
const currentY = JSON.parse(out).y; const currentY = JSON.parse(out).y;
const offset = window.attribute.startY - currentY; const offset = window.attribute.startY - currentY;

View file

@ -22,7 +22,7 @@ const RCtrl = Variable(false);
const Caps = Variable(false); const Caps = Variable(false);
Brightness.connect('caps', (_, state) => { Brightness.connect('caps', (_, state) => {
Caps.value = state; Caps.setValue(state);
}); });
// Assume both shifts are the same for key.labelShift // Assume both shifts are the same for key.labelShift
@ -32,10 +32,10 @@ const RShift = Variable(false);
const Shift = Variable(false); const Shift = Variable(false);
LShift.connect('changed', () => { LShift.connect('changed', () => {
Shift.value = LShift.value || RShift.value; Shift.setValue(LShift.value || RShift.value);
}); });
RShift.connect('changed', () => { RShift.connect('changed', () => {
Shift.value = LShift.value || RShift.value; Shift.setValue(LShift.value || RShift.value);
}); });
const SPACING = 4; const SPACING = 4;
@ -100,13 +100,13 @@ const ModKey = (key: Key) => {
execAsync(`ydotool key ${key.keycode}:${Mod.value ? 0 : 1}`); execAsync(`ydotool key ${key.keycode}:${Mod.value ? 0 : 1}`);
label.toggleClassName('active', !Mod.value); label.toggleClassName('active', !Mod.value);
Mod.value = !Mod.value; Mod.setValue(!Mod.value);
}, },
setup: (self) => { setup: (self) => {
self self
.hook(NormalClick, () => { .hook(NormalClick, () => {
Mod.value = false; Mod.setValue(false);
label.toggleClassName('active', false); label.toggleClassName('active', false);
execAsync(`ydotool key ${key.keycode}:0`); 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}:1`);
execAsync(`ydotool key ${key.keycode}:0`); execAsync(`ydotool key ${key.keycode}:0`);
NormalClick.value = true; NormalClick.setValue(true);
}, 'cancelled'); }, 'cancelled');
return Box({ return Box({

View file

@ -13,7 +13,7 @@ const AUDIO_MAX = 1.5;
const ShowSpeaker = Variable(true); const ShowSpeaker = Variable(true);
globalThis.showSpeaker = () => { globalThis.showSpeaker = () => {
ShowSpeaker.value = !ShowSpeaker.value; ShowSpeaker.setValue(!ShowSpeaker.value);
}; };
// Types // Types

View file

@ -33,7 +33,7 @@ const PowermenuWidget = () => CenterBox({
end_widget: CursorBox({ end_widget: CursorBox({
class_name: 'logout button', class_name: 'logout button',
on_primary_click_release: () => Hyprland.sendMessage('dispatch exit') on_primary_click_release: () => Hyprland.messageAsync('dispatch exit')
.catch(print), .catch(print),
child: Label({ child: Label({

View file

@ -132,10 +132,10 @@ const GridButton = ({
on_primary_click_release: () => { on_primary_click_release: () => {
ButtonStates.forEach((state) => { ButtonStates.forEach((state) => {
if (state !== Activated) { if (state !== Activated) {
state.value = false; state.setValue(false);
} }
}); });
Activated.value = !Activated.value; Activated.setValue(!Activated.value);
}, },
on_hover: (self) => { on_hover: (self) => {

View file

@ -170,7 +170,7 @@ export const NetworkMenu = () => {
if (accesPoint.strength < ap.strength) { if (accesPoint.strength < ap.strength) {
APList.get(ap.ssid).attribute APList.get(ap.ssid).attribute
.ap.value = ap; .ap.setValue(ap);
} }
} }
else { else {

View file

@ -50,7 +50,7 @@ export default () => {
name: 'swipeSpotify1', name: 'swipeSpotify1',
gesture: 'LR', gesture: 'LR',
edge: 'L', edge: 'L',
command: () => Hyprland.sendMessage( command: () => Hyprland.messageAsync(
'dispatch togglespecialworkspace spot', 'dispatch togglespecialworkspace spot',
), ),
}); });
@ -59,7 +59,7 @@ export default () => {
name: 'swipeSpotify2', name: 'swipeSpotify2',
gesture: 'RL', gesture: 'RL',
edge: 'L', edge: 'L',
command: () => Hyprland.sendMessage( command: () => Hyprland.messageAsync(
'dispatch togglespecialworkspace spot', 'dispatch togglespecialworkspace spot',
), ),
}); });