diff --git a/CHANGELOG.md b/CHANGELOG.md index 8fbd220..1bc0adb 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +- Use Swift Quit on macOS +- Refactored `settings.json` to not generate a hardcoded JSON string +- Use AltTab on macOS - Refactored `launchd` agents to use `command` instead of manually specifying `wait4path` - Added `iPhone Mirroring` to Dock on `hermes-macos` - Fixed `nix.registry.nixpkgs.to.path` being defined multiple times in `nix-darwin` diff --git a/modules/graphical.nix b/modules/graphical.nix index cff4f72..218d5b2 100644 --- a/modules/graphical.nix +++ b/modules/graphical.nix @@ -2,8 +2,9 @@ imports = [ "graphical-minimal" "greetd" "mpv" ]; darwinModule = { pkgs, lib, ... }: { - environment.systemPackages = - builtins.attrValues { inherit (pkgs) raycast utm; }; + environment.systemPackages = builtins.attrValues { + inherit (pkgs) alt-tab-macos raycast swift-quit utm; + }; launchd.user.agents.raycast = { command = ''"/Applications/Nix Apps/Raycast.app/Contents/MacOS/Raycast"''; @@ -16,6 +17,62 @@ ''; services.karabiner-elements.enable = true; + + launchd.user.agents.alt-tab = { + command = ''"/Applications/Nix Apps/AltTab.app/Contents/MacOS/AltTab"''; + serviceConfig.RunAtLoad = true; + }; + + system.defaults.CustomUserPreferences."com.lwouis.alt-tab-macos" = { + SUAutomaticallyUpdate = false; + SUEnableAutomaticChecks = false; + updatePolicy = 0; + + alignThumbnails = true; + # Took a lot of debugging to figure this out + # plutil -type hideSpaceNumberLabels ~/Library/Preferences/com.lwouis.alt-tab-macos.plist + hideSpaceNumberLabels = "true"; + holdShortcut = "\\u2318"; + startAtLogin = "false"; + + blacklist = lib.generators.toJSON { } [ + { + "bundleIdentifier" = "com.apple.finder"; + "hide" = "2"; + "ignore" = "0"; + } + { + "bundleIdentifier" = "com.apple.ScreenSharing"; + "hide" = "0"; + "ignore" = "2"; + } + { + "bundleIdentifier" = "com.utmapp.UTM"; + "hide" = "0"; + "ignore" = "2"; + } + { + "bundleIdentifier" = "com.apple.Terminal"; + "hide" = "2"; + "ignore" = "0"; + } + ]; + }; + + launchd.user.agents.swift-quit = { + command = + ''"/Applications/Nix Apps/Swift Quit.app/Contents/MacOS/Swift Quit"''; + serviceConfig.RunAtLoad = true; + }; + + system.defaults.CustomUserPreferences."onebadidea.Swift-Quit" = { + SwiftQuitExcludedApps = [ "/System/Applications/Utilities/Terminal.app" ]; + SwiftQuitSettings = { + excludeBehaviour = "includeApps"; + launchAtLogin = false; + menubarIconEnabled = true; + }; + }; }; nixosModule = { user, pkgs, lib, ... }: { diff --git a/modules/vscode.nix b/modules/vscode.nix index b92cbe5..bda1e38 100644 --- a/modules/vscode.nix +++ b/modules/vscode.nix @@ -254,11 +254,10 @@ home.persistence."/persist${config.home.homeDirectory}".directories = [ ".config/Code" ]; - home.file.".vscode-server/data/Machine/settings.json".text = '' - { - "nix.serverPath": "${lib.getExe pkgs.nil}" - } - ''; + home.file.".vscode-server/data/Machine/settings.json".source = + (pkgs.formats.json { }).generate "vscode-server-settings.json" { + "nix.serverPath" = lib.getExe pkgs.nil; + }; programs.git.extraConfig.core.editor = "${pkgs.writeShellScript "use-vscode-sometimes" '' diff --git a/overlays/i3-ws.nix b/overlays/i3-ws.nix index 6178258..def669a 100644 --- a/overlays/i3-ws.nix +++ b/overlays/i3-ws.nix @@ -1,5 +1,5 @@ self: super: { - i3-ws = assert (!builtins.hasAttr "i3-ws" super); + i3-ws = assert !super ? i3-ws; super.stdenv.mkDerivation (let pname = "i3-ws"; version = "git-2017-07-30"; diff --git a/overlays/swift-quit.nix b/overlays/swift-quit.nix new file mode 100644 index 0000000..0ae1171 --- /dev/null +++ b/overlays/swift-quit.nix @@ -0,0 +1,25 @@ +self: super: { + swift-quit = assert !super ? swift-quit; + super.stdenvNoCC.mkDerivation (finalAttrs: { + pname = "swift-quit"; + version = "1.5"; + + src = super.fetchurl { + url = + "https://github.com/onebadidea/swiftquit/releases/download/v${finalAttrs.version}/Swift.Quit.zip"; + sha256 = "sha256-pORnyxOhTc/zykBHF5ujsWEZ9FjNauJGeBDz9bnHTvs="; + }; + dontUnpack = true; + + nativeBuildInputs = [ super.unzip ]; + + installPhase = '' + runHook preInstall + + mkdir -p $out/Applications + unzip -d $out/Applications $src + + runHook postInstall + ''; + }); +}