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

hyprland/workspaces is not working on waybar 0.9.20 #2398

Closed
hnbnh opened this issue Aug 13, 2023 · 16 comments
Closed

hyprland/workspaces is not working on waybar 0.9.20 #2398

hnbnh opened this issue Aug 13, 2023 · 16 comments

Comments

@hnbnh
Copy link

hnbnh commented Aug 13, 2023

Describe the bug:

I wasn't able to have hyprland/workspaces enabled on my waybar configuration

Configuration

{
  "spacing": 0,
  "layer": "top",
  "modules-left": ["hyprland/workspaces"],
  "modules-center": ["clock"],
  "hyprland/workspaces": {
    "format": "{name}: {icon}",
    "format-icons": {
      "1": "",
      "2": "",
      "3": "",
      "4": "",
      "5": "",
      "active": "",
      "default": ""
    },
    "persistent_workspaces": {
      "*": 5, // 5 workspaces by default on every monitor
      "HDMI-A-1": 3 // but only three on HDMI-A-1
    }
  }
}

Log:

[warning] module hyprland/workspaces: Disabling module "hyprland/workspaces", * Line 1, Column 1
  Syntax error: value, object or array expected.
@zjeffer
Copy link
Contributor

zjeffer commented Aug 13, 2023

This problem is already fixed in the latest master. You can compile it yourself or wait for the next release.

In the meantime, you should be able to use wlr/workspaces.

@Alexays
Copy link
Owner

Alexays commented Aug 14, 2023

New release 0.9.21 published.

@Alexays Alexays closed this as completed Aug 14, 2023
@amplexus
Copy link

I was getting this same error with Waybar on Wayland. However I noticed that my monitor has hexadecimal in the model and make according to hyprctl monitors and I'm aware of another issue (#2475) relating to a jsoncpp limitation where it doesnt like/support escaped characters.

# hyprctl monitors
Monitor eDP-1 (ID 0):
	[email protected] at 0x0
	description: BOE 0x0866 (eDP-1)
	make: BOE
	model: 0x0866
	serial: 
	active workspace: 3 (3)
	reserved: 0 30 0 0
	scale: 2.00
	transform: 0
	focused: yes
	dpmsStatus: 1
	vrr: 0

Running Waybar v0.9.24-88-g748fc809 I get the same error:

[2024-01-10 19:18:08.619] [warning] module hyprland/workspaces: Disabling module "hyprland/workspaces", * Line 1, Column 1 Syntax error: value, object or array expected.

so I'm not sure if my issue relates to this here bug or the one over at #2475 (more likely).

I'd be curious whether @hnbnh has a monitor with hexadecimal in the monitor name/model/description when seeing this error (i.e. output of hyprctl monitors).

@amplexus
Copy link

amplexus commented Jan 10, 2024

Ok ignore my comment above, as it looks like my issue is unrelated to hex values.

I dug a little deeper, and it looks like the call is failing in src/modules/hyprland/workspaces.cpp within Workspaces::init() on this line:

      m_activeWorkspaceName = (gIPC->getSocket1JsonReply("activeworkspace"))["name"].asString();

That line throws an exception for me. If I comment it out and initialise the active workspace name to a dummy value, then the workspaces appear in waybar.

I also tried shifting the activeworkspace call into the doUpdate() function, but it failed there too.

@zjeffer
Copy link
Contributor

zjeffer commented Jan 10, 2024

@amplexus What is the name of that active workspace?

@amplexus
Copy link

amplexus commented Jan 10, 2024

@zjeffer here's all my workspaces - the active one has an ID of 3:

# hyprctl workspaces
workspace ID 1 (1) on monitor eDP-1:
	windows: 1
	hasfullscreen: 0
	lastwindow: 0x3571d960
	lastwindowtitle: (1) Facebook - Google Chrome

workspace ID 5 (5) on monitor eDP-1:
	windows: 1
	hasfullscreen: 0
	lastwindow: 0x35711c30
	lastwindowtitle: Alexays/Waybar: Highly customizable Wayland bar for Sway and Wlroots based compositors. :tada: - Google Chrome

workspace ID 2 (2) on monitor eDP-1:
	windows: 1
	hasfullscreen: 0
	lastwindow: 0x35718590
	lastwindowtitle: YouTube - Google Chrome

workspace ID 4 (4) on monitor eDP-1:
	windows: 2
	hasfullscreen: 0
	lastwindow: 0x357223b0
	lastwindowtitle: Vite + React - Google Chrome

workspace ID 3 (3) on monitor eDP-1:
	windows: 1
	hasfullscreen: 0
	lastwindow: 0x3574abf0
	lastwindowtitle: hyprctl workspaces

And if it's any use, here's my workspaces config in waybar:

    "hyprland/workspaces": {
        "active-only": false,
        "all-outputs": false,
        "on-click": "activate",
        "format": "{icon}",
        "format-icons": {
            "1": "",
            "2": "",
            "3": "",
            "4": "",
            "5": "",
            "6": "",
            "7": "",
            "8": "",
            "9": "",
            "urgent": "",
            "focused": "",
            "default": ""
        }
    },

However please note that if I strip the above workspaces config out entirely (but keep "modules-left": ["hyprland/workspaces"]) I still get the same error.

@amplexus
Copy link

Ok hang about. My hyprctl command doesn't support the activeworkspace option.

Digging deeper, I followed https://wiki.hyprland.org/Getting-Started/Installation/ which lead me to a gist for Ubuntu 23.X, which gave me a script to run, which, err, downloaded hyprland 0.24.1 (versus current release 0.34). I figure that's the problem.

@amplexus
Copy link

Can confirm that running current Hyprland (0.34.0) works fine - no errors or failing RPC calls... All that commotion for nothing :D

Thanks anyway @zjeffer !

@arnavgr
Copy link

arnavgr commented Mar 25, 2024

@amplexus i have the same problem as you have but on the latest hyprland, is there any way you can help me?

@whoisYoges
Copy link

Make sure the following line exists in your /etc/hosts file and then restart NetworkManager and waybar:

127.0.0.1	localhost

@michalke-it
Copy link

Also make sure that you are REALLY on the latest version. I for example just learned that I had hyprland-nvidia installed, which was removed from the arch repos (or the AUR? don't remember) some time ago it seems and I was therefore still on 0.31.0-2 instead of the current 0.37.1-2.
Hope it helps!

@arnavgr
Copy link

arnavgr commented Mar 28, 2024

Also make sure that you are REALLY on the latest version. I for example just learned that I had hyprland-nvidia installed, which was removed from the arch repos (or the AUR? don't remember) some time ago it seems and I was therefore still on 0.31.0-2 instead of the current 0.37.1-2. Hope it helps!

thats it

i was on nvidia and was using that package, switched to hyprland-git and it fixed it. Thank you

@unkindypie
Copy link

A bit off-topic but while trying to fix the problem from this issue using solution from @michalke-it and @arnavgr I've tried to install hyprland-git using yay to migrate from hyprland-nvidia 0.31.0-2 but got this error when installing hyprland-git:

Submodule 'subprojects/hyprland-protocols' (https://github.com/hyprwm/hyprland-protocols) registered for path 'subprojects/hyprland-protocols'
Submodule 'subprojects/tracy' (https://github.com/wolfpld/tracy) registered for path 'subprojects/tracy'
Submodule 'subprojects/udis86' (https://github.com/canihavesomecoffee/udis86) registered for path 'subprojects/udis86'
Submodule 'subprojects/wlroots-hyprland' (https://github.com/hyprwm/wlroots-hyprland) registered for path 'subprojects/wlroots-hyprland'
Cloning into '/home/maxb/.cache/yay/hyprland-git/src/Hyprland/subprojects/hyprland-protocols'...
done.
Cloning into '/home/maxb/.cache/yay/hyprland-git/src/Hyprland/subprojects/tracy'...
done.
Cloning into '/home/maxb/.cache/yay/hyprland-git/src/Hyprland/subprojects/udis86'...
done.
Cloning into '/home/maxb/.cache/yay/hyprland-git/src/Hyprland/subprojects/wlroots-hyprland'...
Submodule path 'subprojects/hyprland-protocols': checked out '0c2ce70625cb30aef199cb388f99e19a61a6ce03'
Submodule path 'subprojects/tracy': checked out '37aff70dfa50cf6307b3fee6074d627dc2929143'
Submodule path 'subprojects/udis86': checked out '5336633af70f3917760a6d441ff02d93477b0c86'
Submodule path 'subprojects/wlroots-hyprland': checked out '62eeffbe233d199f520a5755c344e85f8eab7940'
fatal: cannot change to 'subprojects/wlroots': No such file or directory
==> ERROR: A failure occurred in prepare().
    Aborting...
 -> error making: hyprland-git-exit status 4
 -> Failed to install the following packages. Manual intervention is required:
hyprland-git - exit status 4

Can anyone help fixing it? I've tried cleanBuild option but it doesn't help

@zjeffer
Copy link
Contributor

zjeffer commented Apr 13, 2024

@unkindypie I assume you're maxbko on https://aur.archlinux.org/packages/hyprland-git?
It seems to be an issue with the hyprland-git AUR package. The person below you provided a patch.

And it seems the patch has been applied 10 minutes ago. Try to build again and it should work.

@unkindypie
Copy link

@zjeffer right you've found me 😁
Will try thank you for letting me know

@arnavgr
Copy link

arnavgr commented Apr 13, 2024

try the official arch repo waybar package

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

8 participants