Re:Unpacking Elixir: Syntax
by limecat on Friday September 08, 2023 @08:39AM
(#37432736)
I use autokey not as a hotkey but as text expansion. If I type "..c" then this is expanded into "{}" with the cursor inside the braces. And to surround text with "{}" I use ",,c", hence "whatever,,c" becomes "{whatever}". I have similar text expansion for other symbols that require AltGr, square braces are ..s and ,,s for instance. On Windows Autohotkey can do the same, just the scripting language is different. The Autokey text for curly braces is simply "{}<left>" and for surrounding with curly braces the script is:
import time
keyboard.send_keys("<shift>+<ctrl>+<left>")
time.sleep(0.25)
sample = clipboard.get_selection()
keyboard.send_key("<delete>")
keyboard.send_keys("{%s}" % sample)
Maybe it helps you.
[ Parent
| on HN ]
Re:Unpacking Elixir: Syntax
by jagaerglad on Friday September 08, 2023 @09:34AM
(#37433292)
That is actually very smart and helpful, thanks! :) My only gripe with autokey is that it's the only thing holding me back from wayland. Hawck is supposed to work with wayland but I never got it to work, was a while ago I tried though
I don't use Wayland, but it seems xdg-desktop-portal since 1.16.0 has a 'Global Shortcuts portal'. Perhaps check it out.