{
  lib,
  pkgs,
  config,
  ...
}: let
  editor = config.programs.editor;
  pkg = editor.package;
  menu = config.programs.menu.package + config.programs.menu.dmenuCommand;
  editorCmd = "NIXOS_OZONE_WL= ${pkg}/bin/${pkg.executableName}";
in {
  options.programs = with lib; {
    editor = {
      package = mkPackageOption pkgs "vscodium" {
        example = "pkgs.vscode";
      };
    };
  };

  config = {
    programs.vscode = {
      enable = true;
      package = editor.package;
      extensions = [];
      userSettings = {
        "keyboard.dispatch" = "keyCode";
        "terminal.integrated.sendKeybindingsToShell" = true;
        "aws.telemetry" = false;
        "gitlens.telemetry.enabled" = false;
        "redhat.telemetry.enabled" = false;
        "cSpell.language" = "en,en-GB";
      };
    };

    programs.scripts = [
      {
        name = "open-code";
        text = ''
          code_dir=~/Documents/code
          cd $code_dir
          repo=$(ls | ${menu})
          [ -e "$repo" ] && ${editorCmd} $repo
        '';
        install = false;
        hotkeys = [{key = "C";}];
      }
    ];
  };
}
