diff --git a/flake.lock b/flake.lock index 52d3a6a..969f4ab 100644 --- a/flake.lock +++ b/flake.lock @@ -220,11 +220,11 @@ ] }, "locked": { - "lastModified": 1681468923, - "narHash": "sha256-+X2oO4juRVhQRs002mn8km6PODccIRiz09c2K1xtSpY=", + "lastModified": 1681690464, + "narHash": "sha256-x8pw8KAb9TJsszbCHUBK2bWvgYPlCjwHMV1dF95eZPs=", "owner": "nix-community", "repo": "home-manager", - "rev": "17198cf5ae27af5b647c7dac58d935a7d0dbd189", + "rev": "53bd74f786934997e7f6a5ed9741b226e511e508", "type": "github" }, "original": { @@ -256,11 +256,11 @@ }, "locked": { "dir": "contrib", - "lastModified": 1681541834, - "narHash": "sha256-LRAfvzWVTAbOKasVIVh4RJl8nhOq3uZ1DQGJleGsp6A=", + "lastModified": 1681719021, + "narHash": "sha256-edYPdId662VSpTngbFinHZDk7hbIO0T4DaIG75QdOoA=", "owner": "neovim", "repo": "neovim", - "rev": "0a61cb60a633f05e3f05f8d5dae241910a92ee1f", + "rev": "53985a6d31cc60d4b2d7a7af91929922de9ecf4d", "type": "github" }, "original": { @@ -279,11 +279,11 @@ ] }, "locked": { - "lastModified": 1681546346, - "narHash": "sha256-tANWXcsWGi78lWWtKvebIDSUpfzhNC4pyeHU/sj5a6g=", + "lastModified": 1681719254, + "narHash": "sha256-bA07zWjG/4mvnXcs08Z0vwAUObpE9nsbtF4wUC0G+Bg=", "owner": "nix-community", "repo": "neovim-nightly-overlay", - "rev": "b0e4272a92496088bf58546ad05350174bb7fff2", + "rev": "d4ac0e115563dc894323947e2fd679f25bfa788a", "type": "github" }, "original": { @@ -313,9 +313,7 @@ }, "nix-darwin": { "inputs": { - "nixpkgs": [ - "nixpkgs" - ] + "nixpkgs": "nixpkgs" }, "locked": { "lastModified": 1681154394, @@ -384,18 +382,16 @@ }, "nixpkgs": { "locked": { - "lastModified": 1681465517, - "narHash": "sha256-EasJh15/jcJNAHtq2SGbiADRXteURAnQbj1NqBoKkzU=", - "owner": "nixos", + "lastModified": 1668650906, + "narHash": "sha256-JuiYfDO23O8oxUUOmhQflmOoJovyC5G4RjcYQMQjrRE=", + "owner": "NixOS", "repo": "nixpkgs", - "rev": "abe7316dd51a313ce528972b104f4f04f56eefc4", + "rev": "3a86856a13c88c8c64ea32082a851fefc79aa700", "type": "github" }, "original": { - "owner": "nixos", - "ref": "nixos-unstable", - "repo": "nixpkgs", - "type": "github" + "id": "nixpkgs", + "type": "indirect" } }, "nixpkgs-for-bootstrap": { @@ -429,6 +425,22 @@ "type": "github" } }, + "nixpkgs_2": { + "locked": { + "lastModified": 1681648924, + "narHash": "sha256-pzi3HISK8+7mpEtv08Yr80wswyHKsz+RP1CROG1Qf6s=", + "owner": "nixos", + "repo": "nixpkgs", + "rev": "f294325aed382b66c7a188482101b0f336d1d7db", + "type": "github" + }, + "original": { + "owner": "nixos", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, "nmd": { "flake": false, "locked": { @@ -479,11 +491,11 @@ }, "nur": { "locked": { - "lastModified": 1681541221, - "narHash": "sha256-lt+iea1TlHzWGfbShveXj6FOE8FXC5nHnBOjz8ftfHM=", + "lastModified": 1681717482, + "narHash": "sha256-UxDd2AAb8oWyosSp637Jv+WdWOv/nJ4efD8YzzUIsWY=", "owner": "nix-community", "repo": "NUR", - "rev": "425b65fc5dca82de0d628b43638ee93599660f57", + "rev": "54997f4d48b6e90e226d9a8243e9e164f61c167c", "type": "github" }, "original": { @@ -500,7 +512,7 @@ "nix-colors": "nix-colors", "nix-darwin": "nix-darwin", "nix-on-droid": "nix-on-droid", - "nixpkgs": "nixpkgs", + "nixpkgs": "nixpkgs_2", "nur": "nur", "wired": "wired", "zig-overlay": "zig-overlay", @@ -580,11 +592,11 @@ ] }, "locked": { - "lastModified": 1681560430, - "narHash": "sha256-HuU22HP2Ah2E5MWbQ9u6YoB6L1txnCM8nyCpax8flnA=", + "lastModified": 1681690952, + "narHash": "sha256-x8KEUCSorKtsWWlJWXi6atcWkcREAV1o081knXZCQfc=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "0ece65731201765d2c2c5078e7c29cefc00d4977", + "rev": "0cd7fee7dae8eaaf77ed0d420f69be0a481acc9d", "type": "github" }, "original": { @@ -629,11 +641,11 @@ "zig-overlay": "zig-overlay_2" }, "locked": { - "lastModified": 1681494644, - "narHash": "sha256-1VvQvIPaynMc/+bwXy46cSMlND2D6f+IKB4odOjaERo=", + "lastModified": 1681661082, + "narHash": "sha256-JLiMVy1biVDEwlc9Kme2+daslCe+2wso00Zt2FcL0A8=", "owner": "zigtools", "repo": "zls", - "rev": "421ae86917127ac6050c3fdbb6b153d664bb04e8", + "rev": "3ae56929fcc695fb6fbd2c74f86feb7d4890e368", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index f42e050..0705297 100644 --- a/flake.nix +++ b/flake.nix @@ -18,7 +18,7 @@ # Nix Darwin nix-darwin = { url = "github:lnl7/nix-darwin/master"; - inputs.nixpkgs.follows = "nixpkgs"; + # inputs.nixpkgs.follows = "nixpkgs"; }; # Home Manager diff --git a/machines/nix-darwin/x86_64-darwin/limontozu/configuration.nix b/machines/nix-darwin/x86_64-darwin/limontozu/configuration.nix new file mode 100644 index 0000000..3a3e79c --- /dev/null +++ b/machines/nix-darwin/x86_64-darwin/limontozu/configuration.nix @@ -0,0 +1,81 @@ +{ inputs, outputs, lib, pkgs, config, ... }: + +{ + environment.systemPackages = with pkgs; [ ]; + + # environment.darwinConfig = builtins.toString ./configuration.nix; + + # Auto upgrade nix package and the daemon service. + services.nix-daemon.enable = true; + + # nix = { + # # Ensure we can work with flakes + # package = pkgs.nixFlakes; + # + # # This will add each flake input as a registry + # # To make nix3 commands consistent with your flake + # registry = lib.mapAttrs (_: value: { flake = value; }) inputs; + # + # # This will additionally add your inputs to the system's legacy channels + # # Making legacy nix commands consistent as well, awesome! + # nixPath = lib.mapAttrsToList (key: value: "${key}=${value.to.path}") config.nix.registry; + # + # settings = { + # # Enable flakes and new 'nix' command + # experimental-features = "nix-command flakes repl-flake"; + # # Deduplicate and optimize nix store + # auto-optimise-store = true; + # # Keep outputs and derivations + # keep-outputs = true; + # keep-derivations = true; + # }; + # }; + + nix.package = pkgs.nixFlakes; + + nix.extraOptions = '' + experimental-features = nix-command flakes repl-flake + keep-outputs = true + keep-derivations = true + ''; + + # NIX_PATH = + # builtins.concatStringsSep + # ":" + # (lib.mapAttrsToList + # (name: input: + # "${name}=${input.url}?rev=${input.locked.rev}") + # inputs); + + # Create /etc/zshrc that loads the nix-darwin environment. + programs.zsh.enable = true; # default shell on catalina + + # Fonts + fonts.fontDir.enable = true; + fonts.fonts = with pkgs; [ + (nerdfonts.override { fonts = [ "FiraCode" ]; }) + ]; + + reo101 = { + system = { + enable = true; + }; + brew = { + enable = true; + }; + yabai = { + enable = true; + }; + }; + + # Keyboard + system.keyboard.enableKeyMapping = true; + system.keyboard.remapCapsLockToEscape = true; + + # Add ability to used TouchID for sudo authentication + security.pam.enableSudoTouchIdAuth = true; + + # Used for backwards compatibility, please read the changelog before changing. + # > darwin-rebuild changelog + system.stateVersion = 4; +} diff --git a/machines/nix-darwin/x86_64-darwin/limontozu/home/pavelatanasov.nix b/machines/nix-darwin/x86_64-darwin/limontozu/home/pavelatanasov.nix new file mode 100644 index 0000000..03a5868 --- /dev/null +++ b/machines/nix-darwin/x86_64-darwin/limontozu/home/pavelatanasov.nix @@ -0,0 +1,77 @@ +{ inputs, outputs, lib, pkgs, config, ... }: + +{ + home = { + username = lib.mkForce "pavelatanasov"; + homeDirectory = lib.mkForce "/Users/pavelatanasov"; + stateVersion = "22.11"; + }; + + # Let Home Manager install and manage itself. + programs.home-manager.enable = true; + + # Use this flake's version of nixpkgs + home.sessionVariables = { + NIX_PATH = "nixpkgs=${inputs.nixpkgs}"; + }; + + home.packages = with pkgs; [ + # WM + yabai + skhd + + # Neovim + neovim + + # Dhall + dhall + dhall-lsp-server + + # Nix + rnix-lsp + nil + + # FMI + vim-fmi-cli + + # Zig + zigpkgs.master + inputs.zls-overlay.packages.x86_64-darwin.default + ]; + + reo101 = { + shell = { + enable = true; + direnv = true; + zoxide = true; + }; + wezterm = { + enable = true; + }; + }; + + nixpkgs = { + overlays = lib.attrValues outputs.overlays ++ [ + inputs.neovim-nightly-overlay.overlay + inputs.zig-overlay.overlays.default + ]; + + config.allowUnfree = true; + }; + + programs.git = { + enable = true; + userName = "pavelatanasov"; + userEmail = "pavel.atanasov@limechain.tech"; + # signing = { + # signByDefault = true; + # key = "0x52F3E1D376F692C0"; + # }; + }; + + # services.gpg-agent = { + # enable = true; + # defaultCacheTtl = 1800; + # enableSshSupport = true; + # }; +} diff --git a/modules/home-manager/reo101-river/default.nix b/modules/home-manager/reo101-river/default.nix index 6210e7c..1bf2012 100644 --- a/modules/home-manager/reo101-river/default.nix +++ b/modules/home-manager/reo101-river/default.nix @@ -78,11 +78,11 @@ in # enabled = true; # }; - # dunst on wayland - services.wired = { - enable = true; - config = ./wired.ron; - }; + # # dunst on wayland + # services.wired = { + # enable = true; + # config = ./wired.ron; + # }; }; meta = { diff --git a/modules/home-manager/reo101-shell.nix b/modules/home-manager/reo101-shell.nix index 2e2e5a7..f89f860 100644 --- a/modules/home-manager/reo101-shell.nix +++ b/modules/home-manager/reo101-shell.nix @@ -100,12 +100,12 @@ in } { name = "fast-syntax-highlighting"; - file = "F-Sy-H.plugin.zsh"; + file = "fast-syntax-highlighting.plugin.zsh"; src = pkgs.fetchFromGitHub { - owner = "zdharma"; + owner = "zdharma-continuum"; repo = "fast-syntax-highlighting"; - rev = "285d6ce8e1d9c7a70b427c46a4030d43e7a6406b"; - sha256 = "4kma7Sx2RGWa9J4gr+U89ArxpM2/b8H9ytQ2pNCv6is="; + rev = "13d7b4e63468307b6dcb2dadf6150818f242cbff"; + sha256 = "sha256-AmsexwVombgVmRvl4O9Kd/WbnVJHPTXETxBv18PDHz4="; }; } { diff --git a/modules/home-manager/reo101-wezterm/wezterm.lua b/modules/home-manager/reo101-wezterm/wezterm.lua index 9dc416f..b24f8fe 100644 --- a/modules/home-manager/reo101-wezterm/wezterm.lua +++ b/modules/home-manager/reo101-wezterm/wezterm.lua @@ -40,10 +40,10 @@ M.freetype_render_target = "Light" -------------------- -- Window options -- -------------------- --- M.window_background_opacity = 0.2 --- M.text_background_opacity = 1.0 +M.window_background_opacity = 0.8 +M.text_background_opacity = 1.0 -- M.window_background_image = "/home/reo101/.local/share/bg/ide_bg.jpeg" -M.window_decorations = "NONE" +-- M.window_decorations = "NONE" M.window_close_confirmation = "NeverPrompt" M.use_resize_increments = false M.enable_scroll_bar = false diff --git a/modules/nix-darwin/brew/default.nix b/modules/nix-darwin/brew/default.nix new file mode 100644 index 0000000..4640226 --- /dev/null +++ b/modules/nix-darwin/brew/default.nix @@ -0,0 +1,74 @@ +{ lib, pkgs, config, ... }: + +with lib; +let + cfg = config.reo101.brew; +in +{ + imports = [ + ]; + + options = { + reo101.brew = { + enable = mkEnableOption "reo101 brew config"; + }; + }; + + config = mkIf cfg.enable { + # Requires Homebrew to be installed + system.activationScripts.preUserActivation.text = '' + if ! xcode-select --version 2>/dev/null; then + $DRY_RUN_CMD xcode-select --install + fi + if ! /usr/local/bin/brew --version 2>/dev/null; then + $DRY_RUN_CMD /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + ''; + + homebrew = { + enable = true; + onActivation = { + autoUpdate = false; # Don't update during rebuild + upgrade = true; + cleanup = "zap"; # Uninstall all programs not declared + }; + global = { + brewfile = true; # Run brew bundle from anywhere + lockfiles = false; # Don't save lockfile (since running from anywhere) + }; + taps = [ + "homebrew/core" + "homebrew/cask" + "homebrew/cask-fonts" + "homebrew/cask-drivers" + "homebrew/services" + "cmacrae/formulae" + "FelixKratz/formulae" + ]; + brews = [ + "libusb" + "sketchybar" + "switchaudio-osx" + ]; + casks = [ + "android-platform-tools" + "discord" + "docker" + "font-fira-code-nerd-font" + "karabiner-elements" + "scroll-reverser" + "sf-symbols" + # "slack" + "spotify" + ]; + extraConfig = '' + # brew "xorpse/formulae/brew", args: ["HEAD"] + cask_args appdir: "~/Applications" + ''; + }; + }; + + meta = { + maintainers = with lib.maintainers; [ reo101 ]; + }; +} diff --git a/modules/nix-darwin/default.nix b/modules/nix-darwin/default.nix index 1b3249d..4a90fa6 100644 --- a/modules/nix-darwin/default.nix +++ b/modules/nix-darwin/default.nix @@ -4,4 +4,7 @@ { # List your module files here # my-module = import ./my-module.nix; + brew = import ./brew; + yabai = import ./yabai; + system = import ./system; } diff --git a/modules/nix-darwin/system/default.nix b/modules/nix-darwin/system/default.nix new file mode 100644 index 0000000..95a7513 --- /dev/null +++ b/modules/nix-darwin/system/default.nix @@ -0,0 +1,257 @@ +{ lib, pkgs, config, ... }: + +with lib; +let + cfg = config.reo101.system; +in +{ + imports = [ + ]; + + options = { + reo101.system = { + enable = mkEnableOption "reo101 MacOS system config"; + }; + }; + + config = mkIf cfg.enable { + + services.nix-daemon.enable = true; + + environment.shells = [ pkgs.zsh ]; + + security.pam.enableSudoTouchIdAuth = true; + + system = { + + keyboard = { + remapCapsLockToControl = true; + enableKeyMapping = true; # Allows for skhd + }; + + defaults = { + NSGlobalDomain = { + + # Set to dark mode + AppleInterfaceStyle = "Dark"; + + # Don't change from dark to light automatically + # AppleInterfaceSwitchesAutomatically = false; + + # Enable full keyboard access for all controls (e.g. enable Tab in modal dialogs) + AppleKeyboardUIMode = 3; + + # Automatically show and hide the menu bar + _HIHideMenuBar = true; + + # Expand save panel by default + NSNavPanelExpandedStateForSaveMode = true; + + # Expand print panel by default + PMPrintingExpandedStateForPrint = true; + + # Replace press-and-hold with key repeat + ApplePressAndHoldEnabled = false; + + # Set a fast key repeat rate + KeyRepeat = 2; + + # Shorten delay before key repeat begins + InitialKeyRepeat = 12; + + # Save to local disk by default, not iCloud + NSDocumentSaveNewDocumentsToCloud = false; + + # Disable autocorrect capitalization + NSAutomaticCapitalizationEnabled = false; + + # Disable autocorrect smart dashes + NSAutomaticDashSubstitutionEnabled = false; + + # Disable autocorrect adding periods + NSAutomaticPeriodSubstitutionEnabled = false; + + # Disable autocorrect smart quotation marks + NSAutomaticQuoteSubstitutionEnabled = false; + + # Disable autocorrect spellcheck + NSAutomaticSpellingCorrectionEnabled = false; + + # (Effectively) disable resize animations + NSWindowResizeTime = 0.003; + + # Disable scrollbar animations + NSScrollAnimationEnabled = false; + + # Disable automatic window animations + NSAutomaticWindowAnimationsEnabled = false; + }; + + dock = { + + # Automatically show and hide the dock + autohide = true; + + # Add translucency in dock for hidden applications + showhidden = true; + + # Enable spring loading on all dock items + enable-spring-load-actions-on-all-items = true; + + # Highlight hover effect in dock stack grid view + mouse-over-hilite-stack = true; + + mineffect = "genie"; + orientation = "bottom"; + show-recents = false; + tilesize = 44; + }; + + finder = { + + # Default Finder window set to column view + FXPreferredViewStyle = "clmv"; + + # Finder search in current folder by default + FXDefaultSearchScope = "SCcf"; + + # Disable warning when changing file extension + FXEnableExtensionChangeWarning = false; + + # Allow quitting of Finder application + QuitMenuItem = true; + }; + + # Disable "Are you sure you want to open" dialog + LaunchServices.LSQuarantine = false; + + # Disable trackpad tap to click + trackpad.Clicking = false; + + # universalaccess = { + # # Zoom in with Control + Scroll Wheel + # closeViewScrollWheelToggle = true; + # closeViewZoomFollowsFocus = true; + # }; + + # Where to save screenshots + screencapture.location = "~/Downloads"; + }; + + # Settings that don't have an option in nix-darwin + activationScripts.postActivation.text = '' + echo "Disable disk image verification" + defaults write com.apple.frameworks.diskimages skip-verify -bool true + defaults write com.apple.frameworks.diskimages skip-verify-locked -bool true + defaults write com.apple.frameworks.diskimages skip-verify-remote -bool true + + echo "Avoid creating .DS_Store files on network volumes" + defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true + + echo "Disable the warning before emptying the Trash" + defaults write com.apple.finder WarnOnEmptyTrash -bool false + + echo "Require password immediately after sleep or screen saver begins" + defaults write com.apple.screensaver askForPassword -int 1 + defaults write com.apple.screensaver askForPasswordDelay -int 0 + + echo "Allow apps from anywhere" + SPCTL="$(spctl --status)" + if ! [ "$\{SPCTL}" = "assessments disabled" ]; then + sudo spctl --master-disable + fi + ''; + + # User-level settings + activationScripts.postUserActivation.text = '' + echo "Show the ~/Library folder" + chflags nohidden ~/Library + + echo "Enable dock magnification" + defaults write com.apple.dock magnification -bool true + + echo "Set dock magnification size" + defaults write com.apple.dock largesize -int 48 + + echo "Set dock autohide delays (0)" + defaults write com.apple.dock autohide-time-modifier -float 0 + defaults write com.apple.dock autohide-delay -float 0 + defaults write com.apple.dock expose-animation-duration -float 0 + defaults write com.apple.dock springboard-show-duration -float 0 + defaults write com.apple.dock springboard-hide-duration -float 0 + defaults write com.apple.dock springboard-page-duration -float 0 + + echo "Disable Finder animations" + defaults write com.apple.finder DisableAllAnimations -bool true + + echo "Disable Mail animations" + defaults write com.apple.Mail DisableSendAnimations -bool true + defaults write com.apple.Mail DisableReplyAnimations -bool true + + echo "Define dock icon function" + __dock_item() { + echo "${ + lib.pipe + '' + + + tile-data + + + + file-data + + + + _CFURLString + + + $\{1} + + + _CFURLStringType + + + 0 + + + + + '' + [ + (lib.splitString "\n") + (map + (lib.flip lib.pipe + [ + (builtins.match "[[:space:]]*(.*)") + head + ])) + lib.concatStrings + ] + }" + } + + echo "Choose and order dock icons" + defaults write com.apple.dock persistent-apps -array \ + "$(__dock_item "/System/Applications/System Settings.app")" + ''; + # defaults write com.apple.dock persistent-apps -array \ + # "$(__dock_item /Applications/1Password.app)" \ + # "$(__dock_item ${pkgs.slack}/Applications/Slack.app)" \ + # "$(__dock_item /System/Applications/Calendar.app)" \ + # "$(__dock_item ${pkgs.firefox-bin}/Applications/Firefox.app)" \ + # "$(__dock_item /System/Applications/Messages.app)" \ + # "$(__dock_item /System/Applications/Mail.app)" \ + # "$(__dock_item /Applications/Mimestream.app)" \ + # "$(__dock_item /Applications/zoom.us.app)" \ + # "$(__dock_item ${pkgs.discord}/Applications/Discord.app)" \ + # "$(__dock_item /Applications/Obsidian.app)" \ + # "$(__dock_item ${pkgs.kitty}/Applications/kitty.app)" \ + # "$(__dock_item /System/Applications/System\ Settings.app)" + }; + }; + + meta = { + maintainers = with lib.maintainers; [ reo101 ]; + }; +} diff --git a/modules/nix-darwin/yabai/default.nix b/modules/nix-darwin/yabai/default.nix new file mode 100644 index 0000000..0a66b81 --- /dev/null +++ b/modules/nix-darwin/yabai/default.nix @@ -0,0 +1,42 @@ +{ lib, pkgs, config, ... }: + +with lib; +let + cfg = config.reo101.yabai; +in +{ + imports = [ + ]; + + options = { + reo101.yabai = { + enable = mkEnableOption "reo101 yabai config"; + }; + }; + + config = mkIf cfg.enable { + services= { + yabai = { + enable = true; + package = pkgs.yabai; + enableScriptingAddition = true; + extraConfig = (builtins.readFile ./yabairc); + }; + + skhd = { + enable = true; + package = pkgs.skhd; + skhdConfig = (builtins.readFile ./skhdrc); + }; + + # sketchybar = { + # enable = true; + # package = pkgs.sketchybar; + # }; + }; + }; + + meta = { + maintainers = with lib.maintainers; [ reo101 ]; + }; +} diff --git a/modules/nix-darwin/yabai/skhdrc b/modules/nix-darwin/yabai/skhdrc new file mode 100644 index 0000000..beded6e --- /dev/null +++ b/modules/nix-darwin/yabai/skhdrc @@ -0,0 +1,106 @@ +# Open WezTerm +cmd - return : wezterm + +# Close window +cmd - q : yabai -m window --close + +# Navigation +alt - h : yabai -m window --focus west || yabai -m display --focus west +alt - j : yabai -m window --focus south || yabai -m display --focus south +alt - k : yabai -m window --focus north || yabai -m display --focus north +alt - l : yabai -m window --focus east || yabai -m display --focus east +alt - n : yabai -m window --focus next +alt - p : yabai -m window --focus last + +# Focus workspace +cmd - 1 : yabai -m space --focus 1 +cmd - 2 : yabai -m space --focus 2 +cmd - 3 : yabai -m space --focus 3 +cmd - 4 : yabai -m space --focus 4 +cmd - 5 : yabai -m space --focus 5 +cmd - 6 : yabai -m space --focus 6 +cmd - 7 : yabai -m space --focus 7 +cmd - 8 : yabai -m space --focus 8 +cmd - 9 : yabai -m space --focus 9 +cmd - tab : yabai -m space --focus recent +# cmd - ; : yabai -m space --focus next + +# Moving windows +shift + alt - h : yabai -m window --warp west +shift + alt - j : yabai -m window --warp south +shift + alt - k : yabai -m window --warp north +shift + alt - l : yabai -m window --warp east + +# Move container to workspace +shift + cmd - m : yabai -m window --space last; sketchybar --trigger windows_on_spaces +shift + cmd - p : yabai -m window --space prev; sketchybar --trigger windows_on_spaces +shift + cmd - n : yabai -m window --space next; sketchybar --trigger windows_on_spaces +shift + cmd - 1 : yabai -m window --space 1; sketchybar --trigger windows_on_spaces +shift + cmd - 2 : yabai -m window --space 2; sketchybar --trigger windows_on_spaces +shift + cmd - 3 : yabai -m window --space 3; sketchybar --trigger windows_on_spaces +shift + cmd - 4 : yabai -m window --space 4; sketchybar --trigger windows_on_spaces +shift + cmd - 5 : yabai -m window --space 5; sketchybar --trigger windows_on_spaces +shift + cmd - 6 : yabai -m window --space 6; sketchybar --trigger windows_on_spaces +shift + cmd - 7 : yabai -m window --space 7; sketchybar --trigger windows_on_spaces +shift + cmd - 8 : yabai -m window --space 8; sketchybar --trigger windows_on_spaces +shift + cmd - 9 : yabai -m window --space 9; sketchybar --trigger windows_on_spaces + +# Move focus container to workspace +shift + alt - m : yabai -m window --space last; yabai -m space --focus last; sketchybar --trigger windows_on_spaces +shift + alt - p : yabai -m window --space prev; yabai -m space --focus prev; sketchybar --trigger windows_on_spaces +shift + alt - n : yabai -m window --space next; yabai -m space --focus next; sketchybar --trigger windows_on_spaces +shift + alt - 1 : yabai -m window --space 1; yabai -m space --focus 1; sketchybar --trigger windows_on_spaces +shift + alt - 2 : yabai -m window --space 2; yabai -m space --focus 2; sketchybar --trigger windows_on_spaces +shift + alt - 3 : yabai -m window --space 3; yabai -m space --focus 3; sketchybar --trigger windows_on_spaces +shift + alt - 4 : yabai -m window --space 4; yabai -m space --focus 4; sketchybar --trigger windows_on_spaces +shift + alt - 5 : yabai -m window --space 5; yabai -m space --focus 5; sketchybar --trigger windows_on_spaces +shift + alt - 6 : yabai -m window --space 6; yabai -m space --focus 6; sketchybar --trigger windows_on_spaces +shift + alt - 7 : yabai -m window --space 7; yabai -m space --focus 7; sketchybar --trigger windows_on_spaces +shift + alt - 8 : yabai -m window --space 8; yabai -m space --focus 8; sketchybar --trigger windows_on_spaces +shift + alt - 9 : yabai -m window --space 9; yabai -m space --focus 9; sketchybar --trigger windows_on_spaces + +# Resize windows +lctrl + alt - h : yabai -m window --resize left:-50:0; \ + yabai -m window --resize right:-50:0 +lctrl + alt - j : yabai -m window --resize bottom:0:50; \ + yabai -m window --resize top:0:50 +lctrl + alt - k : yabai -m window --resize top:0:-50; \ + yabai -m window --resize bottom:0:-50 +lctrl + alt - l : yabai -m window --resize right:50:0; \ + yabai -m window --resize left:50:0 + +# Equalize size of windows +lctrl + alt - e : yabai -m space --balance + +# Enable / Disable gaps in current workspace +lctrl + alt - g : yabai -m space --toggle padding; yabai -m space --toggle gap + +# Rotate windows clockwise and anticlockwise +alt - r : yabai -m space --rotate 270 +shift + alt - r : yabai -m space --rotate 90 + +# Rotate on X and Y Axis +shift + alt - x : yabai -m space --mirror x-axis +shift + alt - y : yabai -m space --mirror y-axis + +# Set insertion point for focused container +shift + lctrl + alt - h : yabai -m window --insert west +shift + lctrl + alt - j : yabai -m window --insert south +shift + lctrl + alt - k : yabai -m window --insert north +shift + lctrl + alt - l : yabai -m window --insert east + +# Float / Unfloat window +shift + cmd - space : \ + yabai -m window --toggle float; \ + yabai -m window --toggle border; \ + sketchybar --trigger window_focus + +# Restart Yabai +shift + lctrl + alt - r : \ + /usr/bin/env osascript <<< \ + "display notification \"Restarting Yabai\" with title \"Yabai\""; \ + launchctl kickstart -k "gui/${UID}/homebrew.mxcl.yabai" + +# Make window native fullscreen +alt - f : yabai -m window --toggle zoom-fullscreen; sketchybar --trigger window_focus +shift + alt - f : yabai -m window --toggle native-fullscreen diff --git a/modules/nix-darwin/yabai/yabairc b/modules/nix-darwin/yabai/yabairc new file mode 100644 index 0000000..d8c4d0c --- /dev/null +++ b/modules/nix-darwin/yabai/yabairc @@ -0,0 +1,85 @@ +#!/usr/bin/env sh + +# Unload the macOS WindowManager process +launchctl unload -F /System/Library/LaunchAgents/com.apple.WindowManager.plist > /dev/null 2>&1 & + +sudo yabai --load-sa +yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa" +yabai -m signal --add event=window_focused action="sketchybar --trigger window_focus" +yabai -m signal --add event=display_added action="sleep 2 && ${HOME}/.config/yabai/create_spaces.sh" +yabai -m signal --add event=display_removed action="sleep 1 && ${HOME}/.config/yabai/create_spaces.sh" +yabai -m signal --add event=window_created action="sketchybar --trigger windows_on_spaces" +yabai -m signal --add event=window_destroyed action="sketchybar --trigger windows_on_spaces" +yabai -m signal --add event=window_destroyed action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse" +yabai -m signal --add event=application_terminated action="yabai -m query --windows --window &> /dev/null || yabai -m window --focus mouse" + +{ + DESIRED_SPACES_PER_DISPLAY=4 + CURRENT_SPACES="$(yabai -m query --displays | jq -r '.[].spaces | @sh')" + + DELTA=0 + while read -r line + do + LAST_SPACE="$(echo "${line##* }")" + LAST_SPACE=$((${LAST_SPACE}+${DELTA})) + EXISTING_SPACE_COUNT="$(echo "${line}" | wc -w)" + MISSING_SPACES=$((${DESIRED_SPACES_PER_DISPLAY} - ${EXISTING_SPACE_COUNT})) + if [ "${MISSING_SPACES}" -gt 0 ]; then + for i in $(seq 1 ${MISSING_SPACES}); do + yabai -m space --create "${LAST_SPACE}" + LAST_SPACE=$((${LAST_SPACE}+1)) + done + elif [ "${MISSING_SPACES}" -lt 0 ]; then + for i in $(seq 1 $((-${MISSING_SPACES}))); do + yabai -m space --destroy "${LAST_SPACE}" + LAST_SPACE=$((${LAST_SPACE}-1)) + done + fi + DELTA=$((${DELTA}+${MISSING_SPACES})) + done <<< "${CURRENT_SPACES}" + + sketchybar --trigger space_change --trigger windows_on_spaces +} + +yabai -m config "external_bar" "all:49:0" \ + "window_border" "on" \ + "mouse_follows_focus" "off" \ + "focus_follows_mouse" "autoraise" \ + "window_zoom_persist" "off" \ + "window_placement" "second_child" \ + "window_topmost" "off" \ + "window_shadow" "float" \ + "window_opacity" "on" \ + "window_opacity_duration" "0.15" \ + "active_window_opacity" "1.0" \ + "normal_window_opacity" "0.95" \ + "window_border_width" "2" \ + "window_border_hidpi" "off" \ + "window_border_radius" "11" \ + "window_animation_duration" "0.22" \ + "active_window_border_color" "0xffe1e3e4" \ + "normal_window_border_color" "0xff2a2f38" \ + "insert_feedback_color" "0xff9dd274" \ + "split_ratio" "0.50" \ + "auto_balance" "off" \ + "mouse_modifier" "cmd" \ + "mouse_action1" "move" \ + "mouse_action2" "resize" \ + "mouse_drop_action" "swap" \ + \ + "top_padding" "10" \ + "bottom_padding" "10" \ + "left_padding" "10" \ + "right_padding" "10" \ + "window_gap" "8" + +# Exclude problematic apps from being managed: +yabai -m rule --add app="^(LuLu|Vimac|Calculator|Software Update|Dictionary|VLC|System Preferences|System Settings|zoom.us|Photo Booth|Archive Utility|Python|LibreOffice|App Store|Steam|Alfred|Activity Monitor)$" manage=off +yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off +yabai -m rule --add label="Safari" app="^Safari$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Advance)$" manage=off +yabai -m rule --add label="About This Mac" app="System Information" title="About This Mac" manage=off +yabai -m rule --add label="Select file to save to" app="^Inkscape$" title="Select file to save to" manage=off + +yabai -m config layout bsp + +echo "yabai configuration loaded.." diff --git a/pkgs/vim-fmi-cli/default.nix b/pkgs/vim-fmi-cli/default.nix index 80baf9f..a50ea7b 100644 --- a/pkgs/vim-fmi-cli/default.nix +++ b/pkgs/vim-fmi-cli/default.nix @@ -1,23 +1,26 @@ -{ lib, fetchFromGitHub, rustPlatform, openssl, pkg-config, libxkbcommon }: +{ lib, stdenv, darwin, fetchFromGitHub, rustPlatform, openssl, pkg-config, libxkbcommon }: rustPlatform.buildRustPackage rec { pname = "vim-fmi-cli"; - version = "v0.1.14"; + version = "v0.1.16"; src = fetchFromGitHub { owner = "AndrewRadev"; repo = pname; rev = version; - sha256 = "sha256-7Ek86uVa9fGaXwb8ZOzob2S27V+KYhogAFVLH4g20rU="; + sha256 = "sha256-pirsTb2GUxIjxTg0oJgfb7QzvgGTsBa2HBdcogsEB1M="; }; - cargoSha256 = "sha256-E2MSfypho15dYXdh2h5P/pwxxBJ8iQYVgEliUcrxugI="; + cargoSha256 = "sha256-5Tr8tnWsQtYYNqPBSA/nT6ggvxjUvE3/AwkeJwUeMcY="; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ ]; + buildInputs = [ ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ + SystemConfiguration + CoreServices + ]); PKG_CONFIG_PATH = "${openssl.dev}/lib/pkgconfig"; LD_LIBRARY_PATH = lib.makeLibraryPath buildInputs; diff --git a/util/default.nix b/util/default.nix index 3e2f357..c13b4a1 100644 --- a/util/default.nix +++ b/util/default.nix @@ -137,7 +137,7 @@ rec { users = lib.attrsets.genAttrs users (user: import (root + "/home/${user}.nix")); - + sharedModules = builtins.attrValues homeManagerModules; extraSpecialArgs = { inherit inputs outputs; }; }; }