refactor(ags wim): bundle all files through imports
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-01-13 23:38:31 -05:00
parent 0d0f513007
commit 7c0e1658da
56 changed files with 220 additions and 244 deletions

View file

@ -1,11 +1,3 @@
import { watchAndCompileSass, transpileTypeScript } from 'file:///home/matt/.nix/devices/wim/config/ags/js/utils.js'; import { transpileTypeScript } from 'file:///home/matt/.nix/devices/wim/config/ags/js/utils.js';
watchAndCompileSass(); export default (await transpileTypeScript()).default;
// Compile wim's config since that is where the big boy code is
// I have it symlinked in the git repo so TS server can see it
await transpileTypeScript(
'/home/matt/.nix/devices/wim/config/ags',
'/tmp/ags/wim',
);
export default (await import(await transpileTypeScript())).default;

View file

@ -1,9 +1,9 @@
import { Box, CenterBox, Window } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, CenterBox, Window } from 'resource:///com/github/Aylur/ags/widget.js';
import SysTray from '../../wim/ts/bar/items/systray.js'; import SysTray from '../../wim/ts/bar/items/systray.ts';
import Separator from '../../wim/ts/misc/separator.js'; import Separator from '../../wim/ts/misc/separator.ts';
import NotifButton from '../../wim/ts/bar/items/notif-button.js'; import NotifButton from '../../wim/ts/bar/items/notif-button.ts';
import Clock from './buttons/clock.js'; import Clock from './buttons/clock.ts';
const PADDING = 20; const PADDING = 20;

View file

@ -1,9 +1,9 @@
import Pointers from '../wim/services/pointers.js'; import Pointers from '../wim/services/pointers.ts';
import AppLauncher from '../wim/ts/applauncher/main.js'; import AppLauncher from '../wim/ts/applauncher/main.ts';
import Bar from './bar/main.js'; import Bar from './bar/main.ts';
import { NotifPopups, NotifCenter } from './notifications/main.js'; import { NotifPopups, NotifCenter } from './notifications/main.ts';
import Powermenu from '../wim/ts/powermenu.js'; import Powermenu from '../wim/ts/powermenu.ts';
const closeWinDelay = 800; const closeWinDelay = 800;

View file

@ -1,9 +1,9 @@
import { Window } from 'resource:///com/github/Aylur/ags/widget.js'; import { Window } from 'resource:///com/github/Aylur/ags/widget.js';
import NotifCenterWidget from '../../wim/ts/notifications/center.js'; import NotifCenterWidget from '../../wim/ts/notifications/center.ts';
import PopUpsWidget from '../../wim/ts/notifications/popup.js'; import PopUpsWidget from '../../wim/ts/notifications/popup.ts';
import PopupWindow from '../../wim/ts/misc/popup.js'; import PopupWindow from '../../wim/ts/misc/popup.ts';
export const NotifPopups = () => Window({ export const NotifPopups = () => Window({

View file

@ -1,4 +1,4 @@
import { watchAndCompileSass, transpileTypeScript } from './js/utils.js'; import { transpileTypeScript } from './js/utils.js';
watchAndCompileSass(); // See ./ts/main.ts for actual code
export default (await import(await transpileTypeScript())).default; export default (await transpileTypeScript()).default;

View file

@ -2,7 +2,7 @@ import App from 'resource:///com/github/Aylur/ags/app.js';
import { execAsync, monitorFile } from 'resource:///com/github/Aylur/ags/utils.js'; import { execAsync, monitorFile } from 'resource:///com/github/Aylur/ags/utils.js';
export const watchAndCompileSass = () => { const watchAndCompileSass = () => {
const reloadCss = () => { const reloadCss = () => {
const scss = `${App.configDir}/scss/main.scss`; const scss = `${App.configDir}/scss/main.scss`;
const css = '/tmp/ags/style.css'; const css = '/tmp/ags/style.css';
@ -10,7 +10,7 @@ export const watchAndCompileSass = () => {
execAsync(`sassc ${scss} ${css}`).then(() => { execAsync(`sassc ${scss} ${css}`).then(() => {
App.resetCss(); App.resetCss();
App.applyCss(css); App.applyCss(css);
}).catch(reloadCss); }).catch(print);
}; };
monitorFile( monitorFile(
@ -21,36 +21,19 @@ export const watchAndCompileSass = () => {
reloadCss(); reloadCss();
}; };
export const transpileTypeScript = async( export const transpileTypeScript = async() => {
src = App.configDir, await execAsync([
out = '/tmp/ags', 'bun', 'build', `${App.configDir}/ts/main.ts`,
) => { '--outdir', '/tmp/ags',
const promises = []; '--external', 'resource:///*',
const files = (await execAsync([ '--external', 'gi://*',
'find', `${src}/`, '--external', 'cairo',
'-wholename', `${src}/services/*.ts`, '--external', '*/fzf.es.js',
'-o', ]).catch(print);
'-wholename', `${src}/ts/*.ts`,
])).split('\n');
/** @param {string} p */ watchAndCompileSass();
const getDirectoryPath = (p) => p.substring(0, p.lastIndexOf('/'));
files.forEach((file) => { // The file is going to be there after transpilation
const outDir = getDirectoryPath(out + file // @ts-ignore
.replace(`${src}/ts`, '/ts') return await import('file:///tmp/ags/main.js');
.replace(`${src}/services`, '/services'));
promises.push(
execAsync([
'bun', 'build', file,
'--outdir', outDir,
'--external', '*',
]).catch(print),
);
});
await Promise.all(promises);
return `file://${out}/ts/main.js`;
}; };

View file

@ -1,6 +1,6 @@
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js'; import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import Service from 'resource:///com/github/Aylur/ags/service.js'; import Service from 'resource:///com/github/Aylur/ags/service.js';
import TouchGestures from './touch-gestures.js'; import TouchGestures from './touch-gestures.ts';
import { execAsync, subprocess } from 'resource:///com/github/Aylur/ags/utils.js'; import { execAsync, subprocess } from 'resource:///com/github/Aylur/ags/utils.js';
const ROTATION_MAP = { const ROTATION_MAP = {

View file

@ -3,10 +3,10 @@ import App from 'resource:///com/github/Aylur/ags/app.js';
import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import { lookUpIcon } from 'resource:///com/github/Aylur/ags/utils.js'; import { lookUpIcon } from 'resource:///com/github/Aylur/ags/utils.js';
import CursorBox from '../misc/cursorbox.js'; import CursorBox from '../misc/cursorbox.ts';
// Types // Types
import { Application } from 'types/service/applications.js'; import { Application } from 'types/service/applications.ts';
export default (app: Application) => { export default (app: Application) => {

View file

@ -6,11 +6,11 @@ import { Fzf } from 'file:///home/matt/.config/ags/node_modules/fzf/dist/fzf.es.
import { Box, Entry, Icon, Label, ListBox, Revealer, Scrollable } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Entry, Icon, Label, ListBox, Revealer, Scrollable } from 'resource:///com/github/Aylur/ags/widget.js';
import PopupWindow from '../misc/popup.js'; import PopupWindow from '../misc/popup.ts';
import AppItem from './app-item.js'; import AppItem from './app-item.ts';
// Types // Types
import { Application } from 'types/service/applications.js'; import { Application } from 'types/service/applications.ts';
type ListBoxRow = typeof imports.gi.Gtk.ListBoxRow; type ListBoxRow = typeof imports.gi.Gtk.ListBoxRow;

View file

@ -2,8 +2,8 @@ import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
import { Label, Icon } from 'resource:///com/github/Aylur/ags/widget.js'; import { Label, Icon } from 'resource:///com/github/Aylur/ags/widget.js';
import { SpeakerIcon } from '../../misc/audio-icons.js'; import { SpeakerIcon } from '../../misc/audio-icons.ts';
import HoverRevealer from './hover-revealer.js'; import HoverRevealer from './hover-revealer.ts';
export default () => HoverRevealer({ export default () => HoverRevealer({

View file

@ -2,7 +2,7 @@ import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
import { Label, Icon } from 'resource:///com/github/Aylur/ags/widget.js'; import { Label, Icon } from 'resource:///com/github/Aylur/ags/widget.js';
import HoverRevealer from './hover-revealer.js'; import HoverRevealer from './hover-revealer.ts';
export default () => HoverRevealer({ export default () => HoverRevealer({

View file

@ -1,7 +1,7 @@
import { Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import Brightness from '../../../services/brightness.js'; import Brightness from '../../../services/brightness.ts';
import HoverRevealer from './hover-revealer.js'; import HoverRevealer from './hover-revealer.ts';
export default () => HoverRevealer({ export default () => HoverRevealer({

View file

@ -1,7 +1,7 @@
import { Box, Revealer } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
import Separator from '../../misc/separator.js'; import Separator from '../../misc/separator.ts';
import CursorBox from '../../misc/cursorbox.js'; import CursorBox from '../../misc/cursorbox.ts';
export default ({ export default ({

View file

@ -2,11 +2,11 @@ import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import HoverRevealer from './hover-revealer.js'; import HoverRevealer from './hover-revealer.ts';
const DEFAULT_KB = 'at-translated-set-2-keyboard'; const DEFAULT_KB = 'at-translated-set-2-keyboard';
import AgsLabel from 'types/widgets/label.js'; import AgsLabel from 'types/widgets/label.ts';
type Keyboard = { type Keyboard = {
address: string; address: string;
name: string; name: string;

View file

@ -2,7 +2,7 @@ import Network from 'resource:///com/github/Aylur/ags/service/network.js';
import { Label, Icon } from 'resource:///com/github/Aylur/ags/widget.js'; import { Label, Icon } from 'resource:///com/github/Aylur/ags/widget.js';
import HoverRevealer from './hover-revealer.js'; import HoverRevealer from './hover-revealer.ts';
export default () => HoverRevealer({ export default () => HoverRevealer({

View file

@ -2,7 +2,7 @@ import Battery from 'resource:///com/github/Aylur/ags/service/battery.js';
import { Label, Icon, Box } from 'resource:///com/github/Aylur/ags/widget.js'; import { Label, Icon, Box } from 'resource:///com/github/Aylur/ags/widget.js';
import Separator from '../../misc/separator.js'; import Separator from '../../misc/separator.ts';
const LOW_BATT = 20; const LOW_BATT = 20;
const SPACING = 5; const SPACING = 5;

View file

@ -4,7 +4,7 @@ import { Label } from 'resource:///com/github/Aylur/ags/widget.js';
const { DateTime } = imports.gi.GLib; const { DateTime } = imports.gi.GLib;
import CursorBox from '../../misc/cursorbox.js'; import CursorBox from '../../misc/cursorbox.ts';
export default () => CursorBox({ export default () => CursorBox({

View file

@ -2,7 +2,7 @@ import Applications from 'resource:///com/github/Aylur/ags/service/applications.
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js'; import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import Separator from '../../misc/separator.js'; import Separator from '../../misc/separator.ts';
const SPACING = 8; const SPACING = 8;

View file

@ -2,8 +2,8 @@ import { Label } from 'resource:///com/github/Aylur/ags/widget.js';
import Variable from 'resource:///com/github/Aylur/ags/variable.js'; import Variable from 'resource:///com/github/Aylur/ags/variable.js';
import CursorBox from '../../misc/cursorbox.js'; import CursorBox from '../../misc/cursorbox.ts';
import Persist from '../../misc/persist.js'; import Persist from '../../misc/persist.ts';
const HeartState = Variable(''); const HeartState = Variable('');

View file

@ -3,13 +3,13 @@ import Notifications from 'resource:///com/github/Aylur/ags/service/notification
import { Box, CenterBox, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, CenterBox, Icon, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import CursorBox from '../../misc/cursorbox.js'; import CursorBox from '../../misc/cursorbox.ts';
import Separator from '../../misc/separator.js'; import Separator from '../../misc/separator.ts';
const SPACING = 4; const SPACING = 4;
// Types // Types
import AgsWindow from 'types/widgets/window.js'; import AgsWindow from 'types/widgets/window.ts';
export default () => CursorBox({ export default () => CursorBox({

View file

@ -1,7 +1,7 @@
import { Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Label } from 'resource:///com/github/Aylur/ags/widget.js';
import Tablet from '../../../services/tablet.js'; import Tablet from '../../../services/tablet.ts';
import CursorBox from '../../misc/cursorbox.js'; import CursorBox from '../../misc/cursorbox.ts';
export default () => CursorBox({ export default () => CursorBox({

View file

@ -2,21 +2,21 @@ import App from 'resource:///com/github/Aylur/ags/app.js';
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import Audio from '../hovers/audio.js'; import Audio from '../hovers/audio.ts';
import Bluetooth from '../hovers/bluetooth.js'; import Bluetooth from '../hovers/bluetooth.ts';
import Brightness from '../hovers/brightness.js'; import Brightness from '../hovers/brightness.ts';
import KeyboardLayout from '../hovers/keyboard-layout.js'; import KeyboardLayout from '../hovers/keyboard-layout.ts';
import Network from '../hovers/network.js'; import Network from '../hovers/network.ts';
import CursorBox from '../../misc/cursorbox.js'; import CursorBox from '../../misc/cursorbox.ts';
import Separator from '../../misc/separator.js'; import Separator from '../../misc/separator.ts';
const SPACING = 4; const SPACING = 4;
// Types // Types
import AgsRevealer from 'types/widgets/revealer.js'; import AgsRevealer from 'types/widgets/revealer.ts';
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsWindow from 'types/widgets/window.js'; import AgsWindow from 'types/widgets/window.ts';
export default () => { export default () => {

View file

@ -3,14 +3,14 @@ import SystemTray from 'resource:///com/github/Aylur/ags/service/systemtray.js';
import { timeout } from 'resource:///com/github/Aylur/ags/utils.js'; import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
import { Box, Icon, MenuItem, MenuBar, Revealer } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Icon, MenuItem, MenuBar, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
import Separator from '../../misc/separator.js'; import Separator from '../../misc/separator.ts';
const REVEAL_DURATION = 500; const REVEAL_DURATION = 500;
const SPACING = 12; const SPACING = 12;
// Types // Types
import { TrayItem } from 'types/service/systemtray.js'; import { TrayItem } from 'types/service/systemtray.ts';
import AgsRevealer from 'types/widgets/revealer.js'; import AgsRevealer from 'types/widgets/revealer.ts';
type Menu = typeof imports.gi.Gtk.Menu; type Menu = typeof imports.gi.Gtk.Menu;

View file

@ -1,7 +1,7 @@
import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import Tablet from '../../../services/tablet.js'; import Tablet from '../../../services/tablet.ts';
import CursorBox from '../../misc/cursorbox.js'; import CursorBox from '../../misc/cursorbox.ts';
export default () => CursorBox({ export default () => CursorBox({

View file

@ -3,15 +3,15 @@ import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { timeout } from 'resource:///com/github/Aylur/ags/utils.js'; import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
import { Box, Overlay, Revealer } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Overlay, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
import CursorBox from '../../misc/cursorbox.js'; import CursorBox from '../../misc/cursorbox.ts';
const URGENT_DURATION = 1000; const URGENT_DURATION = 1000;
// Types // Types
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsRevealer from 'types/widgets/revealer.js'; import AgsRevealer from 'types/widgets/revealer.ts';
import AgsOverlay from 'types/widgets/overlay.js'; import AgsOverlay from 'types/widgets/overlay.ts';
import AgsEventBox from 'types/widgets/eventbox.js'; import AgsEventBox from 'types/widgets/eventbox.ts';
const Workspace = ({ id }: { id: number }) => { const Workspace = ({ id }: { id: number }) => {

View file

@ -1,19 +1,19 @@
import { Window, CenterBox, Box } from 'resource:///com/github/Aylur/ags/widget.js'; import { Window, CenterBox, Box } from 'resource:///com/github/Aylur/ags/widget.js';
import Separator from '../misc/separator.js'; import Separator from '../misc/separator.ts';
import Battery from './items/battery.js'; import Battery from './items/battery.ts';
import Clock from './items/clock.js'; import Clock from './items/clock.ts';
import CurrentWindow from './items/current-window.js'; import CurrentWindow from './items/current-window.ts';
import Heart from './items/heart.js'; import Heart from './items/heart.ts';
import NotifButton from './items/notif-button.js'; import NotifButton from './items/notif-button.ts';
import OskToggle from './items/osk-toggle.js'; import OskToggle from './items/osk-toggle.ts';
import QsToggle from './items/quick-settings.js'; import QsToggle from './items/quick-settings.ts';
import SysTray from './items/systray.js'; import SysTray from './items/systray.ts';
import TabletToggle from './items/tablet-toggle.js'; import TabletToggle from './items/tablet-toggle.ts';
import Workspaces from './items/workspaces.js'; import Workspaces from './items/workspaces.ts';
import BarReveal from './fullscreen.js'; import BarReveal from './fullscreen.ts';
const SPACING = 12; const SPACING = 12;

View file

@ -1,6 +1,6 @@
import { Window } from 'resource:///com/github/Aylur/ags/widget.js'; import { Window } from 'resource:///com/github/Aylur/ags/widget.js';
import RoundedCorner from './screen-corners.js'; import RoundedCorner from './screen-corners.ts';
const TopLeft = () => Window({ const TopLeft = () => Window({

View file

@ -2,7 +2,7 @@ import { Box, Calendar, Label } from 'resource:///com/github/Aylur/ags/widget.js
const { DateTime } = imports.gi.GLib; const { DateTime } = imports.gi.GLib;
import PopupWindow from './misc/popup.js'; import PopupWindow from './misc/popup.ts';
const Divider = () => Box({ const Divider = () => Box({

View file

@ -1,15 +1,15 @@
import Setup from './setup.js'; import Setup from './setup.ts';
import AppLauncher from './applauncher/main.js'; import AppLauncher from './applauncher/main.ts';
import Bar from './bar/main.js'; import Bar from './bar/main.ts';
import BgFade from './misc/background-fade.js'; import BgFade from './misc/background-fade.ts';
import Calendar from './date.js'; import Calendar from './date.ts';
import Corners from './corners/main.js'; import Corners from './corners/main.ts';
import { NotifPopups, NotifCenter } from './notifications/main.js'; import { NotifPopups, NotifCenter } from './notifications/main.ts';
import OSD from './osd/main.js'; import OSD from './osd/main.ts';
import OSK from './on-screen-keyboard/main.js'; import OSK from './on-screen-keyboard/main.ts';
import Overview from './overview/main.js'; import Overview from './overview/main.ts';
import Powermenu from './powermenu.js'; import Powermenu from './powermenu.ts';
import QSettings from './quick-settings/main.js'; import QSettings from './quick-settings/main.ts';
Setup(); Setup();

View file

@ -3,8 +3,8 @@ import Mpris from 'resource:///com/github/Aylur/ags/service/mpris.js';
import { Button, Icon, Label, Stack, Slider, CenterBox, Box } from 'resource:///com/github/Aylur/ags/widget.js'; import { Button, Icon, Label, Stack, Slider, CenterBox, Box } from 'resource:///com/github/Aylur/ags/widget.js';
import { execAsync, lookUpIcon, readFileAsync } from 'resource:///com/github/Aylur/ags/utils.js'; import { execAsync, lookUpIcon, readFileAsync } from 'resource:///com/github/Aylur/ags/utils.js';
import Separator from '../misc/separator.js'; import Separator from '../misc/separator.ts';
import CursorBox from '../misc/cursorbox.js'; import CursorBox from '../misc/cursorbox.ts';
const ICON_SIZE = 32; const ICON_SIZE = 32;
@ -29,13 +29,13 @@ const icons = {
}; };
// Types // Types
import { MprisPlayer } from 'types/service/mpris.js'; import { MprisPlayer } from 'types/service/mpris.ts';
import { Variable as Var } from 'types/variable'; import { Variable as Var } from 'types/variable';
import AgsOverlay from 'types/widgets/overlay.js'; import AgsOverlay from 'types/widgets/overlay.ts';
import AgsCenterBox, { CenterBoxProps } from 'types/widgets/centerbox.js'; import AgsCenterBox, { CenterBoxProps } from 'types/widgets/centerbox.ts';
import AgsLabel from 'types/widgets/label.js'; import AgsLabel from 'types/widgets/label.ts';
import AgsIcon from 'types/widgets/icon.js'; import AgsIcon from 'types/widgets/icon.ts';
import AgsStack from 'types/widgets/stack.js'; import AgsStack from 'types/widgets/stack.ts';
export const CoverArt = ( export const CoverArt = (

View file

@ -3,18 +3,18 @@ import Variable from 'resource:///com/github/Aylur/ags/variable.js';
import { Box, CenterBox } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, CenterBox } from 'resource:///com/github/Aylur/ags/widget.js';
import * as mpris from './mpris.js'; import * as mpris from './mpris.ts';
import PlayerGesture from './gesture.js'; import PlayerGesture from './gesture.ts';
import Separator from '../misc/separator.js'; import Separator from '../misc/separator.ts';
const FAVE_PLAYER = 'org.mpris.MediaPlayer2.spotify'; const FAVE_PLAYER = 'org.mpris.MediaPlayer2.spotify';
const SPACING = 8; const SPACING = 8;
// Types // Types
import { MprisPlayer } from 'types/service/mpris.js'; import { MprisPlayer } from 'types/service/mpris.ts';
import AgsOverlay from 'types/widgets/overlay.js'; import AgsOverlay from 'types/widgets/overlay.ts';
import { Variable as Var } from 'types/variable'; import { Variable as Var } from 'types/variable';
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
const Top = ( const Top = (

View file

@ -89,7 +89,7 @@ export default ({
App.getWindow(name)?.child.show_all(); App.getWindow(name)?.child.show_all();
}, },
// This is for my custom pointers.js // This is for my custom pointers.ts
close_on_unfocus, close_on_unfocus,
}; };

View file

@ -8,13 +8,13 @@ import { lookUpIcon } from 'resource:///com/github/Aylur/ags/utils.js';
const { GLib } = imports.gi; const { GLib } = imports.gi;
import Gesture from './gesture.js'; import Gesture from './gesture.ts';
import CursorBox from '../misc/cursorbox.js'; import CursorBox from '../misc/cursorbox.ts';
// Types // Types
import { Notification as NotifObj } from 'types/service/notifications.js'; import { Notification as NotifObj } from 'types/service/notifications.ts';
import AgsEventBox from 'types/widgets/eventbox.js'; import AgsEventBox from 'types/widgets/eventbox.ts';
import { Client } from 'types/service/hyprland.js'; import { Client } from 'types/service/hyprland.ts';
type NotificationWidget = { type NotificationWidget = {
notif: NotifObj notif: NotifObj
slideIn?: 'Left' | 'Right' slideIn?: 'Left' | 'Right'

View file

@ -4,11 +4,11 @@ import Notifications from 'resource:///com/github/Aylur/ags/service/notification
import { Label, Box, Icon, Scrollable, Revealer } from 'resource:///com/github/Aylur/ags/widget.js'; import { Label, Box, Icon, Scrollable, Revealer } 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';
import { Notification, HasNotifs } from './base.js'; import { Notification, HasNotifs } from './base.ts';
import CursorBox from '../misc/cursorbox.js'; import CursorBox from '../misc/cursorbox.ts';
// Types // Types
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import { Notification as NotifObj } from 'resource:///com/github/Aylur/ags/service/notifications.js'; import { Notification as NotifObj } from 'resource:///com/github/Aylur/ags/service/notifications.js';

View file

@ -3,13 +3,13 @@ import Notifications from 'resource:///com/github/Aylur/ags/service/notification
import { Box, EventBox } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, EventBox } 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';
import { HasNotifs } from './base.js'; import { HasNotifs } from './base.ts';
const { Gdk, Gtk } = imports.gi; const { Gdk, Gtk } = imports.gi;
const display = Gdk.Display.get_default(); const display = Gdk.Display.get_default();
// Types // Types
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
const MAX_OFFSET = 200; const MAX_OFFSET = 200;
const OFFSCREEN = 300; const OFFSCREEN = 300;

View file

@ -1,8 +1,8 @@
import { Window } from 'resource:///com/github/Aylur/ags/widget.js'; import { Window } from 'resource:///com/github/Aylur/ags/widget.js';
import NotifCenterWidget from './center.js'; import NotifCenterWidget from './center.ts';
import PopUpsWidget from './popup.js'; import PopUpsWidget from './popup.ts';
import PopupWindow from '../misc/popup.js'; import PopupWindow from '../misc/popup.ts';
export const NotifPopups = () => Window({ export const NotifPopups = () => Window({
name: 'notifications', name: 'notifications',

View file

@ -5,12 +5,12 @@ import { interval } from 'resource:///com/github/Aylur/ags/utils.js';
import GLib from 'gi://GLib'; import GLib from 'gi://GLib';
import { Notification } from './base.js'; import { Notification } from './base.ts';
const DELAY = 2000; const DELAY = 2000;
// Types // Types
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
export default () => Box({ export default () => Box({

View file

@ -4,15 +4,15 @@ import { execAsync, timeout } from 'resource:///com/github/Aylur/ags/utils.js';
const { Gtk } = imports.gi; const { Gtk } = imports.gi;
import Tablet from '../../services/tablet.js'; import Tablet from '../../services/tablet.ts';
const KEY_N = 249; const KEY_N = 249;
const HIDDEN_MARGIN = 340; const HIDDEN_MARGIN = 340;
const ANIM_DURATION = 700; const ANIM_DURATION = 700;
// Types // Types
import AgsWindow from 'types/widgets/window.js'; import AgsWindow from 'types/widgets/window.ts';
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
const releaseAllKeys = () => { const releaseAllKeys = () => {

View file

@ -3,11 +3,11 @@ import { Box, CenterBox, Label, ToggleButton } from 'resource:///com/github/Aylu
const { Gdk } = imports.gi; const { Gdk } = imports.gi;
const display = Gdk.Display.get_default(); const display = Gdk.Display.get_default();
import Separator from '../misc/separator.js'; import Separator from '../misc/separator.ts';
import RoundedCorner from '../corners/screen-corners.js'; import RoundedCorner from '../corners/screen-corners.ts';
import Key from './keys.js'; import Key from './keys.ts';
import { defaultOskLayout, oskLayouts } from './keyboard-layouts.js'; import { defaultOskLayout, oskLayouts } from './keyboard-layouts.ts';
const keyboardLayout = defaultOskLayout; const keyboardLayout = defaultOskLayout;
const keyboardJson = oskLayouts[keyboardLayout]; const keyboardJson = oskLayouts[keyboardLayout];
@ -16,8 +16,8 @@ const COLOR = 'rgba(0, 0, 0, 0.3)';
const SPACING = 4; const SPACING = 4;
// Types // Types
import AgsWindow from 'types/widgets/window.js'; import AgsWindow from 'types/widgets/window.ts';
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
export default (window: AgsWindow) => Box({ export default (window: AgsWindow) => Box({

View file

@ -1,5 +1,5 @@
import Variable from 'resource:///com/github/Aylur/ags/variable.js'; import Variable from 'resource:///com/github/Aylur/ags/variable.js';
import Brightness from '../../services/brightness.js'; import Brightness from '../../services/brightness.ts';
import { Box, EventBox, Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, EventBox, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js'; import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
@ -7,7 +7,7 @@ import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
const { Gdk, Gtk } = imports.gi; const { Gdk, Gtk } = imports.gi;
const display = Gdk.Display.get_default(); const display = Gdk.Display.get_default();
import Separator from '../misc/separator.js'; import Separator from '../misc/separator.ts';
// Keep track of when a non modifier key // Keep track of when a non modifier key
// is clicked to release all modifiers // is clicked to release all modifiers
@ -45,7 +45,7 @@ const LALT_CODE = 56;
const LCTRL_CODE = 29; const LCTRL_CODE = 29;
// Types // Types
import { Variable as Var } from 'types/variable.js'; import { Variable as Var } from 'types/variable.ts';
type Key = { type Key = {
keytype: 'normal', keytype: 'normal',
label: string, label: string,

View file

@ -1,9 +1,9 @@
import { Window } from 'resource:///com/github/Aylur/ags/widget.js'; import { Window } from 'resource:///com/github/Aylur/ags/widget.js';
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js'; import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
import Tablet from '../../services/tablet.js'; import Tablet from '../../services/tablet.ts';
import Gesture from './gesture.js'; import Gesture from './gesture.ts';
import Keyboard from './keyboard.js'; import Keyboard from './keyboard.ts';
// Start ydotool daemon // Start ydotool daemon

View file

@ -3,14 +3,14 @@ import App from 'resource:///com/github/Aylur/ags/app.js';
import { timeout } from 'resource:///com/github/Aylur/ags/utils.js'; import { timeout } from 'resource:///com/github/Aylur/ags/utils.js';
import { Stack } from 'resource:///com/github/Aylur/ags/widget.js'; import { Stack } from 'resource:///com/github/Aylur/ags/widget.js';
import PopupWindow from '../misc/popup.js'; import PopupWindow from '../misc/popup.ts';
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsStack from 'types/widgets/stack.js'; import AgsStack from 'types/widgets/stack.ts';
// Import all the OSDs as an array // Import all the OSDs as an array
const OSDList = [] as Array<(stack: AgsStack) => AgsBox>; const OSDList = [] as Array<(stack: AgsStack) => AgsBox>;
import * as Modules from './osds.js'; import * as Modules from './osds.ts';
for (const osd in Modules) { for (const osd in Modules) {
OSDList.push(Modules[osd]); OSDList.push(Modules[osd]);
} // Array } // Array

View file

@ -2,11 +2,11 @@ import Audio from 'resource:///com/github/Aylur/ags/service/audio.js';
import Variable from 'resource:///com/github/Aylur/ags/variable.js'; import Variable from 'resource:///com/github/Aylur/ags/variable.js';
import { Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Label } from 'resource:///com/github/Aylur/ags/widget.js';
import OSD from './ctor.js'; import OSD from './ctor.ts';
import Brightness from '../../services/brightness.js'; import Brightness from '../../services/brightness.ts';
import { SpeakerIcon } from '../misc/audio-icons.js'; import { SpeakerIcon } from '../misc/audio-icons.ts';
import { MicIcon } from '../misc/audio-icons.js'; import { MicIcon } from '../misc/audio-icons.ts';
const AUDIO_MAX = 1.5; const AUDIO_MAX = 1.5;
@ -17,7 +17,7 @@ globalThis.showSpeaker = () => {
}; };
// Types // Types
import AgsStack from 'types/widgets/stack.js'; import AgsStack from 'types/widgets/stack.ts';
export const SpeakerOSD = (stack: AgsStack) => OSD({ export const SpeakerOSD = (stack: AgsStack) => OSD({

View file

@ -4,15 +4,15 @@ import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { Icon, Revealer } from 'resource:///com/github/Aylur/ags/widget.js'; import { Icon, Revealer } 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';
import { WindowButton } from './dragndrop.js'; import { WindowButton } from './dragndrop.ts';
import * as VARS from './variables.js'; import * as VARS from './variables.ts';
// Types // Types
import { Client as HyprClient } from 'types/service/hyprland.js'; import { Client as HyprClient } from 'types/service/hyprland.ts';
import AgsRevealer from 'types/widgets/revealer.js'; import AgsRevealer from 'types/widgets/revealer.ts';
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsButton from 'types/widgets/button.js'; import AgsButton from 'types/widgets/button.ts';
import AgsIcon from 'types/widgets/icon.js'; import AgsIcon from 'types/widgets/icon.ts';
const scale = (size: number) => (size * VARS.SCALE) - VARS.MARGIN; const scale = (size: number) => (size * VARS.SCALE) - VARS.MARGIN;

View file

@ -1,7 +1,7 @@
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js'; import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { Box } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box } from 'resource:///com/github/Aylur/ags/widget.js';
import * as VARS from './variables.js'; import * as VARS from './variables.ts';
const PADDING = 34; const PADDING = 34;
const MARGIN = 9; const MARGIN = 9;
@ -12,10 +12,10 @@ const DEFAULT_STYLE = `
`; `;
// Types // Types
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsRevealer from 'types/widgets/revealer.js'; import AgsRevealer from 'types/widgets/revealer.ts';
import AgsCenterBox from 'types/widgets/centerbox.js'; import AgsCenterBox from 'types/widgets/centerbox.ts';
import AgsEventBox from 'types/widgets/eventbox.js'; import AgsEventBox from 'types/widgets/eventbox.ts';
export const Highlighter = () => Box({ export const Highlighter = () => Box({

View file

@ -5,17 +5,17 @@ import { Button, EventBox } from 'resource:///com/github/Aylur/ags/widget.js';
import Cairo from 'cairo'; import Cairo from 'cairo';
const { Gtk, Gdk } = imports.gi; const { Gtk, Gdk } = imports.gi;
import { updateClients } from './clients.js'; import { updateClients } from './clients.ts';
const TARGET = [Gtk.TargetEntry.new('text/plain', Gtk.TargetFlags.SAME_APP, 0)]; const TARGET = [Gtk.TargetEntry.new('text/plain', Gtk.TargetFlags.SAME_APP, 0)];
const display = Gdk.Display.get_default(); const display = Gdk.Display.get_default();
// Types // Types
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsButton from 'types/widgets/button.js'; import AgsButton from 'types/widgets/button.ts';
import AgsRevealer from 'types/widgets/revealer.js'; import AgsRevealer from 'types/widgets/revealer.ts';
import { ButtonProps } from 'types/widgets/button.js'; import { ButtonProps } from 'types/widgets/button.ts';
import { EventBoxProps } from 'types/widgets/eventbox.js'; import { EventBoxProps } from 'types/widgets/eventbox.ts';
type WindowButtonType = ButtonProps & { type WindowButtonType = ButtonProps & {
address: string address: string
mainBox: AgsBox mainBox: AgsBox

View file

@ -3,13 +3,13 @@ import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { Box, Overlay, Window } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Overlay, Window } from 'resource:///com/github/Aylur/ags/widget.js';
import { WorkspaceRow, getWorkspaces, updateWorkspaces } from './workspaces.js'; import { WorkspaceRow, getWorkspaces, updateWorkspaces } from './workspaces.ts';
import { Highlighter, updateCurrentWorkspace } from './current-workspace.js'; import { Highlighter, updateCurrentWorkspace } from './current-workspace.ts';
import { updateClients } from './clients.js'; import { updateClients } from './clients.ts';
// Types // Types
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsOverlay from 'types/widgets/overlay.js'; import AgsOverlay from 'types/widgets/overlay.ts';
// TODO: have a 'page' for each monitor, arrows on both sides to loop through // TODO: have a 'page' for each monitor, arrows on both sides to loop through

View file

@ -2,8 +2,8 @@ import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { Revealer, CenterBox, Box, EventBox, Fixed, Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { Revealer, CenterBox, Box, EventBox, Fixed, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import { WorkspaceDrop } from './dragndrop.js'; import { WorkspaceDrop } from './dragndrop.ts';
import * as VARS from './variables.js'; import * as VARS from './variables.ts';
const DEFAULT_STYLE = ` const DEFAULT_STYLE = `
min-width: ${VARS.SCREEN.X * VARS.SCALE}px; min-width: ${VARS.SCREEN.X * VARS.SCALE}px;
@ -11,10 +11,10 @@ const DEFAULT_STYLE = `
`; `;
// Types // Types
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsRevealer from 'types/widgets/revealer.js'; import AgsRevealer from 'types/widgets/revealer.ts';
import AgsCenterBox from 'types/widgets/centerbox.js'; import AgsCenterBox from 'types/widgets/centerbox.ts';
import AgsEventBox from 'types/widgets/eventbox.js'; import AgsEventBox from 'types/widgets/eventbox.ts';
export const getWorkspaces = (box: AgsBox) => { export const getWorkspaces = (box: AgsBox) => {

View file

@ -3,8 +3,8 @@ import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import { CenterBox, Label } from 'resource:///com/github/Aylur/ags/widget.js'; import { CenterBox, Label } from 'resource:///com/github/Aylur/ags/widget.js';
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js'; import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
import PopupWindow from './misc/popup.js'; import PopupWindow from './misc/popup.ts';
import CursorBox from './misc/cursorbox.js'; import CursorBox from './misc/cursorbox.ts';
const PowermenuWidget = () => CenterBox({ const PowermenuWidget = () => CenterBox({

View file

@ -3,16 +3,16 @@ import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
import { Box, Icon, Label, ListBox, Overlay, Revealer, Scrollable } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Icon, Label, ListBox, Overlay, Revealer, Scrollable } from 'resource:///com/github/Aylur/ags/widget.js';
import CursorBox from '../misc/cursorbox.js'; import CursorBox from '../misc/cursorbox.ts';
const SCROLL_THRESH_H = 200; const SCROLL_THRESH_H = 200;
const SCROLL_THRESH_N = 7; const SCROLL_THRESH_N = 7;
// Types // Types
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsScrollable from 'types/widgets/scrollable.js'; import AgsScrollable from 'types/widgets/scrollable.ts';
type ListBoxRow = typeof imports.gi.Gtk.ListBoxRow; type ListBoxRow = typeof imports.gi.Gtk.ListBoxRow;
import { BluetoothDevice as BTDev } from 'types/service/bluetooth.js'; import { BluetoothDevice as BTDev } from 'types/service/bluetooth.ts';
const BluetoothDevice = (dev: BTDev) => Box({ const BluetoothDevice = (dev: BTDev) => Box({

View file

@ -6,20 +6,20 @@ import Variable from 'resource:///com/github/Aylur/ags/variable.js';
import { Box, Icon, Label, Revealer } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Icon, Label, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js'; import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
import { SpeakerIcon, MicIcon } from '../misc/audio-icons.js'; import { SpeakerIcon, MicIcon } from '../misc/audio-icons.ts';
import CursorBox from '../misc/cursorbox.js'; import CursorBox from '../misc/cursorbox.ts';
import Separator from '../misc/separator.js'; import Separator from '../misc/separator.ts';
import { NetworkMenu } from './network.js'; import { NetworkMenu } from './network.ts';
import { BluetoothMenu } from './bluetooth.js'; import { BluetoothMenu } from './bluetooth.ts';
// Types // Types
import { GObject } from 'gi://GObject'; import { GObject } from 'gi://GObject';
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsIcon from 'types/widgets/icon.js'; import AgsIcon from 'types/widgets/icon.ts';
import AgsLabel from 'types/widgets/label.js'; import AgsLabel from 'types/widgets/label.ts';
import AgsRevealer from 'types/widgets/revealer.js'; import AgsRevealer from 'types/widgets/revealer.ts';
import { Variable as Var } from 'types/variable.js'; import { Variable as Var } from 'types/variable.ts';
type IconTuple = [ type IconTuple = [
GObject.Object, GObject.Object,
(self: AgsIcon) => void, (self: AgsIcon) => void,

View file

@ -1,10 +1,10 @@
import { Box, Label, Revealer } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Label, Revealer } from 'resource:///com/github/Aylur/ags/widget.js';
import ButtonGrid from './button-grid.js'; import ButtonGrid from './button-grid.ts';
import SliderBox from './slider-box.js'; import SliderBox from './slider-box.ts';
import Player from '../media-player/player.js'; import Player from '../media-player/player.ts';
import PopupWindow from '../misc/popup.js'; import PopupWindow from '../misc/popup.ts';
import ToggleButton from './toggle-button.js'; import ToggleButton from './toggle-button.ts';
const QuickSettingsWidget = () => { const QuickSettingsWidget = () => {

View file

@ -5,14 +5,14 @@ import Variable from 'resource:///com/github/Aylur/ags/variable.js';
import { Box, Icon, Label, ListBox, Overlay, Revealer, Scrollable } from 'resource:///com/github/Aylur/ags/widget.js'; import { Box, Icon, Label, ListBox, Overlay, Revealer, Scrollable } from 'resource:///com/github/Aylur/ags/widget.js';
import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js'; import { execAsync } from 'resource:///com/github/Aylur/ags/utils.js';
import CursorBox from '../misc/cursorbox.js'; import CursorBox from '../misc/cursorbox.ts';
const SCROLL_THRESH_H = 200; const SCROLL_THRESH_H = 200;
const SCROLL_THRESH_N = 7; const SCROLL_THRESH_N = 7;
// Types // Types
import AgsBox from 'types/widgets/box.js'; import AgsBox from 'types/widgets/box.ts';
import AgsScrollable from 'types/widgets/scrollable.js'; import AgsScrollable from 'types/widgets/scrollable.ts';
type ListBoxRow = typeof imports.gi.Gtk.ListBoxRow; type ListBoxRow = typeof imports.gi.Gtk.ListBoxRow;
type APType = { type APType = {
bssid: string bssid: string

View file

@ -5,8 +5,8 @@ import { Box, Slider, Icon } from 'resource:///com/github/Aylur/ags/widget.js';
const { Gdk } = imports.gi; const { Gdk } = imports.gi;
const display = Gdk.Display.get_default(); const display = Gdk.Display.get_default();
import Brightness from '../../services/brightness.js'; import Brightness from '../../services/brightness.ts';
import { SpeakerIcon } from '../misc/audio-icons.js'; import { SpeakerIcon } from '../misc/audio-icons.ts';
export default () => Box({ export default () => Box({

View file

@ -2,13 +2,13 @@ import App from 'resource:///com/github/Aylur/ags/app.js';
import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js'; import Hyprland from 'resource:///com/github/Aylur/ags/service/hyprland.js';
import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js'; import Bluetooth from 'resource:///com/github/Aylur/ags/service/bluetooth.js';
import Brightness from '../services/brightness.js'; import Brightness from '../services/brightness.ts';
import Pointers from '../services/pointers.js'; import Pointers from '../services/pointers.ts';
import Tablet from '../services/tablet.js'; import Tablet from '../services/tablet.ts';
import TouchGestures from '../services/touch-gestures.js'; import TouchGestures from '../services/touch-gestures.ts';
import closeAll from './misc/closer.js'; import closeAll from './misc/closer.ts';
import Persist from './misc/persist.js'; import Persist from './misc/persist.ts';
export default () => { export default () => {

View file

@ -5,6 +5,7 @@
"lib": [ "lib": [
"ES2022" "ES2022"
], ],
"allowImportingTsExtensions": true,
"allowJs": true, "allowJs": true,
"checkJs": true, "checkJs": true,
"strict": true, "strict": true,