From 8838b0ecf7ce20ff48d65efdaa3b03ef8ca69b98 Mon Sep 17 00:00:00 2001 From: Felix Albrigtsen Date: Thu, 16 Nov 2023 14:37:23 +0100 Subject: [PATCH] worf: Add yabai/skhd. Add sarek as builder --- base.nix | 2 +- hosts/worf/configuration.nix | 16 ++++++++- hosts/worf/yabai.nix | 69 ++++++++++++++++++++++++++++++++++++ 3 files changed, 85 insertions(+), 2 deletions(-) create mode 100644 hosts/worf/yabai.nix diff --git a/base.nix b/base.nix index c2fdf68..723f43d 100644 --- a/base.nix +++ b/base.nix @@ -79,7 +79,7 @@ "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIDKzPICGew7uN0cmvRmbwkwTCodTBUgEhkoftQnZuO4Q felixalbrigtsen@gmail.com" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIBTXSL0w7OUcz1LzEt1T3I3K5RgyNV+MYz0x/1RbpDHQ felixalb@worf" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIFiPHhj0YbklJnJNcxD0IlzPxLTGfv095H5zyS/1Wb64 felixalb@edison.home.feal.no" - "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH5M7hYl3saBNMAo6sczgfUvASEJWFHuERB7xvf4gxst nix-builder-voyager-worf" + "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIH5M7hYl3saBNMAo6sczgfUvASEJWFHuERB7xvf4gxst nix-builder-worf" ]; shell = pkgs.zsh; }; diff --git a/hosts/worf/configuration.nix b/hosts/worf/configuration.nix index 8b4333d..80ac00b 100644 --- a/hosts/worf/configuration.nix +++ b/hosts/worf/configuration.nix @@ -1,6 +1,9 @@ { pkgs, ... }: { # Many settings should be handled by home manager. System-wide settings are however managed here. + imports = [ + ./yabai.nix + ]; nixpkgs.config.allowUnfree = true; @@ -28,7 +31,18 @@ mandatoryFeatures = [ ]; sshUser = "felixalb"; - sshKey = "/var/root/.ssh/nix-builder-voyager"; + sshKey = "/var/root/.ssh/nix-builder"; + } + { + hostName = "sarek.home.feal.no"; + system = "x86_64-linux"; + + maxJobs = 6; + supportedFeatures = [ "big-parallel" "benchmark" "nixos-test" ]; + mandatoryFeatures = [ ]; + + sshUser = "felixalb"; + sshKey = "/var/root/.ssh/nix-builder"; } ]; diff --git a/hosts/worf/yabai.nix b/hosts/worf/yabai.nix new file mode 100644 index 0000000..a4b7214 --- /dev/null +++ b/hosts/worf/yabai.nix @@ -0,0 +1,69 @@ + +{ config, pkgs, lib, ... }: +let + cfg = config.services.yabai; +in { + services.yabai = { + enable = true; + enableScriptingAddition = true; + config = { + layout = "bsp"; + debug_output = "on"; + focus_follows_mouse = "autoraise"; + mouse_follows_focus = "off"; + window_placement = "second_child"; + window_opacity = "off"; + # top_padding = 10; + # bottom_padding = 10; + # left_padding = 10; + # right_padding = 10; + window_gap = 10; + }; + }; + + services.skhd = { + enable = true; + skhdConfig = let + mod = "alt"; + mod2 = "alt + ctrl"; + mod3 = "alt + shift"; + in '' + # Move window focus + ${mod} - j : yabai -m window --focus south + ${mod} - k : yabai -m window --focus north + ${mod} - h : yabai -m window --focus west + ${mod} - l : yabai -m window --focus east + + ${mod} - down : yabai -m window --focus south + ${mod} - up : yabai -m window --focus north + ${mod} - left : yabai -m window --focus west + ${mod} - right : yabai -m window --focus east + + # Move windows + ${mod3} - j : yabai -m window --warp south + ${mod3} - k : yabai -m window --warp north + ${mod3} - h : yabai -m window --warp west + ${mod3} - l : yabai -m window --warp east + + ${mod3} - down : yabai -m window --warp south + ${mod3} - up : yabai -m window --warp north + ${mod3} - left : yabai -m window --warp west + ${mod3} - right : yabai -m window --warp east + + # Move windows to different spaces + ${mod2} - 1 : yabai -m window --space 1 + ${mod2} - 2 : yabai -m window --space 2 + ${mod2} - 3 : yabai -m window --space 3 + ${mod2} - 4 : yabai -m window --space 4 + ${mod2} - 5 : yabai -m window --space 5 + ${mod2} - 6 : yabai -m window --space 6 + ${mod2} - 7 : yabai -m window --space 7 + + # Misc + + ${mod2} - f : yabai -m window --toggle zoom-fullscreen + ${mod2} - b : yabai -m space --balance + ${mod3} - space : yabai -m window --toggle float --grid 4:4:1:1:2:2 + ''; + }; +}