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

Crash during launch with Hyprland v0.35 KeyError: 'physical-width' and with Hyprland v0.37.1 KeyError: 'monitor' #54

Closed
iqbal1975 opened this issue Mar 17, 2024 · 5 comments

Comments

@iqbal1975
Copy link

OS: Arch
WM: Hyprland v0.35

Monitor config in Hyprland:

# Mirror Display
monitor=eDP-1,preferred,auto,1
monitor=DP-2,preferred,auto,1,mirror,eDP-1

hyprctl monitors all

Monitor eDP-1 (ID 0):
	1920x1080@60.00400 at 0x0
	description: Lenovo Group Limited 0x40B2 (eDP-1)
	make: Lenovo Group Limited
	model: 0x40B2
	serial: 
	active workspace: 5 (5)
	special workspace: 0 ()
	reserved: 0 32 0 30
	scale: 1.00
	transform: 0
	focused: yes
	dpmsStatus: 1
	vrr: 0
	activelyTearing: false

Monitor DP-2 (ID 1):
	1920x1080@60.00000 at 0x0
	description: Sony SONY TV 0x01010101 (DP-2)
	make: Sony
	model: SONY TV
	serial: 0x01010101
	active workspace: -1 ()
	special workspace: 0 ()
	reserved: 0 0 0 0
	scale: 1.00
	transform: 0
	focused: no
	dpmsStatus: 1
	vrr: 0
	activelyTearing: false

wlr-randr

DP-2 "Sony SONY TV 0x01010101 (DP-2)"
  Make: Sony
  Model: SONY TV
  Serial: 0x01010101
  Physical size: 1600x900 mm
  Enabled: no
  Modes:
    1920x1080 px, 60.000000 Hz (preferred)
    1920x1080 px, 59.938999 Hz
    1920x1080 px, 50.000000 Hz
    1920x1080 px, 29.972000 Hz
    1920x1080 px, 23.976999 Hz
    1680x1050 px, 59.953999 Hz
    1600x900 px, 60.000000 Hz
    1280x1024 px, 60.020000 Hz
    1152x864 px, 75.000000 Hz
    1280x720 px, 60.000000 Hz
    1280x720 px, 59.943001 Hz
    1280x720 px, 50.000000 Hz
    1280x720 px, 29.972000 Hz
    1280x720 px, 23.976000 Hz
    1024x768 px, 60.004002 Hz
    800x600 px, 60.317001 Hz
    720x576 px, 50.000000 Hz
    720x480 px, 59.939999 Hz
    640x480 px, 59.939999 Hz
    640x480 px, 59.929001 Hz
    0x0 px
eDP-1 "Lenovo Group Limited 0x40B2 (eDP-1)"
  Make: Lenovo Group Limited
  Model: 0x40B2
  Serial: (null)
  Physical size: 340x190 mm
  Enabled: yes
  Modes:
    1920x1080 px, 60.004002 Hz (preferred, current)
    1920x1080 px, 50.001999 Hz
  Position: 0,0
  Transform: normal
  Scale: 1.000000
  Adaptive Sync: disabled

Trying to manually enable DP-2 causes Hyprland to crash and takes me back to SDDM login screen

wlr-randr --dry-run --output DP-2 --on
OR
wlr-randr --output DP-2 --on

Finally,
nwg-displays

Settings: {'view-scale': 0.15, 'snap-threshold': 10, 'indicator-timeout': 500, 'custom-mode': [], 'use-desc': False}
Running on Hyprland
eDP-1 {'active': True, 'modes': [{'width': 1920, 'height': 1080, 'refresh': 60004.002}, {'width': 1920, 'height': 1080, 'refresh': 50001.998999999996}], 'scale_filter': None, 'dpms': True, 'mirror': '', 'monitor': <__gi__.GdkWaylandMonitor object at 0x728de19d9ac0 (GdkWaylandMonitor at 0x5d322cb0ab60)>, 'physical-width': 1920, 'physical-height': 1080, 'refresh': 60.004002, 'adaptive_sync_status': 'disabled', 'focused': True, 'description': 'Lenovo Group Limited 0x40B2 ', 'x': 0, 'y': 0, 'logical-width': 1920, 'logical-height': 1080, 'transform': 'normal', 'scale': 1.0, 'model': '0x40B2'}
DP-2 {'active': False, 'modes': [{'width': 1920, 'height': 1080, 'refresh': 60000.0}, {'width': 1920, 'height': 1080, 'refresh': 59938.999}, {'width': 1920, 'height': 1080, 'refresh': 50000.0}, {'width': 1920, 'height': 1080, 'refresh': 29972.0}, {'width': 1920, 'height': 1080, 'refresh': 23976.999}, {'width': 1680, 'height': 1050, 'refresh': 59953.999}, {'width': 1600, 'height': 900, 'refresh': 60000.0}, {'width': 1280, 'height': 1024, 'refresh': 60020.0}, {'width': 1152, 'height': 864, 'refresh': 75000.0}, {'width': 1280, 'height': 720, 'refresh': 60000.0}, {'width': 1280, 'height': 720, 'refresh': 59943.001000000004}, {'width': 1280, 'height': 720, 'refresh': 50000.0}, {'width': 1280, 'height': 720, 'refresh': 29972.0}, {'width': 1280, 'height': 720, 'refresh': 23976.0}, {'width': 1024, 'height': 768, 'refresh': 60004.002}, {'width': 800, 'height': 600, 'refresh': 60317.001}, {'width': 720, 'height': 576, 'refresh': 50000.0}, {'width': 720, 'height': 480, 'refresh': 59939.999}, {'width': 640, 'height': 480, 'refresh': 59939.999}, {'width': 640, 'height': 480, 'refresh': 59929.001}], 'scale_filter': None, 'dpms': True, 'mirror': '', 'monitor': None, 'focused': False, 'adaptive_sync_status': 'disabled', 'description': 'Sony SONY TV 0x01010101', 'x': 0, 'y': 0, 'logical-width': 1920, 'logical-height': 1080, 'transform': 'normal', 'scale': 1.0, 'model': 'SONY TV'}
Traceback (most recent call last):
  File "/usr/bin/nwg-displays", line 33, in <module>
    sys.exit(load_entry_point('nwg-displays==0.3.14', 'gui_scripts', 'nwg-displays')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/nwg_displays/main.py", line 1243, in main
    create_display_buttons()
  File "/usr/lib/python3.11/site-packages/nwg_displays/main.py", line 563, in create_display_buttons
    b = DisplayButton(key, item["description"], item["x"], item["y"], round(item["physical-width"]),
                                                                            ~~~~^^^^^^^^^^^^^^^^^^
KeyError: 'physical-width'

System information (inxi -Faz) is attached.
system_info.txt
Let me know what other information you need. Thank you.

@nwg-piotr
Copy link
Owner

All the display detection part has already been re-written on the no-wlr-randr branch. However, the change also resolves #35, and relies on this commit on the Hyprland side. This means I cannot release until Hyprland > 0.36 is available. I know that v0.37.1 has been released yesterday, but on Arch we're still on v0.35.

@iqbal1975
Copy link
Author

iqbal1975 commented Mar 20, 2024

Update: New Error now on Arch with Hyprland v0.37.1 : KeyError: 'monitor'

nwg-displays

Settings: {'view-scale': 0.15, 'snap-threshold': 10, 'indicator-timeout': 500, 'custom-mode': [], 'use-desc': False}
Running on Hyprland
eDP-1 {'active': True, 'mirror': '', 'scale_filter': None, 'modes': [{'width': 1920, 'height': 1080, 'refresh': 60000.0}, {'width': 1920, 'height': 1080, 'refresh': 50000.0}], 'focused': True, 'adaptive_sync_status': 'disabled', 'description': 'Lenovo Group Limited 0x40B2', 'x': 0, 'y': 0, 'refresh': 60.0, 'logical-width': 1920, 'logical-height': 1080, 'physical-width': 1920.0, 'physical-height': 1080.0, 'transform': 'normal', 'scale': 1.0, 'dpms': True, 'ten_bit': False, 'model': '0x40B2', 'monitor': <__gi__.GdkWaylandMonitor object at 0x734d70502000 (GdkWaylandMonitor at 0x6076d1b3b070)>}
DP-2 {'active': False, 'modes': [{'width': 1920, 'height': 1080, 'refresh': 60000.0}, {'width': 1920, 'height': 1080, 'refresh': 59940.0}, {'width': 1920, 'height': 1080, 'refresh': 50000.0}, {'width': 1920, 'height': 1080, 'refresh': 29970.0}, {'width': 1920, 'height': 1080, 'refresh': 23980.0}, {'width': 1680, 'height': 1050, 'refresh': 59950.0}, {'width': 1600, 'height': 900, 'refresh': 60000.0}, {'width': 1280, 'height': 1024, 'refresh': 60020.0}, {'width': 1152, 'height': 864, 'refresh': 75000.0}, {'width': 1280, 'height': 720, 'refresh': 60000.0}, {'width': 1280, 'height': 720, 'refresh': 59940.0}, {'width': 1280, 'height': 720, 'refresh': 50000.0}, {'width': 1280, 'height': 720, 'refresh': 29970.0}, {'width': 1280, 'height': 720, 'refresh': 23980.0}, {'width': 1024, 'height': 768, 'refresh': 60000.0}, {'width': 800, 'height': 600, 'refresh': 60320.0}, {'width': 720, 'height': 576, 'refresh': 50000.0}, {'width': 720, 'height': 480, 'refresh': 59940.0}, {'width': 640, 'height': 480, 'refresh': 59940.0}, {'width': 640, 'height': 480, 'refresh': 59930.0}], 'mirror': '', 'scale_filter': None, 'focused': False, 'adaptive_sync_status': 'disabled', 'description': 'Sony SONY TV 0x01010101', 'x': 0, 'y': 0, 'refresh': 60.0, 'logical-width': 1920, 'logical-height': 1080, 'physical-width': 1920.0, 'physical-height': 1080.0, 'transform': 'normal', 'scale': 1.0, 'dpms': True, 'ten_bit': False, 'model': 'SONY TV'}
Traceback (most recent call last):
  File "/usr/bin/nwg-displays", line 33, in <module>
    sys.exit(load_entry_point('nwg-displays==0.3.15', 'gui_scripts', 'nwg-displays')())
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/site-packages/nwg_displays/main.py", line 1252, in main
    create_display_buttons()
  File "/usr/lib/python3.11/site-packages/nwg_displays/main.py", line 577, in create_display_buttons
    item["focused"], item["monitor"], mirror=item["mirror"])
                     ~~~~^^^^^^^^^^^
KeyError: 'monitor'

@nwg-piotr
Copy link
Owner

OK, I managed to reproduce the crash and find a quick fix while at the office. Will take a closer look at it tonight, at home.

@iqbal1975 iqbal1975 changed the title Crash during launch KeyError: 'physical-width' Crash during launch with Hyprland v0.35 KeyError: 'physical-width' and with Hyprland v0.37.1 KeyError: 'monitor' Mar 20, 2024
nwg-piotr added a commit that referenced this issue Mar 21, 2024
@nwg-piotr
Copy link
Owner

The commit above should prevent the program from crashing when Gdk.Monitor assignment fails. It won't resolve other problems we're still experiencing on Hyprland, however. E.g.: mirroring monitors are not listed as active. When you re-launch nwg-displays, they will show up as disabled with x and y values = 0. I don't think we can do much about it.

@iqbal1975
Copy link
Author

Thanks for the quick turnaround @nwg-piotr 👍🏼 Now keeping fingers crossed that I can get mirroring to work on Hyprland ! 🤔 😅

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants