fix(ags nvim): get eslint to work again and update deps

This commit is contained in:
matt1432 2024-08-01 12:54:32 -04:00
parent a79cb29aaf
commit 28615e8152
31 changed files with 904 additions and 870 deletions

View file

@ -5,7 +5,7 @@ import { Application } from 'types/service/applications.ts';
const bash = async(strings: TemplateStringsArray | string, ...values: unknown[]) => {
const cmd = typeof strings === 'string' ?
strings :
strings.flatMap((str, i) => `${str }${values[i] ?? ''}`)
strings.flatMap((str, i) => `${str}${values[i] ?? ''}`)
.join('');
return Utils.execAsync(['bash', '-c', cmd]).catch((err) => {

View file

@ -69,7 +69,7 @@ export default () => {
rows.forEach((row) => {
row.changed();
const item = (row.get_children()[0] as AgsAppItem);
const item = row.get_children()[0] as AgsAppItem;
if (item.attribute.app) {
const isMatching = fzfResults.some((r) => {

View file

@ -27,7 +27,7 @@ Hyprland.connect('event', (hyprObj) => {
const mon = Hyprland.getMonitor(c.monitor);
return c.fullscreen &&
c.workspace.id === mon?.activeWorkspace.id;
c.workspace.id === mon?.activeWorkspace.id;
});
const monitors = fsClients.map((c) =>

View file

@ -9,11 +9,11 @@ export default () => HoverRevealer({
icon: Icon().hook(Network, (self) => {
if (Network.wifi.internet === 'connected' ||
Network.wifi.internet === 'connecting') {
Network.wifi.internet === 'connecting') {
self.icon = Network.wifi.icon_name;
}
else if (Network.wired.internet === 'connected' ||
Network.wired.internet === 'connecting') {
Network.wired.internet === 'connecting') {
self.icon = Network.wired.icon_name;
}
else {
@ -23,11 +23,11 @@ export default () => HoverRevealer({
label: Label().hook(Network, (self) => {
if (Network.wifi.internet === 'connected' ||
Network.wifi.internet === 'connecting') {
Network.wifi.internet === 'connecting') {
self.label = Network.wifi.ssid || 'Unknown';
}
else if (Network.wired.internet === 'connected' ||
Network.wired.internet === 'connecting') {
Network.wired.internet === 'connecting') {
self.label = 'Connected';
}
else {

View file

@ -50,7 +50,7 @@ const Workspace = ({ id }: { id: number }) => {
// Deal with urgent windows
const client = Hyprland.getClient(addr);
const isThisUrgent = client &&
client.workspace.id === id;
client.workspace.id === id;
if (isThisUrgent) {
self.toggleClassName('urgent', true);

View file

@ -3,10 +3,12 @@ import CalendarWidget from './main.ts';
import { get_gdkmonitor_from_desc } from '../lib.ts';
const RIGHT_MARGIN = 20;
export default () => PopupWindow({
name: 'calendar',
anchor: ['bottom', 'right'],
margins: [0, 20, 0, 0],
margins: [0, RIGHT_MARGIN, 0, 0],
transition: 'slide bottom',
gdkmonitor: get_gdkmonitor_from_desc('desc:Acer Technologies Acer K212HQL T3EAA0014201'),

View file

@ -15,8 +15,8 @@ import { Box as AgsBox } from 'types/widgets/box';
const lock = Lock.prepare_lock();
const windows: Map<Gdk.Monitor, Gtk.Window> = new Map();
const blurBGs: AgsBox<Gtk.Widget, { geometry: { w: number, h: number }; }>[] = [];
const windows = new Map<Gdk.Monitor, Gtk.Window>();
const blurBGs: AgsBox<Gtk.Widget, { geometry: { w: number, h: number } }>[] = [];
const transition_duration = 1000;
const WINDOW_MARGINS = -2;

View file

@ -19,7 +19,7 @@ import {
export default ({
setup = () => {/**/},
setup = () => { /**/ },
...props
}: Gesture) => {
const widget = EventBox();

View file

@ -3,10 +3,10 @@ import { PopupWindow } from 'global-types';
export default () => {
(App.windows as Array<PopupWindow>)
(App.windows as PopupWindow[])
.filter((w) => w &&
w.close_on_unfocus &&
w.close_on_unfocus !== 'stay')
w.close_on_unfocus &&
w.close_on_unfocus !== 'stay')
.forEach((w) => {
App.closeWindow(w.name);
});

View file

@ -5,6 +5,9 @@ import Gdk from 'gi://Gdk?version=3.0';
import { BaseProps, Widget as AgsWidget } from 'types/widgets/widget';
type EventHandler<Self> = (self: Self, event: Gdk.Event) => boolean | unknown;
// eslint-disable-next-line
export interface CursorBox<Child, Attr> extends AgsWidget<Attr> { }
export type CursorBoxProps<
Child extends Gtk.Widget,
Attr = unknown,
@ -26,10 +29,8 @@ export type CursorBoxProps<
on_secondary_click_release?: EventHandler<Self>
}, Attr>;
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export interface CursorBox<Child, Attr> extends AgsWidget<Attr> { }
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
export class CursorBox<Child extends Gtk.Widget, Attr> extends Gtk.EventBox {
static {
Widget.register(this, {

View file

@ -3,7 +3,7 @@ const { get_home_dir } = imports.gi.GLib;
import GObject from 'types/@girs/gobject-2.0/gobject-2.0';
type Persist = {
interface Persist {
name: string
gobject: GObject.Object
prop: string
@ -11,7 +11,7 @@ type Persist = {
whenTrue?: boolean | string
whenFalse?: boolean | string
signal?: string
};
}
export default ({

View file

@ -8,6 +8,9 @@ import { Window } from 'resource:///com/github/Aylur/ags/widgets/window.js';
import type { WindowProps } from 'types/widgets/window';
import type { Widget as AgsWidget } from 'types/widgets/widget';
// eslint-disable-next-line
export interface PopupWindow<Child, Attr> extends AgsWidget<Attr> { }
import {
CloseType,
HyprTransition,
@ -18,17 +21,15 @@ export type PopupWindowProps<
Attr = unknown,
Self = PopupWindow<Child, Attr>,
> = WindowProps<Child, Attr, Self> & {
transition?: HyprTransition;
on_open?(self: PopupWindow<Child, Attr>): void;
on_close?(self: PopupWindow<Child, Attr>): void;
close_on_unfocus?: CloseType;
anchor?: Array<'top' | 'bottom' | 'right' | 'left'>;
transition?: HyprTransition
on_open?(self: PopupWindow<Child, Attr>): void
on_close?(self: PopupWindow<Child, Attr>): void
close_on_unfocus?: CloseType
anchor?: ('top' | 'bottom' | 'right' | 'left')[]
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export interface PopupWindow<Child, Attr> extends AgsWidget<Attr> { }
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
export class PopupWindow<
Child extends Gtk.Widget,
Attr,
@ -68,6 +69,7 @@ export class PopupWindow<
}
// eslint-disable-next-line no-use-before-define
protected _on_open: (self: PopupWindow<Child, Attr>) => void;
get on_open() {
@ -79,6 +81,7 @@ export class PopupWindow<
}
// eslint-disable-next-line no-use-before-define
private _on_close: (self: PopupWindow<Child, Attr>) => void;
get on_close() {
@ -92,8 +95,8 @@ export class PopupWindow<
constructor({
transition = 'slide top',
on_open = () => {/**/ },
on_close = () => {/**/ },
on_open = () => { /**/ },
on_close = () => { /**/ },
// Window props
name,

View file

@ -9,22 +9,24 @@ import { ListBoxRow } from 'types/@girs/gtk-3.0/gtk-3.0.cjs';
import { Monitor } from 'types/service/hyprland';
import { Binding } from 'types/service';
// eslint-disable-next-line @typescript-eslint/no-empty-object-type
export interface SortedList<Attr> extends AgsWidget<Attr> { }
// eslint-disable-next-line no-use-before-define
type MakeChild = ReturnType<typeof makeChild>;
type SortedListProps<Attr = unknown, Self = SortedList<Attr>> =
PopupWindowProps<MakeChild['child'], Attr, Self> & {
on_select: (row: ListBoxRow) => void;
init_rows?: (list: MakeChild['list']) => void;
set_sort: (
text: string,
list: MakeChild['list'],
placeholder: MakeChild['placeholder'],
) => void;
setup_list?: (list: MakeChild['list']) => void;
};
PopupWindowProps<MakeChild['child'], Attr, Self> & {
on_select: (row: ListBoxRow) => void
init_rows?: (list: MakeChild['list']) => void
set_sort: (
text: string,
list: MakeChild['list'],
placeholder: MakeChild['placeholder'],
) => void
setup_list?: (list: MakeChild['list']) => void
};
// eslint-disable-next-line @typescript-eslint/no-unused-vars
export interface SortedList<Attr> extends AgsWidget<Attr> { }
const centerCursor = async(): Promise<void> => {
@ -108,6 +110,7 @@ const makeChild = (class_name: string | Binding<any, any, string>) => {
};
};
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
export class SortedList<
Attr,
> extends PopupWindow<MakeChild['child'], Attr> {

View file

@ -14,11 +14,11 @@ import { launchApp } from '../applauncher/launch.ts';
// Types
import { Notification as NotifObj } from 'types/service/notifications.ts';
import { Client } from 'types/service/hyprland.ts';
type NotificationWidget = {
interface NotificationWidget {
notif: NotifObj
slideIn?: 'Left' | 'Right'
command?(): void
};
}
import {
CursorBox as CBox,
EventBoxGeneric,
@ -46,7 +46,7 @@ const getDragState = (box: EventBoxGeneric) => (box
const NotificationIcon = (notif: NotifObj) => {
let iconCmd = (box: CBox):void => {
let iconCmd = (box: CBox): void => {
if (!box) {
console.log();
}
@ -66,16 +66,16 @@ const NotificationIcon = (notif: NotifObj) => {
if (!getDragState(box)) {
if (wmClass === 'Proton Mail') {
Hyprland.messageAsync('dispatch ' +
'togglespecialworkspace thunder');
'togglespecialworkspace thunder');
}
else if (wmClass === 'Spotify') {
Hyprland.messageAsync('dispatch ' +
'togglespecialworkspace spot');
'togglespecialworkspace spot');
}
else {
Hyprland.messageAsync('j/clients').then((msg) => {
const clients = JSON.parse(msg) as Array<Client>;
const classes = [] as Array<string>;
const clients = JSON.parse(msg) as Client[];
const classes = [] as string[];
for (const key of clients) {
if (key.class) {
@ -85,7 +85,7 @@ const NotificationIcon = (notif: NotifObj) => {
if (wmClass && classes.includes(wmClass)) {
Hyprland.messageAsync('dispatch ' +
`focuswindow ^(${wmClass})`);
`focuswindow ^(${wmClass})`);
}
else {
Hyprland.messageAsync('dispatch workspace empty')
@ -168,7 +168,7 @@ export const HasNotifs = Variable(false);
export const Notification = ({
notif,
slideIn = 'Left',
command = () => {/**/},
command = () => { /**/ },
}: NotificationWidget) => {
if (!notif) {
return;
@ -248,7 +248,7 @@ export const Notification = ({
notif.close(),
child: Icon('window-close' +
'-symbolic'),
'-symbolic'),
}),
}),
],

View file

@ -44,7 +44,7 @@ const defaultStyle = `${TRANSITION} margin: unset; opacity: 1;`;
export default ({
id,
slideIn = 'Left',
command = () => {/**/},
command = () => { /**/ },
...props
}) => {
const widget = EventBox({

View file

@ -28,7 +28,7 @@ export default (window: OskWindow) => {
window.child.setCss(`margin-bottom: -${HIDDEN_MARGIN}px;`);
let signals = [] as Array<number>;
let signals = [] as number[];
window.attribute = {
startY: null,

View file

@ -45,14 +45,14 @@ const LCTRL_CODE = 29;
// Types
import { Variable as Var } from 'types/variable.ts';
type Key = {
keytype: string,
label: string,
labelShift?: string,
labelAltGr?: string,
shape: string,
interface Key {
keytype: string
label: string
labelShift?: string
labelAltGr?: string
shape: string
keycode: number
};
}
const ModKey = (key: Key) => {

View file

@ -7,7 +7,7 @@ import PopupWindow from '../misc/popup.ts';
import { BoxGeneric } from 'global-types';
// Import all the OSDs as an array
const OSDList = [] as Array<() => BoxGeneric>;
const OSDList = [] as (() => BoxGeneric)[];
import * as Modules from './osds.ts';
for (const osd in Modules) {

View file

@ -187,7 +187,7 @@ export const BluetoothMenu = () => {
// Make bottom scroll indicator appear only
// when first getting overflowing children
if (!(bottomArrow.reveal_child === true ||
topArrow.reveal_child === true)) {
topArrow.reveal_child === true)) {
bottomArrow.reveal_child = true;
}
}
@ -200,7 +200,7 @@ export const BluetoothMenu = () => {
}
// Trigger sort_func
(self.get_children() as Array<ListBoxRow>)
(self.get_children() as ListBoxRow[])
.forEach((ch) => {
ch.changed();
});

View file

@ -36,7 +36,7 @@ type IndicatorTuple = [
signal?: string,
];
type GridButtonType = {
interface GridButtonType {
command?(): void
secondary_command?(): void
on_open?(menu: RevealerGeneric): void
@ -44,17 +44,17 @@ type GridButtonType = {
indicator?: IndicatorTuple
// @ts-expect-error me is lazy
menu?: Widget
};
}
// TODO: do vpn button
const SPACING = 28;
const ButtonStates = [] as Array<Var<boolean>>;
const ButtonStates = [] as Var<boolean>[];
const GridButton = ({
command = () => {/**/},
secondary_command = () => {/**/},
on_open = () => {/**/},
command = () => { /**/ },
secondary_command = () => { /**/ },
on_open = () => { /**/ },
icon,
indicator,
menu,
@ -158,7 +158,7 @@ const GridButton = ({
?.children[1] as BoxGeneric;
const isSetup = (rowMenu
.get_children() as Array<BoxGeneric>)
.get_children() as BoxGeneric[])
.find((ch) => ch === menu);
if (!isSetup) {

View file

@ -43,7 +43,7 @@ const AccessPoint = (ap: APType) => {
self.setCss(
`opacity: ${
widget.attribute.ap.value.ssid ===
Network.wifi.ssid ?
Network.wifi.ssid ?
'1' :
'0'
};
@ -150,7 +150,7 @@ export const NetworkMenu = () => {
self.hook(Network, () => {
// Add missing APs
const currentAPs = Network.wifi
?.access_points as Array<APType>;
?.access_points as APType[];
currentAPs.forEach((ap) => {
if (ap.ssid !== 'Unknown') {
@ -214,7 +214,7 @@ export const NetworkMenu = () => {
// Make bottom scroll indicator appear only
// when first getting overflowing children
if (!(bottomArrow.reveal_child === true ||
topArrow.reveal_child === true)) {
topArrow.reveal_child === true)) {
bottomArrow.reveal_child = true;
}
}
@ -227,7 +227,7 @@ export const NetworkMenu = () => {
}
// Trigger sort_func
(self.get_children() as Array<ListBoxRow>)
(self.get_children() as ListBoxRow[])
.forEach((ch) => {
ch.changed();
});