Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optimize windowHints, make "char" immutable with hack the function of "hs.hints.addWindow" #1380

Open
cxdongjack opened this issue Apr 29, 2017 · 2 comments

Comments

@cxdongjack
Copy link

the immutable hotkeys is more efficient than random ones

char generation algorithm as below:

  • try to find char in user specific dict, like { ['com.sublimetext.3'] = 'S' }
  • parse the bundleID to single char, like com.apple.Terminal -> 'T', bundleID is stable than title
  • loop the charhints(i.e ABC..XYZ), find the nil char in 'dict'

other optimized points:

  • try to use only one key against the 'vimperator' style
  • seperate the imutable with the random, random ones use the numbers
  • fix the annoying problem, chars are changed when window be bring to frontend

here is the code in my config https://github.com/cxdongjack/hammerspoon/blob/master/jump.lua#L30

hope some help

@cxdongjack
Copy link
Author

The hotkey is the the first char of the application name with your intuition.

screenshot

@cmsj
Copy link
Member

cmsj commented May 2, 2017

I think this is an interesting idea, and I just opened #1388 suggesting that we rewrite hs.hints to be a pure Lua module using hs.canvas and hs.windowfilter.

Fancy taking a crack at it? :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants