2016-12-26 19:54:28 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once __DIR__."/../vendor/autoload.php";
|
|
|
|
|
|
|
|
use NoccyLabs\X11\WindowList;
|
|
|
|
|
|
|
|
// Create a list of all windows
|
|
|
|
$windows = new WindowList();
|
|
|
|
$windows->dump();
|
|
|
|
|
2016-12-26 21:44:00 +00:00
|
|
|
// Select only visible windows
|
|
|
|
$visible = $windows->visible();
|
|
|
|
$visible->dump();
|
|
|
|
|
2016-12-26 19:54:28 +00:00
|
|
|
// Select all the windows with a title matching *code*
|
2016-12-26 21:44:00 +00:00
|
|
|
$codewindows = $visible->find("*code*");
|
|
|
|
if (count($codewindows)==0) {
|
|
|
|
printf("Sorry, couldn't find any vscode instances running!\n");
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
$codewindows->dump();
|
2016-12-26 19:54:28 +00:00
|
|
|
|
|
|
|
// Grab the first window
|
2016-12-26 21:44:00 +00:00
|
|
|
$codewindow = $codewindows->first();
|
|
|
|
$codewindow->dump();
|
2016-12-26 19:54:28 +00:00
|
|
|
|
|
|
|
// Focus the window and simulate F1 being pressed
|
2016-12-26 21:44:00 +00:00
|
|
|
$codewindow->focus()->activate()->sendKeys("F1");
|