Author Topic: Accept tokens for profile switching  (Read 4233 times)

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Accept tokens for profile switching
« on: January 19, 2018, 03:07:34 PM »
Currently the "enable profile switching for the following windows" only allows for hard-coded input. I think it would be fantastic if this field accepted tokens. This would provide even more contextual control and expanded functionality to whichever users are interested in it.

I've already discussed some of the drawbacks of having profile switching handled via window title only and made a case for profile switching via window process name here. But if the profile switching field could accept tokens it would be possible to perform switching via process name via {EXP}.

Here's an example. Under certain circumstances it is possible for two applications to have the same window title, potentially causing undesirable profile switching if both app windows are in use. Now say I have a profile called "Profile1" that I want to switch to when I select the window titled "MyWindow" that is associated with the application "MyApp." I can then just use this in the "enable profile switching" field:

Code: [Select]
{EXP: IIF('{ACTIVEWINDOWPROCESSNAME}' = 'MyApp', 'MyWindow', 'no action')}
...so only activating the window titled MyWindow related to the process MyApp will trigger the expression to output "MyWindow" text into the switching field, which would then trigger a switch to Profile1. And other apps with window title MyWindow wouldn't trigger the profile switch. Though this would require the tokens to be reevaluated every time a new window is activated. This is just one possible use for this kind of functionality.

Gary do you think it would be feasible to have the "enable profile switching" field accept tokens?
« Last Edit: January 20, 2018, 11:27:47 PM by Exergist »

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2825
Re: Accept tokens for profile switching
« Reply #1 on: March 20, 2018, 08:43:03 PM »
Switching between profiles exists outside of a single profile's space.  Since variables and tokens exist within the profile space, it would get a little convoluted.... global-only variables would have to be set somewhere on the load of some profile and so on and so on.  Also, the checks for profile switching is done very quickly, and token/variable processing would add a significant level of unnecessary overhead for the majority of users.  Hope that makes sense o_O

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Accept tokens for profile switching
« Reply #2 on: March 20, 2018, 08:54:25 PM »
Absolutely! Thanks for the reply. It doesn't sound like tokens make sense, but what about switching based on the executable behind a given window?

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2825
Re: Accept tokens for profile switching
« Reply #3 on: March 20, 2018, 10:24:13 PM »
I can do process name, no problem.  So, if your window title is, 'My Window', but the process name is xyz1234, you can put in xyz1234 or *xyz* or whatever.

Exergist

  • Global Moderator
  • Sr. Member
  • *****
  • Posts: 405
  • Ride the lightning
Re: Accept tokens for profile switching
« Reply #4 on: March 20, 2018, 11:21:09 PM »
Two thumbs way, way up! :)

Gary

  • Administrator
  • Hero Member
  • *****
  • Posts: 2825
Re: Accept tokens for profile switching
« Reply #5 on: March 21, 2018, 07:45:16 AM »
Next beta, very soon ;)