rcgit

/ nixos

plain blame

{ pkgs, ... }:
{

  services.hyprpaper = {
    enable = true;
    settings = {
      ipc = "on";
      preload = [
        "/etc/nixos/home/wallpapers/owl1.webp"
        "/etc/nixos/home/wallpapers/owl2.webp"
        "/etc/nixos/home/wallpapers/owl3.webp"
      ];
      wallpaper = [ ", /etc/nixos/home/wallpapers/owl1.webp" ];
    };
  };

  services.hyprpolkitagent.enable = true;

  services.hypridle = {
    enable = true;
    settings = {
      general = {
        after_sleep_cmd = "${pkgs.hyprland}/bin/hyprctl dispatch dpms on";
        ignore_dbus_inhibit = false;
        lock_cmd = "${pkgs.procps}/bin/pidof hyprlock || ${pkgs.hyprlock}/bin/hyprlock";
      };

      listener = [
        {
          timeout = 300;
          on-timeout = "${pkgs.brightnessctl}/bin/brightnessctl -s set 10";
          on-resume = "${pkgs.brightnessctl}/bin/brightnessctl -r";
        }
        {
          timeout = 600;
          on-timeout = "${pkgs.systemd}/bin/loginctl lock-session";
        }
        {
          timeout = 900; # 15 minutes
          on-timeout = "${pkgs.hyprland}/bin/hyprctl dispatch dpms off"; # screen off when timeout has passed
          on-resume = "${pkgs.hyprland}/bin/hyprctl dispatch dpms on"; # screen on when activity is detected after timeout has fired.
        }
        {
          timeout = 1800;
          on-timeout = "${pkgs.systemd}/bin/systemctl suspend";
        }
      ];
    };
  };
  wayland.windowManager.hyprland = {
    enable = true;
    package = pkgs.hyprland;
    systemd = {
      variables = [ "--all" ];
      enable = true;
      enableXdgAutostart = true;
    };
    extraConfig = ''
      gesture = 3, up, dispatcher, fullscreen 1
      gesture = 3, down, dispatcher, fullscreen 1
      gesture = 4, up, dispatcher, fullscreen 0
      gesture = 4, down, dispatcher, fullscreen 0
      gesture = 2, pinchout, dispatcher, splitratio 0.1   # approximating clockwise to pinchout
      gesture = 2, pinchin, dispatcher, splitratio -0.1  # approximating anticlockwise to pinchin
      gesture = 4, pinchin, close
      gesture = 4, pinchout, dispatcher, exec ${pkgs.ghostty}/bin/ghostty
      gesture = 2, left, dispatcher, workspace 1   # approximating left_up/left_down to left/right/up/down
      gesture = 2, down, dispatcher, workspace 2
      gesture = 2, right, dispatcher, workspace 3
      gesture = 2, up, dispatcher, workspace 4

      exec-once = ${pkgs.hyprlock}/bin/hyprlock --immediate;
      env = HYPRCURSOR_THEME,rose-pine-hyprcursor
    '';
    xwayland.enable = true;
    settings = {
      monitor = ", preferred, auto, 1";
      general = {
        gaps_out = 10;
      };
      input = {
        kb_layout = "us,fi";
        kb_options = "grp:alt_shift_toggle";
        scroll_method = "on_button_down";
        scroll_button = 274;
        sensitivity = 0; # -1.0 - 1.0, 0 means no modification
        repeat_delay = 180;
        repeat_rate = 150;
        touchpad = {
          natural_scroll = true;
          disable_while_typing = true;
          tap-to-click = true;
          middle_button_emulation = true;
        };
      };
      decoration = {
        dim_inactive = true;
      };
      misc = {
        disable_hyprland_logo = true;
        disable_splash_rendering = true;
        middle_click_paste = true;
      };
      "$mainMod" = "SUPER";
      bind = [
        "$mainMod, V, exec, ${pkgs.ghostty}/bin/ghostty --class clipse -e 'clipse' "
        "$mainMod, Return, exec, ${pkgs.ghostty}/bin/ghostty"
        "$mainMod, d, exec, ${pkgs.walker}/bin/walker --modules applications,translation,webesearch,clipboard,finder"
        "$mainMod, B, exec, ${pkgs.firefox}/bin/firefox"
        "$mainMod, F, fullscreen"
        "$mainMod, C, killactive,"
        "$mainMod, Tab, cyclenext"
        ", Print, exec, ${pkgs.grim}/bin/grim - | ${pkgs.wl-clipboard}/bin/wl-copy && ${pkgs.wl-clipboard}/bin/wl-paste > ~/Pictures/screenshots/Screenshot-$(date +%F_%T).png && ${pkgs.dunst}/bin/dunstify 'Screenshot of the whole screen taken' -t 1000"
        ", XF86MonBrightnessUp, exec, brightnessctl s -e 5%+"
        ", XF86MonBrightnessDown, exec, brightnessctl s -e 5%-"
        ", XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+"
        ", XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
        "$mainMod SHIFT, L, exec, hyprlock"

        # Move focus with mainMod + arrow keys
        "$mainMod, left, movefocus, l"
        "$mainMod, right, movefocus, r"
        "$mainMod, up, movefocus, u"
        "$mainMod, down, movefocus, d"
        "$mainMod, H, movefocus, l"
        "$mainMod, L, movefocus, r"
        "$mainMod, K, movefocus, u"
        "$mainMod, J, movefocus, d"

        "$mainMod SHIFT, left, swapwindow, l"
        "$mainMod SHIFT, right, swapwindow, r"
        "$mainMod SHIFT, up, swapwindow, u"
        "$mainMod SHIFT, down, swapwindow, d"

        # Switch workspaces with mainMod + [0-9]
        "$mainMod, 1, workspace, 1"
        "$mainMod, 2, workspace, 2"
        "$mainMod, 3, workspace, 3"
        "$mainMod, 4, workspace, 4"
        "$mainMod, 5, workspace, 5"
        "$mainMod, 6, workspace, 6"
        "$mainMod, 7, workspace, 7"
        "$mainMod, 8, workspace, 8"
        "$mainMod, 9, workspace, 9"
        "$mainMod, 0, workspace, 10"

        # Move active window to a workspace with mainMod + SHIFT + [0-9]
        "$mainMod SHIFT, 1, movetoworkspace, 1"
        "$mainMod SHIFT, 2, movetoworkspace, 2"
        "$mainMod SHIFT, 3, movetoworkspace, 3"
        "$mainMod SHIFT, 4, movetoworkspace, 4"
        "$mainMod SHIFT, 5, movetoworkspace, 5"
        "$mainMod SHIFT, 6, movetoworkspace, 6"
        "$mainMod SHIFT, 7, movetoworkspace, 7"
        "$mainMod SHIFT, 8, movetoworkspace, 8"
        "$mainMod SHIFT, 9, movetoworkspace, 9"
        "$mainMod SHIFT, 0, movetoworkspace, 10"
      ];
      binde = [ ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle" ];
      bindm = [
        # Move/resize windows with mainMod + LMB/RMB and dragging
        "$mainMod, mouse:272, movewindow"
        "$mainMod, mouse:273, resizewindow"
      ];
    };
  };
}