From 04003d26eee1b440082d35bcd95be2ca1d1bfc2b Mon Sep 17 00:00:00 2001 From: matt1432 Date: Tue, 12 Nov 2024 15:08:13 -0500 Subject: [PATCH] feat(agsV2): migrate binto --- devices/binto/default.nix | 2 +- devices/binto/modules/gpu-replay.nix | 2 +- .../ags-v2/config/configurations/binto.ts | 67 +++++++++++++++++++ .../ags-v2/config/widgets/bar/binto.tsx | 61 +++++++++++++++++ .../ags-v2/config/widgets/date/binto.tsx | 18 +++++ .../ags-v2/config/widgets/notifs/binto.tsx | 31 +++++++++ 6 files changed, 179 insertions(+), 2 deletions(-) create mode 100644 nixosModules/ags-v2/config/configurations/binto.ts create mode 100644 nixosModules/ags-v2/config/widgets/bar/binto.tsx create mode 100644 nixosModules/ags-v2/config/widgets/date/binto.tsx create mode 100644 nixosModules/ags-v2/config/widgets/notifs/binto.tsx diff --git a/devices/binto/default.nix b/devices/binto/default.nix index 2428ae57..935ee21a 100644 --- a/devices/binto/default.nix +++ b/devices/binto/default.nix @@ -61,7 +61,7 @@ in { roles.desktop = { user = mainUser; - ags.enable = true; + ags-v2.enable = true; mainMonitor = "desc:GIGA-BYTE TECHNOLOGY CO. LTD. G27QC 0x00000B1D"; displayManager.duplicateScreen = false; diff --git a/devices/binto/modules/gpu-replay.nix b/devices/binto/modules/gpu-replay.nix index e98376c2..6c8de65c 100644 --- a/devices/binto/modules/gpu-replay.nix +++ b/devices/binto/modules/gpu-replay.nix @@ -71,7 +71,7 @@ in { ]; wayland.windowManager.hyprland.settings = { - bind = [",F8, exec, ags -r 'GSR.saveReplay()'"]; + bind = [",F8, exec, ags request 'save-replay'"]; }; }; } diff --git a/nixosModules/ags-v2/config/configurations/binto.ts b/nixosModules/ags-v2/config/configurations/binto.ts new file mode 100644 index 00000000..3ffbfa21 --- /dev/null +++ b/nixosModules/ags-v2/config/configurations/binto.ts @@ -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(); + }, + }); +}; diff --git a/nixosModules/ags-v2/config/widgets/bar/binto.tsx b/nixosModules/ags-v2/config/widgets/bar/binto.tsx new file mode 100644 index 00000000..982f8bac --- /dev/null +++ b/nixosModules/ags-v2/config/widgets/bar/binto.tsx @@ -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 () => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +); diff --git a/nixosModules/ags-v2/config/widgets/date/binto.tsx b/nixosModules/ags-v2/config/widgets/date/binto.tsx new file mode 100644 index 00000000..796c80dc --- /dev/null +++ b/nixosModules/ags-v2/config/widgets/date/binto.tsx @@ -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 () => ( + + + +); diff --git a/nixosModules/ags-v2/config/widgets/notifs/binto.tsx b/nixosModules/ags-v2/config/widgets/notifs/binto.tsx new file mode 100644 index 00000000..d09cc9a3 --- /dev/null +++ b/nixosModules/ags-v2/config/widgets/notifs/binto.tsx @@ -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 = () => ( + + + +); + +export const NotifCenter = () => ( + +
+ +);