From e42e505ce82b2ad0d33b56e9e1e600db7ebb9e7a Mon Sep 17 00:00:00 2001 From: Alessio Molinari Date: Wed, 12 Jun 2024 23:07:00 +0200 Subject: [PATCH 1/8] chore: bump version --- src/main.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 2d0be9d..2721156 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -418,5 +418,5 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { // Initialize first vdesk HyprlandAPI::reloadConfig(); - return {"virtual-desktops", "Virtual desktop like workspaces", "LevMyskin", "2.2.2"}; + return {"virtual-desktops", "Virtual desktop like workspaces", "LevMyskin", "2.2.3"}; } From 6bbee0b01594f28cddc2f7ee9bcf0ce27bbf330a Mon Sep 17 00:00:00 2001 From: Alessio Molinari Date: Wed, 12 Jun 2024 23:07:32 +0200 Subject: [PATCH 2/8] chore: update hyprpm to hyprland 0.41.0 --- hyprpm.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hyprpm.toml b/hyprpm.toml index 2583140..074d842 100644 --- a/hyprpm.toml +++ b/hyprpm.toml @@ -24,6 +24,8 @@ commit_pins = [ ["fe7b748eb668136dd0558b7c8279bfcd7ab4d759", "2a90d57bdfdee1a153fd321bc2da0924b8409c3b"], # Hyprland v0.40.0 ["cba1ade848feac44b2eda677503900639581c3f4", "e3bad3b9ab3dac25ad77641a2037601035125535"], + # Hyprland v0.41.0 + ["ea2501d4556f84d3de86a4ae2f4b22a474555b9f", "e42e505ce82b2ad0d33b56e9e1e600db7ebb9e7a"], ] From 8bef6655d843b62aa2cdb646e69f1972fa48c1e6 Mon Sep 17 00:00:00 2001 From: Alessio Molinari Date: Wed, 12 Jun 2024 23:19:14 +0200 Subject: [PATCH 3/8] ci: update hyprland and wayland-scanner version --- .github/workflows/ci.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 90e7091..64b27a0 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,8 +28,8 @@ jobs: if: github.ref == 'refs/heads/main'|| github.base_ref == 'main' with: INSTALL_XORG_PKGS: true - branch: 'v0.40.0' - hyprwayland: 'v0.3.4' + branch: 'v0.41.0' + hyprwayland: 'v0.3.10' - name: Setup base on dev uses: ./.github/actions/setup_base From 02cadb1cc5ced45b0e7dcf6e7467ce094ea92d5a Mon Sep 17 00:00:00 2001 From: Alessio Molinari Date: Wed, 12 Jun 2024 23:32:45 +0200 Subject: [PATCH 4/8] chore: restore main readme, ups --- README.md | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 25ed745..a810887 100644 --- a/README.md +++ b/README.md @@ -1,15 +1,14 @@ # Virtual desktops for Hyprland ![hyprico](.github/hyprland.ico) `virtual-desktops` is a plugin for the [Hyprland](https://github.com/hyprwm/Hyprland) compositor. `virtual-desktops` manages multiple screens workspaces as if they were a single virtual desktop. -## WARNING -You are on the `dev` branch. This branch unconsistently gather updates and fixes to follow `hyprland-git`. By unconsistently, I mean that there is NO GUARANTEE that this branch will work with `hyprland-git` at any given time. -This plugin **DOES NOT** support `hyprland-git`, please refrain from opening issues if virtual-desktop does not compile with the latest commit on hyprland. Feel free to contribute to this branch via PRs though. +This plugin **only supports official releases of Hyprland** (e.g., v0.39.x, v0.40.x). +If you are on `hyprland-git`, please try compiling this plugin from the [dev branch](https://github.com/levnikmyskin/hyprland-virtual-desktops/tree/dev). +There is **NO GUARANTEE** that the plugin will compile succesfully on the latest Hyprland commit, but we try our best to keep it updated. Also, always check the [PR section](https://github.com/levnikmyskin/hyprland-virtual-desktops/pulls?q=is%3Apr+is%3Aopen+sort%3Aupdated-desc), +as there might be a draft PR for the next Hyprland release, where you can check the status of development. Feel free to join our [matrix room](https://matrix.to/#/#hypr-virtual-desktops:matrix.org)! ->>>>>>> main - ## Table of contents - [Virtual desktops for Hyprland ](#virtual-desktops-for-hyprland-) - [Table of contents](#table-of-contents) From cd3b43fdc8407ef3ecaa3b66a381a61af8b142b9 Mon Sep 17 00:00:00 2001 From: Alessio Molinari Date: Sat, 15 Jun 2024 11:20:42 +0200 Subject: [PATCH 5/8] feat: support hyprland v0.41.1 (use hyprutils) --- include/VirtualDesk.hpp | 6 ++-- include/utils.hpp | 4 ++- src/main.cpp | 72 +++++++++++++++++++++-------------------- 3 files changed, 44 insertions(+), 38 deletions(-) diff --git a/include/VirtualDesk.hpp b/include/VirtualDesk.hpp index 4bd1263..b8c8f49 100644 --- a/include/VirtualDesk.hpp +++ b/include/VirtualDesk.hpp @@ -11,9 +11,11 @@ #include "globals.hpp" #include "utils.hpp" #include -#include +#include -typedef std::unordered_map WorkspaceMap; +using namespace Hyprutils::Memory; + +typedef std::unordered_map WorkspaceMap; // map with CMonitor* -> hyprland workspace id typedef std::unordered_map Layout; typedef std::string MonitorName; diff --git a/include/utils.hpp b/include/utils.hpp index bf2c720..8cfd1ce 100644 --- a/include/utils.hpp +++ b/include/utils.hpp @@ -5,10 +5,12 @@ #include #include "globals.hpp" #include -#include +#include #include #include +using namespace Hyprutils::Memory; + const std::string VIRTUALDESK_NAMES_CONF = "plugin:virtual-desktops:names"; const std::string CYCLEWORKSPACES_CONF = "plugin:virtual-desktops:cycleworkspaces"; const std::string REMEMBER_LAYOUT_CONF = "plugin:virtual-desktops:rememberlayout"; diff --git a/src/main.cpp b/src/main.cpp index 2721156..c134a39 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -5,7 +5,7 @@ #include #include #include -#include +#include #include "globals.hpp" #include "VirtualDeskManager.hpp" @@ -15,21 +15,23 @@ #include #include +using namespace Hyprutils::Memory; + static CSharedPointer onWorkspaceChangeHook = nullptr; static CSharedPointer onWindowOpenHook = nullptr; static CSharedPointer onConfigReloadedHook = nullptr; inline CFunctionHook* g_pMonitorConnectHook = nullptr; inline CFunctionHook* g_pMonitorDisconnectHook = nullptr; -typedef void (*origMonitorConnect)(void*, bool); -typedef void (*origMonitorDisconnect)(void*, bool); +typedef void (*origMonitorConnect)(void*, bool); +typedef void (*origMonitorDisconnect)(void*, bool); -std::unique_ptr manager = std::make_unique(); -std::vector stickyRules; -bool notifiedInit = false; -bool monitorLayoutChanging = false; +std::unique_ptr manager = std::make_unique(); +std::vector stickyRules; +bool notifiedInit = false; +bool monitorLayoutChanging = false; -void parseNamesConf(std::string& conf) { +void parseNamesConf(std::string& conf) { size_t pos; size_t delim; std::string rule; @@ -179,38 +181,36 @@ std::string printStateDispatch(eHyprCtlOutputFormat format, std::string arg) { if (format == eHyprCtlOutputFormat::FORMAT_NORMAL) { out += "Virtual desks\n"; int index = 0; - for(auto const& [vdeskId, desk] : manager->vdesksMap) { + for (auto const& [vdeskId, desk] : manager->vdesksMap) { unsigned int windows = 0; - std::string workspaces; - bool first = true; - for(auto const& [monitor, workspaceId] : desk->activeLayout(manager->conf)) { + std::string workspaces; + bool first = true; + for (auto const& [monitor, workspaceId] : desk->activeLayout(manager->conf)) { windows += g_pCompositor->getWindowsOnWorkspace(workspaceId); - if(!first) workspaces += ", "; - else first = false; + if (!first) + workspaces += ", "; + else + first = false; workspaces += std::format("{}", workspaceId); } - out += std::format( - "- {}: {}\n Focused: {}\n Populated: {}\n Workspaces: {}\n Windows: {}\n", - desk->name, - desk->id, - manager->activeVdesk().get() == desk.get(), - windows > 0, - workspaces, - windows - ); - if(index++ < manager->vdesksMap.size() - 1) out += "\n"; + out += std::format("- {}: {}\n Focused: {}\n Populated: {}\n Workspaces: {}\n Windows: {}\n", desk->name, desk->id, manager->activeVdesk().get() == desk.get(), + windows > 0, workspaces, windows); + if (index++ < manager->vdesksMap.size() - 1) + out += "\n"; } - } else if(format == eHyprCtlOutputFormat::FORMAT_JSON) { + } else if (format == eHyprCtlOutputFormat::FORMAT_JSON) { std::string vdesks; - int index = 0; - for(auto const& [vdeskId, desk] : manager->vdesksMap) { + int index = 0; + for (auto const& [vdeskId, desk] : manager->vdesksMap) { unsigned int windows = 0; - std::string workspaces; - bool first = true; - for(auto const& [monitor, workspaceId] : desk->activeLayout(manager->conf)) { + std::string workspaces; + bool first = true; + for (auto const& [monitor, workspaceId] : desk->activeLayout(manager->conf)) { windows += g_pCompositor->getWindowsOnWorkspace(workspaceId); - if(!first) workspaces += ", "; - else first = false; + if (!first) + workspaces += ", "; + else + first = false; workspaces += std::format("{}", workspaceId); } vdesks += std::format(R"#({{ @@ -220,8 +220,10 @@ std::string printStateDispatch(eHyprCtlOutputFormat format, std::string arg) { "populated": {}, "workspaces": [{}], "windows": {} - }})#", vdeskId, desk->name, manager->activeVdesk().get() == desk.get(), windows > 0, workspaces, windows); - if(index++ < manager->vdesksMap.size() - 1) vdesks += ","; + }})#", + vdeskId, desk->name, manager->activeVdesk().get() == desk.get(), windows > 0, workspaces, windows); + if (index++ < manager->vdesksMap.size() - 1) + vdesks += ","; } out += std::format(R"#([{}])#", vdesks); } @@ -418,5 +420,5 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { // Initialize first vdesk HyprlandAPI::reloadConfig(); - return {"virtual-desktops", "Virtual desktop like workspaces", "LevMyskin", "2.2.3"}; + return {"virtual-desktops", "Virtual desktop like workspaces", "LevMyskin", "2.2.4"}; } From 9d26d30bc31cf13ca2535eeca70abf61e3cc7bc6 Mon Sep 17 00:00:00 2001 From: Alessio Molinari Date: Sat, 15 Jun 2024 11:21:07 +0200 Subject: [PATCH 6/8] feat(ci): add hyprutils to ci deps --- .github/actions/setup_base/action.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/actions/setup_base/action.yml b/.github/actions/setup_base/action.yml index 8f8df38..f869d30 100644 --- a/.github/actions/setup_base/action.yml +++ b/.github/actions/setup_base/action.yml @@ -79,6 +79,15 @@ runs: cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF` cmake --install build + - name: Get hyprutils + shell: bash + run: | + git clone https://github.com/hyprwm/hyprutils.git + cd hyprutils + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -S . -B ./build + cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf _NPROCESSORS_CONF` + cmake --install build + - name: Get Xorg pacman pkgs shell: bash if: inputs.INSTALL_XORG_PKGS == 'true' From 003c77c7ceebd4a6b6ffb6d1ae3396b53132bc70 Mon Sep 17 00:00:00 2001 From: Alessio Molinari Date: Sat, 15 Jun 2024 12:06:32 +0200 Subject: [PATCH 7/8] fix(ci): update to hyprland 0.41.1 --- .github/workflows/ci.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 64b27a0..163f140 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -28,7 +28,7 @@ jobs: if: github.ref == 'refs/heads/main'|| github.base_ref == 'main' with: INSTALL_XORG_PKGS: true - branch: 'v0.41.0' + branch: 'v0.41.1' hyprwayland: 'v0.3.10' - name: Setup base on dev From 552214002b61f65a9ded08e6550782d3ca570487 Mon Sep 17 00:00:00 2001 From: Alessio Molinari Date: Sat, 15 Jun 2024 12:20:10 +0200 Subject: [PATCH 8/8] chore: bump hyprpm --- hyprpm.toml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hyprpm.toml b/hyprpm.toml index 074d842..992c99b 100644 --- a/hyprpm.toml +++ b/hyprpm.toml @@ -26,6 +26,8 @@ commit_pins = [ ["cba1ade848feac44b2eda677503900639581c3f4", "e3bad3b9ab3dac25ad77641a2037601035125535"], # Hyprland v0.41.0 ["ea2501d4556f84d3de86a4ae2f4b22a474555b9f", "e42e505ce82b2ad0d33b56e9e1e600db7ebb9e7a"], + # Hyprland v0.41.1 + ["9e781040d9067c2711ec2e9f5b47b76ef70762b3", "b5121a450a66382fd8e6e28e93d83430c86043a6"] ]