Phillip Berndt [Sun, 15 Nov 2020 15:32:28 +0000 (16:32 +0100)]
Release 1.11
This updates the readme with changes since 1.10.1 and releases 1.11.
This version primarily brings small bugfixes, only change warranting
minor version bump is that batch mode now assigns user groups.
In batch mode, set groups to group membership of target user.
Previously, group list was cleared during privilege de-escalation. This causes
profiles scripts to be run as the local user with an empty group list. This can
cause issues when, eg, the 'video' group is required for backlight control,
and the user is trying to invoke xbacklight from postswitch.sh.
* *2020-04-23* Fix hook script execution order to match description from readme
* *2020-04-11* Handle negative gamma values (fixes #188)
* *2020-04-11* Sort approximate matches in detected profiles by quality of match
* *2020-01-31* Handle non-ASCII environment variables (fixes #180)
* *2019-12-31* Fix output positioning if the top-left output is not the first
* *2019-12-31* Accept negative gamma values (and interpret them as 0)
* *2019-12-31* Prefer the X11 launcher over systemd/udev configuration
Vincent Bernat [Thu, 16 Jan 2020 10:42:06 +0000 (11:42 +0100)]
Handle non-ASCII environment variable values
When a process has an UTF-8 character in its environment, autorandr
crashes with:
```
Unhandled exception ('utf-8' codec can't decode byte 0xab in position 0: invalid start byte). Please report this as a bug at https://github.com/phillipberndt/autorandr/issues.
Traceback (most recent call last):
File "./autorandr.py", line 1439, in <module>
exception_handled_main()
File "./autorandr.py", line 1423, in exception_handled_main
main(sys.argv)
File "./autorandr.py", line 1203, in main
dispatch_call_to_sessions([x for x in argv if x != "--batch"])
File "./autorandr.py", line 1110, in dispatch_call_to_sessions
for environ_entry in open(environ_file).read().split("\0"):
File "/usr/lib/python3.7/codecs.py", line 322, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xab in position 0: invalid start byte
```
Instead, we read the environment without decoding and convert to ASCII
explicitely. Any environment variable not decodable will just be
skipped.
Vincent Bernat [Thu, 16 Jan 2020 10:48:59 +0000 (11:48 +0100)]
Fork and exec using the current Python interpreter
When testing against various versions of Python by invoking autorandr
with an explicit Python interpreter, in batch mode, autorandr will
reexecute itself without specifying the Python interpreter. This
change makes sure it is reexecuted using the current Python
interpreter.
Phillip Berndt [Tue, 31 Dec 2019 10:41:27 +0000 (11:41 +0100)]
Prefer X11 launcher (like srandr) over udev/systemd setup
See #162. The X11 launcher, that waits for randr events in X11 and runs
autorandr manually, proved to be more reliable than the setup using udev
and systemd. Make it the default.
Maximilian Bosch [Thu, 21 Mar 2019 23:49:42 +0000 (00:49 +0100)]
Work around problems with autorandr's completion when using `bashcompinit`
On ZSH the easiest approach to get bash completions running is to use
`bashcompinit`. Unfortunately it seems as there are slight differences
between ZSH and bash which cause problems when using that feature.
I had to change the following things:
* Replace the `-n` check with a length check of the AR directory array:
ZSH adds an empty string at first if no system directory for autorandr
was found. Checking if there's at least a single element works around
this problem.
* Silence errors from `find`. The empty string at first causes a
`directory not found error` during the completion.
It can be tested on ZSH after running the following command:
Josiah Schwab [Sat, 9 Feb 2019 19:42:45 +0000 (11:42 -0800)]
Fix case in which x and y are not specified in panning
The regular expression that extracts the panning values has optional
matches for the named groups x and y.
Previously, the case in which there is no match for x and y looks to
have been attempted to be handled by doing
detail.get("x", "0")
This is a bug. The default argument to dict.get is only returned when
the key is not a member of the dictionary. However, when a group
fails to participate in the regex match, the dict does have a key.
The default value of this default key is None. This would lead to an
error when the get returned None and None was then cast to an integer.
This resolves the issue by explicitly setting the groupdict default to
be "0", which is appropriate for the two groups (x and y) that may
optionally participate in the match.