From 1d64a259eb2f377b7b7dc36263eaf33d4a7cf28c Mon Sep 17 00:00:00 2001 From: Ryan Schanzenbacher Date: Sun, 21 Jun 2026 22:42:17 -0400 Subject: Changed wallpaper to change via helper app, initial settings for window management --- hosts/RyanMac/configuration.nix | 94 +++++++++++++++++++++++++++++++++---- modules/darwin/random-wallpaper.nix | 5 +- users/ryan/home.nix | 7 ++- 3 files changed, 93 insertions(+), 13 deletions(-) diff --git a/hosts/RyanMac/configuration.nix b/hosts/RyanMac/configuration.nix index 51d181b..66ad874 100644 --- a/hosts/RyanMac/configuration.nix +++ b/hosts/RyanMac/configuration.nix @@ -1,4 +1,4 @@ -{ pkgs, inputs, ... }: +{ pkgs, inputs, lib, ... }: let username = "ryan"; @@ -19,9 +19,30 @@ let ]; }); + mkSpace = i: { + name = toString (117+i); + value = { + enabled = true; + value = { + type = "standard"; + parameters = [ (48 + i) (builtins.elemAt [ 18 19 20 21 22 23 25 26 28 ] (i - 1)) 524288 ]; + }; + }; + }; + + spaceHotkeys = builtins.listToAttrs (map mkSpace (lib.range 1 9)); + + manualHotkeys = { + "64" = { + enabled = true; + }; + }; + in { # Modules - imports = [ ../../modules/darwin/random-wallpaper.nix ]; + imports = [ + ../../modules/darwin/random-wallpaper.nix + ]; # Define the system's user and home dir location users.users."${username}" = { @@ -37,6 +58,31 @@ in { directory = "${../../files/Wallpapers}"; }; + # Configure yabai + services.yabai = { + enable = true; + enableScriptingAddition = false; + config = { + mouse_follows_focus = "on"; + layout = "bsp"; + window_placement = "second_child"; + top_padding = "10"; + bottom_padding = "10"; + left_padding = "10"; + right_padding = "10"; + window_gap = "5"; + mouse_modifier = "alt"; + mouse_drop_action = "swap"; + mouse_action1 = "move"; + mouse_action2 = "resize"; + focus_follows_mouse = "autofocus"; + }; + extraConfig = '' + yabai -m rule --add app='System Settings' manage=off + borders style=round active_color='gradient(top_left=0xee33ccff,bottom_right=0xee00ff99)' inactive_color=0xaa595959 width=6.0 + ''; + }; + # Install the /etc/nix/flake-registry.json file we made above environment.etc."nix/flake-registry.json".source = pinnedNixpkgs; @@ -72,13 +118,14 @@ in { taps = [ "netbirdio/tap" + "FelixKratz/formulae" ]; brews = [ + "borders" ]; casks = [ - "glide" "utm" "ghostty" "zen" @@ -92,7 +139,28 @@ in { enable = true; skhdConfig = '' alt - d : osascript -e 'tell application "System Events" to key code 49 using {command down}' - alt - return : open -na /Applications/Ghostty.app + alt - return : osascript -e 'tell application "Ghostty"' -e 'new window' -e 'activate' -e 'end tell' + + alt - up : ${pkgs.yabai}/bin/yabai -m window --focus north + shift + alt - up : ${pkgs.yabai}/bin/yabai -m window --swap north + alt - down : ${pkgs.yabai}/bin/yabai -m window --focus south + shift + alt - down : ${pkgs.yabai}/bin/yabai -m window --swap south + alt - right : ${pkgs.yabai}/bin/yabai -m window --focus east + shift + alt - right : ${pkgs.yabai}/bin/yabai -m window --swap east + alt - left : ${pkgs.yabai}/bin/yabai -m window --focus west + shift + alt - left: ${pkgs.yabai}/bin/yabai -m window --swap west + + shift + alt - 1 : ${pkgs.yabai}/bin/yabai -m window --space 1 + shift + alt - 2 : ${pkgs.yabai}/bin/yabai -m window --space 2 + shift + alt - 3 : ${pkgs.yabai}/bin/yabai -m window --space 3 + shift + alt - 4 : ${pkgs.yabai}/bin/yabai -m window --space 4 + shift + alt - 5 : ${pkgs.yabai}/bin/yabai -m window --space 5 + shift + alt - 6 : ${pkgs.yabai}/bin/yabai -m window --space 6 + shift + alt - 7 : ${pkgs.yabai}/bin/yabai -m window --space 7 + shift + alt - 8 : ${pkgs.yabai}/bin/yabai -m window --space 8 + shift + alt - 9 : ${pkgs.yabai}/bin/yabai -m window --space 9 + + alt - f : ${pkgs.yabai}/bin/yabai -m window --toggle zoom-fullscreen ''; }; @@ -137,6 +205,7 @@ in { # Control center stuff controlcenter = { BatteryShowPercentage = true; + Bluetooth = true; }; # Clock settings @@ -182,6 +251,7 @@ in { minimize-to-application = false; orientation = "bottom"; autohide = true; + mru-spaces = false; # Disable auto-rearrange spaces persistent-apps = [ { app = "/Applications/Zen.app"; } #{ app = "/System/Applications/Launchpad.app"; } @@ -206,14 +276,15 @@ in { AppleMenuBarVisibleInFullscreen = true; }; + "com.apple.Accessibility" = { + ReduceMotionEnabled = 1; + }; + "com.apple.symbolichotkeys" = { - AppleSymbolicHotKeys = { - "64" = { - enabled = true; # skhd needs this for its shortcut - }; - }; + AppleSymbolicHotKeys = manualHotkeys // spaceHotkeys; }; }; + universalaccess.reduceMotion = true; }; # Post-Activation scripts @@ -229,11 +300,14 @@ in { fi echo "Reloading Preferences DB..." - /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u + sudo -iu ${username} /System/Library/PrivateFrameworks/SystemAdministration.framework/Resources/activateSettings -u echo "Setting default browser" ${pkgs.defaultbrowser}/bin/defaultbrowser ${defaultBrowser} + echo "Adding Keyboard brightness controls to Control Center..." + sudo -iu ${username} defaults -currentHost write com.apple.controlcenter KeyboardBrightness -int 25 + # this is fragile so it goes at the bottom echo "Reloading skhd..." sudo -iu ${username} ${pkgs.skhd}/bin/skhd -r diff --git a/modules/darwin/random-wallpaper.nix b/modules/darwin/random-wallpaper.nix index 6b17c0f..75248b7 100644 --- a/modules/darwin/random-wallpaper.nix +++ b/modules/darwin/random-wallpaper.nix @@ -3,14 +3,15 @@ let cfg = config.local.randomWallpaper; script = pkgs.writeShellApplication { name = "set-random-wallpaper"; - runtimeInputs = [ pkgs.coreutils pkgs.findutils ]; + runtimeInputs = [ pkgs.coreutils pkgs.findutils pkgs.desktoppr]; text = '' set -euo pipefail img=$(find "${cfg.directory}" \ -type f \( -iname '*.jpg' -o -iname '*.jpeg' -o -iname '*.png' \) \ | shuf -n1) [ -n "$img" ] || exit 0 - /usr/bin/osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"$img\"" + #/usr/bin/osascript -e "tell application \"System Events\" to tell every desktop to set picture to \"$img\"" + desktoppr "$img" ''; }; in diff --git a/users/ryan/home.nix b/users/ryan/home.nix index af8770b..9ff5870 100644 --- a/users/ryan/home.nix +++ b/users/ryan/home.nix @@ -95,11 +95,16 @@ programs.zsh = { enable = true; - initContent = '' + initContent = let + brewPath = if pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64 then '' + eval "$(/opt/homebrew/bin/brew shellenv)" + '' else ""; + in '' export GPG_TTY="$(tty)" export SSH_AUTH_SOCK="$(gpgconf --list-dirs agent-ssh-socket)" gpgconf --launch gpg-agent gpg-connect-agent updatestartuptty /bye > /dev/null + ${brewPath} ''; shellAliases = { cat = "bat --paging=never"; -- cgit v1.3