I am wary of trying to add stuff to the alias configuration dialog to support this.. it feels like an awkward match.
How so? The feature would condition when an alias is triggered and what results it triggers. Seems like alias configuration to me.
It seems to me a cleaner approach might be an easier and more flexible system for writing short script-like plugins.. That would let you more easily write a mini script to do what you want.
Not sure if I follow this. How would we go about that in these use cases: The alias "cs" could be used to immediately (using the special FARR string "dolaunch") run a cheat sheet file for the active application/process. Alias "help" could show help resources relevant to the active application. Would I write one script-like plugin per such active window context dependent alias string that I want. That is, one for "cs", one for "help" and so on?More thoughts on this kind of feature
Two use cases where different implementations would be the best fit, I now reckon.Case1
We want to make a single alias string, or single regex pattern, to trigger different results depending on the active window (or other conditions...) and we might have many such windows. Example: "help" shows help resources relevant to the active application.
Here ability to add #If declaratives on lines in the results list in the alias configuration would be handy and easy to overview. Mockup:
#If win_process = "Firefox.exe"
#If win_process = "Chrome.exe"
and so on for 10 other windows.
(For my own use I currently achieve this effect through an alias that runs an AutoHotkey script with %LASTHWND% as parameter, and then the script looks up that window and takes conditional action. But my thinking is that FARR users might be interested in the basics of that without having to resort to external scripts. A minor difference is that with this external script approach we can't make FARR not trigger a regex alias if none of the target windows are active. That is we can't make FARR do a regular search for files with "help" if the active window is not
one of those we have special actions for in the script.)Case2
We want to make a lot of different alias strings to trigger only if some window is active (or other conditions...)
For example we want aliases for the strings "help", "cs", "close" and so on that only trigger if the active window is InkScape.
Here it would make more sense to be able add the condition to a set of lines in the list of aliases in an alias file in FARR Options. (Under the hood: the condition would exist as a parent tag with a number of <AliasEntry> items as children in the FARR myaliases.alias XML file)
Or, perhaps more feasible, one condition per alias file. So in the example we'd make inkscape.alias and have all aliases in it trigger only if the active window condition is met. Users could be exposed to that through an edit field or a button to show an editfield in the section above the list of aliases in FARR options.New feature idea: Aliases conditional on active window
Under the hood: store condition in a tag in inkscape.alias XML file. Mockup:
<AliasSetCondition>win_process = InkScape.exe</AliasSetCondition>
<AliasSetDescription>Custom User Alias File</AliasSetDescription>
Edit: Or, to change as little as possible in the current FARR options UI, let users add alias condition strings to the alias file description box (AliasSetDescription XML tag)! FARR would detect if the string in that box starts with a declarative like "#if" and then treat the rest of the string as conditions.