Search code examples
chromium

Programmatically retrieving the contents of the chrome://gpu url


I am trying to programmatically retrieve the contents of the chrome://gpu url.

As a start I tried to load up chrome://gpu from the command-line, but chromium refuses to start up with a url that is prefixed with a chrome: prefix.

Then I tried to out-clever that limitation by using a redirect page:

<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="refresh" content="7; url='chrome://gpu'" />
  </head>
  <body>
    <p>Please follow <a href="chrome://gpu">this link</a>.</p>
  </body>
</html>

But that page, although it can be launched from command line, would not refresh for me.

Even clicking the link does not work, which leads me to determine that you cannot link to chrome://gpu at all.

When I tried right-click open-in-tab on the link, I get:

enter image description here

Which means that chromium is actively blocking access to it, unless it is typed out by the user.

I have two questions:

  1. Can this block be disabled?

  2. If not, how can I retrieve this information programmatically? Can I somehow feed artificial keystrokes into chromium?

Update 1

Tried to add virtual key-strokes with:

$ wtype test
Compositor does not support the virtual keyboard protocol

Update 2

I have gotten further: I can use ydotool to make chromium browse to chrome://gpu and then do Save-As, but that saves a nearly empty html page that references a gpu_internals.js script.

Is it possible to save the output of that script instead?


Solution

  • I've found ydotool to be a good solution for this.

    With it, you can automatically open a page to chrome://gpu and then click in the browser window, followed by Ctrl+A, Ctrl+C to retrieve to contents to the clipboard.

    You can then use wl-paste from the wl-clipboard package to get it.