Solved Sending "Super" key kb.Super via chromedp

I use chromedp to streamline some tasks - one of those is logging into Citrix Gateway so I don't have to enter my credentials each time. I'm trying to have it launch specific applications so I can grab coffee while my desktop "warms up" and by the time I come back, it is ready to go.

Normally, I would also accomplish this by adding the apps I want to the startup folder; however, that is locked down.

Essentially, what I'm trying is this:

package main

import (
"fmt"

"github.com/chromedp/chromedp"
"github.com/chromedp/chromedp/kb"
)

func main() {
instanceContext := ...
err := chromedp.Run(instanceContext, chromedp.KeyEvent(kb.Super))
}

The code runs okay, yes, there is exception handling, but for brevity, I omitted that. I don't see any semblence of the Super key (Windows) being pressed at all. I also tried running this a few times with a 1s sleep between each iteration.

Conversely, I use the same approach to send enter and that works like a charm. I'm using the correct context (I have multiple tabs), so it isn't a matter of sending the Super key to the wrong tab.

This is a bit random, but I was wondering if anyone had any luck sending the Super key, or if I need to do something else to simulate it?

EDIT:
I also tried sending alt + tab both as a single event that chromedp then synthesizes as well as a alt keydown, then tab, then alt keyup. I ran that in a loop with a delay between each iteration to see if I could visibly notice that being performed.
 
I figured it out, I don't want the "Super" key, but I want the "Meta" key instead. Sending kb.Meta triggers the Windows key and it worked perfectly.

Reading the documentation still has me somewhat confused. I wonder if I run this code on Linux or Mac if I will need to use the Super key instead. I'll report back if/when I cross that bridge.
 
Back
Top