2
2
mirror of https://git.feal.no/felixalb/nixos-config.git synced 2024-12-22 20:17:31 +01:00
nixos-config/hosts/worf/yabai.nix

130 lines
4.1 KiB
Nix

{ config, pkgs, lib, ... }:
let
cfg = config.services.yabai;
sketchybar-app-font = pkgs.callPackage ./../../common/sketchybar-app-font.nix {};
in {
services.yabai = {
enable = true;
package = pkgs.unstable.yabai;
enableScriptingAddition = true;
config = {
layout = "bsp";
debug_output = "on";
focus_follows_mouse = "autoraise";
mouse_follows_focus = "off";
window_placement = "second_child";
window_opacity = "off";
window_border = "on";
window_border_width = 1;
window_border_blur = "off";
normal_window_border_color = "0xff404066";
active_window_border_color = "0xffff2020";
window_border_radius = 0;
# top_padding = 10;
# bottom_padding = 10;
# left_padding = 10;
# right_padding = 10;
window_gap = 0;
external_bar = "all:40:0";
};
};
services.skhd = {
enable = true;
skhdConfig = let
mod = "alt";
mod2 = "alt + ctrl";
mod3 = "alt + shift";
mod4 = "alt + cmd";
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
# Switch spaces
ctrl - left : yabai -m space --focus prev
ctrl - right : yabai -m space --focus next
ctrl - 1 : yabai -m space --focus 1
ctrl - 2 : yabai -m space --focus 2
ctrl - 3 : yabai -m space --focus 3
ctrl - 4 : yabai -m space --focus 4
ctrl - 5 : yabai -m space --focus 5
ctrl - 6 : yabai -m space --focus 6
ctrl - 7 : yabai -m space --focus 7
# Resize windows
${mod2} - j : yabai -m window --resize bottom:0:20
${mod2} - k : yabai -m window --resize bottom:0:-20
${mod2} - h : yabai -m window --resize right:-20:0
${mod2} - l : yabai -m window --resize right:20:0
${mod2} - down : yabai -m window --resize bottom:0:20
${mod2} - up : yabai -m window --resize bottom:0:-20
${mod2} - left : yabai -m window --resize right:-20:0
${mod2} - right : yabai -m window --resize right:20:0
# Move windows to different displays
${mod2} + cmd - 1 : yabai -m window --display 1
${mod2} + cmd - 2 : yabai -m window --display 2
${mod2} + cmd - 3 : yabai -m window --display 3
# Fullscreen
${mod2} - f : yabai -m window --toggle zoom-fullscreen
${mod2} + shift - f : yabai -m window --toggle native-fullscreen
# Mirror layout
${mod2} - m : yabai -m space --mirror y-axis
# Misc.
${mod2} - b : yabai -m space --balance
${mod2} - space : yabai -m window --toggle float --grid 4:4:1:1:2:2
${mod2} - return : yabai -m window --toggle split
# Launch terminal
cmd - return : open -n -a ${pkgs.alacritty}/Applications/Alacritty.app
'';
};
services.sketchybar = {
enable = true;
package = pkgs.sketchybar;
# The config is handled outside of nix, and is placed in ~/.config/sketchybar
};
fonts.packages = [
sketchybar-app-font
];
}