|
|
@ -5,26 +5,26 @@ declare(strict_types=1); |
|
|
|
namespace App\LayoutDriver; |
|
|
|
|
|
|
|
/** |
|
|
|
* Interface to xrandr for configuring outputs |
|
|
|
* Interface to xrandr for configuring outputs. |
|
|
|
* |
|
|
|
* @author Adam Pippin <hello@adampippin.ca> |
|
|
|
*/ |
|
|
|
class Xrandr implements \App\ILayoutDriver |
|
|
|
{ |
|
|
|
/** |
|
|
|
* The xrandr command |
|
|
|
* The xrandr command. |
|
|
|
* @var \App\System\Command\Xrandr |
|
|
|
*/ |
|
|
|
protected $_xrandr; |
|
|
|
|
|
|
|
/** |
|
|
|
* Cache of current display parameters |
|
|
|
* Cache of current display parameters. |
|
|
|
* @var array<string, array> |
|
|
|
*/ |
|
|
|
protected $_displays; |
|
|
|
|
|
|
|
/** |
|
|
|
* Create a new xrandr driver |
|
|
|
* Create a new xrandr driver. |
|
|
|
* |
|
|
|
* @param \App\System\Command\Xrandr $xrandr_cmd |
|
|
|
*/ |
|
|
@ -34,7 +34,7 @@ class Xrandr implements \App\ILayoutDriver |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Read display parameters from xrandr |
|
|
|
* Read display parameters from xrandr. |
|
|
|
* |
|
|
|
* @return void |
|
|
|
*/ |
|
|
@ -48,10 +48,10 @@ class Xrandr implements \App\ILayoutDriver |
|
|
|
if (preg_match('/^(?<output>[^ ]+) connected (?<primary>primary )?(?<screen_w>[0-9]+)x(?<screen_h>[0-9]+)\\+(?<screen_x>[0-9]+)\\+(?<screen_y>[0-9]+) /', $line, $match)) |
|
|
|
{ |
|
|
|
$this->_displays[$match['output']] = [ |
|
|
|
'x' => $match['screen_x'], |
|
|
|
'y' => $match['screen_y'], |
|
|
|
'w' => $match['screen_w'], |
|
|
|
'h' => $match['screen_h'], |
|
|
|
'x' => (int)$match['screen_x'], |
|
|
|
'y' => (int)$match['screen_y'], |
|
|
|
'w' => (int)$match['screen_w'], |
|
|
|
'h' => (int)$match['screen_h'], |
|
|
|
'primary' => !empty($match['primary']) |
|
|
|
]; |
|
|
|
} |
|
|
|