Commit Graph

64 Commits

Author SHA1 Message Date
Vaxry 6d21014a50 core: fix no-pch build 2024-06-19 16:29:00 +02:00
Vaxry 8c64a4bad7
core: move to hyprutils for utils (#6385)
* core: move to hyprutils for utils

Nix: add hyprutils dep

* Meson: add hyprutils dep

* flake.lock: update

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-06-11 17:17:45 +02:00
Vaxry 1ed1ce9506
internal: new shared_ptr and weak_ptr implementation (#5883)
moves std::shared_ptrs to a new implementation

Advantages:
- you can dereference a weak_ptr directly. This will obviously segfault on a nullptr deref if it's expired.
   - this is useful to avoid the .lock() hell where we are 100% sure the pointer _should_ be valid. (and if it isn't, it should throw.)
- weak_ptrs are still valid while the SP is being destroyed.
   - reasoning: while an object (e.g. CWindow) is being destroyed, its `weak_ptr self` should be accessible (the sp is still alive, and so is CWindow), but it's not because by stl it's already expired (to prevent resurrection)
   - this impl solves it differently. w_p is expired, but can still be dereferenced and used. Creating `s_p`s is not possible anymore, though.
   - this is useful in destructors and callbacks.
2024-05-05 17:16:00 +01:00
Vaxry 62ae2b3f40
pluginAPI/hooks: Remove dependency on cc from the hooksystem (#5801)
* Remove dependency on cc from the hooksystem

* Nix: remove cc from wrapper

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-04-30 02:54:43 +01:00
Vaxry a5a6480917
core: Move /tmp/hypr to $XDG_RUNTIME_DIR/hypr (#5788)
Moves the directory containing sockets and logs.
Also restructures lockfiles a bit.

For consumers, check if `$XDG_RUNTIME_DIR/hypr` exists. If so, use it. If not, use the old `/tmp/hypr`.
2024-04-28 22:25:24 +01:00
Vaxry 95a5e75c26 hooksystem: check for existing random outdir 2024-04-28 21:20:10 +01:00
Vaxry b164e67d8b core: prefer mkdir over create_directory and permissions 2024-04-28 18:58:31 +01:00
Vaxry 28c8561924 hooksystem: use a random 700 directory for assembler 2024-04-28 18:28:19 +01:00
virchau13 90a53aed59
CrashReporter: fix deadlocks by making it mostly async-signal-safe (#5771)
`CrashReporter::createAndSaveCrash()` is not async-signal-safe,
resulting in random deadlocks/double-crashes during Hyprland crashes.
This changes the function to be (mostly) async-signal-safe.
2024-04-27 17:38:48 +01:00
Vaxry bca7804bb6
internal: Window storage rework - part 1 (#5762)
* Window storage rework - part 1

* format

* remove useless include

* fix pch

* format

* fix crash in dwindle

* fix vram leak

* prefer .expired() for bool checks
2024-04-27 12:43:12 +01:00
Vaxry dafc9ed4eb pluginsystem: fix unhooking on exit 2024-04-22 15:57:03 +01:00
Vaxry e91513a5e8 pluginapi: unregister callbacks on lost ptrs 2024-04-22 15:50:23 +01:00
Vaxry 450343b7b8 pluginsystem: unload entire plugin before calling dlclose()
fixes #5689
2024-04-22 15:46:43 +01:00
Vaxry 4ad739ec63 HookSystem: improve callback safety 2024-04-20 20:16:42 +01:00
Vaxry dab149e4a6 core: fix compile without pch
fixes #5445
2024-04-05 21:23:28 +01:00
Vaxry 965a2e5b21 hooksystem: attempt allocating pages in linear order 2024-04-05 17:16:09 +01:00
Martin Sundhaug 942172d2dc
hooksystem: Fix miscalculation in comment (#5442) 2024-04-05 12:56:53 +01:00
Vaxry 1ae592fcd9 hyprpm: add support for minimum versions 2024-04-05 00:46:37 +01:00
Vaxry 0569b9c300 hooksystem: manually map trampoline addresses
better patching of rip calls as we are close enough to just change them up
2024-04-04 18:50:37 +01:00
Vaxry 0a4ade01d3 format: make ci happy 2024-03-08 17:40:28 +00:00
Vaxry 13f6f0b923
Migrate the config to hyprlang (#4656)
* Migrate to hyprlang

* pop up errors

* fix swapped args

* Meson & Nix: build with hyprlang

* CI: add hyprlang to setup action

* add infra for plugin stuff

* fix hyprctl getoption

* fix hyprctl getoption with json

* format

* fix post parse logic

* fix autogen config

* oops missed exec-once

* fmt

* fix ws rules

* require 0.3.0 for hyprlang

* nix: flaek

* minor type fixes

* fix cfg usages in swipe

* use cvarlist for ws rules

* fix throw in addPluginConfigVar

* Nix: update hyprlang

* minor fixes

* fix disableLogs

* mention hyprlang docs

* bump hyprlang dep in cmake

* Meson: bump min hyprlang version

Nix: update hyprlang

* minor fix

* Nix: update meson patch

---------

Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2024-02-18 15:00:34 +00:00
Vaxry 60bda7ee3d pluginapi: allow registering hyprctl commands
closes #4616
2024-02-05 01:57:29 +00:00
Vaxry 939696f97e hyprctl: move to a class and unify commands 2024-02-05 01:56:49 +00:00
Vaxry 754eaf5b8b pluginapi: fix hooks with negative rip offsets
fixes #4484
2024-01-24 13:53:18 +00:00
Zach DeCook 1607e96704
HookSystem: rename PAGESIZE_VAR from PAGESIZE to avoid conflict (#4321) 2024-01-01 23:05:26 +01:00
Vaxry 6a93cee74e pluginapi: manually detect endbr64 opcodes in function hooks
ref #4277
2023-12-28 13:36:09 +01:00
Vaxry e75dafd8b2 pluginapi: better wording for plugin function hook errors 2023-12-27 19:27:15 +01:00
Vaxry b7e8110a30 pluginapi: log assembler return 2023-12-27 19:23:06 +01:00
Vaxry 7474c81958
pluginapi: Trampoline hooks %rip patching improvements (#4256)
---------

Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
2023-12-27 11:43:04 +01:00
Vaxry 9132660768 functionHooks: fix incorrect protlen calcs 2023-12-09 16:16:46 +00:00
François Conzelmann 4a42344e97
style/ci: apply clang-format and verify it in ci (#4039)
* style: apply clang-format

* ci: add new clang-format job to CI
2023-12-06 22:54:56 +00:00
Vaxry 99ca26d4eb hooksystem: fix missed log include 2023-11-26 18:33:53 +00:00
Vaxry 1778fb77e2 functionhooks: throw an exception on unsupported %rip usage
ref #2479, now will actually tell you what's wrong instead of crashing
2023-11-26 17:53:51 +00:00
Vaxry 395985f815 pluginmgr: fix double use of dlerror() 2023-11-17 22:24:52 +00:00
Vaxry 51282f964f plugins: make logging on error more verbose
ref #3874
2023-11-17 22:22:31 +00:00
Vaxry 9be6fbf5ea
decorations: Decoration Positioner (#3800) 2023-11-11 14:37:17 +00:00
Vaxry 935c90915a pluginapi: fixup get_hash functions 2023-10-29 21:21:54 +00:00
Vaxry af9440152e pluginapi: add a config keyword adding method 2023-10-29 16:59:50 +00:00
Vaxry a61eb7694d hooksystem: add callbackinfo struct and cancellable events 2023-10-21 14:52:43 +01:00
Philip Damianik 442209942f
cleanup: Replace find() with C++20 starts_with(), ends_with() and contains() (#3572)
* Replace find() with C++20 starts_with() and ends_with()

* Replace find() with C++20 contains()
2023-10-15 19:07:23 +01:00
memchr 43b39e0bc6
build: include version.h in PluginAPI.hpp (#3571) 2023-10-15 12:22:51 +01:00
Vaxry d5a572bd39
Plugin API: Add version query (#3545) 2023-10-14 18:47:43 +01:00
ItsDrike 1afb00a01b
pluginapi: remove starting newline in demangled func name (#3502) 2023-10-06 14:01:40 +01:00
Philip Damianik 8c83852704
internal: Remove all `.c_str()` calls when using `std::vformat` (#3198)
Signed-off-by: pdamianik <39028343+pdamianik@users.noreply.github.com>
2023-09-06 21:45:37 +02:00
Vaxry 61a71c65ac
internal: Formatter rework (#3186) 2023-09-06 12:51:36 +02:00
vaxerski 0c61a1530f plugins: fix config value usage in init 2023-07-10 14:13:23 +02:00
vaxerski 5ac625d7bd format: fix hooksystem 2023-06-16 18:45:14 +02:00
vaxerski eb1f832fce decos: recalc on add 2023-05-23 14:26:38 +02:00
outfoxxed 642030f959
Fix not finding function symbols for hooking (#2292)
Fixes no useful feedback about failing subcommand.
Fixes function hooks breaking when running under a path containing
spaces.

Replaced old usages with this function where possible.
Complex shell usages now use `execAndGetShell` which is equal to the
old function.
2023-05-16 23:39:14 +03:00
outfoxxed 3a631e40db
Declarative plugin management (#2180)
* Declarative plugin management

Allow declaring `plugin` entries in the hyprland configuration.

Plugins will be loaded if an entry is added and unloaded if that entry
is removed.

* Replace pointers with copying in updateconfigPlugins

* Include which plugin was declared twice in error
2023-05-01 15:10:53 +01:00