php-x11/examples/find_windows.php

21 lines
445 B
PHP

<?php
require_once __DIR__."/../vendor/autoload.php";
use NoccyLabs\X11\WindowList;
// Create a list of all windows
$windows = new WindowList();
$windows->dump();
// Select all the windows with a title matching *code*
$windows = $windows->visible()->find("*code*");
$windows->dump();
// Grab the first window
$window = $windows->first();
$window->dump();
// Focus the window and simulate F1 being pressed
$window->focus()->sendKeys("F1");