2022년 1월 15일 토요일

키보드로 마우스 대체하기 (macOS)

 Karabiner-Elements에서 Complex Keyboard Modification을 설치한다.

https://github.com/yeonsh/mouse_keys_minimal/blob/main/mouse_keys_minimal.json


위 modification은 아래 modification을 수정한 것. 불필요한 것들을 삭제하고, Terminal에서 CTRL+U와 충돌하는 것을 변경하기 위해 마우스 클릭과 우클릭을 각각 9와 0으로 변경.

사용키:

LEFT CTRL+I,J,K,L (마우스 포인터 이동 2048px)

LEFT CTRL+RIGHT SHIFT+W,A,S,D (마우스 포인터 이동 1024px)

LEFT CTRL+9, Left Click

LEFT CTRL+0, Right Click

 

LEFT CTRL+LEFT SHIFT+I,J,K,L (Scroll)


Alcro - Rust용 HTML5 Desktop 앱 개발 툴

 lorca와 같은 용도이며 rust를 위한 툴. 이름은 거꾸로(anagram)

https://github.com/Srinivasa314/alcro

lorca - Go로 HTML5 desktop app 만들기 위한 라이브러리

 사용할 라이브러리는 Lorca

https://github.com/zserge/lorca

 

홈페이지에서 가져온 Features:

  • Pure Go library (no cgo) with a very simple API
  • Small application size (normally 5-10MB)
  • Best of both worlds - the whole power of HTML/CSS to make your UI look good, combined with Go performance and ease of development
  • Expose Go functions/methods and call them from JavaScript
  • Call arbitrary JavaScript code from Go
  • Asynchronous flow between UI and main app in both languages (async/await and Goroutines)
  • Supports loading web UI from the local web server or via data URL
  • Supports testing your app with the UI in the headless mode
  • Supports multiple app windows
  • Supports packaging and branding (e.g. custom app icons). Packaging for all three OS can be done on a single machine using GOOS and GOARCH variables.

 

샘플 코드:

ui, _ := lorca.New("", "", 480, 320)
defer ui.Close()

// Bind Go function to be available in JS. Go function may be long-running and
// blocking - in JS it's represented with a Promise.
ui.Bind("add", func(a, b int) int { return a + b })

// Call JS function from Go. Functions may be asynchronous, i.e. return promises
n := ui.Eval(`Math.random()`).Float()
fmt.Println(n)

// Call JS that calls Go and so on and so on...
m := ui.Eval(`add(2, 3)`).Int()
fmt.Println(m)

// Wait for the browser window to be closed
<-ui.Done()