Created
August 27, 2020 17:09
-
-
Save scorninpc/353490e8c860515cb8e0695738732fc3 to your computer and use it in GitHub Desktop.
Dock with PHP-GTK 3
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Tests with PHP-GTK 3 to create a simple GTK dock / panel | |
* | |
* https://github.com/scorninpc/php-gtk3 | |
* | |
* Just download the appimage from release, make it executable, and run ./php-gk3-ARCH-VERSION.appimage dockStupido.php | |
*/ | |
$title = "dockStupido"; | |
$width = 1920; | |
$height = 24; | |
$dock = new \GtkWindow(\Gtk::WINDOW_POPUP); | |
$dock->set_size_request($width, $height); | |
$dock->set_title($title); | |
$dock->show(); | |
// Make the dock | |
$commands = [ | |
"win=\$(xdotool search --name '^dockStupido\$');", | |
"WIDTH=" . $width . "; HEIGHT=" . $height . ";", | |
"SCREEN_WIDTH=\$(xrandr -q | head -n2 | tail -n1 | awk '{print \$4}' | awk -F'[+]' '{print \$1}' | awk -F'[x]' '{print \$1}');", | |
"SCREEN_HEIGHT=\$(xrandr -q | head -n2 | tail -n1 | awk '{print \$4}' | awk -F'[+]' '{print \$1}' | awk -F'[x]' '{print \$2}');", | |
"xdotool windowunmap --sync \$win;", | |
"xdotool windowsize --sync \$win \$WIDTH \$HEIGHT;", | |
"xdotool windowmove --sync \$win \$((\$SCREEN_WIDTH - \$WIDTH)) \$((\$SCREEN_HEIGHT - \$HEIGHT));", | |
"xprop -id \"\${win}\" -format _NET_WM_WINDOW_TYPE 32a -set _NET_WM_WINDOW_TYPE \"_NET_WM_WINDOW_TYPE_DOCK\";", | |
"xprop -id \"\${win}\" -format _NET_WM_STRUT_PARTIAL 32cccccccccccc -set _NET_WM_STRUT_PARTIAL \"0,0,0,\${HEIGHT},0,0,0,0,0,\${WIDTH},0,0\"", | |
"", | |
]; | |
exec(implode(" ", $commands)); | |
// Loop | |
\Gtk::main(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Tests with PHP-GTK 3 to create a simple GTK dock / panel
https://github.com/scorninpc/php-gtk3
Just download the appimage from release, make it executable, and run
./php-gk3-ARCH-VERSION.appimage dockStupido.php
This will create a blank window like a dock or panel at bottom of screen