PDA

View Full Version : xrandr-tui



sea
21st January 2016, 11:51 PM
Heyas everyone

My machine is a laptop, and recently i've got my hands on a 16:10 LCD and a keyboard.
Well, me used to connect my laptop to the TV to watch some movies (from dvd).
For that i used to use my script 'hdmi', which still may be found on this forum using the search function.

Anyway, with the LCD, i figured, the chances to plug it in might be more often than watching a dvd from the laptop.
And since i was reworking my WM at that time, i started writing xdisplay/xrandr-tui to have a matching script for the screen-toggle (fn+f4)

I have only that one monitor, so the two most occasions occouring would be:

switch
side a side (linear)


With the help of the community, i'd like to provide more help for more 'complex' scenarios.
However, this is a wrapper script (TUI), so it requires TUI (website (https://savannah.nongnu.org/projects/tui/), download (http://git.savannah.gnu.org/cgit/tui.git/snapshot/tui-master.tar.gz), install (http://git.savannah.gnu.org/cgit/tui.git/tree/docs/INSTALL.md)) (will be installed automaticly, if missing, when installing xrandr-tui)

How it currently looks (developement, alpha, it works though):
https://raw.githubusercontent.com/sri-arjuna/awesome/master/screenshots/preview-xdisplay-resolution.jpg
The 'reset' task is currently hardcoded to my system, but shall take its values from a conf file in the future.
If there were more active (connected and used) displays, it would ask for which one you would like to change the resolution.

So, once TUI is installed (see right above the screenshot), you can create a new script: "$HOME/bin/xrandr-tui" and give it execution flag: "chmod +x xrandr-tui".
<-- See next post for the script its code, otherwise the post is too long -->

So what is this all about?
First, i've just achieved a script that helps me to do the display stuff in a lazy, i'm excited about it and want to share.
Issue along with this, since i wrote for myself, it requires, for which it just so happens i require any kind of opinions and feedback (http://forums.fedoraforum.org/showthread.php?t=308454) from (end-)users and scripters...
But figured several people have issues with multiscreen setups, so do i, i just hope my script helps you to master the situation a bit better.

Blind Emergency:
In case all your screens turned black, i hepe you recall where the terminal window was, so you can enter "xrandr-tui/xdisplay", and choose '6' (or whatever number 'reset' is by the time happening) to reset your displays to the default values.
However, at some time (linear, mirror) it might be required to reboot to have the new layout applied properly.
In that case, simply switch to tty (CTRL+ALT+F2) and reboot.

And for this thread (and for now):
Does it work properly and reliable for you?
Got a setup to share? (please share all required (xrandr,etc) commands to achieve it)

Switch works perfectly (for me, most required)!
Linear works (for me, after a reboot).
Mirror works (for me, after a reboot).

What is your setup?
If anything different than single monitor (or dual using switch/docking station), or side-a-side and line-above-again (eg: 2 lines with each 3 screens as columns)...

I wonder if there would be a need to create some default values for: 4:3, 16:10 and 16:9 displays automaticly?
Or and if one should be able to add a custom screen resolution as well?

Thank you and hope this helps

sea
21st January 2016, 11:51 PM
<-- Script became too long already, please see post #4 -->

As the thread continues and grows, this post/code will be updated along the way.

Dutchy
22nd January 2016, 08:22 PM
Seems like a nice application of your TUI.
xrandr is something that you don't use that often and you need to use it you've forgotten the commands (especially the more complex ones like adding new modelines are nasty).

sea
23rd January 2016, 07:43 PM
Thank you Dutchy.
Yeah, i've been thinking about that too.

Since i wanted this to be a community project, to get people like you and others attracted to TUI, I made it a github project.
Well, it is early evening for me, but i'd like to share/announce its adress for a better cooperation.

In case anyone wants to contribute some bits, there it is: https://github.com/sri-arjuna/xrandr-tui
With the script already be too long for a single post, please get the script from: --> here <-- (https://raw.githubusercontent.com/sri-arjuna/xrandr-tui/master/bin/xrandr-tui)
It still requires TUI (website (https://savannah.nongnu.org/projects/tui/), download (http://git.savannah.gnu.org/cgit/tui.git/snapshot/tui-master.tar.gz), install (http://git.savannah.gnu.org/cgit/tui.git/tree/docs/INSTALL.md))

* 2016.01.23 - 0.3.1 - sea

- 'Reset' now uses the conf file
- 'Switch' now works from cli too
- 'help-screen', manpage when installed using configure
- Add new mode


Add new mode looks like: (had no more free modes, rm modes is still to do)
https://raw.githubusercontent.com/sri-arjuna/xrandr-tui/master/screenshots/xrandr-tui_add_mode.jpg

Hope you like it

EDIT:
If you have any recomendations for the different kinds of modes preset lists (box,hd.wide), please let me know. :)

sea
23rd January 2016, 10:08 PM
0.3.2

Addded: '--list-used'
Updated: '--reset' works now
Updated: Several typos fixed
Updated: Now, one can enter the configuration from the main menu as well
Updated: when installed using ./configure, the tmp manpage is now removed (by make distclean)


Now i'm off for weekend too, enjoy :)

kurtdriver
24th January 2016, 03:43 AM
Sea, add an option for custom resolution and I'm in, I have a laptop hooked up to a tv, the tv's resolution is 1280x768, unavailable to me in Xfce.
I can set resolution quite easily with Xfce's built in program, just not the one I need. Add that feature and your script will be miles ahead of other options.

sea
24th January 2016, 10:20 AM
0.4 - sea

Added: Mode - Add - Custom
Added: Mode - Remove (not all modes are removable!)
Updated: '--mirror' seems to work for now (beware of different resolutions!)


Someone with 3 or more screens please let me know if the 'linear' mode from the menu works as expected.

kurtdriver
24th January 2016, 05:02 PM
Thank you Sea.

kurtdriver
24th January 2016, 06:34 PM
Well that didn't work.

[kurt@Jupiter ~]$ unzip xrandr-tui-master.zip
Archive: xrandr-tui-master.zip
225fbe6d70da487398ec98e31176b4cf838d2145
xrandr-tui-master/ChangeLog exists and is a symbolic link.
replace xrandr-tui-master/ChangeLog? [y]es, [n]o, [A]ll, [N]one, [r]ename: A
linking: xrandr-tui-master/ChangeLog -> docs/ChangeLog
linking: xrandr-tui-master/README.md -> docs/README.md
inflating: xrandr-tui-master/bin/xrandr-tui
inflating: xrandr-tui-master/configure
inflating: xrandr-tui-master/configure.yassi
inflating: xrandr-tui-master/docs/ChangeLog
inflating: xrandr-tui-master/docs/LICENSE
inflating: xrandr-tui-master/docs/README.md
inflating: xrandr-tui-master/screenshots/xrandr-tui_add_mode.jpg
inflating: xrandr-tui-master/screenshots/xrandr-tui_change_resolution.jpg
finishing deferred symbolic links:
xrandr-tui-master/ChangeLog -> docs/ChangeLog
lchmod (file attributes) error: Function not implemented
xrandr-tui-master/README.md -> docs/README.md
lchmod (file attributes) error: Function not implemented

sea
24th January 2016, 07:39 PM
The download i just checked worked fine.
Do have any issues with other zip files?

EDIT:
Because it seems your unzip is missing a function?

EDIT2:
As a workaround you can copy paste the script content directly.
https://raw.githubusercontent.com/sri-arjuna/xrandr-tui/master/bin/xrandr-tui
You will then need to install TUI manually (see top post)

hth

sea
25th January 2016, 09:31 PM
0.4.2

Code: Massive rework of internal message handling (names)
Updated: Switch Display
Updated: Screen resolution
Added: screenshots/xrandr-tui_remove_mode.jpg
Requires TUI 0.9.4-5 ! (download) (https://savannah.nongnu.org/files/?group=tui)


And as a 'final note':
It does what I need it to, feel free to contribute the parts you need.
With the massive rework of the internal message names it is prepared for your cooperation.

However, I will add the following:

HZ per output
Select HZ when adding a new mode
Improve: Mirror & Linear