Skip to content

Commit

Permalink
Allow overriding the Hyprland version (fixes #105)
Browse files Browse the repository at this point in the history
  • Loading branch information
fdev31 committed May 23, 2024
1 parent daa19a3 commit 5106b84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion pyprland/plugins/pyprland.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ async def init(self) -> None:

if version_str:
try:
state.hyprland_version = VersionInfo(*(int(i) for i in version_str[1:].split(".")[:3]))
self.__set_hyprland_version(version_str[1:])
except Exception: # pylint: disable=broad-except
self.log.exception('Fail to parse version tag "%s"', version_str)
await self.notify_error(f"Failed to parse hyprctl version tag: {version_str}")
Expand All @@ -56,6 +56,9 @@ async def event_monitorremoved(self, name: str) -> None:
async def on_reload(self) -> None:
"""Reload the plugin."""
state.variables = self.config.get("variables", {})
version_override = self.config.get("hyprland_version")
if version_override:
self.__set_hyprland_version(version_override)

async def event_activewindowv2(self, addr: str) -> None:
"""Keep track of the focused client."""
Expand All @@ -80,3 +83,7 @@ def set_commands(self, **cmd_map) -> None:
"""Set some commands, made available as run_`name` methods."""
for name, fn in cmd_map.items():
setattr(self, f"run_{name}", fn)

def __set_hyprland_version(self, version_str: str) -> None:
"""Set the hyprland version."""
state.hyprland_version = VersionInfo(*(int(i) for i in version_str.split(".")[:3]))
2 changes: 1 addition & 1 deletion pyprland/version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
"""Package version."""

VERSION = "2.3.2-14"
VERSION = "2.3.2-15"

0 comments on commit 5106b84

Please sign in to comment.