markdown-it
demo
Delete
Submit
clear
permalink
### [[滑鼠]羅技木星軌跡球 如何在macbook自訂鍵 ](https://www.ptt.cc/bbs/Key_Mou_Pad/M.1582204955.A.BA8.html) #### [Hammerspoon](https://www.hammerspoon.org/) #### [相關設定調整](https://github.com/tekezo/Karabiner/issues/814) ```lua -- HANDLE SCROLLING local oldmousepos = {} local scrollmult = -4 -- negative multiplier makes mouse work like traditional scrollwheel mousetap = hs.eventtap.new({5}, function(e) oldmousepos = hs.mouse.getAbsolutePosition() local mods = hs.eventtap.checkKeyboardModifiers() if mods['ctrl'] and mods['cmd'] then -- print ("will scroll") local dx = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaX']) local dy = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaY']) local scroll = hs.eventtap.event.newScrollEvent({dx * scrollmult, dy * scrollmult},{},'pixel') scroll:post() -- put the mouse back hs.mouse.setAbsolutePosition(oldmousepos) -- return true, {scroll} return true else return false, {} end -- print ("Mouse moved!") -- print (dx) -- print (dy) end) mousetap:start() ``` ```lua -- HANDLE SCROLLING local oldmousepos = {} -- positive multiplier (== natural scrolling) makes mouse work like traditional scrollwheel local scrollmult = 4 -- The were all events logged, when using `{"all"}` mousetap = hs.eventtap.new({0,3,5,14,25,26,27}, function(e) oldmousepos = hs.mouse.getAbsolutePosition() local mods = hs.eventtap.checkKeyboardModifiers() local pressedMouseButton = e:getProperty(hs.eventtap.event.properties['mouseEventButtonNumber']) -- If OSX button 4 is pressed, allow scrolling local shouldScroll = 3 == pressedMouseButton if shouldScroll then local dx = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaX']) local dy = e:getProperty(hs.eventtap.event.properties['mouseEventDeltaY']) local scroll = hs.eventtap.event.newScrollEvent({dx * scrollmult, dy * scrollmult},{},'pixel') scroll:post() -- put the mouse back hs.mouse.setAbsolutePosition(oldmousepos) return true, {scroll} else return false, {} end -- print ("Mouse moved!") -- print (dx) -- print (dy) end) mousetap:start() -- 檔案更新時自動重新載入 Hammerspoon 設定檔 function reloadConfig(files) for _,file in pairs(files) do if file:sub(-4) == ".lua" then hs.reload() -- 重新載入 Hammerspoon 設定檔 return; end end end hammerWatcher = hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reloadConfig):start() hs.alert.show("Config loaded") print("Config loaded") -- 定義一個 function 來調整預設輸出裝置的音量 local function adjustVolume(delta) return function() -- 取得目前預設輸出裝置的音量 local currVolume = hs.audiodevice.defaultOutputDevice():outputVolume() hs.audiodevice.defaultOutputDevice():setOutputVolume(currVolume + delta) end end -- 將 rightctrl + ] 設定為音量增加 5 -- 將 rightctrl + [ 設定為音量減少 5 hs.hotkey.bind({"ctrl"}, "]", adjustVolume(5)) hs.hotkey.bind({"ctrl"}, "[", adjustVolume(-5)) ``` ### [Mac 上如何使用Emoji 表情符號](https://mrmad.com.tw/mac-emoji-shortcut) 在任何能夠輸入的頁面中,透過 「Control+Command⌘+空白鍵」三個按鍵快捷鍵。 ### [iTerm2 於 irc 使用 Option (alt) 切換視窗的設定](https://blog.longwin.com.tw/2015/01/mac-iterm2-irc-option-alt-esc-2014/) 1. 開啟 iTerm2 1. Preferences -> Profiles -> Keys 1. 最下方的 Left option 從 "Normal" 改成 "+Esc" 1. 關掉視窗就可以直接使用了~ ### [Mac 快捷鍵](https://is.gd/UUBVfW) ### [How do I start the docker daemon on macOS?](https://apple.stackexchange.com/questions/373888/how-do-i-start-the-docker-daemon-on-macos) ``` open -a Docker ``` or ``` brew install colima colima start # create VM with 1CPU, 2GiB memory and 10GiB storage colima start --cpu 1 --memory 2 --disk 10 # modify an existing VM to 4CPUs and 8GiB memory. colima start --cpu 4 --memory 8 docker ps -a ```
html
source
debug
Fork me on GitHub