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 do not work #2475

Closed
Nyayurin opened this issue Sep 7, 2023 · 57 comments
Closed

hyprland/workspaces do not work #2475

Nyayurin opened this issue Sep 7, 2023 · 57 comments
Labels
bug Something isn't working

Comments

@Nyayurin
Copy link

Nyayurin commented Sep 7, 2023

image
image

@Dungeonseeker
Copy link

Add the following to the bottom of ~/.config/waybar/config....

    "hyprland/workspaces": {
        "disable-scroll": true,
		"format": "{name} {icon}",
		"format-icons": {
			"active": " ",
			"default": " "
		},
        "persistent_workspaces": {
            "1": [],
            "2": [],
            "3": [],
            "4": [],
        },
    },

@zjeffer
Copy link
Contributor

zjeffer commented Sep 7, 2023

@Nyayurn What's your actual hyprland/workspaces config? We can only see you added the "modules-center": ["hyprland/workspaces"] module, but not the config itself. Also please copy paste instead of screenshotting, makes it easier for other people to find similar issues.

@Nyayurin
Copy link
Author

Nyayurin commented Sep 8, 2023

@Nyayurn What's your actual hyprland/workspaces config? We can only see you added the "modules-center": ["hyprland/workspaces"] module, but not the config itself. Also please copy paste instead of screenshotting, makes it easier for other people to find similar issues.

none or

"hyprland/workspaces": {}

or

Add the following to the bottom of ~/.config/waybar/config....

    "hyprland/workspaces": {
        "disable-scroll": true,
		"format": "{name} {icon}",
		"format-icons": {
			"active": " ",
			"default": " "
		},
        "persistent_workspaces": {
            "1": [],
            "2": [],
            "3": [],
            "4": [],
        },
    },

as the same error

@zjeffer
Copy link
Contributor

zjeffer commented Sep 8, 2023

Which version of Waybar are you using?

@celepharn
Copy link

Changing wlr/workspaces to hyprland/workspaces fixed it for me.

@Nyayurin
Copy link
Author

Nyayurin commented Sep 9, 2023

Which version of Waybar are you using?

extra/waybar 0.9.22-1

@zjeffer
Copy link
Contributor

zjeffer commented Sep 9, 2023

That's so strange. Can you copy paste your entire config? Both config.json and style.css.

@Nyayurin
Copy link
Author

Nyayurin commented Sep 9, 2023

config
style.css

@zjeffer
Copy link
Contributor

zjeffer commented Sep 9, 2023

Yeah I don't understand, your config works without issues on my system, with both the latest master and 0.9.22-1 from the extra/waybar package...

@Nyayurin
Copy link
Author

Nyayurin commented Sep 9, 2023

I also can't understand that others have no problem hyprland/workspaces, but I can only use wlr/workspaces
but wlr/workspaces is no longer supported
this is my package list
paru -Qe
paru -Q

@stauersbol
Copy link

idk if its helpful or anything, but try running the config.json through a unescape tool online to see if it changes anything.
that is just from looking at the warning you are getting, but i could be wrong

@Dungeonseeker
Copy link

Dungeonseeker commented Sep 10, 2023

OK, lets try it in reverse. Rename your existing config to something else eg

mv ~/.config/waybar/config ~/.config/waybar/config.bakup

Then try swapping your config with mine.

Obviously a lot of stuff probably won't work but workspaces should work.

Edit - Sorry, that was the wrong config, its my top bar you want...
top.txt

Edit 2 - Actually its probably easier to just rename top.txt to top, drop it in ~/.config/waybar then run waybar -c ~/.config/waybar/top.

@Nyayurin
Copy link
Author

OK, lets try it in reverse. Rename your existing config to something else eg

mv ~/.config/waybar/config ~/.config/waybar/config.bakup

Then try swapping your config with mine.

Obviously a lot of stuff probably won't work but workspaces should work.

Edit - Sorry, that was the wrong config, its my top bar you want... top.txt

Edit 2 - Actually its probably easier to just rename top.txt to top, drop it in ~/.config/waybar then run waybar -c ~/.config/waybar/top.

It still do not work
Screen

@stauersbol
Copy link

stauersbol commented Sep 10, 2023

It still do not work

Try removing the keyboard-state module and see what happens, unless it is actually something you are using.

@Nyayurin
Copy link
Author

It still do not work

Try removing the keyboard-state module and see what happens, unless it is actually something you are using.

still do not work
Screen

@stauersbol
Copy link

stauersbol commented Sep 10, 2023

It still do not work

Try removing the keyboard-state module and see what happens, unless it is actually something you are using.

still do not work Screen

Did you try running it through an JSON unescape tool online?
If you didn't could you try doing that, just to see what happens?

@Nyayurin
Copy link
Author

still do not work Screen

Did you try running it through an JSON unescape tool online? If you didn't could you try doing that, just to see what happens?

How do I do that?

@stauersbol
Copy link

stauersbol commented Sep 10, 2023

still do not work Screen

Did you try running it through an JSON unescape tool online? If you didn't could you try doing that, just to see what happens?

How do I do that?

https://www.freeformatter.com/json-escape.html

Try this tool, it might not work, but it is worth the try

EDIT:
Funny, I tried both your config and the one @Dungeonseeker sent and both work just fine for me

@Nyayurin
Copy link
Author

still do not work Screen

Did you try running it through an JSON unescape tool online? If you didn't could you try doing that, just to see what happens?

How do I do that?

https://www.freeformatter.com/json-escape.html

Try this tool, it might not work, but it is worth the try

EDIT: Funny, I tried both your config and the one @Dungeonseeker sent and both work just fine for me

I tried it but still do not work

@Dungeonseeker
Copy link

It still do not work

Try removing the keyboard-state module and see what happens, unless it is actually something you are using.

still do not work Screen

Did you try running it through an JSON unescape tool online? If you didn't could you try doing that, just to see what happens?

Nah, that config is working perfectly for me. At this point I'm stumped. The provided config works for others and a known working config doesn't work for OP.

The only other thing I can think of is trying to install waybar-hypland which states its specifically for workspaces support but I'm running stock waybar 0.9.22 and I have no issues at all.

@Nyayurin
Copy link
Author

It still do not work

Try removing the keyboard-state module and see what happens, unless it is actually something you are using.

still do not work Screen

Did you try running it through an JSON unescape tool online? If you didn't could you try doing that, just to see what happens?

Nah, that config is working perfectly for me. At this point I'm stumped. The provided config works for others and a known working config doesn't work for OP.

The only other thing I can think of is trying to install waybar-hypland which states its specifically for workspaces support but I'm running stock waybar 0.9.22 and I have no issues at all.

I already used waybar-nvidia,but it still do not work

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

The only other thing I can think of is trying to install waybar-hypland which states its specifically for workspaces support but I'm running stock waybar 0.9.22 and I have no issues at all.

The waybar-hyprland packages was for wlr/workspaces support, not hyprland/workspaces. That package is now obsolete, of course.

@stauersbol
Copy link

stauersbol commented Sep 10, 2023

It still do not work

Try removing the keyboard-state module and see what happens, unless it is actually something you are using.

still do not work Screen

Did you try running it through an JSON unescape tool online? If you didn't could you try doing that, just to see what happens?

Nah, that config is working perfectly for me. At this point I'm stumped. The provided config works for others and a known working config doesn't work for OP.

The only other thing I can think of is trying to install waybar-hypland which states its specifically for workspaces support but I'm running stock waybar 0.9.22 and I have no issues at all.

Yeah waybar is just fine, as @zjeffer just pointed out waybar-hyprland is obsolete now.

@Nyayurn did you try manually compiling and seeing what it does?
https://wiki.hyprland.org/Useful-Utilities/Status-Bars/#compiling-manually

There is a short guide on the hyprland wiki if you want to try that out.

@Nyayurin
Copy link
Author

I input these command, but it throw some error

sed -i -e 's/zext_workspace_handle_v1_activate(workspace_handle_);/const std::string command = "hyprctl dispatch workspace " + name_;\n\tsystem(command.c_str());/g' src/modules/hyprland/workspaces.cpp
meson --prefix=/usr --buildtype=plain --auto-features=enabled --wrap-mode=nodownload build

meson-log.txt

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

That wiki should be updated, the first command is not necessary anymore.

I use this to compile:

# in the Waybar git repo (make sure you pull the latest version)
git clean -dxff

meson setup --reconfigure --prefix=/usr \
          --buildtype=debug \
          --auto-features=enabled \
          --wrap-mode=nodownload \
          -Dexperimental=true \
          -Dcava=disabled \
          -Dcpp_std=c++20 \
          -Dtests=enabled \
        ./build

ninja -C build

Then run waybar using ./build/waybar --config <path-to-config.json> --style <path-to-style.css>

@Dungeonseeker
Copy link

Also what is the output of hyprctl monitors and hyprctl workspaces ?

@Nyayurin
Copy link
Author

It still do not work

Try removing the keyboard-state module and see what happens, unless it is actually something you are using.

still do not work Screen

Did you try running it through an JSON unescape tool online? If you didn't could you try doing that, just to see what happens?

Nah, that config is working perfectly for me. At this point I'm stumped. The provided config works for others and a known working config doesn't work for OP.
The only other thing I can think of is trying to install waybar-hypland which states its specifically for workspaces support but I'm running stock waybar 0.9.22 and I have no issues at all.

Yeah waybar is just fine, as @zjeffer just pointed out waybar-hyprland is obsolete now.

@Nyayurn did you try manually compiling and seeing what it does? https://wiki.hyprland.org/Useful-Utilities/Status-Bars/#compiling-manually

There is a short guide on the hyprland wiki if you want to try that out.

It's still do not work
Screen

@Nyayurin
Copy link
Author

Also what is the output of hyprctl monitors and hyprctl workspaces ?

❯ hyprctl monitors
Monitor DVI-D-1 (ID 0):
[email protected] at 0x0
description: TXD \xc7\xe5\xbb\xaa\xcd\xac\xb7\xbd 0x00000001 (DVI-D-1)
make: TXD
model: \xc7\xe5\xbb\xaa\xcd\xac\xb7\xbd
serial: 0x00000001
active workspace: 7 (7)
special workspace: 0 ()
reserved: 0 0 0 0
scale: 1.00
transform: 0
focused: yes
dpmsStatus: 1
vrr: 0

❯ hyprctl workspaces
workspace ID 1 (1) on monitor DVI-D-1:
windows: 1
hasfullscreen: 0
lastwindow: 0x560df2cacbd0
lastwindowtitle: QQ

workspace ID 2 (2) on monitor DVI-D-1:
windows: 1
hasfullscreen: 0
lastwindow: 0x560df246ec30
lastwindowtitle: hyprland/workspaces do not work · Issue #2475 · Alexays/Waybar - Vivaldi

workspace ID 3 (3) on monitor DVI-D-1:
windows: 1
hasfullscreen: 1
lastwindow: 0x560df24885a0
lastwindowtitle: Windows [正在运行] - Oracle VM VirtualBox

workspace ID 4 (4) on monitor DVI-D-1:
windows: 1
hasfullscreen: 0
lastwindow: 0x560df247b8a0
lastwindowtitle: 备忘录 - Obsidian Vault - Obsidian v1.4.5

workspace ID 5 (5) on monitor DVI-D-1:
windows: 1
hasfullscreen: 0
lastwindow: 0x560df461d680
lastwindowtitle: Celeste

workspace ID 6 (6) on monitor DVI-D-1:
windows: 1
hasfullscreen: 0
lastwindow: 0x560df466fb60
lastwindowtitle: OBS 29.1.3-1 - 配置文件: Untitled - 场景: Untitled

workspace ID 7 (7) on monitor DVI-D-1:
windows: 1
hasfullscreen: 0
lastwindow: 0x560df56d3120
lastwindowtitle: Yurn@SakuraArch: ~/Waybar

@Dungeonseeker
Copy link

Just as a last ditch throw anything at the wall and hope something sticks attempt, try renaming your style.css file and see if that changes anything.

Its weird its saying there is an escape error, that makes no sense since workspaces is a built in module.

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

Try this config:

{
  "layer": "top", // Waybar at top layer
  "position": "top", // Waybar position (top|bottom|left|right)
  "height": 32, // Waybar height (to be removed for auto height)
  "width": 0, // Waybar width (0 == auto)
  "spacing": 0, // Gaps between modules
  "modules-left": [
    "hyprland/workspaces"
  ]
}

and /etc/xdg/waybar/style.css as the style file.

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

Which version of Hyprland are you using? Maybe there's a problem with the IPC communication?

@Dungeonseeker
Copy link

Is there anything weird showing with journalctl -b0 |grep 'hyprland' or sudo dmesg |grep 'hyprland'?

@Nyayurin
Copy link
Author

I'm using hyprland 0.29.1-1
Screen

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

Can you try removing all code inside the constructor in src/hyprland/workspaces.cpp, so it looks like this:

Workspaces::Workspaces(const std::string &id, const Bar &bar, const Json::Value &config)
    : AModule(config, "workspaces", id, false, false),
      bar_(bar),
      box_(bar.vertical ? Gtk::ORIENTATION_VERTICAL : Gtk::ORIENTATION_HORIZONTAL, 0) {
}

Then recompile with ninja -C build, and run waybar. The module wouldn't do anything but it also shouldn't throw the error.

@Nyayurin
Copy link
Author

It's do not throw error but still do not work
Screen

@Nyayurin
Copy link
Author

Try this config:

{
  "layer": "top", // Waybar at top layer
  "position": "top", // Waybar position (top|bottom|left|right)
  "height": 32, // Waybar height (to be removed for auto height)
  "width": 0, // Waybar width (0 == auto)
  "spacing": 0, // Gaps between modules
  "modules-left": [
    "hyprland/workspaces"
  ]
}

and /etc/xdg/waybar/style.css as the style file.

This is no any error but still do not work
Screen

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

Great, now we can debug further. Try instead of removing everything from the constructor, only remove all the gIPC->registerForIPC() function calls from the constructor. Let's see if that throws any errors (it probably stll won't show any workspaces on the bar but it would bring us closer to a solution).

EDIT: also remove the init() call and the creation of gIPC, so remove all of this:

if (!gIPC) {
    gIPC = std::make_unique<IPC>();
  }

  init();

  gIPC->registerForIPC("workspace", this);
  gIPC->registerForIPC("createworkspace", this);
  gIPC->registerForIPC("destroyworkspace", this);
  gIPC->registerForIPC("focusedmon", this);
  gIPC->registerForIPC("moveworkspace", this);
  gIPC->registerForIPC("renameworkspace", this);
  gIPC->registerForIPC("openwindow", this);
  gIPC->registerForIPC("closewindow", this);
  gIPC->registerForIPC("movewindow", this);
  gIPC->registerForIPC("urgent", this);

@Nyayurin
Copy link
Author

It's fine, no any error
Screen

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

Now try it with init() and creation of the gIPC object, but without the registerForIPC calls.

@Nyayurin
Copy link
Author

if (!gIPC) {
    gIPC = std::make_unique<IPC>();
  }

  init();

is still error

if (!gIPC) {
    gIPC = std::make_unique<IPC>();
  }

will not show any error

@Nyayurin
Copy link
Author

if (!gIPC) {
    gIPC = std::make_unique<IPC>();
  }

  //init();

  gIPC->registerForIPC("workspace", this);
  gIPC->registerForIPC("createworkspace", this);
  gIPC->registerForIPC("destroyworkspace", this);
  gIPC->registerForIPC("focusedmon", this);
  gIPC->registerForIPC("moveworkspace", this);
  gIPC->registerForIPC("renameworkspace", this);
  gIPC->registerForIPC("openwindow", this);
  gIPC->registerForIPC("closewindow", this);
  gIPC->registerForIPC("movewindow", this);
  gIPC->registerForIPC("urgent", this);

will not show any error on start
but show the same error when I switch workspace

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

Ok, so the issue is definitely in the IPC communication: maybe in the parsing here or the communication itself here

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

Revert all the changes you made and now try replacing the getSocket1JsonReply method with this:

Json::Value IPC::getSocket1JsonReply(const std::string& rq) {
  std::string response;
  try {
    response = getSocket1Reply("j/" + rq);
  } catch (std::exception& e) {
    spdlog::error("Hyprland IPC: Couldn't get JSON reply: {}", e.what());
    return {Json::nullValue};
  }
  spdlog::info("Hyprland IPC: Got JSON reply: {}", response);
  try {
    return parser_.parse(response);
  } catch (std::exception& e) {
    spdlog::error("Hyprland IPC: Couldn't parse JSON: {}", e.what());
    return {Json::nullValue};
  }
}

and see what it outputs.

@Nyayurin
Copy link
Author

❯ ./build/waybar --config ~/waybar.config --style /etc/xdg/waybar/style.css
[2023-09-11 00:01:30.564] [info] Using configuration file /home/Yurn/waybar.config
[2023-09-11 00:01:30.564] [info] Using CSS file /etc/xdg/waybar/style.css
[2023-09-11 00:01:30.568] [info] Hyprland IPC starting
[2023-09-11 00:01:30.574] [info] Hyprland IPC: Got JSON reply: {
"id": 5,
"name": "5",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": false,
"lastwindow": "0x560df4811380",
"lastwindowtitle": "./build/waybar --config ~/waybar.config --style /etc/xdg/waybar/style.css"
}
[2023-09-11 00:01:30.574] [info] Hyprland IPC: Got JSON reply: [{
"id": 0,
"name": "DVI-D-1",
"description": "TXD \xc7\xe5\xbb\xaa\xcd\xac\xb7\xbd 0x00000001 (DVI-D-1)",
"make": "TXD",
"model": "\xc7\xe5\xbb\xaa\xcd\xac\xb7\xbd ",
"serial": "0x00000001",
"width": 1920,
"height": 1080,
"refreshRate": 60.002998,
"x": 0,
"y": 0,
"activeWorkspace": {
"id": 5,
"name": "5"
},
"specialWorkspace": {
"id": 0,
"name": ""
},
"reserved": [0, 38, 0, 0],
"scale": 1.00,
"transform": 0,
"focused": true,
"dpmsStatus": true,
"vrr": false
}]
[2023-09-11 00:01:30.574] [error] Hyprland IPC: Couldn't parse JSON: * Line 6, Column 14
Bad escape sequence in string
See Line 6, Column 17 for detail.

[2023-09-11 00:01:30.574] [error] Monitor 'DVI-D-1' does not have an ID? Using 0
[2023-09-11 00:01:30.574] [info] Hyprland IPC: Got JSON reply: [{
"id": 1,
"name": "1",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": false,
"lastwindow": "0x560df2cacbd0",
"lastwindowtitle": "QQ"
},{
"id": 2,
"name": "2",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": false,
"lastwindow": "0x560df246ec30",
"lastwindowtitle": "hyprland/workspaces do not work · Issue #2475 · Alexays/Waybar - Vivaldi"
},{
"id": 3,
"name": "3",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": true,
"lastwindow": "0x560df24885a0",
"lastwindowtitle": "Windows [正在运行] - Oracle VM VirtualBox"
},{
"id": 4,
"name": "4",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": false,
"lastwindow": "0x560df247b8a0",
"lastwindowtitle": "备忘录 - Obsidian Vault - Obsidian v1.4.5"
},{
"id": 5,
"name": "5",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": false,
"lastwindow": "0x560df4811380",
"lastwindowtitle": "./build/waybar --config ~/waybar.config --style /etc/xdg/waybar/style.css"
}]
[2023-09-11 00:01:30.579] [info] Hyprland IPC: Got JSON reply: [{
"id": 1,
"name": "1",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": false,
"lastwindow": "0x560df2cacbd0",
"lastwindowtitle": "QQ"
},{
"id": 2,
"name": "2",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": false,
"lastwindow": "0x560df246ec30",
"lastwindowtitle": "hyprland/workspaces do not work · Issue #2475 · Alexays/Waybar - Vivaldi"
},{
"id": 3,
"name": "3",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": true,
"lastwindow": "0x560df24885a0",
"lastwindowtitle": "Windows [正在运行] - Oracle VM VirtualBox"
},{
"id": 4,
"name": "4",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": false,
"lastwindow": "0x560df247b8a0",
"lastwindowtitle": "备忘录 - Obsidian Vault - Obsidian v1.4.5"
},{
"id": 5,
"name": "5",
"monitor": "DVI-D-1",
"windows": 1,
"hasfullscreen": false,
"lastwindow": "0x560df4811380",
"lastwindowtitle": "./build/waybar --config ~/waybar.config --style /etc/xdg/waybar/style.css"
}]
[2023-09-11 00:01:30.601] [info] Hyprland IPC: Got JSON reply: [{
"id": 0,
"name": "DVI-D-1",
"description": "TXD \xc7\xe5\xbb\xaa\xcd\xac\xb7\xbd 0x00000001 (DVI-D-1)",
"make": "TXD",
"model": "\xc7\xe5\xbb\xaa\xcd\xac\xb7\xbd ",
"serial": "0x00000001",
"width": 1920,
"height": 1080,
"refreshRate": 60.002998,
"x": 0,
"y": 0,
"activeWorkspace": {
"id": 5,
"name": "5"
},
"specialWorkspace": {
"id": 0,
"name": ""
},
"reserved": [0, 70, 0, 0],
"scale": 1.00,
"transform": 0,
"focused": true,
"dpmsStatus": true,
"vrr": false
}]
[2023-09-11 00:01:30.601] [error] Hyprland IPC: Couldn't parse JSON: * Line 6, Column 14
Bad escape sequence in string
See Line 6, Column 17 for detail.

[2023-09-11 00:01:30.601] [info] Bar configured (width: 1920, height: 32) for output: DVI-D-1
[2023-09-11 00:01:46.572] [info] Hyprland IPC: Got JSON reply: [{
"id": 0,
"name": "DVI-D-1",
"description": "TXD \xc7\xe5\xbb\xaa\xcd\xac\xb7\xbd 0x00000001 (DVI-D-1)",
"make": "TXD",
"model": "\xc7\xe5\xbb\xaa\xcd\xac\xb7\xbd ",
"serial": "0x00000001",
"width": 1920,
"height": 1080,
"refreshRate": 60.002998,
"x": 0,
"y": 0,
"activeWorkspace": {
"id": 2,
"name": "2"
},
"specialWorkspace": {
"id": 0,
"name": ""
},
"reserved": [0, 70, 0, 0],
"scale": 1.00,
"transform": 0,
"focused": true,
"dpmsStatus": true,
"vrr": false
}]
[2023-09-11 00:01:46.572] [error] Hyprland IPC: Couldn't parse JSON: * Line 6, Column 14
Bad escape sequence in string
See Line 6, Column 17 for detail.

[2023-09-11 00:01:49.016] [info] Hyprland IPC: Got JSON reply: [{
"id": 0,
"name": "DVI-D-1",
"description": "TXD \xc7\xe5\xbb\xaa\xcd\xac\xb7\xbd 0x00000001 (DVI-D-1)",
"make": "TXD",
"model": "\xc7\xe5\xbb\xaa\xcd\xac\xb7\xbd ",
"serial": "0x00000001",
"width": 1920,
"height": 1080,
"refreshRate": 60.002998,
"x": 0,
"y": 0,
"activeWorkspace": {
"id": 5,
"name": "5"
},
"specialWorkspace": {
"id": 0,
"name": ""
},
"reserved": [0, 70, 0, 0],
"scale": 1.00,
"transform": 0,
"focused": true,
"dpmsStatus": true,
"vrr": false
}]
[2023-09-11 00:01:49.016] [error] Hyprland IPC: Couldn't parse JSON: * Line 6, Column 14
Bad escape sequence in string
See Line 6, Column 17 for detail.

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

Looks like your monitor description and model are not parsable with json. Probably an upstream issue?

@Nyayurin
Copy link
Author

wait, it's still error but work
Screen

@zjeffer
Copy link
Contributor

zjeffer commented Sep 10, 2023

Yes because we're catching the error and returning NULL, but I assume you might run into bugs. A better fix is needed, but I'm not sure what the best solution would be.

@Nyayurin
Copy link
Author

Yes because we're catching the error and returning NULL, but I assume you might run into bugs. A better fix is needed, but I'm not sure what the best solution would be.

A difficult problem, but now there is a not-so-good but at least a solution.

@amplexus
Copy link

amplexus commented Jan 10, 2024

So I'm running Waybar on Wayland and I got a monitor that has also has a hex value in its description:

# 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

And I'm getting a similar but different Waybar error (built from source checked out today - Waybar v0.9.24-88-g748fc809 (branch 'master')):

[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.

It doesn't matter if I have no config mentioning hyprland/workspaces other than "modules-left": ["hyprland/workspaces]", I always get the above error.

I'm wondering if this is the same error as @Nyayurn saw above?

@amplexus
Copy link

amplexus commented Jan 10, 2024

Separately and for what it's worth, I see in the jsoncpp library a pull request to add "allowHexadecimal" reader option:

open-source-parsers/jsoncpp#1510

I'm not sure if such a pull request will help with @Nyayurn's escape variant (\x prefix), but I think it would help with mine (0x prefix).

And I also note another issue #2398 with similar symptoms, though the maintainer says that issue was fixed in 0.9.21 (I'm running 0.9.24).

@amplexus
Copy link

Ok never mind. I added a test to https://github.com/open-source-parsers/jsoncpp containing my monitor description string and it didn't complain. My issue is unrelated to this bug.

zjeffer added a commit to zjeffer/Waybar that referenced this issue Jan 14, 2024
* replace \x with \u00 to follow JSON spec
* fixes Alexays#2475
* added unit tests for json parsing
@nnisarggada
Copy link

any updates?

@zjeffer
Copy link
Contributor

zjeffer commented Jan 18, 2024

any updates?

I figured out what causes it, I have a PR open here: #2496

There's still something I need to test with the clock module, as you can see in the comments, but I haven't had time yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants