Compare commits

...

1014 Commits

Author SHA1 Message Date
xqso
5c8d675eed ci: correct tar command for xz compression & fix typos (#11213) 2025-07-25 17:19:23 +02:00
Vaxry
fd0c1f2ab4 keybinds: do not reset scroll timer on not passed
avoids endless lockups
2025-07-25 14:59:00 +02:00
Vaxry
31cc7f3b87 core: move workspace ptrs to weak (#11194)
Fixes some race conditions that come up in tests. We only clean up workspaces when we render a frame. With this, they are always cleared instantly.
2025-07-24 00:36:29 +02:00
mavonarx
ecc04e8ba7 drm: check syncobj timeline support before advertising protocol (#11117)
Prevents crashes on systems where DRM driver lacks syncobj timeline
support (e.g., Apple Silicon with Honeykrisp driver). Applications
like Zed and WezTerm would crash with 'Timeline failed importing'
when trying to use explicit sync.

Fixes #8158 #8803

---------

Co-authored-by: mvonarx <matthias.vonarx@sitrox.com>
2025-07-23 23:11:07 +02:00
Vaxry
c51c6e38ac tests: add a few more workspace tests 2025-07-23 20:41:38 +02:00
Florent Charpentier
55f2daa21e swipe: fix workspace swipe not rendering last frame if target ws is on edge (#11184)
Fix for a weird behaviour that happens when swipe is only valid in 1
direction (i.e. from ws 1)

When you start a swipe from the only direction possible, then swipe back
(without releasing), the last frame where the delta is reset to 0 was
not being rendered
2025-07-23 20:06:28 +02:00
Nikolaos Karaolidis
2d2a5bebff core: fix maxwidth resolution mode (#11183)
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-07-23 12:10:39 +02:00
Tom Englund
6ca7c14b58 CTM: check for finite value aswell (#11185)
checking for < 0.F will not catch NaN or inf values, use std::isfinite
aswell.
2025-07-23 12:09:19 +02:00
Vaxry
fdbbad04bb core: enter unsafe state on boot if there are no mons 2025-07-22 11:14:12 +02:00
Karun Sandhu
873914a2a6 CI/Nix: also check for qt version in update script 2025-07-22 09:56:43 +03:00
00-KAMIDUKI
50758505d5 example: make screen shader example compatible with glsl 300 (#10846) (#11132) 2025-07-21 21:05:47 +02:00
Vaxry
462729d865 protocols/subcompositor: fix subsurface sorting (#11136) 2025-07-20 19:42:40 +02:00
Thomas Müller
bf1602d9f9 renderer: implement wp-color-management-v1 transfer functions (#11084) 2025-07-20 18:20:27 +02:00
MightyPlaza
d4de69381e internal: set value and goal for window size and position on setGroupCurrent (#11120) 2025-07-20 17:00:17 +02:00
MirzaSamadAhmedBaig
503fc458d8 internal: replace unsafe strcpy with snprintf (#11128) 2025-07-20 15:31:53 +02:00
Vaxry
a3d59b525b systeminfo: print more render info 2025-07-20 14:51:17 +02:00
Mozzarella32
b7a91e02e9 renderer: Add cursor:invisible to allow to hide the cursor (#11058) 2025-07-20 12:40:21 +02:00
Vaxry
58b6eceb6d sessionlock: fix flipped if condition 2025-07-20 12:33:22 +02:00
Vaxry
91d8a629eb sessionlock: fix timer logic on unsafe state 2025-07-19 16:48:20 +02:00
Vaxry
8b38353012 eventloop: improve timer handling to avoid crashes
ref #11062
2025-07-19 16:47:14 +02:00
Vaxry
3b04131259 eventloop: avoid duplicate timers 2025-07-19 13:31:37 +02:00
Vaxry
d84699d8e5 opengl: detect android fence support and disable explicit if it's missing (#11077)
Checks for explicit sync support via the android fences, and falls back to implicit sync if it isn't
2025-07-19 12:38:41 +02:00
MrFantOlas
ae3cc48f22 protocols/gamma: support pipes (#11076)
Add support for pipes and potentially other valid file descriptors. Add check for more data on the socket than the required amount as per protocol.

---------

Co-authored-by: Alexandre Teixeira <alexandre.teixeira@etu.emse.fr>
2025-07-18 23:20:17 +02:00
Radovenchyk
4adf658907 README: add link to CI from badge (#11085) 2025-07-18 21:13:56 +03:00
Mike Will
260a13a12f snap: use window extents instead of border size (#11079)
* snap: use window extents instead of border size

`border_overlap` no longer does anything for window snapping, only monitor snapping.
2025-07-18 17:35:43 +02:00
vaxerski
088e8af955 [gha] Nix: update inputs 2025-07-18 10:11:00 +00:00
Vaxry
49abc193f7 framescheduler: check monitor validity in doLater 2025-07-18 12:09:43 +02:00
Vaxry
a05c797e4a compositor: properly set infinite region on null input
fixes #11065
2025-07-17 22:04:20 +02:00
Tom Englund
b46dc9ee0c framescheduler: dont if check deleted weakpointer (#11063)
if m_monitor is destroyed the doOnReadable will eventually hit UB on
destruction if checking a destroyed m_monitor. acctually use the
captured mon weak pointer.
2025-07-17 21:59:20 +02:00
aphelei
75c0675e14 config: add better zoomFactor default (#11060) 2025-07-17 18:37:11 +02:00
Vaxry
49d73d1893 config: default drag_lock to 0 2025-07-16 22:39:42 +02:00
boundlessvoid0
409b56f6a3 hyprctl: make animations print details about bezier curves (#10413) (#10871) 2025-07-16 21:35:15 +02:00
Vaxry
148718b3bc socket2: fixup invalid ws passed to openwindow
fixes #11044
2025-07-16 18:22:54 +02:00
Vaxry
5349667992 master: add ignoremaster to swapwithmaster
fixes #11042
2025-07-16 15:51:11 +02:00
Vaxry
c4a4c34156 version: bump to 0.50.0 2025-07-16 11:33:42 +02:00
Vaxry
d4fbedcd35 core: never use hw cursors when tearing 2025-07-16 11:33:40 +02:00
Vaxry
5bfe6dc703 config: disable hw on mgpu nvidia by default (#11018) 2025-07-16 11:02:20 +02:00
Mike Will
8453fbf4eb snap: fix border_overlap option for monitor snapping (#10987) 2025-07-15 22:24:40 +02:00
UjinT34
e15014e031 protocols/cm: Fix preferred image description (#11026) 2025-07-15 19:33:14 +02:00
UjinT34
bc764f7065 protocols: Remove incorrect CM proto debug check and fix preferred image description (#11023) 2025-07-14 22:54:43 +02:00
Maximilian Seidler
06fcdbd9c7 renderer: use makeUnique for session-lock render passes (#11019)
Fixup for a merge conflict introduced by #10865.
2025-07-14 15:48:50 +02:00
Maximilian Seidler
01971cb6c7 session-lock: don't render workspaces when locked (#10865)
Avoid rendering the workspace behind if we are locked
2025-07-14 13:13:54 +02:00
Vaxry
d0f58baf29 screencopy: ignore hidden windows in noscreenshare
fixes #11002
2025-07-12 18:22:47 +02:00
Vaxry
8bfff87833 debugOverlay: fix tick measurement 2025-07-12 18:19:59 +02:00
Vaxry
6821723b44 splashes: add zacoons' splash
winner of the 4th ricing comp
2025-07-11 23:47:48 +02:00
Tom Englund
e589adb00d config: remove render_ahead* config options
remove render_ahead* config options and descriptions. they are unusued.
2025-07-11 17:51:04 +02:00
Tom Englund
523eed048e xwl: dont mark the even source as readable
wl_event_source_check makes the event trigger until onx11event returns non
zero. but we arent removing the event source from the event loop so lets
not mark it at all and recieve spurious constant calls.
2025-07-11 17:51:04 +02:00
Tom Englund
e6bb809663 monintor: remove rathandler
is this even used? lets just remove it.
2025-07-11 17:51:04 +02:00
Tom Englund
b5433bb753 singlepixel: move to unique ptrs
less refcounting, move by rvalue.
2025-07-10 14:09:00 +02:00
Tom Englund
bcb96c5532 presentation: move to unique ptrs
less refcounting, move by rvalue.
2025-07-10 14:09:00 +02:00
Tom Englund
f22b5971d1 dmabuf: move to unique ptrs
less refcounting, move by rvalue.
2025-07-10 14:09:00 +02:00
Tom Englund
87653077f8 cursorshape: use unique ptrs
less refcounting.
2025-07-10 14:09:00 +02:00
Tom Englund
a21882be33 ctmcontrol: move to unique ptrs
less refcounting, move by rvalue.
2025-07-10 14:09:00 +02:00
Tom Englund
37be9a8959 alphamodifier: move to unique ptrs
less refcounting, move by rvalue.
2025-07-10 14:09:00 +02:00
Tom Englund
f5af40afce renderpass: use unique ptr instead of shared ptr
lets use unique ptrs instead of refcounting shared ptr when its not
needed, use rvalue reference to construct in vector directly.
2025-07-10 14:09:00 +02:00
Vaxry
6375e471f3 config: disable new_render_scheduling by default 2025-07-09 16:13:57 +02:00
Kamikadze
c6497a7193 internal: Prevent double-free in attemptDirectScanout (#10974) 2025-07-09 14:39:36 +02:00
FrancisTheCat
9517d0eaa4 renderer: Added a pointer position uniform to the screen shader. (#10821) 2025-07-08 19:31:15 +02:00
outfoxxed
78e9eddfb6 core: use new typed signals from hu (#10853) 2025-07-08 18:56:40 +02:00
Tom Englund
2f34ef141b compositor: fix race to finish on null buffer (#10970)
if a null buffer is commited and a pending state is awaiting, drop the
pending state so we dont end up in race to finish brokeness.
2025-07-08 18:55:46 +02:00
Vaxry
8f948827a6 Renderer: Implement new render scheduling (#10936)
Implements a new render scheduling method, where we triple buffer when necessary.

Enabled by default, improves FPS on underpowered devices.

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2025-07-08 12:41:10 +02:00
Tom Englund
9856563f89 opengl: avoid reallocations in EGLImage (#10960)
use a std::array instead of vector and avoid reallocations.
it should at most be 49 entries, so make the array 50. and RASSERT check
it incase more entries gets added in the future.
2025-07-07 23:44:35 +02:00
Tom Englund
bb958a9e13 pass: overload TexPass constructor
overload it with a rvalue to allow us to move the data directly avoiding
an extra copy. because SRenderData is not trivially copyable.
2025-07-07 18:09:34 +02:00
Tom Englund
c75f85098c renderer: move render calculation behind if case
the durationUs is not used unless debug overlay is enabled, lets not
calculate it each call to rendermonitor if not enabled. same with
renderStart.
2025-07-07 18:09:34 +02:00
Tom Englund
4a30e2acd9 eventloop: RAII the even source on readable fd
RAII remove the event source and honor rule by 5
2025-07-07 18:09:34 +02:00
Tom Englund
ceec1943ff compositor: dont send around int max values
we know the buffersize use it instead of int max values that can
potentially cause math issues and slowdowns. minor improvement to
glmark2 aswell.
2025-07-07 18:09:34 +02:00
jmanc3
83c453cb82 plugins: made currentWindow available in RENDER_PRE_WINDOW (#10957) 2025-07-07 18:06:42 +02:00
Tom Englund
54369adffa internal: iso C++ prohibits anonymous structs (#10955)
turn on -Wpedantic and name the anonymous struct.
2025-07-07 16:18:06 +02:00
vaxerski
d23ed852fc [gha] Nix: update inputs 2025-07-07 11:34:38 +00:00
Tom Englund
a16d0c76a6 texture: zero out the cached states in destroy (#10954)
if destroyTexture is called outside of the texture destructor we need to
empty out the cached states.
2025-07-07 13:33:22 +02:00
Mihai Fufezan
6a5f4f5954 Nix: fix overlay application
Should fix hyprwm/hyprland-plugins#412
2025-07-05 14:18:38 +03:00
MightyPlaza
b99c193e46 internal: handle setGroupCurrent properly on fs groups (#10920) 2025-07-05 00:16:25 +02:00
bobrat
9b51d73a1e hyprpm: print all dependencies that are missing (#10907) 2025-07-04 14:43:46 +02:00
Tiago Dinis
3c9447ca53 nix: update aquamarine 2025-07-04 01:33:31 +03:00
Mihai Fufezan
90c8609cbb CMake: disable tests by default (#10899) 2025-07-01 23:18:34 +02:00
Vaxry
b246f33ab1 inputmgr: remove unused var 2025-07-01 23:18:01 +02:00
aphelei
e9c5594186 renderer: add mouse zoom animations (#10882)
Adds animations for the mouse zoom effect.
2025-07-01 11:33:48 +02:00
Tom Englund
e827b75e22 opengl: add missing skipcm if case (#10888)
missing skipcm if case so the CM uniforms where never added on the
gradient2 renderBorder case, until the non gradient2 one had run atleast
once. causing it to not render on first launch/delayed.
2025-07-01 11:32:49 +02:00
Tom Englund
9adacef70b buffer: check if buffer fd already readable (#10894)
check if buffer fd is already readable, to avoid a lot of unnecessery
systemcalls and churn.
2025-07-01 11:32:17 +02:00
Tom Englund
f464dfbefa shader: replace texture2d with texture (#10893)
* shader: replace texture2d with texture

remove unused v_color and replace deprecated texture2d with texture.

* shader: use the more modern essl3 extension

GL_OES_EGL_image_external_essl3 provides support for samplerExternalOES
in texture function, aquamarine already use it. apply it here too.
2025-07-01 11:32:00 +02:00
Tom Englund
8c37d2ce25 sessionlock: restore cursor if hidden on unlock (#10889)
if session locks have hidden the cursor its gonna be missing unless a
new cursor shape is set, hovering windows makes us get one, moving the
wallpaper/desktop does not. set it again to left_ptr as is default on
compositor start.
2025-07-01 11:31:10 +02:00
Karun Sandhu
ee8978b961 flake.lock: update 2025-06-29 19:29:36 +03:00
Vaxry
ab900d8752 screencopy: fix improper box calculations for transforms (#10870) 2025-06-28 17:01:14 +02:00
Vaxry
0fea173fc8 unbind: add unbind all 2025-06-28 14:55:13 +02:00
Mihai Fufezan
a01d20cfe8 CI/Nix: fix rebase oopsie 2025-06-27 16:56:52 +03:00
Vaxry
e4b6fedfb9 tester: simplify adding test files 2025-06-27 12:18:45 +02:00
Vaxry
1fc7e80bdb README: update previews 2025-06-27 12:06:21 +02:00
Mike Will
b850b35778 snap: move gapOffset logic outside of for loop (#10861) 2025-06-27 12:01:45 +02:00
Mihai Fufezan
2796ec1cf2 CI/Nix: separate xdph from hl 2025-06-26 23:38:23 +03:00
Vaxry
3d6476c902 Core: Add a test suite (#9297)
Adds a test suite for testing hyprland's features with a runtime tester

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2025-06-26 19:43:39 +02:00
rafiq
9a67e0421b renderer: clamp rounding_power (#10816) 2025-06-26 19:26:46 +02:00
outfoxxed
3bbdf9dc5a protocols: add ext-workspace implementation (#10818) 2025-06-26 18:32:44 +02:00
sam
1f337a7a5e hyprctl: replace read-only strings with std::string_view (#10851) 2025-06-26 12:28:35 +02:00
UjinT34
452a158107 config: use parseScale for monitorv2 (#10852) 2025-06-26 12:28:21 +02:00
Tom Englund
f4f090e4b2 renderer: reduce a lot of glcalls and cache various states (#10757)
* opengl: cache viewport state

according to nvidia docs calling glViewPort unnecessarily on the same
already set viewport is wasteful and can cause state changes when not
needed. cache it in a struct and only call it when the viewport is
actually changing.

* opengl: cache glenable/gldisable state

avoid making multiple glenable/gldisable calls on already set caps, can
cause state changes and incur driver overhead.

* opengl: cache glscissor box

only call glscissor if the box actually has changed, try to avoid state
changes.

* opengl: cache gluniform calls

cache the gluniform calls, the uniform values are cached in driver per
program only the drawcalls setting the uniform yet again with the same
value on same location is causing more overhead then caching it ourself
and just no oping on it if no changes.

* shader: rewrite handling of uniforms and state

this is way faster as we don't need to mess with maps (hashing, etc) and instead can just use an array

* opengl: stuff and 300 shaders

* opengl: typo

* opengl: get the uniform locations properly

now that the legacy shaders are gone get the uniformlocations for
SKIP_CM etc, so they can be properly set and used depending on if
cm_enabled is set to false or true, before it was falling back to a
legacy shader that didnt even have those uniforms.

* opengl: check epsilon on float and remove extra glcall

seems an extra unset glcall was added, remove it. and check the float
epsilon on the glfloat.

* opengl: remove instanced shader draw

remove the instanced boolean from the vertex shader, might be neglible
differences, needs more benchmark/work to see if its even worth it.

* texture: cache texture paramaters

parameters where occasionally set twice or more on same texture, short
version wrap it and cache it. and move gpu churn to cpu churn.

add a bind/unbind to texture aswell.

* texture: use fast std::array caching

cache the texparameter values in fast array lookups
and incase we dont want it cached, apply it anyways.

* shader: fix typo and hdr typo

actually use Matrix4x2fv in the 4x2fv cache function, and send the
proper float array for hdr.

* texture: make caching not linear lookup

make caching of texture params not linear.

* minor style changes

* opengl: revert drawarrays

revert the mostly code style reduce loc change of drawarrays, and focus
on the caching. its a if else case going wrong here breaking
blur/contrast amongst others drawing.

---------

Co-authored-by: Vaxry <vaxry@vaxry.net>
2025-06-25 12:42:32 +02:00
Mihai Fufezan
5a348fb7df Nix: filter src using fileset
Allows reusing already-built derivation when changing files outside the
ones defined in the fileset.
2025-06-24 21:39:42 +03:00
Vaxry
aea8132001 buffer: don't use crazy listener::emit() 2025-06-24 15:23:53 +02:00
UjinT34
cf7e3aa448 renderer/cm: Add automatic hdr (#9785) 2025-06-23 14:33:09 +02:00
Vaxry
c7c8ca475b config: add missing description for enforce_permissions 2025-06-23 13:56:02 +02:00
Vaxry
24e5f9974d hyprctl: print no open windows instead of invalid request on empty clients 2025-06-23 13:49:30 +02:00
Vaxry
dd33128c2f input: fix mouseDown triggering hl ops on locked (#10809) 2025-06-22 12:49:13 +02:00
zacoons
8b1d5560cf renderer: add wrapping options to renderTextureWithBlur method (#10807) 2025-06-21 19:03:28 +02:00
vaxerski
2388874738 [gha] Nix: update inputs 2025-06-21 14:22:28 +00:00
Vladimir-csp
4be32dbff4 xwayland: Don't leave shell process (#10802) 2025-06-21 16:21:08 +02:00
fufexan
8ebff1948f [gha] build man pages 2025-06-19 22:49:42 +00:00
Mihai Fufezan
a301d54df8 treewide: hyprland.org -> hypr.land 2025-06-20 01:49:20 +03:00
Mihai Fufezan
ff2f85641a CI/Nix: add cache-nix-action
Use nixbuild/nix-quick-install-action which pairs well with
nix-community/cache-nix-action.

Should help with build times by reducing the number of packages needing
to be re-downloaded on each run.

Parameters are taken from https://github.com/nix-community/cache-nix-action
and may be tweaked later.
2025-06-20 01:37:59 +03:00
Jasson
b49d0ca20e xwayland: Fix crash when copying from wayland to xwayland (#10786) 2025-06-19 19:44:38 +02:00
Vaxry
86b5e3bfbc config: nuke explicit_sync settings
were not used anymore, explicit is on by default
2025-06-19 14:58:03 +02:00
Vaxry
54ccf9c6b3 renderer: make lock fail textures dynamically loaded
this should reduce idle vram usage by a whopping 16MB, but also might fix the tty unknown issue.
2025-06-19 13:46:42 +02:00
Vaxry
e999ad664d hookSystem: avoid using manual mem management, fix leak
fixes #10790
2025-06-19 11:58:12 +02:00
7mile
9fb6b5d96b input: Fix incorrect localcoords with a surface above an XWayland window (#10773) 2025-06-18 22:48:51 +02:00
Vaxry
0fb63c68e9 permissions: properly print config requests for plugins 2025-06-18 22:43:04 +02:00
Vaxry
83a4c61048 plugins: don't update config plugins on state unchanged
fixes #10781
2025-06-18 22:42:57 +02:00
Jasson
bef1321f00 xwayland: fix minor errors in previous refactor (#10763) 2025-06-18 10:16:22 +02:00
Jacob Ilias Komissar
0ece4af36a grpupbar: Add config options to color inactive and locked groupbar titles (#10667) 2025-06-16 22:40:38 +02:00
Vaxry
aba2cfe7a8 asyncDialogBox: lock box in fdWrite to prevent a uaf (#10759) 2025-06-16 17:02:08 +02:00
Vaxry
d4e8a44087 windowrules/move: clamp max pos in onscreen to avoid assert crash
fixes #10760
2025-06-16 13:43:06 +02:00
Jasson
1905c41c65 xwayland: Use RAII instead or freeing memory manually (#10677)
As suggested by clang-tidy
2025-06-16 13:31:46 +02:00
UjinT34
bd5703d5c6 protocols/cm: fix wp invalid luminance check (#10752) 2025-06-15 23:13:57 +02:00
Vaxry
d037c54260 protocols: support xdg-shell v7
there's nothing special we need to add for this rev
2025-06-15 12:21:16 +02:00
UjinT34
c3894d9288 config/monitor: Add monitor v2 HDR rules (#10623) 2025-06-15 12:15:18 +02:00
Vaxry
3db3baa19e opengl: use a stack for storing monitor transform enabled
fixes #10487
2025-06-15 12:11:28 +02:00
Vaxry
57d20a1bf6 internal: clean up dead snapshot code 2025-06-15 11:51:27 +02:00
Vaxry
472b52bc06 cursor: reset hc data after theme change
theme change invalidates the cairo surfaces there

fixes #10636
2025-06-15 11:47:10 +02:00
vaxerski
79b9edb85b [gha] Nix: update inputs 2025-06-15 09:46:31 +00:00
may
f08167c877 input: add sticky option for drag_lock (#10702)
* allow configuring the sticky option for `drag_lock`

* enable sticky drag_lock by default as recommended by libinput

recommended here:
https://lists.freedesktop.org/archives/wayland-devel/2024-November/043860.html
2025-06-15 11:45:06 +02:00
Joel-Valenciano
ad85406220 drm-lease: Add Multi-GPU Support (#10099) 2025-06-13 15:17:32 +02:00
Otto Modinos
d14f81e6ac protocols: whitelist wp_color_manager_v1 for security_context (#10723)
Now that `wine` (and `proton`) supports Wayland it makes sense to allow the `wp_color_manager_v1` in Flatpak for native HDR without the need for `gamescope`!
2025-06-13 00:27:30 +02:00
linfindel
826061d166 README: Update image cdn (#10722) 2025-06-12 23:22:52 +02:00
Vaxry
748419faa5 hyprpm: check version and update automatically on add (#10706)
ideally should let the user know, but jic also checks for header updates
2025-06-12 13:40:55 +02:00
Vaxry
412c7dc7f7 renderer: fixup some missing fadeout cases with special
fixes some fadeout missing cases:

- closing last window
- closing above fs
- closing in general

fixes #10283
2025-06-11 17:52:23 +02:00
Vaxry
8329de1ab5 input: grab the correct active workspace on mouseMove
fixes #10651
2025-06-11 17:09:39 +02:00
Vaxry
144885d89f anr: make dialog disappear if the app dies
fixes #10514
2025-06-11 17:00:16 +02:00
Vaxry
f7526d6be0 renderer: refuse rendering invalid resolutions
sometimes a driver fails to assign any reasonable mode in which case we might render 0x0 which will make us crash. Don't do that. Part 1 of #10678
2025-06-11 16:57:07 +02:00
Vaxry
6910ca76bd protocols/subcompositor: fixup place_above and _below
fixes #10716
2025-06-11 16:54:47 +02:00
Viktor
6bdb1f413e dwindle: add the ability to specify an aspect ratio for a singular window (#10650) 2025-06-10 08:20:31 +01:00
ilusha420
81468253ea hyprpm: fix typo in help message (#10687) 2025-06-09 14:31:04 +03:00
Luuk Blankenstijn
231e01e39b hyprctl: don't detect a negative value as a parameter (#10671) 2025-06-08 20:17:38 +01:00
Kamikadze
c6f713fefe screencopy: fix incorrect noscreenshare positions with monitor scaling (#10674) 2025-06-08 08:19:23 +01:00
Kamikadze
91967f8ec0 renderer: fix incorrect cursor position when screencopy region with monitor scaling (#10675) 2025-06-08 08:18:42 +01:00
Kamikadze
0a47575c7f internal: Use using instead of #define to alias smart pointers (#10673) 2025-06-08 08:13:56 +01:00
vaxerski
8801770981 [gha] Nix: update inputs 2025-06-07 20:14:08 +00:00
Kamikadze
66b99bd277 monitor: ensure autoDir is applied when changed (#10672) 2025-06-07 21:12:43 +01:00
sam
2794f485cb hyprctl: Remove exceptions, use modern error handling (#10664) 2025-06-06 20:23:33 +01:00
Ufuk Ustali
0ac3bef724 input: support configuring drag_3fg from libinput (#10631) 2025-06-06 15:47:15 +01:00
vaxerski
456c820d52 assets: update header 2025-06-06 15:14:17 +02:00
UjinT34
c35c2fea40 config: Restore auto-center-* for monitors (#10660) 2025-06-06 08:01:19 +01:00
Friday
d6fbd89336 nix: use gcc15-built dependencies 2025-06-06 08:07:34 +03:00
XPhyro
fb7548cb41 screencopy: fix applying noscreenshare to invisible special workspaces (#10628) 2025-06-05 21:29:01 +01:00
Eric Li
423b69f5d3 config: add group: selector (#10588) 2025-06-05 21:17:04 +01:00
UjinT34
abdfc5ea40 config: add a new monitor v2 config syntax (#9761) 2025-06-05 15:56:46 +01:00
sam
59c886d855 internal: Catch filesystem exceptions while iterating RunTimeDir (#10648) 2025-06-05 15:19:54 +01:00
Jasson
d7a87ce6e2 xwayland: fix xwayland -> wayland clipboard (#10646) 2025-06-04 16:00:55 +01:00
vaxerski
d9f7448d82 xwayland: pad pid with leading zeroes in lockfile
fixes #10652
2025-06-04 16:54:12 +02:00
littleblack111
b5c0d0b8aa keybinds: add an option to respect gaps out for floating to movewindow (#9360) 2025-06-03 19:48:56 +01:00
sam
b1d0a727cc internal: Center window on parent if available (#10582)
Fixes #10537
2025-06-02 19:22:51 +01:00
Kamikadze
ef2c73af80 internal: embed example config (#10608) 2025-06-02 18:36:44 +01:00
Kamikadze
16c62a6dbb internal: Fix HyprError not displaying at startup (#10606) 2025-06-01 21:03:53 +01:00
Jasson
2d1c6f88d2 xwm: Refactored functions in XWM.cpp (#10569)
* Refactored SXSelection::onSelection in XWM.cpp

- Made the function more readable and less redundant
- Extracted repeated conditions into booleans.
- Reduced nested conditionals
- Reused (conn) pointer

* Refectd readProp

* Refactor initSelection
2025-06-01 21:02:17 +01:00
vaxerski
82b8549542 hyprpm: refuse adding a new repo without update 2025-06-01 21:53:30 +02:00
Kamikadze
69c2b2926e internal: refactor to use empty() (#10599) 2025-05-31 19:49:50 +01:00
Kamikadze
4078e1d17c refactor: replace all typedef with using (#10594) 2025-05-31 14:02:02 +01:00
mitsuru
af2fdb5d58 nix: use gcc15
resolves Nix build/CI failures introduced in 9190443
bumps flake.lock as gcc15Stdenv wasn't available at the pinned version
of nixpkgs
2025-05-31 01:45:34 +03:00
Kamikadze
9190443d95 refactor: use std::ranges whenever possible (#10584) 2025-05-30 14:25:59 +01:00
littleblack111
9bf1b49144 snap: add option to respect gaps (#10524) 2025-05-28 14:20:03 +01:00
vaxerski
5cc6cb4945 groupbar: force recalc on visibility changes
fixes #10566
2025-05-28 15:18:30 +02:00
vaxerski
9b327ddfd1 monitor: mark 0, 0 presentation timestamps as invalid
fixes #10562
2025-05-27 21:26:47 +02:00
Kamikadze
24915a3a9b windowrules: Add noscreenshare (#10482) 2025-05-27 16:10:22 +01:00
Nikolaos Karaolidis
90d0b8ecae core: add auto-center arrangements (#10527)
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-05-27 15:51:59 +01:00
littleblack111
ddb9f8394d config: fix inconsistant hint of default value (#10556)
similar to https://github.com/hyprwm/hyprland-wiki/pull/1093
2025-05-27 15:50:00 +01:00
littleblack111
a62ccb169a config: fix crash on misnamed variable (#10549) 2025-05-27 08:33:17 +01:00
Vaxry
be6ee6e55f cmake: disable gprof by default 2025-05-26 23:33:44 +02:00
Nikolaos Karaolidis
c2805aad92 config: add maxwidth monitor resolution mode (#10528)
Signed-off-by: Nikolaos Karaolidis <nick@karaolidis.com>
2025-05-26 19:25:58 +02:00
littleblack111
4c4c9bb324 dwindle: add better automatic window drag and drop direction detection (#9704) 2025-05-26 19:15:11 +02:00
Vaxry
292a7456af eventLoop: fixup headers 2025-05-26 16:53:35 +02:00
Vaxry
2347050285 pass/surface: make sure popup blurs are marked for require live blur
fixes #10535
2025-05-25 18:48:32 +02:00
Vaxry
a58ab20e8b debug/pass: show live/precompile blur in debug 2025-05-25 18:45:28 +02:00
Vladimir-csp
cc0792c1dc hyprland-uwsm.desktop: Add TryExec
This should hide this entry when uwsm is missing (at least in DMs that handle TryExec)
2025-05-25 14:55:33 +03:00
vaxerski
28c9122adb [gha] Nix: update inputs 2025-05-24 18:41:03 +00:00
Vaxry
55076edaac versionkeeper: don't pop up on initial launch 2025-05-24 20:39:36 +02:00
Virt
81cd526f92 cursor: fix screencopy cursor pos and duplicate shape with sw cursors (#10519)
* cursor: account for hotspot with overridePos

* cursor: don't draw cursor on screencopy if using sw anyways
2025-05-23 23:41:35 +02:00
Mihai Fufezan
bd4733a0ff flake.lock: update
nix/overlays: remove wayland-protocols overlay. PR landed in master a while ago
2025-05-22 18:02:20 +03:00
nezu
4f161da3d6 hyprpm: ignore pins when adding a package with a git rev (#10502)
ref #10436
2025-05-22 13:54:02 +02:00
darkwater
185c96849e input: unhide cursor on tablet events after touch events (#10484) 2025-05-21 23:44:21 +02:00
zacoons
b90910c0dc renderer: add wrapping options to renderTexture method (#10497) 2025-05-21 16:41:40 +01:00
Vaxry
eb3b38d40b eventLoop: fixup event source callbacks 2025-05-19 01:27:30 +02:00
Vaxry
d9c8a37811 input: always allow focus to permission popups 2025-05-18 19:34:20 +02:00
Vaxry
158c0f2911 permissions: add permission management for keyboards (#10367) 2025-05-18 19:13:20 +02:00
zacoons
44cb8f769e internal: added error log when getEdgeDefinedPoint is impossible (#10462) 2025-05-18 19:10:06 +02:00
Vaxry
705b97c4ac input: revert #10416 and #10418
fixes #10451
2025-05-17 19:43:12 +02:00
Vaxry
c19f383685 hyprpm: fix crash with enable without an arg 2025-05-17 19:07:18 +02:00
Vaxry
bb5cd5b2dd screencopy: store a fb before permission popup if the permission is pending (#10455)
stops rendering the permission popup on stuff like grim when it asks
2025-05-17 19:03:35 +02:00
Vaxry
bb9aa79b21 hyprpm: reject remove without a param
ref #10458
2025-05-17 18:10:35 +02:00
Vaxry
dfa4836216 hyprpm: fix execute permission bit on installed dirs (#10435) 2025-05-17 18:08:42 +02:00
vaxerski
18377d221d [gha] Nix: update inputs 2025-05-17 11:08:13 +00:00
outfoxxed
2aa21625bd input: ensure seat grabs from exclusive layers can be dismissed (#10418) 2025-05-17 13:06:48 +02:00
outfoxxed
2946009006 input: do not send mouse events when outside of a surface (#10416) 2025-05-16 23:39:28 +02:00
outfoxxed
b0cc49218d protocols: simulate mouse movement after activating a toplevel (#10429) 2025-05-16 23:38:45 +02:00
Zach DeCook
a5c9b3e490 core: Include cstring whenever strncpy is used (#10404)
Fixes ppc64le build in alpine
2025-05-15 10:31:44 +01:00
outfoxxed
dfb841c303 desktop: prevent layers from dismissing their own seat grabs on map (#10417) 2025-05-15 10:16:03 +01:00
Tom Englund
5ceb0ec15d core: drop the legacy renderer (#10408)
* core: drop the legacy renderer

the legacy renderer is broken and barely used, drop it.

* Nix: drop support for legacyRenderer

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2025-05-15 10:13:24 +01:00
outfoxxed
f707d86912 protocols/hyprland-surface: account for scaled monitor positions (#10415) 2025-05-15 10:12:55 +01:00
Yukari Chiba
75f2cb5f65 xwayland: do not include xcb.h when xwayland is disabled (#10407)
xcb.h should not be included when xwayland is disabled. 
This allows hyprland to not use X11 libraries at all when xwayland is disabled.
2025-05-14 19:31:19 +01:00
Vaxry
a51e639d81 input: disallow virtual keyboards from changing LED state (#10402) 2025-05-14 17:48:17 +01:00
Tom Englund
59b2340680 opengl: add missing vao for screenshader (#10397)
missed creating vertex array objects in 04124988e8
add it.
2025-05-13 23:46:29 +01:00
outfoxxed
da3583fd5e opengl: publicize shader creation/usage functions (#10378)
Allows plugins to create and use shaders again
2025-05-12 14:15:47 +02:00
Tom Englund
04124988e8 opengl: optimize shaders and reduce unneeded drawcalls (#10364)
* opengl: remove unnecessery glflush calls

glflushing forces the driver to break batching and issue commands
prematurely and prevents optimisations like command reordering and
merging.

many glFunctions already internally glflushes and eglsync creation still
has a glflush at end render. so lets reduce the overhead of these calls.

* opengl: reduce glUseProgram calls

apitrace shows cases where the same program gets called multiple times,
add a helper function that keeps track of current program and only call
it once on same program. reduces slight overhead.

* opengl: use more efficient vertex array object

use a more modern vertex array object approach with the shaders, makes
it a onetime setup on shader creation instead of once per drawcall, also
should make the driver not have to revalidate the vertex format on each
call.
2025-05-11 18:36:20 +02:00
Vaxry
390a357859 renderer: use alpha for the lockttytext texture
ref #10348
2025-05-11 13:15:03 +01:00
Vaxry
9a87498bb1 renderer: minor damage fixes 2025-05-10 23:53:05 +01:00
Vaxry
f58bb72d3a renderer: render blur on fade out (#10356) 2025-05-10 19:31:26 +02:00
vaxerski
60cd5b7a48 renderer: always render snapshots as 8bit
fixes issues with transparent windows on 10b
2025-05-09 22:16:21 +01:00
Florian "sp1rit
25cf06f6cf build: require hyprgraphics>=0.1.3 (#10350)
49974d5 introduced use of types, which were only added in 0.1.3
2025-05-09 14:47:28 +02:00
Jan Beich
e44aae0c20 hyprpm: switch to numeric owner/group after f8bbe5124c (#10345)
On BSDs "root" is in "wheel" group. Instead of enumerating platforms
or probing "wheel" explicitly use numeric value for the superuser.

$ truss hyprpm add <url>
[...]
read(5,"install: unknown group root\n",1023)     = 28 (0x1c)
[...]
[ERR] ✖ Failed to write plugin state
2025-05-09 14:18:15 +02:00
Jan Beich
fcb6f936ea hyprpm: add missing include for libc++ after 1c530cbc66 (#10344)
hyprpm/src/helpers/Sys.cpp:24:24: error: implicit instantiation of undefined temp
late 'std::basic_ostringstream<char>'
   24 |     std::ostringstream oss;
      |                        ^
/usr/include/c++/v1/__fwd/sstream.h:27:28: note: template is declared here
   27 | class _LIBCPP_TEMPLATE_VIS basic_ostringstream;
      |                            ^
2025-05-09 03:42:19 +02:00
Vaxry
9958d29764 version: bump to 0.49.0 2025-05-08 21:15:18 +01:00
Vaxry
239cdd67fd socket2: fix order of window events on map (#10341) 2025-05-08 22:10:31 +02:00
s1dd
f01e3043b8 desktop: cleanup code and use std::ranges (#10289) 2025-05-08 21:01:49 +02:00
Vaxry
04c98abd1f layout: properly assign workspace and monitor when moving a child to the parent (#10338) 2025-05-08 21:00:28 +02:00
nyx
53bfb92d65 layout: allow interacting with pinned windows when fullscreened (#10326)
* layout: allow interacting with pinned windows when fullscreened

* IHyprLayout: format code

* e
2025-05-08 20:59:51 +02:00
Mihai Fufezan
2b3cac018e flake.lock: update 2025-05-08 20:37:36 +03:00
Vaxry
f909b0f114 opengl: fix legacyrenderer 2025-05-08 18:22:44 +01:00
MightyPlaza
fa1e343b04 compositor: set fullscreenstate on movetoworkspace (#10303)
modified:   src/managers/KeybindManager.cpp
2025-05-08 18:29:47 +02:00
davc0n
22b12e3013 refactor: cshader class to sshader struct (#10324) 2025-05-08 00:07:35 +02:00
Mihai Fufezan
7a971735af flake.lock: update 2025-05-07 21:51:59 +03:00
Tom Englund
6abb5b0c7e renderer: precompute fullalpha (#10319)
precompute it once instead of calculating it every single call, was showing
up as a lot of time wasted in profiling.
2025-05-07 19:02:07 +02:00
Tom Englund
0dfcba9825 DMABuffer: reserve vector and avoid UB (#10317)
actually reserve the vector instead of initializing it with the
m_attrs.fd.size() adding 4 invalid fd entries, and later emplace_back
the valid ones.

sync_merge_data name is defined as char name[32] a fixed size array, and
c++ technically doesnt allow assigning string literals directly to array
fields in aggregate initializers, it may compile but is technically
undefined behaviour or ill formed. zero initalise it and use
std::ranges::copy_n instead.
2025-05-07 18:15:27 +02:00
davc0n
e5df8cdc62 xwayland: refactor class member vars (#10312)
* xwayland: refactor class member vars

* xwayland: fix pure wayland build
2025-05-07 15:21:44 +02:00
Vaxry
f8bbe5124c hyprpm: clean up root access and properly check input (#10304)
* manifest: reject bad names from parsing

* sys: restructure root functions
2025-05-06 22:43:08 +02:00
Vaxry
948277895e popup: damage old size on unmap as well as new (#10306)
fixes #10305

chromium for some reason sets the popup size to like 8x8 at the same time as unmapping
2025-05-06 21:49:20 +02:00
Zebra2711
708a7c24ef hyprpm: add missing return (#10299)
Add a missing return statement after handling the first superuser binary in the `dropSudo` function

Fixes: 1c530cb

Co-authored-by: Zebra2711 <zebra2711@users.noreply.github.com>
2025-05-06 14:53:28 +02:00
CyrenArkade
1ce614dfc0 animations: Add option for animating workspaces as if the first and last were adjacent (#10277)
* add option for animating workspaces as if the first and last were adjacent

* change wraparound detection to use IDs instead of dispatcher

* move shouldWraparound from MiscFunctions to Monitor
2025-05-06 03:54:27 +02:00
Jack Barnes
930eeac900 window: use stored size for new floating window when persistentsize is set (#10212)
* fix(window): use stored size for new floating window when persistentsize is set. fix hyprwm#9422.

* fix: replace `std::any_of` with `std::ranges:any_of`

* fix: use initialClass and initialTitle when storing sizes on close

* fix: add `xdgTag` as a new indicator

* fix: no {}

* fix: format with clang-format
2025-05-06 03:53:43 +02:00
shane blackthorne
ec93f8a1cd socket2: add monitorremovedv2 event (#10229) 2025-05-06 03:52:36 +02:00
davc0n
997fefbc11 render: refactor class member vars (#10292)
* render: refactor class member vars

* render: fix clang format
2025-05-05 23:44:49 +02:00
Vaxry
c7eb141098 renderer: always try to apply a mode if pixel size is invalid (#10291) 2025-05-05 23:40:37 +02:00
Vaxry
1f50cdfa8b hyprpm: wrap sudo cmd in quotes
ref #10288
2025-05-05 13:09:00 +01:00
s1dd
1c530cbc66 hyprpm: Minor optimizations and refactor of helpers and progress bar (#10246)
* hyprpm: optimize sys.cpp

* hyprpm: refine progress bar logic

* chore: fix fetchSuperuserBins

* chore: modify one line if/else statements

* chore: fix if/else statements

* chore: follow naming convention for const vars

* chore: revert shell escape logic
2025-05-05 04:22:22 +02:00
davc0n
9cd5b25745 protocols: refactor class member vars (u-z) (#10282)
* protocols: refactor class member vars (u-z)

* protocols: fix clang format
2025-05-04 23:39:00 +02:00
phonetic112
78ff20ddf0 workspaces: Fix empty flag not selecting active workspace (#10237) 2025-05-04 19:22:41 +02:00
davc0n
2626f89ea6 protocols: refactor class member vars (n-t) (#10273) 2025-05-04 19:21:36 +02:00
davc0n
adbae0f74d protocols: refactor class member vars (a-m) (#10265) 2025-05-04 00:13:29 +02:00
davc0n
46ac115bd1 protocols: refactor class member vars (types) (#10261) 2025-05-03 18:54:50 +02:00
Honkazel
3465efcdc1 internal: Use vecnotinrect instead of !vecinrect (#10262)
* monitor: use vecnotinrect

* inputmanager: vecnotinrect

* clang format
2025-05-03 18:54:15 +02:00
Virt
cdf5736f1a layerrules: fix abovelock interactivity for touch input (#10253) 2025-05-03 16:07:02 +02:00
davc0n
2d6ca96e07 plugins: refactor class member vars (#10257) 2025-05-03 16:06:24 +02:00
davc0n
d9cad5e1b6 protocols: refactor class member vars (core) (#10259) 2025-05-03 16:02:49 +02:00
Vaxry
0c736217a7 configmgr: fix CConfigValue<> from plugins 2025-05-02 17:53:55 +01:00
Vaxry
77ecf09506 internal: fix name confusion in SAlphaValue
fixes #10251
2025-05-02 16:29:15 +01:00
vaxerski
f1ac1847ff [gha] Nix: update inputs 2025-05-02 15:08:46 +00:00
davc0n
ce821294e2 managers: refactor class member vars (#10242) 2025-05-02 17:07:20 +02:00
Vaxry
6f174a9e08 renderer: render fading out floating windows over fs 2025-05-02 00:16:17 +01:00
davc0n
5b3e489108 inputs: refactor class member vars (#10230) 2025-05-01 23:57:11 +02:00
Jan Beich
2670b8f772 hyprpm: add missing include for libc++ after 858c0e26d1 (#10234)
hyprpm/src/core/DataState.cpp:80:23: error: implicit instantiation of undefined template 'std::basic_stringstream<char>'
   80 |     std::stringstream ss;
      |                       ^
hyprpm/src/core/DataState.cpp:149:23: error: implicit instantiation of undefined template 'std::basic_stringstream<char>'
  149 |     std::stringstream ss;
      |                       ^
hyprpm/src/core/DataState.cpp:229:31: error: implicit instantiation of undefined template 'std::basic_stringstream<char>'
  229 |             std::stringstream ss;
      |                               ^
/usr/include/c++/v1/__fwd/sstream.h:30:28: note: template is declared here
   30 | class _LIBCPP_TEMPLATE_VIS basic_stringstream;
      |                            ^
2025-05-01 20:48:13 +02:00
Vaxry
858c0e26d1 hyprpm: move to system directories for storing plugins (#10211) 2025-05-01 18:00:26 +02:00
Zetta1 Reid0
b5ef049ea1 master: Change center_master_slaves_on_right to center_master_fallback (#10201)
* Change center_master_slaves_on_right  to center_master_fallback
2025-05-01 13:29:06 +02:00
davc0n
615e0dae46 layouts: refactor class member vars (#10228) 2025-05-01 13:27:07 +02:00
davc0n
ce4766772d hyprerror: refactor class member vars (#10227) 2025-05-01 13:26:43 +02:00
Vaxry
8d6618104e cmake: ignore Wclobbered
fails build otherwise
2025-04-30 23:06:40 +01:00
davc0n
50e1bec85f helpers: refactor class member vars (#10218) 2025-04-30 23:45:20 +02:00
Vaxry
b8a204c21d ci: minor fixes to glaze 2025-04-30 22:43:37 +01:00
Ikalco
2ee5118d7a render: properly release rendered buffers (#9807)
* cleanup eglSync

* properly release buffers in renderer

* add renderingDoneCallback and use it in screencopy

* use static constructor for CEGLSync
2025-04-30 18:35:25 +02:00
Vaxry
5d005f11fa xdg-bell: fix wrong resource cast 2025-04-30 14:07:23 +01:00
Vaxry
54c89104de DonationNag: ask after each major update (#10213)
This changes how the donation nag timing works.

The donation nag will now appear:

- after a major update (e.g. 48 -> 49)*
- once in late july
- once in december

however, a donation nag will never pop up more than once a month. So, if there is an update on the 26th of November, and you get a popup on the 28th, you will not get one in december.

This is of course still disableable in your config.
2025-04-30 14:47:35 +02:00
Mihai Fufezan
b2ad21a65c flake.lock: update 2025-04-30 09:26:58 +03:00
Vaxry
72cb5d24b6 permissions: disable automatic reloading of permissions from cfg
security reasons, avoid reading them live. Ideally we'd lock them behind sudo, but we can't do that.
2025-04-30 00:35:32 +01:00
Vaxry
9868b18378 input: don't use pointer hold logic for unmapped surfs
fixes #10215
2025-04-30 00:31:21 +01:00
Sander
208f4c48db config: use natural increase and decrease of brightness for default cfg (#10210)
* feat(config): hyprland natural brightness

* feat(config): natural increase and decrease of brightness
2025-04-30 01:10:47 +02:00
Vaxry
4506871310 xdg-bell: avoid crashes on null toplevel 2025-04-30 00:10:07 +01:00
Vaxry
6483f4ec22 screencopy: don't render cursor when frame doesn't want it 2025-04-29 22:02:55 +01:00
UjinT34
ae1fe860ff renderer: add render:send_content_type setting (#9851) 2025-04-29 22:09:14 +02:00
UjinT34
49974d5e34 cm: Use precomputed primaries conversion (#9814) 2025-04-29 21:29:40 +02:00
Vaxry
94bc132084 xdg-bell/xdg-tag: fix moved resource usage 2025-04-29 19:49:13 +01:00
davc0n
e9c3fcbb64 devices: refactor class member vars (#10206) 2025-04-29 19:51:07 +02:00
Vaxry
40147d3a3f asyncdialogbox: fix missing header 2025-04-29 18:37:21 +01:00
Vaxry
23ecce0e7a protocols: add support for xdg-system-bell-v1 2025-04-29 18:32:21 +01:00
Vaxry
465e3d979d window: make AsyncDialogBoxes not closeable
we don't want the user to accidentally close a popup for permissions or ANR. They can dismiss them by clicking an appropriate option.
2025-04-29 18:20:06 +01:00
Vaxry
b10a43dabc windowrules: add noclosefor
fixes #10027
2025-04-29 18:14:02 +01:00
Vaxry
5bd7ff884d permissions: add perms for plugin loading (#10184)
Adds permission management for loading plugins

---------

Co-authored-by: Jan Beich <jbeich@FreeBSD.org>
2025-04-29 18:59:43 +02:00
davc0n
2118440488 windows: refactor class member vars (#10168) 2025-04-28 22:25:22 +02:00
Vaxry
c505eb55ff screencopy: support hw cursors while sharing with cursor 2025-04-28 20:18:02 +01:00
Vaxry
f5c5cfa960 keybindmgr: fixup bindn regression
fixes #10195
2025-04-28 00:18:51 +01:00
Vaxry
0302bfdc22 async: add Promise and use it for AsyncDialogBox 2025-04-27 13:28:06 +01:00
Vaxry
4f868a1f3c SECURITY: init security policy
fixes #9921
2025-04-27 00:07:00 +02:00
nyx
94c55fe909 helpers: properly support next/prev for workspace switching (#10074) 2025-04-26 23:52:07 +02:00
Vaxry
742bce016c decorationPositioner: update posinfo on window update
fixes #10175
2025-04-25 16:09:11 +01:00
Virt
4cf62c114e layerrules: add abovelock to render above lockscreen (#9793) 2025-04-25 16:38:31 +02:00
Jason
41f5f67f6c window: Fix order of urgency flag and event emission (#10163) 2025-04-25 02:37:49 +02:00
davc0n
02d7badd15 workspaces: refactor class member vars (#10167) 2025-04-25 02:37:12 +02:00
davc0n
0e80ecc534 layers: refactor class member vars (#10149)
* layers: refactor class member vars

* popups: rename m_WLSurface to m_wlSurface
2025-04-24 20:49:49 +02:00
M Matthew Hydock
be6268a7ec groupbar: Add options for setting group bar title font weight (and indicator gap) (#9617) 2025-04-24 20:48:08 +02:00
WhySoBad
a9549dbca0 protocols: add Hyprland toplevel mapping implementation (#9775) 2025-04-24 18:10:57 +02:00
Vaxry
b06fbdb743 dwindle: use idealIgnoreReserved for moveWindowTo bbs
fixes #10005
2025-04-23 22:31:14 +01:00
davc0n
241a4935a2 compositor: refactor class member vars (#10141) 2025-04-22 15:23:29 +02:00
Mihai Fufezan
3577a6be31 nix/overlays: add w-p 1.43 2025-04-22 11:03:27 +03:00
Mihai Fufezan
2e540e4ec4 flake.lock: update 2025-04-22 11:00:49 +03:00
Vaxry
a4f7d7c594 protocols: add xdg_toplevel_tag_v1 support
Adds a new windowrule to target windows by xdgTag, xdgtag:
2025-04-21 22:30:27 +01:00
nyx
55e953b383 InputManager: add nofollowmouse (#9994)
* InputManager: add nofollowmouse

with this, focus_follows_mouse=1 acts like focus_follows_mouse=2 on the specific windows defined by the user

* e

* e

biggest e of all time
2025-04-21 20:48:27 +02:00
nyx
d29723cb76 keybinds: allow executing binds not bound to a key (#10102) 2025-04-21 20:47:14 +02:00
davc0n
400dd16072 debug: refactor class member vars (#10130) 2025-04-21 20:42:02 +02:00
Andrei V
a3b96961a2 tablet: naive window refocusing (#10110)
Signed-off-by: Andrei V <andrei@ptaxa.net>
2025-04-21 00:32:31 +02:00
Vaxry
a3d32f3b70 hyprpm: fix format 2025-04-20 23:23:17 +01:00
davc0n
4d14bcb02f config: Refactor class member vars (#10124)
* Refactor config classes vars

* Fix clang format errors
2025-04-20 20:39:33 +02:00
Vaxry
9b4060f09b hyprpm: extend dep list 2025-04-20 16:54:28 +01:00
syuzuki
867bc86089 compositor: fix getMonitorInDirection skipping active monitor (#10114) 2025-04-20 04:22:21 +02:00
Bruno Krügel
f48ee7a3d1 protocols: ensure PointerConstraints activation occurs only after attched to InputManager (#10096) 2025-04-19 01:16:30 +02:00
fazzi
51afc2c291 ctm: enable fade animation on nvidia driver versions 575 and above (#10095)
* ctm: enable fade animation on nvidia driver versions 575 and above

* format if statement without braces; handle potential throw when checking for nvidia version file
2025-04-18 21:44:54 +02:00
vaxerski
02f7da2bf2 [gha] Nix: update inputs 2025-04-18 15:39:22 +00:00
Lee Bousfield
7631d4c73f render, helpers: Call OpenGL destroyMonitorResources on disconnect (#10111)
* render, helpers: Call OpenGL destroyMonitorResources on disconnect

* helpers: Add opengl null check
2025-04-18 17:37:51 +02:00
raf
ddae3036ca ci: close unwanted issues automatically (#10106)
* ci: close unwanted issues automatically

You want it, it's yours my friend.

* ci/close-issues: simplify

* ci/close-issues: try to handle large number of issues

* ci/close-issues: fix 'vaxerski'
2025-04-17 22:33:05 +02:00
nyx
225e13c3cc InputManager: add config option to disable keybinds per device (#10064) 2025-04-17 02:19:10 +02:00
Lee Bousfield
3fa6320a39 desktop: Damage subsurface when position changes (#10094) 2025-04-16 17:49:01 +02:00
Vaxry
1ae7e2164c xcursormgr: include <variant>
ref #10093
2025-04-16 13:49:41 +01:00
Vaxry
877fb5b93a time: move to stl's clocks and move timer 2025-04-16 01:37:48 +01:00
Ikalco
0e521788bc core: wait for dmabuf readiness (#9806)
* add doOnReadable to event loop manager

* move syncTimeline addWaiter to doOnReadable

* wait on dmabuf buffers to be readable

* don't over synchronize in scanout, also give present feedback on same buffer commit
2025-04-16 01:02:31 +02:00
MightyPlaza
ffd6cf65e4 windowrules: allow incrementing window props (#9566) 2025-04-16 01:00:40 +02:00
Mihai Fufezan
8b7b169043 flake.lock: update 2025-04-14 18:58:37 +03:00
Nathan Ollerenshaw
533bc5115e monitors: fix disconnected monitors are reconnected to an empty workspace (#9874)
---------

Co-authored-by: nyx <nnyyxxxx@protonmail.com>
2025-04-14 11:07:53 +02:00
psyvern
99ab3e19d9 framebuffer: Fix framebuffer size check (#10068) 2025-04-13 22:40:15 +02:00
Vaxry
f4e19d3f1e layerSurface: warp position and size before taking a snapshot (#10054) 2025-04-13 17:56:20 +02:00
nyx
06469b3391 IHyprLayout: center floating window at cursor when picked up from fullscreen (#10063) 2025-04-13 17:32:53 +02:00
nyx
303a10d27c IHyprLayout: respect minimum window size (#10017)
* IHyprLayout: respect minimum window size

this prevents window warping, before we were not respecting the minimum size which caused the window to move suddenly, even though it would be sized to its minimum size.
2025-04-13 01:03:03 +02:00
rszyma
4d85e7996d dwindle: ignore fullscreen window for positioning when use_active_for_splits=false (#9838)
* fix(dwindle): ignore fullscreen window for positioning when use_active_for_splits=false

* rename NON_FULLSCREEN -> SKIP_FULLSCREEN_PRIORITY
2025-04-13 00:58:38 +02:00
Ikalco
2da4f427ea compositor/surface: fix surface opaque and input regions not being updated (#10055) 2025-04-12 18:58:29 +02:00
Vaxry
a17cea8b8c asyncDialogBox: fix missing pid
fixes #10056
2025-04-12 17:47:22 +01:00
alaricljs
6538970087 binds: add drag_threshold for click/drag isolation (#9839)
---------

Co-authored-by: Leeman <lstrout@enlj.com>
2025-04-12 16:43:13 +02:00
Lee Bousfield
0399e64274 screencopy: Handle explicit sync failure (#10050) 2025-04-12 16:38:46 +02:00
Vaxry
382f0f23f1 pass: revert "remove renderer finalDamage since it's unused (#9996)" (#10039)
This reverts commit 0a7e2cb152.
2025-04-11 00:34:50 +02:00
Aaron Blasko
b83c9f5c6f cmake: do not install version.h.in (#10035) 2025-04-11 00:31:07 +02:00
Virt
d775686380 input: add warp_on_toggle_special (#9945) 2025-04-10 14:54:24 +02:00
Ikalco
0dc531c4a7 core: fix crash in data device on shutdown (#9997) 2025-04-09 18:08:42 +02:00
Ikalco
0a7e2cb152 pass: remove renderer finalDamage since it's unused (#9996) 2025-04-09 17:50:06 +02:00
Vaxry
4f991610d0 watchdog: remove watchdog
it has been unused for a while now
2025-04-09 01:48:21 +01:00
nyx
ea852965ff xdg-shell: fix some null refs (#9992) 2025-04-08 19:43:15 +02:00
Vaxry
260d8e1f71 Permission Manager: add permission management for screencopy (#9930) 2025-04-08 19:39:53 +02:00
nyx
642f394eb3 xwayland: sync primary selection with wayland (#9952) 2025-04-08 17:36:29 +02:00
Vaxry
b15c2bfff6 CursorManager: Store cursor pixel data retrieved from X/HC as a copy (#9986)
Instead of storing pointers as refs (which could randomly get invalid very easily) copy the data.
2025-04-07 21:08:16 +02:00
Ikalco
da86db43d4 core: refactor and improve surface commit (#9805)
* make CHLBufferReference not a SP anymore

* copy over release and acquire points in CHLBufferReference

* use CHLBufferReference in screencopy and toplevel export

TODO: use CHLBufferReference in direct scanout properly
      the only problem is the scanout buffer release timing,
      specifically the onBackendRelease mechanism

* cleanup SSurfaceState and surface pending commit tracking

* move surface code from DRMSyncobj, and move acquire to SSurfaceState

* use queue for comitted pending surface states like proto says

"The content update is placed in a queue until it becomes active." - wl_surface::commit

* drop, not release, prev buffer if 2nd buffer wl_surface.attach is sent

"A wl_buffer that has been attached and then replaced by another attach instead of committed will not receive a release event, and is not used by the compositor." - wl_surface::attach
2025-04-07 21:03:27 +02:00
Vaxry
70ae99f521 input/layers: Fix exclusive LS focus / refocus after unmap (#9984) 2025-04-07 20:52:11 +02:00
Jan Beich
a8eda7f978 helpers: add missing include for BSDs after 3c128679ee (#9982)
src/helpers/AsyncDialogBox.cpp:47:23: error: use of undeclared identifier 'read'
   47 |         while ((ret = read(m_pipeReadFd.get(), buf.data(), 1023)) > 0) {
      |                       ^
src/helpers/AsyncDialogBox.cpp:83:9: error: use of undeclared identifier 'pipe'
   83 |     if (pipe(outPipe)) {
      |         ^
src/helpers/AsyncDialogBox.cpp:110:5: error: use of undeclared identifier 'close'
  110 |     close(outPipe[1]);
      |     ^
2025-04-07 20:36:01 +02:00
kerty0
8a8f394da7 swipe: fix swiping onto a new workspace bound to another monitor (#8176) (#9927)
The previous code didn't check if the chosen new workspace was bound to another monitor, causing buggy behavior where workspace was simultaneously open and not.

The fix simply uses `r+1` for new workspace selection.

Also, the previous code would select rightmost workspace + 1, creating large gaps in workspace IDs in some scenarios. Example (`()` and `[]` indicate workspaces on different monitors):

`(1), 2, 3, 4, 5, 6, 7, 8, 9, [10]`

Swipe right on `()` monitor would create:

`(1), 2, 3, 4, 5, 6, 7, 8, 9, [10], (11)`

But with this commit:

`(1), (2), 3, 4, 5, 6, 7, 8, 9, [10]`
2025-04-07 14:46:31 +02:00
Virt
51838fb5f5 layout: properly track floating window position (#9937) 2025-04-06 23:41:27 +02:00
Vaxry
85f874d10f swipe: fix prev workspace remembering
fixes #9904
2025-04-06 22:35:26 +01:00
nyx
9b3925009a DataDevice: position icon at cursor hotspot (#9895)
* DataDevice: position icon at cursor hotspot

ref: https://wayland.app/protocols/wayland#wl_data_device:request:start_drag
2025-04-06 23:24:14 +02:00
Vaxry
3c128679ee helpers: Add an async dialog box impl (#9919)
Adds an async dialog box, way safer than our previous local solution for ANR
2025-04-06 17:31:58 +02:00
Vaxry
e96b8ce4cc window: send fractional scale on updateScaleTransform
fixes #9889
2025-04-06 00:30:13 +01:00
Maximilian Seidler
433b7881a3 compositor: fix crash when moving a workspace to a monitor with size 0x0 (#9848) 2025-04-06 00:54:29 +02:00
Vaxry
ed05f14300 ci: nuke stalebot 2025-04-05 19:28:42 +01:00
Vaxry
c62fb08da6 github: remove issue templates 2025-04-05 18:45:52 +01:00
Vaxry
8ba20fcae1 compositor: avoid crash on null window monitor move
ref #9809
2025-04-05 00:30:33 +01:00
Mihai Fufezan
ff97d18c4c flake.lock: update 2025-04-03 18:08:55 +00:00
Maximilian Seidler
5e8bb71785 ctm: fix crash when finishing ctm progress with a destroyed monitor (#9835) 2025-04-03 16:40:59 +02:00
Amadej Kastelic
b496e2c718 nix/module: load plugins using exec-once (#9836) 2025-04-03 10:43:06 +03:00
Arkady Buryakov
a41b8d5e97 groupbar: add text offset and upper gap settings (#9733)
* Groupbar: add keep_upper_gap setting to apply/remove outer gap offset to the upper side of groupbar

* Groupbar: add text_offset setting to adjust text vertical position in a group header
2025-04-02 22:26:46 +02:00
Armin
8654029f86 versionkeeper: create version file if not present (#9829) 2025-04-02 22:21:05 +02:00
nyx
a4e6c5d678 window: don't deactivate unfocused xwayland windows in groups (#9781)
* window: don't deactivate unfocused xwayland windows in groups

we dont want to deactivate unfocused xwayland windows because X is weird, keep the behavior for wayland windows
2025-04-02 00:51:37 +02:00
nyx
3a47c73f34 layout: center floating window at cursor when picked up from fullscreen (#9780)
* layout: center floating window at cursor when picked up from fullscreen

when picking up a floating window after it had been fullscreened before it would return to its previous position which looked ugly because the cursor could be no where near the windows original position, this patch makes it so that the window is returned to the users current cursor position

* E
2025-04-02 00:45:51 +02:00
X2E4VXpZKv
1f0fd79b91 internal: Don't force default cursor on config reload/monitor reconfigure (#9815) 2025-04-01 16:20:38 +02:00
Vaxry
d1a59ec39e renderer: render tiled fading out above other tiled windows
fixes #9717

closes #9796
2025-04-01 00:25:09 +01:00
Vaxry
4c987b20e2 makefile: fix find command in installheaders
fixes #9812
2025-03-31 17:13:27 +01:00
nyx
2309270752 anr: add config for ping number before popup shows up (#9782)
* anr: make pings configurable

makes the pings of the dialog popup configurable
2025-03-31 18:06:17 +02:00
Vaxry
79b526a041 socket2: add minimized event for foreign-wlr
ref #995
2025-03-30 22:38:30 +01:00
nyx
075bbecabd core: fix artifacts when fullscreening (#9778)
* core: fix artifacts when fullscreening

fixes an issue where fullscreening a floating window that is between two monitors causes artifacts to appear on the monitor where it did not become fullscreened on

* e
2025-03-30 23:28:12 +02:00
nyx
8aaffda969 core: fix null ref when resuming system (#9794)
* core: fix null ref when resuming system

* e
2025-03-30 23:18:04 +02:00
Shockingly Good
10a335631e solitary: Fix the non-working tearing #9429 (#9772)
Fixes the non-working tearing by removing the incorrect
opaqueness check for the windows.

Fixes #9429
2025-03-30 20:29:39 +02:00
Emad Elsaid
da2d7c3971 config: Fix matching monitor by description to allow space prefix (#9788) 2025-03-30 03:12:15 +02:00
LeviVanDerMaas
05eb0aa43d workspaces: Add binds:hide_special_on_workspace_change (#9728) 2025-03-30 03:11:39 +02:00
Tom Englund
fc7223edc0 synctimeline: check if fd is readable before wait (#9789)
a lot of the time the fd is already readable, and done. so just call the
waiter directly instead of making a waiter and adding it to the
eventloop.
2025-03-30 01:53:23 +01:00
Lee Bousfield
86c279d7d0 protocols: Don't update hdr metadata if image description is unchanged (#9776) 2025-03-30 01:25:27 +01:00
micha4w
46b00a4a86 makefile: add new shaders to make installheaders (#9783) 2025-03-30 01:25:02 +01:00
Tom Englund
4a79eea6dc opengl: check for g_pHyprOpengl pointer (#9791)
restore the pointer check to avoid null ptr dereference on compositor
destruction.
2025-03-29 21:52:27 +01:00
UjinT34
7374a023ef renderer/opengl: Extract shaders from source (#9600)
---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2025-03-29 01:19:35 +01:00
Lee Bousfield
a46576afc3 xwayland: Cleanup server startup and FDs (#9769) 2025-03-28 17:12:25 +01:00
Lee Bousfield
10035a85cc core: Don't damage the entire surface every frame (#9763)
* core: Don't damage the entire surface every frame

* core: Damage buffer on dims or transform change

* core: Use guards for scale and tr equality checks
2025-03-28 17:00:39 +01:00
Vaxry
c93140a5f1 surfacestate: reset buffer bit before applying to current
fixes #9759
2025-03-28 12:32:07 +00:00
Vaxry
5380cbcdda workspaces: minor fixes to persistence
fixes #9741
2025-03-27 14:00:29 +00:00
Tom Englund
9ea76428b6 internal: fix minor ubsan errors (#9743)
* opengl: check if g_pHyprOpengl exist

on compositor destruction we can hit a race where a CEGLSync destructs
and tries to call eglDestroySyncKHR on a null g_pHyprOpengl.

/src/render/OpenGL.cpp:3019:32: runtime error: member access within null pointer of type 'struct CHyprOpenGLImpl'
     #0 0x555565eed979 in CEGLSync::~CEGLSync() /src/render/OpenGL.cpp:3019
     #1 0x555565f6271e in std::default_delete<CEGLSync>::operator()(CEGLSync*)
     const /usr/lib/gcc/x86_64-pc-linux-gnu/14/include/g++-v14/bits/unique_ptr.h:93

* xdgshell: dont apply state on empty states

setsize can be called before a state has been added to pending,
resulting in calling ApplyState with a empty state.

/src/protocols/XDGShell.cpp:323:11: runtime error: null pointer passed as argument 2, which is declared to never be null
     #0 0x5555659bf67e in CXDGToplevelResource::applyState() /src/protocols/XDGShell.cpp:323
     #1 0x5555659bcedc in CXDGToplevelResource::setSize(Hyprutils::Math::Vector2D const&) /src/protocols/XDGShell.cpp:  256
     #2 0x555563eed0ef in Events::listener_commitWindow(void*, void*) /src/events/Windows.cpp:841
2025-03-26 18:22:44 +01:00
Vaxry
0cd04bd666 surfacestate: track and apply updated state
fixes #9729
2025-03-26 17:22:21 +00:00
Vaxry
1c2b9a9ce3 opengl: don't attempt to compile cm on gles3.0
also disable the error for the cm shader

fixes #9738
2025-03-26 14:28:19 +00:00
vaxerski
cec084c178 pass/rect: include clipBox in opaque calculations
ref #9730 ref #9709
2025-03-26 11:47:04 +00:00
vaxerski
c2ef8fcc00 groupbar: round boxes 2025-03-26 11:44:38 +00:00
Tom Englund
3fc3521a97 pass: remove unusued timeline in texpass (#9734)
remove unused timeline and waitpoint in texpass and especially remove
the passing it to renderTextureInternalWithDamage that implicitly
converted it to bool. setting discardActive and allowCustomUV
2025-03-26 02:22:09 +01:00
Arkady Buryakov
9a67354fa2 Groupbar: apply scaling factor to text (#9731) 2025-03-26 02:07:56 +01:00
nyx
f7ba86d1f3 keybinds: add sendkeystate dispatcher (#9599) 2025-03-25 00:59:13 +01:00
Vaxry
f3db1b172c decoration: bring back border_part_of_window
fixes #9683, now under decoration: though
2025-03-24 23:57:50 +00:00
Tom Englund
2a6d070774 xwl: dont close the fd to early (#9715)
dont close the fd until the wl_event_source is removed, so we dont get
another event triggered with an already closed fd.
2025-03-24 19:33:07 +01:00
Vaxry
aec69131cd seat: avoid sending null surfaces in leave/enter events
ref #9699
2025-03-24 14:10:47 +00:00
vaxerski
4b968e5bc1 [gha] Nix: update inputs 2025-03-24 12:57:34 +00:00
UjinT34
a852461c7d renderer: Simplify and fix hdr metadata setting (#9706)
* simplify and fix hdr metadata setting

* keep incorrect(?) cm skip till #9600
2025-03-24 13:56:07 +01:00
Mihai Fufezan
e4abf26069 Nix: add changes from Nixpkgs derivation 2025-03-23 18:19:34 +02:00
Mihai Fufezan
006bd9eef5 protocols/meson.build: use native wayland-scanner 2025-03-23 18:15:17 +02:00
Vaxry
5ee35f914f version: bump to 0.48.0 2025-03-23 14:56:13 +00:00
entailz
aa1bd647b1 core/Compositor.hpp: fix non-relative Texture import (#9703) 2025-03-23 14:49:10 +02:00
Lee Bousfield
fdb7ca6c8f core/compositor: Fix dropping cursor buffer data early (#9700) 2025-03-22 23:06:02 +01:00
UjinT34
6ab5a0befb renderer: fix cm_fs_passthrough (#9698) 2025-03-22 18:34:01 +01:00
Lee Bousfield
6384f4acf4 core/compositor: Correctly track SHM buffer damage (#9678) 2025-03-22 17:13:44 +01:00
Aaron Blasko
4600043a49 hyprpm: return 1 when plugins are outdated (#9694)
* hyprpm: return 1 when plugins are outdated

* clang-formatted
2025-03-22 17:01:35 +01:00
Lee Bousfield
279b06044c screencopy, render: Use explicit sync for screencopy (#9697)
* screencopy, render: Use explicit sync for screencopy

* screencopy: Check if explicit sync is enabled

* screencopy: Don't require explicit KMS enabled
2025-03-22 17:01:14 +01:00
Tom Englund
ccbdba7ee2 syncobj: refactor point timelines (#9689)
no need to store the resource, just store the csynctimeline as a shared
pointer and make the timeline own the syncobj fd.
2025-03-21 20:19:53 +01:00
UjinT34
c7f0519faf core: fix DS and VRR automation (#9334) 2025-03-21 14:33:07 +01:00
Lee Bousfield
7ea4fbf0ba types: Upgrade buffer ref from WP to SP (#9677) 2025-03-20 11:08:47 +00:00
Tom Englund
f6ca4bac51 syncobj: restore SHM buffer reset (#9675)
reset shm buffers early to mitigate stuttering animations, also reuse
the monitors eglSync and store the eglsync per monitor. this however
reintroduces flickering in dbeaver nonsyncobj application.
2025-03-20 11:39:55 +01:00
phonetic112
155eba57d8 groupbar: remove 2 pixel gap above groupbar (#9664) 2025-03-19 23:09:36 +01:00
Andrei V
7b10530a0d XWayland: restore the abstract socket, and make it optional (#9615)
* Revert "xwayland: don't create an abstract unix domain socket on linux (#8874)" (#9574)

This reverts commit 2b01a5bcf6.

* xwayland: make the abstract Unix domain socket optional (#9574)

* xwayland: extend the default permissions for a regular Unix domain socket (#9574)

* xwayland: a little refactoring for `createSocket`
2025-03-19 23:06:30 +01:00
Tom Englund
a25a214523 dmabuf: pop buffer on failure (#9620)
ensure it doesnt permanently gets stuck in the container on failure, pop
it from the container.
2025-03-19 17:49:20 +01:00
Lee Bousfield
c8d80a2920 ci: Fail on warnings (#9668)
* ci: Fail on warnings

* misc: Fix compiler warnings
2025-03-19 00:46:28 +01:00
Vaxry
03385fc07f seatmgr: avoid crash on null surfs 2025-03-18 19:43:05 +00:00
vaxerski
cca0f48b74 renderer: add an option to disable cm and auto-skip cm if not necessary
fixes #9641

adds render:cm_enabled default true
2025-03-18 11:30:08 +00:00
Kamikadze
60edb376f2 config/defaultConfig.hpp: windowrulev2 -> windowrule (#9663) 2025-03-18 13:13:03 +02:00
tachyglossues
6f74d8d7e9 example/hyprland.conf: windowrulev2 -> windowrule (#9662) 2025-03-18 12:24:43 +02:00
Vaxry
ec4bea7901 config: nuke windowrule v1 syntax 2025-03-18 01:37:00 +00:00
Honkazel
9171db1984 renderer: delete now redundant ifdefs (#9651)
Hyprland for now requires aquamarine =>0.8.0 anyway
2025-03-18 02:29:08 +01:00
Ikalco
5f60fc7d00 renderer: only commit hw cursor stuff if needed (#9654) 2025-03-17 22:06:41 +01:00
Lee Bousfield
c4f46473df monitor: Optimize direct scanout damage (#9653) 2025-03-17 22:05:44 +01:00
Lee Bousfield
011d7ccb91 internal: Fix compiler warnings (#9646) 2025-03-17 15:52:40 +01:00
Lee Bousfield
efc51eb7d1 managers: Use primary backend for cursor swapchain (#9645) 2025-03-17 15:51:18 +01:00
nyx
c2835b6b0f groupbar: remove recursive window recalc (#9561) 2025-03-17 15:50:49 +01:00
Mihai Fufezan
d5d7f69d1e flake.lock: update
aquamarine: bump to 0.8.0
hyprcursor: bump to 0.1.12
2025-03-17 14:50:35 +02:00
Ikalco
5cef2f44fe renderer: allow commits when buffer is unchanged but cursor changed (#9648) 2025-03-17 13:06:58 +01:00
Vaxry
22154fa272 opengl: simplify cm pipeline
fixes a few mistakes, and skips the CM shader in cpu instead of adding a costly branch

ref #9641
2025-03-16 21:50:20 +00:00
Mihai Fufezan
2ddd16ef28 CMake: install frag files (for real this time) 2025-03-16 19:35:37 +02:00
Mihai Fufezan
d7382aa8a1 CMake: install frag files 2025-03-16 18:27:27 +02:00
Mihai Fufezan
90306bdae6 Meson: include frags in globber 2025-03-16 16:30:50 +02:00
Vaxry
b1ab0f7539 splashes: update for 3ya 2025-03-16 03:03:37 +00:00
Tom Englund
bf5e4bf116 syncobj: dont crash compositor on protocol errors (#9627)
dont call a member on null pointer if client misbehaves.
as in the weak pointer being expired.
2025-03-15 19:57:52 +01:00
Blackilykat
4c471218c9 renderer: fix window offset for dragged windows (#9629) 2025-03-15 19:15:09 +01:00
phonetic112
e59680481d input: Fix clicking through groupbar tabs (#9606) 2025-03-15 01:22:39 +01:00
André Silva
f4315db50f nix: mesa -> libgbm (#9612)
d209d800b7
2025-03-14 20:24:55 +02:00
Vaxry
3cc8e8c6be renderer: don't crash if cm fails to compile 2025-03-14 15:20:08 +00:00
Vaxry
b37944605f protocols: fix include 2025-03-14 14:35:01 +00:00
Vaxry
f4995c1837 descriptions: remove allow_early_buffer_release 2025-03-14 14:14:10 +00:00
Tom Englund
6ffde36466 syncobj: use eventfd instead of stalling fd checks (#9437)
* syncobj: cleanup and use uniqueptrs

cleanup a bit missing removals if resource not good, erasing from
containers etc. make use of unique ptrs instead. and add default
destructors.

* syncobj: rework syncobj entirerly

remove early buffer release that was breaking explicit sync, the buffer
needs to exist until the surface commit event has been emitted and draw
calls added egl sync points, move to eventfd signaling instead of
stalling sync point checks, and recommit pending commits if waiting on a
signal. add a CDRMSyncPointState helper class. move a few weak pointers
to shared pointers so they dont destruct before we need to use them.

* syncobj: queue pending states for eventfd

eventfd requires us to queue pending stats until ready and then apply to
current, and also when no ready state exist commit the client commit on
the current existing buffer, if there is one.

* syncobj: clear current buffer damage

clear current buffer damage on current buffer commits.

* syncobj: cleanup code and fix hyprlock

remove unused code, and ensure we dont commit a empty texture causing
locksession protocol and gtk4-layer-shell misbehaving.

* syncobj: ensure buffers are cleaned up

ensure the containers having the various buffers actually gets cleaned
up from their containers, incase the CSignal isnt signaled because of
expired smart pointers or just wrong order destruction because mishaps.
also move the acquire/point setting to buffer attaching. instead of on
precommit.

* syncobj: remove unused code, optimize

remove unused code and merge sync fds if fence is valid, remove manual
directscanout buffer dropping that signals release point on pageflip, it
can cause us to signal the release point while still keeping the current
buffer and rendering it yet again causing wrong things.

* syncobj: delay buffer release on non syncobj

delay buffer releases on non syncobj surfaces until next commit, and
check on async buffers if syncobj and drop and signal the release point
on backend buffer release.

* syncobj: ensure we follow protocol

ensure we follow protocol by replacing acquire/release points if they
arrive late and replace already existing ones. also remove unneded
brackets, and dont try to manual lock/release buffers when it comes to
explicit protocol. it doesnt care about buffer releases only about
acquire and release points and signaling them.

* syncobj: lets not complicate things

set points in precommit, before checking protocol errors and we catch
any pending acquire/release points arriving late.

* syncobj: move SSurfaceState to types

remove destructor resource destroying, let resources destroys them on
their events, and move SSurfaceStates to types/SurfaceState.hpp

* syncobj: actually store the merged fd

have to actually store the mergedfd to use it.

* syncobj: cleanup a bit around fences

ensure the current asynchronous buffer is actually released on pageflip
not the previous. cleanup a bit FD handling in
commitPendingAndDoExplicitSync, and reuse the in fence when syncing
surfaces.

* syncobjs: ensure fence FD doesnt leak

calling resetexplicitfence without properly ensuring the FD is closed
before will leak it, store it per monitor and let it close itself with
the CFileDescriptor class.

* syncobj: ensure buffers are actually released

buffers were never being sent released properly.

* types: Defer buffer sync releaser until unlock

* syncobj: store directscanout fence in monitor

ensure the infence fd survives the scope of attemptdirectscanout so it
doesnt close before it should have.

* syncobj: check if if acquire is expired

we might hit a race to finish on exit where the timeline just has
destructed but the buffer waiter is still pending. and such we
removeAllWaiters null dereferences.

* syncobj: code style changes

remove quack comment, change to m_foo and use a std::vector and
weakpointer in the waiter for removal instead of a std::list.

* syncobj: remove unused async buffer drop

remove unused async buffer drop, only related to directscanout and is
handled elsewhere.

---------

Co-authored-by: Lee Bousfield <ljbousfield@gmail.com>
2025-03-14 15:08:20 +01:00
André Silva
c754d7963f nix: remove wayland-protocols overlay and bump flake (#9613)
* flake.lock: update nixpkgs

* nix: remove wayland-protocols bump

* flake.lock: update

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2025-03-14 09:14:59 +02:00
UjinT34
8c97cb7858 renderer: add simple color management (#9506)
Adds proper color management and transformations for CM surfaces.
2025-03-14 00:15:18 +01:00
phonetic112
e86d3a14e4 groupbar: add an option to adjust gap sizes (#9578) 2025-03-12 15:09:09 +01:00
nyx
4b25fbe5fd windows: respect noinitialfocus with workspace changes (#9586)
If a window is specifically placed on another workspace then we should
not "focus" that workspace even if the window itself never gets focused
when noinitialfocus is enabled for the window.
2025-03-11 18:32:01 +01:00
Vaxry
81e93acba4 groupbar: pass alpha to title tex render pass
ref #9598
2025-03-11 17:30:12 +00:00
Khalid J.
b21edb1a97 input: fix touch calibration matrix overriding
make the default behavior non-overriding to avoid overriding user-set
values elswehere.
2025-03-11 00:51:42 +00:00
MightyPlaza
e4af4b5e2e core: update decorations on lockgroups (#9573)
modified:   src/managers/KeybindManager.cpp
2025-03-10 18:40:46 +01:00
Ikalco
d30cc19d25 renderer: skip ds commits if buffer didn't change (#9556)
this fixes direct scanout glitches by ensuring that attemptDirectScanout doesn't try to recommit the same buffer to AQ
which would cause a pageflip event and the backendRelease to release the same buffer too early
2025-03-08 20:24:22 +01:00
nyx
f15b49e0fd core: prevent crash when monitor list is empty (#9572) 2025-03-08 20:14:03 +01:00
nyx
c544c5115c windowrules: store floating size on close instead of resize (#9569) 2025-03-08 14:20:27 +01:00
nyx
b80b64cd6c windowrules: add option to allow size persistence between app launches (#9422) 2025-03-08 02:12:02 +01:00
vaxerski
4082e876d5 [gha] Nix: update inputs 2025-03-07 22:56:23 +00:00
Lee Bousfield
8ce1665fdb protocols: Fix blocked color management get_information (#9563) 2025-03-07 23:54:56 +01:00
nyx
7753e8ea68 keybinds): prevent crash when executing movewindoworgroup (#9551) 2025-03-06 23:08:57 +01:00
Vaxry
cb4230e1c2 touch: reject swipe on locked sessions
fixes #9542
2025-03-06 22:08:23 +00:00
nyx
7055d0c138 master: add option to keep master window position (#9537) 2025-03-06 23:06:05 +01:00
nyx
4435f5c546 input: fixup mouse check for flipping x / y (#9529) 2025-03-06 17:33:01 +01:00
Lee Bousfield
7a84317f33 protocols: Fix cursor shape protocol valid shape check (#9547) 2025-03-06 16:54:47 +01:00
Abdalrahman Shaban
2433760786 hyprctl: Error handling improvements, minor cleanups (#9536) 2025-03-06 00:50:28 +01:00
Matt White
b51ab182ae socket2: add activespecialv2 (#9530) 2025-03-05 20:33:33 +01:00
nyx
d7e7a29261 input: add flip_x and flip_y for touchpad (#9481) 2025-03-03 21:56:01 +01:00
Ikalco
f1ef724a87 protocols: Ensure protocol dtors are called in ProtocolManager dtor (#9521) 2025-03-03 01:57:49 +01:00
Vaxry
474bfcbccd core: fix clang-format 2025-03-02 16:24:37 +00:00
Mihai Fufezan
905ca39bc9 nix/module: toHyprconf -> toHyprlang (#9221)
* nix/module: toHyprconf -> toHyprlang

Updated generator that will end up living in Nixpkgs' `lib/generators`.

* nix/module: use xdph package directly

The downstream module already applies hyprland's
finalPackage to the portalPackage.

* new lib

* lib: add flattenAttrs, remove category processing

Flattening attributes means we no longer need to process categories
separately. For all intents and purposes, they do not exist.

Simplify the codebase once again, while introducing an easy to grasp
recursive function.

Add a bit of documentation for toHyprlang, though I doubt it's clear
enough even now. Still needs proper NixDoc.

* lib: add proper NixDoc

* nix/lib: inherit from lib
2025-03-02 15:41:49 +02:00
Vaxry
3a21dd84b3 core: cleanup some smart pointer usage 2025-03-02 02:19:35 +00:00
Vaxry
e6be4af21f core: add default initializers for ccompositor ptrs 2025-03-02 02:16:24 +00:00
Vaxry
2c78867a98 core: cleanup window properties
they don't need to be in CConfigManager, and belong to window instead
2025-03-02 02:13:37 +00:00
phonetic112
2acbb59bf2 core: ignore internal move workspace calls if the workspace doesn't change (#9516) 2025-03-01 19:34:38 +01:00
Vaxry
11943f761e monitor: avoid crash on expired special workspace monitor owner
fixes #9477
2025-03-01 15:56:44 +00:00
Indy Ray
f148b96bea input: Provide a non-zero time for button release triggered during window unmap. (#9513)
It doesn't seem that this is actually required, but it seems more consistant with other areas, such as in CVirtualKeyboardV1Resource::releasePressed.
2025-03-01 16:53:30 +01:00
Lee Bousfield
445337d03d protocols: Fix IWaylandProtocol onDisplayDestroy m_pGlobal double-free (#9507) 2025-02-28 02:52:31 +01:00
Lee Bousfield
34f2a4713e core: Add null activeWorkspace check in moveWorkspaceToMonitor (#9503) 2025-02-28 02:52:23 +01:00
Tuur Vanhoutte
d5920bc5da internal: fix include paths (#9500)
* Fix include path in Monitor.hpp

* fix more includes
2025-02-27 00:56:11 +01:00
Vaxry
aee9b8ac19 protocols: fix relative include 2025-02-26 22:13:06 +00:00
Vaxry
32a3d84d74 protocols: fix wrong iface for xdg_dialog
fixes #9498
2025-02-26 20:49:31 +00:00
Soliprem
002cd91fbf nix: wp-protocol version bump (#9494) 2025-02-26 19:36:24 +02:00
littleblack111
01f4074421 hyprctl/layers: print pid for layershell clients (#9468)
Adds a `getPID()` fn to layershell to print it in `hyprctl layers`
2025-02-26 16:03:06 +01:00
UjinT34
6787fe8933 protocols: Support wp color management proto (#9444)
Adds support for the recently merged w-p CM protocol alongside the (now deprecated) old CM WIP protocols
2025-02-26 15:56:37 +01:00
牧羊犬真Q
f0850905f0 cmake: add CXX_STANDARD_REQUIRED flag to ensure c++ version must be c++26 (#9476)
As the [cmake documentation](https://cmake.org/cmake/help/latest/prop_tgt/CXX_STANDARD_REQUIRED.html) said, when we use the CMAKE_CXX_STANDARD without CXX_STANDARD_REQUIRED, then the standard version we set will be an optional value, and may decay back to older c++ version. So I add this configuration into cmakelist to ensure c++ version is c++26.
2025-02-25 14:03:09 +00:00
Vaxry
d1ea18b492 hyprctl/config: fixup config descriptions, fill out missing ones, provide more data
adds current and explicit, better parsing, and fixes missing / invalid ones
2025-02-25 14:03:04 +00:00
Vaxry
73ae9790f9 hyprpm: add --hl-url for custom forks 2025-02-24 13:11:30 +00:00
nyx
3458d7ac93 xwayland: improve dnd and cleanup (#9405)
Minor changes to xwayland dnd / regular dnd to fix various issues

---------

Co-authored-by: Vaxry <vaxry@vaxry.net>
2025-02-24 03:52:10 +01:00
cyanbun96
e59464629f config: fix a possible crash in the monitor config parser (#9460)
* Less crash-prone monitor config parser

* clang-format
2025-02-23 23:43:24 +01:00
littleblack111
2e81648980 internal: use isNumber from hyprutils (#9467) 2025-02-23 18:35:29 +01:00
Tom Englund
8f50460bfe xcursor: move config check to sync gsettings (#9473)
move the check down into the function itself, 39df1f4 began syncing on
session change, but isnt checking for the setting itself, so instead of
duplicating checks all over. do it here.
2025-02-23 18:32:38 +01:00
Vaxry
f4b148df1e anr: add xwayland support (#9456)
Adds XWayland support to ANR dialogs
2025-02-21 21:26:53 +01:00
Vaxry
0e24f9c0d5 anr: add a note for no pid dialogs 2025-02-21 16:58:22 +00:00
Aaron Tulino
2cfa5d2408 hyprctl: Add IPC support for Hyprsunset (#9315)
* Add IPC support for Hyprsunset

* clang-format

* Add documentation
2025-02-21 15:20:11 +01:00
Mihai Fufezan
fa246cb6ed flake.lock: update hyprutils and aquamarine 2025-02-20 14:56:17 +02:00
nyx
6d25ef09cd xwayland: add INCR support for clipboard transfers (#9434)
add INCR protocol support for large transfers
fix write handling for partial transfers
fix an issue where wayland windows could die from a paste from an
xwayland window
2025-02-19 16:29:39 +01:00
Vaxry
0137a5f6cd anr: capitalize options 2025-02-18 15:20:00 +00:00
Vaxry
3c1a2e9fca config/descriptions: add enable_anr_dialog 2025-02-18 15:18:34 +00:00
Vaxry
fb8eaba83f core: add an ANR dialog
for xdg-shell, we can ping the wm_base, and thus render an ANR dialog if an app dies

for XWayland, there probably is a similar method, but I don't know about it and don't care.
2025-02-18 15:13:56 +00:00
nyx
3352317ca8 scripts/generateVersion.sh: convert to posix (#9433) 2025-02-18 16:18:22 +02:00
Vaxry
e59623d1d5 hyprctl: don't return empty str if there are no global shortcuts
fixes #6043
2025-02-18 00:33:36 +00:00
nyx
d01f9943e1 subsurfaces: dont try to access popup surfaces when handling subsurface updates (#9421) 2025-02-17 19:02:32 +01:00
andrewandreii
59c615c321 input: add follow_mouse_threshold (#9392) 2025-02-17 03:03:27 +01:00
Vaxry
e2a9271150 animations: add the gnomed animation style for windows 2025-02-16 20:53:49 +00:00
Maximilian Seidler
897ee276dc xwayland: configure on a configure request and cleanup geometry conversion (#9375)
* xwayland: configure the window on a configure request

* xwayland: move coordinate conversion handling to their own functions

* xwayland: rename configure to configureRequest
2025-02-16 01:20:42 +01:00
andrewandreii
94a30889a7 keybinds: fix some errors not returning a failure (#9416) 2025-02-15 20:04:02 +01:00
nyx
9228116c9a xwayland: fix a possible clipboard race condition (#9394) 2025-02-15 20:03:37 +01:00
Roberto Previdi
410da2e46f workspaces: update persistence on workspace rename (#9368) 2025-02-15 15:01:52 +01:00
nyx
7a6fde8414 internal: redirect exec'd app output to /dev/null (#9411) 2025-02-15 14:51:17 +01:00
Tom Englund
3eb6cb1875 syncobj: ensure we only add waiters on succesful checks (#9412)
timeline check only returns nullopt on ETIME_ERR , meaning the if check
later on returns true if drmSyncobjTimelineWait returns anything else
like EINVAL/EPERM/EACCESS etc, so actually check the returned .value()
of the std::optional. also move the fd to rvalue references.
2025-02-15 14:48:52 +01:00
Vaxry
2f967037aa config: set no_hw_cursors to auto by default and disable on tearing
when tearing, updates to the overlay plane may be ignored by the kernel. To avoid the cursor being a slideshow, disable hw cursors
2025-02-15 00:29:27 +00:00
Vaxry
1309b59f2c monitor: report a scheduled frame when tearing on cursor move 2025-02-15 00:18:43 +00:00
Vaxry
fb36815b01 renderer: remove spammy log 2025-02-14 22:51:41 +00:00
Honkazel
df3fba1572 internal: remove unused variable (#9402) 2025-02-14 16:31:03 +01:00
Maximilian Seidler
40adb3dfb4 config: actually set initial beziers (#9400) 2025-02-13 11:37:59 +00:00
Anthony Ruhier
5d2b008294 renderer: disable explicit if aquamarine output doesn't support it (#9396) (#9398)
The explicit settings ignore the aquamarine output.supportsExplicit
attribute, which creates glitches on drivers not supporting explicit
sync (example: freedreno).

If the output has been set as not supporting explicit, disable the
explicit settings.
2025-02-13 11:09:25 +00:00
Maximilian Seidler
208f94fe12 animations: sync inactive/active border angles when using borderangle animations (#9401) 2025-02-13 11:08:03 +00:00
Maximilian Seidler
1789405163 session-lock: send locked when in unsafe state (#9399) 2025-02-13 11:06:36 +00:00
nyx
68bb3e7f0a env: move XDG_SESSION_TYPE to before backend init (#9390) 2025-02-12 13:54:42 +00:00
J. J. Ramsey
f83fe9986b protocols: add version 2 of ext-idle-notify-v1 protocol (#8959)
Signed-off-by: James Ramsey <james.jehiel.ramsey@gmail.com>
Co-authored-by: James Ramsey <james.jehiel.ramsey@gmail.com>
2025-02-11 15:58:43 +01:00
Mihai Fufezan
f2d43e5f21 nix/overlays: add wayland-protocols overlay 2025-02-10 20:17:29 +02:00
Mihai Fufezan
e1179b665b flake.lock: update 2025-02-10 20:11:35 +02:00
Vaxry
f261fb6fe0 groupbar: fix groupbar missing when indicator_height is <= 0
ref #9291 #9372
2025-02-09 17:58:09 +00:00
Vaxry
3a43e7bb9a config: default movefocus_cycles_fullscreen to false
less confusing
2025-02-09 17:50:54 +00:00
Vaxry
1f97643e83 core: add mallopt to modify trim threshold 2025-02-09 17:38:20 +00:00
clamydo
56f6f61596 tablet: take active_area_size into account when sending tip event (#9325)
* fixes #9322, take `active_area_size` into account when sending tip event

* check if `relative_input` is set

As suggested by @y47s5s68tq870r7tc1xpp755pabopg

* refactoring active area in own function to keep it DRY

* coding style

* making transformation static

---------

Co-authored-by: clamydo <clamydo@users.noreply.github.com>
2025-02-09 15:30:30 +01:00
Honkazel
8e10ddb592 datadevice: fix wrong param (#9370)
Reason: look at the setReceive parameters and also at the next line(tries to narrow)
2025-02-08 22:00:55 +01:00
nyx
feb8ad48f0 groups: deactivate unfocused windows in groups (#9354) 2025-02-08 15:05:44 +01:00
Tom Englund
f7fcbe32c9 renderer: various fixes towards improving gpu calls robustness (#9188)
ensure framebuffer textures are detached and deleted, avoid leaving framebuffers bound when not needed

* render: avoid calling glDeleteProgram on no program

its safe to do so but it adds a bunch of unnecessery lines in apitrace
when tracing. if guard it and return early.

* opengl: ensure texture and buffers are unbound

ensure bound buffers are unbound after use, also detach textures from
framebuffer before deleting it otherwise it will become dangling and
essentially leak.
2025-02-08 01:46:26 +01:00
Paul Cross
a724332eb8 desktop: add ability to target pinned windows in workspace rules (#9344)
* desktop: add ability to target pinned windows in workspace rules

* desktop: add ability to target pinned windows in workspace rules

* fix formating
2025-02-08 01:45:13 +01:00
Vaxry
54441e0c4e renderer: fix fade out on silent moves to special 2025-02-06 17:45:28 +00:00
WhySoBad
acbcf0cf11 toplevelexport: fix transformed origin for shm buffers (#9343)
* toplevelexport: fix transformed origin for shm buffers

* toplevelexport: fix style nits
2025-02-06 12:42:20 +00:00
vaxerski
30b49c75bf popup: improve ::at() behavior 2025-02-06 12:15:41 +00:00
Maximilian Seidler
ff9e059de6 window: move size reporting to animation begin callback (#9298)
* window: fix resizes with an update callback

* window: fixup sendWindowSize

Remove the size argument from sendWindowSize, since it is now a member of the Window class
and we don't want any mismatches between m_vRealSize and what we report.

Remove sendWindowSize from mapWindow, since we shouldn't need it.

* window: sendWindowSize on animation begin

* window: move most calls to sendWindowSize to the animation begin
callback

* window: remove sendWindowSize in unmanaged if not fullscreen
2025-02-06 11:21:04 +00:00
Tom Englund
f1e32cd122 core: avoid .at() and use [] operator (#9347)
avoid .at() where it makes sense and use [] operator in loops.
2025-02-06 11:18:04 +00:00
nyx
868b2b544a window: fix missing surface null checks to prevent crashes (#9350) 2025-02-06 11:17:12 +00:00
Vaxry
8a6778f0a0 scripts: don't overwrite generated version if we're not in a git repo 2025-02-05 15:42:01 +00:00
raf
64591c85aa nix: add hydraJobs output for aggregating Hyprland build jobs 2025-02-05 16:55:33 +02:00
nyx
873bff390e renderer: fix missing null checks to prevent crashes (#9332) 2025-02-05 15:53:09 +01:00
Tom Benham
84c9baecc6 keybinds: Added toggleswallow dispatcher (#5548)
* Added `toggleswallow` dispatcher

* clang-format

* Removed brackets for 1-line if
2025-02-05 09:56:41 +00:00
vaxerski
3b99e906df compositor: don't iterate over unmapped ls-es in vectorToLS
fixes #9312
2025-02-04 10:18:08 +00:00
Vaxry
5e7292434a compositor: guard null ws in updating fade 2025-02-03 22:36:10 +00:00
Vaxry
70cfc7cc9c cmonitor: guard old workspace 2025-02-03 19:53:14 +00:00
Vaxry
1da0b2c02e subprojects: update h-p
fixes #9309
2025-02-03 19:45:26 +00:00
Alexander
708d166360 dispatchers: add cyclenext hist option (#9055) 2025-02-03 02:34:30 +01:00
Vaxry
44004abc01 config: fix includes 2025-02-02 22:20:28 +00:00
UjinT34
31431a9271 protocols: Support content-type-v1 proto (#9226) 2025-02-02 20:25:29 +01:00
Alexander
70d94fec13 refactor: clang-tidy in compositor (#9241)
Co-authored-by: Alexandr Krylov <t@ruenya.nix>
2025-02-02 18:34:26 +01:00
outfoxxed
373108102c protocols: implement hyprland-ctm-control rev 2 (#9267)
* protocols: implement hyprland-ctm-control v2

* bump h-p and nix
2025-02-02 18:31:04 +01:00
micha4w
97a24ec6f3 Nix: change meson buildtype from debugoptimized to debug 2025-02-02 14:32:03 +02:00
Vaxry
64fefa3749 desktop: move popups to UPs and fix missing subsurface resource
fixes #9283
2025-02-01 19:10:19 +00:00
Vaxry
e380b6ed66 popup: take xdg geometry into account in input calcs
fixes #9023
2025-02-01 15:49:10 +00:00
Vaxry
88adae73ba pass: add input region debug 2025-02-01 15:31:31 +00:00
Vaxry
c6f672257b desktop: move popup and subsurface ctors to factories
makes sure m_pSelf is set before we do anything like possibly adding children

fixes #9275

supersedes #9276
2025-02-01 15:08:30 +00:00
Maximilian Seidler
5b43c106bd animation: don't immediately disconnect active vars during tick (#9272) 2025-02-01 15:44:20 +01:00
Mihai Fufezan
d11d069715 CI/Nix: remove deprecated magic-nix-cache-action 2025-02-01 09:29:06 +02:00
nyx
ddf180fa30 render: enforce framebuffer offloading and remove introspection toggle (#9217) 2025-01-31 17:08:43 +01:00
nyx
a4b7d1c2d7 xwayland: correct pointer coordinate mismatch in X11 windows (#9259)
refactor(xwayland): add back comments
2025-01-31 14:36:56 +01:00
Mihai Fufezan
12b5034c99 configWatcher: watch both symlinks and canonical paths (#9219) 2025-01-31 14:36:22 +01:00
Vaxry
9c38287410 groupbar: various visual improvements
added rounding, round at edges, and indicator height
2025-01-31 13:32:36 +00:00
Brayden Zee
ac5668192e desktop: fix segfault when destroying a partially create layer surface (#9247) 2025-01-31 13:33:51 +01:00
Aaron Tulino
7d51dee103 hyprctl: Extract IPC code to separate method (#9223)
This makes it possible to use the same IPC code for more projects in the future
2025-01-31 13:33:36 +01:00
nyx
ea16b64ec1 xwayland: prevent invalid window configurations for X11 apps (#9253)
* fix(xwayland): prevent invalid window configurations for X11 apps

* refact(xwayland): remove unneeded line
2025-01-31 13:26:08 +01:00
Ikalco
e6a9cfab91 monitor: preferred mode now tries first 3 modes if preferred fails before erroring (#9246) 2025-01-31 13:23:32 +01:00
nyx
ef03f69116 xwayland: handle window coords correctly (#9238) 2025-01-30 22:36:42 +01:00
Tom Englund
32c0fa2f2f core: begin using CFileDescriptor from hyprutils (#9122)
* config: make fd use CFileDescriptor

make use of the new hyprutils CFileDescriptor instead of manual FD
handling.

* hyprctl: make fd use CFileDescriptor

make use of the new hyprutils CFileDescriptor instead of manual FD
handling.

* ikeyboard: make fd use CFileDescriptor

make use of the new CFileDescriptor instead of manual FD handling, also
in sendKeymap remove dead code, it already early returns if keyboard
isnt valid, and dont try to close the FD that ikeyboard owns.

* core: make SHMFile functions use CFileDescriptor

make SHMFile misc functions use CFileDescriptor and its associated usage
in dmabuf and keyboard.

* core: make explicit sync use CFileDescriptor

begin using CFileDescriptor in explicit sync and its timelines and
eglsync usage in opengl, there is still a bit left with manual handling
that requires future aquamarine change aswell.

* eventmgr: make fd and sockets use CFileDescriptor

make use of the hyprutils CFileDescriptor instead of manual FD and
socket handling and closing.

* eventloopmgr: make timerfd use CFileDescriptor

make the timerfd use CFileDescriptor instead of manual fd handling

* opengl: make gbm fd use CFileDescriptor

make the gbm rendernode fd use CFileDescriptor instead of manual fd
handling

* core: make selection source/offer use CFileDescriptor

make data selection source and offers use CFileDescriptor and its
associated use in xwm and protocols

* protocols: convert protocols fd to CFileDescriptor

make most fd handling use CFileDescriptor in protocols

* shm: make SHMPool use CfileDescriptor

make SHMPool use CFileDescriptor instead of manual fd handling.

* opengl: duplicate fd with CFileDescriptor

duplicate fenceFD with CFileDescriptor duplicate instead.

* xwayland: make sockets and fds use CFileDescriptor

instead of manual opening/closing make sockets and fds use
CFileDescriptor

* keybindmgr: make sockets and fds use CFileDescriptor

make sockets and fds use CFileDescriptor instead of manual handling.
2025-01-30 11:30:12 +00:00
Honkazel
7d1c78f4a3 core,hyprctl: clang, clang-tidy, typo fixes and dtors changes (#9233)
* declare dtor once + DMABBUF typo fix

* dup include + clang moment

* linux-dmabuf: last minute nit change
2025-01-30 11:07:06 +00:00
Vaxry
d462cc7fa1 subsurface: fix invalid parent typo
fixes #9224
2025-01-29 23:16:25 +00:00
Vaxry
09ec1cca51 popup: stop refocusing at unmap
fixes #9018
2025-01-29 23:05:59 +00:00
Mihai Fufezan
6fc9c8e479 flake.lock: update 2025-01-29 22:45:38 +02:00
Vaxry
6131919715 monitor: round refresh rates in sorting modes
fixes #9209
2025-01-29 13:34:11 +00:00
vaxerski
aaa5573c73 config/hyprctl: fix keyword not updating autoreload
ref #9139
2025-01-29 10:50:39 +00:00
vaxerski
344e32d71b pass/rect: fix bounding / opaque regions
fixes #9212
2025-01-29 10:42:46 +00:00
Owen L.
d41135d07c input: change window grab cursor to closed hand (#9196) 2025-01-29 10:27:34 +01:00
nyx
b884f1f7c8 renderer: calculate UV using both pixel and monitor dimensions (#9210) 2025-01-29 09:41:56 +01:00
Vaxry
3d1dd6b5c7 presentation: log a fixme when there is a feedback leak
ref #8087
2025-01-28 23:43:31 +00:00
Tom Englund
1d3904c3e7 configmgr: properly free glob memory
globfree is only freeing internally allocated resources, so also call
free the on glob_t memory we allocated.
2025-01-28 11:19:52 +01:00
Tom Englund
529ad4eaf4 ikeyboard: free xkbSymState in clearManuallyAllocd
asan reported a leak on xkbSymState on destruction, because it wasnt
beeing unrefed, was only being unrefed on calls to updateXKBTranslationState.
2025-01-28 11:19:52 +01:00
DDoSolitary
d3042e5358 xwayland: respect window size set by configure requests (#9190) 2025-01-28 10:04:57 +00:00
Jan Beich
d2773d7a4e deps: add libinotify-kqueue on BSDs after 8dd2cd41fb (#9197)
src/config/ConfigWatcher.cpp:2:10: fatal error: 'sys/inotify.h' file not found
    2 | #include <sys/inotify.h>
      |          ^~~~~~~~~~~~~~~
2025-01-27 23:06:48 +01:00
matt1432
5fd90548dc nix: fix duplicate inputs and update flake.lock 2025-01-27 22:45:18 +02:00
Mihai Fufezan
25d5ce4833 CI/setup_base: add libspng 2025-01-27 22:25:27 +02:00
DDoSolitary
e7a72de9b5 xwayland: send synthetic configure events (#9193) 2025-01-27 17:45:15 +01:00
littleblack111
cb7ed4f62b ci: clang-format fix (#9145)
* move

* revert, comment via peter-evans/commit-comment@v3

* remove
2025-01-27 17:41:26 +01:00
Vaxry
2a478c30ca core: fix clang-format 2025-01-27 13:41:38 +00:00
Vaxry
04ac46c543 version: bump to 0.47.0 2025-01-27 11:43:43 +00:00
Vaxry
2f55806d6f renderer: fix rare case when a tiled window would be rendered over fs 2025-01-26 21:06:25 +00:00
user111111111111111111111111111111111
3b207d29bd core: update groups on movewindow (#9183) 2025-01-26 20:06:50 +01:00
Vaxry
6bd6c5512e hooksystem: avoid huge include for HANDLE 2025-01-26 18:38:35 +00:00
Vaxry
bb5b09def0 renderer: fix funky corners
oopsie
2025-01-26 16:00:29 +00:00
Vaxry
efe29a2461 shadow: avoid drawing empty shadows 2025-01-26 16:00:28 +00:00
Vaxry
e951011503 renderer/internal: stop using box pointers
in favor of const refs
2025-01-26 15:05:34 +00:00
Vaxry
16aeb24bc1 core: make persistent workspaces always follow the config
instead of just staying after open, they will now be enforced on their respective monitors

fixes #8769
2025-01-26 14:40:42 +00:00
Vaxry
74d0f34cf3 pointer: always scale the cpu cursor to the right size
fixes #9003
2025-01-26 14:25:54 +00:00
Maximilian Seidler
4abf9155ee window: only set m_iMonitorMovedFrom when the workspace is visible (#9178) 2025-01-26 14:00:52 +01:00
Vaxry
0a28e13787 desktop: move desktop types to memory-safe pointers 2025-01-26 12:54:38 +00:00
Maximilian Seidler
3cd6e3960f xwayland: fix pointer mismatches with multiple monitors (#9179) 2025-01-26 13:23:39 +01:00
Vaxry
8b1d6e3009 subsurface: damage the entire parent on size change
the previous method doesn't exactly work, idk todo fix

fixes #8784
2025-01-25 21:57:58 +00:00
Vaxry
445acec2a2 core: move sendWindowSize off of xwaylandmgr
additionally fixes that one weird x11 issue with floating windows being mis-sized on open
2025-01-25 20:36:44 +00:00
Vaxry
45c3787e75 window: revert only set m_iMonitorMovedFrom, when moving to a different monitor
This reverts commit 089fdd1ea0.

Great commit.
2025-01-25 19:37:52 +00:00
Junxuan Liao
9199a9746d input: pass touch events to lock screens (#9129)
* refactor: use weak pointers for session lock surfaces

* input: pass touch events to lock screens
2025-01-25 19:44:13 +01:00
Vaxry
bce58d9d65 dwindle: fix possible crash on null ws 2025-01-25 18:34:15 +00:00
heather7283
f3fc8d599a config/ConfigWatcher.cpp: add missing include needed for clang (#9166) 2025-01-25 19:23:53 +01:00
Maximilian Seidler
107723bdf4 config: disable borderangle by default (#9165) 2025-01-25 19:23:36 +01:00
Mihai Fufezan
065e89648b flake.lock: update 2025-01-25 15:33:27 +02:00
Vaxry
354d4594de xwayland: various window handling fixes
I hate this fucking garbage
2025-01-25 02:35:41 +00:00
Maximilian Seidler
089fdd1ea0 window: only set m_iMonitorMovedFrom, when moving to a different monitor (#9160) 2025-01-25 00:27:24 +01:00
heather7283
1815f9a2e5 compositor: fix incorrect cast, use lambda capture instead (#9161) 2025-01-25 00:26:46 +01:00
Vaxry
d8f79d7678 core: add --verify-config to verify the config with Hyprland
fixes #9135
2025-01-24 20:30:21 +00:00
Maximilian Seidler
80b2fd135b animations: fix borderangle once (#9149) 2025-01-24 19:22:05 +01:00
Vaxry
fda9790cde layout: force full damage on toggling floating mode
fixes #8849
2025-01-24 17:51:16 +00:00
heather7283
9b3f71390c layershell: check if layer is valid (#9156)
fixes compositor crash when client tried to create a layer surface with
invalid layer argument
2025-01-24 16:51:31 +01:00
Maximilian Seidler
0e5d03a557 datadevice: do the unfocus surface stuff before dndActive is true (#9157) 2025-01-24 16:50:15 +01:00
Vaxry
57a39984dd input: abord dnd op on escape pressed
ref #9154
2025-01-24 13:37:30 +00:00
Vaxry
944e36ea2e config: fix misc:disable_autoreload
fixes #9139
2025-01-24 13:23:23 +00:00
Vaxry
4a1b960cbe layout: set window size after toggling floating 2025-01-24 00:49:47 +00:00
Vaxry
5d8261aee2 xwayland: avoid sending value of real size to xwayland 2025-01-24 00:25:14 +00:00
Vaxry
d075d1cab9 pass/rect: fix bounding box 2025-01-23 22:59:42 +00:00
Vaxry
bb099e5733 pass/rect: fix box shrinking with bb
fixes #9084
2025-01-23 22:57:14 +00:00
Vaxry
dadb2e0949 opengl: use uv to avoid rendering the entire blurbox
additionally can use smoothing for rounding

fixes #9086
2025-01-23 22:41:46 +00:00
Vaxry
a8c2d5a616 layout: damage window properly on float mode changes
fixes #8849
2025-01-23 22:15:14 +00:00
outfoxxed
465cf66df1 protocols: add hyprland_surface_v1.set_visible_region implementation (#9120) 2025-01-23 22:57:33 +01:00
Vaxry
1a0a22ad03 configmgr: fix crash on very early plugin loads 2025-01-23 21:27:11 +00:00
Vaxry
0a1ae48a9f core: move all shared_ptrs from the STL to hyprutils (#9143) 2025-01-23 21:55:41 +01:00
Mihai Fufezan
ae403e6a05 flake.lock: update 2025-01-23 14:48:37 +02:00
Junxuan Liao
ae4e38d9d5 tablet: send motions on tip events (#9132)
Typically, the position of the tool tip also changes on tool tip events, so we
should forward this update to the clients.
2025-01-23 12:35:13 +00:00
littleblack111
ecae3c5e4b ci: fix "Resource not accessible by integration" for cf workflow (#9144) 2025-01-23 12:32:44 +00:00
maround95
f1bd62806e core/renderer: Add GPU hotplug support (#8980) 2025-01-23 11:08:19 +00:00
DDoSolitary
fda5626594 xwayland: fix sending large clipboard data (#9134) 2025-01-22 14:27:46 +00:00
DDoSolitary
c90dbfab6f xwayland: fix clipboard mime name and atom mismatch (#9137) 2025-01-22 14:26:53 +00:00
Vaxry
d335c8f101 fractional-scale: avoid redundant and duplicate scale events
fixes #9126
2025-01-22 10:41:04 +00:00
amnesiacsardine
c8a0443adc config/ConfigManager.cpp: add instruction to edit config (#9130) 2025-01-22 12:16:46 +02:00
Christoph Hrdinka
ce48bc5408 flake.lock: update (#9128) 2025-01-21 21:21:00 +02:00
Alexander
da6e966313 keybinds: add visible arg for cyclenext (#9045)
Co-authored-by: Крылов Александр <aleksandr.krylov@hyperus.team>
2025-01-21 14:17:07 +00:00
Zach DeCook
a661203bb6 xwayland: fix crash when trying to initialize without Xwayland installed (#9077) 2025-01-20 18:40:51 +00:00
DDoSolitary
9e8d9791c7 xwayland: support sending clipboard change notification on focus (#9111) 2025-01-20 17:53:29 +00:00
Maximilian Seidler
2d82a92324 config: fix float animation speeds < 0 (#9123) 2025-01-20 16:48:04 +00:00
Maximilian Seidler
407453166c protocols: add hyprland_lock_notify_v1 implementation (#9092) 2025-01-19 18:21:36 +00:00
vaxerski
8dd2cd41fb core: move to inotify for monitoring the config files
instead of manually polling every second which is not efficient, use inotify.

an added bonus is that inotify is much much faster
2025-01-19 16:11:12 +01:00
vaxerski
0a0e56d99c core: use readFileAsString instead of cat for os-release 2025-01-19 14:04:59 +01:00
outfoxxed
086fd7ece8 protocols: do not destroy screencopy resources before client request (#9048) 2025-01-19 12:51:42 +00:00
Tom Englund
4da9b7cc5b core: reserve vector sizes as much as we can (#9118)
avoid reallocations as much as possible with a few edge cases where the
reservation overshoots a tiny bit. but a few bytes of memory short term
is better used then the overhead of potential reallocation.
2025-01-19 10:38:42 +00:00
Charlie Root
f56153a9c1 nix/module.nix: expand nixos module for configuring hyprland
Expand the nixos module to be able to configure hyprland, just like the
current home-manager module does.
2025-01-18 12:48:38 +02:00
Mihai Fufezan
a36fa5c229 Nix: disable hyprpm
It does not work properly on Nix anyway. If you were using hyprpm in
some way before, please switch to using the `plugins` option in the
HM module (and the upcoming option in the NixOS module, soon™).
2025-01-18 11:39:44 +02:00
Mihai Fufezan
fdfcfc824e CMake, Meson: add option controlling hyprpm building 2025-01-18 11:39:44 +02:00
Mihai Fufezan
d01756c1f4 Meson: properly install 'hyprland' symlink (#9091) 2025-01-18 10:59:25 +02:00
UjinT34
078e13f463 renderer: Auto enable wide color gamut in HDR mode (#9090) 2025-01-17 20:23:57 +00:00
vaxerski
47d645d84a core: fixup includes 2025-01-17 19:14:55 +01:00
Beau
b65f8a8723 desktop/DesktopTypes.hpp: fix include (#9104) 2025-01-17 18:56:43 +01:00
vaxerski
401a3bae61 core: fix warning in shadow 2025-01-17 18:56:43 +01:00
vaxerski
76a899627e regex: log an error if regex parsing fails 2025-01-17 18:56:43 +01:00
vaxerski
b7a3c45269 core: add LIKELY and UNLIKELY macros
helps the compiler optimize
2025-01-17 18:56:39 +01:00
user111111111111111111111111111111111
2bad73354a core: cleanup header includes (#9088)
Cleanup some unneeded includes to speed up compilation
2025-01-17 15:21:35 +00:00
Vaxry
0dc7367a70 renderer: use cairo for cpu buffer rendering (#9071)
Instead of a wonky memcpy which doesn't work when anything non-standard is used (size, pos, transform), just use cairo
2025-01-16 14:42:39 +00:00
UjinT34
52b9ae592b renderer: fix fullscreen hdr check (#9076) 2025-01-16 13:13:47 +01:00
vaxerski
25add26881 renderer: unload background texture if it's disabled
ref #9031
2025-01-14 17:52:32 +01:00
outfoxxed
f16f170433 protocols: immediately copy toplevel content when ignoreDamage set (#9049)
Also sets m_ignoreDamage, as it wasn't set before.
2025-01-14 16:44:09 +00:00
outfoxxed
a6b263713a protocols: allow hyprland-toplevel-export to capture hidden windows (#9041) 2025-01-12 17:10:36 +00:00
outfoxxed
4f0f512cab protocols: do not capture cursor in toplevel without pointer focus (#9042) 2025-01-12 17:09:02 +00:00
UjinT34
a3a7499317 renderer: Do not set hdr metadata unless needed (#9014) 2025-01-12 17:02:41 +00:00
staz
b117fae3b4 keybinds: fix movefocus fallback for special workspaces (#9040) 2025-01-12 17:00:56 +00:00
Toria
2671656a75 helpers/Monitor.cpp: fix include path (#9039) 2025-01-12 18:35:10 +02:00
Maximilian Seidler
2778aff08f animations: fix XWayland cursor glitch and refactor skill issues (#9033) 2025-01-11 16:38:04 +00:00
Maximilian Seidler
9e4f90aedf animation: fixup adding animvars during ::tick (#9030) 2025-01-11 16:35:57 +00:00
Alexander
15dc024a39 keybinds: fix previous_per_monitor logic (#9010)
Co-authored-by: Крылов Александр <aleksandr.krylov@hyperus.team>
2025-01-11 16:05:53 +00:00
littleblack111
3b85690aa6 config: add exec(-onec) with rules and execr(-once) (#8953) 2025-01-11 15:58:05 +00:00
vaxerski
cef09fbfe6 animation: avoid crashes in ::tick() on mutations
mutating the active variables is valid during a tick, we can't let it crash
2025-01-10 21:55:19 +01:00
UjinT34
a8b568c6c4 core: Add render:allow_early_buffer_release to make buffer release configurable (#9019) 2025-01-10 18:42:26 +00:00
Vaxry
b5fb6110ab core: Add a periodic donation request (#8981)
Will fire once in december and july. Disableable with `ecosystem:no_donation:nag`
2025-01-10 18:09:40 +00:00
littleblack111
da9252a23e keybinds: fix nullptr deref in forcekillactive (#9021) 2025-01-10 15:16:52 +00:00
vaxerski
8475a8ef99 core: always use goal size to send to clients 2025-01-10 14:09:16 +01:00
Dardo D Kleiner
f9c37ca43b windows: honor xdg_toplevel_set_fullscreen output hint (#8965)
Co-authored-by: Dardo D Kleiner <dardo.kleiner@nrl.navy.mil>
2025-01-09 22:38:38 +00:00
vaxerski
9dc9366fc6 config: fix animations requiring all args
fixes #9009
2025-01-09 22:08:16 +01:00
littleblack111
85aba23cbe ci(clang-format): directly do the clang-format instead of error (#8955)
Will suggest a clang-format fix on every MR that violates it.
2025-01-09 20:54:25 +00:00
zakk4223
2d1ebadb9b selectors: add a tag: to for matching window tag(s) by regex (#8985) 2025-01-09 20:52:26 +00:00
Maximilian Seidler
e66eab7b6a animationmgr: don't warp based on POINTY value (#9000) 2025-01-09 11:13:47 +00:00
littleblack111
c9822b08f9 keybinds: add new window destruction dispatchers (#8962) 2025-01-08 21:16:34 +00:00
vaxerski
983bc067da opengl: fix crash on null fb stencil op 2025-01-08 12:34:43 +01:00
vaxerski
b320bc2dc6 core: use cpu-buffer hw cursors on nvidia by default 2025-01-08 12:29:24 +01:00
vaxerski
ad64726f5d opengl: only allocate offMainFB on demand
These are not used by hyprland, only potentially plugins. No need to keep the VRAM allocated all the time
2025-01-08 11:33:45 +01:00
Maximilian Seidler
5fa2594659 renderer: don't access hdrMetadata optional if it has no value (#8987) 2025-01-08 10:28:55 +00:00
staz
75727e7c17 protocols: fix compilation error (#8988) 2025-01-08 10:28:47 +00:00
vaxerski
67e1e46f9b window: fixup fade out animation on silent moves 2025-01-07 20:58:49 +01:00
vaxerski
308b1f3afb core: minor fixes for animation rewrite 2025-01-07 20:30:44 +01:00
vaxerski
c143907857 config: update animation even if disabled 2025-01-07 20:27:07 +01:00
UjinT34
830350a1f7 core: Add support for HDR and color management protocols (#8715) 2025-01-07 18:32:50 +00:00
vaxerski
95542e4488 animationmgr: fix invalid include 2025-01-07 19:13:35 +01:00
Maximilian Seidler
5642ed331d core: move parts of the animation system to hyprutils (#8868)
* core: change animation manager to use Hyprutils::Animation

* config: move animation config to hyprutils animation tree

* use g_pAnimationManager->createAnimation and the new PHLANIMVAR template

* core: use CGenericAnimatedVariabled::{enabled,setConfig,getStyle} and adapt callbacks

* core: adapt animated variable usage (dereference the shared pointer)

* misc: bump CMakeLists to hyprutils 0.3.3
2025-01-07 17:55:14 +00:00
Zetta1 Reid0
c7086f936a master: add option to show slaves on left in center orientation (#8940)
Co-authored-by: Zetta1_Reid0 <11255-Zetta1_Reid0@users.noreply.gitlab.xfce.org>
2025-01-07 17:50:34 +00:00
Pollux
b9f110ef87 shaders: fix blank windows when using corner rounding (#8969) (#8971) 2025-01-06 19:30:57 +00:00
Byso
1bf4937b02 hyprctl: fix hyprctl --batch not working with exec rules (#8952) 2025-01-06 16:52:59 +00:00
UjinT34
6a90b50545 core/compositor: fix too early buffer release (#8966) 2025-01-06 16:52:35 +00:00
Mike Will
602d6b7356 snap: don't snap to any windows if workspace has a fullscreen window (#8870) 2025-01-06 16:37:13 +00:00
vaxerski
780e3dd542 [gha] Nix: update inputs 2025-01-06 14:29:29 +00:00
vaxerski
f1a7a7497e datadevice: guard XWayland server against crashes
The server might be dead or restarting, and we'd deref null

ref #7822
2025-01-06 15:27:57 +01:00
vaxerski
f390f48a07 pass: fixup debug mode rendering of input boxes 2025-01-05 23:19:13 +01:00
vaxerski
1b06d222cf pass/surface: fixup invalid expansion by old -1 rounding param
fixes #8889
2025-01-05 20:35:24 +01:00
vaxerski
391ff29110 pass: improve pass debug mode 2025-01-05 19:49:31 +01:00
Pollux
a5c14370c1 renderer: Add supercircular window corners (#8943)
renderer: Add supercircular shadows and borders

config: Add rounding_power to default and example configs

rule: add `roundingpower` window rule
2025-01-05 18:38:49 +00:00
Sergio Miguéns
b0bae15499 master: make loop around optional when cycling (#8926) 2025-01-04 16:40:33 +00:00
vaxerski
e8317ae34d xwayland: don't define atoms on no_xwayland builds
fixes #8661
2025-01-04 17:35:11 +01:00
vaxerski
a25d228840 windows: minor initial workspace improvements
ref #8942
2025-01-04 17:21:02 +01:00
vaxerski
60f069d540 groupbar: fix missing ellipsize for text
fixes #8938
2025-01-04 00:25:01 +01:00
vaxerski
2e6e0e9278 core: guard workspace and monitor in moveWorkspaceToMonitor
ref #7822
2025-01-04 00:10:21 +01:00
davc0n
f69e72eca1 socket2: add focusedmonv2 event (#8921)
* socket2: add focusedmonv2 event

* socket2: remove workspace name from focusedmonv2
2025-01-03 22:43:48 +00:00
rszyma
b0cd9972e8 github: bug issue template improvements (#8894) 2025-01-03 12:47:34 +00:00
vaxerski
f3c49c1295 pass: ignore empty rectangles queued
ref #8935
2025-01-02 21:58:23 +01:00
vaxerski
4971725b69 config: avoid querying the fs every tick 2025-01-02 18:29:10 +01:00
vaxerski
1697171fc0 pass: allow removing all pass elements of a given type 2025-01-02 18:14:45 +01:00
vaxerski
81721b8aa8 groupbar: unify title rendering
moves the text renderer to the unified opengl impl
2025-01-02 17:50:55 +01:00
vaxerski
365caa49ff keybinds: attempt to wrap around if fallback is allowed in movefocus
fixes #8909
2025-01-02 17:36:02 +01:00
vaxerski
94381e5999 dnd/seat: avoid sending button events during a dnd op
fixes #8781
2025-01-02 15:58:28 +01:00
outfoxxed
42fd366046 protocols: fix alpha-modifier noncompliance (#8929)
Also fixes small issues with hyprland-surface opacity < 1.0 while
surface alpha = 1.0.
2025-01-02 11:53:57 +00:00
Raymond Bian
cbd2451570 renderer: fix CRendererHintsPassElement reset duplication issue (#8928) 2025-01-02 11:51:59 +00:00
outfoxxed
dde3e082c9 protocols: add hyprland_surface_v1 implementation (#8877) 2025-01-01 23:34:02 +00:00
vaxerski
9f3c9ac01a pass: mark crucial elements as undiscardable 2025-01-01 22:55:21 +01:00
vaxerski
7f177fa1cf layershell: return focus to a valid ls on close if possible 2025-01-01 17:28:04 +01:00
vaxerski
d64ac47202 pass: improve pass debugging 2025-01-01 17:26:05 +01:00
vaxerski
4e93b2def5 renderer: use a render pass for render modif in client render
fixes #8918
2025-01-01 14:11:21 +01:00
vaxerski
aff34089c4 monitor: avoid crashes on no good modes
fixes #8915
2025-01-01 13:47:16 +01:00
davc0n
1989b0049f hyprpm: add glaze dependency FetchContent fallback (#8899)
Use FetchContent to retrieve glaze dependency if not available with
find_package.
Allows to build hyprpm w/o installing glaze at system level (on some distros is
not available in official repositories).
2024-12-30 19:12:29 +00:00
vaxerski
9f933da1c5 renderer: fix oversized blur precalcs not blurring at all
fixes #8839
2024-12-30 20:00:45 +01:00
Ikalco
af301312d5 core: fix custom resolutions (#8897) 2024-12-30 18:45:42 +00:00
vaxerski
8c14c2a5f4 ctm: disable fade animation by default on nvidia
Fixes #8891, the nvidia driver dies when we spam CTM too much.
2024-12-30 11:58:35 +01:00
Ikalco
cb211d83f6 internal: few small monitor improvements (#8890)
* remove framesToSkip, its not used anymore

* only set drm format when needed after leaving direct scanout

* always set drm damage
2024-12-29 23:19:12 +00:00
khushal-solves
fde569db65 master: replace always_center_master with slave_count_for_center_master (#8871)
- Replaced boolean config parameter `always_center_master` to an integer value `slave_count_for_center_master` for more control on when to center master window.
- Also updated configuration parameter, type, description and related internal variable.

New description: **when using orientation=center, make the master window centered only when at least this many slave windows are open. (Set 0 to always_center_master)**

This effects center orientation of master layout.
Now, user can control when the master window would be centered
2024-12-29 23:11:16 +00:00
Tuur Vanhoutte
5b37d53992 hyprpm: add an option to force reload all plugins (#8883) 2024-12-29 23:09:17 +00:00
vaxerski
deb077c346 ctm: add an internal fade animation to ctm transitions 2024-12-29 19:21:20 +01:00
vaxerski
3f40d6d936 pass: scale blur region in ::render 2024-12-29 12:56:58 +01:00
Mike Will
a364e80425 snap: give edge snapping precedence over corner snapping (#8873) 2024-12-29 11:18:14 +00:00
Clayton
2b01a5bcf6 xwayland: don't create an abstract unix domain socket on linux (#8874) 2024-12-28 14:07:42 +00:00
Ikalco
8d4c18d723 core: refactor/improve monitor mode selection (#8804) 2024-12-28 13:32:04 +00:00
vaxerski
c600e1aaff [gha] Nix: update inputs 2024-12-27 21:51:12 +00:00
Mike Will
cca0adf6a3 snap: revert #8659, use bounds checking instead of bit mask (#8872)
They seem like the same check, but a snap bit might not be
turned on as expected if we grab a different corner after
an edge has already been snapped.
2024-12-27 21:49:45 +00:00
vaxerski
534adad6b1 pass: scale blur regions properly 2024-12-27 17:49:05 +01:00
user111111111111111111111111111111111
775111b603 foreign-toplevel: update active on null window focus (#8860)
* update ForeignTopLevel on null window focus

* fix

* clang
2024-12-27 15:20:55 +00:00
khushal-solves
85632e7c33 internal: update window position/size after changing fullscreenstate (#8865)
This effects fullscreen group of floating windows.
2024-12-27 15:20:38 +00:00
Tuur Vanhoutte
43ca66779b hyprpm: use glaze to parse hyprctl plugin list (#8812)
* Use std::filesystem::path in hyprpm DataState to avoid concatenating strings with (folder + "/" + file)
* Added getPluginStates helper method in DataState
* Small clang-tidy improvements
2024-12-27 14:40:46 +00:00
vaxerski
e75e2cdac7 functionHooks: wait for hyprland pages before returning addr for trampo
ref #8845
2024-12-26 11:31:59 +01:00
vaxerski
2eaa4d80a0 debug: fix overlay not rendering 2024-12-26 00:16:42 +01:00
Avi Herman
dddb64dc35 internal: added reference to CTimer class in KeybindManager (#8836) 2024-12-25 19:09:45 +00:00
staz
1a3d17da91 debug: fix ISDEBUG checking (#8823) 2024-12-25 16:33:10 +01:00
vaxerski
2a24a61126 pass: improve blur region detection 2024-12-25 00:57:55 +01:00
vaxerski
2e2e2e2cad monitor: bring back old description behavior
this makes description match the beginning again. Fixes #8756
2024-12-23 21:17:38 +00:00
Mihai Fufezan
68a5842f06 Nix: fix TAG substitution 2024-12-23 20:07:12 +02:00
Mihai Fufezan
5f7ad767db flake.lock: update 2024-12-23 00:39:17 +02:00
Vaxry
a4a4fffffb renderer: allow plugins to know what window was rendered in post 2024-12-22 22:07:08 +00:00
Vaxry
1830296df3 debug: add debug:pass for debugging the render pass 2024-12-22 17:20:33 +00:00
Vaxry
e536b02248 Renderer: rewrite render scheduling (#8683)
This rewrites renderer scheduling. Occlusion is now unified in a new Pass type.
2024-12-22 17:12:09 +01:00
Vaxry
1cc1a46c2e core: fade in windows when they are brought from invisible workspaces 2024-12-22 16:04:10 +00:00
Vaxry
31422ae25d windowrules: add negative: prefix for negating a regex
fixes #8799
2024-12-21 23:07:34 +00:00
Vaxry
57921d7dbd windowrules: precompute regexes for window/layer rules 2024-12-21 19:21:50 +00:00
Aqa-Ib
8e8073c421 groups: honor group lock window rule (#8782) 2024-12-21 17:35:47 +01:00
Vaxry
52ee7a8748 data-device: fix edge case crash on null xwm
fixes #8787
2024-12-21 15:08:00 +00:00
Vaxry
71dc9f6128 pluginAPI: add register dispatcher v2 2024-12-19 20:23:32 +00:00
Aqa-Ib
fd67ee9ecd layout: apply group rules after window creation (#8779)
* apply group rules after window creation

* clang-format
2024-12-19 20:22:40 +01:00
Vaxry
bec18dc6f9 core: fix possible crash on null active workspace
fixes #7822
2024-12-19 19:11:15 +00:00
Ikalco
5b714f05f8 internal: Make static analysis more happy (#8767)
* make functions used in 1 file static

* fix invalid substr param -1

* give default initializer to borderGradier

* move RASSERT from printf to std::print
2024-12-19 02:56:01 +01:00
Aaron Blasko
7c43eed2c1 hyprpm: fix hyrpm sometimes returning 0 despite errors occuring (#8761)
* hyprpm: fix hyrpm sometimes returning 0 despite errors occuring

* there u go
2024-12-19 01:33:57 +01:00
Kamikadze
23e7d8f6a7 logging: fix Gpu info (#8764) 2024-12-19 00:08:57 +01:00
Jan Beich
df06cb4d71 core: Unbreak build on FreeBSD (#8762)
* CrashReporter: restore explicit environ(7) after 8bbeee1173

BSD systems don't declare environ(7) in any header like POSIX suggests.

src/signal-safe.cpp:12:23: error: use of undeclared identifier 'environ'
   12 |     for (char** var = environ; *var != nullptr; var++) {
      |                       ^

* fix

---------

Co-authored-by: Vaxry <vaxry@vaxry.net>
2024-12-18 20:15:44 +01:00
Vaxry
0fec38fe72 xwayland: fix compile with no xwayland 2024-12-18 19:09:02 +00:00
Vaxry
80a4852266 xwm: fixup targets in selection requests
fixes #8719
2024-12-18 15:24:37 +00:00
Vaxry
4c4471c66d xwayland: fix dnd including xwayland
ref #8759
2024-12-18 15:14:37 +00:00
Vaxry
6378c8ed65 core: avoid activating toplevel-less surfaces
ref #8609
2024-12-18 15:01:12 +00:00
Ikalco
49e5f9c428 logging: get broader GPUINFO (#8753) 2024-12-18 15:56:53 +01:00
Khalid
5f1df55fcb hyprctl: Fix hyprctl batch JSON command (#8749) 2024-12-17 18:26:02 +01:00
Ikalco
e2c78c00e5 internal: remove dead code (#8748) 2024-12-17 17:31:27 +01:00
normaltaro
bd7092a9fe binds: cycle within group on single monitor if no window found in the argument direction. (#8714) 2024-12-17 17:12:38 +01:00
Mihai Fufezan
c7d9719910 flake.lock: update 2024-12-17 10:20:33 +02:00
Austin Horstman
7ae7920572 flake.lock: update (#8742) 2024-12-17 03:15:39 +01:00
Vaxry
4b6163aef3 windowrules: fixup duplicate rule enum tags
fixes #8746
2024-12-17 01:57:35 +00:00
Vaxry
788ae58897 version: bump to 0.46.0 2024-12-16 23:38:56 +00:00
Vaxry
bba2d9a197 versionkeeper: init version to 0.0.0 if no file is present 2024-12-16 23:37:13 +00:00
Austin Horstman
e340e9f431 nix/meson: add re2 dependency (#8738)
* nix/default: add re2 dependency

* meson: add re2
2024-12-16 20:22:36 +01:00
Vaxry
c2d14a2013 opengl: fixup missed /4 in oklab parsing 2024-12-16 18:53:21 +00:00
Vaxry
95cdedee04 windowrules: fix prop rules with boolean values 2024-12-16 18:44:19 +00:00
Vaxry
0706c1a1f7 layerrules: fix ignorezero not working
fixes #8737
2024-12-16 18:37:34 +00:00
Vaxry
aecf1abddd opengl: fixup invalid ogl uniform reads 2024-12-16 18:34:19 +00:00
Vaxry
b9f82e9968 animationmgr: fixup stack-use-after-return 2024-12-16 18:31:07 +00:00
Vaxry
e06b520427 core: Move regex from stdlib to re2 (#8736)
Moves the regex handling from stdlib to re2
2024-12-16 19:21:44 +01:00
Vaxry
dab50b3ef3 core: Optimize window/layer rule application and scanning (#8735)
Optimizes window and layer rule parsing and later usage.
2024-12-16 19:05:24 +01:00
Mihai Fufezan
eaac5c7cbd flake.lock: update 2024-12-16 18:06:00 +02:00
Vaxry
a5234f26e4 core: drop using deques in favor of vectors
No point in most of these.
2024-12-16 15:58:19 +00:00
Vaxry
de3ad245dc input: add warp_back_after_non_mouse_input
adds cursor:warp_back_after_non_mouse_input

fixes #8675
2024-12-15 23:54:14 +00:00
Vaxry
db24964877 xwayland: Support cross DnD from Wayland (#8708)
Adds support for drag-and-drop from Wayland clients to XWayland ones
2024-12-15 00:37:17 +01:00
Vaxry
9f7a96b997 core/data: Use pointer focus for DnD operations (#8707)
fixes #7737
2024-12-14 16:19:56 +01:00
Vaxry
3cba4ba44e hyprctl: avoid crash on null pwuid
fixes #8693
2024-12-13 22:36:42 +00:00
Vaxry
8237627f3a compositor: fix monitor arrangement with mixed auto directions
fixes #8518
2024-12-13 22:31:30 +00:00
Vaxry
35e134e570 hyprctl: add an inhibitingIdle field to windows
fixes #4322
2024-12-13 21:30:24 +00:00
normaltaro
452a7e6905 dispatchers: Add an option to prioritize focus change within groups with movefocus (#8601)
* modified movefocus dispatcher to prioritize focus change within groups

* pass clang-format check

* `movefocus` cycling groups set optional to config bool `movefocus_cycles_groupfirst`

* Update ConfigDescriptions.hpp
2024-12-13 21:28:57 +01:00
Mike Will
61a51bb4ef snap: bias reserved area when its size is greater than zero (#8694) 2024-12-13 17:34:04 +01:00
Vaxry
aefaeedf5e data-device: fixup wrong box expansion
oopsie 7c03e9d376 was wrong
2024-12-12 12:16:59 +00:00
Vaxry
cef5e6dd7c layersurface: use lastMonitor and not monitor from cursor for new ls
fixes #8622
2024-12-11 22:31:38 +00:00
Vaxry
7c03e9d376 core/data-device: expand damage region to fix minor px errors
fixes #7656
2024-12-11 22:30:17 +00:00
Mike Will
df956a0f6f windowrules: add rules for mouse and touchpad scroll factors (#8655) 2024-12-11 17:27:49 +00:00
rooot
33f271c29a hyprpm: target installed instead of running version (#8634)
---------

Signed-off-by: rooot <hey@rooot.gay>
2024-12-11 17:49:09 +01:00
Vaxry
e892310953 workspace: update hasFullscreenWindow in updateWindows 2024-12-11 16:03:04 +00:00
Pavel Belyavsky
4d05677e8d config: add 'force' option for 'cursor:warp_on_change_workspace' (#8681)
* config: add 'force' option for 'cursor:warp_on_change_workspace'

* manager: throw the expression into the function arguments

* config: fix description of `cursor:warp_on_change_workspace`
2024-12-10 21:55:05 +01:00
Alexander Iliev
c16044a5c8 core: Fix workspace selector parsing (#8687)
Search for the closing bracket when parsing a workspace selector.
This is needed when the `m[desc:<monitor description>]` selector
is used, as the monitor description always contains spaces.
2024-12-10 21:54:51 +01:00
littleblack111
d94d8b4ab2 windows: allow replacing existing fullscreen (#8566)
* feat: `binds:allow_replace_fullscreen`

this allows replacement of fullscreen window(i.e. fullscreening another
window when one is already fullscreened on the workspace)

this is used when a floating window that is spawned on top of a
fullscreen wanted to be fullscreened

* clang-format

* remove: config for `allow_replace_fullscreen`
2024-12-10 21:09:47 +01:00
Vaxry
bb5c3f2702 core/output: don't send enter too aggresively
sometimes this might be like 1px and send enter to the wrong output

fixes #8654
2024-12-10 01:40:35 +00:00
Vaxry
0a27af8cd1 crashreporter: avoid clang warning 2024-12-08 18:52:39 +00:00
Mihai Fufezan
c106f454c1 CI/Nix: temporarily disable cross build 2024-12-07 22:01:32 +02:00
Vaxry
875b598a33 github: mention PR guidelines in the template 2024-12-07 18:01:19 +00:00
Vaxry
8bbeee1173 core: Add clang-tidy (#8664)
This adds a .clang-tidy file for us.

It's not a strict requirement to be compliant, but I tuned it to be alright.
2024-12-07 18:51:18 +01:00
Vaxry
b1e5cc66bd core: Add support for hyprqtutils' update screen (#8651)
* Nix: add hyprland-qtutils to PATH

* flake.lock: update

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-12-06 15:45:02 +01:00
Mike Will
5ff02902ee snap: use the bit mask to check if snapping occurred (#8659) 2024-12-06 15:25:14 +01:00
Vaxry
cccca7c02e renderer: drop requesting OUT_FENCE_PTR 2024-12-06 14:15:46 +00:00
Mihai Fufezan
10a4365f7d Nix: create TAG info from version 2024-12-06 10:16:18 +02:00
Vaxry
a7a6eedc21 core: move version include to hyprctl 2024-12-05 19:35:50 +00:00
Vaxry
888bdf4e23 hyprctl: add directScanout to hyprctl monitors 2024-12-05 19:33:54 +00:00
Vaxry
ceef4fb3a5 core: feeling a bit quirky today. 2024-12-05 03:36:50 +00:00
Vaxry
22f7d6f142 core: add a few festive splashes
adds two new 'special' splash types for xmas and new years. Activated based on local time.
2024-12-05 01:59:36 +00:00
Mike Will
f9e4998a6d snap: check which corner is being grabbed for monitor snapping (#8637) 2024-12-04 19:12:04 +01:00
Vaxry
3c617ce33c internal: fixup some missed updateColorsOk() calls 2024-12-03 22:58:30 +00:00
vaxerski
f6ac755cf7 cleanup: Revert use doLater instead of adding idle event handlers (#8624)
This reverts commit 6d7544458d.
2024-12-03 21:15:25 +00:00
Vaxry
320144ae72 core: move colorspace handling to oklab (#8635)
* Meson: add hyprgraphics

* Nix: add hyprgraphics

* CI/setup_base: get hyprgraphics-git

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-12-03 18:58:24 +00:00
Vaxry
92186898c0 version: add link versions for other utils (#8619)
---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-12-02 16:31:22 +00:00
UjinT34
10a9fec7fc master: make center ignore reserved areas (#8625) 2024-12-02 15:32:32 +00:00
Ikalco
6d7544458d cleanup: use doLater instead of adding idle event handlers (#8624) 2024-12-01 17:14:35 +00:00
Vaxry
d26439a0fe nix: update flake 2024-11-30 17:42:40 +00:00
littleblack111
ef6b0c81c9 cleanup: remove leftover var in ThreadManager.cpp (#8611) 2024-11-30 16:40:23 +00:00
Vaxry
8f83d29f00 renderer: restore discard mode after IME render pass
ref #8555
2024-11-28 23:51:59 +00:00
Daringcuteseal
22bf2853e6 hyprpm: fix incomplete unmet dependencies message 2024-11-28 17:48:46 +02:00
nyx
5963970be5 descriptions: change allow_pin_fullscreen value to false (#8592) 2024-11-28 15:25:24 +00:00
Vaxry
8b51eeb7ae core: fix compilation outside stdlibc++
fixes #8603
2024-11-28 14:31:43 +00:00
Andre Toerien
5329298b52 sessionLock: don't send motion events on every surface commit (#8584) 2024-11-27 19:59:00 +00:00
Agent00Ming
e9a7fb8f91 renderer: fix incorrect early return (#8590)
Co-authored-by: Agent_00Ming <agent00ming9366@gmail.com>
2024-11-27 14:17:45 +00:00
Ikalco
1fb720b62a seat: fix double scrolling in some applications (#8583) 2024-11-26 13:52:43 +00:00
Vaxry
2687788236 hyprctl: verify runtime dir exists in instances()
ref #8579
2024-11-25 14:42:11 +00:00
Vladimir-csp
0ddb952d7a hyprland-uwsm.desktop: Just reference plain entry (#8553) 2024-11-25 16:18:50 +02:00
Nabil Otsmane
1930a95000 shm: fix shm fd size check before creating or resizing shm_pool (#8572)
* protocols: fix shm fd size check before creating or resizing shm_pool

* added static to function
2024-11-25 00:50:35 +00:00
Vaxry
cc38e7e18f config: don't overwrite errors in gradients 2024-11-24 14:53:36 +00:00
Vaxry
55ec8bd512 config: throw an error explicitly when parsing colors in gradients
ref #8552
2024-11-24 02:46:28 +00:00
Mike Will
54f57797e9 snap: account for position of multiple monitors (#8543) 2024-11-23 14:36:28 +00:00
littleblack111
65f66dcf0d binds: add option to allow fullscreening a pinned window (#8526) 2024-11-23 14:32:13 +00:00
Ryan
451d7a41fc renderer: add option to blur IME popups (#8521) 2024-11-23 14:29:29 +00:00
Vaxry
00d6261cc0 hyprpm: move temp files to XDG_RUNTIME_DIR
avoid /tmp, it's cringe
2024-11-23 14:18:13 +00:00
Vaxry
745a82ce8a core: workspace-related function cleanup / refactor
CCompositor is massive, and has a lot of functions that could be better optimized if in CWorkspace
2024-11-22 16:01:02 +00:00
Vaxry
a847bc67b1 monitor: fix default focus when switching to a fs workspace 2024-11-22 15:22:35 +00:00
may
b100344595 keybinds: actually suppress internal keybinds instead of passing them along (#8538) 2024-11-22 02:31:42 +00:00
Tom Englund
943b3d467b bezier: optimize setup of bezier curves (#8528)
avoid reallocations by resizing and copy the pVec into the resized
m_dPoints, reduce the amount of calculations in baking to only do it
once per iteration instead of twice. precompute in getYforT and getXforT
return early in getYForPoint if x is equal or below 0. and use const
references where we can.

these changes we are now down to an average of "time to bake: 2.50µs."
on my machine compared to before average of "time to bake: 11.15µs"
2024-11-22 01:47:51 +00:00
vaxerski
940f7aa990 renderer: fixup blur optimization considitons
fixes #8531
2024-11-20 11:02:21 +00:00
Vaxry
e5fa017172 internal: fix some misused configStringToInt conversions
fixes #8523
2024-11-20 10:32:50 +00:00
Vaxry
c4eda46d0e xdg-shell: even more robust layout min/max size
although I don't think any apps use this, but better safe than sorry
2024-11-19 22:07:25 +00:00
Vaxry
aa067a4cf1 xdg-shell: don't report invalid min/max sizes on unset
fixes #8522
2024-11-19 21:40:16 +00:00
Vaxry
67cee43006 internal: minor cleanups for color results 2024-11-19 01:16:11 +00:00
Vaxry
47a1650c48 miscfunctions: move configStringToInt to std::expected 2024-11-18 23:53:38 +00:00
Vaxry
936dfedbad keybinds: move to managed pointers 2024-11-18 19:56:26 +00:00
MightyPlaza
6113f4da7f keybinds: allow repeating multiple binds (#8290) 2024-11-18 19:48:13 +00:00
Maximilian Seidler
cc923ad031 config: update the configStringToInt implementation (#8476)
Copied from hyprlang and removed std::expected.
2024-11-18 19:45:22 +00:00
🇺🇦 Sviatoslav Sydorenko (Святослав Сидоренко)
df9ff44899 Fix example config name in auto-generated cfg header (#8509)
Previously, it was suggesting to find `hypr.conf` in the `examples/` folder which doesn't exist. This patch fixed that to point to the existing file.

Additionally, the change updates `HYPR` to `HYPRLAND` in the same header.
2024-11-18 17:54:18 +02:00
Aqa-Ib
97493511f9 internal: fix changeWindowZOrder reordering incorrectly (#8494) 2024-11-18 14:44:15 +00:00
Vaxry
505c1f8f4a miscfunctions: fix cross build 2024-11-18 14:35:09 +00:00
johannes hanika
6744bb57c6 constraints: don't warp pointer position on release (#8491)
this was annoying for nuklear properties/ui slider elements that grab
the pointer via GLFW_CURSOR_DISABLE to allow more range and finer control.
upon mouse release, the pointer is reset to the middle of the window
without this patch, making long mouse movements necessary to go back
to the original position for readjustments. fwiw the new behaviour
is consistent with x11 and weston.
2024-11-18 14:02:34 +00:00
Vaxry
2259a88551 miscfunctions: add missing include 2024-11-18 13:59:57 +00:00
Vaxry
1ba050d603 shell: propagate new machanism from hyprctl to miscfunctions 2024-11-17 21:58:00 +00:00
Vaxry
e8717a4fce shell: don't use fgrep, prefer grep -F 2024-11-17 21:57:04 +00:00
Alessio Molinari
9b03307653 hooks: add pre connected/disconnected monitor events (#8503) 2024-11-17 19:34:03 +00:00
Vaxry
b735295d2b windows/xdg: minor cleanup of min/max size calculations
fixes #8495
2024-11-17 19:31:54 +00:00
Vaxry
8d5cdedbd3 hyprpm: fix format crash
ref #8487
2024-11-17 16:46:49 +00:00
Vaxry
4f591e807a renderer: simplify blur enabling logic 2024-11-17 16:42:30 +00:00
Vaxry
fb91c2550f renderer: don't render unmapped popups
fixes #8485
2024-11-17 16:16:54 +00:00
Alexandre Acebedo
0ddbd1c3a4 renderer: add lockdead_screen_delay (#8467) 2024-11-17 15:58:18 +00:00
Ruslan
af83c82513 hyprctl: add json output on hyprctl -j plugins list (#8480)
---------

Co-authored-by: Руслан Новокшонов <r.novokshonov@vk.team>
2024-11-16 23:18:30 +00:00
staz
9d37b1b073 workspacerules: Do not check 'on-created-empty' if using a workspace windowrule (#8486) 2024-11-16 23:07:33 +00:00
vaxerski
cf18eca86d [gha] Nix: update inputs 2024-11-16 23:06:35 +00:00
Vaxry
ec1e6be003 core: guard pmonitor in focuswindow
may be null

fixes #8483
2024-11-16 23:05:02 +00:00
sslater11
83be2480c4 workspace: fix missing name via focusworkspaceoncurrentmonitor (#8484) 2024-11-16 16:39:58 +00:00
littleblack111
7affc34ab4 bind: new long press option (#8302)
---------

Co-authored-by: Vaxry <vaxry@vaxry.net>
2024-11-15 23:21:59 +00:00
Vaxry
098e491a43 protocols: mark primarySelection as not privileged
fixes #8479
2024-11-15 00:47:34 +00:00
UjinT34
967fe76a60 drm: enable explit out fence in AQ (#8431) 2024-11-15 00:45:13 +00:00
Tom Englund
940ed3d525 xcursors: store themes in a std:set to order it (#8474)
using a unordered_set means its store based on a hash_value meaning
currently it can end up loading inherited themes before the actual theme
itself depending on the hash of the theme name used, reason for using
set at all over vector is to keep unique members and not foreverever
looping broken inherit themeing.
2024-11-14 20:38:16 +00:00
Vaxry
6f7280a690 descriptions: add use_cpu_buffer 2024-11-14 20:20:51 +00:00
Vaxry
20031cea92 pointer: add drm dumb buffers for cursors (#8399)
---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-11-14 20:15:51 +00:00
Mihai Fufezan
3fb47372b7 flake.lock: update 2024-11-13 21:34:52 +02:00
Vaxry
bb160cfe37 makefile: add stub to discourage direct make 2024-11-12 15:26:25 +00:00
SoSeDiK
a29cfa7843 logging: Add some context to config error logs (#8326) 2024-11-12 00:53:55 +00:00
nnra
f5fa84554f config: Changed the default value of decoration:blur:ignore_opacity to true (#8418)
This change is made in order to deliver the blur look majority of people
expect by default.
2024-11-11 15:49:35 +00:00
Mihai Fufezan
b88e4a1a9a Nix: disable uwsm desktop file installation
Will be enabled in the NixOS module.
2024-11-11 16:52:42 +02:00
Mihai Fufezan
ff411658e8 Lock uwsm desktop file behind feature flag
The file in the repo cannot be used in NixOS due to missing full paths,
and the fact that `uwsm` does not have access to `PATH` to find the
listed binaries. Might be useful in other situations as well.
2024-11-11 16:52:42 +02:00
Mihai Fufezan
943c7d18cc meson: autodetect systemd 2024-11-11 16:52:42 +02:00
Izmyname
ccfae82ad1 rename hyprland-systemd.desktop and remove hyprland-session.service 2024-11-11 16:52:42 +02:00
izmyname
430b5c302a systemd: hyprland-systemd.desktop -> hyprland-uwsm.desktop
Remove hyprland-session.service.
2024-11-11 16:52:42 +02:00
Vaxry
8fa4cfb7df keybinds: don't animate fullscreen size/pos changes coming in
when fullscreen, don't animate the pos/size when switching to another fullscreen window, as they can look weird and distracting.

Ideally we would do it differently but it's not really possible to do well without reading minds
2024-11-11 13:55:37 +00:00
dawsers
a551f85b91 renderer: scaled surfaces could have zero area (#8423) 2024-11-11 13:48:50 +00:00
JManch
07052a515b pointer: map devices across all outputs by default (#8352) 2024-11-11 13:45:33 +00:00
WavyEbuilder
1fa0cd7a75 debug: clean up fetching of the contents of /proc/device-tree (#8413) 2024-11-11 13:44:41 +00:00
Vaxry
c10739e6e3 core: fixup execAndGet
fixes #8410
2024-11-10 22:53:11 +00:00
WavyEbuilder
9e628067fc debug: clean up opening of files in HyprCtl (#8401)
`std::ifstream` is more suited than `execAndGet` here.
2024-11-10 15:54:15 +00:00
Vaxry
99b01c5d12 hyprpm: fix format 2024-11-10 15:54:00 +00:00
Vaxry
a8ff3a452c core: move to os/Process from hyprutils
nix bump too
2024-11-09 17:14:25 +00:00
Vaxry
dca75db127 defaultConfig: fixup smart gaps rules 2024-11-09 16:56:43 +00:00
Vaxry
a425fbebe4 version: bump to 0.45.0 2024-11-09 14:27:47 +00:00
Vaxry
cca227a53e tablet: use inputMgr unified naming scheme
ref #8301
2024-11-09 02:34:04 +00:00
Vaxry
b9c439a55e compositor: make sure we don't ret early on no surface
if there is no implicit surface passed, make sure the current focus is not null, otherwise we nope early without focusing the window

fixes #8293
2024-11-09 02:27:01 +00:00
Vaxry
726d697821 popup: minor cleanups
don't iterate over unmapped popups in breadthfirst, don't refocus if it wasnt in focus

ref #8293
2024-11-09 02:26:24 +00:00
Vaxry
0ccc0ace88 input: ignore non-kb ls-es in refocusLastWindow
ref #8293
2024-11-09 02:25:54 +00:00
Vaxry
f43d4a8638 layershell: minor cleanups and improvements to focus
ref #8293
2024-11-09 02:25:34 +00:00
Vaxry
4c7a2faf85 input: cleanup device naming logic
ref #8301
2024-11-09 01:53:05 +00:00
nickodei
3b66351eeb input: Refocus window on scrolling if follows mouse (#8361) 2024-11-08 17:25:37 +00:00
Mihai Fufezan
e58e97b0a3 Nix: build aquamarine and hyprutils in debug when using hyprland-debug 2024-11-07 10:54:52 +02:00
Mihai Fufezan
2dd0b2af71 flake.lock: update 2024-11-07 10:54:52 +02:00
dawsers
2ec2b3bfb3 renderer: minor fixup to window rendering logic (#8359)
Don't render animating windows out of their monitor when they are not moving workspaces
2024-11-06 23:30:17 +00:00
Vaxry
0ec128e5ed renderer: don't rely on datarootdir for local share 2024-11-06 22:11:46 +00:00
Mihai Fufezan
083a5cf3c1 CI: update actions 2024-11-06 19:50:01 +02:00
Aqa-Ib
8f42401aa8 groups: add merge_groups_on_groupbar (#8362) 2024-11-06 16:52:10 +00:00
Vaxry
97a309b784 layershell: check if workspace is valid in onMap
ref #8296
2024-11-06 14:02:44 +00:00
izmyname
3bf6f78dad hyprland-systemd.desktop: change name back to Hyprland (#8351) 2024-11-05 20:14:48 +02:00
Kamikadze
e4ab28b1fb defaultConfig: update default config values for shadows (#8360) 2024-11-05 18:03:37 +00:00
Vaxry
81ad218b8b shadow: fix double premultiplication
shader takes straight alpha aaaa
2024-11-05 16:28:55 +00:00
Vaxry
64c46db087 hyprctl: add mirrorOf to hyprctl monitors
fixes #8026
2024-11-05 16:20:04 +00:00
Vaxry
0920572e70 shaders: improve corner AA in borders shader 2024-11-05 16:11:05 +00:00
Vaxry
55ccb1a8cf shaders: fixup jagged edges in texture rounded corners 2024-11-05 16:00:39 +00:00
Vaxry
d1638a09ba shadow: add sharp and refactor options
options moved to decoration:shadow:
2024-11-05 15:44:40 +00:00
Vaxry
e3882b23d0 screencopy: fix build with legacyrenderer
fixes #8355
2024-11-05 09:59:03 +00:00
Vaxry
88e9e03945 renderer: add expand_undersized_textures
adds an option to disable the texture expansion for textures that are smaller while resizing up
2024-11-04 19:45:23 +00:00
Mihai Fufezan
0fb9a04526 flake.lock: update xdph 2024-11-04 20:01:40 +02:00
Mihai Fufezan
44899cd548 nix/overlays: fix xdph overlay
Partial fix for https://github.com/hyprwm/Hyprland/issues/8343
2024-11-04 19:43:25 +02:00
Gliczy
cd0d049126 flake.lock: update xdph 2024-11-03 18:43:08 +02:00
Vaxry
180c26ada6 renderer: safeguard against non-sampleable currentFB in blurMainFb
fixes #8325
2024-11-03 15:16:13 +00:00
trianta
5833abbbd1 xwayland: minor fixups for stability (#8323)
* xwayland: add inline safe closing of fds and fix LOCK_FILE_MODE permissions

* xwayland: auto recreate xwayland instance if it crashes

* xwayland: delay auto-restart until later
2024-11-03 14:59:46 +00:00
diniamo
514e0ff509 flake: update nixpkgs 2024-11-03 12:14:49 +02:00
Vaxry
40081cb330 renderer: improve api around new framebuffer changes
ref #8325
2024-11-02 15:26:45 +00:00
Mihai Fufezan
32b18179dd CMake: systemd fixes 2024-11-02 00:20:52 +02:00
Pavel Solovev
29e7dc6428 Systemd fixes
Fix installation path, install the service only if the systemd option is enabled
2024-11-02 00:20:52 +02:00
izmyname
3c0605c68e hyprland-systemd.desktop improvements (#8318) 2024-11-01 19:21:36 +02:00
Vaxry
d8b865366a renderer: Add a missing texture asset and a user check
When an asset is missing, instead of a black screen, render an obnoxious, yet standard, missing texture.

Additionally, warn the user assets failed to load.

Shoutout to Arch for having their assets broken for months. Fix your shit. I am tired of it, and it's negatively impacting users.
2024-11-01 15:52:09 +00:00
vaxerski
3852418d24 hyprctl: reload windowrules on reloadAll 2024-11-01 13:03:12 +00:00
Ikalco
c4d214c42d monitors: fix vrr breaking monitor disconnect (#8314) 2024-11-01 12:30:26 +00:00
Mike Will
93b4478e70 snap: add option border_overlap and other improvements (#8289)
* snap: add option `border_overlap` and other improvements

I really liked the way borders used to overlap when snapping and how
only the window's main surface would snap to the monitor, so I would
like to bring that behavior back, but in the form of a config option.

Other improvements include:

- reduced the number of snap functions from 4 down to 2, and only
one ever gets called at any given time.

- border size should not be added to gap size. It seemed like the
right thing to do at the time, but it makes snapping feel way
stronger than it actually should.

- all const variables have been given the all-caps naming convention.

- to avoid excessive casting, border size is declared as a double.

- to avoid excessive x + w, y + h calculations. I'm using a struct
called Range and working only with start and end values until the
very end of the function.

- check for both monitor snapping as well as reserved monitor space
snapping in a relatively efficient way.

* snap: always border-align for corners and reserved monitor space

We probably don't want to treat reserved monitor space as if it were just
a smaller monitor. Instead, it should be treated more like a borderless
window, which means our window's border should never encroach upon it.
2024-10-31 11:21:08 +00:00
Tom Englund
7c7a84ff60 internal: more profiling less calls and local copies (#8300)
* compositor: reduce amount of window box copies

mousemoveunified can call this very frequently, the cbox copying
actually shows up as an impact in such cases, move it down in the scope
and only do it when necessery.

* core: constify and reference frequent calls

profiling shows these as frequent called functions try to reduce the
amount of copies with references and const the variables.

* pointermgr: remove not used local copy, const ref

remove unneded local copies and const ref cursorsize.

* inputmgr: reduce amount of calls to vectortowindow

the amount of calls to g_pCompositor->vectorToWindowUnified fast ramps
up in cpu usage with enough windows existing and moving the mouse, move
the PWINDOWIDEAL up and reuse it if its already the same.

* protocol: compositor remove unused local copy

remove unused local copy of accumulateCurrentBufferDamage and const
previousBuffer.

* renderer: reduce scope of variables and refactor

move a few variables down in their scopes to reduce the amount of calls
and copies when not needed, also add one more for loop in
renderWorkspaceWindows and store the windows in a vector with
weakpointers that should be rendered, this adds a loop but reduces the
amount of repeated calls to shouldRenderWindow and also makes the rest
of the loops go over way smaller vector when many windows exist.
2024-10-30 23:20:32 +00:00
Vaxry
a0b2169ed6 input: revert #8279 2024-10-30 22:14:43 +00:00
nickodei
ee91df62f0 input: simulate mouse movement after scroll to refocus window (#8279) 2024-10-30 19:12:16 +00:00
MightyPlaza
12c1bb936d internal: check size limit in layouts (#8298)
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
modified:   src/helpers/MiscFunctions.cpp
modified:   src/helpers/MiscFunctions.hpp
modified:   src/layout/DwindleLayout.cpp
modified:   src/layout/IHyprLayout.cpp
modified:   src/layout/MasterLayout.cpp
modified:   src/macros.hpp
2024-10-30 18:58:36 +00:00
Aqa-Ib
5f721dce36 group: fix moveWindowIntoGroup (#8297) 2024-10-30 10:00:58 +00:00
staticssleever668
d679d20029 seat: avoid sending pointless 'keymap' and 'repeat_info' events (#8276)
#### Describe your PR, what does it fix/add?

Fix lag spikes when pressing more than 6 keys at the same time.

 #### Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)

Debugging process:
<details>
This is triggered by typing some applications, like CopyQ or XWayland.
Typing in Firefox doesn't lead to lag, however it itself does lag
handling these events.

Profiling CopyQ shows that paths leading to
`QtWaylandClient::QWaylandInputDevice::Keyboard::keyboard` take over
80% of processing time of an otherwise idle program.

Looking at output of 'wev' even when it's not focused shows same events
received over and over again.

```
[14:     wl_keyboard] repeat_info: rate: 25 keys/sec; delay: 300 ms
[14:     wl_keyboard] keymap: format: 1 (xkb v1), size: 64754
```

Looking at what passes through CInputManager::onKeyboardKey() ->
CSeatManager::setKeyboard() shows Hyprland 'switching' between endpoints
of the same keyboard, one of them being named like the other but with
'-1' suffix.
</details>

Tested changing layouts in Fcitx5 and with following config.

```
input:kb_layout = us,cz
input:kb_variant = ,qwerty
input:kb_options = grp:alt_shift_toggle
```

Also tested changing 'input:repeat_delay' while running.

Curiously, now these events appear in the output of 'wev' only once.
Changing layouts still seems to work fine though.

 #### Is it ready for merging, or does it need work?

Ready for merging.
2024-10-28 19:25:27 +00:00
MightyPlaza
7188ee4f99 hyprctl: move setprop into dispatchers (#8275)
* move setprop into dispatchers
modified:   src/debug/HyprCtl.cpp
modified:   src/managers/KeybindManager.cpp
modified:   src/managers/KeybindManager.hpp

* add deprecated
modified:   src/debug/HyprCtl.cpp
2024-10-28 18:18:58 +00:00
Tom Englund
c7315617eb internal: few more marginal optimisations from profiling (#8271)
* deco: reduce local temporars and function calls

profiling shows this is a high used function, reduce the amount of
function calls and local temporar copies and also check if we even need
to add extents at all in the loop.

* popup: optimize bfhelper in popups

pass nodes as const reference and reserve the size of the children node
vector help reduce the reallocations.

* procotol: make compositor bfhelper use const ref

use const ref for nodes and reserve second nodes vector size to reduce
amount of reallocation needed.
2024-10-28 18:02:52 +00:00
Aqa-Ib
d49a1334a8 swallow: check if swallow_regex doesn't exist (#8265)
Avoid to run CWindow::getSwallower() when `swallow_regex` doesn't exist in the user's config file.
2024-10-28 16:52:14 +00:00
Mike Will
2c481202ef layout: slight adjustments to snapping logic (#8273)
fixes some bugs with resizing and corner snapping
2024-10-28 13:39:05 +00:00
Vaxry
6cf193e166 layout: don't snap to self and allow same-pid snaps
fixes #8255
2024-10-27 23:41:22 +00:00
Vaxry
b1120ec433 layout: window snapping cleanup + fixes
way better now heh

fixes #8259 fixes #8267
2024-10-27 23:39:57 +00:00
Vaxry
5d4b54b012 core: move internal structures to monitor pointers (#8266) 2024-10-27 18:45:38 +00:00
Ryan
b6e226c320 groupbar: set locked color when groups are globally locked (#8257) 2024-10-27 18:26:42 +00:00
Tom Englund
f9b52203f5 internal: optimize cursor move a bit (#8264)
* window: inline and const getWindowMainSurfaceBox

getWindowMainSurfaceBox gets called a lot of times from deep down from
mousemoveunified, profiling mousemoveunified it spends quite a lot of
cpu time in here, let the compiler optimize the call to
getWindowMainSurfaceBox by inlining and making it const. reducing the
overhead.

* inputmgr: return early and use std::any_of

return early in mousemoveunified to reduce the amount of unnecessery
calls to various pointers when not needed, also make isconstrained use
std::any_of instead of for loop to use the STL optimized paths with
hopes and dreams marginally faster.

* decoration: return early, reduce temporar copy

return earlier and reduce the temp copies by using one .lock instead of
two
2024-10-27 17:51:26 +00:00
Aqa-Ib
a3d3b4fd64 groups: fix swallowing (#8223)
* fix swallowing for groups

* remove unnecessary check

* clang-format

* clarify comment

* make variables consistent

* make aditional variables consistent
2024-10-27 01:44:55 +01:00
izmyname
f3f7d3629a Build with hyprland-session.service (#8251)
Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-10-26 22:49:00 +03:00
Damianu
c356e42500 misc: Fix bad links to wiki (#8240)
Same as in https://github.com/hyprwm/hyprland-wiki/pull/828
2024-10-26 16:50:31 +01:00
Aqa-Ib
0b29caf9ab core: fix group members disappearing when you move the group to another monitor (#8237)
* fix group members disappearance when you move the group to another monitor

* remove repeated action
2024-10-26 02:22:37 +01:00
Vaxry
3dd8db83f1 pointer: add default auto for no_hw_cursors
auto defaults to off on nvidia, on for everyone else. Gotta wait until we do fucking drm_dumb and it fucking works
2024-10-26 02:12:43 +01:00
Vaxry
d5689bb539 internal: cleanup CMonitor usage and fix a few ref hogs
ref #8221
2024-10-26 02:06:13 +01:00
izmyname
e5384774a8 example/hyprland-session.service: add support for xdg autostart (#8230) 2024-10-25 23:38:59 +03:00
Tom Englund
f0e023bff2 security-context: avoid UB in C macro (#8229)
to safely use wl_container_of with a class the class has to be no
virtual functions, no inheritance, and uniform access control (e.g all
public)

work around this by putting this into a destroywrapper struct.
2024-10-25 11:26:48 +01:00
izmyname
3cec45d821 Improve hyprland-session.service (#8225) 2024-10-24 17:50:53 +03:00
czlabinger
7f46680ab1 hyprctl: add caps/num lock state for keyboards (#8145)
---------

Co-authored-by: Behzad <behzadasbahi@gmail.com>
2024-10-24 14:01:08 +01:00
Honkazel
f603a22af0 internal: Remove some unused lambda captures (#8218) 2024-10-24 13:12:41 +01:00
Honkazel
cdac64970e Makefile: fix legacyrendererdebug typo (#8214) 2024-10-23 23:32:39 +03:00
chitoroagad
6e0aadc585 updated flake.lock 2024-10-23 07:19:55 +03:00
Aqa-Ib
2b6ff6837e groups: add group_on_movetoworkspace (#8159) 2024-10-23 00:51:25 +01:00
Vaxry
29997ef4ba default/config: improve default animations
objectively better
2024-10-22 21:34:21 +01:00
KAGEYAM4
5e96d738e6 hyprpm: Add option to notify on fail and keep original notify (#8167)
* Only generate notification on fail

Hyprpm fail/pass notification are mutually exclusive.

* Add option to notify on fail and keep original notify (#1)

* Add option to notify on fail and keep original notify
---------

Co-authored-by: KAGEYAM4 <75798544+KAGEYAM4@users.noreply.github.com>

---------

Co-authored-by: littleblack111 <littleblack11111@gmail.com>
2024-10-22 00:28:42 +01:00
Ikalco
9df0f0b66c renderer: fix floating window damage (#8182) 2024-10-21 16:09:14 +01:00
Mike Will
4093b993a2 input: add snapping to floating windows (#8088)
* add snapping to floating windows

Works for both moving and resizing of windows.
It comes with 3 options:

`general:snap:enabled` - whether it's enabled, off by default

`general:snap:window_gap` - minimum gap in pixels between windows before
snapping. Setting to 0 effectively turns off this method of snapping.

`general:snap:monitor_gap` - minimum gap in pixels between window and
monitor edges before snapping. Again, setting it to 0 effectively turns
it off.

* snap: add more ignore criteria and change if clause into a guard

* snap: refactor code

* snap: new refactoring approach and account for border size

* snap: do corner snapping after all edge snapping is done

The approach of performing corner snaps after each individual edge snap
results in far fewer scenarios where snapping can occur.

After trying it out for a while, I found that I prefer an approach
that's more prone to snapping.

* snap: combine snapWindows and snapMonitor into a single function

* snap: add forced aspect ratio functionality

* snap: avoid directly referring to border_size config value

* snap: address vaxerski feedback

- add new line between functions
- use std::function typedef for SnapFn and make snap functions static
- avoid uninitialized variable declarations.
- change ignore condition m_bIsX11 to isX11OverrideRedirect()
- use braces for CBox and Vector2D declarations.
- add SNAP_INVALID to eSnapEdge enum
- use bitshift notation for eSnapEdge and eRectCorner
- make performSnap a non-member function.

* snap: add corner-snapping to forced aspect ratio mode
2024-10-21 16:08:25 +01:00
Vaxry
08cc063e17 monitor: avoid crash on released buffer in surf 2024-10-19 23:48:25 +01:00
Vaxry
a17850e41c layersurface: fixup brace style 2024-10-19 23:47:28 +01:00
Vaxry
6a5c342063 layersurface: round geom in arrangeLayerArray
fixes #8171
2024-10-19 23:45:51 +01:00
Vaxry
f044e4c951 internal: Move CMonitor to SP (#8178)
* move monitors to sp

* XD
2024-10-19 23:03:29 +01:00
Vaxry
ce3ba798df defaultConfig: improve smart gaps 2024-10-19 17:03:22 +01:00
Vaxry
0eaf3581a3 window: guard PMONITOR in commit listener
ref #8170
2024-10-19 16:24:03 +01:00
Vaxry
62ee5cc273 monitor: modernize/refactor last legacy-handled events 2024-10-19 16:21:47 +01:00
Vaxry
48bf32c5de foreign-toplevel-wlr: don't send updates to X11 OR windows 2024-10-19 16:09:53 +01:00
Vaxry
904f9b6aee foreign-toplevel: don't send updates to X11 OR windows 2024-10-19 16:09:53 +01:00
Maximilian Seidler
e5d3a71263 config: fix generateConfig loop (#8164)
* config: fix generateConfig loop

* config: cleanup getMainConfigPath
2024-10-19 15:49:56 +01:00
Maximilian Seidler
0e630e9e74 session-lock: reset seat grab on a new session lock (#8147) 2024-10-17 21:05:55 +01:00
MightyPlaza
5f30cb7753 windowrules: allow specifying max size in size window rule (#8021)
* allow specifying max size in size window rule
modified:   src/events/Windows.cpp

* clean up
modified:   src/events/Windows.cpp
2024-10-17 21:03:17 +01:00
Behzad
495b92fb53 makefile: fix typo (#8127) 2024-10-17 15:20:18 +01:00
Vaxry
b57086aa43 window: properly break cycles in X11TransientFor
ref #8045
2024-10-16 22:23:15 +01:00
zakk4223
09581d32fd hyprpm: Fix crashes due to misplaced fmt argument(s) (#8140) 2024-10-16 22:13:59 +01:00
Aqa-Ib
86e9f69a69 layout: move applyGroupRules() to onWindowCreated() (#8139) 2024-10-16 22:13:35 +01:00
Vaxry
781828a56e output: send enter events on late wl_output binds
fixes #6560
2024-10-16 21:59:33 +01:00
vaxerski
0baf166d39 [gha] Nix: update inputs 2024-10-16 10:01:31 +00:00
Aqa-Ib
ace803948a layout: enable group rules for new floating windows (#8122)
* layout: enable group rules for new floating windows

* fix comment

* do not apply group rules to a new floating window if it shouldBeFloated.
fixes child windows

* comment
2024-10-16 10:59:47 +01:00
Aqa-Ib
01c2ff34dd layout: simplify the conditions to autogroup (#8120) 2024-10-14 19:31:17 +01:00
fanlumaster(Fany Full)
22b1370ae5 IME: Fixup IME popup candidate windows position when scale is not 1.0 (#8117) 2024-10-14 18:03:16 +01:00
deadacute
f309681d4a example: update desktop file to include DesktopNames 2024-10-14 18:26:07 +03:00
Ikalco
ce62521883 drm-lease: fix crashes and implementation (#8116) 2024-10-14 11:37:42 +01:00
Aqa-Ib
e7fd0f5aec layout: deny auto-grouping a new floating window into a tiled group (#8108) 2024-10-14 00:25:19 +01:00
Vaxry
abfd550ee2 xwm: avoid infinite parent lookup loop in lookupParentExists
ref #8045
2024-10-14 00:24:32 +01:00
Vaxry
8e51a36c7f config/example: add optional smart gaps to the default config
ref #8106 #8114
2024-10-14 00:19:10 +01:00
Vaxry
5c3bd8e93d notif-overlay: add a bit of padding for icons 2024-10-13 17:26:44 +01:00
Toni500git
05a5e0b4f1 hyprland: convert std::cout and std::cerr to std::println() 2024-10-13 14:13:56 +01:00
Toni500git
b61d4c3636 hyprctl: convert std::cout and std::cerr to std::println() 2024-10-13 14:13:56 +01:00
Toni500git
e79d3cd2ef hyprpm: convert std::cout and std::cerr to std::println() 2024-10-13 14:13:56 +01:00
Vaxry
1822707c7e drm-syncobj: fix crash on missing timelines
fixes #8092
2024-10-12 17:56:46 +01:00
Vaxry
c3f7c9bbb5 xcursor: don't crash on broken permissions in X themes
ref #8079
2024-10-12 15:18:39 +01:00
UjinT34
ee8116ac5d input: Fix VRR for constrained cursors (#6877) 2024-10-12 01:29:51 +01:00
Edgars Cīrulis
f5db483973 drm-timeline: Add check for conflicting acquire and release points (#8083)
Signed-off-by: Edgars Cirulis <edgarsciruliss@gmail.com>
2024-10-12 01:12:07 +01:00
Toni500github
7564b26b7d internal: improve version query and define HYPRLAND_VERSION (#8034) 2024-10-11 12:19:16 +01:00
Jasson
178a300eea xwayland: minor cleanups and fixes (#8076) 2024-10-11 12:07:25 +01:00
Vaxry
d655a10381 config/layout: nuke no_gaps_when_only (#8072) 2024-10-11 10:56:19 +01:00
Vaxry
b65773bea9 hyprpm: disallow shallow on unknown branch 2024-10-10 11:01:13 +01:00
Vaxry
c4eb194033 gammactrl: guard pMonitor in setGamma 2024-10-09 22:00:06 +01:00
Aqa-Ib
6ae89940c7 layout: add merge_floated_into_tiled_on_groupbar (#8042) 2024-10-09 10:58:49 +01:00
JManch
3d28879c26 hyprerror: fix height calc with bottom bar (#8043) 2024-10-09 10:24:35 +01:00
trianta
223dcc8bac output: update state even if no owner exists (#8044) 2024-10-09 10:24:05 +01:00
Mihai Fufezan
6ce07ee864 CI/release: remove script backup line 2024-10-09 12:00:43 +03:00
Vaxry
bc299928ad output/xdg-output: avoid sending events to released globals
ref #6835
2024-10-09 00:26:40 +01:00
Vaxry
ac658500fb keyboard: update group state on change for the sym resolve state
fixes #8038
2024-10-08 23:33:10 +01:00
Vaxry
8cced091f5 renderer: reserve space for error at the bottom if that's set
ref #8040
2024-10-08 21:58:40 +01:00
Vaxry
91299f7039 hyprerror: make hyprerror reserve space (#8040) 2024-10-08 21:20:25 +01:00
Vaxry
60308a2bb5 defaultConfig: add a nofocus rule for weird X windows
ref #6543
2024-10-08 20:28:34 +01:00
Aqa-Ib
613eac4603 layout: remove unnecessary check after 45e8219 (#8037) 2024-10-08 19:31:15 +01:00
JManch
e4a26f4f1d dispatchers: allow leading whitespace in window parameter (#8016) 2024-10-08 17:50:06 +01:00
Vaxry
57b632ead8 pointer: expand sw cursor damage box
fixes #8031

just a bit, rounding errors I guess
2024-10-08 17:03:19 +01:00
Vaxry
1bf63dfdcd protocols: Add support for hyprland-ctm-control-v1 (#8023)
* initial ctm support

* flake.lock: update

* Meson: bump required versions and add ctm proto

---------

Co-authored-by: Mihai Fufezan <mihai@fufexan.net>
2024-10-08 16:59:15 +01:00
vaxerski
e0cfbec66b keybinds: fixup xkb_states for resolve_by_sym
fixes #7750
2024-10-08 13:15:58 +01:00
davc0n
b3a7e3109b misc: refactor version command (#8027)
Fixes a minor spacing issue if git status is not dirty.
Additionally now should be easier to extend it eventually.
2024-10-08 11:42:51 +01:00
Aqa-Ib
45e82199fb layout: add drag_into_group to control merging dragging windows (#8004) 2024-10-08 11:20:41 +01:00
Vaxry
4711796d38 config: give simple help for super+q not working
only on default config :P
2024-10-08 09:54:25 +01:00
Ikalco
0d70c44253 screencopy: fix screencopy frames not being cleaned up (#8017)
---------

Co-authored-by: Vaxry <vaxry@vaxry.net>
2024-10-08 01:23:48 +01:00
MightyPlaza
a364df4c9e internal: use clampWindowSize to unify min/maxsize handling (#8014)
modified:   src/desktop/Window.cpp
modified:   src/desktop/Window.hpp
modified:   src/events/Windows.cpp
2024-10-07 19:52:49 +01:00
Artur Manuel
46d990f1b6 feat: add a custom made treewide formatter (#7992) 2024-10-07 21:49:19 +03:00
Timon Schelling
5bf7b1e1fa flake.nix: add xdph follows
fixes a duplicate  hyprland-protocols instance sometimes being created due to xdph not following hyprlands instance
2024-10-07 21:43:35 +03:00
Aqa-Ib
97444ed7a8 layout: fix auto group when opening a new window in a non-focused workspace using window rules (#8006) 2024-10-07 13:22:55 +01:00
Vaxry
4e41cda27e security-context: close client fds after disconnect 2024-10-06 15:08:26 +01:00
Vaxry
da86aac0f5 security-context: implement protocol
fixes #7318
2024-10-06 14:07:07 +01:00
505 changed files with 44490 additions and 24974 deletions

101
.clang-tidy Normal file
View File

@@ -0,0 +1,101 @@
WarningsAsErrors: '*'
HeaderFilterRegex: '.*\.hpp'
FormatStyle: file
Checks: >
-*,
bugprone-*,
-bugprone-easily-swappable-parameters,
-bugprone-forward-declararion-namespace,
-bugprone-forward-declararion-namespace,
-bugprone-macro-parentheses,
-bugprone-narrowing-conversions,
-bugprone-branch-clone,
-bugprone-assignment-in-if-condition,
concurrency-*,
-concurrency-mt-unsafe,
cppcoreguidelines-*,
-cppcoreguidelines-owning-memory,
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-pro-bounds-constant-array-index,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-non-private-member-variables-in-classes,
-cppcoreguidelines-avoid-goto,
-cppcoreguidelines-pro-bounds-array-to-pointer-decay,
-cppcoreguidelines-avoid-do-while,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-special-member-functions,
-cppcoreguidelines-explicit-virtual-functions,
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-pro-bounds-pointer-arithmetic,
-cppcoreguidelines-narrowing-conversions,
-cppcoreguidelines-pro-type-union-access,
-cppcoreguidelines-pro-type-member-init,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-macro-to-enum,
-cppcoreguidelines-init-variables,
-cppcoreguidelines-pro-type-cstyle-cast,
-cppcoreguidelines-pro-type-vararg,
-cppcoreguidelines-pro-type-reinterpret-cast,
google-global-names-in-headers,
-google-readability-casting,
google-runtime-operator,
misc-*,
-misc-unused-parameters,
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-misc-include-cleaner,
-misc-use-anonymous-namespace,
-misc-const-correctness,
modernize-*,
-modernize-return-braced-init-list,
-modernize-use-trailing-return-type,
-modernize-use-using,
-modernize-use-override,
-modernize-avoid-c-arrays,
-modernize-macro-to-enum,
-modernize-loop-convert,
-modernize-use-nodiscard,
-modernize-pass-by-value,
-modernize-use-auto,
performance-*,
-performance-avoid-endl,
-performance-unnecessary-value-param,
portability-std-allocator-const,
readability-*,
-readability-function-cognitive-complexity,
-readability-function-size,
-readability-identifier-length,
-readability-magic-numbers,
-readability-uppercase-literal-suffix,
-readability-braces-around-statements,
-readability-redundant-access-specifiers,
-readability-else-after-return,
-readability-container-data-pointer,
-readability-implicit-bool-conversion,
-readability-avoid-nested-conditional-operator,
-readability-redundant-member-init,
-readability-redundant-string-init,
-readability-avoid-const-params-in-decls,
-readability-named-parameter,
-readability-convert-member-functions-to-static,
-readability-qualified-auto,
-readability-make-member-function-const,
-readability-isolate-declaration,
-readability-inconsistent-declaration-parameter-name,
-clang-diagnostic-error,
CheckOptions:
performance-for-range-copy.WarnOnAllAutoCopies: true
performance-inefficient-string-concatenation.StrictMode: true
readability-braces-around-statements.ShortStatementLines: 0
readability-identifier-naming.ClassCase: CamelCase
readability-identifier-naming.ClassIgnoredRegexp: I.*
readability-identifier-naming.ClassPrefix: C # We can't use regex here?!?!?!?
readability-identifier-naming.EnumCase: CamelCase
readability-identifier-naming.EnumPrefix: e
readability-identifier-naming.EnumConstantCase: UPPER_CASE
readability-identifier-naming.FunctionCase: camelBack
readability-identifier-naming.NamespaceCase: CamelCase
readability-identifier-naming.NamespacePrefix: N
readability-identifier-naming.StructPrefix: S
readability-identifier-naming.StructCase: CamelCase

View File

@@ -1,75 +1,15 @@
name: Bug Report
description: Something is not working right
labels: ["bug"]
name: Do not open issues, go to discussions please!
description: Do not open an issue
body:
- type: checkboxes
attributes:
label: Already reported ? *
description: Before opening a new bug report, please take a moment to search through the current open and closed issues to check if it already exists.
label: Please close this issue.
description: Users cannot open issues. I want my issue to be closed.
options:
- label: I have searched the existing open and closed issues.
required: true
- type: dropdown
id: type
attributes:
label: Regression?
description: |
Regression means that something used to work but no longer does.
**BEFORE CONTINUING**, please check if this bug is a regression or not, and if it is, we need you to bisect with the help of the wiki: https://wiki.hyprland.org/Crashes-and-Bugs/#bisecting-an-issue
multiple: true
options:
- "Yes"
- "No"
validations:
required: true
- label: Yes, I want this issue to be closed.
required: true
- type: textarea
id: ver
id: body
attributes:
label: System Info and Version
description: |
Paste the output of `hyprctl systeminfo -c` here. If you can't
launch Hyprland, paste the output of `Hyprland --systeminfo`.
If `Hyprland --systeminfo` errors out (added in 0.44.0), find
and paste the Hyprland version manually.
value: "<details>
<summary>System/Version info</summary>
```sh
<Paste the output of the command here>
```
</details>"
validations:
required: true
- type: textarea
id: desc
attributes:
label: Description
description: "What went wrong?"
validations:
required: true
- type: textarea
id: repro
attributes:
label: How to reproduce
description: "How can someone else reproduce the issue?"
validations:
required: true
- type: textarea
id: logs
attributes:
label: Crash reports, logs, images, videos
description: |
Anything that can help. Please always ATTACH and not paste them.
Logs can be found in $XDG_RUNTIME_DIR/hypr
Crash reports are stored in ~/.cache/hyprland or $XDG_CACHE_HOME/hyprland
label: Issue body

View File

@@ -1,19 +0,0 @@
name: Feature Request
description: I'd like to request additional functionality
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Before opening a new issue, take a moment to search through the current open ones.
---
- type: textarea
id: desc
attributes:
label: Description
description: "Describe your idea"
validations:
required: true

View File

@@ -20,6 +20,7 @@ runs:
clang \
cmake \
git \
glaze \
glm \
glslang \
go \
@@ -33,7 +34,10 @@ runs:
libfontenc \
libglvnd \
libinput \
libjxl \
libliftoff \
libspng \
libwebp \
libxcursor \
libxcvt \
libxfont2 \
@@ -58,7 +62,8 @@ runs:
xcb-util \
xcb-util-image \
libzip \
librsvg
librsvg \
re2
- name: Get hyprwayland-scanner-git
shell: bash
@@ -69,6 +74,11 @@ runs:
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
cmake --install build
- name: Get hyprgraphics-git
shell: bash
run: |
git clone https://github.com/hyprwm/hyprgraphics && cd hyprgraphics && cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -B build && cmake --build build --target hyprgraphics && cmake --install build
- name: Get hyprutils-git
shell: bash
run: |

View File

@@ -1,3 +1,9 @@
<!--
BEFORE you submit your PR, please check out the PR guidelines
on our wiki: https://wiki.hyprland.org/Contributing-and-Debugging/PR-Guidelines/
-->
#### Describe your PR, what does it fix/add?

View File

@@ -21,7 +21,7 @@ jobs:
- name: Build Hyprland
run: |
make all
CFLAGS=-Werror CXXFLAGS=-Werror make all
- name: Compress and package artifacts
run: |
@@ -36,10 +36,10 @@ jobs:
cp build/Hyprland hyprland/
cp -r example/ hyprland/
cp -r assets/ hyprland/
tar -cvf Hyprland.tar.xz hyprland
tar -cvJf Hyprland.tar.xz hyprland
- name: Release
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: Build archive
path: Hyprland.tar.xz
@@ -107,6 +107,7 @@ jobs:
run: make release
clang-format:
permissions: read-all
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork
name: "Code Style (Arch)"
runs-on: ubuntu-latest

48
.github/workflows/clang-format.yml vendored Normal file
View File

@@ -0,0 +1,48 @@
name: clang-format
on: pull_request_target
jobs:
clang-format:
permissions: write-all
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork
name: "Code Style (Arch)"
runs-on: ubuntu-latest
container:
image: archlinux
steps:
- name: Checkout repository actions
uses: actions/checkout@v4
with:
sparse-checkout: .github/actions
- name: Setup base
uses: ./.github/actions/setup_base
- name: Configure
run: meson setup build -Ddefault_library=static
- name: clang-format check
run: ninja -C build clang-format-check
- name: clang-format apply
if: ${{ failure() && github.event_name == 'pull_request' }}
run: ninja -C build clang-format
- name: Create patch
if: ${{ failure() && github.event_name == 'pull_request' }}
run: |
echo 'Please fix the formatting issues by running [`clang-format`](https://wiki.hyprland.org/Contributing-and-Debugging/PR-Guidelines/#code-style), or directly apply this patch:' > clang-format.patch
echo '<details>' >> clang-format.patch
echo '<summary>clang-format.patch</summary>' >> clang-format.patch
echo >> clang-format.patch
echo '```diff' >> clang-format.patch
git diff >> clang-format.patch
echo '```' >> clang-format.patch
echo >> clang-format.patch
echo '</details>' >> clang-format.patch
- name: Comment patch
if: ${{ failure() && github.event_name == 'pull_request' }}
uses: mshick/add-pr-comment@v2
with:
message-path: |
clang-format.patch

101
.github/workflows/close-issues.yml vendored Normal file
View File

@@ -0,0 +1,101 @@
name: Close Unauthorized Issues
on:
workflow_dispatch:
issues:
types: [opened]
jobs:
close-unauthorized-issues:
runs-on: ubuntu-latest
permissions:
issues: write
steps:
# XXX: This *could* be done in Bash by abusing GitHub's own tool to interact with its API
# but that's too much of a hack, and we'll be adding a layer of abstraction. github-script
# is a workflow that eases interaction with GitHub API in the workflow run context.
- name: "Close 'unauthorized' issues"
uses: actions/github-script@v7
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
script: |
const ALLOWED_USERS = ['vaxerski', 'fufexan', 'NotAShelf'];
const CLOSING_COMMENT = 'Users are no longer allowed to open issues themselves, please open a discussion instead.\n\nPlease see the [wiki](https://wiki.hyprland.org/Contributing-and-Debugging/Issue-Guidelines/) on why this is the case.\n\nWe are volunteers, and we need your cooperation to make the best software we can. Thank you for understanding! ❤️\n\n[Open a discussion here](https://github.com/hyprwm/Hyprland/discussions)';
async function closeUnauthorizedIssue(issueNumber, userName) {
if (ALLOWED_USERS.includes(userName)) {
console.log(`Issue #${issueNumber} - Created by authorized user ${userName}`);
return;
}
console.log(`Issue #${issueNumber} - Unauthorized, closing`);
await github.rest.issues.update({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
state: 'closed',
state_reason: 'not_planned'
});
await github.rest.issues.createComment({
owner: context.repo.owner,
repo: context.repo.repo,
issue_number: issueNumber,
body: CLOSING_COMMENT
});
}
if (context.eventName === 'issues' && context.payload.action === 'opened') {
// Direct access to the issue that triggered the workflow
const issue = context.payload.issue;
// Skip if this is a PR
if (issue.pull_request) {
console.log(`Issue #${issue.number} - Skipping, this is a pull request`);
return;
}
// Process the single issue that triggered the workflow
await closeUnauthorizedIssue(issue.number, issue.user.login);
} else {
// For manual runs, we need to handle pagination
async function* fetchAllOpenIssues() {
let page = 1;
let hasNextPage = true;
while (hasNextPage) {
const response = await github.rest.issues.listForRepo({
owner: context.repo.owner,
repo: context.repo.repo,
state: 'open',
per_page: 100,
page: page
});
if (response.data.length === 0) {
hasNextPage = false;
} else {
for (const issue of response.data) {
yield issue;
}
page++;
}
}
}
// Process issues one by one
for await (const issue of fetchAllOpenIssues()) {
try {
// Skip pull requests
if (issue.pull_request) {
console.log(`Issue #${issue.number} - Skipping, this is a pull request`);
continue;
}
await closeUnauthorizedIssue(issue.number, issue.user.login);
} catch (error) {
console.error(`Error processing issue #${issue.number}: ${error.message}`);
}
}
}

View File

@@ -17,14 +17,14 @@ jobs:
run: sudo apt install pandoc
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- name: Build man pages
run: make man
- uses: stefanzweifel/git-auto-commit-action@v4
- uses: stefanzweifel/git-auto-commit-action@v5
name: Commit
with:
commit_message: "[gha] build man pages"

View File

@@ -1,28 +0,0 @@
name: Nix (Build)
on:
workflow_call:
secrets:
CACHIX_AUTH_TOKEN:
required: false
jobs:
build:
strategy:
matrix:
package:
- hyprland
- hyprland-cross
- xdg-desktop-portal-hyprland
runs-on: ubuntu-latest
steps:
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: cachix/cachix-action@v15
with:
name: hyprland
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- run: nix build 'github:hyprwm/Hyprland?ref=${{ github.ref }}#${{ matrix.package }}' -L --extra-substituters "https://hyprland.cachix.org"

View File

@@ -1,4 +1,4 @@
name: Nix (CI)
name: Nix
on: [push, pull_request, workflow_dispatch]
@@ -8,7 +8,23 @@ jobs:
uses: ./.github/workflows/nix-update-inputs.yml
secrets: inherit
build:
hyprland:
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork)
uses: ./.github/workflows/nix-build.yml
uses: ./.github/workflows/nix.yml
secrets: inherit
with:
command: nix build 'github:hyprwm/Hyprland?ref=${{ github.ref }}' -L --extra-substituters "https://hyprland.cachix.org"
xdph:
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork)
needs: hyprland
uses: ./.github/workflows/nix.yml
secrets: inherit
with:
command: nix build 'github:hyprwm/Hyprland?ref=${{ github.ref }}#xdg-desktop-portal-hyprland' -L --extra-substituters "https://hyprland.cachix.org"
test:
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork)
needs: hyprland
uses: ./.github/workflows/nix-test.yml
secrets: inherit

59
.github/workflows/nix-test.yml vendored Normal file
View File

@@ -0,0 +1,59 @@
name: Nix (Test)
on:
workflow_call:
secrets:
CACHIX_AUTH_TOKEN:
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v31
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 5G
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: nix-${{ runner.os }}
# created more than this number of seconds ago
purge-created: 0
# or, last accessed more than this number of seconds ago
# relative to the start of the `Post Restore and save Nix store` phase
purge-last-accessed: 0
# except any version with the key that is the same as the `primary-key`
purge-primary-key: never
- uses: cachix/cachix-action@v15
with:
name: hyprland
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- name: Run test VM
run: nix build 'github:hyprwm/Hyprland?ref=${{ github.ref }}#checks.x86_64-linux.tests' -L --extra-substituters "https://hyprland.cachix.org"
- name: Check exit status
run: grep 0 result/exit_status
- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: logs
path: result

View File

@@ -13,15 +13,44 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
token: ${{ secrets.PAT }}
- uses: DeterminateSystems/nix-installer-action@main
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v31
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}-${{ hashFiles('**/*.nix', '**/flake.lock') }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}-
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 1G
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: nix-${{ runner.os }}-
# created more than this number of seconds ago
purge-created: 0
# or, last accessed more than this number of seconds ago
# relative to the start of the `Post Restore and save Nix store` phase
purge-last-accessed: 0
# except any version with the key that is the same as the `primary-key`
purge-primary-key: never
- name: Update inputs
run: nix/update-inputs.sh
- name: Commit
uses: stefanzweifel/git-auto-commit-action@v4
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "[gha] Nix: update inputs"

53
.github/workflows/nix.yml vendored Normal file
View File

@@ -0,0 +1,53 @@
name: Build
on:
workflow_call:
inputs:
command:
required: true
type: string
description: Command to run
secrets:
CACHIX_AUTH_TOKEN:
required: false
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Install Nix
uses: nixbuild/nix-quick-install-action@v31
with:
nix_conf: |
keep-env-derivations = true
keep-outputs = true
- name: Restore and save Nix store
uses: nix-community/cache-nix-action@v6
with:
# restore and save a cache using this key
primary-key: nix-${{ runner.os }}
# if there's no cache hit, restore a cache by this prefix
restore-prefixes-first-match: nix-${{ runner.os }}
# collect garbage until the Nix store size (in bytes) is at most this number
# before trying to save a new cache
# 1G = 1073741824
gc-max-store-size-linux: 5G
# do purge caches
purge: true
# purge all versions of the cache
purge-prefixes: nix-${{ runner.os }}
# created more than this number of seconds ago
purge-created: 0
# or, last accessed more than this number of seconds ago
# relative to the start of the `Post Restore and save Nix store` phase
purge-last-accessed: 0
# except any version with the key that is the same as the `primary-key`
purge-primary-key: never
- uses: cachix/cachix-action@v15
with:
name: hyprland
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
- run: ${{ inputs.command }}

View File

@@ -11,7 +11,7 @@ jobs:
steps:
- name: Checkout Hyprland
id: checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive
@@ -20,7 +20,6 @@ jobs:
run: |
git fetch --unshallow || echo "failed unshallowing"
bash -c scripts/generateVersion.sh
mv scripts/generateVersion.sh scripts/generateVersion.sh.bak
- name: Create tarball with submodules
id: tar

View File

@@ -13,7 +13,7 @@ jobs:
security-events: write
steps:
- name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Scan with Flawfinder
uses: david-a-wheeler/flawfinder@8e4a779ad59dbfaee5da586aa9210853b701959c

View File

@@ -1,28 +0,0 @@
# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time.
#
# You can adjust the behavior by modifying this file.
# For more information, see:
# https://github.com/actions/stale
name: Mark stale issues and pull requests
on:
schedule:
- cron: "7 */4 * * *"
workflow_dispatch:
jobs:
stale:
if: github.repository == 'hyprwm/Hyprland'
runs-on: ubuntu-latest
permissions:
issues: write
pull-requests: write
steps:
- uses: actions/stale@v5
with:
repo-token: ${{ secrets.STALEBOT_PAT }}
stale-issue-label: "stale"
stale-pr-label: "stale"
operations-per-run: 40
days-before-close: -1

6
.gitignore vendored
View File

@@ -14,6 +14,7 @@ _deps
build/
result*
/.pre-commit-config.yaml
/.vscode/
/.idea/
.envrc
@@ -27,6 +28,8 @@ protocols/*.c*
protocols/*.h*
.ccls-cache
*.so
src/render/shaders/*.inc
src/render/shaders/Shaders.hpp
hyprctl/hyprctl
@@ -39,3 +42,6 @@ PKGBUILD
src/version.h
hyprpm/Makefile
hyprctl/Makefile
**/.#*.*
**/#*.*#

View File

@@ -9,12 +9,14 @@ project(
DESCRIPTION "A Modern C++ Wayland Compositor"
VERSION ${VER})
include(CTest)
include(CheckIncludeFile)
include(GNUInstallDirs)
set(HYPRLAND_VERSION ${VER})
set(PREFIX ${CMAKE_INSTALL_PREFIX})
set(INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
set(BINDIR ${CMAKE_INSTALL_BINDIR})
configure_file(hyprland.pc.in hyprland.pc @ONLY)
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
@@ -24,6 +26,9 @@ message(STATUS "Gathering git info")
# Get git info hash and branch
execute_process(COMMAND ./scripts/generateVersion.sh
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
# Make shader files includable
execute_process(COMMAND ./scripts/generateShaderIncludes.sh
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
find_package(PkgConfig REQUIRED)
@@ -71,17 +76,23 @@ else()
message(STATUS "Configuring Hyprland in Release with CMake")
endif()
add_compile_definitions(HYPRLAND_VERSION="${HYPRLAND_VERSION}")
include_directories(. "src/" "protocols/")
set(CMAKE_CXX_STANDARD 26)
set(CXX_STANDARD_REQUIRED ON)
add_compile_options(
-Wall
-Wextra
-Wpedantic
-Wno-unused-parameter
-Wno-unused-value
-Wno-missing-field-initializers
-Wno-gnu-zero-variadic-macro-arguments
-Wno-narrowing
-Wno-pointer-arith
-Wno-clobbered
-fmacro-prefix-map=${CMAKE_SOURCE_DIR}/=)
set(CMAKE_EXECUTABLE_ENABLE_EXPORTS TRUE)
@@ -91,18 +102,28 @@ message(STATUS "Checking deps...")
find_package(Threads REQUIRED)
if(LEGACY_RENDERER)
set(GLES_VERSION "GLES2")
else()
set(GLES_VERSION "GLES3")
endif()
set(GLES_VERSION "GLES3")
find_package(OpenGL REQUIRED COMPONENTS ${GLES_VERSION})
pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.1)
pkg_check_modules(aquamarine_dep REQUIRED IMPORTED_TARGET aquamarine>=0.9.0)
pkg_check_modules(hyprlang_dep REQUIRED IMPORTED_TARGET hyprlang>=0.3.2)
pkg_check_modules(hyprcursor_dep REQUIRED IMPORTED_TARGET hyprcursor>=0.1.7)
pkg_check_modules(hyprutils_dep REQUIRED IMPORTED_TARGET hyprutils>=0.8.1)
pkg_check_modules(hyprgraphics_dep REQUIRED IMPORTED_TARGET hyprgraphics>=0.1.3)
pkg_check_modules(aquamarine_dep REQUIRED IMPORTED_TARGET aquamarine)
string(REPLACE "." ";" AQ_VERSION_LIST ${aquamarine_dep_VERSION})
list(GET AQ_VERSION_LIST 0 AQ_VERSION_MAJOR)
list(GET AQ_VERSION_LIST 1 AQ_VERSION_MINOR)
list(GET AQ_VERSION_LIST 2 AQ_VERSION_PATCH)
add_compile_definitions(AQUAMARINE_VERSION="${aquamarine_dep_VERSION}")
add_compile_definitions(AQUAMARINE_VERSION_MAJOR=${AQ_VERSION_MAJOR})
add_compile_definitions(AQUAMARINE_VERSION_MINOR=${AQ_VERSION_MINOR})
add_compile_definitions(AQUAMARINE_VERSION_PATCH=${AQ_VERSION_PATCH})
add_compile_definitions(HYPRLANG_VERSION="${hyprlang_dep_VERSION}")
add_compile_definitions(HYPRUTILS_VERSION="${hyprutils_dep_VERSION}")
add_compile_definitions(HYPRCURSOR_VERSION="${hyprcursor_dep_VERSION}")
add_compile_definitions(HYPRGRAPHICS_VERSION="${hyprgraphics_dep_VERSION}")
pkg_check_modules(
deps
@@ -111,19 +132,17 @@ pkg_check_modules(
xkbcommon
uuid
wayland-server>=1.22.90
wayland-protocols
wayland-protocols>=1.43
cairo
pango
pangocairo
pixman-1
xcursor
libdrm
libinput
libinput>=1.28
gbm
gio-2.0
hyprlang>=0.3.2
hyprcursor>=0.1.7
hyprutils>=0.2.3)
re2)
find_package(hyprwayland-scanner 0.3.10 REQUIRED)
@@ -137,7 +156,7 @@ endif()
add_executable(Hyprland ${SRCFILES} ${TRACY_CPP_FILES})
set(USE_GPROF ON)
set(USE_GPROF OFF)
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
message(STATUS "Setting debug flags")
@@ -190,9 +209,10 @@ if(NOT HAS_TIMERFD AND epoll_FOUND)
target_link_libraries(Hyprland PkgConfig::epoll)
endif()
if(LEGACY_RENDERER)
message(STATUS "Using the legacy GLES2 renderer!")
add_compile_definitions(LEGACY_RENDERER)
check_include_file("sys/inotify.h" HAS_INOTIFY)
pkg_check_modules(inotify IMPORTED_TARGET libinotify)
if(NOT HAS_INOTIFY AND inotify_FOUND)
target_link_libraries(Hyprland PkgConfig::inotify)
endif()
if(NO_XWAYLAND)
@@ -219,6 +239,15 @@ if(NO_SYSTEMD)
else()
message(STATUS "SYSTEMD support is requested (NO_SYSTEMD not defined)...")
add_compile_definitions(USES_SYSTEMD)
# session file -uwsm
if(NO_UWSM)
message(STATUS "UWSM support is disabled...")
else()
message(STATUS "UWSM support is enabled (NO_UWSM not defined)...")
install(FILES ${CMAKE_SOURCE_DIR}/systemd/hyprland-uwsm.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions)
endif()
endif()
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
@@ -232,7 +261,15 @@ target_precompile_headers(Hyprland PRIVATE
message(STATUS "Setting link libraries")
target_link_libraries(Hyprland rt PkgConfig::aquamarine_dep PkgConfig::deps)
target_link_libraries(
Hyprland
rt
PkgConfig::aquamarine_dep
PkgConfig::hyprlang_dep
PkgConfig::hyprutils_dep
PkgConfig::hyprcursor_dep
PkgConfig::hyprgraphics_dep
PkgConfig::deps)
if(udis_dep_FOUND)
target_link_libraries(Hyprland PkgConfig::udis_dep)
else()
@@ -274,7 +311,7 @@ endfunction()
target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads)
pkg_check_modules(hyprland_protocols_dep hyprland-protocols>=0.2.0)
pkg_check_modules(hyprland_protocols_dep hyprland-protocols>=0.6.4)
if(hyprland_protocols_dep_FOUND)
pkg_get_variable(HYPRLAND_PROTOCOLS hyprland-protocols pkgdatadir)
message(STATUS "hyprland-protocols dependency set to ${HYPRLAND_PROTOCOLS}")
@@ -300,7 +337,15 @@ protocolnew("protocols" "kde-server-decoration" true)
protocolnew("protocols" "wlr-data-control-unstable-v1" true)
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-focus-grab-v1" true)
protocolnew("protocols" "wlr-layer-shell-unstable-v1" true)
protocolnew("protocols" "xx-color-management-v4" true)
protocolnew("protocols" "frog-color-management-v1" true)
protocolnew("protocols" "wayland-drm" true)
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-ctm-control-v1" true)
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-surface-v1" true)
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-lock-notify-v1" true)
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-toplevel-mapping-v1"
true)
protocolnew("staging/tearing-control" "tearing-control-v1" false)
protocolnew("staging/fractional-scale" "fractional-scale-v1" false)
protocolnew("unstable/xdg-output" "xdg-output-unstable-v1" false)
@@ -331,12 +376,30 @@ protocolnew("staging/drm-lease" "drm-lease-v1" false)
protocolnew("staging/linux-drm-syncobj" "linux-drm-syncobj-v1" false)
protocolnew("staging/xdg-dialog" "xdg-dialog-v1" false)
protocolnew("staging/single-pixel-buffer" "single-pixel-buffer-v1" false)
protocolnew("staging/security-context" "security-context-v1" false)
protocolnew("staging/content-type" "content-type-v1" false)
protocolnew("staging/color-management" "color-management-v1" false)
protocolnew("staging/xdg-toplevel-tag" "xdg-toplevel-tag-v1" false)
protocolnew("staging/xdg-system-bell" "xdg-system-bell-v1" false)
protocolnew("staging/ext-workspace" "ext-workspace-v1" false)
protocolwayland()
# tools
add_subdirectory(hyprctl)
add_subdirectory(hyprpm)
if(NO_HYPRPM)
message(STATUS "hyprpm is disabled")
else()
add_subdirectory(hyprpm)
message(STATUS "hyprpm is enabled (NO_HYPRPM not defined)")
endif()
if(NO_TESTS)
message(STATUS "building tests is disabled")
else()
message(STATUS "building tests is enabled (NO_TESTS not defined)")
endif()
# binary and symlink
install(TARGETS Hyprland)
@@ -347,7 +410,6 @@ install(
${CMAKE_INSTALL_FULL_BINDIR}/Hyprland \
\"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/hyprland\" \
)")
# session file
install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.desktop
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions)
@@ -391,4 +453,19 @@ install(
DIRECTORY ${HEADERS_SRC}
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland
FILES_MATCHING
PATTERN "*.h*")
PATTERN "*.h"
PATTERN "*.hpp"
PATTERN "*.inc")
if(TESTS)
enable_testing()
add_custom_target(tests)
add_subdirectory(hyprtester)
add_test(
NAME "Main Test"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/hyprtester
COMMAND hyprtester)
add_dependencies(tests hyprtester)
endif()

View File

@@ -1,12 +1,7 @@
PREFIX = /usr/local
legacyrenderer:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./buildZ
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
legacyrendererdebug:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
stub:
@echo "Do not run $(MAKE) directly without any arguments. Please refer to the wiki on how to compile Hyprland."
release:
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build
@@ -49,7 +44,7 @@ installheaders:
cmake --build ./build --config Release --target generate-protocol-headers
find src -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland
find src -type f \( -name '*.hpp' -o -name '*.h' -o -name '*.inc' \) -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland
cp ./protocols/*.h* ${PREFIX}/include/hyprland/protocols
cp ./build/hyprland.pc ${PREFIX}/share/pkgconfig
if [ -d /usr/share/pkgconfig ]; then cp ./build/hyprland.pc /usr/share/pkgconfig 2>/dev/null || true; fi

View File

@@ -4,7 +4,7 @@
<br>
![Badge Workflow]
[![Badge Workflow]][Workflow]
[![Badge License]][License]
![Badge Language]
[![Badge Pull Requests]][Pull Requests]
@@ -100,7 +100,7 @@ easy IPC, much more QoL stuff than other compositors and more...
<!----------------------------------------------------------------------------->
[Configure]: https://wiki.hyprland.org/Configuring/Configuring-Hyprland/
[Configure]: https://wiki.hypr.land/Configuring/
[Stars]: https://starchart.cc/hyprwm/Hyprland
[Hypr]: https://github.com/hyprwm/Hypr
@@ -108,9 +108,10 @@ easy IPC, much more QoL stuff than other compositors and more...
[Issues]: https://github.com/hyprwm/Hyprland/issues
[Todo]: https://github.com/hyprwm/Hyprland/projects?type=beta
[Contribute]: https://wiki.hyprland.org/Contributing-and-Debugging/
[Install]: https://wiki.hyprland.org/Getting-Started/Installation/
[Quick Start]: https://wiki.hyprland.org/Getting-Started/Master-Tutorial/
[Contribute]: https://wiki.hypr.land/Contributing-and-Debugging/
[Install]: https://wiki.hypr.land/Getting-Started/Installation/
[Quick Start]: https://wiki.hypr.land/Getting-Started/Master-Tutorial/
[Workflow]: https://github.com/hyprwm/Hyprland/actions/workflows/ci.yaml
[License]: LICENSE
@@ -125,9 +126,9 @@ easy IPC, much more QoL stuff than other compositors and more...
<!----------------------------------{ Images }--------------------------------->
[Preview A]: https://i.ibb.co/C1yTb0r/falf.png
[Preview B]: https://linfindel.github.io/cdn/hyprland-preview-b.png
[Preview C]: https://i.ibb.co/B3GJg28/20221126-20h53m26s-grim.png
[Preview A]: https://i.ibb.co/XxFY75Mk/greerggergerhtrytghjnyhjn.png
[Preview B]: https://i.ibb.co/C1yTb0r/falf.png
[Preview C]: https://i.ibb.co/2Yc4q835/hyprland-preview-b.png
<!----------------------------------{ Badges }--------------------------------->

32
SECURITY.md Normal file
View File

@@ -0,0 +1,32 @@
# Hyprland Development Security Policy
If you have a bug that affects the security of your system, you may
want to privately disclose it instead of making it immediately public.
## Supported versions
_Only_ the most recent release on Github is supported. There are no LTS releases.
## What is not a security issue
Some examples of issues that should not be reported as security issues:
- An app can execute a command when ran outside of a sandbox
- An app can write / read hyprland sockets when ran outside of a sandbox
- Crashes
- Things that are protected via permissions when the permission system is disabled
## What is a security issue
Some examples of issues that should be reported as security issues:
- Sandboxed application executing arbitrary code via Hyprland
- Application being able to modify Hyprland's code on the fly
- Application being able to keylog / track user's activity beyond what the wayland protocols allow
## How to report security issues
Please report your security issues via either of these channels:
- Mail: `vaxry [at] vaxry [dot] net`
- Matrix: `@vaxry:matrix.vaxry.net`
- Discord: `@vaxry`

View File

@@ -1 +1 @@
0.44.0
0.50.0

File diff suppressed because one or more lines are too long

Before

Width:  |  Height:  |  Size: 506 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@@ -1,5 +1,19 @@
.\" Automatically generated by Pandoc 2.9.2.1
.\" Automatically generated by Pandoc 3.1.3
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "Hyprland" "1" "" "" "Hyprland User Manual"
.hy
.SH NAME

View File

@@ -2,15 +2,15 @@
First of all, please remember to:
- Check that your issue is not a duplicate
- Read the [FAQ](https://wiki.hyprland.org/FAQ/)
- Read the [Configuring Page](https://wiki.hyprland.org/Configuring/Configuring-Hyprland)
- Read the [FAQ](https://wiki.hypr.land/FAQ/)
- Read the [Configuring Page](https://wiki.hypr.land/Configuring/)
<br/>
# Reporting suggestions
Suggestions are welcome.
Many features can be implemented using bash scripts and Hyprland sockets, read up on those [Here](https://wiki.hyprland.org/IPC). Please do not suggest features that can be implemented as such.
Many features can be implemented using bash scripts and Hyprland sockets, read up on those [Here](https://wiki.hypr.land/IPC). Please do not suggest features that can be implemented as such.
<br/>
@@ -70,7 +70,7 @@ A debug coredump provides more information for debugging and may speed up the pr
Make sure you're on latest git. Run `git pull --recurse-submodules` to sync everything.
1. [Compile Hyprland with debug mode](http://wiki.hyprland.org/Contributing-and-Debugging/#build-in-debug-mode)
1. [Compile Hyprland with debug mode](http://wiki.hypr.land/Contributing-and-Debugging/#build-in-debug-mode)
> Note: The config file used will be `hyprlandd.conf` instead of `hyprland.conf`
2. `cd ~`

View File

@@ -1,5 +1,19 @@
.\" Automatically generated by Pandoc 2.9.2.1
.\" Automatically generated by Pandoc 3.1.3
.\"
.\" Define V font for inline verbatim, using C font in formats
.\" that render this, and otherwise B font.
.ie "\f[CB]x\f[]"x" \{\
. ftr V B
. ftr VI BI
. ftr VB B
. ftr VBI BI
.\}
.el \{\
. ftr V CR
. ftr VI CI
. ftr VB CB
. ftr VBI CBI
.\}
.TH "hyprctl" "1" "" "" "hyprctl User Manual"
.hy
.SH NAME

View File

@@ -1,14 +0,0 @@
[Unit]
Description=Hyprland - Tiling compositor with the looks
Documentation=man:Hyprland(1)
BindsTo=graphical-session.target
Before=graphical-session.target
Wants=graphical-session-pre.target
After=graphical-session-pre.target
[Service]
Type=notify
ExecStart=/usr/bin/Hyprland
ExecStop=/usr/bin/hyprctl dispatch exit
Restart=on-failure
Slice=session.slice

View File

@@ -1,5 +0,0 @@
[Desktop Entry]
Name=Hyprland
Comment=An intelligent dynamic tiling Wayland compositor
Exec=systemctl --user start --wait hyprland-session
Type=Application

View File

@@ -1,6 +1,6 @@
# This is an example Hyprland config file.
# Refer to the wiki for more information.
# https://wiki.hyprland.org/Configuring/Configuring-Hyprland/
# https://wiki.hypr.land/Configuring/
# Please note not all available settings / options are set here.
# For a full list, see the wiki
@@ -14,7 +14,7 @@
### MONITORS ###
################
# See https://wiki.hyprland.org/Configuring/Monitors/
# See https://wiki.hypr.land/Configuring/Monitors/
monitor=,preferred,auto,auto
@@ -22,7 +22,7 @@ monitor=,preferred,auto,auto
### MY PROGRAMS ###
###################
# See https://wiki.hyprland.org/Configuring/Keywords/
# See https://wiki.hypr.land/Configuring/Keywords/
# Set programs that you use
$terminal = kitty
@@ -46,52 +46,72 @@ $menu = wofi --show drun
### ENVIRONMENT VARIABLES ###
#############################
# See https://wiki.hyprland.org/Configuring/Environment-variables/
# See https://wiki.hypr.land/Configuring/Environment-variables/
env = XCURSOR_SIZE,24
env = HYPRCURSOR_SIZE,24
###################
### PERMISSIONS ###
###################
# See https://wiki.hypr.land/Configuring/Permissions/
# Please note permission changes here require a Hyprland restart and are not applied on-the-fly
# for security reasons
# ecosystem {
# enforce_permissions = 1
# }
# permission = /usr/(bin|local/bin)/grim, screencopy, allow
# permission = /usr/(lib|libexec|lib64)/xdg-desktop-portal-hyprland, screencopy, allow
# permission = /usr/(bin|local/bin)/hyprpm, plugin, allow
#####################
### LOOK AND FEEL ###
#####################
# Refer to https://wiki.hyprland.org/Configuring/Variables/
# Refer to https://wiki.hypr.land/Configuring/Variables/
# https://wiki.hyprland.org/Configuring/Variables/#general
# https://wiki.hypr.land/Configuring/Variables/#general
general {
gaps_in = 5
gaps_out = 20
border_size = 2
# https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
# https://wiki.hypr.land/Configuring/Variables/#variable-types for info about colors
col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
col.inactive_border = rgba(595959aa)
# Set to true enable resizing windows by clicking and dragging on borders and gaps
resize_on_border = false
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
# Please see https://wiki.hypr.land/Configuring/Tearing/ before you turn this on
allow_tearing = false
layout = dwindle
}
# https://wiki.hyprland.org/Configuring/Variables/#decoration
# https://wiki.hypr.land/Configuring/Variables/#decoration
decoration {
rounding = 10
rounding_power = 2
# Change transparency of focused and unfocused windows
active_opacity = 1.0
inactive_opacity = 1.0
drop_shadow = true
shadow_range = 4
shadow_render_power = 3
col.shadow = rgba(1a1a1aee)
shadow {
enabled = true
range = 4
render_power = 3
color = rgba(1a1a1aee)
}
# https://wiki.hyprland.org/Configuring/Variables/#blur
# https://wiki.hypr.land/Configuring/Variables/#blur
blur {
enabled = true
size = 3
@@ -101,34 +121,59 @@ decoration {
}
}
# https://wiki.hyprland.org/Configuring/Variables/#animations
# https://wiki.hypr.land/Configuring/Variables/#animations
animations {
enabled = true
enabled = yes, please :)
# Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
# Default animations, see https://wiki.hypr.land/Configuring/Animations/ for more
bezier = myBezier, 0.05, 0.9, 0.1, 1.05
bezier = easeOutQuint,0.23,1,0.32,1
bezier = easeInOutCubic,0.65,0.05,0.36,1
bezier = linear,0,0,1,1
bezier = almostLinear,0.5,0.5,0.75,1.0
bezier = quick,0.15,0,0.1,1
animation = windows, 1, 7, myBezier
animation = windowsOut, 1, 7, default, popin 80%
animation = border, 1, 10, default
animation = borderangle, 1, 8, default
animation = fade, 1, 7, default
animation = workspaces, 1, 6, default
animation = global, 1, 10, default
animation = border, 1, 5.39, easeOutQuint
animation = windows, 1, 4.79, easeOutQuint
animation = windowsIn, 1, 4.1, easeOutQuint, popin 87%
animation = windowsOut, 1, 1.49, linear, popin 87%
animation = fadeIn, 1, 1.73, almostLinear
animation = fadeOut, 1, 1.46, almostLinear
animation = fade, 1, 3.03, quick
animation = layers, 1, 3.81, easeOutQuint
animation = layersIn, 1, 4, easeOutQuint, fade
animation = layersOut, 1, 1.5, linear, fade
animation = fadeLayersIn, 1, 1.79, almostLinear
animation = fadeLayersOut, 1, 1.39, almostLinear
animation = workspaces, 1, 1.94, almostLinear, fade
animation = workspacesIn, 1, 1.21, almostLinear, fade
animation = workspacesOut, 1, 1.94, almostLinear, fade
animation = zoomFactor, 1, 7, quick
}
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
# Ref https://wiki.hypr.land/Configuring/Workspace-Rules/
# "Smart gaps" / "No gaps when only"
# uncomment all if you wish to use that.
# workspace = w[tv1], gapsout:0, gapsin:0
# workspace = f[1], gapsout:0, gapsin:0
# windowrule = bordersize 0, floating:0, onworkspace:w[tv1]
# windowrule = rounding 0, floating:0, onworkspace:w[tv1]
# windowrule = bordersize 0, floating:0, onworkspace:f[1]
# windowrule = rounding 0, floating:0, onworkspace:f[1]
# See https://wiki.hypr.land/Configuring/Dwindle-Layout/ for more
dwindle {
pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true # You probably want this
}
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
# See https://wiki.hypr.land/Configuring/Master-Layout/ for more
master {
new_status = master
}
# https://wiki.hyprland.org/Configuring/Variables/#misc
# https://wiki.hypr.land/Configuring/Variables/#misc
misc {
force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers
disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :(
@@ -139,7 +184,7 @@ misc {
### INPUT ###
#############
# https://wiki.hyprland.org/Configuring/Variables/#input
# https://wiki.hypr.land/Configuring/Variables/#input
input {
kb_layout = us
kb_variant =
@@ -156,13 +201,13 @@ input {
}
}
# https://wiki.hyprland.org/Configuring/Variables/#gestures
# https://wiki.hypr.land/Configuring/Variables/#gestures
gestures {
workspace_swipe = false
}
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more
# See https://wiki.hypr.land/Configuring/Keywords/#per-device-input-configs for more
device {
name = epic-mouse-v1
sensitivity = -0.5
@@ -173,10 +218,10 @@ device {
### KEYBINDINGS ###
###################
# See https://wiki.hyprland.org/Configuring/Keywords/
# See https://wiki.hypr.land/Configuring/Keywords/
$mainMod = SUPER # Sets "Windows" key as main modifier
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
# Example binds, see https://wiki.hypr.land/Configuring/Binds/ for more
bind = $mainMod, Q, exec, $terminal
bind = $mainMod, C, killactive,
bind = $mainMod, M, exit,
@@ -233,8 +278,8 @@ bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+
bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-
bindel = ,XF86MonBrightnessUp, exec, brightnessctl -e4 -n2 set 5%+
bindel = ,XF86MonBrightnessDown, exec, brightnessctl -e4 -n2 set 5%-
# Requires playerctl
bindl = , XF86AudioNext, exec, playerctl next
@@ -246,13 +291,14 @@ bindl = , XF86AudioPrev, exec, playerctl previous
### WINDOWS AND WORKSPACES ###
##############################
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules
# See https://wiki.hypr.land/Configuring/Window-Rules/ for more
# See https://wiki.hypr.land/Configuring/Workspace-Rules/ for workspace rules
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule
# windowrule = float,class:^(kitty)$,title:^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# Ignore maximize requests from apps. You'll probably like this.
windowrule = suppressevent maximize, class:.*
windowrulev2 = suppressevent maximize, class:.* # You'll probably like this.
# Fix some dragging issues with XWayland
windowrule = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0

View File

@@ -2,4 +2,6 @@
Name=Hyprland
Comment=An intelligent dynamic tiling Wayland compositor
Exec=Hyprland
Type=Application
Type=Application
DesktopNames=Hyprland
Keywords=tiling;wayland;compositor;

View File

@@ -22,5 +22,6 @@
}
]
},
]
}

View File

@@ -1,16 +1,19 @@
//
// Example blue light filter shader.
//
//
#version 300 es
precision mediump float;
varying vec2 v_texcoord;
in vec2 v_texcoord;
layout(location = 0) out vec4 fragColor;
uniform sampler2D tex;
void main() {
vec4 pixColor = texture2D(tex, v_texcoord);
vec4 pixColor = texture(tex, v_texcoord);
pixColor[2] *= 0.8;
gl_FragColor = pixColor;
fragColor = pixColor;
}

192
flake.lock generated
View File

@@ -16,11 +16,11 @@
]
},
"locked": {
"lastModified": 1727261104,
"narHash": "sha256-rxDI7WrxIRV9it9mDCHcLa7xQykf1JloXnoXr5xQ8zI=",
"lastModified": 1752743471,
"narHash": "sha256-4izhj1j7J4mE8LgljCXSIUDculqOsxxhdoC81VhqizM=",
"owner": "hyprwm",
"repo": "aquamarine",
"rev": "b82fdaff917582a9d568969e15e61b398c71e990",
"rev": "e31b575d19e7cf8a8f4398e2f9cffe27a1332506",
"type": "github"
},
"original": {
@@ -29,6 +29,43 @@
"type": "github"
}
},
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1696426674,
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"gitignore": {
"inputs": {
"nixpkgs": [
"pre-commit-hooks",
"nixpkgs"
]
},
"locked": {
"lastModified": 1709087332,
"narHash": "sha256-HG2cCnktfHsKV0s4XW83gU3F57gaTljL9KNSuG6bnQs=",
"owner": "hercules-ci",
"repo": "gitignore.nix",
"rev": "637db329424fd7e46cf4185293b9cc8c88c95394",
"type": "github"
},
"original": {
"owner": "hercules-ci",
"repo": "gitignore.nix",
"type": "github"
}
},
"hyprcursor": {
"inputs": {
"hyprlang": [
@@ -42,11 +79,11 @@
]
},
"locked": {
"lastModified": 1727532803,
"narHash": "sha256-ZaZ7h7PY8mQc4vtGmVqWLAq9CAO02gHMyNR5yY8zDmM=",
"lastModified": 1749155331,
"narHash": "sha256-XR9fsI0zwLiFWfqi/pdS/VD+YNorKb3XIykgTg4l1nA=",
"owner": "hyprwm",
"repo": "hyprcursor",
"rev": "b98726e431d4d3ed58bd58bee1047cdb81cec69f",
"rev": "45fcc10b4c282746d93ec406a740c43b48b4ef80",
"type": "github"
},
"original": {
@@ -55,6 +92,32 @@
"type": "github"
}
},
"hyprgraphics": {
"inputs": {
"hyprutils": [
"hyprutils"
],
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1752149140,
"narHash": "sha256-gbh1HL98Fdqu0jJIWN4OJQN7Kkth7+rbkFpSZLm/62A=",
"owner": "hyprwm",
"repo": "hyprgraphics",
"rev": "340494a38b5ec453dfc542c6226481f736cc8a9a",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprgraphics",
"type": "github"
}
},
"hyprland-protocols": {
"inputs": {
"nixpkgs": [
@@ -65,11 +128,11 @@
]
},
"locked": {
"lastModified": 1727451107,
"narHash": "sha256-qV9savtHwmZUa0eJE294WYJjKPGB2+bJhwByFShsVyo=",
"lastModified": 1749046714,
"narHash": "sha256-kymV5FMnddYGI+UjwIw8ceDjdeg7ToDVjbHCvUlhn14=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "6b3261ee13a6d2b99de79a31d352f6996e35bde3",
"rev": "613878cb6f459c5e323aaafe1e6f388ac8a36330",
"type": "github"
},
"original": {
@@ -78,28 +141,64 @@
"type": "github"
}
},
"hyprland-protocols_2": {
"hyprland-qt-support": {
"inputs": {
"hyprlang": [
"hyprland-qtutils",
"hyprlang"
],
"nixpkgs": [
"xdph",
"hyprland-qtutils",
"nixpkgs"
],
"systems": [
"xdph",
"hyprland-qtutils",
"systems"
]
},
"locked": {
"lastModified": 1721326555,
"narHash": "sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg=",
"lastModified": 1749154592,
"narHash": "sha256-DO7z5CeT/ddSGDEnK9mAXm1qlGL47L3VAHLlLXoCjhE=",
"owner": "hyprwm",
"repo": "hyprland-protocols",
"rev": "5a11232266bf1a1f5952d5b179c3f4b2facaaa84",
"repo": "hyprland-qt-support",
"rev": "4c8053c3c888138a30c3a6c45c2e45f5484f2074",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-protocols",
"repo": "hyprland-qt-support",
"type": "github"
}
},
"hyprland-qtutils": {
"inputs": {
"hyprland-qt-support": "hyprland-qt-support",
"hyprlang": [
"hyprlang"
],
"hyprutils": [
"hyprland-qtutils",
"hyprlang",
"hyprutils"
],
"nixpkgs": [
"nixpkgs"
],
"systems": [
"systems"
]
},
"locked": {
"lastModified": 1750371812,
"narHash": "sha256-D868K1dVEACw17elVxRgXC6hOxY+54wIEjURztDWLk8=",
"owner": "hyprwm",
"repo": "hyprland-qtutils",
"rev": "b13c7481e37856f322177010bdf75fccacd1adc8",
"type": "github"
},
"original": {
"owner": "hyprwm",
"repo": "hyprland-qtutils",
"type": "github"
}
},
@@ -116,11 +215,11 @@
]
},
"locked": {
"lastModified": 1725997860,
"narHash": "sha256-d/rZ/fHR5l1n7PeyLw0StWMNLXVU9c4HFyfskw568so=",
"lastModified": 1750371198,
"narHash": "sha256-/iuJ1paQOBoSLqHflRNNGyroqfF/yvPNurxzcCT0cAE=",
"owner": "hyprwm",
"repo": "hyprlang",
"rev": "dfeb5811dd6485490cce18d6cc1e38a055eea876",
"rev": "cee01452bca58d6cadb3224e21e370de8bc20f0b",
"type": "github"
},
"original": {
@@ -139,11 +238,11 @@
]
},
"locked": {
"lastModified": 1727300645,
"narHash": "sha256-OvAtVLaSRPnbXzOwlR1fVqCXR7i+ICRX3aPMCdIiv+c=",
"lastModified": 1752252310,
"narHash": "sha256-06i1pIh6wb+sDeDmWlzuPwIdaFMxLlj1J9I5B9XqSeo=",
"owner": "hyprwm",
"repo": "hyprutils",
"rev": "3f5293432b6dc6a99f26aca2eba3876d2660665c",
"rev": "bcabcbada90ed2aacb435dc09b91001819a6dc82",
"type": "github"
},
"original": {
@@ -162,11 +261,11 @@
]
},
"locked": {
"lastModified": 1726874836,
"narHash": "sha256-VKR0sf0PSNCB0wPHVKSAn41mCNVCnegWmgkrneKDhHM=",
"lastModified": 1751897909,
"narHash": "sha256-FnhBENxihITZldThvbO7883PdXC/2dzW4eiNvtoV5Ao=",
"owner": "hyprwm",
"repo": "hyprwayland-scanner",
"rev": "500c81a9e1a76760371049a8d99e008ea77aa59e",
"rev": "fcca0c61f988a9d092cbb33e906775014c61579d",
"type": "github"
},
"original": {
@@ -177,11 +276,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1727348695,
"narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=",
"lastModified": 1752687322,
"narHash": "sha256-RKwfXA4OZROjBTQAl9WOZQFm7L8Bo93FQwSJpAiSRvo=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784",
"rev": "6e987485eb2c77e5dcc5af4e3c70843711ef9251",
"type": "github"
},
"original": {
@@ -191,15 +290,40 @@
"type": "github"
}
},
"pre-commit-hooks": {
"inputs": {
"flake-compat": "flake-compat",
"gitignore": "gitignore",
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1750779888,
"narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=",
"owner": "cachix",
"repo": "git-hooks.nix",
"rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d",
"type": "github"
},
"original": {
"owner": "cachix",
"repo": "git-hooks.nix",
"type": "github"
}
},
"root": {
"inputs": {
"aquamarine": "aquamarine",
"hyprcursor": "hyprcursor",
"hyprgraphics": "hyprgraphics",
"hyprland-protocols": "hyprland-protocols",
"hyprland-qtutils": "hyprland-qtutils",
"hyprlang": "hyprlang",
"hyprutils": "hyprutils",
"hyprwayland-scanner": "hyprwayland-scanner",
"nixpkgs": "nixpkgs",
"pre-commit-hooks": "pre-commit-hooks",
"systems": "systems",
"xdph": "xdph"
}
@@ -221,7 +345,9 @@
},
"xdph": {
"inputs": {
"hyprland-protocols": "hyprland-protocols_2",
"hyprland-protocols": [
"hyprland-protocols"
],
"hyprlang": [
"hyprlang"
],
@@ -239,11 +365,11 @@
]
},
"locked": {
"lastModified": 1727524473,
"narHash": "sha256-1DGktDtSWIJpnDbVoj/qpvJSH5zg6JbOfuh6xqZMap0=",
"lastModified": 1751300244,
"narHash": "sha256-PFuv1TZVYvQhha0ac53E3YgdtmLShrN0t4T6xqHl0jE=",
"owner": "hyprwm",
"repo": "xdg-desktop-portal-hyprland",
"rev": "7e500e679ede40e79cf2d89b5f5fa3e34923bd26",
"rev": "6115f3fdcb2c1a57b4a80a69f3c797e47607b90a",
"type": "github"
},
"original": {

View File

@@ -22,12 +22,26 @@
inputs.hyprlang.follows = "hyprlang";
};
hyprgraphics = {
url = "github:hyprwm/hyprgraphics";
inputs.nixpkgs.follows = "nixpkgs";
inputs.systems.follows = "systems";
inputs.hyprutils.follows = "hyprutils";
};
hyprland-protocols = {
url = "github:hyprwm/hyprland-protocols";
inputs.nixpkgs.follows = "nixpkgs";
inputs.systems.follows = "systems";
};
hyprland-qtutils = {
url = "github:hyprwm/hyprland-qtutils";
inputs.nixpkgs.follows = "nixpkgs";
inputs.systems.follows = "systems";
inputs.hyprlang.follows = "hyprlang";
};
hyprlang = {
url = "github:hyprwm/hyprlang";
inputs.nixpkgs.follows = "nixpkgs";
@@ -51,10 +65,16 @@
url = "github:hyprwm/xdg-desktop-portal-hyprland";
inputs.nixpkgs.follows = "nixpkgs";
inputs.systems.follows = "systems";
inputs.hyprland-protocols.follows = "hyprland-protocols";
inputs.hyprlang.follows = "hyprlang";
inputs.hyprutils.follows = "hyprutils";
inputs.hyprwayland-scanner.follows = "hyprwayland-scanner";
};
pre-commit-hooks = {
url = "github:cachix/git-hooks.nix";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = inputs @ {
@@ -76,12 +96,27 @@
pkgsCrossFor = eachSystem (system: crossSystem:
import nixpkgs {
localSystem = system;
crossSystem = crossSystem;
inherit crossSystem;
overlays = with self.overlays; [
hyprland-packages
hyprland-extras
];
});
pkgsDebugFor = eachSystem (system:
import nixpkgs {
localSystem = system;
overlays = with self.overlays; [
hyprland-debug
];
});
pkgsDebugCrossFor = eachSystem (system: crossSystem:
import nixpkgs {
localSystem = system;
inherit crossSystem;
overlays = with self.overlays; [
hyprland-debug
];
});
in {
overlays = import ./nix/overlays.nix {inherit self lib inputs;};
@@ -91,23 +126,35 @@
self.packages.${system})
// {
inherit (self.packages.${system}) xdg-desktop-portal-hyprland;
});
pre-commit-check = inputs.pre-commit-hooks.lib.${system}.run {
src = ./.;
hooks = {
hyprland-treewide-formatter = {
enable = true;
entry = "${self.formatter.${system}}/bin/hyprland-treewide-formatter";
pass_filenames = false;
excludes = ["subprojects"];
always_run = true;
};
};
};
}
// (import ./nix/tests inputs pkgsFor.${system}));
packages = eachSystem (system: {
default = self.packages.${system}.hyprland;
inherit
(pkgsFor.${system})
# hyprland-packages
hyprland
hyprland-debug
hyprland-legacy-renderer
hyprland-unwrapped
hyprtester
# hyprland-extras
xdg-desktop-portal-hyprland
;
inherit (pkgsDebugFor.${system}) hyprland-debug;
hyprland-cross = (pkgsCrossFor.${system} "aarch64-linux").hyprland;
hyprland-debug-cross = (pkgsDebugCrossFor.${system} "aarch64-linux").hyprland-debug;
});
devShells = eachSystem (system: {
@@ -119,12 +166,19 @@
hardeningDisable = ["fortify"];
inputsFrom = [pkgsFor.${system}.hyprland];
packages = [pkgsFor.${system}.clang-tools];
inherit (self.checks.${system}.pre-commit-check) shellHook;
};
});
formatter = eachSystem (system: nixpkgs.legacyPackages.${system}.alejandra);
formatter = eachSystem (system: pkgsFor.${system}.callPackage ./nix/formatter.nix {});
nixosModules.default = import ./nix/module.nix inputs;
homeManagerModules.default = import ./nix/hm-module.nix self;
# Hydra build jobs
# Recent versions of Hydra can aggregate jobsets from 'hydraJobs' instead of a release.nix
# or similar. Remember to filter large or incompatible attributes here. More eval jobs can
# be added by merging, e.g., self.packages // self.devShells.
hydraJobs = self.packages;
};
}

View File

@@ -5,7 +5,7 @@ project(
DESCRIPTION "Control utility for Hyprland"
)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET hyprutils>=0.1.1)
pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.4 re2)
add_executable(hyprctl "main.cpp")

View File

@@ -1,5 +1,7 @@
#pragma once
#include <string_view>
const std::string_view USAGE = R"#(usage: hyprctl [flags] <command> [args...|--help]
commands:
@@ -20,6 +22,7 @@ commands:
getoption <option> Gets the config option status (values)
globalshortcuts Lists all global shortcuts
hyprpaper ... Issue a hyprpaper request
hyprsunset ... Issue a hyprsunset request
instances Lists all running instances of Hyprland with
their info
keyword <name> <value> Issue a keyword to call a config keyword
@@ -79,6 +82,16 @@ requests:
flags:
See 'hyprctl --help')#";
const std::string_view HYPRSUNSET_HELP = R"#(usage: hyprctl [flags] hyprsunset <request>
requests:
temperature <temp> Enable blue-light filter
identity Disable blue-light filter
gamma <gamma> Enable gamma filter
flags:
See 'hyprctl --help')#";
const std::string_view NOTIFY_HELP = R"#(usage: hyprctl [flags] notify <icon> <time_ms> <color> <message...>
icon:
@@ -133,7 +146,7 @@ regex:
Regular expression by which a window will be searched
property:
See https://wiki.hyprland.org/Configuring/Using-hyprctl/#setprop for list
See https://wiki.hypr.land/Configuring/Using-hyprctl/#setprop for list
of properties
value:

View File

@@ -23,7 +23,7 @@ _hyprctl () {
local words cword
_get_comp_words_by_ref -n "$COMP_WORDBREAKS" words cword
declare -a literals=(resizeactive 2 changegroupactive -r moveintogroup forceallowsinput 4 ::= systeminfo all layouts setprop animationstyle switchxkblayout create denywindowfromgroup headless activebordercolor exec setcursor wayland focusurgentorlast workspacerules movecurrentworkspacetomonitor movetoworkspacesilent hyprpaper alpha inactivebordercolor movegroupwindow movecursortocorner movewindowpixel prev movewindow globalshortcuts clients dimaround setignoregrouplock splash execr monitors 0 forcenoborder -q animations 1 nomaxsize splitratio moveactive pass swapnext devices layers rounding lockactivegroup 5 moveworkspacetomonitor -f -i --quiet forcenodim pin 0 1 forceopaque forcenoshadow setfloating minsize alphaoverride sendshortcut workspaces cyclenext alterzorder togglegroup lockgroups bordersize dpms focuscurrentorlast -1 --batch notify remove instances 1 3 moveoutofgroup killactive 2 movetoworkspace movecursor configerrors closewindow swapwindow tagwindow forcerendererreload centerwindow auto focuswindow seterror nofocus alphafullscreen binds version -h togglespecialworkspace fullscreen windowdancecompat 0 keyword toggleopaque 3 --instance togglefloating renameworkspace alphafullscreenoverride activeworkspace x11 kill forceopaqueoverriden output global dispatch reload forcenoblur -j event --help disable -1 activewindow keepaspectratio dismissnotify focusmonitor movefocus plugin exit workspace fullscreenstate getoption alphainactiveoverride alphainactive decorations settiled config-only descriptions resizewindowpixel fakefullscreen rollinglog swapactiveworkspaces submap next movewindoworgroup cursorpos forcenoanims focusworkspaceoncurrentmonitor maxsize)
declare -a literals=(resizeactive 2 changegroupactive -r moveintogroup forceallowsinput 4 ::= systeminfo all layouts setprop animationstyle switchxkblayout create denywindowfromgroup headless activebordercolor exec setcursor wayland focusurgentorlast workspacerules movecurrentworkspacetomonitor movetoworkspacesilent hyprpaper alpha inactivebordercolor movegroupwindow movecursortocorner movewindowpixel prev movewindow globalshortcuts clients dimaround setignoregrouplock splash execr monitors 0 forcenoborder -q animations 1 nomaxsize splitratio moveactive pass swapnext devices layers rounding lockactivegroup 5 moveworkspacetomonitor -f -i --quiet forcenodim pin 0 1 forceopaque forcenoshadow setfloating minsize alphaoverride sendshortcut workspaces cyclenext alterzorder togglegroup lockgroups bordersize dpms focuscurrentorlast -1 --batch notify remove instances 1 3 moveoutofgroup killactive 2 movetoworkspace movecursor configerrors closewindow swapwindow tagwindow forcerendererreload centerwindow auto focuswindow seterror nofocus alphafullscreen binds version -h togglespecialworkspace fullscreen windowdancecompat 0 keyword toggleopaque 3 --instance togglefloating renameworkspace alphafullscreenoverride activeworkspace x11 kill forceopaqueoverriden output global dispatch reload forcenoblur -j event --help disable -1 activewindow keepaspectratio dismissnotify focusmonitor movefocus plugin exit workspace fullscreenstate getoption alphainactiveoverride alphainactive decorations settiled config-only descriptions resizewindowpixel fakefullscreen rollinglog swapactiveworkspaces submap next movewindoworgroup cursorpos forcenoanims focusworkspaceoncurrentmonitor maxsize sendkeystate)
declare -A literal_transitions
literal_transitions[0]="([120]=14 [43]=2 [125]=21 [81]=2 [3]=21 [51]=2 [50]=2 [128]=2 [89]=2 [58]=21 [8]=2 [10]=2 [11]=3 [130]=4 [13]=5 [97]=6 [101]=2 [102]=21 [133]=7 [100]=2 [137]=2 [22]=2 [19]=2 [140]=8 [25]=2 [143]=2 [107]=9 [146]=10 [69]=2 [33]=2 [34]=2 [78]=21 [114]=2 [37]=2 [151]=2 [116]=2 [121]=13 [123]=21 [39]=11 [42]=21 [79]=15 [118]=12)"
literal_transitions[1]="([81]=2 [51]=2 [50]=2 [128]=2 [8]=2 [89]=2 [10]=2 [11]=3 [130]=4 [13]=5 [97]=6 [101]=2 [133]=7 [100]=2 [22]=2 [19]=2 [137]=2 [140]=8 [25]=2 [143]=2 [107]=9 [146]=10 [69]=2 [33]=2 [34]=2 [114]=2 [37]=2 [151]=2 [116]=2 [39]=11 [118]=12 [121]=13 [120]=14 [79]=15 [43]=2)"

View File

@@ -29,7 +29,7 @@ function _hyprctl
set COMP_CWORD (count $COMP_WORDS)
end
set literals "resizeactive" "2" "changegroupactive" "-r" "moveintogroup" "forceallowsinput" "4" "::=" "systeminfo" "all" "layouts" "setprop" "animationstyle" "switchxkblayout" "create" "denywindowfromgroup" "headless" "activebordercolor" "exec" "setcursor" "wayland" "focusurgentorlast" "workspacerules" "movecurrentworkspacetomonitor" "movetoworkspacesilent" "hyprpaper" "alpha" "inactivebordercolor" "movegroupwindow" "movecursortocorner" "movewindowpixel" "prev" "movewindow" "globalshortcuts" "clients" "dimaround" "setignoregrouplock" "splash" "execr" "monitors" "0" "forcenoborder" "-q" "animations" "1" "nomaxsize" "splitratio" "moveactive" "pass" "swapnext" "devices" "layers" "rounding" "lockactivegroup" "5" "moveworkspacetomonitor" "-f" "-i" "--quiet" "forcenodim" "pin" "0" "1" "forceopaque" "forcenoshadow" "setfloating" "minsize" "alphaoverride" "sendshortcut" "workspaces" "cyclenext" "alterzorder" "togglegroup" "lockgroups" "bordersize" "dpms" "focuscurrentorlast" "-1" "--batch" "notify" "remove" "instances" "1" "3" "moveoutofgroup" "killactive" "2" "movetoworkspace" "movecursor" "configerrors" "closewindow" "swapwindow" "tagwindow" "forcerendererreload" "centerwindow" "auto" "focuswindow" "seterror" "nofocus" "alphafullscreen" "binds" "version" "-h" "togglespecialworkspace" "fullscreen" "windowdancecompat" "0" "keyword" "toggleopaque" "3" "--instance" "togglefloating" "renameworkspace" "alphafullscreenoverride" "activeworkspace" "x11" "kill" "forceopaqueoverriden" "output" "global" "dispatch" "reload" "forcenoblur" "-j" "event" "--help" "disable" "-1" "activewindow" "keepaspectratio" "dismissnotify" "focusmonitor" "movefocus" "plugin" "exit" "workspace" "fullscreenstate" "getoption" "alphainactiveoverride" "alphainactive" "decorations" "settiled" "config-only" "descriptions" "resizewindowpixel" "fakefullscreen" "rollinglog" "swapactiveworkspaces" "submap" "next" "movewindoworgroup" "cursorpos" "forcenoanims" "focusworkspaceoncurrentmonitor" "maxsize"
set literals "resizeactive" "2" "changegroupactive" "-r" "moveintogroup" "forceallowsinput" "4" "::=" "systeminfo" "all" "layouts" "setprop" "animationstyle" "switchxkblayout" "create" "denywindowfromgroup" "headless" "activebordercolor" "exec" "setcursor" "wayland" "focusurgentorlast" "workspacerules" "movecurrentworkspacetomonitor" "movetoworkspacesilent" "hyprpaper" "alpha" "inactivebordercolor" "movegroupwindow" "movecursortocorner" "movewindowpixel" "prev" "movewindow" "globalshortcuts" "clients" "dimaround" "setignoregrouplock" "splash" "execr" "monitors" "0" "forcenoborder" "-q" "animations" "1" "nomaxsize" "splitratio" "moveactive" "pass" "swapnext" "devices" "layers" "rounding" "lockactivegroup" "5" "moveworkspacetomonitor" "-f" "-i" "--quiet" "forcenodim" "pin" "0" "1" "forceopaque" "forcenoshadow" "setfloating" "minsize" "alphaoverride" "sendshortcut" "workspaces" "cyclenext" "alterzorder" "togglegroup" "lockgroups" "bordersize" "dpms" "focuscurrentorlast" "-1" "--batch" "notify" "remove" "instances" "1" "3" "moveoutofgroup" "killactive" "2" "movetoworkspace" "movecursor" "configerrors" "closewindow" "swapwindow" "tagwindow" "forcerendererreload" "centerwindow" "auto" "focuswindow" "seterror" "nofocus" "alphafullscreen" "binds" "version" "-h" "togglespecialworkspace" "fullscreen" "windowdancecompat" "0" "keyword" "toggleopaque" "3" "--instance" "togglefloating" "renameworkspace" "alphafullscreenoverride" "activeworkspace" "x11" "kill" "forceopaqueoverriden" "output" "global" "dispatch" "reload" "forcenoblur" "-j" "event" "--help" "disable" "-1" "activewindow" "keepaspectratio" "dismissnotify" "focusmonitor" "movefocus" "plugin" "exit" "workspace" "fullscreenstate" "getoption" "alphainactiveoverride" "alphainactive" "decorations" "settiled" "config-only" "descriptions" "resizewindowpixel" "fakefullscreen" "rollinglog" "swapactiveworkspaces" "submap" "next" "movewindoworgroup" "cursorpos" "forcenoanims" "focusworkspaceoncurrentmonitor" "maxsize" "sendkeystate"
set descriptions
set descriptions[1] "Resize the active window"
@@ -48,7 +48,7 @@ function _hyprctl
set descriptions[22] "Focus the urgent window or the last window"
set descriptions[23] "Get the list of defined workspace rules"
set descriptions[24] "Move the active workspace to a monitor"
set descriptions[25] "Move window doesnt switch to the workspace"
set descriptions[25] "Move window doesn't switch to the workspace"
set descriptions[26] "Interact with hyprpaper if present"
set descriptions[29] "Swap the active window with the next or previous in a group"
set descriptions[30] "Move the cursor to the corner of the active window"

View File

@@ -1,4 +1,4 @@
# This is a file feeded to complgen to generate bash/fish/zsh completions
# This is a file fed to complgen to generate bash/fish/zsh completions
# Repo: https://github.com/adaszko/complgen
# Generate completion scripts: "complgen aot --bash-script hyprctl.bash --fish-script hyprctl.fish --zsh-script hyprctl.zsh ./hyprctl.usage"
@@ -106,11 +106,12 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
| (execr) "Execute a raw shell command"
| (pass) "Pass the key to a specified window"
| (sendshortcut) "On shortcut X sends shortcut Y to a specified window"
| (sendkeystate) "Send a key with specific state (down/repeat/up) to a specified window (window must keep focus for events to continue)"
| (killactive) "Close the active window"
| (closewindow) "Close a specified window"
| (workspace) "Change the workspace"
| (movetoworkspace) "Move the focused window to a workspace"
| (movetoworkspacesilent) "Move window doesnt switch to the workspace"
| (movetoworkspacesilent) "Move window doesn't switch to the workspace"
| (togglefloating) "Toggle the current window's floating state"
| (setfloating) "Set the current window's floating state to true"
| (settiled) "Set the current window's floating state to false"

View File

@@ -17,7 +17,7 @@ _hyprctl_cmd_0 () {
}
_hyprctl () {
local -a literals=("resizeactive" "2" "changegroupactive" "-r" "moveintogroup" "forceallowsinput" "4" "::=" "systeminfo" "all" "layouts" "setprop" "animationstyle" "switchxkblayout" "create" "denywindowfromgroup" "headless" "activebordercolor" "exec" "setcursor" "wayland" "focusurgentorlast" "workspacerules" "movecurrentworkspacetomonitor" "movetoworkspacesilent" "hyprpaper" "alpha" "inactivebordercolor" "movegroupwindow" "movecursortocorner" "movewindowpixel" "prev" "movewindow" "globalshortcuts" "clients" "dimaround" "setignoregrouplock" "splash" "execr" "monitors" "0" "forcenoborder" "-q" "animations" "1" "nomaxsize" "splitratio" "moveactive" "pass" "swapnext" "devices" "layers" "rounding" "lockactivegroup" "5" "moveworkspacetomonitor" "-f" "-i" "--quiet" "forcenodim" "pin" "0" "1" "forceopaque" "forcenoshadow" "setfloating" "minsize" "alphaoverride" "sendshortcut" "workspaces" "cyclenext" "alterzorder" "togglegroup" "lockgroups" "bordersize" "dpms" "focuscurrentorlast" "-1" "--batch" "notify" "remove" "instances" "1" "3" "moveoutofgroup" "killactive" "2" "movetoworkspace" "movecursor" "configerrors" "closewindow" "swapwindow" "tagwindow" "forcerendererreload" "centerwindow" "auto" "focuswindow" "seterror" "nofocus" "alphafullscreen" "binds" "version" "-h" "togglespecialworkspace" "fullscreen" "windowdancecompat" "0" "keyword" "toggleopaque" "3" "--instance" "togglefloating" "renameworkspace" "alphafullscreenoverride" "activeworkspace" "x11" "kill" "forceopaqueoverriden" "output" "global" "dispatch" "reload" "forcenoblur" "-j" "event" "--help" "disable" "-1" "activewindow" "keepaspectratio" "dismissnotify" "focusmonitor" "movefocus" "plugin" "exit" "workspace" "fullscreenstate" "getoption" "alphainactiveoverride" "alphainactive" "decorations" "settiled" "config-only" "descriptions" "resizewindowpixel" "fakefullscreen" "rollinglog" "swapactiveworkspaces" "submap" "next" "movewindoworgroup" "cursorpos" "forcenoanims" "focusworkspaceoncurrentmonitor" "maxsize")
local -a literals=("resizeactive" "2" "changegroupactive" "-r" "moveintogroup" "forceallowsinput" "4" "::=" "systeminfo" "all" "layouts" "setprop" "animationstyle" "switchxkblayout" "create" "denywindowfromgroup" "headless" "activebordercolor" "exec" "setcursor" "wayland" "focusurgentorlast" "workspacerules" "movecurrentworkspacetomonitor" "movetoworkspacesilent" "hyprpaper" "alpha" "inactivebordercolor" "movegroupwindow" "movecursortocorner" "movewindowpixel" "prev" "movewindow" "globalshortcuts" "clients" "dimaround" "setignoregrouplock" "splash" "execr" "monitors" "0" "forcenoborder" "-q" "animations" "1" "nomaxsize" "splitratio" "moveactive" "pass" "swapnext" "devices" "layers" "rounding" "lockactivegroup" "5" "moveworkspacetomonitor" "-f" "-i" "--quiet" "forcenodim" "pin" "0" "1" "forceopaque" "forcenoshadow" "setfloating" "minsize" "alphaoverride" "sendshortcut" "workspaces" "cyclenext" "alterzorder" "togglegroup" "lockgroups" "bordersize" "dpms" "focuscurrentorlast" "-1" "--batch" "notify" "remove" "instances" "1" "3" "moveoutofgroup" "killactive" "2" "movetoworkspace" "movecursor" "configerrors" "closewindow" "swapwindow" "tagwindow" "forcerendererreload" "centerwindow" "auto" "focuswindow" "seterror" "nofocus" "alphafullscreen" "binds" "version" "-h" "togglespecialworkspace" "fullscreen" "windowdancecompat" "0" "keyword" "toggleopaque" "3" "--instance" "togglefloating" "renameworkspace" "alphafullscreenoverride" "activeworkspace" "x11" "kill" "forceopaqueoverriden" "output" "global" "dispatch" "reload" "forcenoblur" "-j" "event" "--help" "disable" "-1" "activewindow" "keepaspectratio" "dismissnotify" "focusmonitor" "movefocus" "plugin" "exit" "workspace" "fullscreenstate" "getoption" "alphainactiveoverride" "alphainactive" "decorations" "settiled" "config-only" "descriptions" "resizewindowpixel" "fakefullscreen" "rollinglog" "swapactiveworkspaces" "submap" "next" "movewindoworgroup" "cursorpos" "forcenoanims" "focusworkspaceoncurrentmonitor" "maxsize" "sendkeystate")
local -A descriptions
descriptions[1]="Resize the active window"
@@ -36,7 +36,7 @@ _hyprctl () {
descriptions[22]="Focus the urgent window or the last window"
descriptions[23]="Get the list of defined workspace rules"
descriptions[24]="Move the active workspace to a monitor"
descriptions[25]="Move window doesnt switch to the workspace"
descriptions[25]="Move window doesn't switch to the workspace"
descriptions[26]="Interact with hyprpaper if present"
descriptions[29]="Swap the active window with the next or previous in a group"
descriptions[30]="Move the cursor to the corner of the active window"

View File

@@ -1,3 +1,5 @@
#include <re2/re2.h>
#include <cctype>
#include <netdb.h>
#include <netinet/in.h>
@@ -10,29 +12,24 @@
#include <sys/un.h>
#include <pwd.h>
#include <unistd.h>
#include <ranges>
#include <algorithm>
#include <csignal>
#include <format>
#include <ranges>
#include <optional>
#include <charconv>
#include <iostream>
#include <string>
#include <print>
#include <fstream>
#include <string>
#include <vector>
#include <deque>
#include <filesystem>
#include <cstdarg>
#include <regex>
#include <sys/socket.h>
#include <hyprutils/string/String.hpp>
#include <cstring>
using namespace Hyprutils::String;
#include "Strings.hpp"
#define PAD
std::string instanceSignature;
bool quiet = false;
@@ -41,63 +38,100 @@ struct SInstanceData {
uint64_t time;
uint64_t pid;
std::string wlSocket;
bool valid = true;
};
void log(std::string str) {
void log(const std::string_view str) {
if (quiet)
return;
std::cout << str << "\n";
std::println("{}", str);
}
static int getUID() {
const auto UID = getuid();
const auto PWUID = getpwuid(UID);
return PWUID ? PWUID->pw_uid : UID;
}
std::string getRuntimeDir() {
const auto XDG = getenv("XDG_RUNTIME_DIR");
if (!XDG) {
const std::string USERID = std::to_string(getpwuid(getuid())->pw_uid);
const std::string USERID = std::to_string(getUID());
return "/run/user/" + USERID + "/hypr";
}
return std::string{XDG} + "/hypr";
}
static std::optional<uint64_t> toUInt64(const std::string_view str) {
uint64_t value = 0;
const auto [ptr, ec] = std::from_chars(str.data(), str.data() + str.size(), value);
if (ec != std::errc() || ptr != str.data() + str.size())
return std::nullopt;
return value;
}
static std::optional<SInstanceData> parseInstance(const std::filesystem::directory_entry& entry) {
if (!entry.is_directory())
return std::nullopt;
const auto lockPath = entry.path() / "hyprland.lock";
std::ifstream ifs(lockPath);
if (!ifs.is_open())
return std::nullopt;
SInstanceData data;
data.id = entry.path().filename().string();
const auto first = std::string_view{data.id}.find_first_of('_');
const auto last = std::string_view{data.id}.find_last_of('_');
if (first == std::string_view::npos || last == std::string_view::npos || last <= first)
return std::nullopt;
auto time = toUInt64(std::string_view{data.id}.substr(first + 1, last - first - 1));
if (!time)
return std::nullopt;
data.time = *time;
std::string line;
if (!std::getline(ifs, line))
return std::nullopt;
auto pid = toUInt64(std::string_view{line});
if (!pid)
return std::nullopt;
data.pid = *pid;
if (!std::getline(ifs, data.wlSocket))
return std::nullopt;
if (std::getline(ifs, line) && !line.empty())
return std::nullopt; // more lines than expected
return data;
}
std::vector<SInstanceData> instances() {
std::vector<SInstanceData> result;
for (const auto& el : std::filesystem::directory_iterator(getRuntimeDir())) {
if (!el.is_directory() || !std::filesystem::exists(el.path().string() + "/hyprland.lock"))
continue;
std::error_code ec;
const auto runtimeDir = getRuntimeDir();
if (!std::filesystem::exists(runtimeDir, ec) || ec)
return result;
// read lock
SInstanceData* data = &result.emplace_back();
data->id = el.path().filename().string();
std::filesystem::directory_iterator it(runtimeDir, std::filesystem::directory_options::skip_permission_denied, ec);
if (ec)
return result;
try {
data->time = std::stoull(data->id.substr(data->id.find_first_of('_') + 1, data->id.find_last_of('_') - (data->id.find_first_of('_') + 1)));
} catch (std::exception& e) { continue; }
// read file
std::ifstream ifs(el.path().string() + "/hyprland.lock");
int i = 0;
for (std::string line; std::getline(ifs, line); ++i) {
if (i == 0) {
try {
data->pid = std::stoull(line);
} catch (std::exception& e) { continue; }
} else if (i == 1) {
data->wlSocket = line;
} else
break;
}
ifs.close();
for (const auto& el : it) {
if (auto instance = parseInstance(el))
result.emplace_back(std::move(*instance));
}
std::erase_if(result, [&](const auto& el) { return kill(el.pid, 0) != 0 && errno == ESRCH; });
std::erase_if(result, [](const auto& el) { return kill(el.pid, 0) != 0 && errno == ESRCH; });
std::sort(result.begin(), result.end(), [&](const auto& a, const auto& b) { return a.time < b.time; });
std::ranges::sort(result, {}, &SInstanceData::time);
return result;
}
@@ -105,7 +139,7 @@ std::vector<SInstanceData> instances() {
static volatile bool sigintReceived = false;
void intHandler(int sig) {
sigintReceived = true;
std::cout << "[hyprctl] SIGINT received, closing connection" << std::endl;
std::println("[hyprctl] SIGINT received, closing connection");
}
int rollingRead(const int socket) {
@@ -115,12 +149,12 @@ int rollingRead(const int socket) {
constexpr size_t BUFFER_SIZE = 8192;
std::array<char, BUFFER_SIZE> buffer = {0};
long sizeWritten = 0;
std::cout << "[hyprctl] reading from socket following up log:" << std::endl;
std::println("[hyprctl] reading from socket following up log:");
while (!sigintReceived) {
sizeWritten = read(socket, buffer.data(), BUFFER_SIZE);
if (sizeWritten < 0 && errno != EAGAIN) {
if (errno != EINTR)
std::cout << "Couldn't read (5) " << strerror(errno) << ":" << errno << std::endl;
std::println("Couldn't read (5): {}: {}", strerror(errno), errno);
close(socket);
return 5;
}
@@ -129,7 +163,7 @@ int rollingRead(const int socket) {
break;
if (sizeWritten > 0) {
std::cout << std::string(buffer.data(), sizeWritten);
std::println("{}", std::string(buffer.data(), sizeWritten));
buffer.fill('\0');
}
@@ -139,11 +173,19 @@ int rollingRead(const int socket) {
return 0;
}
int request(std::string arg, int minArgs = 0, bool needRoll = false) {
int request(std::string_view arg, int minArgs = 0, bool needRoll = false) {
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
auto t = timeval{.tv_sec = 5, .tv_usec = 0};
setsockopt(SERVERSOCKET, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(struct timeval));
if (SERVERSOCKET < 0) {
log("Couldn't open a socket (1)");
return 1;
}
auto t = timeval{.tv_sec = 5, .tv_usec = 0};
if (setsockopt(SERVERSOCKET, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(struct timeval)) < 0) {
log("Couldn't set socket timeout (2)");
return 2;
}
const auto ARGS = std::count(arg.begin(), arg.end(), ' ');
@@ -152,59 +194,53 @@ int request(std::string arg, int minArgs = 0, bool needRoll = false) {
return -1;
}
if (SERVERSOCKET < 0) {
log("Couldn't open a socket (1)");
return 1;
}
if (instanceSignature.empty()) {
log("HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)");
return 2;
log("HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?) (3)");
return 3;
}
const std::string USERID = std::to_string(getpwuid(getuid())->pw_uid);
sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;
sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;
std::string socketPath = getRuntimeDir() + "/" + instanceSignature + "/.socket.sock";
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
log("Couldn't connect to " + socketPath + ". (3)");
return 3;
log("Couldn't connect to " + socketPath + ". (4)");
return 4;
}
auto sizeWritten = write(SERVERSOCKET, arg.c_str(), arg.length());
auto sizeWritten = write(SERVERSOCKET, arg.data(), arg.size());
if (sizeWritten < 0) {
log("Couldn't write (4)");
return 4;
log("Couldn't write (5)");
return 5;
}
if (needRoll)
return rollingRead(SERVERSOCKET);
std::string reply = "";
char buffer[8192] = {0};
std::string reply = "";
constexpr size_t BUFFER_SIZE = 8192;
char buffer[BUFFER_SIZE] = {0};
sizeWritten = read(SERVERSOCKET, buffer, 8192);
sizeWritten = read(SERVERSOCKET, buffer, BUFFER_SIZE);
if (sizeWritten < 0) {
if (errno == EWOULDBLOCK)
log("Hyprland IPC didn't respond in time\n");
log("Couldn't read (5)");
return 5;
log("Couldn't read (6)");
return 6;
}
reply += std::string(buffer, sizeWritten);
while (sizeWritten == 8192) {
sizeWritten = read(SERVERSOCKET, buffer, 8192);
while (sizeWritten == BUFFER_SIZE) {
sizeWritten = read(SERVERSOCKET, buffer, BUFFER_SIZE);
if (sizeWritten < 0) {
log("Couldn't read (5)");
return 5;
log("Couldn't read (6)");
return 6;
}
reply += std::string(buffer, sizeWritten);
}
@@ -216,7 +252,7 @@ int request(std::string arg, int minArgs = 0, bool needRoll = false) {
return 0;
}
int requestHyprpaper(std::string arg) {
int requestIPC(std::string_view filename, std::string_view arg) {
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
if (SERVERSOCKET < 0) {
@@ -232,9 +268,7 @@ int requestHyprpaper(std::string arg) {
sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;
const std::string USERID = std::to_string(getpwuid(getuid())->pw_uid);
std::string socketPath = getRuntimeDir() + "/" + instanceSignature + "/.hyprpaper.sock";
std::string socketPath = getRuntimeDir() + "/" + instanceSignature + "/" + filename;
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
@@ -246,16 +280,16 @@ int requestHyprpaper(std::string arg) {
arg = arg.substr(arg.find_first_of('/') + 1); // strip flags
arg = arg.substr(arg.find_first_of(' ') + 1); // strip "hyprpaper"
auto sizeWritten = write(SERVERSOCKET, arg.c_str(), arg.length());
auto sizeWritten = write(SERVERSOCKET, arg.data(), arg.size());
if (sizeWritten < 0) {
log("Couldn't write (4)");
return 4;
}
constexpr size_t BUFFER_SIZE = 8192;
char buffer[BUFFER_SIZE] = {0};
char buffer[8192] = {0};
sizeWritten = read(SERVERSOCKET, buffer, 8192);
sizeWritten = read(SERVERSOCKET, buffer, BUFFER_SIZE);
if (sizeWritten < 0) {
log("Couldn't read (5)");
@@ -269,11 +303,20 @@ int requestHyprpaper(std::string arg) {
return 0;
}
void batchRequest(std::string arg, bool json) {
std::string commands = arg.substr(arg.find_first_of(" ") + 1);
int requestHyprpaper(std::string_view arg) {
return requestIPC(".hyprpaper.sock", arg);
}
int requestHyprsunset(std::string_view arg) {
return requestIPC(".hyprsunset.sock", arg);
}
void batchRequest(std::string_view arg, bool json) {
std::string commands(arg.substr(arg.find_first_of(' ') + 1));
if (json) {
commands = "j/" + std::regex_replace(commands, std::regex(";\\s*"), ";j/");
RE2::GlobalReplace(&commands, ";\\s*", ";j/");
commands.insert(0, "j/");
}
std::string rq = "[[BATCH]]" + commands;
@@ -310,11 +353,11 @@ void instancesRequest(bool json) {
log(result + "\n");
}
std::deque<std::string> splitArgs(int argc, char** argv) {
std::deque<std::string> result;
std::vector<std::string> splitArgs(int argc, char** argv) {
std::vector<std::string> result;
for (auto i = 1 /* skip the executable */; i < argc; ++i)
result.push_back(std::string(argv[i]));
result.emplace_back(argv[i]);
return result;
}
@@ -323,7 +366,7 @@ int main(int argc, char** argv) {
bool parseArgs = true;
if (argc < 2) {
std::cout << USAGE << std::endl;
std::println("{}", USAGE);
return 1;
}
@@ -340,7 +383,7 @@ int main(int argc, char** argv) {
parseArgs = false;
continue;
}
if (parseArgs && (ARGS[i][0] == '-') && !isNumber(ARGS[i], true) /* For stuff like -2 */) {
if (parseArgs && (ARGS[i][0] == '-') && !(isNumber(ARGS[i], true) || isNumber(ARGS[i].substr(0, ARGS[i].length() - 1), true)) /* For stuff like -2 or -2, */) {
// parse
if (ARGS[i] == "-j" && !fullArgs.contains("j")) {
fullArgs += "j";
@@ -360,7 +403,7 @@ int main(int argc, char** argv) {
++i;
if (i >= ARGS.size()) {
std::cout << USAGE << std::endl;
std::println("{}", USAGE);
return 1;
}
@@ -371,24 +414,26 @@ int main(int argc, char** argv) {
const std::string& cmd = ARGS[0];
if (cmd == "hyprpaper") {
std::cout << HYPRPAPER_HELP << std::endl;
std::println("{}", HYPRPAPER_HELP);
} else if (cmd == "hyprsunset") {
std::println("{}", HYPRSUNSET_HELP);
} else if (cmd == "notify") {
std::cout << NOTIFY_HELP << std::endl;
std::println("{}", NOTIFY_HELP);
} else if (cmd == "output") {
std::cout << OUTPUT_HELP << std::endl;
std::println("{}", OUTPUT_HELP);
} else if (cmd == "plugin") {
std::cout << PLUGIN_HELP << std::endl;
std::println("{}", PLUGIN_HELP);
} else if (cmd == "setprop") {
std::cout << SETPROP_HELP << std::endl;
std::println("{}", SETPROP_HELP);
} else if (cmd == "switchxkblayout") {
std::cout << SWITCHXKBLAYOUT_HELP << std::endl;
std::println("{}", SWITCHXKBLAYOUT_HELP);
} else {
std::cout << USAGE << std::endl;
std::println("{}", USAGE);
}
return 1;
} else {
std::cout << USAGE << std::endl;
std::println("{}", USAGE);
return 1;
}
@@ -399,7 +444,7 @@ int main(int argc, char** argv) {
}
if (fullRequest.empty()) {
std::cout << USAGE << std::endl;
std::println("{}", USAGE);
return 1;
}
@@ -453,6 +498,8 @@ int main(int argc, char** argv) {
batchRequest(fullRequest, json);
else if (fullRequest.contains("/hyprpaper"))
exitStatus = requestHyprpaper(fullRequest);
else if (fullRequest.contains("/hyprsunset"))
exitStatus = requestHyprsunset(fullRequest);
else if (fullRequest.contains("/switchxkblayout"))
exitStatus = request(fullRequest, 2);
else if (fullRequest.contains("/seterror"))
@@ -476,7 +523,7 @@ int main(int argc, char** argv) {
else if (fullRequest.contains("/decorations"))
exitStatus = request(fullRequest, 1);
else if (fullRequest.contains("/--help"))
std::cout << USAGE << std::endl;
std::println("{}", USAGE);
else if (fullRequest.contains("/rollinglog") && needRoll)
exitStatus = request(fullRequest, 0, true);
else {

View File

@@ -3,6 +3,7 @@ executable(
'main.cpp',
dependencies: [
dependency('hyprutils', version: '>= 0.1.1'),
dependency('re2', required: true)
],
install: true,
)

View File

@@ -9,11 +9,25 @@ file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
set(CMAKE_CXX_STANDARD 23)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET tomlplusplus hyprutils>=0.1.1)
pkg_check_modules(hyprpm_deps REQUIRED IMPORTED_TARGET tomlplusplus hyprutils>=0.7.0)
find_package(glaze QUIET)
if (NOT glaze_FOUND)
set(GLAZE_VERSION v5.1.1)
message(STATUS "glaze dependency not found, retrieving ${GLAZE_VERSION} with FetchContent")
include(FetchContent)
FetchContent_Declare(
glaze
GIT_REPOSITORY https://github.com/stephenberry/glaze.git
GIT_TAG ${GLAZE_VERSION}
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(glaze)
endif()
add_executable(hyprpm ${SRCFILES})
target_link_libraries(hyprpm PUBLIC PkgConfig::deps)
target_link_libraries(hyprpm PUBLIC PkgConfig::hyprpm_deps glaze::glaze)
# binary
install(TARGETS hyprpm)

View File

@@ -29,8 +29,8 @@ function _hyprpm
set descriptions[6] "Show help menu"
set descriptions[7] "Check and update all plugins if needed"
set descriptions[8] "Install a new plugin repository from git"
set descriptions[9] "Enable too much loggin"
set descriptions[10] "Enable too much loggin"
set descriptions[9] "Enable too much logging"
set descriptions[10] "Enable too much logging"
set descriptions[11] "Force an operation ignoring checks (e.g. update -f)"
set descriptions[12] "Disable shallow cloning of Hyprland sources"
set descriptions[13] "Remove a plugin repository"

View File

@@ -3,7 +3,7 @@ hyprpm [<FLAGS>]... <ARGUMENT>
<FLAGS> ::= (--notify | -n) "Send a hyprland notification for important events (e.g. load fail)"
| (--help | -h) "Show help menu"
| (--verbose | -v) "Enable too much loggin"
| (--verbose | -v) "Enable too much logging"
| (--force | -f) "Force an operation ignoring checks (e.g. update -f)"
| (--no-shallow | -s) "Disable shallow cloning of Hyprland sources"
;
@@ -14,7 +14,7 @@ hyprpm [<FLAGS>]... <ARGUMENT>
| (list) "List all installed plugins"
| (enable <PLUGINS>) "Load a plugin"
| (disable <PLUGINS>) "Unload a plugin"
| (reload) "Reload all plugins"
| (reload) "Reload plugins to match the enabled/disabled state. Use -f to force reload."
;
<PLUGINS> ::= {{{ hyprpm list | awk '/Plugin/{print $4}' }}};

View File

@@ -19,8 +19,8 @@ _hyprpm () {
descriptions[6]="Show help menu"
descriptions[7]="Check and update all plugins if needed"
descriptions[8]="Install a new plugin repository from git"
descriptions[9]="Enable too much loggin"
descriptions[10]="Enable too much loggin"
descriptions[9]="Enable too much logging"
descriptions[10]="Enable too much logging"
descriptions[11]="Force an operation ignoring checks (e.g. update -f)"
descriptions[12]="Disable shallow cloning of Hyprland sources"
descriptions[13]="Remove a plugin repository"

View File

@@ -1,45 +1,91 @@
#include "DataState.hpp"
#include <sys/stat.h>
#include <toml++/toml.hpp>
#include <iostream>
#include <filesystem>
#include <print>
#include <sstream>
#include <fstream>
#include "PluginManager.hpp"
#include "../helpers/Die.hpp"
#include "../helpers/Sys.hpp"
#include "../helpers/StringUtils.hpp"
std::string DataState::getDataStatePath() {
const auto HOME = getenv("HOME");
if (!HOME) {
std::cerr << "DataState: no $HOME\n";
throw std::runtime_error("no $HOME");
return "";
static std::string getTempRoot() {
static auto ENV = getenv("XDG_RUNTIME_DIR");
if (!ENV) {
std::cerr << "\nERROR: XDG_RUNTIME_DIR not set!\n";
exit(1);
}
const auto XDG_DATA_HOME = getenv("XDG_DATA_HOME");
const auto STR = ENV + std::string{"/hyprpm/"};
if (XDG_DATA_HOME)
return std::string{XDG_DATA_HOME} + "/hyprpm";
return std::string{HOME} + "/.local/share/hyprpm";
return STR;
}
// write the state to a file
static bool writeState(const std::string& str, const std::string& to) {
// create temp file in a safe temp root
std::ofstream of(getTempRoot() + ".temp-state", std::ios::trunc);
if (!of.good())
return false;
of << str;
of.close();
return NSys::root::install(getTempRoot() + ".temp-state", to, "644");
}
std::filesystem::path DataState::getDataStatePath() {
return std::filesystem::path("/var/cache/hyprpm/" + g_pPluginManager->m_szUsername);
}
std::string DataState::getHeadersPath() {
return getDataStatePath() + "/headersRoot";
return getDataStatePath() / "headersRoot";
}
std::vector<std::filesystem::path> DataState::getPluginStates() {
ensureStateStoreExists();
std::vector<std::filesystem::path> states;
for (const auto& entry : std::filesystem::directory_iterator(getDataStatePath())) {
if (!entry.is_directory() || entry.path().stem() == "headersRoot")
continue;
const auto stateFile = entry.path() / "state.toml";
if (!std::filesystem::exists(stateFile))
continue;
states.emplace_back(stateFile);
}
return states;
}
void DataState::ensureStateStoreExists() {
const auto PATH = getDataStatePath();
if (!std::filesystem::exists(PATH))
std::filesystem::create_directories(PATH);
if (!std::filesystem::exists(getHeadersPath()))
std::filesystem::create_directories(getHeadersPath());
std::error_code ec;
if (!std::filesystem::exists(getHeadersPath(), ec) || ec) {
std::println("{}", infoString("The hyprpm state store doesn't exist. Creating now..."));
if (!std::filesystem::exists("/var/cache/hyprpm/", ec) || ec) {
if (!NSys::root::createDirectory("/var/cache/hyprpm", "755"))
Debug::die("ensureStateStoreExists: Failed to run a superuser cmd");
}
if (!std::filesystem::exists(getDataStatePath(), ec) || ec) {
if (!NSys::root::createDirectory(getDataStatePath().string(), "755"))
Debug::die("ensureStateStoreExists: Failed to run a superuser cmd");
}
if (!NSys::root::createDirectory(getHeadersPath(), "755"))
Debug::die("ensureStateStoreExists: Failed to run a superuser cmd");
}
}
void DataState::addNewPluginRepo(const SPluginRepository& repo) {
ensureStateStoreExists();
const auto PATH = getDataStatePath() + "/" + repo.name;
const auto PATH = getDataStatePath() / repo.name;
std::filesystem::create_directories(PATH);
std::error_code ec;
if (!std::filesystem::exists(PATH, ec) || ec) {
if (!NSys::root::createDirectory(PATH.string(), "755"))
Debug::die("addNewPluginRepo: failed to create cache dir");
}
// clang-format off
auto DATA = toml::table{
{"repository", toml::table{
@@ -50,39 +96,36 @@ void DataState::addNewPluginRepo(const SPluginRepository& repo) {
}}
};
for (auto const& p : repo.plugins) {
// copy .so to the good place
if (std::filesystem::exists(p.filename))
std::filesystem::copy_file(p.filename, PATH + "/" + p.name + ".so");
const auto filename = p.name + ".so";
// copy .so to the good place and chmod 755
if (std::filesystem::exists(p.filename)) {
if (!NSys::root::install(p.filename, (PATH / filename).string(), "0755"))
Debug::die("addNewPluginRepo: failed to install so file");
}
DATA.emplace(p.name, toml::table{
{"filename", p.name + ".so"},
{"filename", filename},
{"enabled", p.enabled},
{"failed", p.failed}
});
}
// clang-format on
std::ofstream ofs(PATH + "/state.toml", std::ios::trunc);
ofs << DATA;
ofs.close();
std::stringstream ss;
ss << DATA;
if (!writeState(ss.str(), (PATH / "state.toml").string()))
Debug::die("{}", failureString("Failed to write plugin state"));
}
bool DataState::pluginRepoExists(const std::string& urlOrName) {
ensureStateStoreExists();
const auto PATH = getDataStatePath();
for (const auto& entry : std::filesystem::directory_iterator(PATH)) {
if (!entry.is_directory() || entry.path().stem() == "headersRoot")
continue;
if (!std::filesystem::exists(entry.path().string() + "/state.toml"))
continue;
auto STATE = toml::parse_file(entry.path().string() + "/state.toml");
const auto NAME = STATE["repository"]["name"].value_or("");
const auto URL = STATE["repository"]["url"].value_or("");
for (const auto& stateFile : getPluginStates()) {
const auto STATE = toml::parse_file(stateFile.c_str());
const auto NAME = STATE["repository"]["name"].value_or("");
const auto URL = STATE["repository"]["url"].value_or("");
if (URL == urlOrName || NAME == urlOrName)
return true;
@@ -94,31 +137,29 @@ bool DataState::pluginRepoExists(const std::string& urlOrName) {
void DataState::removePluginRepo(const std::string& urlOrName) {
ensureStateStoreExists();
const auto PATH = getDataStatePath();
for (const auto& entry : std::filesystem::directory_iterator(PATH)) {
if (!entry.is_directory() || entry.path().stem() == "headersRoot")
continue;
if (!std::filesystem::exists(entry.path().string() + "/state.toml"))
continue;
auto STATE = toml::parse_file(entry.path().string() + "/state.toml");
const auto NAME = STATE["repository"]["name"].value_or("");
const auto URL = STATE["repository"]["url"].value_or("");
for (const auto& stateFile : getPluginStates()) {
const auto STATE = toml::parse_file(stateFile.c_str());
const auto NAME = STATE["repository"]["name"].value_or("");
const auto URL = STATE["repository"]["url"].value_or("");
if (URL == urlOrName || NAME == urlOrName) {
// unload the plugins!!
for (const auto& file : std::filesystem::directory_iterator(entry.path())) {
for (const auto& file : std::filesystem::directory_iterator(stateFile.parent_path())) {
if (!file.path().string().ends_with(".so"))
continue;
g_pPluginManager->loadUnloadPlugin(std::filesystem::absolute(file.path()), false);
}
std::filesystem::remove_all(entry.path());
const auto PATH = stateFile.parent_path().string();
if (!PATH.starts_with("/var/cache/hyprpm") || PATH.contains('\''))
return; // WTF?
// scary!
if (!NSys::root::removeRecursive(PATH))
Debug::die("removePluginRepo: failed to remove dir");
return;
}
}
@@ -127,9 +168,13 @@ void DataState::removePluginRepo(const std::string& urlOrName) {
void DataState::updateGlobalState(const SGlobalState& state) {
ensureStateStoreExists();
const auto PATH = getDataStatePath();
const auto PATH = getDataStatePath();
std::filesystem::create_directories(PATH);
std::error_code ec;
if (!std::filesystem::exists(PATH, ec) || ec) {
if (!NSys::root::createDirectory(PATH.string(), "755"))
Debug::die("updateGlobalState: failed to create dir");
}
// clang-format off
auto DATA = toml::table{
{"state", toml::table{
@@ -139,20 +184,23 @@ void DataState::updateGlobalState(const SGlobalState& state) {
};
// clang-format on
std::ofstream ofs(PATH + "/state.toml", std::ios::trunc);
ofs << DATA;
ofs.close();
std::stringstream ss;
ss << DATA;
if (!writeState(ss.str(), (PATH / "state.toml").string()))
Debug::die("{}", failureString("Failed to write plugin state"));
}
SGlobalState DataState::getGlobalState() {
ensureStateStoreExists();
const auto PATH = getDataStatePath();
const auto stateFile = getDataStatePath() / "state.toml";
if (!std::filesystem::exists(PATH + "/state.toml"))
std::error_code ec;
if (!std::filesystem::exists(stateFile, ec) || ec)
return SGlobalState{};
auto DATA = toml::parse_file(PATH + "/state.toml");
auto DATA = toml::parse_file(stateFile.c_str());
SGlobalState state;
state.headersHashCompiled = DATA["state"]["hash"].value_or("");
@@ -164,18 +212,9 @@ SGlobalState DataState::getGlobalState() {
std::vector<SPluginRepository> DataState::getAllRepositories() {
ensureStateStoreExists();
const auto PATH = getDataStatePath();
std::vector<SPluginRepository> repos;
for (const auto& entry : std::filesystem::directory_iterator(PATH)) {
if (!entry.is_directory() || entry.path().stem() == "headersRoot")
continue;
if (!std::filesystem::exists(entry.path().string() + "/state.toml"))
continue;
auto STATE = toml::parse_file(entry.path().string() + "/state.toml");
for (const auto& stateFile : getPluginStates()) {
const auto STATE = toml::parse_file(stateFile.c_str());
const auto NAME = STATE["repository"]["name"].value_or("");
const auto URL = STATE["repository"]["url"].value_or("");
@@ -208,17 +247,8 @@ std::vector<SPluginRepository> DataState::getAllRepositories() {
bool DataState::setPluginEnabled(const std::string& name, bool enabled) {
ensureStateStoreExists();
const auto PATH = getDataStatePath();
for (const auto& entry : std::filesystem::directory_iterator(PATH)) {
if (!entry.is_directory() || entry.path().stem() == "headersRoot")
continue;
if (!std::filesystem::exists(entry.path().string() + "/state.toml"))
continue;
auto STATE = toml::parse_file(entry.path().string() + "/state.toml");
for (const auto& stateFile : getPluginStates()) {
const auto STATE = toml::parse_file(stateFile.c_str());
for (const auto& [key, val] : STATE) {
if (key == "repository")
continue;
@@ -231,15 +261,33 @@ bool DataState::setPluginEnabled(const std::string& name, bool enabled) {
if (FAILED)
return false;
(*STATE[key].as_table()).insert_or_assign("enabled", enabled);
auto modifiedState = STATE;
(*modifiedState[key].as_table()).insert_or_assign("enabled", enabled);
std::ofstream state(entry.path().string() + "/state.toml", std::ios::trunc);
state << STATE;
state.close();
std::stringstream ss;
ss << modifiedState;
if (!writeState(ss.str(), stateFile.string()))
Debug::die("{}", failureString("Failed to write plugin state"));
return true;
}
}
return false;
}
}
void DataState::purgeAllCache() {
std::error_code ec;
if (!std::filesystem::exists(getDataStatePath()) && !ec) {
std::println("{}", infoString("Nothing to do"));
return;
}
const auto PATH = getDataStatePath().string();
if (PATH.contains('\''))
return;
// scary!
if (!NSys::root::removeRecursive(PATH))
Debug::die("Failed to run a superuser cmd");
}

View File

@@ -1,4 +1,5 @@
#pragma once
#include <filesystem>
#include <string>
#include <vector>
#include "Plugin.hpp"
@@ -9,14 +10,16 @@ struct SGlobalState {
};
namespace DataState {
std::string getDataStatePath();
std::string getHeadersPath();
void ensureStateStoreExists();
void addNewPluginRepo(const SPluginRepository& repo);
void removePluginRepo(const std::string& urlOrName);
bool pluginRepoExists(const std::string& urlOrName);
void updateGlobalState(const SGlobalState& state);
SGlobalState getGlobalState();
bool setPluginEnabled(const std::string& name, bool enabled);
std::vector<SPluginRepository> getAllRepositories();
std::filesystem::path getDataStatePath();
std::string getHeadersPath();
std::vector<std::filesystem::path> getPluginStates();
void ensureStateStoreExists();
void addNewPluginRepo(const SPluginRepository& repo);
void removePluginRepo(const std::string& urlOrName);
bool pluginRepoExists(const std::string& urlOrName);
void updateGlobalState(const SGlobalState& state);
void purgeAllCache();
SGlobalState getGlobalState();
bool setPluginEnabled(const std::string& name, bool enabled);
std::vector<SPluginRepository> getAllRepositories();
};

View File

@@ -0,0 +1,86 @@
#include "HyprlandSocket.hpp"
#include <pwd.h>
#include <sys/socket.h>
#include "../helpers/StringUtils.hpp"
#include <print>
#include <sys/un.h>
#include <unistd.h>
#include <cstring>
static int getUID() {
const auto UID = getuid();
const auto PWUID = getpwuid(UID);
return PWUID ? PWUID->pw_uid : UID;
}
static std::string getRuntimeDir() {
const auto XDG = getenv("XDG_RUNTIME_DIR");
if (!XDG) {
const std::string USERID = std::to_string(getUID());
return "/run/user/" + USERID + "/hypr";
}
return std::string{XDG} + "/hypr";
}
std::string NHyprlandSocket::send(const std::string& cmd) {
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
if (SERVERSOCKET < 0) {
std::println("{}", failureString("Couldn't open a socket (1)"));
return "";
}
const auto HIS = getenv("HYPRLAND_INSTANCE_SIGNATURE");
if (!HIS) {
std::println("{}", failureString("HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?) (3)"));
return "";
}
sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;
std::string socketPath = getRuntimeDir() + "/" + HIS + "/.socket.sock";
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
std::println("{}", failureString("Couldn't connect to " + socketPath + ". (4)"));
return "";
}
auto sizeWritten = write(SERVERSOCKET, cmd.c_str(), cmd.length());
if (sizeWritten < 0) {
std::println("{}", failureString("Couldn't write (5)"));
return "";
}
std::string reply = "";
constexpr size_t BUFFER_SIZE = 8192;
char buffer[BUFFER_SIZE] = {0};
sizeWritten = read(SERVERSOCKET, buffer, BUFFER_SIZE);
if (sizeWritten < 0) {
std::println("{}", failureString("Couldn't read (6)"));
return "";
}
reply += std::string(buffer, sizeWritten);
while (sizeWritten == BUFFER_SIZE) {
sizeWritten = read(SERVERSOCKET, buffer, BUFFER_SIZE);
if (sizeWritten < 0) {
std::println("{}", failureString("Couldn't read (7)"));
return "";
}
reply += std::string(buffer, sizeWritten);
}
close(SERVERSOCKET);
return reply;
}

View File

@@ -0,0 +1,7 @@
#pragma once
#include <string>
namespace NHyprlandSocket {
std::string send(const std::string& cmd);
};

View File

@@ -1,6 +1,12 @@
#include "Manifest.hpp"
#include <toml++/toml.hpp>
#include <iostream>
#include <algorithm>
// Alphanumerics and -_ allowed for plugin names. No magic names.
// [A-Za-z0-9\-_]*
static bool validManifestName(const std::string_view& n) {
return std::ranges::all_of(n, [](const char& c) { return (c >= 'a' && c <= 'z') || (c >= 'A' && c <= 'Z') || c == '-' || c == '_' || c == '=' || (c >= '0' && c <= '9'); });
}
CManifest::CManifest(const eManifestType type, const std::string& path) {
auto manifest = toml::parse_file(path);
@@ -11,11 +17,17 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
continue;
CManifest::SManifestPlugin plugin;
if (!validManifestName(key.str())) {
m_good = false;
return;
}
plugin.name = key;
m_vPlugins.push_back(plugin);
m_plugins.push_back(plugin);
}
for (auto& plugin : m_vPlugins) {
for (auto& plugin : m_plugins) {
plugin.description = manifest[plugin.name]["description"].value_or("?");
plugin.version = manifest[plugin.name]["version"].value_or("?");
plugin.output = manifest[plugin.name]["build"]["output"].value_or("?");
@@ -37,21 +49,21 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
}
if (plugin.output.empty() || plugin.buildSteps.empty()) {
m_bGood = false;
m_good = false;
return;
}
}
} else if (type == MANIFEST_HYPRPM) {
m_sRepository.name = manifest["repository"]["name"].value_or("");
auto authors = manifest["repository"]["authors"].as_array();
m_repository.name = manifest["repository"]["name"].value_or("");
auto authors = manifest["repository"]["authors"].as_array();
if (authors) {
for (auto&& a : *authors) {
m_sRepository.authors.push_back(a.as_string()->value_or("?"));
m_repository.authors.push_back(a.as_string()->value_or("?"));
}
} else {
auto author = manifest["repository"]["author"].value_or("");
if (!std::string{author}.empty())
m_sRepository.authors.push_back(author);
m_repository.authors.push_back(author);
}
auto pins = manifest["repository"]["commit_pins"].as_array();
@@ -59,7 +71,7 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
for (auto&& pin : *pins) {
auto pinArr = pin.as_array();
if (pinArr && pinArr->get(1))
m_sRepository.commitPins.push_back(std::make_pair<>(pinArr->get(0)->as_string()->get(), pinArr->get(1)->as_string()->get()));
m_repository.commitPins.push_back(std::make_pair<>(pinArr->get(0)->as_string()->get(), pinArr->get(1)->as_string()->get()));
}
}
@@ -68,11 +80,17 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
continue;
CManifest::SManifestPlugin plugin;
if (!validManifestName(key.str())) {
m_good = false;
return;
}
plugin.name = key;
m_vPlugins.push_back(plugin);
m_plugins.push_back(plugin);
}
for (auto& plugin : m_vPlugins) {
for (auto& plugin : m_plugins) {
plugin.description = manifest[plugin.name]["description"].value_or("?");
plugin.output = manifest[plugin.name]["output"].value_or("?");
plugin.since = manifest[plugin.name]["since_hyprland"].value_or(0);
@@ -94,12 +112,12 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
}
if (plugin.output.empty() || plugin.buildSteps.empty()) {
m_bGood = false;
m_good = false;
return;
}
}
} else {
// ???
m_bGood = false;
m_good = false;
}
}

View File

@@ -27,8 +27,8 @@ class CManifest {
std::string name;
std::vector<std::string> authors;
std::vector<std::pair<std::string, std::string>> commitPins;
} m_sRepository;
} m_repository;
std::vector<SManifestPlugin> m_vPlugins;
bool m_bGood = true;
std::vector<SManifestPlugin> m_plugins;
bool m_good = true;
};

File diff suppressed because it is too large Load Diff

View File

@@ -2,6 +2,7 @@
#include <memory>
#include <string>
#include <utility>
enum eHeadersErrors {
HEADERS_OK = 0,
@@ -26,7 +27,8 @@ enum ePluginLoadStateReturn {
LOADSTATE_OK = 0,
LOADSTATE_FAIL,
LOADSTATE_PARTIAL_FAIL,
LOADSTATE_HEADERS_OUTDATED
LOADSTATE_HEADERS_OUTDATED,
LOADSTATE_HYPRLAND_UPDATED
};
struct SHyprlandVersion {
@@ -38,6 +40,8 @@ struct SHyprlandVersion {
class CPluginManager {
public:
CPluginManager();
bool addNewPluginRepo(const std::string& url, const std::string& rev);
bool removePluginRepo(const std::string& urlOrName);
@@ -49,10 +53,10 @@ class CPluginManager {
bool enablePlugin(const std::string& name);
bool disablePlugin(const std::string& name);
ePluginLoadStateReturn ensurePluginsLoadState();
ePluginLoadStateReturn ensurePluginsLoadState(bool forceReload = false);
bool loadUnloadPlugin(const std::string& path, bool load);
SHyprlandVersion getHyprlandVersion();
SHyprlandVersion getHyprlandVersion(bool running = true);
void notify(const eNotifyIcons icon, uint32_t color, int durationMs, const std::string& message);
@@ -60,6 +64,7 @@ class CPluginManager {
bool m_bVerbose = false;
bool m_bNoShallow = false;
std::string m_szCustomHlUrl, m_szUsername;
// will delete recursively if exists!!
bool createSafeDirectory(const std::string& path);
@@ -68,7 +73,7 @@ class CPluginManager {
std::string headerError(const eHeadersErrors err);
std::string headerErrorShort(const eHeadersErrors err);
std::string m_szWorkingPluginDirectory = "";
std::string m_szWorkingPluginDirectory;
};
inline std::unique_ptr<CPluginManager> g_pPluginManager;

View File

@@ -0,0 +1,15 @@
#pragma once
#include <format>
#include <iostream>
// NOLINTNEXTLINE
namespace Debug {
template <typename... Args>
void die(std::format_string<Args...> fmt, Args&&... args) {
const std::string logMsg = std::vformat(fmt.get(), std::make_format_args(args...));
std::cout << "\n[ERR] " << logMsg << "\n";
exit(1);
}
};

View File

@@ -0,0 +1,32 @@
#pragma once
#include <format>
#include <string>
#include "Colors.hpp"
template <typename... Args>
std::string statusString(const std::string_view emoji, const std::string_view color, const std::string_view fmt, Args&&... args) {
std::string ret = std::format("{}{}{} ", color, emoji, Colors::RESET);
ret += std::vformat(fmt, std::make_format_args(args...));
return ret;
}
template <typename... Args>
std::string successString(const std::string_view fmt, Args&&... args) {
return statusString("", Colors::GREEN, fmt, args...);
}
template <typename... Args>
std::string failureString(const std::string_view fmt, Args&&... args) {
return statusString("", Colors::RED, fmt, args...);
}
template <typename... Args>
std::string verboseString(const std::string_view fmt, Args&&... args) {
return statusString("[v]", Colors::BLUE, fmt, args...);
}
template <typename... Args>
std::string infoString(const std::string_view fmt, Args&&... args) {
return statusString("", Colors::RESET, fmt, args...);
}

168
hyprpm/src/helpers/Sys.cpp Normal file
View File

@@ -0,0 +1,168 @@
#include "Sys.hpp"
#include "Die.hpp"
#include "StringUtils.hpp"
#include <pwd.h>
#include <unistd.h>
#include <sstream>
#include <print>
#include <filesystem>
#include <algorithm>
#include <hyprutils/os/Process.hpp>
#include <hyprutils/string/VarList.hpp>
using namespace Hyprutils::OS;
using namespace Hyprutils::String;
inline constexpr std::array<std::string_view, 3> SUPERUSER_BINARIES = {
"sudo",
"doas",
"run0",
};
static std::string validSubinsAsStr() {
std::ostringstream oss;
auto it = SUPERUSER_BINARIES.begin();
if (it != SUPERUSER_BINARIES.end()) {
oss << *it++;
for (; it != SUPERUSER_BINARIES.end(); ++it)
oss << ", " << *it;
}
return oss.str();
}
static bool executableExistsInPath(const std::string& exe) {
const char* PATHENV = std::getenv("PATH");
if (!PATHENV)
return false;
CVarList paths(PATHENV, 0, ':', true);
std::error_code ec;
for (const auto& PATH : paths) {
std::filesystem::path candidate = std::filesystem::path(PATH) / exe;
if (!std::filesystem::exists(candidate, ec) || ec)
continue;
if (!std::filesystem::is_regular_file(candidate, ec) || ec)
continue;
auto perms = std::filesystem::status(candidate, ec).permissions();
if (ec)
continue;
if ((perms & std::filesystem::perms::others_exec) != std::filesystem::perms::none)
return true;
}
return false;
}
static std::string subin() {
static std::string bin;
static bool once = true;
if (!once)
return bin;
for (const auto& BIN : SUPERUSER_BINARIES) {
if (!executableExistsInPath(std::string{BIN}))
continue;
bin = BIN;
break;
}
once = false;
if (bin.empty())
Debug::die("{}", failureString("No valid superuser binary present. Supported: {}", validSubinsAsStr()));
return bin;
}
static bool verifyStringValid(const std::string& s) {
return std::ranges::none_of(s, [](const char& c) { return c == '`' || c == '$' || c == '(' || c == ')' || c == '\'' || c == '"'; });
}
int NSys::getUID() {
const auto UID = getuid();
const auto PWUID = getpwuid(UID);
return PWUID ? PWUID->pw_uid : UID;
}
int NSys::getEUID() {
const auto UID = geteuid();
const auto PWUID = getpwuid(UID);
return PWUID ? PWUID->pw_uid : UID;
}
bool NSys::isSuperuser() {
return getuid() != geteuid() || geteuid() == 0;
}
void NSys::root::cacheSudo() {
// "caches" the sudo so that the prompt later doesn't pop up in a weird spot
// sudo will not ask us again for a moment
CProcess proc(subin(), {"echo", "hyprland"});
proc.runSync();
}
void NSys::root::dropSudo() {
if (subin() != "sudo") {
std::println("{}", infoString("Don't know how to drop timestamp for '{}', ignoring.", subin()));
return;
}
CProcess proc(subin(), {"-k"});
proc.runSync();
}
bool NSys::root::createDirectory(const std::string& path, const std::string& mode) {
if (!verifyStringValid(path))
return false;
if (!std::ranges::all_of(mode, [](const char& c) { return c >= '0' && c <= '9'; }))
return false;
CProcess proc(subin(), {"mkdir", "-p", "-m", mode, path});
return proc.runSync() && proc.exitCode() == 0;
}
bool NSys::root::removeRecursive(const std::string& path) {
if (!verifyStringValid(path))
return false;
std::error_code ec;
const std::string PATH_ABSOLUTE = std::filesystem::canonical(path, ec);
if (ec)
return false;
if (!PATH_ABSOLUTE.starts_with("/var/cache/hyprpm"))
return false;
CProcess proc(subin(), {"rm", "-fr", PATH_ABSOLUTE});
return proc.runSync() && proc.exitCode() == 0;
}
bool NSys::root::install(const std::string& what, const std::string& where, const std::string& mode) {
if (!verifyStringValid(what) || !verifyStringValid(where))
return false;
if (!std::ranges::all_of(mode, [](const char& c) { return c >= '0' && c <= '9'; }))
return false;
CProcess proc(subin(), {"install", "-m" + mode, "-o", "0", "-g", "0", what, where});
return proc.runSync() && proc.exitCode() == 0;
}
std::string NSys::root::runAsSuperuserUnsafe(const std::string& cmd) {
CProcess proc(subin(), {"/bin/sh", "-c", cmd});
if (!proc.runSync())
return "";
return proc.stdOut();
}

View File

@@ -0,0 +1,23 @@
#pragma once
#include <string>
namespace NSys {
bool isSuperuser();
int getUID();
int getEUID();
// NOLINTNEXTLINE
namespace root {
void cacheSudo();
void dropSudo();
//
[[nodiscard("Discarding could lead to vulnerabilities and bugs")]] bool createDirectory(const std::string& path, const std::string& mode);
[[nodiscard("Discarding could lead to vulnerabilities and bugs")]] bool removeRecursive(const std::string& path);
[[nodiscard("Discarding could lead to vulnerabilities and bugs")]] bool install(const std::string& what, const std::string& where, const std::string& mode);
// Do not use this unless absolutely necessary!
std::string runAsSuperuserUnsafe(const std::string& cmd);
};
};

View File

@@ -1,105 +1,139 @@
#include "progress/CProgressBar.hpp"
#include "helpers/Colors.hpp"
#include "helpers/StringUtils.hpp"
#include "core/PluginManager.hpp"
#include "core/DataState.hpp"
#include "helpers/Sys.hpp"
#include <iostream>
#include <vector>
#include <string>
#include <chrono>
#include <thread>
#include <print>
const std::string HELP = R"#(┏ hyprpm, a Hyprland Plugin Manager
#include <hyprutils/utils/ScopeGuard.hpp>
using namespace Hyprutils::Utils;
constexpr std::string_view HELP = R"#(┏ hyprpm, a Hyprland Plugin Manager
add [url] [git rev] Install a new plugin repository from git. Git revision
is optional, when set, commit locks are ignored.
remove [url/name] Remove an installed plugin repository
enable [name] Enable a plugin
disable [name] Disable a plugin
update Check and update all plugins if needed
remove [url/name] Remove an installed plugin repository.
enable [name] Enable a plugin.
disable [name] Disable a plugin.
update Check and update all plugins if needed.
reload Reload hyprpm state. Ensure all enabled plugins are loaded.
list List all installed plugins
list List all installed plugins.
purge-cache Remove the entire hyprpm cache, built plugins, hyprpm settings and headers.
Flags:
--notify | -n Send a hyprland notification for important events (e.g. load fail)
--help | -h Show this menu
--verbose | -v Enable too much logging
--force | -f Force an operation ignoring checks (e.g. update -f)
--no-shallow | -s Disable shallow cloning of Hyprland sources
--notify | -n Send a hyprland notification for important events (including both successes and fail events).
--notify-fail | -nn Send a hyprland notification for fail events only.
--help | -h Show this menu.
--verbose | -v Enable too much logging.
--force | -f Force an operation ignoring checks (e.g. update -f).
--no-shallow | -s Disable shallow cloning of Hyprland sources.
--hl-url | Pass a custom hyprland source url.
)#";
int main(int argc, char** argv, char** envp) {
int main(int argc, char** argv, char** envp) {
std::vector<std::string> ARGS{argc};
for (int i = 0; i < argc; ++i) {
ARGS[i] = std::string{argv[i]};
}
if (ARGS.size() < 2) {
std::cout << HELP;
std::println(stderr, "{}", HELP);
return 1;
}
std::vector<std::string> command;
bool notify = false, verbose = false, force = false, noShallow = false;
bool notify = false, notifyFail = false, verbose = false, force = false, noShallow = false;
std::string customHlUrl;
for (int i = 1; i < argc; ++i) {
if (ARGS[i].starts_with("-")) {
if (ARGS[i] == "--help" || ARGS[i] == "-h") {
std::cout << HELP;
std::println("{}", HELP);
return 0;
} else if (ARGS[i] == "--notify" || ARGS[i] == "-n") {
notify = true;
} else if (ARGS[i] == "--notify-fail" || ARGS[i] == "-nn") {
notifyFail = notify = true;
} else if (ARGS[i] == "--verbose" || ARGS[i] == "-v") {
verbose = true;
} else if (ARGS[i] == "--no-shallow" || ARGS[i] == "-s") {
noShallow = true;
} else if (ARGS[i] == "--hl-url") {
if (i + 1 >= argc) {
std::println(stderr, "Missing argument for --hl-url");
return 1;
}
customHlUrl = ARGS[i + 1];
i++;
} else if (ARGS[i] == "--force" || ARGS[i] == "-f") {
force = true;
std::cout << Colors::RED << "!" << Colors::RESET << " Using --force, I hope you know what you are doing.\n";
std::println("{}", statusString("!", Colors::RED, "Using --force, I hope you know what you are doing."));
} else {
std::cerr << "Unrecognized option " << ARGS[i] << "\n";
std::println(stderr, "Unrecognized option {}", ARGS[i]);
return 1;
}
} else {
} else
command.push_back(ARGS[i]);
}
}
if (command.empty()) {
std::cout << HELP;
return 0;
std::println(stderr, "{}", HELP);
return 1;
}
g_pPluginManager = std::make_unique<CPluginManager>();
g_pPluginManager->m_bVerbose = verbose;
g_pPluginManager->m_bNoShallow = noShallow;
g_pPluginManager = std::make_unique<CPluginManager>();
g_pPluginManager->m_bVerbose = verbose;
g_pPluginManager->m_bNoShallow = noShallow;
g_pPluginManager->m_szCustomHlUrl = customHlUrl;
if (command[0] == "add") {
if (command.size() < 2) {
std::cerr << Colors::RED << "" << Colors::RESET << " Not enough args for add.\n";
std::println(stderr, "{}", failureString("Not enough args for add."));
return 1;
}
std::string rev = "";
if (command.size() >= 3) {
if (command.size() >= 3)
rev = command[2];
}
return g_pPluginManager->addNewPluginRepo(command[1], rev) ? 0 : 1;
} else if (command[0] == "remove") {
if (ARGS.size() < 2) {
std::cerr << Colors::RED << "" << Colors::RESET << " Not enough args for remove.\n";
const auto HLVER = g_pPluginManager->getHyprlandVersion();
auto GLOBALSTATE = DataState::getGlobalState();
if (GLOBALSTATE.headersHashCompiled != HLVER.hash) {
std::println(stderr, "{}", failureString("Headers outdated, please run hyprpm update."));
return 1;
}
NSys::root::cacheSudo();
CScopeGuard x([] { NSys::root::dropSudo(); });
g_pPluginManager->updateHeaders(false);
return g_pPluginManager->addNewPluginRepo(command[1], rev) ? 0 : 1;
} else if (command[0] == "remove") {
if (command.size() < 2) {
std::println(stderr, "{}", failureString("Not enough args for remove."));
return 1;
}
NSys::root::cacheSudo();
CScopeGuard x([] { NSys::root::dropSudo(); });
return g_pPluginManager->removePluginRepo(command[1]) ? 0 : 1;
} else if (command[0] == "update") {
bool headersValid = g_pPluginManager->headersValid() == HEADERS_OK;
bool headers = g_pPluginManager->updateHeaders(force);
NSys::root::cacheSudo();
CScopeGuard x([] { NSys::root::dropSudo(); });
bool headersValid = g_pPluginManager->headersValid() == HEADERS_OK;
bool headers = g_pPluginManager->updateHeaders(force);
if (headers) {
const auto HLVER = g_pPluginManager->getHyprlandVersion();
const auto HLVER = g_pPluginManager->getHyprlandVersion(false);
auto GLOBALSTATE = DataState::getGlobalState();
const auto COMPILEDOUTDATED = HLVER.hash != GLOBALSTATE.headersHashCompiled;
@@ -110,59 +144,81 @@ int main(int argc, char** argv, char** envp) {
auto ret2 = g_pPluginManager->ensurePluginsLoadState();
if (ret2 == LOADSTATE_HYPRLAND_UPDATED)
g_pPluginManager->notify(ICON_INFO, 0, 10000, "[hyprpm] Updated plugins, but Hyprland was updated. Please restart Hyprland.");
if (ret2 != LOADSTATE_OK)
return 1;
} else if (notify)
g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Couldn't update headers");
} else if (command[0] == "enable") {
if (ARGS.size() < 2) {
std::cerr << Colors::RED << "" << Colors::RESET << " Not enough args for enable.\n";
if (command.size() < 2) {
std::println(stderr, "{}", failureString("Not enough args for enable."));
return 1;
}
if (!g_pPluginManager->enablePlugin(command[1])) {
std::cerr << Colors::RED << "" << Colors::RESET << " Couldn't enable plugin (missing?)\n";
std::println(stderr, "{}", failureString("Couldn't enable plugin (missing?)"));
return 1;
}
auto ret = g_pPluginManager->ensurePluginsLoadState();
NSys::root::cacheSudo();
CScopeGuard x([] { NSys::root::dropSudo(); });
auto ret = g_pPluginManager->ensurePluginsLoadState();
if (ret == LOADSTATE_HYPRLAND_UPDATED)
g_pPluginManager->notify(ICON_INFO, 0, 10000, "[hyprpm] Enabled plugin, but Hyprland was updated. Please restart Hyprland.");
if (ret != LOADSTATE_OK)
return 1;
} else if (command[0] == "disable") {
if (command.size() < 2) {
std::cerr << Colors::RED << "" << Colors::RESET << " Not enough args for disable.\n";
std::println(stderr, "{}", failureString("Not enough args for disable."));
return 1;
}
if (!g_pPluginManager->disablePlugin(command[1])) {
std::cerr << Colors::RED << "" << Colors::RESET << " Couldn't disable plugin (missing?)\n";
std::println(stderr, "{}", failureString("Couldn't disable plugin (missing?)"));
return 1;
}
auto ret = g_pPluginManager->ensurePluginsLoadState();
NSys::root::cacheSudo();
CScopeGuard x([] { NSys::root::dropSudo(); });
auto ret = g_pPluginManager->ensurePluginsLoadState();
if (ret != LOADSTATE_OK)
return 1;
} else if (command[0] == "reload") {
auto ret = g_pPluginManager->ensurePluginsLoadState();
auto ret = g_pPluginManager->ensurePluginsLoadState(force);
if (ret != LOADSTATE_OK && notify) {
switch (ret) {
case LOADSTATE_FAIL:
case LOADSTATE_PARTIAL_FAIL: g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Failed to load plugins"); break;
case LOADSTATE_HEADERS_OUTDATED:
g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Failed to load plugins: Outdated headers. Please run hyprpm update manually.");
break;
default: break;
if (ret != LOADSTATE_OK) {
if (notify) {
switch (ret) {
case LOADSTATE_FAIL:
case LOADSTATE_PARTIAL_FAIL: g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Failed to load plugins"); break;
case LOADSTATE_HEADERS_OUTDATED:
g_pPluginManager->notify(ICON_ERROR, 0, 10000, "[hyprpm] Failed to load plugins: Outdated headers. Please run hyprpm update manually.");
break;
default: break;
}
}
} else if (notify) {
return 1;
} else if (notify && !notifyFail) {
g_pPluginManager->notify(ICON_OK, 0, 4000, "[hyprpm] Loaded plugins");
}
} else if (command[0] == "purge-cache") {
NSys::root::cacheSudo();
CScopeGuard x([] { NSys::root::dropSudo(); });
DataState::purgeAllCache();
} else if (command[0] == "list") {
g_pPluginManager->listAllPlugins();
} else {
std::cout << HELP;
std::println(stderr, "{}", HELP);
return 1;
}
return 0;
}
}

View File

@@ -8,6 +8,7 @@ executable(
dependency('hyprutils', version: '>= 0.1.1'),
dependency('threads'),
dependency('tomlplusplus'),
dependency('glaze', method: 'cmake'),
],
install: true,
)

View File

@@ -1,80 +1,78 @@
#include "CProgressBar.hpp"
#include <iostream>
#include <algorithm>
#include <sys/ioctl.h>
#include <unistd.h>
#include <cmath>
#include <format>
#include <print>
#include <cstdio>
#include <sys/ioctl.h>
#include <stdio.h>
#include <unistd.h>
#include <algorithm>
#include <sstream>
#include "../helpers/Colors.hpp"
void CProgressBar::printMessageAbove(const std::string& msg) {
struct winsize w;
static winsize getTerminalSize() {
winsize w{};
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
return w;
}
std::string spaces;
for (size_t i = 0; i < w.ws_col; ++i) {
spaces += ' ';
}
static void clearCurrentLine() {
std::print("\r\33[2K"); // ansi escape sequence to clear entire line
}
std::cout << "\r" << spaces << "\r" << msg << "\n";
print();
void CProgressBar::printMessageAbove(const std::string& msg) {
clearCurrentLine();
std::print("\r{}\n", msg);
print(); // reprint bar underneath
}
void CProgressBar::print() {
struct winsize w;
ioctl(STDOUT_FILENO, TIOCGWINSZ, &w);
const auto w = getTerminalSize();
if (m_bFirstPrint)
std::cout << "\n";
m_bFirstPrint = false;
std::string spaces;
for (size_t i = 0; i < w.ws_col; ++i) {
spaces += ' ';
if (m_bFirstPrint) {
std::print("\n");
m_bFirstPrint = false;
}
std::cout << "\r" << spaces << "\r";
clearCurrentLine();
std::string message = "";
float percentDone = 0;
if (m_fPercentage >= 0)
float percentDone = 0.0f;
if (m_fPercentage >= 0.0f)
percentDone = m_fPercentage;
else
percentDone = (float)m_iSteps / (float)m_iMaxSteps;
const auto BARWIDTH = std::clamp(w.ws_col - static_cast<unsigned long>(m_szCurrentMessage.length()) - 2, 0UL, 50UL);
// draw bar
message += std::string{" "} + Colors::GREEN;
size_t i = 0;
for (; i < std::floor(percentDone * BARWIDTH); ++i) {
message += "";
else {
// check for divide-by-zero
percentDone = m_iMaxSteps > 0 ? static_cast<float>(m_iSteps) / m_iMaxSteps : 0.0f;
}
// clamp to ensure no overflows (sanity check)
percentDone = std::clamp(percentDone, 0.0f, 1.0f);
const size_t BARWIDTH = std::clamp<size_t>(w.ws_col - m_szCurrentMessage.length() - 2, 0, 50);
std::ostringstream oss;
oss << ' ' << Colors::GREEN;
size_t filled = static_cast<size_t>(std::floor(percentDone * BARWIDTH));
size_t i = 0;
for (; i < filled; ++i)
oss << "";
if (i < BARWIDTH) {
i++;
message += std::string{""} + Colors::RESET;
for (; i < BARWIDTH; ++i) {
message += "";
}
oss << "" << Colors::RESET;
++i;
for (; i < BARWIDTH; ++i)
oss << "";
} else
message += Colors::RESET;
oss << Colors::RESET;
// draw progress
if (m_fPercentage >= 0)
message += " " + std::format("{}%", static_cast<int>(percentDone * 100.0)) + " ";
if (m_fPercentage >= 0.0f)
oss << " " << std::format("{}%", static_cast<int>(percentDone * 100.0)) << ' ';
else
message += " " + std::format("{} / {}", m_iSteps, m_iMaxSteps) + " ";
// draw message
std::cout << message + " " + m_szCurrentMessage;
oss << " " << std::format("{} / {}", m_iSteps, m_iMaxSteps) << ' ';
std::print("{} {}", oss.str(), m_szCurrentMessage);
std::fflush(stdout);
}
}

View File

@@ -14,4 +14,4 @@ class CProgressBar {
private:
bool m_bFirstPrint = true;
};
};

30
hyprtester/CMakeLists.txt Normal file
View File

@@ -0,0 +1,30 @@
cmake_minimum_required(VERSION 3.19)
project(hyprtester DESCRIPTION "Hyprland test suite")
include(GNUInstallDirs)
set(CMAKE_CXX_STANDARD 26)
find_package(PkgConfig REQUIRED)
pkg_check_modules(hyprtester_deps REQUIRED IMPORTED_TARGET hyprutils>=0.5.0)
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
add_executable(hyprtester ${SRCFILES})
add_custom_command(
TARGET hyprtester
POST_BUILD
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/plugin/build.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/plugin)
target_link_libraries(hyprtester PUBLIC PkgConfig::hyprtester_deps)
install(TARGETS hyprtester)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/test.conf
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/hypr)
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/plugin/hyprtestplugin.so
DESTINATION ${CMAKE_INSTALL_PREFIX}/lib)

View File

@@ -0,0 +1,16 @@
CXXFLAGS = -shared -fPIC --no-gnu-unique -g -std=c++2b -Wno-c++11-narrowing
INCLUDES = `pkg-config --cflags pixman-1 libdrm pangocairo libinput libudev wayland-server xkbcommon`
LIBS = `pkg-config --libs pangocairo`
SRC = src/main.cpp
TARGET = hyprtestplugin.so
all: $(TARGET)
$(TARGET): $(SRC)
$(CXX) $(CXXFLAGS) -I../.. -I../../protocols $(INCLUDES) $^ $> -o $@ $(LIBS) -O2
clean:
rm -f ./$(TARGET)
.PHONY: all clean

4
hyprtester/plugin/build.sh Executable file
View File

@@ -0,0 +1,4 @@
#!/bin/sh
make clean
make all

View File

@@ -0,0 +1,5 @@
#pragma once
#include <src/plugins/PluginAPI.hpp>
inline HANDLE PHANDLE = nullptr;

View File

@@ -0,0 +1,62 @@
#include <unistd.h>
#include <src/includes.hpp>
#include <sstream>
#include <any>
#define private public
#include <src/config/ConfigManager.hpp>
#include <src/config/ConfigDescriptions.hpp>
#include <src/layout/IHyprLayout.hpp>
#include <src/managers/LayoutManager.hpp>
#include <src/Compositor.hpp>
#undef private
#include "globals.hpp"
// Do NOT change this function.
APICALL EXPORT std::string PLUGIN_API_VERSION() {
return HYPRLAND_API_VERSION;
}
static SDispatchResult test(std::string in) {
bool success = true;
std::string errors = "";
if (g_pConfigManager->m_configValueNumber != CONFIG_OPTIONS.size() + 1 /* autogenerated is special */) {
errors += "config value number mismatches descriptions size\n";
success = false;
}
return SDispatchResult{
.success = success,
.error = errors,
};
}
// Trigger a snap move event for the active window
static SDispatchResult snapMove(std::string in) {
const auto PLASTWINDOW = g_pCompositor->m_lastWindow.lock();
if (!PLASTWINDOW->m_isFloating)
return {.success = false, .error = "Window must be floating"};
Vector2D pos = PLASTWINDOW->m_realPosition->goal();
Vector2D size = PLASTWINDOW->m_realSize->goal();
g_pLayoutManager->getCurrentLayout()->performSnap(pos, size, PLASTWINDOW, MBIND_MOVE, -1, size);
*PLASTWINDOW->m_realPosition = pos.round();
return {};
}
APICALL EXPORT PLUGIN_DESCRIPTION_INFO PLUGIN_INIT(HANDLE handle) {
PHANDLE = handle;
HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:test:test", ::test);
HyprlandAPI::addDispatcherV2(PHANDLE, "plugin:test:snapmove", ::snapMove);
return {"hyprtestplugin", "hyprtestplugin", "Vaxry", "1.0"};
}
APICALL EXPORT void PLUGIN_EXIT() {
;
}

17
hyprtester/src/Log.hpp Normal file
View File

@@ -0,0 +1,17 @@
#pragma once
#include <string>
#include <format>
#include <print>
namespace NLog {
template <typename... Args>
//NOLINTNEXTLINE
void log(std::format_string<Args...> fmt, Args&&... args) {
std::string logMsg = "";
logMsg += std::vformat(fmt.get(), std::make_format_args(args...));
std::println("{}", logMsg);
std::fflush(stdout);
}
}

View File

@@ -0,0 +1,136 @@
#include "hyprctlCompat.hpp"
#include "shared.hpp"
#include <pwd.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <filesystem>
#include <fstream>
#include <algorithm>
#include <csignal>
#include <cerrno>
#include <print>
static int getUID() {
const auto UID = getuid();
const auto PWUID = getpwuid(UID);
return PWUID ? PWUID->pw_uid : UID;
}
static std::string getRuntimeDir() {
const auto XDG = getenv("XDG_RUNTIME_DIR");
if (!XDG) {
const std::string USERID = std::to_string(getUID());
return "/run/user/" + USERID + "/hypr";
}
return std::string{XDG} + "/hypr";
}
std::vector<SInstanceData> instances() {
std::vector<SInstanceData> result;
try {
if (!std::filesystem::exists(getRuntimeDir()))
return {};
} catch (std::exception& e) { return {}; }
for (const auto& el : std::filesystem::directory_iterator(getRuntimeDir())) {
if (!el.is_directory() || !std::filesystem::exists(el.path().string() + "/hyprland.lock"))
continue;
// read lock
SInstanceData* data = &result.emplace_back();
data->id = el.path().filename().string();
try {
data->time = std::stoull(data->id.substr(data->id.find_first_of('_') + 1, data->id.find_last_of('_') - (data->id.find_first_of('_') + 1)));
} catch (std::exception& e) { continue; }
// read file
std::ifstream ifs(el.path().string() + "/hyprland.lock");
int i = 0;
for (std::string line; std::getline(ifs, line); ++i) {
if (i == 0) {
try {
data->pid = std::stoull(line);
} catch (std::exception& e) { continue; }
} else if (i == 1) {
data->wlSocket = line;
} else
break;
}
ifs.close();
}
std::erase_if(result, [&](const auto& el) { return kill(el.pid, 0) != 0 && errno == ESRCH; });
std::sort(result.begin(), result.end(), [&](const auto& a, const auto& b) { return a.time < b.time; });
return result;
}
std::string getFromSocket(const std::string& cmd) {
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
auto t = timeval{.tv_sec = 5, .tv_usec = 0};
setsockopt(SERVERSOCKET, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(struct timeval));
if (SERVERSOCKET < 0) {
std::println("socket: Couldn't open a socket (1)");
return "";
}
sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;
std::string socketPath = getRuntimeDir() + "/" + HIS + "/.socket.sock";
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
std::println("Couldn't connect to {}. (3)", socketPath);
return "";
}
auto sizeWritten = write(SERVERSOCKET, cmd.c_str(), cmd.length());
if (sizeWritten < 0) {
std::println("Couldn't write (4)");
return "";
}
std::string reply = "";
char buffer[8192] = {0};
sizeWritten = read(SERVERSOCKET, buffer, 8192);
if (sizeWritten < 0) {
if (errno == EWOULDBLOCK)
std::println("Hyprland IPC didn't respond in time");
std::println("Couldn't read (5)");
return "";
}
reply += std::string(buffer, sizeWritten);
while (sizeWritten == 8192) {
sizeWritten = read(SERVERSOCKET, buffer, 8192);
if (sizeWritten < 0) {
std::println("Couldn't read (5)");
return "";
}
reply += std::string(buffer, sizeWritten);
}
close(SERVERSOCKET);
return reply;
}

View File

@@ -0,0 +1,16 @@
#pragma once
#include <vector>
#include <string>
#include <cstdint>
struct SInstanceData {
std::string id;
uint64_t time;
uint64_t pid;
std::string wlSocket;
bool valid = true;
};
std::vector<SInstanceData> instances();
std::string getFromSocket(const std::string& cmd);

240
hyprtester/src/main.cpp Normal file
View File

@@ -0,0 +1,240 @@
// This is a tester for Hyprland. It will launch the built binary in ./build/Hyprland
// in headless mode and test various things.
// for now it's quite basic and limited, but will be expanded in the future.
// NOTE: This tester has to be ran from its directory!!
// Some TODO:
// - Add a plugin built alongside so that we can do more detailed tests (e.g. simulating keystrokes)
// - test coverage
// - maybe figure out a way to do some visual tests too?
// Required runtime deps for checks:
// - kitty
// - xeyes
#include "shared.hpp"
#include "hyprctlCompat.hpp"
#include "tests/main/tests.hpp"
#include "tests/plugin/plugin.hpp"
#include <filesystem>
#include <hyprutils/os/Process.hpp>
#include <hyprutils/memory/WeakPtr.hpp>
#include <csignal>
#include <cerrno>
#include <chrono>
#include <thread>
#include <print>
#include "Log.hpp"
using namespace Hyprutils::OS;
using namespace Hyprutils::Memory;
#define SP CSharedPointer
static int ret = 0;
static SP<CProcess> hyprlandProc;
static const std::string cwd = std::filesystem::current_path().string();
//
static bool launchHyprland(std::string configPath, std::string binaryPath) {
if (binaryPath == "") {
std::error_code ec;
if (!std::filesystem::exists(cwd + "/../build/Hyprland", ec) || ec) {
NLog::log("{}No Hyprland binary", Colors::RED);
return false;
}
binaryPath = cwd + "/../build/Hyprland";
}
if (configPath == "") {
std::error_code ec;
if (!std::filesystem::exists(cwd + "/test.conf", ec) || ec) {
NLog::log("{}No test config", Colors::RED);
return false;
}
configPath = cwd + "/test.conf";
}
NLog::log("{}Launching Hyprland", Colors::YELLOW);
hyprlandProc = makeShared<CProcess>(binaryPath, std::vector<std::string>{"--config", configPath});
hyprlandProc->addEnv("HYPRLAND_HEADLESS_ONLY", "1");
NLog::log("{}Launched async process", Colors::YELLOW);
return hyprlandProc->runAsync();
}
static bool hyprlandAlive() {
NLog::log("{}hyprlandAlive", Colors::YELLOW);
kill(hyprlandProc->pid(), 0);
return errno != ESRCH;
}
static void help() {
NLog::log("usage: hyprtester [arg [...]].\n");
NLog::log(R"(Arguments:
--help -h - Show this message again
--config FILE -c FILE - Specify config file to use
--binary FILE -b FILE - Specify Hyprland binary to use
--plugin FILE -p FILE - Specify the location of the test plugin)");
}
int main(int argc, char** argv, char** envp) {
std::string configPath = "";
std::string binaryPath = "";
std::string pluginPath = std::filesystem::current_path().string();
std::vector<std::string> args{argv + 1, argv + argc};
for (auto it = args.begin(); it != args.end(); it++) {
if (*it == "--config" || *it == "-c") {
if (std::next(it) == args.end()) {
help();
return 1;
}
configPath = *std::next(it);
try {
configPath = std::filesystem::canonical(configPath);
if (!std::filesystem::is_regular_file(configPath)) {
throw std::exception();
}
} catch (...) {
std::println(stderr, "[ ERROR ] Config file '{}' doesn't exist!", configPath);
help();
return 1;
}
it++;
continue;
} else if (*it == "--binary" || *it == "-b") {
if (std::next(it) == args.end()) {
help();
return 1;
}
binaryPath = *std::next(it);
try {
binaryPath = std::filesystem::canonical(binaryPath);
if (!std::filesystem::is_regular_file(binaryPath)) {
throw std::exception();
}
} catch (...) {
std::println(stderr, "[ ERROR ] Binary '{}' doesn't exist!", binaryPath);
help();
return 1;
}
it++;
continue;
} else if (*it == "--plugin" || *it == "-p") {
if (std::next(it) == args.end()) {
help();
return 1;
}
pluginPath = *std::next(it);
try {
pluginPath = std::filesystem::canonical(pluginPath);
if (!std::filesystem::is_regular_file(pluginPath)) {
throw std::exception();
}
} catch (...) {
std::println(stderr, "[ ERROR ] plugin '{}' doesn't exist!", pluginPath);
help();
return 1;
}
it++;
continue;
} else if (*it == "--help" || *it == "-h") {
help();
return 0;
} else {
std::println(stderr, "[ ERROR ] Unknown option '{}' !", *it);
help();
return 1;
}
}
NLog::log("{}launching hl", Colors::YELLOW);
if (!launchHyprland(configPath, binaryPath)) {
NLog::log("{}well it failed", Colors::RED);
return 1;
}
// hyprland has launched, let's check if it's alive after 10s
std::this_thread::sleep_for(std::chrono::milliseconds(10000));
NLog::log("{}slept for 10s", Colors::YELLOW);
if (!hyprlandAlive()) {
NLog::log("{}Hyprland failed to launch", Colors::RED);
return 1;
}
// wonderful, we are in. Let's get the instance signature.
NLog::log("{}trying to get INSTANCES", Colors::YELLOW);
const auto INSTANCES = instances();
if (INSTANCES.empty()) {
NLog::log("{}Hyprland failed to launch (2)", Colors::RED);
return 1;
}
HIS = INSTANCES.back().id;
WLDISPLAY = INSTANCES.back().wlSocket;
NLog::log("{}trying to get create headless output", Colors::YELLOW);
getFromSocket("/output create headless");
NLog::log("{}trying to load plugin", Colors::YELLOW);
if (const auto R = getFromSocket(std::format("/plugin load {}", pluginPath)); R != "ok") {
NLog::log("{}Failed to load the test plugin: {}", Colors::RED, R);
getFromSocket("/dispatch exit 1");
return 1;
}
NLog::log("{}Loaded plugin", Colors::YELLOW);
for (const auto& fn : testFns) {
EXPECT(fn(), true);
}
NLog::log("{}running plugin test", Colors::YELLOW);
EXPECT(testPlugin(), true);
// kill hyprland
NLog::log("{}dispatching exit", Colors::YELLOW);
getFromSocket("/dispatch exit");
NLog::log("\n{}Summary:\n\tPASSED: {}{}{}/{}\n\tFAILED: {}{}{}/{}\n{}", Colors::RESET, Colors::GREEN, TESTS_PASSED, Colors::RESET, TESTS_PASSED + TESTS_FAILED, Colors::RED,
TESTS_FAILED, Colors::RESET, TESTS_PASSED + TESTS_FAILED, (TESTS_FAILED > 0 ? std::string{Colors::RED} + "\nSome tests failed.\n" : ""));
kill(hyprlandProc->pid(), SIGKILL);
hyprlandProc.reset();
return ret || TESTS_FAILED;
}

90
hyprtester/src/shared.hpp Normal file
View File

@@ -0,0 +1,90 @@
// Stolen from hyprutils
#pragma once
#include <iostream>
inline std::string HIS = "";
inline std::string WLDISPLAY = "";
inline int TESTS_PASSED = 0;
inline int TESTS_FAILED = 0;
namespace Colors {
constexpr const char* RED = "\x1b[31m";
constexpr const char* GREEN = "\x1b[32m";
constexpr const char* YELLOW = "\x1b[33m";
constexpr const char* BLUE = "\x1b[34m";
constexpr const char* MAGENTA = "\x1b[35m";
constexpr const char* CYAN = "\x1b[36m";
constexpr const char* RESET = "\x1b[0m";
};
#define EXPECT(expr, val) \
if (const auto RESULT = expr; RESULT != (val)) { \
NLog::log("{}Failed: {}{}, expected {}, got {}. Source: {}@{}.", Colors::RED, Colors::RESET, #expr, val, RESULT, __FILE__, __LINE__); \
ret = 1; \
TESTS_FAILED++; \
} else { \
NLog::log("{}Passed: {}{}. Got {}", Colors::GREEN, Colors::RESET, #expr, val); \
TESTS_PASSED++; \
}
#define EXPECT_VECTOR2D(expr, val) \
do { \
const auto& RESULT = expr; \
const auto& EXPECTED = val; \
if (!(std::abs(RESULT.x - EXPECTED.x) < 1e-6 && std::abs(RESULT.y - EXPECTED.y) < 1e-6)) { \
NLog::log("{}Failed: {}{}, expected [{}, {}], got [{}, {}]. Source: {}@{}.", Colors::RED, Colors::RESET, #expr, EXPECTED.x, EXPECTED.y, RESULT.x, RESULT.y, __FILE__, \
__LINE__); \
ret = 1; \
TESTS_FAILED++; \
} else { \
NLog::log("{}Passed: {}{}. Got [{}, {}].", Colors::GREEN, Colors::RESET, #expr, RESULT.x, RESULT.y); \
TESTS_PASSED++; \
} \
} while (0)
#define EXPECT_CONTAINS(haystack, needle) \
if (const auto EXPECTED = needle; !std::string{haystack}.contains(EXPECTED)) { \
NLog::log("{}Failed: {}{} should contain {} but doesn't. Source: {}@{}. Haystack is:\n{}", Colors::RED, Colors::RESET, #haystack, EXPECTED, __FILE__, __LINE__, \
std::string{haystack}); \
ret = 1; \
TESTS_FAILED++; \
} else { \
NLog::log("{}Passed: {}{} contains {}.", Colors::GREEN, Colors::RESET, #haystack, EXPECTED); \
TESTS_PASSED++; \
}
#define EXPECT_NOT_CONTAINS(haystack, needle) \
if (std::string{haystack}.contains(needle)) { \
NLog::log("{}Failed: {}{} shouldn't contain {} but does. Source: {}@{}. Haystack is:\n{}", Colors::RED, Colors::RESET, #haystack, #needle, __FILE__, __LINE__, \
std::string{haystack}); \
ret = 1; \
TESTS_FAILED++; \
} else { \
NLog::log("{}Passed: {}{} doesn't contain {}.", Colors::GREEN, Colors::RESET, #haystack, #needle); \
TESTS_PASSED++; \
}
#define EXPECT_STARTS_WITH(str, what) \
if (!std::string{str}.starts_with(what)) { \
NLog::log("{}Failed: {}{} should start with {} but doesn't. Source: {}@{}. String is:\n{}", Colors::RED, Colors::RESET, #str, #what, __FILE__, __LINE__, \
std::string{str}); \
ret = 1; \
TESTS_FAILED++; \
} else { \
NLog::log("{}Passed: {}{} starts with {}.", Colors::GREEN, Colors::RESET, #str, #what); \
TESTS_PASSED++; \
}
#define EXPECT_COUNT_STRING(str, what, no) \
if (Tests::countOccurrences(str, what) != no) { \
NLog::log("{}Failed: {}{} should contain {} {} times, but doesn't. Source: {}@{}. String is:\n{}", Colors::RED, Colors::RESET, #str, #what, no, __FILE__, __LINE__, \
std::string{str}); \
ret = 1; \
TESTS_FAILED++; \
} else { \
NLog::log("{}Passed: {}{} contains {} {} times.", Colors::GREEN, Colors::RESET, #str, #what, no); \
TESTS_PASSED++; \
}
#define OK(x) EXPECT(x, "ok")

View File

@@ -0,0 +1,22 @@
#include "../../Log.hpp"
#include "tests.hpp"
#include "../../shared.hpp"
#include "../../hyprctlCompat.hpp"
#include <hyprutils/os/Process.hpp>
#include <hyprutils/memory/WeakPtr.hpp>
static int ret = 0;
using namespace Hyprutils::OS;
using namespace Hyprutils::Memory;
static bool test() {
NLog::log("{}Testing animations", Colors::GREEN);
auto str = getFromSocket("/animations");
NLog::log("{}Testing bezier curve output from `hyprctl animations`", Colors::YELLOW);
{EXPECT_CONTAINS(str, std::format("beziers:\n\n\tname: quick\n\t\tX0: 0.15\n\t\tY0: 0.00\n\t\tX1: 0.10\n\t\tY1: 1.00"))};
return !ret;
}
REGISTER_TEST_FN(test)

View File

@@ -0,0 +1,179 @@
#include "tests.hpp"
#include "../../shared.hpp"
#include "../../hyprctlCompat.hpp"
#include <print>
#include <thread>
#include <chrono>
#include <hyprutils/os/Process.hpp>
#include <hyprutils/memory/WeakPtr.hpp>
#include <csignal>
#include <cerrno>
#include "../shared.hpp"
static int ret = 0;
using namespace Hyprutils::OS;
using namespace Hyprutils::Memory;
#define UP CUniquePointer
#define SP CSharedPointer
static bool test() {
NLog::log("{}Testing groups", Colors::GREEN);
// test on workspace "window"
NLog::log("{}Dispatching workspace `groups`", Colors::YELLOW);
getFromSocket("/dispatch workspace name:groups");
NLog::log("{}Spawning kittyProcA", Colors::YELLOW);
auto kittyProcA = Tests::spawnKitty();
if (!kittyProcA) {
NLog::log("{}Error: kitty did not spawn", Colors::RED);
return false;
}
NLog::log("{}Expecting 1 window", Colors::YELLOW);
EXPECT(Tests::windowCount(), 1);
// check kitty properties. One kitty should take the entire screen, minus the gaps.
NLog::log("{}Check kitty dimensions", Colors::YELLOW);
{
auto str = getFromSocket("/clients");
EXPECT_COUNT_STRING(str, "at: 22,22", 1);
EXPECT_COUNT_STRING(str, "size: 1876,1036", 1);
EXPECT_COUNT_STRING(str, "fullscreen: 0", 1);
}
// group the kitty
NLog::log("{}Enable group and groupbar", Colors::YELLOW);
OK(getFromSocket("/dispatch togglegroup"));
OK(getFromSocket("/keyword group:groupbar:enabled 1"));
// check the height of the window now
NLog::log("{}Recheck kitty dimensions", Colors::YELLOW);
{
auto str = getFromSocket("/clients");
EXPECT_CONTAINS(str, "at: 22,43");
EXPECT_CONTAINS(str, "size: 1876,1015");
}
// disable the groupbar for ease of testing for now
NLog::log("{}Disable groupbar", Colors::YELLOW);
OK(getFromSocket("r/keyword group:groupbar:enabled 0"));
// kill all
NLog::log("{}Kill windows", Colors::YELLOW);
Tests::killAllWindows();
NLog::log("{}Spawn kitty again", Colors::YELLOW);
kittyProcA = Tests::spawnKitty();
if (!kittyProcA) {
NLog::log("{}Error: kitty did not spawn", Colors::RED);
return false;
}
NLog::log("{}Group kitty", Colors::YELLOW);
OK(getFromSocket("/dispatch togglegroup"));
// check the height of the window now
NLog::log("{}Check kitty dimensions 2", Colors::YELLOW);
{
auto str = getFromSocket("/clients");
EXPECT_CONTAINS(str, "at: 22,22");
EXPECT_CONTAINS(str, "size: 1876,1036");
}
NLog::log("{}Spawn kittyProcB", Colors::YELLOW);
auto kittyProcB = Tests::spawnKitty();
if (!kittyProcB) {
NLog::log("{}Error: kitty did not spawn", Colors::RED);
return false;
}
NLog::log("{}Expecting 2 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 2);
size_t lastActiveKittyIdx = 0;
NLog::log("{}Get last active kitty id", Colors::YELLOW);
try {
auto str = getFromSocket("/activewindow");
lastActiveKittyIdx = std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16);
} catch (...) {
NLog::log("{}Fail at getting prop", Colors::RED);
ret = 1;
}
// test cycling through
NLog::log("{}Test cycling through grouped windows", Colors::YELLOW);
OK(getFromSocket("/dispatch changegroupactive f"));
try {
auto str = getFromSocket("/activewindow");
EXPECT(lastActiveKittyIdx != std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16), true);
} catch (...) {
NLog::log("{}Fail at getting prop", Colors::RED);
ret = 1;
}
getFromSocket("/dispatch changegroupactive f");
try {
auto str = getFromSocket("/activewindow");
EXPECT(lastActiveKittyIdx, std::stoull(str.substr(7, str.find(" -> ") - 7), nullptr, 16));
} catch (...) {
NLog::log("{}Fail at getting prop", Colors::RED);
ret = 1;
}
NLog::log("{}Disable autogrouping", Colors::YELLOW);
OK(getFromSocket("/keyword group:auto_group false"));
NLog::log("{}Spawn kittyProcC", Colors::YELLOW);
auto kittyProcC = Tests::spawnKitty();
if (!kittyProcC) {
NLog::log("{}Error: kitty did not spawn", Colors::RED);
return false;
}
NLog::log("{}Expecting 3 windows 2", Colors::YELLOW);
EXPECT(Tests::windowCount(), 3);
{
auto str = getFromSocket("/clients");
EXPECT_COUNT_STRING(str, "at: 22,22", 2);
}
OK(getFromSocket("/dispatch movefocus l"));
OK(getFromSocket("/dispatch changegroupactive 1"));
OK(getFromSocket("/keyword group:auto_group true"));
OK(getFromSocket("/keyword group:insert_after_current false"));
NLog::log("{}Spawn kittyProcD", Colors::YELLOW);
auto kittyProcD = Tests::spawnKitty();
if (!kittyProcD) {
NLog::log("{}Error: kitty did not spawn", Colors::RED);
return false;
}
NLog::log("{}Expecting 4 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 4);
OK(getFromSocket("/dispatch changegroupactive 3"));
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, std::format("pid: {}", kittyProcD->pid()));
}
// kill all
NLog::log("{}Kill windows", Colors::YELLOW);
Tests::killAllWindows();
NLog::log("{}Expecting 0 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 0);
return !ret;
}
REGISTER_TEST_FN(test)

View File

@@ -0,0 +1,144 @@
#include "tests.hpp"
#include "../../shared.hpp"
#include "../../hyprctlCompat.hpp"
#include <print>
#include <thread>
#include <chrono>
#include <hyprutils/os/Process.hpp>
#include <hyprutils/memory/WeakPtr.hpp>
#include <csignal>
#include <cerrno>
#include "../shared.hpp"
static int ret = 0;
using namespace Hyprutils::OS;
using namespace Hyprutils::Memory;
#define UP CUniquePointer
#define SP CSharedPointer
static bool test() {
NLog::log("{}Testing config: misc:", Colors::GREEN);
NLog::log("{}Testing close_special_on_empty", Colors::YELLOW);
OK(getFromSocket("/keyword misc:close_special_on_empty false"));
OK(getFromSocket("/dispatch workspace special:test"));
Tests::spawnKitty();
{
auto str = getFromSocket("/monitors");
EXPECT_CONTAINS(str, "special workspace: -");
}
Tests::killAllWindows();
{
auto str = getFromSocket("/monitors");
EXPECT_CONTAINS(str, "special workspace: -");
}
Tests::spawnKitty();
OK(getFromSocket("/keyword misc:close_special_on_empty true"));
Tests::killAllWindows();
{
auto str = getFromSocket("/monitors");
EXPECT_NOT_CONTAINS(str, "special workspace: -");
}
NLog::log("{}Testing new_window_takes_over_fullscreen", Colors::YELLOW);
OK(getFromSocket("/keyword misc:new_window_takes_over_fullscreen 0"));
Tests::spawnKitty("kitty_A");
OK(getFromSocket("/dispatch fullscreen 0"));
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "fullscreen: 2");
EXPECT_CONTAINS(str, "kitty_A");
}
Tests::spawnKitty("kitty_B");
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "fullscreen: 2");
EXPECT_CONTAINS(str, "kitty_A");
}
OK(getFromSocket("/keyword misc:new_window_takes_over_fullscreen 1"));
Tests::spawnKitty("kitty_C");
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "fullscreen: 2");
EXPECT_CONTAINS(str, "kitty_C");
}
OK(getFromSocket("/keyword misc:new_window_takes_over_fullscreen 2"));
Tests::spawnKitty("kitty_D");
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "fullscreen: 0");
EXPECT_CONTAINS(str, "kitty_D");
}
OK(getFromSocket("/keyword misc:new_window_takes_over_fullscreen 0"));
Tests::killAllWindows();
NLog::log("{}Testing exit_window_retains_fullscreen", Colors::YELLOW);
OK(getFromSocket("/keyword misc:exit_window_retains_fullscreen false"));
Tests::spawnKitty("kitty_A");
Tests::spawnKitty("kitty_B");
OK(getFromSocket("/dispatch fullscreen 0"));
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "fullscreen: 2");
}
OK(getFromSocket("/dispatch killwindow activewindow"));
Tests::waitUntilWindowsN(1);
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "fullscreen: 0");
}
Tests::spawnKitty("kitty_B");
OK(getFromSocket("/dispatch fullscreen 0"));
OK(getFromSocket("/keyword misc:exit_window_retains_fullscreen true"));
OK(getFromSocket("/dispatch killwindow activewindow"));
Tests::waitUntilWindowsN(1);
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "fullscreen: 2");
}
// kill all
NLog::log("{}Killing all windows", Colors::YELLOW);
Tests::killAllWindows();
NLog::log("{}Expecting 0 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 0);
return !ret;
}
REGISTER_TEST_FN(test);

View File

@@ -0,0 +1,175 @@
#include <hyprutils/math/Vector2D.hpp>
#include <hyprutils/memory/WeakPtr.hpp>
#include <hyprutils/os/Process.hpp>
#include "../../shared.hpp"
#include "../../hyprctlCompat.hpp"
#include "../shared.hpp"
#include "tests.hpp"
using Hyprutils::Math::Vector2D;
static int ret = 0;
static bool spawnFloatingKitty() {
if (!Tests::spawnKitty()) {
NLog::log("{}Error: kitty did not spawn", Colors::RED);
return false;
}
OK(getFromSocket("/dispatch setfloating active"));
OK(getFromSocket("/dispatch resizeactive exact 100 100"));
return true;
}
static void expectSocket(const std::string& CMD) {
if (const auto RESULT = getFromSocket(CMD); RESULT != "ok") {
NLog::log("{}Failed: {}getFromSocket({}), expected ok, got {}. Source: {}@{}.", Colors::RED, Colors::RESET, CMD, RESULT, __FILE__, __LINE__);
ret = 1;
TESTS_FAILED++;
} else {
NLog::log("{}Passed: {}getFromSocket({}). Got ok", Colors::GREEN, Colors::RESET, CMD);
TESTS_PASSED++;
}
}
static void expectSnapMove(const Vector2D FROM, const Vector2D* TO) {
const Vector2D& A = FROM;
const Vector2D& B = TO ? *TO : FROM;
if (TO)
NLog::log("{}Expecting snap to ({},{}) when window is moved to ({},{})", Colors::YELLOW, B.x, B.y, A.x, A.y);
else
NLog::log("{}Expecting no snap when window is moved to ({},{})", Colors::YELLOW, A.x, A.y);
expectSocket(std::format("/dispatch moveactive exact {} {}", A.x, A.y));
expectSocket("/dispatch plugin:test:snapmove");
EXPECT_CONTAINS(getFromSocket("/activewindow"), std::format("at: {},{}", B.x, B.y));
}
static void testWindowSnap(const bool RESPECTGAPS) {
const double BORDERSIZE = 2;
const double WINDOWSIZE = 100;
const double OTHER = 500;
const double WINDOWGAP = 8;
const double GAPSIN = 5;
const double GAP = (RESPECTGAPS ? 2 * GAPSIN : 0) + (2 * BORDERSIZE);
const double END = GAP + WINDOWSIZE;
double x;
Vector2D predict;
x = WINDOWGAP + END;
expectSnapMove({OTHER + x, OTHER}, nullptr);
expectSnapMove({OTHER - x, OTHER}, nullptr);
expectSnapMove({OTHER, OTHER + x}, nullptr);
expectSnapMove({OTHER, OTHER - x}, nullptr);
x -= 1;
expectSnapMove({OTHER + x, OTHER}, &(predict = {OTHER + END, OTHER}));
expectSnapMove({OTHER - x, OTHER}, &(predict = {OTHER - END, OTHER}));
expectSnapMove({OTHER, OTHER + x}, &(predict = {OTHER, OTHER + END}));
expectSnapMove({OTHER, OTHER - x}, &(predict = {OTHER, OTHER - END}));
}
static void testMonitorSnap(const bool RESPECTGAPS, const bool OVERLAP) {
const double BORDERSIZE = 2;
const double WINDOWSIZE = 100;
const double MONITORGAP = 10;
const double GAPSOUT = 20;
const double RESP = (RESPECTGAPS ? GAPSOUT : 0);
const double GAP = RESP + (OVERLAP ? 0 : BORDERSIZE);
const double END = GAP + WINDOWSIZE;
double x;
Vector2D predict;
x = MONITORGAP + GAP;
expectSnapMove({x, x}, nullptr);
x -= 1;
expectSnapMove({x, x}, &(predict = {GAP, GAP}));
x = MONITORGAP + END;
expectSnapMove({1920 - x, 1080 - x}, nullptr);
x -= 1;
expectSnapMove({1920 - x, 1080 - x}, &(predict = {1920 - END, 1080 - END}));
// test reserved area
const double RESERVED = 200;
const double RGAP = RESERVED + RESP + BORDERSIZE;
const double REND = RGAP + WINDOWSIZE;
x = MONITORGAP + RGAP;
expectSnapMove({x, x}, nullptr);
x -= 1;
expectSnapMove({x, x}, &(predict = {RGAP, RGAP}));
x = MONITORGAP + REND;
expectSnapMove({1920 - x, 1080 - x}, nullptr);
x -= 1;
expectSnapMove({1920 - x, 1080 - x}, &(predict = {1920 - REND, 1080 - REND}));
}
static bool test() {
NLog::log("{}Testing snap", Colors::GREEN);
// move to monitor HEADLESS-2
NLog::log("{}Moving to monitor HEADLESS-2", Colors::YELLOW);
OK(getFromSocket("/dispatch focusmonitor HEADLESS-2"));
NLog::log("{}Adding reserved monitor area to HEADLESS-2", Colors::YELLOW);
OK(getFromSocket("/keyword monitor HEADLESS-2,addreserved,200,200,200,200"));
// test on workspace "snap"
NLog::log("{}Dispatching workspace `snap`", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace name:snap"));
// spawn a kitty terminal and move to (500,500)
NLog::log("{}Spawning kittyProcA", Colors::YELLOW);
if (!spawnFloatingKitty())
return false;
NLog::log("{}Expecting 1 window", Colors::YELLOW);
EXPECT(Tests::windowCount(), 1);
NLog::log("{}Move the kitty window to (500,500)", Colors::YELLOW);
OK(getFromSocket("/dispatch moveactive exact 500 500"));
// spawn a second kitty terminal
NLog::log("{}Spawning kittyProcB", Colors::YELLOW);
if (!spawnFloatingKitty())
return false;
NLog::log("{}Expecting 2 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 2);
NLog::log("");
testWindowSnap(false);
testMonitorSnap(false, false);
NLog::log("\n{}Turning on respect_gaps", Colors::YELLOW);
OK(getFromSocket("/keyword general:snap:respect_gaps true"));
testWindowSnap(true);
testMonitorSnap(true, false);
NLog::log("\n{}Turning on border_overlap", Colors::YELLOW);
OK(getFromSocket("/keyword general:snap:respect_gaps false"));
OK(getFromSocket("/keyword general:snap:border_overlap true"));
testMonitorSnap(false, true);
NLog::log("\n{}Turning on both border_overlap and respect_gaps", Colors::YELLOW);
OK(getFromSocket("/keyword general:snap:respect_gaps true"));
testMonitorSnap(true, true);
// kill all
NLog::log("\n{}Killing all windows", Colors::YELLOW);
Tests::killAllWindows();
NLog::log("{}Expecting 0 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 0);
NLog::log("{}Reloading the config", Colors::YELLOW);
OK(getFromSocket("/reload"));
return !ret;
}
REGISTER_TEST_FN(test)

View File

@@ -0,0 +1,12 @@
#pragma once
#include <vector>
#include <functional>
inline std::vector<std::function<bool()>> testFns;
#define REGISTER_TEST_FN(fn) \
static auto _register_fn = [] { \
testFns.emplace_back(fn); \
return 1; \
}();

View File

@@ -0,0 +1,98 @@
#include "tests.hpp"
#include "../../shared.hpp"
#include "../../hyprctlCompat.hpp"
#include <print>
#include <thread>
#include <chrono>
#include <hyprutils/os/Process.hpp>
#include <hyprutils/memory/WeakPtr.hpp>
#include <csignal>
#include <cerrno>
#include "../shared.hpp"
static int ret = 0;
using namespace Hyprutils::OS;
using namespace Hyprutils::Memory;
#define UP CUniquePointer
#define SP CSharedPointer
static bool test() {
NLog::log("{}Testing windows", Colors::GREEN);
// test on workspace "window"
NLog::log("{}Switching to workspace `window`", Colors::YELLOW);
getFromSocket("/dispatch workspace name:window");
NLog::log("{}Spawning kittyProcA", Colors::YELLOW);
auto kittyProcA = Tests::spawnKitty();
if (!kittyProcA) {
NLog::log("{}Error: kitty did not spawn", Colors::RED);
return false;
}
NLog::log("{}Expecting 1 window", Colors::YELLOW);
EXPECT(Tests::windowCount(), 1);
// check kitty properties. One kitty should take the entire screen, as this is smart gaps
NLog::log("{}Expecting kitty to take up the whole screen", Colors::YELLOW);
{
auto str = getFromSocket("/clients");
EXPECT(str.contains("at: 0,0"), true);
EXPECT(str.contains("size: 1920,1080"), true);
EXPECT(str.contains("fullscreen: 0"), true);
}
NLog::log("{}Spawning kittyProcB", Colors::YELLOW);
auto kittyProcB = Tests::spawnKitty();
if (!kittyProcB) {
NLog::log("{}Error: kitty did not spawn", Colors::RED);
return false;
}
NLog::log("{}Expecting 2 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 2);
// open xeyes
NLog::log("{}Spawning xeyes", Colors::YELLOW);
getFromSocket("/dispatch exec xeyes");
NLog::log("{}Keep checking if xeyes spawned", Colors::YELLOW);
int counter = 0;
while (Tests::windowCount() != 3) {
counter++;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
if (counter > 50) {
EXPECT(Tests::windowCount(), 3);
return !ret;
}
}
NLog::log("{}Expecting 3 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 3);
NLog::log("{}Checking props of xeyes", Colors::YELLOW);
// check some window props of xeyes, try to tile them
{
auto str = getFromSocket("/clients");
EXPECT_CONTAINS(str, "floating: 1");
getFromSocket("/dispatch settiled class:XEyes");
std::this_thread::sleep_for(std::chrono::milliseconds(200));
str = getFromSocket("/clients");
EXPECT_NOT_CONTAINS(str, "floating: 1");
}
// kill all
NLog::log("{}Killing all windows", Colors::YELLOW);
Tests::killAllWindows();
NLog::log("{}Expecting 0 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 0);
return !ret;
}
REGISTER_TEST_FN(test)

View File

@@ -0,0 +1,358 @@
#include "tests.hpp"
#include "../../shared.hpp"
#include "../../hyprctlCompat.hpp"
#include <print>
#include <thread>
#include <chrono>
#include <hyprutils/os/Process.hpp>
#include <hyprutils/memory/WeakPtr.hpp>
#include <csignal>
#include <cerrno>
#include "../shared.hpp"
static int ret = 0;
using namespace Hyprutils::OS;
using namespace Hyprutils::Memory;
#define UP CUniquePointer
#define SP CSharedPointer
static bool test() {
NLog::log("{}Testing workspaces", Colors::GREEN);
EXPECT(Tests::windowCount(), 0);
// test on workspace "window"
NLog::log("{}Switching to workspace 1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace 1"));
NLog::log("{}Spawning kittyProc on ws 1", Colors::YELLOW);
auto kittyProcA = Tests::spawnKitty();
if (!kittyProcA) {
NLog::log("{}Error: kitty did not spawn", Colors::RED);
return false;
}
NLog::log("{}Switching to workspace 3", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace 3"));
NLog::log("{}Spawning kittyProc on ws 3", Colors::YELLOW);
auto kittyProcB = Tests::spawnKitty();
if (!kittyProcB) {
NLog::log("{}Error: kitty did not spawn", Colors::RED);
return false;
}
NLog::log("{}Switching to workspace 1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace 1"));
NLog::log("{}Switching to workspace +1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace +1"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 2 (2)");
}
// check if the other workspaces are alive
{
auto str = getFromSocket("/workspaces");
EXPECT_CONTAINS(str, "workspace ID 3 (3)");
EXPECT_CONTAINS(str, "workspace ID 1 (1)");
}
NLog::log("{}Switching to workspace 1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace 1"));
{
auto str = getFromSocket("/workspaces");
EXPECT_NOT_CONTAINS(str, "workspace ID 2 (2)");
}
NLog::log("{}Switching to workspace m+1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace m+1"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 3 (3)");
}
NLog::log("{}Switching to workspace -1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace -1"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 2 (2)");
}
NLog::log("{}Switching to workspace 1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace 1"));
NLog::log("{}Switching to workspace r+1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace r+1"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 2 (2)");
}
NLog::log("{}Switching to workspace r+1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace r+1"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 3 (3)");
}
NLog::log("{}Switching to workspace r~1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace r~1"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 1 (1)");
}
NLog::log("{}Switching to workspace empty", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace empty"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 2 (2)");
}
NLog::log("{}Switching to workspace previous", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace previous"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 1 (1)");
}
NLog::log("{}Switching to workspace name:TEST_WORKSPACE_NULL", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace name:TEST_WORKSPACE_NULL"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID -1337 (TEST_WORKSPACE_NULL)");
}
NLog::log("{}Switching to workspace 1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace 1"));
// add a new monitor
NLog::log("{}Adding a new monitor", Colors::YELLOW);
EXPECT(getFromSocket("/output create headless"), "ok")
// should take workspace 2
{
auto str = getFromSocket("/monitors");
EXPECT_CONTAINS(str, "active workspace: 2 (2)");
EXPECT_CONTAINS(str, "active workspace: 1 (1)");
EXPECT_CONTAINS(str, "HEADLESS-3");
}
// focus the first monitor
OK(getFromSocket("/dispatch focusmonitor 0"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 1 (1)");
}
NLog::log("{}Switching to workspace r+1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace r+1"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 3 (3)");
}
NLog::log("{}Switching to workspace r~2", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace 1"));
OK(getFromSocket("/dispatch workspace r~2"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 3 (3)");
}
NLog::log("{}Switching to workspace m+1", Colors::YELLOW);
OK(getFromSocket("/dispatch workspace m+1"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 1 (1)");
}
NLog::log("{}Switching to workspace 1", Colors::YELLOW);
// no OK: this will throw an error as it should
getFromSocket("/dispatch workspace 1");
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 1 (1)");
}
NLog::log("{}Testing back_and_forth", Colors::YELLOW);
OK(getFromSocket("/keyword binds:workspace_back_and_forth true"));
OK(getFromSocket("/dispatch workspace 1"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 3 (3)");
}
OK(getFromSocket("/keyword binds:workspace_back_and_forth false"));
NLog::log("{}Testing hide_special_on_workspace_change", Colors::YELLOW);
OK(getFromSocket("/keyword binds:hide_special_on_workspace_change true"));
OK(getFromSocket("/dispatch workspace special:HELLO"));
{
auto str = getFromSocket("/monitors");
EXPECT_CONTAINS(str, "special workspace: -");
EXPECT_CONTAINS(str, "special:HELLO");
}
// no OK: will err (it shouldn't prolly but oh well)
getFromSocket("/dispatch workspace 3");
{
auto str = getFromSocket("/monitors");
EXPECT_COUNT_STRING(str, "special workspace: 0 ()", 2);
}
OK(getFromSocket("/keyword binds:hide_special_on_workspace_change false"));
NLog::log("{}Testing allow_workspace_cycles", Colors::YELLOW);
OK(getFromSocket("/keyword binds:allow_workspace_cycles true"));
OK(getFromSocket("/dispatch workspace 1"));
OK(getFromSocket("/dispatch workspace 3"));
OK(getFromSocket("/dispatch workspace 1"));
OK(getFromSocket("/dispatch workspace previous"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 3 (3)");
}
OK(getFromSocket("/dispatch workspace previous"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 1 (1)");
}
OK(getFromSocket("/dispatch workspace previous"));
{
auto str = getFromSocket("/activeworkspace");
EXPECT_STARTS_WITH(str, "workspace ID 3 (3)");
}
OK(getFromSocket("/keyword binds:allow_workspace_cycles false"));
OK(getFromSocket("/dispatch workspace 1"));
NLog::log("{}Killing all windows", Colors::YELLOW);
Tests::killAllWindows();
// spawn 3 kitties
NLog::log("{}Testing focus_preferred_method", Colors::YELLOW);
OK(getFromSocket("/keyword dwindle:force_split 2"));
Tests::spawnKitty("kitty_A");
Tests::spawnKitty("kitty_B");
Tests::spawnKitty("kitty_C");
OK(getFromSocket("/keyword dwindle:force_split 0"));
// focus kitty 2: will be top right (dwindle)
OK(getFromSocket("/dispatch focuswindow class:kitty_B"));
// resize it to be a bit taller
OK(getFromSocket("/dispatch resizeactive +20 +20"));
// now we test focus methods.
OK(getFromSocket("/keyword binds:focus_preferred_method 0"));
OK(getFromSocket("/dispatch focuswindow class:kitty_C"));
OK(getFromSocket("/dispatch focuswindow class:kitty_A"));
OK(getFromSocket("/dispatch movefocus r"));
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "class: kitty_C");
}
OK(getFromSocket("/dispatch focuswindow class:kitty_A"));
OK(getFromSocket("/keyword binds:focus_preferred_method 1"));
OK(getFromSocket("/dispatch movefocus r"));
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "class: kitty_B");
}
NLog::log("{}Testing movefocus_cycles_fullscreen", Colors::YELLOW);
OK(getFromSocket("/dispatch focuswindow class:kitty_A"));
OK(getFromSocket("/dispatch focusmonitor HEADLESS-3"));
Tests::spawnKitty("kitty_D");
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "class: kitty_D");
}
OK(getFromSocket("/dispatch focusmonitor l"));
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "class: kitty_A");
}
OK(getFromSocket("/keyword binds:movefocus_cycles_fullscreen false"));
OK(getFromSocket("/dispatch fullscreen 0"));
OK(getFromSocket("/dispatch movefocus r"));
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "class: kitty_D");
}
OK(getFromSocket("/dispatch focusmonitor l"));
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "class: kitty_A");
}
OK(getFromSocket("/keyword binds:movefocus_cycles_fullscreen true"));
OK(getFromSocket("/dispatch movefocus r"));
{
auto str = getFromSocket("/activewindow");
EXPECT_CONTAINS(str, "class: kitty_B");
}
// destroy the headless output
OK(getFromSocket("/output remove HEADLESS-3"));
// kill all
NLog::log("{}Killing all windows", Colors::YELLOW);
Tests::killAllWindows();
NLog::log("{}Expecting 0 windows", Colors::YELLOW);
EXPECT(Tests::windowCount(), 0);
return !ret;
}
REGISTER_TEST_FN(test)

View File

@@ -0,0 +1,21 @@
#include "plugin.hpp"
#include "../../shared.hpp"
#include "../../hyprctlCompat.hpp"
#include <print>
#include <thread>
#include <chrono>
#include <hyprutils/os/Process.hpp>
#include <hyprutils/memory/WeakPtr.hpp>
#include <csignal>
#include <cerrno>
#include "../shared.hpp"
bool testPlugin() {
const auto RESPONSE = getFromSocket("/dispatch plugin:test:test");
if (RESPONSE != "ok") {
NLog::log("{}Plugin tests failed, plugin returned:\n{}{}", Colors::RED, Colors::RESET, RESPONSE);
return false;
}
return true;
}

View File

@@ -0,0 +1,3 @@
#pragma once
bool testPlugin();

View File

@@ -0,0 +1,92 @@
#include "shared.hpp"
#include <csignal>
#include <cerrno>
#include <thread>
#include <print>
#include "../shared.hpp"
#include "../hyprctlCompat.hpp"
using namespace Hyprutils::OS;
using namespace Hyprutils::Memory;
CUniquePointer<CProcess> Tests::spawnKitty(const std::string& class_) {
const auto COUNT_BEFORE = windowCount();
CUniquePointer<CProcess> kitty = makeUnique<CProcess>("kitty", class_.empty() ? std::vector<std::string>{} : std::vector<std::string>{"--class", class_});
kitty->addEnv("WAYLAND_DISPLAY", WLDISPLAY);
kitty->runAsync();
std::this_thread::sleep_for(std::chrono::milliseconds(10));
// wait while kitty spawns
int counter = 0;
while (processAlive(kitty->pid()) && windowCount() == COUNT_BEFORE) {
counter++;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
if (counter > 50)
return nullptr;
}
if (!processAlive(kitty->pid()))
return nullptr;
return kitty;
}
bool Tests::processAlive(pid_t pid) {
errno = 0;
int ret = kill(pid, 0);
return ret != -1 || errno != ESRCH;
}
int Tests::windowCount() {
return countOccurrences(getFromSocket("/clients"), "focusHistoryID: ");
}
int Tests::countOccurrences(const std::string& in, const std::string& what) {
int cnt = 0;
auto pos = in.find(what);
while (pos != std::string::npos) {
cnt++;
pos = in.find(what, pos + what.length() - 1);
}
return cnt;
}
bool Tests::killAllWindows() {
auto str = getFromSocket("/clients");
auto pos = str.find("Window ");
while (pos != std::string::npos) {
auto pos2 = str.find(" -> ", pos);
getFromSocket("/dispatch killwindow address:0x" + str.substr(pos + 7, pos2 - pos - 7));
pos = str.find("Window ", pos + 5);
}
int counter = 0;
while (Tests::windowCount() != 0) {
counter++;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
if (counter > 50) {
std::println("{}Timed out waiting for windows to close", Colors::RED);
return false;
}
}
return true;
}
void Tests::waitUntilWindowsN(int n) {
int counter = 0;
while (Tests::windowCount() != n) {
counter++;
std::this_thread::sleep_for(std::chrono::milliseconds(100));
if (counter > 50) {
std::println("{}Timed out waiting for windows", Colors::RED);
return;
}
}
}

View File

@@ -0,0 +1,17 @@
#pragma once
#include <hyprutils/os/Process.hpp>
#include <hyprutils/memory/WeakPtr.hpp>
#include <sys/types.h>
#include "../Log.hpp"
//NOLINTNEXTLINE
namespace Tests {
Hyprutils::Memory::CUniquePointer<Hyprutils::OS::CProcess> spawnKitty(const std::string& class_ = "");
bool processAlive(pid_t pid);
int windowCount();
int countOccurrences(const std::string& in, const std::string& what);
bool killAllWindows();
void waitUntilWindowsN(int n);
};

313
hyprtester/test.conf Normal file
View File

@@ -0,0 +1,313 @@
# This is an example Hyprland config file.
# Refer to the wiki for more information.
# https://wiki.hyprland.org/Configuring/
# Please note not all available settings / options are set here.
# For a full list, see the wiki
# You can split this configuration into multiple files
# Create your files separately and then link them to this file like this:
# source = ~/.config/hypr/myColors.conf
################
### MONITORS ###
################
# See https://wiki.hyprland.org/Configuring/Monitors/
monitor=HEADLESS-1,1920x1080@60,auto-right,1
monitor=HEADLESS-2,1920x1080@60,auto-right,1
monitor=HEADLESS-3,1920x1080@60,auto-right,1
monitor=HEADLESS-4,1920x1080@60,auto-right,1
monitor=HEADLESS-5,1920x1080@60,auto-right,1
monitor=HEADLESS-6,1920x1080@60,auto-right,1
monitor=,disabled
###################
### MY PROGRAMS ###
###################
# See https://wiki.hyprland.org/Configuring/Keywords/
# Set programs that you use
$terminal = kitty
$fileManager = dolphin
$menu = wofi --show drun
#################
### AUTOSTART ###
#################
# Autostart necessary processes (like notifications daemons, status bars, etc.)
# Or execute your favorite apps at launch like this:
# exec-once = $terminal
# exec-once = nm-applet &
# exec-once = waybar & hyprpaper & firefox
#############################
### ENVIRONMENT VARIABLES ###
#############################
# See https://wiki.hyprland.org/Configuring/Environment-variables/
env = XCURSOR_SIZE,24
env = HYPRCURSOR_SIZE,24
#####################
### LOOK AND FEEL ###
#####################
# Refer to https://wiki.hyprland.org/Configuring/Variables/
# https://wiki.hyprland.org/Configuring/Variables/#general
general {
gaps_in = 5
gaps_out = 20
border_size = 2
snap {
enabled = true
window_gap = 8
monitor_gap = 10
respect_gaps = false
border_overlap = false
}
# https://wiki.hyprland.org/Configuring/Variables/#variable-types for info about colors
col.active_border = rgba(33ccffee) rgba(00ff99ee) 45deg
col.inactive_border = rgba(595959aa)
# Set to true enable resizing windows by clicking and dragging on borders and gaps
resize_on_border = false
# Please see https://wiki.hyprland.org/Configuring/Tearing/ before you turn this on
allow_tearing = false
layout = dwindle
}
# https://wiki.hyprland.org/Configuring/Variables/#decoration
decoration {
rounding = 10
rounding_power = 2
# Change transparency of focused and unfocused windows
active_opacity = 1.0
inactive_opacity = 1.0
shadow {
enabled = true
range = 4
render_power = 3
color = rgba(1a1a1aee)
}
# https://wiki.hyprland.org/Configuring/Variables/#blur
blur {
enabled = true
size = 3
passes = 1
vibrancy = 0.1696
}
}
# https://wiki.hyprland.org/Configuring/Variables/#animations
animations {
enabled = 0
# Default animations, see https://wiki.hyprland.org/Configuring/Animations/ for more
bezier = easeOutQuint,0.23,1,0.32,1
bezier = easeInOutCubic,0.65,0.05,0.36,1
bezier = linear,0,0,1,1
bezier = almostLinear,0.5,0.5,0.75,1.0
bezier = quick,0.15,0,0.1,1
animation = global, 1, 10, default
animation = border, 1, 5.39, easeOutQuint
animation = windows, 1, 4.79, easeOutQuint
animation = windowsIn, 1, 4.1, easeOutQuint, popin 87%
animation = windowsOut, 1, 1.49, linear, popin 87%
animation = fadeIn, 1, 1.73, almostLinear
animation = fadeOut, 1, 1.46, almostLinear
animation = fade, 1, 3.03, quick
animation = layers, 1, 3.81, easeOutQuint
animation = layersIn, 1, 4, easeOutQuint, fade
animation = layersOut, 1, 1.5, linear, fade
animation = fadeLayersIn, 1, 1.79, almostLinear
animation = fadeLayersOut, 1, 1.39, almostLinear
animation = workspaces, 1, 1.94, almostLinear, fade
animation = workspacesIn, 1, 1.21, almostLinear, fade
animation = workspacesOut, 1, 1.94, almostLinear, fade
}
# Ref https://wiki.hyprland.org/Configuring/Workspace-Rules/
# "Smart gaps" / "No gaps when only"
# uncomment all if you wish to use that.
# workspace = w[tv1], gapsout:0, gapsin:0
# workspace = f[1], gapsout:0, gapsin:0
# windowrulev2 = bordersize 0, floating:0, onworkspace:w[tv1]
# windowrulev2 = rounding 0, floating:0, onworkspace:w[tv1]
# windowrulev2 = bordersize 0, floating:0, onworkspace:f[1]
# windowrulev2 = rounding 0, floating:0, onworkspace:f[1]
# See https://wiki.hyprland.org/Configuring/Dwindle-Layout/ for more
dwindle {
pseudotile = true # Master switch for pseudotiling. Enabling is bound to mainMod + P in the keybinds section below
preserve_split = true # You probably want this
}
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
master {
new_status = master
}
# https://wiki.hyprland.org/Configuring/Variables/#misc
misc {
force_default_wallpaper = -1 # Set to 0 or 1 to disable the anime mascot wallpapers
disable_hyprland_logo = false # If true disables the random hyprland logo / anime girl background. :(
}
#############
### INPUT ###
#############
# https://wiki.hyprland.org/Configuring/Variables/#input
input {
kb_layout = us
kb_variant =
kb_model =
kb_options =
kb_rules =
follow_mouse = 1
sensitivity = 0 # -1.0 - 1.0, 0 means no modification.
touchpad {
natural_scroll = false
}
}
# https://wiki.hyprland.org/Configuring/Variables/#gestures
gestures {
workspace_swipe = false
}
# Example per-device config
# See https://wiki.hyprland.org/Configuring/Keywords/#per-device-input-configs for more
device {
name = epic-mouse-v1
sensitivity = -0.5
}
###################
### KEYBINDINGS ###
###################
# See https://wiki.hyprland.org/Configuring/Keywords/
$mainMod = SUPER # Sets "Windows" key as main modifier
# Example binds, see https://wiki.hyprland.org/Configuring/Binds/ for more
bind = $mainMod, Q, exec, $terminal
bind = $mainMod, C, killactive,
bind = $mainMod, M, exit,
bind = $mainMod, E, exec, $fileManager
bind = $mainMod, V, togglefloating,
bind = $mainMod, R, exec, $menu
bind = $mainMod, P, pseudo, # dwindle
bind = $mainMod, J, togglesplit, # dwindle
# Move focus with mainMod + arrow keys
bind = $mainMod, left, movefocus, l
bind = $mainMod, right, movefocus, r
bind = $mainMod, up, movefocus, u
bind = $mainMod, down, movefocus, d
# Switch workspaces with mainMod + [0-9]
bind = $mainMod, 1, workspace, 1
bind = $mainMod, 2, workspace, 2
bind = $mainMod, 3, workspace, 3
bind = $mainMod, 4, workspace, 4
bind = $mainMod, 5, workspace, 5
bind = $mainMod, 6, workspace, 6
bind = $mainMod, 7, workspace, 7
bind = $mainMod, 8, workspace, 8
bind = $mainMod, 9, workspace, 9
bind = $mainMod, 0, workspace, 10
# Move active window to a workspace with mainMod + SHIFT + [0-9]
bind = $mainMod SHIFT, 1, movetoworkspace, 1
bind = $mainMod SHIFT, 2, movetoworkspace, 2
bind = $mainMod SHIFT, 3, movetoworkspace, 3
bind = $mainMod SHIFT, 4, movetoworkspace, 4
bind = $mainMod SHIFT, 5, movetoworkspace, 5
bind = $mainMod SHIFT, 6, movetoworkspace, 6
bind = $mainMod SHIFT, 7, movetoworkspace, 7
bind = $mainMod SHIFT, 8, movetoworkspace, 8
bind = $mainMod SHIFT, 9, movetoworkspace, 9
bind = $mainMod SHIFT, 0, movetoworkspace, 10
# Example special workspace (scratchpad)
bind = $mainMod, S, togglespecialworkspace, magic
bind = $mainMod SHIFT, S, movetoworkspace, special:magic
# Scroll through existing workspaces with mainMod + scroll
bind = $mainMod, mouse_down, workspace, e+1
bind = $mainMod, mouse_up, workspace, e-1
# Move/resize windows with mainMod + LMB/RMB and dragging
bindm = $mainMod, mouse:272, movewindow
bindm = $mainMod, mouse:273, resizewindow
# Laptop multimedia keys for volume and LCD brightness
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+
bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-
# Requires playerctl
bindl = , XF86AudioNext, exec, playerctl next
bindl = , XF86AudioPause, exec, playerctl play-pause
bindl = , XF86AudioPlay, exec, playerctl play-pause
bindl = , XF86AudioPrev, exec, playerctl previous
##############################
### WINDOWS AND WORKSPACES ###
##############################
# See https://wiki.hyprland.org/Configuring/Window-Rules/ for more
# See https://wiki.hyprland.org/Configuring/Workspace-Rules/ for workspace rules
# Example windowrule v1
# windowrule = float, ^(kitty)$
# Example windowrule v2
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
# Ignore maximize requests from apps. You'll probably like this.
windowrulev2 = suppressevent maximize, class:.*
# Fix some dragging issues with XWayland
windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0
# Workspace "windows" is a smart gaps one
workspace = n[s:window] w[tv1], gapsout:0, gapsin:0
workspace = n[s:window] f[1], gapsout:0, gapsin:0
windowrulev2 = bordersize 0, floating:0, onworkspace:n[s:window] w[tv1]
windowrulev2 = rounding 0, floating:0, onworkspace:n[s:window] w[tv1]
windowrulev2 = bordersize 0, floating:0, onworkspace:n[s:window] f[1]
windowrulev2 = rounding 0, floating:0, onworkspace:n[s:window] f[1]

View File

@@ -21,6 +21,7 @@ add_project_arguments(
'-Wno-missing-field-initializers',
'-Wno-narrowing',
'-Wno-pointer-arith', datarootdir,
'-DHYPRLAND_VERSION="' + meson.project_version() + '"',
],
language: 'cpp',
)
@@ -30,8 +31,20 @@ if cpp_compiler.check_header('execinfo.h')
add_project_arguments('-DHAS_EXECINFO', language: 'cpp')
endif
aquamarine = dependency('aquamarine')
aquamarine = dependency('aquamarine', version: '>=0.9.0')
hyprcursor = dependency('hyprcursor', version: '>=0.1.7')
hyprgraphics = dependency('hyprgraphics', version: '>= 0.1.3')
hyprlang = dependency('hyprlang', version: '>= 0.3.2')
hyprutils = dependency('hyprutils', version: '>= 0.8.1')
aquamarine_version_list = aquamarine.version().split('.')
add_project_arguments(['-DAQUAMARINE_VERSION="@0@"'.format(aquamarine.version())], language: 'cpp')
add_project_arguments(['-DAQUAMARINE_VERSION_MAJOR=@0@'.format(aquamarine_version_list.get(0))], language: 'cpp')
add_project_arguments(['-DAQUAMARINE_VERSION_MINOR=@0@'.format(aquamarine_version_list.get(1))], language: 'cpp')
add_project_arguments(['-DAQUAMARINE_VERSION_PATCH=@0@'.format(aquamarine_version_list.get(2))], language: 'cpp')
add_project_arguments(['-DHYPRCURSOR_VERSION="@0@"'.format(hyprcursor.version())], language: 'cpp')
add_project_arguments(['-DHYPRGRAPHICS_VERSION="@0@"'.format(hyprgraphics.version())], language: 'cpp')
add_project_arguments(['-DHYPRLANG_VERSION="@0@"'.format(hyprlang.version())], language: 'cpp')
add_project_arguments(['-DHYPRUTILS_VERSION="@0@"'.format(hyprutils.version())], language: 'cpp')
xcb_dep = dependency('xcb', required: get_option('xwayland'))
xcb_composite_dep = dependency('xcb-composite', required: get_option('xwayland'))
@@ -49,14 +62,19 @@ endif
backtrace_dep = cpp_compiler.find_library('execinfo', required: false)
epoll_dep = dependency('epoll-shim', required: false) # timerfd on BSDs
inotify_dep = dependency('libinotify', required: false) # inotify on BSDs
re2 = dependency('re2', required: true)
# Handle options
if get_option('systemd').enabled()
add_project_arguments('-DUSES_SYSTEMD', language: 'cpp')
endif
systemd_option = get_option('systemd')
systemd = dependency('systemd', required: systemd_option)
systemd_option.enable_auto_if(systemd.found())
if get_option('legacy_renderer').enabled()
add_project_arguments('-DLEGACY_RENDERER', language: 'cpp')
if (systemd_option.enabled())
message('Enabling systemd integration')
add_project_arguments('-DUSES_SYSTEMD', language: 'cpp')
subdir('systemd')
endif
if get_option('buildtype') == 'debug'
@@ -65,9 +83,11 @@ endif
# Generate hyprland version and populate version.h
run_command('sh', '-c', 'scripts/generateVersion.sh', check: true)
# Make shader files includable
run_command('sh', '-c', 'scripts/generateShaderIncludes.sh', check: true)
# Install headers
globber = run_command('find', 'src', '-name', '*.h*', check: true)
globber = run_command('find', 'src', '-name', '*.h*', '-o', '-name', '*.inc', check: true)
headers = globber.stdout().strip().split('\n')
foreach file : headers
install_headers(file, subdir: 'hyprland', preserve_path: true)
@@ -79,14 +99,19 @@ if get_option('tracy_enable') and get_option('buildtype') != 'debugoptimized'
warning('Profiling builds should set -- buildtype = debugoptimized')
endif
subdir('protocols')
subdir('src')
subdir('hyprctl')
subdir('hyprpm/src')
subdir('assets')
subdir('example')
subdir('docs')
if get_option('hyprpm').enabled()
subdir('hyprpm/src')
endif
# Generate hyprland.pc
pkg_install_dir = join_paths(get_option('datadir'), 'pkgconfig')

View File

@@ -1,4 +1,5 @@
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
option('systemd', type: 'feature', value: 'auto', description: 'Enable systemd integration')
option('legacy_renderer', type: 'feature', value: 'disabled', description: 'Enable legacy renderer')
option('uwsm', type: 'feature', value: 'enabled', description: 'Enable uwsm integration (only if systemd is enabled)')
option('hyprpm', type: 'feature', value: 'enabled', description: 'Enable hyprpm')
option('tracy_enable', type: 'boolean', value: false , description: 'Enable profiling')

View File

@@ -5,14 +5,19 @@
pkg-config,
pkgconf,
makeWrapper,
cmake,
meson,
ninja,
aquamarine,
binutils,
cairo,
epoll-shim,
git,
glaze,
hyprcursor,
hyprgraphics,
hyprland-protocols,
hyprland-qtutils,
hyprlang,
hyprutils,
hyprwayland-scanner,
@@ -22,9 +27,10 @@
libinput,
libxkbcommon,
libuuid,
mesa,
libgbm,
pango,
pciutils,
re2,
systemd,
tomlplusplus,
udis86-hyprland,
@@ -35,7 +41,6 @@
xwayland,
debug ? false,
enableXWayland ? true,
legacyRenderer ? false,
withSystemd ? lib.meta.availableOn stdenv.hostPlatform systemd,
wrapRuntimeDeps ? true,
version ? "git",
@@ -46,33 +51,52 @@
enableNvidiaPatches ? false,
nvidiaPatches ? false,
hidpiXWayland ? false,
legacyRenderer ? false,
}: let
inherit (builtins) baseNameOf foldl';
inherit (builtins) foldl' readFile;
inherit (lib.asserts) assertMsg;
inherit (lib.attrsets) mapAttrsToList;
inherit (lib.lists) flatten concatLists optional optionals;
inherit (lib.sources) cleanSourceWith cleanSource;
inherit (lib.strings) hasSuffix makeBinPath optionalString mesonBool mesonEnable;
inherit (lib.strings) makeBinPath optionalString mesonBool mesonEnable trim;
fs = lib.fileset;
adapters = flatten [
stdenvAdapters.useMoldLinker
(lib.optional debug stdenvAdapters.keepDebugInfo)
];
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
in
assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
assert assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";
customStdenv.mkDerivation {
assert assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hypr.land/Configuring/XWayland";
assert assertMsg (!legacyRenderer) "The option `legacyRenderer` has been removed. Legacy renderer is no longer supported.";
customStdenv.mkDerivation (finalAttrs: {
pname = "hyprland${optionalString debug "-debug"}";
inherit version;
src = cleanSourceWith {
filter = name: type: let
baseName = baseNameOf (toString name);
in
! (hasSuffix ".nix" baseName);
src = cleanSource ../.;
src = fs.toSource {
root = ../.;
fileset =
fs.intersection
# allows non-flake builds to only include files tracked by git
(fs.gitTracked ../.)
(fs.unions [
../assets/hyprland-portals.conf
../assets/install
../hyprctl
../hyprland.pc.in
../LICENSE
../meson_options.txt
../protocols
../src
../systemd
../VERSION
(fs.fileFilter (file: file.hasExt "1") ../docs)
(fs.fileFilter (file: file.hasExt "conf" || file.hasExt "desktop") ../example)
(fs.fileFilter (file: file.hasExt "sh") ../scripts)
(fs.fileFilter (file: file.name == "meson.build") ../.)
]);
};
postPatch = ''
@@ -87,6 +111,7 @@ in
DATE = date;
DIRTY = optionalString (commit == "") "dirty";
HASH = commit;
TAG = "v${trim (readFile "${finalAttrs.src}/VERSION")}";
depsBuildBuild = [
pkg-config
@@ -97,6 +122,7 @@ in
makeWrapper
meson
ninja
cmake # needed for glaze
pkg-config
];
@@ -111,7 +137,9 @@ in
aquamarine
cairo
git
glaze
hyprcursor
hyprgraphics
hyprland-protocols
hyprlang
hyprutils
@@ -120,9 +148,10 @@ in
libinput
libuuid
libxkbcommon
mesa
libgbm
pango
pciutils
re2
tomlplusplus
udis86-hyprland
wayland
@@ -130,6 +159,7 @@ in
wayland-scanner
xorg.libXcursor
]
(optionals customStdenv.hostPlatform.isBSD [epoll-shim])
(optionals customStdenv.hostPlatform.isMusl [libexecinfo])
(optionals enableXWayland [
xorg.libxcb
@@ -142,19 +172,19 @@ in
(optional withSystemd systemd)
];
strictDeps = true;
mesonBuildType =
if debug
then "debugoptimized"
then "debug"
else "release";
# we want as much debug info as possible
dontStrip = debug;
mesonFlags = flatten [
(mapAttrsToList mesonEnable {
"xwayland" = enableXWayland;
"legacy_renderer" = legacyRenderer;
"systemd" = withSystemd;
"uwsm" = false;
"hyprpm" = false;
})
(mapAttrsToList mesonBool {
"b_pch" = false;
@@ -167,6 +197,7 @@ in
wrapProgram $out/bin/Hyprland \
--suffix PATH : ${makeBinPath [
binutils
hyprland-qtutils
pciutils
pkgconf
]}
@@ -182,4 +213,4 @@ in
platforms = lib.platforms.linux;
mainProgram = "Hyprland";
};
}
})

64
nix/formatter.nix Normal file
View File

@@ -0,0 +1,64 @@
{
writeShellApplication,
deadnix,
statix,
alejandra,
llvmPackages_19,
fd,
}:
writeShellApplication {
name = "hyprland-treewide-formatter";
runtimeInputs = [
deadnix
statix
alejandra
llvmPackages_19.clang-tools
fd
];
text = ''
# shellcheck disable=SC2148
# common excludes
excludes="subprojects"
nix_format() {
if [ "$*" = 0 ]; then
fd '.*\.nix' . -E "$excludes" -x statix fix -- {} \;
fd '.*\.nix' . -E "$excludes" -X deadnix -e -- {} \; -X alejandra {} \;
elif [ -d "$1" ]; then
fd '.*\.nix' "$1" -E "$excludes" -i -x statix fix -- {} \;
fd '.*\.nix' "$1" -E "$excludes" -i -X deadnix -e -- {} \; -X alejandra {} \;
else
statix fix -- "$1"
deadnix -e "$1"
alejandra "$1"
fi
}
cpp_format() {
if [ "$*" = 0 ] || [ "$1" = "." ]; then
fd '.*\.cpp' . -E "$excludes" | xargs clang-format --verbose -i
elif [ -d "$1" ]; then
fd '.*\.cpp' "$1" -E "$excludes" | xargs clang-format --verbose -i
else
clang-format --verbose -i "$1"
fi
}
for i in "$@"; do
case ''${i##*.} in
"nix")
nix_format "$i"
;;
"cpp")
cpp_format "$i"
;;
*)
nix_format "$i"
cpp_format "$i"
;;
esac
done
'';
}

60
nix/hyprtester.nix Normal file
View File

@@ -0,0 +1,60 @@
{
lib,
stdenv,
stdenvAdapters,
cmake,
pkg-config,
hyprland,
hyprwayland-scanner,
version ? "git",
}: let
inherit (lib.lists) flatten foldl';
inherit (lib.sources) cleanSourceWith cleanSource;
inherit (lib.strings) hasSuffix cmakeBool;
adapters = flatten [
stdenvAdapters.useMoldLinker
stdenvAdapters.keepDebugInfo
];
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
in
customStdenv.mkDerivation (finalAttrs: {
pname = "hyprtester";
inherit version;
src = cleanSourceWith {
filter = name: _type: let
baseName = baseNameOf (toString name);
in
! (hasSuffix ".nix" baseName);
src = cleanSource ../.;
};
nativeBuildInputs = [
cmake
pkg-config
hyprwayland-scanner
];
buildInputs = hyprland.buildInputs;
preConfigure = ''
cmake -S . -B .
cmake --build . --target generate-protocol-headers -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
cd hyprtester
'';
cmakeBuildType = "Debug";
cmakeFlags = [(cmakeBool "TESTS" true)];
meta = {
homepage = "https://github.com/hyprwm/Hyprland";
description = "Hyprland testing framework";
license = lib.licenses.bsd3;
platforms = hyprland.meta.platforms;
mainProgram = "hyprtester";
};
})

201
nix/lib.nix Normal file
View File

@@ -0,0 +1,201 @@
lib: let
inherit (lib)
attrNames
filterAttrs
foldl
generators
partition
;
inherit (lib.strings)
concatMapStrings
hasPrefix
;
/**
Convert a structured Nix attribute set into Hyprland's configuration format.
This function takes a nested attribute set and converts it into Hyprland-compatible
configuration syntax, supporting top, bottom, and regular command sections.
Commands are flattened using the `flattenAttrs` function, and attributes are formatted as
`key = value` pairs. Lists are expanded as duplicate keys to match Hyprland's expected format.
Configuration:
* `topCommandsPrefixes` - A list of prefixes to define **top** commands (default: `["$"]`).
* `bottomCommandsPrefixes` - A list of prefixes to define **bottom** commands (default: `[]`).
Attention:
- The function ensures top commands appear **first** and bottom commands **last**.
- The generated configuration is a **single string**, suitable for writing to a config file.
- Lists are converted into multiple entries, ensuring compatibility with Hyprland.
# Inputs
Structured function argument:
: topCommandsPrefixes (optional, default: `["$"]`)
: A list of prefixes that define **top** commands. Any key starting with one of these
prefixes will be placed at the beginning of the configuration.
: bottomCommandsPrefixes (optional, default: `[]`)
: A list of prefixes that define **bottom** commands. Any key starting with one of these
prefixes will be placed at the end of the configuration.
Value:
: The attribute set to be converted to Hyprland configuration format.
# Type
```
toHyprlang :: AttrSet -> AttrSet -> String
```
# Examples
:::{.example}
```nix
let
config = {
"$mod" = "SUPER";
monitor = {
"HDMI-A-1" = "1920x1080@60,0x0,1";
};
exec = [
"waybar"
"dunst"
];
};
in lib.toHyprlang {} config
```
**Output:**
```nix
"$mod = SUPER"
"monitor:HDMI-A-1 = 1920x1080@60,0x0,1"
"exec = waybar"
"exec = dunst"
```
:::
*/
toHyprlang = {
topCommandsPrefixes ? ["$"],
bottomCommandsPrefixes ? [],
}: attrs: let
toHyprlang' = attrs: let
# Specially configured `toKeyValue` generator with support for duplicate keys
# and a legible key-value separator.
mkCommands = generators.toKeyValue {
mkKeyValue = generators.mkKeyValueDefault {} " = ";
listsAsDuplicateKeys = true;
indent = ""; # No indent, since we don't have nesting
};
# Flatten the attrset, combining keys in a "path" like `"a:b:c" = "x"`.
# Uses `flattenAttrs` with a colon separator.
commands = flattenAttrs (p: k: "${p}:${k}") attrs;
# General filtering function to check if a key starts with any prefix in a given list.
filterCommands = list: n:
foldl (acc: prefix: acc || hasPrefix prefix n) false list;
# Partition keys into top commands and the rest
result = partition (filterCommands topCommandsPrefixes) (attrNames commands);
topCommands = filterAttrs (n: _: builtins.elem n result.right) commands;
remainingCommands = removeAttrs commands result.right;
# Partition remaining commands into bottom commands and regular commands
result2 = partition (filterCommands bottomCommandsPrefixes) result.wrong;
bottomCommands = filterAttrs (n: _: builtins.elem n result2.right) remainingCommands;
regularCommands = removeAttrs remainingCommands result2.right;
in
# Concatenate strings from mapping `mkCommands` over top, regular, and bottom commands.
concatMapStrings mkCommands [
topCommands
regularCommands
bottomCommands
];
in
toHyprlang' attrs;
/**
Flatten a nested attribute set into a flat attribute set, using a custom key separator function.
This function recursively traverses a nested attribute set and produces a flat attribute set
where keys are joined using a user-defined function (`pred`). It allows transforming deeply
nested structures into a single-level attribute set while preserving key-value relationships.
Configuration:
* `pred` - A function `(string -> string -> string)` defining how keys should be concatenated.
# Inputs
Structured function argument:
: pred (required)
: A function that determines how parent and child keys should be combined into a single key.
It takes a `prefix` (parent key) and `key` (current key) and returns the joined key.
Value:
: The nested attribute set to be flattened.
# Type
```
flattenAttrs :: (String -> String -> String) -> AttrSet -> AttrSet
```
# Examples
:::{.example}
```nix
let
nested = {
a = "3";
b = { c = "4"; d = "5"; };
};
separator = (prefix: key: "${prefix}.${key}"); # Use dot notation
in lib.flattenAttrs separator nested
```
**Output:**
```nix
{
"a" = "3";
"b.c" = "4";
"b.d" = "5";
}
```
:::
*/
flattenAttrs = pred: attrs: let
flattenAttrs' = prefix: attrs:
builtins.foldl' (
acc: key: let
value = attrs.${key};
newKey =
if prefix == ""
then key
else pred prefix key;
in
acc
// (
if builtins.isAttrs value
then flattenAttrs' newKey value
else {"${newKey}" = value;}
)
) {} (builtins.attrNames attrs);
in
flattenAttrs' "" attrs;
in
{
inherit flattenAttrs toHyprlang;
}

View File

@@ -5,17 +5,149 @@ inputs: {
...
}: let
inherit (pkgs.stdenv.hostPlatform) system;
selflib = import ./lib.nix lib;
cfg = config.programs.hyprland;
package = inputs.self.packages.${system}.hyprland;
portalPackage = inputs.self.packages.${system}.xdg-desktop-portal-hyprland.override {
hyprland = cfg.finalPackage;
};
in {
config = {
options = {
programs.hyprland = {
package = lib.mkDefault package;
portalPackage = lib.mkDefault portalPackage;
plugins = lib.mkOption {
type = with lib.types; listOf (either package path);
default = [];
description = ''
List of Hyprland plugins to use. Can either be packages or
absolute plugin paths.
'';
};
settings = lib.mkOption {
type = with lib.types; let
valueType =
nullOr (oneOf [
bool
int
float
str
path
(attrsOf valueType)
(listOf valueType)
])
// {
description = "Hyprland configuration value";
};
in
valueType;
default = {};
description = ''
Hyprland configuration written in Nix. Entries with the same key
should be written as lists. Variables' and colors' names should be
quoted. See <https://wiki.hypr.land> for more examples.
Special categories (e.g `devices`) should be written as
`"devices[device-name]"`.
::: {.note}
Use the [](#programs.hyprland.plugins) option to
declare plugins.
:::
'';
example = lib.literalExpression ''
{
decoration = {
shadow_offset = "0 5";
"col.shadow" = "rgba(00000099)";
};
"$mod" = "SUPER";
bindm = [
# mouse movements
"$mod, mouse:272, movewindow"
"$mod, mouse:273, resizewindow"
"$mod ALT, mouse:272, resizewindow"
];
}
'';
};
extraConfig = lib.mkOption {
type = lib.types.lines;
default = "";
example = ''
# window resize
bind = $mod, S, submap, resize
submap = resize
binde = , right, resizeactive, 10 0
binde = , left, resizeactive, -10 0
binde = , up, resizeactive, 0 -10
binde = , down, resizeactive, 0 10
bind = , escape, submap, reset
submap = reset
'';
description = ''
Extra configuration lines to add to `/etc/xdg/hypr/hyprland.conf`.
'';
};
topPrefixes = lib.mkOption {
type = with lib.types; listOf str;
default = ["$" "bezier"];
example = ["$" "bezier" "source"];
description = ''
List of prefix of attributes to put at the top of the config.
'';
};
bottomPrefixes = lib.mkOption {
type = with lib.types; listOf str;
default = [];
example = ["source"];
description = ''
List of prefix of attributes to put at the bottom of the config.
'';
};
};
};
config = lib.mkMerge [
{
programs.hyprland = {
package = lib.mkDefault inputs.self.packages.${system}.hyprland;
portalPackage = lib.mkDefault inputs.self.packages.${system}.xdg-desktop-portal-hyprland;
};
}
(lib.mkIf cfg.enable {
environment.etc."xdg/hypr/hyprland.conf" = let
shouldGenerate = cfg.extraConfig != "" || cfg.settings != {} || cfg.plugins != [];
pluginsToHyprlang = plugins:
selflib.toHyprlang {
topCommandsPrefixes = cfg.topPrefixes;
bottomCommandsPrefixes = cfg.bottomPrefixes;
}
{
"exec-once" = let
mkEntry = entry:
if lib.types.package.check entry
then "${entry}/lib/lib${entry.pname}.so"
else entry;
hyprctl = lib.getExe' config.programs.hyprland.package "hyprctl";
in
map (p: "${hyprctl} plugin load ${mkEntry p}") cfg.plugins;
};
in
lib.mkIf shouldGenerate {
text =
lib.optionalString (cfg.plugins != [])
(pluginsToHyprlang cfg.plugins)
+ lib.optionalString (cfg.settings != {})
(selflib.toHyprlang {
topCommandsPrefixes = cfg.topPrefixes;
bottomCommandsPrefixes = cfg.bottomPrefixes;
}
cfg.settings)
+ lib.optionalString (cfg.extraConfig != "") cfg.extraConfig;
};
})
];
}

View File

@@ -8,7 +8,7 @@
(builtins.substring 4 2 longDate)
(builtins.substring 6 2 longDate)
]);
version = lib.removeSuffix "\n" (builtins.readFile ../VERSION);
ver = lib.removeSuffix "\n" (builtins.readFile ../VERSION);
in {
# Contains what a user is most likely to care about:
# Hyprland itself, XDPH and the Share Picker.
@@ -22,28 +22,39 @@ in {
# Dependencies
inputs.aquamarine.overlays.default
inputs.hyprcursor.overlays.default
inputs.hyprgraphics.overlays.default
inputs.hyprland-protocols.overlays.default
inputs.hyprland-qtutils.overlays.default
inputs.hyprlang.overlays.default
inputs.hyprutils.overlays.default
inputs.hyprwayland-scanner.overlays.default
self.overlays.udis86
# Hyprland packages themselves
(final: prev: let
(final: _prev: let
date = mkDate (self.lastModifiedDate or "19700101");
version = "${ver}+date=${date}_${self.shortRev or "dirty"}";
in {
hyprland = final.callPackage ./default.nix {
stdenv = final.gcc14Stdenv;
version = "${version}+date=${date}_${self.shortRev or "dirty"}";
stdenv = final.gcc15Stdenv;
commit = self.rev or "";
revCount = self.sourceInfo.revCount or "";
inherit date;
inherit date version;
};
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
hyprland-debug = final.hyprland.override {debug = true;};
hyprland-legacy-renderer = final.hyprland.override {legacyRenderer = true;};
hyprtester = final.callPackage ./hyprtester.nix {
inherit version;
};
# deprecated packages
hyprland-legacy-renderer =
builtins.trace ''
hyprland-legacy-renderer was removed. Please use the hyprland package.
Legacy renderer is no longer supported.
''
final.hyprland;
hyprland-nvidia =
builtins.trace ''
hyprland-nvidia was removed. Please use the hyprland package.
@@ -54,23 +65,35 @@ in {
hyprland-hidpi =
builtins.trace ''
hyprland-hidpi was removed. Please use the hyprland package.
For more information, refer to https://wiki.hyprland.org/Configuring/XWayland.
For more information, refer to https://wiki.hypr.land/Configuring/XWayland.
''
final.hyprland;
})
];
# Debug
hyprland-debug = lib.composeManyExtensions [
# Dependencies
self.overlays.hyprland-packages
(final: prev: {
aquamarine = prev.aquamarine.override {debug = true;};
hyprutils = prev.hyprutils.override {debug = true;};
hyprland-debug = prev.hyprland.override {debug = true;};
})
];
# Packages for extra software recommended for usage with Hyprland,
# including forked or patched packages for compatibility.
hyprland-extras = lib.composeManyExtensions [
inputs.xdph.overlays.xdg-desktop-portal-hyprland
inputs.xdph.overlays.default
];
# udis86 from nixpkgs is too old, and also does not provide a .pc file
# this version is the one used in the git submodule, and allows us to
# fetch the source without '?submodules=1'
udis86 = final: prev: {
udis86-hyprland = prev.udis86.overrideAttrs (self: super: {
udis86-hyprland = prev.udis86.overrideAttrs (_self: _super: {
src = final.fetchFromGitHub {
owner = "canihavesomecoffee";
repo = "udis86";

86
nix/tests/default.nix Normal file
View File

@@ -0,0 +1,86 @@
inputs: pkgs: let
flake = inputs.self.packages.${pkgs.stdenv.hostPlatform.system};
hyprland = flake.hyprland;
in {
tests = pkgs.testers.runNixOSTest {
name = "hyprland-tests";
nodes.machine = {pkgs, ...}: {
environment.systemPackages = with pkgs; [
flake.hyprtester
# Programs needed for tests
kitty
xorg.xeyes
];
# Enabled by default for some reason
services.speechd.enable = false;
environment.variables = {
"AQ_TRACE" = "1";
"HYPRLAND_TRACE" = "1";
"XDG_RUNTIME_DIR" = "/tmp";
"XDG_CACHE_HOME" = "/tmp";
};
programs.hyprland = {
enable = true;
package = hyprland;
# We don't need portals in this test, so we don't set portalPackage
};
# Test configuration
environment.etc."test.conf".source = "${flake.hyprtester}/share/hypr/test.conf";
# Disable portals
xdg.portal.enable = pkgs.lib.mkForce false;
# Autologin root into tty
services.getty.autologinUser = "alice";
system.stateVersion = "24.11";
users.users.alice = {
isNormalUser = true;
};
virtualisation = {
cores = 4;
# Might crash with less
memorySize = 8192;
resolution = {
x = 1920;
y = 1080;
};
# Doesn't seem to do much, thought it would fix XWayland crashing
qemu.options = ["-vga none -device virtio-gpu-pci"];
};
};
testScript = ''
# Wait for tty to be up
machine.wait_for_unit("multi-user.target")
# Run hyprtester testing framework/suite
print("Running hyprtester")
exit_status, _out = machine.execute("su - alice -c 'hyprtester -b ${hyprland}/bin/Hyprland -c /etc/test.conf -p ${flake.hyprtester}/lib/hyprtestplugin.so 2>&1 | tee /tmp/testerlog; exit ''${PIPESTATUS[0]}'")
print(f"Hyprtester exited with {exit_status}")
# Copy logs to host
machine.execute('cp "$(find /tmp/hypr -name *.log | head -1)" /tmp/hyprlog')
machine.execute(f'echo {exit_status} > /tmp/exit_status')
machine.copy_from_vm("/tmp/testerlog")
machine.copy_from_vm("/tmp/hyprlog")
machine.copy_from_vm("/tmp/exit_status")
# Print logs for visibility in CI
_, out = machine.execute("cat /tmp/testerlog")
print(f"Hyprtester log:\n{out}")
# Finally - shutdown
machine.shutdown()
'';
};
}

View File

@@ -1,16 +1,25 @@
#!/usr/bin/env -S nix shell nixpkgs#jq -c bash
# Update inputs when the Mesa version is outdated. We don't want
# Update inputs when the Mesa or QT version is outdated. We don't want
# incompatibilities between the user's system and Hyprland.
# get the current Nixpkgs revision
REV=$(jq <flake.lock '.nodes.nixpkgs.locked.rev' -r)
# check versions for current and remote nixpkgs' mesa
CRT_VER=$(nix eval --raw github:nixos/nixpkgs/"$REV"#mesa.version)
NEW_VER=$(nix eval --raw github:nixos/nixpkgs/nixos-unstable#mesa.version)
if [ "$CRT_VER" != "$NEW_VER" ]; then
echo "Updating Mesa $CRT_VER -> $NEW_VER and flake inputs"
get_ver() {
nix eval --raw "github:nixos/nixpkgs/$1#$2"
}
# check versions for current and remote nixpkgs'
MESA_OLD=$(get_ver "$REV" mesa.version)
MESA_NEW=$(get_ver nixos-unstable mesa.version)
QT_OLD=$(get_ver "$REV" kdePackages.qtbase.version)
QT_NEW=$(get_ver nixos-unstable kdePackages.qtbase.version)
if [ "$MESA_OLD" != "$MESA_NEW" ] || [ "$QT_OLD" != "$QT_NEW" ]; then
echo "Updating flake inputs..."
echo "Mesa: $MESA_OLD -> $MESA_NEW"
echo "Qt: $QT_OLD -> $QT_NEW"
# update inputs to latest versions
nix flake update

View File

@@ -0,0 +1,366 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="frog_color_management_v1">
<copyright>
Copyright © 2023 Joshua Ashton for Valve Software
Copyright © 2023 Xaver Hugl
Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"),
to deal in the Software without restriction, including without limitation
the rights to use, copy, modify, merge, publish, distribute, sublicense,
and/or sell copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice (including the next
paragraph) shall be included in all copies or substantial portions of the
Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
</copyright>
<description summary="experimental color management protocol">
The aim of this color management extension is to get HDR games working quickly,
and have an easy way to test implementations in the wild before the upstream
protocol is ready to be merged.
For that purpose it's intentionally limited and cut down and does not serve
all uses cases.
</description>
<interface name="frog_color_management_factory_v1" version="1">
<description summary="color management factory">
The color management factory singleton creates color managed surface objects.
</description>
<request name="destroy" type="destructor"></request>
<request name="get_color_managed_surface">
<description summary="create color management interface for surface">
</description>
<arg name="surface" type="object" interface="wl_surface"
summary="target surface" />
<arg name="callback" type="new_id" interface="frog_color_managed_surface"
summary="new color managed surface object" />
</request>
</interface>
<interface name="frog_color_managed_surface" version="1">
<description summary="color managed surface">
Interface for changing surface color management and HDR state.
An implementation must: support every part of the version
of the frog_color_managed_surface interface it exposes.
Including all known enums associated with a given version.
</description>
<request name="destroy" type="destructor">
<description summary="destroy color managed surface">
Destroying the color managed surface resets all known color
state for the surface back to 'undefined' implementation-specific
values.
</description>
</request>
<enum name="transfer_function">
<description summary="known transfer functions">
Extended information on the transfer functions described
here can be found in the Khronos Data Format specification:
https://registry.khronos.org/DataFormat/specs/1.3/dataformat.1.3.html
</description>
<entry name="undefined" value="0"
summary="specifies undefined, implementation-specific handling of the surface's transfer function." />
<entry name="srgb" value="1"
summary="specifies the sRGB non-linear EOTF. An implementation may: display this as Gamma 2.2 for the purposes of being consistent with content rendering across displays, rendering_intent and user expectations." />
<entry name="gamma_22" value="2" summary="specifies gamma 2.2 power curve as the EOTF" />
<entry name="st2084_pq" value="3"
summary="specifies the SMPTE ST2084 Perceptual Quantizer (PQ) EOTF" />
<entry name="scrgb_linear" value="4"
summary="specifies the scRGB (extended sRGB) linear EOTF. Note: Primaries outside the gamut triangle specified can be expressed with negative values for this transfer function." />
</enum>
<request name="set_known_transfer_function">
<description summary="sets a known transfer function for a surface" />
<arg name="transfer_function" type="uint" enum="transfer_function"
summary="transfer function for the surface" />
</request>
<enum name="primaries">
<description summary="known primaries" />
<entry name="undefined" value="0"
summary="specifies undefined, implementation-specific handling" />
<entry name="rec709" value="1" summary="specifies Rec.709/sRGB primaries with D65 white point" />
<entry name="rec2020" value="2"
summary="specifies Rec.2020/HDR10 primaries with D65 white point" />
</enum>
<request name="set_known_container_color_volume">
<description summary="sets the container color volume (primaries) for a surface" />
<arg name="primaries" type="uint" enum="primaries" summary="primaries for the surface" />
</request>
<enum name="render_intent">
<description summary="known render intents">
Extended information on render intents described
here can be found in ICC.1:2022:
https://www.color.org/specification/ICC.1-2022-05.pdf
</description>
<entry name="perceptual" value="0" summary="perceptual" />
</enum>
<request name="set_render_intent">
<description summary="sets the render intent for a surface">
NOTE: On a surface with "perceptual" (default) render intent, handling of the container's
color volume
is implementation-specific, and may differ between different transfer functions it is paired
with:
ie. sRGB + 709 rendering may have it's primaries widened to more of the available display's
gamut
to be be more pleasing for the viewer.
Compared to scRGB Linear + 709 being treated faithfully as 709
(including utilizing negatives out of the 709 gamut triangle)
</description>
<arg name="render_intent" type="uint" enum="render_intent"
summary="render intent for the surface" />
</request>
<request name="set_hdr_metadata">
<description summary="set HDR metadata for a surface">
Forwards HDR metadata from the client to the compositor.
HDR Metadata Infoframe as per CTA 861.G spec.
Usage of this HDR metadata is implementation specific and
outside of the scope of this protocol.
</description>
<arg name="mastering_display_primary_red_x" type="uint">
<description summary="red primary x coordinate">
Mastering Red Color Primary X Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="mastering_display_primary_red_y" type="uint">
<description summary="red primary y coordinate">
Mastering Red Color Primary Y Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="mastering_display_primary_green_x" type="uint">
<description summary="green primary x coordinate">
Mastering Green Color Primary X Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="mastering_display_primary_green_y" type="uint">
<description summary="green primary y coordinate">
Mastering Green Color Primary Y Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="mastering_display_primary_blue_x" type="uint">
<description summary="blue primary x coordinate">
Mastering Blue Color Primary X Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="mastering_display_primary_blue_y" type="uint">
<description summary="blue primary y coordinate">
Mastering Blue Color Primary Y Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="mastering_white_point_x" type="uint">
<description summary="white point x coordinate">
Mastering White Point X Coordinate of the Data.
These are coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="mastering_white_point_y" type="uint">
<description summary="white point y coordinate">
Mastering White Point Y Coordinate of the Data.
These are coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="max_display_mastering_luminance" type="uint">
<description summary="max display mastering luminance">
Max Mastering Display Luminance.
This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
</description>
</arg>
<arg name="min_display_mastering_luminance" type="uint">
<description summary="min display mastering luminance">
Min Mastering Display Luminance.
This value is coded as an unsigned 16-bit value in units of
0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
represents 6.5535 cd/m2.
</description>
</arg>
<arg name="max_cll" type="uint">
<description summary="max content light level">
Max Content Light Level.
This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
</description>
</arg>
<arg name="max_fall" type="uint">
<description summary="max frame average light level">
Max Frame Average Light Level.
This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
</description>
</arg>
</request>
<event name="preferred_metadata">
<description summary="preferred metadata for a surface">
Current preferred metadata for a surface.
The application should use this information to tone-map its buffers
to this target before committing.
This metadata does not necessarily correspond to any physical output, but
rather what the compositor thinks would be best for a given surface.
</description>
<arg name="transfer_function" type="uint" enum="transfer_function">
<description summary="output's current transfer function">
Specifies a known transfer function that corresponds to the
output the surface is targeting.
</description>
</arg>
<arg name="output_display_primary_red_x" type="uint">
<description summary="red primary x coordinate">
Output Red Color Primary X Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="output_display_primary_red_y" type="uint">
<description summary="red primary y coordinate">
Output Red Color Primary Y Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="output_display_primary_green_x" type="uint">
<description summary="green primary x coordinate">
Output Green Color Primary X Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="output_display_primary_green_y" type="uint">
<description summary="green primary y coordinate">
Output Green Color Primary Y Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="output_display_primary_blue_x" type="uint">
<description summary="blue primary x coordinate">
Output Blue Color Primary X Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="output_display_primary_blue_y" type="uint">
<description summary="blue primary y coordinate">
Output Blue Color Primary Y Coordinate of the Data.
Coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="output_white_point_x" type="uint">
<description summary="white point x coordinate">
Output White Point X Coordinate of the Data.
These are coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="output_white_point_y" type="uint">
<description summary="white point y coordinate">
Output White Point Y Coordinate of the Data.
These are coded as unsigned 16-bit values in units of
0.00002, where 0x0000 represents zero and 0xC350
represents 1.0000.
</description>
</arg>
<arg name="max_luminance" type="uint">
<description summary="maximum luminance">
Max Output Luminance
The max luminance in nits that the output is capable of rendering in small areas.
Content should: not exceed this value to avoid clipping.
This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
</description>
</arg>
<arg name="min_luminance" type="uint">
<description summary="minimum luminance">
Min Output Luminance
The min luminance that the output is capable of rendering.
Content should: not exceed this value to avoid clipping.
This value is coded as an unsigned 16-bit value in units of
0.0001 cd/m2, where 0x0001 represents 0.0001 cd/m2 and 0xFFFF
represents 6.5535 cd/m2.
</description>
</arg>
<arg name="max_full_frame_luminance" type="uint">
<description summary="maximum full frame luminance">
Max Full Frame Luminance
The max luminance in nits that the output is capable of rendering for the
full frame sustained.
This value is coded as an unsigned 16-bit value in units of 1 cd/m2,
where 0x0001 represents 1 cd/m2 and 0xFFFF represents 65535 cd/m2.
</description>
</arg>
</event>
</interface>
</protocol>

View File

@@ -1,13 +1,13 @@
wayland_protos = dependency(
'wayland-protocols',
version: '>=1.32',
version: '>=1.43',
fallback: 'wayland-protocols',
default_options: ['tests=false'],
)
hyprland_protos = dependency(
'hyprland-protocols',
version: '>=0.2',
version: '>=0.6.4',
fallback: 'hyprland-protocols',
)
@@ -33,9 +33,15 @@ protocols = [
'wayland-drm.xml',
'wlr-data-control-unstable-v1.xml',
'wlr-screencopy-unstable-v1.xml',
'xx-color-management-v4.xml',
'frog-color-management-v1.xml',
hyprland_protocol_dir / 'protocols/hyprland-global-shortcuts-v1.xml',
hyprland_protocol_dir / 'protocols/hyprland-toplevel-export-v1.xml',
hyprland_protocol_dir / 'protocols/hyprland-toplevel-mapping-v1.xml',
hyprland_protocol_dir / 'protocols/hyprland-focus-grab-v1.xml',
hyprland_protocol_dir / 'protocols/hyprland-ctm-control-v1.xml',
hyprland_protocol_dir / 'protocols/hyprland-surface-v1.xml',
hyprland_protocol_dir / 'protocols/hyprland-lock-notify-v1.xml',
wayland_protocol_dir / 'staging/tearing-control/tearing-control-v1.xml',
wayland_protocol_dir / 'staging/fractional-scale/fractional-scale-v1.xml',
wayland_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
@@ -64,6 +70,12 @@ protocols = [
wayland_protocol_dir / 'staging/linux-drm-syncobj/linux-drm-syncobj-v1.xml',
wayland_protocol_dir / 'staging/xdg-dialog/xdg-dialog-v1.xml',
wayland_protocol_dir / 'staging/single-pixel-buffer/single-pixel-buffer-v1.xml',
wayland_protocol_dir / 'staging/security-context/security-context-v1.xml',
wayland_protocol_dir / 'staging/content-type/content-type-v1.xml',
wayland_protocol_dir / 'staging/color-management/color-management-v1.xml',
wayland_protocol_dir / 'staging/xdg-toplevel-tag/xdg-toplevel-tag-v1.xml',
wayland_protocol_dir / 'staging/xdg-system-bell/xdg-system-bell-v1.xml',
wayland_protocol_dir / 'staging/ext-workspace/ext-workspace-v1.xml',
]
wl_protocols = []
@@ -79,7 +91,7 @@ foreach protocol : protocols
endforeach
# wayland.xml generation
wayland_scanner = dependency('wayland-scanner')
wayland_scanner = dependency('wayland-scanner', native: true)
wayland_scanner_datadir = wayland_scanner.get_variable('pkgdatadir')
wayland_xml = wayland_scanner_datadir / 'wayland.xml'

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,24 @@
#!/bin/sh
SHADERS_SRC="./src/render/shaders/glsl"
echo "-- Generating shader includes"
if [ ! -d ./src/render/shaders ]; then
mkdir ./src/render/shaders
fi
echo '#pragma once' > ./src/render/shaders/Shaders.hpp
echo '#include <map>' >> ./src/render/shaders/Shaders.hpp
echo 'static const std::map<std::string, std::string> SHADERS = {' >> ./src/render/shaders/Shaders.hpp
for filename in `ls ${SHADERS_SRC}`; do
echo "-- ${filename}"
{ echo 'R"#('; cat ${SHADERS_SRC}/${filename}; echo ')#"'; } > ./src/render/shaders/${filename}.inc
echo "{\"${filename}\"," >> ./src/render/shaders/Shaders.hpp
echo "#include \"./${filename}.inc\"" >> ./src/render/shaders/Shaders.hpp
echo "}," >> ./src/render/shaders/Shaders.hpp
done
echo '};' >> ./src/render/shaders/Shaders.hpp

View File

@@ -1,4 +1,13 @@
#!/bin/sh
# if the git directory doesn't exist, don't gather data to avoid overwriting, unless
# the version file is missing altogether (otherwise compiling will fail)
if [ ! -d ./.git ]; then
if [ -f ./src/version.h ]; then
exit 0
fi
fi
cp -fr ./src/version.h.in ./src/version.h
HASH=${HASH-$(git rev-parse HEAD)}

Some files were not shown because too many files have changed in this diff Show More