{
  pkgs,
  config,
  ...
}: let
  modKeyName = config.windowManager.modifierKey;
  modifier =
    if modKeyName == "SUPER"
    then "Mod4"
    else if modKeyName == "ALT"
    then "Mod1"
    else null;
in {
  imports = [
    (import ../utils/swaylock.nix)
    (import ../utils/swayidle.nix)
    (import ../utils/waybar.nix)
  ];
  xdg.portal = {
    enable = true;
    configPackages = [pkgs.sway];
    extraPortals = [pkgs.xdg-desktop-portal-wlr pkgs.xdg-desktop-portal-gtk];
  };

  wayland.windowManager.sway = {
    enable = true;
    config = {
      inherit modifier;
      bars = [];
      input = {
        "*" = {
          xkb_layout = "gb";
          xkb_options = "esperanto:qwerty,lv3:ralt_switch";
        };
        "type:touchpad".natural_scroll = "enabled";
      };
    };
  };

  services.mako.enable = true;

  programs.waybar = {
    enable = true;
    settings = {
      mainBar = {
        modules-left = ["sway/workspaces" "sway/window"];
      };
    };
  };
}
