Skip to content

Commit

Permalink
refactor: better structure, add config for yabai, skhd
Browse files Browse the repository at this point in the history
  • Loading branch information
solidsnakedev committed Nov 23, 2023
1 parent d37003a commit 795b5a5
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 5 deletions.
30 changes: 30 additions & 0 deletions config/skhd/skhdrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

alt - j : yabai -m window --focus south
alt - k : yabai -m window --focus north
alt - h : yabai -m window --focus west
alt - l : yabai -m window --focus east

# rotate layout clocwise
shift + alt - r : yabai -m space --rotate 270

# swap layout
shift + alt - s : yabai -m window --swap recent

# maximize a window
shift + alt - m : yabai -m window --toggle zoom-fullscreen

# float / unfloat window and center on screen
shift + alt - t : yabai -m window --toggle float --grid 4:4:1:1:2:2

# Move focus container to workspace
shift + alt - n : index=$(yabai -m query --spaces --display | jq 'first(.[] | select(.windows | length == 0) | .index)') && \
yabai -m window --space ${index:-next}

# increase window size
shift + alt - h : yabai -m window --resize left:-20:0; yabai -m window --resize right:20:0
shift + alt - j : yabai -m window --resize bottom:0:20
shift + alt - k : yabai -m window --resize top:0:-20
shift + alt - l : yabai -m window --resize right:-20:0; yabai -m window --resize left:20:0

# open iterm
alt - return : open -na /Applications/iTerm.app
42 changes: 42 additions & 0 deletions config/yabai/yabairc
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# bsp or float (default: float)
yabai -m config layout bsp

# on or off (default: off)
yabai -m config auto_balance on

# New window spawns to the right if vertical split, or bottom if horizontal split
yabai -m config window_placement second_child

# Set all padding and gaps to 20pt (default: 0)
yabai -m config top_padding 12
yabai -m config bottom_padding 12
yabai -m config left_padding 12
yabai -m config right_padding 12
yabai -m config window_gap 12

# set mouse follows focus mode (default: off)
yabai -m config mouse_follows_focus on

yabai -m config focus_follows_mouse off

yabai -m config mouse_drop_action swap

# set mouse interaction modifier key (default: fn)
yabai -m config mouse_modifier alt

# set modifier + left-click drag to move window (default: move)
yabai -m config mouse_action1 move

# set modifier + right-click drag to resize window (default: resize)
yabai -m config mouse_action2 resize

# float system preferences
yabai -m rule --add app="^System Settings$" manage=off
yabai -m rule --add app="^Calculator$" manage=off
yabai -m rule --add app="^Activity Monitor$" manage=off
yabai -m rule --add app="^Mail$" manage=off
yabai -m rule --add app="^PenTablet$" manage=off
yabai -m rule --add app="^Spotify$" manage=off
yabai -m rule --add app="^zoom.us$" manage=off
yabai -m rule --add app="^Calendar$" manage=off

19 changes: 14 additions & 5 deletions home-manager/mac/home.nix
Original file line number Diff line number Diff line change
Expand Up @@ -104,13 +104,22 @@
# # };
# };

xdg.configFile.yabai = {
source = ../../config/yabai;
recursive = true;
};

xdg.configFile.skhd = {
source = ../../config/skhd;
recursive = true;
};


imports = [
# ./../common-modules/fish.nix
./../common-modules/direnv.nix
./../common-modules/git.nix
./../common-modules/tmux.nix
./../common-modules/bat.nix
./../../modules/direnv.nix
./../../modules/git.nix
./../../modules/tmux.nix
./../../modules/bat.nix
./local-modules/neovim.nix
];

Expand Down

0 comments on commit 795b5a5

Please sign in to comment.