fix(ags): revert async imports to work with latest
All checks were successful
Discord / discord commits (push) Has been skipped
All checks were successful
Discord / discord commits (push) Has been skipped
This commit is contained in:
parent
c688707d49
commit
ef23df4bb2
10 changed files with 373 additions and 360 deletions
|
@ -2,8 +2,23 @@
|
||||||
// TODO: quick-settings
|
// TODO: quick-settings
|
||||||
// TODO: music player stuff
|
// TODO: music player stuff
|
||||||
// TODO: on-screen-keyboard
|
// TODO: on-screen-keyboard
|
||||||
|
// TODO: see if I can bundle each config separately with nix
|
||||||
|
|
||||||
import GLib from 'gi://GLib';
|
import { programArgs } from 'system';
|
||||||
|
|
||||||
|
import binto from './configurations/binto';
|
||||||
|
import wim from './configurations/wim';
|
||||||
|
|
||||||
|
import greeter from './configurations/greeter';
|
||||||
|
import lock from './configurations/lock';
|
||||||
|
|
||||||
|
|
||||||
(await import(`./configurations/${GLib.getenv('CONF')}.ts`)).default();
|
switch (programArgs[0]) {
|
||||||
|
case 'binto': binto(); break;
|
||||||
|
|
||||||
|
case 'wim': wim(); break;
|
||||||
|
|
||||||
|
case 'greeter': greeter(); break;
|
||||||
|
|
||||||
|
case 'lock': lock(); break;
|
||||||
|
}
|
||||||
|
|
|
@ -1,25 +1,25 @@
|
||||||
export default async() => {
|
import { execAsync } from 'astal';
|
||||||
const { execAsync } = await import('astal');
|
import { App } from 'astal/gtk3';
|
||||||
const { App } = await import('astal/gtk3');
|
|
||||||
|
|
||||||
const style = (await import('../style/main.scss')).default;
|
import style from '../style/main.scss';
|
||||||
|
|
||||||
const AppLauncher = (await import('../widgets/applauncher/main')).default;
|
import AppLauncher from '../widgets/applauncher/main';
|
||||||
const Bar = (await import('../widgets/bar/binto')).default;
|
import Bar from '../widgets/bar/binto';
|
||||||
const BgLayer = (await import('../widgets/bg-layer/main')).default;
|
import BgLayer from '../widgets/bg-layer/main';
|
||||||
const Calendar = (await import('../widgets/date/binto')).default;
|
import Calendar from '../widgets/date/binto';
|
||||||
const Clipboard = (await import('../widgets/clipboard/main')).default;
|
import Clipboard from '../widgets/clipboard/main';
|
||||||
const { NotifPopups, NotifCenter } = await import('../widgets/notifs/binto');
|
import { NotifPopups, NotifCenter } from '../widgets/notifs/binto';
|
||||||
const OSD = (await import('../widgets/osd/main')).default;
|
import OSD from '../widgets/osd/main';
|
||||||
const PowerMenu = (await import('../widgets/powermenu/main')).default;
|
import PowerMenu from '../widgets/powermenu/main';
|
||||||
const Screenshot = (await import('../widgets/screenshot/main')).default;
|
import Screenshot from '../widgets/screenshot/main';
|
||||||
|
|
||||||
const { closeAll, perMonitor } = await import('../lib');
|
import { closeAll, perMonitor } from '../lib';
|
||||||
const Brightness = (await import('../services/brightness')).default;
|
import Brightness from '../services/brightness';
|
||||||
const GSR = (await import('../services/gpu-screen-recorder')).default;
|
import GSR from '../services/gpu-screen-recorder';
|
||||||
const MonitorClicks = (await import('../services/monitor-clicks')).default;
|
import MonitorClicks from '../services/monitor-clicks';
|
||||||
|
|
||||||
|
|
||||||
|
export default () => {
|
||||||
App.start({
|
App.start({
|
||||||
css: style,
|
css: style,
|
||||||
|
|
||||||
|
@ -61,9 +61,8 @@ export default async() => {
|
||||||
PowerMenu();
|
PowerMenu();
|
||||||
Screenshot();
|
Screenshot();
|
||||||
|
|
||||||
Brightness.initService({
|
Brightness.initService({ caps: 'input2::capslock' });
|
||||||
caps: 'input2::capslock',
|
GSR.initService();
|
||||||
});
|
|
||||||
new MonitorClicks();
|
new MonitorClicks();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
export default async() => {
|
import { execAsync } from 'astal';
|
||||||
const { execAsync } = await import('astal');
|
import { App } from 'astal/gtk3';
|
||||||
const { App } = await import('astal/gtk3');
|
|
||||||
|
|
||||||
const Greeter = (await import('../widgets/greeter/main')).default;
|
import Greeter from '../widgets/greeter/main';
|
||||||
|
|
||||||
const style = (await import('../style/greeter.scss')).default;
|
import style from '../style/greeter.scss';
|
||||||
|
|
||||||
|
|
||||||
|
export default () => {
|
||||||
App.start({
|
App.start({
|
||||||
css: style,
|
css: style,
|
||||||
instanceName: 'greeter',
|
instanceName: 'greeter',
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
export default async() => {
|
import { App } from 'astal/gtk3';
|
||||||
const { App } = await import('astal/gtk3');
|
|
||||||
|
|
||||||
const Lockscreen = (await import('../widgets/lockscreen/main')).default;
|
import Lockscreen from '../widgets/lockscreen/main';
|
||||||
|
|
||||||
const style = (await import('../style/lock.scss')).default;
|
import style from '../style/lock.scss';
|
||||||
|
|
||||||
|
|
||||||
|
export default () => {
|
||||||
App.start({
|
App.start({
|
||||||
css: style,
|
css: style,
|
||||||
instanceName: 'lock',
|
instanceName: 'lock',
|
||||||
|
|
|
@ -1,26 +1,26 @@
|
||||||
export default async() => {
|
import { execAsync } from 'astal';
|
||||||
const { execAsync } = await import('astal');
|
import { App } from 'astal/gtk3';
|
||||||
const { App } = await import('astal/gtk3');
|
|
||||||
|
|
||||||
const style = (await import('../style/main.scss')).default;
|
import style from '../style/main.scss';
|
||||||
|
|
||||||
const AppLauncher = (await import('../widgets/applauncher/main')).default;
|
import AppLauncher from '../widgets/applauncher/main';
|
||||||
const Bar = (await import('../widgets/bar/wim')).default;
|
import Bar from '../widgets/bar/wim';
|
||||||
const BgLayer = (await import('../widgets/bg-layer/main')).default;
|
import BgLayer from '../widgets/bg-layer/main';
|
||||||
const Calendar = (await import('../widgets/date/wim')).default;
|
import Calendar from '../widgets/date/wim';
|
||||||
const Clipboard = (await import('../widgets/clipboard/main')).default;
|
import Clipboard from '../widgets/clipboard/main';
|
||||||
const Corners = (await import('../widgets/corners/main')).default;
|
import Corners from '../widgets/corners/main';
|
||||||
const IconBrowser = (await import('../widgets/icon-browser/main')).default;
|
import IconBrowser from '../widgets/icon-browser/main';
|
||||||
const { NotifPopups, NotifCenter } = await import('../widgets/notifs/wim');
|
import { NotifPopups, NotifCenter } from '../widgets/notifs/wim';
|
||||||
const OSD = (await import('../widgets/osd/main')).default;
|
import OSD from '../widgets/osd/main';
|
||||||
const PowerMenu = (await import('../widgets/powermenu/main')).default;
|
import PowerMenu from '../widgets/powermenu/main';
|
||||||
const Screenshot = (await import('../widgets/screenshot/main')).default;
|
import Screenshot from '../widgets/screenshot/main';
|
||||||
|
|
||||||
const { closeAll, perMonitor } = await import('../lib');
|
import { closeAll, perMonitor } from '../lib';
|
||||||
const Brightness = (await import('../services/brightness')).default;
|
import Brightness from '../services/brightness';
|
||||||
const MonitorClicks = (await import('../services/monitor-clicks')).default;
|
import MonitorClicks from '../services/monitor-clicks';
|
||||||
|
|
||||||
|
|
||||||
|
export default () => {
|
||||||
App.start({
|
App.start({
|
||||||
css: style,
|
css: style,
|
||||||
|
|
||||||
|
|
|
@ -75,9 +75,8 @@ const notifySend = ({
|
||||||
class GSR extends GObject.Object {
|
class GSR extends GObject.Object {
|
||||||
private _lastNotifID: number | undefined;
|
private _lastNotifID: number | undefined;
|
||||||
|
|
||||||
constructor() {
|
public initService() {
|
||||||
super();
|
try {
|
||||||
|
|
||||||
subprocess(
|
subprocess(
|
||||||
['gsr-start'],
|
['gsr-start'],
|
||||||
(path) => {
|
(path) => {
|
||||||
|
@ -95,6 +94,10 @@ class GSR extends GObject.Object {
|
||||||
() => { /**/ },
|
() => { /**/ },
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
catch (_e) {
|
||||||
|
console.error('Missing dependency for gpu-screen-recorder');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public saveReplay() {
|
public saveReplay() {
|
||||||
execAsync(['gpu-save-replay'])
|
execAsync(['gpu-save-replay'])
|
||||||
|
|
|
@ -4,17 +4,18 @@ import { App, Astal, Gtk, Widget } from 'astal/gtk3';
|
||||||
import AstalGreet from 'gi://AstalGreet';
|
import AstalGreet from 'gi://AstalGreet';
|
||||||
|
|
||||||
|
|
||||||
const DEFAULT_NAME = 'matt';
|
export default () => {
|
||||||
const PARSED_INDEX = {
|
const DEFAULT_NAME = 'matt';
|
||||||
|
const PARSED_INDEX = {
|
||||||
name: 0,
|
name: 0,
|
||||||
uid: 2,
|
uid: 2,
|
||||||
gid: 3,
|
gid: 3,
|
||||||
desc: 4,
|
desc: 4,
|
||||||
home: 5,
|
home: 5,
|
||||||
shell: 6,
|
shell: 6,
|
||||||
};
|
};
|
||||||
|
|
||||||
const parsePasswd = (fileContent: string) => {
|
const parsePasswd = (fileContent: string) => {
|
||||||
const splitUsers = fileContent.split('\n');
|
const splitUsers = fileContent.split('\n');
|
||||||
const parsedUsers = splitUsers.map((u) => {
|
const parsedUsers = splitUsers.map((u) => {
|
||||||
const user = u.split(':');
|
const user = u.split(':');
|
||||||
|
@ -35,21 +36,21 @@ const parsePasswd = (fileContent: string) => {
|
||||||
!u.name.includes('nixbld') &&
|
!u.name.includes('nixbld') &&
|
||||||
u.name !== 'nobody';
|
u.name !== 'nobody';
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const users = parsePasswd(readFile('/etc/passwd'));
|
const users = parsePasswd(readFile('/etc/passwd'));
|
||||||
|
|
||||||
const dropdown = new Gtk.ComboBoxText();
|
const dropdown = new Gtk.ComboBoxText();
|
||||||
|
|
||||||
dropdown.show_all();
|
dropdown.show_all();
|
||||||
|
|
||||||
users.forEach((u) => {
|
users.forEach((u) => {
|
||||||
dropdown.append(null, u.name);
|
dropdown.append(null, u.name);
|
||||||
});
|
});
|
||||||
|
|
||||||
const response = <label /> as Widget.Label;
|
const response = <label /> as Widget.Label;
|
||||||
|
|
||||||
const password = (
|
const password = (
|
||||||
<entry
|
<entry
|
||||||
placeholderText="Password"
|
placeholderText="Password"
|
||||||
visibility={false}
|
visibility={false}
|
||||||
|
@ -75,10 +76,9 @@ const password = (
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
export default () => (
|
|
||||||
<window
|
<window
|
||||||
name="greeter"
|
name="greeter"
|
||||||
keymode={Astal.Keymode.ON_DEMAND}
|
keymode={Astal.Keymode.ON_DEMAND}
|
||||||
|
@ -116,4 +116,5 @@ export default () => (
|
||||||
{response}
|
{response}
|
||||||
</box>
|
</box>
|
||||||
</window>
|
</window>
|
||||||
);
|
);
|
||||||
|
};
|
||||||
|
|
|
@ -21,15 +21,16 @@ class BlurredBox extends Widget.Box {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const windows = new Map<Gdk.Monitor, Gtk.Window>();
|
export default () => {
|
||||||
const blurBGs: BlurredBox[] = [];
|
const windows = new Map<Gdk.Monitor, Gtk.Window>();
|
||||||
|
const blurBGs: BlurredBox[] = [];
|
||||||
|
|
||||||
const transition_duration = 1000;
|
const transition_duration = 1000;
|
||||||
const WINDOW_MARGINS = -2;
|
const WINDOW_MARGINS = -2;
|
||||||
const ENTRY_SPACING = 20;
|
const ENTRY_SPACING = 20;
|
||||||
const CLOCK_SPACING = 60;
|
const CLOCK_SPACING = 60;
|
||||||
|
|
||||||
const bgCSS = ({ w = 1, h = 1 } = {}) => `
|
const bgCSS = ({ w = 1, h = 1 } = {}) => `
|
||||||
border: 2px solid rgba(189, 147, 249, 0.8);
|
border: 2px solid rgba(189, 147, 249, 0.8);
|
||||||
background: rgba(0, 0, 0, 0.2);
|
background: rgba(0, 0, 0, 0.2);
|
||||||
min-height: ${h}px;
|
min-height: ${h}px;
|
||||||
|
@ -38,9 +39,9 @@ const bgCSS = ({ w = 1, h = 1 } = {}) => `
|
||||||
min-width ${transition_duration / 2}ms;
|
min-width ${transition_duration / 2}ms;
|
||||||
`;
|
`;
|
||||||
|
|
||||||
const lock = Lock.prepare_lock();
|
const lock = Lock.prepare_lock();
|
||||||
|
|
||||||
const unlock = () => {
|
const unlock = () => {
|
||||||
blurBGs.forEach((b) => {
|
blurBGs.forEach((b) => {
|
||||||
b.css = bgCSS({
|
b.css = bgCSS({
|
||||||
w: b.geometry.w,
|
w: b.geometry.w,
|
||||||
|
@ -59,9 +60,9 @@ const unlock = () => {
|
||||||
Gdk.Display.get_default()?.sync();
|
Gdk.Display.get_default()?.sync();
|
||||||
App.quit();
|
App.quit();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const Clock = () => {
|
const Clock = () => {
|
||||||
const time = Variable<string>('').poll(1000, () => {
|
const time = Variable<string>('').poll(1000, () => {
|
||||||
return (new Date().toLocaleString([], {
|
return (new Date().toLocaleString([], {
|
||||||
hour: 'numeric',
|
hour: 'numeric',
|
||||||
|
@ -78,9 +79,9 @@ const Clock = () => {
|
||||||
label={bind(time)}
|
label={bind(time)}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
const PasswordPrompt = (monitor: Gdk.Monitor, visible: boolean) => {
|
const PasswordPrompt = (monitor: Gdk.Monitor, visible: boolean) => {
|
||||||
const rev = new BlurredBox({ css: bgCSS() });
|
const rev = new BlurredBox({ css: bgCSS() });
|
||||||
|
|
||||||
idle(() => {
|
idle(() => {
|
||||||
|
@ -183,17 +184,17 @@ const PasswordPrompt = (monitor: Gdk.Monitor, visible: boolean) => {
|
||||||
) :
|
) :
|
||||||
<box />,
|
<box />,
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const createWindow = (monitor: Gdk.Monitor) => {
|
const createWindow = (monitor: Gdk.Monitor) => {
|
||||||
const hyprDesc = get_hyprland_monitor_desc(monitor);
|
const hyprDesc = get_hyprland_monitor_desc(monitor);
|
||||||
const entryVisible = Vars.mainMonitor === hyprDesc || Vars.dupeLockscreen;
|
const entryVisible = Vars.mainMonitor === hyprDesc || Vars.dupeLockscreen;
|
||||||
const win = PasswordPrompt(monitor, entryVisible);
|
const win = PasswordPrompt(monitor, entryVisible);
|
||||||
|
|
||||||
windows.set(monitor, win);
|
windows.set(monitor, win);
|
||||||
};
|
};
|
||||||
|
|
||||||
const lock_screen = () => {
|
const lock_screen = () => {
|
||||||
const display = Gdk.Display.get_default();
|
const display = Gdk.Display.get_default();
|
||||||
|
|
||||||
for (let m = 0; m < (display?.get_n_monitors() ?? 0); m++) {
|
for (let m = 0; m < (display?.get_n_monitors() ?? 0); m++) {
|
||||||
|
@ -214,17 +215,17 @@ const lock_screen = () => {
|
||||||
lock.new_surface(win, monitor);
|
lock.new_surface(win, monitor);
|
||||||
win.show();
|
win.show();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
const on_finished = () => {
|
const on_finished = () => {
|
||||||
lock.destroy();
|
lock.destroy();
|
||||||
Gdk.Display.get_default()?.sync();
|
Gdk.Display.get_default()?.sync();
|
||||||
App.quit();
|
App.quit();
|
||||||
};
|
};
|
||||||
|
|
||||||
lock.connect('finished', on_finished);
|
lock.connect('finished', on_finished);
|
||||||
|
|
||||||
if (Vars.hasFprintd) {
|
if (Vars.hasFprintd) {
|
||||||
globalThis.authFinger = () => AstalAuth.Pam.authenticate('', (_, task) => {
|
globalThis.authFinger = () => AstalAuth.Pam.authenticate('', (_, task) => {
|
||||||
try {
|
try {
|
||||||
AstalAuth.Pam.authenticate_finish(task);
|
AstalAuth.Pam.authenticate_finish(task);
|
||||||
|
@ -235,8 +236,6 @@ if (Vars.hasFprintd) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
globalThis.authFinger();
|
globalThis.authFinger();
|
||||||
}
|
}
|
||||||
|
|
||||||
export default () => {
|
|
||||||
lock_screen();
|
lock_screen();
|
||||||
};
|
};
|
||||||
|
|
|
@ -26,8 +26,10 @@ in {
|
||||||
"cava"
|
"cava"
|
||||||
"powerprofiles"
|
"powerprofiles"
|
||||||
"river"
|
"river"
|
||||||
"docs" # not a lib
|
|
||||||
"gjs" # not a lib
|
# Not libraries
|
||||||
|
"docs"
|
||||||
|
"gjs"
|
||||||
]
|
]
|
||||||
)
|
)
|
||||||
++ [gtk-session-lock.packages.${pkgs.system}.default];
|
++ [gtk-session-lock.packages.${pkgs.system}.default];
|
||||||
|
@ -36,10 +38,8 @@ in {
|
||||||
name = "lock";
|
name = "lock";
|
||||||
runtimeInputs = [cfg.package];
|
runtimeInputs = [cfg.package];
|
||||||
text = ''
|
text = ''
|
||||||
export CONF="lock"
|
|
||||||
|
|
||||||
if [ "$#" == 0 ]; then
|
if [ "$#" == 0 ]; then
|
||||||
exec ags run ~/${cfg.configDir}
|
exec ags run ~/${cfg.configDir} -a lock
|
||||||
else
|
else
|
||||||
exec ags "$@" -i lock
|
exec ags "$@" -i lock
|
||||||
fi
|
fi
|
||||||
|
@ -54,10 +54,8 @@ in {
|
||||||
name = "ags";
|
name = "ags";
|
||||||
runtimeInputs = [cfg.package];
|
runtimeInputs = [cfg.package];
|
||||||
text = ''
|
text = ''
|
||||||
export CONF="${hostName}"
|
|
||||||
|
|
||||||
if [ "$#" == 0 ]; then
|
if [ "$#" == 0 ]; then
|
||||||
exec ags run ~/${cfg.configDir}
|
exec ags run ~/${cfg.configDir} -a ${hostName}
|
||||||
else
|
else
|
||||||
exec ags "$@"
|
exec ags "$@"
|
||||||
fi
|
fi
|
||||||
|
@ -67,8 +65,7 @@ in {
|
||||||
name = "agsConf";
|
name = "agsConf";
|
||||||
runtimeInputs = [cfg.package];
|
runtimeInputs = [cfg.package];
|
||||||
text = ''
|
text = ''
|
||||||
export CONF="$1"
|
exec ags run ~/${cfg.configDir} -a "$1"
|
||||||
exec ${cfg.package}/bin/ags run ~/${cfg.configDir}
|
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
]
|
]
|
||||||
|
|
|
@ -54,8 +54,7 @@ self: {
|
||||||
];
|
];
|
||||||
|
|
||||||
text = ''
|
text = ''
|
||||||
export CONF="greeter"
|
exec ags run ${agsConfig} -a greeter
|
||||||
exec ags run ${agsConfig}
|
|
||||||
'';
|
'';
|
||||||
})
|
})
|
||||||
];
|
];
|
||||||
|
|
Loading…
Reference in a new issue