feat(macos): migrate to yabai 7 & arrpc service
This commit is contained in:
parent
29c555b886
commit
af809090d1
2 changed files with 69 additions and 30 deletions
|
@ -8,12 +8,8 @@
|
||||||
in {
|
in {
|
||||||
config = lib.mkIf config.isGraphical {
|
config = lib.mkIf config.isGraphical {
|
||||||
home.packages =
|
home.packages =
|
||||||
(lib.optionals isDarwin [
|
(lib.optionals isDarwin [(pkgs.discord.override {withOpenASAR = true;})])
|
||||||
(pkgs.discord.override {withOpenASAR = true;})
|
++ (lib.optionals isLinux [(pkgs.vesktop.override {withSystemVencord = false;})]);
|
||||||
])
|
|
||||||
++ (lib.optionals isLinux [
|
|
||||||
(pkgs.vesktop.override {withSystemVencord = false;})
|
|
||||||
]);
|
|
||||||
|
|
||||||
home.activation.discordSettings = let
|
home.activation.discordSettings = let
|
||||||
json = pkgs.writeTextFile {
|
json = pkgs.writeTextFile {
|
||||||
|
@ -44,6 +40,14 @@ in {
|
||||||
'';
|
'';
|
||||||
|
|
||||||
services.arrpc.enable = isLinux;
|
services.arrpc.enable = isLinux;
|
||||||
|
launchd.agents.arrpc = {
|
||||||
|
enable = isDarwin;
|
||||||
|
config = {
|
||||||
|
ProgramArguments = ["${pkgs.arrpc}/bin/arrpc"];
|
||||||
|
KeepAlive = true;
|
||||||
|
RunAtLoad = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
services.discord-applemusic-rich-presence.enable = isDarwin;
|
services.discord-applemusic-rich-presence.enable = isDarwin;
|
||||||
services.mpd-discord-rpc.enable = isLinux;
|
services.mpd-discord-rpc.enable = isLinux;
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
{lib, ...}: {
|
{
|
||||||
|
pkgs,
|
||||||
|
lib,
|
||||||
|
...
|
||||||
|
}: {
|
||||||
imports = [./options.nix];
|
imports = [./options.nix];
|
||||||
# manipulate the global /etc/zshenv for PATH, etc.
|
# manipulate the global /etc/zshenv for PATH, etc.
|
||||||
programs.zsh.enable = true;
|
programs.zsh.enable = true;
|
||||||
|
@ -17,54 +21,82 @@
|
||||||
enableScriptingAddition = true;
|
enableScriptingAddition = true;
|
||||||
logFile = "/var/tmp/yabai.log";
|
logFile = "/var/tmp/yabai.log";
|
||||||
config = {
|
config = {
|
||||||
auto_balance = "off";
|
|
||||||
focus_follows_mouse = "off";
|
|
||||||
layout = "bsp";
|
layout = "bsp";
|
||||||
mouse_drop_action = "swap";
|
|
||||||
mouse_follows_focus = "off";
|
|
||||||
window_animation_duration = "0.0";
|
|
||||||
window_gap = 5;
|
window_gap = 5;
|
||||||
left_padding = 5;
|
left_padding = 5;
|
||||||
right_padding = 5;
|
right_padding = 5;
|
||||||
top_padding = 5;
|
top_padding = 5;
|
||||||
bottom_padding = 5;
|
bottom_padding = 5;
|
||||||
window_origin_display = "default";
|
window_animation_duration = "0.3";
|
||||||
|
|
||||||
|
window_origin_display = "cursor";
|
||||||
window_placement = "second_child";
|
window_placement = "second_child";
|
||||||
window_shadow = "float";
|
window_shadow = "float";
|
||||||
|
|
||||||
|
mouse_modifier = "cmd";
|
||||||
|
mouse_action2 = "resize";
|
||||||
|
mouse_drop_action = "swap";
|
||||||
|
mouse_follows_focus = "off";
|
||||||
|
focus_follows_mouse = "off";
|
||||||
};
|
};
|
||||||
extraConfig = let
|
extraConfig = let
|
||||||
rule = "yabai -m rule --add";
|
rule = "yabai -m rule";
|
||||||
ignored = app: builtins.concatStringsSep "\n" (map (e: ''${rule} app="${e}" manage=off sticky=off layer=above'') app);
|
mkRules = apps: options:
|
||||||
unmanaged = app: builtins.concatStringsSep "\n" (map (e: ''${rule} app="${e}" manage=off'') app);
|
builtins.concatStringsSep "\n" (map (app: ''yabai -m rule --add app="${app}" ${options}'') apps);
|
||||||
|
unmanaged = apps: mkRules apps "manage=off";
|
||||||
in ''
|
in ''
|
||||||
# auto-inject scripting additions
|
# auto-inject scripting additions
|
||||||
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
|
yabai -m signal --add event=dock_did_restart action="sudo yabai --load-sa"
|
||||||
sudo yabai --load-sa
|
sudo yabai --load-sa
|
||||||
|
|
||||||
${ignored ["JetBrains Toolbox" "Mullvad VPN" "Sip" "iStat Menus"]}
|
# ensure that there are always 10 spaces
|
||||||
${unmanaged ["Godot" "GOG Galaxy" "Steam" "System Settings"]}
|
spacestocreate=10
|
||||||
yabai -m rule --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off
|
spaces=$((spacestocreate - $(yabai -m query --spaces | ${pkgs.jq}/bin/jq length)))
|
||||||
yabai -m rule --add label="Safari" app="^Safari$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Advance)$" manage=off
|
while [ "$spaces" -gt 0 ]; do
|
||||||
|
yabai -m space --create
|
||||||
|
spaces=$((spaces - 1))
|
||||||
|
done
|
||||||
|
|
||||||
# etc.
|
# make the spaces auto-balance
|
||||||
${rule} manage=off app="CleanShot"
|
for i in {1..10}; do
|
||||||
${rule} manage=off sticky=on app="OBS Studio"
|
yabai -m config --space "$i" auto_balance on
|
||||||
|
done
|
||||||
|
|
||||||
|
${unmanaged [
|
||||||
|
"CleanShot"
|
||||||
|
"GOG Galaxy"
|
||||||
|
"Godot"
|
||||||
|
"JetBrains Toolbox"
|
||||||
|
"Mullvad VPN"
|
||||||
|
"OBS Studio"
|
||||||
|
"Sip"
|
||||||
|
"Steam"
|
||||||
|
"System Settings"
|
||||||
|
"iStat Menus"
|
||||||
|
]}
|
||||||
|
|
||||||
|
${rule} --add label="Finder" app="^Finder$" title="(Co(py|nnect)|Move|Info|Pref)" manage=off
|
||||||
|
${rule} --add label="Safari" app="^Safari$" title="^(General|(Tab|Password|Website|Extension)s|AutoFill|Se(arch|curity)|Privacy|Advance)$" manage=off
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
skhd = {
|
skhd = {
|
||||||
enable = true;
|
enable = true;
|
||||||
skhdConfig = let
|
skhdConfig = let
|
||||||
mapKeymaps = with builtins;
|
mapKeymaps = cmd:
|
||||||
cmd:
|
builtins.concatStringsSep "\n" (
|
||||||
concatStringsSep "\n" (map (i:
|
map (i:
|
||||||
replaceStrings ["Num"] [
|
builtins.replaceStrings ["Num"] [
|
||||||
(toString (
|
(toString (
|
||||||
if (i == 10)
|
if (i == 10)
|
||||||
then 0
|
then 0
|
||||||
else i
|
else i
|
||||||
))
|
))
|
||||||
]
|
]
|
||||||
cmd) (lib.range 1 10));
|
cmd) (
|
||||||
|
lib.range 1 10
|
||||||
|
)
|
||||||
|
);
|
||||||
in ''
|
in ''
|
||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
# focus window
|
# focus window
|
||||||
|
@ -94,8 +126,11 @@
|
||||||
ctrl - right : yabai -m space --focus next
|
ctrl - right : yabai -m space --focus next
|
||||||
# switch to space
|
# switch to space
|
||||||
${mapKeymaps "cmd + ctrl - Num : yabai -m space --focus Num"}
|
${mapKeymaps "cmd + ctrl - Num : yabai -m space --focus Num"}
|
||||||
# send window to desktop and follow focus
|
# send window to desktop, follow focus, and move out of scratchpad
|
||||||
${mapKeymaps "cmd + shift - Num : yabai -m window --space Num; yabai -m space --focus Num"}
|
${mapKeymaps "cmd + shift - Num : yabai -m window --space Num; yabai -m space --focus Num; yabai -m window --scratchpad ''"}
|
||||||
|
|
||||||
|
cmd - tab : yabai -m window --toggle main
|
||||||
|
cmd + shift - tab : yabai -m window --scratchpad main
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue