hyprland-community/pyprland

[BUG] [NIX] Crash on startup with 2.2.10

dwilliam62 opened this issue · 15 comments

Pyprland version
2.2.10

Describe the bug
After updating hyprland a working pyrland config fails to load at startup

To Reproduce
Steps to reproduce the behavior:
run pypr in hyprland.conf
pypr at CLI generates this:

Error loading plugin pyprland:
Traceback (most recent call last):
File "/nix/store/ip72pdqf93vfirszcibsfm3cfp0vs2lf-pyprland-2.2.10/lib/python3.11/site-packages/pyprland/command.py", line 121, in _load_single_plugin
await plug.init()
File "/nix/store/ip72pdqf93vfirszcibsfm3cfp0vs2lf-pyprland-2.2.10/lib/python3.11/site-packages/pyprland/plugins/pyprland.py", line 12, in init
version = (await self.hyprctlJSON("version"))["tag"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/ip72pdqf93vfirszcibsfm3cfp0vs2lf-pyprland-2.2.10/lib/python3.11/site-packages/pyprland/ipc.py", line 59, in wrapper
return await func(*args, **kwargs, logger=logger)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/ip72pdqf93vfirszcibsfm3cfp0vs2lf-pyprland-2.2.10/lib/python3.11/site-packages/pyprland/ipc.py", line 100, in hyprctlJSON
ret = json.loads(resp)
^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/init.py", line 346, in loads
return _default_decoder.decode(s)
^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/nix/store/glfr70gi7hfaj50mwj2431p8bg60fhqw-python3-3.11.9/lib/python3.11/json/decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 8 column 16 (char 187)

Expected behavior
that is loads properly with the updated hyprland

Configuration (provide following files/samples when [relevant):
I would love to attach the config files but not matter what I do they are rejected by GITHUB. .toml, tar, tgz, etc..
pyprland.toml

File: pyprland.toml
[pyprland]
plugins = [
"toggle_special",
"scratchpads",
"lost_windows",
"monitors",
"shift_monitors",
"toggle_dpms",
"magnify",
"expose",
"workspaces_follow_focus",
]

[workspaces_follow_focus]
max_workspaces = 9

[expose]
include_special = false

[scratchpads.term]
animation = "fromTop"
command = "kitty --class kitty-dropterm"
class = "kitty-dropterm"
size = "75% 60%"
max_size = "1920px 100%"

[scratchpads.volume]
animation = "fromRight"
command = "pavucontrol"
class = "pavucontrol"
lazy = true
size = "40% 90%"
max_size = "1080px 100%"
unfocus = "hide"

[layout_center]
margin = 60
offset = [0, 30]
next = "movefocus r"
prev = "movefocus l"
next2 = "movefocus d"
prev2 = "movefocus u"

hyprland.conf

exec-once = /nix/store/wmx2x7hc0m0szcb7yzlswnylmv2w5qz8-dbus-1.14.10/bin/dbus-update-activ
ation-environment --systemd DISPLAY HYPRLAND_INSTANCE_SIGNATURE WAYLAND_DISPLAY XDG_CURREN
T_DESKTOP && systemctl --user stop hyprland-session.target && systemctl --user start hyprl
and-session.target
plugin=/nix/store/322gih4fc8apd9yg9l10gq71ic5jlygx-hyprtrails-0.1/lib/libhyprtrails.so
plugin=/nix/store/vzfqdyrfy052mcw0h23xhijba204vxpm-hyprexpo-0.1/lib/libhyprexpo.so
monitor = Virtual-1,1920x1080@60,auto,1

    windowrule = float, ^(steam)$
    windowrule = size 1080 900, ^(steam)$
    windowrule = center, ^(steam)$
    windowrule = opacity 0.8 0.8, discord
    windowrule = opacity 0.8 0.8, steam
    general {
      gaps_in = 6
      gaps_out = 8
      border_size = 2
      col.active_border = rgba(398bc6ff) rgba(576ddbff) rgba(2a9292ff) rgba(955ae7ff)

45deg
col.inactive_border = rgba(19171ccc) rgba(26232acc) 45deg
layout = dwindle
resize_on_border = true
}

    input {
      kb_layout = us, de
kb_options = grp:alt_shift_toggle
      kb_options=caps:super
      follow_mouse = 1
      touchpad {
        natural_scroll = false
      }
      sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
      accel_profile = flat
    }
    env = NIXOS_OZONE_WL, 1
    env = NIXPKGS_ALLOW_UNFREE, 1
    env = XDG_CURRENT_DESKTOP, Hyprland
    env = XDG_SESSION_TYPE, wayland
    env = XDG_SESSION_DESKTOP, Hyprland
    env = GDK_BACKEND, wayland
    env = CLUTTER_BACKEND, wayland
    env = SDL_VIDEODRIVER, wayland
    env = QT_QPA_PLATFORM, wayland
    env = QT_WAYLAND_DISABLE_WINDOWDECORATION, 1
    env = QT_AUTO_SCREEN_SCALE_FACTOR, 1
    env = MOZ_ENABLE_WAYLAND, 1
    env = WLR_NO_HARDWARE_CURSORS,1

env = WLR_RENDERER_ALLOW_SOFTWARE,1

    gestures {
      workspace_swipe = true
      workspace_swipe_fingers = 3
    }
    misc {
      mouse_move_enables_dpms = true
      key_press_enables_dpms = false
      enable_swallow = true;
      #force_default_wallpaper = 0;
      #new_window_takes_over_fullscreen = 2;
      disable_hyprland_logo = true;
      disable_splash_rendering = true;
      animate_manual_resizes = true;
      animate_mouse_windowdragging = true
    }
    animations {
      enabled = yes
      bezier = wind, 0.05, 0.9, 0.1, 1.05
      bezier = winIn, 0.1, 1.1, 0.1, 1.1
      bezier = winOut, 0.3, -0.3, 0, 1
      bezier = liner, 1, 1, 1, 1
      animation = windows, 1, 6, wind, slide
      animation = windowsIn, 1, 6, winIn, slide
      animation = windowsOut, 1, 5, winOut, slide
      animation = windowsMove, 1, 5, wind, slide
      animation = border, 1, 1, liner

      animation = fade, 1, 10, default
      animation = workspaces, 1, 5, wind
    }
    decoration {
      rounding = 0
      drop_shadow = false
      blur {
          enabled = true
          size = 5
          passes = 3
          new_optimizations = on
          ignore_opacity = on
      }
    }
    plugin {
hyprtrails {
        color = rgba(a06e3bff)
      }
    }

  plugin {
    hyprexpo {
      columns = 3
      gap_size = 5
       bg_col = rgb(111111)
        workspace_method = center current # [center/first] [workspace] e.g. first 1 or

center m+1
enable_gesture = true # laptop touchpad, 4 fingers
gesture_distance = 300 # how far is the "max"
gesture_positive = true # positive = swipe down. Negative = swipe up.
}
}

  bind = CTRL, space, hyprexpo:expo, toggle # can be: toggle, off/disable or on/enable

    exec-once = $POLKIT_BIN
    exec-once = dbus-update-activation-environment --systemd --all
    exec-once = systemctl --user import-environment QT_QPA_PLATFORMTHEME WAYLAND_DISPL

AY XDG_CURRENT_DESKTOP
exec-once = swww init
exec-once = pypr
exec-once = waybar
#exec-once = waybar -c ~/.config/waybar-dw1/config -s ~/.config/waybar-dw1/style.c
ss &
exec-once = swaync
#exec-once = wallsetter
exec-once = wpaperd
exec-once = nm-applet --indicator
exec-once = swayidle -w timeout 720 'swaylock -f' timeout 1000 'hyprctl dispatch d
pms off' resume 'hyprctl dispatch dpms on' before-sleep 'swaylock -f -c 000000'
dwindle {
pseudotile = true
preserve_split = true
}
master {
new_is_master = true
}
bind = SUPER,Return,exec,alacritty
bind = SUPERSHIFT,Return,exec,rofi-launcher
bind = SUPERSHIFT,D,exec,rofi-launcher
bind = SUPERSHIFT,W,exec,web-search
bind = SUPERSHIFT,N,exec,swaync-client -rs
bind = SUPER,W,exec,brave

    bind = SUPER,E,exec,emopicker9000
    bind = SUPER,S,exec,screenshootin
    bind = SUPER,D,exec,discord
    bind = SUPER,J,exec,jellyfinmediaplayer
    bind = SUPER,B,exec,google-chrome-stable
    bind = SUPERSHIFT,W,exec,wezterm
    bind = SUPER,A,exec,alacritty
    bind = SUPERSHIFT,A,exec,kitty
    bind = SUPERSHIFT,C,exec,wpaperd
    bind = SUPERCTRL,A,exec,st
    bind = SUPER,O,exec,obs
    bind = SUPER,G,exec,google-chrome-stable
    bind = SUPERCTRL,M,exec,nwg-drawer
    bind = SUPERSHIFT,G,exec,gimp
    bind = SUPER,T,exec,thunar
    bind = SUPER,M,exec,spotify
    bind = SUPER,Q,killactive,
    bind = SUPER,P,pseudo,
    bind = SUPERSHIFT,I,togglesplit,
    bind = SUPER,F,fullscreen,
    bind = SUPERSHIFT,F,togglefloating,
    bind = SUPERSHIFT,X,exit,
    bind = SUPERSHIFT,left,movewindow,l
    bind = SUPERSHIFT,right,movewindow,r
    bind = SUPERSHIFT,up,movewindow,u
    bind = SUPERSHIFT,down,movewindow,d
    bind = SUPERSHIFT,h,movewindow,l
    bind = SUPERSHIFT,l,movewindow,r
    bind = SUPERSHIFT,k,movewindow,u
    bind = SUPERSHIFT,j,movewindow,d
    bind = SUPER,left,movefocus,l
    bind = SUPER,right,movefocus,r
    bind = SUPER,up,movefocus,u
    bind = SUPER,down,movefocus,d
    bind = SUPER,h,movefocus,l
    bind = SUPER,l,movefocus,r
    bind = SUPER,k,movefocus,u
    bind = SUPER,j,movefocus,d
    bind = SUPER,1,workspace,1
    bind = SUPER,2,workspace,2
    bind = SUPER,3,workspace,3
    bind = SUPER,4,workspace,4
    bind = SUPER,5,workspace,5
    bind = SUPER,6,workspace,6
    bind = SUPER,7,workspace,7
    bind = SUPER,8,workspace,8
    bind = SUPER,9,workspace,9
    bind = SUPER,0,workspace,10
    bind = SUPERSHIFT,SPACE,movetoworkspace,special
    bind = SUPER,SPACE,togglespecialworkspace
    bind = SUPERSHIFT,1,movetoworkspace,1
    bind = SUPERSHIFT,2,movetoworkspace,2
    bind = SUPERSHIFT,3,movetoworkspace,3
    bind = SUPERSHIFT,4,movetoworkspace,4
    bind = SUPERSHIFT,5,movetoworkspace,5
    bind = SUPERSHIFT,6,movetoworkspace,6
    bind = SUPERSHIFT,7,movetoworkspace,7
    bind = SUPERSHIFT,8,movetoworkspace,8
    bind = SUPERSHIFT,9,movetoworkspace,9
    bind = SUPERSHIFT,0,movetoworkspace,10
    bind = SUPERCONTROL,right,workspace,e+1
    bind = SUPERCONTROL,left,workspace,e-1
    bind = SUPER,mouse_down,workspace, e+1
    bind = SUPER,mouse_up,workspace, e-1
    bindm = SUPER,mouse:272,movewindow
    bindm = SUPER,mouse:273,resizewindow
    bind = ALT,Tab,cyclenext
    bind = ALT,Tab,bringactivetotop
    bind = SUPERCTRL,J, changegroupactive,f
    bind = SUPERCTRL,L, changegroupactive,b
    bind = SUPER,SPACE, togglespecialworkspace
    bind = SUPERSHIFT,SPACE, movetoworkspace,special
# Switch workspaces relative to the active workspace with mainMod + CTRL + [←→]
    bind = SUPER CTRL, right, workspace, r+1
    bind = SUPER CTRL, left, workspace, r-1

# move to the first empty workspace instantly with mainMod + CTRL + [↓]
    bind = SUPER CTRL, down, workspace, empty

# Resize windows bind = ,XF86AudioRaiseVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
    bind = ,XF86AudioLowerVolume,exec,wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
    binde = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
    bind = ,XF86AudioPlay, exec, playerctl play-pause
    bind = ,XF86AudioPause, exec, playerctl play-pause
    bind = ,XF86AudioNext, exec, playerctl next
    bind = ,XF86AudioPrev, exec, playerctl previous
    bind = ,XF86MonBrightnessDown,exec,brightnessctl set 5%-
    bind = ,XF86MonBrightnessUp,exec,brightnessctl set +5%
    binde = SUPER SHIFT, right, resizeactive, 30 0
    binde = SUPER SHIFT, left, resizeactive, -30 0
    binde = SUPER SHIFT, up, resizeactive, 0 -30
    binde = SUPER SHIFT, down, resizeactive, 0 30


    # Pyprland
    bind = SUPER SHIFT, V, exec, pypr toggle volume
    bind = SUPER SHIFT, S, exec, pypr toggle term
    #bind = SUPER SHIFT, B, exec, pypr toggle stb
    #bind = SUPER SHIFT, T, exec, pypr toggle stb-logs
    #bind = SUPER SHIFT, U, exec, pypr toggle logs
    bind = SUPER SHIFT, R, exec, pypr reload

Additional context
Add any other context about the problem here.

hyprctl systeminfo
Hyprland, built from branch at commit f94264928a8ab4da8759d4ded25a46af44451d38 ().
Date: 2024-04-26
Tag: , commits: @COMMITS@

flags: (if any)

System Information:
System name: Linux
Node name: ddubsos-dev
Release: 6.8.7
Version: #1-NixOS SMP PREEMPT_DYNAMIC Wed Apr 17 09:23:43 UTC 2024

GPU information:

os-release: ANSI_COLOR="1;34"
BUG_REPORT_URL="https://github.com/NixOS/nixpkgs/issues"
BUILD_ID="24.05.20240425.7bb2ccd"
DOCUMENTATION_URL="https://nixos.org/learn.html"
HOME_URL="https://nixos.org/"
ID=nixos
IMAGE_ID=""
IMAGE_VERSION=""
LOGO="nix-snowflake"
NAME=NixOS
PRETTY_NAME="NixOS 24.05 (Uakari)"
SUPPORT_URL="https://nixos.org/community.html"
VERSION="24.05 (Uakari)"
VERSION_CODENAME=uakari
VERSION_ID="24.05"

plugins:
hyprtrails by Vaxry ver 1.0
hyprexpo by Vaxry ver 1.0

Seems like you're using NixOS! Me too :)

I just ran into this after an update as well, since the pyprland packaged in Nix is on v2.2.11 and this seems to be fixed in v2.2.12

You should be able to use this (as a temporary fix) wherever you're declaring packages in your config:

environment.systemPackages = with pkgs; [
    (pyprland.overrideAttrs (oldAttrs: {
      src = fetchFromGitHub {
        owner = "hyprland-community";
        repo = "pyprland";
        rev = "refs/tags/2.2.12";
        hash = "sha256-SVly20/+67d0Rr2SuM1n/JfT1SlyKdKRBLDx2okCZRY=";
      };
    }))
];

or if using home-manager:

home.packages = with pkgs; [
    (pyprland.overrideAttrs (oldAttrs: {
      src = fetchFromGitHub {
        owner = "hyprland-community";
        repo = "pyprland";
        rev = "refs/tags/2.2.12";
        hash = "sha256-SVly20/+67d0Rr2SuM1n/JfT1SlyKdKRBLDx2okCZRY=";
      };
    }))
];

For me this setup throws a warning when starting but then continues to work properly :)

this is a duplicate of #88 btw :)
Thank you for the support @librephoenix

Would it be possible to get a build using the tag or is it something related to nix?
I don't see anything special in the Arch package and I get such output:

❯ hyprctl -j version
{
    "branch": "",
    "commit": "fe7b748eb668136dd0558b7c8279bfcd7ab4d759",
    "dirty": false,
    "commit_message": "props: bump version to 0.39.1",
    "commit_date": "Tue Apr 16 16:01:03 2024",
    "tag": "v0.39.1",
    "commits": 4460,
    "flags": []
}

Poking @NotAShelf for information

Seems like you're using NixOS! Me too :)

Hello yes! for about 6-8 months. My setup is based on ZaneyOS https://gitlab.com/Zaney/zaneyos
But I have forked and modified it. I've been a long time fan of pyprland so I added it to mine. This is 1st issue I've ever had with it.

I will try your fix!
Thanks for the quick reply!

This is my pyprland.nix pretty simple I got the config from someone else and just wrapped it here

{ config, pkgs, ... }:

{
home.packages = with pkgs; [ pyprland ];

xdg.configFile."hypr/pyprland.toml".text = ''
[pyprland]
plugins = [
"toggle_special",
"scratchpads",
"lost_windows",
"monitors",
"shift_monitors",
"toggle_dpms",
"magnify",
"expose",
"workspaces_follow_focus",
]

[workspaces_follow_focus]
max_workspaces = 9

[expose]
include_special = false

[scratchpads.term]
animation = "fromTop"
command = "kitty --class kitty-dropterm"
class = "kitty-dropterm"
size = "75% 60%"
max_size = "1920px 100%"

[scratchpads.volume]
animation = "fromRight"
command = "pavucontrol"
class = "pavucontrol"
lazy = true
size = "40% 90%"
max_size = "1080px 100%"
unfocus = "hide"

[layout_center]
margin = 60
offset = [0, 30]
next = "movefocus r"
prev = "movefocus l"
next2 = "movefocus d"
prev2 = "movefocus u"

'';
}

I am doing something wrong. Still new to NIX

image

it doesn't build the new version

I don't know anything about nix, but can't the provided flake.nix be useful?

I don't know anything about nix, but can't the provided flake.nix be useful?

That is the flake provided

Before it was just

{ config, pkgs, ... }:

{
home.packages = with pkgs; [ pyprland ];

I will try to figure it out

Thanks

I don't think you are alone in that case, if someone can provide decent instructions to easily get the latest pyprland (or a specific tag) on Nix I'll add it to the wiki.

In case it helps some people: the "version" tag in hyprctl -j version is required from 2.2.9 to 2.2.11 (included). Later versions assume you are using a bleeding edge version in such case, which is a packaging issue.

fetchFromGitHub will fetch a source based tarball (i.e. contents of this repository on the topmost level) and won't actually expose a package. To use the pyprland package exposed by this flake, you must add it as a flake input and consume the exposed package directly with inputs.pyprland.packages.${pkgs.stdenv.system}.pyprland.

I can probably work on upstreaming pyprland to nixpkgs, the packaging is somewhat complete and poetry2nix is available in nixpkgs also. Should be trivial to implement an update script to reduce maintenance on my end as I don't use pyprland, and may not always keep myself up to date.

Pyprland is in nixpkgs already: https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/py/pyprland/package.nix, though they aren't using pyprland's flake to build it. In the original issue it looks like the nixpkgs package is being used.

Nixpkgs master branch is already using pyprland 2.2.12, but nixos-unstable is still stuck on 2.2.10: https://github.com/NixOS/nixpkgs/blob/nixos-unstable/pkgs/by-name/py/pyprland/package.nix

Once unstable updates to 2.2.12 (maybe in a week or so, give or take?), I think this issue will resolve itself.

In any case, the temporary fix I mentioned was to just override the pyprland in nixpkgs with the up-to-date version.

Any issues with installing pyprland directly from pyprland's flake might be something separate?

thanks all It should be a few days or so before the update is there it appears

image

I am ok to close this issue

NixPkg PR + #92 will fix this issue, closing, thank you all!