various changes

3d323731bc26… · Ryan Schanzenbacher ·

parent a2c015245921… view tree

Changed files

diff --git a/files/darwin-settings/vorssaint_settings.plist b/files/darwin-settings/vorssaint_settings.plist
index 44a5daa..d4dfed4 100644
--- a/files/darwin-settings/vorssaint_settings.plist
+++ b/files/darwin-settings/vorssaint_settings.plist
@@ -147,7 +147,7 @@
<key>featureAvailable.musicBlock</key>
<false/>
<key>featureAvailable.pastePlain</key>
- <false/>
+ <true/>
<key>featureAvailable.quickLauncher</key>
<true/>
<key>featureAvailable.quickToggles</key>
@@ -171,7 +171,7 @@
<key>featureAvailable.superKey</key>
<false/>
<key>featureAvailable.switcher</key>
- <false/>
+ <true/>
<key>featureAvailable.textSnippets</key>
<false/>
<key>featureAvailable.uninstaller</key>
@@ -215,7 +215,7 @@
<key>lastUpdateIntroVersion</key>
<string>3.2.0</string>
<key>launchAtLoginWanted</key>
- <false/>
+ <true/>
<key>mediaGIFEnd</key>
<real>0.0</real>
<key>mediaGIFFPS</key>
@@ -472,6 +472,8 @@
<true/>
<key>panelPowerOrder</key>
<string>system,adapter,battery,remaining,health</string>
+ <key>panelSectionOrder</key>
+ <string>keepAwake,brightness,system,mixer,power,disk,network,fanControl,utilities,controls,toggles</string>
<key>panelShowBrightness</key>
<true/>
<key>panelShowControls</key>
@@ -533,15 +535,15 @@
<key>panelUtilityWindowLayout</key>
<true/>
<key>pastePlainEnabled</key>
- <false/>
+ <true/>
<key>pastePlainShortcut</key>
- <string>option+shift+command:9</string>
+ <string>shift+command:9</string>
<key>previewSize</key>
<string>normal</string>
<key>quickLauncherHiddenItems</key>
<string></string>
<key>quickLauncherShortcut</key>
- <string>control+command:9</string>
+ <string>option+shift:9</string>
<key>quickLauncherShortcutEnabled</key>
<true/>
<key>radialMenuActivationMode</key>
diff --git a/hosts/RyanMac/configuration.nix b/hosts/RyanMac/configuration.nix
index 687b941..e98db39 100644
--- a/hosts/RyanMac/configuration.nix
+++ b/hosts/RyanMac/configuration.nix
@@ -159,6 +159,7 @@ in {
"kdenlive"
"rustdesk"
"vorssaint"
+ "obs"
];
};
diff --git a/modules/darwin/yabai/default.nix b/modules/darwin/yabai/default.nix
index cc7df15..8aa4fbf 100644
--- a/modules/darwin/yabai/default.nix
+++ b/modules/darwin/yabai/default.nix
@@ -4,6 +4,10 @@
let
cfg = config.local.yabai;
+ spaceFocusBinds = lib.concatStringsSep "\n"
+ (map (i: "shift + alt - ${toString i} : ${yabaiBin} -m window --space ${toString i}")
+ (lib.range 1 cfg.spaceHotkeys.count));
+
# symbolic hotkey IDs 118..126 == "Switch to Desktop 1".."Switch to Desktop 9"
spaceKeycodes = [ 18 19 20 21 22 23 25 26 28 ];
@@ -29,6 +33,14 @@ let
(uuid: pad: " ${uuid}) pad=${toString pad} ;;")
cfg.displayTopPadding);
+ paddingSignals = ''
+ yabai -m signal --add event=display_added action="${displayPaddingScript}" label="per-display padding (added)"
+ yabai -m signal --add event=display_removed action="${displayPaddingScript}" label="per-display padding (removed)"
+ yabai -m signal --add event=space_created action="${displayPaddingScript}" label="per-display padding (space)"
+ ${displayPaddingScript}
+ '';
+
+
displayPaddingScript = pkgs.writeShellScript "yabai-display-padding" ''
set -eu
yabai="${cfg.package}/bin/yabai"
@@ -50,6 +62,18 @@ ${padArms}
yabaiBin = "${cfg.package}/bin/yabai";
+ sudoersFile = pkgs.runCommand "sudoers-yabai" { } ''
+ YABAI_BIN="${yabaiBin}"
+ SHASUM=$(sha256sum "$YABAI_BIN" | cut -d' ' -f1)
+ cat > "$out" <<EOF
+ ${cfg.user} ALL=(root) NOPASSWD: sha256:$SHASUM $YABAI_BIN --load-sa
+ EOF
+ '';
+
+ dockRestartSignal = ''
+ yabai -m signal --add event=dock_did_restart action="/usr/bin/sudo ${yabaiBin} --load-sa" label="reload scripting addition"
+ '';
+
directionBinds = lib.concatStringsSep "\n" (map (d: ''
alt - ${d.key} : ${yabaiBin} -m window --focus ${d.dir} || ${yabaiBin} -m display --focus ${d.dir}
shift + alt - ${d.key} : ${yabaiBin} -m window --swap ${d.dir} || ${yabaiBin} -m window --display ${d.dir}
@@ -74,6 +98,15 @@ in {
description = "yabai package. Referenced by keybindings and the padding script.";
};
+ user = lib.mkOption {
+ type = lib.types.str;
+ default = config.system.primaryUser;
+ defaultText = lib.literalExpression "config.system.primaryUser";
+ description = ''
+ User that is granted permission to run --load-sa
+ '';
+ };
+
enableScriptingAddition = lib.mkOption {
type = lib.types.bool;
default = false;
@@ -83,6 +116,15 @@ in {
'';
};
+ useYabaiSpaceFocus = lib.mkOption {
+ type = lib.types.bool;
+ default = false;
+ description = ''
+ Bind alt+n to yabai native control rather than skhd. Requires scripting
+ additions.
+ '';
+ };
+
defaultPadding = lib.mkOption {
type = lib.types.int;
default = 10;
@@ -94,7 +136,7 @@ in {
defaultTopPadding = lib.mkOption {
type = lib.types.int;
- default = 10;
+ default = 40;
description = ''
Padding for top edge of screen
'';
@@ -168,6 +210,21 @@ in {
};
config = lib.mkIf cfg.enable {
+ assertions = [
+ {
+ assertion = cfg.user != null && cfg.user != "";
+ message = ''
+ local.yabai.user is unset. Set it or system.primaryUser
+ '';
+ }
+ {
+ assertion = cfg.useYabaiSpaceFocus -> cfg.enableScriptingAssition;
+ message = ''
+ local.yabai.useYabaiSpaceFocus requires enableScriptingAddition.
+ '';
+ }
+ ];
+
services.yabai = {
enable = true;
inherit (cfg) package enableScriptingAddition;
@@ -188,39 +245,41 @@ in {
focus_follows_mouse = "autofocus";
} // cfg.extraSettings;
- extraConfig = ''
- yabai -m rule --add app='System Settings' manage=off
- yabai -m rule --add app="^Zen$" title="^Picture-in-Picture$" manage=off
- ''
- + lib.optionalString (cfg.displayTopPadding != { }) ''
-
- # Per-display padding. space_created is required, not redundant:
- # display_added fires when yabai sees the display, which can precede
- # macOS finishing space creation on it, so the first pass may find
- # zero or one space. display_removed is required because yabai
- # reindexes spaces on disconnect and the overrides are keyed by index.
- yabai -m signal --add event=display_added action="${displayPaddingScript}" label="per-display padding (added)"
- yabai -m signal --add event=display_removed action="${displayPaddingScript}" label="per-display padding (removed)"
- yabai -m signal --add event=space_created action="${displayPaddingScript}" label="per-display padding (space)"
- ${displayPaddingScript}
- ''
- + cfg.extraConfig;
+ extraConfig = lib.concatStringsSep "\n" (
+ [
+ ''
+ yabai -m rule --add app='System Settings' manage=off
+ yabai -m rule --add app="^Zen$" title="^Picture-in-Picture$" manage=off
+ ''
+ ]
+ ++ lib.optional cfg.enableScriptingAddition dockRestartSignal
+ ++ lib.optional (cfg.displayTopPadding != { }) paddingSignals
+ ++ lib.optional (cfg.extraConfig != "") cfg.extraConfig
+ );
};
+ environment.etc."sudoers.d/yabai".source =
+ lib.mkIf cfg.enableScriptingAddition (lib.mkForce sudoersFile);
+
services.skhd = lib.mkIf cfg.manageKeybindings {
enable = true;
- skhdConfig = ''
- shift + alt - q : ${yabaiBin} -m window --close
-
- ${directionBinds}
-
- shift + alt - space : ${yabaiBin} -m window --toggle float
- shift + alt - return : ${yabaiBin} -m window --toggle sticky
- alt - f : ${yabaiBin} -m window --toggle zoom-fullscreen
- shift + alt - f : ${yabaiBin} -m window --toggle native-fullscreen
-
- ${spaceMoveBinds}
- '';
+ skhdConfig = lib.concatStringsSep "\n" (
+ [
+ ''
+ shift + alt - q : ${yabaiBin} -m window --close
+
+ ${directionBinds}
+
+ shift + alt - space : ${yabaiBin} -m window --toggle float
+ shift + alt - return : ${yabaiBin} -m window --toggle sticky
+ alt - f : ${yabaiBin} -m window --toggle zoom-fullscreen
+ shift + alt - f : ${yabaiBin} -m window --toggle native-fullscreen
+
+ ${spaceMoveBinds}
+ ''
+ ]
+ ++ lib.optional cfg.useYabaiSpaceFocus spaceFocusBinds
+ );
};
# Prerequisites, not preferences: yabai requires per-display spaces, and
diff --git a/users/ryan/common.nix b/users/ryan/common.nix
index b1599fd..aaca782 100644
--- a/users/ryan/common.nix
+++ b/users/ryan/common.nix
@@ -122,6 +122,11 @@
enableSshSupport = true;
};
+ programs.fzf = {
+ enable = true;
+ enableZshIntegration = true;
+ };
+
programs.zsh = {
enable = true;
initContent = let