{config, pkgs, pkgs-unstable, inputs, host, user, nvidia, rice, lib, ... }:
let
  animation-speed = "5";
  transparency = builtins.toString rice.transparency;
  monitors = {
    xps = {
      main = {
        name = "eDP-1";
        resolution = "1920x1200";
        position = "0x0";
        scale = "1.0";
      };
      second = {
        name = "DP-3";
        resolution = "1920x1080";
        position = "1920x0";
        scale = "1.0";
      };
    };
    north = {
      main = {
        name = "DP-4";
        resolution = "2560x1440";
        position = "1920x150";
        scale = "1.0";
      };
      left = {
        name = "HDMI-A-2";
        resolution = "1920x1080";
        position = "0x0";
        scale = "1.0";
      };
      # right = {
      #   name = "HDMI-A-2";
      #   resolution = "1920x1080";
      #   position = "4480x360";
      #   scale = "1.0";
      # };
    };
    ace = {
      main = {
        name = "HDMI-A-1";
        resolution = "3840x2160";
        position = "0x0";
        scale = "2.0";
      };
    };
  };
in {
  home.packages = (with pkgs; [
    # hyprland itself is a system package
    hyprland-protocols
    hyprlock
    hypridle
    hyprpicker
    hyprcursor

    grim
    slurp

  # ]) ++ (with pkgs-unstable; [
    
  ]) ++ (with inputs; [
    hyprswitch.packages.x86_64-linux.default
  ]);
  

  wayland.windowManager.hyprland = {
    enable = true;
    # package = pkgs-unstable.hyprland;
    package = pkgs.hyprland;
    # package = inputs.hyprland.packages.${pkgs.system}.hyprland;
    xwayland.enable = true;
    systemd.enable = true;
    plugins = [
      # inputs.hyprland-plugins.packages.${pkgs.system}.hyprexpo
      # inputs.hyprfocus.packages.${pkgs.system}.hyprfocus
      # inputs.hycov.packages.${pkgs.system}.hycov
      # inputs.Hyprspace.packages.${pkgs.system}.Hyprspace
    ];

    settings = {
      monitor =
        if host == "NxXPS" then (with monitors.xps; [
          "${main.name}, ${main.resolution}, ${main.position}, ${main.scale}"
          "${second.name}, ${second.resolution}, ${second.position}, ${second.scale}"
        ]) else (if host == "NxNORTH" then (with monitors.north; [
          "${main.name}, ${main.resolution}, ${main.position}, ${main.scale}"
          "${left.name}, ${left.resolution}, ${left.position}, ${left.scale}"
          # "${right.name}, ${right.resolution}, ${right.position}, ${right.scale}"
        ]) else ( with monitors.ace; [
          "${main.name}, ${main.resolution}, ${main.position}, ${main.scale}"
        ]));

      workspace = let
        d1 = if host == "NxXPS" then monitors.xps.main.name else (if host == "NxNORTH" then monitors.north.main.name else monitors.ace.main.name);
        d2 = if host == "NxXPS" then monitors.xps.second.name else (if host == "NxNORTH" then monitors.north.left.name else monitors.ace.main.name);
        d3 = if host == "NxXPS" then monitors.xps.main.name else (if host == "NxNORTH" then monitors.north.main.name else monitors.ace.main.name);
        # d3 = if host == "NxXPS" then monitors.xps.main.name else (if host == "NxNORTH" then monitors.north.right.name else monitors.ace.main.name);
       compact = "gapsin:0, gapsout:0, bordersize:1, rounding:false";
      in [
        "11, monitor:${d1}, default:true"
        "12, monitor:${d1}"
        "13, monitor:${d1}"
        "14, monitor:${d1}"
        "15, monitor:${d1}"
        "16, monitor:${d1}"
        "17, monitor:${d1}"
        "18, monitor:${d1}"
        "19, monitor:${d1}"
        "10, monitor:${d1}, ${compact}"
        "100, monitor:${d1}, ${compact}"
        "21, monitor:${d2}, default:true, ${compact}"
        "22, monitor:${d2}"
        "23, monitor:${d2}"
        "24, monitor:${d2}"
        "25, monitor:${d2}"
        "26, monitor:${d2}"
        "27, monitor:${d2}"
        "28, monitor:${d2}"
        "29, monitor:${d2}"
        "20, monitor:${d2}"
        "31, monitor:${d3}, default:${let x = if host == "NxNORTH" then "true" else "false"; in x}"
        "32, monitor:${d3}"
        "33, monitor:${d3}"
        "34, monitor:${d3}"
        "35, monitor:${d3}"
        "36, monitor:${d3}"
        "37, monitor:${d3}"
        "38, monitor:${d3}"
        "39, monitor:${d3}"
        "30, monitor:${d3}, ${compact}"
      ] ++ [
        # no gaps when only
        "w[tv1], gapsout:0, gapsin:0"
        "f[1], gapsout:0, gapsin:0"
      ];

      # "device:logitech-wireless-mouse-mx-master-1" = {
      #   sensitivity = -0.2;
      # };


      env = if nvidia.enable == true then [
        "LIBVA_DRIVER_NAME,nvidia"
        "XDG_SESSION_TYPE,wayland"
        "GBM_BACKEND,nvidia-drm"
        "__GLX_VENDOR_LIBRARY_NAME,nvidia"
        "WLR_NO_HARDWARE_CURSORS,1"
        "HYPRCURSOR_THEME,${config.gtk.cursorTheme.name}"
        "HYPRCURSOR_SIZE,${toString config.gtk.cursorTheme.size}"
      ] else [];

      input = {
        sensitivity = 0.1;
        kb_layout = "de";
        follow_mouse = "1";
        touchpad = {
          natural_scroll = true;
          scroll_factor = "0.9";
        };
      };

      general = {
        gaps_in = builtins.div rice.gap-size 2;
        gaps_out = rice.gap-size;
        border_size = rice.border-width;
        "col.active_border" = "rgba(${rice.lib.nohash rice.color.border2}ff) rgba(${rice.lib.nohash rice.color.border}ff) 90deg";
        "col.inactive_border" = "rgba(${rice.lib.nohash rice.color.background}ff) rgba(${rice.lib.nohash rice.color.border}ff) 90deg";

        # cursor_inactive_timeout = 10;

        layout = "dwindle";
        # layout = "master";
        resize_on_border = false;
      };

      decoration = {
        rounding = rice.rounding;
        # drop_shadow = false;
        # shadow_range = "20";
        # shadow_offset = "0 0";
        # shadow_render_power = "4";
        # "col.shadow" = "rgba(${rice.lib.nohash rice.color.red.base}ff)";
        # "col.shadow_inactive" = "rgba(${rice.lib.nohash rice.color.black.base}ff)";

        active_opacity = "1.0";
        inactive_opacity = "1.0";
        fullscreen_opacity = "1.0";

        dim_inactive = false;
        dim_strength = "0.2";
        dim_around = "0.8";

        blur = {
          enabled = true;
          size = "3";
          passes = "2";
          xray = false;
          vibrancy = 0.5;
          ignore_opacity = true;
        };
      };

      animations = {
        enabled = true;
        # bezier = "myBezier, 0.01, 0.9, 0.1, 1.0"; #o
        # bezier = "myBezier, 0.83, 0, 0.17, 1"; # io
        bezier = "myBezier, 0.33, 1, 0.68, 1";
        animation = let direction = if host == "NxXPS" then "slide" else "slidevert"; in [
          "windows, 1, ${animation-speed}, myBezier, slide"
          "border, 1, ${animation-speed}, myBezier"
          "fade, 1, ${animation-speed}, myBezier"
          "workspaces, 1, ${animation-speed}, myBezier, ${direction}"
        ];
      };

      gestures = {
        workspace_swipe = true;
        workspace_swipe_fingers = "4";
        workspace_swipe_distance = "300";
        workspace_swipe_invert = true;
        workspace_swipe_min_speed_to_force = "30";
        workspace_swipe_cancel_ratio = "0.5";
        workspace_swipe_create_new = false;
        workspace_swipe_direction_lock = false;
        workspace_swipe_direction_lock_threshold = "10";
        workspace_swipe_forever = true;
        workspace_swipe_use_r = false;
      };

      dwindle = {
        preserve_split = true; # you probably want this
      };

      # master = {
      # };

      misc = {
        disable_hyprland_logo = true;
        animate_mouse_windowdragging = false;
        enable_swallow = true;
      };

      exec-once = [
        "waybar"
        "swww-daemon"
        "hyprland-autoname-workspaces"
        "/usr/lib/polkit-kde-authentication-agent-1 "
        "dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP"
        "syncthing -no-browser"
        "mako"
        "fcitx5"
        # "ibus engine xkb:de::deu"
        "libinput-gestures"
        # "hyprswitch --daemon"
      ];

      windowrulev2 = [
        "opacity ${transparency},class:^(com.chatterino.*)$"
        "opacity ${transparency},class:^(chatterino)$"
        "bordercolor rgba(${rice.lib.nohash rice.color.magenta.bright}ff), pinned:1"
        "noanim, class:^(presenter)$" # sent
        "float, class:^(presenter)$" # sent
        "noanim, class:^(imv)$"
        "float, class:^(imv)$" 
        "fullscreen, class:^(imv)$" 
      ] ++ [
        "bordersize 0, floating:0, onworkspace:w[tv1]"
        "rounding 0, floating:0, onworkspace:w[tv1]"
        "bordersize 0, floating:0, onworkspace:f[1]"
        "rounding 0, floating:0, onworkspace:f[1]"
      ];

      windowrule = [
        # "opacity ${transparency}, firefox"
        "opacity ${transparency}, code-oss"
        "opacity ${transparency}, VSCodium"
        "opacity ${transparency}, Code"
        # "opacity ${transparency}, sent"
        "opacity ${transparency}, neovide"
        "opacity ${transparency}, obsidian"
        # "opacity ${transparency}, zathura"
        # "bordercolor rgba(${rice.lib.nohash rice.color.foreground}ff) rgba(${rice.lib.nohash rice.color.background}${rice.lib.float-to-drune rice.transparency}), Alacritty"
        # "bordercolor rgba(${rice.lib.nohash rice.color.foreground}ff) rgba(${rice.lib.nohash rice.color.background}${rice.lib.float-to-drune rice.transparency}), Kitty"
        "opacity ${transparency}, discord"
        "opacity ${transparency}, vesktop"
        "opacity ${transparency}, Element"
        # "opacity ${transparency}, thunderbird"
        "opacity ${transparency}, lutris"
        "opacity ${transparency}, element"
        # "opacity ${transparency}, ^([sS]potify)$"
        # "opacity ${transparency}, virt-manager"
        # "opacity ${transparency}, thunar"
        "opacity ${transparency}, title:^(wlogout)$"
        "opaque, title:^(GNU Image Manipulation Program)$"
        "float, title:^(Picture-in-Picture)$"
        "float, title:^(Ibus-ui.*)$"
        "float, ^(ibus-ui.*)$"
        "float, ^(ibus-ui-gtk3)$"
        "float, title:^(Ibus-ui-gtk3)$"
        "pin, title:^(Picture-in-Picture)$"
        "float, org.kde.polkit-kde-authentication-agent-1"
        "float, title:^(wlogout)$"
        "float, imv"
        "float, title:^(Page Info — .*)$"
        "float, title:^(Compact folders)$"
        "tile, sent"
        "fullscreen, wlogout"
        "fullscreen, sent"
        "workspace 14, lutris"
        "workspace 100, title:^(Apex Legends)$"
        "workspace 100, ^(cyberpunk2077.exe)$"
        "workspace 100, title:^(No Man.s Sky)$"
        "workspace 100, gamescope"
      ];


      layerrule = [
        "blur,waybar"
        "dimaround,rofi"
        "blur,rofi"
        "xray,rofi"
      ];


      # d8888b. d888888b d8b   db d8888b. .d8888.
      # 88  '8D   '88'   888o  88 88  '8D 88'  YP
      # 88oooY'    88    88V8o 88 88   88 '8bo.
      # 88''Yb.    88    88 V8o88 88   88   'Y8b.
      # 88   8D   .88.   88  V888 88  .8D db   8D
      # Y8888P' Y888888P VP   V8P Y8888D' '8888Y'

      ###########################################################################
      ## ROW 0:
      bind = [
        "SUPER SHIFT, Escape, exit, "
        "SUPER,       F1, workspace,       100"
        "SUPER SHIFT, F1, movetoworkspace, 100"
        # "SUPER,       F2,"
        # "SUPER,       F3, toggleopaque"
        # "SUPER,       F4,"
        "SUPER,       F5, exec, nx_gcal_event force-lookup"
        "SUPER SHIFT, F5, exec, nx_gcal_event reauthenticate"
        "SUPER,       F6, exec, kitty -e 'htop'"
        "SUPER,       F7, exec, kitty -e 'nmtui'"
        ''SUPER,       F8, exec, find ~/Pictures/wallpapers/* -type f -not -path "~/Pictures/wallpapers/.git/*" | sort -R | head -n 1 | xargs -d '\n' swww img --transition-type wipe --transition-angle 60 --transition-step 120 --transition-fps 120 --transition-duration 2''
        "SUPER,       F9, execr, waybar_mode set '󰸉 '"
        "SUPER,       F9, submap, color"
        # "SUPER,       F10, hyprload,update"
        "SUPER,       F11, exec, waybar"
        "SUPER SHIFT, F11, exec, pkill waybar "
        "SUPER,       F12, exec, hyprland-autoname-workspaces"
        "SUPER SHIFT, F12, exec, pkill -9 hyprland-autoname-workspaces  "

        ###########################################################################
        ## ROW 1:

        # "SUPER,       ^, "
        "SUPER,       1, workspace,       11"
        "SUPER SHIFT, 1, movetoworkspace, 11"
        "SUPER,       2, workspace,       12"
        "SUPER SHIFT, 2, movetoworkspace, 12"
        "SUPER,       3, workspace,       13"
        "SUPER SHIFT, 3, movetoworkspace, 13"
        "SUPER,       4, workspace,       14"
        "SUPER SHIFT, 4, movetoworkspace, 14"
        "SUPER,       5, workspace,       15"
        "SUPER SHIFT, 5, movetoworkspace, 15"
        "SUPER,       6, workspace,       16"
        "SUPER SHIFT, 6, movetoworkspace, 16"
        "SUPER,       7, workspace,       17"
        "SUPER SHIFT, 7, movetoworkspace, 17"
        "SUPER,       8, workspace,       18"
        "SUPER SHIFT, 8, movetoworkspace, 18"
        "SUPER,       9, workspace,       19"
        "SUPER SHIFT, 9, movetoworkspace, 19"
        "SUPER,       0, workspace,       10"
        "SUPER SHIFT, 0, movetoworkspace, 10"

        # "SUPER,       ß,"
        # "SUPER,       ´,"
        # "SUPER,       Backspace,"

        ###########################################################################
        ## ROW 2:

        #bind = SUPER,       TAB, hycov:toggleoverview
        # "SUPER,       TAB, overview:toggle"
        # "SUPER,       TAB, hyprexpo:expo, toggle"
        "ALT,         TAB, focuscurrentorlast"
        # "SUPER,       TAB, exec, hyprswitch --daemon"
        "SUPER,       Q, killactive"
        "SUPER,       W, exec, waybar_mode set '󰈹 '"
        "SUPER,       W, submap, browserSM "
        "SUPER,       E, exec, element-desktop"
        "SUPER,       R, exec, rofi -show drun"
        # "SUPER,       T, exec, alacritty"
        # "SUPER SHIFT, T, exec, alacritty -e sh -c "ssh nxace""
        "SUPER,       T, exec, SESSION_FROM_DE=TRUE kitty"
        "SUPER SHIFT, T, exec, kitty -e sh -c 'ssh nxace'"
        "SUPER,       Z, exec, waybar_mode set ' '"
        "SUPER,       Z, submap, tuda"
        "SUPER,       U, exec, thunderbird "
        "SUPER,       I, exec, kitty -e fish -c 'hx ~/nix-dots/ && fish'"
        "SUPER SHIFT, I, exec, kitty -e fish -c 'nh home switch || read'"
        "SUPER CTRL,  I, exec, kitty -e fish -c 'nh os switch || read'"
        "SUPER,       O, exec, obsidian "
        "SUPER,       P, pin "
        # "SUPER,       Ü,"
        # "SUPER,       +,"
        "SUPER,       Enter, exec, SESSION_FROM_DE=TRUE kitty"


        ###########################################################################
        ## ROW 3:

        "SUPER,       A, execr, waybar_mode set ' 󰹑 '"
        "SUPER,       A, submap, scrL"
        "SUPER,       S, exec, spotify"
        "SUPER,       D, exec, vesktop"
        "SUPER,       F, fullscreen"
        # "SUPER,       G,"
        "SUPER,       H, movefocus, l"
        "SUPER,       J, movefocus, d"
        "SUPER,       K, movefocus, u"
        "SUPER,       L, movefocus, r"
        # "SUPER,       Ö,"
        # "SUPER,       Ä,"
        # "SUPER,       #,"

        ###########################################################################
        ## ROW 4:

        # "SUPER,       <, overview:toggle"
        "SUPER,       Y, execr, waybar_mode set '󰹑 '"
        "SUPER,       Y, submap, scrR"
        "SUPER,       X, exec, pkill wlogout || wlogout --protocol layer-shell -b 3"
        # "SUPER,       C, exec, /home/nx2/scripts/quickconfig/quickconfig.sh "
        "SUPER,       C, exec, chatterino"
        "SUPER SHIFT, C, exec, hyprpicker -n -a"
        "SUPER,       V, togglefloating, "
        "SUPER,       B, exec, bitwarden"
        "SUPER,       N, togglesplit"
        # "SUPER,       M, exec, /home/nx2/scripts/meme-full-screen/meme-full-screen.sh "
        # "SUPER,       comma, exec, /home/nx2/scripts/change-language.sh"
        "SUPER,       ., exec, echo key x:Prior | dotool"
        "SUPER,       -, exec, echo key x:Next | dotool"

        ###########################################################################
        ## ROW 5:

        # bindr = SUPER, Ctrl, exec, # ??
        # bindr = SUPERALT, Alt_L, exec, 
        "SUPER,            Space, cyclenext"
        "SUPER SHIFT,      Space, swapnext"
        # "SUPER,      , "
        # "SUPER,      , "
        # "SUPER,      AppsKey, # ? "
        #

        ###########################################################################
        ## ARROW KEYS:

        "SUPER, left, movefocus, l"
        # "SUPER SHIFT, left, split-changemonitor, prev"
        "SUPER, right, movefocus, r"
        "SUPER, up, movefocus, u"
        # "SUPER SHIFT, right, split-changemonitor, next"
        "SUPER, down, movefocus, d"

        ###########################################################################
        ## MEGA KEYS:

        ''     , Print, exec, grim -g "$(slurp)"''
        # "SUPER, Next, resizeactive, 5% 5%" # binde
        # "SUPER, Prior, resizeactive, -5% -5%" # binde

        ###########################################################################
        ## FN KEYS:

        ",XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
        ",XF86AudioLowerVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%-"
        ",XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
        ",XF86AudioPlay, exec, playerctl play-pause"
        ",XF86AudioPrev, exec, playerctl previous"
        ",XF86AudioNext, exec, playerctl next"
        ",XF86MonBrightnessUp, exec, brightnessctl s '5%+'"
        ",XF86MonBrightnessDown, exec, brightnessctl s '5%-'"

        ###########################################################################
        ## MOUSE:

        "SUPER, mouse_down, workspace, e+1"
        "SUPER, mouse_up, workspace, e-1"
      ];


      bindm = [
        "SUPER, mouse:272, movewindow"
        "SUPER, mouse:273, resizewindow"
      ];

      bindl = [
        # ",switch:on:Lid Switch, exec, hyprlock &"
      ];
      binde = [
        # "SUPER, TAB, exec, hyprswitch --daemon --do-initial-execute"
        "SUPER, Next, resizeactive, 10% 10%" 
        "SUPER, Prior, resizeactive, -10% -10%" 
      ];
    };



    # .d8888. db    db d8888b. 88b  d88   d8b   d88888b. .d8888.
    # 88'  YP 88    88 88  '8D 88YbdP88  dP'Yb  88'  '8b 88'  YP
    # '8bo.   88    88 88oooY' 88 YP 88 d8. .8b 88.  .8P '8bo.
    #   'Y8b. 88    88 88''Yb. 88    88 8888888 888888P'   'Y8b.
    # db   8D 88.  .88 88   8D 88    88 88' '88 88       db   8D
    # '8888Y' 'Y8888P' Y8888P' YP    YP 88   YP YP       '8888Y'
    extraConfig = let
      action_simple = { mods ? "", key, cmd }: ''
        bind=${mods},${key},execr,waybar_mode unset
        bind=${mods},${key},${cmd}
        bind=${mods},${key},submap,reset
      '';
      extra_workspace = { key, wsnumber }: ''
        bind=,${key},execr,waybar_mode unset
        bind=,${key},workspace,${wsnumber}
        bind=,${key},submap,reset
        bind=SUPER,${key},execr,waybar_mode unset
        bind=SUPER,${key},workspace,${wsnumber}
        bind=SUPER,${key},submap,reset
        bind=SUPER SHIFT,${key},execr, waybar_mode unset
        bind=SUPER SHIFT,${key},movetoworkspace,${wsnumber}
        bind=SUPER SHIFT,${key},submap,reset
      '';
    in ''    
      submap = browserSM
      ${action_simple { key = "A"; cmd = "exec,firefox https://www.amazon.de/b?node=3010075031&ref_=nav_ya_signin";}}
      ${action_simple { key = "C"; cmd = "exec,firefox https://calendar.google.com";}}
      ${action_simple { key = "D"; cmd = "exec,firefox https://www.disneyplus.com/home";}}
      ${action_simple { key = "H"; cmd = "exec,firefox https://www.hs-mittweida.de";}}
      ${action_simple { key = "I"; cmd = "exec,firefox https://www.imdb.com";}}
      ${action_simple { key = "L"; cmd = "exec,firefox https://feddit.de";}}
      ${action_simple { key = "M"; cmd = "exec,firefox https://ieji.de/home";}}
      ${action_simple { key = "N"; cmd = "exec,firefox https://Netflix.com";}}
      ${action_simple { key = "R"; cmd = "exec,firefox https://reddit.com";}}
      ${action_simple { key = "S"; cmd = "exec,firefox 127.0.0.1:8384/";}}
      ${action_simple { key = "T"; cmd = "exec,hyprctl dispatch exec firefox https://twitch.tv";}}
      ${action_simple { key = "udiaeresis"; cmd = "exec,firefox https://translate.google.com";}}
      ${action_simple { key = "W"; cmd = "exec,hyprctl dispatch exec firefox";}}
      ${action_simple { key = "X"; cmd = "exec,firefox https://nx2.site";}}
      ${action_simple { key = "Y"; cmd = "exec,firefox https://youtube.com";}}
      ${action_simple { key = "P"; cmd = "exec,firefox https://pw.nx2.site";}}
      bind = , Escape, exec, waybar_mode unset
      bind = , Escape, submap, reset
      submap = reset


      submap = scrL
      ${builtins.concatStringsSep "\n" (builtins.map (num: extra_workspace { key = builtins.toString num; wsnumber = "2" + builtins.toString num;}) [1 2 3 4 5 6 7 8 9 0])}
      bind = , A, execr, waybar_mode unset
      bind = , A, submap, reset
      bind = , Escape, execr, waybar_mode unset
      bind = , Escape, submap, reset
      submap = reset

      submap = scrR
      ${builtins.concatStringsSep "\n" (builtins.map (num: extra_workspace { key = builtins.toString num; wsnumber = "3" + builtins.toString num;}) [1 2 3 4 5 6 7 8 9 0])}
      bind = , Y, execr, waybar_mode unset
      bind = , Y, submap, reset
      bind = , Escape, execr, waybar_mode unset
      bind = , Escape, submap, reset
      submap = reset

      submap = color
      ${action_simple { key = "W"; cmd = ''exec,swww query | sed -n 1p | sed -E 's-.*image: (.*)-"\1"-g' | xargs change_colors_json img && notify-send 'change_colors_json img successfull' ''; }} 
      ${action_simple { key = "M"; cmd = ''exec,change_colors_json manual && notify-send 'change_colors_json manual successfull'  ''; }} 
      ${action_simple { key = "D"; cmd = ''exec,firefox /home/${user}/.config/color-pallete.html''; }} 
      bind = , Escape, execr, waybar_mode unset
      bind = , Escape, submap, reset
      submap = reset

      submap = tuda
      ${action_simple { key = "T"; cmd = ''exec,firefox https://www.tucan.tu-darmstadt.de/''; }} 
      ${action_simple { key = "M"; cmd = ''exec,firefox https://moodle.tu-darmstadt.de/''; }} 
      ${action_simple { key = "I"; cmd = ''exec,firefox https://moodle.informatik.tu-darmstadt.de/''; }} 
      bind = , Escape, execr, waybar_mode unset
      bind = , Escape, submap, reset
      submap = reset

      
    '';
  };

  home.file = let
    m = if host == "NxXPS" then monitors.xps.main.name else monitors.north.main.name;
  in {
    ".config/hypr/hyprlock.conf".text = ''
      background {
          monitor = ${m}

          # all these options are taken from hyprland, see https://wiki.hyprland.org/Configuring/Variables/#blur for explanations
          path = /home/nx2/Pictures/wallpapers/nix-wall.png
          blur_size = 4
          blur_passes = 3 # 0 disables blurring
          noise = 0.0117
          contrast = 1.3000 # Vibrant!!!
          brightness = 0.8000
          vibrancy = 0.2100
          vibrancy_darkness = 0.0
      }

      input-field {
          monitor =
          size = 250, 50
          outline_thickness = 1
          dots_size = 0.2 # Scale of input-field height, 0.2 - 0.8
          dots_spacing = 0.64 # Scale of dots' absolute size, 0.0 - 1.0
          dots_center = true
          outer_color = rgba(aaaaaaff)
          inner_color = rgba(000000ff)
          font_color = rgba(ffffffff)
          fade_on_empty = true
          placeholder_text = <i>Password...</i> # Text rendered in the input box when it's empty.
          hide_input = false
          position = 0, 50
          halign = center
          valign = bottom
      }

      # Current time
      label {
          monitor =
          text = cmd[update:1000] echo "<b><big> $(date +"%H:%M:%S") </big></b>"
          color = $color0
          font_size = 64
          font_family = ${rice.font.code.name} 10
          position = 0, 16
          halign = center
          valign = center
      }

      # User label
      label {
          monitor =
          text = Hey <span text_transform="capitalize" size="larger">$USER</span>
          color = $color0
          font_size = 20
          font_family = ${rice.font.code.name} 10
          position = 0, 0
          halign = center
          valign = center
      }


      # Type to unlock
      label {
          monitor =
          text = Type to unlock!
          color = $color0
          font_size = 16
          font_family = ${rice.font.code.name} 10
          position = 0, 30
          halign = center
          valign = bottom
      }
    '';
    };
}


# plugin {
#     hycov {
#         overview_gappo = 60             # gaps width from screen edge
#         overview_gappi = 24             # gaps width from clients
#         enable_hotarea = 0              # enable mouse cursor hotarea     
#         # hotarea_monitor = all           # monitor name which hotarea is in, default is all
#         # hotarea_pos = 1                 # position of hotarea (1: bottom left, 2: bottom right, 3: top left, 4: top right)
#         # hotarea_size = 10               # hotarea size, 10x10
#         # swipe_fingers = 4               # finger number of gesture,move any directory
#         move_focus_distance = 100       # distance for movefocus,only can use 3 finger to move 
#         enable_gesture = 0              # enable gesture
#         disable_workspace_change = 0    # disable workspace change when in overview mode
#         disable_spawn = 0               # disable bind exec when in overview mode
#         auto_exit = 1                   # enable auto exit when no client in overview
#         auto_fullscreen = 0             # auto make active window maximize after exit overview
#         only_active_workspace = 0       # only overview the active workspace
#         only_active_monitor = 1         # only overview the active monitor
#         enable_alt_release_exit = 0     # alt swith mode arg,see readme for detail
#         alt_replace_key = Alt_L         # alt swith mode arg,see readme for detail
#         alt_toggle_auto_next = 0        # auto focus next window when toggle overview in alt swith mode
#         click_in_cursor = 0             # when click to jump,the target windwo is find by cursor, not the current foucus window.
#         hight_of_titlebar = 0           # height deviation of title bar hight
#     }
# }
