Git Product home page Git Product logo

Comments (8)

ashfinal avatar ashfinal commented on July 19, 2024

Use alt instead of option.
You can read the manual more carefully. :)
http://www.hammerspoon.org/docs/hs.eventtap.html

from awesome-hammerspoon.

nikitavoloboev avatar nikitavoloboev commented on July 19, 2024

That too doesn't work for me. :(

viewM:bind('', 'H', 'Scroll Leftward', function() hs.eventtap.keyStroke({"alt"}, "left") end)
viewM:bind('', 'L', 'Scroll Rightward', function() hs.eventtap.keyStroke({"alt"}, "right") end)
viewM:bind('', 'J', 'Scroll Downward', function() hs.eventtap.keyStroke({"alt"}, "down") end)
viewM:bind('', 'K', 'Scroll Upward', function() hs.eventtap.keyStroke({"alt"}, "up") end)

from awesome-hammerspoon.

nikitavoloboev avatar nikitavoloboev commented on July 19, 2024

Also if you want to know, what I am trying to do, I am replacing Hammerspoon scrolling to Karabiner's. (can be found here)

It is a lot more smooth this way.

from awesome-hammerspoon.

ashfinal avatar ashfinal commented on July 19, 2024

This works for me.
Just open Hammerspoon console, paste the above code and try again.

I'm thinking you may have put these code into awesomeconfig.lua? That will not work.
They are "shadowed". You need replace the corresponding lines with the code above.

from awesome-hammerspoon.

ashfinal avatar ashfinal commented on July 19, 2024

And I don't see it makes more smooth.
If scrolling one line one time is too short for you, you can scroll faster, which may act more smooth.

viewM:bind('', 'J', 'Scroll Downward', function() hs.eventtap.scrollWheel({0,-1},{},"line") end, nil, function() hs.eventtap.scrollWheel({0,-1},{},"line") end)

Change -1 to -2 (or -3/4…) to scroll faster.

from awesome-hammerspoon.

nikitavoloboev avatar nikitavoloboev commented on July 19, 2024

You are right that it is smooth enough if you adjust the settings well enough.

Still though, my binds for sending a keystroke don't work at all (In this case I want when M pressed to switch application) :

viewM:bind('', 'escape', function() viewM:exit() end)
viewM:bind('', 'Q', function() viewM:exit() end)
viewM:bind('', 'tab', function() showavailableHotkey() end)

viewM:bind('', 'H', 'scroll leftward', function() hs.eventtap.scrollWheel({1,0},{},"line") end, nil, function() hs.eventtap.scrollWheel({1,0},{},"line") end)
viewM:bind('', 'J', 'scroll downward', function() hs.eventtap.scrollWheel({0,-1},{},"line") end, nil, function() hs.eventtap.scrollWheel({0,-1},{},"line") end)
viewM:bind('', 'K', 'scroll upward', function() hs.eventtap.scrollWheel({0,1},{},"line") end, nil, function() hs.eventtap.scrollWheel({0,1},{},"line") end)

viewM:bind('', 'L', 'scroll rightward', function() hs.eventtap.scrollWheel({-1,0},{},"line") end, nil, function() hs.eventtap.scrollWheel({-1,0},{},"line") end)

viewM:bind('', 'M', 'switch app', function() hs.eventtap.keyStroke({"cmd"}, "tab") end)


viewM:bind('shift', 'H', 'scroll leftward', function() hs.eventtap.scrollWheel({3,0},{},"line") end, nil, function() hs.eventtap.scrollWheel({3,0},{},"line") end)
viewM:bind('shift', 'J', 'scroll downward', function() hs.eventtap.scrollWheel({0,-3},{},"line") end, nil, function() hs.eventtap.scrollWheel({0,-3},{},"line") end)
viewM:bind('shift', 'K', 'scroll upward', function() hs.eventtap.scrollWheel({0,3},{},"line") end, nil, function() hs.eventtap.scrollWheel({0,3},{},"line") end)

viewM:bind('shift', 'L', 'scroll rightward', function() hs.eventtap.scrollWheel({-3,0},{},"line") end, nil, function() hs.eventtap.scrollWheel({-3,0},{},"line") end)

I am changing and editing the basic mode.lua file directly, not editing anything in awesomeconfig.lua.

from awesome-hammerspoon.

nikitavoloboev avatar nikitavoloboev commented on July 19, 2024

Also tried to add 'M' key as a way to quit from the mode :

viewM:bind('', 'escape', function() viewM:exit() end)
viewM:bind('', 'Q', function() viewM:exit() end)
viewM:bind('', 'M', function() viewM:exit() end)

I would think that binding M key in this way would work but it doesn't for some reason. Nothing happens as I press it in this viewM mode.

from awesome-hammerspoon.

ashfinal avatar ashfinal commented on July 19, 2024

Hum … That is strange. Switching application and exiting VIEW mode, both work for me here.
Maybe you forgot to reload configuation? Or modify some code else?

Open Hammerspoon console, paste the code below, then try pressing j again.

tmp = hs.hotkey.bind("","j",nil,function() hs.eventtap.keyStroke({"cmd"},"tab") end)

tmp:delete() to cancel this temporary hotkey binding/test.

from awesome-hammerspoon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.