Closed Nyayurin closed 10 months ago
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": [],
},
},
@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.
@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
Which version of Waybar are you using?
Changing wlr/workspaces to hyprland/workspaces fixed it for me.
Which version of Waybar are you using?
extra/waybar 0.9.22-1
That's so strange. Can you copy paste your entire config? Both config.json and style.css.
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...
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
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.
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
It still do not work
Try removing the keyboard-state
module and see what happens, unless it is actually something you are using.
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
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
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?
still do not work
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?
still do not work
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
still do not work
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
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
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.
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
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
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.
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
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.
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
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>
Also what is the output of hyprctl monitors
and hyprctl workspaces
?
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
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 outwaybar-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
Also what is the output of
hyprctl monitors
andhyprctl workspaces
?
❯ hyprctl monitors
Monitor DVI-D-1 (ID 0):
1920x1080@60.002998 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
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.
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.
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.
Ok this is weird: it's still reporting something wrong with line 6, column 14, just like before...
If you remove hyprland/workspaces from the config (basically having an empty config). Does it still give the error?
What's your locale?
EDIT: Oh, I can see in the screenshot it's using zh_CN. Try running waybar with LANG=en_US.UTF-8 ./build/waybar
and see if it makes a difference
If I remove hyprland/workspaces it will not show en_US.UTF-8 still error
Which version of Hyprland are you using? Maybe there's a problem with the IPC communication?
Is there anything weird showing with journalctl -b0 |grep 'hyprland'
or sudo dmesg |grep 'hyprland'
?
I'm using hyprland 0.29.1-1
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.
It's do not throw error but still do not work
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
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);
It's fine, no any error
Now try it with init() and creation of the gIPC object, but without the registerForIPC calls.
if (!gIPC) {
gIPC = std::make_unique<IPC>();
}
init();
is still error
if (!gIPC) {
gIPC = std::make_unique<IPC>();
}
will not show any error
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
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.
❯ ./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.
Looks like your monitor description and model are not parsable with json. Probably an upstream issue?
wait, it's still error but work