Skip to content

Add xremap module integration with home-manager - #768

Merged
shunkakinoki merged 4 commits into
mainfrom
matic-refactor
Feb 9, 2026
Merged

Add xremap module integration with home-manager#768
shunkakinoki merged 4 commits into
mainfrom
matic-refactor

Conversation

@shunkakinoki

@shunkakinoki shunkakinoki commented Feb 9, 2026

Copy link
Copy Markdown
Owner

Introduce the xremap module and integrate it with home-manager to enable input remapping features. Adjustments to key bindings and service configurations enhance user experience on Linux desktops.


Summary by cubic

Add a reusable Home Manager xremap module and move input remapping from host config to user scope. Enables macOS-style shortcuts via Hyper→Ctrl, with Ghostty overrides and Hyprland-safe exceptions; restores $mod+Shift+F togglefloating and keeps fullscreen on Hyper+F.

  • New Features

    • Home Manager module enables xremap on Linux desktops with wlroots, file watch, and device filter for "keyd virtual keyboard".
    • Global Hyper→Ctrl remap; Ghostty uses Ctrl+Shift for copy/paste.
    • Exceptions: Hyper+F passes through for Hyprland fullscreen; Hyper+3/4/5 pass through for screenshots.
  • Refactors

    • Integrates upstream xremap HM module and adds local module; removes per-host xremap config and nixosModule from matic.
    • Keeps uinput + udev rules in host; enables keyd with etc-managed config and restart trigger.
    • Clarifies SUPER vs Hyper pipeline in keyd and Hyprland comments.

Written for commit 500cf20. Summary will update on new commits.

Copilot AI review requested due to automatic review settings February 9, 2026 08:36
@shunkakinoki shunkakinoki self-assigned this Feb 9, 2026
@mesa-dot-dev

mesa-dot-dev Bot commented Feb 9, 2026

Copy link
Copy Markdown

You do not have enough credits to review this pull request. Please purchase more credits to continue.

@coderabbitai

coderabbitai Bot commented Feb 9, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

The pull request modifies Hyprland keybinding configuration, restructures key remapping services in a host configuration, and adds a new xremap Home Manager module for desktop Linux systems. Changes include adjusting Hyprland's mod+Shift+F binding, importing xremap modules, creating a new xremap service configuration with Ghostty-specific overrides, and reorganizing Keyd service configuration.

Changes

Cohort / File(s) Summary
Hyprland Configuration
config/hyprland/hyprland.conf
Modified mod+Shift+F keybinding from toggling floating to executing hyprctl batch command that moves window to empty workspace and disables fullscreen.
Home Manager Imports
home-manager/default.nix, home-manager/modules/default.nix
Added xremap module to imports and module list, enabling xremap integration in Home Manager configuration.
Xremap Module
home-manager/modules/xremap/default.nix
New Nix module defining xremap key remapping service for desktop Linux with global Hyper-to-Ctrl mappings, Ghostty-specific copy/paste overrides, and systemd service configuration.
Host Configuration Restructuring
named-hosts/matic/default.nix
Removed top-level Keyd/XRemap imports; moved Keyd configuration inline with systemd capabilities and CAP_SETGID settings; removed XRemap block; added conditional CrowdStrike Falcon module inclusion.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Suggested labels

enhancement

Poem

🐰 A keymap dance with Hyper's might,
Remap the globals, make them right,
Ghostty whispers copy-paste dreams,
Keyd and xremap join the schemes,
Keys now flow through Linux's delight! ✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding an xremap module and integrating it with home-manager, which is the primary focus of the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Description check ✅ Passed The PR description clearly describes the changeset: introducing an xremap module integrated with home-manager for input remapping on Linux desktops, with specific details about key binding adjustments and service configurations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch matic-refactor

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @shunkakinoki, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly enhances the system's input remapping capabilities by integrating the xremap tool more deeply and modularly into the home-manager setup. The primary goal is to provide a consistent and customizable key remapping experience across Linux desktops, with special considerations for terminal applications. This change also involves a substantial refactoring of existing keybinding configurations to improve maintainability and clarity.

Highlights

  • xremap Home-Manager Module: A new xremap module has been introduced within home-manager, centralizing the configuration for input remapping. This module enables xremap on Linux desktops, configures it for wlroots, and defines global key remappings using a 'Hyper' prefix, along with application-specific overrides for Ghostty terminal.
  • Configuration Refactoring: The xremap and keyd configurations have been refactored. The extensive inline xremap configuration previously present in named-hosts/matic/default.nix has been removed and moved into the new home-manager module. Similarly, the keyd configuration has been moved from a separate module inclusion to an inline block within the host-specific configuration.
  • Hyprland Keybinding Adjustment: A Hyprland keybinding has been simplified, consolidating the action to move a window to an empty workspace and fullscreen it under a single $mod SHIFT, F binding, and removing the redundant togglefloating binding.
Changelog
  • config/hyprland/hyprland.conf
    • Removed the togglefloating keybinding.
    • Consolidated window management keybindings for moving to an empty workspace and fullscreening under $mod SHIFT, F.
  • home-manager/default.nix
    • Enabled the xremap home-manager module by adding inputs.xremap.homeManagerModules.default.
  • home-manager/modules/default.nix
    • Included the new ./xremap module in the main list of home-manager modules.
  • home-manager/modules/xremap/default.nix
    • Created a new xremap home-manager module.
    • Configured xremap service to enable input remapping on Linux desktops with wlroots support.
    • Defined global key remappings using a 'Hyper' prefix (C-Alt-Shift-Super-) to a 'Ctrl' prefix (C-) for letters, numbers, symbols, and navigation keys.
    • Implemented application-specific remapping for Ghostty terminal, overriding copy/paste to C-Shift-c and C-Shift-v.
    • Set up systemd user service parameters for xremap, including StartLimitIntervalSec and RestartSec.
  • named-hosts/matic/default.nix
    • Removed direct keyd and xremap NixOS module inclusions.
    • Migrated keyd configuration to an inline block within the host-specific configuration.
    • Removed the extensive inline xremap configuration, deferring its management to the new home-manager module.
Activity
  • No human activity (comments, reviews, approvals) has been recorded on this pull request yet.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@mesa-dot-dev

mesa-dot-dev Bot commented Feb 9, 2026

Copy link
Copy Markdown

Mesa Description

TL;DR

Add a reusable Home Manager xremap module and move input remapping from host config to user scope. Clarifies key mapping and restores Hyprland $mod+Shift+F togglefloating.

What changed?

  • home-manager/default.nix: Enabled the new xremap Home Manager module.
  • home-manager/modules/default.nix: Added the new xremap module to the Home Manager modules list.
  • home-manager/modules/xremap/default.nix: Introduced a new Home Manager module for xremap. This module configures a 'Hyper' key mapping (C-Alt-Shift-Super-) to 'Ctrl' for general use, includes specific remapping for Ghostty terminal copy/paste (Ctrl+Shift), and sets up the xremap service with wlroots support, file watch, device filtering for "keyd virtual keyboard", and custom systemd restart tweaks.
  • named-hosts/matic/default.nix: Refactored keyd configuration by removing its dedicated NixOS module import and handling its configuration directly within the host. Removed all xremap configuration, including keymap definitions and its user service setup, from this host-specific file.
  • config/keyd/default.conf: Updated comments to clarify how CapsLock, RightAlt, and the Framework key (leftmeta/prog1) interact with Hyprland bindings and xremap's remapping. No functional keybindings were altered.

Description generated by Mesa. Update settings

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request effectively introduces xremap integration with home-manager by creating a dedicated module. This refactoring moves the configuration from a host-specific file to a reusable module, which is a significant improvement for maintainability and modularity. The changes are well-structured and align with the goal of enhancing input remapping capabilities. I have one suggestion to make the code in the new module more concise.

Comment on lines +14 to +41
letters = [
"a"
"b"
"c"
"d"
"e"
"f"
"g"
"h"
"i"
"j"
"k"
"l"
"m"
"n"
"o"
"p"
"q"
"r"
"s"
"t"
"u"
"v"
"w"
"x"
"y"
"z"
];

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The list of letters can be generated more concisely using lib.stringToCharacters. This improves readability and reduces the line count, making the code easier to maintain.

  letters = lib.stringToCharacters "abcdefghijklmnopqrstuvwxyz";

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 issue found across 5 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them.


<file name="named-hosts/matic/default.nix">

<violation number="1" location="named-hosts/matic/default.nix:74">
P2: This configuration duplicates the existing `config/keyd/default.nix` module. Instead of inlining the configuration, restore the `../../config/keyd` import to the `modules` list to maintain a Single Source of Truth and reduce clutter.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

security.sudo.wheelNeedsPassword = false;

# Keyd configuration (Linux desktop only)
services.keyd.enable = true;

@cubic-dev-ai cubic-dev-ai Bot Feb 9, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This configuration duplicates the existing config/keyd/default.nix module. Instead of inlining the configuration, restore the ../../config/keyd import to the modules list to maintain a Single Source of Truth and reduce clutter.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At named-hosts/matic/default.nix, line 74:

<comment>This configuration duplicates the existing `config/keyd/default.nix` module. Instead of inlining the configuration, restore the `../../config/keyd` import to the `modules` list to maintain a Single Source of Truth and reduce clutter.</comment>

<file context>
@@ -76,127 +70,25 @@ inputs.nixpkgs.lib.nixosSystem {
         security.sudo.wheelNeedsPassword = false;
 
+        # Keyd configuration (Linux desktop only)
+        services.keyd.enable = true;
+        users.groups.keyd = { };
+        systemd.services.keyd.serviceConfig = {
</file context>
Fix with Cubic

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces xremap as a Home Manager module (backed by the upstream xremap/nix-flake Home Manager module) and updates the matic NixOS host configuration accordingly, while adjusting a Hyprland keybinding to align with the new remapping approach.

Changes:

  • Move xremap configuration out of the matic NixOS host module into a dedicated Home Manager module (home-manager/modules/xremap).
  • Integrate the upstream inputs.xremap.homeManagerModules.default module into the Home Manager import set.
  • Update matic to configure keyd directly (and drop the prior module import), and tweak a Hyprland window-management binding.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
named-hosts/matic/default.nix Removes direct xremap NixOS module usage; adds inline keyd configuration and keeps uinput/udev rules needed for input remapping.
home-manager/modules/xremap/default.nix New Home Manager module that defines xremap keymaps and a small systemd user-service tweak for desktop Linux.
home-manager/modules/default.nix Registers the new local ./xremap module.
home-manager/default.nix Imports upstream inputs.xremap.homeManagerModules.default so services.xremap is available in HM.
config/hyprland/hyprland.conf Adjusts an F binding in the window-management section.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +73 to +83
# Keyd configuration (Linux desktop only)
services.keyd.enable = true;
users.groups.keyd = { };
systemd.services.keyd.serviceConfig = {
CapabilityBoundingSet = [ "CAP_SETGID" ];
AmbientCapabilities = [ "CAP_SETGID" ];
};
systemd.services.keyd.restartTriggers = [
(builtins.hashFile "sha256" ../../config/keyd/default.conf)
];
environment.etc."keyd/default.conf".source = ../../config/keyd/default.conf;

Copilot AI Feb 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The keyd configuration here duplicates the existing config/keyd/default.nix module (same enable/group/capabilities/restartTriggers/etc). Consider importing ../../config/keyd again (or reusing that module) instead of inlining, to reduce duplication and avoid future drift.

Copilot uses AI. Check for mistakes.
bind = $mod SHIFT, F, togglefloating,
bind = CTRL ALT SHIFT SUPER, F, exec, hyprctl --batch "dispatch movetoworkspace empty; dispatch fullscreen 0"
bind = $mod SHIFT, F, exec, hyprctl --batch "dispatch movetoworkspace empty; dispatch fullscreen 0"
bind = SUPER CTRL, F, fullscreen, 0

Copilot AI Feb 9, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change removes the only togglefloating keybinding in the Hyprland config (no other togglefloating bind exists in repo config). If floating toggle is still desired, consider reintroducing it on a different chord so the action remains accessible.

Suggested change
bind = SUPER CTRL, F, fullscreen, 0
bind = SUPER CTRL, F, fullscreen, 0
bind = $mod, G, togglefloating,

Copilot uses AI. Check for mistakes.
Clarify SUPER vs Hyper key pipeline in keyd comments and revert
incorrect hyprland bind change (restore togglefloating on $mod+Shift+F).
Framework+F now passes through as Hyper+F to Hyprland instead of
being remapped to Ctrl+F by xremap.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants