Skip to content

Commit

Permalink
Open the ScanSnap App if device connects automatically
Browse files Browse the repository at this point in the history
  • Loading branch information
bluemaex committed Jun 9, 2018
1 parent 4b4d60d commit 9760ca1
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
3 changes: 2 additions & 1 deletion osx/etc-sym/.hammerspoon/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@ Install=spoon.SpoonInstall
require "lockscreen"
require "window-grid"
require "window-layout"
require "wifi"
require "wallpaper"
require "wifi"
require "usb"

-- print config loaded
hs.notify.show("Loaded Config", "Have fun!", "")
15 changes: 15 additions & 0 deletions osx/etc-sym/.hammerspoon/usb.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
local usbWatcher = nil

function usbDeviceCallback(data)
if (data["productName"] == "ScanSnap S1300i") then
if (data["eventType"] == "added") then
hs.application.launchOrFocus("ScanSnap Manager")
elseif (data["eventType"] == "removed") then
app = hs.appfinder.appFromName("ScanSnap Manager")
app:kill()
end
end
end

usbWatcher = hs.usb.watcher.new(usbDeviceCallback)
usbWatcher:start()

0 comments on commit 9760ca1

Please sign in to comment.