Is it possible to have some sort of profiles on AutoKey? #806
-
Like, for example, I have a lot of scripts and phrases that I use on a daily basis. As of the current version, I can divide them into folders, like Work, General/Misc., etc... so I'm wondering if it would also be possible to have profiles as well, where the scripts and phrases from the WORK folder are inactive if and when I have the General/Misc folder active, so that potential overlapping Hotkeys/abbreviations would not be an issue. Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments
-
Welcome to the AutoKey community, HeathenHacks! Not directly, but it's pretty easy to implement "manually". Two main ways. If you need phrases to work, then you make AutoKey's configuration directory (or part of it) a symlink and change where it points for additional profiles. The down side of this is that you have to terminate and restart AutoKey after doing so. It might work without that, but AutoKey needs to have a reason to rescan its configuration and that usually won't happen very frequently. If you can live with just scripts (you can always rewrite your phrases as scripts too.), then create an AutoKey global stored variable to represent the "state" of the system. Have each of your scripts first read the state variable and use it to decide what to do. Have another script(s) to set the state variable and make sure you handle the case of starting up when the state variabe doesn't exist yet. (Trying to read a global variable that doesn't exist throws an exception. If that can happen, then it needs to be inside a Using this method with one or more state variables, you can theoretically build an arbitrarily complex finite state automata in AutoKey. Depending on how fancy you need to get, you may run into some other edge cases/subtleties, but nothing that can't be handled with a bit of extra coding. See this example of using a stored global variable. It uses it to break out of a loop, but the basic idea is the same. Often, you can also get a lot of context dependent behavior by using window filters. It is possible to define two or more AutoKey actions (phrases or scripts) that have the same trigger abbreviation or hotkey as long as you make sure each of them has a window filter which is mutually exclusive with the rest of them. |
Beta Was this translation helpful? Give feedback.
-
Good find, @josephj11. I totally missed that page when hunting through the scripts just now. Here's more information on those global values to go along with it. I added a link to that on the page you found, too, so that both can be found in the future. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the suggestions, guys! Much appreciated. ❤️ |
Beta Was this translation helpful? Give feedback.
-
Someone should open an issue for this, it shouldn't be too bad to integrate it as a command line option like |
Beta Was this translation helpful? Give feedback.
Welcome to the AutoKey community, HeathenHacks!
Not directly, but it's pretty easy to implement "manually".
Two main ways.
If you need phrases to work, then you make AutoKey's configuration directory (or part of it) a symlink and change where it points for additional profiles. The down side of this is that you have to terminate and restart AutoKey after doing so. It might work without that, but AutoKey needs to have a reason to rescan its configuration and that usually won't happen very frequently.
If you can live with just scripts (you can always rewrite your phrases as scripts too.), then create an AutoKey global stored variable to represent the "state" of the system. Have each of your …