refactor(ags): prioritise getters when using astal libs
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
10b70583e0
commit
179e402504
30 changed files with 176 additions and 164 deletions
|
@ -6,21 +6,23 @@ import AstalHyprland from 'gi://AstalHyprland';
|
|||
export const get_hyprland_monitor = (monitor: Gdk.Monitor): AstalHyprland.Monitor | undefined => {
|
||||
const hyprland = AstalHyprland.get_default();
|
||||
|
||||
const manufacturer = monitor.manufacturer?.replace(',', '');
|
||||
const model = monitor.model?.replace(',', '');
|
||||
const manufacturer = monitor.get_manufacturer()?.replace(',', '');
|
||||
const model = monitor.get_model()?.replace(',', '');
|
||||
const start = `${manufacturer} ${model}`;
|
||||
|
||||
return hyprland.get_monitors().find((m) => m.description?.startsWith(start));
|
||||
return hyprland.get_monitors().find((m) => m.get_description()?.startsWith(start));
|
||||
};
|
||||
|
||||
export const get_hyprland_monitor_desc = (monitor: Gdk.Monitor): string => {
|
||||
const hyprland = AstalHyprland.get_default();
|
||||
|
||||
const manufacturer = monitor.manufacturer?.replace(',', '');
|
||||
const model = monitor.model?.replace(',', '');
|
||||
const manufacturer = monitor.get_manufacturer()?.replace(',', '');
|
||||
const model = monitor.get_model()?.replace(',', '');
|
||||
const start = `${manufacturer} ${model}`;
|
||||
|
||||
return `desc:${hyprland.get_monitors().find((m) => m.description?.startsWith(start))?.description}`;
|
||||
return `desc:${hyprland
|
||||
.get_monitors()
|
||||
.find((m) => m.get_description()?.startsWith(start))?.get_description()}`;
|
||||
};
|
||||
|
||||
export const get_gdkmonitor_from_desc = (desc: string): Gdk.Monitor => {
|
||||
|
@ -38,7 +40,7 @@ export const get_gdkmonitor_from_desc = (desc: string): Gdk.Monitor => {
|
|||
};
|
||||
|
||||
export const get_monitor_desc = (mon: AstalHyprland.Monitor): string => {
|
||||
return `desc:${mon.description}`;
|
||||
return `desc:${mon.get_description()}`;
|
||||
};
|
||||
|
||||
export const hyprMessage = (message: string) => new Promise<string>((
|
||||
|
@ -66,25 +68,25 @@ export const centerCursor = (): void => {
|
|||
let y: number;
|
||||
const monitor = hyprland.get_focused_monitor();
|
||||
|
||||
switch (monitor.transform) {
|
||||
switch (monitor.get_transform()) {
|
||||
case 1:
|
||||
x = monitor.x - (monitor.height / 2);
|
||||
y = monitor.y - (monitor.width / 2);
|
||||
x = monitor.get_x() - (monitor.get_height() / 2);
|
||||
y = monitor.get_y() - (monitor.get_width() / 2);
|
||||
break;
|
||||
|
||||
case 2:
|
||||
x = monitor.x - (monitor.width / 2);
|
||||
y = monitor.y - (monitor.height / 2);
|
||||
x = monitor.get_x() - (monitor.get_width() / 2);
|
||||
y = monitor.get_y() - (monitor.get_height() / 2);
|
||||
break;
|
||||
|
||||
case 3:
|
||||
x = monitor.x + (monitor.height / 2);
|
||||
y = monitor.y + (monitor.width / 2);
|
||||
x = monitor.get_x() + (monitor.get_height() / 2);
|
||||
y = monitor.get_y() + (monitor.get_width() / 2);
|
||||
break;
|
||||
|
||||
default:
|
||||
x = monitor.x + (monitor.width / 2);
|
||||
y = monitor.y + (monitor.height / 2);
|
||||
x = monitor.get_x() + (monitor.get_width() / 2);
|
||||
y = monitor.get_y() + (monitor.get_height() / 2);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ interface NotifySendProps {
|
|||
urgency?: 'low' | 'normal' | 'critical'
|
||||
}
|
||||
|
||||
const escapeShellArg = (arg: string): string => `'${arg?.replace(/'/g, '\'\\\'\'')}'`;
|
||||
const escapeShellArg = (arg: string | undefined): string => `'${arg?.replace(/'/g, '\'\\\'\'') ?? ''}'`;
|
||||
|
||||
export const notifySend = ({
|
||||
actions = [],
|
||||
|
|
|
@ -27,7 +27,7 @@ export class AppItem extends Widget.Box {
|
|||
|
||||
const icon = (
|
||||
<icon
|
||||
icon={this.app.iconName}
|
||||
icon={this.app.get_icon_name()}
|
||||
css="font-size: 42px; margin-right: 25px;"
|
||||
/>
|
||||
);
|
||||
|
@ -36,7 +36,7 @@ export class AppItem extends Widget.Box {
|
|||
<box vertical>
|
||||
<label
|
||||
className="title"
|
||||
label={app.name}
|
||||
label={app.get_name()}
|
||||
xalign={0}
|
||||
truncate
|
||||
valign={Gtk.Align.CENTER}
|
||||
|
@ -45,7 +45,7 @@ export class AppItem extends Widget.Box {
|
|||
{app.description !== '' && (
|
||||
<label
|
||||
className="description"
|
||||
label={app.description}
|
||||
label={app.get_description()}
|
||||
wrap
|
||||
xalign={0}
|
||||
justify={Gtk.Justification.LEFT}
|
||||
|
|
|
@ -16,10 +16,10 @@ export default () => SortedList({
|
|||
create_row: (app) => <AppItem app={app} />,
|
||||
|
||||
fzf_options: {
|
||||
selector: (app) => app.name + app.executable,
|
||||
selector: (app) => app.get_name() + app.get_executable(),
|
||||
|
||||
tiebreakers: [
|
||||
(a, b) => b.item.frequency - a.item.frequency,
|
||||
(a, b) => b.item.get_frequency() - a.item.get_frequency(),
|
||||
],
|
||||
},
|
||||
|
||||
|
@ -40,11 +40,11 @@ export default () => SortedList({
|
|||
a.set_visible(true);
|
||||
b.set_visible(true);
|
||||
|
||||
return row2.frequency - row1.frequency;
|
||||
return row2.get_frequency() - row1.get_frequency();
|
||||
}
|
||||
else {
|
||||
const s1 = fzfResults.find((r) => r.item.name === row1.name)?.score ?? 0;
|
||||
const s2 = fzfResults.find((r) => r.item.name === row2.name)?.score ?? 0;
|
||||
const s1 = fzfResults.find((r) => r.item.get_name() === row1.get_name())?.score ?? 0;
|
||||
const s2 = fzfResults.find((r) => r.item.get_name() === row2.get_name())?.score ?? 0;
|
||||
|
||||
a.set_visible(s1 !== 0);
|
||||
b.set_visible(s2 !== 0);
|
||||
|
|
|
@ -23,5 +23,6 @@ export const launchApp = (app: AstalApps.Application) => {
|
|||
.join(' ');
|
||||
|
||||
bash(`${exe} &`);
|
||||
app.frequency += 1;
|
||||
|
||||
app.set_frequency(app.get_frequency() + 1);
|
||||
};
|
||||
|
|
|
@ -6,7 +6,7 @@ import { ComboBoxText } from '../misc/subclasses';
|
|||
|
||||
|
||||
export default (devices: AstalWp.Device[]) => devices
|
||||
.sort((a, b) => a.description.localeCompare(b.description))
|
||||
.sort((a, b) => a.get_description().localeCompare(b.description))
|
||||
.map((device) => (
|
||||
<box className="stream" vertical>
|
||||
|
||||
|
@ -15,19 +15,19 @@ export default (devices: AstalWp.Device[]) => devices
|
|||
<ComboBoxText
|
||||
setup={(self) => {
|
||||
const profiles = (device.get_profiles() ?? []).sort((a, b) => {
|
||||
if (a.description === 'Off') {
|
||||
if (a.get_description() === 'Off') {
|
||||
return 1;
|
||||
}
|
||||
else if (b.description === 'Off') {
|
||||
else if (b.get_description() === 'Off') {
|
||||
return -1;
|
||||
}
|
||||
else {
|
||||
return a.description.localeCompare(b.description);
|
||||
return a.get_description().localeCompare(b.get_description());
|
||||
}
|
||||
});
|
||||
|
||||
profiles.forEach((profile) => {
|
||||
self.append(profile.index.toString(), profile.description);
|
||||
self.append(profile.get_index().toString(), profile.get_description());
|
||||
});
|
||||
|
||||
self.set_active(
|
||||
|
@ -38,7 +38,11 @@ export default (devices: AstalWp.Device[]) => devices
|
|||
}}
|
||||
|
||||
onChanged={(self) => {
|
||||
device.set_active_profile(parseInt(self.activeId));
|
||||
const activeId = self.get_active_id();
|
||||
|
||||
if (activeId) {
|
||||
device.set_active_profile(parseInt(activeId));
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@ export default (streams: AstalWp.Endpoint[]) => {
|
|||
let group: RadioButton | undefined;
|
||||
|
||||
return streams
|
||||
.sort((a, b) => a.description.localeCompare(b.description))
|
||||
.sort((a, b) => a.get_description().localeCompare(b.get_description()))
|
||||
.map((stream) => (
|
||||
<box className="stream" vertical>
|
||||
|
||||
|
@ -29,14 +29,14 @@ export default (streams: AstalWp.Endpoint[]) => {
|
|||
self.group = group;
|
||||
}
|
||||
|
||||
self.active = stream.isDefault;
|
||||
self.active = stream.get_is_default();
|
||||
self.hook(stream, 'notify::is-default', () => {
|
||||
self.active = stream.isDefault;
|
||||
self.active = stream.get_is_default();
|
||||
});
|
||||
}}
|
||||
|
||||
onButtonReleaseEvent={() => {
|
||||
stream.isDefault = true;
|
||||
stream.set_is_default(true);
|
||||
}}
|
||||
/>
|
||||
|
||||
|
@ -56,12 +56,12 @@ export default (streams: AstalWp.Endpoint[]) => {
|
|||
valign={Gtk.Align.END}
|
||||
|
||||
onButtonReleaseEvent={() => {
|
||||
stream.mute = !stream.mute;
|
||||
stream.set_mute(!stream.get_mute());
|
||||
}}
|
||||
>
|
||||
<icon
|
||||
icon={bind(stream, 'mute').as((isMuted) => {
|
||||
if (stream.mediaClass === AstalWp.MediaClass.AUDIO_MICROPHONE) {
|
||||
if (stream.get_media_class() === AstalWp.MediaClass.AUDIO_MICROPHONE) {
|
||||
return isMuted ?
|
||||
'audio-input-microphone-muted-symbolic' :
|
||||
'audio-input-microphone-symbolic';
|
||||
|
|
|
@ -7,7 +7,7 @@ import PopupWindow from '../../misc/popup-window';
|
|||
|
||||
|
||||
export default () => {
|
||||
const speaker = AstalWp.get_default()?.audio.default_speaker;
|
||||
const speaker = AstalWp.get_default()?.get_audio()?.get_default_speaker();
|
||||
|
||||
if (!speaker) {
|
||||
throw new Error('Could not find default audio devices.');
|
||||
|
@ -26,7 +26,7 @@ export default () => {
|
|||
'right',
|
||||
);
|
||||
|
||||
win.visible = !win.visible;
|
||||
win.set_visible(!win.get_visible());
|
||||
}}
|
||||
>
|
||||
<overlay passThrough>
|
||||
|
|
|
@ -27,7 +27,7 @@ export default () => {
|
|||
'right',
|
||||
);
|
||||
|
||||
win.visible = !win.visible;
|
||||
win.set_visible(!win.get_visible());
|
||||
}}
|
||||
>
|
||||
{bind(bluetooth, 'isPowered').as((isPowered) => {
|
||||
|
@ -38,7 +38,9 @@ export default () => {
|
|||
return (
|
||||
<box>
|
||||
{bind(bluetooth, 'isConnected').as((isConnected) => {
|
||||
const device = bluetooth.get_devices().find((dev) => dev.connected);
|
||||
const device = bluetooth
|
||||
.get_devices()
|
||||
.find((dev) => dev.get_connected());
|
||||
|
||||
if (!isConnected || !device) {
|
||||
return (<icon icon="bluetooth-active-symbolic" />);
|
||||
|
|
|
@ -38,13 +38,13 @@ export default () => {
|
|||
'right',
|
||||
);
|
||||
|
||||
win.visible = !win.visible;
|
||||
win.set_visible(!win.get_visible());
|
||||
}}
|
||||
|
||||
setup={(self) => {
|
||||
App.connect('window-toggled', (_, win) => {
|
||||
if (win.name === 'win-notif-center') {
|
||||
self.toggleClassName('toggle-on', win.visible);
|
||||
if (win.get_name() === 'win-notif-center') {
|
||||
self.toggleClassName('toggle-on', win.get_visible());
|
||||
}
|
||||
});
|
||||
}}
|
||||
|
|
|
@ -21,13 +21,13 @@ export default () => {
|
|||
const updateVars = (
|
||||
client: AstalHyprland.Client | null = hyprland.get_focused_client(),
|
||||
) => {
|
||||
lastFocusedAddress = client ? client.address : null;
|
||||
lastFocusedAddress = client ? client.get_address() : null;
|
||||
|
||||
const app = applications.fuzzy_query(
|
||||
client?.class ?? '',
|
||||
client?.get_class() ?? '',
|
||||
)[0];
|
||||
|
||||
const icon = app?.iconName;
|
||||
const icon = app?.get_icon_name();
|
||||
|
||||
if (icon) {
|
||||
visibleIcon.set(true);
|
||||
|
@ -37,7 +37,7 @@ export default () => {
|
|||
visibleIcon.set(false);
|
||||
}
|
||||
|
||||
focusedTitle.set(client?.title ?? '');
|
||||
focusedTitle.set(client?.get_title() ?? '');
|
||||
const id = client?.connect('notify::title', (c) => {
|
||||
if (c.get_address() !== lastFocusedAddress) {
|
||||
c.disconnect(id);
|
||||
|
|
|
@ -18,10 +18,10 @@ export default () => {
|
|||
client: AstalHyprland.Client | null = hyprland.get_focused_client(),
|
||||
) => {
|
||||
const app = applications.fuzzy_query(
|
||||
client?.class ?? '',
|
||||
client?.get_class() ?? '',
|
||||
)[0];
|
||||
|
||||
const icon = app?.iconName;
|
||||
const icon = app?.get_icon_name();
|
||||
|
||||
if (icon) {
|
||||
visibleIcon.set(true);
|
||||
|
|
|
@ -28,7 +28,7 @@ export default () => {
|
|||
'right',
|
||||
);
|
||||
|
||||
win.visible = !win.visible;
|
||||
win.set_visible(!win.get_visible());
|
||||
}}
|
||||
>
|
||||
{bind(network, 'primary').as((primary) => {
|
||||
|
@ -38,7 +38,7 @@ export default () => {
|
|||
else if (primary === AstalNetwork.Primary.WIFI) {
|
||||
const Wifi = network.get_wifi();
|
||||
|
||||
if (!Wifi || Wifi.accessPoints.length === 0) { return; }
|
||||
if (!Wifi || Wifi.get_access_points().length === 0) { return; }
|
||||
|
||||
return (
|
||||
<box>
|
||||
|
|
|
@ -27,13 +27,13 @@ export default () => {
|
|||
'right',
|
||||
);
|
||||
|
||||
win.visible = !win.visible;
|
||||
win.set_visible(!win.get_visible());
|
||||
}}
|
||||
|
||||
setup={(self) => {
|
||||
App.connect('window-toggled', (_, win) => {
|
||||
if (win.name === 'win-notif-center') {
|
||||
self.toggleClassName('toggle-on', win.visible);
|
||||
if (win.get_name() === 'win-notif-center') {
|
||||
self.toggleClassName('toggle-on', win.get_visible());
|
||||
}
|
||||
});
|
||||
}}
|
||||
|
@ -41,7 +41,7 @@ export default () => {
|
|||
<box>
|
||||
<icon
|
||||
icon={bind(notifications, 'notifications').as((notifs) => {
|
||||
if (notifications.dontDisturb) {
|
||||
if (notifications.get_dont_disturb()) {
|
||||
return 'notification-disabled-symbolic';
|
||||
}
|
||||
else if (notifs.length > 0) {
|
||||
|
|
|
@ -8,7 +8,7 @@ const SKIP_ITEMS = ['.spotify-wrapped'];
|
|||
|
||||
const TrayItem = (item: AstalTray.TrayItem) => {
|
||||
if (item.iconThemePath) {
|
||||
App.add_icons(item.iconThemePath);
|
||||
App.add_icons(item.get_icon_theme_path());
|
||||
}
|
||||
|
||||
return (
|
||||
|
@ -43,7 +43,7 @@ export default () => {
|
|||
setup={(self) => {
|
||||
self
|
||||
.hook(tray, 'item-added', (_, item: string) => {
|
||||
if (itemMap.has(item) || SKIP_ITEMS.includes(tray.get_item(item).title)) {
|
||||
if (itemMap.has(item) || SKIP_ITEMS.includes(tray.get_item(item).get_title())) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -89,10 +89,10 @@ export default () => {
|
|||
.child as Widget.Box)
|
||||
.children as Widget.Revealer[];
|
||||
|
||||
const currentIndex = indicators.findIndex((w) => w.name === currentId);
|
||||
const currentIndex = indicators.findIndex((w) => w.get_name() === currentId);
|
||||
|
||||
if (currentIndex >= 0) {
|
||||
self.css = `margin-left: ${L_PADDING + (currentIndex * WS_WIDTH)}px`;
|
||||
self.set_css(`margin-left: ${L_PADDING + (currentIndex * WS_WIDTH)}px`);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -123,40 +123,40 @@ export default () => {
|
|||
<box
|
||||
setup={(self) => {
|
||||
const refresh = () => {
|
||||
(self.children as Widget.Revealer[]).forEach((rev) => {
|
||||
rev.reveal_child = false;
|
||||
(self.get_children() as Widget.Revealer[]).forEach((rev) => {
|
||||
rev.set_reveal_child(false);
|
||||
});
|
||||
|
||||
workspaces.forEach((ws) => {
|
||||
ws.reveal_child = true;
|
||||
ws.set_reveal_child(true);
|
||||
});
|
||||
};
|
||||
|
||||
const updateWorkspaces = () => {
|
||||
Hyprland.get_workspaces().forEach((ws) => {
|
||||
const currentWs = (self.children as Widget.Revealer[])
|
||||
.find((ch) => ch.name === ws.id.toString());
|
||||
const currentWs = (self.get_children() as Widget.Revealer[])
|
||||
.find((ch) => ch.get_name() === ws.get_id().toString());
|
||||
|
||||
if (!currentWs && ws.id > 0) {
|
||||
self.add(Workspace({ id: ws.id }));
|
||||
if (!currentWs && ws.get_id() > 0) {
|
||||
self.add(Workspace({ id: ws.get_id() }));
|
||||
}
|
||||
});
|
||||
|
||||
// Make sure the order is correct
|
||||
workspaces.forEach((workspace, i) => {
|
||||
(workspace.get_parent() as Widget.Box)
|
||||
.reorder_child(workspace, i);
|
||||
(workspace.get_parent() as Widget.Box).reorder_child(workspace, i);
|
||||
});
|
||||
};
|
||||
|
||||
const updateAll = () => {
|
||||
workspaces = (self.children as Widget.Revealer[])
|
||||
workspaces = (self.get_children() as Widget.Revealer[])
|
||||
.filter((ch) => {
|
||||
return Hyprland.get_workspaces().find((ws) => {
|
||||
return ws.id.toString() === ch.name;
|
||||
return ws.get_id().toString() === ch.get_name();
|
||||
});
|
||||
})
|
||||
.sort((a, b) => parseInt(a.name ?? '0') - parseInt(b.name ?? '0'));
|
||||
.sort((a, b) =>
|
||||
parseInt(a.get_name() ?? '0') - parseInt(b.get_name() ?? '0'));
|
||||
|
||||
updateWorkspaces();
|
||||
refresh();
|
||||
|
|
|
@ -87,7 +87,7 @@ export default class DeviceWidget extends Widget.Revealer {
|
|||
dev.pair();
|
||||
}
|
||||
else {
|
||||
bluetooth.adapter.remove_device(dev);
|
||||
bluetooth.get_adapter()?.remove_device(dev);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
|
@ -111,7 +111,7 @@ export default class DeviceWidget extends Widget.Revealer {
|
|||
<button
|
||||
cursor="pointer"
|
||||
onButtonReleaseEvent={() => {
|
||||
rev.revealChild = !rev.revealChild;
|
||||
rev.set_reveal_child(!rev.get_reveal_child());
|
||||
}}
|
||||
>
|
||||
<box>
|
||||
|
@ -155,7 +155,7 @@ export default class DeviceWidget extends Widget.Revealer {
|
|||
this.dev = dev;
|
||||
|
||||
this.connect('realize', () => idle(() => {
|
||||
this.revealChild = true;
|
||||
this.set_reveal_child(true);
|
||||
}));
|
||||
};
|
||||
};
|
||||
|
|
|
@ -12,29 +12,29 @@ import DeviceWidget from './device';
|
|||
const calculateDevSort = (dev: AstalBluetooth.Device) => {
|
||||
let value = 0;
|
||||
|
||||
if (dev.connected) {
|
||||
if (dev.get_connected()) {
|
||||
value += 1000;
|
||||
}
|
||||
if (dev.paired) {
|
||||
if (dev.get_paired()) {
|
||||
value += 100;
|
||||
}
|
||||
if (dev.blocked) {
|
||||
if (dev.get_blocked()) {
|
||||
value += 10;
|
||||
}
|
||||
if (dev.icon) {
|
||||
if (dev.icon === 'audio-headset') {
|
||||
if (dev.get_icon()) {
|
||||
if (dev.get_icon() === 'audio-headset') {
|
||||
value += 9;
|
||||
}
|
||||
if (dev.icon === 'audio-headphones') {
|
||||
if (dev.get_icon() === 'audio-headphones') {
|
||||
value += 8;
|
||||
}
|
||||
if (dev.icon === 'audio-card') {
|
||||
if (dev.get_icon() === 'audio-card') {
|
||||
value += 7;
|
||||
}
|
||||
if (dev.icon === 'computer') {
|
||||
if (dev.get_icon() === 'computer') {
|
||||
value += 6;
|
||||
}
|
||||
if (dev.icon === 'phone') {
|
||||
if (dev.get_icon() === 'phone') {
|
||||
value += 5;
|
||||
}
|
||||
}
|
||||
|
@ -58,13 +58,13 @@ export default () => {
|
|||
|
||||
setup={(self) => {
|
||||
bluetooth.devices
|
||||
.filter((dev) => dev.name)
|
||||
.filter((dev) => dev.get_name())
|
||||
.forEach((dev) => {
|
||||
self.add(<DeviceWidget dev={dev} />);
|
||||
});
|
||||
|
||||
self.hook(bluetooth, 'device-added', (_, dev) => {
|
||||
if (dev.name) {
|
||||
if (dev.get_name()) {
|
||||
self.add(<DeviceWidget dev={dev} />);
|
||||
self.invalidate_sort();
|
||||
}
|
||||
|
@ -78,11 +78,11 @@ export default () => {
|
|||
const devWidget = children.find((ch) => ch.dev === dev);
|
||||
|
||||
if (devWidget) {
|
||||
devWidget.revealChild = false;
|
||||
devWidget.set_reveal_child(false);
|
||||
|
||||
setTimeout(() => {
|
||||
devWidget.get_parent()?.destroy();
|
||||
}, devWidget.transitionDuration + 100);
|
||||
}, devWidget.get_transition_duration() + 100);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -92,7 +92,7 @@ export default () => {
|
|||
|
||||
const sort = calculateDevSort(devB) - calculateDevSort(devA);
|
||||
|
||||
return sort !== 0 ? sort : devA.name.localeCompare(devB.name);
|
||||
return sort !== 0 ? sort : devA.get_name().localeCompare(devB.get_name());
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
@ -114,7 +114,7 @@ export default () => {
|
|||
|
||||
setup={(self) => {
|
||||
self.connect('notify::active', () => {
|
||||
bluetooth.adapter?.set_powered(self.active);
|
||||
bluetooth.get_adapter()?.set_powered(self.active);
|
||||
});
|
||||
}}
|
||||
/>
|
||||
|
@ -133,10 +133,10 @@ export default () => {
|
|||
self.toggleClassName('active', self.active);
|
||||
|
||||
if (self.active) {
|
||||
bluetooth.adapter?.start_discovery();
|
||||
bluetooth.get_adapter()?.start_discovery();
|
||||
}
|
||||
else {
|
||||
bluetooth.adapter?.stop_discovery();
|
||||
bluetooth.get_adapter()?.stop_discovery();
|
||||
}
|
||||
}}
|
||||
>
|
||||
|
|
|
@ -64,7 +64,7 @@ export default (hyprpaper: InstanceType<typeof Process>) => {
|
|||
onActivate={(self) => {
|
||||
AstalGreet.login(
|
||||
dropdown.get_active_text() ?? '',
|
||||
self.text || '',
|
||||
self.get_text() || '',
|
||||
'Hyprland',
|
||||
(_, res) => {
|
||||
try {
|
||||
|
@ -77,7 +77,7 @@ export default (hyprpaper: InstanceType<typeof Process>) => {
|
|||
}, 500);
|
||||
}
|
||||
catch (error) {
|
||||
response.label = JSON.stringify(error);
|
||||
response.set_label(JSON.stringify(error));
|
||||
}
|
||||
},
|
||||
);
|
||||
|
@ -94,7 +94,7 @@ export default (hyprpaper: InstanceType<typeof Process>) => {
|
|||
setup={(self) => {
|
||||
centerCursor();
|
||||
setTimeout(() => {
|
||||
self.visible = true;
|
||||
self.set_visible(true);
|
||||
password.grab_focus();
|
||||
}, 1000);
|
||||
}}
|
||||
|
|
|
@ -43,16 +43,16 @@ export default () => {
|
|||
|
||||
const unlock = () => {
|
||||
blurBGs.forEach((b) => {
|
||||
b.css = bgCSS({
|
||||
b.set_css(bgCSS({
|
||||
w: b.geometry.w,
|
||||
h: 1,
|
||||
});
|
||||
}));
|
||||
|
||||
timeout(transition_duration / 2, () => {
|
||||
b.css = bgCSS({
|
||||
b.set_css(bgCSS({
|
||||
w: 1,
|
||||
h: 1,
|
||||
});
|
||||
}));
|
||||
});
|
||||
});
|
||||
timeout(transition_duration, () => {
|
||||
|
@ -86,8 +86,8 @@ export default () => {
|
|||
|
||||
idle(() => {
|
||||
rev.geometry = {
|
||||
w: monitor.geometry.width,
|
||||
h: monitor.geometry.height,
|
||||
w: monitor.get_geometry().width,
|
||||
h: monitor.get_geometry().height,
|
||||
};
|
||||
|
||||
rev.css = bgCSS({
|
||||
|
@ -164,17 +164,17 @@ export default () => {
|
|||
onRealize={(self) => self.grab_focus()}
|
||||
|
||||
onActivate={(self) => {
|
||||
self.sensitive = false;
|
||||
self.set_sensitive(false);
|
||||
|
||||
AstalAuth.Pam.authenticate(self.text ?? '', (_, task) => {
|
||||
AstalAuth.Pam.authenticate(self.get_text() ?? '', (_, task) => {
|
||||
try {
|
||||
AstalAuth.Pam.authenticate_finish(task);
|
||||
unlock();
|
||||
}
|
||||
catch (e) {
|
||||
self.text = '';
|
||||
label.label = (e as Error).message;
|
||||
self.sensitive = true;
|
||||
self.set_text('');
|
||||
label.set_label((e as Error).message);
|
||||
self.set_sensitive(true);
|
||||
}
|
||||
});
|
||||
}}
|
||||
|
|
|
@ -87,7 +87,7 @@ export class PopupWindow extends Widget.Window {
|
|||
const monitor = this.gdkmonitor ??
|
||||
this.get_display().get_monitor_at_point(alloc.x, alloc.y);
|
||||
|
||||
const transform = get_hyprland_monitor(monitor)?.transform;
|
||||
const transform = get_hyprland_monitor(monitor)?.get_transform();
|
||||
|
||||
let width: number;
|
||||
|
||||
|
|
|
@ -80,9 +80,12 @@ export class SortedList<T> {
|
|||
this.fzf_results = out;
|
||||
list.invalidate_sort();
|
||||
|
||||
const visibleApplications = list.get_children().filter((row) => row.visible).length;
|
||||
const visibleApplications = list
|
||||
.get_children()
|
||||
.filter((row) => row.get_visible())
|
||||
.length;
|
||||
|
||||
placeholder.reveal_child = visibleApplications <= 0;
|
||||
placeholder.set_reveal_child(visibleApplications <= 0);
|
||||
})
|
||||
.catch(() => { /**/ });
|
||||
};
|
||||
|
@ -134,7 +137,7 @@ export class SortedList<T> {
|
|||
name={name}
|
||||
keymode={Astal.Keymode.ON_DEMAND}
|
||||
on_open={() => {
|
||||
entry.text = '';
|
||||
entry.set_text('');
|
||||
refreshItems();
|
||||
centerCursor();
|
||||
entry.grab_focus();
|
||||
|
|
|
@ -15,7 +15,7 @@ const apCommand = (ap: AstalNetwork.AccessPoint, cmd: string[]): void => {
|
|||
ap.get_ssid()!,
|
||||
]).catch((e) => notifySend({
|
||||
title: 'Network',
|
||||
iconName: ap.iconName,
|
||||
iconName: ap.get_icon_name(),
|
||||
body: (e as Error).message,
|
||||
actions: [
|
||||
{
|
||||
|
|
|
@ -52,7 +52,7 @@ const NotificationList = () => {
|
|||
const notif = (self.get_children() as NotifGestureWrapper[])
|
||||
.find((ch) => ch.id === id);
|
||||
|
||||
if (notif?.sensitive) {
|
||||
if (notif?.get_sensitive()) {
|
||||
notif.slideAway('Right');
|
||||
}
|
||||
});
|
||||
|
|
|
@ -143,7 +143,7 @@ export class NotifGestureWrapper extends Widget.EventBox {
|
|||
return;
|
||||
}
|
||||
|
||||
revChild.css = side === 'Left' ? slideLeft : slideRight;
|
||||
revChild.set_css(side === 'Left' ? slideLeft : slideRight);
|
||||
|
||||
timeout(ANIM_DURATION - 100, () => {
|
||||
rev = this.get_child() as Widget.Revealer | null;
|
||||
|
@ -265,21 +265,21 @@ export class NotifGestureWrapper extends Widget.EventBox {
|
|||
|
||||
// Slide right
|
||||
if (offset > 0) {
|
||||
self.css = `
|
||||
self.set_css(`
|
||||
opacity: 1; transition: none;
|
||||
margin-left: ${offset}px;
|
||||
margin-right: -${offset}px;
|
||||
`;
|
||||
`);
|
||||
}
|
||||
|
||||
// Slide left
|
||||
else {
|
||||
offset = Math.abs(offset);
|
||||
self.css = `
|
||||
self.set_css(`
|
||||
opacity: 1; transition: none;
|
||||
margin-right: ${offset}px;
|
||||
margin-left: -${offset}px;
|
||||
`;
|
||||
`);
|
||||
}
|
||||
|
||||
// Put a threshold on if a click is actually dragging
|
||||
|
@ -301,7 +301,7 @@ export class NotifGestureWrapper extends Widget.EventBox {
|
|||
this.slideAway(offset > 0 ? 'Right' : 'Left');
|
||||
}
|
||||
else {
|
||||
self.css = defaultStyle;
|
||||
self.set_css(defaultStyle);
|
||||
this.dragging = false;
|
||||
|
||||
this.setCursor('grab');
|
||||
|
@ -313,9 +313,9 @@ export class NotifGestureWrapper extends Widget.EventBox {
|
|||
}
|
||||
|
||||
// Reverse of slideAway, so it started at squeeze, then we go to slide
|
||||
self.css = this.slide_in_from === 'Left' ?
|
||||
self.set_css(this.slide_in_from === 'Left' ?
|
||||
slideLeft :
|
||||
slideRight;
|
||||
slideRight);
|
||||
|
||||
idle(() => {
|
||||
if (!notifications.get_notification(id)) {
|
||||
|
@ -336,7 +336,7 @@ export class NotifGestureWrapper extends Widget.EventBox {
|
|||
}
|
||||
|
||||
// Then we go to center
|
||||
self.css = defaultStyle;
|
||||
self.set_css(defaultStyle);
|
||||
|
||||
if (this.is_popup) {
|
||||
timeout(ANIM_DURATION, () => {
|
||||
|
|
|
@ -69,7 +69,7 @@ const setupButton = (self: Gtk.Widget) => {
|
|||
if (!display) {
|
||||
return;
|
||||
}
|
||||
self.window.set_cursor(Gdk.Cursor.new_from_name(
|
||||
self.get_window()?.set_cursor(Gdk.Cursor.new_from_name(
|
||||
display,
|
||||
'pointer',
|
||||
));
|
||||
|
@ -80,7 +80,7 @@ const setupButton = (self: Gtk.Widget) => {
|
|||
if (!display) {
|
||||
return;
|
||||
}
|
||||
self.window.set_cursor(null);
|
||||
self.get_window()?.set_cursor(null);
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -127,7 +127,7 @@ export const Notification = ({
|
|||
}
|
||||
}}*/
|
||||
>
|
||||
<box vertical className={`notification ${notifObj.urgency} widget`}>
|
||||
<box vertical className={`notification ${notifObj.get_urgency()} widget`}>
|
||||
{/* Content */}
|
||||
<box>
|
||||
<NotifIcon notifObj={notifObj} />
|
||||
|
@ -146,8 +146,8 @@ export const Notification = ({
|
|||
max_width_chars={24}
|
||||
truncate
|
||||
wrap
|
||||
label={notifObj.summary}
|
||||
use_markup={notifObj.summary.startsWith('<')}
|
||||
label={notifObj.get_summary()}
|
||||
use_markup={notifObj.get_summary().startsWith('<')}
|
||||
/>
|
||||
|
||||
{/* Time */}
|
||||
|
@ -155,7 +155,7 @@ export const Notification = ({
|
|||
className="time"
|
||||
valign={Gtk.Align.CENTER}
|
||||
halign={Gtk.Align.END}
|
||||
label={setTime(notifObj.time)}
|
||||
label={setTime(notifObj.get_time())}
|
||||
/>
|
||||
|
||||
{/* Close button */}
|
||||
|
@ -180,7 +180,7 @@ export const Notification = ({
|
|||
hexpand
|
||||
use_markup
|
||||
xalign={0}
|
||||
label={notifObj.body}
|
||||
label={notifObj.get_body()}
|
||||
wrap
|
||||
/>
|
||||
</box>
|
||||
|
|
|
@ -42,8 +42,8 @@ export default () => {
|
|||
globalThis.popup_osd = popup;
|
||||
|
||||
const brightness = Brightness.get_default();
|
||||
const speaker = AstalWp.get_default()?.audio.default_speaker;
|
||||
const microphone = AstalWp.get_default()?.audio.default_microphone;
|
||||
const speaker = AstalWp.get_default()?.get_audio()?.get_default_speaker();
|
||||
const microphone = AstalWp.get_default()?.get_audio()?.get_default_microphone();
|
||||
|
||||
if (!speaker || !microphone) {
|
||||
throw new Error('Could not find default audio devices.');
|
||||
|
|
|
@ -42,20 +42,20 @@ export default (window: OskWindow) => {
|
|||
if (tablet.oskState) {
|
||||
window.setSlideDown();
|
||||
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
transition: margin-bottom ${ANIM_DURATION}ms cubic-bezier(0.36, 0, 0.66, -0.56);
|
||||
margin-bottom: 0px;
|
||||
`;
|
||||
`);
|
||||
}
|
||||
else {
|
||||
releaseAllKeys();
|
||||
|
||||
window.setSlideUp();
|
||||
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
transition: margin-bottom ${ANIM_DURATION}ms cubic-bezier(0.36, 0, 0.66, -0.56);
|
||||
margin-bottom: -${calculatedHeight}px;
|
||||
`;
|
||||
`);
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -91,23 +91,23 @@ export default (window: OskWindow) => {
|
|||
const offset = window.startY - currentY;
|
||||
|
||||
if (offset < 0) {
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
transition: margin-bottom 0.5s ease-in-out;
|
||||
margin-bottom: -${calculatedHeight}px;
|
||||
`;
|
||||
`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (offset > calculatedHeight) {
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
margin-bottom: 0px;
|
||||
`;
|
||||
`);
|
||||
}
|
||||
else {
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
margin-bottom: ${offset - calculatedHeight}px;
|
||||
`;
|
||||
`);
|
||||
}
|
||||
});
|
||||
}),
|
||||
|
@ -125,17 +125,17 @@ export default (window: OskWindow) => {
|
|||
const offset = window.startY - currentY;
|
||||
|
||||
if (offset > calculatedHeight) {
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
transition: margin-bottom 0.5s ease-in-out;
|
||||
margin-bottom: 0px;
|
||||
`;
|
||||
`);
|
||||
tablet.oskState = true;
|
||||
}
|
||||
else {
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
transition: margin-bottom 0.5s ease-in-out;
|
||||
margin-bottom: -${calculatedHeight}px;
|
||||
`;
|
||||
`);
|
||||
}
|
||||
|
||||
window.startY = null;
|
||||
|
@ -172,17 +172,17 @@ export default (window: OskWindow) => {
|
|||
const offset = window.startY - currentY;
|
||||
|
||||
if (offset > 0) {
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
transition: margin-bottom 0.5s ease-in-out;
|
||||
margin-bottom: 0px;
|
||||
`;
|
||||
`);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
margin-bottom: ${offset}px;
|
||||
`;
|
||||
`);
|
||||
});
|
||||
}),
|
||||
);
|
||||
|
@ -199,18 +199,18 @@ export default (window: OskWindow) => {
|
|||
const offset = window.startY - currentY;
|
||||
|
||||
if (offset < -(calculatedHeight * 2 / 3)) {
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
transition: margin-bottom 0.5s ease-in-out;
|
||||
margin-bottom: -${calculatedHeight}px;
|
||||
`;
|
||||
`);
|
||||
|
||||
tablet.oskState = false;
|
||||
}
|
||||
else {
|
||||
window.get_child().css = `
|
||||
window.get_child().set_css(`
|
||||
transition: margin-bottom 0.5s ease-in-out;
|
||||
margin-bottom: 0px;
|
||||
`;
|
||||
`);
|
||||
}
|
||||
|
||||
window.startY = null;
|
||||
|
|
|
@ -148,9 +148,9 @@ const RegularKey = (key: Key) => {
|
|||
self
|
||||
.hook(Shift, () => {
|
||||
if (key.labelShift) {
|
||||
self.label = Shift.get() ?
|
||||
self.set_label(Shift.get() ?
|
||||
key.labelShift :
|
||||
key.label;
|
||||
key.label);
|
||||
}
|
||||
})
|
||||
.hook(Caps, () => {
|
||||
|
@ -161,18 +161,18 @@ const RegularKey = (key: Key) => {
|
|||
}
|
||||
|
||||
if (key.labelShift && key.label.match(/[A-Za-z]/)) {
|
||||
self.label = Caps.get() ?
|
||||
self.set_label(Caps.get() ?
|
||||
key.labelShift :
|
||||
key.label;
|
||||
key.label);
|
||||
}
|
||||
})
|
||||
.hook(AltGr, () => {
|
||||
if (key.labelAltGr) {
|
||||
self.toggleClassName('altgr', AltGr.get());
|
||||
|
||||
self.label = AltGr.get() ?
|
||||
self.set_label(AltGr.get() ?
|
||||
key.labelAltGr :
|
||||
key.label;
|
||||
key.label);
|
||||
}
|
||||
});
|
||||
}}
|
||||
|
|
|
@ -27,7 +27,7 @@ export default () => {
|
|||
const windowList = <box vertical /> as Widget.Box;
|
||||
|
||||
const updateWindows = async() => {
|
||||
if (!App.get_window('win-screenshot')?.visible) {
|
||||
if (!App.get_window('win-screenshot')?.get_visible()) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -77,11 +77,11 @@ export default () => {
|
|||
cursor="pointer"
|
||||
|
||||
onButtonReleaseEvent={() => {
|
||||
takeScreenshot(['-o', monitor.name]);
|
||||
takeScreenshot(['-o', monitor.get_name()]);
|
||||
}}
|
||||
>
|
||||
<label
|
||||
label={`${monitor.name}: ${monitor.description}`}
|
||||
label={`${monitor.get_name()}: ${monitor.get_description()}`}
|
||||
truncate
|
||||
maxWidthChars={50}
|
||||
/>
|
||||
|
@ -125,9 +125,9 @@ export default () => {
|
|||
|
||||
onButtonReleaseEvent={() => {
|
||||
frozen = !frozen;
|
||||
freezeIcon.icon = frozen ?
|
||||
freezeIcon.set_icon(frozen ?
|
||||
'checkbox-checked-symbolic' :
|
||||
'checkbox-symbolic';
|
||||
'checkbox-symbolic');
|
||||
}}
|
||||
>
|
||||
<box halign={Gtk.Align.CENTER}>
|
||||
|
|
Loading…
Reference in a new issue