Skip to content

Commit

Permalink
62 papercuts
Browse files Browse the repository at this point in the history
  • Loading branch information
Enzime committed Sep 24, 2024
1 parent 963e9d9 commit 36c74a9
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 8 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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`
Expand Down
61 changes: 59 additions & 2 deletions modules/graphical.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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"'';
Expand All @@ -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, ... }: {
Expand Down
9 changes: 4 additions & 5 deletions modules/vscode.nix
Original file line number Diff line number Diff line change
Expand Up @@ -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" ''
Expand Down
2 changes: 1 addition & 1 deletion overlays/i3-ws.nix
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
25 changes: 25 additions & 0 deletions overlays/swift-quit.nix
Original file line number Diff line number Diff line change
@@ -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
'';
});
}

0 comments on commit 36c74a9

Please sign in to comment.