From df59286237c2c6834d9c411c1f07327e39632e49 Mon Sep 17 00:00:00 2001 From: Kaley Fischer Date: Thu, 28 Dec 2023 22:06:52 +0100 Subject: [PATCH 1/4] fix: removed a unneeded error popup --- src/Hy3Layout.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Hy3Layout.cpp b/src/Hy3Layout.cpp index 0b08895..8211a97 100644 --- a/src/Hy3Layout.cpp +++ b/src/Hy3Layout.cpp @@ -1436,7 +1436,7 @@ void Hy3Layout::applyNodeDataToWindow(Hy3Node* node, bool no_animation) { "node {:x}'s workspace has no associated monitor, cannot apply node data", (uintptr_t) node ); - errorNotif(); + //errorNotif(); return; } From 4c5fb30e76af4edce9d8ba1f33abcb021285ee76 Mon Sep 17 00:00:00 2001 From: Kaley Fischer Date: Wed, 3 Jan 2024 03:50:01 +0100 Subject: [PATCH 2/4] Update: added a makefile --- CMakeLists.txt | 0 LICENSE | 0 Makefile | 25 +++++++++++++++++++++++++ README.md | 0 flake.lock | 0 flake.nix | 0 hyprload.toml | 0 7 files changed, 25 insertions(+) mode change 100644 => 100755 CMakeLists.txt mode change 100644 => 100755 LICENSE create mode 100644 Makefile mode change 100644 => 100755 README.md mode change 100644 => 100755 flake.lock mode change 100644 => 100755 flake.nix mode change 100644 => 100755 hyprload.toml diff --git a/CMakeLists.txt b/CMakeLists.txt old mode 100644 new mode 100755 diff --git a/LICENSE b/LICENSE old mode 100644 new mode 100755 diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..d27dcdb --- /dev/null +++ b/Makefile @@ -0,0 +1,25 @@ +NAME = hy3 +PREFIX = /usr + +all: + $(MAKE) clear + $(MAKE) release + +release: + cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja + cmake --build ./build + chmod -R 777 ./build + +clear: + rm -rf build + +install.core: + @if [ ! -f ./build/libhy3.so ]; then echo -en "You need to run $(MAKE) all first.\n" && exit 1; fi + @echo -en "!NOTE: Please note make install does not compile Hy3 and only installs the already built files." + mkdir -p ${PREFIX}/lib + cp -f ./build/libhy3.so ${PREFIX}/lib + chmod 755 ${PREFIX}/lib/libhy3.so + +install: install.core + +uninstall: diff --git a/README.md b/README.md old mode 100644 new mode 100755 diff --git a/flake.lock b/flake.lock old mode 100644 new mode 100755 diff --git a/flake.nix b/flake.nix old mode 100644 new mode 100755 diff --git a/hyprload.toml b/hyprload.toml old mode 100644 new mode 100755 From 8774c0479a8ab5492156ce8f52b31941fd8e7bc1 Mon Sep 17 00:00:00 2001 From: Kaley Fischer Date: Wed, 3 Jan 2024 05:25:59 +0100 Subject: [PATCH 3/4] update: made it up to date with upstream --- README.md | 83 +++++++++++++++++++++++++++++++--------- compile_commands_bear.sh | 4 -- hyprload.toml | 12 ------ hyprpm.toml | 15 ++++++++ src/TabGroup.cpp | 5 +++ src/main.cpp | 4 +- 6 files changed, 87 insertions(+), 36 deletions(-) delete mode 100755 compile_commands_bear.sh delete mode 100755 hyprload.toml create mode 100644 hyprpm.toml diff --git a/README.md b/README.md index a789c9b..1f3d69c 100755 --- a/README.md +++ b/README.md @@ -65,12 +65,13 @@ Assuming you use hyprland's home manager module, you can easily integrate hy3 by inputs.nixpkgs.follows = "nixpkgs"; }; - hyprland.url = "github:hyprwm/Hyprland"; - # or "github:hyprwm/Hyprland?ref=v{version}" for a release version of hyprland + hyprland.url = "github:hyprwm/Hyprland?ref=v{version}"; # where {version} is the hyprland release version + # or "github:hyprwm/Hyprland" to follow the development branch hy3 = { - url = "github:outfoxxed/hy3"; - # or "github:outfoxxed/hy3?ref=hl{version}" for a release version of hyprland + url = "github:outfoxxed/hy3?ref=hl{version}"; # where {version} is the hyprland release version + # or "github:outfoxxed/hy3" to follow the development branch. + # (you may encounter issues if you dont do the same for hyprland) inputs.hyprland.follows = "hyprland"; }; }; @@ -108,11 +109,64 @@ wayland.windowManager.hyprland = { }; ``` -### Arch (AUR) +### hyprpm +Hyprland now has a dedicated plugin manager, which should be used when your package manager +isn't capable of locking hy3 builds to the correct hyprland version. > [!IMPORTANT] +> Make sure hyprpm is activated by putting +> +> ```conf +> exec-once = hyprpm reload -n +> ``` +> +> in your hyprland.conf. (See [the wiki](https://wiki.hyprland.org/Plugins/Using-Plugins/) for details.) + +To install hy3 via hyprpm run + +```sh +hyprpm add https://github.com/outfoxxed/hy3 +``` + +To update hy3 (and all other plugins), run + +```sh +hyprpm update +``` + +(See [the wiki](https://wiki.hyprland.org/Plugins/Using-Plugins/) for details.) + +> [!WARNING] +> When you are running a tagged hyprland version hyprpm (0.34.0+) will build against hy3's +> corrosponding release. However if you are running an untagged build (aka `-git`) hyprpm +> will build against hy3's *latest* commit. This means **if you are running an out of date +> untagged build of hyprland, hyprpm may pick an incompatible revision of hy3**. +> +> To fix this problem you will either need to update hyprland or manually build the correct +> version of hy3. + +### Manual +Install hyprland, including its headers and pkg-config file, then run the following commands: + +```sh +cmake -DCMAKE_BUILD_TYPE=Release -B build +cmake --build build +``` + +The plugin will be located at `build/libhy3.so`, and you can load it normally +(See [the hyprland wiki](https://wiki.hyprland.org/Plugins/Using-Plugins/#installing--using-plugins) for details.) + +Note that the hyprland headers and pkg-config file **MUST be installed correctly, for the target version of hyprland**. + +### Arch (AUR) + +> [!NOTE] +> This method of installation is deprecated and you should use *hyprpm* instead, +> as it is simpler and less error prone. + +> [!CAUTION] > Pacman is not very reliable when it comes to building packages in the correct order. -> If hy3 fails to load or build, crashes randomly or behaves oddly (commonly dispatchers stop working) +> If you get a notification saying *hy3 was compiled for a different version of hyprland* > then your packages likely updated in the wrong order, or you have hyprland headers in `/usr/local`. > > To fix this, remove `/usr/include/hyprland`, `/usr/local/include/hyprland`, `/usr/share/pkgconfig/hyprland.pc` and `/usr/local/share/pkgconfig/hyprland.pc`, @@ -131,19 +185,6 @@ You can enable it in your hyprland configuration by adding the following line an plugin = /usr/lib/libhy3.so ``` -### Manual -Install hyprland, including its headers and pkg-config file, then run the following commands: - -```sh -cmake -DCMAKE_BUILD_TYPE=Debug -B build -cmake --build build -``` - -The plugin will be located at `build/libhy3.so`, and you can load it normally -(See [the hyprland wiki](https://wiki.hyprland.org/Plugins/Using-Plugins/#installing--using-plugins) for details.) - -Note that the hyprland headers and pkg-config file **MUST be installed correctly, for the target version of hyprland**. - ## Configuration > [!IMPORTANT] @@ -204,6 +245,9 @@ plugin { # render the window title on the bar render_text = # default: true + # center the window title + text_center = # default: false + # font to render the window title with text_font = # default: Sans @@ -301,3 +345,4 @@ plugin { - `expand` - expand by one node - `shrink` - shrink by one node - `base` - undo all expansions + diff --git a/compile_commands_bear.sh b/compile_commands_bear.sh deleted file mode 100755 index 83b4946..0000000 --- a/compile_commands_bear.sh +++ /dev/null @@ -1,4 +0,0 @@ -rm -rf build -bear -- cmake --build build -cmake -DCMAKE_BUILD_TYPE=Debug -DHY3_NO_VERSION_CHECK=TRUE -B build -sed -i 's/-std=gnu++23/-std=gnu++2b/g' compile_commands.json diff --git a/hyprload.toml b/hyprload.toml deleted file mode 100755 index 0d3855c..0000000 --- a/hyprload.toml +++ /dev/null @@ -1,12 +0,0 @@ -[hy3] -description = "i3 like tiling for hyprland" -version = "0.1" -author = "outfoxxed" - -[hy3.build] -output = "build/libhy3.so" -steps = [ - "rm -rf build", - "cmake -DCMAKE_BUILD_TYPE=Debug -B build", - "cmake --build build" -] diff --git a/hyprpm.toml b/hyprpm.toml new file mode 100644 index 0000000..c8fd12b --- /dev/null +++ b/hyprpm.toml @@ -0,0 +1,15 @@ +[repository] +name = "hy3" +authors = ["outfoxxed"] +commit_pins = [ + ["03ebbe18ed8517ee22591eac82cd54322f42cb7d", "2f28dc810c0e1f42763a1f14fb011c4fce6db8be"] +] + +[hy3] +description = "i3 like tiling for hyprland" +authors = ["outfoxxed"] +output = "build/libhy3.so" +build = [ + "cmake -DCMAKE_BUILD_TYPE=Release -B build", + "cmake --build build" +] diff --git a/src/TabGroup.cpp b/src/TabGroup.cpp index 217b88e..27a40d4 100644 --- a/src/TabGroup.cpp +++ b/src/TabGroup.cpp @@ -128,6 +128,7 @@ void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) { // clang-format off static const auto* s_rounding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:rounding")->intValue; static const auto* render_text = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:render_text")->intValue; + static const auto* text_center = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:text_center")->intValue; static const auto* text_font = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:text_font")->strValue; static const auto* text_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:text_height")->intValue; static const auto* text_padding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:text_padding")->intValue; @@ -224,6 +225,9 @@ void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) { PangoLayout* layout = pango_cairo_create_layout(cairo); pango_layout_set_text(layout, this->window_title.c_str(), -1); + if (*text_center) + pango_layout_set_alignment(layout, PANGO_ALIGN_CENTER); + PangoFontDescription* font_desc = pango_font_description_from_string(text_font->c_str()); pango_font_description_set_size(font_desc, *text_height * scale * PANGO_SCALE); pango_layout_set_font_description(layout, font_desc); @@ -679,3 +683,4 @@ void Hy3TabGroup::updateStencilWindows(Hy3Node& group) { this->stencil_windows.clear(); findOverlappingWindows(group, this->size.goalv().y, this->stencil_windows); } + diff --git a/src/main.cpp b/src/main.cpp index da76409..62df130 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -18,7 +18,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { if (GIT_COMMIT_HASH != std::string(__hyprland_api_get_hash())) { HyprlandAPI::addNotification( PHANDLE, - "[hy3] Hy3 was compiled for a different version of hyprland; refusing to start.", + "[hy3] hy3 was compiled for a different version of hyprland; refusing to load.", CColor {1.0, 0.2, 0.2, 1.0}, 10000 ); @@ -45,6 +45,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { CONF("tabs:from_top", int, 0); CONF("tabs:rounding", int, 3); CONF("tabs:render_text", int, 1); + CONF("tabs:text_center", int, 0); CONF("tabs:text_font", str, "Sans"); CONF("tabs:text_height", int, 8); CONF("tabs:text_padding", int, 3); @@ -73,3 +74,4 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) { } APICALL EXPORT void PLUGIN_EXIT() {} + From 8c4df162dea4a7e7544018d2f3c0348ebdeb36ac Mon Sep 17 00:00:00 2001 From: Kaley Fischer Date: Thu, 4 Jan 2024 10:35:44 +0100 Subject: [PATCH 4/4] fix: added my credits --- hyprpm.toml | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/hyprpm.toml b/hyprpm.toml index c8fd12b..e5fcf4d 100644 --- a/hyprpm.toml +++ b/hyprpm.toml @@ -1,13 +1,10 @@ [repository] name = "hy3" -authors = ["outfoxxed"] -commit_pins = [ - ["03ebbe18ed8517ee22591eac82cd54322f42cb7d", "2f28dc810c0e1f42763a1f14fb011c4fce6db8be"] -] +authors = ["outfoxxed, DRAGONTOS"] [hy3] description = "i3 like tiling for hyprland" -authors = ["outfoxxed"] +authors = ["outfoxxed, DRAGONTOS"] output = "build/libhy3.so" build = [ "cmake -DCMAKE_BUILD_TYPE=Release -B build",