Compare commits

...

1180 Commits

Author SHA1 Message Date
vaxerski
ff5843bd85 anchor to proper quad in floating resize 2022-10-03 22:41:12 +01:00
vaxerski
3bb5971c2e [gha] bump flake inputs 2022-10-03 21:17:33 +00:00
vaxerski
a1d9404f9f update wlroots dep 2022-10-03 22:16:02 +01:00
vaxerski
ab82c4806d allow one less arg in bind 2022-10-03 21:01:08 +01:00
vaxerski
49ab3890aa remove polling from socket2, fully event based 2022-10-03 20:47:15 +01:00
vaxerski
85eea70be4 fix commas in free binds 2022-10-03 16:38:05 +01:00
vaxerski
174b593438 optimize removing trailing spaces 2022-10-03 14:36:56 +01:00
vaxerski
0a08830375 Unify arg lists, allow for trailing spaces in args 2022-10-03 14:29:45 +01:00
vaxerski
a97621b1cb Added window swallowing 2022-10-01 19:19:15 +01:00
vaxerski
355366714e minor OR XWayland fixes 2022-10-01 18:25:02 +01:00
vaxerski
590fbf808b send a focusedmon event on focus change mon 2022-10-01 10:38:53 +01:00
vaxerski
bbeed21e62 fix crash 2022-10-01 08:54:43 +01:00
vaxerski
e6c9e3f81d add case for empty strings in isNumber 2022-09-30 21:54:13 +01:00
vaxerski
7579e03b64 include shaders only in opengl.cpp 2022-09-30 18:38:10 +01:00
vaxerski
1ef23a304a remove redundant attrib setting 2022-09-30 17:04:33 +01:00
vaxerski
3c27d1ab13 optimize vector config value setting 2022-09-30 17:03:14 +01:00
vaxerski
59a3c43913 guard event in maximize request 2022-09-30 10:37:09 +01:00
vaxerski
2d73da1a79 enter outputs for non-interactive ls-es too 2022-09-29 22:16:43 +01:00
Vaxry
45fe185cb9 Merge pull request #736 from Dickby/fix_bordersize_again
Scale the border size, revert the window scaling according to border
2022-09-29 22:01:06 +01:00
vaxerski
da40bf823f apply new node data to all group windows on close 2022-09-29 19:46:33 +01:00
vaxerski
caeb0636fa fix crash on dwindle splitratio alter on single group 2022-09-29 19:41:49 +01:00
vaxerski
bdd9680adf fix ipc event missing on silent movetoworkspace 2022-09-29 19:33:43 +01:00
vaxerski
ff4c22ca90 add fullscreen info to clients request 2022-09-29 19:30:49 +01:00
vaxerski
9f9129e536 focusable checks in nextWindow calls 2022-09-29 16:53:31 +01:00
Felix Dick
ab42e4bccf Merge branch 'main' into fix_bordersize_again 2022-09-29 14:29:03 +02:00
vaxerski
2636abca2d use the event data for determining maximize status in requests 2022-09-29 10:24:54 +01:00
vaxerski
ead0e74471 handle maximize toplevel request 2022-09-29 10:20:17 +01:00
Vaxry
dcf5e34bfa Merge pull request #735 from Dickby/fix_splash_position
Splash position fix
2022-09-29 10:07:27 +01:00
Felix Dick
10c4f4ba35 Shift splash up if monitor has wider ratio than bgTexture. 2022-09-29 05:29:03 +02:00
Felix Dick
a1319e5110 Merge branch 'main' into fix_bordersize_again 2022-09-29 01:42:28 +02:00
Felix Dick
5233746ac5 Change scaledBorderSize to int. 2022-09-29 01:40:19 +02:00
Vaxry
31cb4c49d9 Merge pull request #743 from Dickby/use_double_literals
Use double literals, don't cast integer or float literals to double.
2022-09-28 19:28:13 +01:00
Felix Dick
11ee78f88b Use double literals, don't cast a integer literal to double. 2022-09-28 20:08:41 +02:00
vaxerski
ec5ffe8839 rewrite isNumber 2022-09-28 15:32:53 +01:00
vaxerski
e3b1d3c3c5 allow for pure workspace names in dispatchers 2022-09-28 15:26:41 +01:00
vaxerski
458ba3237b use goalv in movetoworkspace 2022-09-28 15:12:15 +01:00
Vaxry
7a775c0584 Merge pull request #737 from Dickby/use_max_instead_of_clamp_in_some_places
Replace clamp with max if there is no upper bound.
2022-09-26 20:49:56 +01:00
Felix Dick
87afc8c250 Replace clamp with max if there is no upper bound. 2022-09-26 21:10:24 +02:00
Felix Dick
cd2b2c4fba Scale the border size, revert the window scaling according to border 2022-09-26 17:38:08 +02:00
Felix Dick
c48336aac3 Scale the cairo matrix to fit the monitor dimensions. 2022-09-26 06:35:00 +02:00
Vaxry
f70b57f360 Merge pull request #732 from Dickby/main
Remove trailing whitespace.
2022-09-25 19:32:24 +01:00
Felix Dick
bf3f519eb7 Remove trailing whitespace. 2022-09-25 20:07:48 +02:00
Vaxry
190229942f Merge pull request #727 from Dickby/main
Scale border size in window size pos calculation
2022-09-25 17:21:31 +01:00
Dickby
e476382d08 scale border size in dwindle layout window sizes. 2022-09-25 18:12:42 +02:00
Dickby
c885afcbc6 Scale border size in calculations of windows 2022-09-25 12:42:39 +02:00
vaxerski
fad5fc587d guard kb settings in xkb translation state 2022-09-24 21:07:18 +01:00
vaxerski
73dbacd16d overwrite wsbind rules on existing 2022-09-24 13:42:18 +01:00
vaxerski
65fb0cf0f6 fix custom rules on null modelist 2022-09-24 13:10:11 +01:00
vaxerski
5101ddeff1 fix oopsies in rule code 2022-09-24 11:30:41 +01:00
Vaxry
959557ecc3 Merge pull request #716 from Dickby/main
Fixing my last change
2022-09-23 18:18:55 +01:00
Dickby
bccc81d306 Fixing my last change
It wasn't a problem with the bug i tried to fix.
But there  would be a problem if some function would dereference pPreviousGroupMember from the node that was PHEAD->pNextGroupMember.
Please don't be mean!
2022-09-23 19:13:05 +02:00
Vaxry
718de0d9fa Merge pull request #715 from Dickby/main
fix crash
2022-09-23 17:05:04 +01:00
vaxerski
fd6116c0cd style 2022-09-23 17:01:27 +01:00
Dickby
00b16888bf style fix 2022-09-23 17:59:33 +02:00
Vaxry
abee2da5bd Merge pull request #706 from DashieTM/main
Add "highest" mode to Monitor for autoconfiguration.
2022-09-23 16:50:24 +01:00
vaxerski
695411f1bd don't decorate on only no gaps 2022-09-23 16:47:58 +01:00
Dickby
f9d8b3096a fix crash
Fixes #711
2022-09-23 17:01:46 +02:00
vaxerski
e5d143b238 support more wlr_cursor events 2022-09-22 21:14:02 +01:00
vaxerski
37f2e1ddbe don't recalc pseudo on fullscreen 2022-09-22 20:57:09 +01:00
vaxerski
ef3eb37c7f support max in size rules 2022-09-22 18:13:23 +01:00
Mihai Fufezan
db551b8970 Nix & meson: bump to 0.14.0 2022-09-22 19:59:38 +03:00
vaxerski
c08218301b disallow pinning fullscreen 2022-09-22 16:48:40 +01:00
vaxerski
75aaf11a9c default pass_mouse_when_bound to 0 2022-09-22 16:33:45 +01:00
Fabio Lenherr
c4e782ca5d remove more silly mistakes 2022-09-22 00:50:23 +02:00
Fabio Lenherr
da2c2ddc21 remove empty line 2022-09-22 00:47:09 +02:00
Fabio Lenherr
5272588270 fix silly mistakes 2022-09-22 00:45:56 +02:00
Fabio Lenherr
215125bd66 add refreshrate or resolution preference 2022-09-22 00:22:39 +02:00
Fabio Lenherr
30d16373d0 fix Hz Log 2022-09-21 22:40:01 +02:00
Fabio Lenherr
c1feb683ce added high to monitor resolution 2022-09-21 22:29:52 +02:00
vaxerski
d3ffccd45f accept any case in binds 2022-09-21 17:41:26 +01:00
Mihai Fufezan
d49af1cc18 flake: add libdrm overlay until it gets updated 2022-09-21 18:10:35 +03:00
vaxerski
8b46d0b5a9 simplify some local vars 2022-09-21 15:11:09 +01:00
vaxerski
336883dda3 [gha] bump flake inputs 2022-09-21 14:09:05 +00:00
vaxerski
65ec8c7694 update wlroots dep 2022-09-21 15:07:57 +01:00
vaxerski
79c645f8cd handle touch devices internally as objects 2022-09-21 14:39:34 +01:00
vaxerski
d44cc9f112 [gha] bump flake inputs 2022-09-21 13:23:15 +00:00
vaxerski
1963da2d47 update wlroots dep 2022-09-21 14:22:05 +01:00
vaxerski
2b99dbb446 better cycling in fullscreen with pinned 2022-09-21 14:16:13 +01:00
vaxerski
d24f31de51 disallow fullscreen pinned 2022-09-21 14:09:26 +01:00
Fabio Lenherr / DashieTM
d51c7ca135 change Preferred mode to use highest refreshrate 2022-09-20 23:41:03 +02:00
vaxerski
8b11a2e1b1 minor mouse bind handling fixes 2022-09-20 22:23:02 +01:00
vaxerski
b4bcba935d disallow move/resize dispatchers on fullscreen windows 2022-09-20 19:58:08 +01:00
vaxerski
7f3750bd75 disable enabling groups on fullscreen windows 2022-09-20 18:08:10 +01:00
vaxerski
7a9423c782 better dwindle swapping with groups 2022-09-20 18:04:39 +01:00
vaxerski
6f98b3cbd8 fix pinned fade on fs 2022-09-20 15:33:53 +01:00
vaxerski
2dd1661aec fix groups with fullscreen 2022-09-20 12:17:34 +01:00
vaxerski
cde624ec6a fix moving between fullscreen workspaces 2022-09-20 10:16:58 +01:00
vaxerski
b82621c4ec fix mouse binds being stuck 2022-09-20 10:02:20 +01:00
vaxerski
5b6c8d5b0f fix misc fullscreen issues 2022-09-20 09:55:25 +01:00
vaxerski
4dca2b945b fix LS fading out on ws change 2022-09-20 09:46:55 +01:00
Vaxry
a8943246a7 Merge pull request #684 from tomahk/main
fix some bugs with attaching/disabling monitors
2022-09-19 21:08:48 +01:00
vaxerski
e42de0b778 export HYPRLAND_CMD for scripts 2022-09-19 21:06:44 +01:00
tomahk
5146165599 this is c++, use nullptr 2022-09-19 21:45:00 +02:00
tomahk
73e19aee6f prevent assert killing Hyprland after reenabling monitor 2022-09-19 20:44:33 +02:00
tomahk
3780361b95 fix hyprland freeze when undocking from docking station 2022-09-19 20:42:59 +02:00
vaxerski
ec6144e5da fix fadeout on unmap fullscreen 2022-09-19 19:09:21 +01:00
vaxerski
b6eaeffcf6 introduce new mouse binds in default and example cfgs 2022-09-19 19:06:22 +01:00
vaxerski
c24b45671a mouse binds overhaul 2022-09-19 19:04:48 +01:00
vaxerski
85c7aaf155 fade control for fullscreen action on windows 2022-09-19 17:26:11 +01:00
vaxerski
696253b348 fix special workspace dispatcher logic 2022-09-19 16:01:42 +01:00
vaxerski
abb6db9c37 don't apply alpha to fadingOut on setWindowFullscreen 2022-09-19 11:44:11 +01:00
vaxerski
18b483b8e1 fix ws switching with LS opacity 2022-09-19 10:40:42 +01:00
vaxerski
7c809a3059 fullscreen animation en-nice-ment 2022-09-19 10:23:13 +01:00
vaxerski
4070e1a148 fix wonky focus on movetoworkspace 2022-09-18 17:26:12 +01:00
vaxerski
dd61f88ed1 guard invalid FB allocs 2022-09-18 12:40:49 +01:00
vaxerski
29626989e7 fix focus follows mouse 0 event sending on wrong window 2022-09-18 12:35:05 +01:00
vaxerski
cf32d28082 fix groupbar being wonk on scaled 2022-09-18 12:13:16 +01:00
vaxerski
5131a4acaf fix special fullscreen 2022-09-17 15:07:03 +01:00
vaxerski
a72a39ebd5 minor swipe fixes 2022-09-17 15:05:12 +01:00
vaxerski
151e013241 fix refocus on same workspace 2022-09-17 12:10:06 +01:00
vaxerski
fa2d81b649 fix animation issues with workspace silent 2022-09-16 21:17:03 +01:00
vaxerski
037d4ed422 handle multi-ws swaps in layouts 2022-09-14 17:30:16 +02:00
vaxerski
9f82278d65 simplify dwindle swap 2022-09-14 17:24:45 +02:00
vaxerski
8e0f7b9b11 Various subsurface handling fixes 2022-09-14 16:34:41 +02:00
vaxerski
a96acc8fa4 only check for visible on xdg 2022-09-13 22:23:48 +02:00
vaxerski
5a146e9d90 guard surface in addsurfaceglobaloffset 2022-09-13 21:49:55 +02:00
vaxerski
da10022d84 fix an unholy memory safety issue 2022-09-13 20:27:07 +02:00
vaxerski
e518adf1ac don't iterate over subsurfaces in unmap 2022-09-13 15:44:50 +02:00
vaxerski
d8dbe26f31 tick config after reload request 2022-09-13 15:36:49 +02:00
vaxerski
e9f226797e Added monitor mirroring 2022-09-13 15:25:42 +02:00
vaxerski
7d4f0a3199 verify visibility of new geom in floating creation 2022-09-13 12:29:56 +02:00
vaxerski
0062281092 added wsbind 2022-09-12 21:05:52 +02:00
vaxerski
81f267dff9 add default speed to hyprctl devices mice 2022-09-12 17:09:04 +02:00
vaxerski
a09c614c2d more forceRendering checks in shouldRenderWindow 2022-09-12 15:33:25 +02:00
Vaxry
b49d7007b5 Merge pull request #659 from hyprwm/hyprctl-nopoll
hyprctl-nopoll
2022-09-11 20:48:22 +02:00
vaxerski
864e227f5d fix decos on pinned 2022-09-11 20:27:59 +02:00
vaxerski
82aa78916d hyprctl-nopoll 2022-09-10 21:21:28 +02:00
vaxerski
f024d7114f allow current in monitorfromstring 2022-09-10 19:57:57 +02:00
vaxerski
8808d40008 added misc:disable_autoreload 2022-09-10 17:28:41 +02:00
vaxerski
d94fe3d063 added window pinning 2022-09-10 13:11:02 +02:00
vaxerski
f663fa209c minor code styling fixes 2022-09-09 19:08:11 +02:00
Mihai Fufezan
9370c7aa8a Nix modules: add recommendedEnvironment option 2022-09-09 17:01:24 +03:00
vaxerski
928158bbfb prevent missed surface size updates on fullscreen window close 2022-09-08 23:02:29 +02:00
vaxerski
bacfae3084 guard drag in destroyDrag 2022-09-08 21:25:16 +02:00
vaxerski
0d95a0174c more guarding in cleanup pid gathering 2022-09-08 20:55:25 +02:00
vaxerski
0eb5ecafb9 consistent output of window addresses 2022-09-08 18:47:39 +02:00
vaxerski
49a55f136e fix addreserved lag 2022-09-08 14:11:32 +02:00
vaxerski
64be57b780 fix group decos on added windows 2022-09-07 20:36:39 +02:00
Vaxry
6e195a6b8c Merge pull request #636 from viperML/fix-man
docs: fix github workflow
2022-09-07 13:05:16 +02:00
Fernando Ayats
8d3f6c5d84 docs: fix github workflow 2022-09-07 12:44:20 +02:00
vaxerski
5c470d2e54 damage drag on destroy 2022-09-07 12:18:52 +02:00
Mihai Fufezan
26910a8b63 Nix HM module: fix build error
Apparently HM doesn't like having `lib.mkDefault` near strings.

Fixes #635
2022-09-07 13:11:03 +03:00
vaxerski
44a2d755c6 Added Xwayland and floating props to windowrulev2 2022-09-07 11:25:44 +02:00
Mars
cf5426f2d8 Fix typo in module.nix 2022-09-07 11:48:08 +03:00
Mihai Fufezan
1d631c8a23 Nix modules: add common environment variables 2022-09-07 01:24:09 +03:00
vaxerski
789eedd115 fix a minor bug with no gaps when only and groups 2022-09-06 19:59:59 +02:00
vaxerski
4a8274e5f0 fix dwindle no gaps when only when dissolving a group 2022-09-06 18:12:41 +02:00
vaxerski
4b7d28d2cb fix last partial commit 2022-09-06 18:12:25 +02:00
vaxerski
5fdd1dd60f simplify config monitor reloads and rearrange layers 2022-09-06 17:26:18 +02:00
vaxerski
e71a4d75de Added windowrulev2 2022-09-06 11:57:11 +02:00
vaxerski
f002bd1603 wrap lastwindow in quotes in hyprctl json 2022-09-05 23:07:56 +02:00
vaxerski
16f1d1b99b guard unsafe state in unmap ls 2022-09-05 22:35:41 +02:00
vaxerski
c1bc8d46e9 use lastMonitor in mapWindow 2022-09-05 22:04:49 +02:00
vaxerski
94ca386a8c set last monitor and dont refocus in some cases (changeworkspace) 2022-09-05 21:36:22 +02:00
vaxerski
2ba7cb2414 escape json strings in workspaces lastwindow title 2022-09-05 21:32:37 +02:00
vaxerski
5b5f36f494 fix transformed blur on new optimizations 2022-09-05 21:26:21 +02:00
vaxerski
a74b8033ca added a submap IPC event 2022-09-05 13:50:52 +02:00
vaxerski
41883e0522 fix wonky behavior with silent workspace rule 2022-09-05 11:44:43 +02:00
vaxerski
3ea89e6171 fix splash positioning 2022-09-05 11:31:54 +02:00
vaxerski
d6c06318af don't accumulate from virtual 2022-09-05 11:19:40 +02:00
vaxerski
cb839c9dcc guard pFoundWindow in CInputManager under fullscreen 2022-09-05 00:59:13 +02:00
vaxerski
3dd514a452 fix a damage issue with transformed blur 2022-09-04 23:08:04 +02:00
vaxerski
6afab12b91 fix blur on transformed displays 2022-09-04 19:27:38 +02:00
vaxerski
7a3b57c99c send accumulated modifiers to surfaces 2022-09-04 18:46:28 +02:00
vaxerski
ba0c5fe0bb fix mouse focus not returning from a LS on follow mouse 0 2022-09-04 18:42:11 +02:00
vaxerski
f6ecef0959 add lastwindow info to hyprctl workspaces 2022-09-04 18:32:03 +02:00
vaxerski
ff26531e11 use activateSurface in unconstrainMouse 2022-09-04 11:29:49 +02:00
vaxerski
fbd2b4799d Fix some more crimes against humanity 2022-09-03 22:49:52 +02:00
Mihai Fufezan
1664f81cae Nix: revert HM module import fix
fixes #619
2022-09-03 23:22:39 +03:00
vaxerski
c425e620af fix some minor crimes against humanity 2022-09-03 19:35:17 +02:00
vaxerski
f4add0ac6d refocus on reserved area 2022-09-03 15:35:53 +02:00
vaxerski
3c3f80c2fe simplify code and update monitor on warp 2022-09-03 11:55:19 +02:00
Mihai Fufezan
eee0cad4d0 Nix modules: fix imports 2022-09-03 02:20:20 +03:00
Mihai Fufezan
0ea96e87c0 flake: remove overlay warning 2022-09-03 01:55:28 +03:00
vaxerski
5d09bb647b fix up styling 2022-09-02 23:56:22 +02:00
vaxerski
f5697095bc unify monitor args 2022-09-02 11:53:12 +02:00
vaxerski
56203b1757 fix no_gaps_when_only with a group 2022-09-01 19:46:38 +02:00
Fernando Ayats
c0a7dffcdc nix: move wlroots and add nvidia patches (#608) 2022-09-01 20:35:50 +03:00
vaxerski
8581e71789 optimize calls in toggleSpecialWorkspace 2022-09-01 11:47:48 +02:00
vaxerski
bb90ff0461 sanity check on last window 2022-09-01 11:46:41 +02:00
vaxerski
1d4d2f4793 [gha] bump flake inputs 2022-09-01 09:25:26 +00:00
vaxerski
7f62cbc48a Update wlroots dep 2022-09-01 11:24:15 +02:00
vaxerski
f2d84a7e3a guard parent in X11TransientFor 2022-09-01 10:16:23 +02:00
vaxerski
095185cfe7 guard parent in X11TransientFor 2022-09-01 10:15:55 +02:00
vaxerski
f77fac9df9 warp only on another monitor in changeworkspace 2022-08-31 21:39:27 +02:00
vaxerski
dacaf72e02 remember last window on workspace 2022-08-31 17:02:49 +02:00
Mihai Fufezan
0ad261aa9c flake: formatting 2022-08-31 12:26:12 +03:00
Mihai Fufezan
7610c20761 Nix & meson: 0.11.1 -> 0.12.1
flake: add commit to wlroots version
2022-08-31 12:22:32 +03:00
vaxerski
4103bca056 default rounding to 0 2022-08-31 11:17:04 +02:00
vaxerski
21a1b62b6a remove tiling node when invalid 2022-08-31 11:14:33 +02:00
vaxerski
7f483dfdb0 guard psurface in activateSurface 2022-08-31 11:12:46 +02:00
vaxerski
1cf46fd6a2 added closewindow dispatcher 2022-08-30 21:35:27 +02:00
vaxerski
eb658dcb61 finally fixed transformed snapshots 2022-08-30 19:40:19 +02:00
vaxerski
195ec2b092 fix LS popup damage 2022-08-30 19:21:45 +02:00
vaxerski
dd6aba07e9 revert x11 size hints 2022-08-30 16:12:11 +02:00
vaxerski
d35d949bc5 use sizehints if existent for X11 default floating 2022-08-30 13:07:54 +02:00
vaxerski
48eb2e0d6f Added window dimming 2022-08-30 12:46:17 +02:00
vaxerski
179562b646 fix dwindle groupbars 2022-08-29 19:52:35 +02:00
vaxerski
20c050e890 set last monitor on move focus dispatcher 2022-08-29 18:50:10 +02:00
Mihai Fufezan
bdd20c401d Add HiDPI xwayland + wlroots patches (#591) 2022-08-29 16:51:39 +03:00
vaxerski
6865660e51 disable fullscreen and floating dispatchers on special 2022-08-29 14:55:11 +02:00
vaxerski
6c8ce734fb fix segfault in inactive sessions 2022-08-29 11:17:42 +02:00
vaxerski
09495375b5 ratelimit setting cursor 2022-08-28 22:45:05 +02:00
vaxerski
3c20ecb04d ignore oversized popups' dims in global coords 2022-08-28 21:20:18 +02:00
vaxerski
5da114477f move X11 transients to top on parent top 2022-08-28 19:47:06 +02:00
vaxerski
c757fa54e1 Allow passing the mouse as well in pass 2022-08-28 17:01:48 +02:00
vaxerski
16f8d46391 Force wlroots to not send leave events in pass to XWayland
Massive hack, kill me
2022-08-28 16:43:15 +02:00
vaxerski
5726f394b1 fix subsurface UV handling on oversized windows 2022-08-28 14:43:25 +02:00
vaxerski
f5f99c6700 reset uv on invalid buffer source box 2022-08-28 14:32:06 +02:00
vaxerski
cfa6c01df0 remove double drm and dmabuf creation 2022-08-28 12:32:26 +02:00
vaxerski
d413388761 Multiple improvements to the shutdown procedure 2022-08-28 11:19:08 +02:00
vaxerski
4203a61b69 minor fixes to the viewporter behavior 2022-08-28 10:41:47 +02:00
vaxerski
80b3a436d2 better find device cats 2022-08-28 10:25:48 +02:00
vaxerski
5d9d55a245 fix device closing 2022-08-28 10:20:26 +02:00
Vaxry
52c0ba544c Viewporter implementaion (#585)
Implementation of the `wp_viewporter` core protocol and some bugfixes
2022-08-28 10:14:43 +02:00
Vaxry
8b5c64c8fd Merge pull request #589 from alec-lefors/drm-leasing
fix more indents
2022-08-28 00:07:01 +02:00
Alec LeFors
2ea5f50f40 fix more indents, im sorry vaxry 2022-08-27 17:57:02 -04:00
Vaxry
1d97ad9856 Merge pull request #588 from alec-lefors/drm-leasing
implemented DRM leasing
2022-08-27 23:47:41 +02:00
Alec LeFors
1d43bb70d4 fix indents, change crit log to info 2022-08-27 17:24:36 -04:00
vaxerski
573cb0d4e0 fix parser in nested categories 2022-08-27 23:12:01 +02:00
Alec LeFors
59d7cfcd02 implemented DRM leasing for VR headsets 2022-08-27 17:10:13 -04:00
vaxerski
ed2cacc5d5 fix styling in const ptrs 2022-08-27 21:37:35 +02:00
Nicholas Cioli
df4c1c02a6 fix xwayland config option for nix (#587)
When building Hyprland in nix using the following home-manager recipe:

```nix
wayland.windowManager.hyprland = {
    enable = true;
    xwayland = false;
  };
```

The default nix configuration still makes reference to a compile argument `NO_XWAYLAND`, but the `meson_options.txt` only makes reference to `xwayland`. This causes the build to fail with:

```
meson.build:1:0: ERROR: Unknown options: "NO_XWAYLAND"
```

This change fixes that issue. This still doesn't allow you to build Hyprland without having XWayland installed (#178), but it should at least allow for valid nix configurations for when that issue gets resolved.
2022-08-27 21:45:48 +03:00
vaxerski
8122505825 pass press and release events separately 2022-08-27 19:29:28 +02:00
vaxerski
0964448f93 fix fullscreen in moving ws 2022-08-27 19:11:21 +02:00
vaxerski
5d63152219 added a forceinput rule 2022-08-27 13:01:55 +02:00
vaxerski
aaa834d0c3 fix logic in candidates on unmap 2022-08-27 12:02:25 +02:00
vaxerski
28966d85ae guard nullptr in unmap 2022-08-27 12:01:04 +02:00
vaxerski
a648b452dd fix internal keybinds 2022-08-26 19:19:34 +02:00
vaxerski
d53b0a6491 optimize options in dwindle 2022-08-26 19:07:33 +02:00
Mihai Fufezan
80d522cb26 nix & meson: update version to 0.11.1 2022-08-26 19:48:22 +03:00
vaxerski
dbd774fedb simplify a bit of code 2022-08-26 18:02:10 +02:00
Mihai Fufezan
bf00bf7963 Nix: add nixConfig 2022-08-26 18:58:42 +03:00
vaxerski
949655005a added an event for moving workspace 2022-08-26 16:05:02 +02:00
Vaxry
56caba5f01 updated readme previews 2022-08-26 11:41:07 +02:00
vaxerski
b09f157b93 fix fullscreen on workspace rule silent 2022-08-26 11:33:36 +02:00
vaxerski
10f529ada7 added a specialWorkspace anim leaf 2022-08-26 11:26:23 +02:00
vaxerski
f7c741317f fix shadows on silent rule 2022-08-26 01:08:11 +02:00
vaxerski
b16a57ceeb fix window rules 2022-08-26 00:38:20 +02:00
vaxerski
0eb86f4b0d fix silent workspaces with back and forth 2022-08-26 00:19:57 +02:00
vaxerski
7b01c3d028 allow specifying window for toggle floating 2022-08-25 22:34:53 +02:00
vaxerski
89018bfa95 remove leftover code that didnt work 2022-08-25 21:38:01 +02:00
vaxerski
0d1a9e4ba9 modify exit behaviour a bit 2022-08-25 21:35:47 +02:00
vaxerski
e327b0a835 added a swapactiveworkspaces dispatcher 2022-08-25 21:25:28 +02:00
vaxerski
de477a6ff5 don't focus silent windows 2022-08-25 16:47:33 +02:00
Vaxry
e92469121d Merge pull request #573 from NotAShelf/main
Add cleaninstall task
2022-08-24 22:05:27 +02:00
NotAShelf
a9761cb1c8 Merge branch 'hyprwm:main' into main 2022-08-24 23:05:22 +03:00
vaxerski
6c2175ed52 fixes to swapnext logic on dwindle 2022-08-24 22:01:25 +02:00
vaxerski
00ef40dda1 added swapnext and swapprev for master 2022-08-24 21:50:48 +02:00
vaxerski
9c3aeda9f9 added swapnext 2022-08-24 21:40:36 +02:00
NotAShelf
a4f7bd4bc2 fix typo
what is this, clash of clans?
2022-08-24 18:53:30 +03:00
NotAShelf
3fd903ee74 remove unintended whitespace 2022-08-24 18:51:57 +03:00
NotAShelf
83ef951c21 add clean install for those who build from source 2022-08-24 18:47:35 +03:00
NotAShelf
8bbb790d87 [gha] build man pages 2022-08-24 15:46:38 +00:00
vaxerski
ffaf14c19e minor damage fixes 2022-08-24 13:44:48 +02:00
vaxerski
9366c187dc don't find a new candidate to refocus on unfocused unmap 2022-08-24 11:14:11 +02:00
vaxerski
29696d046e remove general:sensitivity from the default config 2022-08-24 11:12:42 +02:00
vaxerski
09f3999b1e Unfocus first on non-internal ws changes 2022-08-23 23:34:36 +02:00
vaxerski
fba7ed97fb don't refocus if candidate is last window 2022-08-23 23:15:04 +02:00
vaxerski
fd70a9184b fix logic in fullscreen close candidates 2022-08-23 23:09:28 +02:00
vaxerski
0a9ac47030 remove unintuitive candidate behavior 2022-08-23 18:25:33 +02:00
vaxerski
e2450247c0 minor fixes to candidate finding 2022-08-23 18:18:18 +02:00
vaxerski
973540bbc5 minor fix on unfocus on fullscreen workspace 2022-08-23 18:01:22 +02:00
vaxerski
f9b2aa5468 don't round popups 2022-08-23 16:54:32 +02:00
vaxerski
451659ec34 fix oversized popup misalignment 2022-08-23 16:52:36 +02:00
vaxerski
a9e34cba93 move monitor damage to separate funcs 2022-08-23 16:07:47 +02:00
vaxerski
48c9e9d83d damage on force warp resize 2022-08-23 15:08:15 +02:00
vaxerski
23c5760538 IME Popup damage fixes 2022-08-23 11:16:35 +02:00
vaxerski
9bfa3ebc50 fix up keyword to accept spaced args 2022-08-22 23:25:11 +02:00
Mihai Fufezan
8feb6f7da1 Nix: add shortRev to version 2022-08-23 00:17:00 +03:00
vaxerski
fb0e81c18e fix up hyprctl dispatch 2022-08-22 19:16:35 +02:00
vaxerski
359df96d53 fix wlr logging 2022-08-22 18:58:29 +02:00
vaxerski
63493b5736 use a custom logging func for wlr 2022-08-22 18:50:38 +02:00
vaxerski
6565c31dbf fix IME grab on multiple open native inputs 2022-08-22 18:40:38 +02:00
vaxerski
575bfa40e5 added misc:float_switch_override_focus 2022-08-22 18:22:26 +02:00
vaxerski
429b2bffed fix minor refocus issue 2022-08-22 18:16:32 +02:00
vaxerski
c83948ea9a added HYPRLAND_LOG_WLR envvar 2022-08-22 15:50:08 +02:00
vaxerski
8a6e29974b [gha] build man pages 2022-08-22 13:16:57 +00:00
Vaxry
4c6d9b7d5a Merge pull request #555 from viperML/update-man
docs: build man pages to repo
2022-08-22 15:16:32 +02:00
Vaxry
9f5e099cd1 Merge pull request #562 from sp1ritCS/s/ospatches
openSUSE patches
2022-08-22 14:47:17 +02:00
vaxerski
8b39a1cf9b always use /usr/share/ for wayland-sessions 2022-08-22 14:46:53 +02:00
Florian sp1rit​
e9551731f0 improve compatability with older meson versions
- changed <compiler>.get_version() to <compiler>.version()

Signed-off-by: Florian "sp1rit"​ <sp1ritCS@protonmail.com>
2022-08-22 14:35:49 +02:00
Florian sp1rit​
39a9980fb1 dropped deprecated gethostbyname check
Done to avoid the rpmlint warning:
hyprland.x86_64: W: binary-or-shlib-calls-gethostbyname /usr/bin/hyprctl
The binary calls gethostbyname. Please port the code to use getaddrinfo.

Signed-off-by: Florian "sp1rit"​ <sp1ritCS@protonmail.com>
2022-08-22 14:35:41 +02:00
vaxerski
d0ec2b72ae report sizes to all windows on fullscreen 2022-08-22 14:22:21 +02:00
vaxerski
e97fa4e26b destroy monitor resources on exit 2022-08-22 14:17:25 +02:00
vaxerski
52318692f0 clean up temp logic in snapshots 2022-08-22 13:38:40 +02:00
vaxerski
86be6c3884 fix LS snapshot rendering logic 2022-08-22 13:36:00 +02:00
vaxerski
21bea0fcb4 typo 2022-08-22 11:37:00 +02:00
vaxerski
83f7fee3f5 fullscreen request only when mapped 2022-08-22 11:35:46 +02:00
vaxerski
f273ebed9c fix another edge case for fullscreen default windows 2022-08-21 23:24:57 +02:00
vaxerski
3cb30e7fb0 fix crash 2022-08-21 23:16:54 +02:00
vaxerski
3e9a8a7bc8 set new optimizations for blur in example configs 2022-08-21 22:59:19 +02:00
vaxerski
7ca50d7566 handle fullscreen pre-map
stupid-ass qt
2022-08-21 22:30:48 +02:00
vaxerski
ebe07c6656 fix incorrect popup handling on oversized 2022-08-21 21:23:05 +02:00
vaxerski
ce62a98470 fix warn 2022-08-21 18:35:45 +02:00
vaxerski
8faac0c9ac minor activewindow and focus fixes 2022-08-21 18:34:38 +02:00
Fernando Ayats
fea6d7deb0 docs: install manpages with meson 2022-08-21 18:00:04 +02:00
Fernando Ayats
463bc7ab13 doc: install mapages 2022-08-21 17:28:56 +02:00
Vaxry
c4ba11729f Merge pull request #557 from xDarksome/main
Add window{open/close/move} IPC events (#549)
2022-08-21 17:10:24 +02:00
vaxerski
5569e1f69c remove unused func 2022-08-21 17:09:35 +02:00
vaxerski
da725d7aa5 warn about outdated keybind cfg 2022-08-21 17:01:32 +02:00
Darksome
f7f3446882 CCompositor::moveWindowToWorkspace -> CWindow::moveToWorkspace 2022-08-21 18:01:26 +03:00
vaxerski
0f63077a07 use a custom translation state in keybinds 2022-08-21 16:43:22 +02:00
xDarksome
0f25f3aee3 Merge branch 'hyprwm:main' into main 2022-08-21 16:03:51 +03:00
Vaxry
5e1f2539cb Merge pull request #352 from CharlesEkkel/previous-workspace
Add switching to previous workspace
2022-08-21 14:16:52 +02:00
Charles Taylor
9dbdd66da4 fix retrieval of monitor 2022-08-21 22:11:40 +10:00
Charles Taylor
6ec932d11f fix bug which allowed a switch to workspace ID -1.
This only happened for the workspace_back_and_forth setting, since it
was missing a check.
2022-08-21 22:05:35 +10:00
Charles Taylor
3c8c605541 fix style conflicts and config + monitor retrieval 2022-08-21 21:58:46 +10:00
Charles Taylor
9ee42836d5 add general:allow_workspace_cycles option 2022-08-21 20:47:56 +10:00
Charles Taylor
d6ff7e40cf add general:workspace_back_and_forth option 2022-08-21 20:40:06 +10:00
Charles Taylor
04f0efadc3 add switching to previous workspace 2022-08-21 20:21:21 +10:00
viperML
12cdca7422 [gha] build man pages 2022-08-21 08:40:27 +00:00
Fernando Ayats
7ce2c91673 doc: build man pages to repo 2022-08-21 10:39:47 +02:00
Fernando Ayats
aaba11b7a2 gha: build man pages 2022-08-21 10:33:45 +02:00
vaxerski
9513031da3 fix a minor border issue 2022-08-20 22:45:30 +02:00
vaxerski
08e874bcf9 fix special workspace windows being xray with new optim 2022-08-20 20:16:04 +02:00
vaxerski
61aa4ff70e [gha] bump flake inputs 2022-08-20 18:07:29 +00:00
vaxerski
cc3f0ff9e7 update wlroots dep 2022-08-20 20:06:24 +02:00
vaxerski
7af193d921 reload on input and device hyprctl 2022-08-20 18:57:30 +02:00
vaxerski
132c96f867 multiple fixes for device configs 2022-08-20 18:47:48 +02:00
vaxerski
45a0e69286 Find a candidate better on window close 2022-08-20 18:12:59 +02:00
vaxerski
0ebef9a8ae no focus to OR Xwayland 2022-08-20 18:00:50 +02:00
vaxerski
185f93ae64 fix dwindle active for splits 2022-08-20 17:59:15 +02:00
Darksome
776750ee34 Merge branch 'main' of github.com:xDarksome/Hyprland 2022-08-20 13:26:31 +03:00
Darksome
37e1450a4d Impl CCompositor::moveWindowToWorkspace 2022-08-20 13:25:56 +03:00
vaxerski
1b1a0259a8 fix crash 2022-08-19 23:22:59 +02:00
Vaxry
223ca6e286 Merge pull request #548 from FlafyDev/main
add input:kb_file option to use a .xkb file.
2022-08-19 22:39:50 +02:00
FlafyDev
f0ad77251b move absolutePath to MiscFunctions 2022-08-19 23:18:09 +03:00
vaxerski
c2a3896cc9 added dwindle:use_active_for_splits 2022-08-19 22:03:41 +02:00
Vaxry
e749331f30 update wiki links in readme 2022-08-19 21:50:57 +02:00
FlafyDev
69d17bf424 add input:kb_file 2022-08-19 21:01:51 +03:00
vaxerski
946222f4a7 fix typo in swipe alpha control 2022-08-19 17:42:10 +02:00
vaxerski
504d07a87d fix swipe on workspace style fade 2022-08-19 17:36:01 +02:00
vaxerski
81b27be6bb reset lastwindow on full LS focus 2022-08-19 17:29:16 +02:00
vaxerski
f9e30e985c fix refocus on no window 2022-08-19 17:25:07 +02:00
vaxerski
6cae44e2c0 fix custom rounding in shadow deco 2022-08-19 14:52:18 +02:00
vaxerski
43aea417b0 Fix occasional hangups on exit 2022-08-18 22:36:58 +02:00
xDarksome
4af95d4253 Merge branch 'hyprwm:main' into main 2022-08-18 22:24:00 +03:00
Darksome
844c33c980 Add mapwindow, unmapwindow and movewindow IPC events 2022-08-18 22:23:28 +03:00
Vaxry
ece3ac97f9 Merge pull request #543 from Roger-Roger-debug/main
More fullscreen animation fixes
2022-08-18 19:51:37 +02:00
vaxerski
9b62328b22 minor changes to the activelayout event 2022-08-18 17:50:32 +02:00
vaxerski
c1a64a2b9d added main param to keyboards 2022-08-18 17:34:01 +02:00
vaxerski
b078a12eed Added an activelayout event 2022-08-18 17:17:33 +02:00
Roger Roger
eca6e53bd7 Animate workspaces with fullscreen windows 2022-08-18 12:42:21 +02:00
Roger Roger
f2d3aecf00 Don't draw fullscreen windows on other monitors 2022-08-18 12:41:10 +02:00
vaxerski
f3c597bfb7 fix crash 2022-08-18 07:28:07 +02:00
vaxerski
c5a4c83f78 better integrate touch with subsurfaces 2022-08-17 23:23:36 +02:00
vaxerski
f4d11d2d43 fix lastFocus on activateWindow 2022-08-17 22:59:40 +02:00
Vaxry
4c1dba643e Merge pull request #535 from Roger-Roger-debug/main
Fix workspace animation showing on other monitors
2022-08-17 12:35:03 +02:00
Roger Roger
5a20573e91 Fix workspace animation showing on other monitors 2022-08-17 12:12:16 +02:00
vaxerski
cd9c85a150 never animate moving floating windows 2022-08-16 22:40:16 +02:00
vaxerski
bbc6b5d5e0 added misc:animate_manual_resizes 2022-08-16 21:56:54 +02:00
vaxerski
a59641096c ignore dwindle reload on full window null 2022-08-16 21:32:12 +02:00
vaxerski
c6de4ee4b7 more checks in fullscreen event 2022-08-16 21:30:53 +02:00
vaxerski
317b6c430c damage monitor on workspace swipe end 2022-08-16 16:34:36 +02:00
vaxerski
095487ea5d disallow configure from fullscreen 2022-08-16 16:31:44 +02:00
vaxerski
daeb0d3418 force sending size on setWindowFullscreen 2022-08-16 16:30:10 +02:00
vaxerski
7cde50a018 scale hyprerror with the monitor res 2022-08-16 16:25:53 +02:00
vaxerski
bec7501365 fix borders on no_gaps_when_only 2022-08-16 16:19:52 +02:00
vaxerski
ea45c6bfe0 fix memory issue with hyprctl devices 2022-08-16 16:15:43 +02:00
vaxerski
6e2467cc24 fix active keymap in hyprctl devices 2022-08-16 16:10:20 +02:00
vaxerski
454d0d3f9f fix autogen config warning 2022-08-16 15:59:18 +02:00
vaxerski
d2011a4ba9 added support for window selection in moving to workspace 2022-08-15 16:12:53 +02:00
vaxerski
b0b3a5af10 added resizewindowpixel and movewindowpixel 2022-08-15 15:59:07 +02:00
vaxerski
d47bfe6af1 remove unused fixXWaylandWindowsOnWorkspace 2022-08-15 00:34:39 +02:00
Mihai Fufezan
c982312c07 Nix HM module: reload config-only 2022-08-15 00:47:56 +03:00
vaxerski
f0fe0c25d6 added config-only to hyprctl reload 2022-08-14 23:26:18 +02:00
vaxerski
d906617fb6 clean up fullscreen logic in fullscreenWindow event 2022-08-14 23:03:50 +02:00
Mihai Fufezan
ed1b72f37d Nix HM module: add XDG_SESSION_TYPE, fix reload 2022-08-14 23:45:55 +03:00
vaxerski
28867758c4 better fix the last fix 2022-08-14 16:39:56 +02:00
vaxerski
920727cbba fix crash with fullscreen requests 2022-08-14 16:34:40 +02:00
vaxerski
bfe0f844d2 fix wallpaper pixelation in some cases 2022-08-13 22:33:51 +02:00
vaxerski
214c2c7b1c fix groups not updating size on head change 2022-08-13 10:08:35 +02:00
vaxerski
9136783e9c default hardcoded rule to preferred auto 2022-08-12 22:26:35 +02:00
Vaxry
662b6003c6 Merge pull request #515 from SignalWalker/main
fix: support clang in meson build
2022-08-12 22:15:32 +02:00
Fernando Ayats
c136078239 nix: use cleanSource (#518) 2022-08-12 23:12:24 +03:00
Ash Walker
38056c0102 fix: support clang in meson build 2022-08-12 11:21:19 -04:00
vaxerski
db35a1c6d0 ensure egl is current in begin 2022-08-12 17:10:07 +02:00
vaxerski
66b0622bc5 fixed popup unmap damage 2022-08-12 17:04:26 +02:00
vaxerski
0e57651e2f fix segfault with cyclenext null 2022-08-11 22:56:16 +02:00
vaxerski
e5ab9643be enable layers_hog_keyboard_focus by default 2022-08-11 21:52:38 +02:00
vaxerski
b3c5809986 fix flags syntax in json 2022-08-11 21:29:31 +02:00
vaxerski
ae175fdda5 handle json for hyprctl version 2022-08-11 21:28:37 +02:00
vaxerski
9102471610 added hyprctl getoption 2022-08-11 21:16:38 +02:00
vaxerski
f85c765634 change activemon to focusedmon for consistency 2022-08-11 20:55:39 +02:00
vaxerski
37442db20e destroy program in shader destructor 2022-08-11 20:33:35 +02:00
vaxerski
b178891ab3 compile shaders for every context separately 2022-08-11 20:29:21 +02:00
vaxerski
073f08301a fix formatting in focused monitor hyprctl 2022-08-11 20:22:41 +02:00
vaxerski
8fb4669b85 fix cyclenext on fullscreen 2022-08-11 20:21:55 +02:00
vaxerski
008cc63dc0 fix error for popin 2022-08-11 20:17:23 +02:00
vaxerski
aba63a7f96 disallow nested groups creation 2022-08-11 19:56:29 +02:00
vaxerski
c9ed5bf77e fix cyclenext with fullscreen windows 2022-08-11 19:45:37 +02:00
vaxerski
f4f0495050 disable focus to menu x11 types 2022-08-11 19:36:15 +02:00
vaxerski
c319a2aba9 Completely rewrote Dwindle group code 2022-08-11 19:29:39 +02:00
vaxerski
cd75606f42 change active to focused in hyprctl monitors 2022-08-10 23:49:20 +02:00
vaxerski
c7350117f1 reinit render on disconnected displays 2022-08-10 23:19:15 +02:00
vaxerski
69db6207c0 don't damage in unsafe state 2022-08-10 23:14:53 +02:00
vaxerski
58ff04fdf3 added experimental monitor saving 2022-08-10 21:54:09 +02:00
vaxerski
9b39a0c2e0 Added hyprctl setcursor 2022-08-10 21:22:11 +02:00
vaxerski
f64f94ca56 scale rounding in shadows 2022-08-10 18:29:37 +02:00
vaxerski
76877d4b15 minor changes to monitor logging 2022-08-10 18:27:57 +02:00
vaxerski
96f3b62429 multiply by scale in rounding 2022-08-10 18:22:01 +02:00
vaxerski
0162da7a7c adjust curve size for scaled 2022-08-10 18:10:38 +02:00
vaxerski
9eb750c00b added misc:layers_hog_keyboard_focus 2022-08-10 17:46:01 +02:00
vaxerski
03f2e4d42a fix compile 2022-08-10 13:45:20 +02:00
vaxerski
15fc0892c7 further fixes to monitor disabling on launch 2022-08-10 13:44:04 +02:00
vaxerski
a564be73c5 set correct full params in disabled at launch 2022-08-10 13:31:58 +02:00
vaxerski
7e8666754f allow focus to override redirect 2022-08-10 12:49:45 +02:00
vaxerski
c043bcdee6 fixes to toplevel updates 2022-08-10 08:51:59 +02:00
vaxerski
8e5985d70e clean up unconstraining logic 2022-08-09 20:36:21 +02:00
vaxerski
9255a4d2ff ignore further keybinds on submap change 2022-08-09 19:54:06 +02:00
vaxerski
113ac67a16 focus monitor on monitor rule 2022-08-09 18:51:26 +02:00
vaxerski
862722412f handle fullscreen in dwindle groups better 2022-08-09 18:37:50 +02:00
vaxerski
a6d4a4d5f3 warn about incorrect bezier args 2022-08-09 18:15:37 +02:00
vaxerski
e2f61e267e add parse errors for invalid kb layouts 2022-08-09 18:13:13 +02:00
Mihai Fufezan
ecce027c02 flake: add aarch64-linux as supported platform 2022-08-09 13:17:47 +03:00
Mihai Fufezan
f28b71232a unhide window on requested size change 2022-08-09 11:57:09 +03:00
Yavor Kolev
af9d34ab77 Fix my idiotic mistake (#502)
When resolving conflicts i accepted the old changes 👨🏻🔫
2022-08-09 02:22:55 +03:00
Mihai Fufezan
2d33d4aebc nix & meson: update version to 0.10.0 2022-08-09 01:35:05 +03:00
Vaxry
aa39653ea1 Merge pull request #500 from yavko/fix-active-window-json-bools
Fix the fix
2022-08-08 22:58:34 +02:00
Yavor Kolev
6d788f0fc9 Merge branch 'main' into fix-active-window-json-bools 2022-08-08 13:51:08 -07:00
vaxerski
ab6a62f0fd Revert "Merge pull request #499 from yavko/fix-active-window-json-bools"
This reverts commit 5aed6f1bc7, reversing
changes made to 6f137938da.
2022-08-08 22:49:02 +02:00
Yavor Kolev
d460519c30 Fix the fix 2022-08-08 13:48:33 -07:00
vaxerski
b60b52c5cf fix movefocusto with null last 2022-08-08 22:46:11 +02:00
Vaxry
5aed6f1bc7 Merge pull request #499 from yavko/fix-active-window-json-bools
makes active windoe consistient with client json
2022-08-08 22:42:09 +02:00
Yavor Kolev
5cec6257e9 The fix 2022-08-08 13:39:02 -07:00
vaxerski
6f137938da send enter and leave events for surfaces 2022-08-08 21:20:41 +02:00
vaxerski
9fca4b5bc2 fix lastwindow in focusWindow null 2022-08-08 20:42:14 +02:00
vaxerski
87a2ecb90e notify of all mods in pass 2022-08-08 20:31:48 +02:00
vaxerski
bf9d358d3b fix refocus shenanigans with window data 2022-08-08 20:21:11 +02:00
vaxerski
9532ff4287 fix unconstrain coords 2022-08-07 21:27:30 +02:00
vaxerski
d64227e7c7 added basic touch controls 2022-08-07 21:17:03 +02:00
vaxerski
3a8dcf284a add more errors 2022-08-07 19:28:46 +02:00
vaxerski
1744be7bdd log more in output cfg 2022-08-07 19:28:31 +02:00
Vaxry
9fcfaaadb6 Merge pull request #484 from rubyist/unlock-then-sleep
unlock the event queue before sleeping
2022-08-06 23:32:05 +02:00
Scott Barron
355ee15039 unlock the event queue before sleeping 2022-08-06 17:21:54 -04:00
vaxerski
9564a4cd12 added misc:always_follow_on_dnd 2022-08-06 22:26:32 +02:00
vaxerski
64e80991ca added popin anim minimum % 2022-08-06 22:11:08 +02:00
Vaxry
3829b1626e Merge pull request #483 from rubyist/json-when-no-activewindow
Have hyprctl -j activewindows return empty json object if there are no activewindows
2022-08-06 21:56:16 +02:00
Scott Barron
5ce7c71cef use empty json object when no activewindow 2022-08-06 15:36:28 -04:00
vaxerski
793b23dbe6 fix crash in toplevel set appid 2022-08-06 21:15:50 +02:00
vaxerski
070db65a24 [gha] bump flake inputs 2022-08-06 19:11:51 +00:00
vaxerski
6aa448534f guard toplevel funcs 2022-08-06 21:10:37 +02:00
vaxerski
6357a92e46 update wlroots dep 2022-08-06 21:07:32 +02:00
vaxerski
68fd97fae9 change workspace in focusWindow if necessary 2022-08-06 21:05:19 +02:00
vaxerski
1b109d9242 [gha] bump flake inputs 2022-08-06 18:58:50 +00:00
vaxerski
69b8568ccf better foreign toplevel protocol obedience 2022-08-06 20:57:38 +02:00
Vaxry
ccd68049f7 Merge pull request #479 from rubyist/fix-json
output valid json when there are no clients
2022-08-06 01:06:21 +02:00
Scott Barron
206b7f4372 output valid json when there are no clients 2022-08-05 18:53:19 -04:00
Vaxry
aa7177a9e4 Merge pull request #478 from yavko/change-to-json-bools
Change more to json bools
2022-08-06 00:33:33 +02:00
yavko
59088decd0 Change to json bools 2022-08-05 15:23:38 -07:00
Vaxry
c77b571fa7 Merge pull request #474 from yavko/patch-1
Change monitor active to json bool
2022-08-05 23:54:33 +02:00
Vaxry
49f5ae2ef3 Updated the readme header 2022-08-05 22:54:27 +02:00
vaxerski
74cbfdcda4 guard zero border 2022-08-05 22:21:14 +02:00
vaxerski
f66365d9da fix crash in dwindle on create tiled 2022-08-05 20:00:17 +02:00
vaxerski
b30bb22bb8 fix crash in getMaxSizeForWindow 2022-08-05 19:41:50 +02:00
vaxerski
d72f1cc644 fix various shadow damage issues 2022-08-05 19:23:53 +02:00
vaxerski
78e4f274bc remove some spammy logs from IME 2022-08-05 19:03:03 +02:00
vaxerski
14026d4484 move IME panel below the cursor to not obstruct 2022-08-05 18:54:59 +02:00
Vaxry
f44af0366f mention IME in the readme 2022-08-05 18:52:55 +02:00
vaxerski
cd37a1533e reject tiling windows that do not meet the max size requirement 2022-08-05 18:10:59 +02:00
vaxerski
575434f1a4 fix rounding on switching only tiled 2022-08-05 18:08:23 +02:00
vaxerski
97e82fa4fb clamp resizing tiled to their max sizes 2022-08-05 17:58:08 +02:00
vaxerski
4ea37fe64d remember floating size between tiles 2022-08-05 17:52:14 +02:00
vaxerski
ad42392856 fix rare IME crash 2022-08-05 17:19:49 +02:00
vaxerski
e0ada97a24 support zwp_input_method_v2 popups 2022-08-05 17:07:01 +02:00
vaxerski
9a8a6317ff multiple IME fixes 2022-08-05 16:21:08 +02:00
vaxerski
cb5521ec6e fix possible crashes with IME 2022-08-05 13:19:16 +02:00
vaxerski
1c4d0e8c18 added IME protocol support 2022-08-05 13:03:37 +02:00
Yavor Kolev
9f11765707 Change monitor active to json bool 2022-08-04 16:25:56 -07:00
vaxerski
3947fe9e9f simplify border rendering when rounding is 0 2022-08-04 17:21:01 +02:00
vaxerski
c7c0149c08 [gha] bump flake inputs 2022-08-04 14:02:25 +00:00
vaxerski
d58233d08b update wlroots dep 2022-08-04 16:01:11 +02:00
vaxerski
07f68bf72a scale shadows properly 2022-08-04 11:18:33 +02:00
vaxerski
5e97fe8fcd use auto in default configs 2022-08-04 11:11:21 +02:00
vaxerski
81308a9cc3 add position auto for mon config 2022-08-04 11:10:26 +02:00
vaxerski
5dcbce550f only ensure DPMS in hyprctl monitors 2022-08-03 21:19:12 +02:00
vaxerski
5a96142cf8 guard monitor settings 2022-08-03 21:06:51 +02:00
vaxerski
9540106959 check for x11type and not nofocus in wcf 2022-08-03 21:03:08 +02:00
vaxerski
69558acb2e noInitialFocus in onWindowCreatedFloating as a check 2022-08-03 20:15:39 +02:00
vaxerski
37068cf4f0 fix crash with reenabling a monitor 2022-08-03 17:42:19 +02:00
vaxerski
587330d864 fix recursion bomb 2022-08-03 17:32:12 +02:00
vaxerski
9991db159c fix dynamic reenabling of a monitor 2022-08-03 17:29:05 +02:00
vaxerski
f488ec166d fix crash 2022-08-03 17:19:32 +02:00
vaxerski
871c81ac1a erase instead of overwriting monitor rules 2022-08-03 17:15:45 +02:00
vaxerski
36e563c79c reload monitors instantly on tickHyprCtl 2022-08-03 17:12:38 +02:00
vaxerski
69365c7609 fix monitor rule possible segv 2022-08-03 16:20:33 +02:00
vaxerski
c3edb20e04 make monitor IDs permanent 2022-08-03 16:19:00 +02:00
vaxerski
b9be405d32 clear ls lists on monitor disconnect 2022-08-03 16:12:05 +02:00
vaxerski
8dd88d901d guard onDisconnect 2022-08-03 16:05:25 +02:00
vaxerski
996e5a9e69 disallow swapping in fullscreen 2022-08-03 15:35:28 +02:00
vaxerski
fff7534721 fullscreen new window on fullscreen movefocus 2022-08-03 15:33:55 +02:00
vaxerski
cd483a7a37 ignore borders in nogapswhenonly 2022-08-03 15:25:30 +02:00
vaxerski
e13f2480ff fixed missing recursion of force in dwindle 2022-08-03 12:30:28 +02:00
vaxerski
f36cd350cc do not animate mouse resizes in layouts 2022-08-03 12:27:20 +02:00
vaxerski
c779a7c03b move refocus on only unmap 2022-08-03 12:03:18 +02:00
vaxerski
179e5188a4 remove incorrect border thickness calc 2022-08-03 12:03:15 +02:00
Vaxry
d3c96c248c Merge pull request #463 from luxus/patch-1
update flake to 0.9.1
2022-08-02 23:20:58 +02:00
Kai
3fabf1c483 update flake to 0.9.1
and again :D
2022-08-02 22:40:37 +02:00
vaxerski
02fbb3a417 fix preferred mode 2022-08-02 22:20:45 +02:00
vaxerski
9c8d32d1c2 default new blur optimiz to 0 2022-08-02 15:26:44 +02:00
vaxerski
a71f4114b0 added opaque windowrule 2022-08-02 00:08:31 +02:00
vaxerski
a6cd552980 bring back xdg current desktop 2022-08-01 23:31:25 +02:00
vaxerski
100d29d34d use nproc in makefile 2022-08-01 22:48:43 +02:00
vaxerski
00747fc6df fix preWindowPass with floating as first 2022-08-01 20:32:46 +02:00
vaxerski
523023aec7 mark blur dirty on monitor damage 2022-08-01 20:28:20 +02:00
vaxerski
024752bbe3 fix new blur optimizations with non-full damage 2022-08-01 20:18:26 +02:00
vaxerski
e794de1f4d guard texid in new optimized blur 2022-08-01 19:50:37 +02:00
vaxerski
1edd66618f added general:no_cursor_warps 2022-08-01 18:50:16 +02:00
vaxerski
338865e433 added follow_mouse 3 2022-08-01 18:42:11 +02:00
vaxerski
cb36456f40 optimize new blur rendering 2022-08-01 15:32:20 +02:00
vaxerski
b90159c089 revert blur changes 2022-08-01 15:29:49 +02:00
vaxerski
0ba17d4da3 fix oopsie with optim 2022-08-01 15:28:14 +02:00
vaxerski
d6e227ae0d don't stencil with new optimizations in blur 2022-08-01 15:24:42 +02:00
vaxerski
6427bb41d8 reload blur on cfg reload 2022-08-01 13:12:50 +02:00
vaxerski
60c16f77a6 added master:no_gaps_when_only 2022-08-01 12:57:37 +02:00
vaxerski
f892387b70 added dwindle:no_gaps_when_only 2022-08-01 12:51:52 +02:00
vaxerski
6378990bc3 fixes to the new blur system 2022-08-01 12:23:09 +02:00
vaxerski
070d7699a7 added decoration:blur_new_optimizations 2022-08-01 12:16:33 +02:00
vaxerski
8a4e04d789 check window validity in getfirstwindowonworkspace 2022-08-01 00:45:06 +02:00
vaxerski
46e18e08d1 contain for the hyprland default bg 2022-07-31 23:44:04 +02:00
Kai
9ac00fe52b update flake.nix to version 0.9.0beta (#451) 2022-07-31 22:44:51 +03:00
vaxerski
d44adb1bea [gha] bump flake inputs 2022-07-31 18:31:50 +00:00
vaxerski
40c652f23e update wlroots dep 2022-07-31 20:30:43 +02:00
vaxerski
575c3e071a fix ls fadeout on scaled 2022-07-31 17:20:33 +02:00
vaxerski
dba4596c7e focus to first window on not found in refocus 2022-07-31 17:07:39 +02:00
vaxerski
e95aa8ef26 minor fixes to render loop 2022-07-31 16:54:36 +02:00
vaxerski
a1d1ec4c46 added misc:mouse_move_enables_dpms 2022-07-31 15:46:42 +02:00
Mihai Fufezan
d9687c93ee Nix: add cachix (#448) 2022-07-31 15:19:28 +03:00
vaxerski
9be239dac6 remove wlr_viewporter, we do not support it 2022-07-31 14:10:21 +02:00
vaxerski
76f7c2510e account for geom in initial XDG window popups 2022-07-31 14:05:47 +02:00
vaxerski
2230f0ccaa move to XDG 4 2022-07-31 13:21:33 +02:00
vaxerski
04f8029fcc fix minor XDG issue 2022-07-31 13:14:56 +02:00
vaxerski
20cba2d707 damage monitor on dpms on 2022-07-31 12:39:49 +02:00
vaxerski
e2bc07d276 fix lack of return in tickHyprctl 2022-07-31 12:35:10 +02:00
vaxerski
edac94bed1 tick hyprctl separately 2022-07-31 00:27:32 +02:00
Mihai Fufezan
4610b3d864 protocols: add wlr-output-power-management-unstable-v1.xml to meson.build 2022-07-31 01:09:26 +03:00
vaxerski
0573d5987f dont account for scale in border thick 2022-07-31 00:07:35 +02:00
vaxerski
e5cef8fc96 account for scale in downrounding 2022-07-31 00:04:34 +02:00
vaxerski
382f851b30 account for border in rounding 2022-07-31 00:00:24 +02:00
vaxerski
2e3d42a9a9 added a dpms dispatcher 2022-07-30 23:51:13 +02:00
vaxerski
217ff1f401 do not call dmabuf_create twice 2022-07-30 23:45:27 +02:00
vaxerski
c2db3ad8ce fix minor memory issue 2022-07-30 23:04:31 +02:00
vaxerski
2e0dd4bea2 use pref in default configs 2022-07-30 22:55:20 +02:00
vaxerski
d6a649c1b3 added preferred to monitor cfg 2022-07-30 22:54:29 +02:00
vaxerski
f96b611651 support wlr-output-power-management 2022-07-30 22:41:24 +02:00
vaxerski
4211b37e22 added misc:damage_entire_on_snapshot 2022-07-30 22:26:46 +02:00
vaxerski
45747fb8e6 fix snapshots on scaled 2022-07-30 22:22:51 +02:00
vaxerski
adeab98831 some window fadeout fixes 2022-07-30 22:07:40 +02:00
vaxerski
036be18bf5 fix shader fix 2022-07-30 19:00:38 +02:00
Mihai Fufezan
59879e0bd1 Nix module: make package nullable part 3 2022-07-30 18:19:27 +03:00
Mihai Fufezan
132b5ba5b6 Nix module: make package nullable part 2 2022-07-30 18:14:46 +03:00
Mihai Fufezan
3c544e1c31 Nix module: make package nullable 2022-07-30 18:11:46 +03:00
vaxerski
191c02a4f4 update decos on configureX11 2022-07-30 15:22:34 +02:00
vaxerski
7c7690eb08 windowrules for floating remove hidden flag 2022-07-30 12:42:27 +02:00
Mihai Fufezan
66680a1149 Nix: fix failing module 2022-07-29 18:39:10 +03:00
Vaxry
fd74208453 Merge pull request #446 from IanManske/movecurrentworkspace-nullmonitor-fix
Fix crash from moving current workspace to nonexistent (null) monitor.
2022-07-29 17:19:25 +02:00
vaxerski
e56699826f Optimize shaders 2022-07-29 17:07:33 +02:00
Ian Manske
ef2417fbcb Fix crash from moving current workspace to nonexistent (null) monitor. 2022-07-29 10:59:31 -04:00
reptee
fd999100f0 Remove extra packages in nix module (#343)
Co-authored-by: Mihai Fufezan <fufexan@pm.me>
Co-authored-by: Mihai Fufezan <fufexan@protonmail.com>
2022-07-29 14:35:38 +03:00
Mihai Fufezan
0eebf3ab16 meson: add -DGIT arguments (#321) 2022-07-29 13:21:19 +03:00
vaxerski
ac8e5fef10 even more damage scaled fixes 2022-07-29 11:52:56 +02:00
vaxerski
429a9bc6c3 hide only XWayland on incorrect size 2022-07-29 11:45:32 +02:00
vaxerski
233bad5011 Spam the protocols less with resizes of XDG 2022-07-28 23:55:00 +02:00
vaxerski
0f19bd99f8 more scaled surface damage fixes 2022-07-28 23:21:35 +02:00
vaxerski
f0cd784f79 fixes to surface damaging on scaled 3 2022-07-28 22:41:59 +02:00
vaxerski
7a2f296c93 surface damage fixes 2 2022-07-28 22:23:27 +02:00
vaxerski
0b0cd85085 surface damage fixes 2 2022-07-28 22:23:00 +02:00
vaxerski
3f62a386bf surface damage fixes 2022-07-28 22:15:56 +02:00
vaxerski
4076a3b6d7 fixed device configs 2022-07-28 21:38:30 +02:00
vaxerski
13d9c85e4e fix alpha with xwl opacity 2022-07-28 18:17:47 +02:00
vaxerski
9afa3953e9 fix crash oopsie 2022-07-28 17:56:11 +02:00
Vaxry
398662c75a Merge pull request #440 from Roger-Roger-debug/main
Fix hyprctl flags help
2022-07-28 17:47:56 +02:00
Roger Roger
5bc9534642 Fix hyprctl flags help 2022-07-28 16:42:18 +02:00
vaxerski
0e2038fedf minor fullscreen anim fixes 2022-07-28 16:33:45 +02:00
vaxerski
6d35d642ea fix fullscreen workspace slide anims 2022-07-28 15:56:55 +02:00
vaxerski
b0ab8afc58 fix some XWayland weird popups 2022-07-28 15:40:06 +02:00
vaxerski
578787b36d add gestures to example configs 2022-07-28 13:44:17 +02:00
vaxerski
f6c7a79988 update default configs for new anim config 2022-07-28 13:39:05 +02:00
vaxerski
9d5b76b757 fix typo in new anim handlers 2022-07-28 13:34:52 +02:00
vaxerski
920fdd6bff Animation config rework 2022-07-28 13:28:43 +02:00
vaxerski
9dd17a4be6 Added toggleopaque dispatcher 2022-07-28 12:07:41 +02:00
vaxerski
3904351678 Added layoutmsg and some master layout msgs 2022-07-28 12:00:10 +02:00
vaxerski
b6f2a4bc36 damage popups correctly 2022-07-28 11:37:27 +02:00
vaxerski
e102f9ec8c remove make man 2022-07-27 23:12:18 +02:00
vaxerski
ee15ad1215 render ls popups correctly 2022-07-27 18:02:20 +02:00
Gabriel Fontes
1d3e1472f2 nix: add home-manager module (#395) 2022-07-27 17:32:42 +03:00
Mihai Fufezan
b2627c05c4 flake & meson: 0.7.0 -> 0.8.1
nix: add legacyRenderer option
2022-07-27 14:57:59 +03:00
vaxerski
427bc35b6b fix empty workspace name on unspecified default 2022-07-27 13:56:01 +02:00
vaxerski
c9c4b14ef2 optimize xwayland has_alpha blur 2022-07-27 13:30:55 +02:00
vaxerski
cb1a36faf0 missed 2 structs 2022-07-27 12:36:56 +02:00
vaxerski
31a079b347 added DPMS 2022-07-27 12:32:00 +02:00
Vaxry
50b991674b Merge pull request #379 from volitank/main
docs: add man pages
2022-07-27 00:08:12 +02:00
vaxerski
28046e9da0 added binds:scroll_event_delay 2022-07-26 23:34:03 +02:00
vaxerski
cc146f0344 use transformed size in popup unconstrain 2022-07-26 22:58:25 +02:00
vaxerski
d3c1d3435c fix typo in XDG popup callbacks 2022-07-26 22:45:59 +02:00
vaxerski
57f5de68ae remove commit event cuz i forgot 2022-07-26 22:01:55 +02:00
vaxerski
eb30d9bdc8 fix typo in LS destroy event 2022-07-26 21:59:07 +02:00
vaxerski
98ef43496b listener fixes 2022-07-26 21:41:29 +02:00
vaxerski
1455442b9a fix swipe not cancelling constraints 2022-07-26 18:38:30 +02:00
vaxerski
71c1ff8ee3 log xwayland in hyprctl 2022-07-26 18:25:08 +02:00
vaxerski
b18a2738e3 schedule recalcs in LS 2022-07-26 18:22:34 +02:00
vaxerski
99ebbb36b2 README stuff 2022-07-26 17:34:53 +02:00
vaxerski
6f2368f809 Add a pass dispatcher 2022-07-26 17:30:30 +02:00
vaxerski
7dc014e967 r and e exclusivity in bind 2022-07-26 17:04:26 +02:00
vaxerski
66eac124e2 add binding to mouse buttons 2022-07-26 14:50:21 +02:00
vaxerski
d04f36c57d set moz env 2022-07-26 10:05:29 +02:00
vaxerski
7babcf7e6a arrange after switch 2022-07-25 23:53:43 +02:00
vaxerski
b0d91cbf3a simplify formats 2022-07-25 22:40:34 +02:00
vaxerski
db899e00e7 adjust ls fading out logic 2022-07-25 22:00:46 +02:00
vaxerski
6e16dfa5e5 use defines for unreachable 2022-07-25 21:34:57 +02:00
vaxerski
c998e946aa Wrap adding to fading out
needed to avoid memory safety issues, because sometimes there would be duplicates.
2022-07-25 21:08:54 +02:00
vaxerski
cde39e0b6e ls fixes 2022-07-25 20:47:56 +02:00
vaxerski
b1d3a1deea force unmap on direct destroy 2022-07-25 18:38:40 +02:00
vaxerski
e2594c79cc fix fading out layers without unmap 2022-07-25 18:35:53 +02:00
vaxerski
a0be6e19d8 fix shadowing with doesntHave 2022-07-25 16:12:06 +02:00
vaxerski
14176f01ca fix swiping with one workspace on monitor 2022-07-25 15:42:27 +02:00
Vaxry
574d950145 updated previews in readme 2022-07-25 15:05:23 +02:00
vaxerski
bb539f0a8d added keybind repeat flag 2022-07-25 14:42:49 +02:00
vaxerski
067e2d39f6 shadow with respect of keysym on press 2022-07-25 14:24:02 +02:00
vaxerski
e388a86c9d move floating windows manually on moveworkspacetomonitor 2022-07-25 14:22:32 +02:00
vaxerski
3e6abaf680 fix some swipe issues 2022-07-25 14:06:49 +02:00
vaxerski
6dc8c4b310 Shadowing Keybinds fixes 2022-07-24 14:35:58 +02:00
vaxerski
1ddd7ee713 remove forced envvars 2022-07-24 13:29:46 +02:00
vaxerski
92d1d21a3d added default touchpad settings to example configs 2022-07-24 12:23:31 +02:00
vaxerski
8dcc3032a8 fix keybinds shadowing multibinds 2022-07-24 12:16:26 +02:00
vaxerski
1626707b7f make layerSurfaces into RAII 2022-07-23 15:48:08 +02:00
Blake Lee
970bcc467c remove version 2022-07-22 15:32:56 -04:00
Mihai Fufezan
72700bf9dc layersurfaces: set default geometry 2022-07-22 20:28:43 +03:00
vaxerski
616ec22735 wrapped wl_listener fixes 2022-07-22 13:34:19 +02:00
vaxerski
d9b0edb786 remove newPopup handler for LS 2022-07-22 13:12:26 +02:00
vaxerski
3f169a937a fix wlr workspace names before init 2022-07-22 12:37:44 +02:00
vaxerski
fa1273f258 minor changes to swipes 2022-07-22 00:13:56 +02:00
vaxerski
8f66ddcad0 minor changes to swipes 2022-07-22 00:10:26 +02:00
vaxerski
4db1062af6 minor changes to swipes 2022-07-22 00:08:25 +02:00
vaxerski
0013ef9ef0 reload input after exec once 2022-07-21 20:30:48 +02:00
vaxerski
19cd04c85f shadow keybinds on drag events 2022-07-21 19:44:34 +02:00
Vaxry
a011c28227 Merge pull request #265 from xDarksome/main
Scroll workspaces with Super+MouseWheel
2022-07-21 19:40:15 +02:00
Darksome
d5ccca4fdb Consider scroll as a 'pressed' key 2022-07-21 20:31:38 +03:00
vaxerski
f512bf6b5a remove server from hyprctl as it's unused 2022-07-21 19:27:55 +02:00
Darksome
ce508f1cdc Fix merge 2022-07-21 19:48:34 +03:00
Darksome
eb8a1939e6 Merge upstream 2022-07-21 19:18:03 +03:00
Vaxry
7f660fed0d Merge pull request #404 from System-x64/new-hyprland.png
Updated assets/hyprland.png
2022-07-21 14:46:56 +02:00
vaxerski
75ce01b1a7 Make the thread manager into a wl event loop timer 2022-07-21 12:33:22 +02:00
Dikshant Namdeo
b9f8d900b3 updated-hyprland.png 2022-07-21 12:31:24 +05:30
vaxerski
189cbe9f09 added shadowing keybinds 2022-07-20 23:17:26 +02:00
vaxerski
fa2bd3b1a8 added keybinds on key up 2022-07-20 22:45:06 +02:00
vaxerski
fc33cae70c change bind flag parsing 2022-07-20 22:33:43 +02:00
vaxerski
641aaff998 minor code adjustments 2022-07-20 18:39:08 +02:00
vaxerski
9463e3eb0a fix transformed snapshots a bit 2022-07-20 16:28:05 +02:00
vaxerski
e6b151b6c3 fix memory read after free in damageSurface 2022-07-20 12:06:14 +02:00
vaxerski
d52446135b add sensitivity per device & reload mice on config 2022-07-19 19:26:53 +02:00
vaxerski
1ba600ca23 added workspace swipe fingers 2022-07-19 18:35:24 +02:00
vaxerski
0026414f9b fix workspace swipes mistake 2022-07-19 18:30:53 +02:00
vaxerski
ce8d655fad fix oopsie in log 2022-07-19 16:39:15 +02:00
vaxerski
d4690a5c5e minor change to unmanaged X11 geom requests 2022-07-19 16:38:27 +02:00
vaxerski
755245e752 adjust workspace on geom change x11 2022-07-19 16:21:35 +02:00
vaxerski
ec2afb563e fix oopsie include 2022-07-19 14:28:37 +02:00
vaxerski
59e34e311e fix oopsie include 2022-07-19 14:27:52 +02:00
vaxerski
c6c3d66373 fix hyprctl with relative negative 2022-07-19 14:24:03 +02:00
vaxerski
21217bcb2b notify enter on subsurfaces with follow mouse not 1 2022-07-19 14:05:12 +02:00
vaxerski
f905ae33c8 guard pSurface in unmapsubsurface 2022-07-19 13:54:42 +02:00
vaxerski
0281caa8e0 fix ASan error 2022-07-19 13:36:54 +02:00
Blake Lee
a312f8e0ac replace rst2man with pandoc 2022-07-18 18:56:46 -04:00
Vaxry
f35d513bf5 Merge pull request #391 from dgerblick/focuswindow-options
focuswindow options + other hyprctl bugs I found when testing
2022-07-18 23:19:12 +02:00
vaxerski
10a83853ac added ls noprocess 2022-07-18 21:16:01 +02:00
vaxerski
53b8263eb1 remove fixXwaylandwindowsonworkspace, not needed anymore 2022-07-18 21:15:46 +02:00
vaxerski
8bcfda2230 update moveactivetoworkspace logic 2022-07-18 20:53:29 +02:00
Daniel Gerblick
f2c0e6ef02 fixed issue causing hyprctl to output ill-formed json when strings include characters needing escaping 2022-07-18 14:47:28 -04:00
vaxerski
b669948737 fix logo center 2022-07-18 15:41:02 +02:00
vaxerski
a4b1d51c63 add new wallpapers 2022-07-18 15:31:59 +02:00
vaxerski
e7b8cda360 update logo 2022-07-18 15:23:26 +02:00
vaxerski
c466bd1219 fix webkit 2022-07-18 14:21:21 +02:00
vaxerski
ad19a15cef readme center 2022-07-18 14:20:43 +02:00
vaxerski
954a387cf9 fix center 2022-07-18 14:19:21 +02:00
vaxerski
a51f44d566 readme fix 2022-07-18 14:16:49 +02:00
vaxerski
423c9f9d56 new logo 2022-07-18 14:15:33 +02:00
vaxerski
900e6947e9 reject windows with tiny sizes, overwrite size 2022-07-18 13:14:31 +02:00
vaxerski
90d07d7b52 fix shadows on unmanaged and noborder 2022-07-18 12:39:57 +02:00
vaxerski
60cc33a53c added time logging 2022-07-18 11:46:42 +02:00
Daniel Gerblick
dc1f34c5fa added PID and address-based options for focuswindow, as well as updated hyprctl clients to be consistent with logs and hyprctl activewindow 2022-07-17 19:00:12 -04:00
vaxerski
afeb040684 fix selection events 2022-07-17 18:56:01 +02:00
vaxerski
f5bd30569f fix borders on scaled 2022-07-16 23:29:42 +02:00
vaxerski
6f1b9d6af9 add master:new_on_top 2022-07-16 23:24:42 +02:00
vaxerski
1848086abd reload layout on hyprctl layout 2022-07-16 22:44:29 +02:00
vaxerski
cb2989cec5 fix fade corner artifacts 2022-07-16 21:10:16 +02:00
vaxerski
16afa2c422 fix border rendering on certain windows
oversized subsurfaces had a tendency to be above borders, now they wont be
2022-07-16 20:57:59 +02:00
vaxerski
edcecae7a0 dont cycle on fullscreen 2022-07-16 19:55:40 +02:00
vaxerski
aac546b771 added center windowrule 2022-07-16 16:27:17 +02:00
vaxerski
ef24329495 pass through pinch events 2022-07-16 16:12:31 +02:00
vaxerski
5c836e6460 added master layout 2022-07-16 15:57:31 +02:00
Darksome
68cfc1a496 Merge branch 'main' of github.com:xDarksome/Hyprland 2022-07-16 15:35:47 +03:00
Darksome
08319dd1f5 Fix handleKeybinds debug log 2022-07-16 15:34:13 +03:00
xDarksome
4f9be67298 Merge branch 'hyprwm:main' into main 2022-07-16 15:30:32 +03:00
Darksome
ce9efb7ae3 Impl changeworkspace(e+{n}) 2022-07-16 15:28:17 +03:00
vaxerski
48e5bd96bc Added shadow colors animations and inactive col 2022-07-16 12:44:45 +02:00
Darksome
2ae088d631 Use correct wlroots commit 2022-07-16 12:47:37 +03:00
Darksome
fdbc54d97b Restore events/Devices.cpp formatting 2022-07-16 12:44:12 +03:00
Darksome
e56ff0fcb0 Merge remote-tracking branch 'upstream/main' into mouse-wheel-cfg 2022-07-16 12:40:02 +03:00
Darksome
43b7da0bb1 Rollback flake.lock 2022-07-16 12:30:07 +03:00
Blake Lee
88506d4284 Apply suggestions from code review 2022-07-15 22:34:35 -04:00
volitank
9fc74a708e Apply suggestions from code review
Co-authored-by: Mihai Fufezan <fufexan@pm.me>
2022-07-15 22:25:03 -04:00
Blake Lee
310a839700 docs: add man pages 2022-07-15 20:04:17 -04:00
vaxerski
b2650928ea obey xdg reqs better 2022-07-16 00:11:21 +02:00
Vaxry
069e3b2114 Merge pull request #376 from dgerblick/hyprctl-json-segfault-fix
Fixed SEGFAULT when running hyprctl with only the -j option
2022-07-15 23:21:46 +02:00
Daniel Gerblick
db693ec7e5 Fixed SEGFAULT when running hyprctl with only the -j option 2022-07-15 15:39:39 -04:00
xDarksome
16fecac2d1 [gha] bump flake inputs 2022-07-15 18:55:08 +00:00
Darksome
1eceae811f Try mouse wheel configuration 2022-07-15 21:54:05 +03:00
vaxerski
fbcc6936f4 fix dashes in hyprctl 2022-07-15 20:07:52 +02:00
vaxerski
90ebeaa881 fixed fullscreen opacity on fullscreen 1 2022-07-15 19:33:09 +02:00
vaxerski
1441856811 fix blur on oversized, default to enabled 2022-07-15 19:21:13 +02:00
vaxerski
19c646ab47 Minor changes to the renderer's overflow behavior
Won't squish base layers anymore
2022-07-15 19:07:06 +02:00
Darksome
5388b54442 Merge upstream 2022-07-15 19:42:03 +03:00
vaxerski
6306d4dae3 add remove, to blurls 2022-07-15 13:29:56 +02:00
Vaxry
5af26a451a Merge pull request #373 from fufexan/configpath
Add config flag
2022-07-15 12:03:50 +02:00
vaxerski
ba48e7ceea fixed up hyprctl flags 2022-07-15 11:58:09 +02:00
vaxerski
c0377457df don't poison wlr in make install 2022-07-15 11:39:11 +02:00
Mihai Fufezan
202fb4d8d4 add clangd cache in gitignore 2022-07-15 00:10:00 +03:00
Mihai Fufezan
d8fee02063 add simple help message 2022-07-15 00:09:31 +03:00
Mihai Fufezan
01fc3d6068 add config flag
you can now specify a config with -c <path>
2022-07-14 23:55:24 +03:00
vaxerski
634970a284 update deco values on fullscreen 2022-07-14 22:49:49 +02:00
vaxerski
642af5395e dont focus anything on constrained 2022-07-14 21:33:36 +02:00
Vaxry
316589406f Merge pull request #372 from bazuin-32/main
Fix error when running `hyprctl dispatch exec` with an arg that contains a `/`
2022-07-14 19:33:21 +02:00
bazuin-32
0085319c18 Fix error when running hyprctl dispatch exec with an arg that contains
a `/`
2022-07-14 11:23:18 -06:00
vaxerski
0488f17976 fix opacity inactive methodology 2022-07-14 18:46:42 +02:00
vaxerski
8b52858bb5 fix opacity active 2022-07-14 18:45:16 +02:00
Vaxry
b0dd370421 Merge pull request #342 from viperML/main
ci: add release workflow
2022-07-14 12:54:49 +02:00
vaxerski
65e75c0b44 fix backwards hyprctl compat 2022-07-14 11:43:15 +02:00
Vaxry
7c999fb9f5 Merge pull request #242 from calebowens/caleb-feature-add-width-multiplier
Added a multiplier for the width to height ratio
2022-07-14 11:38:49 +02:00
Kainoa Kanter
21da348826 hyprwm in readme links 2022-07-13 11:23:43 -07:00
vaxerski
c2215e4efb fix focus on fullscreen and over 2022-07-13 18:33:36 +02:00
vaxerski
49dbb586e3 fixed session-less envs 2022-07-13 18:31:09 +02:00
Vaxry
6708f3b133 Fixed TTY switching (#364) 2022-07-13 18:18:23 +02:00
vaxerski
ef7ee2fd0f added active keymap prop 2022-07-13 16:02:14 +02:00
vaxerski
e93b45615c better doc in help 2022-07-13 15:50:46 +02:00
vaxerski
0a16513946 fix warning 2022-07-13 15:48:47 +02:00
vaxerski
99e9503732 flag pos 2022-07-13 15:47:35 +02:00
Vaxry
be69098cb8 Merge pull request #360 from bazuin-32/main
Add hyprctl output in json when `-j` flag is used
2022-07-13 15:44:59 +02:00
Fernando Ayats
d7d5b1a4eb ci: fix repo source 2022-07-13 10:39:57 +02:00
Fernando Ayats
868fc6e0f3 Revert "FIXME: temp disable workflows"
This reverts commit 532ffe1681.
2022-07-13 10:36:47 +02:00
Fernando Ayats
9580ef4bc2 ci: upload source 2022-07-13 10:35:23 +02:00
Fernando Ayats
532ffe1681 FIXME: temp disable workflows 2022-07-13 10:26:11 +02:00
Fernando Ayats
0cfc97972f ci: upload source 2022-07-13 10:25:21 +02:00
bazuin-32
ab859ec9fc Fix issues with batch requests 2022-07-12 16:34:28 -06:00
bazuin-32
ac9ff795cd Fix calls to substr with invalid pos 2022-07-12 15:38:50 -06:00
vaxerski
4bea3467e0 update hyprctl help 2022-07-12 23:21:00 +02:00
vaxerski
bca93f4d3c code styling 2022-07-12 23:17:55 +02:00
vaxerski
bf762f566f Fix VRAM memory leak when releasing snapshots 2022-07-12 23:11:34 +02:00
bazuin-32
2402f2e364 Use enum for specifying hyprctl output format and change the way flags
are passed for json output
2022-07-12 14:59:36 -06:00
bazuin-32
036f431206 Add hyprctl output in json when -j flag is used 2022-07-12 11:57:33 -06:00
Mihai Fufezan
f9985a36b3 nix & meson: 0.6.2 -> 0.7.0 2022-07-12 20:12:59 +03:00
vaxerski
ad03360665 fix device sections shadowing parse errors 2022-07-12 16:07:51 +02:00
vaxerski
3914672dd5 mention more config options in cfgs 2022-07-12 15:41:42 +02:00
vaxerski
78c6371743 default vfr to off 2022-07-12 15:41:28 +02:00
Vaxry
f789a14527 updated issue guidelines 2022-07-12 15:35:23 +02:00
vaxerski
b1e3430405 only set xwayland size/pos on reasonable deltas 2022-07-12 14:14:12 +02:00
vaxerski
a4f82491b7 active opacity is now animated 2022-07-12 13:40:55 +02:00
Mathias Zhang
da83ef7b96 add config drag_lock for touchpad (#353)
* add config drag_lock for touchpad

* fix err

* Update ConfigManager.cpp
2022-07-12 13:11:54 +02:00
vaxerski
2d856ac4b0 Added yes/no values to int parsing 2022-07-12 10:28:42 +02:00
vaxerski
29e2bb27f6 added misc:no_vfr 2022-07-12 10:02:12 +02:00
vaxerski
2f3b2db83d fixed tiled popups going behind windows 2022-07-12 09:49:56 +02:00
vaxerski
bf8bd87d11 added active monitor to hyprctl monitors 2022-07-12 00:16:28 +02:00
vaxerski
c0c75db621 roll VFR for everyone 2022-07-11 23:56:24 +02:00
vaxerski
f461ea3105 squish oversized subsurfaces while animating 2022-07-11 23:38:10 +02:00
vaxerski
668dc9bd9c [gha] bump flake inputs 2022-07-11 21:11:07 +00:00
vaxerski
b55b6c95f2 update wlroots dep 2022-07-11 23:09:35 +02:00
vaxerski
676e4c36c5 fix focus on layers when constrained 2022-07-11 22:51:20 +02:00
vaxerski
ad66c158ba don't refocus on virt ptrs 2022-07-11 20:23:16 +02:00
vaxerski
ab44aabbd7 update decos on setgeometry x11 2022-07-11 19:07:59 +02:00
vaxerski
4c4c36096b fix config reload on fullscreen mode maximized 2022-07-11 15:40:41 +02:00
vaxerski
c923b0e538 respect size in setgeo unmanaged x11 2022-07-11 15:31:31 +02:00
vaxerski
2936368e80 minor event fixes 2022-07-11 14:13:15 +02:00
vaxerski
5eaf93697a clear kb focus on focusSurface null 2022-07-11 12:29:50 +02:00
vaxerski
11c88e2503 apply surface width to ls geo on commit 2022-07-10 20:36:32 +02:00
vaxerski
4b334594dc Added splashes 2022-07-10 15:41:26 +02:00
vaxerski
06c0be5ea6 clear with 17 2022-07-10 11:45:50 +02:00
vaxerski
6f7377f381 accumulate mods from all kbs for keybind processing 2022-07-09 23:24:08 +02:00
vaxerski
c44cafda97 added cyclenext param previous 2022-07-09 18:39:41 +02:00
vaxerski
ddc4cbbd7e allow focus to modal 2022-07-08 23:37:55 +02:00
vaxerski
e6872bddf4 fix minor issues with floating windows and fullscreen 2022-07-08 21:52:52 +02:00
Mihai Fufezan
a7a3c0fc1d nix: add devShell 2022-07-08 18:34:23 +03:00
Fernando Ayats
c8c5e0b90a nix: fix wallpaper location (#334) 2022-07-08 17:46:42 +03:00
vaxerski
8482063157 fixed layersurface focus quirks 2022-07-08 13:19:57 +02:00
vaxerski
92e17f2925 added rules to hyprctl devices and fixed rules 2022-07-08 12:27:05 +02:00
vaxerski
491b99c61e handle unmanaged X11 setGeometry 2022-07-08 11:24:07 +02:00
vaxerski
75a580feda Disallow focus to modal and override_redirect X11 windows 2022-07-08 10:36:21 +02:00
vaxerski
91249675de fix corner artifacts 2022-07-08 09:43:55 +02:00
vaxerski
46306e59eb added keycode support to unbind 2022-07-08 09:32:09 +02:00
vaxerski
cd0a01f4de Added binding by keycodes 2022-07-08 09:27:17 +02:00
vaxerski
75c2a378e3 unfocus keyboard on refocus null 2022-07-07 21:47:59 +02:00
vaxerski
96f19d706a fix possible swipe crash 2022-07-07 20:53:22 +02:00
vaxerski
3278db67a2 added general:disable_hyprland_logo 2022-07-07 20:16:40 +02:00
vaxerski
aa3bc65342 fix special status when workspace is changed 2022-07-07 19:16:16 +02:00
vaxerski
a7b595d968 allow windowrule special again 2022-07-07 19:01:42 +02:00
vaxerski
05736bc1e3 I am an idiot, fixed special ws deletion 2022-07-07 19:00:34 +02:00
vaxerski
3bf172a37e fix hyprerror on scaled outputs 2022-07-07 18:45:01 +02:00
vaxerski
22c4ecf496 fixed swiping with one ws 2022-07-07 13:57:26 +02:00
Vaxry
3f43f94dc4 Merge pull request #318 from hyprwm/swipes
Added swipe workspace gestures
2022-07-07 13:49:43 +02:00
vaxerski
4b796d30c1 Added swipe workspace gestures 2022-07-07 13:49:04 +02:00
vaxerski
5762e3b9e2 fix stretched ls 2022-07-07 12:40:32 +02:00
vaxerski
1cf2f378d4 added ls blurring 2022-07-06 22:12:03 +02:00
vaxerski
6a16f11d63 add namespace to hyprctl layers 2022-07-06 21:57:35 +02:00
vaxerski
a545992891 fixed hyprctl layers crash 2022-07-06 21:57:15 +02:00
Mihai Fufezan
f5936f97d6 nix: use gcc12Stdenv 2022-07-06 18:41:20 +03:00
vaxerski
141f9810bb fix meson C++23 2022-07-06 17:02:12 +02:00
vaxerski
1599dc47d1 set proper C++23 std to meson as well 2022-07-06 16:55:49 +02:00
vaxerski
42d18143e5 use std::unreachable in avars 2022-07-06 16:54:45 +02:00
vaxerski
f9756d10d4 changed C++ std to C++23, use std::string::contains 2022-07-06 16:50:11 +02:00
vaxerski
0d7a8cca79 use C++ throw methods instead of printf and exit 2022-07-06 16:17:58 +02:00
vaxerski
9655d0c138 added support for wlr_idle_inhibitor_v1 2022-07-06 15:42:37 +02:00
vaxerski
5a22335b8d refocus after group toggles 2022-07-06 15:08:21 +02:00
vaxerski
0277f4c6bd support relative paths in source= 2022-07-06 15:05:23 +02:00
vaxerski
8d05dddb98 fix focus on maximized windows with special open 2022-07-06 14:58:46 +02:00
vaxerski
0d54451c67 fix incorrect mouse pos in fullscreen xdg 2022-07-06 11:12:27 +02:00
vaxerski
cda0c4577e find floating special windows in vector methods 2022-07-06 11:07:23 +02:00
vaxerski
239aa2cec4 fix internal workspace changes being clamped 2022-07-06 11:02:21 +02:00
vaxerski
ae096219e8 do updates on every mon update if VFR is enabled 2022-07-05 21:45:32 +02:00
vaxerski
7ff427c229 remove wlroots so in make uninstall 2022-07-05 19:46:05 +02:00
vaxerski
55aeb91e6a use provided wlroots, don't find system 2022-07-05 19:36:28 +02:00
vaxerski
6f5b8425cb fix invalidating the deque in CHyprGroupBarDeco 2022-07-05 17:31:47 +02:00
vaxerski
dd422abb33 schedule frames at the end of avar loop 2022-07-05 16:05:06 +02:00
vaxerski
cc8b8f595f disallow workspace special windowrule 2022-07-04 19:58:51 +02:00
vaxerski
9742ac7596 attempt to fix a specialworkspace crash 2022-07-04 19:41:55 +02:00
vaxerski
beef23cee5 fix vfr frame scheduling 2022-07-04 17:55:33 +02:00
vaxerski
7e38de37a7 fix crash 2022-07-04 17:48:04 +02:00
vaxerski
e0bfec6ef2 added experimental:vfr 2022-07-04 17:47:31 +02:00
vaxerski
c40ef59a35 support monitor names in moving workspaces 2022-07-04 16:51:42 +02:00
vaxerski
c71b76a9e0 fix chromium part 1 2022-07-04 15:58:12 +02:00
vaxerski
853a33888b fix issue with special workspace rules 2022-07-04 12:03:09 +02:00
vaxerski
fc3957d538 optimize workspace in applyNodeData 2022-07-04 00:04:56 +02:00
vaxerski
3df126c675 oops 2022-07-03 23:17:12 +02:00
vaxerski
69e179816b oops last fix didnt fix 2022-07-03 23:16:42 +02:00
vaxerski
a229701f28 fix crash with null pmonitor in special nodes on dwindle 2022-07-03 23:14:51 +02:00
vaxerski
01228fbc9c fix some bugs 2022-07-03 22:54:47 +02:00
vaxerski
f7c4865bac warp size and pos before rule fullscreen 2022-07-03 21:38:39 +02:00
Mihai Fufezan
0a01ec9926 Fix non-focused windows on WS change
Fixes #298
2022-07-03 15:51:32 +03:00
xDarksome
e0f0ed9af4 Don't use pkgs.hyprland package in the nix module (#299)
Users who use the overlay: see wiki for fixing your config if it broke.
2022-07-03 15:28:10 +03:00
vaxerski
e81de82706 added Vector2D::clamp 2022-07-02 22:17:17 +02:00
vaxerski
9d6999345e don't process new focus when cursor constrained 2022-07-02 20:06:10 +02:00
Darksome
cb8a6f881b Disallow scrolling into empty workspaces 2022-07-02 19:55:35 +03:00
xDarksome
185c4d6ea1 Merge branch 'hyprwm:main' into main 2022-07-02 19:43:52 +03:00
vaxerski
b7b3344188 hyprctl: added support for hyprpaper 2022-07-02 18:27:44 +02:00
Mihai Fufezan
80962de2a2 PR Template: add headers 2022-07-02 16:37:19 +03:00
Mihai Fufezan
9ee14eb445 meson: build with -O3 (#291) 2022-07-02 02:48:21 +03:00
vaxerski
e77f451e27 minor oopsie 2022-07-01 22:49:12 +02:00
vaxerski
6f4f164071 don't focus layers without keyboard_interactive 2022-07-01 20:14:33 +02:00
Vaxry
3d294b1aaa Merge pull request #292 from Dakes/focus-window-title
Changed dispatcher: focusWindowByClass -> focusWindow. Now supports titles & classes
2022-07-01 18:20:10 +02:00
vaxerski
7d7e82d446 only do mouseMoveUnified on pix change 2022-07-01 17:59:11 +02:00
Dakes
2225dca576 Add focusWindow dispatcher. Takes titles & classes
Removed focusWindowByClass function, replaced with focusWindow.
Either takes a class matching regex, or a title matching one,
beginning with "title:"
Kept the focuswindowbyclass dispatcher identifier to stay backwards
compatible with existing configs.
2022-07-01 16:24:37 +02:00
vaxerski
868e0f48d0 added debug:disable_logs 2022-07-01 15:57:56 +02:00
vaxerski
1750a7cdbb oops 2022-07-01 11:54:52 +02:00
vaxerski
6f2a36c123 limit events on socket2 to 1024 chars 2022-07-01 10:37:17 +02:00
vaxerski
29ca7f9018 bring back O3 2022-07-01 10:37:07 +02:00
vaxerski
91d68513de fix possible segfault by realloc 2022-06-30 23:55:28 +02:00
vaxerski
3970b43ea2 fix disabling monitor while hyprland is running 2022-06-30 23:50:57 +02:00
vaxerski
92890d492a fallback on unset device config var 2022-06-30 21:38:06 +02:00
vaxerski
d010ca2049 added per-device config options 2022-06-30 21:26:00 +02:00
vaxerski
4510764f34 finally fix scaled snapshots 2022-06-30 20:02:04 +02:00
vaxerski
96a23eca81 calculate damage properly for layers on commit
since the damageSurface func now works, we can remove this old remnant
2022-06-30 18:46:00 +02:00
Vaxry
ac8a23c3ae Merge pull request #281 from hyprwm/modernize-pointers
Modernize pointers (optimization)
2022-06-30 18:20:00 +02:00
vaxerski
990d3f232b fix another crash 2022-06-30 16:11:26 +02:00
vaxerski
97b515edb7 fix crash 2022-06-30 16:00:44 +02:00
vaxerski
328b3fa4bc mordernize pointers 2022-06-30 15:44:26 +02:00
vaxerski
d1564299d2 fix minor bug with new anim optimization 2022-06-30 13:11:10 +02:00
vaxerski
cfc1f6c211 optimize animationmanager 2022-06-30 12:54:58 +02:00
vaxerski
a7ebf0ddc3 added CPU uniform location lookup optimization 2022-06-30 12:39:10 +02:00
vaxerski
4101006b5e remove asserts in CAnimatedVariable 2022-06-30 12:22:24 +02:00
vaxerski
b0cd90a43c refactor a bunch of layout code 2022-06-30 12:09:05 +02:00
vaxerski
ae3ff6736e hyprctl monitors changes 2022-06-29 23:33:51 +02:00
vaxerski
7d20d5c8c3 fix make clear wlroots 2022-06-29 23:06:45 +02:00
vaxerski
6ce2678970 fix snapshot scaling issue 2022-06-29 22:26:34 +02:00
vaxerski
d28151d255 added foreign support 2022-06-29 22:23:51 +02:00
Mihai Fufezan
be390dacfd Merge pull request #274 from fufexan/nix-stuff
nix: add debug package and waybar with -Dexperimental flag
2022-06-29 20:57:18 +03:00
Mihai Fufezan
dc83110c05 nix & meson: 0.6.0 -> 0.6.2 2022-06-29 20:50:33 +03:00
Mihai Fufezan
cbf3595e96 nix: add debug package and waybar with -Dexperimental flag 2022-06-29 20:50:27 +03:00
vaxerski
2659afee3c force workspace events 2022-06-29 18:19:06 +02:00
vaxerski
9391357063 fix focus on maximize 2022-06-29 14:44:24 +02:00
vaxerski
6ec16fdcda damage drag and drop 2022-06-29 14:15:08 +02:00
vaxerski
208864cba9 include build/include in CMakeLists 2022-06-29 13:49:53 +02:00
vaxerski
bbc3b5e19b added make fixwlr 2022-06-29 13:30:28 +02:00
vaxerski
697ce96d62 temp fix for snapshot size on scaled 2022-06-29 13:08:28 +02:00
vaxerski
31a1b3b192 allow init logs to be saved 2022-06-29 12:58:49 +02:00
vaxerski
8820f7f210 optimization + revert one oopsie 2022-06-29 12:54:53 +02:00
vaxerski
73663a8ba5 fix incorrect snapshot calc for scaled outputs 2022-06-29 12:36:50 +02:00
vaxerski
13acfb1c30 fix disabling in animationmanager 2022-06-29 12:06:09 +02:00
vaxerski
37abe0aedc added debug:damage_blink 2022-06-29 11:44:00 +02:00
vaxerski
5636d2031e simplify damageWindow 2022-06-29 11:21:42 +02:00
vaxerski
9388bb5d55 fix shadows on scaled 2022-06-29 11:13:30 +02:00
vaxerski
6213328d2c default currentrules to null 2022-06-28 16:12:47 +02:00
vaxerski
f7db5eaf50 don't render decos on fullscreen windows 2022-06-28 15:45:38 +02:00
vaxerski
3832720273 fix possible crash in cinputmanager 2022-06-28 15:40:14 +02:00
vaxerski
9fcef41d66 mutliple fixes to subsurface handling 2022-06-28 15:30:46 +02:00
vaxerski
fc5cd49795 don't create a surface tree on xwayland windows 2022-06-28 14:09:14 +02:00
vaxerski
9f407b9018 log window parent for x11 2022-06-28 12:46:32 +02:00
vaxerski
85977fb4dc add xwayland class raw to destroywindow 2022-06-28 12:43:08 +02:00
vaxerski
3cbd69e703 added createworkspace destroyworkspace events 2022-06-28 12:39:56 +02:00
vaxerski
a2e009bd9f log classes in create/destroy 2022-06-28 12:24:21 +02:00
vaxerski
80f04fa7c6 speed up damage log in commit subsurface 2022-06-28 12:20:33 +02:00
vaxerski
14c6b594b9 [gha] bump flake inputs 2022-06-28 09:31:06 +00:00
vaxerski
8b4a373efa update wlroots dep 2022-06-28 11:30:07 +02:00
vaxerski
c6f7eecf0f set custom if mode not found 2022-06-28 11:12:01 +02:00
vaxerski
1fc1fc9d3b fix focus on close fullscreen 2022-06-27 22:34:37 +02:00
vaxerski
73d0259210 don't guard changes in activateWindow 2022-06-27 22:01:10 +02:00
vaxerski
4443906994 fix fullscreen rule on already fullscreen ws 2022-06-27 20:11:09 +02:00
vaxerski
2cdb29aa10 fix anims with special workspace 2022-06-27 19:46:04 +02:00
vaxerski
213d0f25cf fix oopsie with fullscreen 2022-06-27 19:08:14 +02:00
vaxerski
dfe06cb060 fix crash with decos with null workspaces 2022-06-27 14:07:33 +02:00
vaxerski
5ad8cead7c prevent failed assert 2022-06-27 13:54:33 +02:00
vaxerski
781526dac5 added hyprctl kill 2022-06-27 13:42:20 +02:00
vaxerski
b9a5fc0d2f added pid and title info to hyprctl 2022-06-27 13:17:11 +02:00
Vaxry
3b6a410f7e Merge pull request #269 from hyprwm/save-wlr
Save wlr on sudo make install
2022-06-27 11:57:55 +02:00
vaxerski
07013b835d remove so and pc 2022-06-27 11:42:52 +02:00
vaxerski
7dad15035a forgot wlroots.pc 2022-06-27 11:40:23 +02:00
vaxerski
bc5fc7fad6 guard shadow w/h 2022-06-27 11:27:02 +02:00
vaxerski
3d48469cb4 fix decos with workspace offset 2022-06-27 00:25:37 +02:00
vaxerski
3263e48675 rerender monitors on config reload 2022-06-26 22:48:31 +02:00
vaxerski
0b1459ef04 typo + fix shadow on multimon 2022-06-26 22:27:03 +02:00
vaxerski
b7b4853301 fix deco on fullscreen 2022-06-26 22:26:13 +02:00
vaxerski
44aeb1fc90 added decoration:shadow_offset 2022-06-26 22:15:06 +02:00
vaxerski
0d6e248f15 bring back alacritty to autogen cfg 2022-06-26 20:35:08 +02:00
vaxerski
0b525cdc63 default to multisample on 2022-06-26 20:09:42 +02:00
vaxerski
6a47a305f8 fix some xwayland popups 2022-06-26 20:08:19 +02:00
vaxerski
1a0b2c4ade rewritten borders, fixed msaa 2022-06-26 19:39:56 +02:00
xDarksome
fc4b10d13c Remove empty line 2022-06-26 19:28:30 +03:00
xDarksome
504f76112a Merge branch 'hyprwm:main' into main 2022-06-26 19:20:20 +03:00
Vaxry
f1a5cb4979 Merge pull request #252 from squidgyberries/ex-conf-improvements
Made some settings' comments clearer
2022-06-26 14:53:46 +01:00
vaxerski
f5c2dfc706 a bit of fixes to cursor hiding 2022-06-26 13:43:32 +02:00
Vaxry
4d09101e23 oops 2022-06-26 12:53:56 +02:00
Vaxry
314e1f8fbe added funding 2022-06-26 12:53:22 +02:00
vaxerski
78bf88ba60 Added fullscreen rule 2022-06-26 12:12:29 +02:00
vaxerski
29aab21033 fix up some stupid default settings (internal) 2022-06-25 23:57:23 +02:00
vaxerski
adead82778 some changes to the sens and use in autogen 2022-06-25 23:40:52 +02:00
vaxerski
45898a57c8 guard windows' validity in focuswindowbyclass 2022-06-25 21:18:33 +02:00
vaxerski
2c8cf6afc4 notify of wiki in case of crashes 2022-06-25 21:16:52 +02:00
vaxerski
316b49eee2 added log level info 2022-06-25 20:50:29 +02:00
vaxerski
8de8f6667e add system info logging 2022-06-25 20:49:06 +02:00
Vaxry
648b2c892c mention shadows in readme 2022-06-25 20:36:48 +02:00
vaxerski
2955698f28 fix fade with deco 2022-06-25 20:31:54 +02:00
vaxerski
747ff3369d added drop shadows 2022-06-25 20:28:40 +02:00
vaxerski
54e8e78612 save wlroots and restore 2022-06-25 12:13:24 +02:00
vaxerski
b46f45befa additional keymap reload safety 2022-06-25 11:50:09 +02:00
vaxerski
3842b1641f allow move to 0 0 2022-06-25 11:20:03 +02:00
vaxerski
72c86b99eb added general:cursor_inactive_timeout 2022-06-24 23:27:02 +02:00
vaxerski
eb13be1240 fix one of the stupidest things i've ever written I am embarrassed. 2022-06-24 22:45:30 +02:00
vaxerski
45a44f9690 added noblur 2022-06-24 22:28:54 +02:00
Mihai Fufezan
e95e01416e flake, meson: manually update version
version update workflow: temporarily disable running on push
2022-06-24 19:48:11 +03:00
fufexan
94e8234ac9 [gha] bump flake and meson version 2022-06-24 16:45:11 +00:00
Mihai Fufezan
c78b811b49 Nix & Meson: fix update workflow 2022-06-24 19:44:53 +03:00
vaxerski
3053f99db6 guard dragging windows in dwindle 2022-06-24 18:37:04 +02:00
xDarksome
be460ea954 Merge branch 'hyprwm:main' into main 2022-06-24 18:58:11 +03:00
Darksome
776ca3baf2 Change workspace wheel scrolling direction 2022-06-24 18:57:14 +03:00
vaxerski
e7467c60f9 fix windowrule regex logic and add title: 2022-06-24 16:25:57 +02:00
vaxerski
3e8842e1f8 fix janky pixel maths with scaled textures 2022-06-24 15:59:59 +02:00
vaxerski
81e36298bf dont scale thick in border 2022-06-24 15:52:42 +02:00
vaxerski
218675246f guard pkeyboard in onMouseButton 2022-06-23 21:46:36 +02:00
vaxerski
e4e323a0df dwindle: disallow swaps between workspaces 2022-06-23 20:51:01 +02:00
vaxerski
f76b9c4852 fix: ignore reserved in getWindowInDirection 2022-06-23 20:39:48 +02:00
vaxerski
ae60075226 fix calculating damage offset for oversized popups 2022-06-23 19:32:00 +02:00
vaxerski
b25bafda08 guard null context in applyConfigToKeyboard 2022-06-23 18:52:05 +02:00
thinkingwithberries
a8e2595534 Update hyprland.conf 2022-06-23 21:52:17 +08:00
thinkingwithberries
3c6526dbbe Merge branch 'hyprwm:main' into ex-conf-improvements 2022-06-23 21:51:40 +08:00
vaxerski
4945c5887d reload all keyboards and not only the active 2022-06-23 15:48:31 +02:00
thinkingwithberries
ccdb03391e removed unused max fps option 2022-06-23 20:30:28 +08:00
thinkingwithberries
6ba5edd13e Made some settings' comments clearer 2022-06-23 18:26:48 +08:00
vaxerski
31dc70a41a Added exact to resizeActive and added moveactive 2022-06-23 10:14:59 +02:00
vaxerski
f9745b0d3b allow getWindowInDirection to scan other mons 2022-06-23 09:56:16 +02:00
Kainoa Kanter
64f6818a13 :finnadie:
https://www.youtube.com/watch?v=_asNhzXq72w
2022-06-22 15:22:22 -07:00
ThatOneCalculator
2631489a18 Syntax error in CI 2022-06-22 15:17:21 -07:00
ThatOneCalculator
5614f28dfd T1C: CMake Release Pipeline (CI) 2022-06-23 00:11:57 +02:00
ThatOneCalculator
a98c07cd00 Merge branch 'main' of https://github.com/hyprwm/Hyprland 2022-06-22 13:24:31 -07:00
Mihai Fufezan
11a5e6bcbf nix: revert to original wlroots repo 2022-06-22 23:23:46 +03:00
ThatOneCalculator
6eefd294af Upload release archive 2022-06-22 13:18:09 -07:00
ThatOneCalculator
606f4b0794 Fix release action 2022-06-22 13:09:37 -07:00
Kainoa Kanter
ff6e3a4d24 T1C: Releases pipeline 2022-06-22 22:04:55 +02:00
Kainoa Kanter
c21b062fe5 Delete aur directory 2022-06-22 11:25:41 -07:00
vaxerski
19d94b87ab Added keybind submaps 2022-06-22 20:23:20 +02:00
Vaxry
bd41776a5a Merge pull request #227 from fufexan/meson
Nix: use meson for builds
2022-06-22 16:20:02 +01:00
vaxerski
c2ff3d9e76 more shadow for readme banner 2022-06-22 16:01:51 +02:00
vaxerski
dbd060247e README better banner 2022-06-22 16:00:52 +02:00
vaxerski
0ec903808b don't use sudo in make config 2022-06-22 15:52:36 +02:00
vaxerski
770bada5d5 Fixed oversized apps' incorrect layout 2022-06-22 15:45:56 +02:00
vaxerski
499d2e41bf default apply_sens_to_raw to 0 2022-06-22 13:01:59 +02:00
vaxerski
d614fa895e Merge pull request #245 from taylor85345/main
Fixed crash on movetoworkspacesilent
2022-06-22 00:14:36 +01:00
taylor85345
b9f542a60f Fixed crash on movetoworkspacesilent 2022-06-21 16:13:05 -07:00
vaxerski
4c2459861b fix borders sometimes disappearing on certain windows 2022-06-21 23:09:20 +02:00
vaxerski
0f1ad16aec added general:no_border_on_floating 2022-06-21 22:54:41 +02:00
vaxerski
5541098f20 Added bindl 2022-06-21 22:47:27 +02:00
vaxerski
48e33023af fix crash on number workspace with null mon 2022-06-21 22:42:54 +02:00
vaxerski
0b6c04355a Merge pull request #239 from SebOuellette/main
Optimize cursor constraints for games
2022-06-21 21:34:31 +01:00
vaxerski
33abb6a5bf dang it autoformat 2022-06-21 22:30:07 +02:00
vaxerski
1810725a0c cleaner code 2022-06-21 22:29:11 +02:00
vaxerski
84d6e640ff support all workspace types in workspace keyword 2022-06-21 22:25:54 +02:00
SebOuellette
20ad9d3e7d Passes all constraint tests!
So a summary of what's been done in this fork/PR. Instead of moving the cursor, we're warp_closest ing. warp_absolute didn't work, so warp closest has kindof an auto constrain feature so it works beautifully. I'm also contraining to the right side of the window - 1, because the cursors are treating that pixel as the next pixel over, so it was actually thinking it was on the next monitor (assuming fullscreen) when the cursor got to the right or bottom of the window. TL;DR rounding issue.

This fix didn't work when you had a fullscreen video playing on a monitor beside, so I also fixed that by ignoring all focus changes or whatever when a constraint actually occured, we obviously just don't want to focus another monitor when constrained, so why not just *disable it when a constraint happened*

The PR is now ready, I love Hyprland, and I can't wait to contribute more :)
2022-06-21 16:25:40 -04:00
vaxerski
4a3f9ccba2 move ignore to eventmanager and fix double focus in changeworkspace 2022-06-21 22:17:30 +02:00
vaxerski
ff49f22440 fix rapid blinking on launch 2022-06-21 22:13:13 +02:00
vaxerski
a2fa1bc80d fix CMake debug mode 2022-06-21 22:09:46 +02:00
Mihai Fufezan
593f24a2ec workflows: add meson version updater and update versions 2022-06-21 22:28:20 +03:00
Mihai Fufezan
8bd7234d72 nix: change build system to meson
flake.nix: change wlroots url to mirror, update version
flake.lock: update wlroots & nixpkgs
nix/update-inputs.sh: update wlroots url
2022-06-21 22:11:46 +03:00
vaxerski
f58bb0187b Merge pull request #241 from viperML/main
Nix: refactor packages and overlays
2022-06-21 11:29:35 +01:00
SebOuellette
3dc2277fd0 Actually, mostly working.
One failure case: When there is a fullscreen window directly to the right of a game, for example, in a multimonitor setup, then the cursor will bug out in between the monitors. sometimes it will get constrained to the border, but just outside the window (which is what this PR fixes, so it's unusual) and sometimes the cursor will just ignore the constraint entirely. However this is only in the one case.
2022-06-21 02:23:57 -04:00
SebOuellette
ee7900f819 Mouse no longer removes focus from constraining window
The window properly constrains the mouse now

I do still notice a bug with moving the mouse in games, if you don't move the mouse fast enough, some games will not register the mouse movement. This doesn't happen in KDE so I know it's related somehow
2022-06-20 23:15:16 -04:00
Sebastian Ouellette
f7e9a27c0a Merge branch 'vaxerski:main' into main 2022-06-20 22:05:02 -04:00
Darksome
8f62f6d4b0 Add workspace switching with mouse wheel 2022-06-20 22:47:28 +03:00
Caleb Owens
7d80327e7d fixed vertical swapping issue 2022-06-20 17:11:59 +01:00
Caleb Owens
3d46c73981 Added a multiplier for the width to height ratio 2022-06-20 14:37:27 +01:00
vaxerski
f5f531562b Merge pull request #205 from sp1ritCS/meson
Added meson buildfiles
2022-06-20 13:56:58 +01:00
Fernando Ayats
4efd913de8 nix: use the overlay in the module 2022-06-20 13:04:40 +02:00
Fernando Ayats
bd95301188 nix: no pseudo-overlay 2022-06-20 12:16:07 +02:00
Fernando Ayats
d6b324306b nix: add a proper overlay and cleanup flake 2022-06-20 11:50:06 +02:00
Sebastian Ouellette
dc84935059 Set the constraint position to the window center (properly)
Missed one expression, it was set to the bottom middle. I missed it because i don't have an extra monitor extending from the bottom of that screen.
2022-06-19 16:54:59 -04:00
Sebastian Ouellette
95e083dbd3 Converted tabs to spaces. Now ready for PR 2022-06-19 16:51:03 -04:00
SebOuellette
39d03fc196 Removed the log file which was causing conflicts 2022-06-19 16:24:30 -04:00
SebOuellette
5058a74453 Cleaned up some old debug 2022-06-19 16:23:49 -04:00
Sebastian Ouellette
ae1bcc909d Invisible cursors are constrained to center
This is a first version of my test to properly constrain cursors. This is mostly working in the buggy applications I had before, but I feel that the cursor needs to actually move around, instead of being locked to the center of the window. 

This may cause problems when locking to the edge, but yeah.
2022-06-19 16:07:41 -04:00
Florian "sp1rit"​
7c3626f15e meson: ensure non-debug builds will use proper configuration
meson will set add -DHYPRLAND_DEBUG to CXXFLAGS during compilation of
debug builds. this avoids NDEBUG issues with wlroots and ensures asserts
will also work on release builds.
2022-06-18 13:09:38 +02:00
vaxerski
f7bdc2e870 Merge pull request #234 from alba4k/main
revised makefile, newline after execution
2022-06-17 21:23:48 +01:00
alba4k
faa1b5a44f Update main.cpp 2022-06-17 22:02:57 +02:00
Yoni FIRROLONI
f428604b6f undo formatting 2022-06-17 19:51:34 +01:00
Yoni FIRROLONI
2feca08a67 move, set active, recalc, anim on monitor connected 2022-06-17 19:51:34 +01:00
vaxerski
837d4af8f6 Merge pull request #231 from CcydtN/main
Fix zombie process problem
2022-06-17 17:53:47 +01:00
alba4k
9c6c5481bb revised makefile, newline after execution 2022-06-17 12:18:25 +02:00
Florian "sp1rit"​
75918c14d7 meson: added wayland dependencies to main executable 2022-06-16 23:30:30 +02:00
Florian "sp1rit"​
d179501c4f meson: added default_library=static as default option 2022-06-16 23:30:30 +02:00
Florian "sp1rit"​
8e203b0da3 added assets/wallpapers to install 2022-06-16 23:30:30 +02:00
Florian "sp1rit"​
09cd8c45a6 dropped emoticons from meson workflow 2022-06-16 23:30:30 +02:00
Florian "sp1rit"​
43065657c9 actions: added meson workflow 2022-06-16 23:30:30 +02:00
Florian "sp1rit"​
89454ada6c added runtime tag to the wayland-session launchable and sample config
this allows for a small-install footprint by running
    meson install -C _build --tags runtime
2022-06-16 23:30:30 +02:00
Florian "sp1rit"​
c169f94895 moved wlroots/xwayland definitions to the main meson file
prevents build-failure when xwayland is disabled to to
    add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
beeing called after the required wayland protocols have been built.
2022-06-16 23:30:30 +02:00
Florian "sp1rit"​
b3ef1fcc54 replaced source list with globber script
See:
  - https://mesonbuild.com/FAQ.html#why-cant-i-specify-target-files-with-a-wildcard
  - https://github.com/vaxerski/Hyprland/pull/205#issuecomment-1154158918
2022-06-16 23:30:30 +02:00
Florian "sp1rit"​
fd0112425f Added meson buildfiles
this makes for a far better experience in combination with wlroots,
since that whole makefile mess is not required.
Additionaly, handling of wayland protocol sources is also slightly
better, but could be improved with mesons inbuilt wayland module.

To build Hyprland using meson:
    meson _build -Ddefault_library=static
    ninja -C _build
    ninja -C _build install
2022-06-16 23:30:28 +02:00
CcydtN
b69375a918 Fixing format issue 2022-06-17 03:25:08 +08:00
vaxerski
354e265128 Merge pull request #230 from bazuin-32/main
Resolves #204. Enables numlock on startup when configured to do so
2022-06-16 18:33:37 +01:00
CcydtN
5fa61e5a54 Fix generating zombie process 2022-06-17 01:14:10 +08:00
bazuin-32
1926bb4659 Resolves #204. Enables numlock on startup when configured to do so. 2022-06-16 10:49:16 -06:00
vaxerski
36ea12b315 Merge pull request #223 from PowerBall253/main
Create config directory if it doesn't exist
2022-06-15 07:41:05 +01:00
Bruno Ancona
0c5d2f04b4 Create config directory if it doesn't exist 2022-06-15 01:29:51 -05:00
vaxerski
fa6530c7e8 Merge pull request #213 from ThatOneCalculator/mirror
Change wlroots submodule url to github mirror
2022-06-13 22:16:28 +01:00
ThatOneCalculator
e97b83167f Change wlroots submodule url to github mirror 2022-06-13 14:10:49 -07:00
vaxerski
9aec355727 update contrib link in readme 2022-06-13 21:30:01 +01:00
vaxerski
a4e21a25f4 Merge pull request #200 from siemato/main
Added Touchpad Config options
2022-06-13 17:30:17 +01:00
Marco Siedentopf
f13217f698 Codestyle 2022-06-12 15:06:58 +00:00
Marco Siedentopf
85d2c1d5a6 Merge branch 'vaxerski:main' into main 2022-06-12 15:04:02 +00:00
vaxerski
2208be5175 Merge pull request #197 from spectreseven1138/main
Add loose follow_mouse option
2022-06-12 14:31:07 +02:00
spectreseven1138
46d11f7646 Access config value statically 2022-06-12 16:31:56 +09:00
Marco Siedentopf
16d1b44ef9 Implemented Config options for Touchpads
Implemented Options to 1. toggle between clickfinger behavior and software buttons, 2. button emulation and 3. tap-to-click
2022-06-12 05:40:06 +00:00
Marco Siedentopf
e69f2ab4c3 Added Config options for Touchpads
Added Options to 1. toggle between clickfinger behavior and software buttons, 2. middle button emulation and 3. tap-to-click
2022-06-12 05:40:01 +00:00
spectreseven1138
95a626f72e Add loose (2) option to follow_mouse config 2022-06-12 09:14:22 +09:00
vaxerski
70eb5053fb Note Hypr and Hyprland's differences in readme 2022-06-11 21:10:41 +01:00
vaxerski
48ab282a69 Merge pull request #195 from PowerBall253/main
Add natural_scrolling option for touchpads only
2022-06-11 18:26:24 +02:00
Bruno Ancona
018b0684dd Add natural_scrolling option for touchpads only 2022-06-11 10:24:00 -05:00
vaxerski
94528bcdbc Merge pull request #194 from frigaut/main
fullscreen fix
2022-06-11 17:06:19 +02:00
Francois Rigaut
4fa69497ca fullscreen fix 2022-06-11 16:37:40 +02:00
vaxerski
dc5cc15474 find surfaces in reverse for focus 2022-06-10 15:18:30 +02:00
vaxerski
3a2ac11e3e added focuswindowbyclass 2022-06-10 12:06:27 +02:00
vaxerski
90a859af27 cyclenext 2022-06-10 11:41:52 +02:00
vaxerski
c6953329d5 Added circlenext 2022-06-10 11:39:06 +02:00
vaxerski
c451e13e4f Merge pull request #174 from ThatOneCalculator/main
Change features section in readme
2022-06-09 22:13:46 +02:00
vaxerski
d68e09a707 remove unfocusall 2022-06-09 22:07:33 +02:00
Kainoa Kanter
b4de91111a Update README.md 2022-06-09 12:59:30 -07:00
Kainoa Kanter
750961e9c1 Merge branch 'vaxerski:main' into main 2022-06-09 12:58:07 -07:00
vaxerski
b5a446ddfd Merge pull request #177 from vaxerski/tablets
Added Tablets support
2022-06-09 21:54:10 +02:00
vaxerski
fbc7853459 de-focusify on lost proximity 2022-06-09 21:39:03 +02:00
vaxerski
53146ccf69 oopsie 2022-06-09 21:39:03 +02:00
vaxerski
506977c13d unfocus on destroy 2022-06-09 19:40:16 +02:00
vaxerski
09b130374d unfocus tablets 2022-06-09 19:38:39 +02:00
vaxerski
b53c093b88 log tablets in hyprctl 2022-06-09 19:25:26 +02:00
vaxerski
8929172bc2 remove redundant logs 2022-06-09 19:19:42 +02:00
vaxerski
6317f64ba0 set proximity in tablets 2022-06-09 18:09:09 +02:00
vaxerski
824d8b954d logify even more 2022-06-09 17:40:05 +02:00
vaxerski
49fc1ccdb4 oops 2022-06-09 17:32:58 +02:00
vaxerski
c218ed4432 notify tablet motion 2022-06-09 17:16:01 +02:00
vaxerski
f97b90859a Add envvars to exec cfg 2022-06-09 15:03:34 +02:00
vaxerski
1841d244f0 log shit in tablets 2022-06-09 14:40:56 +02:00
vaxerski
47404534d0 added tablet v2 support (alpha alpha) 2022-06-09 12:46:55 +02:00
Kainoa Kanter
b7e21d0fa9 Update README.md 2022-06-08 14:05:06 -07:00
Kainoa Kanter
90024e534d Features 2022-06-08 14:03:54 -07:00
vaxerski
248ce66459 warn unrecognized input devices 2022-06-08 22:11:24 +02:00
vaxerski
638b44cabd Attach touch devices raw 2022-06-08 22:09:35 +02:00
vaxerski
8f0b963729 refocus after movetoworkspace 2022-06-08 15:52:38 +02:00
vaxerski
7b73570f11 fix a crash in monitorDestroy 2022-06-08 15:13:47 +02:00
vaxerski
a0f3fc794e [gha] bump flake inputs 2022-06-08 12:43:34 +00:00
vaxerski
263664c58a updated wlroots dep 2022-06-08 14:42:27 +02:00
vaxerski
da80eb8e57 Added the tablet manager and tablet v2 protocol 2022-06-08 14:29:49 +02:00
vaxerski
0b8fe2a0aa fix incorrect animationmanager behavior without anims 2022-06-07 22:27:15 +02:00
vaxerski
1642b1ff66 optimize config calls in often called areas 2022-06-07 20:41:40 +02:00
vaxerski
7b9583c1f2 Mention source in issue guidelines 2022-06-07 20:11:05 +02:00
vaxerski
cc80b68545 fixed a typo, will boost performance on opaque windows with blur 2022-06-07 20:10:14 +02:00
vaxerski
2bddfa81bc Merge pull request #169 from ThatOneCalculator/main
AUR go brrr
2022-06-07 00:12:30 +02:00
Kainoa Kanter
85d91c3d3c Update PKGBUILD-git 2022-06-06 15:07:48 -07:00
Kainoa Kanter
d80c90233b Update PKGBUILD-bin 2022-06-06 15:07:35 -07:00
Kainoa Kanter
d0ca043122 Update PKGBUILD-git 2022-06-06 15:05:29 -07:00
Kainoa Kanter
92da453d4d Update PKGBUILD-git 2022-06-06 15:05:16 -07:00
Kainoa Kanter
433e4a0eef Update PKGBUILD 2022-06-06 15:05:00 -07:00
vaxerski
b62e530fdb Force window style tiled on all xdg windows 2022-06-06 19:43:44 +02:00
vaxerski
663fba76ae Added resizeactive 2022-06-06 19:32:14 +02:00
vaxerski
d73e05cc68 fix XDELTA and YDELTA with empty geometry 2022-06-06 18:56:16 +02:00
vaxerski
066ea296ff dont report unmanaged x11 windows in hyprctl clients 2022-06-06 15:22:25 +02:00
vaxerski
72c967aa89 fix class crash with unmanaged x11 2022-06-06 15:03:06 +02:00
vaxerski
c474e8253a Update issue templates 2022-06-06 15:00:24 +02:00
vaxerski
20936ad2a4 added issue guidelines 2022-06-06 14:58:50 +02:00
vaxerski
d743ac7bb1 added forcerendererreload and some more vt changes 2022-06-06 13:48:17 +02:00
vaxerski
322a495412 Merge pull request #167 from JamesReynolds/main
Fix error: attribute 'lastModifiedDate' missing
2022-06-06 13:06:40 +02:00
vaxerski
63d6c594b9 fix possible crash in hyprctl clients 2022-06-06 12:58:39 +02:00
vaxerski
09e77bf844 added force_no_accel 2022-06-06 12:08:33 +02:00
James Reynolds
3d4832990c Fix error: attribute 'lastModifiedDate' missing
Only applies to some versions of flakes, tested on nix 2.8.1.
2022-06-06 10:20:56 +01:00
vaxerski
84a0fa0f34 fix subsurfaces not damaging on unmap 2022-06-05 23:23:16 +02:00
vaxerski
2cd2f8b5b5 add class to window hyprctl requests 2022-06-04 20:32:27 +02:00
vaxerski
172d6cd498 Merge pull request #160 from ThatOneCalculator/main
Hooray, more AUR stuff!
2022-06-03 20:41:10 +02:00
Kainoa Kanter
02269af777 Update PKGBUILD-git 2022-06-03 11:33:32 -07:00
Kainoa Kanter
e2592522d3 Update PKGBUILD 2022-06-03 11:33:14 -07:00
Kainoa Kanter
d76c982d2e Update PKGBUILD-bin 2022-06-03 11:32:48 -07:00
vaxerski
ef855440c6 keyboard code further cleanup 2022-06-03 19:15:39 +02:00
vaxerski
246aa000f5 Added dwindle:special_scale_factor 2022-06-03 19:03:33 +02:00
vaxerski
1a93b2a756 Handle keyboards better
Also fixes some crashes of apps on reload
2022-06-03 18:59:39 +02:00
vaxerski
10c2bd0686 make shaders cleaner 2022-06-03 18:45:18 +02:00
vaxerski
f99ad521a4 Updated issue templates 2022-06-03 17:52:22 +02:00
vaxerski
9486a230c7 Log to the instance folder 2022-06-03 17:48:07 +02:00
vaxerski
6f3b004199 IPC and log changes, introduce signature 2022-06-03 17:41:57 +02:00
vaxerski
19b17b590c fix moveactivetoworkspace with same workspace 2022-06-03 11:19:17 +02:00
vaxerski
f9c8a72e46 dont enable AA by default 2022-06-02 23:03:13 +02:00
vaxerski
e11cb8b328 Added antialiasing to outer edges
simplified, stupidly fast MSAA for rounded edges
2022-06-02 22:58:54 +02:00
vaxerski
7b568d7ad8 configure keyboards one by one 2022-06-02 20:31:47 +02:00
vaxerski
a2f718059b fucking typo 2022-06-02 19:50:46 +02:00
vaxerski
feb0499597 Merge pull request #144 from fufexan/main
Fix Nix build and add updater
2022-06-02 19:47:54 +02:00
vaxerski
601abc7e92 Added locking numlock 2022-06-02 19:47:11 +02:00
Mihai Fufezan
7451890fd7 nix: replace paths dynamically 2022-06-02 19:10:56 +03:00
vaxerski
f5cdb5b95e Fix special in m+1 m-1 2022-06-02 16:54:19 +02:00
vaxerski
7afcf656bd Added hyprctl devices 2022-06-02 13:59:33 +02:00
Mihai Fufezan
6daa866beb nix/updater: only update wlroots on rev change 2022-06-02 00:09:28 +03:00
Mihai Fufezan
9447fcd603 fix Nix build and add updater
- move unnecessary toplevel files to nix/
- added patch that ignores the submodule (revert)
- add update script run by a workflow
2022-06-01 23:52:08 +03:00
vaxerski
9acf15efd7 README changes 2022-06-01 22:00:46 +02:00
vaxerski
b5a100379e reject drag on fullscreen workspace 2022-06-01 21:13:10 +02:00
vaxerski
4f76d5d8d7 destroy monitor on disabled 2022-06-01 21:10:12 +02:00
vaxerski
8d850b0ce1 Added workspace/monitor unset and workspace silent rules 2022-06-01 21:04:06 +02:00
vaxerski
0f28d2ae55 fix stupid error in anim styles 2022-06-01 20:51:21 +02:00
vaxerski
d2451aea4b use overflowing coords when surface unmaps 2022-06-01 13:38:33 +02:00
vaxerski
680705ff91 [gha] bump flake inputs 2022-06-01 00:50:00 +00:00
vaxerski
300fc2ab0f Merge pull request #140 from ThatOneCalculator/main
More AUR stuff
2022-05-31 22:49:15 +02:00
Kainoa Kanter
02210d3d96 Update PKGBUILD-bin 2022-05-31 13:46:09 -07:00
Kainoa Kanter
879345c1e9 Update PKGBUILD-git 2022-05-31 13:46:00 -07:00
Kainoa Kanter
1e3bea5e70 Update PKGBUILD 2022-05-31 13:45:51 -07:00
Kainoa Kanter
f64cae2b7f Update PKGBUILD-bin 2022-05-31 13:32:59 -07:00
Kainoa Kanter
c433b14e3d Update PKGBUILD 2022-05-31 13:32:38 -07:00
Kainoa Kanter
8d1c495878 Update PKGBUILD-git 2022-05-31 13:32:26 -07:00
Kainoa Kanter
4264a0b08d Update PKGBUILD 2022-05-31 13:26:03 -07:00
Kainoa Kanter
40ab062a3c Update PKGBUILD-bin 2022-05-31 13:25:49 -07:00
Kainoa Kanter
35bcea38e3 0.2.1beta 2022-05-31 13:19:26 -07:00
Kainoa Kanter
1ccb944509 0.2.1beta 2022-05-31 13:19:15 -07:00
Kainoa Kanter
c600249aee Merge branch 'vaxerski:main' into main 2022-05-31 13:18:36 -07:00
Kainoa Kanter
6d6e967a8d Update PKGBUILD-git 2022-05-31 13:17:02 -07:00
vaxerski
970018248f Don't damage surfaces coming from not rendered windows 2022-05-31 22:16:13 +02:00
Kainoa Kanter
f6b8a96621 Update PKGBUILD 2022-05-31 13:15:57 -07:00
Kainoa Kanter
8e8d5a99c2 Add bin 2022-05-31 13:15:41 -07:00
vaxerski
471654d791 remove monitor recommended dt from config 2022-05-31 21:05:46 +02:00
vaxerski
679e36d82e fix border size on scaled outputs 2022-05-31 20:38:45 +02:00
vaxerski
0f8712ed64 fix crash in moveWorkspaceToMonitor 2022-05-31 18:47:32 +02:00
vaxerski
3e28a8b690 added slidevert for workspaces 2022-05-31 17:56:33 +02:00
vaxerski
8de7cc5a8d opacity windowrule support 2 values 2022-05-31 17:35:50 +02:00
vaxerski
e73df80782 Add mon in mon out events and fix crash 2022-05-31 17:17:44 +02:00
vaxerski
0d7131d30e fix typo in hyprctl clients and activewindow 2022-05-31 16:52:28 +02:00
vaxerski
d2e0b7c22a render special over fullscreen 2022-05-31 14:20:41 +02:00
vaxerski
c1193ee483 updated readme features 2022-05-31 14:15:28 +02:00
vaxerski
042e79b888 fix fatal crash 2022-05-31 14:04:11 +02:00
vaxerski
0055efc4f1 Added a special workspace 2022-05-31 14:01:00 +02:00
vaxerski
df722cbb86 Added relative monitor workspace offset 2022-05-31 12:33:08 +02:00
vaxerski
68f7e565e6 Use existing default mon workspace if available on connect 2022-05-31 12:10:34 +02:00
vaxerski
48a3b1c514 fix oopsie 2022-05-31 11:02:54 +02:00
vaxerski
85128ebb7d Merge pull request #130 from vaxerski/bundle-wlroots
Bundle wlroots
2022-05-31 10:50:55 +02:00
vaxerski
ad98b96891 add submodules to CI 2022-05-31 10:47:56 +02:00
vaxerski
2e7586e841 fix up config and includes 2022-05-31 10:43:41 +02:00
vaxerski
f6ba9909d6 added submodule 2022-05-31 10:08:57 +02:00
vaxerski
c9041bf5c9 notify workspace protocol of workspace group change 2022-05-30 20:51:45 +02:00
vaxerski
b2474d406a don't duplicate workspaces on connect 2022-05-30 20:45:39 +02:00
vaxerski
eee9698ec9 move workspaces and not windows on mon disconnect 2022-05-30 20:44:14 +02:00
vaxerski
1f4c938c67 Added moving workspaces 2022-05-30 20:05:38 +02:00
vaxerski
c44c79abb2 fix monitor cleanups on removed 2022-05-30 17:11:35 +02:00
vaxerski
1e096f6fcd fix moveactivetoworkspace 2022-05-30 15:28:23 +02:00
vaxerski
b1c11f3d2e consider the full bb with deco in rendering 2022-05-30 14:55:42 +02:00
vaxerski
da63503d5f updated issue templates
dont submit aur coredumps plox
2022-05-30 14:21:33 +02:00
vaxerski
7167be9c48 Fix relative IDs in movetoworkspace crashing 2022-05-30 14:18:46 +02:00
146 changed files with 16786 additions and 3700 deletions

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
ko_fi: vaxry

View File

@@ -3,13 +3,10 @@ name: Bug report
about: Found a bug? Report it here!
title: ''
labels: bug
assignees: ''
---
**Describe the bug**
**Images/videos/anything that would help**
Please attach a log (it's in /tmp/hypr/hyprland.log) and, if crashing, a crashdump (coredumpctl, then coredumpctl info <pid>)
Please consult the issue guidelines at
https://github.com/vaxerski/Hyprland/blob/main/docs/ISSUE_GUIDELINES.md
BEFORE submitting.

View File

@@ -3,7 +3,10 @@ name: Feature request
about: Suggest a feature/change/idea
title: ''
labels: enhancement
assignees: ''
---
**Describe in detail your idea.**
Please consult the issue guidelines at
https://github.com/vaxerski/Hyprland/blob/main/docs/ISSUE_GUIDELINES.md
BEFORE submitting.

View File

@@ -1,9 +1,9 @@
Describe your PR, what does it fix/add?
#### Describe your PR, what does it fix/add?
Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
#### Is there anything you want to mention? (unchecked code, possible bugs, found problems, breaking compatibility, etc.)
Is it ready for merging, or does it need work?
#### Is it ready for merging, or does it need work?

View File

@@ -13,29 +13,73 @@ jobs:
sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
pacman --noconfirm --noprogressbar -Syyu
pacman --noconfirm --noprogressbar -Sy glslang libepoxy libfontenc libxcvt libxfont2 libxkbfile vulkan-headers vulkan-validation-layers xcb-util-errors xcb-util-renderutil xcb-util-wm xorg-fonts-encodings xorg-server-common xorg-setxkbmap xorg-xkbcomp xorg-xwayland git cmake go clang lld libc++ pkgconf meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd
- name: Set up user
run: |
useradd -m githubuser
echo -e "root ALL=(ALL:ALL) ALL\ngithubuser ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers
- name: Build wlroots
run: |
su githubuser -c "cd ~ && git clone https://gitlab.freedesktop.org/wlroots/wlroots"
su githubuser -c "cd ~/wlroots && meson build/ --prefix=/usr && ninja -C build/ && sudo ninja -C build/ install && cd .."
- name: Fix permissions for git
run: |
git config --global --add safe.directory /__w/Hyprland/Hyprland
- name: Checkout Hyprland
uses: actions/checkout@v3
- name: Build Hyprland With default settings
with:
submodules: recursive
- name: Build Hyprland
run: |
git submodule sync --recursive && git submodule update --init --force --recursive
make all
- name: Build Hyprland with LEGACY_RENDERER
- name: Compress and package artifacts
run: |
make legacyrenderer
mkdir x86_64-pc-linux-gnu
mkdir hyprland
mkdir hyprland/example
mkdir hyprland/assets
cp ./LICENSE hyprland/
cp build/Hyprland hyprland/
cp hyprctl/hyprctl hyprland/
cp subprojects/wlroots/build/libwlroots.so.11032 hyprland/
cp build/Hyprland hyprland/
cp -r example/ hyprland/
cp -r assets/ hyprland/
tar -cvf Hyprland.tar.xz hyprland
- name: Release
uses: actions/upload-artifact@v3
with:
name: Build archive
path: Hyprland.tar.xz
meson:
name: "Build Hyprland with Meson (Arch)"
runs-on: ubuntu-latest
container:
image: archlinux
steps:
- name: Download dependencies
run: |
sed -i 's/SigLevel = Required DatabaseOptional/SigLevel = Optional TrustAll/' /etc/pacman.conf
pacman --noconfirm --noprogressbar -Syyu
pacman --noconfirm --noprogressbar -Sy glslang libepoxy libfontenc libxcvt libxfont2 libxkbfile vulkan-headers vulkan-validation-layers xcb-util-errors xcb-util-renderutil xcb-util-wm xorg-fonts-encodings xorg-server-common xorg-setxkbmap xorg-xkbcomp xorg-xwayland git go clang lld libc++ pkgconf meson ninja wayland wayland-protocols libinput libxkbcommon pixman glm libdrm libglvnd cairo pango systemd scdoc base-devel seatd
- name: Checkout Hyprland
uses: actions/checkout@v3
with:
submodules: true
- name: Configure
run: |
meson obj-x86_64-pc-linux-gnu \
-Ddefault_library=static
- name: Compile
run: ninja -C obj-x86_64-pc-linux-gnu
# - name: Compress artifacts
# run: |
# mkdir x86_64-pc-linux-gnu
# DESTDIR=$PWD/x86_64-pc-linux-gnu meson install -C obj-x86_64-pc-linux-gnu --tags runtime
# tar -cvf x86_64-pc-linux-gnu.tar.xz x86_64-pc-linux-gnu
# - name: Upload artifacts
# uses: actions/upload-artifact@v3
# with:
# name: Build artifacts (x86_64-pc-linux-gnu)
# path: x86_64-pc-linux-gnu.tar.xz

28
.github/workflows/man-update.yaml vendored Normal file
View File

@@ -0,0 +1,28 @@
name: Build man pages
on:
workflow_dispatch:
push:
paths:
- docs/**
branches:
- 'main'
jobs:
main:
name: Build man pages
runs-on: ubuntu-latest
steps:
- name: Install deps
run: sudo apt install pandoc
- name: Clone repository
uses: actions/checkout@v3
# Not needed
# with:
# submodules: recursive
- name: Build man pages
run: make man
- uses: stefanzweifel/git-auto-commit-action@v4
name: Commit
with:
commit_message: "[gha] build man pages"

View File

@@ -5,15 +5,26 @@ jobs:
nix:
name: "Build Hyprland (Nix)"
runs-on: ubuntu-latest
strategy:
matrix:
package:
- default
- hyprland-no-hidpi
steps:
- name: Clone repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install nix
uses: cachix/install-nix-action@v17
with:
install_url: https://releases.nixos.org/nix/nix-2.8.0/install
install_url: https://releases.nixos.org/nix/nix-2.10.3/install
extra_nix_config: |
auto-optimise-store = true
experimental-features = nix-command flakes
- name: Build HyprLand with default settings
run: nix build --print-build-logs
- uses: cachix/cachix-action@v10
with:
name: hyprland
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
- name: Build Hyprland with default settings
run: nix build .#${{ matrix.package }} --print-build-logs

View File

@@ -0,0 +1,26 @@
name: "Nix & Meson: update version"
on: [workflow_dispatch]
jobs:
update:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v3
- name: Update flake and meson version
run: |
REGEX="([0-9]+(\.[0-9a-zA-Z]+)+)"
CRT_REV=$(git show-ref --tags --head --abbrev | head -n 1 | head -c 7)
TAG_REV=$(git show-ref --tags --abbrev | tail -n 1 | head -c 7)
CRT_VER=$(sed -nEe "/$REGEX/{p;q;}" meson.build | awk -F\' '{print $2}')
VERSION=$(git show-ref --tags --abbrev | tail -n 1 | tail -c +20)
if [[ $TAG_REV = $CRT_REV ]] || [[ $CRT_VER != $VERSION ]]; then
sed -Ei "s/$REGEX/$VERSION/g" meson.build
sed -Ei "s/$REGEX/$VERSION/g" flake.nix
fi
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[gha] bump flake and meson version"

View File

@@ -1,9 +1,6 @@
name: "Nix: update lockfile"
on:
schedule:
- cron: '0 0 */14 * *'
workflow_dispatch:
on: [push, workflow_dispatch]
jobs:
update:
@@ -19,7 +16,7 @@ jobs:
auto-optimise-store = true
experimental-features = nix-command flakes
- name: Update lockfile
run: nix flake update
run: nix/update-inputs.sh
- uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: "[gha] bump flake inputs"

38
.github/workflows/release.yaml vendored Normal file
View File

@@ -0,0 +1,38 @@
name: Release artifacts
on:
release:
types: [published]
workflow_dispatch:
jobs:
source-tarball:
runs-on: ubuntu-latest
steps:
- name: Checkout Hyprland
id: checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Create tarball with submodules
id: tar
run: tar -czv --owner=0 --group=0 --no-same-owner --no-same-permissions -f source.tar.gz *
- id: whatrelease
name: Get latest release
uses: pozetroninc/github-action-get-latest-release@master
with:
owner: hyprwm
repo: Hyprland
excludes: prerelease, draft
- name: Upload to release
id: upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: source.tar.gz
asset_name: source-${{ steps.whatrelease.outputs.release }}.tar.gz
tag: ${{ steps.whatrelease.outputs.release }}
overwrite: true

6
.gitignore vendored
View File

@@ -10,8 +10,10 @@ CTestTestfile.cmake
_deps
build/
result
result*
/.vscode/
.envrc
.cache
*.o
*-protocol.c
@@ -22,4 +24,4 @@ hyprctl/hyprctl
gmon.out
*.out
*.tar.gz
*.tar.gz

3
.gitmodules vendored Normal file
View File

@@ -0,0 +1,3 @@
[submodule "wlroots"]
path = subprojects/wlroots
url = https://gitlab.freedesktop.org/wlroots/wlroots.git

View File

@@ -35,13 +35,14 @@ execute_process(
#
#
include_directories(.)
add_compile_options(-std=c++20 -DWLR_USE_UNSTABLE )
include_directories(. PRIVATE "subprojects/wlroots/include/")
include_directories(. PRIVATE "subprojects/wlroots/build/include/")
add_compile_options(-std=c++23 -DWLR_USE_UNSTABLE )
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing)
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-server wayland-client wayland-cursor wayland-protocols cairo pango pangocairo libdrm egl xkbcommon wlroots libinput xcb)
pkg_check_modules(deps REQUIRED IMPORTED_TARGET wayland-server wayland-client wayland-cursor wayland-protocols cairo pango pangocairo libdrm egl xkbcommon libinput xcb) # we do not check for wlroots, as we provide it ourselves
file(GLOB_RECURSE SRCFILES "src/*.cpp")
@@ -59,8 +60,9 @@ ENDIF(NO_XWAYLAND MATCHES true)
IF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
message(STATUS "Configuring Hyprland in Debug with CMake!")
add_definitions( -DHYPRLAND_DEBUG )
ELSE()
# add_compile_options(-O3) # may crash for some
add_compile_options( -O3 )
message(STATUS "Configuring Hyprland in Release with CMake!")
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
@@ -78,7 +80,7 @@ include(CPack)
target_link_libraries(Hyprland PkgConfig::deps)
target_link_libraries(Hyprland
wlroots
${CMAKE_SOURCE_DIR}/subprojects/wlroots/build/libwlroots.so.11032 # wlroots is provided by us
pixman-1
OpenGL
GLESv2

101
Makefile
View File

@@ -9,6 +9,8 @@ PKGS = wlroots wayland-server xcb xkbcommon libinput
CFLAGS += $(foreach p,$(PKGS),$(shell pkg-config --cflags $(p)))
LDLIBS += $(foreach p,$(PKGS),$(shell pkg-config --libs $(p)))
DATE=$(shell date "+%d %b %Y")
xdg-shell-protocol.h:
$(WAYLAND_SCANNER) server-header \
$(WAYLAND_PROTOCOLS)/stable/xdg-shell/xdg-shell.xml $@
@@ -59,6 +61,16 @@ pointer-constraints-unstable-v1-protocol.c:
pointer-constraints-unstable-v1-protocol.o: pointer-constraints-unstable-v1-protocol.h
tablet-unstable-v2-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/tablet-unstable-v2.xml $@
tablet-unstable-v2-protocol.c:
$(WAYLAND_SCANNER) private-code \
protocols/tablet-unstable-v2.xml $@
tablet-unstable-v2-protocol.o: tablet-unstable-v2-protocol.h
idle-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/idle.xml $@
@@ -69,26 +81,37 @@ idle-protocol.c:
idle-protocol.o: idle-protocol.h
wlr-output-power-management-unstable-v1-protocol.h:
$(WAYLAND_SCANNER) server-header \
protocols/wlr-output-power-management-unstable-v1.xml $@
wlr-output-power-management-unstable-v1-protocol.c:
$(WAYLAND_SCANNER) private-code \
protocols/wlr-output-power-management-unstable-v1.xml $@
wlr-output-power-management-unstable-v1-protocol.o: wlr-output-power-management-unstable-v1-protocol.h
legacyrenderer:
mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DLEGACY_RENDERER:STRING=true -H./ -B./build -G Ninja
cmake --build ./build --config Release --target all -j 10
cmake --build ./build --config Release --target all -j $(nproc)
legacyrendererdebug:
mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DLEGACY_RENDERER:STRING=true -H./ -B./build -G Ninja
cmake --build ./build --config Release --target all -j 10
cmake --build ./build --config Release --target all -j $(nproc)
release:
mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -H./ -B./build -G Ninja
cmake --build ./build --config Release --target all -j 10
cmake --build ./build --config Release --target all -j $(nproc)
debug:
mkdir -p build && cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -H./ -B./build -G Ninja
cmake --build ./build --config Debug --target all -j 10
cmake --build ./build --config Debug --target all -j $(nproc)
clear:
rm -rf build
rm -f *.o *-protocol.h *-protocol.c
rm -f ./hyprctl/hyprctl
rm -rf ./subprojects/wlroots/build
all:
make config
@@ -96,9 +119,15 @@ all:
cd ./hyprctl && make all && cd ..
install:
make all
mkdir -p ${PREFIX}/share/wayland-sessions
cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions/
make clear
make fixwlr
cd ./subprojects/wlroots && meson build/ --buildtype=release && ninja -C build/ && cp ./build/libwlroots.so.11032 /usr/lib/ && cd ../..
make protocols
make release
cd hyprctl && make all && cd ..
mkdir -p /usr/share/wayland-sessions
cp ./example/hyprland.desktop /usr/share/wayland-sessions/
mkdir -p ${PREFIX}/bin
cp ./build/Hyprland ${PREFIX}/bin
cp ./hyprctl/hyprctl ${PREFIX}/bin
@@ -107,10 +136,66 @@ install:
cp ./assets/wall_4K.png ${PREFIX}/share/hyprland
cp ./assets/wall_8K.png ${PREFIX}/share/hyprland
install -Dm644 -t ${PREFIX}/share/man/man1 ./docs/*.1
cleaninstall:
make clear
make fixwlr
cd ./subprojects/wlroots && meson build/ --buildtype=release && ninja -C build/ && cp ./build/libwlroots.so.11032 /usr/lib/ && cd ../..
make protocols
make release
cd hyprctl && make all && cd ..
mkdir -p /usr/share/wayland-sessions
mkdir -p ${PREFIX}/bin
cp ./build/Hyprland ${PREFIX}/bin
cp ./hyprctl/hyprctl ${PREFIX}/bin
mkdir -p ${PREFIX}/share/hyprland
cp ./assets/wall_2K.png ${PREFIX}/share/hyprland
cp ./assets/wall_4K.png ${PREFIX}/share/hyprland
cp ./assets/wall_8K.png ${PREFIX}/share/hyprland
install -Dm644 -t ${PREFIX}/share/man/man1 ./docs/*.1
uninstall:
rm -f ${PREFIX}/share/wayland-sessions/hyprland.desktop
rm -f ${PREFIX}/bin/Hyprland
rm -f ${PREFIX}/bin/hyprctl
rm -f /usr/lib/libwlroots.so.11032
rm -rf ${PREFIX}/share/hyprland
rm -f ${PREFIX}/share/man/man1/Hyprland.1
rm -f ${PREFIX}/share/man/man1/hyprctl.1
config: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o wlr-screencopy-unstable-v1-protocol.o idle-protocol.o ext-workspace-unstable-v1-protocol.o pointer-constraints-unstable-v1-protocol.o
protocols: xdg-shell-protocol.o wlr-layer-shell-unstable-v1-protocol.o wlr-screencopy-unstable-v1-protocol.o idle-protocol.o ext-workspace-unstable-v1-protocol.o pointer-constraints-unstable-v1-protocol.o tablet-unstable-v2-protocol.o wlr-output-power-management-unstable-v1-protocol.o
fixwlr:
sed -i -E 's/(soversion = 11)([^032]|$$)/soversion = 11032/g' subprojects/wlroots/meson.build
rm -rf ./subprojects/wlroots/build
config:
make protocols
make fixwlr
cd subprojects/wlroots && meson ./build --prefix=/usr --buildtype=release
cd subprojects/wlroots && ninja -C build/
cd subprojects/wlroots && ninja -C build/ install
man:
pandoc ./docs/Hyprland.1.rst \
--standalone \
--variable=header:"Hyprland User Manual" \
--variable=date:"${DATE}" \
--variable=section:1 \
--from rst \
--to man > ./docs/Hyprland.1
pandoc ./docs/hyprctl.1.rst \
--standalone \
--variable=header:"hyprctl User Manual" \
--variable=date:"${DATE}" \
--variable=section:1 \
--from rst \
--to man > ./docs/hyprctl.1

View File

@@ -1,6 +1,6 @@
<div align = center>
![Banner]
<img src="https://raw.githubusercontent.com/vaxerski/Hyprland/main/assets/header.svg" width="750" height="300" alt="banner">
<br>
@@ -17,8 +17,7 @@
Hyprland is a dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks.
For Hyprland without the `land` part, see [Hypr], the Xorg window manager.
It supports multiple layouts, fancy effects, has a very flexible IPC model allowing for a lot of customization, and more.
<br>
<br>
@@ -37,10 +36,9 @@ For Hyprland without the `land` part, see [Hypr], the Xorg window manager.
# Notice
This project is still in its early development, expect bugs.
Once you get it working though, it's pretty stable.<br/>
Hyprland is still in pretty early development compared to some other Wayland compositors.
Although Hyprland is pretty stable, it may have some bugs.
### Help Wanted
@@ -51,18 +49,27 @@ Try it out and report bugs / suggestions!
- Easily expandable and readable codebase
- Config reloaded instantly upon saving
- Bezier-curve window animations
- Custom bezier curve based animations
- Workspaces protocol support
- `wlr_ext` workspaces protocol support
- Dual Kawase blur
- Window fade in / out
- Tiling/floating/fullscreen windows
- Window/monitor rules
- Drop shadows
- Fully dynamic workspaces
- Closely follows `wlroots-git`
- Global keybinds passed to your apps of choice
- Bundled wlroots
- Window/layer fade in/out
- Tiling/pseudotiling/floating/fullscreen windows
- Switching workspaces between window modes on the fly
- Special workspace (scratchpad)
- Window/monitor rules
- Socket-based IPC
- Event system for bash scripts
- Rounded corners
- Damage tracking(*Experimental*)
- Moving/resizing
- Full damage tracking
- Docks support
- Drawing tablet support
- Native IME + Input panels support
- and much more...
<br>
<br>
@@ -116,18 +123,18 @@ Try it out and report bugs / suggestions!
<!----------------------------------------------------------------------------->
[Configure]: https://github.com/vaxerski/Hyprland/wiki/Configuring-Hyprland
[Configure]: https://wiki.hyprland.org/Configuring/Configuring-Hyprland/
[Discord]: https://discord.gg/hQ9XvMUjjr
[Stars]: https://starchart.cc/vaxerski/Hyprland
[Hypr]: https://github.com/vaxerski/Hypr
[Stars]: https://starchart.cc/hyprwm/Hyprland
[Hypr]: https://github.com/hyprwm/Hypr
[Pull Requests]: https://github.com/vaxerski/Hyprland/pulls
[Issues]: https://github.com/vaxerski/Hyprland/issues
[Todo]: https://github.com/vaxerski/Hyprland/projects?type=beta
[Pull Requests]: https://github.com/hyprwm/Hyprland/pulls
[Issues]: https://github.com/hyprwm/Hyprland/issues
[Todo]: https://github.com/hyprwm/Hyprland/projects?type=beta
[Contribute]: docs/Contribute.md
[Install]: https://github.com/vaxerski/Hyprland/wiki/Installation
[Quick Start]: https://github.com/vaxerski/Hyprland/wiki/Quick-start
[Contribute]: https://wiki.hyprland.org/Contributing-and-Debugging/
[Install]: https://wiki.hyprland.org/Getting-Started/Installation/
[Quick Start]: https://wiki.hyprland.org/Getting-Started/Quick-start/
[License]: LICENSE
@@ -143,20 +150,19 @@ Try it out and report bugs / suggestions!
<!----------------------------------{ Images }--------------------------------->
[Stars Preview]: https://starchart.cc/vaxerski/Hyprland.svg
[Preview A]: https://i.imgur.com/NbrTnZH.png
[Preview B]: https://i.imgur.com/ZA4Fa8R.png
[Preview C]: https://i.imgur.com/BpXxM8H.png
[Banner]: https://raw.githubusercontent.com/vaxerski/Hyprland/main/assets/hyprland.png
[Preview A]: https://i.imgur.com/pC6YF1Y.png
[Preview B]: https://i.imgur.com/NbrTnZH.png
[Preview C]: https://i.imgur.com/sCafdKQ.png
<!----------------------------------{ Badges }--------------------------------->
[Badge Workflow]: https://github.com/vaxerski/Hyprland/actions/workflows/ci.yaml/badge.svg
[Badge Workflow]: https://github.com/hyprwm/Hyprland/actions/workflows/ci.yaml/badge.svg
[Badge Discord]: https://img.shields.io/badge/Join%20the-Discord%20server-6666ff
[Badge Issues]: https://img.shields.io/github/issues/vaxerski/Hyprland
[Badge Pull Requests]: https://img.shields.io/github/issues-pr/vaxerski/Hyprland
[Badge Language]: https://img.shields.io/github/languages/top/vaxerski/Hyprland
[Badge License]: https://img.shields.io/github/license/vaxerski/Hyprland
[Badge Lines]: https://img.shields.io/tokei/lines/github/vaxerski/Hyprland
[Badge Issues]: https://img.shields.io/github/issues/hyprwm/Hyprland
[Badge Pull Requests]: https://img.shields.io/github/issues-pr/hyprwm/Hyprland
[Badge Language]: https://img.shields.io/github/languages/top/hyprwm/Hyprland
[Badge License]: https://img.shields.io/github/license/hyprwm/Hyprland
[Badge Lines]: https://img.shields.io/tokei/lines/github/hyprwm/Hyprland
[Badge Hi Mom]: https://img.shields.io/badge/Hi-mom!-ff69b4

72
assets/header.svg Normal file

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 506 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 76 KiB

5
assets/meson.build Normal file
View File

@@ -0,0 +1,5 @@
wallpapers = ['wall_2K.png', 'wall_4K.png', 'wall_8K.png']
foreach wallpaper : wallpapers
install_data(wallpapers, install_dir: join_paths(get_option('datadir'), 'hyprland'), install_tag: 'runtime')
endforeach

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 227 KiB

After

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 231 KiB

After

Width:  |  Height:  |  Size: 146 KiB

View File

@@ -1,32 +0,0 @@
# Maintainer: ThatOneCalculator <kainoa@t1c.dev>
_pkgname="hyprland"
pkgname="${_pkgname}"
pkgver="0.1.1beta"
pkgrel=2
pkgdesc="Hyprland is a dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks."
arch=(any)
url="https://github.com/vaxerski/Hyprland"
license=('BSD')
depends=(libxcb xcb-proto xcb-util xcb-util-keysyms libxfixes libx11 libxcomposite xorg-xinput libxrender pixman wayland-protocols wlroots-git cairo pango)
makedepends=(git cmake ninja gcc gdb)
source=("${pkgname}-${pkgver}.tar.gz::https://github.com/vaxerski/hyprland/archive/v${pkgver}.tar.gz")
sha256sums=('SKIP')
options=(!makeflags !buildflags)
build() {
cd "$srcdir/Hyprland-$pkgver"
make all
}
package() {
cd "$srcdir/Hyprland-$pkgver"
mkdir -p "${pkgdir}/usr/share/wayland-sessions"
mkdir -p "${pkgdir}/usr/share/hyprland"
install -Dm755 build/Hyprland -t "${pkgdir}/usr/bin"
install -Dm755 hyprctl/hyprctl -t "${pkgdir}/usr/bin"
install -Dm644 assets/*.png -t "${pkgdir}/usr/share/hyprland"
install -Dm644 example/hyprland.desktop -t "${pkgdir}/usr/share/wayland-sessions"
install -Dm644 example/hyprland.conf -t "${pkgdir}/usr/share/hyprland"
install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${_pkgname}"
}

View File

@@ -1,40 +0,0 @@
# Maintainer: ThatOneCalculator <kainoa@t1c.dev>, Sander van Kasteel <info@sandervankasteel.nl>
_pkgname="hyprland"
pkgname="${_pkgname}-git"
pkgver=r568.g632d00c
pkgrel=1
pkgdesc="Hyprland is a dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks."
arch=(any)
url="https://github.com/vaxerski/Hyprland"
license=('BSD')
depends=(libxcb xcb-proto xcb-util xcb-util-keysyms libxfixes libx11 libxcomposite xorg-xinput libxrender pixman wayland-protocols wlroots-git cairo pango)
makedepends=(git cmake ninja gcc gdb)
source=("${_pkgname}::git+https://github.com/vaxerski/Hyprland.git")
sha256sums=('SKIP')
options=(!makeflags !buildflags)
pkgver() {
cd "$_pkgname"
( set -o pipefail
git describe --long 2>/dev/null | sed 's/\([^-]*-g\)/r\1/;s/-/./g' ||
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
)
}
build() {
cd "${srcdir}/${_pkgname}"
make all
}
package() {
cd "${srcdir}/${_pkgname}"
mkdir -p "${pkgdir}/usr/share/wayland-sessions"
mkdir -p "${pkgdir}/usr/share/hyprland"
install -Dm755 build/Hyprland -t "${pkgdir}/usr/bin"
install -Dm755 hyprctl/hyprctl -t "${pkgdir}/usr/bin"
install -Dm644 assets/*.png -t "${pkgdir}/usr/share/hyprland"
install -Dm644 example/hyprland.desktop -t "${pkgdir}/usr/share/wayland-sessions"
install -Dm644 example/hyprland.conf -t "${pkgdir}/usr/share/hyprland"
install -Dm644 LICENSE -t "${pkgdir}/usr/share/licenses/${_pkgname}"
}

View File

@@ -1,84 +0,0 @@
{
lib,
stdenv,
fetchFromGitHub,
pkg-config,
cmake,
ninja,
libdrm,
libinput,
libxcb,
libxkbcommon,
mesa,
mount,
pango,
wayland,
wayland-protocols,
wayland-scanner,
wlroots,
xcbutilwm,
xwayland,
enableXWayland ? true,
version ? "git",
}:
stdenv.mkDerivation {
pname = "hyprland";
inherit version;
src = ./.;
nativeBuildInputs = [
cmake
ninja
pkg-config
];
buildInputs =
[
libdrm
libinput
libxcb
libxkbcommon
mesa
pango
wayland
wayland-protocols
wayland-scanner
(wlroots.override {inherit enableXWayland;})
xcbutilwm
]
++ lib.optional enableXWayland xwayland;
cmakeFlags =
["-DCMAKE_BUILD_TYPE=Release"]
++ lib.optional (!enableXWayland) "-DNO_XWAYLAND=true";
prePatch = ''
make config
'';
postBuild = ''
pushd ../hyprctl
make all
popd
'';
installPhase = ''
pushd ..
install -Dm644 ./example/hyprland.desktop -t $out/share/wayland-sessions
install -Dm755 ./build/Hyprland -t $out/bin
install -Dm755 ./hyprctl/hyprctl -t $out/bin
install -Dm644 ./assets/* -t $out/share/hyprland
install -Dm644 ./example/hyprland.conf -t $out/share/hyprland
popd
'';
passthru.providedSessions = ["hyprland"];
meta = with lib; {
homepage = "https://github.com/vaxerski/Hyprland";
description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
license = licenses.bsd3;
platforms = platforms.linux;
mainProgram = "Hyprland";
};
}

View File

@@ -1,32 +0,0 @@
# Contributing
*Thank you for considering contributing to Hyprland.*
## Development
Check the[Wiki]for debugging instructions.
Afterwards, pick yourself an[Issue] orimplement your own suggestion.
An good place to search for things to contribute is the [Projects Page]
*As Hyprlandis still in its early stages of development, I'd recommend you stick to bug fixes first.*
## Pull Requests
- Please follow the code style
- Code must be readable
- Features should be useful
- Test your changes!
*Run it on bare metal and check if everything works.*
<!----------------------------------------------------------------------------->
[Issue]: https://github.com/vaxerski/Hyprland/issues
[Wiki]: https://github.com/vaxerski/Hyprland/wiki/Contributing-&-Debugging
[Projects page]: https://github.com/vaxerski/Hyprland/projects?type=beta

46
docs/Hyprland.1 Normal file
View File

@@ -0,0 +1,46 @@
.\" Automatically generated by Pandoc 2.5
.\"
.TH "Hyprland" "1" "24 Aug 2022" "" "Hyprland User Manual"
.hy
.SH NAME
.PP
Hyprland \- Dynamic tiling Wayland compositor
.SH SYNOPSIS
.PP
\f[B]Hyprland\f[R] [\f[I]arg [...]\f[R]].
.SH DESCRIPTION
.PP
\f[B]Hyprland\f[R] is a dynamic tiling Wayland compositor based on
wlroots that doesn\[aq]t sacrifice on its looks.
.PP
You can launch Hyprland by either going into a TTY and executing
\f[B]Hyprland\f[R], or with a login manager.
.SH NOTICE
.PP
Hyprland is still in pretty early development compared to some other
Wayland compositors.
.PP
Although Hyprland is pretty stable, it may have some bugs.
.SH CONFIGURATION
.PP
For configuration information please see
<\f[I]https://github.com/hyprwm/Hyprland/wiki\f[R]>.
.SH OPTIONS
.TP
.B \f[B]\-h\f[R], \f[B]\-\-help\f[R]
Show command usage.
.TP
.B \f[B]\-c\f[R], \f[B]\-\-config\f[R]
Specify config file to use.
.SH BUGS
.TP
.B Submit bug reports and request features online at:
<\f[I]https://github.com/hyprwm/Hyprland/issues\f[R]>
.SH SEE ALSO
.PP
Sources at: <\f[I]https://github.com/hyprwm/Hyprland\f[R]>
.SH COPYRIGHT
.PP
Copyright (c) 2022, vaxerski
.SH AUTHORS
Vaxerski <\f[I]https://github.com/vaxerski\f[R]>.

58
docs/Hyprland.1.rst Normal file
View File

@@ -0,0 +1,58 @@
:title: Hyprland
:author: Vaxerski <*https://github.com/vaxerski*>
NAME
====
Hyprland - Dynamic tiling Wayland compositor
SYNOPSIS
========
**Hyprland** [*arg [...]*].
DESCRIPTION
===========
**Hyprland** is a dynamic tiling Wayland compositor based on
wlroots that doesn't sacrifice on its looks.
You can launch Hyprland by either going into a TTY and
executing **Hyprland**, or with a login manager.
NOTICE
======
Hyprland is still in pretty early development compared to some other Wayland compositors.
Although Hyprland is pretty stable, it may have some bugs.
CONFIGURATION
=============
For configuration information please see <*https://github.com/hyprwm/Hyprland/wiki*>.
OPTIONS
=======
**-h**, **--help**
Show command usage.
**-c**, **--config**
Specify config file to use.
BUGS
====
Submit bug reports and request features online at:
<*https://github.com/hyprwm/Hyprland/issues*>
SEE ALSO
========
Sources at: <*https://github.com/hyprwm/Hyprland*>
COPYRIGHT
=========
Copyright (c) 2022, vaxerski

59
docs/ISSUE_GUIDELINES.md Normal file
View File

@@ -0,0 +1,59 @@
# Issue Guidelines
First of all, please remember to:
- Check that your issue is not a duplicate
- Read the [FAQ](https://github.com/vaxerski/Hyprland/wiki/FAQ)
- Read the [Configuring Page](https://github.com/vaxerski/Hyprland/wiki/Configuring-Hyprland)
<br/>
# Reporting suggestions
Suggestions are welcome.
Many features can be implemented using bash scripts and Hyprland sockets, read up on those [Here](https://github.com/vaxerski/Hyprland/wiki/IPC). Please do not suggest features that can be implemented as such.
<br/>
# Reporting bugs
All bug reports should have the following:
- Steps to reproduce
- Expected outcome
- Noted outcome
If your bug is one that doesn't crash Hyprland, but feels like invalid behavior, that's all you need to say.
If your bug crashes Hyprland, append additionally:
- The Hyprland log
- Coredump / Coredump analysis (with a stacktrace)
- Your config
**Important**: Please do NOT use any package for reporting bugs! Clone and compile from source.
## Obtaining the Hyprland log
If you are in a TTY, and the hyprland session that crashed was the last one you launched, the log will be printed with
```
cat /tmp/hypr/$(ls -t /tmp/hypr/ | head -n 1)/hyprland.log
```
feel free to send it to a file, save, copy, etc.
if you are in a Hyprland session, and you want the log of the last session, use
```
cat /tmp/hypr/$(ls -t /tmp/hypr/ | head -n 2 | tail -n 1)/hyprland.log
```
basically, directories in /tmp/hypr are your sessions.
## Obtaining the Hyprland coredump
If you are on systemd, you can simply use
```
coredumpctl
```
then go to the end (press END on your keyboard) and remember the PID of the last `Hyprland` occurrence. It's the first number after the time, for example `2891`.
exit coredumpctl (ctrl+c) and use
```
coredumpctl info [PID]
```
where `[PID]` is the PID you remembered.

View File

@@ -1,35 +0,0 @@
# Installation
## Packages
*I do not maintain any packages, but some kind people have made them for me.*
**If I missed any, please let me know.**
## Notice
Since I am not the maintainer, I cannot guarantee that those packages will always work and be up to date.
***Use at your own disclosure.*** <br>
*If they don't work, try building manually.*
#### Arch(AUR/-git)
```sh
yay -S hyprland-git
```
---
## Building / No XWayland / other
If your distro doesn't have **Hyprland** in its repositories, you want to modify it, or use custom build flags, please refer to the **[Wiki Page][Install]** for the installation instructions.
<!----------------------------------------------------------------------------->
[Install]: https://github.com/vaxerski/Hyprland/wiki/Installation

145
docs/hyprctl.1 Normal file
View File

@@ -0,0 +1,145 @@
.\" Automatically generated by Pandoc 2.5
.\"
.TH "hyprctl" "1" "24 Aug 2022" "" "hyprctl User Manual"
.hy
.SH NAME
.PP
hyprctl \- Utility for controlling parts of Hyprland from a CLI or a
script
.SH SYNOPSIS
.PP
\f[B]hyprctl\f[R] [\f[I](opt)flags\f[R]] [\f[B]command\f[R]]
[\f[I](opt)args\f[R]]
.SH DESCRIPTION
.PP
\f[B]hyprctl\f[R] is a utility for controlling some parts of the
compositor from a CLI or a script.
.SH CONTROL COMMANDS
.PP
\f[B]dispatch\f[R]
.RS
.PP
Call a dispatcher with an argument.
.PP
An argument must be present.
For dispatchers without parameters it can be anything.
.PP
Returns: \f[I]ok\f[R] on success, and an error message on failure.
.TP
.B Examples:
\f[B]hyprctl\f[R] \f[I]dispatch exec kitty\f[R]
.RS
.PP
\f[B]hyprctl\f[R] \f[I]dispatch pseudo x\f[R]
.RE
.RE
.PP
\f[B]keyword\f[R]
.RS
.PP
Set a config keyword dynamically.
.PP
Returns: \f[I]ok\f[R] on success, and an error message on failure.
.TP
.B Examples:
\f[B]hyprctl\f[R] \f[I]keyword bind SUPER,0,pseudo\f[R]
.RS
.PP
\f[B]hyprctl\f[R] \f[I]keyword general:border_size 10\f[R]
.RE
.RE
.PP
\f[B]reload\f[R]
.RS
.PP
Force a reload of the config file.
.RE
.PP
\f[B]kill\f[R]
.RS
.PP
Enter kill mode, where you can kill an app by clicking on it.
You can exit by pressing ESCAPE.
.RE
.SH INFO COMMANDS
.PP
\f[B]version\f[R]
.RS
.PP
Prints the Hyprland version, flags, commit and branch of build.
.RE
.PP
\f[B]monitors\f[R]
.RS
.PP
Lists all the outputs with their properties.
.RE
.PP
\f[B]workspaces\f[R]
.RS
.PP
Lists all workspaces with their properties.
.RE
.PP
\f[B]clients\f[R]
.RS
.PP
Lists all windows with their properties.
.RE
.PP
\f[B]devices\f[R]
.RS
.PP
Lists all connected input devices.
.RE
.PP
\f[B]activewindow\f[R]
.RS
.PP
Returns the active window name.
.RE
.PP
\f[B]layers\f[R]
.RS
.PP
Lists all the layers.
.RE
.PP
\f[B]splash\f[R]
.RS
.PP
Returns the current random splash.
.RE
.SH OPTIONS
.PP
\f[B]\-\-batch\f[R]
.RS
.PP
Specify a batch of commands to execute.
.TP
.B Example:
\f[B]hyprctl\f[R] \f[I]\-\-batch \[dq]keyword general:border_size 2 ;
keyword general:gaps_out 20\[dq]\f[R]
.RS
.PP
\f[I];\f[R] separates the commands.
.RE
.RE
.PP
\f[B]\-j\f[R]
.RS
.PP
Outputs information in JSON.
.RE
.SH BUGS
.TP
.B Submit bug reports and request features online at:
<\f[I]https://github.com/hyprwm/Hyprland/issues\f[R]>
.SH SEE ALSO
.PP
Sources at: <\f[I]https://github.com/hyprwm/Hyprland\f[R]>
.SH COPYRIGHT
.PP
Copyright (c) 2022, vaxerski
.SH AUTHORS
Vaxerski <\f[I]https://github.com/vaxerski\f[R]>.

121
docs/hyprctl.1.rst Normal file
View File

@@ -0,0 +1,121 @@
:title: hyprctl(1)
:author: Vaxerski <*https://github.com/vaxerski*>
NAME
====
hyprctl - Utility for controlling parts of Hyprland from a CLI or a script
SYNOPSIS
========
**hyprctl** [*(opt)flags*] [**command**] [*(opt)args*]
DESCRIPTION
===========
**hyprctl** is a utility for controlling some parts of the compositor from a CLI or a script.
CONTROL COMMANDS
================
**dispatch**
Call a dispatcher with an argument.
An argument must be present.
For dispatchers without parameters it can be anything.
Returns: *ok* on success, and an error message on failure.
Examples:
**hyprctl** *dispatch exec kitty*
**hyprctl** *dispatch pseudo x*
**keyword**
Set a config keyword dynamically.
Returns: *ok* on success, and an error message on failure.
Examples:
**hyprctl** *keyword bind SUPER,0,pseudo*
**hyprctl** *keyword general:border_size 10*
**reload**
Force a reload of the config file.
**kill**
Enter kill mode, where you can kill an app by clicking on it.
You can exit by pressing ESCAPE.
INFO COMMANDS
=============
**version**
Prints the Hyprland version, flags, commit and branch of build.
**monitors**
Lists all the outputs with their properties.
**workspaces**
Lists all workspaces with their properties.
**clients**
Lists all windows with their properties.
**devices**
Lists all connected input devices.
**activewindow**
Returns the active window name.
**layers**
Lists all the layers.
**splash**
Returns the current random splash.
OPTIONS
=======
**--batch**
Specify a batch of commands to execute.
Example:
**hyprctl** *--batch "keyword general:border_size 2 ; keyword general:gaps_out 20"*
*;* separates the commands.
**-j**
Outputs information in JSON.
BUGS
====
Submit bug reports and request features online at:
<*https://github.com/hyprwm/Hyprland/issues*>
SEE ALSO
========
Sources at: <*https://github.com/hyprwm/Hyprland*>
COPYRIGHT
=========
Copyright (c) 2022, vaxerski

2
docs/meson.build Normal file
View File

@@ -0,0 +1,2 @@
install_man ('Hyprland.1')
install_man ('hyprctl.1')

View File

@@ -3,10 +3,16 @@
#
# Refer to the wiki for more information.
monitor=,1280x720@60,0x0,1
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki (basic and advanced configuring)
#
monitor=,preferred,auto,1
workspace=DP-1,1
input {
kb_file=
kb_layout=
kb_variant=
kb_model=
@@ -14,37 +20,39 @@ input {
kb_rules=
follow_mouse=1
touchpad {
natural_scroll=no
}
sensitivity=0 # -1.0 - 1.0, 0 means no modification.
}
general {
max_fps=60 # deprecated, unused
sensitivity=0.25
main_mod=SUPER
gaps_in=5
gaps_out=20
border_size=2
col.active_border=0x66ee1111
col.inactive_border=0x66333333
damage_tracking=full # experimental, monitor is 100% fine, but full might have some minor bugs, especially with high blur settings!
apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse)
damage_tracking=full # leave it on full unless you hate your GPU and want to make it suffer
}
decoration {
rounding=10
blur=1
blur_size=3 # minimum 1
blur_passes=1 # minimum 1, more passes = more resource intensive.
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
# if you want heavy blur, you need to up the blur_passes.
# the more passes, the more you can up the blur_size without noticing artifacts.
blur_passes=1 # minimum 1
blur_new_optimizations=1
}
animations {
enabled=1
animation=windows,1,7,default
animation=borders,1,10,default
animation=fadein,1,10,default
animation=border,1,10,default
animation=fade,1,10,default
animation=workspaces,1,6,default
}
@@ -52,6 +60,10 @@ dwindle {
pseudotile=0 # enable pseudotiling on dwindle
}
gestures {
workspace_swipe=no
}
# example window rules
# for windows named/classed as abc and xyz
#windowrule=move 69 420,abc
@@ -61,6 +73,10 @@ dwindle {
#windowrule=pseudo,abc
#windowrule=monitor 0,xyz
# some nice mouse binds
bindm=SUPER,mouse:272,movewindow
bindm=SUPER,mouse:273,resizewindow
# example binds
bind=SUPER,Q,exec,kitty
bind=SUPER,C,killactive,
@@ -95,4 +111,7 @@ bind=ALT,6,movetoworkspace,6
bind=ALT,7,movetoworkspace,7
bind=ALT,8,movetoworkspace,8
bind=ALT,9,movetoworkspace,9
bind=ALT,0,movetoworkspace,10
bind=ALT,0,movetoworkspace,10
bind=SUPER,mouse_down,workspace,e+1
bind=SUPER,mouse_up,workspace,e-1

2
example/meson.build Normal file
View File

@@ -0,0 +1,2 @@
install_data('hyprland.conf', install_dir: join_paths(get_option('datadir'), 'hyprland'), install_tag: 'runtime')
install_data('hyprland.desktop', install_dir: join_paths(get_option('datadir'), 'wayland-sessions'), install_tag: 'runtime')

12
flake.lock generated
View File

@@ -2,11 +2,11 @@
"nodes": {
"nixpkgs": {
"locked": {
"lastModified": 1653581809,
"narHash": "sha256-Uvka0V5MTGbeOfWte25+tfRL3moECDh1VwokWSZUdoY=",
"lastModified": 1664687381,
"narHash": "sha256-9czSuDzS+OGGwq2kC4KXBLXWfYaup+oLB+AA1Md25U4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "83658b28fe638a170a19b8933aa008b30640fbd1",
"rev": "59d2991d4256cdca1c0cda45d876c80a0fe45c31",
"type": "github"
},
"original": {
@@ -26,11 +26,11 @@
"flake": false,
"locked": {
"host": "gitlab.freedesktop.org",
"lastModified": 1653733431,
"narHash": "sha256-0JwNH2E9XlMVa7ZCsqxazpKwpZ2rW5QQjbk0DdZxa48=",
"lastModified": 1664816798,
"narHash": "sha256-oLJyFT1Fc4UNNaDSN+EYUAWL4CufCBpuS5AV4Z4XANo=",
"owner": "wlroots",
"repo": "wlroots",
"rev": "93ee4c7684050807e959bb3b6d57826a72fba8c2",
"rev": "50cc1ef4d3791d86854dd83c15fff17e5ea1a5b6",
"type": "gitlab"
},
"original": {

View File

@@ -16,40 +16,83 @@
}: let
inherit (nixpkgs) lib;
genSystems = lib.genAttrs [
# Add more systems if they are supported
"aarch64-linux"
"x86_64-linux"
];
pkgsFor = nixpkgs.legacyPackages;
# https://github.com/NixOS/rfcs/pull/107
mkVersion = longDate:
lib.concatStrings [
"0.pre"
"+date="
(lib.concatStringsSep "-" [
(__substring 0 4 longDate)
(__substring 4 2 longDate)
(__substring 6 2 longDate)
])
];
in {
packages = genSystems (system: {
wlroots = pkgsFor.${system}.wlroots.overrideAttrs (prev: {
version = mkVersion inputs.wlroots.lastModifiedDate;
src = inputs.wlroots;
pkgsFor = genSystems (system:
import nixpkgs {
inherit system;
overlays = [
(_: prev: {
libdrm = prev.libdrm.overrideAttrs (old: rec {
version = "2.4.113";
src = prev.fetchurl {
url = "https://dri.freedesktop.org/${old.pname}/${old.pname}-${version}.tar.xz";
sha256 = "sha256-f9frKWf2O+tGBvItUOJ32ZNIDQXvdd2Iqb2OZ3Mj5eE=";
};
mesonFlags =
[
"-Dinstall-test-programs=true"
"-Domap=enabled"
"-Dcairo-tests=disabled"
]
++ lib.optionals prev.stdenv.hostPlatform.isAarch [
"-Dtegra=enabled"
"-Detnaviv=enabled"
];
});
})
];
});
default = pkgsFor.${system}.callPackage ./default.nix {
version = mkVersion self.lastModifiedDate;
inherit (self.packages.${system}) wlroots;
mkDate = longDate: (lib.concatStringsSep "-" [
(__substring 0 4 longDate)
(__substring 4 2 longDate)
(__substring 6 2 longDate)
]);
in {
overlays.default = _: prev: rec {
wlroots-hyprland = prev.callPackage ./nix/wlroots.nix {
version = mkDate (inputs.wlroots.lastModifiedDate or "19700101") + "_" + (inputs.wlroots.shortRev or "dirty");
src = inputs.wlroots;
};
hyprland = prev.callPackage ./nix/default.nix {
stdenv = prev.gcc12Stdenv;
version = "0.14.0beta" + "+date=" + (mkDate (self.lastModifiedDate or "19700101")) + "_" + (self.shortRev or "dirty");
wlroots = wlroots-hyprland;
};
hyprland-debug = hyprland.override {debug = true;};
hyprland-no-hidpi = hyprland.override {hidpiXWayland = false;};
waybar-hyprland = prev.waybar.overrideAttrs (oldAttrs: {
mesonFlags = oldAttrs.mesonFlags ++ ["-Dexperimental=true"];
});
};
packages = genSystems (system:
(self.overlays.default null pkgsFor.${system})
// {
default = self.packages.${system}.hyprland;
});
devShells = genSystems (system: {
default = pkgsFor.${system}.mkShell.override {stdenv = pkgsFor.${system}.gcc12Stdenv;} {
name = "hyprland-shell";
inputsFrom = [
self.packages.${system}.wlroots-hyprland
self.packages.${system}.hyprland
];
};
});
formatter = genSystems (system: pkgsFor.${system}.alejandra);
nixosModules.default = import ./module.nix self;
nixosModules.default = import ./nix/module.nix self;
homeManagerModules.default = import ./nix/hm-module.nix self;
};
# Deprecated
overlays.default = _: prev: {
hyprland = self.packages.${prev.system}.default;
};
overlay = self.overlays.default;
nixConfig = {
extra-substituters = ["https://hyprland.cachix.org"];
extra-trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
};
}

View File

@@ -1,4 +1,4 @@
clean:
rm -rf ./hyprctl ./hyprctl
all:
g++ -std=c++20 ./main.cpp -o ./hyprctl
g++ -std=c++23 ./main.cpp -o ./hyprctl
clean:
rm ./hyprctl

View File

@@ -9,24 +9,37 @@
#include <sys/types.h>
#include <sys/un.h>
#include <unistd.h>
#include <ranges>
#include <algorithm>
#include <iostream>
#include <string>
#include <fstream>
#include <string>
#include <deque>
const std::string USAGE = R"#(
usage: hyprctl [command] [(opt)args]
const std::string USAGE = R"#(usage: hyprctl [(opt)flags] [command] [(opt)args]
commands:
monitors
workspaces
clients
activewindow
layers
devices
dispatch
keyword
version
kill
splash
hyprpaper
reload
setcursor
getoption
flags:
-j -> output in JSON
--batch -> execute a batch of commands, separated by ';'
)#";
void request(std::string arg) {
@@ -37,19 +50,26 @@ void request(std::string arg) {
return;
}
const auto SERVER = gethostbyname("localhost");
if (!SERVER) {
std::cout << "Couldn't get host (2)";
// get the instance signature
auto instanceSig = getenv("HYPRLAND_INSTANCE_SIGNATURE");
if (!instanceSig) {
std::cout << "HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)";
return;
}
std::string instanceSigStr = std::string(instanceSig);
sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;
strcpy(serverAddress.sun_path, "/tmp/hypr/.socket.sock");
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.socket.sock";
strcpy(serverAddress.sun_path, socketPath.c_str());
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
std::cout << "Couldn't connect to /tmp/hypr/.socket.sock. (3) Is Hyprland running?";
std::cout << "Couldn't connect to " << socketPath << ". (3)";
return;
}
@@ -62,7 +82,58 @@ void request(std::string arg) {
char buffer[8192] = {0};
sizeWritten = read(SERVERSOCKET,buffer, 8192);
sizeWritten = read(SERVERSOCKET, buffer, 8192);
if (sizeWritten < 0) {
std::cout << "Couldn't read (5)";
return;
}
close(SERVERSOCKET);
std::cout << std::string(buffer);
}
void requestHyprpaper(std::string arg) {
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
if (SERVERSOCKET < 0) {
std::cout << "Couldn't open a socket (1)";
return;
}
// get the instance signature
auto instanceSig = getenv("HYPRLAND_INSTANCE_SIGNATURE");
if (!instanceSig) {
std::cout << "HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)";
return;
}
std::string instanceSigStr = std::string(instanceSig);
sockaddr_un serverAddress = {0};
serverAddress.sun_family = AF_UNIX;
std::string socketPath = "/tmp/hypr/" + instanceSigStr + "/.hyprpaper.sock";
strcpy(serverAddress.sun_path, socketPath.c_str());
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
std::cout << "Couldn't connect to " << socketPath << ". (3)";
return;
}
auto sizeWritten = write(SERVERSOCKET, arg.c_str(), arg.length());
if (sizeWritten < 0) {
std::cout << "Couldn't write (4)";
return;
}
char buffer[8192] = {0};
sizeWritten = read(SERVERSOCKET, buffer, 8192);
if (sizeWritten < 0) {
std::cout << "Couldn't read (5)";
@@ -81,7 +152,10 @@ void dispatchRequest(int argc, char** argv) {
return;
}
std::string rq = "dispatch " + std::string(argv[2]) + " " + std::string(argv[3]);
std::string rq = "/dispatch";
for(int i = 2; i < argc; i++)
rq += " " + std::string(argv[i]);
request(rq);
}
@@ -92,39 +166,116 @@ void keywordRequest(int argc, char** argv) {
return;
}
std::string rq = "keyword " + std::string(argv[2]) + " " + std::string(argv[3]);
std::string rq = "/keyword";
for(int i = 2; i < argc; i++)
rq += " " + std::string(argv[i]);
request(rq);
}
void batchRequest(int argc, char** argv) {
std::string rq = "[[BATCH]]" + std::string(argv[2]);
void hyprpaperRequest(int argc, char** argv) {
if (argc < 4) {
std::cout << "hyprpaper requires 2 params";
return;
}
std::string rq = std::string(argv[2]) + " " + std::string(argv[3]);
requestHyprpaper(rq);
}
void setcursorRequest(int argc, char** argv) {
if (argc < 4) {
std::cout << "setcursor requires 2 params";
return;
}
std::string rq = "setcursor " + std::string(argv[2]) + " " + std::string(argv[3]);
request(rq);
}
void batchRequest(std::string arg) {
std::string rq = "[[BATCH]]" + arg.substr(arg.find_first_of(" ") + 1);
request(rq);
}
std::deque<std::string> splitArgs(int argc, char** argv) {
std::deque<std::string> result;
for (auto i = 1 /* skip the executable */; i < argc; ++i)
result.push_back(std::string(argv[i]));
return result;
}
bool isNumber(const std::string& str, bool allowfloat) {
return std::ranges::all_of(str.begin(), str.end(), [&](char c) { return isdigit(c) != 0 || c == '-' || (allowfloat && c == '.'); });
}
int main(int argc, char** argv) {
int bflag = 0, sflag = 0, index, c;
if (argc < 2) {
printf("%s", USAGE.c_str());
printf("%s\n", USAGE.c_str());
return 1;
}
if (!strcmp(argv[1], "monitors")) request("monitors");
else if (!strcmp(argv[1], "clients")) request("clients");
else if (!strcmp(argv[1], "workspaces")) request("workspaces");
else if (!strcmp(argv[1], "activewindow")) request("activewindow");
else if (!strcmp(argv[1], "layers")) request("layers");
else if (!strcmp(argv[1], "version")) request("version");
else if (!strcmp(argv[1], "reload")) request("reload");
else if (!strcmp(argv[1], "dispatch")) dispatchRequest(argc, argv);
else if (!strcmp(argv[1], "keyword")) keywordRequest(argc, argv);
else if (!strcmp(argv[1], "--batch")) batchRequest(argc, argv);
std::string fullRequest = "";
std::string fullArgs = "";
const auto ARGS = splitArgs(argc, argv);
for (auto i = 0; i < ARGS.size(); ++i) {
if (ARGS[i][0] == '-' && !isNumber(ARGS[i], true) /* For stuff like -2 */) {
// parse
if (ARGS[i] == "-j" && !fullArgs.contains("j")) {
fullArgs += "j";
} else if (ARGS[i] == "--batch") {
fullRequest = "--batch ";
} else {
printf("%s\n", USAGE.c_str());
return 1;
}
continue;
}
fullRequest += ARGS[i] + " ";
}
if (fullRequest.empty()) {
printf("%s\n", USAGE.c_str());
return 1;
}
fullRequest.pop_back(); // remove trailing space
fullRequest = fullArgs + "/" + fullRequest;
if (fullRequest.contains("/--batch")) batchRequest(fullRequest);
else if (fullRequest.contains("/monitors")) request(fullRequest);
else if (fullRequest.contains("/clients")) request(fullRequest);
else if (fullRequest.contains("/workspaces")) request(fullRequest);
else if (fullRequest.contains("/activewindow")) request(fullRequest);
else if (fullRequest.contains("/layers")) request(fullRequest);
else if (fullRequest.contains("/version")) request(fullRequest);
else if (fullRequest.contains("/kill")) request(fullRequest);
else if (fullRequest.contains("/splash")) request(fullRequest);
else if (fullRequest.contains("/devices")) request(fullRequest);
else if (fullRequest.contains("/reload")) request(fullRequest);
else if (fullRequest.contains("/getoption")) request(fullRequest);
else if (fullRequest.contains("/setcursor")) setcursorRequest(argc, argv);
else if (fullRequest.contains("/dispatch")) dispatchRequest(argc, argv);
else if (fullRequest.contains("/keyword")) keywordRequest(argc, argv);
else if (fullRequest.contains("/hyprpaper")) hyprpaperRequest(argc, argv);
else if (fullRequest.contains("/--help")) printf("%s", USAGE.c_str());
else {
printf("%s", USAGE.c_str());
printf("%s\n", USAGE.c_str());
return 1;
}
printf("\n");
return 0;
}
}

3
hyprctl/meson.build Normal file
View File

@@ -0,0 +1,3 @@
executable('hyprctl', 'main.cpp',
install: true
)

62
meson.build Normal file
View File

@@ -0,0 +1,62 @@
project('Hyprland', 'cpp', 'c',
version : '0.14.0beta',
default_options : [
'warning_level=2',
'default_library=static',
'optimization=3',
# 'cpp_std=c++23' # not yet supported by meson, as of version 0.63.0
])
# clang v14.0.6 uses C++2b instead of C++23, so we've gotta account for that
# replace the following with a project default option once meson gets support for C++23
cpp_compiler = meson.get_compiler('cpp')
if cpp_compiler.has_argument('-std=c++23')
add_global_arguments('-std=c++23', language: 'cpp')
elif cpp_compiler.has_argument('-std=c++2b')
add_global_arguments('-std=c++2b', language: 'cpp')
else
error('Could not configure current C++ compiler (' + cpp_compiler.get_id() + ' ' + cpp_compiler.version() + ') with required C++ standard (C++23)')
endif
GIT_BRANCH = run_command('git', 'rev-parse', '--abbrev-ref', 'HEAD', check: false).stdout().strip()
GIT_COMMIT_HASH = run_command('git', 'rev-parse', 'HEAD', check: false).stdout().strip()
GIT_COMMIT_MESSAGE = run_command('bash', '-c', 'git show | head -n 5 | tail -n 1', check: false).stdout().strip()
GIT_DIRTY = run_command('bash', '-c', 'git diff-index --quiet HEAD -- || echo "dirty"', check: false).stdout().strip()
add_project_arguments(
[
'-Wno-unused-parameter',
'-Wno-unused-value',
'-Wno-missing-field-initializers',
'-Wno-narrowing',
f'-DGIT_BRANCH="@GIT_BRANCH@"',
f'-DGIT_COMMIT_HASH="@GIT_COMMIT_HASH@"',
f'-DGIT_COMMIT_MESSAGE="@GIT_COMMIT_MESSAGE@"',
f'-DGIT_DIRTY="@GIT_DIRTY@"',
],
language: 'cpp')
wlroots = subproject('wlroots', default_options: ['examples=false'])
have_xwlr = wlroots.get_variable('features').get('xwayland')
xcb_dep = dependency('xcb', required: get_option('xwayland'))
if get_option('xwayland').enabled() and not have_xwlr
error('Cannot enable Xwayland in Hyprland: wlroots has been built without Xwayland support')
endif
have_xwayland = xcb_dep.found() and have_xwlr
if not have_xwayland
add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
endif
if get_option('buildtype') == 'debug'
add_project_arguments('-DHYPRLAND_DEBUG', language: 'cpp')
endif
subdir('protocols')
subdir('src')
subdir('hyprctl')
subdir('assets')
subdir('example')
subdir('docs')

1
meson_options.txt Normal file
View File

@@ -0,0 +1 @@
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')

106
nix/default.nix Normal file
View File

@@ -0,0 +1,106 @@
{
lib,
stdenv,
fetchFromGitHub,
fetchpatch,
pkg-config,
meson,
ninja,
git,
libdrm,
libinput,
libxcb,
libxkbcommon,
mesa,
mount,
pango,
wayland,
wayland-protocols,
wayland-scanner,
wlroots,
xcbutilwm,
xwayland,
debug ? false,
enableXWayland ? true,
hidpiXWayland ? true,
legacyRenderer ? false,
nvidiaPatches ? false,
version ? "git",
}: let
assertXWayland = lib.assertMsg (hidpiXWayland -> enableXWayland) ''
Hyprland: cannot have hidpiXWayland when enableXWayland is false.
'';
in
assert assertXWayland;
stdenv.mkDerivation {
pname = "hyprland" + lib.optionalString debug "-debug";
inherit version;
src = lib.cleanSourceWith {
filter = name: type: let
baseName = baseNameOf (toString name);
in
! (
lib.hasSuffix ".nix" baseName
);
src = lib.cleanSource ../.;
};
nativeBuildInputs = [
meson
ninja
pkg-config
];
outputs = [
"out"
"man"
];
buildInputs =
[
git
libdrm
libinput
libxcb
libxkbcommon
mesa
pango
wayland
wayland-protocols
wayland-scanner
(wlroots.override {inherit enableXWayland hidpiXWayland nvidiaPatches;})
xcbutilwm
]
++ lib.optional enableXWayland xwayland;
mesonBuildType =
if debug
then "debug"
else "release";
mesonFlags = builtins.concatLists [
(lib.optional (!enableXWayland) "-Dxwayland=disabled")
(lib.optional legacyRenderer "-DLEGACY_RENDERER:STRING=true")
];
patches = [
# make meson use the provided wlroots instead of the git submodule
./meson-build.patch
];
# Fix hardcoded paths to /usr installation
postPatch = ''
sed -i "s#/usr#$out#" src/render/OpenGL.cpp
'';
passthru.providedSessions = ["hyprland"];
meta = with lib; {
homepage = "https://github.com/vaxerski/Hyprland";
description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
license = licenses.bsd3;
platforms = platforms.linux;
mainProgram = "Hyprland";
};
}

135
nix/hm-module.nix Normal file
View File

@@ -0,0 +1,135 @@
self: {
config,
lib,
pkgs,
...
}: let
cfg = config.wayland.windowManager.hyprland;
defaultHyprlandPackage = self.packages.${pkgs.system}.default.override {
enableXWayland = cfg.xwayland.enable;
hidpiXWayland = cfg.xwayland.hidpi;
};
in {
options.wayland.windowManager.hyprland = {
enable = lib.mkEnableOption "hyprland wayland compositor";
package = lib.mkOption {
type = with lib.types; nullOr package;
default = defaultHyprlandPackage;
description = ''
Hyprland package to use. Will override the 'xwayland' option.
Defaults to the one provided by the flake. Set it to
<literal>pkgs.hyprland</literal> to use the one provided by nixpkgs or
if you have an overlay.
Set to null to not add any Hyprland package to your path. This should
be done if you want to use the NixOS module to install Hyprland.
'';
};
systemdIntegration = lib.mkOption {
type = lib.types.bool;
default = pkgs.stdenv.isLinux;
description = ''
Whether to enable <filename>hyprland-session.target</filename> on
hyprland startup. This links to <filename>graphical-session.target</filename>.
Some important environment variables will be imported to systemd
and dbus user environment before reaching the target, including
<itemizedlist>
<listitem><para><literal>DISPLAY</literal></para></listitem>
<listitem><para><literal>WAYLAND_DISPLAY</literal></para></listitem>
<listitem><para><literal>HYPRLAND_INSTANCE_SIGNATURE</literal></para></listitem>
<listitem><para><literal>XDG_CURRENT_DESKTOP</literal></para></listitem>
</itemizedlist>
'';
};
xwayland = {
enable = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enable XWayland.
'';
};
hidpi = lib.mkOption {
type = lib.types.bool;
default = true;
description = ''
Enable HiDPI XWayland.
'';
};
};
extraConfig = lib.mkOption {
type = lib.types.lines;
default = "";
description = ''
Extra configuration lines to add to ~/.config/hypr/hyprland.conf.
'';
};
recommendedEnvironment = lib.mkOption {
type = lib.types.bool;
default = true;
defaultText = lib.literalExpression "true";
example = lib.literalExpression "false";
description = ''
Whether to set the recommended environment variables.
'';
};
imports = [
(
lib.mkRenamedOptionModule
["wayland" "windowManager" "hyprland" "xwayland"]
["wayland" "windowManager" "hyprland" "xwayland" "enable"]
)
];
};
config = lib.mkIf cfg.enable {
home.packages =
lib.optional (cfg.package != null) cfg.package
++ lib.optional cfg.xwayland.enable pkgs.xwayland;
home.sessionVariables = lib.mkIf cfg.recommendedEnvironment {
GDK_BACKEND = "wayland";
_JAVA_AWT_WM_NONREPARENTING = "1";
NIXOS_OZONE_WL = "1";
XCURSOR_SIZE = toString config.home.pointerCursor.size or "24";
XDG_SESSION_TYPE = "wayland";
};
xdg.configFile."hypr/hyprland.conf" = {
text =
(lib.optionalString cfg.systemdIntegration ''
exec-once=${pkgs.dbus}/bin/dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY HYPRLAND_INSTANCE_SIGNATURE XDG_CURRENT_DESKTOP
exec-once=systemctl --user start hyprland-session.target
'')
+ cfg.extraConfig;
onChange = let
hyprlandPackage =
if cfg.package == null
then defaultHyprlandPackage
else cfg.package;
in "HYPRLAND_INSTANCE_SIGNATURE=$(ls -w 1 /tmp/hypr | tail -1) ${hyprlandPackage}/bin/hyprctl reload config-only";
};
systemd.user.targets.hyprland-session = lib.mkIf cfg.systemdIntegration {
Unit = {
Description = "hyprland compositor session";
Documentation = ["man:systemd.special(7)"];
BindsTo = ["graphical-session.target"];
Wants = ["graphical-session-pre.target"];
After = ["graphical-session-pre.target"];
};
};
systemd.user.targets.tray = {
Unit = {
Description = "Home Manager System Tray";
Requires = ["graphical-session-pre.target"];
};
};
};
}

36
nix/meson-build.patch Normal file
View File

@@ -0,0 +1,36 @@
diff --git a/meson.build b/meson.build
index 22ee4bf..5528613 100644
--- a/meson.build
+++ b/meson.build
@@ -2,16 +2,10 @@ project('Hyprland', 'cpp', 'c',
version : '0.1',
default_options : ['warning_level=3', 'cpp_std=c++20', 'default_library=static'])
-wlroots = subproject('wlroots', default_options: ['examples=false'])
-have_xwlr = wlroots.get_variable('features').get('xwayland')
+wlroots = dependency('wlroots', version: '>=0.16.0')
xcb_dep = dependency('xcb', required: get_option('xwayland'))
-if get_option('xwayland').enabled() and not have_xwlr
- error('Cannot enable Xwayland in Hyprland: wlroots has been built without Xwayland support')
-endif
-have_xwayland = xcb_dep.found() and have_xwlr
-
-if not have_xwayland
+if not xcb_dep.found()
add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
endif
diff --git a/src/meson.build b/src/meson.build
index 5d64188..a676333 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -7,7 +7,7 @@ executable('Hyprland', src,
server_protos,
dependency('wayland-server'),
dependency('wayland-client'),
- wlroots.get_variable('wlroots'),
+ wlroots,
dependency('cairo'),
dependency('pango'),
dependency('pangocairo'),

View File

@@ -8,6 +8,10 @@ self: {
with lib; let
cfg = config.programs.hyprland;
in {
imports = [
(mkRemovedOptionModule ["programs" "hyprland" "extraPackages"] "extraPackages has been removed. Use environment.systemPackages instead.")
];
options.programs.hyprland = {
enable = mkEnableOption ''
Hyprland, the dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
@@ -18,7 +22,7 @@ in {
'';
package = mkOption {
type = types.package;
type = types.nullOr types.package;
default = self.packages.${pkgs.system}.default;
defaultText = literalExpression "<Hyprland flake>.packages.<system>.default";
example = literalExpression "<Hyprland flake>.packages.<system>.default.override { }";
@@ -27,36 +31,40 @@ in {
'';
};
extraPackages = mkOption {
type = with types; listOf package;
default = with pkgs; [
kitty
wofi
swaybg
];
defaultText = literalExpression ''
with pkgs; [ kitty wofi swaybg ];
'';
example = literalExpression ''
with pkgs; [
alacritty wofi
]
'';
recommendedEnvironment = mkOption {
type = types.bool;
default = true;
defaultText = literalExpression "true";
example = literalExpression "false";
description = ''
Extra packages to be installed system wide.
Whether to set the recommended environment variables.
'';
};
};
config = mkIf cfg.enable {
environment.systemPackages = [cfg.package] ++ cfg.extraPackages;
security.polkit.enable = true;
hardware.opengl.enable = mkDefault true;
environment = {
systemPackages = lib.optional (cfg.package != null) cfg.package;
sessionVariables = mkIf cfg.recommendedEnvironment {
GDK_BACKEND = "wayland";
_JAVA_AWT_WM_NONREPARENTING = "1";
NIXOS_OZONE_WL = "1";
XCURSOR_SIZE = "24";
XDG_SESSION_TYPE = "wayland";
};
};
fonts.enableDefaultFonts = mkDefault true;
programs.dconf.enable = mkDefault true;
services.xserver.displayManager.sessionPackages = [cfg.package];
programs.xwayland.enable = mkDefault true;
xdg.portal.enable = mkDefault true;
xdg.portal.extraPortals = [pkgs.xdg-desktop-portal-wlr];
hardware.opengl.enable = mkDefault true;
programs = {
dconf.enable = mkDefault true;
xwayland.enable = mkDefault true;
};
security.polkit.enable = true;
services.xserver.displayManager.sessionPackages = lib.optional (cfg.package != null) cfg.package;
xdg.portal = {
enable = mkDefault true;
extraPortals = [pkgs.xdg-desktop-portal-wlr];
};
};
}

19
nix/update-inputs.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#moreutils nixpkgs#jq -c bash
# get wlroots revision from submodule
SUB_REV=$(git submodule status | awk '{ print substr($1,2)}')
# and from lockfile
CRT_REV=$(jq < flake.lock '.nodes.wlroots.locked.rev' -r)
if [ $SUB_REV != $CRT_REV ]; then
# update nixpkgs to latest version
nix flake lock --update-input nixpkgs
# update wlroots to submodule revision
nix flake lock --override-input wlroots "gitlab:wlroots/wlroots/$SUB_REV?host=gitlab.freedesktop.org"
# remove "dirty" mark from lockfile
jq < flake.lock 'del(.nodes.wlroots.original.rev)' | sponge flake.lock
else
echo "wlroots is up to date!"
fi

64
nix/wlroots.nix Normal file
View File

@@ -0,0 +1,64 @@
{
version,
src,
#
wlroots,
xwayland,
fetchpatch,
lib,
hidpiXWayland ? true,
enableXWayland ? true,
nvidiaPatches ? false,
}:
assert (lib.assertMsg (hidpiXWayland -> enableXWayland) ''
wlroots-hyprland: cannot have hidpiXWayland when enableXWayland is false.
'');
(wlroots.overrideAttrs
(old: {
inherit version src;
pname =
old.pname
+ "-hyprland"
+ (
if hidpiXWayland
then "-hidpi"
else ""
)
+ (
if nvidiaPatches
then "-nvidia"
else ""
);
patches =
(old.patches or [])
++ (lib.optionals (enableXWayland && hidpiXWayland) [
(fetchpatch {
url = "https://gitlab.freedesktop.org/lilydjwg/wlroots/-/commit/6c5ffcd1fee9e44780a6a8792f74ecfbe24a1ca7.diff";
sha256 = "sha256-Eo1pTa/PIiJsRZwIUnHGTIFFIedzODVf0ZeuXb0a3TQ=";
})
(fetchpatch {
url = "https://gitlab.freedesktop.org/wlroots/wlroots/-/commit/18595000f3a21502fd60bf213122859cc348f9af.diff";
sha256 = "sha256-jvfkAMh3gzkfuoRhB4E9T5X1Hu62wgUjj4tZkJm0mrI=";
revert = true;
})
]);
postPatch =
(old.postPatch or "")
+ (
if nvidiaPatches
then ''
substituteInPlace render/gles2/renderer.c --replace "glFlush();" "glFinish();"
''
else ""
);
}))
.override {
xwayland = xwayland.overrideAttrs (old: {
patches =
(old.patches or [])
++ (lib.optionals hidpiXWayland [
./xwayland-vsync.patch
./xwayland-hidpi.patch
]);
});
}

498
nix/xwayland-hidpi.patch Normal file
View File

@@ -0,0 +1,498 @@
diff --git a/hw/xwayland/xwayland-cursor.c b/hw/xwayland/xwayland-cursor.c
index c4457cc2a61b2103b47f996b51dbbe9eb87bd715..4a33e1f33e73c35c1691564ef4852e7501b02245 100644
--- a/hw/xwayland/xwayland-cursor.c
+++ b/hw/xwayland/xwayland-cursor.c
@@ -171,6 +171,8 @@ xwl_cursor_attach_pixmap(struct xwl_seat *xwl_seat,
}
wl_surface_attach(xwl_cursor->surface, buffer, 0, 0);
+ wl_surface_set_buffer_scale(xwl_cursor->surface,
+ xwl_seat->xwl_screen->global_output_scale);
xwl_surface_damage(xwl_seat->xwl_screen, xwl_cursor->surface, 0, 0,
xwl_seat->x_cursor->bits->width,
xwl_seat->x_cursor->bits->height);
@@ -190,6 +192,7 @@ xwl_cursor_attach_pixmap(struct xwl_seat *xwl_seat,
void
xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
{
+ struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
struct xwl_cursor *xwl_cursor = &xwl_seat->cursor;
PixmapPtr pixmap;
CursorPtr cursor;
@@ -220,8 +223,8 @@ xwl_seat_set_cursor(struct xwl_seat *xwl_seat)
wl_pointer_set_cursor(xwl_seat->wl_pointer,
xwl_seat->pointer_enter_serial,
xwl_cursor->surface,
- xwl_seat->x_cursor->bits->xhot,
- xwl_seat->x_cursor->bits->yhot);
+ xwl_scale_to(xwl_screen, xwl_seat->x_cursor->bits->xhot),
+ xwl_scale_to(xwl_screen, xwl_seat->x_cursor->bits->yhot));
xwl_cursor_attach_pixmap(xwl_seat, xwl_cursor, pixmap);
}
@@ -230,6 +233,7 @@ void
xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *xwl_tablet_tool)
{
struct xwl_seat *xwl_seat = xwl_tablet_tool->seat;
+ struct xwl_screen *xwl_screen = xwl_seat->xwl_screen;
struct xwl_cursor *xwl_cursor = &xwl_tablet_tool->cursor;
PixmapPtr pixmap;
CursorPtr cursor;
@@ -258,9 +262,9 @@ xwl_tablet_tool_set_cursor(struct xwl_tablet_tool *xwl_tablet_tool)
zwp_tablet_tool_v2_set_cursor(xwl_tablet_tool->tool,
xwl_tablet_tool->proximity_in_serial,
xwl_cursor->surface,
- xwl_seat->x_cursor->bits->xhot,
- xwl_seat->x_cursor->bits->yhot);
-
+ xwl_scale_to(xwl_screen, xwl_seat->x_cursor->bits->xhot),
+ xwl_scale_to(xwl_screen, xwl_seat->x_cursor->bits->yhot));
+ wl_surface_set_buffer_scale(xwl_cursor->surface, xwl_screen->global_output_scale);
xwl_cursor_attach_pixmap(xwl_seat, xwl_cursor, pixmap);
}
diff --git a/hw/xwayland/xwayland-input.c b/hw/xwayland/xwayland-input.c
index 26b3630c73b62514fe3ba7824371f79868e953f3..55cd8d466a55db03948abe93ffa03bf129b5e17a 100644
--- a/hw/xwayland/xwayland-input.c
+++ b/hw/xwayland/xwayland-input.c
@@ -412,8 +412,8 @@ pointer_handle_enter(void *data, struct wl_pointer *pointer,
DeviceIntPtr dev = get_pointer_device(xwl_seat);
DeviceIntPtr master;
int i;
- int sx = wl_fixed_to_int(sx_w);
- int sy = wl_fixed_to_int(sy_w);
+ int sx = wl_fixed_to_int(sx_w) * xwl_seat->xwl_screen->global_output_scale;
+ int sy = wl_fixed_to_int(sy_w) * xwl_seat->xwl_screen->global_output_scale;
int dx, dy;
ScreenPtr pScreen = xwl_seat->xwl_screen->screen;
ValuatorMask mask;
@@ -592,13 +592,14 @@ pointer_handle_motion(void *data, struct wl_pointer *pointer,
uint32_t time, wl_fixed_t sx_w, wl_fixed_t sy_w)
{
struct xwl_seat *xwl_seat = data;
+ int32_t scale = xwl_seat->xwl_screen->global_output_scale;
if (!xwl_seat->focus_window)
return;
xwl_seat->pending_pointer_event.has_absolute = TRUE;
- xwl_seat->pending_pointer_event.x = sx_w;
- xwl_seat->pending_pointer_event.y = sy_w;
+ xwl_seat->pending_pointer_event.x = sx_w * scale;
+ xwl_seat->pending_pointer_event.y = sy_w * scale;
if (wl_proxy_get_version((struct wl_proxy *) xwl_seat->wl_pointer) < 5)
dispatch_pointer_motion_event(xwl_seat);
@@ -672,7 +673,8 @@ pointer_handle_axis(void *data, struct wl_pointer *pointer,
xorg_list_del(&pending->l);
free(pending);
} else {
- valuator_mask_set_double(&mask, index, wl_fixed_to_double(value) / divisor);
+ double scaled_value = wl_fixed_to_double(value);
+ valuator_mask_set_double(&mask, index, scaled_value / divisor);
}
QueuePointerEvents(get_pointer_device(xwl_seat),
@@ -740,12 +742,13 @@ relative_pointer_handle_relative_motion(void *data,
wl_fixed_t dy_unaccelf)
{
struct xwl_seat *xwl_seat = data;
+ int32_t scale = xwl_seat->xwl_screen->global_output_scale;
xwl_seat->pending_pointer_event.has_relative = TRUE;
- xwl_seat->pending_pointer_event.dx = wl_fixed_to_double(dxf);
- xwl_seat->pending_pointer_event.dy = wl_fixed_to_double(dyf);
- xwl_seat->pending_pointer_event.dx_unaccel = wl_fixed_to_double(dx_unaccelf);
- xwl_seat->pending_pointer_event.dy_unaccel = wl_fixed_to_double(dy_unaccelf);
+ xwl_seat->pending_pointer_event.dx = wl_fixed_to_double(dxf) * scale;
+ xwl_seat->pending_pointer_event.dy = wl_fixed_to_double(dyf) * scale;
+ xwl_seat->pending_pointer_event.dx_unaccel = wl_fixed_to_double(dx_unaccelf) * scale;
+ xwl_seat->pending_pointer_event.dy_unaccel = wl_fixed_to_double(dy_unaccelf) * scale;
if (!xwl_seat->focus_window)
return;
@@ -1057,8 +1060,8 @@ touch_handle_down(void *data, struct wl_touch *wl_touch,
xwl_touch->window = wl_surface_get_user_data(surface);
xwl_touch->id = id;
- xwl_touch->x = wl_fixed_to_int(sx_w);
- xwl_touch->y = wl_fixed_to_int(sy_w);
+ xwl_touch->x = wl_fixed_to_int(sx_w) * xwl_seat->xwl_screen->global_output_scale;
+ xwl_touch->y = wl_fixed_to_int(sy_w) * xwl_seat->xwl_screen->global_output_scale;
xorg_list_add(&xwl_touch->link_touch, &xwl_seat->touches);
xwl_touch_send_event(xwl_touch, xwl_seat, XI_TouchBegin);
@@ -1094,8 +1097,8 @@ touch_handle_motion(void *data, struct wl_touch *wl_touch,
if (!xwl_touch)
return;
- xwl_touch->x = wl_fixed_to_int(sx_w);
- xwl_touch->y = wl_fixed_to_int(sy_w);
+ xwl_touch->x = wl_fixed_to_int(sx_w) * xwl_seat->xwl_screen->global_output_scale;;
+ xwl_touch->y = wl_fixed_to_int(sy_w) * xwl_seat->xwl_screen->global_output_scale;;
xwl_touch_send_event(xwl_touch, xwl_seat, XI_TouchUpdate);
}
@@ -1726,8 +1729,8 @@ tablet_tool_motion(void *data, struct zwp_tablet_tool_v2 *tool,
struct xwl_tablet_tool *xwl_tablet_tool = data;
struct xwl_seat *xwl_seat = xwl_tablet_tool->seat;
int32_t dx, dy;
- double sx = wl_fixed_to_double(x);
- double sy = wl_fixed_to_double(y);
+ double sx = wl_fixed_to_double(x) * xwl_seat->xwl_screen->global_output_scale;
+ double sy = wl_fixed_to_double(y) * xwl_seat->xwl_screen->global_output_scale;
if (!xwl_seat->tablet_focus_window)
return;
@@ -2714,6 +2717,7 @@ xwl_pointer_warp_emulator_set_fake_pos(struct xwl_pointer_warp_emulator *warp_em
int x,
int y)
{
+ struct xwl_screen *xwl_screen;
struct zwp_locked_pointer_v1 *locked_pointer =
warp_emulator->locked_pointer;
WindowPtr window;
@@ -2725,6 +2729,7 @@ xwl_pointer_warp_emulator_set_fake_pos(struct xwl_pointer_warp_emulator *warp_em
if (!warp_emulator->xwl_seat->focus_window)
return;
+ xwl_screen = warp_emulator->xwl_seat->xwl_screen;
window = warp_emulator->xwl_seat->focus_window->window;
if (x >= window->drawable.x ||
y >= window->drawable.y ||
@@ -2733,8 +2738,8 @@ xwl_pointer_warp_emulator_set_fake_pos(struct xwl_pointer_warp_emulator *warp_em
sx = x - window->drawable.x;
sy = y - window->drawable.y;
zwp_locked_pointer_v1_set_cursor_position_hint(locked_pointer,
- wl_fixed_from_int(sx),
- wl_fixed_from_int(sy));
+ wl_fixed_from_int(xwl_scale_to(xwl_screen, sx)),
+ wl_fixed_from_int(xwl_scale_to(xwl_screen, sy)));
wl_surface_commit(warp_emulator->xwl_seat->focus_window->surface);
}
}
diff --git a/hw/xwayland/xwayland-output.c b/hw/xwayland/xwayland-output.c
index ef705bc01bf8c2d2f170cda9ba21ed8293f50559..b8f6cd51bd240ed5e16271eb4749db18868bea7b 100644
--- a/hw/xwayland/xwayland-output.c
+++ b/hw/xwayland/xwayland-output.c
@@ -191,6 +191,9 @@ update_screen_size(struct xwl_output *xwl_output, int width, int height)
{
struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
+ width *= xwl_screen->global_output_scale;
+ height *= xwl_screen->global_output_scale;
+
if (xwl_screen->root_clip_mode == ROOT_CLIP_FULL)
SetRootClip(xwl_screen->screen, ROOT_CLIP_NONE);
@@ -497,14 +500,15 @@ xwl_output_set_emulated_mode(struct xwl_output *xwl_output, ClientPtr client,
xwl_output_set_randr_emu_props(xwl_output->xwl_screen, client);
}
-static void
-apply_output_change(struct xwl_output *xwl_output)
+void
+xwl_output_apply_changes(struct xwl_output *xwl_output)
{
struct xwl_screen *xwl_screen = xwl_output->xwl_screen;
struct xwl_output *it;
int mode_width, mode_height, count;
int width = 0, height = 0, has_this_output = 0;
RRModePtr *randr_modes;
+ int32_t scale = xwl_screen->global_output_scale;
/* Clear out the "done" received flags */
xwl_output->wl_output_done = FALSE;
@@ -523,10 +527,10 @@ apply_output_change(struct xwl_output *xwl_output)
}
/* Build a fresh modes array using the current refresh rate */
- randr_modes = output_get_rr_modes(xwl_output, mode_width, mode_height, &count);
+ randr_modes = output_get_rr_modes(xwl_output, mode_width * scale, mode_height * scale, &count);
RROutputSetModes(xwl_output->randr_output, randr_modes, count, 1);
RRCrtcNotify(xwl_output->randr_crtc, randr_modes[0],
- xwl_output->x, xwl_output->y,
+ xwl_output->x * scale, xwl_output->y * scale,
xwl_output->rotation, NULL, 1, &xwl_output->randr_output);
/* RROutputSetModes takes ownership of the passed in modes, so we only
* have to free the pointer array.
@@ -567,7 +571,7 @@ output_handle_done(void *data, struct wl_output *wl_output)
*/
if (xwl_output->xdg_output_done || !xwl_output->xdg_output ||
zxdg_output_v1_get_version(xwl_output->xdg_output) >= 3)
- apply_output_change(xwl_output);
+ xwl_output_apply_changes(xwl_output);
}
static void
@@ -610,7 +614,7 @@ xdg_output_handle_done(void *data, struct zxdg_output_v1 *xdg_output)
xwl_output->xdg_output_done = TRUE;
if (xwl_output->wl_output_done &&
zxdg_output_v1_get_version(xdg_output) < 3)
- apply_output_change(xwl_output);
+ xwl_output_apply_changes(xwl_output);
}
static void
@@ -678,6 +682,8 @@ xwl_output_create(struct xwl_screen *xwl_screen, uint32_t id)
RROutputSetConnection(xwl_output->randr_output, RR_Connected);
RRTellChanged(xwl_screen->screen);
+ xwl_output->scale = 1;
+
/* We want the output to be in the list as soon as created so we can
* use it when binding to the xdg-output protocol...
*/
diff --git a/hw/xwayland/xwayland-output.h b/hw/xwayland/xwayland-output.h
index 02b9831083e82a33d85d4404e39d00f06f6c56fd..ec089757f44178dcd7f9c48907f790ce1b2a2729 100644
--- a/hw/xwayland/xwayland-output.h
+++ b/hw/xwayland/xwayland-output.h
@@ -53,7 +53,7 @@ struct xwl_output {
struct wl_output *output;
struct zxdg_output_v1 *xdg_output;
uint32_t server_output_id;
- int32_t x, y, width, height, refresh;
+ int32_t x, y, width, height, refresh, scale;
Rotation rotation;
Bool wl_output_done;
Bool xdg_output_done;
@@ -100,6 +100,8 @@ void xwl_output_set_emulated_mode(struct xwl_output *xwl_output,
void xwl_output_set_window_randr_emu_props(struct xwl_screen *xwl_screen,
WindowPtr window);
+void xwl_output_apply_changes(struct xwl_output *xwl_output);
+
void xwl_screen_init_xdg_output(struct xwl_screen *xwl_screen);
#endif /* XWAYLAND_OUTPUT_H */
diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c
index c9cf8c2f569a319034e0789e7587414e50237065..5be0c208ca46b1a53a136885fdc8ab44251fe7ff 100644
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -680,6 +680,8 @@ xwl_present_flip(WindowPtr present_window,
/* We can flip directly to the main surface (full screen window without clips) */
wl_surface_attach(xwl_window->surface, buffer, 0, 0);
+ wl_surface_set_buffer_scale(xwl_window->surface,
+ xwl_window->xwl_screen->global_output_scale);
if (!xwl_window->frame_callback)
xwl_window_create_frame_callback(xwl_window);
diff --git a/hw/xwayland/xwayland-screen.c b/hw/xwayland/xwayland-screen.c
index bb18e5c94fbc7134c801e4e1979e8184079d352e..4ec2de7d123dd36315df07a1e95b1f417925f0f8 100644
--- a/hw/xwayland/xwayland-screen.c
+++ b/hw/xwayland/xwayland-screen.c
@@ -51,6 +51,7 @@
#include "xwayland-pixmap.h"
#include "xwayland-present.h"
#include "xwayland-shm.h"
+#include "xwayland-window-buffers.h"
#ifdef MITSHM
#include "shmint.h"
@@ -110,6 +111,12 @@ xwl_screen_has_resolution_change_emulation(struct xwl_screen *xwl_screen)
return xwl_screen->rootless && xwl_screen_has_viewport_support(xwl_screen);
}
+int
+xwl_scale_to(struct xwl_screen *xwl_screen, int value)
+{
+ return value / (double)xwl_screen->global_output_scale + 0.5;
+}
+
/* Return the output @ 0x0, falling back to the first output in the list */
struct xwl_output *
xwl_screen_get_first_output(struct xwl_screen *xwl_screen)
@@ -127,6 +134,37 @@ xwl_screen_get_first_output(struct xwl_screen *xwl_screen)
return xorg_list_first_entry(&xwl_screen->output_list, struct xwl_output, link);
}
+static void
+xwl_screen_set_global_scale_from_property(struct xwl_screen *screen,
+ PropertyPtr prop)
+{
+ CARD32 *propdata;
+
+ if (prop->type != XA_CARDINAL || prop->format != 32 || prop->size != 1) {
+ // TODO: handle warnings more cleanly.
+ LogMessageVerb(X_WARNING, 0, "Bad value for property %s.\n",
+ NameForAtom(prop->propertyName));
+ return;
+ }
+
+ propdata = prop->data;
+ xwl_screen_set_global_scale(screen, propdata[0]);
+}
+
+static void
+xwl_screen_update_property(struct xwl_screen *screen,
+ PropertyStateRec *propstate)
+{
+ switch (propstate->state) {
+ case PropertyNewValue:
+ xwl_screen_set_global_scale_from_property(screen, propstate->prop);
+ break;
+ case PropertyDelete:
+ xwl_screen_set_global_scale(screen, 1);
+ break;
+ }
+}
+
static void
xwl_property_callback(CallbackListPtr *pcbl, void *closure,
void *calldata)
@@ -134,19 +172,24 @@ xwl_property_callback(CallbackListPtr *pcbl, void *closure,
ScreenPtr screen = closure;
PropertyStateRec *rec = calldata;
struct xwl_screen *xwl_screen;
- struct xwl_window *xwl_window;
if (rec->win->drawable.pScreen != screen)
return;
- xwl_window = xwl_window_get(rec->win);
- if (!xwl_window)
- return;
-
xwl_screen = xwl_screen_get(screen);
- if (rec->prop->propertyName == xwl_screen->allow_commits_prop)
+ if (rec->prop->propertyName == xwl_screen->allow_commits_prop) {
+ struct xwl_window *xwl_window;
+
+ xwl_window = xwl_window_get(rec->win);
+ if (!xwl_window)
+ return;
+
xwl_window_update_property(xwl_window, rec);
+ }
+ else if (rec->prop->propertyName == xwl_screen->global_output_scale_prop) {
+ xwl_screen_update_property(xwl_screen, rec);
+ }
}
Bool
@@ -521,8 +564,14 @@ void xwl_surface_damage(struct xwl_screen *xwl_screen,
{
if (wl_surface_get_version(surface) >= WL_SURFACE_DAMAGE_BUFFER_SINCE_VERSION)
wl_surface_damage_buffer(surface, x, y, width, height);
- else
+ else {
+ x = xwl_scale_to(xwl_screen, x);
+ y = xwl_scale_to(xwl_screen, y);
+ width = xwl_scale_to(xwl_screen, width);
+ height = xwl_scale_to(xwl_screen, height);
+
wl_surface_damage(surface, x, y, width, height);
+ }
}
void
@@ -538,10 +587,34 @@ xwl_screen_roundtrip(struct xwl_screen *xwl_screen)
xwl_give_up("could not connect to wayland server\n");
}
+void
+xwl_screen_set_global_scale(struct xwl_screen *xwl_screen, int32_t scale)
+{
+ struct xwl_output *it;
+ struct xwl_window *xwl_window;
+
+ xwl_screen->global_output_scale = scale;
+
+ /* change randr resolutions and positions */
+ xorg_list_for_each_entry(it, &xwl_screen->output_list, link) {
+ xwl_output_apply_changes(it);
+ }
+
+ if (!xwl_screen->rootless && xwl_screen->screen->root) {
+ /* Clear all the buffers, so that they'll be remade with the new sizes
+ * (this doesn't occur automatically because as far as Xorg is
+ * concerned, the window's size is the same) */
+ xorg_list_for_each_entry(xwl_window, &xwl_screen->window_list, link_window) {
+ xwl_window_buffers_recycle(xwl_window);
+ }
+ }
+}
+
Bool
xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
{
static const char allow_commits[] = "_XWAYLAND_ALLOW_COMMITS";
+ static const char global_output_scale[] = "_XWAYLAND_GLOBAL_OUTPUT_SCALE";
struct xwl_screen *xwl_screen;
Pixel red_mask, blue_mask, green_mask;
int ret, bpc, green_bpc, i;
@@ -573,6 +646,7 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
#ifdef XWL_HAS_GLAMOR
xwl_screen->glamor = 1;
#endif
+ xwl_screen->global_output_scale = 1;
for (i = 1; i < argc; i++) {
if (strcmp(argv[i], "-rootless") == 0) {
@@ -743,6 +817,12 @@ xwl_screen_init(ScreenPtr pScreen, int argc, char **argv)
if (xwl_screen->allow_commits_prop == BAD_RESOURCE)
return FALSE;
+ xwl_screen->global_output_scale_prop = MakeAtom(global_output_scale,
+ strlen(global_output_scale),
+ TRUE);
+ if (xwl_screen->global_output_scale_prop == BAD_RESOURCE)
+ return FALSE;
+
AddCallback(&PropertyStateCallback, xwl_property_callback, pScreen);
xwl_screen_roundtrip(xwl_screen);
diff --git a/hw/xwayland/xwayland-screen.h b/hw/xwayland/xwayland-screen.h
index b965dddd7f964b1d100bbb9d10da1c35ab39810e..7446829d098fbe235e605084a016daff1a8eaea2 100644
--- a/hw/xwayland/xwayland-screen.h
+++ b/hw/xwayland/xwayland-screen.h
@@ -72,6 +72,8 @@ struct xwl_screen {
struct xorg_list damage_window_list;
struct xorg_list window_list;
+ int32_t global_output_scale;
+
int wayland_fd;
struct wl_display *display;
struct wl_registry *registry;
@@ -107,6 +109,7 @@ struct xwl_screen {
struct glamor_context *glamor_ctx;
Atom allow_commits_prop;
+ Atom global_output_scale_prop;
/* The preferred GLVND vendor. If NULL, "mesa" is assumed. */
const char *glvnd_vendor;
@@ -134,5 +137,7 @@ void xwl_screen_roundtrip (struct xwl_screen *xwl_screen);
void xwl_surface_damage(struct xwl_screen *xwl_screen,
struct wl_surface *surface,
int32_t x, int32_t y, int32_t width, int32_t height);
+int xwl_scale_to(struct xwl_screen *xwl_screen, int value);
+void xwl_screen_set_global_scale(struct xwl_screen *xwl_screen, int32_t scale);
#endif /* XWAYLAND_SCREEN_H */
diff --git a/hw/xwayland/xwayland-window.c b/hw/xwayland/xwayland-window.c
index 00f161eda084e335ac07471a2198176d75d9fcf0..ed3903853f0dab1dad390cd8429639541546157d 100644
--- a/hw/xwayland/xwayland-window.c
+++ b/hw/xwayland/xwayland-window.c
@@ -470,7 +470,8 @@ ensure_surface_for_window(WindowPtr window)
}
wl_region_add(region, 0, 0,
- window->drawable.width, window->drawable.height);
+ xwl_scale_to(xwl_screen, window->drawable.width),
+ xwl_scale_to(xwl_screen, window->drawable.height));
wl_surface_set_opaque_region(xwl_window->surface, region);
wl_region_destroy(region);
}
@@ -820,6 +821,7 @@ xwl_window_post_damage(struct xwl_window *xwl_window)
#endif
wl_surface_attach(xwl_window->surface, buffer, 0, 0);
+ wl_surface_set_buffer_scale(xwl_window->surface, xwl_screen->global_output_scale);
/* Arbitrary limit to try to avoid flooding the Wayland
* connection. If we flood it too much anyway, this could

12
nix/xwayland-vsync.patch Normal file
View File

@@ -0,0 +1,12 @@
--- a/hw/xwayland/xwayland-present.c
+++ b/hw/xwayland/xwayland-present.c
@@ -824,7 +824,8 @@
dixDestroyPixmap(vblank->pixmap, vblank->pixmap->drawable.id);
vblank->pixmap = NULL;
- if (xwl_present_queue_vblank(screen, window, vblank->crtc,
+ if (vblank->target_msc > crtc_msc &&
+ xwl_present_queue_vblank(screen, window, vblank->crtc,
vblank->event_id, crtc_msc + 1)
== Success)
return;

52
protocols/meson.build Normal file
View File

@@ -0,0 +1,52 @@
wayland_protos = dependency('wayland-protocols',
version: '>=1.25',
fallback: 'wayland-protocols',
default_options: ['tests=false'],
)
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
wayland_scanner_dep = dependency('wayland-scanner', native: true)
wayland_scanner = find_program(
wayland_scanner_dep.get_variable('wayland_scanner'),
native: true,
)
protocols = [
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
['wlr-layer-shell-unstable-v1.xml'],
['wlr-output-power-management-unstable-v1.xml'],
['ext-workspace-unstable-v1.xml'],
['pointer-constraints-unstable-v1.xml'],
['tablet-unstable-v2.xml'],
['idle.xml']
]
wl_protos_src = []
wl_protos_headers = []
foreach p : protocols
xml = join_paths(p)
wl_protos_src += custom_target(
xml.underscorify() + '_server_c',
input: xml,
output: '@BASENAME@-protocol.c',
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
)
wl_protos_headers += custom_target(
xml.underscorify() + '_server_h',
input: xml,
output: '@BASENAME@-protocol.h',
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'],
)
endforeach
wayland_server = dependency('wayland-server', version: '>=1.20.0')
lib_server_protos = static_library(
'server_protos',
wl_protos_src + wl_protos_headers,
dependencies: wayland_server.partial_dependency(compile_args: true),
)
server_protos = declare_dependency(
link_with: lib_server_protos,
sources: wl_protos_headers,
)

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<protocol name="wlr_output_power_management_unstable_v1">
<copyright>
Copyright © 2019 Purism SPC
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="Control power management modes of outputs">
This protocol allows clients to control power management modes
of outputs that are currently part of the compositor space. The
intent is to allow special clients like desktop shells to power
down outputs when the system is idle.
To modify outputs not currently part of the compositor space see
wlr-output-management.
Warning! The protocol described in this file is experimental and
backward incompatible changes may be made. Backward compatible changes
may be added together with the corresponding interface version bump.
Backward incompatible changes are done by bumping the version number in
the protocol and interface names and resetting the interface version.
Once the protocol is to be declared stable, the 'z' prefix and the
version number in the protocol and interface names are removed and the
interface version number is reset.
</description>
<interface name="zwlr_output_power_manager_v1" version="1">
<description summary="manager to create per-output power management">
This interface is a manager that allows creating per-output power
management mode controls.
</description>
<request name="get_output_power">
<description summary="get a power management for an output">
Create a output power management mode control that can be used to
adjust the power management mode for a given output.
</description>
<arg name="id" type="new_id" interface="zwlr_output_power_v1"/>
<arg name="output" type="object" interface="wl_output"/>
</request>
<request name="destroy" type="destructor">
<description summary="destroy the manager">
All objects created by the manager will still remain valid, until their
appropriate destroy request has been called.
</description>
</request>
</interface>
<interface name="zwlr_output_power_v1" version="1">
<description summary="adjust power management mode for an output">
This object offers requests to set the power management mode of
an output.
</description>
<enum name="mode">
<entry name="off" value="0"
summary="Output is turned off."/>
<entry name="on" value="1"
summary="Output is turned on, no power saving"/>
</enum>
<enum name="error">
<entry name="invalid_mode" value="1" summary="inexistent power save mode"/>
</enum>
<request name="set_mode">
<description summary="Set an outputs power save mode">
Set an output's power save mode to the given mode. The mode change
is effective immediately. If the output does not support the given
mode a failed event is sent.
</description>
<arg name="mode" type="uint" enum="mode" summary="the power save mode to set"/>
</request>
<event name="mode">
<description summary="Report a power management mode change">
Report the power management mode change of an output.
The mode event is sent after an output changed its power
management mode. The reason can be a client using set_mode or the
compositor deciding to change an output's mode.
This event is also sent immediately when the object is created
so the client is informed about the current power management mode.
</description>
<arg name="mode" type="uint" enum="mode"
summary="the output's new power management mode"/>
</event>
<event name="failed">
<description summary="object no longer valid">
This event indicates that the output power management mode control
is no longer valid. This can happen for a number of reasons,
including:
- The output doesn't support power management
- Another client already has exclusive power management mode control
for this output
- The output disappeared
Upon receiving this event, the client should destroy this object.
</description>
</event>
<request name="destroy" type="destructor">
<description summary="destroy this power management">
Destroys the output power management mode control object.
</description>
</request>
</interface>
</protocol>

File diff suppressed because it is too large Load Diff

View File

@@ -10,7 +10,7 @@
#include "config/ConfigManager.hpp"
#include "managers/ThreadManager.hpp"
#include "managers/XWaylandManager.hpp"
#include "managers/InputManager.hpp"
#include "managers/input/InputManager.hpp"
#include "managers/LayoutManager.hpp"
#include "managers/KeybindManager.hpp"
#include "managers/AnimationManager.hpp"
@@ -30,12 +30,16 @@ public:
// ------------------ WLR BASICS ------------------ //
wl_display* m_sWLDisplay;
wl_event_loop* m_sWLEventLoop;
wlr_backend* m_sWLRBackend;
wlr_session* m_sWLRSession;
wlr_renderer* m_sWLRRenderer;
wlr_allocator* m_sWLRAllocator;
wlr_compositor* m_sWLRCompositor;
wlr_subcompositor* m_sWLRSubCompositor;
wlr_data_device_manager* m_sWLRDataDevMgr;
wlr_drm* m_sWRLDRM;
wlr_drm_lease_v1_manager* m_sWRLDRMLeaseMgr;
wlr_xdg_activation_v1* m_sWLRXDGActivation;
wlr_output_layout* m_sWLROutputLayout;
wlr_idle* m_sWLRIdle;
@@ -52,56 +56,71 @@ public:
wlr_egl* m_sWLREGL;
int m_iDRMFD;
wlr_ext_workspace_manager_v1* m_sWLREXTWorkspaceMgr;
wlr_linux_dmabuf_v1* m_sWLRDmabuf;
wlr_pointer_constraints_v1* m_sWLRPointerConstraints;
wlr_relative_pointer_manager_v1* m_sWLRRelPointerMgr;
wlr_server_decoration_manager* m_sWLRServerDecoMgr;
wlr_xdg_decoration_manager_v1* m_sWLRXDGDecoMgr;
wlr_virtual_pointer_manager_v1* m_sWLRVirtPtrMgr;
wlr_foreign_toplevel_manager_v1* m_sWLRToplevelMgr;
wlr_tablet_manager_v2* m_sWLRTabletManager;
wlr_xdg_foreign_registry* m_sWLRForeignRegistry;
wlr_idle_inhibit_manager_v1* m_sWLRIdleInhibitMgr;
wlr_pointer_gestures_v1* m_sWLRPointerGestures;
wlr_output_power_manager_v1* m_sWLROutputPowerMgr;
wlr_input_method_manager_v2* m_sWLRIMEMgr;
wlr_text_input_manager_v3* m_sWLRTextInputMgr;
// ------------------------------------------------- //
const char* m_szWLDisplaySocket;
std::string m_szInstanceSignature = "";
std::string m_szCurrentSplash = "error";
std::list<SMonitor> m_lMonitors;
std::list<CWindow> m_lWindows;
std::list<SXDGPopup> m_lXDGPopups;
std::list<CWorkspace> m_lWorkspaces;
std::list<SSubsurface> m_lSubsurfaces;
std::list<CWindow*> m_lWindowsFadingOut;
std::list<SLayerSurface*> m_lSurfacesFadingOut;
std::vector<std::shared_ptr<CMonitor>> m_vMonitors;
std::vector<std::shared_ptr<CMonitor>> m_vRealMonitors; // for all monitors, even those turned off
std::vector<std::unique_ptr<CWindow>> m_vWindows;
std::deque<std::unique_ptr<CWindow>> m_dUnmanagedX11Windows;
std::vector<std::unique_ptr<SXDGPopup>> m_vXDGPopups;
std::vector<std::unique_ptr<CWorkspace>> m_vWorkspaces;
std::vector<std::unique_ptr<SSubsurface>> m_vSubsurfaces;
std::vector<CWindow*> m_vWindowsFadingOut;
std::vector<SLayerSurface*> m_vSurfacesFadingOut;
void startCompositor();
void cleanupExit();
void startCompositor();
void cleanup();
wlr_surface* m_pLastFocus = nullptr;
CWindow* m_pLastWindow = nullptr;
SMonitor* m_pLastMonitor = nullptr;
CMonitor* m_pLastMonitor = nullptr;
SSeat m_sSeat;
bool m_bReadyToProcess = false;
bool m_bSessionActive = true;
bool m_bDPMSStateON = true;
bool m_bUnsafeState = false; // unsafe state is when there is no monitors.
bool m_bIsShuttingDown = false;
std::deque<uint64_t> m_dProcessPIDsOnShutdown; // stores PIDs of apps to kill later when shutting down
// ------------------------------------------------- //
SMonitor* getMonitorFromID(const int&);
SMonitor* getMonitorFromName(const std::string&);
SMonitor* getMonitorFromCursor();
SMonitor* getMonitorFromVector(const Vector2D&);
CMonitor* getMonitorFromID(const int&);
CMonitor* getMonitorFromName(const std::string&);
CMonitor* getMonitorFromCursor();
CMonitor* getMonitorFromVector(const Vector2D&);
void removeWindowFromVectorSafe(CWindow*);
void focusWindow(CWindow*, wlr_surface* pSurface = nullptr);
void focusSurface(wlr_surface*, CWindow* pWindowOwner = nullptr);
bool windowExists(CWindow*);
bool windowValidMapped(CWindow*);
CWindow* vectorToWindow(const Vector2D&);
CWindow* vectorToWindowIdeal(const Vector2D&);
CWindow* vectorToWindowIdeal(const Vector2D&); // used only for finding a window to focus on, basically a "findFocusableWindow"
CWindow* vectorToWindowTiled(const Vector2D&);
wlr_surface* vectorToLayerSurface(const Vector2D&, std::list<SLayerSurface*>*, Vector2D*);
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<std::unique_ptr<SLayerSurface>>*, Vector2D*, SLayerSurface**);
wlr_surface* vectorWindowToSurface(const Vector2D&, CWindow*, Vector2D& sl);
CWindow* windowFromCursor();
CWindow* windowFloatingFromCursor();
SMonitor* getMonitorFromOutput(wlr_output*);
CMonitor* getMonitorFromOutput(wlr_output*);
CWindow* getWindowForPopup(wlr_xdg_popup*);
CWindow* getWindowFromSurface(wlr_surface*);
bool isWorkspaceVisible(const int&);
@@ -109,26 +128,51 @@ public:
CWorkspace* getWorkspaceByName(const std::string&);
CWorkspace* getWorkspaceByString(const std::string&);
void sanityCheckWorkspaces();
void updateWorkspaceWindowDecos(const int&);
int getWindowsOnWorkspace(const int&);
CWindow* getFirstWindowOnWorkspace(const int&);
void fixXWaylandWindowsOnWorkspace(const int&);
CWindow* getFullscreenWindowOnWorkspace(const int&);
bool doesSeatAcceptInput(wlr_surface*);
bool isWindowActive(CWindow*);
void moveWindowToTop(CWindow*);
void cleanupFadingOut();
void cleanupFadingOut(const int& monid);
CWindow* getWindowInDirection(CWindow*, char);
void deactivateAllWLRWorkspaces(wlr_ext_workspace_handle_v1* exclude = nullptr);
CWindow* getNextWindowOnWorkspace(CWindow*);
CWindow* getNextWindowOnWorkspace(CWindow*, bool focusableOnly = false);
CWindow* getPrevWindowOnWorkspace(CWindow*, bool focusableOnly = false);
int getNextAvailableNamedWorkspace();
bool isPointOnAnyMonitor(const Vector2D&);
CWindow* getConstraintWindow(SMouse*);
SMonitor* getMonitorInDirection(const char&);
void updateAllWindowsBorders();
void updateWindowBorderColor(CWindow*);
CMonitor* getMonitorInDirection(const char&);
void updateAllWindowsAnimatedDecorationValues();
void updateWindowAnimatedDecorationValues(CWindow*);
int getNextAvailableMonitorID();
void moveWorkspaceToMonitor(CWorkspace*, CMonitor*);
void swapActiveWorkspaces(CMonitor*, CMonitor*);
CMonitor* getMonitorFromString(const std::string&);
bool workspaceIDOutOfBounds(const int&);
void setWindowFullscreen(CWindow*, bool, eFullscreenMode);
void moveUnmanagedX11ToWindows(CWindow*);
CWindow* getX11Parent(CWindow*);
void scheduleFrameForMonitor(CMonitor*);
void addToFadingOutSafe(SLayerSurface*);
void addToFadingOutSafe(CWindow*);
CWindow* getWindowByRegex(const std::string&);
void warpCursorTo(const Vector2D&);
SLayerSurface* getLayerSurfaceFromWlr(wlr_layer_surface_v1*);
SLayerSurface* getLayerSurfaceFromSurface(wlr_surface*);
void closeWindow(CWindow*);
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
void forceReportSizesToWindowsOnWorkspace(const int&);
bool cursorOnReservedArea();
std::string explicitConfigPath;
private:
void initAllSignals();
void setRandomSplash();
uint64_t m_iHyprlandPID = 0;
};
@@ -147,4 +191,4 @@ inline std::map<std::string, xcb_atom_t> HYPRATOMS = {
HYPRATOM("_NET_WM_WINDOW_TYPE_DROPDOWN_MENU"),
HYPRATOM("_NET_WM_WINDOW_TYPE_POPUP_MENU"),
HYPRATOM("_NET_WM_WINDOW_TYPE_TOOLTIP"),
HYPRATOM("_NET_WM_WINDOW_TYPE_NOTIFICATION")};
HYPRATOM("_NET_WM_WINDOW_TYPE_NOTIFICATION")};

View File

@@ -1,11 +1,17 @@
#include "Window.hpp"
#include "Compositor.hpp"
#include "render/decorations/CHyprDropShadowDecoration.hpp"
CWindow::CWindow() {
m_vRealPosition.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:windows_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:windows")->intValue, &g_pConfigManager->getConfigValuePtr("animations:windows_curve")->strValue, (void*) this, AVARDAMAGE_ENTIRE);
m_vRealSize.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:windows_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:windows")->intValue, &g_pConfigManager->getConfigValuePtr("animations:windows_curve")->strValue, (void*)this, AVARDAMAGE_ENTIRE);
m_cRealBorderColor.create(AVARTYPE_COLOR, &g_pConfigManager->getConfigValuePtr("animations:borders_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:borders")->intValue, &g_pConfigManager->getConfigValuePtr("animations:borders_curve")->strValue, (void*)this, AVARDAMAGE_BORDER);
m_fAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:fadein_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:fadein")->intValue, &g_pConfigManager->getConfigValuePtr("animations:fadein_curve")->strValue, (void*)this, AVARDAMAGE_ENTIRE);
m_vRealPosition.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*) this, AVARDAMAGE_ENTIRE);
m_vRealSize.create(AVARTYPE_VECTOR, g_pConfigManager->getAnimationPropertyConfig("windowsIn"), (void*)this, AVARDAMAGE_ENTIRE);
m_cRealBorderColor.create(AVARTYPE_COLOR, g_pConfigManager->getAnimationPropertyConfig("border"), (void*)this, AVARDAMAGE_BORDER);
m_fAlpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), (void*)this, AVARDAMAGE_ENTIRE);
m_fActiveInactiveAlpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeSwitch"), (void*)this, AVARDAMAGE_ENTIRE);
m_cRealShadowColor.create(AVARTYPE_COLOR, g_pConfigManager->getAnimationPropertyConfig("fadeShadow"), (void*)this, AVARDAMAGE_SHADOW);
m_fDimPercent.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeDim"), (void*)this, AVARDAMAGE_ENTIRE);
m_dWindowDecorations.emplace_back(std::make_unique<CHyprDropShadowDecoration>(this)); // put the shadow so it's the first deco (has to be rendered first)
}
CWindow::~CWindow() {
@@ -13,4 +19,228 @@ CWindow::~CWindow() {
g_pCompositor->m_pLastFocus = nullptr;
g_pCompositor->m_pLastWindow = nullptr;
}
}
}
wlr_box CWindow::getFullWindowBoundingBox() {
static auto *const PBORDERSIZE = &g_pConfigManager->getConfigValuePtr("general:border_size")->intValue;
SWindowDecorationExtents maxExtents = {{*PBORDERSIZE + 2, *PBORDERSIZE + 2}, {*PBORDERSIZE + 2, *PBORDERSIZE + 2}};
for (auto& wd : m_dWindowDecorations) {
const auto EXTENTS = wd->getWindowDecorationExtents();
if (EXTENTS.topLeft.x > maxExtents.topLeft.x)
maxExtents.topLeft.x = EXTENTS.topLeft.x;
if (EXTENTS.topLeft.y > maxExtents.topLeft.y)
maxExtents.topLeft.y = EXTENTS.topLeft.y;
if (EXTENTS.bottomRight.x > maxExtents.bottomRight.x)
maxExtents.bottomRight.x = EXTENTS.bottomRight.x;
if (EXTENTS.bottomRight.y > maxExtents.bottomRight.y)
maxExtents.bottomRight.y = EXTENTS.bottomRight.y;
}
// Add extents to the real base BB and return
wlr_box finalBox = {m_vRealPosition.vec().x - maxExtents.topLeft.x,
m_vRealPosition.vec().y - maxExtents.topLeft.y,
m_vRealSize.vec().x + maxExtents.topLeft.x + maxExtents.bottomRight.x,
m_vRealSize.vec().y + maxExtents.topLeft.y + maxExtents.bottomRight.y};
return finalBox;
}
wlr_box CWindow::getWindowIdealBoundingBoxIgnoreReserved() {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
auto POS = m_vPosition;
auto SIZE = m_vSize;
if (DELTALESSTHAN(POS.y - PMONITOR->vecPosition.y, PMONITOR->vecReservedTopLeft.y, 1)) {
POS.y = PMONITOR->vecPosition.y;
SIZE.y += PMONITOR->vecReservedTopLeft.y;
}
if (DELTALESSTHAN(POS.x - PMONITOR->vecPosition.x, PMONITOR->vecReservedTopLeft.x, 1)) {
POS.x = PMONITOR->vecPosition.x;
SIZE.x += PMONITOR->vecReservedTopLeft.x;
}
if (DELTALESSTHAN(POS.x + SIZE.x - PMONITOR->vecPosition.x, PMONITOR->vecSize.x - PMONITOR->vecReservedBottomRight.x, 1)) {
SIZE.x += PMONITOR->vecReservedBottomRight.x;
}
if (DELTALESSTHAN(POS.y + SIZE.y - PMONITOR->vecPosition.y, PMONITOR->vecSize.y - PMONITOR->vecReservedBottomRight.y, 1)) {
SIZE.y += PMONITOR->vecReservedBottomRight.y;
}
return wlr_box{(int)POS.x, (int)POS.y, (int)SIZE.x, (int)SIZE.y};
}
void CWindow::updateWindowDecos() {
for (auto& wd : m_dWindowDecorations)
wd->updateWindow(this);
for (auto& wd : m_vDecosToRemove) {
for (auto it = m_dWindowDecorations.begin(); it != m_dWindowDecorations.end(); it++) {
if (it->get() == wd) {
it = m_dWindowDecorations.erase(it);
if (it == m_dWindowDecorations.end())
break;
}
}
}
m_vDecosToRemove.clear();
}
pid_t CWindow::getPID() {
pid_t PID = -1;
if (!m_bIsX11) {
wl_client_get_credentials(wl_resource_get_client(m_uSurface.xdg->resource), &PID, nullptr, nullptr);
} else {
PID = m_uSurface.xwayland->pid;
}
return PID;
}
IHyprWindowDecoration* CWindow::getDecorationByType(eDecorationType type) {
for (auto& wd : m_dWindowDecorations) {
if (wd->getDecorationType() == type)
return wd.get();
}
return nullptr;
}
void CWindow::createToplevelHandle() {
if (m_bIsX11 && (m_bX11DoesntWantBorders || m_iX11Type == 2))
return; // don't create a toplevel
m_phForeignToplevel = wlr_foreign_toplevel_handle_v1_create(g_pCompositor->m_sWLRToplevelMgr);
wlr_foreign_toplevel_handle_v1_set_app_id(m_phForeignToplevel, g_pXWaylandManager->getAppIDClass(this).c_str());
wlr_foreign_toplevel_handle_v1_output_enter(m_phForeignToplevel, g_pCompositor->getMonitorFromID(m_iMonitorID)->output);
wlr_foreign_toplevel_handle_v1_set_title(m_phForeignToplevel, m_szTitle.c_str());
wlr_foreign_toplevel_handle_v1_set_maximized(m_phForeignToplevel, false);
wlr_foreign_toplevel_handle_v1_set_minimized(m_phForeignToplevel, false);
wlr_foreign_toplevel_handle_v1_set_fullscreen(m_phForeignToplevel, false);
// handle events
hyprListener_toplevelActivate.initCallback(&m_phForeignToplevel->events.request_activate, [&](void* owner, void* data) {
g_pCompositor->focusWindow(this);
}, this, "Toplevel");
hyprListener_toplevelFullscreen.initCallback(&m_phForeignToplevel->events.request_fullscreen, [&](void* owner, void* data) {
const auto EV = (wlr_foreign_toplevel_handle_v1_fullscreen_event*)data;
g_pCompositor->setWindowFullscreen(this, EV->fullscreen, FULLSCREEN_FULL);
}, this, "Toplevel");
hyprListener_toplevelClose.initCallback(&m_phForeignToplevel->events.request_close, [&](void* owner, void* data) {
g_pCompositor->closeWindow(this);
}, this, "Toplevel");
m_iLastToplevelMonitorID = m_iMonitorID;
}
void CWindow::destroyToplevelHandle() {
if (!m_phForeignToplevel)
return;
hyprListener_toplevelActivate.removeCallback();
hyprListener_toplevelClose.removeCallback();
hyprListener_toplevelFullscreen.removeCallback();
wlr_foreign_toplevel_handle_v1_destroy(m_phForeignToplevel);
m_phForeignToplevel = nullptr;
}
void CWindow::updateToplevel() {
updateSurfaceOutputs();
if (!m_phForeignToplevel)
return;
wlr_foreign_toplevel_handle_v1_set_title(m_phForeignToplevel, m_szTitle.c_str());
wlr_foreign_toplevel_handle_v1_set_fullscreen(m_phForeignToplevel, m_bIsFullscreen);
if (m_iLastToplevelMonitorID != m_iMonitorID) {
if (const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iLastToplevelMonitorID); PMONITOR && PMONITOR->m_bEnabled)
wlr_foreign_toplevel_handle_v1_output_leave(m_phForeignToplevel, PMONITOR->output);
wlr_foreign_toplevel_handle_v1_output_enter(m_phForeignToplevel, g_pCompositor->getMonitorFromID(m_iMonitorID)->output);
m_iLastToplevelMonitorID = m_iMonitorID;
}
}
void sendEnterIter(wlr_surface* pSurface, int x, int y, void* data) {
const auto OUTPUT = (wlr_output*)data;
wlr_surface_send_enter(pSurface, OUTPUT);
}
void sendLeaveIter(wlr_surface* pSurface, int x, int y, void* data) {
const auto OUTPUT = (wlr_output*)data;
wlr_surface_send_leave(pSurface, OUTPUT);
}
void CWindow::updateSurfaceOutputs() {
if (m_iLastSurfaceMonitorID == m_iMonitorID || !m_bIsMapped || m_bHidden || !m_bMappedX11)
return;
const auto PLASTMONITOR = g_pCompositor->getMonitorFromID(m_iLastSurfaceMonitorID);
m_iLastSurfaceMonitorID = m_iMonitorID;
const auto PNEWMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
if (PLASTMONITOR && PLASTMONITOR->m_bEnabled)
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(this), sendLeaveIter, PLASTMONITOR->output);
wlr_surface_for_each_surface(g_pXWaylandManager->getWindowSurface(this), sendEnterIter, PNEWMONITOR->output);
}
void CWindow::moveToWorkspace(int workspaceID) {
if (m_iWorkspaceID != workspaceID) {
m_iWorkspaceID = workspaceID;
if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(m_iWorkspaceID); PWORKSPACE) {
g_pEventManager->postEvent(SHyprIPCEvent{"movewindow", getFormat("%x,%s", this, PWORKSPACE->m_szName.c_str())});
}
}
}
CWindow* CWindow::X11TransientFor() {
if (!m_bIsX11)
return nullptr;
if (!m_uSurface.xwayland->parent)
return nullptr;
auto PPARENT = g_pCompositor->getWindowFromSurface(m_uSurface.xwayland->parent->surface);
while (g_pCompositor->windowValidMapped(PPARENT) && PPARENT->m_uSurface.xwayland->parent) {
PPARENT = g_pCompositor->getWindowFromSurface(PPARENT->m_uSurface.xwayland->parent->surface);
}
if (!g_pCompositor->windowValidMapped(PPARENT))
return nullptr;
return PPARENT;
}
void CWindow::removeDecorationByType(eDecorationType type) {
for (auto& wd : m_dWindowDecorations) {
if (wd->getDecorationType() == type)
m_vDecosToRemove.push_back(wd.get());
}
updateWindowDecos();
}

View File

@@ -9,11 +9,20 @@
struct SWindowSpecialRenderData {
float alpha = 1.f;
};
float alphaInactive = -1.f; // -1 means unset
// set by the layout
bool rounding = true;
bool border = true;
bool decorate = true;
};
struct SWindowAdditionalConfigData {
std::string animationStyle = "";
int rounding = -1; // -1 means no
bool forceNoBlur = false;
bool forceOpaque = false;
bool forceAllowsInput = false;
};
class CWindow {
@@ -26,8 +35,18 @@ public:
DYNLISTENER(unmapWindow);
DYNLISTENER(destroyWindow);
DYNLISTENER(setTitleWindow);
DYNLISTENER(setGeometryX11U);
DYNLISTENER(fullscreenWindow);
DYNLISTENER(newPopupXDG);
DYNLISTENER(requestMove);
DYNLISTENER(requestMinimize);
DYNLISTENER(requestMaximize);
DYNLISTENER(requestResize);
DYNLISTENER(activateX11);
DYNLISTENER(configureX11);
DYNLISTENER(toplevelClose);
DYNLISTENER(toplevelActivate);
DYNLISTENER(toplevelFullscreen);
// DYNLISTENER(newSubsurfaceWindow);
union {
@@ -43,6 +62,13 @@ public:
CAnimatedVariable m_vRealPosition;
CAnimatedVariable m_vRealSize;
// for not spamming the protocols
Vector2D m_vReportedPosition;
Vector2D m_vReportedSize;
// for restoring floating statuses
Vector2D m_vLastFloatingSize;
// this is used for pseudotiling
bool m_bIsPseudotiled = false;
Vector2D m_vPseudoSize = Vector2D(0,0);
@@ -65,15 +91,19 @@ public:
// XWayland stuff
bool m_bIsX11 = false;
bool m_bMappedX11 = false;
CWindow* m_pX11Parent = nullptr;
uint64_t m_iX11Type = 0;
bool m_bIsModal = false;
bool m_bX11DoesntWantBorders = false;
DYNLISTENER(activateX11);
DYNLISTENER(configureX11);
bool m_bX11ShouldntFocus = false;
//
// For nofocus
bool m_bNoFocus = false;
bool m_bNoInitialFocus = false;
// initial fullscreen
bool m_bWantsInitialFullscreen = false;
SSurfaceTreeNode* m_pSurfaceTree = nullptr;
@@ -90,19 +120,55 @@ public:
// For hidden windows and stuff
bool m_bHidden = false;
// For pinned (sticky) windows
bool m_bPinned = false;
// for proper cycling. While cycling we can't just move the pointers, so we need to keep track of the last cycled window.
CWindow* m_pLastCycledWindow = nullptr;
// Foreign Toplevel proto
wlr_foreign_toplevel_handle_v1* m_phForeignToplevel = nullptr;
// Window decorations
std::deque<std::unique_ptr<IHyprWindowDecoration>> m_dWindowDecorations;
std::vector<IHyprWindowDecoration*> m_vDecosToRemove;
// Special render data, rules, etc
SWindowSpecialRenderData m_sSpecialRenderData;
SWindowAdditionalConfigData m_sAdditionalConfigData;
// for alpha
CAnimatedVariable m_fActiveInactiveAlpha;
// animated shadow color
CAnimatedVariable m_cRealShadowColor;
// animated tint
CAnimatedVariable m_fDimPercent;
// swallowing
CWindow* m_pSwallowed = nullptr;
// for toplevel monitor events
uint64_t m_iLastToplevelMonitorID = -1;
uint64_t m_iLastSurfaceMonitorID = -1;
// For the list lookup
bool operator==(const CWindow& rhs) {
return m_uSurface.xdg == rhs.m_uSurface.xdg && m_uSurface.xwayland == rhs.m_uSurface.xwayland && m_vPosition == rhs.m_vPosition && m_vSize == rhs.m_vSize && m_bFadingOut == rhs.m_bFadingOut;
}
};
// methods
wlr_box getFullWindowBoundingBox();
wlr_box getWindowIdealBoundingBoxIgnoreReserved();
void updateWindowDecos();
pid_t getPID();
IHyprWindowDecoration* getDecorationByType(eDecorationType);
void removeDecorationByType(eDecorationType);
void createToplevelHandle();
void destroyToplevelHandle();
void updateToplevel();
void updateSurfaceOutputs();
void moveToWorkspace(int);
CWindow* X11TransientFor();
};

File diff suppressed because it is too large Load Diff

View File

@@ -16,10 +16,16 @@
#define STRVAL_EMPTY "[[EMPTY]]"
#define INITANIMCFG(name) animationConfig[name] = {}
#define CREATEANIMCFG(name, parent) animationConfig[name] = {false, "", "", 0.f, -1, &animationConfig["global"], &animationConfig[parent]}
struct SConfigValue {
int64_t intValue = -1;
float floatValue = -1;
int64_t intValue = -INT64_MAX;
float floatValue = -__FLT_MAX__;
std::string strValue = "";
Vector2D vecValue = Vector2D(-__FLT_MAX__, -__FLT_MAX__);
bool set = false; // used for device configs
};
struct SMonitorRule {
@@ -28,9 +34,10 @@ struct SMonitorRule {
Vector2D offset = Vector2D(0,0);
float scale = 1;
float refreshRate = 60;
int defaultWorkspaceID = -1;
std::string defaultWorkspace = "";
bool disabled = false;
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
std::string mirrorOf = "";
};
struct SMonitorAdditionalReservedArea {
@@ -43,6 +50,66 @@ struct SMonitorAdditionalReservedArea {
struct SWindowRule {
std::string szRule;
std::string szValue;
bool v2 = false;
std::string szTitle;
std::string szClass;
int bX11 = -1; // -1 means "ANY"
int bFloating = -1;
};
struct SAnimationPropertyConfig {
bool overriden = true;
std::string internalBezier = "";
std::string internalStyle = "";
float internalSpeed = 0.f;
int internalEnabled = -1;
SAnimationPropertyConfig* pValues = nullptr;
SAnimationPropertyConfig* pParentAnimation = nullptr;
};
class CVarList {
public:
CVarList(const std::string& in, long unsigned int lastArgNo = 0) {
std::string curitem = "";
std::string argZ = in;
auto nextItem = [&]() {
auto idx = lastArgNo != 0 && m_vArgs.size() >= lastArgNo - 1 ? std::string::npos : argZ.find_first_of(',');
if (idx != std::string::npos) {
curitem = argZ.substr(0, idx);
argZ = argZ.substr(idx + 1);
} else {
curitem = argZ;
argZ = STRVAL_EMPTY;
}
};
nextItem();
while (curitem != STRVAL_EMPTY) {
m_vArgs.push_back(removeBeginEndSpacesTabs(curitem));
nextItem();
}
};
~CVarList() = default;
int size() const {
return m_vArgs.size();
}
std::string operator[](const long unsigned int& idx) const {
if (idx >= m_vArgs.size())
return "";
return m_vArgs[idx];
}
private:
std::vector<std::string> m_vArgs;
};
class CConfigManager {
@@ -52,17 +119,26 @@ public:
void tick();
void init();
int getInt(std::string);
float getFloat(std::string);
std::string getString(std::string);
int getInt(const std::string&);
float getFloat(const std::string&);
std::string getString(const std::string&);
void setFloat(std::string, float);
void setInt(std::string, int);
void setString(std::string, std::string);
int getDeviceInt(const std::string&, const std::string&);
float getDeviceFloat(const std::string&, const std::string&);
std::string getDeviceString(const std::string&, const std::string&);
bool deviceConfigExists(const std::string&);
bool shouldBlurLS(const std::string&);
SConfigValue* getConfigValuePtr(std::string);
SConfigValue* getConfigValuePtrSafe(std::string);
SMonitorRule getMonitorRuleFor(std::string);
CMonitor* getBoundMonitorForWS(std::string);
std::vector<SWindowRule> getMatchingRules(CWindow*);
std::unordered_map<std::string, SMonitorAdditionalReservedArea> m_mAdditionalReservedAreas;
@@ -73,46 +149,70 @@ public:
void performMonitorReload();
bool m_bWantsMonitorReload = false;
bool m_bForceReload = false;
bool m_bNoMonitorReload = false;
void ensureDPMS();
std::string parseKeyword(const std::string&, const std::string&, bool dynamic = false);
void addParseError(const std::string&);
SAnimationPropertyConfig* getAnimationPropertyConfig(const std::string&);
std::string configCurrentPath;
private:
std::deque<std::string> configPaths; // stores all the config paths
std::unordered_map<std::string, time_t> configModifyTimes; // stores modify times
std::unordered_map<std::string, std::string> configDynamicVars; // stores dynamic vars declared by the user
std::unordered_map<std::string, SConfigValue> configValues;
std::unordered_map<std::string, std::unordered_map<std::string, SConfigValue>> deviceConfigs; // stores device configs
std::string configCurrentPath;
std::unordered_map<std::string, SAnimationPropertyConfig> animationConfig; // stores all the animations with their set values
std::string currentCategory = ""; // For storing the category of the current item
std::string parseError = ""; // For storing a parse error to display later
std::string m_szCurrentSubmap = ""; // For storing the current keybind submap
std::vector<std::pair<std::string, std::string>> boundWorkspaces;
bool isFirstLaunch = true; // For exec-once
std::deque<SMonitorRule> m_dMonitorRules;
std::deque<SWindowRule> m_dWindowRules;
std::deque<std::string> m_dBlurLSNamespaces;
bool firstExecDispatched = false;
std::deque<std::string> firstExecRequests;
// internal methods
void setDefaultVars();
void setDefaultAnimationVars();
void setDeviceDefaultVars(const std::string&);
void setAnimForChildren(SAnimationPropertyConfig *const);
void applyUserDefinedVars(std::string&, const size_t);
void loadConfigLoadVars();
SConfigValue getConfigValueSafe(std::string);
SConfigValue getConfigValueSafe(const std::string&);
SConfigValue getConfigValueSafeDevice(const std::string&, const std::string&);
void parseLine(std::string&);
void configSetValueSafe(const std::string&, const std::string&);
void handleDeviceConfig(const std::string&, const std::string&);
void handleRawExec(const std::string&, const std::string&);
void handleMonitor(const std::string&, const std::string&);
void handleBind(const std::string&, const std::string&);
void handleUnbind(const std::string&, const std::string&);
void handleWindowRule(const std::string&, const std::string&);
void handleWindowRuleV2(const std::string&, const std::string&);
void handleDefaultWorkspace(const std::string&, const std::string&);
void handleBezier(const std::string&, const std::string&);
void handleAnimation(const std::string&, const std::string&);
void handleSource(const std::string&, const std::string&);
void handleSubmap(const std::string&, const std::string&);
void handleBlurLS(const std::string&, const std::string&);
void handleBindWS(const std::string&, const std::string&);
};
inline std::unique_ptr<CConfigManager> g_pConfigManager;
inline std::unique_ptr<CConfigManager> g_pConfigManager;

View File

@@ -9,11 +9,18 @@ PLEASE USE THE CONFIG PROVIDED IN THE GIT REPO /examples/hypr.conf AND EDIT IT,
OR EDIT THIS ONE ACCORDING TO THE WIKI INSTRUCTIONS.
########################################################################################
#
# Please note not all available settings / options are set here.
# For a full list, see the wiki (basic and advanced configuring)
#
autogenerated=1 # remove this line to get rid of the warning on top.
monitor=,1920x1080@60,0x0,1
monitor=,preferred,auto,1
input {
kb_file=
kb_layout=
kb_variant=
kb_model=
@@ -21,11 +28,15 @@ input {
kb_rules=
follow_mouse=1
touchpad {
natural_scroll=no
}
sensitivity=0 # -1.0 - 1.0, 0 means no modification.
}
general {
max_fps=60 # deprecated, unused
sensitivity=0.25
main_mod=SUPER
gaps_in=5
@@ -34,24 +45,24 @@ general {
col.active_border=0x66ee1111
col.inactive_border=0x66333333
damage_tracking=full # experimental, monitor is 100% fine, but full might have some minor bugs, especially with high blur settings!
apply_sens_to_raw=0 # whether to apply the sensitivity to raw input (e.g. used by games where you aim using your mouse)
damage_tracking=full # leave it on full unless you hate your GPU and want to make it suffer
}
decoration {
rounding=10
blur=1
blur_size=3 # minimum 1
blur_passes=1 # minimum 1, more passes = more resource intensive.
# Your blur "amount" is blur_size * blur_passes, but high blur_size (over around 5-ish) will produce artifacts.
# if you want heavy blur, you need to up the blur_passes.
# the more passes, the more you can up the blur_size without noticing artifacts.
blur_passes=1 # minimum 1
blur_new_optimizations=1
}
animations {
enabled=1
animation=windows,1,7,default
animation=borders,1,10,default
animation=fadein,1,10,default
animation=border,1,10,default
animation=fade,1,10,default
animation=workspaces,1,6,default
}
@@ -59,6 +70,10 @@ dwindle {
pseudotile=0 # enable pseudotiling on dwindle
}
gestures {
workspace_swipe=no
}
# example window rules
# for windows named/classed as abc and xyz
#windowrule=move 69 420,abc
@@ -68,8 +83,13 @@ dwindle {
#windowrule=pseudo,abc
#windowrule=monitor 0,xyz
# some nice mouse binds
bindm=SUPER,mouse:272,movewindow
bindm=SUPER,mouse:273,resizewindow
# example binds
bind=SUPER,Q,exec,kitty
bind=SUPER,RETURN,exec,alacritty
bind=SUPER,C,killactive,
bind=SUPER,M,exit,
bind=SUPER,E,exec,dolphin
@@ -103,4 +123,7 @@ bind=ALT,7,movetoworkspace,7
bind=ALT,8,movetoworkspace,8
bind=ALT,9,movetoworkspace,9
bind=ALT,0,movetoworkspace,10
)#";
bind=SUPER,mouse_down,workspace,e+1
bind=SUPER,mouse_up,workspace,e-1
)#";

View File

@@ -13,81 +13,492 @@
#include <string>
std::string monitorsRequest() {
std::string monitorsRequest(HyprCtl::eHyprCtlOutputFormat format) {
std::string result = "";
for (auto& m : g_pCompositor->m_lMonitors) {
result += getFormat("Monitor %s (ID %i):\n\t%ix%i@%f at %ix%i\n\tactive workspace: %i (%s)\n\treserved: %i %i %i %i\n\n",
m.szName.c_str(), m.ID, (int)m.vecSize.x, (int)m.vecSize.y, m.refreshRate, (int)m.vecPosition.x, (int)m.vecPosition.y, m.activeWorkspace, g_pCompositor->getWorkspaceByID(m.activeWorkspace)->m_szName.c_str(), (int)m.vecReservedTopLeft.x, (int)m.vecReservedTopLeft.y, (int)m.vecReservedBottomRight.x, (int)m.vecReservedBottomRight.y);
if (format == HyprCtl::FORMAT_JSON) {
result += "[";
for (auto& m : g_pCompositor->m_vMonitors) {
result += getFormat(
R"#({
"id": %i,
"name": "%s",
"width": %i,
"height": %i,
"refreshRate": %f,
"x": %i,
"y": %i,
"activeWorkspace": {
"id": %i,
"name": "%s"
},
"reserved": [%i, %i, %i, %i],
"scale": %.2f,
"transform": %i,
"focused": %s
},)#",
m->ID,
escapeJSONStrings(m->szName).c_str(),
(int)m->vecPixelSize.x, (int)m->vecPixelSize.y,
m->refreshRate,
(int)m->vecPosition.x, (int)m->vecPosition.y,
m->activeWorkspace, escapeJSONStrings(g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName).c_str(),
(int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y,
m->scale,
(int)m->transform,
(m.get() == g_pCompositor->m_pLastMonitor ? "true" : "false")
);
}
// remove trailing comma
result.pop_back();
result += "]";
} else {
for (auto& m : g_pCompositor->m_vMonitors) {
result += getFormat("Monitor %s (ID %i):\n\t%ix%i@%f at %ix%i\n\tactive workspace: %i (%s)\n\treserved: %i %i %i %i\n\tscale: %.2f\n\ttransform: %i\n\tfocused: %s\n\n",
m->szName.c_str(), m->ID, (int)m->vecPixelSize.x, (int)m->vecPixelSize.y, m->refreshRate, (int)m->vecPosition.x, (int)m->vecPosition.y, m->activeWorkspace, g_pCompositor->getWorkspaceByID(m->activeWorkspace)->m_szName.c_str(), (int)m->vecReservedTopLeft.x, (int)m->vecReservedTopLeft.y, (int)m->vecReservedBottomRight.x, (int)m->vecReservedBottomRight.y, m->scale, (int)m->transform, (m.get() == g_pCompositor->m_pLastMonitor ? "yes" : "no"));
}
}
return result;
}
std::string clientsRequest() {
std::string clientsRequest(HyprCtl::eHyprCtlOutputFormat format) {
std::string result = "";
for (auto& w : g_pCompositor->m_lWindows) {
result += getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i, %i\n\tworkspace: %i (%s)\n\tfloating: %i\n\n",
&w, w.m_szTitle.c_str(), (int)w.m_vRealPosition.vec().x, (int)w.m_vRealPosition.vec().y, (int)w.m_vRealSize.vec().x, (int)w.m_vRealSize.vec().y, w.m_iWorkspaceID, (w.m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w.m_iWorkspaceID)->m_szName.c_str()), (int)w.m_bIsFloating);
if (format == HyprCtl::FORMAT_JSON) {
result += "[";
for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_bIsMapped) {
result += getFormat(
R"#({
"address": "0x%x",
"at": [%i, %i],
"size": [%i, %i],
"workspace": {
"id": %i,
"name": "%s"
},
"floating": %s,
"monitor": %i,
"class": "%s",
"title": "%s",
"pid": %i,
"xwayland": %s,
"pinned": %s,
"fullscreen": %s,
"fullscreenMode": %i
},)#",
w.get(),
(int)w->m_vRealPosition.vec().x, (int)w->m_vRealPosition.vec().y,
(int)w->m_vRealSize.vec().x, (int)w->m_vRealSize.vec().y,
w->m_iWorkspaceID, escapeJSONStrings(w->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName : std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID))).c_str(),
((int)w->m_bIsFloating == 1 ? "true" : "false"),
w->m_iMonitorID,
escapeJSONStrings(g_pXWaylandManager->getAppIDClass(w.get())).c_str(),
escapeJSONStrings(g_pXWaylandManager->getTitle(w.get())).c_str(),
w->getPID(),
((int)w->m_bIsX11 == 1 ? "true" : "false"),
(w->m_bPinned ? "true" : "false"),
(w->m_bIsFullscreen ? "true" : "false"),
(w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0)
);
}
}
// remove trailing comma
if (result != "[")
result.pop_back();
result += "]";
} else {
for (auto& w : g_pCompositor->m_vWindows) {
if (w->m_bIsMapped) {
result += getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\ttitle: %s\n\tpid: %i\n\txwayland: %i\n\tpinned: %i\n\tfullscreen: %i\n\tfullscreenmode: %i\n\n",
w.get(), w->m_szTitle.c_str(), (int)w->m_vRealPosition.vec().x, (int)w->m_vRealPosition.vec().y, (int)w->m_vRealSize.vec().x, (int)w->m_vRealSize.vec().y, w->m_iWorkspaceID, (w->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_szName.c_str() : std::string("Invalid workspace " + std::to_string(w->m_iWorkspaceID)).c_str()), (int)w->m_bIsFloating, w->m_iMonitorID, g_pXWaylandManager->getAppIDClass(w.get()).c_str(), g_pXWaylandManager->getTitle(w.get()).c_str(), w->getPID(), (int)w->m_bIsX11, (int)w->m_bPinned, (int)w->m_bIsFullscreen, (w->m_bIsFullscreen ? (g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID) ? g_pCompositor->getWorkspaceByID(w->m_iWorkspaceID)->m_efFullscreenMode : 0) : 0));
}
}
}
return result;
}
std::string workspacesRequest() {
std::string workspacesRequest(HyprCtl::eHyprCtlOutputFormat format) {
std::string result = "";
for (auto& w : g_pCompositor->m_lWorkspaces) {
result += getFormat("workspace ID %i (%s) on monitor %s:\n\twindows: %i\n\thasfullscreen: %i\n\n",
w.m_iID, w.m_szName.c_str(), g_pCompositor->getMonitorFromID(w.m_iMonitorID)->szName.c_str(), g_pCompositor->getWindowsOnWorkspace(w.m_iID), (int)w.m_bHasFullscreenWindow);
if (format == HyprCtl::FORMAT_JSON) {
result += "[";
for (auto& w : g_pCompositor->m_vWorkspaces) {
const auto PLASTW = w->getLastFocusedWindow();
result += getFormat(
R"#({
"id": %i,
"name": "%s",
"monitor": "%s",
"windows": %i,
"hasfullscreen": %s,
"lastwindow": "0x%x",
"lastwindowtitle": "%s"
},)#",
w->m_iID,
escapeJSONStrings(w->m_szName).c_str(),
escapeJSONStrings(g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName).c_str(),
g_pCompositor->getWindowsOnWorkspace(w->m_iID),
((int)w->m_bHasFullscreenWindow == 1 ? "true" : "false"),
PLASTW,
PLASTW ? escapeJSONStrings(PLASTW->m_szTitle).c_str() : ""
);
}
// remove trailing comma
result.pop_back();
result += "]";
} else {
for (auto& w : g_pCompositor->m_vWorkspaces) {
const auto PLASTW = w->getLastFocusedWindow();
result += getFormat("workspace ID %i (%s) on monitor %s:\n\twindows: %i\n\thasfullscreen: %i\n\tlastwindow: 0x%x\n\tlastwindowtitle: %s\n\n",
w->m_iID, w->m_szName.c_str(), g_pCompositor->getMonitorFromID(w->m_iMonitorID)->szName.c_str(), g_pCompositor->getWindowsOnWorkspace(w->m_iID), (int)w->m_bHasFullscreenWindow, PLASTW, PLASTW ? PLASTW->m_szTitle.c_str() : "");
}
}
return result;
}
std::string activeWindowRequest() {
std::string activeWindowRequest(HyprCtl::eHyprCtlOutputFormat format) {
const auto PWINDOW = g_pCompositor->m_pLastWindow;
if (!g_pCompositor->windowValidMapped(PWINDOW))
return "Invalid";
return format == HyprCtl::FORMAT_JSON ? "{}" : "Invalid";
return getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i, %i\n\tworkspace: %i (%s)\n\tfloating: %i\n\n",
PWINDOW, PWINDOW->m_szTitle.c_str(), (int)PWINDOW->m_vRealPosition.vec().x, (int)PWINDOW->m_vRealPosition.vec().y, (int)PWINDOW->m_vRealSize.vec().x, (int)PWINDOW->m_vRealSize.vec().y, PWINDOW->m_iWorkspaceID, (PWINDOW->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_szName.c_str()), (int)PWINDOW->m_bIsFloating);
if (format == HyprCtl::FORMAT_JSON) {
return getFormat(
R"#({
"address": "0x%x",
"at": [%i, %i],
"size": [%i, %i],
"workspace": {
"id": %i,
"name": "%s"
},
"floating": %s,
"monitor": %i,
"class": "%s",
"title": "%s",
"pid": %i,
"xwayland": %s
})#",
PWINDOW,
(int)PWINDOW->m_vRealPosition.vec().x, (int)PWINDOW->m_vRealPosition.vec().y,
(int)PWINDOW->m_vRealSize.vec().x, (int)PWINDOW->m_vRealSize.vec().y,
PWINDOW->m_iWorkspaceID, escapeJSONStrings(PWINDOW->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_szName).c_str(),
((int)PWINDOW->m_bIsFloating == 1 ? "true" : "false"),
PWINDOW->m_iMonitorID,
escapeJSONStrings(g_pXWaylandManager->getAppIDClass(PWINDOW)).c_str(),
escapeJSONStrings(g_pXWaylandManager->getTitle(PWINDOW)).c_str(),
PWINDOW->getPID(),
((int)PWINDOW->m_bIsX11 == 1 ? "true" : "false")
);
} else {
return getFormat("Window %x -> %s:\n\tat: %i,%i\n\tsize: %i,%i\n\tworkspace: %i (%s)\n\tfloating: %i\n\tmonitor: %i\n\tclass: %s\n\ttitle: %s\n\tpid: %i\n\txwayland: %i\n\n",
PWINDOW, PWINDOW->m_szTitle.c_str(), (int)PWINDOW->m_vRealPosition.vec().x, (int)PWINDOW->m_vRealPosition.vec().y, (int)PWINDOW->m_vRealSize.vec().x, (int)PWINDOW->m_vRealSize.vec().y, PWINDOW->m_iWorkspaceID, (PWINDOW->m_iWorkspaceID == -1 ? "" : g_pCompositor->getWorkspaceByID(PWINDOW->m_iWorkspaceID)->m_szName.c_str()), (int)PWINDOW->m_bIsFloating, (int)PWINDOW->m_iMonitorID, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), g_pXWaylandManager->getTitle(PWINDOW).c_str(), PWINDOW->getPID(), (int)PWINDOW->m_bIsX11);
}
}
std::string layersRequest() {
std::string layersRequest(HyprCtl::eHyprCtlOutputFormat format) {
std::string result = "";
for (auto& mon : g_pCompositor->m_lMonitors) {
result += getFormat("Monitor %s:\n");
int layerLevel = 0;
for (auto& level : mon.m_aLayerSurfaceLists) {
result += getFormat("\tLayer level %i:\n", layerLevel);
if (format == HyprCtl::FORMAT_JSON) {
result += "{\n";
for (auto& layer : level) {
result += getFormat("\t\tLayer %x: xywh: %i %i %i %i\n", layer, layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height);
for (auto& mon : g_pCompositor->m_vMonitors) {
result += getFormat(
R"#("%s": {
"levels": {
)#",
escapeJSONStrings(mon->szName).c_str()
);
int layerLevel = 0;
for (auto& level : mon->m_aLayerSurfaceLists) {
result += getFormat(
R"#(
"%i": [
)#",
layerLevel
);
for (auto& layer : level) {
result += getFormat(
R"#( {
"address": "0x%x",
"x": %i,
"y": %i,
"w": %i,
"h": %i,
"namespace": "%s"
},)#",
layer.get(),
layer->geometry.x,
layer->geometry.y,
layer->geometry.width,
layer->geometry.height,
escapeJSONStrings(layer->szNamespace).c_str()
);
}
// remove trailing comma
result.pop_back();
if (level.size() > 0)
result += "\n ";
result += "],";
layerLevel++;
}
layerLevel++;
// remove trailing comma
result.pop_back();
result += "\n }\n},";
}
// remove trailing comma
result.pop_back();
result += "\n}\n";
} else {
for (auto& mon : g_pCompositor->m_vMonitors) {
result += getFormat("Monitor %s:\n", mon->szName.c_str());
int layerLevel = 0;
for (auto& level : mon->m_aLayerSurfaceLists) {
result += getFormat("\tLayer level %i:\n", layerLevel);
for (auto& layer : level) {
result += getFormat("\t\tLayer %x: xywh: %i %i %i %i, namespace: %s\n", layer.get(), layer->geometry.x, layer->geometry.y, layer->geometry.width, layer->geometry.height, layer->szNamespace.c_str());
}
layerLevel++;
}
result += "\n\n";
}
result += "\n\n";
}
return result;
}
std::string versionRequest() {
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + GIT_DIRTY + " (" + GIT_COMMIT_MESSAGE + ").\nflags: (if any)\n";
std::string devicesRequest(HyprCtl::eHyprCtlOutputFormat format) {
std::string result = "";
#ifdef LEGACY_RENDERER
result += "legacyrenderer\n";
#endif
#ifndef NDEBUG
result += "debug\n";
#endif
#ifdef NO_XWAYLAND
result += "no xwayland\n";
#endif
if (format == HyprCtl::FORMAT_JSON) {
result += "{\n";
result += "\"mice\": [\n";
for (auto& m : g_pInputManager->m_lMice) {
result += getFormat(
R"#( {
"address": "0x%x",
"name": "%s",
"defaultSpeed": %f
},)#",
&m,
escapeJSONStrings(m.mouse->name).c_str(),
wlr_input_device_is_libinput(m.mouse) ? libinput_device_config_accel_get_default_speed((libinput_device*)wlr_libinput_get_device_handle(m.mouse)) : 0.f
);
}
// remove trailing comma
result.pop_back();
result += "\n],\n";
result += "\"keyboards\": [\n";
for (auto& k : g_pInputManager->m_lKeyboards) {
const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k);
result += getFormat(
R"#( {
"address": "0x%x",
"name": "%s",
"rules": "%s",
"model": "%s",
"layout": "%s",
"variant": "%s",
"options": "%s",
"active_keymap": "%s",
"main": %s
},)#",
&k,
escapeJSONStrings(k.keyboard->name).c_str(),
escapeJSONStrings(k.currentRules.rules).c_str(),
escapeJSONStrings(k.currentRules.model).c_str(),
escapeJSONStrings(k.currentRules.layout).c_str(),
escapeJSONStrings(k.currentRules.variant).c_str(),
escapeJSONStrings(k.currentRules.options).c_str(),
escapeJSONStrings(KM).c_str(),
(k.active ? "true" : "false")
);
}
// remove trailing comma
result.pop_back();
result += "\n],\n";
result += "\"tablets\": [\n";
for (auto& d : g_pInputManager->m_lTabletPads) {
result += getFormat(
R"#( {
"address": "0x%x",
"type": "tabletPad",
"belongsTo": {
"address": "0x%x",
"name": "%s"
}
},)#",
&d,
d.pTabletParent,
escapeJSONStrings(d.pTabletParent ? d.pTabletParent->wlrDevice ? d.pTabletParent->wlrDevice->name : "" : "").c_str()
);
}
for (auto& d : g_pInputManager->m_lTablets) {
result += getFormat(
R"#( {
"address": "0x%x",
"name": "%s"
},)#",
&d,
escapeJSONStrings(d.wlrDevice ? d.wlrDevice->name : "").c_str()
);
}
for (auto& d : g_pInputManager->m_lTabletTools) {
result += getFormat(
R"#( {
"address": "0x%x",
"type": "tabletTool",
"belongsTo": "0x%x"
},)#",
&d,
d.wlrTabletTool ? d.wlrTabletTool->data : 0
);
}
// remove trailing comma
result.pop_back();
result += "\n],\n";
result += "\"touch\": [\n";
for (auto& d : g_pInputManager->m_lTouchDevices) {
result += getFormat(
R"#( {
"address": "0x%x",
"name": "%s"
},)#",
&d,
d.pWlrDevice ? d.pWlrDevice->name : ""
);
}
// remove trailing comma
if (result[result.size() - 1] == ',')
result.pop_back();
result += "\n]\n";
result += "}\n";
} else {
result += "mice:\n";
for (auto& m : g_pInputManager->m_lMice) {
result += getFormat("\tMouse at %x:\n\t\t%s\n\t\t\tdefault speed: %f\n", &m, m.mouse->name, (wlr_input_device_is_libinput(m.mouse) ? libinput_device_config_accel_get_default_speed((libinput_device*)wlr_libinput_get_device_handle(m.mouse)) : 0.f));
}
result += "\n\nKeyboards:\n";
for (auto& k : g_pInputManager->m_lKeyboards) {
const auto KM = g_pInputManager->getActiveLayoutForKeyboard(&k);
result += getFormat("\tKeyboard at %x:\n\t\t%s\n\t\t\trules: r \"%s\", m \"%s\", l \"%s\", v \"%s\", o \"%s\"\n\t\t\tactive keymap: %s\n\t\t\tmain: %s\n", &k, k.keyboard->name, k.currentRules.rules.c_str(), k.currentRules.model.c_str(), k.currentRules.layout.c_str(), k.currentRules.variant.c_str(), k.currentRules.options.c_str(), KM.c_str(), (k.active ? "yes" : "no"));
}
result += "\n\nTablets:\n";
for (auto& d : g_pInputManager->m_lTabletPads) {
result += getFormat("\tTablet Pad at %x (belongs to %x -> %s)\n", &d, d.pTabletParent, d.pTabletParent ? d.pTabletParent->wlrDevice ? d.pTabletParent->wlrDevice->name : "" : "");
}
for (auto& d : g_pInputManager->m_lTablets) {
result += getFormat("\tTablet at %x:\n\t\t%s\n", &d, d.wlrDevice ? d.wlrDevice->name : "");
}
for (auto& d : g_pInputManager->m_lTabletTools) {
result += getFormat("\tTablet Tool at %x (belongs to %x)\n", &d, d.wlrTabletTool ? d.wlrTabletTool->data : 0);
}
result += "\n\nTouch:\n";
for (auto& d : g_pInputManager->m_lTouchDevices) {
result += getFormat("\tTouch Device at %x:\n\t\t%s\n", &d, d.pWlrDevice ? d.pWlrDevice->name : "");
}
}
return result;
}
std::string versionRequest(HyprCtl::eHyprCtlOutputFormat format) {
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL) {
std::string result = "Hyprland, built from branch " + std::string(GIT_BRANCH) + " at commit " + GIT_COMMIT_HASH + GIT_DIRTY + " (" + removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str() + ").\nflags: (if any)\n";
#ifdef LEGACY_RENDERER
result += "legacyrenderer\n";
#endif
#ifndef NDEBUG
result += "debug\n";
#endif
#ifdef HYPRLAND_DEBUG
result += "debug\n";
#endif
#ifdef NO_XWAYLAND
result += "no xwayland\n";
#endif
return result;
} else {
std::string result = getFormat(
R"#({
"branch": "%s",
"commit": "%s",
"dirty": %s
"commit_message": "%s",
"flags": [)#", GIT_BRANCH, GIT_COMMIT_HASH, (strcmp(GIT_DIRTY, "dirty") == 0 ? "true" : "false"), removeBeginEndSpacesTabs(GIT_COMMIT_MESSAGE).c_str());
#ifdef LEGACY_RENDERER
result += "\"legacyrenderer\",";
#endif
#ifndef NDEBUG
result += "\"debug\",";
#endif
#ifdef HYPRLAND_DEBUG
result += "\"debug\",";
#endif
#ifdef NO_XWAYLAND
result += "\"no xwayland\",";
#endif
if (result[result.length() - 1] == ',')
result.pop_back();
result += "]\n}";
return result;
}
return ""; // make the compiler happy
}
std::string dispatchRequest(std::string in) {
// get rid of the dispatch keyword
in = in.substr(in.find_first_of(' ') + 1);
@@ -120,23 +531,47 @@ std::string dispatchKeyword(std::string in) {
if (COMMAND == "monitor")
g_pConfigManager->m_bWantsMonitorReload = true; // for monitor keywords
if (COMMAND.find("input") != std::string::npos)
if (COMMAND.contains("input") || COMMAND.contains("device:")) {
g_pInputManager->setKeyboardLayout(); // update kb layout
g_pInputManager->setMouseConfigs(); // update mouse cfgs
}
if (COMMAND.contains("general:layout"))
g_pLayoutManager->switchToLayout(g_pConfigManager->getString("general:layout")); // update layout
Debug::log(LOG, "Hyprctl: keyword %s : %s", COMMAND.c_str(), VALUE.c_str());
if (retval == "")
if (retval == "")
return "ok";
return retval;
}
std::string reloadRequest() {
std::string reloadRequest(std::string request) {
const auto REQMODE = request.substr(request.find_last_of(' ') + 1);
g_pConfigManager->m_bForceReload = true;
if (REQMODE == "config-only") {
g_pConfigManager->m_bNoMonitorReload = true;
}
g_pConfigManager->tick();
return "ok";
}
std::string killRequest() {
g_pInputManager->setClickMode(CLICKMODE_KILL);
return "ok";
}
std::string splashRequest() {
return g_pCompositor->m_szCurrentSplash;
}
std::string getReply(std::string);
std::string dispatchBatch(std::string request) {
@@ -171,34 +606,167 @@ std::string dispatchBatch(std::string request) {
return reply;
}
std::string dispatchSetCursor(std::string request) {
std::string curitem = "";
auto nextItem = [&]() {
auto idx = request.find_first_of(' ');
if (idx != std::string::npos) {
curitem = request.substr(0, idx);
request = request.substr(idx + 1);
} else {
curitem = request;
request = "";
}
curitem = removeBeginEndSpacesTabs(curitem);
};
nextItem();
nextItem();
const auto THEME = curitem;
nextItem();
const auto SIZE = curitem;
if (!isNumber(SIZE)) {
return "size not int";
}
const auto SIZEINT = std::stoi(SIZE);
if (SIZEINT < 1) {
return "size must be positive";
}
wlr_xcursor_manager_destroy(g_pCompositor->m_sWLRXCursorMgr);
g_pCompositor->m_sWLRXCursorMgr = wlr_xcursor_manager_create(THEME.c_str(), SIZEINT);
setenv("XCURSOR_SIZE", SIZE.c_str(), true);
setenv("XCURSOR_THEME", THEME.c_str(), true);
for (auto& m : g_pCompositor->m_vMonitors) {
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, m->scale);
}
return "ok";
}
std::string dispatchGetOption(std::string request, HyprCtl::eHyprCtlOutputFormat format) {
std::string curitem = "";
auto nextItem = [&]() {
auto idx = request.find_first_of(' ');
if (idx != std::string::npos) {
curitem = request.substr(0, idx);
request = request.substr(idx + 1);
} else {
curitem = request;
request = "";
}
curitem = removeBeginEndSpacesTabs(curitem);
};
nextItem();
nextItem();
const auto PCFGOPT = g_pConfigManager->getConfigValuePtrSafe(curitem);
if (!PCFGOPT)
return "no such option";
if (format == HyprCtl::eHyprCtlOutputFormat::FORMAT_NORMAL)
return getFormat("option %s\n\tint: %i\n\tfloat: %f\n\tstr: \"%s\"", curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str());
else {
return getFormat(
R"#(
{
"option": "%s",
"int": %i,
"float": %f,
"str": "%s"
}
)#", curitem.c_str(), PCFGOPT->intValue, PCFGOPT->floatValue, PCFGOPT->strValue.c_str()
);
}
}
std::string getReply(std::string request) {
auto format = HyprCtl::FORMAT_NORMAL;
// process flags for non-batch requests
if (!request.contains("[[BATCH]]") && request.contains("/")) {
long unsigned int sepIndex = 0;
for (const auto& c : request) {
if (c == '/') { // stop at separator
break;
}
sepIndex++;
if (c == 'j')
format = HyprCtl::FORMAT_JSON;
}
if (sepIndex < request.size())
request = request.substr(sepIndex + 1); // remove flags and separator so we can compare the rest of the string
}
if (request == "monitors")
return monitorsRequest();
return monitorsRequest(format);
else if (request == "workspaces")
return workspacesRequest();
return workspacesRequest(format);
else if (request == "clients")
return clientsRequest();
return clientsRequest(format);
else if (request == "kill")
return killRequest();
else if (request == "activewindow")
return activeWindowRequest();
return activeWindowRequest(format);
else if (request == "layers")
return layersRequest();
return layersRequest(format);
else if (request == "version")
return versionRequest();
else if (request == "reload")
return reloadRequest();
return versionRequest(format);
else if (request.find("reload") == 0)
return reloadRequest(request);
else if (request == "devices")
return devicesRequest(format);
else if (request == "splash")
return splashRequest();
else if (request.find("dispatch") == 0)
return dispatchRequest(request);
else if (request.find("keyword") == 0)
return dispatchKeyword(request);
else if (request.find("setcursor") == 0)
return dispatchSetCursor(request);
else if (request.find("getoption") == 0)
return dispatchGetOption(request, format);
else if (request.find("[[BATCH]]") == 0)
return dispatchBatch(request);
return "unknown request";
}
void HyprCtl::tickHyprCtl() {
if (!requestMade)
return;
int hyprCtlFDTick(int fd, uint32_t mask, void* data) {
if (mask & WL_EVENT_ERROR || mask & WL_EVENT_HANGUP)
return 0;
sockaddr_in clientAddress;
socklen_t clientSize = sizeof(clientAddress);
const auto ACCEPTEDCONNECTION = accept(HyprCtl::iSocketFD, (sockaddr*)&clientAddress, &clientSize);
char readBuffer[1024];
auto messageSize = read(ACCEPTEDCONNECTION, readBuffer, 1024);
readBuffer[messageSize == 1024 ? 1023 : messageSize] = '\0';
std::string request(readBuffer);
std::string reply = "";
@@ -209,81 +777,38 @@ void HyprCtl::tickHyprCtl() {
reply = "Err: " + std::string(e.what());
}
request = reply;
write(ACCEPTEDCONNECTION, reply.c_str(), reply.length());
requestMade = false;
requestReady = true;
}
close(ACCEPTEDCONNECTION);
std::string getRequestFromThread(std::string rq) {
while (HyprCtl::request != "" || HyprCtl::requestMade || HyprCtl::requestReady) {
std::this_thread::sleep_for(std::chrono::milliseconds(5));
if (g_pConfigManager->m_bWantsMonitorReload) {
g_pConfigManager->ensureDPMS();
}
HyprCtl::request = rq;
HyprCtl::requestMade = true;
while (!HyprCtl::requestReady) {
std::this_thread::sleep_for(std::chrono::milliseconds(5));
}
HyprCtl::requestReady = false;
HyprCtl::requestMade = false;
std::string toReturn = HyprCtl::request;
HyprCtl::request = "";
return toReturn;
return 0;
}
void HyprCtl::startHyprCtlSocket() {
std::thread([&]() {
const auto SOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
if (SOCKET < 0) {
Debug::log(ERR, "Couldn't start the Hyprland Socket. (1) IPC will not work.");
return;
}
iSocketFD = socket(AF_UNIX, SOCK_STREAM, 0);
unlink("/tmp/hypr/.socket.sock");
if (iSocketFD < 0) {
Debug::log(ERR, "Couldn't start the Hyprland Socket. (1) IPC will not work.");
return;
}
sockaddr_un SERVERADDRESS = {.sun_family = AF_UNIX};
sockaddr_un SERVERADDRESS = {.sun_family = AF_UNIX};
strcpy(SERVERADDRESS.sun_path, "/tmp/hypr/.socket.sock");
std::string socketPath = "/tmp/hypr/" + g_pCompositor->m_szInstanceSignature + "/.socket.sock";
bind(SOCKET, (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS));
strcpy(SERVERADDRESS.sun_path, socketPath.c_str());
// 10 max queued.
listen(SOCKET, 10);
bind(iSocketFD, (sockaddr*)&SERVERADDRESS, SUN_LEN(&SERVERADDRESS));
sockaddr_in clientAddress;
socklen_t clientSize = sizeof(clientAddress);
// 10 max queued.
listen(iSocketFD, 10);
char readBuffer[1024] = {0};
Debug::log(LOG, "Hypr socket started at %s", socketPath.c_str());
Debug::log(LOG, "Hypr socket started.");
while(1) {
const auto ACCEPTEDCONNECTION = accept(SOCKET, (sockaddr*)&clientAddress, &clientSize);
if (ACCEPTEDCONNECTION < 0) {
Debug::log(ERR, "Couldn't listen on the Hyprland Socket. (3) IPC will not work.");
break;
}
auto messageSize = read(ACCEPTEDCONNECTION, readBuffer, 1024);
readBuffer[messageSize == 1024 ? 1023 : messageSize] = '\0';
std::string request(readBuffer);
std::string reply = getRequestFromThread(request);
write(ACCEPTEDCONNECTION, reply.c_str(), reply.length());
close(ACCEPTEDCONNECTION);
}
close(SOCKET);
}).detach();
}
wl_event_loop_add_fd(g_pCompositor->m_sWLEventLoop, iSocketFD, WL_EVENT_READABLE, hyprCtlFDTick, nullptr);
}

View File

@@ -6,7 +6,6 @@
namespace HyprCtl {
void startHyprCtlSocket();
void tickHyprCtl();
// very simple thread-safe request method
inline bool requestMade = false;
@@ -14,4 +13,13 @@ namespace HyprCtl {
inline std::string request = "";
inline std::ifstream requestStream;
inline wl_event_source* hyprCtlTickSource = nullptr;
inline int iSocketFD = -1;
enum eHyprCtlOutputFormat {
FORMAT_NORMAL = 0,
FORMAT_JSON
};
};

View File

@@ -1,7 +1,7 @@
#include "HyprDebugOverlay.hpp"
#include "../Compositor.hpp"
void CHyprMonitorDebugOverlay::renderData(SMonitor* pMonitor, float µs) {
void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
m_dLastRenderTimes.push_back(µs / 1000.f);
if (m_dLastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate)
@@ -11,7 +11,7 @@ void CHyprMonitorDebugOverlay::renderData(SMonitor* pMonitor, float µs) {
m_pMonitor = pMonitor;
}
void CHyprMonitorDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs) {
void CHyprMonitorDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) {
m_dLastRenderTimesNoOverlay.push_back(µs / 1000.f);
if (m_dLastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate)
@@ -21,7 +21,7 @@ void CHyprMonitorDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs
m_pMonitor = pMonitor;
}
void CHyprMonitorDebugOverlay::frameData(SMonitor* pMonitor) {
void CHyprMonitorDebugOverlay::frameData(CMonitor* pMonitor) {
m_dLastFrametimes.push_back(std::chrono::duration_cast<std::chrono::microseconds>(std::chrono::high_resolution_clock::now() - m_tpLastFrame).count() / 1000.f);
if (m_dLastFrametimes.size() > (long unsigned int)pMonitor->refreshRate)
@@ -120,27 +120,27 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
yOffset += 11;
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
m_wbLastDrawnBox = {(int)g_pCompositor->m_lMonitors.front().vecPosition.x, (int)g_pCompositor->m_lMonitors.front().vecPosition.y + offset - 1, (int)maxX + 2, yOffset - offset + 2};
m_wbLastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset - 1, (int)maxX + 2, yOffset - offset + 2};
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
return yOffset - offset;
}
void CHyprDebugOverlay::renderData(SMonitor* pMonitor, float µs) {
void CHyprDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
m_mMonitorOverlays[pMonitor].renderData(pMonitor, µs);
}
void CHyprDebugOverlay::renderDataNoOverlay(SMonitor* pMonitor, float µs) {
void CHyprDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) {
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, µs);
}
void CHyprDebugOverlay::frameData(SMonitor* pMonitor) {
void CHyprDebugOverlay::frameData(CMonitor* pMonitor) {
m_mMonitorOverlays[pMonitor].frameData(pMonitor);
}
void CHyprDebugOverlay::draw() {
const auto PMONITOR = &g_pCompositor->m_lMonitors.front();
const auto PMONITOR = g_pCompositor->m_vMonitors.front().get();
if (!m_pCairoSurface || !m_pCairo) {
m_pCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
@@ -155,8 +155,8 @@ void CHyprDebugOverlay::draw() {
// draw the things
int offsetY = 0;
for (auto& m : g_pCompositor->m_lMonitors) {
offsetY += m_mMonitorOverlays[&m].draw(offsetY);
for (auto& m : g_pCompositor->m_vMonitors) {
offsetY += m_mMonitorOverlays[m.get()].draw(offsetY);
offsetY += 5; // for padding between mons
}

View File

@@ -11,16 +11,16 @@ class CHyprMonitorDebugOverlay {
public:
int draw(int offset);
void renderData(SMonitor* pMonitor, float µs);
void renderDataNoOverlay(SMonitor* pMonitor, float µs);
void frameData(SMonitor* pMonitor);
void renderData(CMonitor* pMonitor, float µs);
void renderDataNoOverlay(CMonitor* pMonitor, float µs);
void frameData(CMonitor* pMonitor);
private:
std::deque<float> m_dLastFrametimes;
std::deque<float> m_dLastRenderTimes;
std::deque<float> m_dLastRenderTimesNoOverlay;
std::chrono::high_resolution_clock::time_point m_tpLastFrame;
SMonitor* m_pMonitor = nullptr;
CMonitor* m_pMonitor = nullptr;
wlr_box m_wbLastDrawnBox;
};
@@ -28,13 +28,13 @@ class CHyprDebugOverlay {
public:
void draw();
void renderData(SMonitor*, float µs);
void renderDataNoOverlay(SMonitor*, float µs);
void frameData(SMonitor*);
void renderData(CMonitor*, float µs);
void renderDataNoOverlay(CMonitor*, float µs);
void frameData(CMonitor*);
private:
std::unordered_map<SMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
std::unordered_map<CMonitor*, CHyprMonitorDebugOverlay> m_mMonitorOverlays;
cairo_surface_t* m_pCairoSurface = nullptr;
cairo_t* m_pCairo = nullptr;

View File

@@ -1,15 +1,38 @@
#include "Log.hpp"
#include "../defines.hpp"
#include "../Compositor.hpp"
#include <fstream>
#include <iostream>
void Debug::init(std::string IS) {
logFile = "/tmp/hypr/" + IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
}
void Debug::wlrLog(wlr_log_importance level, const char* fmt, va_list args) {
char* outputStr = nullptr;
std::ofstream ofs;
ofs.open(logFile, std::ios::out | std::ios::app);
vasprintf(&outputStr, fmt, args);
std::string output = std::string(outputStr);
free(outputStr);
ofs << "[wlr] " << output << "\n";
ofs.close();
}
void Debug::log(LogLevel level, const char* fmt, ...) {
if (disableLogs && *disableLogs)
return;
// log to a file
const std::string DEBUGPATH = ISDEBUG ? "/tmp/hypr/hyprlandd.log" : "/tmp/hypr/hyprland.log";
std::ofstream ofs;
ofs.open(DEBUGPATH, std::ios::out | std::ios::app);
ofs.open(logFile, std::ios::out | std::ios::app);
switch (level) {
case LOG:
@@ -24,41 +47,44 @@ void Debug::log(LogLevel level, const char* fmt, ...) {
case CRIT:
ofs << "[CRITICAL] ";
break;
case INFO:
ofs << "[INFO] ";
break;
default:
break;
}
char buf[LOGMESSAGESIZE] = "";
char* outputStr;
int logLen;
// print date and time to the ofs
if (disableTime && !*disableTime) {
auto timet = std::chrono::system_clock::to_time_t(std::chrono::system_clock::now());
const auto MILLIS = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now().time_since_epoch()).count() % 1000;
ofs << std::put_time(std::localtime(&timet), "[%H:%M:%S:");
if (MILLIS > 99)
ofs << MILLIS;
else if (MILLIS > 9)
ofs << "0" << MILLIS;
else
ofs << "00" << MILLIS;
ofs << "] ";
}
char* outputStr = nullptr;
va_list args;
va_start(args, fmt);
logLen = vsnprintf(buf, sizeof buf, fmt, args);
vasprintf(&outputStr, fmt, args);
va_end(args);
if ((long unsigned int)logLen < sizeof buf) {
outputStr = strdup(buf);
} else {
outputStr = (char*)malloc(logLen + 1);
std::string output = std::string(outputStr);
free(outputStr);
if (!outputStr) {
printf("CRITICAL: Cannot alloc size %d for log! (Out of memory?)", logLen + 1);
return;
}
va_start(args, fmt);
vsnprintf(outputStr, logLen + 1U, fmt, args);
va_end(args);
}
ofs << outputStr << "\n";
ofs << output << "\n";
ofs.close();
// log it to the stdout too.
std::cout << outputStr << "\n";
// free the log
free(outputStr);
std::cout << output << "\n";
}

View File

@@ -1,5 +1,6 @@
#pragma once
#include <string>
#include <wlr/util/log.h>
#define LOGMESSAGESIZE 1024
@@ -8,9 +9,16 @@ enum LogLevel {
LOG = 0,
WARN,
ERR,
CRIT
CRIT,
INFO
};
namespace Debug {
void init(std::string IS);
void log(LogLevel level, const char* fmt, ...);
void wlrLog(wlr_log_importance level, const char* fmt, va_list args);
inline std::string logFile;
inline int64_t* disableLogs = nullptr;
inline int64_t* disableTime = nullptr;
};

View File

@@ -7,12 +7,14 @@
#include "wlrunstable/wlr_ext_workspace_v1.hpp"
#ifndef NDEBUG
#ifdef HYPRLAND_DEBUG
#define ISDEBUG true
#else
#define ISDEBUG false
#endif
#define RIP(format, ... ) { fprintf(stderr, format "\n", ##__VA_ARGS__); exit(EXIT_FAILURE); }
#else
#define ISDEBUG false
#endif
#define LISTENER(name) void listener_##name(wl_listener*, void*); inline wl_listener listen_##name = { .notify = listener_##name };
#define DYNLISTENFUNC(name) void listener_##name(void*, void*);
@@ -26,7 +28,7 @@
#define PIXMAN_DAMAGE_FOREACH(region) int rectsNum = 0; \
const auto RECTSARR = pixman_region32_rectangles(region, &rectsNum); \
for (int i = 0; i < rectsNum; ++i)
#define interface class
@@ -52,6 +54,12 @@
#define ASSERT(expr) RASSERT(expr, "?")
#if ISDEBUG
#define UNREACHABLE() { Debug::log(CRIT, "\n\nMEMORY CORRUPTED: Unreachable failed! (Reached an unreachable position, memory corruption!!!)"); *((int*)nullptr) = 1; }
#else
#define UNREACHABLE() std::unreachable();
#endif
// git stuff
#ifndef GIT_COMMIT_HASH
#define GIT_COMMIT_HASH "?"
@@ -64,4 +72,6 @@
#endif
#ifndef GIT_DIRTY
#define GIT_DIRTY "?"
#endif
#endif
#define SPECIAL_WORKSPACE_ID -99

View File

@@ -2,7 +2,7 @@
#include "../Compositor.hpp"
#include "../helpers/WLClasses.hpp"
#include "../managers/InputManager.hpp"
#include "../managers/input/InputManager.hpp"
#include "../render/Renderer.hpp"
// ---------------------------------------------------- //
@@ -49,16 +49,13 @@ void Events::listener_mouseButton(wl_listener* listener, void* data) {
}
void Events::listener_mouseAxis(wl_listener* listener, void* data) {
const auto E = (wlr_pointer_axis_event*)data;
wlr_seat_pointer_notify_axis(g_pCompositor->m_sSeat.seat, E->time_msec, E->orientation, E->delta, E->delta_discrete, E->source);
g_pInputManager->onMouseWheel((wlr_pointer_axis_event*)data);
}
void Events::listener_requestMouse(wl_listener* listener, void* data) {
const auto EVENT = (wlr_seat_pointer_request_set_cursor_event*)data;
if (EVENT->seat_client == g_pCompositor->m_sSeat.seat->pointer_state.focused_client)
wlr_cursor_set_surface(g_pCompositor->m_sWLRCursor, EVENT->surface, EVENT->hotspot_x, EVENT->hotspot_y);
g_pInputManager->processMouseRequest(EVENT);
}
void Events::listener_newInput(wl_listener* listener, void* data) {
@@ -73,13 +70,24 @@ void Events::listener_newInput(wl_listener* listener, void* data) {
Debug::log(LOG, "Attached a mouse with name %s", DEVICE->name);
g_pInputManager->newMouse(DEVICE);
break;
case WLR_INPUT_DEVICE_TOUCH:
Debug::log(LOG, "Attached a touch device with name %s", DEVICE->name);
g_pInputManager->newTouchDevice(DEVICE);
break;
case WLR_INPUT_DEVICE_TABLET_TOOL:
Debug::log(LOG, "Attached a tablet tool with name %s", DEVICE->name);
g_pInputManager->newTabletTool(DEVICE);
break;
case WLR_INPUT_DEVICE_TABLET_PAD:
Debug::log(LOG, "Attached a tablet pad with name %s", DEVICE->name);
g_pInputManager->newTabletPad(DEVICE);
break;
default:
Debug::log(WARN, "Unrecognized input device plugged in: %s", DEVICE->name);
break;
}
uint32_t capabilities = WL_SEAT_CAPABILITY_POINTER | WL_SEAT_CAPABILITY_KEYBOARD;
wlr_seat_set_capabilities(g_pCompositor->m_sSeat.seat, capabilities);
g_pInputManager->updateCapabilities(DEVICE);
}
void Events::listener_newConstraint(wl_listener* listener, void* data) {
@@ -140,11 +148,74 @@ void Events::listener_newVirtPtr(wl_listener* listener, void* data) {
const auto POINTER = EV->new_pointer;
const auto DEVICE = &POINTER->pointer.base;
g_pInputManager->newMouse(DEVICE);
g_pInputManager->newMouse(DEVICE, true);
}
void Events::listener_destroyMouse(void* owner, void* data) {
const auto PMOUSE = (SMouse*)owner;
g_pInputManager->destroyMouse(PMOUSE->mouse);
}
void Events::listener_swipeBegin(wl_listener* listener, void* data) {
const auto EVENT = (wlr_pointer_swipe_begin_event*)data;
g_pInputManager->onSwipeBegin(EVENT);
}
void Events::listener_swipeUpdate(wl_listener* listener, void* data) {
const auto EVENT = (wlr_pointer_swipe_update_event*)data;
g_pInputManager->onSwipeUpdate(EVENT);
}
void Events::listener_swipeEnd(wl_listener* listener, void* data) {
const auto EVENT = (wlr_pointer_swipe_end_event*)data;
g_pInputManager->onSwipeEnd(EVENT);
}
void Events::listener_pinchBegin(wl_listener* listener, void* data) {
const auto EV = (wlr_pointer_pinch_begin_event*)data;
wlr_pointer_gestures_v1_send_pinch_begin(g_pCompositor->m_sWLRPointerGestures, g_pCompositor->m_sSeat.seat, EV->time_msec, EV->fingers);
}
void Events::listener_pinchUpdate(wl_listener* listener, void* data) {
const auto EV = (wlr_pointer_pinch_update_event*)data;
wlr_pointer_gestures_v1_send_pinch_update(g_pCompositor->m_sWLRPointerGestures, g_pCompositor->m_sSeat.seat, EV->time_msec, EV->dx, EV->dy, EV->scale, EV->rotation);
}
void Events::listener_pinchEnd(wl_listener* listener, void* data) {
const auto EV = (wlr_pointer_pinch_end_event*)data;
wlr_pointer_gestures_v1_send_pinch_end(g_pCompositor->m_sWLRPointerGestures, g_pCompositor->m_sSeat.seat, EV->time_msec, EV->cancelled);
}
void Events::listener_newVirtualKeyboard(wl_listener* listener, void* data) {
const auto WLRKB = (wlr_virtual_keyboard_v1*)data;
g_pInputManager->newVirtualKeyboard(&WLRKB->keyboard.base);
}
void Events::listener_touchBegin(wl_listener* listener, void* data) {
g_pInputManager->onTouchDown((wlr_touch_down_event*)data);
}
void Events::listener_touchEnd(wl_listener* listener, void* data) {
g_pInputManager->onTouchUp((wlr_touch_up_event*)data);
}
void Events::listener_touchUpdate(wl_listener* listener, void* data) {
g_pInputManager->onTouchMove((wlr_touch_motion_event*)data);
}
void Events::listener_touchFrame(wl_listener* listener, void* data) {
wlr_seat_touch_notify_frame(g_pCompositor->m_sSeat.seat);
}
void Events::listener_holdBegin(wl_listener* listener, void* data) {
g_pInputManager->onPointerHoldBegin((wlr_pointer_hold_begin_event*)data);
}
void Events::listener_holdEnd(wl_listener* listener, void* data) {
g_pInputManager->onPointerHoldEnd((wlr_pointer_hold_end_event*)data);
}

View File

@@ -12,6 +12,9 @@ namespace Events {
LISTENER(change);
LISTENER(newOutput);
// DRM events
LISTENER(leaseRequest);
// Layer events
LISTENER(newLayerSurface);
DYNLISTENFUNC(destroyLayerSurface);
@@ -49,6 +52,11 @@ namespace Events {
DYNLISTENFUNC(fullscreenWindow);
DYNLISTENFUNC(activateX11);
DYNLISTENFUNC(configureX11);
DYNLISTENFUNC(unmanagedSetGeometry);
DYNLISTENFUNC(requestMove);
DYNLISTENFUNC(requestResize);
DYNLISTENFUNC(requestMinimize);
DYNLISTENFUNC(requestMaximize);
// Window subsurfaces
// LISTENER(newSubsurfaceWindow);
@@ -59,7 +67,7 @@ namespace Events {
LISTENER(mouseButton);
LISTENER(mouseAxis);
LISTENER(mouseFrame);
LISTENER(newInput);
// Virt Ptr
@@ -69,7 +77,7 @@ namespace Events {
DYNLISTENFUNC(keyboardKey);
DYNLISTENFUNC(keyboardMod);
DYNLISTENFUNC(keyboardDestroy);
DYNLISTENFUNC(commitConstraint);
LISTENER(newConstraint);
DYNLISTENFUNC(setConstraintRegion);
@@ -109,4 +117,43 @@ namespace Events {
// Deco XDG
LISTENER(NewXDGDeco);
};
// Renderer destroy
LISTENER(RendererDestroy);
LISTENER(newIdleInhibitor);
// session
LISTENER(sessionActive);
// Touchpad shit
LISTENER(swipeBegin);
LISTENER(swipeEnd);
LISTENER(swipeUpdate);
LISTENER(pinchBegin);
LISTENER(pinchUpdate);
LISTENER(pinchEnd);
// Power
LISTENER(powerMgrSetMode);
// IME
LISTENER(newIME);
LISTENER(newTextInput);
LISTENER(newVirtualKeyboard);
// IME Popups
DYNLISTENFUNC(mapInputPopup);
DYNLISTENFUNC(unmapInputPopup);
DYNLISTENFUNC(commitInputPopup);
DYNLISTENFUNC(destroyInputPopup);
// Touch
LISTENER(touchBegin);
LISTENER(touchEnd);
LISTENER(touchUpdate);
LISTENER(touchFrame);
LISTENER(holdBegin);
LISTENER(holdEnd);
};

View File

@@ -1,6 +1,6 @@
#include "../Compositor.hpp"
#include "../helpers/WLClasses.hpp"
#include "../managers/InputManager.hpp"
#include "../managers/input/InputManager.hpp"
#include "../render/Renderer.hpp"
#include "Events.hpp"
@@ -26,21 +26,22 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
return;
}
Debug::log(LOG, "New LayerSurface has no preferred monitor. Assigning Monitor %s", PMONITOR->szName);
Debug::log(LOG, "New LayerSurface has no preferred monitor. Assigning Monitor %s", PMONITOR->szName.c_str());
WLRLAYERSURFACE->output = PMONITOR->output;
}
const auto PMONITOR = (SMonitor*)g_pCompositor->getMonitorFromOutput(WLRLAYERSURFACE->output);
PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].push_back(new SLayerSurface());
SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].back();
const auto PMONITOR = (CMonitor*)g_pCompositor->getMonitorFromOutput(WLRLAYERSURFACE->output);
SLayerSurface* layerSurface = PMONITOR->m_aLayerSurfaceLists[WLRLAYERSURFACE->pending.layer].emplace_back(std::make_unique<SLayerSurface>()).get();
layerSurface->szNamespace = WLRLAYERSURFACE->_namespace;
if (!WLRLAYERSURFACE->output) {
WLRLAYERSURFACE->output = g_pCompositor->m_lMonitors.front().output; // TODO: current mon
WLRLAYERSURFACE->output = g_pCompositor->m_vMonitors.front()->output; // TODO: current mon
}
layerSurface->hyprListener_commitLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.commit, &Events::listener_commitLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_destroyLayerSurface.initCallback(&WLRLAYERSURFACE->surface->events.destroy, &Events::listener_destroyLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_destroyLayerSurface.initCallback(&WLRLAYERSURFACE->events.destroy, &Events::listener_destroyLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_mapLayerSurface.initCallback(&WLRLAYERSURFACE->events.map, &Events::listener_mapLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_unmapLayerSurface.initCallback(&WLRLAYERSURFACE->events.unmap, &Events::listener_unmapLayerSurface, layerSurface, "layerSurface");
layerSurface->hyprListener_newPopup.initCallback(&WLRLAYERSURFACE->events.new_popup, &Events::listener_newPopup, layerSurface, "layerSurface");
@@ -50,6 +51,8 @@ void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
WLRLAYERSURFACE->data = layerSurface;
layerSurface->monitorID = PMONITOR->ID;
layerSurface->forceBlur = g_pConfigManager->shouldBlurLS(layerSurface->szNamespace);
Debug::log(LOG, "LayerSurface %x (namespace %s layer %d) created on monitor %s", layerSurface->layerSurface, layerSurface->layerSurface->_namespace, layerSurface->layer, PMONITOR->szName.c_str());
}
@@ -58,24 +61,35 @@ void Events::listener_destroyLayerSurface(void* owner, void* data) {
Debug::log(LOG, "LayerSurface %x destroyed", layersurface->layerSurface);
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
if (!g_pCompositor->getMonitorFromID(layersurface->monitorID))
Debug::log(WARN, "Layersurface destroyed on an invalid monitor (removed?)");
if (!layersurface->fadingOut) {
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
layersurface->alpha.setValueAndWarp(0.f);
layersurface->fadingOut = true;
if (layersurface->mapped) {
Debug::log(LOG, "Forcing an unmap of a LS that did a straight destroy!");
listener_unmapLayerSurface(layersurface, nullptr);
} else {
Debug::log(LOG, "Removing LayerSurface that wasn't mapped.");
layersurface->alpha.setValueAndWarp(0.f);
layersurface->fadingOut = true;
g_pCompositor->addToFadingOutSafe(layersurface);
}
}
layersurface->noProcess = true;
layersurface->hyprListener_commitLayerSurface.removeCallback();
layersurface->hyprListener_destroyLayerSurface.removeCallback();
layersurface->hyprListener_mapLayerSurface.removeCallback();
layersurface->hyprListener_unmapLayerSurface.removeCallback();
layersurface->hyprListener_newPopup.removeCallback();
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
// rearrange to fix the reserved areas
if (PMONITOR) {
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
PMONITOR->scheduledRecalc = true;
// and damage
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
@@ -92,8 +106,10 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
Debug::log(LOG, "LayerSurface %x mapped", layersurface->layerSurface);
layersurface->layerSurface->mapped = true;
layersurface->mapped = true;
wlr_surface_send_enter(layersurface->layerSurface->surface, layersurface->layerSurface->output);
// anim
layersurface->alpha.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeIn"));
// fix if it changed its mon
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
@@ -103,18 +119,30 @@ void Events::listener_mapLayerSurface(void* owner, void* data) {
if ((uint64_t)layersurface->monitorID != PMONITOR->ID) {
const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID);
POLDMON->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface);
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].push_back(layersurface);
for (auto it = POLDMON->m_aLayerSurfaceLists[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLists[layersurface->layer].end(); it++) {
if (it->get() == layersurface) {
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].emplace_back(std::move(*it));
POLDMON->m_aLayerSurfaceLists[layersurface->layer].erase(it);
break;
}
}
layersurface->monitorID = PMONITOR->ID;
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(POLDMON->ID);
PMONITOR->scheduledRecalc = true;
g_pHyprRenderer->arrangeLayersForMonitor(POLDMON->ID);
}
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
if (layersurface->layerSurface->current.keyboard_interactive)
wlr_surface_send_enter(layersurface->layerSurface->surface, layersurface->layerSurface->output);
if (layersurface->layerSurface->current.keyboard_interactive && (!g_pCompositor->m_sSeat.mouse || !g_pCompositor->m_sSeat.mouse->currentConstraint)) { // don't focus if constrained
g_pCompositor->focusSurface(layersurface->layerSurface->surface);
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y);
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layersurface->layerSurface->surface, LOCAL.x, LOCAL.y);
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
}
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
@@ -131,27 +159,54 @@ void Events::listener_unmapLayerSurface(void* owner, void* data) {
Debug::log(LOG, "LayerSurface %x unmapped", layersurface->layerSurface);
if (!g_pCompositor->getMonitorFromID(layersurface->monitorID) || g_pCompositor->m_bUnsafeState) {
Debug::log(WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring.");
g_pCompositor->addToFadingOutSafe(layersurface);
layersurface->mapped = false;
layersurface->fadingOut = true;
layersurface->alpha.setValueAndWarp(0.f);
return;
}
// anim
layersurface->alpha.setConfig(g_pConfigManager->getAnimationPropertyConfig("fadeOut"));
// make a snapshot and start fade
g_pHyprOpenGL->makeLayerSnapshot(layersurface);
layersurface->alpha = 0.f;
layersurface->mapped = false;
layersurface->fadingOut = true;
g_pCompositor->m_lSurfacesFadingOut.push_back(layersurface);
g_pCompositor->addToFadingOutSafe(layersurface);
if (layersurface->layerSurface->mapped)
layersurface->layerSurface->mapped = false;
if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus)
g_pCompositor->m_pLastFocus = nullptr;
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layersurface->layerSurface->output);
if (!PMONITOR)
return;
// refocus if needed
if (layersurface->layerSurface->surface == g_pCompositor->m_pLastFocus) {
g_pCompositor->m_pLastFocus = nullptr;
g_pInputManager->refocus();
}
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed);
geomFixed = {layersurface->geometry.x + (int)PMONITOR->vecPosition.x, layersurface->geometry.y + (int)PMONITOR->vecPosition.y, (int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
g_pHyprRenderer->damageBox(&geomFixed);
geomFixed = {layersurface->geometry.x, layersurface->geometry.y, (int)layersurface->layerSurface->surface->current.width, (int)layersurface->layerSurface->surface->current.height};
layersurface->geometry = geomFixed; // because the surface can overflow... for some reason?
}
void Events::listener_commitLayerSurface(void* owner, void* data) {
@@ -165,33 +220,55 @@ void Events::listener_commitLayerSurface(void* owner, void* data) {
if (!PMONITOR)
return;
wlr_box geomFixed = {layersurface->geometry.x + PMONITOR->vecPosition.x, layersurface->geometry.y + PMONITOR->vecPosition.y, layersurface->geometry.width, layersurface->geometry.height};
if (layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM)
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd
wlr_box geomFixed = {layersurface->geometry.x, layersurface->geometry.y, layersurface->geometry.width, layersurface->geometry.height};
g_pHyprRenderer->damageBox(&geomFixed);
// fix if it changed its mon
if ((uint64_t)layersurface->monitorID != PMONITOR->ID) {
const auto POLDMON = g_pCompositor->getMonitorFromID(layersurface->monitorID);
POLDMON->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface);
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].push_back(layersurface);
for (auto it = POLDMON->m_aLayerSurfaceLists[layersurface->layer].begin(); it != POLDMON->m_aLayerSurfaceLists[layersurface->layer].end(); it++) {
if (it->get() == layersurface) {
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].emplace_back(std::move(*it));
POLDMON->m_aLayerSurfaceLists[layersurface->layer].erase(it);
break;
}
}
layersurface->monitorID = PMONITOR->ID;
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(POLDMON->ID);
PMONITOR->scheduledRecalc = true;
g_pHyprRenderer->arrangeLayersForMonitor(POLDMON->ID);
}
if (layersurface->layerSurface->current.committed != 0) {
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
if (layersurface->layer != layersurface->layerSurface->current.layer) {
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].remove(layersurface);
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->current.layer].push_back(layersurface);
for (auto it = PMONITOR->m_aLayerSurfaceLists[layersurface->layer].begin(); it != PMONITOR->m_aLayerSurfaceLists[layersurface->layer].end(); it++) {
if (it->get() == layersurface) {
PMONITOR->m_aLayerSurfaceLists[layersurface->layerSurface->current.layer].emplace_back(std::move(*it));
PMONITOR->m_aLayerSurfaceLists[layersurface->layer].erase(it);
break;
}
}
layersurface->layer = layersurface->layerSurface->current.layer;
if (layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BACKGROUND || layersurface->layer == ZWLR_LAYER_SHELL_V1_LAYER_BOTTOM)
g_pHyprOpenGL->markBlurDirtyForMonitor(PMONITOR); // so that blur is recalc'd
}
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
PMONITOR->scheduledRecalc = true;
}
layersurface->position = Vector2D(layersurface->geometry.x, layersurface->geometry.y);
// TODO: optimize this. This does NOT need to be here but it prevents some issues with full DT.
g_pHyprRenderer->damageMonitor(PMONITOR);
}
// update geom if it changed
layersurface->geometry = {layersurface->geometry.x, layersurface->geometry.y, layersurface->layerSurface->surface->current.width, layersurface->layerSurface->surface->current.height};
g_pHyprRenderer->damageSurface(layersurface->layerSurface->surface, layersurface->position.x, layersurface->position.y);
}

View File

@@ -2,7 +2,7 @@
#include "../Compositor.hpp"
#include "../helpers/WLClasses.hpp"
#include "../managers/InputManager.hpp"
#include "../managers/input/InputManager.hpp"
#include "../render/Renderer.hpp"
// ------------------------------ //
@@ -25,6 +25,15 @@ void Events::listener_outputMgrTest(wl_listener* listener, void* data) {
g_pHyprRenderer->outputMgrApplyTest(CONFIG, true);
}
void Events::listener_leaseRequest(wl_listener* listener, void* data) {
const auto REQUEST = (wlr_drm_lease_request_v1*)data;
struct wlr_drm_lease_v1* lease = wlr_drm_lease_request_v1_grant(REQUEST);
if (!lease) {
Debug::log(ERR, "Failed to grant lease request!");
wlr_drm_lease_request_v1_reject(REQUEST);
}
}
void Events::listener_requestSetPrimarySel(wl_listener* listener, void* data) {
const auto EVENT = (wlr_seat_request_set_primary_selection_event*)data;
wlr_seat_set_primary_selection(g_pCompositor->m_sSeat.seat, EVENT->source, EVENT->serial);
@@ -78,7 +87,7 @@ void Events::listener_requestDrag(wl_listener* listener, void* data) {
}
void Events::listener_startDrag(wl_listener* listener, void* data) {
if (g_pInputManager->m_sDrag.drag)
return; // don't handle multiple drags
@@ -103,16 +112,31 @@ void Events::listener_startDrag(wl_listener* listener, void* data) {
g_pInputManager->m_sDrag.hyprListener_destroyIcon.initCallback(&wlrDrag->icon->events.destroy, &Events::listener_destroyDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
g_pInputManager->m_sDrag.hyprListener_commitIcon.initCallback(&wlrDrag->icon->surface->events.commit, &Events::listener_commitDragIcon, &g_pInputManager->m_sDrag, "DragIcon");
}
static auto *const PFOLLOWONDND = &g_pConfigManager->getConfigValuePtr("misc:always_follow_on_dnd")->intValue;
if (*PFOLLOWONDND)
g_pInputManager->m_pFollowOnDnDBegin = g_pCompositor->m_pLastWindow;
else
g_pInputManager->m_pFollowOnDnDBegin = nullptr;
}
void Events::listener_destroyDrag(void* owner, void* data) {
Debug::log(LOG, "Drag destroyed.");
if (g_pInputManager->m_sDrag.drag && g_pInputManager->m_sDrag.dragIcon && g_pInputManager->m_sDrag.dragIcon->surface)
g_pHyprRenderer->damageBox(g_pInputManager->m_sDrag.pos.x - 2, g_pInputManager->m_sDrag.pos.y - 2, g_pInputManager->m_sDrag.dragIcon->surface->current.width + 4, g_pInputManager->m_sDrag.dragIcon->surface->current.height + 4);
g_pInputManager->m_sDrag.drag = nullptr;
g_pInputManager->m_sDrag.dragIcon = nullptr;
g_pInputManager->m_sDrag.hyprListener_destroy.removeCallback();
g_pInputManager->refocus();
if (g_pInputManager->m_pFollowOnDnDBegin)
g_pCompositor->focusWindow(g_pInputManager->m_pFollowOnDnDBegin);
g_pInputManager->m_pFollowOnDnDBegin = nullptr;
}
void Events::listener_mapDragIcon(void* owner, void* data) {
@@ -143,7 +167,7 @@ void Events::listener_commitDragIcon(void* owner, void* data) {
void Events::listener_InhibitActivate(wl_listener* listener, void* data) {
Debug::log(LOG, "Activated exclusive for %x.", g_pCompositor->m_sSeat.exclusiveClient);
g_pInputManager->refocus();
g_pCompositor->m_sSeat.exclusiveClient = g_pCompositor->m_sWLRInhibitMgr->active_client;
}
@@ -153,4 +177,37 @@ void Events::listener_InhibitDeactivate(wl_listener* listener, void* data) {
g_pCompositor->m_sSeat.exclusiveClient = nullptr;
g_pInputManager->refocus();
}
}
void Events::listener_RendererDestroy(wl_listener* listener, void* data) {
Debug::log(LOG, "!!Renderer destroyed!!");
}
void Events::listener_sessionActive(wl_listener* listener, void* data) {
Debug::log(LOG, "Session got activated!");
g_pCompositor->m_bSessionActive = true;
}
void Events::listener_powerMgrSetMode(wl_listener* listener, void* data) {
Debug::log(LOG, "PowerMgr set mode!");
const auto EVENT = (wlr_output_power_v1_set_mode_event*)data;
wlr_output_enable(EVENT->output, EVENT->mode == 1);
if (!wlr_output_commit(EVENT->output))
Debug::log(ERR, "Couldn't set power mode");
}
void Events::listener_newIME(wl_listener* listener, void* data) {
Debug::log(LOG, "New IME added!");
g_pInputManager->m_sIMERelay.onNewIME((wlr_input_method_v2*)data);
}
void Events::listener_newTextInput(wl_listener* listener, void* data) {
Debug::log(LOG, "New TextInput added!");
g_pInputManager->m_sIMERelay.onNewTextInput((wlr_text_input_v3*)data);
}

View File

@@ -1,6 +1,6 @@
#include "../Compositor.hpp"
#include "../helpers/WLClasses.hpp"
#include "../managers/InputManager.hpp"
#include "../managers/input/InputManager.hpp"
#include "../render/Renderer.hpp"
#include "Events.hpp"
#include "../debug/HyprCtl.hpp"
@@ -15,30 +15,30 @@
// //
// --------------------------------------------------------- //
SMonitor* pMostHzMonitor = nullptr;
CMonitor* pMostHzMonitor = nullptr;
void Events::listener_change(wl_listener* listener, void* data) {
// layout got changed, let's update monitors.
const auto CONFIG = wlr_output_configuration_v1_create();
for (auto& m : g_pCompositor->m_lMonitors) {
const auto CONFIGHEAD = wlr_output_configuration_head_v1_create(CONFIG, m.output);
for (auto& m : g_pCompositor->m_vMonitors) {
const auto CONFIGHEAD = wlr_output_configuration_head_v1_create(CONFIG, m->output);
// TODO: clients off of disabled
wlr_box BOX;
wlr_output_layout_get_box(g_pCompositor->m_sWLROutputLayout, m.output, &BOX);
wlr_output_layout_get_box(g_pCompositor->m_sWLROutputLayout, m->output, &BOX);
//m.vecSize.x = BOX.width;
// m.vecSize.y = BOX.height;
m.vecPosition.x = BOX.x;
m.vecPosition.y = BOX.y;
//m->vecSize.x = BOX.width;
// m->vecSize.y = BOX.height;
m->vecPosition.x = BOX.x;
m->vecPosition.y = BOX.y;
CONFIGHEAD->state.enabled = m.output->enabled;
CONFIGHEAD->state.mode = m.output->current_mode;
CONFIGHEAD->state.x = m.vecPosition.x;
CONFIGHEAD->state.y = m.vecPosition.y;
CONFIGHEAD->state.enabled = m->output->enabled;
CONFIGHEAD->state.mode = m->output->current_mode;
CONFIGHEAD->state.x = m->vecPosition.x;
CONFIGHEAD->state.y = m->vecPosition.y;
wlr_output_set_custom_mode(m.output, m.vecPixelSize.x, m.vecPixelSize.y, (int)(round(m.refreshRate * 1000)));
wlr_output_set_custom_mode(m->output, m->vecPixelSize.x, m->vecPixelSize.y, (int)(round(m->refreshRate * 1000)));
}
wlr_output_manager_v1_set_configuration(g_pCompositor->m_sWLROutputMgr, CONFIG);
@@ -53,123 +53,107 @@ void Events::listener_newOutput(wl_listener* listener, void* data) {
return;
}
if (g_pCompositor->getMonitorFromName(std::string(OUTPUT->name))) {
Debug::log(WARN, "Monitor with name %s already exists, not adding as new!", OUTPUT->name);
return;
if (g_pCompositor->m_bUnsafeState) {
Debug::log(WARN, "Recovering from an unsafe state. May you be lucky.");
}
// get monitor rule that matches
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(OUTPUT->name);
// add it to real
std::shared_ptr<CMonitor>* PNEWMONITORWRAP = nullptr;
// if it's disabled, disable and ignore
if (monitorRule.disabled) {
wlr_output_enable(OUTPUT, 0);
wlr_output_commit(OUTPUT);
return;
for (auto& rm : g_pCompositor->m_vRealMonitors) {
if (rm->szName == OUTPUT->name) {
PNEWMONITORWRAP = &rm;
Debug::log(LOG, "Recovering a removed monitor.");
break;
}
}
SMonitor newMonitor;
newMonitor.output = OUTPUT;
newMonitor.ID = g_pCompositor->m_lMonitors.size();
newMonitor.szName = OUTPUT->name;
if (!PNEWMONITORWRAP) {
Debug::log(LOG, "Adding completely new monitor.");
PNEWMONITORWRAP = &g_pCompositor->m_vRealMonitors.emplace_back(std::make_shared<CMonitor>());
wlr_output_init_render(OUTPUT, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
(*PNEWMONITORWRAP)->ID = g_pCompositor->getNextAvailableMonitorID();
}
wlr_output_set_scale(OUTPUT, monitorRule.scale);
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, monitorRule.scale);
wlr_output_set_transform(OUTPUT, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: support other transforms
const auto PNEWMONITOR = PNEWMONITORWRAP->get();
wlr_output_enable_adaptive_sync(OUTPUT, 1);
PNEWMONITOR->output = OUTPUT;
PNEWMONITOR->m_pThisWrap = PNEWMONITORWRAP;
// create it in the arr
newMonitor.vecPosition = monitorRule.offset;
newMonitor.vecSize = monitorRule.resolution;
newMonitor.refreshRate = monitorRule.refreshRate;
PNEWMONITOR->onConnect(false);
g_pCompositor->m_lMonitors.push_back(newMonitor);
const auto PNEWMONITOR = &g_pCompositor->m_lMonitors.back();
PNEWMONITOR->hyprListener_monitorFrame.initCallback(&OUTPUT->events.frame, &Events::listener_monitorFrame, PNEWMONITOR);
PNEWMONITOR->hyprListener_monitorDestroy.initCallback(&OUTPUT->events.destroy, &Events::listener_monitorDestroy, PNEWMONITOR);
wlr_output_enable(OUTPUT, 1);
// TODO: this doesn't seem to set the X and Y correctly,
// wlr_output_layout_output_coords returns invalid values, I think...
wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, OUTPUT, monitorRule.offset.x, monitorRule.offset.y);
// set mode, also applies
g_pHyprRenderer->applyMonitorRule(PNEWMONITOR, &monitorRule, true);
Debug::log(LOG, "Added new monitor with name %s at %i,%i with size %ix%i, pointer %x", OUTPUT->name, (int)monitorRule.offset.x, (int)monitorRule.offset.y, (int)monitorRule.resolution.x, (int)monitorRule.resolution.y, OUTPUT);
PNEWMONITOR->damage = wlr_output_damage_create(PNEWMONITOR->output);
// add a WLR workspace group
PNEWMONITOR->pWLRWorkspaceGroupHandle = wlr_ext_workspace_group_handle_v1_create(g_pCompositor->m_sWLREXTWorkspaceMgr);
wlr_ext_workspace_group_handle_v1_output_enter(PNEWMONITOR->pWLRWorkspaceGroupHandle, PNEWMONITOR->output);
// Workspace
const auto WORKSPACEID = monitorRule.defaultWorkspaceID == -1 ? g_pCompositor->m_lWorkspaces.size() + 1 /* Cuz workspaces doesnt have the new one yet and we start with 1 */ : monitorRule.defaultWorkspaceID;
g_pCompositor->m_lWorkspaces.emplace_back(newMonitor.ID);
const auto PNEWWORKSPACE = &g_pCompositor->m_lWorkspaces.back();
// We are required to set the name here immediately
wlr_ext_workspace_handle_v1_set_name(PNEWWORKSPACE->m_pWlrHandle, std::to_string(WORKSPACEID).c_str());
PNEWWORKSPACE->m_iID = WORKSPACEID;
PNEWWORKSPACE->m_szName = std::to_string(WORKSPACEID);
PNEWMONITOR->activeWorkspace = PNEWWORKSPACE->m_iID;
PNEWMONITOR->scale = monitorRule.scale;
g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle);
PNEWWORKSPACE->setActive(true);
if (!pMostHzMonitor || monitorRule.refreshRate > pMostHzMonitor->refreshRate)
if ((!pMostHzMonitor || PNEWMONITOR->refreshRate > pMostHzMonitor->refreshRate) && PNEWMONITOR->m_bEnabled)
pMostHzMonitor = PNEWMONITOR;
//
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
g_pCompositor->m_pLastMonitor = PNEWMONITOR;
// ready to process cuz we have a monitor
g_pCompositor->m_bReadyToProcess = true;
if (PNEWMONITOR->m_bEnabled) {
g_pCompositor->m_bReadyToProcess = true;
g_pCompositor->m_bUnsafeState = false;
}
}
void Events::listener_monitorFrame(void* owner, void* data) {
SMonitor* const PMONITOR = (SMonitor*)owner;
CMonitor* const PMONITOR = (CMonitor*)owner;
if ((g_pCompositor->m_sWLRSession && !g_pCompositor->m_sWLRSession->active) || !g_pCompositor->m_bSessionActive || g_pCompositor->m_bUnsafeState) {
Debug::log(WARN, "Attempted to render frame on inactive session!");
return; // cannot draw on session inactive (different tty)
}
if (!PMONITOR->m_bEnabled)
return;
static std::chrono::high_resolution_clock::time_point startRender = std::chrono::high_resolution_clock::now();
static std::chrono::high_resolution_clock::time_point startRenderOverlay = std::chrono::high_resolution_clock::now();
static std::chrono::high_resolution_clock::time_point endRenderOverlay = std::chrono::high_resolution_clock::now();
if (g_pConfigManager->getInt("debug:overlay") == 1) {
static auto *const PDEBUGOVERLAY = &g_pConfigManager->getConfigValuePtr("debug:overlay")->intValue;
static auto *const PDAMAGETRACKINGMODE = &g_pConfigManager->getConfigValuePtr("general:damage_tracking_internal")->intValue;
static auto *const PDAMAGEBLINK = &g_pConfigManager->getConfigValuePtr("debug:damage_blink")->intValue;
static auto *const PNOVFR = &g_pConfigManager->getConfigValuePtr("misc:no_vfr")->intValue;
static int damageBlinkCleanup = 0; // because double-buffered
if (!*PDAMAGEBLINK)
damageBlinkCleanup = 0;
if (*PDEBUGOVERLAY == 1) {
startRender = std::chrono::high_resolution_clock::now();
g_pDebugOverlay->frameData(PMONITOR);
}
// Hack: only check when monitor with top hz refreshes, saves a bit of resources.
// This is for stuff that should be run every frame
if (PMONITOR->ID == pMostHzMonitor->ID) {
if (PMONITOR->framesToSkip > 0) {
PMONITOR->framesToSkip -= 1;
if (!PMONITOR->noFrameSchedule)
g_pCompositor->scheduleFrameForMonitor(PMONITOR);
else {
Debug::log(LOG, "NoFrameSchedule hit for %s.", PMONITOR->szName.c_str());
}
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
if (PMONITOR->framesToSkip > 10)
PMONITOR->framesToSkip = 0;
return;
}
// checks //
if (PMONITOR->ID == pMostHzMonitor->ID || !*PNOVFR) { // unfortunately with VFR we don't have the guarantee mostHz is going to be updated all the time, so we have to ignore that
g_pCompositor->sanityCheckWorkspaces();
g_pAnimationManager->tick();
g_pCompositor->cleanupFadingOut();
HyprCtl::tickHyprCtl(); // so that we dont get that race condition multithread bullshit
g_pConfigManager->dispatchExecOnce(); // We exec-once when at least one monitor starts refreshing, meaning stuff has init'd
g_pConfigManager->dispatchExecOnce(); // We exec-once when at least one monitor starts refreshing, meaning stuff has init'd
if (g_pConfigManager->m_bWantsMonitorReload)
g_pConfigManager->performMonitorReload();
}
if (PMONITOR->needsFrameSkip) {
PMONITOR->needsFrameSkip = false;
wlr_output_schedule_frame(PMONITOR->output);
g_pHyprRenderer->ensureCursorRenderingMode(); // so that the cursor gets hidden/shown if the user requested timeouts
}
// //
if (PMONITOR->scheduledRecalc) {
PMONITOR->scheduledRecalc = false;
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(PMONITOR->ID);
return;
}
timespec now;
@@ -180,39 +164,45 @@ void Events::listener_monitorFrame(void* owner, void* data) {
bool hasChanged;
pixman_region32_init(&damage);
const auto DTMODE = g_pConfigManager->getInt("general:damage_tracking_internal");
if (DTMODE == -1) {
if (*PDAMAGETRACKINGMODE == -1) {
Debug::log(CRIT, "Damage tracking mode -1 ????");
return;
}
g_pHyprOpenGL->preRender(PMONITOR);
if (!wlr_output_damage_attach_render(PMONITOR->damage, &hasChanged, &damage)){
Debug::log(ERR, "Couldn't attach render to display %s ???", PMONITOR->szName.c_str());
return;
}
if (!hasChanged && DTMODE != DAMAGE_TRACKING_NONE) {
// we need to cleanup fading out when rendering the appropriate context
g_pCompositor->cleanupFadingOut(PMONITOR->ID);
if (!hasChanged && *PDAMAGETRACKINGMODE != DAMAGE_TRACKING_NONE && PMONITOR->forceFullFrames == 0 && damageBlinkCleanup == 0) {
pixman_region32_fini(&damage);
wlr_output_rollback(PMONITOR->output);
wlr_output_schedule_frame(PMONITOR->output); // we update shit at the monitor's Hz so we need to schedule frames because rollback wont
if (*PDAMAGEBLINK || *PNOVFR)
g_pCompositor->scheduleFrameForMonitor(PMONITOR);
return;
}
// if we have no tracking or full tracking, invalidate the entire monitor
if (DTMODE == DAMAGE_TRACKING_NONE || DTMODE == DAMAGE_TRACKING_MONITOR) {
pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR || PMONITOR->forceFullFrames > 0 || damageBlinkCleanup > 0 || PMONITOR->isMirror() /* why??? */) {
pixman_region32_union_rect(&damage, &damage, 0, 0, (int)PMONITOR->vecTransformedSize.x * 10, (int)PMONITOR->vecTransformedSize.y * 10); // wot?
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
} else {
static auto *const PBLURENABLED = &g_pConfigManager->getConfigValuePtr("decoration:blur")->intValue;
// if we use blur we need to expand the damage for proper blurring
if (g_pConfigManager->getInt("decoration:blur") == 1) {
if (*PBLURENABLED == 1) {
// TODO: can this be optimized?
const auto BLURSIZE = g_pConfigManager->getInt("decoration:blur_size");
const auto BLURPASSES = g_pConfigManager->getInt("decoration:blur_passes");
const auto BLURRADIUS = BLURSIZE * pow(2, BLURPASSES); // is this 2^pass? I don't know but it works... I think.
static auto *const PBLURSIZE = &g_pConfigManager->getConfigValuePtr("decoration:blur_size")->intValue;
static auto *const PBLURPASSES = &g_pConfigManager->getConfigValuePtr("decoration:blur_passes")->intValue;
const auto BLURRADIUS = *PBLURSIZE * pow(2, *PBLURPASSES); // is this 2^pass? I don't know but it works... I think.
pixman_region32_copy(&g_pHyprOpenGL->m_rOriginalDamageRegion, &damage);
@@ -223,32 +213,56 @@ void Events::listener_monitorFrame(void* owner, void* data) {
}
}
if (PMONITOR->forceFullFrames > 0) {
PMONITOR->forceFullFrames -= 1;
if (PMONITOR->forceFullFrames > 10)
PMONITOR->forceFullFrames = 0;
}
// TODO: this is getting called with extents being 0,0,0,0 should it be?
// potentially can save on resources.
g_pHyprOpenGL->begin(PMONITOR, &damage);
g_pHyprOpenGL->clear(CColor(100, 11, 11, 255));
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
g_pHyprRenderer->renderAllClientsForMonitor(PMONITOR->ID, &now);
if (PMONITOR->isMirror()) {
g_pHyprOpenGL->renderMirrored();
// if correct monitor draw hyprerror
if (PMONITOR->ID == 0)
g_pHyprError->draw();
Debug::log(LOG, "Mirror frame");
} else {
g_pHyprOpenGL->clear(CColor(17, 17, 17, 255));
g_pHyprOpenGL->clearWithTex(); // will apply the hypr "wallpaper"
// for drawing the debug overlay
if (PMONITOR->ID == 0 && g_pConfigManager->getInt("debug:overlay") == 1) {
startRenderOverlay = std::chrono::high_resolution_clock::now();
g_pDebugOverlay->draw();
endRenderOverlay = std::chrono::high_resolution_clock::now();
g_pHyprRenderer->renderAllClientsForMonitor(PMONITOR->ID, &now);
// if correct monitor draw hyprerror
if (PMONITOR->ID == 0)
g_pHyprError->draw();
// for drawing the debug overlay
if (PMONITOR->ID == 0 && *PDEBUGOVERLAY == 1) {
startRenderOverlay = std::chrono::high_resolution_clock::now();
g_pDebugOverlay->draw();
endRenderOverlay = std::chrono::high_resolution_clock::now();
}
if (*PDAMAGEBLINK && damageBlinkCleanup == 0) {
wlr_box monrect = {0, 0, PMONITOR->vecTransformedSize.x, PMONITOR->vecTransformedSize.y};
g_pHyprOpenGL->renderRect(&monrect, CColor(255, 0, 255, 100), 0);
damageBlinkCleanup = 1;
} else if (*PDAMAGEBLINK) {
damageBlinkCleanup++;
if (damageBlinkCleanup > 3)
damageBlinkCleanup = 0;
}
wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
wlr_output_render_software_cursors(PMONITOR->output, NULL);
wlr_renderer_end(g_pCompositor->m_sWLRRenderer);
}
wlr_renderer_begin(g_pCompositor->m_sWLRRenderer, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
wlr_output_render_software_cursors(PMONITOR->output, NULL);
wlr_renderer_end(g_pCompositor->m_sWLRRenderer);
g_pHyprOpenGL->end();
// calc frame damage
@@ -258,18 +272,27 @@ void Events::listener_monitorFrame(void* owner, void* data) {
const auto TRANSFORM = wlr_output_transform_invert(PMONITOR->output->transform);
wlr_region_transform(&frameDamage, &PMONITOR->damage->current, TRANSFORM, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
if (DTMODE == DAMAGE_TRACKING_NONE || DTMODE == DAMAGE_TRACKING_MONITOR)
if (*PDAMAGETRACKINGMODE == DAMAGE_TRACKING_NONE || *PDAMAGETRACKINGMODE == DAMAGE_TRACKING_MONITOR)
pixman_region32_union_rect(&frameDamage, &frameDamage, 0, 0, (int)PMONITOR->vecTransformedSize.x, (int)PMONITOR->vecTransformedSize.y);
if (*PDAMAGEBLINK)
pixman_region32_union(&frameDamage, &frameDamage, &damage);
wlr_output_set_damage(PMONITOR->output, &frameDamage);
if (!PMONITOR->mirrors.empty())
g_pHyprRenderer->damageMirrorsWith(PMONITOR, &frameDamage);
pixman_region32_fini(&frameDamage);
pixman_region32_fini(&damage);
wlr_output_commit(PMONITOR->output);
if (!wlr_output_commit(PMONITOR->output))
return;
wlr_output_schedule_frame(PMONITOR->output);
if (*PDAMAGEBLINK || *PNOVFR)
g_pCompositor->scheduleFrameForMonitor(PMONITOR);
if (g_pConfigManager->getInt("debug:overlay") == 1) {
if (*PDEBUGOVERLAY == 1) {
const float µs = std::chrono::duration_cast<std::chrono::nanoseconds>(std::chrono::high_resolution_clock::now() - startRender).count() / 1000.f;
g_pDebugOverlay->renderData(PMONITOR, µs);
if (PMONITOR->ID == 0) {
@@ -284,11 +307,11 @@ void Events::listener_monitorFrame(void* owner, void* data) {
void Events::listener_monitorDestroy(void* owner, void* data) {
const auto OUTPUT = (wlr_output*)data;
SMonitor* pMonitor = nullptr;
CMonitor* pMonitor = nullptr;
for (auto& m : g_pCompositor->m_lMonitors) {
if (m.szName == OUTPUT->name) {
pMonitor = &m;
for (auto& m : g_pCompositor->m_vMonitors) {
if (m->szName == OUTPUT->name) {
pMonitor = m.get();
break;
}
}
@@ -296,7 +319,25 @@ void Events::listener_monitorDestroy(void* owner, void* data) {
if (!pMonitor)
return;
g_pCompositor->m_lMonitors.remove(*pMonitor);
pMonitor->onDisconnect();
// TODO: cleanup windows
// cleanup if not unsafe
if (!g_pCompositor->m_bUnsafeState) {
g_pCompositor->m_vRealMonitors.erase(std::remove_if(g_pCompositor->m_vRealMonitors.begin(), g_pCompositor->m_vRealMonitors.end(), [&](std::shared_ptr<CMonitor>& el) { return el.get() == pMonitor; }));
if (pMostHzMonitor == pMonitor) {
int mostHz = 0;
CMonitor* pMonitorMostHz = nullptr;
for (auto& m : g_pCompositor->m_vMonitors) {
if (m->refreshRate > mostHz) {
pMonitorMostHz = m.get();
mostHz = m->refreshRate;
}
}
pMostHzMonitor = pMonitorMostHz;
}
}
}

View File

@@ -2,7 +2,7 @@
#include "../Compositor.hpp"
#include "../helpers/WLClasses.hpp"
#include "../managers/InputManager.hpp"
#include "../managers/input/InputManager.hpp"
#include "../render/Renderer.hpp"
// --------------------------------------------- //
@@ -18,14 +18,26 @@
void addPopupGlobalCoords(void* pPopup, int* x, int* y) {
SXDGPopup *const PPOPUP = (SXDGPopup*)pPopup;
auto curPopup = PPOPUP;
int px = 0;
int py = 0;
auto curPopup = PPOPUP;
while (true) {
px += curPopup->popup->current.geometry.x;
py += curPopup->popup->current.geometry.y;
if (curPopup == PPOPUP && PPOPUP->parentWindow) {
px -= curPopup->popup->base->current.geometry.x;
py -= curPopup->popup->base->current.geometry.y;
}
if (curPopup->pSurfaceTree && curPopup->pSurfaceTree->pSurface && !curPopup->parentPopup && !curPopup->parentWindow) {
const auto EXTENTSSURFACE = pixman_region32_extents(&curPopup->pSurfaceTree->pSurface->input_region);
px -= EXTENTSSURFACE->x1;
py -= EXTENTSSURFACE->y1;
}
if (curPopup->parentPopup) {
curPopup = curPopup->parentPopup;
} else {
@@ -43,10 +55,11 @@ void addPopupGlobalCoords(void* pPopup, int* x, int* y) {
void createNewPopup(wlr_xdg_popup* popup, SXDGPopup* pHyprPopup) {
pHyprPopup->popup = popup;
pHyprPopup->hyprListener_destroyPopupXDG.initCallback(&popup->base->surface->events.destroy, &Events::listener_destroyPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_destroyPopupXDG.initCallback(&popup->base->events.destroy, &Events::listener_destroyPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_mapPopupXDG.initCallback(&popup->base->events.map, &Events::listener_mapPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_unmapPopupXDG.initCallback(&popup->base->events.unmap, &Events::listener_unmapPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_newPopupFromPopupXDG.initCallback(&popup->base->events.new_popup, &Events::listener_newPopupFromPopupXDG, pHyprPopup, "HyprPopup");
pHyprPopup->hyprListener_commitPopupXDG.initCallback(&popup->base->surface->events.commit, &Events::listener_commitPopupXDG, pHyprPopup, "HyprPopup");
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
@@ -68,8 +81,7 @@ void Events::listener_newPopup(void* owner, void* data) {
const auto WLRPOPUP = (wlr_xdg_popup*)data;
g_pCompositor->m_lXDGPopups.push_back(SXDGPopup());
const auto PNEWPOPUP = &g_pCompositor->m_lXDGPopups.back();
const auto PNEWPOPUP = g_pCompositor->m_vXDGPopups.emplace_back(std::make_unique<SXDGPopup>()).get();
const auto PMONITOR = g_pCompositor->getMonitorFromID(layersurface->monitorID);
@@ -85,12 +97,14 @@ void Events::listener_newPopupXDG(void* owner, void* data) {
ASSERT(PWINDOW);
if (!PWINDOW->m_bIsMapped)
return;
Debug::log(LOG, "New layer popup created from XDG window %x -> %s", PWINDOW, PWINDOW->m_szTitle.c_str());
const auto WLRPOPUP = (wlr_xdg_popup*)data;
g_pCompositor->m_lXDGPopups.push_back(SXDGPopup());
const auto PNEWPOPUP = &g_pCompositor->m_lXDGPopups.back();
const auto PNEWPOPUP = g_pCompositor->m_vXDGPopups.emplace_back(std::make_unique<SXDGPopup>()).get();
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
@@ -106,7 +120,7 @@ void Events::listener_newPopupFromPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner;
ASSERT(PPOPUP);
if (PPOPUP->parentWindow)
Debug::log(LOG, "New popup created from XDG Window popup %x -> %s", PPOPUP, PPOPUP->parentWindow->m_szTitle.c_str());
else
@@ -114,8 +128,7 @@ void Events::listener_newPopupFromPopupXDG(void* owner, void* data) {
const auto WLRPOPUP = (wlr_xdg_popup*)data;
g_pCompositor->m_lXDGPopups.push_back(SXDGPopup());
const auto PNEWPOPUP = &g_pCompositor->m_lXDGPopups.back();
const auto PNEWPOPUP = g_pCompositor->m_vXDGPopups.emplace_back(std::make_unique<SXDGPopup>()).get();
PNEWPOPUP->popup = WLRPOPUP;
PNEWPOPUP->parentPopup = PPOPUP;
@@ -134,7 +147,15 @@ void Events::listener_mapPopupXDG(void* owner, void* data) {
Debug::log(LOG, "New XDG Popup mapped at %d %d", (int)PPOPUP->lx, (int)PPOPUP->ly);
PPOPUP->pSurfaceTree = SubsurfaceTree::createTreeRoot(PPOPUP->popup->base->surface, addPopupGlobalCoords, PPOPUP);
PPOPUP->pSurfaceTree = SubsurfaceTree::createTreeRoot(PPOPUP->popup->base->surface, addPopupGlobalCoords, PPOPUP, PPOPUP->parentWindow);
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
wlr_box extents;
wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents);
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
Debug::log(LOG, "XDG Popup got assigned a surfaceTreeNode %x", PPOPUP->pSurfaceTree);
}
@@ -147,9 +168,26 @@ void Events::listener_unmapPopupXDG(void* owner, void* data) {
SubsurfaceTree::destroySurfaceTree(PPOPUP->pSurfaceTree);
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
wlr_box extents;
wlr_surface_get_extends(PPOPUP->popup->base->surface, &extents);
g_pHyprRenderer->damageBox(lx - extents.x, ly - extents.y, extents.width + 2, extents.height + 2);
PPOPUP->pSurfaceTree = nullptr;
}
void Events::listener_commitPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner;
int lx = 0, ly = 0;
addPopupGlobalCoords(PPOPUP, &lx, &ly);
g_pHyprRenderer->damageSurface(PPOPUP->popup->base->surface, lx, ly);
}
void Events::listener_destroyPopupXDG(void* owner, void* data) {
SXDGPopup* PPOPUP = (SXDGPopup*)owner;
@@ -162,5 +200,5 @@ void Events::listener_destroyPopupXDG(void* owner, void* data) {
PPOPUP->pSurfaceTree = nullptr;
}
g_pCompositor->m_lXDGPopups.remove(*PPOPUP);
}
g_pCompositor->m_vXDGPopups.erase(std::remove_if(g_pCompositor->m_vXDGPopups.begin(), g_pCompositor->m_vXDGPopups.end(), [&](std::unique_ptr<SXDGPopup>& el) { return el.get() == PPOPUP; }));
}

View File

@@ -2,7 +2,7 @@
#include "../Compositor.hpp"
#include "../helpers/WLClasses.hpp"
#include "../managers/InputManager.hpp"
#include "../managers/input/InputManager.hpp"
#include "../render/Renderer.hpp"
// ------------------------------------------------------------ //
@@ -19,26 +19,59 @@ void addViewCoords(void* pWindow, int* x, int* y) {
const auto PWINDOW = (CWindow*)pWindow;
*x += PWINDOW->m_vRealPosition.goalv().x;
*y += PWINDOW->m_vRealPosition.goalv().y;
if (!PWINDOW->m_bIsX11) {
wlr_box geom;
wlr_xdg_surface_get_geometry(PWINDOW->m_uSurface.xdg, &geom);
*x -= geom.x;
*y -= geom.y;
}
}
int setAnimToMove(void* data) {
const auto PWINDOW = (CWindow*)data;
auto *const PANIMCFG = g_pConfigManager->getAnimationPropertyConfig("windowsMove");
if (!g_pCompositor->windowValidMapped(PWINDOW))
return 0;
PWINDOW->m_vRealPosition.setConfig(PANIMCFG);
PWINDOW->m_vRealSize.setConfig(PANIMCFG);
return 0;
}
void Events::listener_mapWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;
const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
static auto *const PINACTIVEALPHA = &g_pConfigManager->getConfigValuePtr("decoration:inactive_opacity")->floatValue;
static auto *const PACTIVEALPHA = &g_pConfigManager->getConfigValuePtr("decoration:active_opacity")->floatValue;
static auto *const PDIMSTRENGTH = &g_pConfigManager->getConfigValuePtr("decoration:dim_strength")->floatValue;
static auto *const PSWALLOW = &g_pConfigManager->getConfigValuePtr("misc:enable_swallow")->intValue;
static auto *const PSWALLOWREGEX = &g_pConfigManager->getConfigValuePtr("misc:swallow_regex")->strValue;
const auto PMONITOR = g_pCompositor->m_pLastMonitor;
const auto PWORKSPACE = PMONITOR->specialWorkspaceOpen ? g_pCompositor->getWorkspaceByID(SPECIAL_WORKSPACE_ID) : g_pCompositor->getWorkspaceByID(PMONITOR->activeWorkspace);
PWINDOW->m_iMonitorID = PMONITOR->ID;
PWINDOW->m_bMappedX11 = true;
PWINDOW->m_iWorkspaceID = PMONITOR->activeWorkspace;
PWINDOW->m_iWorkspaceID = PMONITOR->specialWorkspaceOpen ? SPECIAL_WORKSPACE_ID : PMONITOR->activeWorkspace;
PWINDOW->m_bIsMapped = true;
PWINDOW->m_bReadyToDelete = false;
PWINDOW->m_bFadingOut = false;
PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW);
PWINDOW->m_fAlpha = 255.f;
if (PWINDOW->m_iX11Type == 2)
g_pCompositor->moveUnmanagedX11ToWindows(PWINDOW);
g_pCompositor->updateWindowAnimatedDecorationValues(PWINDOW);
// Set all windows tiled regardless of anything
g_pXWaylandManager->setWindowStyleTiled(PWINDOW, WLR_EDGE_LEFT | WLR_EDGE_RIGHT | WLR_EDGE_TOP | WLR_EDGE_BOTTOM);
// Foreign Toplevel
PWINDOW->m_phForeignToplevel = wlr_foreign_toplevel_handle_v1_create(g_pCompositor->m_sWLRToplevelMgr);
// TODO: handle foreign events (requests)
wlr_foreign_toplevel_handle_v1_set_app_id(PWINDOW->m_phForeignToplevel, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
PWINDOW->createToplevelHandle();
// checks if the window wants borders and sets the appriopriate flag
g_pXWaylandManager->checkBorders(PWINDOW);
@@ -46,7 +79,7 @@ void Events::listener_mapWindow(void* owner, void* data) {
const auto PWINDOWSURFACE = g_pXWaylandManager->getWindowSurface(PWINDOW);
if (!PWINDOWSURFACE) {
g_pCompositor->m_lWindows.remove(*PWINDOW);
g_pCompositor->removeWindowFromVectorSafe(PWINDOW);
return;
}
@@ -55,6 +88,8 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_bRequestsFloat = true;
}
PWINDOW->m_bX11ShouldntFocus = PWINDOW->m_bX11ShouldntFocus || (PWINDOW->m_bIsX11 && PWINDOW->m_iX11Type == 2);
if (PWORKSPACE->m_bDefaultFloating)
PWINDOW->m_bIsFloating = true;
@@ -65,37 +100,52 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_vPseudoSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
}
CWindow* pFullscreenWindow = nullptr;
if (PWORKSPACE->m_bHasFullscreenWindow && !PWINDOW->m_bIsFloating) {
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PFULLWINDOW, FULLSCREEN_FULL);
g_pXWaylandManager->setWindowFullscreen(PFULLWINDOW, PFULLWINDOW->m_bIsFullscreen);
pFullscreenWindow = PFULLWINDOW;
g_pCompositor->setWindowFullscreen(PFULLWINDOW, false, PWORKSPACE->m_efFullscreenMode);
}
// window rules
const auto WINDOWRULES = g_pConfigManager->getMatchingRules(PWINDOW);
std::string requestedWorkspace = "";
bool workspaceSilent = false;
bool requestsFullscreen = PWINDOW->m_bWantsInitialFullscreen || (!PWINDOW->m_bIsX11 && PWINDOW->m_uSurface.xdg->role == WLR_XDG_SURFACE_ROLE_TOPLEVEL && PWINDOW->m_uSurface.xdg->toplevel->requested.fullscreen);
bool shouldFocus = true;
for (auto& r : WINDOWRULES) {
if (r.szRule.find("monitor") == 0) {
try {
const long int MONITOR = std::stoi(r.szRule.substr(r.szRule.find(" ")));
const auto MONITORSTR = r.szRule.substr(r.szRule.find(" "));
if (MONITOR >= (long int)g_pCompositor->m_lMonitors.size() || MONITOR < (long int)0)
PWINDOW->m_iMonitorID = 0;
else
PWINDOW->m_iMonitorID = MONITOR;
if (MONITORSTR == "unset") {
PWINDOW->m_iMonitorID = PMONITOR->ID;
} else {
const long int MONITOR = std::stoi(MONITORSTR);
if (!g_pCompositor->getMonitorFromID(MONITOR))
PWINDOW->m_iMonitorID = 0;
else
PWINDOW->m_iMonitorID = MONITOR;
}
PWINDOW->m_iWorkspaceID = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID)->activeWorkspace;
g_pKeybindManager->m_mDispatchers["focusmonitor"](std::to_string(PWINDOW->m_iMonitorID));
Debug::log(ERR, "Rule monitor, applying to window %x -> mon: %i, workspace: %i", PWINDOW, PWINDOW->m_iMonitorID, PWINDOW->m_iWorkspaceID);
} catch (std::exception& e) {
Debug::log(ERR, "Rule monitor failed, rule: %s -> %s | err: %s", r.szRule.c_str(), r.szValue.c_str(), e.what());
}
} else if (r.szRule.find("workspace") == 0) {
// switch to workspace
g_pKeybindManager->m_mDispatchers["workspace"](r.szRule.substr(r.szRule.find_first_of(' ') + 1));
// check if it isnt unset
const auto WORKSPACERQ = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
PWINDOW->m_iMonitorID = g_pCompositor->m_pLastMonitor->ID;
PWINDOW->m_iWorkspaceID = g_pCompositor->m_pLastMonitor->activeWorkspace;
if (WORKSPACERQ == "unset") {
requestedWorkspace = "";
} else {
requestedWorkspace = WORKSPACERQ;
}
Debug::log(LOG, "Rule workspace matched by window %x, %s applied.", PWINDOW, r.szValue.c_str());
} else if (r.szRule.find("float") == 0) {
@@ -106,6 +156,16 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_bIsPseudotiled = true;
} else if (r.szRule.find("nofocus") == 0) {
PWINDOW->m_bNoFocus = true;
} else if (r.szRule == "noblur") {
PWINDOW->m_sAdditionalConfigData.forceNoBlur = true;
} else if (r.szRule == "fullscreen") {
requestsFullscreen = true;
} else if (r.szRule == "opaque") {
PWINDOW->m_sAdditionalConfigData.forceOpaque = true;
} else if (r.szRule == "forceinput") {
PWINDOW->m_sAdditionalConfigData.forceAllowsInput = true;
} else if (r.szRule == "pin") {
PWINDOW->m_bPinned = true;
} else if (r.szRule.find("rounding") == 0) {
try {
PWINDOW->m_sAdditionalConfigData.rounding = std::stoi(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
@@ -114,7 +174,15 @@ void Events::listener_mapWindow(void* owner, void* data) {
}
} else if (r.szRule.find("opacity") == 0) {
try {
PWINDOW->m_sSpecialRenderData.alpha = std::stof(r.szRule.substr(r.szRule.find_first_of(' ') + 1));
std::string alphaPart = r.szRule.substr(r.szRule.find_first_of(' ') + 1);
if (alphaPart.contains(' ')) {
// we have a comma, 2 values
PWINDOW->m_sSpecialRenderData.alpha = std::stof(alphaPart.substr(0, alphaPart.find_first_of(' ')));
PWINDOW->m_sSpecialRenderData.alphaInactive = std::stof(alphaPart.substr(alphaPart.find_first_of(' ') + 1));
} else {
PWINDOW->m_sSpecialRenderData.alpha = std::stof(alphaPart);
}
} catch(std::exception& e) {
Debug::log(ERR, "Opacity rule \"%s\" failed with: %s", r.szRule.c_str(), e.what());
}
@@ -124,6 +192,37 @@ void Events::listener_mapWindow(void* owner, void* data) {
}
}
// disallow tiled pinned
if (PWINDOW->m_bPinned && !PWINDOW->m_bIsFloating)
PWINDOW->m_bPinned = false;
if (requestedWorkspace != "") {
// process requested workspace
if (requestedWorkspace.contains(' ')) {
// check for silent
if (requestedWorkspace.contains("silent")) {
workspaceSilent = true;
shouldFocus = false;
}
requestedWorkspace = requestedWorkspace.substr(0, requestedWorkspace.find_first_of(' '));
if (!shouldFocus && requestedWorkspace == std::to_string(PMONITOR->activeWorkspace))
shouldFocus = true;
if (requestedWorkspace == "special") {
workspaceSilent = true;
}
}
if (!workspaceSilent) {
g_pKeybindManager->m_mDispatchers["workspace"](requestedWorkspace);
PWINDOW->m_iMonitorID = g_pCompositor->m_pLastMonitor->ID;
PWINDOW->m_iWorkspaceID = g_pCompositor->m_pLastMonitor->activeWorkspace;
}
}
if (PWINDOW->m_bIsFloating) {
g_pLayoutManager->getCurrentLayout()->onWindowCreatedFloating(PWINDOW);
PWINDOW->m_bCreatedOverFullscreen = true;
@@ -136,13 +235,17 @@ void Events::listener_mapWindow(void* owner, void* data) {
const auto SIZEXSTR = VALUE.substr(0, VALUE.find(" "));
const auto SIZEYSTR = VALUE.substr(VALUE.find(" ") + 1);
const auto SIZEX = SIZEXSTR.find('%') == std::string::npos ? std::stoi(SIZEXSTR) : std::stoi(SIZEXSTR.substr(0, SIZEXSTR.length() - 1)) * 0.01f * PMONITOR->vecSize.x;
const auto SIZEY = SIZEYSTR.find('%') == std::string::npos ? std::stoi(SIZEYSTR) : std::stoi(SIZEYSTR.substr(0, SIZEYSTR.length() - 1)) * 0.01f * PMONITOR->vecSize.y;
const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(PWINDOW);
const auto SIZEX = SIZEXSTR == "max" ? std::clamp(MAXSIZE.x, 20.0, PMONITOR->vecSize.x) : (!SIZEXSTR.contains('%') ? std::stoi(SIZEXSTR) : std::stoi(SIZEXSTR.substr(0, SIZEXSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.x);
const auto SIZEY = SIZEYSTR == "max" ? std::clamp(MAXSIZE.y, 20.0, PMONITOR->vecSize.y) : (!SIZEYSTR.contains('%') ? std::stoi(SIZEYSTR) : std::stoi(SIZEYSTR.substr(0, SIZEYSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.y);
Debug::log(LOG, "Rule size, applying to window %x", PWINDOW);
PWINDOW->m_vRealSize = Vector2D(SIZEX, SIZEY);
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.goalv());
PWINDOW->m_bHidden = false;
} catch (...) {
Debug::log(LOG, "Rule size failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
}
@@ -152,21 +255,27 @@ void Events::listener_mapWindow(void* owner, void* data) {
const auto POSXSTR = VALUE.substr(0, VALUE.find(" "));
const auto POSYSTR = VALUE.substr(VALUE.find(" ") + 1);
const auto POSX = POSXSTR.find('%') == std::string::npos ? std::stoi(POSXSTR) : std::stoi(POSXSTR.substr(0, POSXSTR.length() - 1)) * 0.01f * PMONITOR->vecSize.x;
const auto POSY = POSYSTR.find('%') == std::string::npos ? std::stoi(POSYSTR) : std::stoi(POSYSTR.substr(0, POSYSTR.length() - 1)) * 0.01f * PMONITOR->vecSize.y;
const auto POSX = !POSXSTR.contains('%') ? std::stoi(POSXSTR) : std::stoi(POSXSTR.substr(0, POSXSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.x;
const auto POSY = !POSYSTR.contains('%') ? std::stoi(POSYSTR) : std::stoi(POSYSTR.substr(0, POSYSTR.length() - 1)) * 0.01 * PMONITOR->vecSize.y;
Debug::log(LOG, "Rule move, applying to window %x", PWINDOW);
PWINDOW->m_vRealPosition = Vector2D(POSX, POSY) + PMONITOR->vecPosition;
PWINDOW->m_bHidden = false;
} catch (...) {
Debug::log(LOG, "Rule move failed, rule: %s -> %s", r.szRule.c_str(), r.szValue.c_str());
}
} else if (r.szRule == "center") {
PWINDOW->m_vRealPosition = PMONITOR->vecPosition + PMONITOR->vecSize / 2.f - PWINDOW->m_vRealSize.goalv() / 2.f;
}
}
// set the pseudo size to the GOAL of our current size
// because the windows are animated on RealSize
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goalv();
g_pCompositor->moveWindowToTop(PWINDOW);
}
else {
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW);
@@ -175,60 +284,194 @@ void Events::listener_mapWindow(void* owner, void* data) {
PWINDOW->m_vPseudoSize = PWINDOW->m_vRealSize.goalv() - Vector2D(10,10);
}
if (!PWINDOW->m_bNoFocus)
g_pCompositor->focusWindow(PWINDOW);
const auto PFOCUSEDWINDOWPREV = g_pCompositor->m_pLastWindow;
PWINDOW->m_pSurfaceTree = SubsurfaceTree::createTreeRoot(g_pXWaylandManager->getWindowSurface(PWINDOW), addViewCoords, PWINDOW);
if (PWINDOW->m_sAdditionalConfigData.forceAllowsInput) {
PWINDOW->m_bNoFocus = false;
PWINDOW->m_bNoInitialFocus = false;
PWINDOW->m_bX11ShouldntFocus = false;
}
if (!PWINDOW->m_bNoFocus && !PWINDOW->m_bNoInitialFocus && PWINDOW->m_iX11Type != 2) {
g_pCompositor->focusWindow(PWINDOW);
PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PACTIVEALPHA);
PWINDOW->m_fDimPercent.setValueAndWarp(*PDIMSTRENGTH);
} else {
PWINDOW->m_fActiveInactiveAlpha.setValueAndWarp(*PINACTIVEALPHA);
PWINDOW->m_fDimPercent.setValueAndWarp(0);
}
Debug::log(LOG, "Window got assigned a surfaceTreeNode %x", PWINDOW->m_pSurfaceTree);
if (!PWINDOW->m_bIsX11) {
PWINDOW->hyprListener_commitWindow.initCallback(&PWINDOW->m_uSurface.xdg->surface->events.commit, &Events::listener_commitWindow, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_newPopupXDG.initCallback(&PWINDOW->m_uSurface.xdg->events.new_popup, &Events::listener_newPopupXDG, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_requestMaximize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_maximize, &Events::listener_requestMaximize, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_requestMinimize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_minimize, &Events::listener_requestMinimize, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_requestMove.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_move, &Events::listener_requestMove, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_requestResize.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_resize, &Events::listener_requestResize, PWINDOW, "XDG Window Late");
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xdg->toplevel->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW, "XDG Window Late");
} else {
PWINDOW->hyprListener_fullscreenWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_fullscreen, &Events::listener_fullscreenWindow, PWINDOW, "XWayland Window Late");
PWINDOW->hyprListener_activateX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_activate, &Events::listener_activateX11, PWINDOW, "XWayland Window Late");
PWINDOW->hyprListener_configureX11.initCallback(&PWINDOW->m_uSurface.xwayland->events.request_configure, &Events::listener_configureX11, PWINDOW, "XWayland Window Late");
PWINDOW->hyprListener_setTitleWindow.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_title, &Events::listener_setTitleWindow, PWINDOW, "XWayland Window Late");
if (PWINDOW->m_iX11Type == 2)
PWINDOW->hyprListener_setGeometryX11U.initCallback(&PWINDOW->m_uSurface.xwayland->events.set_geometry, &Events::listener_unmanagedSetGeometry, PWINDOW, "XWayland Window Late");
}
// do the animation thing
g_pAnimationManager->onWindowPostCreateClose(PWINDOW, false);
PWINDOW->m_fAlpha.setValueAndWarp(0.f);
PWINDOW->m_fAlpha = 255.f;
const auto TIMER = wl_event_loop_add_timer(g_pCompositor->m_sWLEventLoop, setAnimToMove, PWINDOW);
wl_event_source_timer_update(TIMER, PWINDOW->m_vRealPosition.getDurationLeftMs() + 5);
if (workspaceSilent) {
// move the window
const auto OLDWORKSPACE = PWINDOW->m_iWorkspaceID;
if (g_pCompositor->m_pLastWindow == PWINDOW) {
if (requestedWorkspace != "special")
g_pKeybindManager->m_mDispatchers["movetoworkspacesilent"](requestedWorkspace);
else
g_pKeybindManager->m_mDispatchers["movetoworkspace"]("special");
} else {
Debug::log(ERR, "Tried to set workspace silent rule to a nofocus window!");
}
g_pCompositor->forceReportSizesToWindowsOnWorkspace(OLDWORKSPACE);
}
if (requestsFullscreen) {
// fix fullscreen on requested (basically do a switcheroo)
if (PWORKSPACE->m_bHasFullscreenWindow) {
const auto PFULLWINDOW = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
g_pCompositor->setWindowFullscreen(PFULLWINDOW, false, FULLSCREEN_FULL);
}
PWINDOW->m_vRealPosition.warp();
PWINDOW->m_vRealSize.warp();
g_pCompositor->setWindowFullscreen(PWINDOW, true, FULLSCREEN_FULL);
}
if (pFullscreenWindow && workspaceSilent) {
g_pCompositor->setWindowFullscreen(pFullscreenWindow, true, PWORKSPACE->m_efFullscreenMode);
}
// recheck idle inhibitors
g_pInputManager->recheckIdleInhibitorStatus();
PWINDOW->m_pSurfaceTree = SubsurfaceTree::createTreeRoot(g_pXWaylandManager->getWindowSurface(PWINDOW), addViewCoords, PWINDOW, PWINDOW);
PWINDOW->updateToplevel();
if (!shouldFocus) {
if (g_pCompositor->windowValidMapped(PFOCUSEDWINDOWPREV)) {
g_pCompositor->focusWindow(PFOCUSEDWINDOWPREV);
PFOCUSEDWINDOWPREV->updateWindowDecos(); // need to for some reason i cba to find out why
} else if (!PFOCUSEDWINDOWPREV)
g_pCompositor->focusWindow(nullptr);
}
// verify swallowing
if (*PSWALLOW) {
// check parent
int ppid = getPPIDof(PWINDOW->getPID());
const auto PPPID = getPPIDof(ppid);
// why? no clue. Blame terminals.
if (PPPID > 2) {
ppid = PPPID;
}
if (ppid) {
// get window by pid
CWindow* found = nullptr;
for (auto& w : g_pCompositor->m_vWindows) {
if (!w->m_bIsMapped || w->m_bHidden)
continue;
if (w->getPID() == ppid) {
found = w.get();
break;
}
}
if (found) {
// check if it's the window we want
std::regex rgx(*PSWALLOWREGEX);
if (std::regex_match(g_pXWaylandManager->getAppIDClass(found), rgx)) {
// swallow
PWINDOW->m_pSwallowed = found;
g_pLayoutManager->getCurrentLayout()->onWindowRemoved(found);
found->m_bHidden = true;
}
}
}
}
Debug::log(LOG, "Map request dispatched, monitor %s, xywh: %f %f %f %f", PMONITOR->szName.c_str(), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y, PWINDOW->m_vRealSize.goalv().x, PWINDOW->m_vRealSize.goalv().y);
auto workspaceID = requestedWorkspace != "" ? requestedWorkspace : PWORKSPACE->m_szName;
g_pEventManager->postEvent(SHyprIPCEvent{"openwindow", getFormat("%x,%s,%s,%s", PWINDOW, workspaceID.c_str(), g_pXWaylandManager->getAppIDClass(PWINDOW).c_str(), PWINDOW->m_szTitle.c_str())});
}
void Events::listener_unmapWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;
Debug::log(LOG, "Window %x unmapped", PWINDOW);
Debug::log(LOG, "Window %x unmapped (class %s)", PWINDOW, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
g_pEventManager->postEvent(SHyprIPCEvent{"closewindow", getFormat("%x", PWINDOW)});
if (!PWINDOW->m_bIsX11) {
Debug::log(LOG, "Unregistered late callbacks XDG: %x %x %x %x", &PWINDOW->hyprListener_commitWindow.m_sListener.link, &PWINDOW->hyprListener_setTitleWindow.m_sListener.link, &PWINDOW->hyprListener_fullscreenWindow.m_sListener.link, &PWINDOW->hyprListener_newPopupXDG.m_sListener.link);
Debug::log(LOG, "Unregistered late callbacks XDG");
PWINDOW->hyprListener_commitWindow.removeCallback();
PWINDOW->hyprListener_setTitleWindow.removeCallback();
PWINDOW->hyprListener_fullscreenWindow.removeCallback();
PWINDOW->hyprListener_newPopupXDG.removeCallback();
PWINDOW->hyprListener_requestMaximize.removeCallback();
PWINDOW->hyprListener_requestMinimize.removeCallback();
PWINDOW->hyprListener_requestMove.removeCallback();
PWINDOW->hyprListener_requestResize.removeCallback();
PWINDOW->hyprListener_fullscreenWindow.removeCallback();
} else {
Debug::log(LOG, "Unregistered late callbacks XWL: %x %x %x %x", &PWINDOW->hyprListener_fullscreenWindow.m_sListener.link, &PWINDOW->hyprListener_activateX11.m_sListener.link, &PWINDOW->hyprListener_configureX11.m_sListener.link, &PWINDOW->hyprListener_setTitleWindow.m_sListener.link);
Debug::log(LOG, "Unregistered late callbacks XWL");
PWINDOW->hyprListener_fullscreenWindow.removeCallback();
PWINDOW->hyprListener_activateX11.removeCallback();
PWINDOW->hyprListener_configureX11.removeCallback();
PWINDOW->hyprListener_setTitleWindow.removeCallback();
PWINDOW->hyprListener_setGeometryX11U.removeCallback();
}
if (PWINDOW->m_bIsFullscreen) {
g_pCompositor->setWindowFullscreen(PWINDOW, false, FULLSCREEN_FULL);
}
// Allow the renderer to catch the last frame.
g_pHyprOpenGL->makeWindowSnapshot(PWINDOW);
// swallowing
if (PWINDOW->m_pSwallowed && g_pCompositor->windowExists(PWINDOW->m_pSwallowed)) {
PWINDOW->m_pSwallowed->m_bHidden = false;
g_pLayoutManager->getCurrentLayout()->onWindowCreated(PWINDOW->m_pSwallowed);
PWINDOW->m_pSwallowed = nullptr;
}
bool wasLastWindow = false;
if (PWINDOW == g_pCompositor->m_pLastWindow) {
wasLastWindow = true;
g_pCompositor->m_pLastWindow = nullptr;
g_pCompositor->m_pLastFocus = nullptr;
}
PWINDOW->m_fAlpha = 0.f;
PWINDOW->m_bMappedX11 = false;
// remove the fullscreen window status from workspace if we closed it
@@ -242,46 +485,77 @@ void Events::listener_unmapWindow(void* owner, void* data) {
// do this after onWindowRemoved because otherwise it'll think the window is invalid
PWINDOW->m_bIsMapped = false;
// refocus on a new window
g_pInputManager->refocus();
// refocus on a new window if needed
if (wasLastWindow) {
auto PWINDOWCANDIDATE = g_pCompositor->vectorToWindowIdeal(PWINDOW->m_vRealPosition.goalv() + PWINDOW->m_vRealSize.goalv() / 2.f);
if (PWORKSPACE->m_bHasFullscreenWindow && ((!PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bCreatedOverFullscreen) || !PWINDOW->m_bIsFloating))
PWINDOWCANDIDATE = g_pCompositor->getFullscreenWindowOnWorkspace(PWORKSPACE->m_iID);
if (!PWINDOWCANDIDATE || PWINDOW == PWINDOWCANDIDATE || !PWINDOWCANDIDATE->m_bIsMapped || PWINDOWCANDIDATE->m_bHidden || PWINDOWCANDIDATE->m_bX11ShouldntFocus || PWINDOWCANDIDATE->m_iX11Type == 2 || PWINDOWCANDIDATE->m_iMonitorID != g_pCompositor->m_pLastMonitor->ID)
PWINDOWCANDIDATE = nullptr;
Debug::log(LOG, "On closed window, new focused candidate is %x", PWINDOWCANDIDATE);
if (PWINDOWCANDIDATE != g_pCompositor->m_pLastWindow) {
if (!PWINDOWCANDIDATE)
g_pInputManager->refocus();
else
g_pCompositor->focusWindow(PWINDOWCANDIDATE);
}
} else {
Debug::log(LOG, "Unmapped was not focused, ignoring a refocus.");
}
Debug::log(LOG, "Destroying the SubSurface tree of unmapped window %x", PWINDOW);
SubsurfaceTree::destroySurfaceTree(PWINDOW->m_pSurfaceTree);
PWINDOW->m_pSurfaceTree = nullptr;
PWINDOW->m_bFadingOut = true;
g_pCompositor->m_lWindowsFadingOut.push_back(PWINDOW);
g_pCompositor->addToFadingOutSafe(PWINDOW);
g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID));
const auto PMONITOR = g_pCompositor->getMonitorFromID(PWINDOW->m_iMonitorID);
// do the animation thing
PWINDOW->m_vOriginalClosedPos = PWINDOW->m_vRealPosition.vec();
PWINDOW->m_vOriginalClosedPos = PWINDOW->m_vRealPosition.vec() - PMONITOR->vecPosition;
PWINDOW->m_vOriginalClosedSize = PWINDOW->m_vRealSize.vec();
if (!PWINDOW->m_bX11DoesntWantBorders) // don't animate out if they weren't animated in.
PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.vec() + Vector2D(0.01f, 0.01f); // it has to be animated, otherwise onWindowPostCreateClose will ignore it
// anims
g_pAnimationManager->onWindowPostCreateClose(PWINDOW, true);
PWINDOW->m_fAlpha = 0.f;
// Destroy Foreign Toplevel
wlr_foreign_toplevel_handle_v1_destroy(PWINDOW->m_phForeignToplevel);
PWINDOW->m_phForeignToplevel = nullptr;
PWINDOW->destroyToplevelHandle();
// recheck idle inhibitors
g_pInputManager->recheckIdleInhibitorStatus();
}
void Events::listener_commitWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;
if (!g_pCompositor->windowValidMapped(PWINDOW))
if (!PWINDOW->m_bMappedX11 || PWINDOW->m_bHidden || (PWINDOW->m_bIsX11 && !PWINDOW->m_bMappedX11))
return;
g_pHyprRenderer->damageSurface(g_pXWaylandManager->getWindowSurface(PWINDOW), PWINDOW->m_vRealPosition.goalv().x, PWINDOW->m_vRealPosition.goalv().y);
// Debug::log(LOG, "Window %x committed", PWINDOW); // SPAM!
}
void Events::listener_destroyWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;
Debug::log(LOG, "Window %x destroyed, queueing.", PWINDOW);
Debug::log(LOG, "Window %x destroyed, queueing. (class %s)", PWINDOW, g_pXWaylandManager->getAppIDClass(PWINDOW).c_str());
if (PWINDOW->m_bIsX11)
Debug::log(LOG, "XWayland class raw: %s", PWINDOW->m_uSurface.xwayland->_class);
if (PWINDOW == g_pCompositor->m_pLastWindow) {
g_pCompositor->m_pLastWindow = nullptr;
@@ -312,10 +586,9 @@ void Events::listener_setTitleWindow(void* owner, void* data) {
PWINDOW->m_szTitle = g_pXWaylandManager->getTitle(PWINDOW);
if (PWINDOW == g_pCompositor->m_pLastWindow) // if it's the active, let's post an event to update others
g_pEventManager->postEvent(SHyprIPCEvent("activewindow", g_pXWaylandManager->getAppIDClass(PWINDOW) + "," + PWINDOW->m_szTitle));
g_pEventManager->postEvent(SHyprIPCEvent{"activewindow", g_pXWaylandManager->getAppIDClass(PWINDOW) + "," + PWINDOW->m_szTitle});
if (PWINDOW->m_phForeignToplevel)
wlr_foreign_toplevel_handle_v1_set_title(PWINDOW->m_phForeignToplevel, PWINDOW->m_szTitle.c_str());
PWINDOW->updateToplevel();
Debug::log(LOG, "Window %x set title to %s", PWINDOW, PWINDOW->m_szTitle.c_str());
}
@@ -323,17 +596,29 @@ void Events::listener_setTitleWindow(void* owner, void* data) {
void Events::listener_fullscreenWindow(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;
if (!PWINDOW->m_bIsMapped) {
PWINDOW->m_bWantsInitialFullscreen = true;
return;
}
if (PWINDOW->m_bHidden)
return;
if (!PWINDOW->m_bIsX11) {
const auto REQUESTED = &PWINDOW->m_uSurface.xdg->toplevel->requested;
if (REQUESTED->fullscreen != PWINDOW->m_bIsFullscreen)
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, FULLSCREEN_FULL);
g_pCompositor->setWindowFullscreen(PWINDOW, REQUESTED->fullscreen, FULLSCREEN_FULL);
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
} else {
g_pLayoutManager->getCurrentLayout()->fullscreenRequestForWindow(PWINDOW, FULLSCREEN_FULL);
g_pCompositor->setWindowFullscreen(PWINDOW, !PWINDOW->m_bIsFullscreen, FULLSCREEN_FULL);
}
PWINDOW->updateToplevel();
Debug::log(LOG, "Window %x fullscreen to %i", PWINDOW, PWINDOW->m_bIsFullscreen);
g_pXWaylandManager->setWindowFullscreen(PWINDOW, PWINDOW->m_bIsFullscreen);
}
@@ -358,7 +643,7 @@ void Events::listener_configureX11(void* owner, void* data) {
const auto E = (wlr_xwayland_surface_configure_event*)data;
g_pHyprRenderer->damageWindow(PWINDOW);
if (!PWINDOW->m_bIsFloating) {
if (!PWINDOW->m_bIsFloating || PWINDOW->m_bIsFullscreen) {
g_pXWaylandManager->setWindowSize(PWINDOW, PWINDOW->m_vRealSize.vec());
g_pInputManager->refocus();
g_pHyprRenderer->damageWindow(PWINDOW);
@@ -370,6 +655,11 @@ void Events::listener_configureX11(void* owner, void* data) {
return;
}
if (E->width > 1 && E->height > 1)
PWINDOW->m_bHidden = false;
else
PWINDOW->m_bHidden = true;
PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(E->x, E->y));
PWINDOW->m_vRealSize.setValueAndWarp(Vector2D(E->width, E->height));
PWINDOW->m_vPosition = PWINDOW->m_vRealPosition.vec();
@@ -377,6 +667,8 @@ void Events::listener_configureX11(void* owner, void* data) {
wlr_xwayland_surface_configure(PWINDOW->m_uSurface.xwayland, E->x, E->y, E->width, E->height);
PWINDOW->m_iWorkspaceID = g_pCompositor->getMonitorFromVector(PWINDOW->m_vRealPosition.vec() + PWINDOW->m_vRealSize.vec() / 2.f)->activeWorkspace;
g_pCompositor->moveWindowToTop(PWINDOW);
PWINDOW->m_bCreatedOverFullscreen = true;
@@ -384,20 +676,56 @@ void Events::listener_configureX11(void* owner, void* data) {
g_pInputManager->refocus();
g_pHyprRenderer->damageWindow(PWINDOW);
PWINDOW->updateWindowDecos();
}
void Events::listener_unmanagedSetGeometry(void* owner, void* data) {
CWindow* PWINDOW = (CWindow*)owner;
if (!PWINDOW->m_bMappedX11 || PWINDOW->m_bHidden)
return;
const auto POS = PWINDOW->m_vRealPosition.goalv();
const auto SIZ = PWINDOW->m_vRealSize.goalv();
if (PWINDOW->m_uSurface.xwayland->width > 1 && PWINDOW->m_uSurface.xwayland->height > 1)
PWINDOW->m_bHidden = false;
else
PWINDOW->m_bHidden = true;
if (abs(std::floor(POS.x) - PWINDOW->m_uSurface.xwayland->x) > 2 || abs(std::floor(POS.y) - PWINDOW->m_uSurface.xwayland->y) > 2 || abs(std::floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2) {
Debug::log(LOG, "Unmanaged window %x requests geometry update to %i %i %i %i", PWINDOW, (int)PWINDOW->m_uSurface.xwayland->x, (int)PWINDOW->m_uSurface.xwayland->y, (int)PWINDOW->m_uSurface.xwayland->width, (int)PWINDOW->m_uSurface.xwayland->height);
g_pHyprRenderer->damageWindow(PWINDOW);
PWINDOW->m_vRealPosition.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->x, PWINDOW->m_uSurface.xwayland->y));
if (abs(std::floor(SIZ.x) - PWINDOW->m_uSurface.xwayland->width) > 2 || abs(std::floor(SIZ.y) - PWINDOW->m_uSurface.xwayland->height) > 2)
PWINDOW->m_vRealSize.setValueAndWarp(Vector2D(PWINDOW->m_uSurface.xwayland->width, PWINDOW->m_uSurface.xwayland->height));
PWINDOW->m_iWorkspaceID = g_pCompositor->getMonitorFromVector(PWINDOW->m_vRealPosition.vec() + PWINDOW->m_vRealSize.vec() / 2.f)->activeWorkspace;
g_pCompositor->moveWindowToTop(PWINDOW);
PWINDOW->updateWindowDecos();
g_pHyprRenderer->damageWindow(PWINDOW);
}
}
void Events::listener_surfaceXWayland(wl_listener* listener, void* data) {
const auto XWSURFACE = (wlr_xwayland_surface*)data;
Debug::log(LOG, "New XWayland Surface created.");
Debug::log(LOG, "New XWayland Surface created (class %s).", XWSURFACE->_class);
if (XWSURFACE->parent)
Debug::log(LOG, "Window parent data: %s at %x", XWSURFACE->parent->_class, XWSURFACE->parent);
g_pCompositor->m_lWindows.emplace_back();
const auto PNEWWINDOW = &g_pCompositor->m_lWindows.back();
const auto PNEWWINDOW = XWSURFACE->override_redirect ? g_pCompositor->m_dUnmanagedX11Windows.emplace_back(std::make_unique<CWindow>()).get() : g_pCompositor->m_vWindows.emplace_back(std::make_unique<CWindow>()).get();
PNEWWINDOW->m_uSurface.xwayland = XWSURFACE;
PNEWWINDOW->m_iX11Type = XWSURFACE->override_redirect ? 2 : 1;
PNEWWINDOW->m_bIsX11 = true;
PNEWWINDOW->m_pX11Parent = g_pCompositor->getX11Parent(PNEWWINDOW);
PNEWWINDOW->hyprListener_mapWindow.initCallback(&XWSURFACE->events.map, &Events::listener_mapWindow, PNEWWINDOW, "XWayland Window");
PNEWWINDOW->hyprListener_unmapWindow.initCallback(&XWSURFACE->events.unmap, &Events::listener_unmapWindow, PNEWWINDOW, "XWayland Window");
PNEWWINDOW->hyprListener_destroyWindow.initCallback(&XWSURFACE->events.destroy, &Events::listener_destroyWindow, PNEWWINDOW, "XWayland Window");
@@ -407,13 +735,12 @@ void Events::listener_newXDGSurface(wl_listener* listener, void* data) {
// A window got opened
const auto XDGSURFACE = (wlr_xdg_surface*)data;
Debug::log(LOG, "New XDG Surface created. (%ix%i at %i %i)", XDGSURFACE->current.geometry.width, XDGSURFACE->current.geometry.height, XDGSURFACE->current.geometry.x, XDGSURFACE->current.geometry.y);
if (XDGSURFACE->role != WLR_XDG_SURFACE_ROLE_TOPLEVEL)
return; // TODO: handle?
return;
g_pCompositor->m_lWindows.emplace_back();
const auto PNEWWINDOW = &g_pCompositor->m_lWindows.back();
Debug::log(LOG, "New XDG Surface created. (class: %s)", XDGSURFACE->toplevel->app_id);
const auto PNEWWINDOW = g_pCompositor->m_vWindows.emplace_back(std::make_unique<CWindow>()).get();
PNEWWINDOW->m_uSurface.xdg = XDGSURFACE;
PNEWWINDOW->hyprListener_mapWindow.initCallback(&XDGSURFACE->events.map, &Events::listener_mapWindow, PNEWWINDOW, "XDG Window");
@@ -425,3 +752,31 @@ void Events::listener_NewXDGDeco(wl_listener* listener, void* data) {
const auto WLRDECO = (wlr_xdg_toplevel_decoration_v1*)data;
wlr_xdg_toplevel_decoration_v1_set_mode(WLRDECO, WLR_XDG_TOPLEVEL_DECORATION_V1_MODE_SERVER_SIDE);
}
void Events::listener_requestMaximize(void* owner, void* data) {
const auto PWINDOW = (CWindow*)owner;
const auto EV = (wlr_foreign_toplevel_handle_v1_maximized_event*)data;
g_pCompositor->setWindowFullscreen(PWINDOW, EV ? EV->maximized : !PWINDOW->m_bIsFullscreen, FULLSCREEN_MAXIMIZED); // this will be rejected if there already is a fullscreen window
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
}
void Events::listener_requestMinimize(void* owner, void* data) {
// ignore
}
void Events::listener_requestMove(void* owner, void* data) {
const auto PWINDOW = (CWindow*)owner;
// ignore
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
}
void Events::listener_requestResize(void* owner, void* data) {
const auto PWINDOW = (CWindow*)owner;
// ignore
wlr_xdg_surface_schedule_configure(PWINDOW->m_uSurface.xdg);
}

View File

@@ -1,25 +1,24 @@
#include "AnimatedVariable.hpp"
#include "../managers/AnimationManager.hpp"
#include "../config/ConfigManager.hpp"
CAnimatedVariable::CAnimatedVariable() {
; // dummy var
}
void CAnimatedVariable::create(ANIMATEDVARTYPE type, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY policy) {
void CAnimatedVariable::create(ANIMATEDVARTYPE type, SAnimationPropertyConfig* pAnimConfig, void* pWindow, AVARDAMAGEPOLICY policy) {
m_eVarType = type;
m_eDamagePolicy = policy;
m_pSpeed = speed;
m_pEnabled = enabled;
m_pConfig = pAnimConfig;
m_pWindow = pWindow;
m_pBezier = pBezier;
g_pAnimationManager->m_lAnimatedVariables.push_back(this);
m_bDummy = false;
}
void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY policy) {
create(type, speed, enabled, pBezier, pWindow, policy);
void CAnimatedVariable::create(ANIMATEDVARTYPE type, std::any val, SAnimationPropertyConfig* pAnimConfig, void* pWindow, AVARDAMAGEPOLICY policy) {
create(type, pAnimConfig, pWindow, policy);
try {
switch (type) {
@@ -57,4 +56,8 @@ CAnimatedVariable::~CAnimatedVariable() {
void CAnimatedVariable::unregister() {
g_pAnimationManager->m_lAnimatedVariables.remove(this);
}
}
int CAnimatedVariable::getDurationLeftMs() {
return std::max((int)(m_pConfig->pValues->internalSpeed * 100) - (int)std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - animationBegin).count(), 0);
}

View File

@@ -13,19 +13,21 @@ enum ANIMATEDVARTYPE {
enum AVARDAMAGEPOLICY {
AVARDAMAGE_INVALID = -1,
AVARDAMAGE_ENTIRE = 0,
AVARDAMAGE_BORDER
AVARDAMAGE_BORDER,
AVARDAMAGE_SHADOW
};
class CAnimationManager;
class CWorkspace;
struct SLayerSurface;
struct SAnimationPropertyConfig;
class CAnimatedVariable {
public:
CAnimatedVariable(); // dummy var
void create(ANIMATEDVARTYPE, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY);
void create(ANIMATEDVARTYPE, std::any val, float* speed, int64_t* enabled, std::string* pBezier, void* pWindow, AVARDAMAGEPOLICY);
void create(ANIMATEDVARTYPE, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY);
void create(ANIMATEDVARTYPE, std::any val, SAnimationPropertyConfig*, void* pWindow, AVARDAMAGEPOLICY);
~CAnimatedVariable();
@@ -33,56 +35,47 @@ public:
// gets the current vector value (real time)
const Vector2D& vec() const {
RASSERT(m_eVarType == AVARTYPE_VECTOR, "Tried to access vec() of AVARTYPE %i!", m_eVarType);
return m_vValue;
}
// gets the current float value (real time)
const float& fl() const {
RASSERT(m_eVarType == AVARTYPE_FLOAT, "Tried to access fl() of AVARTYPE %i!", m_eVarType);
return m_fValue;
}
// gets the current color value (real time)
const CColor& col() const {
RASSERT(m_eVarType == AVARTYPE_COLOR, "Tried to access col() of AVARTYPE %i!", m_eVarType);
return m_cValue;
}
// gets the goal vector value
const Vector2D& goalv() const {
RASSERT(m_eVarType == AVARTYPE_VECTOR, "Tried to access goalv() of AVARTYPE %i!", m_eVarType);
return m_vGoal;
}
// gets the goal float value
const float& goalf() const {
RASSERT(m_eVarType == AVARTYPE_FLOAT, "Tried to access goalf() of AVARTYPE %i!", m_eVarType);
return m_fGoal;
}
// gets the goal color value
const CColor& goalc() const {
RASSERT(m_eVarType == AVARTYPE_COLOR, "Tried to access goalc() of AVARTYPE %i!", m_eVarType);
return m_cGoal;
}
void operator=(const Vector2D& v) {
RASSERT(m_eVarType == AVARTYPE_VECTOR, "Tried to access =v of AVARTYPE %i!", m_eVarType);
m_vGoal = v;
animationBegin = std::chrono::system_clock::now();
m_vBegun = m_vValue;
}
void operator=(const float& v) {
RASSERT(m_eVarType == AVARTYPE_FLOAT, "Tried to access =f of AVARTYPE %i!", m_eVarType);
m_fGoal = v;
animationBegin = std::chrono::system_clock::now();
m_fBegun = m_fValue;
}
void operator=(const CColor& v) {
RASSERT(m_eVarType == AVARTYPE_COLOR, "Tried to access =c of AVARTYPE %i!", m_eVarType);
m_cGoal = v;
animationBegin = std::chrono::system_clock::now();
m_cBegun = m_cValue;
@@ -90,7 +83,6 @@ public:
// Sets the actual stored value, without affecting the goal, but resets the timer
void setValue(const Vector2D& v) {
RASSERT(m_eVarType == AVARTYPE_VECTOR, "Tried to access setValue(v) of AVARTYPE %i!", m_eVarType);
m_vValue = v;
animationBegin = std::chrono::system_clock::now();
m_vBegun = m_vValue;
@@ -98,7 +90,6 @@ public:
// Sets the actual stored value, without affecting the goal, but resets the timer
void setValue(const float& v) {
RASSERT(m_eVarType == AVARTYPE_FLOAT, "Tried to access setValue(f) of AVARTYPE %i!", m_eVarType);
m_fValue = v;
animationBegin = std::chrono::system_clock::now();
m_vBegun = m_vValue;
@@ -106,7 +97,6 @@ public:
// Sets the actual stored value, without affecting the goal, but resets the timer
void setValue(const CColor& v) {
RASSERT(m_eVarType == AVARTYPE_COLOR, "Tried to access setValue(c) of AVARTYPE %i!", m_eVarType);
m_cValue = v;
animationBegin = std::chrono::system_clock::now();
m_vBegun = m_vValue;
@@ -114,21 +104,18 @@ public:
// Sets the actual value and goal
void setValueAndWarp(const Vector2D& v) {
RASSERT(m_eVarType == AVARTYPE_VECTOR, "Tried to access setValueAndWarp(v) of AVARTYPE %i!", m_eVarType);
m_vGoal = v;
warp();
}
// Sets the actual value and goal
void setValueAndWarp(const float& v) {
RASSERT(m_eVarType == AVARTYPE_FLOAT, "Tried to access setValueAndWarp(f) of AVARTYPE %i!", m_eVarType);
m_fGoal = v;
warp();
}
// Sets the actual value and goal
void setValueAndWarp(const CColor& v) {
RASSERT(m_eVarType == AVARTYPE_COLOR, "Tried to access setValueAndWarp(c) of AVARTYPE %i!", m_eVarType);
m_cGoal = v;
warp();
}
@@ -138,18 +125,18 @@ public:
switch (m_eVarType) {
case AVARTYPE_FLOAT:
return m_fValue != m_fGoal;
case AVARTYPE_VECTOR:
case AVARTYPE_VECTOR:
return m_vValue != m_vGoal;
case AVARTYPE_COLOR:
return m_cValue != m_cGoal;
default:
return false;
UNREACHABLE();
}
return false; // unreachable
}
UNREACHABLE();
private:
return false; // just so that the warning is suppressed
}
void warp() {
switch (m_eVarType) {
@@ -166,10 +153,22 @@ private:
break;
}
default:
break;
UNREACHABLE();
}
}
void setConfig(SAnimationPropertyConfig* pConfig) {
m_pConfig = pConfig;
}
SAnimationPropertyConfig* getConfig() {
return m_pConfig;
}
int getDurationLeftMs();
private:
Vector2D m_vValue = Vector2D(0,0);
float m_fValue = 0;
CColor m_cValue;
@@ -182,15 +181,12 @@ private:
float m_fBegun = 0;
CColor m_cBegun;
float* m_pSpeed = nullptr;
int64_t* m_pEnabled = nullptr;
// owners
void* m_pWindow = nullptr;
void* m_pWorkspace = nullptr;
void* m_pLayer = nullptr;
std::string* m_pBezier = nullptr;
SAnimationPropertyConfig* m_pConfig = nullptr;
bool m_bDummy = true;
@@ -202,4 +198,4 @@ private:
friend class CAnimationManager;
friend class CWorkspace;
friend struct SLayerSurface;
};
};

View File

@@ -1,9 +1,7 @@
#include "Color.hpp"
#include "../defines.hpp"
CColor::CColor() {
}
CColor::CColor() { }
CColor::CColor(float r, float g, float b, float a) {
this->r = r;

View File

@@ -23,8 +23,8 @@ public:
CColor operator* (const float& v) const {
return CColor(r * v, g * v, b * v, a * v);
}
bool operator==(const CColor& c2) const {
return r == c2.r && g == c2.g && b == c2.b && a == c2.a;
}
};
};

View File

@@ -2,11 +2,70 @@
#include "../defines.hpp"
#include <algorithm>
#include "../Compositor.hpp"
#include <sys/utsname.h>
#include <iomanip>
static const float transforms[][9] = {{
1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
0.0f, 1.0f, 0.0f,
-1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
-1.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
0.0f, -1.0f, 0.0f,
1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
-1.0f, 0.0f, 0.0f,
0.0f, 1.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
0.0f, 1.0f, 0.0f,
1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
1.0f, 0.0f, 0.0f,
0.0f, -1.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},{
0.0f, -1.0f, 0.0f,
-1.0f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f,
},
};
std::string absolutePath(const std::string& rawpath, const std::string& currentPath) {
auto value = rawpath;
if (value[0] == '.') {
auto currentDir = currentPath.substr(0, currentPath.find_last_of('/'));
if (value[1] == '.') {
auto parentDir = currentDir.substr(0, currentDir.find_last_of('/'));
value.replace(0, 2, parentDir);
} else {
value.replace(0, 1, currentDir);
}
}
if (value[0] == '~') {
static const char* const ENVHOME = getenv("HOME");
value.replace(0, 1, std::string(ENVHOME));
}
return value;
}
void addWLSignal(wl_signal* pSignal, wl_listener* pListener, void* pOwner, std::string ownerString) {
ASSERT(pSignal);
ASSERT(pListener);
wl_signal_add(pSignal, pListener);
Debug::log(LOG, "Registered signal for owner %x: %x -> %x (owner: %s)", pOwner, pSignal, pListener, ownerString.c_str());
@@ -16,64 +75,63 @@ void handleNoop(struct wl_listener *listener, void *data) {
// Do nothing
}
void wlr_signal_emit_safe(struct wl_signal *signal, void *data) {
struct wl_listener cursor;
struct wl_listener end;
/* Add two special markers: one cursor and one end marker. This way, we know
* that we've already called listeners on the left of the cursor and that we
* don't want to call listeners on the right of the end marker. The 'it'
* function can remove any element it wants from the list without troubles.
* wl_list_for_each_safe tries to be safe but it fails: it works fine
* if the current item is removed, but not if the next one is. */
wl_list_insert(&signal->listener_list, &cursor.link);
cursor.notify = handleNoop;
wl_list_insert(signal->listener_list.prev, &end.link);
end.notify = handleNoop;
while (cursor.link.next != &end.link) {
struct wl_list *pos = cursor.link.next;
struct wl_listener *l = wl_container_of(pos, l, link);
wl_list_remove(&cursor.link);
wl_list_insert(pos, &cursor.link);
l->notify(l, data);
}
wl_list_remove(&cursor.link);
wl_list_remove(&end.link);
}
std::string getFormat(const char *fmt, ...) {
char buf[2048] = "";
char* outputStr = nullptr;
va_list args;
va_start(args, fmt);
vsprintf(buf, fmt, args);
vasprintf(&outputStr, fmt, args);
va_end(args);
return std::string(buf);
std::string output = std::string(outputStr);
free(outputStr);
return output;
}
std::string escapeJSONStrings(const std::string& str) {
std::ostringstream oss;
for (auto &c : str) {
switch (c) {
case '"': oss << "\\\""; break;
case '\\': oss << "\\\\"; break;
case '\b': oss << "\\b"; break;
case '\f': oss << "\\f"; break;
case '\n': oss << "\\n"; break;
case '\r': oss << "\\r"; break;
case '\t': oss << "\\t"; break;
default:
if ('\x00' <= c && c <= '\x1f') {
oss << "\\u"
<< std::hex << std::setw(4) << std::setfill('0') << static_cast<int>(c);
} else {
oss << c;
}
}
}
return oss.str();
}
void scaleBox(wlr_box* box, float scale) {
box->width = std::round((box->x + box->width) * scale) - std::round(box->x * scale);
box->height = std::round((box->y + box->height) * scale) - std::round(box->y * scale);
box->width = std::round(box->width * scale);
box->height = std::round(box->height * scale);
box->x = std::round(box->x * scale);
box->y = std::round(box->y * scale);
}
std::string removeBeginEndSpacesTabs(std::string str) {
while (str[0] == ' ' || str[0] == '\t') {
str = str.substr(1);
int countBefore = 0;
while (str[countBefore] == ' ' || str[countBefore] == '\t') {
countBefore++;
}
while (str.length() != 0 && (str[str.length() - 1] == ' ' || str[str.length() - 1] == '\t')) {
str = str.substr(0, str.length() - 1);
int countAfter = 0;
while (str.length() != 0 && (str[str.length() - countAfter - 1] == ' ' || str[str.length() - 1 - countAfter] == '\t')) {
countAfter++;
}
str = str.substr(countBefore, str.length() - countBefore - countAfter);
return str;
}
@@ -82,7 +140,7 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
if (source.find_first_of("+") == 0) {
try {
if (source.find('.') != std::string::npos)
if (source.contains("."))
result = relative + std::stof(source.substr(1));
else
result = relative + std::stoi(source.substr(1));
@@ -92,7 +150,7 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
}
} else if (source.find_first_of("-") == 0) {
try {
if (source.find('.') != std::string::npos)
if (source.contains("."))
result = relative - std::stof(source.substr(1));
else
result = relative - std::stoi(source.substr(1));
@@ -102,7 +160,7 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
}
} else {
try {
if (source.find('.') != std::string::npos)
if (source.contains("."))
result = stof(source);
else
result = stoi(source);
@@ -115,8 +173,29 @@ float getPlusMinusKeywordResult(std::string source, float relative) {
return result;
}
bool isNumber(const std::string& str) {
return std::ranges::all_of(str.begin(), str.end(), [](char c) { return isdigit(c) != 0; });
bool isNumber(const std::string& str, bool allowfloat) {
std::string copy = str;
if (*copy.begin() == '-')
copy = copy.substr(1);
if (copy.empty())
return false;
bool point = !allowfloat;
for (auto& c : copy) {
if (c == '.') {
if (point)
return false;
point = true;
break;
}
if (!std::isdigit(c))
return false;
}
return true;
}
bool isDirection(const std::string& arg) {
@@ -125,7 +204,10 @@ bool isDirection(const std::string& arg) {
int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
int result = INT_MAX;
if (in.find("name:") == 0) {
if (in.find("special") == 0) {
outName = "special";
return SPECIAL_WORKSPACE_ID;
} else if (in.find("name:") == 0) {
const auto WORKSPACENAME = in.substr(in.find_first_of(':') + 1);
const auto WORKSPACE = g_pCompositor->getWorkspaceByName(WORKSPACENAME);
if (!WORKSPACE) {
@@ -135,15 +217,179 @@ int getWorkspaceIDFromString(const std::string& in, std::string& outName) {
}
outName = WORKSPACENAME;
} else {
result = std::clamp((int)getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspace), 1, INT_MAX);
outName = std::to_string(result);
if ((in[0] == 'm' || in[0] == 'e') && (in[1] == '-' || in[1] == '+') && isNumber(in.substr(2))) {
bool onAllMonitors = in[0] == 'e';
if (!g_pCompositor->m_pLastMonitor) {
Debug::log(ERR, "Relative monitor workspace on monitor null!");
result = INT_MAX;
return result;
}
// monitor relative
result = (int)getPlusMinusKeywordResult(in.substr(1), 0);
// result now has +/- what we should move on mon
int remains = (int)result;
int currentID = g_pCompositor->m_pLastMonitor->activeWorkspace;
int searchID = currentID;
while (remains != 0) {
if (remains < 0)
searchID--;
else
searchID++;
if (g_pCompositor->workspaceIDOutOfBounds(searchID)){
// means we need to wrap around
int lowestID = 99999;
int highestID = -99999;
for (auto& w : g_pCompositor->m_vWorkspaces) {
if (w->m_iID == SPECIAL_WORKSPACE_ID)
continue;
if (w->m_iID < lowestID)
lowestID = w->m_iID;
if (w->m_iID > highestID)
highestID = w->m_iID;
}
if (remains < 0)
searchID = highestID;
else
searchID = lowestID;
}
if (const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(searchID); PWORKSPACE && PWORKSPACE->m_iID != SPECIAL_WORKSPACE_ID) {
if (onAllMonitors || PWORKSPACE->m_iMonitorID == g_pCompositor->m_pLastMonitor->ID) {
currentID = PWORKSPACE->m_iID;
if (remains < 0)
remains++;
else
remains--;
}
}
}
result = currentID;
outName = g_pCompositor->getWorkspaceByID(currentID)->m_szName;
} else {
if (in[0] == '+' || in[0] == '-') {
if (g_pCompositor->m_pLastMonitor)
result = std::max((int)getPlusMinusKeywordResult(in, g_pCompositor->m_pLastMonitor->activeWorkspace), 1);
else {
Debug::log(ERR, "Relative workspace on no mon!");
result = INT_MAX;
}
} else if (isNumber(in))
result = std::max(std::stoi(in), 1);
else {
// maybe name
const auto PWORKSPACE = g_pCompositor->getWorkspaceByName(in);
if (PWORKSPACE)
result = PWORKSPACE->m_iID;
}
outName = std::to_string(result);
}
}
return result;
}
float vecToRectDistanceSquared(const Vector2D& vec, const Vector2D& p1, const Vector2D& p2) {
const float DX = std::max((double)0, std::max(p1.x - vec.x, vec.x - p2.x));
const float DY = std::max((double)0, std::max(p1.y - vec.y, vec.y - p2.y));
const float DX = std::max({0.0, p1.x - vec.x, vec.x - p2.x});
const float DY = std::max({0.0, p1.y - vec.y, vec.y - p2.y});
return DX * DX + DY * DY;
}
// Execute a shell command and get the output
std::string execAndGet(const char* cmd) {
std::array<char, 128> buffer;
std::string result;
const std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose);
if (!pipe) {
Debug::log(ERR, "execAndGet: failed in pipe");
return "";
}
while (fgets(buffer.data(), buffer.size(), pipe.get()) != nullptr) {
result += buffer.data();
}
return result;
}
void logSystemInfo() {
struct utsname unameInfo;
uname(&unameInfo);
Debug::log(LOG, "System name: %s", unameInfo.sysname);
Debug::log(LOG, "Node name: %s", unameInfo.nodename);
Debug::log(LOG, "Release: %s", unameInfo.release);
Debug::log(LOG, "Version: %s", unameInfo.version);
// log etc
Debug::log(LOG, "os-release:");
Debug::log(NONE, "%s", execAndGet("cat /etc/os-release").c_str());
}
void matrixProjection(float mat[9], int w, int h, wl_output_transform tr) {
memset(mat, 0, sizeof(*mat) * 9);
const float* t = transforms[tr];
float x = 2.0f / w;
float y = 2.0f / h;
// Rotation + reflection
mat[0] = x * t[0];
mat[1] = x * t[1];
mat[3] = y * -t[3];
mat[4] = y * -t[4];
// Translation
mat[2] = -copysign(1.0f, mat[0] + mat[1]);
mat[5] = -copysign(1.0f, mat[3] + mat[4]);
// Identity
mat[8] = 1.0f;
}
int64_t getPPIDof(int64_t pid) {
std::string dir = "/proc/" + std::to_string(pid) + "/status";
FILE* infile;
infile = fopen(dir.c_str(), "r");
if (!infile)
return 0;
char* line = nullptr;
size_t len = 0;
ssize_t len2 = 0;
std::string pidstr;
while ((len2 = getline(&line, &len, infile)) != -1) {
if (strstr(line, "PPid:")) {
pidstr = std::string(line, len2);
const auto tabpos = pidstr.find_last_of('\t');
if (tabpos != std::string::npos)
pidstr = pidstr.substr(tabpos);
break;
}
}
fclose(infile);
if (line)
free(line);
try {
return std::stoll(pidstr);
} catch (std::exception& e) {
return 0;
}
}

View File

@@ -2,14 +2,20 @@
#include "../includes.hpp"
std::string absolutePath(const std::string&, const std::string&);
void addWLSignal(wl_signal*, wl_listener*, void* pOwner, std::string ownerString);
void wlr_signal_emit_safe(struct wl_signal *signal, void *data);
std::string getFormat(const char *fmt, ...); // Basically Debug::log to a string
std::string escapeJSONStrings(const std::string& str);
void scaleBox(wlr_box*, float);
std::string removeBeginEndSpacesTabs(std::string);
bool isNumber(const std::string&);
bool isNumber(const std::string&, bool allowfloat = false);
bool isDirection(const std::string&);
int getWorkspaceIDFromString(const std::string&, std::string&);
float vecToRectDistanceSquared(const Vector2D& vec, const Vector2D& p1, const Vector2D& p2);
void logSystemInfo();
std::string execAndGet(const char*);
int64_t getPPIDof(int64_t pid);
float getPlusMinusKeywordResult(std::string in, float relative);
float getPlusMinusKeywordResult(std::string in, float relative);
void matrixProjection(float mat[9], int w, int h, wl_output_transform tr);

361
src/helpers/Monitor.cpp Normal file
View File

@@ -0,0 +1,361 @@
#include "Monitor.hpp"
#include "../Compositor.hpp"
void CMonitor::onConnect(bool noRule) {
if (m_bEnabled)
return;
szName = output->name;
// get monitor rule that matches
SMonitorRule monitorRule = g_pConfigManager->getMonitorRuleFor(output->name);
hyprListener_monitorFrame.initCallback(&output->events.frame, &Events::listener_monitorFrame, this);
hyprListener_monitorDestroy.initCallback(&output->events.destroy, &Events::listener_monitorDestroy, this);
// if it's disabled, disable and ignore
if (monitorRule.disabled) {
wlr_output_enable_adaptive_sync(output, 1);
wlr_output_set_scale(output, 1);
wlr_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL);
auto PREFSTATE = wlr_output_preferred_mode(output);
if (!PREFSTATE) {
wlr_output_mode* mode;
wl_list_for_each(mode, &output->modes, link) {
wlr_output_set_mode(output, PREFSTATE);
if (!wlr_output_test(output))
continue;
PREFSTATE = mode;
break;
}
}
if (PREFSTATE)
wlr_output_set_mode(output, PREFSTATE);
else
Debug::log(WARN, "No mode found for disabled output %s", output->name);
wlr_output_enable(output, 0);
if (!wlr_output_commit(output)) {
Debug::log(ERR, "Couldn't commit disabled state on output %s", output->name);
}
Events::listener_change(nullptr, nullptr);
m_bEnabled = false;
hyprListener_monitorFrame.removeCallback();
return;
}
if (output->non_desktop) {
Debug::log(LOG, "Not configuring non-desktop output");
if (g_pCompositor->m_sWRLDRMLeaseMgr) {
wlr_drm_lease_v1_manager_offer_output(g_pCompositor->m_sWRLDRMLeaseMgr, output);
}
return;
}
if (!m_bRenderingInitPassed) {
output->allocator = nullptr;
output->renderer = nullptr;
wlr_output_init_render(output, g_pCompositor->m_sWLRAllocator, g_pCompositor->m_sWLRRenderer);
m_bRenderingInitPassed = true;
}
if (!m_pThisWrap) {
// find the wrap
for (auto& m : g_pCompositor->m_vRealMonitors) {
if (m->ID == ID) {
m_pThisWrap = &m;
break;
}
}
}
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_vMonitors.end()){
g_pCompositor->m_vMonitors.push_back(*m_pThisWrap);
}
m_bEnabled = true;
wlr_output_set_scale(output, monitorRule.scale);
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, monitorRule.scale);
wlr_output_set_transform(output, WL_OUTPUT_TRANSFORM_NORMAL); // TODO: support other transforms
// create it in the arr
vecPosition = monitorRule.offset;
vecSize = monitorRule.resolution;
refreshRate = monitorRule.refreshRate;
wlr_output_enable(output, 1);
// TODO: this doesn't seem to set the X and Y correctly,
// wlr_output_layout_output_coords returns invalid values, I think...
wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, output, monitorRule.offset.x, monitorRule.offset.y);
// set mode, also applies
if (!noRule)
g_pHyprRenderer->applyMonitorRule(this, &monitorRule, true);
Debug::log(LOG, "Added new monitor with name %s at %i,%i with size %ix%i, pointer %x", output->name, (int)vecPosition.x, (int)vecPosition.y, (int)vecPixelSize.x, (int)vecPixelSize.y, output);
damage = wlr_output_damage_create(output);
// add a WLR workspace group
if (!pWLRWorkspaceGroupHandle) {
pWLRWorkspaceGroupHandle = wlr_ext_workspace_group_handle_v1_create(g_pCompositor->m_sWLREXTWorkspaceMgr);
}
wlr_ext_workspace_group_handle_v1_output_enter(pWLRWorkspaceGroupHandle, output);
setupDefaultWS(monitorRule);
scale = monitorRule.scale;
m_pThisWrap = nullptr;
forceFullFrames = 3; // force 3 full frames to make sure there is no blinking due to double-buffering.
//
if (!g_pCompositor->m_pLastMonitor) // set the last monitor if it isnt set yet
g_pCompositor->m_pLastMonitor = this;
wlr_xcursor_manager_load(g_pCompositor->m_sWLRXCursorMgr, scale);
g_pHyprRenderer->arrangeLayersForMonitor(ID);
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
g_pEventManager->postEvent(SHyprIPCEvent{"monitoradded", szName});
}
void CMonitor::onDisconnect() {
if (!m_bEnabled)
return;
// Cleanup everything. Move windows back, snap cursor, shit.
CMonitor* BACKUPMON = nullptr;
for (auto& m : g_pCompositor->m_vMonitors) {
if (m.get() != this) {
BACKUPMON = m.get();
break;
}
}
// remove mirror
if (pMirrorOf) {
pMirrorOf->mirrors.erase(std::find_if(pMirrorOf->mirrors.begin(), pMirrorOf->mirrors.end(), [&](const auto& other) { return other == this; }));
pMirrorOf = nullptr;
}
if (!mirrors.empty()) {
for (auto& m : mirrors) {
m->setMirror("");
}
g_pConfigManager->m_bWantsMonitorReload = true;
}
m_bEnabled = false;
m_bRenderingInitPassed = false;
hyprListener_monitorFrame.removeCallback();
if (!BACKUPMON) {
Debug::log(WARN, "Unplugged last monitor, entering an unsafe state. Good luck my friend.");
hyprListener_monitorMode.removeCallback();
hyprListener_monitorDestroy.removeCallback();
g_pCompositor->m_bUnsafeState = true;
return;
}
const auto BACKUPWORKSPACE = BACKUPMON->activeWorkspace > 0 ? std::to_string(BACKUPMON->activeWorkspace) : "name:" + g_pCompositor->getWorkspaceByID(BACKUPMON->activeWorkspace)->m_szName;
// snap cursor
wlr_cursor_warp(g_pCompositor->m_sWLRCursor, g_pCompositor->m_sSeat.mouse->mouse, BACKUPMON->vecPosition.x + BACKUPMON->vecTransformedSize.x / 2.f, BACKUPMON->vecPosition.y + BACKUPMON->vecTransformedSize.y / 2.f);
// move workspaces
std::deque<CWorkspace*> wspToMove;
for (auto& w : g_pCompositor->m_vWorkspaces) {
if (w->m_iMonitorID == ID) {
wspToMove.push_back(w.get());
}
}
for (auto& w : wspToMove) {
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
w->startAnim(true, true, true);
}
activeWorkspace = -1;
wlr_output_damage_destroy(damage);
wlr_output_layout_remove(g_pCompositor->m_sWLROutputLayout, output);
wlr_output_enable(output, false);
wlr_output_commit(output);
g_pCompositor->m_vWorkspaces.erase(std::remove_if(g_pCompositor->m_vWorkspaces.begin(), g_pCompositor->m_vWorkspaces.end(), [&](std::unique_ptr<CWorkspace>& el) { return el->m_iMonitorID == ID; }));
Debug::log(LOG, "Removed monitor %s!", szName.c_str());
g_pEventManager->postEvent(SHyprIPCEvent{"monitorremoved", szName});
g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](std::shared_ptr<CMonitor>& el) { return el.get() == this; }));
}
void CMonitor::addDamage(pixman_region32_t* rg) {
wlr_output_damage_add(damage, rg);
}
void CMonitor::addDamage(wlr_box* box) {
wlr_output_damage_add_box(damage, box);
}
bool CMonitor::isMirror() {
return pMirrorOf != nullptr;
}
void CMonitor::setupDefaultWS(const SMonitorRule& monitorRule) {
// Workspace
std::string newDefaultWorkspaceName = "";
auto WORKSPACEID = monitorRule.defaultWorkspace == "" ? g_pCompositor->m_vWorkspaces.size() + 1 : getWorkspaceIDFromString(monitorRule.defaultWorkspace, newDefaultWorkspaceName);
if (WORKSPACEID == INT_MAX || WORKSPACEID == (long unsigned int)SPECIAL_WORKSPACE_ID) {
WORKSPACEID = g_pCompositor->m_vWorkspaces.size() + 1;
newDefaultWorkspaceName = std::to_string(WORKSPACEID);
Debug::log(LOG, "Invalid workspace= directive name in monitor parsing, workspace name \"%s\" is invalid.", monitorRule.defaultWorkspace.c_str());
}
auto PNEWWORKSPACE = g_pCompositor->getWorkspaceByID(WORKSPACEID);
Debug::log(LOG, "New monitor: WORKSPACEID %d, exists: %d", WORKSPACEID, (int)(PNEWWORKSPACE != nullptr));
if (PNEWWORKSPACE) {
// workspace exists, move it to the newly connected monitor
g_pCompositor->moveWorkspaceToMonitor(PNEWWORKSPACE, this);
activeWorkspace = PNEWWORKSPACE->m_iID;
g_pLayoutManager->getCurrentLayout()->recalculateMonitor(ID);
PNEWWORKSPACE->startAnim(true, true, true);
} else {
if (newDefaultWorkspaceName == "")
newDefaultWorkspaceName = std::to_string(WORKSPACEID);
PNEWWORKSPACE = g_pCompositor->m_vWorkspaces.emplace_back(std::make_unique<CWorkspace>(ID, newDefaultWorkspaceName)).get();
// We are required to set the name here immediately
wlr_ext_workspace_handle_v1_set_name(PNEWWORKSPACE->m_pWlrHandle, newDefaultWorkspaceName.c_str());
PNEWWORKSPACE->m_iID = WORKSPACEID;
}
activeWorkspace = PNEWWORKSPACE->m_iID;
g_pCompositor->deactivateAllWLRWorkspaces(PNEWWORKSPACE->m_pWlrHandle);
PNEWWORKSPACE->setActive(true);
}
void CMonitor::setMirror(const std::string& mirrorOf) {
const auto PMIRRORMON = g_pCompositor->getMonitorFromString(mirrorOf);
if (PMIRRORMON == pMirrorOf)
return;
if (PMIRRORMON && PMIRRORMON->isMirror()) {
Debug::log(ERR, "Cannot mirror a mirror!");
return;
}
if (PMIRRORMON == this) {
Debug::log(ERR, "Cannot mirror self!");
return;
}
if (!PMIRRORMON) {
// disable mirroring
if (pMirrorOf) {
pMirrorOf->mirrors.erase(std::find_if(pMirrorOf->mirrors.begin(), pMirrorOf->mirrors.end(), [&](const auto& other) { return other == this; }));
}
pMirrorOf = nullptr;
// set rule
const auto RULE = g_pConfigManager->getMonitorRuleFor(this->szName);
vecPosition = RULE.offset;
// push to mvmonitors
if (!m_pThisWrap) {
// find the wrap
for (auto& m : g_pCompositor->m_vRealMonitors) {
if (m->ID == ID) {
m_pThisWrap = &m;
break;
}
}
}
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) == g_pCompositor->m_vMonitors.end()) {
g_pCompositor->m_vMonitors.push_back(*m_pThisWrap);
}
setupDefaultWS(RULE);
wlr_output_layout_add(g_pCompositor->m_sWLROutputLayout, output, (int)vecPosition.x, (int)vecPosition.y);
} else {
CMonitor* BACKUPMON = nullptr;
for (auto& m : g_pCompositor->m_vMonitors) {
if (m.get() != this) {
BACKUPMON = m.get();
break;
}
}
// move all the WS
std::deque<CWorkspace*> wspToMove;
for (auto& w : g_pCompositor->m_vWorkspaces) {
if (w->m_iMonitorID == ID) {
wspToMove.push_back(w.get());
}
}
for (auto& w : wspToMove) {
g_pCompositor->moveWorkspaceToMonitor(w, BACKUPMON);
w->startAnim(true, true, true);
}
activeWorkspace = -1;
wlr_output_layout_remove(g_pCompositor->m_sWLROutputLayout, output);
vecPosition = Vector2D(-1337420, -1337420);
pMirrorOf = PMIRRORMON;
pMirrorOf->mirrors.push_back(this);
// remove from mvmonitors
if (std::find_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](auto& other) { return other.get() == this; }) != g_pCompositor->m_vMonitors.end()) {
g_pCompositor->m_vMonitors.erase(std::remove_if(g_pCompositor->m_vMonitors.begin(), g_pCompositor->m_vMonitors.end(), [&](const auto& other) { return other.get() == this; }));
}
g_pCompositor->m_pLastMonitor = g_pCompositor->m_vMonitors.front().get();
}
}

View File

@@ -3,10 +3,14 @@
#include "../defines.hpp"
#include <deque>
#include "WLClasses.hpp"
#include <list>
#include <vector>
#include <array>
#include <memory>
struct SMonitor {
struct SMonitorRule;
class CMonitor {
public:
Vector2D vecPosition = Vector2D(0,0);
Vector2D vecSize = Vector2D(0,0);
Vector2D vecPixelSize = Vector2D(0,0);
@@ -27,13 +31,23 @@ struct SMonitor {
wlr_output* output = nullptr;
float refreshRate = 60;
wlr_output_damage* damage = nullptr;
bool needsFrameSkip = false;
int framesToSkip = 0;
int forceFullFrames = 0;
bool noFrameSchedule = false;
bool scheduledRecalc = false;
wl_output_transform transform = WL_OUTPUT_TRANSFORM_NORMAL;
// mirroring
CMonitor* pMirrorOf = nullptr;
std::vector<CMonitor*> mirrors;
// for the special workspace
bool specialWorkspaceOpen = false;
// Double-linked list because we need to have constant mem addresses for signals
// We have to store pointers and use raw new/delete because they might be moved between them
// and I am lazy
std::array<std::list<SLayerSurface*>, 4> m_aLayerSurfaceLists;
std::array<std::vector<std::unique_ptr<SLayerSurface>>, 4> m_aLayerSurfaceLists;
DYNLISTENER(monitorFrame);
DYNLISTENER(monitorDestroy);
@@ -44,9 +58,24 @@ struct SMonitor {
wlr_ext_workspace_group_handle_v1* pWLRWorkspaceGroupHandle = nullptr;
// methods
void onConnect(bool noRule);
void onDisconnect();
void addDamage(pixman_region32_t* rg);
void addDamage(wlr_box* box);
void setMirror(const std::string&);
bool isMirror();
std::shared_ptr<CMonitor>* m_pThisWrap = nullptr;
bool m_bEnabled = false;
bool m_bRenderingInitPassed = false;
// For the list lookup
bool operator==(const SMonitor& rhs) {
bool operator==(const CMonitor& rhs) {
return vecPosition == rhs.vecPosition && vecSize == rhs.vecSize && szName == rhs.szName;
}
};
private:
void setupDefaultWS(const SMonitorRule&);
};

56
src/helpers/Splashes.hpp Normal file
View File

@@ -0,0 +1,56 @@
#pragma once
#include <array>
#include <string>
inline const std::vector<std::string> SPLASHES = {
"Woo, animations!",
"It's like Hypr, but better.",
"Release 1.0 when?",
"It's not awesome, it's Hyprland!",
"\"I commit too often, people can't catch up lmao\" - Vaxry",
"This text is random.",
"\"There are reasons to not use rust.\" - Boga",
"Read the wiki.",
"\"Hello everyone this is YOUR daily dose of read the wiki\" - Vaxry",
"h",
"\"why no work, bro I haven't hacked your pc to get live feeds yet\" - Vaxry",
"Compile, wait for 20 minutes, notice a new commit, compile again.",
"To rice, or not to rice, that is the question.",
"Now available on Fedora!",
// music reference / quote section
"J'remue le ciel, le jour, la nuit.",
"aezakmi, aezakmi, aezakmi, aezakmi, aezakmi, aezakmi, aezakmi!",
"Wir sind schon sehr lang zusammen...",
"I see a red door and I want it painted black.",
"Take on me, take me on...",
"You spin me right round baby right round",
"Stayin' alive, stayin' alive",
"Say no way, say no way ya, no way!",
"Ground control to Major Tom...",
"Alors on danse",
"And all that I can see, is just a yellow lemon tree.",
"Got a one-way ticket to the blues",
"Is this the real life, is this just fantasy",
"What's in your head, in your head?",
"We're all living in America, America, America.",
"I'm still standing, better than I ever did",
"Here comes the sun, bringing you love and shining on everyone",
"Two trailer park girls go round the outside",
"With the lights out, it's less dangerous",
"Here we go back, this is the moment, tonight is the night",
"Now you're just somebody that I used to know...",
"Black bird, black moon, black sky",
"Some legends are told, some turn to dust or to gold",
"Your brain gets smart, but your head gets dumb.",
"Save your mercy for someone who needs it more",
"You're gonna hear my voice when I shout it out loud",
"Ding ding pch n daa, bam-ba-ba-re-bam baram bom bom baba-bam-bam-bommm",
"Súbeme la radio que esta es mi canción",
"I'm beggin', beggin' you",
//
"Join the discord server!",
"Thanks ThatOneCalculator!",
"The AUR packages always work, except for the times they don't.",
"Funny animation compositor woo"
};

View File

@@ -20,12 +20,11 @@ void addSurfaceGlobalOffset(SSurfaceTreeNode* node, int* lx, int* ly) {
}
}
SSurfaceTreeNode* createTree(wlr_surface* pSurface) {
SubsurfaceTree::surfaceTreeNodes.push_back(SSurfaceTreeNode());
const auto PNODE = &SubsurfaceTree::surfaceTreeNodes.back();
SSurfaceTreeNode* createTree(wlr_surface* pSurface, CWindow* pWindow) {
const auto PNODE = &SubsurfaceTree::surfaceTreeNodes.emplace_back();
PNODE->pSurface = pSurface;
PNODE->pWindowOwner = pWindow;
PNODE->hyprListener_newSubsurface.initCallback(&pSurface->events.new_subsurface, &Events::listener_newSubsurfaceNode, PNODE, "SurfaceTreeNode");
PNODE->hyprListener_commit.initCallback(&pSurface->events.commit, &Events::listener_commitSubsurface, PNODE, "SurfaceTreeNode");
@@ -42,16 +41,21 @@ SSurfaceTreeNode* createTree(wlr_surface* pSurface) {
return PNODE;
}
SSurfaceTreeNode* createSubsurfaceNode(SSurfaceTreeNode* pParent, SSubsurface* pSubsurface, wlr_surface* surface) {
const auto PNODE = createTree(surface);
SSurfaceTreeNode* createSubsurfaceNode(SSurfaceTreeNode* pParent, SSubsurface* pSubsurface, wlr_surface* surface, CWindow* pWindow) {
const auto PNODE = createTree(surface, pWindow);
PNODE->pParent = pParent;
PNODE->pSubsurface = pSubsurface;
Debug::log(LOG, "Creating a subsurface Node! (pWindow: %x)", pWindow);
return PNODE;
}
SSurfaceTreeNode* SubsurfaceTree::createTreeRoot(wlr_surface* pSurface, applyGlobalOffsetFn fn, void* data) {
const auto PNODE = createTree(pSurface);
SSurfaceTreeNode* SubsurfaceTree::createTreeRoot(wlr_surface* pSurface, applyGlobalOffsetFn fn, void* data, CWindow* pWindow) {
const auto PNODE = createTree(pSurface, pWindow);
Debug::log(LOG, "Creating a surfaceTree Root! (pWindow: %x)", pWindow);
PNODE->offsetfn = fn;
PNODE->globalOffsetData = data;
@@ -83,6 +87,28 @@ void SubsurfaceTree::destroySurfaceTree(SSurfaceTreeNode* pNode) {
pNode->hyprListener_destroy.removeCallback();
pNode->hyprListener_newSubsurface.removeCallback();
// damage
if (pNode->pSurface) {
wlr_box extents = {};
wlr_surface_get_extends(pNode->pSurface, &extents);
int lx = 0, ly = 0;
addSurfaceGlobalOffset(pNode, &lx, &ly);
extents.x += lx;
extents.y += ly;
g_pHyprRenderer->damageBox(&extents);
}
// remove references to this node
for (auto& tn : surfaceTreeNodes) {
for (auto& cs : tn.childSubsurfaces) {
if (cs.pChild == pNode)
cs.pChild = nullptr;
}
}
surfaceTreeNodes.remove(*pNode);
Debug::log(LOG, "SurfaceTree Node removed");
@@ -108,8 +134,7 @@ void Events::listener_newSubsurfaceNode(void* owner, void* data) {
const auto PSUBSURFACE = (wlr_subsurface*)data;
pNode->childSubsurfaces.push_back(SSubsurface());
const auto PNEWSUBSURFACE = &pNode->childSubsurfaces.back();
const auto PNEWSUBSURFACE = &pNode->childSubsurfaces.emplace_back();
Debug::log(LOG, "Added a new subsurface %x", PSUBSURFACE);
@@ -120,6 +145,11 @@ void Events::listener_newSubsurfaceNode(void* owner, void* data) {
PNEWSUBSURFACE->hyprListener_unmap.initCallback(&PSUBSURFACE->events.unmap, &Events::listener_unmapSubsurface, PNEWSUBSURFACE, "Subsurface");
PNEWSUBSURFACE->hyprListener_destroy.initCallback(&PSUBSURFACE->events.destroy, &Events::listener_destroySubsurface, PNEWSUBSURFACE, "Subsurface");
PNEWSUBSURFACE->pWindowOwner = pNode->pWindowOwner;
if (PSUBSURFACE->mapped)
listener_mapSubsurface(PNEWSUBSURFACE, nullptr);
wlr_subsurface* existingWlrSubsurface;
wl_list_for_each(existingWlrSubsurface, &PSUBSURFACE->surface->current.subsurfaces_below, current.link) {
listener_newSubsurfaceNode(pNode, existingWlrSubsurface);
@@ -132,9 +162,12 @@ void Events::listener_newSubsurfaceNode(void* owner, void* data) {
void Events::listener_mapSubsurface(void* owner, void* data) {
SSubsurface* subsurface = (SSubsurface*)owner;
if (subsurface->pChild)
return;
Debug::log(LOG, "Subsurface %x mapped", subsurface->pSubsurface);
subsurface->pChild = createSubsurfaceNode(subsurface->pParent, subsurface, subsurface->pSubsurface->surface);
subsurface->pChild = createSubsurfaceNode(subsurface->pParent, subsurface, subsurface->pSubsurface->surface, subsurface->pWindowOwner);
}
void Events::listener_unmapSubsurface(void* owner, void* data) {
@@ -148,32 +181,54 @@ void Events::listener_unmapSubsurface(void* owner, void* data) {
int lx = 0, ly = 0;
addSurfaceGlobalOffset(PNODE, &lx, &ly);
wlr_box extents = {0};
wlr_surface_get_extends(PNODE->pSurface, &extents);
wlr_box extents = {lx, ly, 0, 0};
if (PNODE->pSurface) {
extents.width = PNODE->pSurface->current.width;
extents.height = PNODE->pSurface->current.height;
extents.x += lx;
extents.y += ly;
g_pHyprRenderer->damageBox(&extents);
}
SubsurfaceTree::destroySurfaceTree(subsurface->pChild);
subsurface->pChild = nullptr;
//SubsurfaceTree::destroySurfaceTree(subsurface->pChild);
//subsurface->pChild = nullptr;
}
}
void Events::listener_commitSubsurface(void* owner, void* data) {
SSurfaceTreeNode* pNode = (SSurfaceTreeNode*)owner;
// no damaging if it's not visible
if (!g_pHyprRenderer->shouldRenderWindow(pNode->pWindowOwner)) {
static auto *const PLOGDAMAGE = &g_pConfigManager->getConfigValuePtr("debug:log_damage")->intValue;
if (*PLOGDAMAGE)
Debug::log(LOG, "Refusing to commit damage from %x because it's invisible.", pNode->pWindowOwner);
return;
}
int lx = 0, ly = 0;
addSurfaceGlobalOffset(pNode, &lx, &ly);
// I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox)
// What this does is that basically, if the pNode is a child of some other node, on commit,
// it will also damage (check & damage if needed) all its siblings.
if (pNode->pParent) for (auto& cs : pNode->pParent->childSubsurfaces) {
const auto NODECOORDS = pNode->pSubsurface ? Vector2D(pNode->pSubsurface->pSubsurface->current.x, pNode->pSubsurface->pSubsurface->current.y) : Vector2D();
if (&cs != pNode->pSubsurface && cs.pSubsurface) {
g_pHyprRenderer->damageSurface(cs.pSubsurface->surface, lx - NODECOORDS.x + cs.pSubsurface->current.x, ly - NODECOORDS.y + cs.pSubsurface->current.y);
}
}
g_pHyprRenderer->damageSurface(pNode->pSurface, lx, ly);
}
void Events::listener_destroySubsurface(void* owner, void* data) {
SSubsurface* subsurface = (SSubsurface*)owner;
if (subsurface->pChild)
listener_destroySubsurfaceNode(subsurface->pChild, nullptr);
if (subsurface->pChild) {
SubsurfaceTree::destroySurfaceTree(subsurface->pChild);
}
Debug::log(LOG, "Subsurface %x destroyed", subsurface);

View File

@@ -4,6 +4,7 @@
#include <list>
struct SSubsurface;
class CWindow;
typedef void (*applyGlobalOffsetFn)(void *, int *, int *);
@@ -21,6 +22,7 @@ struct SSurfaceTreeNode {
applyGlobalOffsetFn offsetfn;
void *globalOffsetData;
CWindow* pWindowOwner = nullptr;
bool operator==(const SSurfaceTreeNode& rhs) {
return pSurface == rhs.pSurface;
@@ -37,13 +39,15 @@ struct SSubsurface {
DYNLISTENER(unmap);
DYNLISTENER(destroy);
CWindow* pWindowOwner = nullptr;
bool operator==(const SSubsurface& rhs) {
return pSubsurface == rhs.pSubsurface;
}
};
namespace SubsurfaceTree {
SSurfaceTreeNode* createTreeRoot(wlr_surface*, applyGlobalOffsetFn, void*);
SSurfaceTreeNode* createTreeRoot(wlr_surface*, applyGlobalOffsetFn, void*, CWindow* pWindow = nullptr);
void destroySurfaceTree(SSurfaceTreeNode*);
inline std::list<SSurfaceTreeNode> surfaceTreeNodes;

17
src/helpers/Timer.cpp Normal file
View File

@@ -0,0 +1,17 @@
#include "Timer.hpp"
void CTimer::reset() {
m_tpLastReset = std::chrono::system_clock::now();
}
std::chrono::system_clock::duration CTimer::getDuration() {
return std::chrono::system_clock::now() - m_tpLastReset;
}
int CTimer::getMillis() {
return std::chrono::duration_cast<std::chrono::milliseconds>(getDuration()).count();
}
float CTimer::getSeconds() {
return std::chrono::duration_cast<std::chrono::milliseconds>(getDuration()).count() / 1000.f;
}

15
src/helpers/Timer.hpp Normal file
View File

@@ -0,0 +1,15 @@
#pragma once
#include "../defines.hpp"
class CTimer {
public:
void reset();
float getSeconds();
int getMillis();
private:
std::chrono::system_clock::time_point m_tpLastReset;
std::chrono::system_clock::duration getDuration();
};

View File

@@ -1,4 +1,5 @@
#include "Vector2D.hpp"
#include <algorithm>
Vector2D::Vector2D(double xx, double yy) {
x = xx;
@@ -20,4 +21,11 @@ double Vector2D::normalize() {
Vector2D Vector2D::floor() {
return Vector2D((int)x, (int)y);
}
Vector2D Vector2D::clamp(const Vector2D& min, const Vector2D& max) {
return Vector2D(
std::clamp(this->x, min.x, max.x == 0 ? INFINITY : max.x),
std::clamp(this->y, min.y, max.y == 0 ? INFINITY : max.y)
);
}

View File

@@ -35,5 +35,11 @@ class Vector2D {
return a.x != x || a.y != y;
}
Vector2D operator*(const Vector2D& a) const {
return Vector2D(this->x * a.x, this->y * a.y);
}
Vector2D clamp(const Vector2D& min, const Vector2D& max = Vector2D());
Vector2D floor();
};

View File

@@ -2,6 +2,6 @@
#include "../config/ConfigManager.hpp"
SLayerSurface::SLayerSurface() {
alpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:fadein_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:fadein")->intValue, &g_pConfigManager->getConfigValuePtr("animations:fadein_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
alpha.create(AVARTYPE_FLOAT, g_pConfigManager->getAnimationPropertyConfig("fadeIn"), nullptr, AVARDAMAGE_ENTIRE);
alpha.m_pLayer = this;
}

View File

@@ -2,7 +2,7 @@
#include "../events/Events.hpp"
#include "../defines.hpp"
#include "../../wlr-layer-shell-unstable-v1-protocol.h"
#include "wlr-layer-shell-unstable-v1-protocol.h"
#include "../Window.hpp"
#include "SubsurfaceTree.hpp"
#include "AnimatedVariable.hpp"
@@ -19,15 +19,22 @@ struct SLayerSurface {
DYNLISTENER(commitLayerSurface);
DYNLISTENER(newPopup);
wlr_box geometry;
wlr_box geometry = {0,0,0,0};
Vector2D position;
zwlr_layer_shell_v1_layer layer;
bool mapped = false;
int monitorID = -1;
std::string szNamespace = "";
CAnimatedVariable alpha;
bool fadingOut = false;
bool readyToDelete = false;
bool noProcess = false;
bool forceBlur = false;
// For the list lookup
bool operator==(const SLayerSurface& rhs) {
@@ -60,6 +67,29 @@ struct SRenderData {
// for custom round values
int rounding = -1; // -1 means not set
// for blurring
bool blur = false;
// only for windows, not popups
bool squishOversized = true;
// for calculating UV
CWindow* pWindow = nullptr;
};
struct SExtensionFindingData {
Vector2D origin;
Vector2D vec;
wlr_surface** found;
};
struct SStringRuleNames {
std::string layout = "";
std::string model = "";
std::string variant = "";
std::string options = "";
std::string rules = "";
};
struct SKeyboard {
@@ -67,8 +97,22 @@ struct SKeyboard {
DYNLISTENER(keyboardMod);
DYNLISTENER(keyboardKey);
DYNLISTENER(keyboardKeymap);
DYNLISTENER(keyboardDestroy);
bool isVirtual = false;
bool active = false;
xkb_layout_index_t activeLayout = 0;
std::string name = "";
std::string xkbFilePath = "";
SStringRuleNames currentRules;
int repeatRate = 0;
int repeatDelay = 0;
int numlockOn = -1;
// For the list lookup
bool operator==(const SKeyboard& rhs) {
return keyboard == rhs.keyboard;
@@ -83,6 +127,10 @@ struct SMouse {
pixman_region32_t confinedTo;
std::string name = "";
bool virt = false;
DYNLISTENER(commitConstraint);
DYNLISTENER(destroyMouse);
@@ -103,18 +151,19 @@ struct SConstraint {
}
};
struct SMonitor;
class CMonitor;
struct SXDGPopup {
CWindow* parentWindow = nullptr;
SXDGPopup* parentPopup = nullptr;
wlr_xdg_popup* popup = nullptr;
SMonitor* monitor = nullptr;
CMonitor* monitor = nullptr;
DYNLISTENER(newPopupFromPopupXDG);
DYNLISTENER(destroyPopupXDG);
DYNLISTENER(mapPopupXDG);
DYNLISTENER(unmapPopupXDG);
DYNLISTENER(commitPopupXDG);
double lx;
double ly;
@@ -144,11 +193,142 @@ struct SDrag {
bool iconMapped = false;
wlr_drag_icon* dragIcon = nullptr;
Vector2D pos;
DYNLISTENER(destroyIcon);
DYNLISTENER(mapIcon);
DYNLISTENER(unmapIcon);
DYNLISTENER(commitIcon);
};
};
struct STablet {
DYNLISTENER(Tip);
DYNLISTENER(Axis);
DYNLISTENER(Button);
DYNLISTENER(Proximity);
DYNLISTENER(Destroy);
wlr_tablet* wlrTablet = nullptr;
wlr_tablet_v2_tablet* wlrTabletV2 = nullptr;
wlr_input_device* wlrDevice = nullptr;
std::string name = "";
bool operator==(const STablet& b) {
return wlrDevice == b.wlrDevice;
}
};
struct STabletTool {
wlr_tablet_tool* wlrTabletTool = nullptr;
wlr_tablet_v2_tablet_tool* wlrTabletToolV2 = nullptr;
wlr_tablet_v2_tablet* wlrTabletOwnerV2 = nullptr;
wlr_surface* pSurface = nullptr;
double tiltX = 0;
double tiltY = 0;
bool active = true;
std::string name = "";
DYNLISTENER(TabletToolDestroy);
DYNLISTENER(TabletToolSetCursor);
bool operator==(const STabletTool& b) {
return wlrTabletTool == b.wlrTabletTool;
}
};
struct STabletPad {
wlr_tablet_v2_tablet_pad* wlrTabletPadV2 = nullptr;
STablet* pTabletParent = nullptr;
std::string name = "";
DYNLISTENER(Attach);
DYNLISTENER(Button);
DYNLISTENER(Strip);
DYNLISTENER(Ring);
DYNLISTENER(Destroy);
bool operator==(const STabletPad& b) {
return wlrTabletPadV2 == b.wlrTabletPadV2;
}
};
struct SIdleInhibitor {
wlr_idle_inhibitor_v1* pWlrInhibitor = nullptr;
CWindow* pWindow = nullptr;
DYNLISTENER(Destroy);
bool operator==(const SIdleInhibitor& b) {
return pWlrInhibitor == b.pWlrInhibitor;
}
};
struct SSwipeGesture {
CWorkspace* pWorkspaceBegin = nullptr;
double delta = 0;
float avgSpeed = 0;
int speedPoints = 0;
CMonitor* pMonitor = nullptr;
};
struct STextInput {
wlr_text_input_v3* pWlrInput = nullptr;
wlr_surface* pPendingSurface = nullptr;
DYNLISTENER(textInputEnable);
DYNLISTENER(textInputDisable);
DYNLISTENER(textInputCommit);
DYNLISTENER(textInputDestroy);
DYNLISTENER(pendingSurfaceDestroy);
};
struct SIMEKbGrab {
wlr_input_method_keyboard_grab_v2* pWlrKbGrab = nullptr;
wlr_keyboard* pKeyboard = nullptr;
DYNLISTENER(grabDestroy);
};
struct SIMEPopup {
wlr_input_popup_surface_v2* pSurface = nullptr;
int x, y;
int realX, realY;
bool visible;
Vector2D lastSize;
DYNLISTENER(mapPopup);
DYNLISTENER(unmapPopup);
DYNLISTENER(destroyPopup);
DYNLISTENER(commitPopup);
DYNLISTENER(focusedSurfaceUnmap);
bool operator==(const SIMEPopup& other) {
return pSurface == other.pSurface;
}
};
struct STouchDevice {
wlr_input_device* pWlrDevice = nullptr;
DYNLISTENER(destroy);
bool operator==(const STouchDevice& other) {
return pWlrDevice == other.pWlrDevice;
}
};

View File

@@ -4,9 +4,9 @@
#include "../debug/Log.hpp"
void handleWrapped(wl_listener* listener, void* data) {
CHyprWLListener* pListener = wl_container_of(listener, pListener, m_sListener);
CHyprWLListener::SWrapper* pWrap = wl_container_of(listener, pWrap, m_sListener);
pListener->emit(data);
pWrap->m_pSelf->emit(data);
}
CHyprWLListener::CHyprWLListener(wl_signal* pSignal, std::function<void(void*, void*)> callback, void* pOwner) {
@@ -14,7 +14,9 @@ CHyprWLListener::CHyprWLListener(wl_signal* pSignal, std::function<void(void*, v
}
CHyprWLListener::CHyprWLListener() {
; //
m_swWrapper.m_pSelf = this;
m_swWrapper.m_sListener.notify = &handleWrapped;
wl_list_init(&m_swWrapper.m_sListener.link);
}
CHyprWLListener::~CHyprWLListener() {
@@ -22,31 +24,28 @@ CHyprWLListener::~CHyprWLListener() {
}
void CHyprWLListener::removeCallback() {
if (m_bIsConnected) {
Debug::log(LOG, "Callback %x -> %x, %s removed.", m_pCallback, m_pOwner, m_szAuthor.c_str());
wl_list_remove(&m_sListener.link);
if (isConnected()) {
Debug::log(LOG, "Callback %x -> %x, %s removed.", &m_pCallback, &m_pOwner, m_szAuthor.c_str());
wl_list_remove(&m_swWrapper.m_sListener.link);
wl_list_init(&m_swWrapper.m_sListener.link);
}
m_bIsConnected = false;
}
bool CHyprWLListener::isConnected() {
return m_bIsConnected;
return !wl_list_empty(&m_swWrapper.m_sListener.link);
}
void CHyprWLListener::initCallback(wl_signal* pSignal, std::function<void(void*, void*)> callback, void* pOwner, std::string author) {
if (m_bIsConnected)
removeCallback();
if (isConnected()) {
Debug::log(ERR, "Tried to connect a listener twice?!");
return;
}
m_pOwner = pOwner;
m_pCallback = callback;
m_szAuthor = author;
m_sListener.notify = &handleWrapped;
m_bIsConnected = true;
addWLSignal(pSignal, &m_sListener, pOwner, m_szAuthor);
addWLSignal(pSignal, &m_swWrapper.m_sListener, pOwner, m_szAuthor);
}
void CHyprWLListener::emit(void* data) {

View File

@@ -9,18 +9,26 @@ public:
CHyprWLListener();
~CHyprWLListener();
CHyprWLListener(const CHyprWLListener&) = delete;
CHyprWLListener(CHyprWLListener&&) = delete;
CHyprWLListener& operator=(const CHyprWLListener&) = delete;
CHyprWLListener& operator=(CHyprWLListener&&) = delete;
void initCallback(wl_signal*, std::function<void(void*, void*)>, void* owner, std::string author = "");
void removeCallback();
bool isConnected();
wl_listener m_sListener;
struct SWrapper {
wl_listener m_sListener;
CHyprWLListener* m_pSelf;
};
void emit(void*);
private:
bool m_bIsConnected = false;
SWrapper m_swWrapper;
void* m_pOwner = nullptr;

View File

@@ -1,7 +1,7 @@
#include "Workspace.hpp"
#include "../Compositor.hpp"
CWorkspace::CWorkspace(int monitorID) {
CWorkspace::CWorkspace(int monitorID, std::string name, bool special) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
if (!PMONITOR) {
@@ -10,36 +10,46 @@ CWorkspace::CWorkspace(int monitorID) {
}
m_iMonitorID = monitorID;
m_pWlrHandle = wlr_ext_workspace_handle_v1_create(PMONITOR->pWLRWorkspaceGroupHandle);
m_szName = name;
m_bIsSpecialWorkspace = special;
// set geometry here cuz we can
wl_array_init(&m_wlrCoordinateArr);
*reinterpret_cast<int*>(wl_array_add(&m_wlrCoordinateArr, sizeof(int))) = (int)PMONITOR->vecPosition.x;
*reinterpret_cast<int*>(wl_array_add(&m_wlrCoordinateArr, sizeof(int))) = (int)PMONITOR->vecPosition.y;
wlr_ext_workspace_handle_v1_set_coordinates(m_pWlrHandle, &m_wlrCoordinateArr);
wlr_ext_workspace_handle_v1_set_hidden(m_pWlrHandle, false);
wlr_ext_workspace_handle_v1_set_urgent(m_pWlrHandle, false);
if (!special) {
m_pWlrHandle = wlr_ext_workspace_handle_v1_create(PMONITOR->pWLRWorkspaceGroupHandle);
// set geometry here cuz we can
wl_array_init(&m_wlrCoordinateArr);
*reinterpret_cast<int*>(wl_array_add(&m_wlrCoordinateArr, sizeof(int))) = (int)PMONITOR->vecPosition.x;
*reinterpret_cast<int*>(wl_array_add(&m_wlrCoordinateArr, sizeof(int))) = (int)PMONITOR->vecPosition.y;
wlr_ext_workspace_handle_v1_set_coordinates(m_pWlrHandle, &m_wlrCoordinateArr);
wlr_ext_workspace_handle_v1_set_hidden(m_pWlrHandle, false);
wlr_ext_workspace_handle_v1_set_urgent(m_pWlrHandle, false);
}
m_vRenderOffset.m_pWorkspace = this;
m_vRenderOffset.create(AVARTYPE_VECTOR, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
m_vRenderOffset.create(AVARTYPE_VECTOR, special ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspace") : g_pConfigManager->getAnimationPropertyConfig("workspaces"), nullptr, AVARDAMAGE_ENTIRE);
m_fAlpha.m_pWorkspace = this;
m_fAlpha.create(AVARTYPE_FLOAT, &g_pConfigManager->getConfigValuePtr("animations:workspaces_speed")->floatValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces")->intValue, &g_pConfigManager->getConfigValuePtr("animations:workspaces_curve")->strValue, nullptr, AVARDAMAGE_ENTIRE);
m_fAlpha.create(AVARTYPE_FLOAT, special ? g_pConfigManager->getAnimationPropertyConfig("specialWorkspace") : g_pConfigManager->getAnimationPropertyConfig("workspaces"), nullptr, AVARDAMAGE_ENTIRE);
m_fAlpha.setValueAndWarp(255.f);
g_pEventManager->postEvent({"createworkspace", m_szName}, true);
}
CWorkspace::~CWorkspace() {
m_vRenderOffset.unregister();
Debug::log(LOG, "Destroying workspace ID %d", m_iID);
if (m_pWlrHandle) {
wlr_ext_workspace_handle_v1_set_active(m_pWlrHandle, false);
wlr_ext_workspace_handle_v1_destroy(m_pWlrHandle);
m_pWlrHandle = nullptr;
}
g_pEventManager->postEvent({"destroyworkspace", m_szName}, true);
}
void CWorkspace::startAnim(bool in, bool left) {
const auto ANIMSTYLE = g_pConfigManager->getString("animations:workspaces_style");
void CWorkspace::startAnim(bool in, bool left, bool instant) {
const auto ANIMSTYLE = m_fAlpha.m_pConfig->pValues->internalStyle;
if (ANIMSTYLE == "fade") {
m_vRenderOffset.setValueAndWarp(Vector2D(0, 0)); // fix a bug, if switching from slide -> fade.
@@ -51,6 +61,18 @@ void CWorkspace::startAnim(bool in, bool left) {
m_fAlpha.setValueAndWarp(255.f);
m_fAlpha = 0.f;
}
} else if (ANIMSTYLE == "slidevert") {
// fallback is slide
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
m_fAlpha.setValueAndWarp(255.f); // fix a bug, if switching from fade -> slide.
if (in) {
m_vRenderOffset.setValueAndWarp(Vector2D(0, left ? PMONITOR->vecSize.y : -PMONITOR->vecSize.y));
m_vRenderOffset = Vector2D(0, 0);
} else {
m_vRenderOffset = Vector2D(0, left ? -PMONITOR->vecSize.y : PMONITOR->vecSize.y);
}
} else {
// fallback is slide
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
@@ -64,10 +86,53 @@ void CWorkspace::startAnim(bool in, bool left) {
m_vRenderOffset = Vector2D(left ? -PMONITOR->vecSize.x : PMONITOR->vecSize.x, 0);
}
}
if (instant) {
m_vRenderOffset.warp();
m_fAlpha.warp();
}
// check LS-es
if (in) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(m_iMonitorID);
for (auto& ls : PMONITOR->m_aLayerSurfaceLists[ZWLR_LAYER_SHELL_V1_LAYER_TOP]) {
if (!ls->fadingOut)
ls->alpha = m_bHasFullscreenWindow && m_efFullscreenMode == FULLSCREEN_FULL ? 0.f : 255.f;
}
}
}
void CWorkspace::setActive(bool on) {
if (m_pWlrHandle) {
wlr_ext_workspace_handle_v1_set_active(m_pWlrHandle, on);
}
}
}
void CWorkspace::moveToMonitor(const int& id) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(id);
if (!PMONITOR || m_bIsSpecialWorkspace)
return;
wlr_ext_workspace_handle_v1_set_active(m_pWlrHandle, false);
wlr_ext_workspace_handle_v1_destroy(m_pWlrHandle);
m_pWlrHandle = wlr_ext_workspace_handle_v1_create(PMONITOR->pWLRWorkspaceGroupHandle);
// set geometry here cuz we can
wl_array_init(&m_wlrCoordinateArr);
*reinterpret_cast<int*>(wl_array_add(&m_wlrCoordinateArr, sizeof(int))) = (int)PMONITOR->vecPosition.x;
*reinterpret_cast<int*>(wl_array_add(&m_wlrCoordinateArr, sizeof(int))) = (int)PMONITOR->vecPosition.y;
wlr_ext_workspace_handle_v1_set_coordinates(m_pWlrHandle, &m_wlrCoordinateArr);
wlr_ext_workspace_handle_v1_set_hidden(m_pWlrHandle, false);
wlr_ext_workspace_handle_v1_set_urgent(m_pWlrHandle, false);
wlr_ext_workspace_handle_v1_set_name(m_pWlrHandle, m_szName.c_str());
}
CWindow* CWorkspace::getLastFocusedWindow() {
if (!g_pCompositor->windowValidMapped(m_pLastFocusedWindow) || m_pLastFocusedWindow->m_iWorkspaceID != m_iID)
return nullptr;
return m_pLastFocusedWindow;
}

View File

@@ -8,9 +8,11 @@ enum eFullscreenMode : uint8_t {
FULLSCREEN_MAXIMIZED
};
class CWindow;
class CWorkspace {
public:
CWorkspace(int monitorID);
CWorkspace(int monitorID, std::string name, bool special = false);
~CWorkspace();
// Workspaces ID-based have IDs > 0
@@ -18,6 +20,9 @@ public:
int m_iID = -1;
std::string m_szName = "";
uint64_t m_iMonitorID = -1;
// Previous workspace ID is stored during a workspace change, allowing travel
// to the previous workspace.
int m_iPrevWorkspaceID = -1;
bool m_bHasFullscreenWindow = false;
eFullscreenMode m_efFullscreenMode = FULLSCREEN_FULL;
@@ -28,11 +33,22 @@ public:
// for animations
CAnimatedVariable m_vRenderOffset;
CAnimatedVariable m_fAlpha;
bool m_bForceRendering = false;
// "scratchpad"
bool m_bIsSpecialWorkspace = false;
// last window
CWindow* m_pLastFocusedWindow = nullptr;
// user-set
bool m_bDefaultFloating = false;
bool m_bDefaultPseudo = false;
void startAnim(bool in, bool left);
void startAnim(bool in, bool left, bool instant = false);
void setActive(bool on);
void moveToMonitor(const int&);
CWindow* getLastFocusedWindow();
};

View File

@@ -12,9 +12,11 @@ void CHyprError::createQueued() {
m_tTexture.destroyTexture();
}
const auto PMONITOR = &g_pCompositor->m_lMonitors.front();
const auto PMONITOR = g_pCompositor->m_vMonitors.front().get();
const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, PMONITOR->vecSize.x, PMONITOR->vecSize.y);
const auto FONTSIZE = std::clamp((int)(10.f * (PMONITOR->vecPixelSize.x / 1920.f)), 8, 40);
const auto CAIROSURFACE = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y);
const auto CAIRO = cairo_create(CAIROSURFACE);
@@ -27,12 +29,12 @@ void CHyprError::createQueued() {
const auto LINECOUNT = 1 + std::count(m_szQueued.begin(), m_szQueued.end(), '\n');
cairo_set_source_rgba(CAIRO, m_cQueued.r / 255.f, m_cQueued.g / 255.f, m_cQueued.b / 255.f, m_cQueued.a / 255.f);
cairo_rectangle(CAIRO, 0, 0, PMONITOR->vecSize.x, 10 * LINECOUNT);
cairo_rectangle(CAIRO, 0, 0, PMONITOR->vecPixelSize.x, (FONTSIZE + 2 * (FONTSIZE / 10.f)) * LINECOUNT);
// outline
cairo_rectangle(CAIRO, 0, 0, 1, PMONITOR->vecSize.y); // left
cairo_rectangle(CAIRO, PMONITOR->vecSize.x - 1, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y); // right
cairo_rectangle(CAIRO, 0, PMONITOR->vecSize.y - 1, PMONITOR->vecSize.x, PMONITOR->vecSize.y); // bottom
cairo_rectangle(CAIRO, 0, 0, 1, PMONITOR->vecPixelSize.y); // left
cairo_rectangle(CAIRO, PMONITOR->vecPixelSize.x - 1, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); // right
cairo_rectangle(CAIRO, 0, PMONITOR->vecPixelSize.y - 1, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y); // bottom
cairo_fill(CAIRO);
@@ -40,10 +42,10 @@ void CHyprError::createQueued() {
const CColor textColor = m_cQueued.r * m_cQueued.g * m_cQueued.b < 0.5f ? CColor(255, 255, 255, 255) : CColor(0, 0, 0, 255);
cairo_select_font_face(CAIRO, "Noto Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size(CAIRO, 8);
cairo_set_font_size(CAIRO, FONTSIZE);
cairo_set_source_rgba(CAIRO, textColor.r / 255.f, textColor.g / 255.f, textColor.b / 255.f, textColor.a / 255.f);
float yoffset = 8;
float yoffset = FONTSIZE;
while(m_szQueued != "") {
std::string current = m_szQueued.substr(0, m_szQueued.find('\n'));
if (const auto NEWLPOS = m_szQueued.find('\n'); NEWLPOS != std::string::npos)
@@ -52,9 +54,9 @@ void CHyprError::createQueued() {
m_szQueued = "";
cairo_move_to(CAIRO, 0, yoffset);
cairo_show_text(CAIRO, current.c_str());
yoffset += 9;
yoffset += FONTSIZE + (FONTSIZE / 10.f);
}
cairo_surface_flush(CAIROSURFACE);
@@ -64,13 +66,13 @@ void CHyprError::createQueued() {
glBindTexture(GL_TEXTURE_2D, m_tTexture.m_iTexID);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
#ifndef GLES2
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_R, GL_BLUE);
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_SWIZZLE_B, GL_RED);
#endif
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecSize.x, PMONITOR->vecSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
// delete cairo
cairo_destroy(CAIRO);
@@ -95,16 +97,16 @@ void CHyprError::draw() {
m_tTexture.destroyTexture();
m_bIsCreated = false;
m_szQueued = "";
g_pHyprRenderer->damageMonitor(&g_pCompositor->m_lMonitors.front());
g_pHyprRenderer->damageMonitor(g_pCompositor->m_vMonitors.front().get());
return;
}
const auto PMONITOR = &g_pCompositor->m_lMonitors.front();
const auto PMONITOR = g_pCompositor->m_vMonitors.front().get();
if (g_pHyprOpenGL->m_RenderData.pMonitor != PMONITOR)
return; // wrong mon
wlr_box windowBox = {0, 0, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
wlr_box windowBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
g_pHyprOpenGL->renderTexture(m_tTexture, &windowBox, 255.f, 0);
}
@@ -112,4 +114,4 @@ void CHyprError::draw() {
void CHyprError::destroy() {
if (m_bIsCreated)
m_bQueuedDestroy = true;
}
}

View File

@@ -32,16 +32,20 @@
#define class _class
#define namespace _namespace
#define static
#define delete delete_
extern "C" {
#include <wlr/backend.h>
#include <wlr/backend/libinput.h>
#include <wlr/backend/drm.h>
#include <wlr/render/allocator.h>
#include <wlr/render/wlr_renderer.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_cursor.h>
#include <wlr/types/wlr_data_control_v1.h>
#include <wlr/types/wlr_data_device.h>
#include <wlr/types/wlr_drm_lease_v1.h>
#include <wlr/types/wlr_drm.h>
#include <wlr/types/wlr_export_dmabuf_v1.h>
#include <wlr/types/wlr_linux_dmabuf_v1.h>
#include <wlr/types/wlr_gamma_control_v1.h>
@@ -74,9 +78,13 @@ extern "C" {
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
#include <wlr/types/wlr_virtual_pointer_v1.h>
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
#include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/util/log.h>
#include <wlr/xwayland.h>
#include <wlr/util/region.h>
#include <wlr/types/wlr_tablet_pad.h>
#include <wlr/types/wlr_tablet_tool.h>
#include <wlr/types/wlr_tablet_v2.h>
#include <xkbcommon/xkbcommon.h>
#include <X11/Xproto.h>
#include <wlr/render/egl.h>
@@ -84,8 +92,18 @@ extern "C" {
#include <wlr/render/wlr_texture.h>
#include <wlr/types/wlr_pointer_constraints_v1.h>
#include <wlr/types/wlr_relative_pointer_v1.h>
#include <wlr/interfaces/wlr_keyboard.h>
#include <wlr/types/wlr_xdg_foreign_registry.h>
#include <wlr/types/wlr_xdg_foreign_v1.h>
#include <wlr/types/wlr_xdg_foreign_v2.h>
#include <wlr/types/wlr_pointer_gestures_v1.h>
#include <wlr/types/wlr_output_power_management_v1.h>
#include <wlr/types/wlr_input_method_v2.h>
#include <wlr/types/wlr_text_input_v3.h>
#include <wlr/types/wlr_touch.h>
}
#undef delete
#undef class
#undef namespace
#undef static
@@ -109,4 +127,7 @@ extern "C" {
#include "helpers/Vector2D.hpp"
#include "../ext-workspace-unstable-v1-protocol.h"
#include "ext-workspace-unstable-v1-protocol.h"
#include <algorithm>
#include <utility>

File diff suppressed because it is too large Load Diff

View File

@@ -18,10 +18,9 @@ struct SDwindleNodeData {
bool splitTop = false; // for preserve_split
bool isGroup = false;
int groupMemberActive = 0;
std::deque<SDwindleNodeData*> groupMembers;
SDwindleNodeData* pGroupParent = nullptr;
bool groupHead = false;
SDwindleNodeData* pNextGroupMember = nullptr;
SDwindleNodeData* pPreviousGroupMember = nullptr;
Vector2D position;
Vector2D size;
@@ -30,51 +29,53 @@ struct SDwindleNodeData {
float splitRatio = 1.f;
bool valid = true;
// For list lookup
bool operator==(const SDwindleNodeData& rhs) {
return pWindow == rhs.pWindow && workspaceID == rhs.workspaceID && position == rhs.position && size == rhs.size && pParent == rhs.pParent && children[0] == rhs.children[0] && children[1] == rhs.children[1];
}
void recalcSizePosRecursive();
void recalcSizePosRecursive(bool force = false);
void getAllChildrenRecursive(std::deque<SDwindleNodeData*>*);
bool isGroupMember();
SDwindleNodeData* getGroupHead();
SDwindleNodeData* getGroupVisible();
int getGroupMemberCount();
void setGroupFocusedNode(SDwindleNodeData*);
CHyprDwindleLayout* layout = nullptr;
};
class CHyprDwindleLayout : public IHyprLayout {
public:
virtual void onWindowCreated(CWindow*);
virtual void onWindowRemoved(CWindow*);
virtual void onWindowCreatedTiling(CWindow*);
virtual void onWindowRemovedTiling(CWindow*);
virtual bool isWindowTiled(CWindow*);
virtual void recalculateMonitor(const int&);
virtual void recalculateWindow(CWindow*);
virtual void changeWindowFloatingMode(CWindow*);
virtual void onBeginDragWindow();
virtual void onEndDragWindow();
virtual void onMouseMove(const Vector2D&);
virtual void onWindowCreatedFloating(CWindow*);
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode);
virtual void resizeActiveWindow(const Vector2D&, CWindow* pWindow = nullptr);
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool);
virtual std::any layoutMessage(SLayoutMessageHeader, std::string);
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*);
virtual void switchWindows(CWindow*, CWindow*);
virtual void alterSplitRatioBy(CWindow*, float);
virtual std::string getLayoutName();
private:
virtual void onEnable();
virtual void onDisable();
private:
std::list<SDwindleNodeData> m_lDwindleNodesData;
Vector2D m_vBeginDragXY;
Vector2D m_vLastDragXY;
Vector2D m_vBeginDragPositionXY;
Vector2D m_vBeginDragSizeXY;
int getNodesOnWorkspace(const int&);
void applyNodeDataToWindow(SDwindleNodeData*);
void applyNodeDataToWindow(SDwindleNodeData*, bool force = false);
SDwindleNodeData* getNodeFromWindow(CWindow*);
SDwindleNodeData* getFirstNodeOnWorkspace(const int&);
SDwindleNodeData* getMasterNodeOnWorkspace(const int&);
void toggleWindowGroup(CWindow*);
void switchGroupWindow(CWindow*, bool forward);
void switchGroupWindow(CWindow*, bool forward, CWindow* to = nullptr);
void toggleSplit(CWindow*);
std::deque<CWindow*> getGroupMembers(CWindow*);

341
src/layout/IHyprLayout.cpp Normal file
View File

@@ -0,0 +1,341 @@
#include "IHyprLayout.hpp"
#include "../defines.hpp"
#include "../Compositor.hpp"
void IHyprLayout::onWindowCreated(CWindow* pWindow) {
if (pWindow->m_bIsFloating) {
onWindowCreatedFloating(pWindow);
} else {
wlr_box desiredGeometry = {0};
g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry);
if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
pWindow->m_vLastFloatingSize = PMONITOR->vecSize / 2.f;
} else {
pWindow->m_vLastFloatingSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
}
onWindowCreatedTiling(pWindow);
}
}
void IHyprLayout::onWindowRemoved(CWindow* pWindow) {
if (pWindow->m_bIsFloating) {
onWindowRemovedFloating(pWindow);
} else {
onWindowRemovedTiling(pWindow);
}
}
void IHyprLayout::onWindowRemovedFloating(CWindow* pWindow) {
return; // no-op
}
void IHyprLayout::onWindowCreatedFloating(CWindow* pWindow) {
wlr_box desiredGeometry = {0};
g_pXWaylandManager->getGeometryForWindow(pWindow, &desiredGeometry);
const auto PMONITOR = g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID);
if (!PMONITOR) {
Debug::log(ERR, "Window %x (%s) has an invalid monitor in onWindowCreatedFloating!!!", pWindow, pWindow->m_szTitle.c_str());
return;
}
if (desiredGeometry.width <= 5 || desiredGeometry.height <= 5) {
const auto PWINDOWSURFACE = g_pXWaylandManager->getWindowSurface(pWindow);
pWindow->m_vRealSize = Vector2D(PWINDOWSURFACE->current.width, PWINDOWSURFACE->current.height);
if ((desiredGeometry.width <= 1 || desiredGeometry.height <= 1) && pWindow->m_bIsX11 && pWindow->m_iX11Type == 2) { // XDG windows should be fine. TODO: check for weird atoms?
pWindow->m_bHidden = true;
return;
}
// reject any windows with size <= 5x5
if (pWindow->m_vRealSize.goalv().x <= 5 || pWindow->m_vRealSize.goalv().y <= 5) {
pWindow->m_vRealSize = PMONITOR->vecSize / 2.f;
}
pWindow->m_vRealPosition = Vector2D(PMONITOR->vecPosition.x + (PMONITOR->vecSize.x - pWindow->m_vRealSize.goalv().x) / 2.f, PMONITOR->vecPosition.y + (PMONITOR->vecSize.y - pWindow->m_vRealSize.goalv().y) / 2.f);
} else {
// we respect the size.
pWindow->m_vRealSize = Vector2D(desiredGeometry.width, desiredGeometry.height);
// check if it's on the correct monitor!
Vector2D middlePoint = Vector2D(desiredGeometry.x, desiredGeometry.y) + Vector2D(desiredGeometry.width, desiredGeometry.height) / 2.f;
// check if it's visible on any monitor (only for XDG)
bool visible = pWindow->m_bIsX11;
if (!pWindow->m_bIsX11) {
for (auto& m : g_pCompositor->m_vMonitors) {
if (VECINRECT(Vector2D(desiredGeometry.x, desiredGeometry.y), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x, m->vecPosition.y + m->vecPosition.y)
|| VECINRECT(Vector2D(desiredGeometry.x + desiredGeometry.width, desiredGeometry.y), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x, m->vecPosition.y + m->vecPosition.y)
|| VECINRECT(Vector2D(desiredGeometry.x, desiredGeometry.y + desiredGeometry.height), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x, m->vecPosition.y + m->vecPosition.y)
|| VECINRECT(Vector2D(desiredGeometry.x + desiredGeometry.width, desiredGeometry.y + desiredGeometry.height), m->vecPosition.x, m->vecPosition.y, m->vecPosition.x + m->vecSize.x, m->vecPosition.y + m->vecPosition.y)) {
visible = true;
break;
}
}
}
// TODO: detect a popup in a more consistent way.
if ((desiredGeometry.x == 0 && desiredGeometry.y == 0) || !visible) {
// if it's not, fall back to the center placement
pWindow->m_vRealPosition = PMONITOR->vecPosition + Vector2D((PMONITOR->vecSize.x - desiredGeometry.width) / 2.f, (PMONITOR->vecSize.y - desiredGeometry.height) / 2.f);
} else {
// if it is, we respect where it wants to put itself, but apply monitor offset if outside
// most of these are popups
if (const auto POPENMON = g_pCompositor->getMonitorFromVector(middlePoint); POPENMON->ID != PMONITOR->ID) {
pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y) - POPENMON->vecPosition + PMONITOR->vecPosition;
} else {
pWindow->m_vRealPosition = Vector2D(desiredGeometry.x, desiredGeometry.y);
}
}
}
if (pWindow->m_bX11DoesntWantBorders) {
pWindow->m_vRealPosition.setValue(pWindow->m_vRealPosition.goalv());
pWindow->m_vRealSize.setValue(pWindow->m_vRealSize.goalv());
}
if (pWindow->m_iX11Type != 2) {
g_pXWaylandManager->setWindowSize(pWindow, pWindow->m_vRealSize.goalv());
g_pCompositor->moveWindowToTop(pWindow);
}
}
void IHyprLayout::onBeginDragWindow() {
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow;
m_vBeginDragSizeXY = Vector2D();
// Window will be floating. Let's check if it's valid. It should be, but I don't like crashing.
if (!g_pCompositor->windowValidMapped(DRAGGINGWINDOW)) {
Debug::log(ERR, "Dragging attempted on an invalid window!");
return;
}
if (DRAGGINGWINDOW->m_bIsFullscreen) {
Debug::log(LOG, "Rejecting drag on a fullscreen window.");
return;
}
const auto PWORKSPACE = g_pCompositor->getWorkspaceByID(DRAGGINGWINDOW->m_iWorkspaceID);
if (PWORKSPACE->m_bHasFullscreenWindow) {
Debug::log(LOG, "Rejecting drag on a fullscreen workspace.");
return;
}
DRAGGINGWINDOW->m_vRealPosition.setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
DRAGGINGWINDOW->m_vRealSize.setConfig(g_pConfigManager->getAnimationPropertyConfig("windowsMove"));
DRAGGINGWINDOW->m_bDraggingTiled = false;
if (!DRAGGINGWINDOW->m_bIsFloating) {
if (g_pInputManager->dragMode == MBIND_MOVE) {
changeWindowFloatingMode(DRAGGINGWINDOW);
DRAGGINGWINDOW->m_bIsFloating = true;
DRAGGINGWINDOW->m_bDraggingTiled = true;
DRAGGINGWINDOW->m_vRealPosition = g_pInputManager->getMouseCoordsInternal() - DRAGGINGWINDOW->m_vRealSize.goalv() / 2.f;
}
}
m_vBeginDragXY = g_pInputManager->getMouseCoordsInternal();
m_vBeginDragPositionXY = DRAGGINGWINDOW->m_vRealPosition.goalv();
m_vBeginDragSizeXY = DRAGGINGWINDOW->m_vRealSize.goalv();
m_vLastDragXY = m_vBeginDragXY;
// get the grab corner
if (m_vBeginDragXY.x < m_vBeginDragPositionXY.x + m_vBeginDragSizeXY.x / 2.0) {
// left
if (m_vBeginDragXY.y < m_vBeginDragPositionXY.y + m_vBeginDragSizeXY.y / 2.0)
m_iGrabbedCorner = 0;
else
m_iGrabbedCorner = 4;
} else {
// right
if (m_vBeginDragXY.y < m_vBeginDragPositionXY.y + m_vBeginDragSizeXY.y / 2.0)
m_iGrabbedCorner = 1;
else
m_iGrabbedCorner = 3;
}
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
// shadow to ignore any bound to MAIN_MOD
g_pKeybindManager->shadowKeybinds();
}
void IHyprLayout::onEndDragWindow() {
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow;
if (!g_pCompositor->windowValidMapped(DRAGGINGWINDOW))
return;
if (DRAGGINGWINDOW->m_bDraggingTiled) {
DRAGGINGWINDOW->m_bIsFloating = false;
changeWindowFloatingMode(DRAGGINGWINDOW);
}
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
}
void IHyprLayout::onMouseMove(const Vector2D& mousePos) {
const auto DRAGGINGWINDOW = g_pInputManager->currentlyDraggedWindow;
// Window invalid or drag begin size 0,0 meaning we rejected it.
if (!g_pCompositor->windowValidMapped(DRAGGINGWINDOW) || m_vBeginDragSizeXY == Vector2D()) {
g_pInputManager->currentlyDraggedWindow = nullptr;
return;
}
const auto DELTA = Vector2D(mousePos.x - m_vBeginDragXY.x, mousePos.y - m_vBeginDragXY.y);
const auto TICKDELTA = Vector2D(mousePos.x - m_vLastDragXY.x, mousePos.y - m_vLastDragXY.y);
const auto PANIMATE = &g_pConfigManager->getConfigValuePtr("misc:animate_manual_resizes")->intValue;
if (abs(TICKDELTA.x) < 1.f && abs(TICKDELTA.y) < 1.f)
return;
m_vLastDragXY = mousePos;
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
if (g_pInputManager->dragMode == MBIND_MOVE) {
DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(m_vBeginDragPositionXY + DELTA);
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize.goalv());
} else if (g_pInputManager->dragMode == MBIND_RESIZE) {
if (DRAGGINGWINDOW->m_bIsFloating) {
const auto MAXSIZE = g_pXWaylandManager->getMaxSizeForWindow(DRAGGINGWINDOW);
// calc the new size and pos
Vector2D newSize = m_vBeginDragSizeXY;
Vector2D newPos = m_vBeginDragPositionXY;
if (m_iGrabbedCorner == 3) {
newSize = newSize + DELTA;
} else if (m_iGrabbedCorner == 0) {
newSize = newSize - DELTA;
newPos = newPos + DELTA;
} else if (m_iGrabbedCorner == 1) {
newSize = newSize + Vector2D(DELTA.x, -DELTA.y);
newPos = newPos + Vector2D(0, DELTA.y);
} else if (m_iGrabbedCorner == 4) {
newSize = newSize + Vector2D(-DELTA.x, DELTA.y);
newPos = newPos + Vector2D(DELTA.x, 0);
}
newSize = newSize.clamp(Vector2D(20,20), MAXSIZE);
if (*PANIMATE) {
DRAGGINGWINDOW->m_vRealSize = newSize;
DRAGGINGWINDOW->m_vRealPosition = newPos;
} else {
DRAGGINGWINDOW->m_vRealSize.setValueAndWarp(newSize);
DRAGGINGWINDOW->m_vRealPosition.setValueAndWarp(newPos);
}
g_pXWaylandManager->setWindowSize(DRAGGINGWINDOW, DRAGGINGWINDOW->m_vRealSize.goalv());
} else {
resizeActiveWindow(TICKDELTA, DRAGGINGWINDOW);
}
}
// get middle point
Vector2D middle = DRAGGINGWINDOW->m_vRealPosition.vec() + DRAGGINGWINDOW->m_vRealSize.vec() / 2.f;
// and check its monitor
const auto PMONITOR = g_pCompositor->getMonitorFromVector(middle);
if (PMONITOR) {
DRAGGINGWINDOW->m_iMonitorID = PMONITOR->ID;
DRAGGINGWINDOW->moveToWorkspace(PMONITOR->activeWorkspace);
DRAGGINGWINDOW->updateToplevel();
}
DRAGGINGWINDOW->updateWindowDecos();
g_pHyprRenderer->damageWindow(DRAGGINGWINDOW);
}
void IHyprLayout::changeWindowFloatingMode(CWindow* pWindow) {
if (pWindow->m_bIsFullscreen) {
Debug::log(LOG, "Rejecting a change float order because window is fullscreen.");
// restore its' floating mode
pWindow->m_bIsFloating = !pWindow->m_bIsFloating;
return;
}
pWindow->m_bPinned = false;
const auto TILED = isWindowTiled(pWindow);
if (!TILED) {
const auto PNEWMON = g_pCompositor->getMonitorFromVector(pWindow->m_vRealPosition.vec() + pWindow->m_vRealSize.vec() / 2.f);
pWindow->m_iMonitorID = PNEWMON->ID;
pWindow->moveToWorkspace(PNEWMON->activeWorkspace);
// save real pos cuz the func applies the default 5,5 mid
const auto PSAVEDPOS = pWindow->m_vRealPosition.vec();
const auto PSAVEDSIZE = pWindow->m_vRealSize.vec();
// if the window is pseudo, update its size
pWindow->m_vPseudoSize = pWindow->m_vRealSize.vec();
pWindow->m_vLastFloatingSize = PSAVEDSIZE;
onWindowCreatedTiling(pWindow);
pWindow->m_vRealPosition.setValue(PSAVEDPOS);
pWindow->m_vRealSize.setValue(PSAVEDSIZE);
// fix pseudo leaving artifacts
g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID));
} else {
pWindow->m_vSize = pWindow->m_vRealSize.vec();
pWindow->m_vPosition = pWindow->m_vRealPosition.vec();
onWindowRemovedTiling(pWindow);
g_pCompositor->moveWindowToTop(pWindow);
pWindow->m_vRealPosition = pWindow->m_vRealPosition.vec() + (pWindow->m_vRealSize.vec() - pWindow->m_vLastFloatingSize) / 2.f;
pWindow->m_vRealSize = pWindow->m_vLastFloatingSize;
g_pHyprRenderer->damageMonitor(g_pCompositor->getMonitorFromID(pWindow->m_iMonitorID));
pWindow->m_sSpecialRenderData.rounding = true;
}
g_pCompositor->updateWindowAnimatedDecorationValues(pWindow);
pWindow->updateToplevel();
}
void IHyprLayout::moveActiveWindow(const Vector2D& delta, CWindow* pWindow) {
const auto PWINDOW = pWindow ? pWindow : g_pCompositor->m_pLastWindow;
if (!g_pCompositor->windowValidMapped(PWINDOW))
return;
if (!PWINDOW->m_bIsFloating) {
Debug::log(LOG, "Dwindle cannot move a tiled window in moveActiveWindow!");
return;
}
PWINDOW->m_vRealPosition = PWINDOW->m_vRealPosition.goalv() + delta;
g_pHyprRenderer->damageWindow(PWINDOW);
}

View File

@@ -16,17 +16,29 @@ enum eFullscreenMode : uint8_t;
interface IHyprLayout {
public:
virtual void onEnable() = 0;
virtual void onDisable() = 0;
/*
Called when a window is created (mapped)
The layout HAS TO set the goal pos and size (anim mgr will use it)
If !animationinprogress, then the anim mgr will not apply an anim.
*/
virtual void onWindowCreated(CWindow*) = 0;
virtual void onWindowCreated(CWindow*);
virtual void onWindowCreatedTiling(CWindow*) = 0;
virtual void onWindowCreatedFloating(CWindow*);
/*
Return tiled status
*/
virtual bool isWindowTiled(CWindow*) = 0;
/*
Called when a window is removed (unmapped)
*/
virtual void onWindowRemoved(CWindow*) = 0;
virtual void onWindowRemoved(CWindow*);
virtual void onWindowRemovedTiling(CWindow*) = 0;
virtual void onWindowRemovedFloating(CWindow*);
/*
Called when the monitor requires a layout recalculation
this usually means reserved area changes
@@ -42,53 +54,59 @@ public:
/*
Called when a window is requested to be floated
*/
virtual void changeWindowFloatingMode(CWindow*) = 0;
virtual void changeWindowFloatingMode(CWindow*);
/*
Called when a window is clicked on, beginning a drag
this might be a resize, move, whatever the layout defines it
as.
*/
virtual void onBeginDragWindow() = 0;
virtual void onBeginDragWindow();
/*
Called when a user requests a resize of the current window by a vec
Vector2D holds pixel values
Optional pWindow for a specific window
*/
virtual void resizeActiveWindow(const Vector2D&, CWindow* pWindow = nullptr) = 0;
/*
Called when a user requests a move of the current window by a vec
Vector2D holds pixel values
Optional pWindow for a specific window
*/
virtual void moveActiveWindow(const Vector2D&, CWindow* pWindow = nullptr);
/*
Called when a window is ended being dragged
(mouse up)
*/
virtual void onEndDragWindow() = 0;
virtual void onEndDragWindow();
/*
Called whenever the mouse moves, should the layout want to
Called whenever the mouse moves, should the layout want to
do anything with it.
Useful for dragging.
*/
virtual void onMouseMove(const Vector2D&) = 0;
/*
Called when a window is created, but is requesting to be floated.
Warning: this also includes stuff like popups, incorrect handling
of which can result in a crash!
*/
virtual void onWindowCreatedFloating(CWindow*) = 0;
virtual void onMouseMove(const Vector2D&);
/*
Called when a window / the user requests to toggle the fullscreen state of a window
The layout sets all the fullscreen flags.
It can either accept or ignore.
*/
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode) = 0;
virtual void fullscreenRequestForWindow(CWindow*, eFullscreenMode, bool) = 0;
/*
Called when a dispatcher requests a custom message
The layout is free to ignore.
The layout is free to ignore.
std::any is the reply. Can be empty.
*/
virtual std::any layoutMessage(SLayoutMessageHeader, std::string) = 0;
/*
/*
Required to be handled, but may return just SWindowRenderLayoutHints()
Called when the renderer requests any special draw flags for
a specific window, e.g. border color for groups.
*/
virtual SWindowRenderLayoutHints requestRenderHints(CWindow*) = 0;
/*
/*
Called when the user requests two windows to be swapped places.
The layout is free to ignore.
*/
@@ -104,4 +122,11 @@ public:
Called when something wants the current layout's name
*/
virtual std::string getLayoutName() = 0;
};
private:
Vector2D m_vBeginDragXY;
Vector2D m_vLastDragXY;
Vector2D m_vBeginDragPositionXY;
Vector2D m_vBeginDragSizeXY;
int m_iGrabbedCorner = 0;
};

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