Skip to content

Commit

Permalink
Merge branch 'master' of https://gitlab.com/timods/dotfiles
Browse files Browse the repository at this point in the history
* 'master' of https://gitlab.com/timods/dotfiles:
  Add more hammerspoon helpers
  idk what I was doing
  • Loading branch information
Tim Deeb-Swihart committed Apr 18, 2020
2 parents 3d6bcf6 + 42f2c50 commit 1b50fc8
Show file tree
Hide file tree
Showing 8 changed files with 260 additions and 81 deletions.
121 changes: 58 additions & 63 deletions config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
134 changes: 134 additions & 0 deletions config/karabiner/karabiner.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
]
}
]
},
Expand Down
30 changes: 23 additions & 7 deletions hammerspoon/global.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
16 changes: 15 additions & 1 deletion hammerspoon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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")
27 changes: 27 additions & 0 deletions hammerspoon/sleepwake.lua
Original file line number Diff line number Diff line change
@@ -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
7 changes: 0 additions & 7 deletions install.py
Original file line number Diff line number Diff line change
Expand Up @@ -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))


Expand Down Expand Up @@ -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)
Expand Down
4 changes: 2 additions & 2 deletions launchagents/local.timods.watchman.plist
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.github.facebook.watchman</string>
<string>local.timods.watchman</string>
<key>Disabled</key>
<false/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/bin/watchman</string>
<string>/Users/timods/.local/bin/watchman</string>
<string>--foreground</string>
<string>--logfile=/usr/local/var/run/watchman/timods-state/log</string>
<string>--log-level=1</string>
Expand Down
Loading

0 comments on commit 1b50fc8

Please sign in to comment.