# Touchegg gesture support for dots-hyprland { config, lib, pkgs, ... }: with lib; let cfg = config.programs.dots-hyprland.touchegg; mainCfg = config.programs.dots-hyprland; in { options.programs.dots-hyprland.touchegg = { enable = mkEnableOption "Touchegg gesture support"; config = mkOption { type = types.lines; default = '' 150 80 auto auto true F84A53 F84A53 begin begin hyprctl dispatch fullscreen 0 false NONE begin hyprctl dispatch fullscreen 1 false NONE begin hyprctl dispatch global quickshell:overviewToggle false NONE begin hyprctl dispatch overview false NONE begin hyprctl dispatch movewindow l false NONE begin hyprctl dispatch movewindow r false NONE begin hyprctl dispatch movewindow u false NONE begin hyprctl dispatch movewindow d false NONE begin true Control_L KP_Subtract KP_Add true Control_L KP_Add KP_Subtract true Control_L KP_Subtract KP_Add true Control_L KP_Add KP_Subtract true Control_L KP_Subtract KP_Add true Control_L KP_Add KP_Subtract ''; description = "Touchegg configuration XML"; }; }; config = mkIf cfg.enable { # Note: touchegg service needs to be enabled at system level # Add this to your NixOS configuration: services.touchegg.enable = true; # Install touchegg configuration (both user and system locations) xdg.configFile."touchegg/touchegg.conf" = { text = cfg.config; }; # Also create system config that touchegg service can read # Note: This requires the touchegg service to be enabled at system level home.activation.toucheggSystemConfig = lib.hm.dag.entryAfter ["writeBoundary"] '' echo "πŸ“„ Creating system-wide touchegg configuration..." $DRY_RUN_CMD sudo mkdir -p /etc/touchegg $DRY_RUN_CMD sudo cp ${config.xdg.configHome}/touchegg/touchegg.conf /etc/touchegg/touchegg.conf echo "βœ… System touchegg config updated" ''; # Create touchegg client service (required for gesture execution) systemd.user.services.touchegg-client = { Unit = { Description = "Touchegg Client"; After = [ "graphical-session.target" ]; }; Service = { Type = "simple"; ExecStart = "${pkgs.touchegg}/bin/touchegg --client"; Restart = "on-failure"; RestartSec = 3; }; Install = { WantedBy = [ "default.target" ]; }; }; # Install touchegg and management scripts home.packages = [ pkgs.touchegg ] ++ [ (pkgs.writeShellScriptBin "touchegg-restart" '' echo "πŸ”„ Restarting touchegg service..." sudo systemctl restart touchegg echo "βœ… Touchegg restarted" '') (pkgs.writeShellScriptBin "touchegg-status" '' echo "πŸ“Š Touchegg service status:" systemctl status touchegg --no-pager echo "" echo "πŸ“„ Touchegg configuration:" echo " ~/.config/touchegg/touchegg.conf" if [[ -f ~/.config/touchegg/touchegg.conf ]]; then echo " βœ… Configuration file exists" else echo " ❌ Configuration file missing" fi '') (pkgs.writeShellScriptBin "touchegg-reload-config" '' echo "πŸ”„ Reloading touchegg configuration..." if systemctl is-active touchegg >/dev/null 2>&1; then sudo systemctl reload touchegg 2>/dev/null || sudo systemctl restart touchegg echo "βœ… Touchegg configuration reloaded" else echo "❌ Touchegg service is not running" echo "πŸ’‘ Try: sudo systemctl start touchegg" fi '') ]; # Session variables for touchegg home.sessionVariables = { TOUCHEGG_CONFIG_PATH = "$HOME/.config/touchegg/touchegg.conf"; }; }; }