ConEmu macro for toggling window transparency

3

1

I would like to create a macro to toggle transparency in ConEmu. Ideally, I would be able to hold down a key and the transparency of ConEmu would be set as high as possible. Upon release, it would return to the previous setting. A toggle of on/off is also fine. I was thinking I could create a guimacro like this (pseudo-code follows):

if GetOption("AlphaValue") = 80
  SetOption("AlphaValue") 40
else 
  SetOption("AlphaValue") 80

I read the page on ConEmu GuiMacros and I'm not sure I understand how I would be able to accomplish this using a GuiMacro. Can GuiMacros do this, or do I need to write a script and have a macro launch a script or something?

Can anyone clarify how I would go about creating this functionality in ConEmu?

Matt

Posted 2015-08-25T20:46:37.790

Reputation: 331

1You may use autohotkey scripts, perhaps. – Maximus – 2015-08-25T21:23:47.070

Answers

3

As recommended by Maximus, I was able to do this using a combination of AutoHotKey and ConEmu GuiMacros.

AutoHotKey script:

#IfWinActive ahk_class VirtualConsoleClass
^e::
   Send, ^+!e
   KeyWait, e
   Send, ^+!r
Return
#IfWinActive

ConEmu macros:

Macro1
Hotkey: Ctrl-Shift-Alt-E
GuiMacro: SetOption("AlphaValue",40)

Macro2
Hotkey: Ctrl-Shift-Alt-R
GuiMacro: SetOption("AlphaValue",204)

The AutoHotKey script uses KeyWait to send one key sequence when the hotkey is first pressed, and another when the key is released. I used crazy sequences I wouldn't otherwise use (Ctrl-Shift-Alt- E and R) and created macros for these in ConEmu to issue the GuiMacro commands.

While I hold down Ctrl-E, the transparency of the ConEmu window is changed to 40 (fully transparent) and when I release the E key the transparency is set back to my setting of 204 (80% opaque). By using #IfWinActive in AutoHotKey, it will only execute these hotkeys when ConEmu is the active window.

Thanks to Maximus for his quick response and suggestion of AutoHotKey, and of course for creating the awesome ConEmu!

Matt

Posted 2015-08-25T20:46:37.790

Reputation: 331