Skip to content

Scratchpads broken on Hyprland 0.53.0 due to windowrule syntax change #201

Description

@bmethod

Hyprland 0.53.0 completely overhauled the windowrule syntax. This breaks pyprland scratchpads because the old format is no longer valid.

Errors seen

FAILED b'invalid field float: missing a value'
FAILED b'invalid field unset: missing a value'
FAILED b'invalid field class:org.coolercontrol.CoolerControl: missing a value'

Cause

Pyprland sends the old syntax:

windowrule float,class:classname
windowrule workspace special:S-name silent,class:classname

Hyprland 0.53.0 requires:

windowrule match:class classname, float on
windowrule match:class classname, workspace special:S-name silent

Workaround

I've patched plugins/scratchpads/__init__.py locally with the following changes:

  1. Added a new class decorator for 0.53.0+:
def class_decorator_053(name: str) -> str:
    """Return the class rule for hyprland 0.53.0+."""
    return f"match:class {name}"
  1. Updated version detection in on_reload:
if state.hyprland_version >= VersionInfo(0, 53, 0):
    self._classify = class_decorator_053
    self._rule_format = "new"
elif state.hyprland_version > VersionInfo(0, 47, 2):
    self._classify = class_decorator_new
    self._rule_format = "old"
else:
    self._classify = class_decorator_old
    self._rule_format = "old"
  1. Updated all windowrule constructions to swap the order for 0.53.0+:
# Old format
f"windowrule float,{self._classify(defined_class)}"
# New format  
f"windowrule {self._classify(defined_class)}, float on"

This applies to float, workspace, move, size, and unset rules.

Note: The unset rule still shows an error - I'm not certain of the correct 0.53.0 syntax for unsetting windowrules.

Environment

  • Hyprland 0.53.0
  • pyprland 2.5.1 (git)

Related

#191

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions