You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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:
Screen 0: minimum 8 x 8, current 1366 x 768, maximum 32767 x 32767
LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 293mm x 164mm
1366x768 60.02*+ 40.01
1360x768 59.80 59.96
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
DP1 disconnected (normal left inverted right x axis y axis)
DP2 disconnected (normal left inverted right x axis y axis)
DP3 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
HDMI3 disconnected (normal left inverted right x axis y axis)
VGA1 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)
Here's what autorandr outputs when --config option is used:
output LVDS1
mode primary
pos x
rotate 1366x768+0+0
output DP1
off
output DP2
off
output DP3
off
output HDMI1
off
output HDMI2
off
output HDMI3
off
output VGA1
off
output VIRTUAL1
off
(Note the pos x for example).
When trying to load such config xrandr prints an error
xrandr: failed to parse 'x' as a position
Try 'xrandr --help' for more information.
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:
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 preswitch hook is present, but not needed, since this version takes care of the order of operations (deactivates screens first, then activates the used ones).
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).
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
This file contains hidden or 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
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.