diff --git a/nixosModules/ags-v2/config/app.ts b/nixosModules/ags-v2/config/app.ts index fa27ad23..1b056979 100644 --- a/nixosModules/ags-v2/config/app.ts +++ b/nixosModules/ags-v2/config/app.ts @@ -1,4 +1,3 @@ -// TODO: touch gestures // TODO: persisting data like bluetooth // TODO: quick-settings // TODO: music player stuff diff --git a/nixosModules/ags-v2/config/configurations/wim.ts b/nixosModules/ags-v2/config/configurations/wim.ts index 54319ac1..6c33cebf 100644 --- a/nixosModules/ags-v2/config/configurations/wim.ts +++ b/nixosModules/ags-v2/config/configurations/wim.ts @@ -20,15 +20,35 @@ export default async() => { const Brightness = (await import('../services/brightness')).default; const MonitorClicks = (await import('../services/monitor-clicks')).default; - globalThis.closeAll = closeAll; - globalThis.Brightness = Brightness; - App.start({ css: style, - requestHandler(js, res) { - App.eval(js).then(res).catch(res); + 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('Brightness.screen')) { + Brightness.screen += parseFloat(request.replace('Brightness.screen ', '')); + respond('screen brightness changed'); + } + else if (request.startsWith('popup')) { + popup_osd(request.replace('popup ', '')); + respond('osd popped up'); + } + else if (request.startsWith('osk')) { + console.log(`TODO: ${request.replace('osk ', '')}`); + respond('implement this'); + } }, main: () => { @@ -52,10 +72,6 @@ export default async() => { caps: 'input1::capslock', }); new MonitorClicks(); - - setTimeout(() => { - App.get_window('win-applauncher')?.set_visible(true); - }, 3 * 1000); }, }); }; diff --git a/nixosModules/ags-v2/config/env.d.ts b/nixosModules/ags-v2/config/env.d.ts index 309b1573..2c93f116 100644 --- a/nixosModules/ags-v2/config/env.d.ts +++ b/nixosModules/ags-v2/config/env.d.ts @@ -1,11 +1,7 @@ -/* eslint-disable @typescript-eslint/no-unused-vars, no-var */ +/* eslint-disable @typescript-eslint/no-unused-vars */ const SRC: string; -var Brightness: import('./services/brightness').default; - -function closeAll(): void; - declare module 'inline:*' { const content: string; diff --git a/nixosModules/ags-v2/hyprland.nix b/nixosModules/ags-v2/hyprland.nix index 1e95e8e0..dbcd1777 100644 --- a/nixosModules/ags-v2/hyprland.nix +++ b/nixosModules/ags-v2/hyprland.nix @@ -22,7 +22,10 @@ "ignorealpha 0.19, ^(blur-bg.*)" ]; - exec-once = ["ags"]; + exec-once = [ + "ags" + "sleep 3; ags request 'open win-applauncher'" + ]; bind = [ "$mainMod SHIFT, E , exec, ags toggle win-powermenu" @@ -32,15 +35,15 @@ ]; binde = [ ## Brightness control - ", XF86MonBrightnessUp , exec, ags request 'Brightness.screen += 0.05'" - ", XF86MonBrightnessDown, exec, ags request 'Brightness.screen -= 0.05'" + ", XF86MonBrightnessUp , exec, ags request 'Brightness.screen +0.05'" + ", XF86MonBrightnessDown, exec, ags request 'Brightness.screen -0.05'" ## Volume control - ", XF86AudioRaiseVolume , exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ & ags request 'popup_osd(\"speaker\")' &" - ", XF86AudioLowerVolume , exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- & ags request 'popup_osd(\"speaker\")' &" + ", XF86AudioRaiseVolume , exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+ & ags request 'popup speaker' &" + ", XF86AudioLowerVolume , exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%- & ags request 'popup speaker' &" ]; - bindn = [" , Escape , exec, ags request 'closeAll()'"]; - bindr = ["CAPS, Caps_Lock, exec, ags request 'Brightness.fetchCapsState()'"]; + bindn = [" , Escape , exec, ags request closeAll"]; + bindr = ["CAPS, Caps_Lock, exec, ags request fetchCapsState"]; }; }; } diff --git a/nixosModules/desktop/environment/home/hyprgrass.nix b/nixosModules/desktop/environment/home/hyprgrass.nix index c52df4cd..11977024 100644 --- a/nixosModules/desktop/environment/home/hyprgrass.nix +++ b/nixosModules/desktop/environment/home/hyprgrass.nix @@ -36,16 +36,19 @@ in { # windows resize_on_border_long_press = true; - hyprgrass-bindm = [", longpress:2, movewindow"]; - # in pixels, the distance from the edge that is considered an edge edge_margin = 10; - experimental = { - # send proper cancel events to windows instead of hacky touch_up events, - # NOT recommended as it crashed a few times, once it's stabilized I'll make it the default - send_cancel = 0; - }; + # send proper cancel events to windows instead of hacky touch_up events, + # NOT recommended as it crashed a few times, once it's stabilized I'll make it the default + experimental.send_cancel = 0; + + hyprgrass-bind = [ + ", edge:u:d, exec, ags request 'open win-applauncher'" + ", edge:d:u, exec, ags request 'osk open'" + ", swipe:3:d, exec, hyprctl dispatch hyprexpo:expo on" + ]; + hyprgrass-bindm = [", longpress:2, movewindow"]; }; };