Add hyprland dispatcher (doesn't do anything yet)

This commit is contained in:
NullBite 2024-02-19 19:43:25 +01:00
parent f7b7bef245
commit 3acfc2e9d9
Signed by: nullbite
GPG Key ID: 6C4D545385D4925A
3 changed files with 47 additions and 0 deletions

View File

@ -2,6 +2,8 @@
let
cfg = config.nixfiles.sessions.hyprland;
mkd = lib.mkDefault;
hyprland-pkg = config.wayland.windowManager.hyprland.finalPackage;
terminal = "${pkgs.kitty}/bin/kitty";
files = "${pkgs.dolphin}/bin/dolphin";
rofi = "${pkgs.rofi-wayland}/bin/rofi";
@ -10,6 +12,8 @@ let
polkit-agent = "${pkgs.polkit-kde-agent}/libexec/polkit-kde-authentication-agent-1";
grimblast = "${inputs.hyprwm-contrib.packages.${pkgs.system}.grimblast}/bin/grimblast";
hypr-dispatcher = "${pkgs.callPackage ./dispatcher { hyprland = hyprland-pkg; }}/bin/hypr-dispatcher";
# https://github.com/flatpak/xdg-desktop-portal-gtk/issues/440#issuecomment-1900520919
xdpg-workaround = pkgs.writeShellScript "xdg-desktop-portal-gtk-workaround"
''
@ -56,6 +60,7 @@ in
wev
dunst
pkgs.brightnessctl
hypr-dispatcher
];
wayland.windowManager.hyprland = {

View File

@ -0,0 +1,19 @@
{ lib,
stdenvNoCC,
socat,
coreutils,
hyprland,
makeShellWrapper }:
let
wrappedPath = lib.makeBinPath [ coreutils socat hyprland ];
in
stdenvNoCC.mkDerivation {
name = "hyprland-dispatcher";
phases = [ "installPhase" ];
nativeBuildInputs = [ makeShellWrapper ];
src = ./.;
installPhase = ''
install -Dm555 $src/dispatcher.sh $out/bin/hypr-dispatcher
wrapProgramShell $out/bin/hypr-dispatcher --prefix PATH : "${wrappedPath}"
'';
}

View File

@ -0,0 +1,23 @@
#!/usr/bin/env bash
state_gd_rebind=0
log() {
echo "$@" >&2
}
handle_active_window() {
case "$1" in
# geometry dash
*'>>'steam_app_322170,*) log matched Geometry Dash ;;
esac
}
handle() {
case "$1" in
activewindow*) handle_active_window "$1" ;;
esac
};
socat - "UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock" | \
while read -r line ; do handle "$line"; done