Skip to content

Commit

Permalink
feat(hyprland): add window rules for mihoyo games
Browse files Browse the repository at this point in the history
  • Loading branch information
zakuciael committed Jun 19, 2024
1 parent cc350bb commit 9d0c521
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"fullscreen",
"gamemode",
"gamescope",
"Genshin",
"grimblast",
"hypr",
"Hyprland",
Expand Down
19 changes: 18 additions & 1 deletion modules/desktop/gaming/mihoyo.nix
Original file line number Diff line number Diff line change
@@ -1,17 +1,34 @@
{
config,
lib,
username,
...
}:
with lib;
with lib.my; let
with lib.my;
with lib.my.utils; let
cfg = config.modules.desktop.gaming.mihoyo;
layout = findLayoutConfig config ({index, ...}: index == 1); # Main monitor
monitor = getLayoutMonitor layout "wayland";
launcherClass = "^(moe.launcher.an-anime-game-launcher)$";
gameTitle = "^(Genshin Impact)$";
in {
options.modules.desktop.gaming.mihoyo = {
enable = mkEnableOption "miHoYo games";
};

config = mkIf (cfg.enable) {
home-manager.users.${username} = {
wayland.windowManager.hyprland.settings = {
windowrulev2 = [
"float, class:${launcherClass}"
"size 70% 70%, class:${launcherClass}"
"monitor ${monitor}, class:${launcherClass}"
"monitor ${monitor}, title:${gameTitle}"
];
};
};

programs.anime-game-launcher.enable = true;
};
}

0 comments on commit 9d0c521

Please sign in to comment.