Preswitch hook and arandr method for dumping current xrandr config#34
Preswitch hook and arandr method for dumping current xrandr config#34gabrys wants to merge 2 commits intowertarbyte:masterfrom
Conversation
|
This repository is unmaintained. See #33. All of the problems you're experiencing have likely already been solved by earlier pull requests: See https://github.com/phillipberndt/autorandr/ for the most recent version. Especially, a
In theory, yes, but in practice, it doesn't. See phillipberndt/autorandr#17 (comment)
As far as I can see, arandr also parses the output of |
|
@phillipberndt thanks for the answers. I'll take a look at the fork :-). |
Hi,
I wanted to use autorandr as I think it represents a brilliant idea. Unfortunately I had a problem with the dumper code, it seems to misinterpret the xrandr output. Here the output from xrandr:
Here's what autorandr outputs when --config option is used:
(Note the pos x for example).
When trying to load such config xrandr prints an error
Parsing xrandr seems very brave to me, since the command output can change from version to version (and I think this is what did happen and caused the isuse). Using the xrandr lib would be perfect, but then autorandr is such a shell script, right? Fortunately there's a nice Python utility to help called arandr that ships with a tool called unxrandr, that use the xrandr lib bindings to dump the current xrandr state in a form of a xrandr command call ready to use, for example:
I augmented the autorandr code to take advantage of this great tool. The patch follows the conventions already used by the tool author just adding a new method to dump the config (the idea of methods in the script is very nice!).
The second commit of the pull request is much more straight-forward. I added the preswitch hook that are launched just before the config is applied. This is useful for me, because I have an Intel card that is capable of displaying on at maximum 2 screen at once and can't switch from displaying 2 external screens to the laptop screen (the common scenario when detaching from a docking station) without disabling the external screens first. In this case I just put the following in the preswitch hook:
... and everything works nicely.
Hope this pull request makes sense to you and follows the conventions, thus could be merged for others' profit.