{inputs, pkgs, ...}:
{

  home.packages = [
    pkgs.hyprshot
    pkgs.nautilus
    pkgs.gnome-control-center
    pkgs.brightnessctl
    pkgs.cliphist
    pkgs.wl-clipboard
  ];


  wayland.windowManager.hyprland = {
    enable = true;
    systemd.enable = true;
    settings = {
      "$mod" = "SUPER";
      "$browser" = "firefox";
      "$launcher-cmd" = "wofi --show drun -n";
      "$ide" = "code";

      # Global bindings
      bind = [
        # Launch applications
        "$mod, space, exec, $launcher-cmd"
        "$mod, return, exec, kitty"
        "$mod, b, exec, $browser"
        "$mod, s, exec, $ide"
        "$mod, e, exec, nautilus"

        # Lock screen
        "$mod, l, exec, hyprlock"

        # Clipboard management
        "$mod, V, exec, cliphist list | wofi --dmenu | cliphist decode | wl-copy"

        "$mod+Shift, Q, killactive," # Close window
        # Toggle Floating and reduce size
        "$mod, f, togglefloating,"
        "$mod, f, resizeactive, 50% 50%,"

        # Alt-tab alternative
        "$mod, Tab, cyclenext,"
        "$mod, Tab, bringactivetotop,"


        # Move the window
        "$mod+Shift, left, movewindow, l"
        "$mod+Shift, right, movewindow, r"
        "$mod+Shift, up, movewindow, u"
        "$mod+Shift, down, movewindow, d"

        "$mod+Ctrl, left, movetoworkspace, -1"
        "$mod+Ctrl, right, movetoworkspace, +1"

        # # Switch workspace
        # "$mod+Ctrl, left, workspace, -1"
        # "$mod+Ctrl, right, workspace, +1"

        # Screenshot
        "$mod, Print, exec, hyprshot -m region -o ~/Pictures/Screenshots"
        "$mod+Shift, Print, exec, hyprshot -m window -o ~/Pictures/Screenshots"

      ];

      # repeatable bindings
      binde = [
        # Fn keys
        ", XF86MonBrightnessDown, exec, brightnessctl set -5%"
        ", XF86MonBrightnessUp, exec, brightnessctl set +5%"
        ", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+"
        ", XF86AudioLowerVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%-"
        ", XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"

        # Reshape the window in focus
        "$mod, left, resizeactive, -2% 0"
        "$mod, right, resizeactive, 2% 0"

      ];

      # lock-screen bindings
      bindl = [
        # on lid close, lock the screen
        # if another monitor is connected, only turn the internal monitor off and don't lock the screen
        ", switch:on:Lid Switch, exec, hyprctl dispatch dpms off eDP-1"
        # if there is no active monitor, perform a screen lock
        ", switch:on:Lid Switch, exec, hyprctl monitors | grep 'dpmsStatus: 1' || hyprlock"
        ", switch:off:Lid Switch, exec, hyprctl dispatch dpms on eDP-1"
      ];

      # bindr = [
      #     # Overview
      #   "$mod, , overview:toggle"
      # ];

      bindm = [
        # move the window
        "$mod, mouse:272, movewindow"
      ];

      exec-once = [
        # "${pkgs.hyprpaper}/bin/hyprpaper"
        # hyprpaper is handled as its own service
        "${pkgs.waybar}/bin/waybar"
        # listen to clipboard events and send them to cliphist
        "wl-paste --watch cliphist store"
        "${pkgs.waybar}/bin/hypridle"
        "hyprpaper"
        # # Fixes cursor themes in gnome apps under hyprland
        # "gsettings set org.gnome.desktop.interface cursor-theme '${config.home.pointerCursor.name}'"
        # "gsettings set org.gnome.desktop.interface cursor-size ${toString home.pointerCursor.size}"
      ];

      general = {
        resize_on_border = true;
        gaps_in = 5;
        gaps_out = 5;
        border_size = 1;
        "col.active_border" = "rgb(98971A) rgb(CC241D) 45deg";
        layout = "master";
      };

      misc = {
        # disable refreshs when nothing is going on
        vfr = false;
        disable_hyprland_logo = true;
      };

      input = {
        kb_layout = "de";
        # remap caps lock to ctrl
        kb_options = "ctrl:nocaps";
        numlock_by_default = true;
        # mouse input should be unchanged
        natural_scroll = false;
        sensitivity = 0.3;
        touchpad = {
          disable_while_typing = false;
          natural_scroll = true;
        };
      };

      gestures = {
        workspace_swipe = true;
        workspace_swipe_fingers = 4;
        workspace_swipe_touch = true;
      };

      decoration = {
        rounding = 5;
        # active_opacity = 0.95;
        inactive_opacity = 0.9;

        shadow = {
          enabled = false;
        };

        # blur is set on a per-program basis
        windowrulev2 = [
          # kitty should behave like a floating window
          "animation popin, class:kitty"
          "move cursor -50% -50%, class:kitty"
          "float, class:kitty"
          "size 50% 50%, class:kitty"

          # some more floating windows
          "float, class:org.gnome.Settings"
          "float, class:desktopclient.owncloud.com"
          "float, class:org.keepassxc.KeePassXC"

        ];
      };

      monitor = [
        "eDP-1, 3840x2160, 0x0, 1.5" # the internal laptop monitor
        # Samsung monitor at irchel (matching the description)
        # "desc:Samsung Electric Company LS27D80xU HK7X800803, 3840x2160, auto-up, 1.5"
        ", preferred, auto-up, auto" # automatically add any newly detected monitor
      ];

      xwayland = {
        enabled = false;
      };

      env = [
        # force apps to use wayland
        "NIXOS_OZONE_WL, 1"
        "ELECTRON_OZONE_PLATFORM_HINT, wayland"
        # set the scale factor for GDK apps
        "GDK_SCALE, 1.5"
        # set the scale factor for QT apps
        "QT_SCALE_FACTOR, 1.5"
        # set the scale factor for GTK apps
      ];
    };

    plugins = [
      # Global overview
      pkgs.hyprlandPlugins.hyprspace
      # Touch gestures
      pkgs.hyprlandPlugins.hyprgrass
    ];

  };

  services.swaync.enable = true;
}
