-
-
Notifications
You must be signed in to change notification settings - Fork 732
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
Comments
Add the following to the bottom of ~/.config/waybar/config....
|
@Nyayurn What's your actual hyprland/workspaces config? We can only see you added the |
none or
or
as the same error |
Which version of Waybar are you using? |
Changing wlr/workspaces to hyprland/workspaces fixed it for me. |
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 |
idk if its helpful or anything, but try running the config.json through a unescape tool online to see if it changes anything. |
OK, lets try it in reverse. Rename your existing config to something else eg
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... 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. |
|
Try removing the |
https://www.freeformatter.com/json-escape.html Try this tool, it might not work, but it is worth the try EDIT: |
I tried it but still do not work |
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 waybar-hyprland packages was for wlr/workspaces support, not hyprland/workspaces. That package is now obsolete, of course. |
Yeah @Nyayurn did you try manually compiling and seeing what it does? 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 |
Also what is the output of |
|
❯ hyprctl monitors ❯ hyprctl workspaces workspace ID 2 (2) on monitor DVI-D-1: workspace ID 3 (3) on monitor DVI-D-1: workspace ID 4 (4) on monitor DVI-D-1: workspace ID 5 (5) on monitor DVI-D-1: workspace ID 6 (6) on monitor DVI-D-1: workspace ID 7 (7) on monitor DVI-D-1: |
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. |
Which version of Hyprland are you using? Maybe there's a problem with the IPC communication? |
Is there anything weird showing with |
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 |
|
Great, now we can debug further. Try instead of removing everything from the constructor, only remove all the 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); |
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 |
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.574] [error] Monitor 'DVI-D-1' does not have an ID? Using 0 [2023-09-11 00:01:30.601] [info] Bar configured (width: 1920, height: 32) for output: DVI-D-1 [2023-09-11 00:01:49.016] [info] Hyprland IPC: Got JSON reply: [{ |
Looks like your monitor description and model are not parsable with json. Probably an upstream issue? |
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. |
So I'm running Waybar on Wayland and I got a monitor that has also has a hex value in its description:
And I'm getting a similar but different Waybar error (built from source checked out today -
It doesn't matter if I have no config mentioning hyprland/workspaces other than I'm wondering if this is the same error as @Nyayurn saw above? |
Separately and for what it's worth, I see in the jsoncpp library a pull request to open-source-parsers/jsoncpp#1510 I'm not sure if such a pull request will help with @Nyayurn's escape variant ( And I also note another issue #2398 with similar symptoms, though the maintainer says that issue was fixed in |
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. |
* replace \x with \u00 to follow JSON spec * fixes Alexays#2475 * added unit tests for json parsing
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. |
The text was updated successfully, but these errors were encountered: