2023-11-16 14:37:23 +01:00
|
|
|
{ config, pkgs, lib, ... }:
|
|
|
|
let
|
|
|
|
cfg = config.services.yabai;
|
2023-12-07 10:22:35 +01:00
|
|
|
sketchybar-app-font = pkgs.callPackage ./../../common/sketchybar-app-font.nix {};
|
2023-11-16 14:37:23 +01:00
|
|
|
in {
|
|
|
|
services.yabai = {
|
|
|
|
enable = true;
|
2024-03-18 18:08:43 +01:00
|
|
|
package = pkgs.unstable.yabai;
|
2023-11-16 14:37:23 +01:00
|
|
|
enableScriptingAddition = true;
|
|
|
|
config = {
|
|
|
|
layout = "bsp";
|
|
|
|
debug_output = "on";
|
|
|
|
focus_follows_mouse = "autoraise";
|
|
|
|
mouse_follows_focus = "off";
|
2023-12-07 10:22:35 +01:00
|
|
|
|
2023-11-16 14:37:23 +01:00
|
|
|
window_placement = "second_child";
|
|
|
|
window_opacity = "off";
|
2023-12-07 10:22:35 +01:00
|
|
|
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;
|
|
|
|
|
2023-11-16 14:37:23 +01:00
|
|
|
# top_padding = 10;
|
|
|
|
# bottom_padding = 10;
|
|
|
|
# left_padding = 10;
|
|
|
|
# right_padding = 10;
|
2023-12-07 10:22:35 +01:00
|
|
|
window_gap = 0;
|
|
|
|
|
|
|
|
external_bar = "all:40:0";
|
2023-11-16 14:37:23 +01:00
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
services.skhd = {
|
|
|
|
enable = true;
|
|
|
|
skhdConfig = let
|
|
|
|
mod = "alt";
|
|
|
|
mod2 = "alt + ctrl";
|
|
|
|
mod3 = "alt + shift";
|
2023-12-07 10:22:35 +01:00
|
|
|
mod4 = "alt + cmd";
|
2023-11-16 14:37:23 +01:00
|
|
|
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
|
|
|
|
|
2023-12-07 10:22:35 +01:00
|
|
|
# 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
|
2023-11-16 14:37:23 +01:00
|
|
|
|
2023-12-07 10:22:35 +01:00
|
|
|
# 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
|
2023-11-16 14:37:23 +01:00
|
|
|
${mod2} - f : yabai -m window --toggle zoom-fullscreen
|
2023-12-07 10:22:35 +01:00
|
|
|
${mod2} + shift - f : yabai -m window --toggle native-fullscreen
|
|
|
|
|
|
|
|
# Mirror layout
|
|
|
|
${mod2} - m : yabai -m space --mirror y-axis
|
|
|
|
|
|
|
|
# Misc.
|
2023-11-16 14:37:23 +01:00
|
|
|
${mod2} - b : yabai -m space --balance
|
2023-12-07 10:22:35 +01:00
|
|
|
${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
|
2023-11-16 14:37:23 +01:00
|
|
|
'';
|
|
|
|
};
|
2023-12-07 10:22:35 +01:00
|
|
|
|
|
|
|
services.sketchybar = {
|
|
|
|
enable = true;
|
2023-12-17 01:05:34 +01:00
|
|
|
package = pkgs.sketchybar;
|
2023-12-07 10:22:35 +01:00
|
|
|
# The config is handled outside of nix, and is placed in ~/.config/sketchybar
|
|
|
|
};
|
|
|
|
|
2024-07-30 19:07:24 +02:00
|
|
|
fonts.packages = [
|
2023-12-07 10:22:35 +01:00
|
|
|
sketchybar-app-font
|
|
|
|
];
|
2023-11-16 14:37:23 +01:00
|
|
|
}
|