Tiny Core Linux

General TC => Programming & Scripting - Unofficial => Topic started by: Misalf on April 17, 2016, 05:11:22 PM

Title: Openbox - xrandr pipe menu for resolution and stuff
Post by: Misalf on April 17, 2016, 05:11:22 PM
Hi there.
I sometimes connect a bigger screen to my netbook so I was happy when I found  ob-randr  which makes things easy for Openbox users.
http://openbox.org/wiki/Openbox:Pipemenus (-> Miscellaneous: ob-randr) or https://github.com/whiteinge/ob-randr

It's a Python script though, pretty much the only one I was using, so I converted its functionality to Shell script because reasons.

(http://forum.tinycorelinux.net/index.php?action=dlattach;topic=19886.0;attach=4590)

Also, this way I can extend it (easily) if needed (dunno python).
For now, I just added the possibility to set  DISPLAY-X <[--left-of|--right-of|--above|--below|--same-as]> Display-Y , which the original ob-randr still has on its TODO list (5-years-ninja'ed),

(http://forum.tinycorelinux.net/index.php?action=dlattach;topic=19886.0;attach=4589)

added settings for software-brightness (gamma) and the possibility to change settings of not-connected displays (i.e. still generating the menu for setting "left-of" before turning on the display, etc. ; just no resolution settings).

The config layout from the original  ob-randr  works, too. Meaning one can save often used xrandr settings to a file and execute them with this menu ("shortcuts") in the same way as the original python version of ob-randr does (I hope).


Currently, the script does only little error checking regarding the use of Xorg. Needs more checking under Xvesa and Xfbdev.
Title: Re: Openbox - xrandr pipe menu for resolution and stuff
Post by: Misalf on April 17, 2016, 05:42:32 PM
Oh, I also added that VGA info (question mark in VRAM comes from lspci cannot see more than 256MB, which may be more actually; Depending on driver, Xorg's log may provide more info which is used instead if it does).

Install instructions are in the script.

Complains welcome.
Title: Re: Openbox - xrandr pipe menu for resolution and stuff
Post by: Misalf on April 17, 2016, 06:04:02 PM
One more thing I should note:
Since the default Openbox scripts on TinyCore rewrite the Openbox config (menu.xml) upon starting the X sever, the following is needed to make this menu persistent across reboots...

~/.config/openbox/rc.xml  defines the menu file
Code: [Select]
...
<file>menu.xml</file>
...
Change that to
Code: [Select]
...
<file>menu-whatever.xml</file>
...
And ...
Code: [Select]
cp ~/.config/openbox/menu.xml ~/.config/openbox/menu-whatever.xml
Then ...
Code: [Select]
editor ~/.config/openbox/menu-whatever.xml
And add ...
Code: [Select]
<menu id="xrandr-menu" label="Displays" execute="~/.config/openbox/pipe_xrandr.sh"/>
... wherever suitable.