Hyprland icon indicating copy to clipboard operation
Hyprland copied to clipboard

Migrate the config to hyprlang

Open vaxerski opened this issue 1 year ago • 56 comments

cc @fufexan @MightyPlaza @DreamMaoMao @outfoxxed @horriblename @thejch

Breaking: everything internally (all plugins)

This MR migrates hyprland's config to hyprlang. PLEASE NOTE this requires latest hyprlang-git. Once this mr is gtg, I'll bump ver to 0.3.0.

Please test this, some parts have been written at 3AM and I'll be surprised if I havent missed some *PVAR -> **PVAR occurrences.

TODO:

  • [x] CI (@fufexan pls)
  • [x] Meson (@fufexan pls)
  • [x] getOption hyprctl
  • [x] plugin config keywords
  • [x] more testing
  • [x] Better error reporting (keywords do not throw errors at all atm)

List of breaking changes for end users:

  • hyprctl getoption has a new return syntax
  • device sections take name = ... instead of device:... {
  • All config-related plugin APIs are broken (need updates)

vaxerski avatar Feb 09 '24 03:02 vaxerski

image

image

Even updating hyprlang to 0.2.1

this branch of hyprland still fail to build.

DreamMaoMao avatar Feb 09 '24 07:02 DreamMaoMao

build fail by use meson

success by use cmake

DreamMaoMao avatar Feb 09 '24 07:02 DreamMaoMao

@DreamMaoMao meson should work now.

fufexan avatar Feb 09 '24 08:02 fufexan

I can test once you have a way for me to add plugin settings. Normal workflow does not work without hy3.

outfoxxed avatar Feb 09 '24 12:02 outfoxxed

@outfoxxed done. Check the PluginAPI header for API changes.

vaxerski avatar Feb 09 '24 15:02 vaxerski

from my testing this is ready to review.

vaxerski avatar Feb 09 '24 16:02 vaxerski

seems to have removed case insensitivity. not sure if intended or not. e.g. it breaks

OpenGL {
    nvidia_anti_flicker = true
}

has to be

opengl {
    nvidia_anti_flicker = true
}

now

thejch avatar Feb 09 '24 23:02 thejch

true, hyprlang is case-sensitive. IDK, never was meant to be capitalized, tbh

vaxerski avatar Feb 09 '24 23:02 vaxerski

This also breaks multiple #s e.g. ## comment throws an error

thejch avatar Feb 10 '24 01:02 thejch

nice catch. Needs a fix in hyprlang.

vaxerski avatar Feb 10 '24 01:02 vaxerski

fixed in https://github.com/hyprwm/hyprlang/commit/c1f5b0ab485e13dde662e7a320a511c66b2fb386

vaxerski avatar Feb 10 '24 01:02 vaxerski

I found 2 issues :

  • gapsout for my special workspace stopped working, it seems to be ignored.
  • red config error stripe appears/disapears only when closing hyprland completely and re-running it, not when using hyprctl (found by jappie3)

Vagahbond avatar Feb 10 '24 10:02 Vagahbond

@fufexan can't get meson to work, also tried putting hyprland and hyprland.dev in shell inputs

Run-time dependency hyprlang found: NO (tried pkgconfig and cmake)

src/meson.build:14:4: ERROR: Dependency "hyprlang" not found, tried pkgconfig and cmake

outfoxxed avatar Feb 10 '24 11:02 outfoxxed

Commit dac898d69ca8227a3e9eaf1997dedee1f7c76024 (Nix)

  1. Shadows are not working
decoration {
  col.shadow=rgb(2E3440)
  drop_shadow=true
  shadow_range=25
  shadow_render_power=3
}
  1. Groupbar render_titles=false is not working
group {
  groupbar {
    render_titles=false
    ...
  }
}

ErrorNoInternet avatar Feb 10 '24 11:02 ErrorNoInternet

@DreamMaoMao meson should work now.

it work to me now

DreamMaoMao avatar Feb 10 '24 13:02 DreamMaoMao

@fufexan can't get meson to work, also tried putting hyprland and hyprland.dev in shell inputs

Run-time dependency hyprlang found: NO (tried pkgconfig and cmake)

src/meson.build:14:4: ERROR: Dependency "hyprlang" not found, tried pkgconfig and cmake

may need to install the latest committed hyprlang

DreamMaoMao avatar Feb 10 '24 13:02 DreamMaoMao

for what is a man, what has he got?

@Vagahbond in what case? gaps_out seems to be working for me normally.

@ErrorNoInternet fixed both :)

@DreamMaoMao hyprlang 0.3.0 needed

vaxerski avatar Feb 10 '24 14:02 vaxerski

I can swipe across multiple workspaces in one swipe using my laptop's trackpad, is this intended?

Jappie3 avatar Feb 10 '24 15:02 Jappie3

if you enable it ;)

fixed

vaxerski avatar Feb 10 '24 17:02 vaxerski

@Vagahbond in what case? gaps_out seems to be working for me normally.

Hyprland, built from branch  at commit 80ae6dbf754b9773a7375fde7c9d8495732c8e25  ().
Date: 2024-02-10
Tag: 

flags: (if any)

My conf bit for this is :

    workspace = special:scratchpad, on-created-empty:foot zsh -c 'nitch; zsh -i' & gnome-pomodoro,gapsout:50

gaps out for regular windows work normally but for my scratchpad they're borken.

satty-20240210-20:33:09

It used to work before I switch to that PR, is the issue between chair and desk ?

Vagahbond avatar Feb 10 '24 19:02 Vagahbond

fixed

vaxerski avatar Feb 10 '24 20:02 vaxerski

gotta wait for arc lonix to have hyprlang 0.3 in their standard repos not -testing and this should be gtg

vaxerski avatar Feb 10 '24 21:02 vaxerski

fwiw this should also reduce CPU usage as I found some places where some idiots slipped through my reviews and made very poor decisions as to how the config should be pulled

vaxerski avatar Feb 11 '24 02:02 vaxerski

Adding config variables via HyprlandAPI is segfaulting. Fairly sure I'm using it correctly from reading the mr.

#define CONF(NAME, TYPE, VALUE)                                                                    \
	HyprlandAPI::addConfigValue(PHANDLE, "plugin:hy3:" NAME, Hyprlang::CConfigValue((Hyprlang::TYPE) VALUE))

	// general
	CONF("no_gaps_when_only", INT, 0);
	CONF("node_collapse_policy", INT, 2);
	CONF("group_inset", INT, 10);
	CONF("tab_first_window", INT, 0);

	// tabs
	CONF("tabs:height", INT, 15);
	CONF("tabs:padding", INT, 5);
	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", STRING, "Sans");
	CONF("tabs:text_height", INT, 8);
	CONF("tabs:text_padding", INT, 3);
	CONF("tabs:col.active", INT, 0xff32b4ff);
	CONF("tabs:col.urgent", INT, 0xffff4f4f);
	CONF("tabs:col.inactive", INT, 0x80808080);
	CONF("tabs:col.text.active", INT, 0xff000000);
	CONF("tabs:col.text.urgent", INT, 0xff000000);
	CONF("tabs:col.text.inactive", INT, 0xff000000);

	// autotiling
	CONF("autotile:enable", INT, 0);
	CONF("autotile:ephemeral_groups", INT, 1);
	CONF("autotile:trigger_height", INT, 0);
	CONF("autotile:trigger_width", INT, 0);
	CONF("autotile:workspaces", STRING, "all");

#undef CONF
[LOG] Creating the PluginSystem!
[LOG] Loading plugin /home/admin/programming/outfoxxed/hyprland/hy3/build/libhy3.so which is now present in config
[Detaching after vfork from child process 47858]
[Detaching after vfork from child process 47859]

Thread 1 "Hyprland" received signal SIGSEGV, Segmentation fault.
0x00007ffff74a3735 in Hyprlang::CConfigValue::setFrom(std::any) ()
   from /nix/store/wb4hl303qyd53anm1d0fp4h426l3gcl1-hyprlang-0.pre+date=2024-02-09_335d0c6/lib/libhyprlang.so.0
(gdb) bt
#0  0x00007ffff74a3735 in Hyprlang::CConfigValue::setFrom(std::any) ()
   from /nix/store/wb4hl303qyd53anm1d0fp4h426l3gcl1-hyprlang-0.pre+date=2024-02-09_335d0c6/lib/libhyprlang.so.0
#1  0x00007ffff74a3897 in Hyprlang::CConfigValue::CConfigValue(Hyprlang::CConfigValue const&) ()
   from /nix/store/wb4hl303qyd53anm1d0fp4h426l3gcl1-hyprlang-0.pre+date=2024-02-09_335d0c6/lib/libhyprlang.so.0
#2  0x00000000009c86c1 in CConfigManager::addPluginConfigVar(void*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, Hyprlang::CConfigValue const&) ()
#3  0x000000000103938f in addConfigValue ()
#4  0x00007fffd0f845da in pluginInit (handle=<optimized out>) at /nix/store/LBAMP822R4DMQ2F7VIZVSWBILK83AWSR-gcc-13.2.0/include/c++/13.2.0/bits/basic_string.tcc:238
#5  0x0000000001061dd8 in CPluginSystem::loadPlugin(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) ()
#6  0x00000000010656ed in CPluginSystem::updateConfigPlugins(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > const&, bool&) ()
#7  0x00000000009c79dc in CConfigManager::handlePluginLoads() ()
#8  0x00000000006dd303 in CCompositor::initManagers(eManagersInitStage) ()
#9  0x00000000006d34bc in CCompositor::initServer() ()
#10 0x0000000000e1dc79 in main ()

outfoxxed avatar Feb 11 '24 09:02 outfoxxed

There's still an issue in this branch with the config file reloading... @Vagahbond hinted at it earlier (the error not going away when fixing the config) and @ErrorNoInternet also encountered some weird behavior.

If I edit hyprland.conf & add some gibberish to a random word, no error appears & hyprctl reload returns ok like nothing's wrong.

hyprctl version: Hyprland, built from branch at commit d23884e8e70cb5825fef47bd1aa23563aae5095a

Haven't gotten to the bottom of it yet, just posting it here to make sure it doesn't get overlooked.

Jappie3 avatar Feb 11 '24 11:02 Jappie3

https://github.com/DreamMaoMao/hycov/blob/hyprlang/src/main.cpp

there are no any errors in build. but hyprland crashed when the plugin was loaded, and neither coredump nor the crash log had any useful information.Did I do something wrong?

DreamMaoMao avatar Feb 11 '24 14:02 DreamMaoMao

@outfoxxed wooops gimme sec

vaxerski avatar Feb 11 '24 14:02 vaxerski

@outfoxxed can you try https://github.com/hyprwm/hyprlang/commit/7c5f672b2fedafd29ea8227862a3b60b743080cf

@DreamMaoMao you too, this should fix stuff.

vaxerski avatar Feb 11 '24 15:02 vaxerski

@Jappie3 can't repro.

adding lines like:

cock
windowrule22222222222222222 = e
bindaaaaaaaaa = eee, e,ee,e ,ee,ee

all throw for me and go away when fixed.

Config?

vaxerski avatar Feb 11 '24 15:02 vaxerski

@vaxerski

hyprlandconfig.txt

Jappie3 avatar Feb 11 '24 15:02 Jappie3