Fabric-Development / fabric

The next-generation framework for building desktop widgets using Python
https://ffpy.org
GNU Affero General Public License v3.0
442 stars 16 forks source link

Unable to run the test code without Hyprland #40

Closed saipavanc closed 3 months ago

saipavanc commented 3 months ago

I am trying to install Fabric on Nixos using nix-shell, and I have the following error:

fabric_shell ~/dotfiles/fabric $ python
Python 3.11.9 (main, Apr  2 2024, 08:25:04) [GCC 13.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from fabric.widgets.label import Label
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/nix/store/79ym61nlb8m9cbaxx6lf0ga720rhgzzz-python3.11-fabric-git/lib/python3.11/site-packages/fabric/widgets/__init__.py", line 28, in <module>
    from fabric.hyprland.widgets import Workspaces as HyprlandWorkspaces
  File "/nix/store/79ym61nlb8m9cbaxx6lf0ga720rhgzzz-python3.11-fabric-git/lib/python3.11/site-packages/fabric/hyprland/widgets.py", line 18, in <module>
    connection = Hyprland()
                 ^^^^^^^^^^
  File "/nix/store/79ym61nlb8m9cbaxx6lf0ga720rhgzzz-python3.11-fabric-git/lib/python3.11/site-packages/fabric/hyprland/service.py", line 118, in __init__
    raise HyprlandSocketNotFoundError(
fabric.hyprland.service.HyprlandSocketNotFoundError: Hyprland socket doesn't seem to be found,
Is Hyprland running?
>>> from fabric.widgets.label import Label

When I am trying to import from widgets, it fails initially for the first run, but works fine for the second run. I am able to open the example 'Hello World!' window as shown in the documentation, but it does not work in a script as it fails for the first import.

its-darsh commented 3 months ago

this is an addressed issue with this version of Fabric and it's already fixed in the rewrite :)

the reason behind this error is that we import Hyprland's widgets in the __init__.py of fabric/widgets folder, removing those imports will resolve this issue

saipavanc commented 3 months ago

I agree, it is a simple fix. Is the rewrite already committed? The init file for widgets still has the Hyprland imports in the main branch, I don't see other branches as well.

its-darsh commented 3 months ago

it's still in local development, so far it's turning complete :D

saipavanc commented 3 months ago

That sounds great! Thanks so much for the great work :), I was looking for just this package as I am familiar with Python than js. Nice that it works with X11 too, can use the old bspwm config if needed.