diff --git a/config.json b/config.json index 9f52ce5..3adf4d6 100644 --- a/config.json +++ b/config.json @@ -40,77 +40,72 @@ "zsh" ], "casks": [ - "alfred", - "bettertouchtool", - "brave-browser", - "dash", - "fantastical", - "font-fira-code", - "font-fira-mono", - {"name": "franz", "when": "home"}, - {"name": "gog-galaxy", "when": "home"}, - "hammerspoon", - "iina", - {"name": "iridient-developer", "when": "home"}, - {"name": "java8", "when": "home"}, - "keka", - {"name": "keybase", "when": "home"}, - "lunchy", - {"name": "openemu", "when": "home"}, - "osxfuse", - "racket", - {"name": "signal", "when": "home"}, - "hammerspoon", - "iina", - "java", - "java8", - "keka", - "lunchy", - "osxfuse", - {"name": "transmission", "when": "home"}, - "virtualbox", - {"name": "vmware-fusion", "when": "home"}, - "xquartz" + "alfred", + {"name": "arq", "when": "home"}, + "bettertouchtool", + "brave-browser", + "dash", + {"name": "epic-games", "when": "home"}, + "fantastical", + "firefox", + "font-fira-code", + "font-fira-mono", + {"name": "franz", "when": "home"}, + {"name": "gog-galaxy", "when": "home"}, + "hammerspoon", + "iina", + {"name": "iridient-developer", "when": "home"}, + {"name": "java8", "when": "home"}, + "keka", + {"name": "keybase", "when": "home"}, + "lunchy", + {"name": "openemu", "when": "home"}, + "osxfuse", + "racket", + {"name": "signal", "when": "home"}, + "skim", + {"name": "steam", "when": "home"}, + {"name": "transmission", "when": "home"}, + "virtualbox", + {"name": "vmware-fusion", "when": "home"}, + "xquartz" ], "mas": [ - "Things3", - "Xcode", - "Paprika Recipe Manager 3", - "Keep It", - "Pixelmator", - "Kindle", - "Time Out", - "1Password 7" + "Xcode", + "Paprika Recipe Manager 3", + "Pixelmator", + "Kindle", + "Time Out", + "1Password 7" ], "sources": { - "https://github.com/larkery/zsh-histdb.git": "~/.zsh-histdb/", - "https://github.com/zsh-users/zsh-autosuggestions", "~/.zsh/zsh-autosuggestions", - "https://github.com/asdf-vm/asdf.git": { - "destination": "~/.asdf", - "post-install": "cd ~/.asdf && git checkout \"$(git describe --abbrev=0 --tags)\"" - }, - "https://github.com/tarjoilija/zgen": { - "symlinks": { - "zgen.zsh": "~/.zgen.zsh", - "_zgen": "~/.zsh/_zgen" - } - }, - "https://github.com/scottwhudson/Lunette.git": { - "symlinks": { - "Lunette.spoon": "~/.hammerspoon/Spoons/" - } + "https://github.com/larkery/zsh-histdb.git": "~/.zsh-histdb/", + "https://github.com/asdf-vm/asdf.git": { + "destination": "~/.asdf", + "post-install": "cd ~/.asdf && git checkout \"$(git describe --abbrev=0 --tags)\"" + }, + "https://github.com/tarjoilija/zgen": { + "symlinks": { + "zgen.zsh": "~/.zgen.zsh", + "_zgen": "~/.zsh/_zgen" } + }, + "https://github.com/scottwhudson/Lunette.git": { + "symlinks": { + "Lunette.spoon": "~/.hammerspoon/Spoons/" + } + } }, "symlinks": { - "dots/.*": "~/", - "zsh/*": "~/.config/zsh/config.sh", - "bin/*": "~/.local/bin/", - "config/*": "~/.config/", - "launchagents/*.plist":"~/Library/LaunchAgents/", - "hammerspoon/*": "~/.hammerspoon/" + "dots/.*": "~/", + "zsh/*": "~/.config/zsh/config.sh", + "bin/*": "~/.local/bin/", + "config/*": "~/.config/", + "launchagents/*.plist":"~/Library/LaunchAgents/", + "hammerspoon/*": "~/.hammerspoon/" }, "post-install": [ - "brew cleanup", - "find ~/Library/LaunchAgents -name '*.plist' | xargs launchctl load" + "brew cleanup", + "find ~/Library/LaunchAgents -name '*.plist' | xargs launchctl load" ] } diff --git a/config/karabiner/karabiner.json b/config/karabiner/karabiner.json index cdab411..6421367 100644 --- a/config/karabiner/karabiner.json +++ b/config/karabiner/karabiner.json @@ -75,6 +75,140 @@ "type": "basic" } ] + }, + { + "description": "SpaceFN: Space enables SpaceFN mode (see: https://geekhack.org/index.php?topic=51069.0)", + "manipulators": [ + { + "from": { + "key_code": "spacebar", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "set_variable": { + "name": "spacefn_mode", + "value": 1 + } + } + ], + "to_after_key_up": [ + { + "set_variable": { + "name": "spacefn_mode", + "value": 0 + } + } + ], + "to_if_alone": [ + { + "key_code": "spacebar" + } + ], + "type": "basic" + } + ] + }, + { + "description": "SpaceFN: Space+[ijkl] to Up, Left, Down, Right", + "manipulators": [ + { + "conditions": [ + { + "name": "spacefn_mode", + "type": "variable_if", + "value": 1 + } + ], + "from": { + "key_code": "i", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "up_arrow" + } + ], + "type": "basic" + }, + { + "conditions": [ + { + "name": "spacefn_mode", + "type": "variable_if", + "value": 1 + } + ], + "from": { + "key_code": "k", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "down_arrow" + } + ], + "type": "basic" + }, + { + "conditions": [ + { + "name": "spacefn_mode", + "type": "variable_if", + "value": 1 + } + ], + "from": { + "key_code": "j", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "left_arrow" + } + ], + "type": "basic" + }, + { + "conditions": [ + { + "name": "spacefn_mode", + "type": "variable_if", + "value": 1 + } + ], + "from": { + "key_code": "l", + "modifiers": { + "optional": [ + "any" + ] + } + }, + "to": [ + { + "key_code": "right_arrow" + } + ], + "type": "basic" + } + ] } ] }, diff --git a/hammerspoon/global.lua b/hammerspoon/global.lua index 20fd988..5963d55 100644 --- a/hammerspoon/global.lua +++ b/hammerspoon/global.lua @@ -70,10 +70,26 @@ hs.hotkey.bind(module.prefix, "b", launcher("org.mozilla.firefox")) hs.hotkey.bind(module.prefix, "i", launcher("com.googlecode.iterm2")) hs.hotkey.bind(module.prefix, "e", launcher("org.gnu.Emacs")) -hs.hotkey.bind(module.prefix, "m", launcher("com.microsoft.teams")) -hs.hotkey.bind(module.prefix, "n", launcher("com.microsoft.OneNote")) -hs.hotkey.bind(module.prefix, "c", launcher("com.microsoft.Outlook")) -hs.hotkey.bind(module.prefix, "p", -function() -- P for Post. It's stupid, I know, but M and E were taken - hs.application.launchOrFocusByBundleID('com.microsoft.Outlook') -end) +if os.getenv("AT_WORK") == 1 then + hs.hotkey.bind(module.prefix, "m", launcher("com.microsoft.teams")) + hs.hotkey.bind(module.prefix, "n", launcher("com.microsoft.OneNote")) + hs.hotkey.bind(module.prefix, "c", launcher("com.microsoft.Outlook")) + hs.hotkey.bind(module.prefix, "p", + function() -- P for Post. It's stupid, I know, but M and E were taken + hs.application.launchOrFocusByBundleID('com.microsoft.Outlook') + end) +else + hs.hotkey.bind(module.prefix, "k", launcher("com.reinvented.KeepIt")) + hs.hotkey.bind(module.prefix, "d", launcher("com.devon-technologies.think3")) + hs.hotkey.bind(module.prefix, "m", launcher("com.apple.iChat")) + hs.hotkey.bind(module.prefix, "s", launcher("org.whispersystems.signal-desktop")) + hs.hotkey.bind(module.prefix, "c", launcher("com.flexibits.fantastical2.mac")) + hs.hotkey.bind(module.prefix, "p", + function() -- P for Post. It's stupid, I know, but M and E were taken + hs.application.launchOrFocusByBundleID('com.apple.mail') + hs.osascript.applescript('tell application "Mail" to check for new mail') + end ) + hs.hotkey.bind(module.prefix, "t", launcher("com.culturedcode.ThingsMac")) + --hs.hotkey.bind(module.prefix, "a", collectFromFrontmostApp) -- a for Archive + hs.hotkey.bind(module.prefix, "r", todoFromFrontmostApp) -- r for Remember +end diff --git a/hammerspoon/init.lua b/hammerspoon/init.lua index 893e7ab..9e1a3a8 100644 --- a/hammerspoon/init.lua +++ b/hammerspoon/init.lua @@ -8,7 +8,21 @@ local global = require 'global' local keepit = require 'keepit' local mail = require 'mail' +local sleepwake = require 'sleepwake' +local wifi = require 'wifi' local usb = require 'usb' local wifi = require 'wifi' -local reload = require 'reload' +function reloadConfig(files) + doReload = false + for _,file in pairs(files) do + if file:sub(-4) == ".lua" then + doReload = true + end + end + if doReload then + hs.reload() + end +end +homewatcher = hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reloadConfig):start() +hs.alert.show("Config loaded") diff --git a/hammerspoon/sleepwake.lua b/hammerspoon/sleepwake.lua new file mode 100644 index 0000000..c445315 --- /dev/null +++ b/hammerspoon/sleepwake.lua @@ -0,0 +1,27 @@ +require "string" + +local module = {} + +function checkBluetoothResult(rc, stderr, stderr) + if rc ~= 0 then + print(string.format("Unexpected result executing `blueutil`: rc=%d stderr=%s stdout=%s", rc, stderr, stdout)) + end +end + +function bluetooth(power) + print("Setting bluetooth to " .. power) + local t = hs.task.new("/usr/local/bin/blueutil", checkBluetoothResult, {"--power", power}) + t:start() +end + +function f(event) + if event == hs.caffeinate.watcher.systemWillSleep then + bluetooth("off") + elseif event == hs.caffeinate.watcher.screensDidWake then + bluetooth("on") + end +end + +module.watcher = hs.caffeinate.watcher.new(f) +module.watcher:start() +return module diff --git a/install.py b/install.py index b7da5a8..9fd9823 100644 --- a/install.py +++ b/install.py @@ -127,7 +127,6 @@ def install_brew(pkgs, tags): with NamedTemporaryFile('w') as tf: tf.write('\n'.join(to_install)) tf.flush() - import pdb; pdb.set_trace() runcmd('xargs <{} brew install'.format(tf.name)) @@ -182,12 +181,6 @@ def install_from_config(config_file, tags): except OSError: pass # FIXME: only do the following four on macos hosts - if platform.system() == 'Darwin': - # check_install_deps_macos() - install_taps(config.get('brew-taps', [])) - install_casks(config.get('casks', []), tags) - install_brew(config.get('brew', []), tags) - # install_mas(config.get('mas', []), tags) install_sources(config.get('sources', {})) install_symlinks(config.get('symlinks', {})) post_install(config) diff --git a/launchagents/local.timods.watchman.plist b/launchagents/local.timods.watchman.plist index fd526e5..1963121 100644 --- a/launchagents/local.timods.watchman.plist +++ b/launchagents/local.timods.watchman.plist @@ -3,12 +3,12 @@ Label - com.github.facebook.watchman + local.timods.watchman Disabled ProgramArguments - /usr/local/bin/watchman + /Users/timods/.local/bin/watchman --foreground --logfile=/usr/local/var/run/watchman/timods-state/log --log-level=1 diff --git a/zsh/dev.sh b/zsh/dev.sh index 7814699..67e035e 100644 --- a/zsh/dev.sh +++ b/zsh/dev.sh @@ -10,7 +10,7 @@ export GDTMPLS="$GOPATH/src/github.com/chronoslynx/godoc-tmpls" export CCACHE_COMPRESS=1 # personal installation prefix -export PREFIX="$HOME/.local" +export INSTALL_PREFIX="$HOME/.local" export XTARGET="i686-elf" export CARGO_HOME="$HOME/.cargo" export CHOOSENIM_NO_ANALYTICS=1