koiuo / randrctl

Profile based screen manager for X
GNU General Public License v3.0
47 stars 12 forks source link

ValueError: invalid literal for int() with base 10: '1080_60.00' #31

Open endreszabo opened 3 years ago

endreszabo commented 3 years ago

I guess randrctl tries to parse the resolutions as an integer. Sometimes, there are characters other than number in the 'mode' string. For instance my VIRTUAL1 output has the following modes that leads randctrl to fail:

VIRTUAL1 connected (normal left inverted right x axis y axis)
   1280x720_vnc  60.00  
   1920x1080_60.00  60.00  

Full trace:

python /usr/bin/randrctl switch-to 2dp-usb-c-n-at-e
Traceback (most recent call last):
  File "/usr/bin/randrctl", line 10, in <module>
    sys.exit(main())
  File "/home/e/.local/lib/python3.9/site-packages/randrctl/cli.py", line 311, in main
    return cmd(randrctl, args)
  File "/home/e/.local/lib/python3.9/site-packages/randrctl/cli.py", line 155, in cmd_switch_to
    randrctl.switch_to(args.profile_name)
  File "/home/e/.local/lib/python3.9/site-packages/randrctl/ctl.py", line 71, in switch_to
    self._apply(p)
  File "/home/e/.local/lib/python3.9/site-packages/randrctl/ctl.py", line 64, in _apply
    raise e
  File "/home/e/.local/lib/python3.9/site-packages/randrctl/ctl.py", line 60, in _apply
    self.xrandr.apply(p)
  File "/home/e/.local/lib/python3.9/site-packages/randrctl/xrandr.py", line 52, in apply
    args = self._compose_mode_args(profile, self.get_all_outputs())
  File "/home/e/.local/lib/python3.9/site-packages/randrctl/xrandr.py", line 131, in get_all_outputs
    o = self._parse_xrandr_connection(i)
  File "/home/e/.local/lib/python3.9/site-packages/randrctl/xrandr.py", line 234, in _parse_xrandr_connection
    dw, dh = map(lambda s: int(s), display.mode.split('x'))
  File "/home/e/.local/lib/python3.9/site-packages/randrctl/xrandr.py", line 234, in <lambda>
    dw, dh = map(lambda s: int(s), display.mode.split('x'))
ValueError: invalid literal for int() with base 10: '1080_60.00'
endreszabo commented 3 years ago

How can I help? I really want as I like this project.

koiuo commented 3 years ago

@endreszabo , thanks for reporting and responding with the intent to help. I really appreciate that :pray:

I do not have time to work on this right now. Moreover, at some point I've been half through the rewrite of this tool to a different language (which should've solved issues like this one, as it would rely on Xorg APIs rather than xrandr output), so if I had free time, I'd better invest it there.

At this point the best help would be to prepare a pull-request that fixes the issue.