refactor(ags): update to new types
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-01-22 10:23:32 -05:00
parent c2e8eee3a3
commit 7fd12f5b04
30 changed files with 660 additions and 153 deletions

2
.gitignore vendored
View file

@ -1,7 +1,7 @@
*.egg-info
*.temp
*node_modules/
*types/
*types
*build/
result*
*config.js

View file

@ -114,6 +114,7 @@
"@stylistic/no-whitespace-before-property": ["warn"],
"@stylistic/nonblock-statement-body-position": ["error", "below"],
"@stylistic/object-curly-newline": ["warn", { "consistent": true }],
"@stylistic/object-property-newline": ["warn", {"allowAllPropertiesOnSameLine": false}],
"@stylistic/object-curly-spacing": ["warn", "always"],
"@stylistic/operator-linebreak": ["warn", "after"],
"@stylistic/padded-blocks": ["error", "never"],

View file

@ -16,7 +16,7 @@ const ON_CLICK_TRIGGERS = [
// Types
import AgsWindow from 'types/widgets/window';
type Subprocess = typeof imports.gi.Gio.Subprocess;
import { Subprocess } from 'types/@girs/gio-2.0/gio-2.0.cjs';
type Layer = {
address: string;
x: number;
@ -52,7 +52,7 @@ class Pointers extends Service {
});
}
#process: Subprocess;
#process = null as Subprocess | null;
#lastLine = '';
#pointers = [] as Array<String>;
@ -169,7 +169,10 @@ class Pointers extends Service {
// Return an empty Layer if widget doesn't exist
{
address: '',
x: 0, y: 0, w: 0, h: 0,
x: 0,
y: 0,
w: 0,
h: 0,
namespace: '',
},
);

View file

@ -16,7 +16,7 @@ const DEVICES = [
];
// Types
type Subprocess = typeof imports.gi.Gio.Subprocess;
import { Subprocess } from 'types/@girs/gio-2.0/gio-2.0.cjs';
class Tablet extends Service {
@ -36,8 +36,8 @@ class Tablet extends Service {
#tabletMode = false;
#oskState = false;
#autorotate: Subprocess;
#blockedInputs: Subprocess;
#autorotate = null as Subprocess | null;
#blockedInputs = null as Subprocess | null;
get tabletMode() {
return this.#tabletMode;

View file

@ -33,7 +33,7 @@ const DISTANCE_VERIF = [
];
// Types
type Subprocess = typeof imports.gi.Gio.Subprocess;
import { Subprocess } from 'types/@girs/gio-2.0/gio-2.0.cjs';
// TODO: add actmode param
@ -47,7 +47,7 @@ class TouchGestures extends Service {
}
#gestures = new Map();
#gestureDaemon: Subprocess;
#gestureDaemon = null as Subprocess | null;
get gestures() {
return this.#gestures;

View file

@ -11,12 +11,14 @@ import AppItem from './app-item.ts';
// Types
import { Application } from 'types/service/applications.ts';
type ListBoxRow = typeof imports.gi.Gtk.ListBoxRow;
import { ListBoxRow } from 'types/@girs/gtk-3.0/gtk-3.0.cjs';
import AgsEventBox from 'types/widgets/eventbox';
const Applauncher = (window_name = 'applauncher') => {
let fzfResults: Array<any>;
const list = ListBox({});
// @ts-expect-error
const list = ListBox();
const setSort = (text: string) => {
const fzf = new Fzf(Applications.list, {
@ -31,8 +33,10 @@ const Applauncher = (window_name = 'applauncher') => {
fzfResults = fzf.find(text);
list.set_sort_func(
(a: ListBoxRow, b: ListBoxRow) => {
const row1 = a.get_children()[0]?.attribute.app.name;
const row2 = b.get_children()[0]?.attribute.app.name;
const row1 = (a.get_children()[0] as AgsEventBox)
?.attribute.app.name;
const row2 = (b.get_children()[0] as AgsEventBox)
?.attribute.app.name;
if (!row1 || !row2) {
return 0;
@ -95,7 +99,7 @@ const Applauncher = (window_name = 'applauncher') => {
rows.forEach((row) => {
row.changed();
const item = row.get_children()[0];
const item = (row.get_children()[0] as AgsEventBox);
if (item?.attribute.app) {
const isMatching = fzfResults.find((r) => {

View file

@ -1,12 +1,16 @@
import { Label } from 'resource:///com/github/Aylur/ags/widget.js';
const { new_now_local } = imports.gi.GLib.DateTime;
export default () => Label({ class_name: 'clock' })
.poll(1000, (self) => {
const time = imports.gi.GLib
.DateTime.new_now_local();
const time = new_now_local();
self.label = time.format('%a. ') +
time.get_day_of_month() +
time.format(' %b. %H:%M');
const dayName = time.format('%a. ');
const dayNum = time.get_day_of_month();
const date = time.format(' %b. %H:%M');
if (dayNum && dayName && date) {
self.label = dayName + dayNum + date;
}
});

View file

@ -11,7 +11,6 @@ const SPACING = 12;
// Types
import { TrayItem } from 'types/service/systemtray.ts';
import AgsRevealer from 'types/widgets/revealer.ts';
type Menu = typeof imports.gi.Gtk.Menu;
const SysTrayItem = (item: TrayItem) => {
@ -20,7 +19,7 @@ const SysTrayItem = (item: TrayItem) => {
}
return MenuItem({
submenu: <Menu> item.menu,
submenu: item.menu,
tooltip_markup: item.bind('tooltip_markup'),
child: Revealer({

View file

@ -1,6 +1,6 @@
import { Box, DrawingArea } from 'resource:///com/github/Aylur/ags/widget.js';
import Gtk from 'gi://Gtk';
const { Gtk } = imports.gi;
export default (
place = 'top left',
@ -26,7 +26,10 @@ export default (
.get_property('border-radius', Gtk.StateFlags.NORMAL);
widget.set_size_request(r, r);
widget.connect('draw', (_, cr) => {
widget.connect('draw', (_, context) => {
// FIXME: get proper Context type
const cr = context as any;
const c = widget.get_style_context()
.get_property('background-color', Gtk.StateFlags.NORMAL);

View file

@ -1,6 +1,6 @@
import { Box, Calendar, Label } from 'resource:///com/github/Aylur/ags/widget.js';
const { DateTime } = imports.gi.GLib;
const { new_now_local } = imports.gi.GLib.DateTime;
import PopupWindow from './misc/popup.ts';
@ -26,7 +26,7 @@ const Time = () => Box({
label: 'hour',
setup: (self) => {
self.poll(1000, () => {
self.label = DateTime.new_now_local().format('%H');
self.label = new_now_local().format('%H') || '';
});
},
}),
@ -38,7 +38,7 @@ const Time = () => Box({
label: 'minute',
setup: (self) => {
self.poll(1000, () => {
self.label = DateTime.new_now_local().format('%M');
self.label = new_now_local().format('%M') || '';
});
},
}),
@ -56,11 +56,15 @@ const Time = () => Box({
setup: (self) => {
self.poll(1000, () => {
const time = DateTime.new_now_local();
const time = new_now_local();
self.label = time.format('%A, %B ') +
time.get_day_of_month() +
time.format(', %Y');
const dayNameMonth = time.format('%A, %B ');
const dayNum = time.get_day_of_month();
const date = time.format(', %Y');
if (dayNum && dayNameMonth && date) {
self.label = dayNameMonth + dayNum + date;
}
});
},
}),

View file

@ -218,6 +218,9 @@ export const PositionSlider = (
// OnClick
.on('button-press-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'grabbing',
@ -226,6 +229,9 @@ export const PositionSlider = (
// OnRelease
.on('button-release-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'pointer',
@ -234,6 +240,9 @@ export const PositionSlider = (
// OnHover
.on('enter-notify-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'pointer',

View file

@ -49,6 +49,9 @@ export default ({
}).on('enter-notify-event', (self) => {
on_hover(self);
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
Disabled.value ?

View file

@ -1,9 +1,11 @@
import { execAsync, readFileAsync, timeout } from 'resource:///com/github/Aylur/ags/utils.js';
const { get_home_dir } = imports.gi.GLib;
import GObject from 'types/@girs/gobject-2.0/gobject-2.0';
type Persist = {
name: string
gobject: typeof imports.gi.GObject
gobject: GObject.Object
prop: string
condition?: boolean | string // If string, compare following props to this
whenTrue?: boolean | string

View file

@ -6,8 +6,7 @@ import { Box, Overlay, Window } from 'resource:///com/github/Aylur/ags/widget.js
import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
// Types
type Allocation = typeof imports.gi.Gtk.Allocation;
type Widget = typeof imports.gi.Gtk.Widget;
import { Allocation, Widget } from 'types/@girs/gtk-3.0/gtk-3.0.cjs';
import { RevealerProps } from 'types/widgets/revealer';
import { WindowProps } from 'types/widgets/window';
import AgsWindow from 'types/widgets/window';

View file

@ -131,7 +131,8 @@ const NotificationIcon = (notif: NotifObj) => {
min-height: 78px;
`,
children: [Icon({
icon, size: 58,
icon,
size: 58,
hpack: 'center',
hexpand: true,
vpack: 'center',

View file

@ -54,6 +54,9 @@ export default ({
self
// OnClick
.on('button-press-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'grabbing',
@ -62,6 +65,9 @@ export default ({
// OnRelease
.on('button-release-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'grab',
@ -70,6 +76,9 @@ export default ({
// OnHover
.on('enter-notify-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'grab',
@ -98,7 +107,6 @@ export default ({
id,
slideAway: (side: 'Left' | 'Right') => {
// Slide away
(widget.child as AgsBox)
.setCss(side === 'Left' ? slideLeft : slideRight);
@ -135,7 +143,7 @@ export default ({
.hook(gesture, () => {
let offset = gesture.get_offset()[1];
if (offset === 0) {
if (!offset || offset === 0) {
return;
}
@ -189,6 +197,10 @@ export default ({
const offset = gesture.get_offset()[1];
if (!offset) {
return;
}
// If crosses threshold after letting go, slide away
if (Math.abs(offset) > MAX_OFFSET) {
if (offset > 0) {

View file

@ -33,6 +33,8 @@ export default (window: AgsWindow) => {
let signals = [] as Array<number>;
window.attribute = {
startY: null,
setVisible: (state: boolean) => {
if (state) {
window.visible = true;
@ -66,6 +68,7 @@ export default (window: AgsWindow) => {
gesture.disconnect(id);
});
signals = [];
window.attribute.startY = null;
},
setSlideUp: () => {
@ -75,7 +78,7 @@ export default (window: AgsWindow) => {
signals.push(
gesture.connect('drag-begin', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => {
gesture.startY = JSON.parse(out).y;
window.attribute.startY = JSON.parse(out).y;
});
}),
);
@ -85,7 +88,7 @@ export default (window: AgsWindow) => {
gesture.connect('drag-update', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => {
const currentY = JSON.parse(out).y;
const offset = gesture.startY - currentY;
const offset = window.attribute.startY - currentY;
if (offset < 0) {
return;
@ -116,7 +119,7 @@ export default (window: AgsWindow) => {
signals.push(
gesture.connect('drag-begin', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => {
gesture.startY = JSON.parse(out).y;
window.attribute.startY = JSON.parse(out).y;
});
}),
);
@ -126,7 +129,7 @@ export default (window: AgsWindow) => {
gesture.connect('drag-update', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => {
const currentY = JSON.parse(out).y;
const offset = gesture.startY - currentY;
const offset = window.attribute.startY - currentY;
if (offset > 0) {
return;

View file

@ -11,93 +11,540 @@ export const oskLayouts = {
// key types are: normal, tab, caps, shift, control, fn (normal w/ half height), space, expand
keys: [
[
{ keytype: 'normal', label: 'Esc', shape: 'fn', keycode: 1 },
{ keytype: 'normal', label: 'F1', shape: 'fn', keycode: 59 },
{ keytype: 'normal', label: 'F2', shape: 'fn', keycode: 60 },
{ keytype: 'normal', label: 'F3', shape: 'fn', keycode: 61 },
{ keytype: 'normal', label: 'F4', shape: 'fn', keycode: 62 },
{ keytype: 'normal', label: 'F5', shape: 'fn', keycode: 63 },
{ keytype: 'normal', label: 'F6', shape: 'fn', keycode: 64 },
{ keytype: 'normal', label: 'F7', shape: 'fn', keycode: 65 },
{ keytype: 'normal', label: 'F8', shape: 'fn', keycode: 66 },
{ keytype: 'normal', label: 'F9', shape: 'fn', keycode: 67 },
{ keytype: 'normal', label: 'F10', shape: 'fn', keycode: 68 },
{ keytype: 'normal', label: 'F11', shape: 'fn', keycode: 87 },
{ keytype: 'normal', label: 'F12', shape: 'fn', keycode: 88 },
{ keytype: 'normal', label: 'Home', shape: 'fn', keycode: 110 },
{ keytype: 'normal', label: 'End', shape: 'fn', keycode: 115 },
{ keytype: 'normal', label: 'Del', shape: 'fn', keycode: 111 },
{
keytype: 'normal',
label: 'Esc',
shape: 'fn',
keycode: 1,
},
{
keytype: 'normal',
label: 'F1',
shape: 'fn',
keycode: 59,
},
{
keytype: 'normal',
label: 'F2',
shape: 'fn',
keycode: 60,
},
{
keytype: 'normal',
label: 'F3',
shape: 'fn',
keycode: 61,
},
{
keytype: 'normal',
label: 'F4',
shape: 'fn',
keycode: 62,
},
{
keytype: 'normal',
label: 'F5',
shape: 'fn',
keycode: 63,
},
{
keytype: 'normal',
label: 'F6',
shape: 'fn',
keycode: 64,
},
{
keytype: 'normal',
label: 'F7',
shape: 'fn',
keycode: 65,
},
{
keytype: 'normal',
label: 'F8',
shape: 'fn',
keycode: 66,
},
{
keytype: 'normal',
label: 'F9',
shape: 'fn',
keycode: 67,
},
{
keytype: 'normal',
label: 'F10',
shape: 'fn',
keycode: 68,
},
{
keytype: 'normal',
label: 'F11',
shape: 'fn',
keycode: 87,
},
{
keytype: 'normal',
label: 'F12',
shape: 'fn',
keycode: 88,
},
{
keytype: 'normal',
label: 'Home',
shape: 'fn',
keycode: 110,
},
{
keytype: 'normal',
label: 'End',
shape: 'fn',
keycode: 115,
},
{
keytype: 'normal',
label: 'Del',
shape: 'fn',
keycode: 111,
},
],
[
{ keytype: 'normal', label: '/', labelShift: '\\', labelAltGr: '|', shape: 'normal', keycode: 41 },
{ keytype: 'normal', label: '1', labelShift: '!', shape: 'normal', keycode: 2 },
{ keytype: 'normal', label: '2', labelShift: '@', shape: 'normal', keycode: 3 },
{ keytype: 'normal', label: '3', labelShift: '#', labelAltGr: '¤', shape: 'normal', keycode: 4 },
{ keytype: 'normal', label: '4', labelShift: '$', shape: 'normal', keycode: 5 },
{ keytype: 'normal', label: '5', labelShift: '%', shape: 'normal', keycode: 6 },
{ keytype: 'normal', label: '6', labelShift: '?', shape: 'normal', keycode: 7 },
{ keytype: 'normal', label: '7', labelShift: '&', labelAltGr: '{', shape: 'normal', keycode: 8 },
{ keytype: 'normal', label: '8', labelShift: '*', labelAltGr: '}', shape: 'normal', keycode: 9 },
{ keytype: 'normal', label: '9', labelShift: '(', labelAltGr: '[', shape: 'normal', keycode: 10 },
{ keytype: 'normal', label: '0', labelShift: ')', labelAltGr: ']', shape: 'normal', keycode: 11 },
{ keytype: 'normal', label: '-', labelShift: '_', shape: 'normal', keycode: 12 },
{ keytype: 'normal', label: '=', labelShift: '+', labelAltGr: '¬', shape: 'normal', keycode: 13 },
{ keytype: 'normal', label: 'Backspace', shape: 'expand', keycode: 14 },
{
keytype: 'normal',
label: '/',
labelShift: '\\',
labelAltGr: '|',
shape: 'normal',
keycode: 41,
},
{
keytype: 'normal',
label: '1',
labelShift: '!',
shape: 'normal',
keycode: 2,
},
{
keytype: 'normal',
label: '2',
labelShift: '@',
shape: 'normal',
keycode: 3,
},
{
keytype: 'normal',
label: '3',
labelShift: '#',
labelAltGr: '¤',
shape: 'normal',
keycode: 4,
},
{
keytype: 'normal',
label: '4',
labelShift: '$',
shape: 'normal',
keycode: 5,
},
{
keytype: 'normal',
label: '5',
labelShift: '%',
shape: 'normal',
keycode: 6,
},
{
keytype: 'normal',
label: '6',
labelShift: '?',
shape: 'normal',
keycode: 7,
},
{
keytype: 'normal',
label: '7',
labelShift: '&',
labelAltGr: '{',
shape: 'normal',
keycode: 8,
},
{
keytype: 'normal',
label: '8',
labelShift: '*',
labelAltGr: '}',
shape: 'normal',
keycode: 9,
},
{
keytype: 'normal',
label: '9',
labelShift: '(',
labelAltGr: '[',
shape: 'normal',
keycode: 10,
},
{
keytype: 'normal',
label: '0',
labelShift: ')',
labelAltGr: ']',
shape: 'normal',
keycode: 11,
},
{
keytype: 'normal',
label: '-',
labelShift: '_',
shape: 'normal',
keycode: 12,
},
{
keytype: 'normal',
label: '=',
labelShift: '+',
labelAltGr: '¬',
shape: 'normal',
keycode: 13,
},
{
keytype: 'normal',
label: 'Backspace',
shape: 'expand',
keycode: 14,
},
],
[
{ keytype: 'normal', label: 'Tab', shape: 'tab', keycode: 15 },
{ keytype: 'normal', label: 'q', labelShift: 'Q', shape: 'normal', keycode: 16 },
{ keytype: 'normal', label: 'w', labelShift: 'W', shape: 'normal', keycode: 17 },
{ keytype: 'normal', label: 'e', labelShift: 'E', labelAltGr: '€', shape: 'normal', keycode: 18 },
{ keytype: 'normal', label: 'r', labelShift: 'R', shape: 'normal', keycode: 19 },
{ keytype: 'normal', label: 't', labelShift: 'T', shape: 'normal', keycode: 20 },
{ keytype: 'normal', label: 'y', labelShift: 'Y', shape: 'normal', keycode: 21 },
{ keytype: 'normal', label: 'u', labelShift: 'U', shape: 'normal', keycode: 22 },
{ keytype: 'normal', label: 'i', labelShift: 'I', shape: 'normal', keycode: 23 },
{ keytype: 'normal', label: 'o', labelShift: 'O', shape: 'normal', keycode: 24 },
{ keytype: 'normal', label: 'p', labelShift: 'P', shape: 'normal', keycode: 25 },
{ keytype: 'normal', label: '^', labelShift: '"', labelAltGr: '`', shape: 'normal', keycode: 26 },
{ keytype: 'normal', label: 'ç', labelShift: 'Ç', labelAltGr: '~', shape: 'normal', keycode: 27 },
{ keytype: 'normal', label: 'à', labelShift: 'À', shape: 'expand', keycode: 43 },
{
keytype: 'normal',
label: 'Tab',
shape: 'tab',
keycode: 15,
},
{
keytype: 'normal',
label: 'q',
labelShift: 'Q',
shape: 'normal',
keycode: 16,
},
{
keytype: 'normal',
label: 'w',
labelShift: 'W',
shape: 'normal',
keycode: 17,
},
{
keytype: 'normal',
label: 'e',
labelShift: 'E',
labelAltGr: '€',
shape: 'normal',
keycode: 18,
},
{
keytype: 'normal',
label: 'r',
labelShift: 'R',
shape: 'normal',
keycode: 19,
},
{
keytype: 'normal',
label: 't',
labelShift: 'T',
shape: 'normal',
keycode: 20,
},
{
keytype: 'normal',
label: 'y',
labelShift: 'Y',
shape: 'normal',
keycode: 21,
},
{
keytype: 'normal',
label: 'u',
labelShift: 'U',
shape: 'normal',
keycode: 22,
},
{
keytype: 'normal',
label: 'i',
labelShift: 'I',
shape: 'normal',
keycode: 23,
},
{
keytype: 'normal',
label: 'o',
labelShift: 'O',
shape: 'normal',
keycode: 24,
},
{
keytype: 'normal',
label: 'p',
labelShift: 'P',
shape: 'normal',
keycode: 25,
},
{
keytype: 'normal',
label: '^',
labelShift: '"',
labelAltGr: '`',
shape: 'normal',
keycode: 26,
},
{
keytype: 'normal',
label: 'ç',
labelShift: 'Ç',
labelAltGr: '~',
shape: 'normal',
keycode: 27,
},
{
keytype: 'normal',
label: 'à',
labelShift: 'À',
shape: 'expand',
keycode: 43,
},
],
[
{ keytype: 'normal', label: 'Caps', shape: 'caps', keycode: 58 },
{ keytype: 'normal', label: 'a', labelShift: 'A', shape: 'normal', keycode: 30 },
{ keytype: 'normal', label: 's', labelShift: 'S', shape: 'normal', keycode: 31 },
{ keytype: 'normal', label: 'd', labelShift: 'D', shape: 'normal', keycode: 32 },
{ keytype: 'normal', label: 'f', labelShift: 'F', shape: 'normal', keycode: 33 },
{ keytype: 'normal', label: 'g', labelShift: 'G', shape: 'normal', keycode: 34 },
{ keytype: 'normal', label: 'h', labelShift: 'H', shape: 'normal', keycode: 35 },
{ keytype: 'normal', label: 'j', labelShift: 'J', shape: 'normal', keycode: 36 },
{ keytype: 'normal', label: 'k', labelShift: 'K', shape: 'normal', keycode: 37 },
{ keytype: 'normal', label: 'l', labelShift: 'L', shape: 'normal', keycode: 38 },
{ keytype: 'normal', label: ';', labelShift: ':', labelAltGr: '°', shape: 'normal', keycode: 39 },
{ keytype: 'normal', label: 'è', labelShift: 'È', shape: 'normal', keycode: 40 },
{ keytype: 'normal', label: 'Enter', shape: 'expand', keycode: 28 },
{
keytype: 'normal',
label: 'Caps',
shape: 'caps',
keycode: 58,
},
{
keytype: 'normal',
label: 'a',
labelShift: 'A',
shape: 'normal',
keycode: 30,
},
{
keytype: 'normal',
label: 's',
labelShift: 'S',
shape: 'normal',
keycode: 31,
},
{
keytype: 'normal',
label: 'd',
labelShift: 'D',
shape: 'normal',
keycode: 32,
},
{
keytype: 'normal',
label: 'f',
labelShift: 'F',
shape: 'normal',
keycode: 33,
},
{
keytype: 'normal',
label: 'g',
labelShift: 'G',
shape: 'normal',
keycode: 34,
},
{
keytype: 'normal',
label: 'h',
labelShift: 'H',
shape: 'normal',
keycode: 35,
},
{
keytype: 'normal',
label: 'j',
labelShift: 'J',
shape: 'normal',
keycode: 36,
},
{
keytype: 'normal',
label: 'k',
labelShift: 'K',
shape: 'normal',
keycode: 37,
},
{
keytype: 'normal',
label: 'l',
labelShift: 'L',
shape: 'normal',
keycode: 38,
},
{
keytype: 'normal',
label: ';',
labelShift: ':',
labelAltGr: '°',
shape: 'normal',
keycode: 39,
},
{
keytype: 'normal',
label: 'è',
labelShift: 'È',
shape: 'normal',
keycode: 40,
},
{
keytype: 'normal',
label: 'Enter',
shape: 'expand',
keycode: 28,
},
],
[
{ keytype: 'modkey', label: 'Shift', shape: 'shift', keycode: 42 },
{ keytype: 'normal', label: 'z', labelShift: 'Z', labelAltGr: '«', shape: 'normal', keycode: 44 },
{ keytype: 'normal', label: 'x', labelShift: 'X', labelAltGr: '»', shape: 'normal', keycode: 45 },
{ keytype: 'normal', label: 'c', labelShift: 'C', shape: 'normal', keycode: 46 },
{ keytype: 'normal', label: 'v', labelShift: 'V', shape: 'normal', keycode: 47 },
{ keytype: 'normal', label: 'b', labelShift: 'B', shape: 'normal', keycode: 48 },
{ keytype: 'normal', label: 'n', labelShift: 'N', shape: 'normal', keycode: 49 },
{ keytype: 'normal', label: 'm', labelShift: 'M', shape: 'normal', keycode: 50 },
{ keytype: 'normal', label: ',', labelShift: "'", labelAltGr: '<', shape: 'normal', keycode: 51 },
{ keytype: 'normal', label: '.', labelShift: '"', labelAltGr: '>', shape: 'normal', keycode: 52 },
{ keytype: 'normal', label: 'é', labelShift: 'É', shape: 'normal', keycode: 53 },
{ keytype: 'modkey', label: 'Shift', shape: 'expand', keycode: 54 },
{
keytype: 'modkey',
label: 'Shift',
shape: 'shift',
keycode: 42,
},
{
keytype: 'normal',
label: 'z',
labelShift: 'Z',
labelAltGr: '«',
shape: 'normal',
keycode: 44,
},
{
keytype: 'normal',
label: 'x',
labelShift: 'X',
labelAltGr: '»',
shape: 'normal',
keycode: 45,
},
{
keytype: 'normal',
label: 'c',
labelShift: 'C',
shape: 'normal',
keycode: 46,
},
{
keytype: 'normal',
label: 'v',
labelShift: 'V',
shape: 'normal',
keycode: 47,
},
{
keytype: 'normal',
label: 'b',
labelShift: 'B',
shape: 'normal',
keycode: 48,
},
{
keytype: 'normal',
label: 'n',
labelShift: 'N',
shape: 'normal',
keycode: 49,
},
{
keytype: 'normal',
label: 'm',
labelShift: 'M',
shape: 'normal',
keycode: 50,
},
{
keytype: 'normal',
label: ',',
labelShift: "'",
labelAltGr: '<',
shape: 'normal',
keycode: 51,
},
{
keytype: 'normal',
label: '.',
labelShift: '"',
labelAltGr: '>',
shape: 'normal',
keycode: 52,
},
{
keytype: 'normal',
label: 'é',
labelShift: 'É',
shape: 'normal',
keycode: 53,
},
{
keytype: 'modkey',
label: 'Shift',
shape: 'expand',
keycode: 54,
},
],
[
{ keytype: 'modkey', label: 'Ctrl', shape: 'control', keycode: 29 },
{ keytype: 'modkey', label: 'Super', shape: 'normal', keycode: 125 },
{ keytype: 'modkey', label: 'Alt', shape: 'normal', keycode: 56 },
{ keytype: 'normal', label: 'Space', shape: 'space', keycode: 57 },
{ keytype: 'normal', label: 'Space', shape: 'space', keycode: 57 },
{ keytype: 'modkey', label: 'AltGr', shape: 'normal', keycode: 100 },
{ keytype: 'normal', label: 'PrtSc', shape: 'fn', keycode: 99 },
{ keytype: 'modkey', label: 'Ctrl', shape: 'control', keycode: 97 },
{
keytype: 'modkey',
label: 'Ctrl',
shape: 'control',
keycode: 29,
},
{
keytype: 'modkey',
label: 'Super',
shape: 'normal',
keycode: 125,
},
{
keytype: 'modkey',
label: 'Alt',
shape: 'normal',
keycode: 56,
},
{
keytype: 'normal',
label: 'Space',
shape: 'space',
keycode: 57,
},
{
keytype: 'normal',
label: 'Space',
shape: 'space',
keycode: 57,
},
{
keytype: 'modkey',
label: 'AltGr',
shape: 'normal',
keycode: 100,
},
{
keytype: 'normal',
label: 'PrtSc',
shape: 'fn',
keycode: 99,
},
{
keytype: 'modkey',
label: 'Ctrl',
shape: 'control',
keycode: 97,
},
],
],
},

View file

@ -58,6 +58,9 @@ export default (window: AgsWindow) => Box({
// OnHover
.on('enter-notify-event', () => {
if (!display) {
return;
}
self.window.set_cursor(
Gdk.Cursor.new_from_name(
display,

View file

@ -115,6 +115,9 @@ const ModKey = (key: Key) => {
// OnHover
.on('enter-notify-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'pointer',
@ -184,6 +187,9 @@ const RegularKey = (key: Key) => {
// OnHover
.on('enter-notify-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'pointer',

View file

@ -5,9 +5,9 @@ const Y_POS = 80;
// Types
import AgsBox from 'types/widgets/box';
import { IconProps } from 'types/widgets/icon';
import { GObject } from 'gi://GObject';
import GObject from 'types/@girs/gobject-2.0/gobject-2.0';
import AgsStack from 'types/widgets/stack';
type Widget = typeof imports.gi.Gtk.Widget;
import { Widget } from 'types/@girs/gtk-3.0/gtk-3.0.cjs';
import { Connectable } from 'types/widgets/widget';
import AgsProgressBar from 'types/widgets/progressbar';
type ConnectFunc = (self?: AgsProgressBar) => void;
@ -37,9 +37,9 @@ export default ({ stack, icon, info }: OSD) => {
...(typeof icon === 'string' ? { icon } : icon),
}),
// Can take a static widget instead of a progressbar
info.logic ?
ProgressBar({ vpack: 'center' }) :
info.widget,
info.widget ?
info.widget :
ProgressBar({ vpack: 'center' }),
],
})],
});

View file

@ -103,6 +103,9 @@ export const WindowButton = ({
// OnHover
.on('enter-notify-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'pointer',

View file

@ -25,8 +25,8 @@ export const getWorkspaces = (box: AgsBox) => {
(type.children as Array<AgsRevealer>).forEach(
(row) => {
((((row.child as AgsCenterBox)
?.center_widget as AgsEventBox)
?.child as AgsBox)
.center_widget as AgsEventBox)
.child as AgsBox)
.children as Array<AgsRevealer>)
.forEach((workspace) => {
children.push(workspace);
@ -40,7 +40,8 @@ export const getWorkspaces = (box: AgsBox) => {
};
const Workspace = (id: number, name: string, normal = true) => {
const fixed = Fixed({});
// @ts-expect-error
const fixed = Fixed();
const workspace = Revealer({
transition: 'slide_right',

View file

@ -11,7 +11,7 @@ const SCROLL_THRESH_N = 7;
// Types
import AgsBox from 'types/widgets/box.ts';
import AgsScrollable from 'types/widgets/scrollable.ts';
type ListBoxRow = typeof imports.gi.Gtk.ListBoxRow;
import { ListBoxRow } from 'types/@girs/gtk-3.0/gtk-3.0.cjs';
import { BluetoothDevice as BTDev } from 'types/service/bluetooth.ts';

View file

@ -14,7 +14,7 @@ import { NetworkMenu } from './network.ts';
import { BluetoothMenu } from './bluetooth.ts';
// Types
import { GObject } from 'gi://GObject';
import GObject from 'types/@girs/gobject-2.0/gobject-2.0';
import AgsBox from 'types/widgets/box.ts';
import AgsIcon from 'types/widgets/icon.ts';
import AgsLabel from 'types/widgets/label.ts';

View file

@ -13,7 +13,7 @@ const SCROLL_THRESH_N = 7;
// Types
import AgsBox from 'types/widgets/box.ts';
import AgsScrollable from 'types/widgets/scrollable.ts';
type ListBoxRow = typeof imports.gi.Gtk.ListBoxRow;
import { ListBoxRow } from 'types/@girs/gtk-3.0/gtk-3.0.cjs';
type APType = {
bssid: string
address: string

View file

@ -46,6 +46,9 @@ export default () => Box({
// OnClick
.on('button-press-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'grabbing',
@ -54,6 +57,9 @@ export default () => Box({
// OnRelease
.on('button-release-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'pointer',
@ -62,6 +68,9 @@ export default () => Box({
// OnHover
.on('enter-notify-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'pointer',
@ -106,6 +115,9 @@ export default () => Box({
// OnClick
.on('button-press-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'grabbing',
@ -114,6 +126,9 @@ export default () => Box({
// OnRelease
.on('button-release-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'pointer',
@ -122,6 +137,9 @@ export default () => Box({
// OnHover
.on('enter-notify-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'pointer',

View file

@ -42,6 +42,9 @@ export default (rev: AgsRevealer) => {
// OnHover
.on('enter-notify-event', () => {
if (!display) {
return;
}
self.window.set_cursor(Gdk.Cursor.new_from_name(
display,
'pointer',

View file

@ -2,19 +2,15 @@
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"lib": [
"ES2022"
],
"lib": ["ES2022"],
"noEmit": true,
"allowImportingTsExtensions": true,
"allowJs": true,
"checkJs": true,
"strict": true,
"noImplicitAny": false,
"baseUrl": ".",
"typeRoots": [
"./types/ags.d.ts",
"./node_modules/@girs"
],
"typeRoots": ["./types"],
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true
}

View file

@ -18,12 +18,11 @@ in {
...
}: let
symlink = config.lib.file.mkOutOfStoreSymlink;
optionals = lib.lists.optionals;
inherit (lib) optionals;
in {
programs.ags = {
enable = true;
configDir = symlink /home/${mainUser}/.nix/modules/ags/config;
package = ags.packages.${pkgs.system}.default;
};
home = {
@ -49,22 +48,6 @@ in {
## gui
pavucontrol # TODO: replace with ags widget
(writeShellApplication {
name = "updateTypes";
runtimeInputs = [nodejs_18 typescript git];
text = ''
if [[ -d /tmp/ags-types ]]; then
rm -r /tmp/ags-types
fi
rm -r ~/.config/ags/types
git clone https://github.com/Aylur/ags.git /tmp/ags-types
/tmp/ags-types/example/starter-config/setup.sh
rm -r /tmp/ags-types
'';
})
])
++ (optionals isTouchscreen (with pkgs; [
lisgd