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 *.egg-info
*.temp *.temp
*node_modules/ *node_modules/
*types/ *types
*build/ *build/
result* result*
*config.js *config.js

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -1,12 +1,16 @@
import { Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Label } from 'resource:///com/github/Aylur/ags/widget.js';
const { new_now_local } = imports.gi.GLib.DateTime;
export default () => Label({ class_name: 'clock' }) export default () => Label({ class_name: 'clock' })
.poll(1000, (self) => { .poll(1000, (self) => {
const time = imports.gi.GLib const time = new_now_local();
.DateTime.new_now_local();
self.label = time.format('%a. ') + const dayName = time.format('%a. ');
time.get_day_of_month() + const dayNum = time.get_day_of_month();
time.format(' %b. %H:%M'); 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 // Types
import { TrayItem } from 'types/service/systemtray.ts'; import { TrayItem } from 'types/service/systemtray.ts';
import AgsRevealer from 'types/widgets/revealer.ts'; import AgsRevealer from 'types/widgets/revealer.ts';
type Menu = typeof imports.gi.Gtk.Menu;
const SysTrayItem = (item: TrayItem) => { const SysTrayItem = (item: TrayItem) => {
@ -20,7 +19,7 @@ const SysTrayItem = (item: TrayItem) => {
} }
return MenuItem({ return MenuItem({
submenu: <Menu> item.menu, submenu: item.menu,
tooltip_markup: item.bind('tooltip_markup'), tooltip_markup: item.bind('tooltip_markup'),
child: Revealer({ child: Revealer({

View file

@ -1,6 +1,6 @@
import { Box, DrawingArea } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, DrawingArea } from 'resource:///com/github/Aylur/ags/widget.js';
import Gtk from 'gi://Gtk'; const { Gtk } = imports.gi;
export default ( export default (
place = 'top left', place = 'top left',
@ -26,7 +26,10 @@ export default (
.get_property('border-radius', Gtk.StateFlags.NORMAL); .get_property('border-radius', Gtk.StateFlags.NORMAL);
widget.set_size_request(r, r); 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() const c = widget.get_style_context()
.get_property('background-color', Gtk.StateFlags.NORMAL); .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'; 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'; import PopupWindow from './misc/popup.ts';
@ -26,7 +26,7 @@ const Time = () => Box({
label: 'hour', label: 'hour',
setup: (self) => { setup: (self) => {
self.poll(1000, () => { 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', label: 'minute',
setup: (self) => { setup: (self) => {
self.poll(1000, () => { 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) => { setup: (self) => {
self.poll(1000, () => { self.poll(1000, () => {
const time = DateTime.new_now_local(); const time = new_now_local();
self.label = time.format('%A, %B ') + const dayNameMonth = time.format('%A, %B ');
time.get_day_of_month() + const dayNum = time.get_day_of_month();
time.format(', %Y'); const date = time.format(', %Y');
if (dayNum && dayNameMonth && date) {
self.label = dayNameMonth + dayNum + date;
}
}); });
}, },
}), }),

View file

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

View file

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

View file

@ -1,9 +1,11 @@
import { execAsync, readFileAsync, timeout } from 'resource:///com/github/Aylur/ags/utils.js'; import { execAsync, readFileAsync, timeout } from 'resource:///com/github/Aylur/ags/utils.js';
const { get_home_dir } = imports.gi.GLib; const { get_home_dir } = imports.gi.GLib;
import GObject from 'types/@girs/gobject-2.0/gobject-2.0';
type Persist = { type Persist = {
name: string name: string
gobject: typeof imports.gi.GObject gobject: GObject.Object
prop: string prop: string
condition?: boolean | string // If string, compare following props to this condition?: boolean | string // If string, compare following props to this
whenTrue?: boolean | string 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'; import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
// Types // Types
type Allocation = typeof imports.gi.Gtk.Allocation; import { Allocation, Widget } from 'types/@girs/gtk-3.0/gtk-3.0.cjs';
type Widget = typeof imports.gi.Gtk.Widget;
import { RevealerProps } from 'types/widgets/revealer'; import { RevealerProps } from 'types/widgets/revealer';
import { WindowProps } from 'types/widgets/window'; import { WindowProps } from 'types/widgets/window';
import AgsWindow from 'types/widgets/window'; import AgsWindow from 'types/widgets/window';

View file

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

View file

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

View file

@ -33,6 +33,8 @@ export default (window: AgsWindow) => {
let signals = [] as Array<number>; let signals = [] as Array<number>;
window.attribute = { window.attribute = {
startY: null,
setVisible: (state: boolean) => { setVisible: (state: boolean) => {
if (state) { if (state) {
window.visible = true; window.visible = true;
@ -66,6 +68,7 @@ export default (window: AgsWindow) => {
gesture.disconnect(id); gesture.disconnect(id);
}); });
signals = []; signals = [];
window.attribute.startY = null;
}, },
setSlideUp: () => { setSlideUp: () => {
@ -75,7 +78,7 @@ export default (window: AgsWindow) => {
signals.push( signals.push(
gesture.connect('drag-begin', () => { gesture.connect('drag-begin', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => { 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', () => { gesture.connect('drag-update', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => { Hyprland.sendMessage('j/cursorpos').then((out) => {
const currentY = JSON.parse(out).y; const currentY = JSON.parse(out).y;
const offset = gesture.startY - currentY; const offset = window.attribute.startY - currentY;
if (offset < 0) { if (offset < 0) {
return; return;
@ -116,7 +119,7 @@ export default (window: AgsWindow) => {
signals.push( signals.push(
gesture.connect('drag-begin', () => { gesture.connect('drag-begin', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => { 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', () => { gesture.connect('drag-update', () => {
Hyprland.sendMessage('j/cursorpos').then((out) => { Hyprland.sendMessage('j/cursorpos').then((out) => {
const currentY = JSON.parse(out).y; const currentY = JSON.parse(out).y;
const offset = gesture.startY - currentY; const offset = window.attribute.startY - currentY;
if (offset > 0) { if (offset > 0) {
return; 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 // key types are: normal, tab, caps, shift, control, fn (normal w/ half height), space, expand
keys: [ keys: [
[ [
{ keytype: 'normal', label: 'Esc', shape: 'fn', keycode: 1 }, {
{ keytype: 'normal', label: 'F1', shape: 'fn', keycode: 59 }, keytype: 'normal',
{ keytype: 'normal', label: 'F2', shape: 'fn', keycode: 60 }, label: 'Esc',
{ keytype: 'normal', label: 'F3', shape: 'fn', keycode: 61 }, shape: 'fn',
{ keytype: 'normal', label: 'F4', shape: 'fn', keycode: 62 }, keycode: 1,
{ 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',
{ keytype: 'normal', label: 'F8', shape: 'fn', keycode: 66 }, label: 'F1',
{ keytype: 'normal', label: 'F9', shape: 'fn', keycode: 67 }, shape: 'fn',
{ keytype: 'normal', label: 'F10', shape: 'fn', keycode: 68 }, keycode: 59,
{ 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',
{ keytype: 'normal', label: 'End', shape: 'fn', keycode: 115 }, label: 'F2',
{ keytype: 'normal', label: 'Del', shape: 'fn', keycode: 111 }, 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',
{ keytype: 'normal', label: '2', labelShift: '@', shape: 'normal', keycode: 3 }, label: '/',
{ keytype: 'normal', label: '3', labelShift: '#', labelAltGr: '¤', shape: 'normal', keycode: 4 }, labelShift: '\\',
{ keytype: 'normal', label: '4', labelShift: '$', shape: 'normal', keycode: 5 }, labelAltGr: '|',
{ keytype: 'normal', label: '5', labelShift: '%', shape: 'normal', keycode: 6 }, shape: 'normal',
{ keytype: 'normal', label: '6', labelShift: '?', shape: 'normal', keycode: 7 }, keycode: 41,
{ 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',
{ keytype: 'normal', label: '0', labelShift: ')', labelAltGr: ']', shape: 'normal', keycode: 11 }, label: '1',
{ keytype: 'normal', label: '-', labelShift: '_', shape: 'normal', keycode: 12 }, labelShift: '!',
{ keytype: 'normal', label: '=', labelShift: '+', labelAltGr: '¬', shape: 'normal', keycode: 13 }, shape: 'normal',
{ keytype: 'normal', label: 'Backspace', shape: 'expand', keycode: 14 }, 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',
{ keytype: 'normal', label: 'w', labelShift: 'W', shape: 'normal', keycode: 17 }, label: 'Tab',
{ keytype: 'normal', label: 'e', labelShift: 'E', labelAltGr: '€', shape: 'normal', keycode: 18 }, shape: 'tab',
{ keytype: 'normal', label: 'r', labelShift: 'R', shape: 'normal', keycode: 19 }, keycode: 15,
{ 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',
{ keytype: 'normal', label: 'i', labelShift: 'I', shape: 'normal', keycode: 23 }, label: 'q',
{ keytype: 'normal', label: 'o', labelShift: 'O', shape: 'normal', keycode: 24 }, labelShift: 'Q',
{ keytype: 'normal', label: 'p', labelShift: 'P', shape: 'normal', keycode: 25 }, shape: 'normal',
{ keytype: 'normal', label: '^', labelShift: '"', labelAltGr: '`', shape: 'normal', keycode: 26 }, keycode: 16,
{ keytype: 'normal', label: 'ç', labelShift: 'Ç', labelAltGr: '~', shape: 'normal', keycode: 27 }, },
{ keytype: 'normal', label: 'à', labelShift: 'À', shape: 'expand', keycode: 43 }, {
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',
{ keytype: 'normal', label: 's', labelShift: 'S', shape: 'normal', keycode: 31 }, label: 'Caps',
{ keytype: 'normal', label: 'd', labelShift: 'D', shape: 'normal', keycode: 32 }, shape: 'caps',
{ keytype: 'normal', label: 'f', labelShift: 'F', shape: 'normal', keycode: 33 }, keycode: 58,
{ 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',
{ keytype: 'normal', label: 'k', labelShift: 'K', shape: 'normal', keycode: 37 }, label: 'a',
{ keytype: 'normal', label: 'l', labelShift: 'L', shape: 'normal', keycode: 38 }, labelShift: 'A',
{ keytype: 'normal', label: ';', labelShift: ':', labelAltGr: '°', shape: 'normal', keycode: 39 }, shape: 'normal',
{ keytype: 'normal', label: 'è', labelShift: 'È', shape: 'normal', keycode: 40 }, keycode: 30,
{ keytype: 'normal', label: 'Enter', shape: 'expand', keycode: 28 }, },
{
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: 'modkey',
{ keytype: 'normal', label: 'x', labelShift: 'X', labelAltGr: '»', shape: 'normal', keycode: 45 }, label: 'Shift',
{ keytype: 'normal', label: 'c', labelShift: 'C', shape: 'normal', keycode: 46 }, shape: 'shift',
{ keytype: 'normal', label: 'v', labelShift: 'V', shape: 'normal', keycode: 47 }, keycode: 42,
{ 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',
{ keytype: 'normal', label: ',', labelShift: "'", labelAltGr: '<', shape: 'normal', keycode: 51 }, label: 'z',
{ keytype: 'normal', label: '.', labelShift: '"', labelAltGr: '>', shape: 'normal', keycode: 52 }, labelShift: 'Z',
{ keytype: 'normal', label: 'é', labelShift: 'É', shape: 'normal', keycode: 53 }, labelAltGr: '«',
{ keytype: 'modkey', label: 'Shift', shape: 'expand', keycode: 54 }, 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',
{ keytype: 'modkey', label: 'Alt', shape: 'normal', keycode: 56 }, label: 'Ctrl',
{ keytype: 'normal', label: 'Space', shape: 'space', keycode: 57 }, shape: 'control',
{ keytype: 'normal', label: 'Space', shape: 'space', keycode: 57 }, keycode: 29,
{ 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: '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 // OnHover
.on('enter-notify-event', () => { .on('enter-notify-event', () => {
if (!display) {
return;
}
self.window.set_cursor( self.window.set_cursor(
Gdk.Cursor.new_from_name( Gdk.Cursor.new_from_name(
display, display,

View file

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

View file

@ -5,9 +5,9 @@ const Y_POS = 80;
// Types // Types
import AgsBox from 'types/widgets/box'; import AgsBox from 'types/widgets/box';
import { IconProps } from 'types/widgets/icon'; 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'; 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 { Connectable } from 'types/widgets/widget';
import AgsProgressBar from 'types/widgets/progressbar'; import AgsProgressBar from 'types/widgets/progressbar';
type ConnectFunc = (self?: AgsProgressBar) => void; type ConnectFunc = (self?: AgsProgressBar) => void;
@ -37,9 +37,9 @@ export default ({ stack, icon, info }: OSD) => {
...(typeof icon === 'string' ? { icon } : icon), ...(typeof icon === 'string' ? { icon } : icon),
}), }),
// Can take a static widget instead of a progressbar // Can take a static widget instead of a progressbar
info.logic ? info.widget ?
ProgressBar({ vpack: 'center' }) : info.widget :
info.widget, ProgressBar({ vpack: 'center' }),
], ],
})], })],
}); });

View file

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

View file

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

View file

@ -11,7 +11,7 @@ const SCROLL_THRESH_N = 7;
// Types // Types
import AgsBox from 'types/widgets/box.ts'; import AgsBox from 'types/widgets/box.ts';
import AgsScrollable from 'types/widgets/scrollable.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'; 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'; import { BluetoothMenu } from './bluetooth.ts';
// Types // 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 AgsBox from 'types/widgets/box.ts';
import AgsIcon from 'types/widgets/icon.ts'; import AgsIcon from 'types/widgets/icon.ts';
import AgsLabel from 'types/widgets/label.ts'; import AgsLabel from 'types/widgets/label.ts';

View file

@ -13,7 +13,7 @@ const SCROLL_THRESH_N = 7;
// Types // Types
import AgsBox from 'types/widgets/box.ts'; import AgsBox from 'types/widgets/box.ts';
import AgsScrollable from 'types/widgets/scrollable.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 = { type APType = {
bssid: string bssid: string
address: string address: string

View file

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

View file

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

View file

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

View file

@ -18,12 +18,11 @@ in {
... ...
}: let }: let
symlink = config.lib.file.mkOutOfStoreSymlink; symlink = config.lib.file.mkOutOfStoreSymlink;
optionals = lib.lists.optionals; inherit (lib) optionals;
in { in {
programs.ags = { programs.ags = {
enable = true; enable = true;
configDir = symlink /home/${mainUser}/.nix/modules/ags/config; configDir = symlink /home/${mainUser}/.nix/modules/ags/config;
package = ags.packages.${pkgs.system}.default;
}; };
home = { home = {
@ -49,22 +48,6 @@ in {
## gui ## gui
pavucontrol # TODO: replace with ags widget 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; [ ++ (optionals isTouchscreen (with pkgs; [
lisgd lisgd