KeyRoutines
StepFreevar.toggle

Flip an on/off value with one hotkey in a routine

Toggle flips a remembered value between on and off. Paired with an If, it turns one hotkey into a two-way switch, like the free version of an AFK toggle.

How it works

  • Pick the name to flip; if it was off or never set, it becomes on.
  • It returns true when the value is now on.
  • It's kept for this routine by default, or for all routines with the global scope.
  • In a dry run the change stays inside the dry run and the history says "Would turn afk on".

Routines that use it

Free AFK switch

Toggle away, then with Remembered value is mute the sound and lock the PC when on, and unmute when off.

Mic push

One hotkey toggles a mic value and runs Discord: mute based on it.

Desktop icons

Toggle a value and show or hide desktop icons with Show or hide desktop icons.

Settings

SettingWhat it does
NameThe on/off value to flip ("afk").

Good to know

  • It only flips a stored value; you still add the steps that do the on and off work.

Questions

How do I make a toggle hotkey on Windows 11?
Give a Hotkey routine a Toggle step, then an If with Remembered value is on for the on steps and the off steps in the else part.
Does the toggle remember its state after a restart?
Yes. The value is kept on disk, so the next press continues from where you left off.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.