update: made it up to date with upstream

This commit is contained in:
Kaley, Fischer 2024-01-03 05:25:59 +01:00
parent 4c5fb30e76
commit 8774c0479a
6 changed files with 87 additions and 36 deletions

View file

@ -65,12 +65,13 @@ Assuming you use hyprland's home manager module, you can easily integrate hy3 by
inputs.nixpkgs.follows = "nixpkgs"; inputs.nixpkgs.follows = "nixpkgs";
}; };
hyprland.url = "github:hyprwm/Hyprland"; hyprland.url = "github:hyprwm/Hyprland?ref=v{version}"; # where {version} is the hyprland release version
# or "github:hyprwm/Hyprland?ref=v{version}" for a release version of hyprland # or "github:hyprwm/Hyprland" to follow the development branch
hy3 = { hy3 = {
url = "github:outfoxxed/hy3"; url = "github:outfoxxed/hy3?ref=hl{version}"; # where {version} is the hyprland release version
# or "github:outfoxxed/hy3?ref=hl{version}" for a release version of hyprland # 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"; 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] > [!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. > 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`. > 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`, > 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 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 ## Configuration
> [!IMPORTANT] > [!IMPORTANT]
@ -204,6 +245,9 @@ plugin {
# render the window title on the bar # render the window title on the bar
render_text = <bool> # default: true render_text = <bool> # default: true
# center the window title
text_center = <bool> # default: false
# font to render the window title with # font to render the window title with
text_font = <string> # default: Sans text_font = <string> # default: Sans
@ -301,3 +345,4 @@ plugin {
- `expand` - expand by one node - `expand` - expand by one node
- `shrink` - shrink by one node - `shrink` - shrink by one node
- `base` - undo all expansions - `base` - undo all expansions

View file

@ -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

View file

@ -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"
]

15
hyprpm.toml Normal file
View file

@ -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"
]

View file

@ -128,6 +128,7 @@ void Hy3TabBarEntry::prepareTexture(float scale, CBox& box) {
// clang-format off // clang-format off
static const auto* s_rounding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:rounding")->intValue; 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* 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_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_height = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:text_height")->intValue;
static const auto* text_padding = &HyprlandAPI::getConfigValue(PHANDLE, "plugin:hy3:tabs:text_padding")->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); PangoLayout* layout = pango_cairo_create_layout(cairo);
pango_layout_set_text(layout, this->window_title.c_str(), -1); 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()); 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_font_description_set_size(font_desc, *text_height * scale * PANGO_SCALE);
pango_layout_set_font_description(layout, font_desc); pango_layout_set_font_description(layout, font_desc);
@ -679,3 +683,4 @@ void Hy3TabGroup::updateStencilWindows(Hy3Node& group) {
this->stencil_windows.clear(); this->stencil_windows.clear();
findOverlappingWindows(group, this->size.goalv().y, this->stencil_windows); findOverlappingWindows(group, this->size.goalv().y, this->stencil_windows);
} }

View file

@ -18,7 +18,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
if (GIT_COMMIT_HASH != std::string(__hyprland_api_get_hash())) { if (GIT_COMMIT_HASH != std::string(__hyprland_api_get_hash())) {
HyprlandAPI::addNotification( HyprlandAPI::addNotification(
PHANDLE, 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}, CColor {1.0, 0.2, 0.2, 1.0},
10000 10000
); );
@ -45,6 +45,7 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
CONF("tabs:from_top", int, 0); CONF("tabs:from_top", int, 0);
CONF("tabs:rounding", int, 3); CONF("tabs:rounding", int, 3);
CONF("tabs:render_text", int, 1); CONF("tabs:render_text", int, 1);
CONF("tabs:text_center", int, 0);
CONF("tabs:text_font", str, "Sans"); CONF("tabs:text_font", str, "Sans");
CONF("tabs:text_height", int, 8); CONF("tabs:text_height", int, 8);
CONF("tabs:text_padding", int, 3); CONF("tabs:text_padding", int, 3);
@ -73,3 +74,4 @@ APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
} }
APICALL EXPORT void PLUGIN_EXIT() {} APICALL EXPORT void PLUGIN_EXIT() {}