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