{
  flake,
  osConfig,
  pkgs,
  lib,
  ...
}:

let
  inherit (flake.config.machines) devices;

  mars = devices.mars.name;
  deimos = devices.deimos.name;
  host = osConfig.networking.hostName;

  deviceLogic =
    d: m:
    if host == deimos then
      "${d}"
    else if host == mars then
      "${m}"
    else
      "";

  superBinds = builtins.map (x: "SUPER, " + x) [
    # Apps
    "Z, exec, ${lib.getExe pkgs.obsidian}"
    "H, exec, ${lib.getExe pkgs.feishin}"
    "G, exec, ${lib.getExe pkgs.scrcpy}"
    "S, exec, ${lib.getExe pkgs.steam}"
    "N, exec, ${lib.getExe pkgs.signal-desktop-bin}"
    "E, exec, ${lib.getExe pkgs.thunderbird}"
    "T, exec, ${lib.getExe pkgs.zed-editor}"
    "B, exec, ${lib.getExe pkgs.floorp-bin}"
    "X, exec, ${lib.getExe pkgs.freetube}"
    "V, exec, ${lib.getExe pkgs.vesktop}"
    "M, exec, ${lib.getExe pkgs.element-desktop}"
    "D, exec, ${lib.getExe pkgs.ghostty}"
    "P, exec, ${lib.getExe pkgs.bitwarden-desktop}"
    "F, exec, ${lib.getExe pkgs.ghostty} -e ${lib.getExe pkgs.zellij} a dotfiles"
    "R, exec, ${lib.getExe pkgs.ghostty} -e ${lib.getExe pkgs.yazi}"
    # Workspaces
    "1, workspace, 1"
    "2, workspace, 2"
    "3, workspace, 3"
    "4, workspace, 4"
    "5, workspace, 5"
    "6, workspace, 6"
    "7, workspace, 7"
    "8, workspace, 8"
    "9, workspace, 9"
    "0, workspace, 10"
    # Windows
    "Tab, killactive"
    "Backspace, layoutmsg, togglesplit"
    # Window Focus
    "Left, movefocus, l"
    "Up, movefocus, u"
    "Down, movefocus, d"
    "Right, movefocus, r"
    "C, movefocus, l"
    "A, movefocus, u"
    "E, movefocus, d"
    "I, movefocus, r"
    "minus, splitratio, -0.166"
    "equal, splitratio, 0.166"
    "bracketleft, splitratio, -0.166"
    "bracketright, splitratio, 0.166"
    # Audio
    "Page_Up, exec, playerctl next"
    "Page_Down, exec, playerctl previous"
    "Home, exec, playerctl play-pause"
    "Space, exec, fuzzel"
    # Utility
  ];

  superShiftBinds = builtins.map (x: "SUPER SHIFT, " + x) [
    # Super+shift binds
    "S, exec, flameshot gui"
    "period, exec, emote"
    "T, fullscreen, 0"
    # "Print, exec, grim -g \"$(slurp)\""
    "End, exec, shutdown now"
    "Insert, exec, systemctl reboot"
    "Home, exec, swaylock"
  ];
  superCtrlBinds = builtins.map (x: "SUPER CTRL, " + x) [
    # Super+shift binds
  ];

  altBinds = builtins.map (x: "CTRL ALT, " + x) [
    # Alt binds
    #  "Tab, togglefloating"
    # Window
    "Left, movewindow, l"
    "Up, movewindow, u"
    "Down, movewindow, d"
    "Right, movewindow, r"
    "C, movewindow, l"
    "A, movewindow, u"
    "E, movewindow, d"
    "I, movewindow, r"
  ];

  shiftBinds = builtins.map (x: "SHIFT, " + x) [
    # Shift binds
  ];

  ctrlBinds = builtins.map (x: "CTRL, " + x) [
    # Ctrl binds
  ];

  ctrlShiftBinds = builtins.map (x: "CTRL SHIFT, " + x) [
    # Ctrl+shift binds
    #     # Window
    "Tab, togglefloating"
    "1, movetoworkspacesilent, 1"
    "2, movetoworkspacesilent, 2"
    "3, movetoworkspacesilent, 3"
    "4, movetoworkspacesilent, 4"
    "5, movetoworkspacesilent, 5"
    "6, movetoworkspacesilent, 6"
    "7, movetoworkspacesilent, 7"
    "8, movetoworkspacesilent, 8"
    "9, movetoworkspacesilent, 9"
    "0, movetoworkspacesilent, 10"
  ];

  functionBinds = builtins.map (x: " , " + x) [
    "XF86MonBrightnessUp, exec, brightnessctl -d ${deviceLogic "amdgpu_bl1" ""} s +10%"
    "XF86MonBrightnessDown, exec, brightnessctl -d ${deviceLogic "amdgpu_bl1" ""} s 10%-"
    "XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05+"
    "XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 0.05-"
    "XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle"
  ];
in
superBinds
++ superShiftBinds
++ superCtrlBinds
++ altBinds
++ ctrlBinds
++ ctrlShiftBinds
++ shiftBinds
++ functionBinds
# Docs
# https://wiki.hyprland.org/Getting-Started/Master-Tutorial/
