Last release introduced a bug, where if you had a monitor in your config that was not active, it would error out the script and prevent screenchanges

This commit is contained in:
generaldenmark
2020-11-13 15:50:12 +01:00
parent 57fe74e4d1
commit 2f455a6a5e
2 changed files with 8 additions and 6 deletions

View File

@@ -31,7 +31,7 @@ class WorkSpacer:
self.current_output_name = None
def _connect(self):
self.print_if_debug('all available outputs on device')
self.print_if_debug('All available outputs on device')
self.print_if_debug(names_for_outputs)
try:
self.i3 = Connection()
@@ -55,6 +55,8 @@ class WorkSpacer:
for matchNum, match in enumerate(
re.finditer(r'workspace (\$.*) output (\$.*)', self.config, re.MULTILINE)
):
if not config_outputs.keys().__contains__(match.group(2)):
continue # Not an active display, skip it
if not self.workspaces_on_outputs.keys().__contains__(config_outputs[match.group(2)]):
self.workspaces_on_outputs[config_outputs[match.group(2)]] = []
self.workspaces_on_outputs[config_outputs[match.group(2)]].append(
@@ -90,19 +92,19 @@ class WorkSpacer:
y_offset = output.__dict__["rect"].__dict__["y"]
if x_offset == 0 and y_offset == 0:
if x_offset <= self.mouse_position[0] <= x_offset + width and y_offset <=\
if x_offset <= self.mouse_position[0] <= x_offset + width and y_offset <= \
self.mouse_position[1] <= y_offset + height:
return output.__dict__["name"]
elif x_offset == 0:
if x_offset <= self.mouse_position[0] <= x_offset + width and y_offset <\
if x_offset <= self.mouse_position[0] <= x_offset + width and y_offset < \
self.mouse_position[1] <= y_offset + height:
return output.__dict__["name"]
elif y_offset == 0:
if x_offset < self.mouse_position[0] <= x_offset + width and y_offset <=\
if x_offset < self.mouse_position[0] <= x_offset + width and y_offset <= \
self.mouse_position[1] <= y_offset + height:
return output.__dict__["name"]
else:
if x_offset < self.mouse_position[0] <= x_offset + width and y_offset <\
if x_offset < self.mouse_position[0] <= x_offset + width and y_offset < \
self.mouse_position[1] <= y_offset + height:
return output.__dict__["name"]

View File

@@ -4,7 +4,7 @@ with open('README.rst', 'r') as fh:
setup(
name='pi3-smart-workspace',
version='0.1.7',
version='0.1.8',
packages=['pi3'],
url='https://github.com/GeneralDenmark/PyOutputHandler',
license='Apache-2.0 License ',