Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't set --fb when disabling outputs #219

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions autorandr.py
Original file line number Diff line number Diff line change
Expand Up @@ -770,10 +770,10 @@ def apply_configuration(new_configuration, current_configuration, dry_run=False)

fb_dimensions = get_fb_dimensions(new_configuration)
try:
base_argv += ["--fb", "%dx%d" % fb_dimensions]
fb_argv = ["--fb", "%dx%d" % fb_dimensions]
except:
# Failed to obtain frame-buffer size. Doesn't matter, xrandr will choose for the user.
pass
fb_argv = []

auxiliary_changes_pre = []
disable_outputs = []
Expand Down Expand Up @@ -852,7 +852,11 @@ def apply_configuration(new_configuration, current_configuration, dry_run=False)
# Enable the remaining outputs in pairs of two operations
operations = disable_outputs + enable_outputs
for index in range(0, len(operations), 2):
argv = base_argv + list(chain.from_iterable(operations[index:index + 2]))
argv = base_argv
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This creates a reference to base_argv. The += below changes base_argv itself!

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops! Yes. I'm out of practice in mutable collections.

# Only set fb argument when adding monitors. We may be removing the biggest.
if index >= len(disable_outputs):
argv += fb_argv
argv += list(chain.from_iterable(operations[index:index + 2]))
if call_and_retry(argv, dry_run=dry_run) != 0:
raise AutorandrException("Command failed: %s" % " ".join(argv))

Expand Down