feat(agsV2): migrate binto
All checks were successful
Discord / discord commits (push) Has been skipped

This commit is contained in:
matt1432 2024-11-12 15:08:13 -05:00
parent e2d8754f81
commit 04003d26ee
6 changed files with 179 additions and 2 deletions

View file

@ -61,7 +61,7 @@ in {
roles.desktop = { roles.desktop = {
user = mainUser; user = mainUser;
ags.enable = true; ags-v2.enable = true;
mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D"; mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D";
displayManager.duplicateScreen = false; displayManager.duplicateScreen = false;

View file

@ -71,7 +71,7 @@ in {
]; ];
wayland.windowManager.hyprland.settings = { wayland.windowManager.hyprland.settings = {
bind = [",F8, exec, ags -r 'GSR.saveReplay()'"]; bind = [",F8, exec, ags request 'save-replay'"];
}; };
}; };
} }

View file

@ -0,0 +1,67 @@
export default async() => {
const { execAsync } = await import('astal');
const { App } = await import('astal/gtk3');
const style = (await import('../style/main.scss')).default;
const AppLauncher = (await import('../widgets/applauncher/main')).default;
const Bar = (await import('../widgets/bar/binto')).default;
const Calendar = (await import('../widgets/date/binto')).default;
const Clipboard = (await import('../widgets/clipboard/main')).default;
const { NotifPopups, NotifCenter } = await import('../widgets/notifs/binto');
const OSD = (await import('../widgets/osd/main')).default;
const PowerMenu = (await import('../widgets/powermenu/main')).default;
const Screenshot = (await import('../widgets/screenshot/main')).default;
const { closeAll } = await import('../lib');
const Brightness = (await import('../services/brightness')).default;
const GSR = (await import('../services/gpu-screen-recorder')).default;
const MonitorClicks = (await import('../services/monitor-clicks')).default;
App.start({
css: style,
requestHandler(request, respond) {
if (request.startsWith('open')) {
App.get_window(request.replace('open ', ''))?.set_visible(true);
respond('window opened');
}
else if (request.startsWith('closeAll')) {
closeAll();
respond('closed all windows');
}
else if (request.startsWith('fetchCapsState')) {
Brightness.fetchCapsState();
respond('fetched caps_lock state');
}
else if (request.startsWith('popup')) {
popup_osd(request.replace('popup ', ''));
respond('osd popped up');
}
else if (request.startsWith('save-replay')) {
GSR.saveReplay();
respond('saving replay');
}
},
main: () => {
execAsync('hyprpaper').catch(() => { /**/ });
AppLauncher();
Bar();
Calendar();
Clipboard();
NotifPopups();
NotifCenter();
OSD();
PowerMenu();
Screenshot();
Brightness.initService({
caps: 'input2::capslock',
});
new MonitorClicks();
},
});
};

View file

@ -0,0 +1,61 @@
import { Astal, Gtk } from 'astal/gtk3';
import Audio from './items/audio';
import Clock from './items/clock';
import CurrentClient from './items/current-client';
import Network from './items/network';
import NotifButton from './items/notif-button';
import SysTray from './items/tray';
import Workspaces from './items/workspaces';
import BarRevealer from './fullscreen';
import Separator from '../misc/separator';
import { get_gdkmonitor_from_desc } from '../../lib';
export default () => (
<BarRevealer
gdkmonitor={get_gdkmonitor_from_desc('desc:Acer Technologies Acer K212HQL T3EAA0014201')}
exclusivity={Astal.Exclusivity.EXCLUSIVE}
anchor={
Astal.WindowAnchor.BOTTOM |
Astal.WindowAnchor.LEFT |
Astal.WindowAnchor.RIGHT
}
>
<centerbox className="bar widget">
<box hexpand halign={Gtk.Align.START}>
<Workspaces />
<Separator size={8} />
<CurrentClient />
<Separator size={8} />
</box>
<box>
<Clock />
</box>
<box hexpand halign={Gtk.Align.END}>
<SysTray />
<Separator size={8} />
<Network />
<Separator size={8} />
<NotifButton />
<Separator size={8} />
<Audio />
<Separator size={2} />
</box>
</centerbox>
</BarRevealer>
);

View file

@ -0,0 +1,18 @@
import { Astal } from 'astal/gtk3';
import PopupWindow from '../misc/popup-window';
import { get_gdkmonitor_from_desc } from '../../lib';
import DateWidget from './main';
export default () => (
<PopupWindow
name="calendar"
gdkmonitor={get_gdkmonitor_from_desc('desc:Acer Technologies Acer K212HQL T3EAA0014201')}
anchor={Astal.WindowAnchor.BOTTOM}
transition="slide bottom"
>
<DateWidget />
</PopupWindow>
);

View file

@ -0,0 +1,31 @@
import { Astal } from 'astal/gtk3';
import PopupWindow from '../misc/popup-window';
import { get_gdkmonitor_from_desc } from '../../lib';
import Popups from './popups';
import Center from './center';
export const NotifPopups = () => (
<window
name="notifications"
gdkmonitor={get_gdkmonitor_from_desc('desc:Acer Technologies Acer K212HQL T3EAA0014201')}
namespace="notifications"
layer={Astal.Layer.OVERLAY}
anchor={Astal.WindowAnchor.BOTTOM | Astal.WindowAnchor.LEFT}
>
<Popups />
</window>
);
export const NotifCenter = () => (
<PopupWindow
name="notif-center"
gdkmonitor={get_gdkmonitor_from_desc('desc:Acer Technologies Acer K212HQL T3EAA0014201')}
anchor={Astal.WindowAnchor.BOTTOM | Astal.WindowAnchor.RIGHT}
transition="slide bottom"
>
<Center />
</PopupWindow>
);