Live data from Hacker News

In Praise of AutoHotKey

hillelwayne.com

181–190 of 220 posts

Re: In Praise of AutoHotKey

#181

Earlier quoted context omitted.

> add a system-modal popup that requires you to type in "network" correctly 50 times in a row and then issues a Ctrl+Z; if you make a mistake, you start over. There, fixed :).

Working on it. And to make sure I don’t cheat, it’ll put me into a kiosk mode and temporarily change my password to prevent me from escaping my punishment. It’ll be like my very own ransomware!

Be sure the script also temporarily clears your keyboard; can't have you cheating your way out by having "network" ready to paste at any moment!

Re: In Praise of AutoHotKey

#182
post #17

I've started[1] to do similar things on macOS using Hammerspoon[2]. So far I've set it up to let me: 1. Use shift when pasting something to simulate typing in the text instead, getting around websites that block pasting. 2. Use ";" as a hyper key. By holding it down and pressing another key, I can switch between specific programs without cycling. I can also use hjkl as arrow keys. 3. Automatically switch audio input…

Having used both Hammerspoon and AHK, the latter is somehow both terser and more ergonomic. I miss it dearly when I'm not on Windows. And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really? I've actually gone kind of crazy with this idea and made my left ctrl, shift and alt behave as fn+ctrl, fn+shift and fn+alt, so that e.g. left ctrl+h actually does ctrl+left. Then I made fn+[ = pgu…

> And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really?

Caps Lock is quite useful, because it's the perfect location for remapping the Ctrl- and ESC-Keys. Which is no surprise, as they originally where located there.

Under linux there is a nice tool for overloading keys, so they behave one way when pressed short, and another way when holded longer. With programmable keyboards you even have it OS-independant.

Re: In Praise of AutoHotKey

#183
post #72

Earlier quoted context omitted.

> including treating my monitor as a speaker for some reason (it doesn't have built-in speakers). This is quite common on HDMI monitors. Since the HDMI connection transmits both audio and video, the monitor just accepts both audio and video input. They would then have a 3.5-mm jack to allow you plug in an actual speaker or headphone to receive the audio output.

Which is something I don't understand, just separate the signal and give me a digital output from the monitor, why are monitors doing digital analog conversion for audio too, all of a sudden?

There are usually different flavors of the same base-model. Some have speakers, other not. Not adding speakers, but leaving the rest ist just cheaper and more reliable than tinkering with every flavor for single features.

Re: In Praise of AutoHotKey

#184
post #17

I've started[1] to do similar things on macOS using Hammerspoon[2]. So far I've set it up to let me: 1. Use shift when pasting something to simulate typing in the text instead, getting around websites that block pasting. 2. Use ";" as a hyper key. By holding it down and pressing another key, I can switch between specific programs without cycling. I can also use hjkl as arrow keys. 3. Automatically switch audio input…

> getting around websites that block pasting. This one really drives me mad. Is there really any legit reason to this? By the way my hack is I paste it in the address bar, then just drag-drop into the field. Works 50% of the time or more (fails when a lot of these stupid websites don't use placeholder attribute but rather use some sort of Javascript for the placeholder text)

> This one really drives me mad. Is there really any legit reason to this?

Yes, preventing you to steal their content.

Of course this only works against the technical layman, who does not even think about googeling for a solution to this.

Re: In Praise of AutoHotKey

#185
post #17

I've started[1] to do similar things on macOS using Hammerspoon[2]. So far I've set it up to let me: 1. Use shift when pasting something to simulate typing in the text instead, getting around websites that block pasting. 2. Use ";" as a hyper key. By holding it down and pressing another key, I can switch between specific programs without cycling. I can also use hjkl as arrow keys. 3. Automatically switch audio input…

> 2. Use ";" as a hyper key. By holding it down and pressing another key, I can switch between specific programs without cycling. I can also use hjkl as arrow keys.

Did you overload the ;-key, meaning it sends ; when pressed fast, and acts as modifier when hold and pressed with other keys? Is'nt that kidna painful to use and inflicts false input occasionaly?

I too have some personal modifier-keys. I remaped Pause-key to the Right alt-key, and use for persional settings in apps. And I remapped the left Alt-key to F22, and use it for window managing and staring/raising apps.

Benefit with this is that both keys are exclusively used by me and the pause-key is also available even when my setting is not available.

Re: In Praise of AutoHotKey

#186

Earlier quoted context omitted.

Using ; as a hyper key blew my mind, like the article recently about how a certain developer calls all of his scripts ',something' so if he want to run a cli command of his, pressing comma then tab will show only his scripts, so ',py(tab)' won't have 15 pythons in it.

I had almost used up all combinations of Ctrl, Alt, Shift, Win and letters at one point, and still never thought of making my own hyper key. It's genius. At my new job I'm afraid to download AHK at all :(

There is a portable version of autohotkey, so you can run it without installation if this would ease your fear.

Re: In Praise of AutoHotKey

#187
post #8

Linux users, see https://github.com/autokey/autokey . I use it for purposes very similar to those described by the article (little automation scripts, text expansion). It's equally as {sometimes awesome, sometimes infuriatingly quirky} as its Windows inspiration :D , but I guess it's the nature of such a tool :) . Won't work (yet?) on Wayland, though, https://github.com/autokey/autokey/issues/87 .

Unfortunately, AutoKey is not similar to AutoHotkey. I tries to be, but fails so far. Lacks a loooot of AHK functionality and contains lots of bugs. The development is so slow that something new after Linux will come out sooner than they reach AHK's state of, say, 2010.

In the quest for an analogue on Linux of Autohotkey that exclusively runs on Microsoft Windows, neither autokey nor espanso proved as reliable.

Instead, I derived my own little shell script snippy.sh [1] that expands a fuzzy selected string by letting xdotool type it out.

[1] https://github.com/konfekt/snippy.sh

Re: In Praise of AutoHotKey

#188
post #17

I've started[1] to do similar things on macOS using Hammerspoon[2]. So far I've set it up to let me: 1. Use shift when pasting something to simulate typing in the text instead, getting around websites that block pasting. 2. Use ";" as a hyper key. By holding it down and pressing another key, I can switch between specific programs without cycling. I can also use hjkl as arrow keys. 3. Automatically switch audio input…

Having used both Hammerspoon and AHK, the latter is somehow both terser and more ergonomic. I miss it dearly when I'm not on Windows. And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really? I've actually gone kind of crazy with this idea and made my left ctrl, shift and alt behave as fn+ctrl, fn+shift and fn+alt, so that e.g. left ctrl+h actually does ctrl+left. Then I made fn+[ = pgu…

For Excel on Microsoft Windows, there is vim_ahk [1] to add Vim key bindings (after adding EXCEL.EXE to VimGroup) using AutoHotKey. For LibreOffice, especially its spreadsheet calculator Calc, there is the vibreoffice [2] extension.

[1] https://github.com/rcmdnk/vim_ahk#applications [2] https://github.com/yamsu/vibreoffice

Re: In Praise of AutoHotKey

#189

Earlier quoted context omitted.

Having used both Hammerspoon and AHK, the latter is somehow both terser and more ergonomic. I miss it dearly when I'm not on Windows. And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really? I've actually gone kind of crazy with this idea and made my left ctrl, shift and alt behave as fn+ctrl, fn+shift and fn+alt, so that e.g. left ctrl+h actually does ctrl+left. Then I made fn+[ = pgu…

> And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really? Caps Lock is quite useful, because it's the perfect location for remapping the Ctrl- and ESC-Keys. Which is no surprise, as they originally where located there. Under linux there is a nice tool for overloading keys, so they behave one way when pressed short, and another way when holded longer. With programmable keyboards you ev…

> Under linux there is a nice tool for overloading keys...

Name please (TIA)

Re: In Praise of AutoHotKey

#190

Earlier quoted context omitted.

> And I actually use caps lock as a "fn" key for hjkl/arrows. Who needs caps lock, really? Caps Lock is quite useful, because it's the perfect location for remapping the Ctrl- and ESC-Keys. Which is no surprise, as they originally where located there. Under linux there is a nice tool for overloading keys, so they behave one way when pressed short, and another way when holded longer. With programmable keyboards you ev…

> Under linux there is a nice tool for overloading keys... Name please (TIA)

Oh, right. I knew I forgot something.

I use https://github.com/alols/xcape for some while now. It's old, reliable and straight forward, just does it's job. Only downside is that it seems to be limted to X11. Not sure how well it will play with wayland.

There are now also some alternative tools, with more ability, which allow overloading just on the side. I have them on my list for a while now, but not done much yet with them.

- https://github.com/david-janssen/kmonad

- https://github.com/mooz/xkeysnail

- https://github.com/snyball/Hawck

Oh, and for rermapping capslock there are also options with X11. I use

   setxkbmap -option ctrl:nocaps
to map ctrl to capslock, then overload it with

    xcape -e "Control_L=Escape;"
to add ESC ontop.
Post reply on HN