├── modules ├── home-manager │ ├── default.nix │ ├── linux │ │ └── default.nix │ ├── darwin │ │ ├── default.nix │ │ └── hammerspoon │ │ │ ├── init.lua │ │ │ └── Spoons │ │ │ └── WindowHalfsAndThirds.spoon │ │ │ ├── init.lua │ │ │ └── docs.json │ └── common.nix └── macos.nix ├── .github └── workflows │ └── test.yml ├── LICENSE ├── flake.lock ├── flake.nix └── README.md /modules/home-manager/default.nix: -------------------------------------------------------------------------------- 1 | { ... }: 2 | { 3 | imports = [ 4 | ./common.nix 5 | ./darwin 6 | ./linux 7 | ]; 8 | } 9 | -------------------------------------------------------------------------------- /modules/home-manager/linux/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | let 8 | isLinux = pkgs.stdenv.hostPlatform.isLinux; 9 | in 10 | { 11 | config = lib.mkIf isLinux { 12 | }; 13 | } 14 | -------------------------------------------------------------------------------- /modules/macos.nix: -------------------------------------------------------------------------------- 1 | { pkgs, ... }: 2 | let 3 | username = "apearwin"; 4 | homeDirectory = "/Users/${username}"; 5 | in 6 | { 7 | users.users."${username}" = { 8 | home = homeDirectory; 9 | }; 10 | 11 | # Make nix available to default macOS shell. 12 | programs.zsh.enable = true; 13 | # Expose nix-provided paths to fish. 14 | programs.fish.enable = true; 15 | 16 | home-manager = { 17 | useGlobalPkgs = true; 18 | useUserPackages = true; 19 | users."${username}" = { 20 | imports = [ ./home-manager ]; 21 | home = { 22 | inherit homeDirectory username; 23 | stateVersion = "23.11"; 24 | }; 25 | }; 26 | }; 27 | 28 | fonts.packages = [ 29 | pkgs.nerd-fonts.jetbrains-mono 30 | ]; 31 | 32 | # Our Nix installation is managed by the Determinate Systems installer. 33 | nix.enable = false; 34 | 35 | system.stateVersion = 4; 36 | } 37 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: "Test Home Manager configuration." 2 | on: [push] 3 | jobs: 4 | linting: 5 | runs-on: ubuntu-latest 6 | steps: 7 | - uses: actions/checkout@v3 8 | - uses: DeterminateSystems/nix-installer-action@main 9 | - uses: DeterminateSystems/magic-nix-cache-action@main 10 | - name: Nix formatting 11 | run: nix fmt -- --ci 12 | 13 | tests: 14 | runs-on: ubuntu-latest 15 | steps: 16 | - uses: actions/checkout@v3 17 | - uses: DeterminateSystems/nix-installer-action@main 18 | - uses: DeterminateSystems/magic-nix-cache-action@main 19 | - name: Install home-manager and realise home.nix 20 | run: | 21 | # Create profile folders home-manager expects to exist. 22 | nix profile list 23 | # Move the nix.conf file created by magic-nix-cache rather than fail. 24 | nix run home-manager/master -- switch --flake .#apearwin-ci -b backup 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /modules/home-manager/darwin/default.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | lib, 5 | ... 6 | }: 7 | let 8 | isDarwin = pkgs.stdenv.hostPlatform.isDarwin; 9 | in 10 | { 11 | config = lib.mkIf isDarwin { 12 | home = { 13 | packages = with pkgs; [ 14 | colima 15 | docker 16 | ]; 17 | }; 18 | 19 | programs = { 20 | fish = { 21 | plugins = [ 22 | # Need this when using Fish as a default macOS shell in order to pick 23 | # up ~/.nix-profile/bin 24 | { 25 | name = "nix-env"; 26 | src = pkgs.fetchFromGitHub { 27 | owner = "lilyball"; 28 | repo = "nix-env.fish"; 29 | rev = "7b65bd228429e852c8fdfa07601159130a818cfa"; 30 | sha256 = "sha256-RG/0rfhgq6aEKNZ0XwIqOaZ6K5S4+/Y5EEMnIdtfPhk="; 31 | }; 32 | } 33 | ]; 34 | }; 35 | 36 | git = { 37 | settings = { 38 | core = { 39 | # If git uses `ssh` from Nix the macOS-specific configuration in 40 | # `~/.ssh/config` won't be seen as valid 41 | # https://github.com/NixOS/nixpkgs/issues/15686#issuecomment-865928923 42 | sshCommand = "/usr/bin/ssh"; 43 | }; 44 | }; 45 | }; 46 | 47 | ghostty = { 48 | # Ghostty package is broken on macOS, must install app manually. 49 | package = null; 50 | }; 51 | }; 52 | 53 | # Requires telling Hammerspoon to look for configuration in the right place: 54 | # defaults write org.hammerspoon.Hammerspoon MJConfigFile "${XDG_CONFIG_HOME:-$HOME/.config}/hammerspoon/init.lua" 55 | xdg.configFile.hammerspoon = { 56 | source = ./hammerspoon; 57 | recursive = true; 58 | }; 59 | }; 60 | } 61 | -------------------------------------------------------------------------------- /flake.lock: -------------------------------------------------------------------------------- 1 | { 2 | "nodes": { 3 | "home-manager": { 4 | "inputs": { 5 | "nixpkgs": [ 6 | "nixpkgs" 7 | ] 8 | }, 9 | "locked": { 10 | "lastModified": 1761513701, 11 | "narHash": "sha256-w7qOcQb1FSMZASvWe01r99QqZ5LnHO0k3rgs5ryyig0=", 12 | "owner": "nix-community", 13 | "repo": "home-manager", 14 | "rev": "255b6a0ef2f488a2fad051361699cc67db57338c", 15 | "type": "github" 16 | }, 17 | "original": { 18 | "owner": "nix-community", 19 | "repo": "home-manager", 20 | "type": "github" 21 | } 22 | }, 23 | "nix-darwin": { 24 | "inputs": { 25 | "nixpkgs": [ 26 | "nixpkgs" 27 | ] 28 | }, 29 | "locked": { 30 | "lastModified": 1761339987, 31 | "narHash": "sha256-IUaawVwItZKi64IA6kF6wQCLCzpXbk2R46dHn8sHkig=", 32 | "owner": "LnL7", 33 | "repo": "nix-darwin", 34 | "rev": "7cd9aac79ee2924a85c211d21fafd394b06a38de", 35 | "type": "github" 36 | }, 37 | "original": { 38 | "owner": "LnL7", 39 | "repo": "nix-darwin", 40 | "type": "github" 41 | } 42 | }, 43 | "nixpkgs": { 44 | "locked": { 45 | "lastModified": 1761349956, 46 | "narHash": "sha256-tH3wHnOJms+U4k/rK2Nn1RfBrhffX92jLP/2VndSn0w=", 47 | "owner": "NixOS", 48 | "repo": "nixpkgs", 49 | "rev": "02f2cb8e0feb4596d20cc52fda73ccee960e3538", 50 | "type": "github" 51 | }, 52 | "original": { 53 | "owner": "NixOS", 54 | "ref": "nixpkgs-unstable", 55 | "repo": "nixpkgs", 56 | "type": "github" 57 | } 58 | }, 59 | "root": { 60 | "inputs": { 61 | "home-manager": "home-manager", 62 | "nix-darwin": "nix-darwin", 63 | "nixpkgs": "nixpkgs" 64 | } 65 | } 66 | }, 67 | "root": "root", 68 | "version": 7 69 | } 70 | -------------------------------------------------------------------------------- /flake.nix: -------------------------------------------------------------------------------- 1 | { 2 | description = "Home Manager configuration"; 3 | 4 | inputs = { 5 | nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable"; 6 | nix-darwin = { 7 | url = "github:LnL7/nix-darwin"; 8 | inputs.nixpkgs.follows = "nixpkgs"; 9 | }; 10 | home-manager = { 11 | url = "github:nix-community/home-manager"; 12 | inputs.nixpkgs.follows = "nixpkgs"; 13 | }; 14 | }; 15 | 16 | outputs = 17 | { 18 | self, 19 | nixpkgs, 20 | nix-darwin, 21 | home-manager, 22 | }: 23 | let 24 | makeHomeManagerConfiguration = 25 | { 26 | system, 27 | username, 28 | homeDirectory ? "/Users/${username}", 29 | }: 30 | let 31 | pkgs = nixpkgs.legacyPackages.${system}; 32 | in 33 | home-manager.lib.homeManagerConfiguration { 34 | inherit pkgs; 35 | 36 | modules = [ 37 | ./modules/home-manager 38 | { 39 | home = { 40 | inherit homeDirectory username; 41 | stateVersion = "23.11"; 42 | }; 43 | } 44 | ]; 45 | }; 46 | in 47 | { 48 | formatter.aarch64-darwin = nixpkgs.legacyPackages.aarch64-darwin.nixfmt-tree; 49 | formatter.x86_64-linux = nixpkgs.legacyPackages.x86_64-linux.nixfmt-tree; 50 | homeConfigurations.apearwin = makeHomeManagerConfiguration { 51 | system = "aarch64-darwin"; 52 | username = "apearwin"; 53 | }; 54 | homeConfigurations.apearwin-ci = makeHomeManagerConfiguration { 55 | system = "x86_64-linux"; 56 | username = "runner"; 57 | homeDirectory = "/home/runner"; 58 | }; 59 | darwinConfigurations.pearwin-laptop = nix-darwin.lib.darwinSystem { 60 | system = "aarch64-darwin"; 61 | modules = [ 62 | home-manager.darwinModules.home-manager 63 | ./modules/macos.nix 64 | ]; 65 | }; 66 | }; 67 | } 68 | -------------------------------------------------------------------------------- /modules/home-manager/darwin/hammerspoon/init.lua: -------------------------------------------------------------------------------- 1 | -- Reload Hammerspoon configuration. 2 | hs.hotkey.bind({"⌘", "⌥", "⌃"}, "h", function() 3 | hs.reload() 4 | hs.console.clearConsole() 5 | end) 6 | 7 | -- Enter hotkey mode with option-space. 8 | leader = hs.hotkey.modal.new({"⌥"}, "space") 9 | 10 | -- Exit hotkey mode with escape. 11 | leader:bind("", "escape", nil, function() leader:exit() end, nil) 12 | 13 | -- Hide focused application. 14 | leader:bind("", "h", function() hs.application.frontmostApplication():hide() leader:exit() end, nil) 15 | 16 | -- Launch applications. 17 | leader:bind("", "f", function() hs.application.launchOrFocus("Firefox") leader:exit() end, nil) 18 | leader:bind("", "o", function() hs.application.launchOrFocus("Obsidian") leader:exit() end, nil) 19 | leader:bind("", "s", function() hs.application.launchOrFocus("Slack") leader:exit() end, nil) 20 | leader:bind("", "t", function() hs.application.launchOrFocus("Ghostty") leader:exit() end, nil) 21 | 22 | -- Window management. 23 | hs.loadSpoon("WindowHalfsAndThirds") 24 | wm = spoon.WindowHalfsAndThirds 25 | 26 | -- Move focused window to left half. 27 | leader:bind("", "left", function() wm.leftHalf() leader:exit() end, nil) 28 | -- Move focused window to right half. 29 | leader:bind("", "right", function() wm.rightHalf() leader:exit() end, nil) 30 | -- Move focused window to top half. 31 | leader:bind("", "up", function() wm.topHalf() leader:exit() end, nil) 32 | -- Move focused window to bottom half. 33 | leader:bind("", "down", function() wm.bottomHalf() leader:exit() end, nil) 34 | -- Center focused window. 35 | leader:bind("", "c", function() wm.center() leader:exit() end, nil) 36 | -- Undo previous window movement. 37 | leader:bind("", "delete", function() wm.undo() leader:exit() end, nil) 38 | 39 | -- Move focused window to screen to the left. 40 | leader:bind("⌥", "left", function() 41 | local window = hs.application.frontmostApplication():focusedWindow() 42 | window:moveToScreen(window:screen():toWest()) 43 | leader:exit() 44 | end, nil) 45 | 46 | -- Move focused window to screen to the right. 47 | leader:bind("⌥", "right", function() 48 | local window = hs.application.frontmostApplication():focusedWindow() 49 | window:moveToScreen(window:screen():toEast()) 50 | leader:exit() 51 | end, nil) 52 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Dotfiles 2 | 3 | This is my collection of [configuration files](http://dotfiles.github.io/). 4 | 5 | It uses [home-manager][home-manager]—a [Nix][nix]-based tool—to install 6 | programs and create their configuration files based off the 7 | [`home.nix`](home.nix) file in this repository. I [wrote more about it in a 8 | blog post][nix-post]. 9 | 10 | (I used to [use GNU Stow][stow-post]. The last Stow-based commit was 11 | [`4f1feee1e`][stow-commit].) 12 | 13 | ## Usage 14 | 15 | Install [Nix][nix] with Nix Flake support enabled, for example by using the [Determinate Systems installer][nix-installer]. 16 | You should be able to run the `nix flake` command in a shell. 17 | 18 | Next, clone this repository. We'll use `~/Code/dotfiles`. 19 | 20 | ```shell 21 | $ git clone git@github.com:alexpearce/dotfiles.git ~/Code/dotfiles 22 | ``` 23 | 24 | The home-manager profile can then be built and activated: 25 | 26 | ```shell 27 | $ nix run home-manager/master -- switch --flake ~/Code/dotfiles#apearwin 28 | ``` 29 | 30 | To update dependencies: 31 | 32 | ```shell 33 | $ nix flake update ~/Code/dotfiles 34 | ``` 35 | 36 | ### Fish 37 | 38 | I like to set [fish][fish] as my default shell. On macOS this means: 39 | 40 | 1. Editing `/etc/shells` to include an entry for the home-manager-managed 41 | `fish` binary at `~/.nix-profile/bin/fish`. 42 | 2. Setting the default shell with `chsh -s ~/.nix-profile/bin/fish`. 43 | 44 | 45 | ### nix-darwin 46 | 47 | As an alternative to using home-manager alone, the configuration supports using 48 | it with [nix-darwin][nix-darwin]. 49 | 50 | ``` 51 | sudo nix run nix-darwin/master#darwin-rebuild -- switch --flake (pwd) 52 | ``` 53 | 54 | Subsequent rebuilds, after configuration changes, are simpler. 55 | 56 | ``` 57 | sudo darwin-rebuild switch --flake (pwd) 58 | ``` 59 | 60 | [nix]: https://nixos.org/ 61 | [nix-installer]: https://github.com/DeterminateSystems/nix-installer 62 | [home-manager]: https://github.com/nix-community/home-manager 63 | [fish]: https://fishshell.com/ 64 | [nix-darwin]: https://github.com/LnL7/nix-darwin 65 | 66 | [nix-post]: https://alexpearce.me/2021/07/managing-dotfiles-with-nix/ 67 | [stow-post]: https://alexpearce.me/2016/02/managing-dotfiles-with-stow/ 68 | [stow-commit]: https://github.com/alexpearce/dotfiles/tree/4f1feee1e4bc71f2ba5774af44eed1da774510a0 69 | -------------------------------------------------------------------------------- /modules/home-manager/common.nix: -------------------------------------------------------------------------------- 1 | { 2 | config, 3 | pkgs, 4 | ... 5 | }: 6 | { 7 | home = { 8 | packages = with pkgs; [ 9 | entr 10 | fd 11 | httpie 12 | hyperfine 13 | imagemagick 14 | jq 15 | nodejs 16 | pandoc 17 | python3 18 | ripgrep 19 | tree 20 | tree-sitter 21 | ]; 22 | 23 | sessionVariables = { 24 | EDITOR = "hx"; 25 | }; 26 | }; 27 | 28 | programs = { 29 | bat = { 30 | enable = true; 31 | config = { 32 | theme = "base16"; 33 | italic-text = "always"; 34 | }; 35 | }; 36 | 37 | delta = { 38 | enable = true; 39 | enableGitIntegration = true; 40 | options = { 41 | navigate = true; 42 | line-numbers = true; 43 | }; 44 | }; 45 | 46 | direnv = { 47 | enable = true; 48 | config = { 49 | global.hide_env_diff = true; 50 | }; 51 | nix-direnv = { 52 | enable = true; 53 | }; 54 | }; 55 | 56 | eza = { 57 | enable = true; 58 | }; 59 | 60 | fish = { 61 | enable = true; 62 | plugins = [ 63 | { 64 | name = "fzf"; 65 | src = pkgs.fetchFromGitHub { 66 | owner = "PatrickF1"; 67 | repo = "fzf.fish"; 68 | rev = "8920367cf85eee5218cc25a11e209d46e2591e7a"; 69 | sha256 = "sha256-T8KYLA/r/gOKvAivKRoeqIwE2pINlxFQtZJHpOy9GMM="; 70 | }; 71 | } 72 | ]; 73 | shellInit = '' 74 | # Set syntax highlighting colours; var names defined here: 75 | # http://fishshell.com/docs/current/index.html#variables-color 76 | set fish_color_normal normal 77 | set fish_color_command white 78 | set fish_color_quote brgreen 79 | set fish_color_redirection brblue 80 | set fish_color_end white 81 | set fish_color_error -o brred 82 | set fish_color_param brpurple 83 | set fish_color_comment --italics brblack 84 | set fish_color_match cyan 85 | set fish_color_search_match --background=brblack 86 | set fish_color_operator cyan 87 | set fish_color_escape white 88 | set fish_color_autosuggestion brblack 89 | ''; 90 | shellAliases = { 91 | rm = "rm -i"; 92 | cp = "cp -i"; 93 | mv = "mv -i"; 94 | mkdir = "mkdir -p"; 95 | du = "du -hs"; 96 | }; 97 | # Abbreviate commonly used functions 98 | # An abbreviation will expand after or is hit 99 | shellAbbrs = { 100 | b = "bat"; 101 | g = "git"; 102 | ga = "git add"; 103 | gap = "git add -p"; 104 | gb = "git branch"; 105 | gc = "git commit"; 106 | gca = "git commit --amend"; 107 | gcan = "git commit --amend --no-edit"; 108 | gcm = "git commit -m"; 109 | gcl = "git clone"; 110 | gd = "git diff"; 111 | gds = "git diff --staged"; 112 | gl = "git prettylog"; 113 | gp = "git push"; 114 | gpf = "git push --force-with-lease"; 115 | gpl = "git pull"; 116 | gplp = "git pull --prune"; 117 | gr = "git restore"; 118 | grs = "git restore --staged"; 119 | grb = "git rebase"; 120 | grba = "git rebase --abort"; 121 | grbc = "git rebase --continue"; 122 | grbi = "git rebase -i"; 123 | gs = "git status -s -b"; 124 | gst = "git stash"; 125 | gstp = "git stash pop"; 126 | gsts = "git stash show -p"; 127 | gstx = "git stash drop"; 128 | gsw = "git switch"; 129 | gswc = "git switch -c"; 130 | gswm = "git switch main"; 131 | h = "http"; 132 | iexm = "iex -S mix"; 133 | m = "make"; 134 | o = "open"; 135 | p = "python3"; 136 | }; 137 | functions = { 138 | ctrlp = { 139 | description = "Launch Helix file finder from the shell"; 140 | argumentNames = "hidden"; 141 | body = '' 142 | if test -n "$hidden" 143 | # TODO can't find a way to toggle hidden files in Helix yet 144 | echo 'Hidden searching not yet supported.' 145 | exit 1 146 | else 147 | hx . 148 | end 149 | ''; 150 | }; 151 | fish_greeting = { 152 | description = "Greeting to show when starting a fish shell"; 153 | body = ""; 154 | }; 155 | fish_user_key_bindings = { 156 | description = "Set custom key bindings"; 157 | body = '' 158 | bind \cp ctrlp 159 | bind \cl 'ctrlp --hidden' 160 | ''; 161 | }; 162 | mkdcd = { 163 | description = "Make a directory tree and enter it"; 164 | body = "mkdir -p $argv[1]; and cd $argv[1]"; 165 | }; 166 | }; 167 | }; 168 | 169 | fzf = { 170 | enable = true; 171 | enableFishIntegration = false; 172 | }; 173 | 174 | gh = { 175 | enable = true; 176 | settings = { 177 | aliases = { 178 | co = "pr checkout"; 179 | pv = "pr view"; 180 | }; 181 | git_protocol = "ssh"; 182 | }; 183 | }; 184 | 185 | ghostty = { 186 | enable = true; 187 | settings = { 188 | theme = "TokyoNight Moon"; 189 | command = "${config.home.profileDirectory}/bin/fish"; 190 | # Move between panes with cmd+opt+{h,j,k,l}. 191 | keybind = [ 192 | "cmd+opt+h=goto_split:left" 193 | "cmd+opt+j=goto_split:bottom" 194 | "cmd+opt+k=goto_split:top" 195 | "cmd+opt+l=goto_split:right" 196 | # Close the current surface with cmd+shift+w. 197 | "global:cmd+shift+w=close_surface" 198 | ]; 199 | font-family = "Iosevka Term"; 200 | font-feature = "+dlig"; 201 | font-style = "Medium"; 202 | font-style-bold = "Bold"; 203 | font-style-italic = "Medium Italic"; 204 | font-style-bold-italic = "Bold Italic"; 205 | font-size = 16; 206 | # 256 MiB. 207 | scrollback-limit = 268435456; 208 | }; 209 | }; 210 | 211 | git = { 212 | enable = true; 213 | settings = { 214 | alias = { 215 | prettylog = "log --graph --abbrev-commit --decorate --date=relative --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"; 216 | }; 217 | color = { 218 | ui = true; 219 | }; 220 | diff = { 221 | colorMoved = "default"; 222 | }; 223 | merge = { 224 | conflictstyle = "zdiff3"; 225 | }; 226 | push = { 227 | default = "current"; 228 | }; 229 | pull = { 230 | ff = "only"; 231 | }; 232 | init = { 233 | defaultBranch = "main"; 234 | }; 235 | user.email = "alex@pearwin.com"; 236 | user.name = "Alex Pearwin"; 237 | # Clone git repos with URLs like "gh:alexpearce/dotfiles" 238 | url."git@github.com:" = { 239 | insteadOf = "gh:"; 240 | pushInsteadOf = "gh:"; 241 | }; 242 | }; 243 | ignores = [ 244 | ".*.swp" 245 | ".bundle" 246 | "vendor/bundle" 247 | ".DS_Store" 248 | "Icon" 249 | "*.pyc" 250 | ".direnv" 251 | ]; 252 | }; 253 | 254 | helix = { 255 | enable = true; 256 | settings = { 257 | theme = "tokyonight_moon"; 258 | editor = { 259 | bufferline = "multiple"; 260 | color-modes = true; 261 | line-number = "relative"; 262 | lsp.display-messages = true; 263 | }; 264 | keys.normal = { 265 | space.w = ":w"; 266 | space.q = ":q"; 267 | space.x = ":x"; 268 | }; 269 | }; 270 | languages.language = [ 271 | { 272 | name = "elixir"; 273 | auto-format = true; 274 | } 275 | ]; 276 | }; 277 | 278 | home-manager.enable = true; 279 | 280 | starship = { 281 | enable = true; 282 | enableFishIntegration = true; 283 | settings = { 284 | elixir.disabled = true; 285 | nodejs.disabled = true; 286 | nix_shell.disabled = true; 287 | package.disabled = true; 288 | docker_context.disabled = true; 289 | git_branch.format = "[$branch(:$remote_branch)]($style) "; 290 | }; 291 | }; 292 | 293 | zoxide = { 294 | enable = true; 295 | enableFishIntegration = true; 296 | }; 297 | }; 298 | } 299 | -------------------------------------------------------------------------------- /modules/home-manager/darwin/hammerspoon/Spoons/WindowHalfsAndThirds.spoon/init.lua: -------------------------------------------------------------------------------- 1 | --- === WindowHalfsAndThirds === 2 | --- 3 | --- Simple window movement and resizing, focusing on half- and third-of-screen sizes 4 | --- 5 | --- Download: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WindowHalfsAndThirds.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WindowHalfsAndThirds.spoon.zip) 6 | 7 | local obj={} 8 | obj.__index = obj 9 | 10 | -- Metadata 11 | obj.name = "WindowHalfsAndThirds" 12 | obj.version = "0.2" 13 | obj.author = "Diego Zamboni " 14 | obj.homepage = "https://github.com/Hammerspoon/Spoons" 15 | obj.license = "MIT - https://opensource.org/licenses/MIT" 16 | 17 | --- WindowHalfsAndThirds.logger 18 | --- Variable 19 | --- Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon. 20 | obj.logger = hs.logger.new('WindowHalfsAndThirds') 21 | 22 | --- WindowHalfsAndThirds.defaultHotkeys 23 | --- Variable 24 | --- Table containing a sample set of hotkeys that can be 25 | --- assigned to the different operations. These are not bound 26 | --- by default - if you want to use them you have to call: 27 | --- `spoon.WindowHalfsAndThirds:bindHotkeys(spoon.WindowHalfsAndThirds.defaultHotkeys)` 28 | --- after loading the spoon. Value: 29 | --- ``` 30 | --- { 31 | --- left_half = { {"ctrl", "cmd"}, "Left" }, 32 | --- right_half = { {"ctrl", "cmd"}, "Right" }, 33 | --- top_half = { {"ctrl", "cmd"}, "Up" }, 34 | --- bottom_half = { {"ctrl", "cmd"}, "Down" }, 35 | --- third_left = { {"ctrl", "alt" }, "Left" }, 36 | --- third_right = { {"ctrl", "alt" }, "Right" }, 37 | --- third_up = { {"ctrl", "alt" }, "Up" }, 38 | --- third_down = { {"ctrl", "alt" }, "Down" }, 39 | --- top_left = { {"ctrl", "cmd"}, "1" }, 40 | --- top_right = { {"ctrl", "cmd"}, "2" }, 41 | --- bottom_left = { {"ctrl", "cmd"}, "3" }, 42 | --- bottom_right= { {"ctrl", "cmd"}, "4" }, 43 | --- max_toggle = { {"ctrl", "alt", "cmd"}, "f" }, 44 | --- max = { {"ctrl", "alt", "cmd"}, "Up" }, 45 | --- undo = { { "alt", "cmd"}, "z" }, 46 | --- center = { { "alt", "cmd"}, "c" }, 47 | --- larger = { { "alt", "cmd", "shift"}, "Right" }, 48 | --- smaller = { { "alt", "cmd", "shift"}, "Left" }, 49 | --- } 50 | --- ``` 51 | obj.defaultHotkeys = { 52 | left_half = { {"ctrl", "cmd"}, "Left" }, 53 | right_half = { {"ctrl", "cmd"}, "Right" }, 54 | top_half = { {"ctrl", "cmd"}, "Up" }, 55 | bottom_half = { {"ctrl", "cmd"}, "Down" }, 56 | third_left = { {"ctrl", "alt" }, "Left" }, 57 | third_right = { {"ctrl", "alt" }, "Right" }, 58 | third_up = { {"ctrl", "alt" }, "Up" }, 59 | third_down = { {"ctrl", "alt" }, "Down" }, 60 | top_left = { {"ctrl", "cmd"}, "1" }, 61 | top_right = { {"ctrl", "cmd"}, "2" }, 62 | bottom_left = { {"ctrl", "cmd"}, "3" }, 63 | bottom_right = { {"ctrl", "cmd"}, "4" }, 64 | max_toggle = { {"ctrl", "alt", "cmd"}, "f" }, 65 | max = { {"ctrl", "alt", "cmd"}, "Up" }, 66 | undo = { { "alt", "cmd"}, "z" }, 67 | center = { { "alt", "cmd"}, "c" }, 68 | larger = { { "alt", "cmd", "shift"}, "Right" }, 69 | smaller = { { "alt", "cmd", "shift"}, "Left" }, 70 | } 71 | 72 | --- WindowHalfsAndThirds.use_frame_correctness 73 | --- Variable 74 | --- If `true`, set [setFrameCorrectness](http://www.hammerspoon.org/docs/hs.window.html#setFrameCorrectness) for some resizing operations which fail when the window extends beyonds screen boundaries. This may cause some jerkiness in the resizing, so experiment and determine if you need it. Defaults to `false` 75 | obj.use_frame_correctness = false 76 | 77 | --- WindowHalfsAndThirds.clear_cache_after_seconds 78 | --- Variable 79 | --- We don't want our undo frame cache filling all available memory. Let's clear it after it hasn't been used for a while. 80 | obj.clear_cache_after_seconds = 60 81 | 82 | -- Internal terminology: 83 | -- `actions` are the things hotkeys are bound to and express a user desire (eg. `third_left`: move a third further left 84 | -- than the current `window_state`). See the keys of obj._window_moves or the keys of action_to_method_map in 85 | -- :bindHotkeys() for the available actions 86 | -- `window_states` are states a window may be currently in (eg. `left_third`: the leftmost horizontal third of the screen) 87 | -- sometimes `actions` and `window_states` share a name (eg. `left_half`) 88 | -- sometimes `actions` and `window_states` don't share a name (`third_left`: `left_third`, `middle_third_h`, `right_third`) 89 | -- 90 | -- `window_state_names` are states windows can be in (so since `third_left` implies a relative move there is no `third_left` 91 | -- `window_state_name`, only a `third_left` `action`) 92 | -- `window_state_rects` are `{x,y,w,l}` `hs.geometry.unitrect` tables defining those states 93 | obj._window_state_name_to_rect = { 94 | left_half = {0.00,0.00,0.50,1.00}, -- two decimal places required for `window_state_rect_strings` to match 95 | left_40 = {0.00,0.00,0.40,1.00}, 96 | left_60 = {0.00,0.00,0.60,1.00}, 97 | right_half = {0.50,0.00,0.50,1.00}, 98 | right_40 = {0.60,0.00,0.40,1.00}, 99 | right_60 = {0.40,0.00,0.60,1.00}, 100 | top_half = {0.00,0.00,1.00,0.50}, 101 | top_40 = {0.00,0.00,1.00,0.40}, 102 | top_60 = {0.00,0.00,1.00,0.60}, 103 | bottom_half = {0.00,0.50,1.00,0.50}, 104 | bottom_40 = {0.00,0.60,1.00,0.40}, 105 | bottom_60 = {0.00,0.40,1.00,0.60}, 106 | left_third = {0.00,0.00,0.33,1.00}, 107 | left_two_third = {0.00,0.00,0.67,1.00}, 108 | middle_third_h = {0.33,0.00,0.34,1.00}, 109 | right_third = {0.67,0.00,0.33,1.00}, 110 | right_two_third = {0.33,0.00,0.67,1.00}, 111 | top_third = {0.00,0.00,1.00,0.33}, 112 | top_two_third = {0.00,0.00,1.00,0.67}, 113 | middle_third_v = {0.00,0.33,1.00,0.34}, 114 | bottom_third = {0.00,0.67,1.00,0.33}, 115 | bottom_two_third = {0.00,0.33,1.00,0.67}, 116 | top_left = {0.00,0.00,0.50,0.50}, 117 | top_right = {0.50,0.00,0.50,0.50}, 118 | bottom_left = {0.00,0.50,0.50,0.50}, 119 | bottom_right = {0.50,0.50,0.50,0.50}, 120 | max = {0.00,0.00,1.00,1.00}, 121 | } 122 | 123 | -- `window_state_rect_strings` because Lua does table identity comparisons in table keys instead of table content 124 | -- comparisons; that is, table["0.00,0.00,0.50,1.00"] works where table[{0.00,0.00,0.50,1.00}] doesn't 125 | obj._window_state_rect_string_to_name = {} 126 | for state,rect in pairs(obj._window_state_name_to_rect) do 127 | obj._window_state_rect_string_to_name[table.concat(rect,",")] = state 128 | end 129 | 130 | -- `window_moves` are `action` to `window_state_name` pairs 131 | -- `action` = {[`window_state_name` default], [if current `window_state_name`] = [then new `window_state_name`], ...} 132 | -- so if a user takes `action` from `window_state_name` with a key, move to the paired value `window_state_name`, 133 | -- or the default `window_state_name` the current `window_state_name` isn't a key for that `action` 134 | -- (example below) 135 | obj._window_moves = { 136 | left_half = {"left_half", left_half = "left_40", left_40 = "left_60"}, 137 | half_left = {"left_half"}, 138 | -- if `action` `left_half` is requested without a match in this table, move to `left_half` 139 | -- if `action` `left_half` is requested from `window_state_name` `left_half`, move to `left_40` 140 | -- if `action` `left_half` is requested from `window_state_name` `left_40`, move to `left_60` 141 | -- rationale: if a user requests a move to `left_half` and they're already there they're expressing a user need 142 | -- and it's our job to work out what that need is. Let's give them some other `left_half`ish options. 143 | right_half = {"right_half", right_half = "right_40", right_40 = "right_60"}, 144 | half_right = {"right_half"}, 145 | top_half = {"top_half", top_half = "top_40", top_40 = "top_60"}, 146 | half_top = {"top_half"}, 147 | bottom_half = {"bottom_half", bottom_half = "bottom_40", bottom_40 = "bottom_60"}, 148 | half_bottom = {"bottom_half"}, 149 | third_left = {"left_third", left_third = "right_third", middle_third_h = "left_third", right_third = "middle_third_h", 150 | right_half = "middle_third_h"}, 151 | third_right = {"right_third", left_third = "middle_third_h", middle_third_h = "right_third", right_third = "left_third", 152 | left_half = "middle_third_h"}, 153 | left_third = {"left_third"}, -- `left_third` is a `window_state` specific `action`, not a relative action 154 | -- it is not part of the default hotkey mapping 155 | left_two_third = {"left_two_third"}, 156 | middle_third_h = {"middle_third_h"}, 157 | right_third = {"right_third"}, 158 | right_two_third = {"right_two_third"}, 159 | third_up = {"top_third", top_third = "bottom_third", middle_third_v = "top_third", bottom_third = "middle_third_v", 160 | bottom_half = "middle_third_v"}, 161 | third_down = {"bottom_third", top_third = "middle_third_v", middle_third_v = "bottom_third", bottom_third = "top_third", 162 | top_half = "middle_third_v"}, 163 | top_third = {"top_third"}, 164 | top_two_third = {"top_two_third"}, 165 | middle_third_v = {"middle_third_v"}, 166 | bottom_third = {"bottom_third"}, 167 | bottom_two_third = {"bottom_two_third"}, 168 | top_left = {"top_left"}, 169 | top_right = {"top_right"}, 170 | bottom_left = {"bottom_left"}, 171 | bottom_right = {"bottom_right"}, 172 | max = {"max"}, 173 | } 174 | 175 | -- Private utility functions 176 | 177 | local function round(x, places) 178 | local places = places or 0 179 | local x = x * 10^places 180 | return (x + 0.5 - (x + 0.5) % 1) / 10^places 181 | end 182 | 183 | local function current_window_rect(win) 184 | local win = win or hs.window.focusedWindow() 185 | local ur, r = win:screen():toUnitRect(win:frame()), round 186 | return {r(ur.x,2), r(ur.y,2), r(ur.w,2), r(ur.h,2)} -- an hs.geometry.unitrect table 187 | end 188 | 189 | local function current_window_state_name(win) 190 | local win = win or hs.window.focusedWindow() 191 | return obj._window_state_rect_string_to_name[table.concat(current_window_rect(win),",")] 192 | end 193 | 194 | local function cacheWindow(win, move_to) 195 | local win = win or hs.window.focusedWindow() 196 | if (not win) or (not win:id()) then return end 197 | obj._frameCache[win:id()] = win:frame() 198 | obj._frameCacheClearTimer:start() 199 | obj._lastMoveCache[win:id()] = move_to 200 | return win 201 | end 202 | 203 | local function restoreWindowFromCache(win) 204 | local win = win or hs.window.focusedWindow() 205 | if (not win) or (not win:id()) or (not obj._frameCache[win:id()]) then return end 206 | local current_window_frame = win:frame() -- enable undoing an undo action 207 | win:setFrame(obj._frameCache[win:id()]) 208 | obj._frameCache[win:id()] = current_window_frame -- enable undoing an undo action 209 | return win 210 | end 211 | 212 | function obj.script_path_raw(n) 213 | return (debug.getinfo(n or 2, "S").source) 214 | end 215 | function obj.script_path(n) 216 | local str = obj.script_path_raw(n or 2):sub(2) 217 | return str:match("(.*/)") 218 | end 219 | function obj.generate_docs_json() 220 | io.open(obj.script_path().."docs.json","w"):write(hs.doc.builder.genJSON(obj.script_path())):close() 221 | end 222 | 223 | -- Internal functions to store/restore the current value of setFrameCorrectness. 224 | local function _setFrameCorrectness() 225 | obj._savedFrameCorrectness = hs.window.setFrameCorrectness 226 | hs.window.setFrameCorrectness = obj.use_frame_correctness 227 | end 228 | local function _restoreFrameCorrectness() 229 | hs.window.setFrameCorrectness = obj._savedFrameCorrectness 230 | end 231 | 232 | 233 | -- -------------------------------------------------------------------- 234 | -- Base window resizing and moving functions 235 | -- -------------------------------------------------------------------- 236 | 237 | 238 | -- Resize current window to different parts of the screen 239 | -- If use_frame_correctness_preference is true, then use setFrameCorrectness according to the 240 | -- configured value of `WindowHalfsAndThirds.use_frame_correctness` 241 | function obj.resizeCurrentWindow(how, use_frame_correctness_preference) 242 | local win = hs.window.focusedWindow() 243 | if not win then return end 244 | 245 | local move_to = obj._lastMoveCache[win:id()] and obj._window_moves[how][obj._lastMoveCache[win:id()]] or 246 | obj._window_moves[how][current_window_state_name(win)] or obj._window_moves[how][1] 247 | if not move_to then 248 | obj.logger.e("I don't know how to move ".. how .." from ".. (obj._lastMoveCache[win:id()] or 249 | current_window_state_name(win))) 250 | end 251 | if current_window_state_name(win) == move_to then return end 252 | local move_to_rect = obj._window_state_name_to_rect[move_to] 253 | if not move_to_rect then 254 | obj.logger.e("I don't know how to move to ".. move_to) 255 | return 256 | end 257 | 258 | if use_frame_correctness_preference then _setFrameCorrectness() end 259 | cacheWindow(win, move_to) 260 | win:move(move_to_rect) 261 | if use_frame_correctness_preference then _restoreFrameCorrectness() end 262 | end 263 | 264 | -- -------------------------------------------------------------------- 265 | -- Action functions for obj.resizeCurrentWindow, for the hotkeys 266 | -- -------------------------------------------------------------------- 267 | 268 | --- WindowHalfsAndThirds:leftHalf(win) 269 | --- Method 270 | --- Resize to the left half of the screen. 271 | --- 272 | --- Parameters: 273 | --- * win - hs.window to use, defaults to hs.window.focusedWindow() 274 | --- 275 | --- Returns: 276 | --- * the WindowHalfsAndThirds object 277 | --- 278 | --- Notes: 279 | --- * Variations of this method exist for other operations. See WindowHalfsAndThirds:bindHotkeys for details: 280 | --- * .leftHalf .rightHalf .topHalf .bottomHalf .thirdLeft .thirdRight .leftThird .middleThirdH .rightThird 281 | --- * .thirdUp .thirdDown .topThird .middleThirdV .bottomThird .topLeft .topRight .bottomLeft .bottomRight 282 | --- * .maximize 283 | 284 | obj.leftHalf = hs.fnutils.partial(obj.resizeCurrentWindow, "left_half") 285 | obj.halfLeft = hs.fnutils.partial(obj.resizeCurrentWindow, "half_left") 286 | obj.rightHalf = hs.fnutils.partial(obj.resizeCurrentWindow, "right_half") 287 | obj.halfRight = hs.fnutils.partial(obj.resizeCurrentWindow, "half_right") 288 | obj.topHalf = hs.fnutils.partial(obj.resizeCurrentWindow, "top_half") 289 | obj.halfTop = hs.fnutils.partial(obj.resizeCurrentWindow, "half_top") 290 | obj.bottomHalf = hs.fnutils.partial(obj.resizeCurrentWindow, "bottom_half") 291 | obj.halfBottom = hs.fnutils.partial(obj.resizeCurrentWindow, "half_bottom") 292 | obj.thirdLeft = hs.fnutils.partial(obj.resizeCurrentWindow, "third_left") 293 | obj.thirdRight = hs.fnutils.partial(obj.resizeCurrentWindow, "third_right") 294 | obj.leftThird = hs.fnutils.partial(obj.resizeCurrentWindow, "left_third") 295 | obj.leftTwoThird = hs.fnutils.partial(obj.resizeCurrentWindow, "left_two_third") 296 | obj.middleThirdH = hs.fnutils.partial(obj.resizeCurrentWindow, "middle_third_h") 297 | obj.rightThird = hs.fnutils.partial(obj.resizeCurrentWindow, "right_third") 298 | obj.rightTwoThird = hs.fnutils.partial(obj.resizeCurrentWindow, "right_two_third") 299 | obj.thirdUp = hs.fnutils.partial(obj.resizeCurrentWindow, "third_up") 300 | obj.thirdDown = hs.fnutils.partial(obj.resizeCurrentWindow, "third_down") 301 | obj.topThird = hs.fnutils.partial(obj.resizeCurrentWindow, "top_third") 302 | obj.topTwoThird = hs.fnutils.partial(obj.resizeCurrentWindow, "top_two_third") 303 | obj.middleThirdV = hs.fnutils.partial(obj.resizeCurrentWindow, "middle_third_v") 304 | obj.bottomThird = hs.fnutils.partial(obj.resizeCurrentWindow, "bottom_third") 305 | obj.bottomTwoThird = hs.fnutils.partial(obj.resizeCurrentWindow, "bottom_two_third") 306 | obj.topLeft = hs.fnutils.partial(obj.resizeCurrentWindow, "top_left") 307 | obj.topRight = hs.fnutils.partial(obj.resizeCurrentWindow, "top_right") 308 | obj.bottomLeft = hs.fnutils.partial(obj.resizeCurrentWindow, "bottom_left") 309 | obj.bottomRight = hs.fnutils.partial(obj.resizeCurrentWindow, "bottom_right") 310 | obj.maximize = hs.fnutils.partial(obj.resizeCurrentWindow, "max", true) 311 | 312 | 313 | --- WindowHalfsAndThirds:toggleMaximized(win) 314 | --- Method 315 | --- Toggle win between its normal size, and being maximized 316 | --- 317 | --- Parameters: 318 | --- * win - hs.window to use, defaults to hs.window.focusedWindow() 319 | --- 320 | --- Returns: 321 | --- * the WindowHalfsAndThirds object 322 | function obj.toggleMaximized(win) 323 | local win = win or hs.window.focusedWindow() 324 | if (not win) or (not win:id()) then 325 | return 326 | end 327 | if current_window_state_name() == "max" then 328 | restoreWindowFromCache(win) 329 | else 330 | cacheWindow(win, "max") 331 | win:maximize() 332 | end 333 | return obj 334 | end 335 | 336 | --- WindowHalfsAndThirds:undo(win) 337 | --- Method 338 | --- Undo window size changes for win if there've been any in WindowHalfsAndThirds.clear_cache_after_seconds 339 | --- 340 | --- Parameters: 341 | --- * win - hs.window to use, defaults to hs.window.focusedWindow() 342 | --- 343 | --- Returns: 344 | --- * the WindowHalfsAndThirds object 345 | function obj.undo(win) 346 | restoreWindowFromCache(win) 347 | return obj 348 | end 349 | 350 | --- WindowHalfsAndThirds:center(win) 351 | --- Method 352 | --- Center window on screen 353 | --- 354 | --- Parameters: 355 | --- * win - hs.window to use, defaults to hs.window.focusedWindow() 356 | --- 357 | --- Returns: 358 | --- * the WindowHalfsAndThirds object 359 | function obj.center(win) 360 | local win = win or hs.window.focusedWindow() 361 | if win then 362 | cacheWindow(win, "center") 363 | win:centerOnScreen() 364 | end 365 | return obj 366 | end 367 | 368 | --- WindowHalfsAndThirds:larger(win) 369 | --- Method 370 | --- Make win larger than its current size 371 | --- 372 | --- Parameters: 373 | --- * win - hs.window to use, defaults to hs.window.focusedWindow() 374 | --- 375 | --- Returns: 376 | --- * the WindowHalfsAndThirds object 377 | function obj.larger(win) 378 | local win = win or hs.window.focusedWindow() 379 | if win then 380 | cacheWindow(win, nil) 381 | local cw = current_window_rect(win) 382 | local move_to_rect = {} 383 | move_to_rect[1] = math.max(cw[1]-0.02,0) 384 | move_to_rect[2] = math.max(cw[2]-0.02,0) 385 | move_to_rect[3] = math.min(cw[3]+0.04,1 - move_to_rect[1]) 386 | move_to_rect[4] = math.min(cw[4]+0.04,1 - move_to_rect[2]) 387 | win:move(move_to_rect) 388 | end 389 | return obj 390 | end 391 | 392 | --- WindowHalfsAndThirds:smaller(win) 393 | --- Method 394 | --- Make win smaller than its current size 395 | --- 396 | --- Parameters: 397 | --- * win - hs.window to use, defaults to hs.window.focusedWindow() 398 | --- 399 | --- Returns: 400 | --- * the WindowHalfsAndThirds object 401 | function obj.smaller(win) 402 | local win = win or hs.window.focusedWindow() 403 | if win then 404 | cacheWindow(win, nil) 405 | local cw = current_window_rect(win) 406 | local move_to_rect = {} 407 | move_to_rect[3] = math.max(cw[3]-0.04,0.1) 408 | move_to_rect[4] = cw[4] > 0.95 and 1 or math.max(cw[4]-0.04,0.1) -- some windows (MacVim) don't size to 1 409 | move_to_rect[1] = math.min(cw[1]+0.02,1 - move_to_rect[3]) 410 | move_to_rect[2] = cw[2] == 0 and 0 or math.min(cw[2]+0.02,1 - move_to_rect[4]) 411 | win:move(move_to_rect) 412 | end 413 | return obj 414 | end 415 | 416 | --- WindowHalfsAndThirds:bindHotkeys(mapping) 417 | --- Method 418 | --- Binds hotkeys for WindowHalfsAndThirds 419 | --- 420 | --- Parameters: 421 | --- * mapping - A table containing hotkey objifier/key details for the following items: 422 | --- * left_half, right_half, top_half, bottom_half - resize to the corresponding half of the screen 423 | --- * third_left, third_right - resize to one horizontal-third of the screen and move left/right 424 | --- * third_up, third_down - resize to one vertical-third of the screen and move up/down 425 | --- * max - maximize the window 426 | --- * max_toggle - toggle maximization 427 | --- * left_third, middle_third_h, right_third - resize and move the window to the corresponding horizontal third of the screen 428 | --- * top_third, middle_third_v, bottom_third - resize and move the window to the corresponding vertical third of the screen 429 | --- * top_left, top_right, bottom_left, bottom_right - resize and move the window to the corresponding quarter of the screen 430 | --- * undo - restore window to position before last move 431 | --- * center - move window to center of screen 432 | --- * larger - grow window larger than its current size 433 | --- * smaller - shrink window smaller than its current size 434 | --- 435 | --- Returns: 436 | --- * the WindowHalfsAndThirds object 437 | function obj:bindHotkeys(mapping) 438 | local action_to_method_map = { 439 | left_half = self.leftHalf, 440 | half_left = self.halfLeft, 441 | right_half = self.rightHalf, 442 | half_right = self.halfRight, 443 | top_half = self.topHalf, 444 | half_top = self.halfTop, 445 | bottom_half = self.bottomHalf, 446 | half_bottom = self.halfBottom, 447 | third_left = self.thirdLeft, 448 | third_right = self.thirdRight, 449 | third_up = self.thirdUp, 450 | third_down = self.thirdDown, 451 | max = self.maximize, 452 | max_toggle = self.toggleMaximized, 453 | left_third = self.leftThird, 454 | left_two_third = self.leftTwoThird, 455 | middle_third_h = self.middleThirdH, 456 | right_third = self.rightThird, 457 | right_two_third = self.rightTwoThird, 458 | top_third = self.topThird, 459 | top_two_third = self.topTwoThird, 460 | middle_third_v = self.middleThirdV, 461 | bottom_third = self.bottomThird, 462 | bottom_two_third = self.bottomTwoThird, 463 | top_left = self.topLeft, 464 | top_right = self.topRight, 465 | bottom_left = self.bottomLeft, 466 | bottom_right = self.bottomRight, 467 | undo = self.undo, 468 | center = self.center, 469 | larger = self.larger, 470 | smaller = self.smaller, 471 | -- Legacy (`action` names changed for internal consistency, old names preserved) 472 | left = self.leftHalf, 473 | right = self.rightHalf, 474 | top = self.topHalf, 475 | bottom = self.bottomHalf, 476 | } 477 | hs.spoons.bindHotkeysToSpec(action_to_method_map, mapping) 478 | return self 479 | end 480 | 481 | function obj:init() 482 | self._frameCache = {} 483 | obj._lastMoveCache = {} 484 | self._frameCacheClearTimer = hs.timer.delayed.new(obj.clear_cache_after_seconds, 485 | function() obj._frameCache = {}; obj._lastMoveCache = {} end) 486 | end 487 | 488 | 489 | -- Legacy (names changed for internal consistency, old names preserved) 490 | function obj.oneThirdLeft() obj.thirdLeft() end 491 | function obj.oneThirdRight() obj.thirdRight() end 492 | function obj.oneThirdUp() obj.thirdUp() end 493 | function obj.onethirdDown() obj.thirdDown() end 494 | 495 | 496 | return obj 497 | 498 | -------------------------------------------------------------------------------- /modules/home-manager/darwin/hammerspoon/Spoons/WindowHalfsAndThirds.spoon/docs.json: -------------------------------------------------------------------------------- 1 | [ 2 | { 3 | "Command": [], 4 | "Constant": [], 5 | "Constructor": [], 6 | "Deprecated": [], 7 | "Field": [], 8 | "Function": [], 9 | "Method": [ 10 | { 11 | "def": "WindowHalfsAndThirds:bindHotkeys(mapping)", 12 | "desc": "Binds hotkeys for WindowHalfsAndThirds", 13 | "doc": "Binds hotkeys for WindowHalfsAndThirds\n\nParameters:\n * mapping - A table containing hotkey objifier/key details for the following items:\n * left_half, right_half, top_half, bottom_half - resize to the corresponding half of the screen\n * third_left, third_right - resize to one horizontal-third of the screen and move left/right\n * third_up, third_down - resize to one vertical-third of the screen and move up/down\n * max - maximize the window\n * max_toggle - toggle maximization\n * left_third, middle_third_h, right_third - resize and move the window to the corresponding horizontal third of the screen\n * top_third, middle_third_v, bottom_third - resize and move the window to the corresponding vertical third of the screen\n * top_left, top_right, bottom_left, bottom_right - resize and move the window to the corresponding quarter of the screen\n * undo - restore window to position before last move\n * center - move window to center of screen\n * larger - grow window larger than its current size\n * smaller - shrink window smaller than its current size\n\nReturns:\n * the WindowHalfsAndThirds object", 14 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 15 | "lineno": "416", 16 | "name": "bindHotkeys", 17 | "parameters": [ 18 | " * mapping - A table containing hotkey objifier/key details for the following items:", 19 | " * left_half, right_half, top_half, bottom_half - resize to the corresponding half of the screen", 20 | " * third_left, third_right - resize to one horizontal-third of the screen and move left/right", 21 | " * third_up, third_down - resize to one vertical-third of the screen and move up/down", 22 | " * max - maximize the window", 23 | " * max_toggle - toggle maximization", 24 | " * left_third, middle_third_h, right_third - resize and move the window to the corresponding horizontal third of the screen", 25 | " * top_third, middle_third_v, bottom_third - resize and move the window to the corresponding vertical third of the screen", 26 | " * top_left, top_right, bottom_left, bottom_right - resize and move the window to the corresponding quarter of the screen", 27 | " * undo - restore window to position before last move", 28 | " * center - move window to center of screen", 29 | " * larger - grow window larger than its current size", 30 | " * smaller - shrink window smaller than its current size" 31 | ], 32 | "returns": [ 33 | " * the WindowHalfsAndThirds object" 34 | ], 35 | "signature": "WindowHalfsAndThirds:bindHotkeys(mapping)", 36 | "stripped_doc": "", 37 | "type": "Method" 38 | }, 39 | { 40 | "def": "WindowHalfsAndThirds:center(win)", 41 | "desc": "Center window on screen", 42 | "doc": "Center window on screen\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object", 43 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 44 | "lineno": "350", 45 | "name": "center", 46 | "parameters": [ 47 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 48 | ], 49 | "returns": [ 50 | " * the WindowHalfsAndThirds object" 51 | ], 52 | "signature": "WindowHalfsAndThirds:center(win)", 53 | "stripped_doc": "", 54 | "type": "Method" 55 | }, 56 | { 57 | "def": "WindowHalfsAndThirds:larger(win)", 58 | "desc": "Make win larger than its current size", 59 | "doc": "Make win larger than its current size\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object", 60 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 61 | "lineno": "368", 62 | "name": "larger", 63 | "parameters": [ 64 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 65 | ], 66 | "returns": [ 67 | " * the WindowHalfsAndThirds object" 68 | ], 69 | "signature": "WindowHalfsAndThirds:larger(win)", 70 | "stripped_doc": "", 71 | "type": "Method" 72 | }, 73 | { 74 | "def": "WindowHalfsAndThirds:leftHalf(win)", 75 | "desc": "Resize to the left half of the screen.", 76 | "doc": "Resize to the left half of the screen.\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object\n\nNotes:\n * Variations of this method exist for other operations. See WindowHalfsAndThirds:bindHotkeys for details:\n * .leftHalf .rightHalf .topHalf .bottomHalf .thirdLeft .thirdRight .leftThird .middleThirdH .rightThird\n * .thirdUp .thirdDown .topThird .middleThirdV .bottomThird .topLeft .topRight .bottomLeft .bottomRight\n * .maximize", 77 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 78 | "lineno": "268", 79 | "name": "leftHalf", 80 | "notes": [ 81 | " * Variations of this method exist for other operations. See WindowHalfsAndThirds:bindHotkeys for details:", 82 | " * .leftHalf .rightHalf .topHalf .bottomHalf .thirdLeft .thirdRight .leftThird .middleThirdH .rightThird", 83 | " * .thirdUp .thirdDown .topThird .middleThirdV .bottomThird .topLeft .topRight .bottomLeft .bottomRight", 84 | " * .maximize" 85 | ], 86 | "parameters": [ 87 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 88 | ], 89 | "returns": [ 90 | " * the WindowHalfsAndThirds object" 91 | ], 92 | "signature": "WindowHalfsAndThirds:leftHalf(win)", 93 | "stripped_doc": "", 94 | "type": "Method" 95 | }, 96 | { 97 | "def": "WindowHalfsAndThirds:smaller(win)", 98 | "desc": "Make win smaller than its current size", 99 | "doc": "Make win smaller than its current size\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object", 100 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 101 | "lineno": "392", 102 | "name": "smaller", 103 | "parameters": [ 104 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 105 | ], 106 | "returns": [ 107 | " * the WindowHalfsAndThirds object" 108 | ], 109 | "signature": "WindowHalfsAndThirds:smaller(win)", 110 | "stripped_doc": "", 111 | "type": "Method" 112 | }, 113 | { 114 | "def": "WindowHalfsAndThirds:toggleMaximized(win)", 115 | "desc": "Toggle win between its normal size, and being maximized", 116 | "doc": "Toggle win between its normal size, and being maximized\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object", 117 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 118 | "lineno": "313", 119 | "name": "toggleMaximized", 120 | "parameters": [ 121 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 122 | ], 123 | "returns": [ 124 | " * the WindowHalfsAndThirds object" 125 | ], 126 | "signature": "WindowHalfsAndThirds:toggleMaximized(win)", 127 | "stripped_doc": "", 128 | "type": "Method" 129 | }, 130 | { 131 | "def": "WindowHalfsAndThirds:undo(win)", 132 | "desc": "Undo window size changes for win if there've been any in WindowHalfsAndThirds.clear_cache_after_seconds", 133 | "doc": "Undo window size changes for win if there've been any in WindowHalfsAndThirds.clear_cache_after_seconds\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object", 134 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 135 | "lineno": "336", 136 | "name": "undo", 137 | "parameters": [ 138 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 139 | ], 140 | "returns": [ 141 | " * the WindowHalfsAndThirds object" 142 | ], 143 | "signature": "WindowHalfsAndThirds:undo(win)", 144 | "stripped_doc": "", 145 | "type": "Method" 146 | } 147 | ], 148 | "Variable": [ 149 | { 150 | "def": "WindowHalfsAndThirds.clear_cache_after_seconds", 151 | "desc": "We don't want our undo frame cache filling all available memory. Let's clear it after it hasn't been used for a while.", 152 | "doc": "We don't want our undo frame cache filling all available memory. Let's clear it after it hasn't been used for a while.", 153 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 154 | "lineno": "77", 155 | "name": "clear_cache_after_seconds", 156 | "signature": "WindowHalfsAndThirds.clear_cache_after_seconds", 157 | "stripped_doc": "", 158 | "type": "Variable" 159 | }, 160 | { 161 | "def": "WindowHalfsAndThirds.defaultHotkeys", 162 | "desc": "Table containing a sample set of hotkeys that can be", 163 | "doc": "Table containing a sample set of hotkeys that can be\nassigned to the different operations. These are not bound\nby default - if you want to use them you have to call:\n`spoon.WindowHalfsAndThirds:bindHotkeys(spoon.WindowHalfsAndThirds.defaultHotkeys)`\nafter loading the spoon. Value:\n```\n {\n left_half = { {\"ctrl\", \"cmd\"}, \"Left\" },\n right_half = { {\"ctrl\", \"cmd\"}, \"Right\" },\n top_half = { {\"ctrl\", \"cmd\"}, \"Up\" },\n bottom_half = { {\"ctrl\", \"cmd\"}, \"Down\" },\n third_left = { {\"ctrl\", \"alt\" }, \"Left\" },\n third_right = { {\"ctrl\", \"alt\" }, \"Right\" },\n third_up = { {\"ctrl\", \"alt\" }, \"Up\" },\n third_down = { {\"ctrl\", \"alt\" }, \"Down\" },\n top_left = { {\"ctrl\", \"cmd\"}, \"1\" },\n top_right = { {\"ctrl\", \"cmd\"}, \"2\" },\n bottom_left = { {\"ctrl\", \"cmd\"}, \"3\" },\n bottom_right= { {\"ctrl\", \"cmd\"}, \"4\" },\n max_toggle = { {\"ctrl\", \"alt\", \"cmd\"}, \"f\" },\n max = { {\"ctrl\", \"alt\", \"cmd\"}, \"Up\" },\n undo = { { \"alt\", \"cmd\"}, \"z\" },\n center = { { \"alt\", \"cmd\"}, \"c\" },\n larger = { { \"alt\", \"cmd\", \"shift\"}, \"Right\" },\n smaller = { { \"alt\", \"cmd\", \"shift\"}, \"Left\" },\n }\n```", 164 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 165 | "lineno": "22", 166 | "name": "defaultHotkeys", 167 | "signature": "WindowHalfsAndThirds.defaultHotkeys", 168 | "stripped_doc": "assigned to the different operations. These are not bound\nby default - if you want to use them you have to call:\n`spoon.WindowHalfsAndThirds:bindHotkeys(spoon.WindowHalfsAndThirds.defaultHotkeys)`\nafter loading the spoon. Value:\n```\n {\n left_half = { {\"ctrl\", \"cmd\"}, \"Left\" },\n right_half = { {\"ctrl\", \"cmd\"}, \"Right\" },\n top_half = { {\"ctrl\", \"cmd\"}, \"Up\" },\n bottom_half = { {\"ctrl\", \"cmd\"}, \"Down\" },\n third_left = { {\"ctrl\", \"alt\" }, \"Left\" },\n third_right = { {\"ctrl\", \"alt\" }, \"Right\" },\n third_up = { {\"ctrl\", \"alt\" }, \"Up\" },\n third_down = { {\"ctrl\", \"alt\" }, \"Down\" },\n top_left = { {\"ctrl\", \"cmd\"}, \"1\" },\n top_right = { {\"ctrl\", \"cmd\"}, \"2\" },\n bottom_left = { {\"ctrl\", \"cmd\"}, \"3\" },\n bottom_right= { {\"ctrl\", \"cmd\"}, \"4\" },\n max_toggle = { {\"ctrl\", \"alt\", \"cmd\"}, \"f\" },\n max = { {\"ctrl\", \"alt\", \"cmd\"}, \"Up\" },\n undo = { { \"alt\", \"cmd\"}, \"z\" },\n center = { { \"alt\", \"cmd\"}, \"c\" },\n larger = { { \"alt\", \"cmd\", \"shift\"}, \"Right\" },\n smaller = { { \"alt\", \"cmd\", \"shift\"}, \"Left\" },\n }\n```", 169 | "type": "Variable" 170 | }, 171 | { 172 | "def": "WindowHalfsAndThirds.logger", 173 | "desc": "Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.", 174 | "doc": "Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.", 175 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 176 | "lineno": "17", 177 | "name": "logger", 178 | "signature": "WindowHalfsAndThirds.logger", 179 | "stripped_doc": "", 180 | "type": "Variable" 181 | }, 182 | { 183 | "def": "WindowHalfsAndThirds.use_frame_correctness", 184 | "desc": "If `true`, set [setFrameCorrectness](http://www.hammerspoon.org/docs/hs.window.html#setFrameCorrectness) for some resizing operations which fail when the window extends beyonds screen boundaries. This may cause some jerkiness in the resizing, so experiment and determine if you need it. Defaults to `false`", 185 | "doc": "If `true`, set [setFrameCorrectness](http://www.hammerspoon.org/docs/hs.window.html#setFrameCorrectness) for some resizing operations which fail when the window extends beyonds screen boundaries. This may cause some jerkiness in the resizing, so experiment and determine if you need it. Defaults to `false`", 186 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 187 | "lineno": "72", 188 | "name": "use_frame_correctness", 189 | "signature": "WindowHalfsAndThirds.use_frame_correctness", 190 | "stripped_doc": "", 191 | "type": "Variable" 192 | } 193 | ], 194 | "desc": "Simple window movement and resizing, focusing on half- and third-of-screen sizes", 195 | "doc": "Simple window movement and resizing, focusing on half- and third-of-screen sizes\n\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WindowHalfsAndThirds.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WindowHalfsAndThirds.spoon.zip)", 196 | "items": [ 197 | { 198 | "def": "WindowHalfsAndThirds:bindHotkeys(mapping)", 199 | "desc": "Binds hotkeys for WindowHalfsAndThirds", 200 | "doc": "Binds hotkeys for WindowHalfsAndThirds\n\nParameters:\n * mapping - A table containing hotkey objifier/key details for the following items:\n * left_half, right_half, top_half, bottom_half - resize to the corresponding half of the screen\n * third_left, third_right - resize to one horizontal-third of the screen and move left/right\n * third_up, third_down - resize to one vertical-third of the screen and move up/down\n * max - maximize the window\n * max_toggle - toggle maximization\n * left_third, middle_third_h, right_third - resize and move the window to the corresponding horizontal third of the screen\n * top_third, middle_third_v, bottom_third - resize and move the window to the corresponding vertical third of the screen\n * top_left, top_right, bottom_left, bottom_right - resize and move the window to the corresponding quarter of the screen\n * undo - restore window to position before last move\n * center - move window to center of screen\n * larger - grow window larger than its current size\n * smaller - shrink window smaller than its current size\n\nReturns:\n * the WindowHalfsAndThirds object", 201 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 202 | "lineno": "416", 203 | "name": "bindHotkeys", 204 | "parameters": [ 205 | " * mapping - A table containing hotkey objifier/key details for the following items:", 206 | " * left_half, right_half, top_half, bottom_half - resize to the corresponding half of the screen", 207 | " * third_left, third_right - resize to one horizontal-third of the screen and move left/right", 208 | " * third_up, third_down - resize to one vertical-third of the screen and move up/down", 209 | " * max - maximize the window", 210 | " * max_toggle - toggle maximization", 211 | " * left_third, middle_third_h, right_third - resize and move the window to the corresponding horizontal third of the screen", 212 | " * top_third, middle_third_v, bottom_third - resize and move the window to the corresponding vertical third of the screen", 213 | " * top_left, top_right, bottom_left, bottom_right - resize and move the window to the corresponding quarter of the screen", 214 | " * undo - restore window to position before last move", 215 | " * center - move window to center of screen", 216 | " * larger - grow window larger than its current size", 217 | " * smaller - shrink window smaller than its current size" 218 | ], 219 | "returns": [ 220 | " * the WindowHalfsAndThirds object" 221 | ], 222 | "signature": "WindowHalfsAndThirds:bindHotkeys(mapping)", 223 | "stripped_doc": "", 224 | "type": "Method" 225 | }, 226 | { 227 | "def": "WindowHalfsAndThirds:center(win)", 228 | "desc": "Center window on screen", 229 | "doc": "Center window on screen\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object", 230 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 231 | "lineno": "350", 232 | "name": "center", 233 | "parameters": [ 234 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 235 | ], 236 | "returns": [ 237 | " * the WindowHalfsAndThirds object" 238 | ], 239 | "signature": "WindowHalfsAndThirds:center(win)", 240 | "stripped_doc": "", 241 | "type": "Method" 242 | }, 243 | { 244 | "def": "WindowHalfsAndThirds.clear_cache_after_seconds", 245 | "desc": "We don't want our undo frame cache filling all available memory. Let's clear it after it hasn't been used for a while.", 246 | "doc": "We don't want our undo frame cache filling all available memory. Let's clear it after it hasn't been used for a while.", 247 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 248 | "lineno": "77", 249 | "name": "clear_cache_after_seconds", 250 | "signature": "WindowHalfsAndThirds.clear_cache_after_seconds", 251 | "stripped_doc": "", 252 | "type": "Variable" 253 | }, 254 | { 255 | "def": "WindowHalfsAndThirds.defaultHotkeys", 256 | "desc": "Table containing a sample set of hotkeys that can be", 257 | "doc": "Table containing a sample set of hotkeys that can be\nassigned to the different operations. These are not bound\nby default - if you want to use them you have to call:\n`spoon.WindowHalfsAndThirds:bindHotkeys(spoon.WindowHalfsAndThirds.defaultHotkeys)`\nafter loading the spoon. Value:\n```\n {\n left_half = { {\"ctrl\", \"cmd\"}, \"Left\" },\n right_half = { {\"ctrl\", \"cmd\"}, \"Right\" },\n top_half = { {\"ctrl\", \"cmd\"}, \"Up\" },\n bottom_half = { {\"ctrl\", \"cmd\"}, \"Down\" },\n third_left = { {\"ctrl\", \"alt\" }, \"Left\" },\n third_right = { {\"ctrl\", \"alt\" }, \"Right\" },\n third_up = { {\"ctrl\", \"alt\" }, \"Up\" },\n third_down = { {\"ctrl\", \"alt\" }, \"Down\" },\n top_left = { {\"ctrl\", \"cmd\"}, \"1\" },\n top_right = { {\"ctrl\", \"cmd\"}, \"2\" },\n bottom_left = { {\"ctrl\", \"cmd\"}, \"3\" },\n bottom_right= { {\"ctrl\", \"cmd\"}, \"4\" },\n max_toggle = { {\"ctrl\", \"alt\", \"cmd\"}, \"f\" },\n max = { {\"ctrl\", \"alt\", \"cmd\"}, \"Up\" },\n undo = { { \"alt\", \"cmd\"}, \"z\" },\n center = { { \"alt\", \"cmd\"}, \"c\" },\n larger = { { \"alt\", \"cmd\", \"shift\"}, \"Right\" },\n smaller = { { \"alt\", \"cmd\", \"shift\"}, \"Left\" },\n }\n```", 258 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 259 | "lineno": "22", 260 | "name": "defaultHotkeys", 261 | "signature": "WindowHalfsAndThirds.defaultHotkeys", 262 | "stripped_doc": "assigned to the different operations. These are not bound\nby default - if you want to use them you have to call:\n`spoon.WindowHalfsAndThirds:bindHotkeys(spoon.WindowHalfsAndThirds.defaultHotkeys)`\nafter loading the spoon. Value:\n```\n {\n left_half = { {\"ctrl\", \"cmd\"}, \"Left\" },\n right_half = { {\"ctrl\", \"cmd\"}, \"Right\" },\n top_half = { {\"ctrl\", \"cmd\"}, \"Up\" },\n bottom_half = { {\"ctrl\", \"cmd\"}, \"Down\" },\n third_left = { {\"ctrl\", \"alt\" }, \"Left\" },\n third_right = { {\"ctrl\", \"alt\" }, \"Right\" },\n third_up = { {\"ctrl\", \"alt\" }, \"Up\" },\n third_down = { {\"ctrl\", \"alt\" }, \"Down\" },\n top_left = { {\"ctrl\", \"cmd\"}, \"1\" },\n top_right = { {\"ctrl\", \"cmd\"}, \"2\" },\n bottom_left = { {\"ctrl\", \"cmd\"}, \"3\" },\n bottom_right= { {\"ctrl\", \"cmd\"}, \"4\" },\n max_toggle = { {\"ctrl\", \"alt\", \"cmd\"}, \"f\" },\n max = { {\"ctrl\", \"alt\", \"cmd\"}, \"Up\" },\n undo = { { \"alt\", \"cmd\"}, \"z\" },\n center = { { \"alt\", \"cmd\"}, \"c\" },\n larger = { { \"alt\", \"cmd\", \"shift\"}, \"Right\" },\n smaller = { { \"alt\", \"cmd\", \"shift\"}, \"Left\" },\n }\n```", 263 | "type": "Variable" 264 | }, 265 | { 266 | "def": "WindowHalfsAndThirds:larger(win)", 267 | "desc": "Make win larger than its current size", 268 | "doc": "Make win larger than its current size\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object", 269 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 270 | "lineno": "368", 271 | "name": "larger", 272 | "parameters": [ 273 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 274 | ], 275 | "returns": [ 276 | " * the WindowHalfsAndThirds object" 277 | ], 278 | "signature": "WindowHalfsAndThirds:larger(win)", 279 | "stripped_doc": "", 280 | "type": "Method" 281 | }, 282 | { 283 | "def": "WindowHalfsAndThirds:leftHalf(win)", 284 | "desc": "Resize to the left half of the screen.", 285 | "doc": "Resize to the left half of the screen.\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object\n\nNotes:\n * Variations of this method exist for other operations. See WindowHalfsAndThirds:bindHotkeys for details:\n * .leftHalf .rightHalf .topHalf .bottomHalf .thirdLeft .thirdRight .leftThird .middleThirdH .rightThird\n * .thirdUp .thirdDown .topThird .middleThirdV .bottomThird .topLeft .topRight .bottomLeft .bottomRight\n * .maximize", 286 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 287 | "lineno": "268", 288 | "name": "leftHalf", 289 | "notes": [ 290 | " * Variations of this method exist for other operations. See WindowHalfsAndThirds:bindHotkeys for details:", 291 | " * .leftHalf .rightHalf .topHalf .bottomHalf .thirdLeft .thirdRight .leftThird .middleThirdH .rightThird", 292 | " * .thirdUp .thirdDown .topThird .middleThirdV .bottomThird .topLeft .topRight .bottomLeft .bottomRight", 293 | " * .maximize" 294 | ], 295 | "parameters": [ 296 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 297 | ], 298 | "returns": [ 299 | " * the WindowHalfsAndThirds object" 300 | ], 301 | "signature": "WindowHalfsAndThirds:leftHalf(win)", 302 | "stripped_doc": "", 303 | "type": "Method" 304 | }, 305 | { 306 | "def": "WindowHalfsAndThirds.logger", 307 | "desc": "Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.", 308 | "doc": "Logger object used within the Spoon. Can be accessed to set the default log level for the messages coming from the Spoon.", 309 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 310 | "lineno": "17", 311 | "name": "logger", 312 | "signature": "WindowHalfsAndThirds.logger", 313 | "stripped_doc": "", 314 | "type": "Variable" 315 | }, 316 | { 317 | "def": "WindowHalfsAndThirds:smaller(win)", 318 | "desc": "Make win smaller than its current size", 319 | "doc": "Make win smaller than its current size\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object", 320 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 321 | "lineno": "392", 322 | "name": "smaller", 323 | "parameters": [ 324 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 325 | ], 326 | "returns": [ 327 | " * the WindowHalfsAndThirds object" 328 | ], 329 | "signature": "WindowHalfsAndThirds:smaller(win)", 330 | "stripped_doc": "", 331 | "type": "Method" 332 | }, 333 | { 334 | "def": "WindowHalfsAndThirds:toggleMaximized(win)", 335 | "desc": "Toggle win between its normal size, and being maximized", 336 | "doc": "Toggle win between its normal size, and being maximized\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object", 337 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 338 | "lineno": "313", 339 | "name": "toggleMaximized", 340 | "parameters": [ 341 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 342 | ], 343 | "returns": [ 344 | " * the WindowHalfsAndThirds object" 345 | ], 346 | "signature": "WindowHalfsAndThirds:toggleMaximized(win)", 347 | "stripped_doc": "", 348 | "type": "Method" 349 | }, 350 | { 351 | "def": "WindowHalfsAndThirds:undo(win)", 352 | "desc": "Undo window size changes for win if there've been any in WindowHalfsAndThirds.clear_cache_after_seconds", 353 | "doc": "Undo window size changes for win if there've been any in WindowHalfsAndThirds.clear_cache_after_seconds\n\nParameters:\n * win - hs.window to use, defaults to hs.window.focusedWindow()\n\nReturns:\n * the WindowHalfsAndThirds object", 354 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 355 | "lineno": "336", 356 | "name": "undo", 357 | "parameters": [ 358 | " * win - hs.window to use, defaults to hs.window.focusedWindow()" 359 | ], 360 | "returns": [ 361 | " * the WindowHalfsAndThirds object" 362 | ], 363 | "signature": "WindowHalfsAndThirds:undo(win)", 364 | "stripped_doc": "", 365 | "type": "Method" 366 | }, 367 | { 368 | "def": "WindowHalfsAndThirds.use_frame_correctness", 369 | "desc": "If `true`, set [setFrameCorrectness](http://www.hammerspoon.org/docs/hs.window.html#setFrameCorrectness) for some resizing operations which fail when the window extends beyonds screen boundaries. This may cause some jerkiness in the resizing, so experiment and determine if you need it. Defaults to `false`", 370 | "doc": "If `true`, set [setFrameCorrectness](http://www.hammerspoon.org/docs/hs.window.html#setFrameCorrectness) for some resizing operations which fail when the window extends beyonds screen boundaries. This may cause some jerkiness in the resizing, so experiment and determine if you need it. Defaults to `false`", 371 | "file": "Source/WindowHalfsAndThirds.spoon//init.lua", 372 | "lineno": "72", 373 | "name": "use_frame_correctness", 374 | "signature": "WindowHalfsAndThirds.use_frame_correctness", 375 | "stripped_doc": "", 376 | "type": "Variable" 377 | } 378 | ], 379 | "name": "WindowHalfsAndThirds", 380 | "stripped_doc": "\nDownload: [https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WindowHalfsAndThirds.spoon.zip](https://github.com/Hammerspoon/Spoons/raw/master/Spoons/WindowHalfsAndThirds.spoon.zip)", 381 | "submodules": [], 382 | "type": "Module" 383 | } 384 | ] --------------------------------------------------------------------------------