Compare commits
703 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
4520b30d49 | ||
|
8405aa111d | ||
|
ad46257cce | ||
|
0cfbe618b5 | ||
|
7d0944acdf | ||
|
b9990468f3 | ||
|
736a8735b3 | ||
|
b54eecbd79 | ||
|
657aeb3946 | ||
|
6807430b18 | ||
|
0c7a7e2d56 | ||
|
0ec6072a29 | ||
|
3ca699debf | ||
|
52c0919621 | ||
|
6fbfeefc71 | ||
|
46bf87c8d1 | ||
|
595eb89f6e | ||
|
a815b14bf1 | ||
|
3a5052a714 | ||
|
8e237b006f | ||
|
1ed925b69c | ||
|
aed529f695 | ||
|
de68e065fe | ||
|
e2426942e5 | ||
|
5c6c300abf | ||
|
6bd3397141 | ||
|
68fd32c810 | ||
|
3ddb16bd5b | ||
|
f6387536f6 | ||
|
968f6a6013 | ||
|
488efab636 | ||
|
6649255d54 | ||
|
4b00cba319 | ||
|
9e418671e1 | ||
|
d73c14751a | ||
|
6f313de952 | ||
|
2cf6e7862a | ||
|
58669fef77 | ||
|
e20aef7d53 | ||
|
b2143a98e2 | ||
|
f75f8efb1b | ||
|
be96787ed0 | ||
|
89d945aabe | ||
|
27211c71e9 | ||
|
14942bca60 | ||
|
77f2a01304 | ||
|
7b56ce6521 | ||
|
32a8caf7e7 | ||
|
caaa9b11e4 | ||
|
b1ad2d8066 | ||
|
22746b3046 | ||
|
49713fab04 | ||
|
8b86ee8bf0 | ||
|
2a052c69f3 | ||
|
2320b2241c | ||
|
8f5188269b | ||
|
00c8626863 | ||
|
0a211f29f5 | ||
|
d279d7c4c6 | ||
|
6c78b03bb7 | ||
|
f79497087b | ||
|
508bde1f61 | ||
|
e5ff19ac0f | ||
|
8579066c7a | ||
|
9232bc2c00 | ||
|
db0b764a5a | ||
|
278583b8a1 | ||
|
4414cd07e2 | ||
|
9e98fb0167 | ||
|
9856378384 | ||
|
dfa1bd0cd4 | ||
|
92df6b0dce | ||
|
71963972bf | ||
|
1bc05b1f9f | ||
|
e6cf643f5a | ||
|
94140e886e | ||
|
b248d59713 | ||
|
cbc0ff6ec0 | ||
|
6b6554adb8 | ||
|
d936eb437b | ||
|
883d01084c | ||
|
0564b46a5e | ||
|
3c9716acfd | ||
|
581f6659f8 | ||
|
e72ae6b25f | ||
|
9e35656244 | ||
|
e87758529e | ||
|
eb97d949aa | ||
|
e74efd87e5 | ||
|
4dbdb556fe | ||
|
5ee4b19691 | ||
|
d35e70a8c6 | ||
|
c35ed8363f | ||
|
d505b33665 | ||
|
118be4dea0 | ||
|
73b9756b8d | ||
|
8b9e385943 | ||
|
e01da1fd7a | ||
|
7a8c013edc | ||
|
518399a95b | ||
|
155d44016d | ||
|
13f90bb87a | ||
|
c67b257e51 | ||
|
8237d7e1a4 | ||
|
85da1a17d8 | ||
|
9609b04ff9 | ||
|
04421063af | ||
|
43e1415e71 | ||
|
e1448732b3 | ||
|
7c4c402bd7 | ||
|
6179b17903 | ||
|
05b48d48d9 | ||
|
07a21fdfa9 | ||
|
0f594732b0 | ||
|
312411fc70 | ||
|
70add904c4 | ||
|
5ca4823128 | ||
|
0500213086 | ||
|
b0fca6eaf0 | ||
|
4988e00b1d | ||
|
0fad7a0bb0 | ||
|
727f1b54cd | ||
|
c80457be02 | ||
|
4a42c5ed20 | ||
|
bd6d6e7f33 | ||
|
027140b731 | ||
|
ea10592ad3 | ||
|
9b54342baa | ||
|
8f9887b0c9 | ||
|
fa39df4731 | ||
|
f7249bd331 | ||
|
6934e7aa2b | ||
|
8bbeee2041 | ||
|
7a24e564f4 | ||
|
4b5b8a7630 | ||
|
5b1375141b | ||
|
4af9410dc2 | ||
|
a6315b0af4 | ||
|
cac59fefec | ||
|
1ac2fc3f7e | ||
|
cf6a1716ae | ||
|
10d7219807 | ||
|
838ed87d6f | ||
|
76b82fdde7 | ||
|
c5fd577181 | ||
|
fbd6354393 | ||
|
fd8d8e122e | ||
|
1c9d56998d | ||
|
242e06b242 | ||
|
25e72949a1 | ||
|
259dcd838e | ||
|
ef33198e8f | ||
|
604eb21a7e | ||
|
92a0dd164e | ||
|
b9b8e6220f | ||
|
a95df6b57e | ||
|
9642311ac2 | ||
|
98e99cd03d | ||
|
8210a1d7ac | ||
|
d105c7403c | ||
|
00ee1cf98e | ||
|
7dd0f76e5a | ||
|
17ed4fc04c | ||
|
6a8824253c | ||
|
eb42adc4c0 | ||
|
09dbcabcc7 | ||
|
72c7818ae6 | ||
|
1ea47950f4 | ||
|
8d6c18076f | ||
|
9c5a37a797 | ||
|
ca85455a8e | ||
|
28f6c2df59 | ||
|
83ab3ae0af | ||
|
b672118f92 | ||
|
aac90d9279 | ||
|
66586c38f5 | ||
|
82c67e61a9 | ||
|
e45e606fbd | ||
|
688fe5c147 | ||
|
a3b75559b3 | ||
|
df4f222482 | ||
|
3b663f4afc | ||
|
f634b9e61a | ||
|
bdb296a83c | ||
|
4fa63104c9 | ||
|
a437e44a6a | ||
|
cae937c51b | ||
|
8162fae377 | ||
|
c5786be695 | ||
|
1b1ecf77e0 | ||
|
883463f9dd | ||
|
3e7325af57 | ||
|
946ed1f32a | ||
|
4eff224a7f | ||
|
c86db7bbb0 | ||
|
272d904870 | ||
|
01e3da4d51 | ||
|
33015546c6 | ||
|
83d88fa564 | ||
|
11dfb8397b | ||
|
f4045ab8d0 | ||
|
fa12efdd2a | ||
|
bf611fbbf3 | ||
|
5afc4dc42e | ||
|
50348a3ddb | ||
|
279ec1c291 | ||
|
1006663b6e | ||
|
b2a18aa80a | ||
|
d21a6b12b8 | ||
|
912e7ba82d | ||
|
92744b5b9a | ||
|
c5feee1e35 | ||
|
1840a907a8 | ||
|
682b30fba8 | ||
|
12d9901472 | ||
|
15f942000e | ||
|
520e91238f | ||
|
0c56be74a3 | ||
|
069faa4027 | ||
|
c30dfe92ee | ||
|
d85ae306c5 | ||
|
197f880790 | ||
|
3b4aabe04c | ||
|
c5ec079c6f | ||
|
4aec237ec0 | ||
|
39df1f4dbf | ||
|
77cf651825 | ||
|
c7b72790bd | ||
|
3fa6db1e7a | ||
|
d361fcbd85 | ||
|
df9d830117 | ||
|
118d4e1001 | ||
|
511eea71c6 | ||
|
01ff5fdf6a | ||
|
0bf9ceb53b | ||
|
4fdc0d55e4 | ||
|
8b37e81374 | ||
|
fd1d4e288e | ||
|
4b4971c06f | ||
|
83a334f97d | ||
|
9a09eac79b | ||
|
2d552fbaa2 | ||
|
ea72831541 | ||
|
a399f98c68 | ||
|
3e00d7dde7 | ||
|
d5bc3eb1fa | ||
|
99e9cb5107 | ||
|
f36c625e37 | ||
|
2e3dc17a7e | ||
|
b2717cf7fd | ||
|
3d82d199f0 | ||
|
a05da63d85 | ||
|
5b736a4a66 | ||
|
fa6ee51367 | ||
|
b0a70f63e3 | ||
|
d597ae41b9 | ||
|
640d161851 | ||
|
0e86808e59 | ||
|
2b520571e8 | ||
|
5dd2c27b63 | ||
|
4ae89e1f22 | ||
|
51ffd7fa6f | ||
|
ae50f8614d | ||
|
9f5a57ff45 | ||
|
4141e67550 | ||
|
be2dfa36ef | ||
|
1fa4b7d79b | ||
|
592b4a709c | ||
|
09bb5658b7 | ||
|
ab0a3268e0 | ||
|
c8873b958d | ||
|
60571cd5cc | ||
|
5edfa627b4 | ||
|
95959789b7 | ||
|
8c02b3c267 | ||
|
5b7057c479 | ||
|
37e1411e8d | ||
|
5489682799 | ||
|
e989a0bcff | ||
|
8a5f9bbb39 | ||
|
3b9b5346b8 | ||
|
8ec3dc4c09 | ||
|
cc7c117fe7 | ||
|
1c221240d0 | ||
|
c1afc82a4c | ||
|
f3a9f9ec45 | ||
|
10e631053a | ||
|
46c6efeab3 | ||
|
68ee4dda5e | ||
|
743e98f0c0 | ||
|
e673220340 | ||
|
9c38b0fdbe | ||
|
60b663e276 | ||
|
01560c9d7c | ||
|
3a1afb53fd | ||
|
23a8f06594 | ||
|
70468857da | ||
|
87699575e1 | ||
|
33e513d489 | ||
|
6e6c61b9e8 | ||
|
a9d87bd666 | ||
|
7df9b01d48 | ||
|
256db08aed | ||
|
73d09953e8 | ||
|
fcff2dcac2 | ||
|
3cc2028def | ||
|
9b6ae4f77b | ||
|
bc86afea7e | ||
|
6edfdd63a1 | ||
|
04b40ea2ec | ||
|
55ceca4cdd | ||
|
10e8af00d6 | ||
|
ad711ef421 | ||
|
ae638d997d | ||
|
141cd09bd3 | ||
|
0243271544 | ||
|
729b47d46d | ||
|
84227eb587 | ||
|
daed75219f | ||
|
ec672b1ab9 | ||
|
963816b9a6 | ||
|
534fdb5a37 | ||
|
682865632f | ||
|
76610d9fb0 | ||
|
57371b93a0 | ||
|
33a5c8ce32 | ||
|
a0d15a0b7b | ||
|
cd942ad12d | ||
|
daf5fad190 | ||
|
4beac91cbd | ||
|
391f1ae838 | ||
|
381cb2d833 | ||
|
a0be3de0e8 | ||
|
3e543d2ce8 | ||
|
735e3c6c56 | ||
|
b16fb9770c | ||
|
f2b6ebbf54 | ||
|
fe19754887 | ||
|
72bce7efd5 | ||
|
99088eaed8 | ||
|
2da3cfb422 | ||
|
e2efecc24e | ||
|
8a4548e430 | ||
|
a5f58a3126 | ||
|
077494ee85 | ||
|
752604cfe9 | ||
|
3c758db95c | ||
|
7c68236a51 | ||
|
4c3b035162 | ||
|
f17f8b219c | ||
|
e8374e0792 | ||
|
77b134e23b | ||
|
87db950189 | ||
|
5bae7f150b | ||
|
83a5395eaa | ||
|
d03fa94c2c | ||
|
511e9ccdd1 | ||
|
3132f0275e | ||
|
1797319a07 | ||
|
5979ceb56b | ||
|
672bf1f867 | ||
|
33e933e2a0 | ||
|
341fb4497f | ||
|
cbaac6deaf | ||
|
3b6bcd6ddc | ||
|
e6fc9873b5 | ||
|
db1f5cd137 | ||
|
928d1dd38a | ||
|
faa157e162 | ||
|
7f624d2236 | ||
|
f7fb7e7e49 | ||
|
efcbcd7297 | ||
|
043b859ea2 | ||
|
cf373d315e | ||
|
016da234d0 | ||
|
f642fb97df | ||
|
9b0993cc49 | ||
|
efccf25fcc | ||
|
8e15f91c24 | ||
|
300228b503 | ||
|
293e687389 | ||
|
da956c8a97 | ||
|
bd526822de | ||
|
f442f435d3 | ||
|
bc6b0880dd | ||
|
ed6c701144 | ||
|
45c4898423 | ||
|
a770a88e09 | ||
|
1f64668953 | ||
|
13bc7e1e14 | ||
|
7486576fa7 | ||
|
f85c6416c6 | ||
|
e728e56cbc | ||
|
9ff83f4aa9 | ||
|
3247d18a7c | ||
|
a443902abc | ||
|
b03f41efec | ||
|
648f824b9e | ||
|
22138ac259 | ||
|
19fb13e6cf | ||
|
ede1e63f69 | ||
|
cc98594c3a | ||
|
0502c3f62b | ||
|
0a6e83005f | ||
|
e894d5e964 | ||
|
8bb75a223d | ||
|
6247a6b537 | ||
|
2fa57f2dc4 | ||
|
e58fd3bfb0 | ||
|
d7ea1b7785 | ||
|
4d6f96f74f | ||
|
8ff9410d2c | ||
|
718afe271e | ||
|
1f43a5c859 | ||
|
9c5dd59d4b | ||
|
d16c6aa1db | ||
|
ac11771348 | ||
|
f2dc48d92f | ||
|
e4d09aa3a9 | ||
|
c338acbb7d | ||
|
95782de966 | ||
|
3ba3d20ad3 | ||
|
1d70962892 | ||
|
918d8340af | ||
|
4f7113972e | ||
|
8121e66f34 | ||
|
784c0b5ccb | ||
|
eef207ce0a | ||
|
4dd2b5902e | ||
|
cff0123ce6 | ||
|
8a68199a0c | ||
|
e09addf8de | ||
|
315f16d501 | ||
|
7f09646ab8 | ||
|
0b924f541c | ||
|
4778afe2e6 | ||
|
fa022901cf | ||
|
4a8b13ea4f | ||
|
8cf2ca1966 | ||
|
fabc30df52 | ||
|
d6de248b0d | ||
|
c1e21719a2 | ||
|
def5fcb212 | ||
|
65f04f265c | ||
|
6d21014a50 | ||
|
20a465f69d | ||
|
fb15b7aa2a | ||
|
6e5804b53d | ||
|
e0e3c4c6ae | ||
|
b98e0876d3 | ||
|
236150b3c5 | ||
|
d1340bd1d8 | ||
|
28ce0e0f80 | ||
|
a9c7a0830f | ||
|
785d062887 | ||
|
1360677478 | ||
|
14ab0ecc5e | ||
|
9cb3bf1cac | ||
|
b15be9c77d | ||
|
d5ef10abf4 | ||
|
172ee1cada | ||
|
738530e62e | ||
|
069a21a34e | ||
|
2031af82fa | ||
|
d0a6fa7aa6 | ||
|
648ac8a00b | ||
|
43c75f17eb | ||
|
1b5444494d | ||
|
3eaf35f1e2 | ||
|
2566d81884 | ||
|
1f5fd7e64a | ||
|
908bec1564 | ||
|
89f795da98 | ||
|
91fe58f8f2 | ||
|
77f44bfcab | ||
|
6c24dc0bb1 | ||
|
46ef6653be | ||
|
fb82f6bcd7 | ||
|
32aca88752 | ||
|
df0c014ba0 | ||
|
cb63398f07 | ||
|
2f278dc883 | ||
|
12ce06f39b | ||
|
a357fa3e0a | ||
|
a9d53a2252 | ||
|
b2590b58c5 | ||
|
9cd5b3587c | ||
|
8055b1c00a | ||
|
5de273a144 | ||
|
4842eb83b4 | ||
|
e6d10539af | ||
|
9e781040d9 | ||
|
a54f98c203 | ||
|
d677ac6f87 | ||
|
a9d7befc36 | ||
|
0e18da8467 | ||
|
18ee9ece9c | ||
|
38132ffaf5 | ||
|
a99f314106 | ||
|
9d7d5ec3c8 | ||
|
c7e85e26f7 | ||
|
1bae19ce85 | ||
|
f687105eff | ||
|
32283ed706 | ||
|
8412ffcc42 | ||
|
b6bf4afb48 | ||
|
e1b05f8eaf | ||
|
21b9e31bf4 | ||
|
1c388e52fb | ||
|
8c64a4bad7 | ||
|
1f46296ea0 | ||
|
809820921d | ||
|
90d0097716 | ||
|
b17381eb81 | ||
|
811429bfd4 | ||
|
ea2501d455 | ||
|
7ba2c31822 | ||
|
cef6aad28f | ||
|
89a3c90613 | ||
|
b16af45c4a | ||
|
1423707dbe | ||
|
121c6ac3ea | ||
|
722b846ac5 | ||
|
4168b8c17b | ||
|
1f71d5f5c1 | ||
|
bf75723f27 | ||
|
c62f0015ae | ||
|
9994b73ad0 | ||
|
d724556b7e | ||
|
7789caad39 | ||
|
3fb079a2a3 | ||
|
211353dc34 | ||
|
10e02076b1 | ||
|
5b6d54cae0 | ||
|
6967a31450 | ||
|
c31d9ef417 | ||
|
6b6b02c27a | ||
|
40ce17bbbd | ||
|
41e1147dfc | ||
|
9bc00897fc | ||
|
d6337146bb | ||
|
429cff340d | ||
|
af5f24929d | ||
|
c95845b148 | ||
|
82099fd1c0 | ||
|
155fe6f165 | ||
|
fefa55d406 | ||
|
098ac916a6 | ||
|
d0a224a491 | ||
|
5517cc506b | ||
|
0ac0f32671 | ||
|
b30c7125d7 | ||
|
3fd6c1b30e | ||
|
eaecf7db14 | ||
|
e08195d240 | ||
|
66acdfe2ad | ||
|
0ebb43c1a3 | ||
|
a54ab30160 | ||
|
df6ebe358b | ||
|
a60c7283e6 | ||
|
ebf258788e | ||
|
73b133d015 | ||
|
722d537a91 | ||
|
506d0c06e6 | ||
|
546a486bab | ||
|
db5d39a66f | ||
|
553232a3e4 | ||
|
addd3e7f1a | ||
|
a71207434c | ||
|
71c2ff3105 | ||
|
90f262aada | ||
|
2ff95bba3f | ||
|
ce17961aad | ||
|
6d67b84469 | ||
|
0d6eae0523 | ||
|
52684b7d90 | ||
|
4e42107d25 | ||
|
eea0a6a704 | ||
|
255272ea18 | ||
|
df80fbf706 | ||
|
25b9446949 | ||
|
7ad9116de8 | ||
|
62401d5b3f | ||
|
3775776a07 | ||
|
155ae3721c | ||
|
93fea89043 | ||
|
e419ef1873 | ||
|
3c907f7830 | ||
|
4daa5c0658 | ||
|
baef55da1d | ||
|
f8857e6072 | ||
|
c21a5a9340 | ||
|
2ead1fd221 | ||
|
49485ba36a | ||
|
fe23d2b639 | ||
|
9518cec833 | ||
|
23cd4c7998 | ||
|
0cb8fbe18e | ||
|
f21b6fe576 | ||
|
f91431465b | ||
|
a66cfe0fbe | ||
|
7173f0c9e7 | ||
|
abbe71d26d | ||
|
a2643e11a0 | ||
|
3ac0e7ead1 | ||
|
d693c44836 | ||
|
ca0833c9ed | ||
|
de9798fcf9 | ||
|
7e8c0b7f30 | ||
|
9eec4cb670 | ||
|
a8522db683 | ||
|
b9c58b6e75 | ||
|
3fe5280ce9 | ||
|
3381e2b55b | ||
|
7fbe05a250 | ||
|
31890026ea | ||
|
94c20a1863 | ||
|
3eeaea5be9 | ||
|
eed1361f39 | ||
|
7eeee2c94e | ||
|
fc72df8e58 | ||
|
0cfdde3d1a | ||
|
121d3a7213 | ||
|
4cdddcfe46 | ||
|
d0a4a0e0d8 | ||
|
1584679004 | ||
|
ba69652193 | ||
|
47874f09f4 | ||
|
60be4298e1 | ||
|
4c625ce673 | ||
|
064bdb06f1 | ||
|
fd35b35000 | ||
|
2ccd45a844 | ||
|
ff93820bbb | ||
|
071f6977df | ||
|
c8ae9a2e83 | ||
|
cee639d9df | ||
|
6be765b7a1 | ||
|
33a7b7bb6b | ||
|
15072831cf | ||
|
8562d38477 | ||
|
494b9415a1 | ||
|
b6a7fb9e91 | ||
|
3529fbc6d4 | ||
|
ed3a888fc2 | ||
|
a8ab1b1679 | ||
|
6e594e4416 | ||
|
19186de118 | ||
|
38911d6df4 | ||
|
37a84c5223 | ||
|
c19903eaf8 | ||
|
cc4ac52309 | ||
|
2549f0cc97 | ||
|
3374229118 | ||
|
2ba6bb69c4 | ||
|
db30ff63e6 | ||
|
a7e23d2f1e | ||
|
1753059b07 | ||
|
b0861b6709 | ||
|
7cf810b181 | ||
|
51b0da2c0d | ||
|
4f26ae70fd | ||
|
eeebbc0e7e | ||
|
635a02d83f | ||
|
85f7f69046 | ||
|
fe4737fb9d | ||
|
d7aed240db | ||
|
c98acaed62 | ||
|
67a5377b41 | ||
|
84e8d1810d | ||
|
ed411f53bd | ||
|
e4e84064f2 | ||
|
6a988d9276 | ||
|
d1ad490cda | ||
|
36d32973dd | ||
|
70b5e6df70 | ||
|
5e7925eaeb | ||
|
57a12476de | ||
|
601210878d | ||
|
22a86fd7a2 | ||
|
598bbd186b | ||
|
6ccc22194c | ||
|
ec092bd601 | ||
|
2bcc8d303f | ||
|
375e77e398 | ||
|
96365309de | ||
|
0acad88c3c | ||
|
57e76f91d9 | ||
|
0c446ec5f4 | ||
|
fa69de8ab6 | ||
|
05e4a3f1a8 | ||
|
a8a04c746b | ||
|
cddeec47a1 | ||
|
c7fbc30bfd | ||
|
1ed1ce9506 | ||
|
589f758d94 | ||
|
f15513309b | ||
|
99aa34db6e | ||
|
03ebad3cbf | ||
|
aaf35b9f1f | ||
|
62eadad20f | ||
|
0b215c5f24 | ||
|
a3309b51a2 |
44
.github/ISSUE_TEMPLATE/bug.yml
vendored
@@ -2,18 +2,37 @@ name: Bug Report
|
||||
description: Something is not working right
|
||||
labels: ["bug"]
|
||||
body:
|
||||
- type: markdown
|
||||
- type: checkboxes
|
||||
attributes:
|
||||
value: |
|
||||
Before opening a new issue, take a moment to search through the current open ones.
|
||||
label: Already reported ? *
|
||||
description: Before opening a new bug report, please take a moment to search through the current open and closed issues to check if it already exists.
|
||||
options:
|
||||
- label: I have searched the existing open and closed issues.
|
||||
required: true
|
||||
|
||||
---
|
||||
- type: dropdown
|
||||
id: type
|
||||
attributes:
|
||||
label: Regression?
|
||||
description: |
|
||||
Regression means that something used to work but no longer does.
|
||||
**BEFORE CONTINUING**, please check if this bug is a regression or not, and if it is, we need you to bisect with the help of the wiki: https://wiki.hyprland.org/Crashes-and-Bugs/#bisecting-an-issue
|
||||
multiple: true
|
||||
options:
|
||||
- "Yes"
|
||||
- "No"
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: ver
|
||||
attributes:
|
||||
label: Hyprland Version
|
||||
description: "Paste the output of `hyprctl systeminfo` here."
|
||||
label: System Info and Version
|
||||
description: |
|
||||
Paste the output of `hyprctl systeminfo -c` here. If you can't
|
||||
launch Hyprland, paste the output of `Hyprland --systeminfo`.
|
||||
If `Hyprland --systeminfo` errors out (added in 0.44.0), find
|
||||
and paste the Hyprland version manually.
|
||||
value: "<details>
|
||||
<summary>System/Version info</summary>
|
||||
|
||||
@@ -29,17 +48,6 @@ body:
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: dropdown
|
||||
id: type
|
||||
attributes:
|
||||
label: Bug or Regression?
|
||||
description: Is this a bug or a regression?
|
||||
options:
|
||||
- Bug
|
||||
- Regression
|
||||
validations:
|
||||
required: true
|
||||
|
||||
- type: textarea
|
||||
id: desc
|
||||
attributes:
|
||||
@@ -62,6 +70,6 @@ body:
|
||||
label: Crash reports, logs, images, videos
|
||||
description: |
|
||||
Anything that can help. Please always ATTACH and not paste them.
|
||||
Logs can be found in /tmp/hypr
|
||||
Logs can be found in $XDG_RUNTIME_DIR/hypr
|
||||
Crash reports are stored in ~/.cache/hyprland or $XDG_CACHE_HOME/hyprland
|
||||
|
||||
|
11
.github/actions/setup_base/action.yml
vendored
@@ -34,6 +34,7 @@ runs:
|
||||
libglvnd \
|
||||
libinput \
|
||||
libliftoff \
|
||||
libxcursor \
|
||||
libxcvt \
|
||||
libxfont2 \
|
||||
libxkbcommon \
|
||||
@@ -68,6 +69,16 @@ runs:
|
||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
cmake --install build
|
||||
|
||||
- name: Get hyprutils-git
|
||||
shell: bash
|
||||
run: |
|
||||
git clone https://github.com/hyprwm/hyprutils && cd hyprutils && cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -B build && cmake --build build --target hyprutils && cmake --install build
|
||||
|
||||
- name: Get aquamarine-git
|
||||
shell: bash
|
||||
run: |
|
||||
git clone https://github.com/hyprwm/aquamarine && cd aquamarine && cmake -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr -B build && cmake --build build --target aquamarine && cmake --install build
|
||||
|
||||
- name: Get Xorg pacman pkgs
|
||||
shell: bash
|
||||
if: inputs.INSTALL_XORG_PKGS == 'true'
|
||||
|
83
.github/labeler.yml
vendored
Normal file
@@ -0,0 +1,83 @@
|
||||
assets:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "assets/**"
|
||||
|
||||
docs:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "docs/**"
|
||||
|
||||
hyprctl:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "hyprctl/**"
|
||||
|
||||
hyprpm:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "hyprpm/**"
|
||||
|
||||
nix:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "nix/**"
|
||||
|
||||
protocols:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: ["protocols/**", "src/protocols/**"]
|
||||
|
||||
core:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/**"
|
||||
|
||||
config:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/config/**"
|
||||
|
||||
debug:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/debug/**"
|
||||
|
||||
desktop:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/desktop/**"
|
||||
|
||||
devices:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/devices/**"
|
||||
|
||||
events:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/events/**"
|
||||
|
||||
helpers:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/helpers/**"
|
||||
|
||||
hyprerror:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/hyprerror/**"
|
||||
|
||||
init:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/init/**"
|
||||
|
||||
layout:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/layout/**"
|
||||
|
||||
managers:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/managers/**"
|
||||
|
||||
pch:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/pch/**"
|
||||
|
||||
plugins:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/plugins/**"
|
||||
|
||||
render:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/render/**"
|
||||
|
||||
xwayland:
|
||||
- changed-files:
|
||||
- any-glob-to-any-file: "src/xwayland/**"
|
5
.github/workflows/ci.yaml
vendored
@@ -3,6 +3,7 @@ name: Build Hyprland
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
jobs:
|
||||
gcc:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork
|
||||
name: "Build Hyprland (Arch)"
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
@@ -44,6 +45,7 @@ jobs:
|
||||
path: Hyprland.tar.xz
|
||||
|
||||
meson:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork
|
||||
name: "Build Hyprland with Meson (Arch)"
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
@@ -64,6 +66,7 @@ jobs:
|
||||
run: ninja -C build
|
||||
|
||||
no-pch:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork
|
||||
name: "Build Hyprland without precompiled headers (Arch)"
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
@@ -83,6 +86,7 @@ jobs:
|
||||
run: make nopch
|
||||
|
||||
noxwayland:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork
|
||||
name: "Build Hyprland in pure Wayland (Arch)"
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
@@ -103,6 +107,7 @@ jobs:
|
||||
run: make release
|
||||
|
||||
clang-format:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork
|
||||
name: "Code Style (Arch)"
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
|
12
.github/workflows/labeler.yml
vendored
Normal file
@@ -0,0 +1,12 @@
|
||||
name: "Pull Request Labeler"
|
||||
on:
|
||||
- pull_request_target
|
||||
|
||||
jobs:
|
||||
labeler:
|
||||
permissions:
|
||||
contents: read
|
||||
pull-requests: write
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/labeler@v5
|
17
.github/workflows/nix-build.yml
vendored
@@ -1,3 +1,5 @@
|
||||
name: Nix (Build)
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
@@ -10,20 +12,17 @@ jobs:
|
||||
matrix:
|
||||
package:
|
||||
- hyprland
|
||||
- hyprland-cross
|
||||
- xdg-desktop-portal-hyprland
|
||||
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.ref }}
|
||||
|
||||
- uses: cachix/install-nix-action@v25
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- uses: DeterminateSystems/magic-nix-cache-action@main
|
||||
- uses: cachix/cachix-action@v12
|
||||
|
||||
- uses: cachix/cachix-action@v15
|
||||
with:
|
||||
name: hyprland
|
||||
authToken: '${{ secrets.CACHIX_AUTH_TOKEN }}'
|
||||
authToken: "${{ secrets.CACHIX_AUTH_TOKEN }}"
|
||||
|
||||
- run: nix build .#${{ matrix.package }} --extra-substituters "https://hyprland.cachix.org" -L
|
||||
- run: nix build 'github:hyprwm/Hyprland?ref=${{ github.ref }}#${{ matrix.package }}' -L --extra-substituters "https://hyprland.cachix.org"
|
||||
|
11
.github/workflows/nix-ci.yml
vendored
@@ -1,15 +1,14 @@
|
||||
name: Nix
|
||||
name: Nix (CI)
|
||||
|
||||
on: [push, pull_request, workflow_dispatch]
|
||||
|
||||
jobs:
|
||||
wlroots:
|
||||
if: github.event_name != 'pull_request'
|
||||
uses: ./.github/workflows/nix-update-wlroots.yml
|
||||
update-inputs:
|
||||
if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
|
||||
uses: ./.github/workflows/nix-update-inputs.yml
|
||||
secrets: inherit
|
||||
|
||||
build:
|
||||
if: always() && !cancelled() && !contains(needs.*.result, 'failure')
|
||||
needs: wlroots
|
||||
if: (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork)
|
||||
uses: ./.github/workflows/nix-build.yml
|
||||
secrets: inherit
|
||||
|
14
.github/workflows/nix-update-inputs.yml
vendored
@@ -1,11 +1,14 @@
|
||||
name: Nix
|
||||
name: Nix (Update Inputs)
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '0 0 * * *' # check daily
|
||||
workflow_call:
|
||||
secrets:
|
||||
PAT:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
update:
|
||||
if: github.repository == 'hyprwm/Hyprland'
|
||||
name: inputs
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
@@ -22,8 +25,3 @@ jobs:
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "[gha] Nix: update inputs"
|
||||
|
||||
update-build:
|
||||
needs: update
|
||||
uses: ./.github/workflows/nix-build.yml
|
||||
secrets: inherit
|
||||
|
26
.github/workflows/nix-update-wlroots.yml
vendored
@@ -1,26 +0,0 @@
|
||||
name: Nix
|
||||
|
||||
on:
|
||||
workflow_call:
|
||||
secrets:
|
||||
PAT:
|
||||
required: true
|
||||
|
||||
jobs:
|
||||
update:
|
||||
name: wlroots
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Clone repository
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
token: ${{ secrets.PAT }}
|
||||
|
||||
- uses: DeterminateSystems/nix-installer-action@main
|
||||
- name: Update lockfile
|
||||
run: nix/update-wlroots.sh
|
||||
|
||||
- name: Commit
|
||||
uses: stefanzweifel/git-auto-commit-action@v4
|
||||
with:
|
||||
commit_message: "[gha] Nix: update wlroots"
|
1
.github/workflows/security-checks.yml
vendored
@@ -4,6 +4,7 @@ on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
flawfinder:
|
||||
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork
|
||||
name: Flawfinder Checks
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
|
8
.github/workflows/stale.yml
vendored
@@ -7,12 +7,12 @@ name: Mark stale issues and pull requests
|
||||
|
||||
on:
|
||||
schedule:
|
||||
- cron: '7 */4 * * *'
|
||||
- cron: "7 */4 * * *"
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
stale:
|
||||
|
||||
if: github.repository == 'hyprwm/Hyprland'
|
||||
runs-on: ubuntu-latest
|
||||
permissions:
|
||||
issues: write
|
||||
@@ -22,7 +22,7 @@ jobs:
|
||||
- uses: actions/stale@v5
|
||||
with:
|
||||
repo-token: ${{ secrets.STALEBOT_PAT }}
|
||||
stale-issue-label: 'stale'
|
||||
stale-pr-label: 'stale'
|
||||
stale-issue-label: "stale"
|
||||
stale-pr-label: "stale"
|
||||
operations-per-run: 40
|
||||
days-before-close: -1
|
||||
|
10
.gitignore
vendored
@@ -7,6 +7,9 @@ cmake_install.cmake
|
||||
install_manifest.txt
|
||||
compile_commands.json
|
||||
CTestTestfile.cmake
|
||||
CPackConfig.cmake
|
||||
CPackSourceConfig.cmake
|
||||
hyprland.pc
|
||||
_deps
|
||||
|
||||
build/
|
||||
@@ -15,6 +18,9 @@ result*
|
||||
/.idea/
|
||||
.envrc
|
||||
.cache
|
||||
.direnv
|
||||
/.cmake/
|
||||
/.worktree/
|
||||
|
||||
*.o
|
||||
protocols/*.c*
|
||||
@@ -31,5 +37,5 @@ gmon.out
|
||||
PKGBUILD
|
||||
|
||||
src/version.h
|
||||
|
||||
.direnv
|
||||
hyprpm/Makefile
|
||||
hyprctl/Makefile
|
||||
|
4
.gitmodules
vendored
@@ -7,7 +7,3 @@
|
||||
[submodule "subprojects/tracy"]
|
||||
path = subprojects/tracy
|
||||
url = https://github.com/wolfpld/tracy
|
||||
[submodule "subprojects/wlroots-hyprland"]
|
||||
path = subprojects/wlroots-hyprland
|
||||
url = https://github.com/hyprwm/wlroots-hyprland
|
||||
ignore = dirty
|
||||
|
363
CMakeLists.txt
Executable file → Normal file
@@ -1,38 +1,42 @@
|
||||
cmake_minimum_required(VERSION 3.27)
|
||||
include(CheckIncludeFile)
|
||||
cmake_minimum_required(VERSION 3.30)
|
||||
|
||||
# Get version
|
||||
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/props.json PROPS)
|
||||
string(JSON VER GET ${PROPS} version)
|
||||
file(READ "${CMAKE_SOURCE_DIR}/VERSION" VER_RAW)
|
||||
string(STRIP ${VER_RAW} VER)
|
||||
|
||||
project(Hyprland
|
||||
project(
|
||||
Hyprland
|
||||
DESCRIPTION "A Modern C++ Wayland Compositor"
|
||||
VERSION ${VER}
|
||||
)
|
||||
VERSION ${VER})
|
||||
|
||||
include(CheckIncludeFile)
|
||||
include(GNUInstallDirs)
|
||||
|
||||
set(HYPRLAND_VERSION ${VER})
|
||||
set(PREFIX ${CMAKE_INSTALL_PREFIX})
|
||||
set(INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})
|
||||
configure_file(hyprland.pc.in hyprland.pc @ONLY)
|
||||
|
||||
set(CMAKE_MESSAGE_LOG_LEVEL "STATUS")
|
||||
|
||||
message(STATUS "Gathering git info")
|
||||
|
||||
# Get git info
|
||||
# hash and branch
|
||||
execute_process(
|
||||
COMMAND ./scripts/generateVersion.sh
|
||||
# Get git info hash and branch
|
||||
execute_process(COMMAND ./scripts/generateVersion.sh
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
#
|
||||
#
|
||||
|
||||
# udis
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
# Try to find canihavesomecoffee's udis86 using pkgconfig vmd/udis86 does not
|
||||
# provide a .pc file and won't be detected this way
|
||||
pkg_check_modules(udis_dep IMPORTED_TARGET udis86>=1.7.2)
|
||||
|
||||
# Fallback to subproject
|
||||
if(NOT udis_dep_FOUND)
|
||||
add_subdirectory("subprojects/udis86")
|
||||
|
||||
# wlroots
|
||||
message(STATUS "Setting up wlroots")
|
||||
|
||||
include(ExternalProject)
|
||||
include_directories("subprojects/udis86")
|
||||
message(STATUS "udis86 dependency not found, falling back to subproject")
|
||||
endif()
|
||||
|
||||
if(CMAKE_BUILD_TYPE)
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} BUILDTYPE_LOWER)
|
||||
@@ -53,24 +57,11 @@ else()
|
||||
set(BUILDTYPE_LOWER "release")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(
|
||||
wlroots-hyprland
|
||||
PREFIX ${CMAKE_SOURCE_DIR}/subprojects/wlroots-hyprland
|
||||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/subprojects/wlroots-hyprland
|
||||
CONFIGURE_COMMAND meson setup --reconfigure build --buildtype=${BUILDTYPE_LOWER} -Dwerror=false -Dxwayland=$<IF:$<BOOL:${NO_XWAYLAND}>,disabled,enabled> -Dexamples=false -Drenderers=gles2 -Dbackends=drm,libinput $<IF:$<BOOL:${WITH_ASAN}>,-Db_sanitize=address,-Db_sanitize=none>
|
||||
BUILD_COMMAND ninja -C build
|
||||
BUILD_ALWAYS true
|
||||
BUILD_IN_SOURCE true
|
||||
BUILD_BYPRODUCTS ${CMAKE_SOURCE_DIR}/subprojects/wlroots-hyprland/build/libwlroots.a
|
||||
INSTALL_COMMAND echo "wlroots-hyprland: install not needed"
|
||||
)
|
||||
|
||||
find_package(PkgConfig REQUIRED)
|
||||
|
||||
pkg_get_variable(WaylandScanner wayland-scanner wayland_scanner)
|
||||
message(STATUS "Found WaylandScanner at ${WaylandScanner}")
|
||||
pkg_get_variable(WAYLAND_PROTOCOLS_DIR wayland-protocols pkgdatadir)
|
||||
message(STATUS "Found wayland-protocols at ${WAYLAND_PROTOCOLS_DIR}")
|
||||
pkg_get_variable(WAYLAND_SCANNER_PKGDATA_DIR wayland-scanner pkgdatadir)
|
||||
message(
|
||||
STATUS "Found wayland-scanner pkgdatadir at ${WAYLAND_SCANNER_PKGDATA_DIR}")
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||
message(STATUS "Configuring Hyprland in Debug with CMake")
|
||||
@@ -80,18 +71,21 @@ else()
|
||||
message(STATUS "Configuring Hyprland in Release with CMake")
|
||||
endif()
|
||||
|
||||
include_directories(
|
||||
.
|
||||
"src/"
|
||||
"subprojects/wlroots-hyprland/include/"
|
||||
"subprojects/wlroots-hyprland/build/include/"
|
||||
"subprojects/udis86/"
|
||||
"protocols/")
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
add_compile_definitions(WLR_USE_UNSTABLE)
|
||||
add_compile_options(-Wall -Wextra -Wno-unused-parameter -Wno-unused-value -Wno-missing-field-initializers -Wno-narrowing -Wno-pointer-arith)
|
||||
include_directories(. "src/" "protocols/")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 26)
|
||||
add_compile_options(
|
||||
-Wall
|
||||
-Wextra
|
||||
-Wno-unused-parameter
|
||||
-Wno-unused-value
|
||||
-Wno-missing-field-initializers
|
||||
-Wno-narrowing
|
||||
-Wno-pointer-arith
|
||||
-fmacro-prefix-map=${CMAKE_SOURCE_DIR}/=)
|
||||
|
||||
set(CMAKE_EXECUTABLE_ENABLE_EXPORTS TRUE)
|
||||
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
|
||||
|
||||
message(STATUS "Checking deps...")
|
||||
|
||||
@@ -104,15 +98,36 @@ else()
|
||||
endif()
|
||||
find_package(OpenGL REQUIRED COMPONENTS ${GLES_VERSION})
|
||||
|
||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET
|
||||
xkbcommon uuid
|
||||
wayland-server wayland-client wayland-cursor wayland-protocols
|
||||
cairo pango pangocairo pixman-1
|
||||
libdrm libinput hwdata libseat libdisplay-info libliftoff libudev gbm
|
||||
hyprwayland-scanner>=0.3.4 hyprlang>=0.3.2 hyprcursor>=0.1.7
|
||||
)
|
||||
pkg_check_modules(hyprctl_deps REQUIRED IMPORTED_TARGET hyprutils>=0.2.1)
|
||||
|
||||
file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
|
||||
pkg_check_modules(aquamarine_dep REQUIRED IMPORTED_TARGET aquamarine)
|
||||
|
||||
add_compile_definitions(AQUAMARINE_VERSION="${aquamarine_dep_VERSION}")
|
||||
|
||||
pkg_check_modules(
|
||||
deps
|
||||
REQUIRED
|
||||
IMPORTED_TARGET
|
||||
xkbcommon
|
||||
uuid
|
||||
wayland-server>=1.22.90
|
||||
wayland-protocols
|
||||
cairo
|
||||
pango
|
||||
pangocairo
|
||||
pixman-1
|
||||
xcursor
|
||||
libdrm
|
||||
libinput
|
||||
gbm
|
||||
gio-2.0
|
||||
hyprlang>=0.3.2
|
||||
hyprcursor>=0.1.7
|
||||
hyprutils>=0.2.3)
|
||||
|
||||
find_package(hyprwayland-scanner 0.3.10 REQUIRED)
|
||||
|
||||
file(GLOB_RECURSE SRCFILES "src/*.cpp")
|
||||
|
||||
set(TRACY_CPP_FILES "")
|
||||
if(USE_TRACY)
|
||||
@@ -121,7 +136,8 @@ if(USE_TRACY)
|
||||
endif()
|
||||
|
||||
add_executable(Hyprland ${SRCFILES} ${TRACY_CPP_FILES})
|
||||
add_dependencies(Hyprland wlroots-hyprland)
|
||||
|
||||
set(USE_GPROF ON)
|
||||
|
||||
if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||
message(STATUS "Setting debug flags")
|
||||
@@ -148,8 +164,12 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_compile_options(-pg -no-pie -fno-builtin)
|
||||
add_link_options(-pg -no-pie -fno-builtin)
|
||||
add_compile_options(-fno-pie -fno-builtin)
|
||||
add_link_options(-no-pie -fno-builtin)
|
||||
if(USE_GPROF)
|
||||
add_compile_options(-pg)
|
||||
add_link_options(-pg)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_include_file("execinfo.h" EXECINFOH)
|
||||
@@ -180,12 +200,18 @@ if(NO_XWAYLAND)
|
||||
add_compile_definitions(NO_XWAYLAND)
|
||||
else()
|
||||
message(STATUS "XWAYLAND Enabled (NO_XWAYLAND not defined) checking deps...")
|
||||
pkg_check_modules(xdeps REQUIRED IMPORTED_TARGET xcb xwayland xcb-util xcb-render xcb-xfixes xcb-icccm xcb-composite xcb-res xcb-ewmh)
|
||||
pkg_check_modules(xcb_errors IMPORTED_TARGET xcb-errors)
|
||||
pkg_check_modules(
|
||||
xdeps
|
||||
REQUIRED
|
||||
IMPORTED_TARGET
|
||||
xcb
|
||||
xcb-render
|
||||
xcb-xfixes
|
||||
xcb-icccm
|
||||
xcb-composite
|
||||
xcb-res
|
||||
xcb-errors)
|
||||
target_link_libraries(Hyprland PkgConfig::xdeps)
|
||||
if(xcb_errors_FOUND)
|
||||
target_link_libraries(Hyprland PkgConfig::xcb_errors)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NO_SYSTEMD)
|
||||
@@ -201,87 +227,168 @@ include(CPack)
|
||||
|
||||
message(STATUS "Setting precompiled headers")
|
||||
|
||||
target_precompile_headers(Hyprland PRIVATE $<$<COMPILE_LANGUAGE:CXX>:src/pch/pch.hpp>)
|
||||
target_precompile_headers(Hyprland PRIVATE
|
||||
$<$<COMPILE_LANGUAGE:CXX>:src/pch/pch.hpp>)
|
||||
|
||||
message(STATUS "Setting link libraries")
|
||||
|
||||
target_link_libraries(Hyprland rt PkgConfig::deps)
|
||||
target_link_libraries(Hyprland rt PkgConfig::aquamarine_dep PkgConfig::deps)
|
||||
if(udis_dep_FOUND)
|
||||
target_link_libraries(Hyprland PkgConfig::udis_dep)
|
||||
else()
|
||||
target_link_libraries(Hyprland libudis86)
|
||||
endif()
|
||||
|
||||
function(protocol protoPath protoName external)
|
||||
# used by `make installheaders`, to ensure the headers are generated
|
||||
add_custom_target(generate-protocol-headers)
|
||||
|
||||
function(protocolnew protoPath protoName external)
|
||||
if(external)
|
||||
execute_process(
|
||||
COMMAND ${WaylandScanner} server-header ${protoPath} protocols/${protoName}-protocol.h
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
execute_process(
|
||||
COMMAND ${WaylandScanner} private-code ${protoPath} protocols/${protoName}-protocol.c
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
target_sources(Hyprland PRIVATE protocols/${protoName}-protocol.c)
|
||||
set(path ${protoPath})
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND ${WaylandScanner} server-header ${WAYLAND_PROTOCOLS_DIR}/${protoPath} protocols/${protoName}-protocol.h
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
execute_process(
|
||||
COMMAND ${WaylandScanner} private-code ${WAYLAND_PROTOCOLS_DIR}/${protoPath} protocols/${protoName}-protocol.c
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
target_sources(Hyprland PRIVATE protocols/${protoName}-protocol.c)
|
||||
set(path ${WAYLAND_PROTOCOLS_DIR}/${protoPath})
|
||||
endif()
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_SOURCE_DIR}/protocols/${protoName}.cpp
|
||||
${CMAKE_SOURCE_DIR}/protocols/${protoName}.hpp
|
||||
COMMAND hyprwayland-scanner ${path}/${protoName}.xml
|
||||
${CMAKE_SOURCE_DIR}/protocols/
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
target_sources(Hyprland PRIVATE protocols/${protoName}.cpp
|
||||
protocols/${protoName}.hpp)
|
||||
target_sources(generate-protocol-headers
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/protocols/${protoName}.hpp)
|
||||
endfunction()
|
||||
function(protocolNew protoPath protoName external)
|
||||
if (external)
|
||||
execute_process(
|
||||
COMMAND hyprwayland-scanner ${protoPath} ${CMAKE_SOURCE_DIR}/protocols/
|
||||
function(protocolWayland)
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_SOURCE_DIR}/protocols/wayland.cpp
|
||||
${CMAKE_SOURCE_DIR}/protocols/wayland.hpp
|
||||
COMMAND
|
||||
hyprwayland-scanner --wayland-enums
|
||||
${WAYLAND_SCANNER_PKGDATA_DIR}/wayland.xml ${CMAKE_SOURCE_DIR}/protocols/
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
target_sources(Hyprland PRIVATE protocols/${protoName}.cpp)
|
||||
else()
|
||||
execute_process(
|
||||
COMMAND hyprwayland-scanner ${WAYLAND_PROTOCOLS_DIR}/${protoPath} ${CMAKE_SOURCE_DIR}/protocols/
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
|
||||
target_sources(Hyprland PRIVATE protocols/${protoName}.cpp)
|
||||
endif()
|
||||
target_sources(Hyprland PRIVATE protocols/wayland.cpp protocols/wayland.hpp)
|
||||
target_sources(generate-protocol-headers
|
||||
PRIVATE ${CMAKE_SOURCE_DIR}/protocols/wayland.hpp)
|
||||
endfunction()
|
||||
|
||||
target_link_libraries(Hyprland
|
||||
${CMAKE_SOURCE_DIR}/subprojects/wlroots-hyprland/build/libwlroots.a
|
||||
OpenGL::EGL
|
||||
OpenGL::GL
|
||||
Threads::Threads
|
||||
libudis86
|
||||
uuid
|
||||
)
|
||||
target_link_libraries(Hyprland OpenGL::EGL OpenGL::GL Threads::Threads)
|
||||
|
||||
protocol("protocols/tablet-unstable-v2.xml" "tablet-unstable-v2" true)
|
||||
protocol("protocols/wlr-layer-shell-unstable-v1.xml" "wlr-layer-shell-unstable-v1" true)
|
||||
protocol("protocols/wlr-screencopy-unstable-v1.xml" "wlr-screencopy-unstable-v1" true)
|
||||
protocol("subprojects/hyprland-protocols/protocols/hyprland-global-shortcuts-v1.xml" "hyprland-global-shortcuts-v1" true)
|
||||
protocol("subprojects/hyprland-protocols/protocols/hyprland-toplevel-export-v1.xml" "hyprland-toplevel-export-v1" true)
|
||||
protocol("stable/xdg-shell/xdg-shell.xml" "xdg-shell" false)
|
||||
protocol("unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml" "linux-dmabuf-unstable-v1" false)
|
||||
protocol("unstable/text-input/text-input-unstable-v1.xml" "text-input-unstable-v1" false)
|
||||
pkg_check_modules(hyprland_protocols_dep hyprland-protocols>=0.2.0)
|
||||
if(hyprland_protocols_dep_FOUND)
|
||||
pkg_get_variable(HYPRLAND_PROTOCOLS hyprland-protocols pkgdatadir)
|
||||
message(STATUS "hyprland-protocols dependency set to ${HYPRLAND_PROTOCOLS}")
|
||||
else()
|
||||
set(HYPRLAND_PROTOCOLS "subprojects/hyprland-protocols")
|
||||
message(STATUS "hyprland-protocols subproject set to ${HYPRLAND_PROTOCOLS}")
|
||||
endif()
|
||||
|
||||
protocolNew("protocols/wlr-gamma-control-unstable-v1.xml" "wlr-gamma-control-unstable-v1" true)
|
||||
protocolNew("protocols/wlr-foreign-toplevel-management-unstable-v1.xml" "wlr-foreign-toplevel-management-unstable-v1" true)
|
||||
protocolNew("protocols/wlr-output-power-management-unstable-v1.xml" "wlr-output-power-management-unstable-v1" true)
|
||||
protocolNew("protocols/virtual-keyboard-unstable-v1.xml" "virtual-keyboard-unstable-v1" true)
|
||||
protocolNew("protocols/wlr-virtual-pointer-unstable-v1.xml" "wlr-virtual-pointer-unstable-v1" true)
|
||||
protocolNew("protocols/input-method-unstable-v2.xml" "input-method-unstable-v2" true)
|
||||
protocolNew("protocols/wlr-output-management-unstable-v1.xml" "wlr-output-management-unstable-v1" true)
|
||||
protocolNew("staging/tearing-control/tearing-control-v1.xml" "tearing-control-v1" false)
|
||||
protocolNew("staging/fractional-scale/fractional-scale-v1.xml" "fractional-scale-v1" false)
|
||||
protocolNew("unstable/xdg-output/xdg-output-unstable-v1.xml" "xdg-output-unstable-v1" false)
|
||||
protocolNew("staging/cursor-shape/cursor-shape-v1.xml" "cursor-shape-v1" false)
|
||||
protocolNew("unstable/idle-inhibit/idle-inhibit-unstable-v1.xml" "idle-inhibit-unstable-v1" false)
|
||||
protocolNew("unstable/relative-pointer/relative-pointer-unstable-v1.xml" "relative-pointer-unstable-v1" false)
|
||||
protocolNew("unstable/xdg-decoration/xdg-decoration-unstable-v1.xml" "xdg-decoration-unstable-v1" false)
|
||||
protocolNew("staging/alpha-modifier/alpha-modifier-v1.xml" "alpha-modifier-v1" false)
|
||||
protocolNew("staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml" "ext-foreign-toplevel-list-v1" false)
|
||||
protocolNew("unstable/pointer-gestures/pointer-gestures-unstable-v1.xml" "pointer-gestures-unstable-v1" false)
|
||||
protocolNew("unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml" "keyboard-shortcuts-inhibit-unstable-v1" false)
|
||||
protocolNew("unstable/text-input/text-input-unstable-v3.xml" "text-input-unstable-v3" false)
|
||||
protocolNew("unstable/pointer-constraints/pointer-constraints-unstable-v1.xml" "pointer-constraints-unstable-v1" false)
|
||||
protocolNew("staging/xdg-activation/xdg-activation-v1.xml" "xdg-activation-v1" false)
|
||||
protocolNew("staging/ext-idle-notify/ext-idle-notify-v1.xml" "ext-idle-notify-v1" false)
|
||||
protocolNew("staging/ext-session-lock/ext-session-lock-v1.xml" "ext-session-lock-v1" false)
|
||||
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-global-shortcuts-v1"
|
||||
true)
|
||||
protocolnew("unstable/text-input" "text-input-unstable-v1" false)
|
||||
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-toplevel-export-v1"
|
||||
true)
|
||||
protocolnew("protocols" "wlr-screencopy-unstable-v1" true)
|
||||
protocolnew("protocols" "wlr-gamma-control-unstable-v1" true)
|
||||
protocolnew("protocols" "wlr-foreign-toplevel-management-unstable-v1" true)
|
||||
protocolnew("protocols" "wlr-output-power-management-unstable-v1" true)
|
||||
protocolnew("protocols" "virtual-keyboard-unstable-v1" true)
|
||||
protocolnew("protocols" "wlr-virtual-pointer-unstable-v1" true)
|
||||
protocolnew("protocols" "input-method-unstable-v2" true)
|
||||
protocolnew("protocols" "wlr-output-management-unstable-v1" true)
|
||||
protocolnew("protocols" "kde-server-decoration" true)
|
||||
protocolnew("protocols" "wlr-data-control-unstable-v1" true)
|
||||
protocolnew("${HYPRLAND_PROTOCOLS}/protocols" "hyprland-focus-grab-v1" true)
|
||||
protocolnew("protocols" "wlr-layer-shell-unstable-v1" true)
|
||||
protocolnew("protocols" "wayland-drm" true)
|
||||
protocolnew("staging/tearing-control" "tearing-control-v1" false)
|
||||
protocolnew("staging/fractional-scale" "fractional-scale-v1" false)
|
||||
protocolnew("unstable/xdg-output" "xdg-output-unstable-v1" false)
|
||||
protocolnew("staging/cursor-shape" "cursor-shape-v1" false)
|
||||
protocolnew("unstable/idle-inhibit" "idle-inhibit-unstable-v1" false)
|
||||
protocolnew("unstable/relative-pointer" "relative-pointer-unstable-v1" false)
|
||||
protocolnew("unstable/xdg-decoration" "xdg-decoration-unstable-v1" false)
|
||||
protocolnew("staging/alpha-modifier" "alpha-modifier-v1" false)
|
||||
protocolnew("staging/ext-foreign-toplevel-list" "ext-foreign-toplevel-list-v1"
|
||||
false)
|
||||
protocolnew("unstable/pointer-gestures" "pointer-gestures-unstable-v1" false)
|
||||
protocolnew("unstable/keyboard-shortcuts-inhibit"
|
||||
"keyboard-shortcuts-inhibit-unstable-v1" false)
|
||||
protocolnew("unstable/text-input" "text-input-unstable-v3" false)
|
||||
protocolnew("unstable/pointer-constraints" "pointer-constraints-unstable-v1"
|
||||
false)
|
||||
protocolnew("staging/xdg-activation" "xdg-activation-v1" false)
|
||||
protocolnew("staging/ext-idle-notify" "ext-idle-notify-v1" false)
|
||||
protocolnew("staging/ext-session-lock" "ext-session-lock-v1" false)
|
||||
protocolnew("stable/tablet" "tablet-v2" false)
|
||||
protocolnew("stable/presentation-time" "presentation-time" false)
|
||||
protocolnew("stable/xdg-shell" "xdg-shell" false)
|
||||
protocolnew("unstable/primary-selection" "primary-selection-unstable-v1" false)
|
||||
protocolnew("staging/xwayland-shell" "xwayland-shell-v1" false)
|
||||
protocolnew("stable/viewporter" "viewporter" false)
|
||||
protocolnew("stable/linux-dmabuf" "linux-dmabuf-v1" false)
|
||||
protocolnew("staging/drm-lease" "drm-lease-v1" false)
|
||||
protocolnew("staging/linux-drm-syncobj" "linux-drm-syncobj-v1" false)
|
||||
protocolnew("staging/xdg-dialog" "xdg-dialog-v1" false)
|
||||
protocolnew("staging/single-pixel-buffer" "single-pixel-buffer-v1" false)
|
||||
|
||||
protocolwayland()
|
||||
|
||||
# tools
|
||||
add_subdirectory(hyprctl)
|
||||
add_subdirectory(hyprpm)
|
||||
|
||||
# binary and symlink
|
||||
install(TARGETS Hyprland)
|
||||
|
||||
install(
|
||||
CODE "execute_process( \
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink \
|
||||
${CMAKE_INSTALL_FULL_BINDIR}/Hyprland \
|
||||
\"\$ENV{DESTDIR}${CMAKE_INSTALL_FULL_BINDIR}/hyprland\" \
|
||||
)")
|
||||
|
||||
# session file
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.desktop
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/wayland-sessions)
|
||||
|
||||
# allow Hyprland to find assets
|
||||
add_compile_definitions(DATAROOTDIR="${CMAKE_INSTALL_FULL_DATAROOTDIR}")
|
||||
|
||||
# installable assets
|
||||
file(GLOB_RECURSE INSTALLABLE_ASSETS "assets/install/*")
|
||||
list(FILTER INSTALLABLE_ASSETS EXCLUDE REGEX "meson.build")
|
||||
install(FILES ${INSTALLABLE_ASSETS}
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/hypr)
|
||||
|
||||
# default config
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/example/hyprland.conf
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/hypr)
|
||||
|
||||
# portal config
|
||||
install(FILES ${CMAKE_SOURCE_DIR}/assets/hyprland-portals.conf
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/xdg-desktop-portal)
|
||||
|
||||
# man pages
|
||||
file(GLOB_RECURSE MANPAGES "docs/*.1")
|
||||
install(FILES ${MANPAGES} DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
|
||||
|
||||
# pkgconfig entry
|
||||
install(FILES ${CMAKE_BINARY_DIR}/hyprland.pc
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/pkgconfig)
|
||||
|
||||
# protocol headers
|
||||
set(HEADERS_PROTO "${CMAKE_CURRENT_SOURCE_DIR}/protocols")
|
||||
install(
|
||||
DIRECTORY ${HEADERS_PROTO}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h*")
|
||||
|
||||
# hyprland headers
|
||||
set(HEADERS_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src")
|
||||
install(
|
||||
DIRECTORY ${HEADERS_SRC}
|
||||
DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/hyprland
|
||||
FILES_MATCHING
|
||||
PATTERN "*.h*")
|
||||
|
81
Makefile
@@ -1,87 +1,38 @@
|
||||
PREFIX = /usr/local
|
||||
|
||||
legacyrenderer:
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./buildZ
|
||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
chmod -R 777 ./build
|
||||
|
||||
legacyrendererdebug:
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build -G Ninja
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DLEGACY_RENDERER:BOOL=true -S . -B ./build
|
||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
chmod -R 777 ./build
|
||||
|
||||
release:
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build -G Ninja
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build
|
||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
chmod -R 777 ./build
|
||||
|
||||
debug:
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build -G Ninja
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -S . -B ./build
|
||||
cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
chmod -R 777 ./build
|
||||
|
||||
nopch:
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -S . -B ./build -G Ninja
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} -DCMAKE_DISABLE_PRECOMPILE_HEADERS=ON -S . -B ./build
|
||||
cmake --build ./build --config Release --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
|
||||
clear:
|
||||
rm -rf build
|
||||
rm -f ./protocols/*.h ./protocols/*.c ./protocols/*.cpp ./protocols/*.hpp
|
||||
rm -rf ./subprojects/wlroots-hyprland/build
|
||||
|
||||
all:
|
||||
@if [[ "$EUID" = 0 ]]; then echo -en "Avoid running $(MAKE) all as sudo.\n"; fi
|
||||
$(MAKE) clear
|
||||
$(MAKE) release
|
||||
|
||||
install:
|
||||
@if [ ! -f ./build/Hyprland ]; then echo -en "You need to run $(MAKE) all first.\n" && exit 1; fi
|
||||
@echo -en "!NOTE: Please note make install does not compile Hyprland and only installs the already built files."
|
||||
|
||||
mkdir -p ${PREFIX}/share/wayland-sessions
|
||||
mkdir -p ${PREFIX}/bin
|
||||
mkdir -p ${PREFIX}/share/hyprland
|
||||
mkdir -p ${PREFIX}/share/bash-completion/completions
|
||||
mkdir -p ${PREFIX}/share/fish/vendor_completions.d
|
||||
mkdir -p ${PREFIX}/share/zsh/site-functions
|
||||
cp -f ./build/Hyprland ${PREFIX}/bin
|
||||
cp -f ./build/hyprctl/hyprctl ${PREFIX}/bin
|
||||
cp -f ./build/hyprpm/hyprpm ${PREFIX}/bin
|
||||
cp -f ./hyprctl/hyprctl.bash ${PREFIX}/share/bash-completion/completions/hyprctl
|
||||
cp -f ./hyprctl/hyprctl.fish ${PREFIX}/share/fish/vendor_completions.d/hyprctl.fish
|
||||
cp -f ./hyprctl/hyprctl.zsh ${PREFIX}/share/zsh/site-functions/_hyprctl
|
||||
cp -f ./hyprpm/hyprpm.bash ${PREFIX}/share/bash-completion/completions/hyprpm
|
||||
cp -f ./hyprpm/hyprpm.fish ${PREFIX}/share/fish/vendor_completions.d/hyprpm.fish
|
||||
cp -f ./hyprpm/hyprpm.zsh ${PREFIX}/share/zsh/site-functions/_hyprpm
|
||||
chmod 755 ${PREFIX}/bin/Hyprland
|
||||
chmod 755 ${PREFIX}/bin/hyprctl
|
||||
chmod 755 ${PREFIX}/bin/hyprpm
|
||||
cd ${PREFIX}/bin && ln -sf Hyprland hyprland
|
||||
if [ ! -f ${PREFIX}/share/wayland-sessions/hyprland.desktop ]; then cp ./example/hyprland.desktop ${PREFIX}/share/wayland-sessions; fi
|
||||
cp ./assets/wall* ${PREFIX}/share/hyprland
|
||||
mkdir -p ${PREFIX}/share/xdg-desktop-portal
|
||||
cp ./assets/hyprland-portals.conf ${PREFIX}/share/xdg-desktop-portal
|
||||
|
||||
mkdir -p ${PREFIX}/share/man/man1
|
||||
install -m644 ./docs/*.1 ${PREFIX}/share/man/man1
|
||||
|
||||
$(MAKE) installheaders
|
||||
cmake --install ./build
|
||||
|
||||
uninstall:
|
||||
rm -f ${PREFIX}/share/wayland-sessions/hyprland.desktop
|
||||
rm -f ${PREFIX}/bin/Hyprland
|
||||
rm -f ${PREFIX}/bin/hyprland
|
||||
rm -f ${PREFIX}/bin/hyprctl
|
||||
rm -f ${PREFIX}/bin/hyprpm
|
||||
rm -rf ${PREFIX}/share/hyprland
|
||||
rm -f ${PREFIX}/share/man/man1/Hyprland.1
|
||||
rm -f ${PREFIX}/share/man/man1/hyprctl.1
|
||||
rm -f ${PREFIX}/share/bash-completion/completions/hyprctl
|
||||
rm -f ${PREFIX}/share/fish/vendor_completions.d/hyprctl.fish
|
||||
rm -f ${PREFIX}/share/zsh/site-functions/_hyprctl
|
||||
rm -f ${PREFIX}/share/bash-completion/completions/hyprpm
|
||||
rm -f ${PREFIX}/share/fish/vendor_completions.d/hyprpm.fish
|
||||
rm -f ${PREFIX}/share/zsh/site-functions/_hyprpm
|
||||
xargs rm < ./build/install_manifest.txt
|
||||
|
||||
pluginenv:
|
||||
@echo -en "$(MAKE) pluginenv has been deprecated.\nPlease run $(MAKE) all && sudo $(MAKE) installheaders\n"
|
||||
@@ -90,17 +41,16 @@ pluginenv:
|
||||
installheaders:
|
||||
@if [ ! -f ./src/version.h ]; then echo -en "You need to run $(MAKE) all first.\n" && exit 1; fi
|
||||
|
||||
# remove previous headers from hyprpm's dir
|
||||
rm -fr ${PREFIX}/include/hyprland
|
||||
mkdir -p ${PREFIX}/include/hyprland
|
||||
mkdir -p ${PREFIX}/include/hyprland/protocols
|
||||
mkdir -p ${PREFIX}/include/hyprland/wlroots-hyprland
|
||||
mkdir -p ${PREFIX}/share/pkgconfig
|
||||
|
||||
cmake --build ./build --config Release --target generate-protocol-headers
|
||||
|
||||
find src -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland
|
||||
cd subprojects/wlroots-hyprland/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots-hyprland && cd ../../..
|
||||
cd subprojects/wlroots-hyprland/build/include && find . -name '*.h*' -print0 | cpio --quiet -0dump ${PREFIX}/include/hyprland/wlroots-hyprland && cd ../../../..
|
||||
cp ./protocols/*.h ${PREFIX}/include/hyprland/protocols
|
||||
cp ./protocols/*.hpp ${PREFIX}/include/hyprland/protocols
|
||||
cp ./protocols/*.h* ${PREFIX}/include/hyprland/protocols
|
||||
cp ./build/hyprland.pc ${PREFIX}/share/pkgconfig
|
||||
if [ -d /usr/share/pkgconfig ]; then cp ./build/hyprland.pc /usr/share/pkgconfig 2>/dev/null || true; fi
|
||||
|
||||
@@ -130,11 +80,11 @@ asan:
|
||||
@pidof Hyprland > /dev/null && exit 1 || echo ""
|
||||
|
||||
rm -rf ./wayland
|
||||
git reset --hard
|
||||
#git reset --hard
|
||||
|
||||
@echo -en "If you want to apply a patch, input its path (leave empty for none):\n"
|
||||
@read patchvar
|
||||
@if [-n "$patchvar"]; then patch -p1 < $patchvar || echo ""; else echo "No patch specified"; fi
|
||||
@read patchvar; \
|
||||
if [ -n "$$patchvar" ]; then patch -p1 < "$$patchvar" || echo ""; else echo "No patch specified"; fi
|
||||
|
||||
git clone --recursive https://gitlab.freedesktop.org/wayland/wayland
|
||||
cd wayland && patch -p1 < ../scripts/waylandStatic.diff && meson setup build --buildtype=debug -Db_sanitize=address -Ddocumentation=false && ninja -C build && cd ..
|
||||
@@ -143,8 +93,7 @@ asan:
|
||||
|
||||
patch -p1 < ./scripts/hyprlandStaticAsan.diff
|
||||
cmake --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Debug -DWITH_ASAN:STRING=True -DUSE_TRACY:STRING=False -DUSE_TRACY_GPU:STRING=False -S . -B ./build -G Ninja
|
||||
cmake --build ./build --config Debug --target all -j`nproc 2>/dev/null || getconf NPROCESSORS_CONF`
|
||||
cmake --build ./build --config Debug --target all
|
||||
@echo "Hyprland done"
|
||||
|
||||
ASAN_OPTIONS="detect_odr_violation=0,log_path=asan.log" HYPRLAND_NO_CRASHREPORTER=1 ./build/Hyprland -c ~/.config/hypr/hyprland.conf
|
||||
|
||||
|
12
README.md
@@ -1,6 +1,6 @@
|
||||
<div align = center>
|
||||
|
||||
<img src="https://raw.githubusercontent.com/vaxerski/Hyprland/main/assets/header.svg" width="750" height="300" alt="banner">
|
||||
<img src="https://raw.githubusercontent.com/hyprwm/Hyprland/main/assets/header.svg" width="750" height="300" alt="banner">
|
||||
|
||||
<br>
|
||||
|
||||
@@ -13,10 +13,10 @@
|
||||
|
||||
<br>
|
||||
|
||||
Hyprland is a dynamic tiling Wayland compositor based on wlroots that doesn't sacrifice on its looks.
|
||||
Hyprland is a 100% independent, dynamic tiling Wayland compositor that doesn't sacrifice on its looks.
|
||||
|
||||
It provides the latest Wayland features, is highly customizable, has all the eyecandy, the most powerful plugins,
|
||||
easy IPC, much more QoL stuff than other wlr-based compositors and more...
|
||||
easy IPC, much more QoL stuff than other compositors and more...
|
||||
<br>
|
||||
<br>
|
||||
|
||||
@@ -37,7 +37,7 @@ easy IPC, much more QoL stuff than other wlr-based compositors and more...
|
||||
|
||||
- All of the eyecandy: gradient borders, blur, animations, shadows and much more
|
||||
- A lot of customization
|
||||
- Much more QoL stuff than other wlr-based compositors
|
||||
- 100% independent, no wlroots, no libweston, no kwin, no mutter.
|
||||
- Custom bezier curves for the best animations
|
||||
- Powerful plugin support
|
||||
- Built-in plugin manager
|
||||
@@ -48,7 +48,6 @@ easy IPC, much more QoL stuff than other wlr-based compositors and more...
|
||||
- Config reloaded instantly upon saving
|
||||
- Fully dynamic workspaces
|
||||
- Two built-in layouts and more available as plugins
|
||||
- Uses forked wlroots with QoL patches
|
||||
- Global keybinds passed to your apps of choice
|
||||
- Tiling/pseudotiling/floating/fullscreen windows
|
||||
- Special workspaces (scratchpads)
|
||||
@@ -86,7 +85,7 @@ easy IPC, much more QoL stuff than other wlr-based compositors and more...
|
||||
|
||||
<br>
|
||||
|
||||
**[wlroots]** - *For their amazing library*
|
||||
**[wlroots]** - *For powering Hyprland in the past*
|
||||
|
||||
**[tinywl]** - *For showing how 2 do stuff*
|
||||
|
||||
@@ -126,7 +125,6 @@ easy IPC, much more QoL stuff than other wlr-based compositors and more...
|
||||
|
||||
<!----------------------------------{ Images }--------------------------------->
|
||||
|
||||
[Stars Preview]: https://starchart.cc/vaxerski/Hyprland.svg
|
||||
[Preview A]: https://i.ibb.co/C1yTb0r/falf.png
|
||||
[Preview B]: https://linfindel.github.io/cdn/hyprland-preview-b.png
|
||||
[Preview C]: https://i.ibb.co/B3GJg28/20221126-20h53m26s-grim.png
|
||||
|
BIN
assets/install/lockdead.png
Normal file
After Width: | Height: | Size: 110 KiB |
BIN
assets/install/lockdead2.png
Normal file
After Width: | Height: | Size: 48 KiB |
10
assets/install/meson.build
Normal file
@@ -0,0 +1,10 @@
|
||||
globber = run_command('sh', '-c', 'find . -type f -not -name "*.build"', check: true)
|
||||
files = globber.stdout().strip().split('\n')
|
||||
|
||||
foreach file : files
|
||||
install_data(
|
||||
file,
|
||||
install_dir: join_paths(get_option('datadir'), 'hypr'),
|
||||
install_tag: 'runtime',
|
||||
)
|
||||
endforeach
|
Before Width: | Height: | Size: 14 MiB After Width: | Height: | Size: 14 MiB |
Before Width: | Height: | Size: 5.9 MiB After Width: | Height: | Size: 5.9 MiB |
Before Width: | Height: | Size: 27 MiB After Width: | Height: | Size: 27 MiB |
@@ -1,7 +1,7 @@
|
||||
wallpapers = ['0', '1', '2']
|
||||
install_data(
|
||||
'hyprland-portals.conf',
|
||||
install_dir: join_paths(get_option('datadir'), 'xdg-desktop-portal'),
|
||||
install_tag: 'runtime',
|
||||
)
|
||||
|
||||
foreach type : wallpapers
|
||||
install_data(f'wall@type@.png', install_dir: join_paths(get_option('datadir'), 'hyprland'), install_tag: 'runtime')
|
||||
endforeach
|
||||
|
||||
install_data('hyprland-portals.conf', install_dir: join_paths(get_option('datadir'), 'xdg-desktop-portal'), install_tag: 'runtime')
|
||||
subdir('install')
|
||||
|
@@ -10,8 +10,8 @@ Hyprland - Dynamic tiling Wayland compositor
|
||||
\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.
|
||||
\f[B]Hyprland\f[R] is an independent, highly customizable, dynamic
|
||||
tiling Wayland compositor 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.
|
||||
@@ -32,6 +32,12 @@ Show command usage.
|
||||
.TP
|
||||
\f[B]-c\f[R], \f[B]--config\f[R]
|
||||
Specify config file to use.
|
||||
.TP
|
||||
\f[B]--socket\f[R]
|
||||
Sets the Wayland socket name (for Wayland socket handover)
|
||||
.TP
|
||||
\f[B]--wayland-fd\f[R]
|
||||
Sets the Wayland socket file descriptor (for Wayland socket handover)
|
||||
.SH BUGS
|
||||
.TP
|
||||
Submit bug reports and request features online at:
|
||||
|
@@ -14,8 +14,8 @@ SYNOPSIS
|
||||
DESCRIPTION
|
||||
===========
|
||||
|
||||
**Hyprland** is a dynamic tiling Wayland compositor based on
|
||||
wlroots that doesn't sacrifice on its looks.
|
||||
**Hyprland** is an independent, highly customizable,
|
||||
dynamic tiling Wayland compositor 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.
|
||||
@@ -41,6 +41,12 @@ OPTIONS
|
||||
**-c**, **--config**
|
||||
Specify config file to use.
|
||||
|
||||
**--socket**
|
||||
Sets the Wayland socket name (for Wayland socket handover)
|
||||
|
||||
**--wayland-fd**
|
||||
Sets the Wayland socket file descriptor (for Wayland socket handover)
|
||||
|
||||
BUGS
|
||||
====
|
||||
|
||||
|
14
example/hyprland-session.service
Normal file
@@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=Hyprland - Tiling compositor with the looks
|
||||
Documentation=man:Hyprland(1)
|
||||
BindsTo=graphical-session.target
|
||||
Before=graphical-session.target
|
||||
Wants=graphical-session-pre.target
|
||||
After=graphical-session-pre.target
|
||||
|
||||
[Service]
|
||||
Type=notify
|
||||
ExecStart=/usr/bin/Hyprland
|
||||
ExecStop=/usr/bin/hyprctl dispatch exit
|
||||
Restart=on-failure
|
||||
Slice=session.slice
|
5
example/hyprland-systemd.desktop
Normal file
@@ -0,0 +1,5 @@
|
||||
[Desktop Entry]
|
||||
Name=Hyprland
|
||||
Comment=An intelligent dynamic tiling Wayland compositor
|
||||
Exec=systemctl --user start --wait hyprland-session
|
||||
Type=Application
|
@@ -125,7 +125,7 @@ dwindle {
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
|
||||
master {
|
||||
new_is_master = true
|
||||
new_status = master
|
||||
}
|
||||
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#misc
|
||||
@@ -169,9 +169,9 @@ device {
|
||||
}
|
||||
|
||||
|
||||
####################
|
||||
### KEYBINDINGSS ###
|
||||
####################
|
||||
###################
|
||||
### KEYBINDINGS ###
|
||||
###################
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Keywords/
|
||||
$mainMod = SUPER # Sets "Windows" key as main modifier
|
||||
@@ -228,6 +228,19 @@ bind = $mainMod, mouse_up, workspace, e-1
|
||||
bindm = $mainMod, mouse:272, movewindow
|
||||
bindm = $mainMod, mouse:273, resizewindow
|
||||
|
||||
# Laptop multimedia keys for volume and LCD brightness
|
||||
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume -l 1 @DEFAULT_AUDIO_SINK@ 5%+
|
||||
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
|
||||
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
||||
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
|
||||
bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+
|
||||
bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-
|
||||
|
||||
# Requires playerctl
|
||||
bindl = , XF86AudioNext, exec, playerctl next
|
||||
bindl = , XF86AudioPause, exec, playerctl play-pause
|
||||
bindl = , XF86AudioPlay, exec, playerctl play-pause
|
||||
bindl = , XF86AudioPrev, exec, playerctl previous
|
||||
|
||||
##############################
|
||||
### WINDOWS AND WORKSPACES ###
|
||||
@@ -242,4 +255,8 @@ bindm = $mainMod, mouse:273, resizewindow
|
||||
# Example windowrule v2
|
||||
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
||||
|
||||
windowrulev2 = suppressevent maximize, class:.* # You'll probably like this.
|
||||
# Ignore maximize requests from apps. You'll probably like this.
|
||||
windowrulev2 = suppressevent maximize, class:.*
|
||||
|
||||
# Fix some dragging issues with XWayland
|
||||
windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0
|
||||
|
@@ -1,2 +1,10 @@
|
||||
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')
|
||||
install_data(
|
||||
'hyprland.conf',
|
||||
install_dir: join_paths(get_option('datadir'), 'hypr'),
|
||||
install_tag: 'runtime',
|
||||
)
|
||||
install_data(
|
||||
'hyprland.desktop',
|
||||
install_dir: join_paths(get_option('datadir'), 'wayland-sessions'),
|
||||
install_tag: 'runtime',
|
||||
)
|
||||
|
146
flake.lock
generated
@@ -1,5 +1,34 @@
|
||||
{
|
||||
"nodes": {
|
||||
"aquamarine": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprutils"
|
||||
],
|
||||
"hyprwayland-scanner": [
|
||||
"hyprwayland-scanner"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1727261104,
|
||||
"narHash": "sha256-rxDI7WrxIRV9it9mDCHcLa7xQykf1JloXnoXr5xQ8zI=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "aquamarine",
|
||||
"rev": "b82fdaff917582a9d568969e15e61b398c71e990",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "aquamarine",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprcursor": {
|
||||
"inputs": {
|
||||
"hyprlang": [
|
||||
@@ -13,11 +42,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1713612213,
|
||||
"narHash": "sha256-zJboXgWNpNhKyNF8H/3UYzWkx7w00TOCGKi3cwi+tsw=",
|
||||
"lastModified": 1727532803,
|
||||
"narHash": "sha256-ZaZ7h7PY8mQc4vtGmVqWLAq9CAO02gHMyNR5yY8zDmM=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprcursor",
|
||||
"rev": "cab4746180f210a3c1dd3d53e45c510e309e90e1",
|
||||
"rev": "b98726e431d4d3ed58bd58bee1047cdb81cec69f",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -36,11 +65,36 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1691753796,
|
||||
"narHash": "sha256-zOEwiWoXk3j3+EoF3ySUJmberFewWlagvewDRuWYAso=",
|
||||
"lastModified": 1727451107,
|
||||
"narHash": "sha256-qV9savtHwmZUa0eJE294WYJjKPGB2+bJhwByFShsVyo=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprland-protocols",
|
||||
"rev": "0c2ce70625cb30aef199cb388f99e19a61a6ce03",
|
||||
"rev": "6b3261ee13a6d2b99de79a31d352f6996e35bde3",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprland-protocols",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprland-protocols_2": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"xdph",
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"xdph",
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1721326555,
|
||||
"narHash": "sha256-zCu4R0CSHEactW9JqYki26gy8h9f6rHmSwj4XJmlHgg=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprland-protocols",
|
||||
"rev": "5a11232266bf1a1f5952d5b179c3f4b2facaaa84",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -51,6 +105,9 @@
|
||||
},
|
||||
"hyprlang": {
|
||||
"inputs": {
|
||||
"hyprutils": [
|
||||
"hyprutils"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
@@ -59,11 +116,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1713121246,
|
||||
"narHash": "sha256-502X0Q0fhN6tJK7iEUA8CghONKSatW/Mqj4Wappd++0=",
|
||||
"lastModified": 1725997860,
|
||||
"narHash": "sha256-d/rZ/fHR5l1n7PeyLw0StWMNLXVU9c4HFyfskw568so=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprlang",
|
||||
"rev": "78fcaa27ae9e1d782faa3ff06c8ea55ddce63706",
|
||||
"rev": "dfeb5811dd6485490cce18d6cc1e38a055eea876",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -72,6 +129,29 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprutils": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
"systems": [
|
||||
"systems"
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1727300645,
|
||||
"narHash": "sha256-OvAtVLaSRPnbXzOwlR1fVqCXR7i+ICRX3aPMCdIiv+c=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprutils",
|
||||
"rev": "3f5293432b6dc6a99f26aca2eba3876d2660665c",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprutils",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"hyprwayland-scanner": {
|
||||
"inputs": {
|
||||
"nixpkgs": [
|
||||
@@ -82,11 +162,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714755542,
|
||||
"narHash": "sha256-D0pg+ZRwrt4lavZ97Ca8clsgbPA3duLj8iEM7riaIFY=",
|
||||
"lastModified": 1726874836,
|
||||
"narHash": "sha256-VKR0sf0PSNCB0wPHVKSAn41mCNVCnegWmgkrneKDhHM=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "hyprwayland-scanner",
|
||||
"rev": "1270ebaa539e56d61b708c24b072b09cbbd3a828",
|
||||
"rev": "500c81a9e1a76760371049a8d99e008ea77aa59e",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -97,11 +177,11 @@
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1714253743,
|
||||
"narHash": "sha256-mdTQw2XlariysyScCv2tTE45QSU9v/ezLcHJ22f0Nxc=",
|
||||
"lastModified": 1727348695,
|
||||
"narHash": "sha256-J+PeFKSDV+pHL7ukkfpVzCOO7mBSrrpJ3svwBFABbhI=",
|
||||
"owner": "NixOS",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "58a1abdbae3217ca6b702f03d3b35125d88a2994",
|
||||
"rev": "1925c603f17fc89f4c8f6bf6f631a802ad85d784",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
@@ -113,13 +193,14 @@
|
||||
},
|
||||
"root": {
|
||||
"inputs": {
|
||||
"aquamarine": "aquamarine",
|
||||
"hyprcursor": "hyprcursor",
|
||||
"hyprland-protocols": "hyprland-protocols",
|
||||
"hyprlang": "hyprlang",
|
||||
"hyprutils": "hyprutils",
|
||||
"hyprwayland-scanner": "hyprwayland-scanner",
|
||||
"nixpkgs": "nixpkgs",
|
||||
"systems": "systems",
|
||||
"wlroots": "wlroots",
|
||||
"xdph": "xdph"
|
||||
}
|
||||
},
|
||||
@@ -138,31 +219,18 @@
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"wlroots": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1713731601,
|
||||
"narHash": "sha256-bdcKdtLkusvv85DNuJsajZLFeq7bXp+x5AGP1Sd4wD8=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "wlroots-hyprland",
|
||||
"rev": "5c1d51c5a2793480f5b6c4341ad0797052aec2ea",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "hyprwm",
|
||||
"repo": "wlroots-hyprland",
|
||||
"rev": "5c1d51c5a2793480f5b6c4341ad0797052aec2ea",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"xdph": {
|
||||
"inputs": {
|
||||
"hyprland-protocols": [
|
||||
"hyprland-protocols"
|
||||
],
|
||||
"hyprland-protocols": "hyprland-protocols_2",
|
||||
"hyprlang": [
|
||||
"hyprlang"
|
||||
],
|
||||
"hyprutils": [
|
||||
"hyprutils"
|
||||
],
|
||||
"hyprwayland-scanner": [
|
||||
"hyprwayland-scanner"
|
||||
],
|
||||
"nixpkgs": [
|
||||
"nixpkgs"
|
||||
],
|
||||
@@ -171,11 +239,11 @@
|
||||
]
|
||||
},
|
||||
"locked": {
|
||||
"lastModified": 1714060055,
|
||||
"narHash": "sha256-j43TS9wv9luaAlpxcxw0sjxkbcc2mGANVR2RYgo3RCw=",
|
||||
"lastModified": 1727524473,
|
||||
"narHash": "sha256-1DGktDtSWIJpnDbVoj/qpvJSH5zg6JbOfuh6xqZMap0=",
|
||||
"owner": "hyprwm",
|
||||
"repo": "xdg-desktop-portal-hyprland",
|
||||
"rev": "0fe840441e43da12cd7865ed9aa8cdc35a8da85a",
|
||||
"rev": "7e500e679ede40e79cf2d89b5f5fa3e34923bd26",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
|
52
flake.nix
@@ -7,12 +7,12 @@
|
||||
# <https://github.com/nix-systems/nix-systems>
|
||||
systems.url = "github:nix-systems/default-linux";
|
||||
|
||||
wlroots = {
|
||||
type = "github";
|
||||
owner = "hyprwm";
|
||||
repo = "wlroots-hyprland";
|
||||
rev = "5c1d51c5a2793480f5b6c4341ad0797052aec2ea";
|
||||
flake = false;
|
||||
aquamarine = {
|
||||
url = "github:hyprwm/aquamarine";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.systems.follows = "systems";
|
||||
inputs.hyprutils.follows = "hyprutils";
|
||||
inputs.hyprwayland-scanner.follows = "hyprwayland-scanner";
|
||||
};
|
||||
|
||||
hyprcursor = {
|
||||
@@ -32,6 +32,13 @@
|
||||
url = "github:hyprwm/hyprlang";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.systems.follows = "systems";
|
||||
inputs.hyprutils.follows = "hyprutils";
|
||||
};
|
||||
|
||||
hyprutils = {
|
||||
url = "github:hyprwm/hyprutils";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.systems.follows = "systems";
|
||||
};
|
||||
|
||||
hyprwayland-scanner = {
|
||||
@@ -44,8 +51,9 @@
|
||||
url = "github:hyprwm/xdg-desktop-portal-hyprland";
|
||||
inputs.nixpkgs.follows = "nixpkgs";
|
||||
inputs.systems.follows = "systems";
|
||||
inputs.hyprland-protocols.follows = "hyprland-protocols";
|
||||
inputs.hyprlang.follows = "hyprlang";
|
||||
inputs.hyprutils.follows = "hyprutils";
|
||||
inputs.hyprwayland-scanner.follows = "hyprwayland-scanner";
|
||||
};
|
||||
};
|
||||
|
||||
@@ -65,6 +73,15 @@
|
||||
hyprland-extras
|
||||
];
|
||||
});
|
||||
pkgsCrossFor = eachSystem (system: crossSystem:
|
||||
import nixpkgs {
|
||||
localSystem = system;
|
||||
crossSystem = crossSystem;
|
||||
overlays = with self.overlays; [
|
||||
hyprland-packages
|
||||
hyprland-extras
|
||||
];
|
||||
});
|
||||
in {
|
||||
overlays = import ./nix/overlays.nix {inherit self lib inputs;};
|
||||
|
||||
@@ -89,27 +106,19 @@
|
||||
# hyprland-extras
|
||||
|
||||
xdg-desktop-portal-hyprland
|
||||
# dependencies
|
||||
|
||||
hyprland-protocols
|
||||
wlroots-hyprland
|
||||
udis86
|
||||
;
|
||||
hyprland-cross = (pkgsCrossFor.${system} "aarch64-linux").hyprland;
|
||||
});
|
||||
|
||||
devShells = eachSystem (system: {
|
||||
default =
|
||||
pkgsFor.${system}.mkShell.override {
|
||||
stdenv = pkgsFor.${system}.gcc13Stdenv;
|
||||
inherit (self.packages.${system}.default) stdenv;
|
||||
} {
|
||||
name = "hyprland-shell";
|
||||
nativeBuildInputs = with pkgsFor.${system}; [cmake python3 expat libxml2];
|
||||
buildInputs = [self.packages.${system}.wlroots-hyprland];
|
||||
hardeningDisable = ["fortify"];
|
||||
inputsFrom = [
|
||||
self.packages.${system}.wlroots-hyprland
|
||||
self.packages.${system}.hyprland
|
||||
];
|
||||
inputsFrom = [pkgsFor.${system}.hyprland];
|
||||
packages = [pkgsFor.${system}.clang-tools];
|
||||
};
|
||||
});
|
||||
|
||||
@@ -118,9 +127,4 @@
|
||||
nixosModules.default = import ./nix/module.nix inputs;
|
||||
homeManagerModules.default = import ./nix/hm-module.nix self;
|
||||
};
|
||||
|
||||
nixConfig = {
|
||||
extra-substituters = ["https://hyprland.cachix.org"];
|
||||
extra-trusted-public-keys = ["hyprland.cachix.org-1:a7pgxzMz7+chwVL3/pzj6jIBMioiJM7ypFP8PwtkuGc="];
|
||||
};
|
||||
}
|
||||
|
@@ -5,4 +5,21 @@ project(
|
||||
DESCRIPTION "Control utility for Hyprland"
|
||||
)
|
||||
|
||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET hyprutils>=0.1.1)
|
||||
|
||||
add_executable(hyprctl "main.cpp")
|
||||
|
||||
target_link_libraries(hyprctl PUBLIC PkgConfig::hyprctl_deps)
|
||||
|
||||
# binary
|
||||
install(TARGETS hyprctl)
|
||||
|
||||
# shell completions
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprctl.bash
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions
|
||||
RENAME hyprctl)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprctl.fish
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/fish/vendor_completions.d)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprctl.zsh
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions
|
||||
RENAME _hyprctl)
|
||||
|
@@ -1,4 +0,0 @@
|
||||
all:
|
||||
$(CXX) $(CXXFLAGS) -std=c++2b ./main.cpp -o ./hyprctl
|
||||
clean:
|
||||
rm ./hyprctl
|
@@ -38,7 +38,8 @@ commands:
|
||||
plugin ... → Issue a plugin request
|
||||
reload [config-only] → Issue a reload to force reload the config. Pass
|
||||
'config-only' to disable monitor reload
|
||||
rollinglog → Prints tail of the log
|
||||
rollinglog → Prints tail of the log. Also supports -f/--follow
|
||||
option
|
||||
setcursor <theme> <size> → Sets the cursor theme and reloads the cursor
|
||||
manager
|
||||
seterror <color> <message...> → Sets the hyprctl error string. Color has
|
||||
@@ -60,6 +61,7 @@ flags:
|
||||
--batch → Execute a batch of commands, separated by ';'
|
||||
--instance (-i) → use a specific instance. Can be either signature or
|
||||
index in hyprctl instances (0, 1, etc)
|
||||
--quiet (-q) → Disable the output of hyprctl
|
||||
|
||||
--help:
|
||||
Can be used to print command's arguments that did not fit into this page
|
||||
|
@@ -1,19 +1,19 @@
|
||||
_hyprctl_cmd_2 () {
|
||||
hyprctl monitors | grep Monitor | awk '{ print $2 }'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_1 () {
|
||||
hyprpm list | grep "Plugin" | awk '{print $4}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_0 () {
|
||||
hyprctl clients | grep class | awk '{print $2}'
|
||||
hyprctl monitors | awk '/Monitor/{ print $2 }'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_3 () {
|
||||
hyprctl clients | awk '/class/{print $2}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_2 () {
|
||||
hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_0 () {
|
||||
hyprpm list | awk '/Plugin/{print $4}'
|
||||
}
|
||||
|
||||
_hyprctl () {
|
||||
if [[ $(type -t _get_comp_words_by_ref) != function ]]; then
|
||||
echo _get_comp_words_by_ref: function not defined. Make sure the bash-completions system package is installed
|
||||
@@ -23,25 +23,25 @@ _hyprctl () {
|
||||
local words cword
|
||||
_get_comp_words_by_ref -n "$COMP_WORDBREAKS" words cword
|
||||
|
||||
local -a literals=("cyclenext" "globalshortcuts" "cursorpos" "bordersize" "renameworkspace" "animationstyle" "focuswindow" "0" "auto" "swapnext" "forceallowsinput" "moveactive" "activebordercolor" "alphafullscreen" "wayland" "layers" "minsize" "monitors" "1" "kill" "settiled" "3" "focusmonitor" "swapwindow" "moveoutofgroup" "notify" "movecursor" "setcursor" "seterror" "movecurrentworkspacetomonitor" "4" "nomaxsize" "forcenoanims" "setprop" "-i" "togglefloating" "workspacerules" "movetoworkspace" "disable" "setignoregrouplock" "workspaces" "movegroupwindow" "closewindow" "0" "--instance" "binds" "movewindow" "splitratio" "alpha" "denywindowfromgroup" "workspace" "configerrors" "togglegroup" "getoption" "forceopaque" "keepaspectratio" "killactive" "pass" "decorations" "devices" "focuscurrentorlast" "submap" "global" "alphafullscreenoverride" "forcerendererreload" "movewindowpixel" "headless" "version" "dpms" "resizeactive" "moveintogroup" "5" "alphaoverride" "setfloating" "rollinglog" "::=" "rounding" "layouts" "moveworkspacetomonitor" "exec" "alphainactiveoverride" "alterzorder" "fakefullscreen" "nofocus" "keyword" "forcenoborder" "forcenodim" "pin" "output" "forcenoblur" "togglespecialworkspace" "fullscreen" "toggleopaque" "focusworkspaceoncurrentmonitor" "next" "changegroupactive" "-j" "instances" "execr" "exit" "clients" "all" "--batch" "dismissnotify" "inactivebordercolor" "switchxkblayout" "movetoworkspacesilent" "movewindoworgroup" "-r" "movefocus" "focusurgentorlast" "remove" "activeworkspace" "dispatch" "create" "centerwindow" "2" "hyprpaper" "-1" "reload" "alphainactive" "systeminfo" "plugin" "dimaround" "activewindow" "swapactiveworkspaces" "splash" "maxsize" "lockactivegroup" "windowdancecompat" "forceopaqueoverriden" "lockgroups" "movecursortocorner" "x11" "prev" "1" "resizewindowpixel" "forcenoshadow")
|
||||
|
||||
declare -a literals=(resizeactive 2 changegroupactive -r moveintogroup forceallowsinput 4 ::= systeminfo all layouts setprop animationstyle switchxkblayout create denywindowfromgroup headless activebordercolor exec setcursor wayland focusurgentorlast workspacerules movecurrentworkspacetomonitor movetoworkspacesilent hyprpaper alpha inactivebordercolor movegroupwindow movecursortocorner movewindowpixel prev movewindow globalshortcuts clients dimaround setignoregrouplock splash execr monitors 0 forcenoborder -q animations 1 nomaxsize splitratio moveactive pass swapnext devices layers rounding lockactivegroup 5 moveworkspacetomonitor -f -i --quiet forcenodim pin 0 1 forceopaque forcenoshadow setfloating minsize alphaoverride sendshortcut workspaces cyclenext alterzorder togglegroup lockgroups bordersize dpms focuscurrentorlast -1 --batch notify remove instances 1 3 moveoutofgroup killactive 2 movetoworkspace movecursor configerrors closewindow swapwindow tagwindow forcerendererreload centerwindow auto focuswindow seterror nofocus alphafullscreen binds version -h togglespecialworkspace fullscreen windowdancecompat 0 keyword toggleopaque 3 --instance togglefloating renameworkspace alphafullscreenoverride activeworkspace x11 kill forceopaqueoverriden output global dispatch reload forcenoblur -j event --help disable -1 activewindow keepaspectratio dismissnotify focusmonitor movefocus plugin exit workspace fullscreenstate getoption alphainactiveoverride alphainactive decorations settiled config-only descriptions resizewindowpixel fakefullscreen rollinglog swapactiveworkspaces submap next movewindoworgroup cursorpos forcenoanims focusworkspaceoncurrentmonitor maxsize)
|
||||
declare -A literal_transitions
|
||||
literal_transitions[0]="([103]=1 [74]=2 [33]=3 [1]=2 [2]=2 [77]=2 [105]=4 [36]=2 [108]=5 [40]=2 [45]=2 [112]=2 [84]=6 [113]=8 [51]=2 [53]=2 [88]=9 [117]=2 [119]=2 [121]=2 [15]=2 [58]=10 [59]=2 [17]=11 [122]=12 [19]=2 [124]=2 [126]=2 [25]=13 [67]=2 [96]=5 [97]=2 [27]=2 [28]=14 [100]=2 [102]=5)"
|
||||
literal_transitions[3]="([72]=18 [13]=2 [32]=18 [54]=18 [55]=18 [89]=18 [104]=2 [120]=2 [76]=1 [16]=2 [123]=18 [3]=1 [5]=2 [63]=18 [127]=2 [129]=18 [80]=18 [130]=18 [83]=18 [31]=18 [48]=2 [12]=2 [85]=18 [10]=18 [86]=18 [137]=18)"
|
||||
literal_transitions[7]="([103]=1 [74]=2 [33]=3 [1]=2 [2]=2 [77]=2 [105]=4 [36]=2 [40]=2 [45]=2 [112]=2 [84]=6 [113]=8 [51]=2 [53]=2 [88]=9 [117]=2 [119]=2 [121]=2 [15]=2 [58]=10 [59]=2 [17]=11 [122]=12 [19]=2 [124]=2 [126]=2 [25]=13 [67]=2 [97]=2 [27]=2 [28]=14 [100]=2)"
|
||||
literal_transitions[8]="([128]=2 [131]=2 [0]=2 [73]=2 [35]=2 [106]=2 [37]=2 [107]=2 [4]=2 [78]=2 [39]=2 [79]=2 [110]=2 [6]=2 [41]=2 [42]=2 [81]=2 [82]=2 [46]=2 [47]=2 [9]=2 [109]=2 [50]=2 [52]=2 [11]=2 [115]=2 [87]=2 [49]=2 [56]=2 [90]=2 [57]=2 [91]=2 [92]=2 [60]=2 [61]=2 [125]=2 [93]=2 [62]=2 [20]=2 [95]=2 [22]=2 [23]=2 [64]=2 [65]=2 [24]=2 [132]=2 [26]=2 [68]=2 [98]=2 [69]=2 [29]=2 [136]=2 [70]=2 [99]=2)"
|
||||
literal_transitions[9]="([114]=15 [111]=16)"
|
||||
literal_transitions[11]="([101]=2)"
|
||||
literal_transitions[13]="([21]=1 [116]=1 [30]=1 [135]=1 [118]=1 [43]=1 [71]=1)"
|
||||
literal_transitions[14]="([38]=2)"
|
||||
literal_transitions[15]="([8]=2 [66]=2 [14]=2 [133]=2)"
|
||||
literal_transitions[17]="([75]=19)"
|
||||
literal_transitions[18]="([18]=2 [7]=2)"
|
||||
literal_transitions[19]="([34]=5 [44]=5)"
|
||||
literal_transitions[20]="([134]=2 [94]=2)"
|
||||
|
||||
declare -A match_anything_transitions
|
||||
match_anything_transitions=([1]=2 [0]=7 [6]=2 [20]=2 [10]=2 [2]=17 [7]=7 [12]=2 [14]=17 [16]=2 [4]=20 [11]=17)
|
||||
literal_transitions[0]="([120]=14 [43]=2 [125]=21 [81]=2 [3]=21 [51]=2 [50]=2 [128]=2 [89]=2 [58]=21 [8]=2 [10]=2 [11]=3 [130]=4 [13]=5 [97]=6 [101]=2 [102]=21 [133]=7 [100]=2 [137]=2 [22]=2 [19]=2 [140]=8 [25]=2 [143]=2 [107]=9 [146]=10 [69]=2 [33]=2 [34]=2 [78]=21 [114]=2 [37]=2 [151]=2 [116]=2 [121]=13 [123]=21 [39]=11 [42]=21 [79]=15 [118]=12)"
|
||||
literal_transitions[1]="([81]=2 [51]=2 [50]=2 [128]=2 [8]=2 [89]=2 [10]=2 [11]=3 [130]=4 [13]=5 [97]=6 [101]=2 [133]=7 [100]=2 [22]=2 [19]=2 [137]=2 [140]=8 [25]=2 [143]=2 [107]=9 [146]=10 [69]=2 [33]=2 [34]=2 [114]=2 [37]=2 [151]=2 [116]=2 [39]=11 [118]=12 [121]=13 [120]=14 [79]=15 [43]=2)"
|
||||
literal_transitions[3]="([139]=2 [63]=16 [64]=16 [45]=16 [105]=16 [27]=2 [26]=2 [52]=4 [5]=16 [66]=2 [67]=16 [129]=16 [113]=16 [12]=2 [74]=4 [99]=2 [35]=16 [152]=16 [98]=16 [59]=16 [117]=16 [41]=16 [17]=2 [138]=16 [154]=2 [122]=16)"
|
||||
literal_transitions[6]="([126]=2)"
|
||||
literal_transitions[10]="([56]=2)"
|
||||
literal_transitions[11]="([9]=2)"
|
||||
literal_transitions[12]="([14]=19 [80]=22)"
|
||||
literal_transitions[13]="([142]=2)"
|
||||
literal_transitions[14]="([0]=2 [84]=2 [2]=2 [85]=2 [4]=2 [87]=2 [88]=2 [90]=2 [91]=2 [92]=2 [93]=2 [94]=2 [96]=2 [15]=2 [18]=2 [103]=2 [21]=2 [104]=2 [23]=2 [24]=2 [28]=2 [29]=2 [30]=2 [108]=2 [111]=2 [32]=2 [112]=2 [36]=2 [38]=2 [119]=2 [124]=2 [46]=2 [47]=2 [48]=2 [49]=2 [53]=2 [55]=2 [131]=2 [132]=2 [134]=2 [135]=2 [60]=2 [136]=20 [141]=2 [65]=2 [144]=2 [145]=2 [68]=2 [147]=2 [70]=2 [71]=2 [72]=2 [73]=2 [148]=2 [75]=2 [76]=2 [150]=2 [153]=2)"
|
||||
literal_transitions[15]="([86]=4 [6]=4 [109]=4 [61]=4 [77]=4 [54]=4 [62]=4)"
|
||||
literal_transitions[16]="([40]=2 [44]=2)"
|
||||
literal_transitions[17]="([7]=23)"
|
||||
literal_transitions[18]="([31]=2 [149]=2)"
|
||||
literal_transitions[19]="([95]=2 [16]=2 [115]=2 [20]=2)"
|
||||
literal_transitions[20]="([106]=2 [82]=2 [127]=2 [1]=2 [83]=2)"
|
||||
literal_transitions[23]="([57]=21 [110]=21)"
|
||||
declare -A match_anything_transitions=([6]=17 [7]=2 [0]=1 [22]=2 [5]=18 [4]=2 [2]=17 [18]=2 [11]=17 [8]=2 [9]=2 [13]=17 [10]=17 [1]=1)
|
||||
declare -A subword_transitions
|
||||
|
||||
local state=0
|
||||
@@ -79,21 +79,9 @@ _hyprctl () {
|
||||
done
|
||||
|
||||
|
||||
local -a matches=()
|
||||
|
||||
local prefix="${words[$cword]}"
|
||||
|
||||
local shortest_suffix="$word"
|
||||
for ((i=0; i < ${#COMP_WORDBREAKS}; i++)); do
|
||||
local char="${COMP_WORDBREAKS:$i:1}"
|
||||
local candidate="${word##*$char}"
|
||||
if [[ ${#candidate} -lt ${#shortest_suffix} ]]; then
|
||||
shortest_suffix=$candidate
|
||||
fi
|
||||
done
|
||||
local superfluous_prefix=""
|
||||
if [[ "$shortest_suffix" != "$word" ]]; then
|
||||
local superfluous_prefix=${word%$shortest_suffix}
|
||||
fi
|
||||
|
||||
if [[ -v "literal_transitions[$state]" ]]; then
|
||||
local state_transitions_initializer=${literal_transitions[$state]}
|
||||
declare -A state_transitions
|
||||
@@ -102,25 +90,38 @@ _hyprctl () {
|
||||
for literal_id in "${!state_transitions[@]}"; do
|
||||
local literal="${literals[$literal_id]}"
|
||||
if [[ $literal = "${prefix}"* ]]; then
|
||||
local completion=${literal#"$superfluous_prefix"}
|
||||
COMPREPLY+=("$completion ")
|
||||
matches+=("$literal ")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
declare -A commands
|
||||
commands=([16]=2 [4]=3 [12]=1 [10]=0)
|
||||
commands=([7]=0 [22]=1 [8]=3 [5]=2)
|
||||
if [[ -v "commands[$state]" ]]; then
|
||||
local command_id=${commands[$state]}
|
||||
local completions=()
|
||||
mapfile -t completions < <(_hyprctl_cmd_${command_id} "$prefix" | cut -f1)
|
||||
readarray -t completions < <(_hyprctl_cmd_${command_id} "$prefix" | cut -f1)
|
||||
for item in "${completions[@]}"; do
|
||||
if [[ $item = "${prefix}"* ]]; then
|
||||
COMPREPLY+=("$item")
|
||||
matches+=("$item")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
local shortest_suffix="$prefix"
|
||||
for ((i=0; i < ${#COMP_WORDBREAKS}; i++)); do
|
||||
local char="${COMP_WORDBREAKS:$i:1}"
|
||||
local candidate=${prefix##*$char}
|
||||
if [[ ${#candidate} -lt ${#shortest_suffix} ]]; then
|
||||
shortest_suffix=$candidate
|
||||
fi
|
||||
done
|
||||
local superfluous_prefix=""
|
||||
if [[ "$shortest_suffix" != "$prefix" ]]; then
|
||||
local superfluous_prefix=${prefix%$shortest_suffix}
|
||||
fi
|
||||
COMPREPLY=("${matches[@]#$superfluous_prefix}")
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -1,23 +1,23 @@
|
||||
function _hyprctl_3
|
||||
set 1 $argv[1]
|
||||
hyprctl monitors | grep Monitor | awk '{ print $2 }'
|
||||
end
|
||||
|
||||
function _hyprctl_2
|
||||
set 1 $argv[1]
|
||||
hyprpm list | grep "Plugin" | awk '{print $4}'
|
||||
end
|
||||
|
||||
function _hyprctl_1
|
||||
set 1 $argv[1]
|
||||
hyprctl clients | grep class | awk '{print $2}'
|
||||
hyprctl monitors | awk '/Monitor/{ print $2 }'
|
||||
end
|
||||
|
||||
function _hyprctl_4
|
||||
set 1 $argv[1]
|
||||
hyprctl clients | awk '/class/{print $2}'
|
||||
end
|
||||
|
||||
function _hyprctl_3
|
||||
set 1 $argv[1]
|
||||
hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}'
|
||||
end
|
||||
|
||||
function _hyprctl_1
|
||||
set 1 $argv[1]
|
||||
hyprpm list | awk '/Plugin/{print $4}'
|
||||
end
|
||||
|
||||
function _hyprctl
|
||||
set COMP_LINE (commandline --cut-at-cursor)
|
||||
|
||||
@@ -29,141 +29,160 @@ function _hyprctl
|
||||
set COMP_CWORD (count $COMP_WORDS)
|
||||
end
|
||||
|
||||
set --local literals "cyclenext" "globalshortcuts" "cursorpos" "bordersize" "renameworkspace" "animationstyle" "focuswindow" "0" "auto" "swapnext" "forceallowsinput" "moveactive" "activebordercolor" "alphafullscreen" "wayland" "layers" "minsize" "monitors" "1" "kill" "settiled" "3" "focusmonitor" "swapwindow" "moveoutofgroup" "notify" "movecursor" "setcursor" "seterror" "movecurrentworkspacetomonitor" "4" "nomaxsize" "forcenoanims" "setprop" "-i" "togglefloating" "workspacerules" "movetoworkspace" "disable" "setignoregrouplock" "workspaces" "movegroupwindow" "closewindow" "0" "--instance" "binds" "movewindow" "splitratio" "alpha" "denywindowfromgroup" "workspace" "configerrors" "togglegroup" "getoption" "forceopaque" "keepaspectratio" "killactive" "pass" "decorations" "devices" "focuscurrentorlast" "submap" "global" "alphafullscreenoverride" "forcerendererreload" "movewindowpixel" "headless" "version" "dpms" "resizeactive" "moveintogroup" "5" "alphaoverride" "setfloating" "rollinglog" "::=" "rounding" "layouts" "moveworkspacetomonitor" "exec" "alphainactiveoverride" "alterzorder" "fakefullscreen" "nofocus" "keyword" "forcenoborder" "forcenodim" "pin" "output" "forcenoblur" "togglespecialworkspace" "fullscreen" "toggleopaque" "focusworkspaceoncurrentmonitor" "next" "changegroupactive" "-j" "instances" "execr" "exit" "clients" "all" "--batch" "dismissnotify" "inactivebordercolor" "switchxkblayout" "movetoworkspacesilent" "movewindoworgroup" "-r" "movefocus" "focusurgentorlast" "remove" "activeworkspace" "dispatch" "create" "centerwindow" "2" "hyprpaper" "-1" "reload" "alphainactive" "systeminfo" "plugin" "dimaround" "activewindow" "swapactiveworkspaces" "splash" "maxsize" "lockactivegroup" "windowdancecompat" "forceopaqueoverriden" "lockgroups" "movecursortocorner" "x11" "prev" "1" "resizewindowpixel" "forcenoshadow"
|
||||
set literals "resizeactive" "2" "changegroupactive" "-r" "moveintogroup" "forceallowsinput" "4" "::=" "systeminfo" "all" "layouts" "setprop" "animationstyle" "switchxkblayout" "create" "denywindowfromgroup" "headless" "activebordercolor" "exec" "setcursor" "wayland" "focusurgentorlast" "workspacerules" "movecurrentworkspacetomonitor" "movetoworkspacesilent" "hyprpaper" "alpha" "inactivebordercolor" "movegroupwindow" "movecursortocorner" "movewindowpixel" "prev" "movewindow" "globalshortcuts" "clients" "dimaround" "setignoregrouplock" "splash" "execr" "monitors" "0" "forcenoborder" "-q" "animations" "1" "nomaxsize" "splitratio" "moveactive" "pass" "swapnext" "devices" "layers" "rounding" "lockactivegroup" "5" "moveworkspacetomonitor" "-f" "-i" "--quiet" "forcenodim" "pin" "0" "1" "forceopaque" "forcenoshadow" "setfloating" "minsize" "alphaoverride" "sendshortcut" "workspaces" "cyclenext" "alterzorder" "togglegroup" "lockgroups" "bordersize" "dpms" "focuscurrentorlast" "-1" "--batch" "notify" "remove" "instances" "1" "3" "moveoutofgroup" "killactive" "2" "movetoworkspace" "movecursor" "configerrors" "closewindow" "swapwindow" "tagwindow" "forcerendererreload" "centerwindow" "auto" "focuswindow" "seterror" "nofocus" "alphafullscreen" "binds" "version" "-h" "togglespecialworkspace" "fullscreen" "windowdancecompat" "0" "keyword" "toggleopaque" "3" "--instance" "togglefloating" "renameworkspace" "alphafullscreenoverride" "activeworkspace" "x11" "kill" "forceopaqueoverriden" "output" "global" "dispatch" "reload" "forcenoblur" "-j" "event" "--help" "disable" "-1" "activewindow" "keepaspectratio" "dismissnotify" "focusmonitor" "movefocus" "plugin" "exit" "workspace" "fullscreenstate" "getoption" "alphainactiveoverride" "alphainactive" "decorations" "settiled" "config-only" "descriptions" "resizewindowpixel" "fakefullscreen" "rollinglog" "swapactiveworkspaces" "submap" "next" "movewindoworgroup" "cursorpos" "forcenoanims" "focusworkspaceoncurrentmonitor" "maxsize"
|
||||
|
||||
set --local descriptions
|
||||
set descriptions[1] "Focus the next window on a workspace"
|
||||
set descriptions[3] "Get the current cursor pos in global layout coordinates"
|
||||
set descriptions[5] "Rename a workspace"
|
||||
set descriptions[7] "Focus the first window matching"
|
||||
set descriptions[10] "Swap the focused window with the next window"
|
||||
set descriptions[12] "Move the active window"
|
||||
set descriptions[16] "List the layers"
|
||||
set descriptions[18] "List active outputs with their properties"
|
||||
set descriptions[20] "Get into a kill mode, where you can kill an app by clicking on it"
|
||||
set descriptions[21] "Set the current window's floating state to false"
|
||||
set descriptions[22] "ERROR"
|
||||
set descriptions[23] "Focus a monitor"
|
||||
set descriptions[24] "Swap the active window with another window"
|
||||
set descriptions[25] "Move the active window out of a group"
|
||||
set descriptions[26] "Send a notification using the built-in Hyprland notification system"
|
||||
set descriptions[27] "Move the cursor to a specified position"
|
||||
set descriptions[28] "Set the cursor theme and reloads the cursor manager"
|
||||
set descriptions[29] "Set the hyprctl error string"
|
||||
set descriptions[30] "Move the active workspace to a monitor"
|
||||
set descriptions[31] "CONFUSED"
|
||||
set descriptions[34] "Set a property of a window"
|
||||
set descriptions[35] "Specify the Hyprland instance"
|
||||
set descriptions[36] "Toggle the current window's floating state"
|
||||
set descriptions[37] "Get the list of defined workspace rules"
|
||||
set descriptions[38] "Move the focused window to a workspace"
|
||||
set descriptions[40] "Temporarily enable or disable binds:ignore_group_lock"
|
||||
set descriptions[41] "List all workspaces with their properties"
|
||||
set descriptions[42] "Swap the active window with the next or previous in a group"
|
||||
set descriptions[43] "Close a specified window"
|
||||
set descriptions[44] "WARNING"
|
||||
set descriptions[45] "Specify the Hyprland instance"
|
||||
set descriptions[46] "List all registered binds"
|
||||
set descriptions[47] "Move the active window in a direction or to a monitor"
|
||||
set descriptions[48] "Change the split ratio"
|
||||
set descriptions[50] "Prohibit the active window from becoming or being inserted into group"
|
||||
set descriptions[51] "Change the workspace"
|
||||
set descriptions[52] "List all current config parsing errors"
|
||||
set descriptions[53] "Toggle the current active window into a group"
|
||||
set descriptions[54] "Get the config option status (values)"
|
||||
set descriptions[57] "Close the active window"
|
||||
set descriptions[58] "Pass the key to a specified window"
|
||||
set descriptions[59] "List all decorations and their info"
|
||||
set descriptions[60] "List all connected keyboards and mice"
|
||||
set descriptions[61] "Switch focus from current to previously focused window"
|
||||
set descriptions[62] "Change the current mapping group"
|
||||
set descriptions[63] "Execute a Global Shortcut using the GlobalShortcuts portal"
|
||||
set descriptions[65] "Force the renderer to reload all resources and outputs"
|
||||
set descriptions[66] "Move a selected window"
|
||||
set descriptions[68] "Print the Hyprland version: flags, commit and branch of build"
|
||||
set descriptions[69] "Set all monitors' DPMS status"
|
||||
set descriptions[70] "Resize the active window"
|
||||
set descriptions[71] "Move the active window into a group"
|
||||
set descriptions[72] "OK"
|
||||
set descriptions[74] "Set the current window's floating state to true"
|
||||
set descriptions[75] "Print tail of the log"
|
||||
set descriptions[78] "List all layouts available (including plugin ones)"
|
||||
set descriptions[79] "Move a workspace to a monitor"
|
||||
set descriptions[80] "Execute a shell command"
|
||||
set descriptions[82] "Modify the window stack order of the active or specified window"
|
||||
set descriptions[83] "Toggle the focused window's internal fullscreen state"
|
||||
set descriptions[85] "Issue a keyword to call a config keyword dynamically"
|
||||
set descriptions[88] "Pin a window"
|
||||
set descriptions[89] "Allows adding/removing fake outputs to a specific backend"
|
||||
set descriptions[91] "Toggle a special workspace on/off"
|
||||
set descriptions[92] "Toggle the focused window's fullscreen state"
|
||||
set descriptions[93] "Toggle the current window to always be opaque"
|
||||
set descriptions[94] "Focus the requested workspace"
|
||||
set descriptions[96] "Switch to the next window in a group"
|
||||
set descriptions[97] "Output in JSON format"
|
||||
set descriptions[98] "List all running Hyprland instances and their info"
|
||||
set descriptions[99] "Execute a raw shell command"
|
||||
set descriptions[100] "Exit the compositor with no questions asked"
|
||||
set descriptions[101] "List all windows with their properties"
|
||||
set descriptions[103] "Execute a batch of commands separated by ;"
|
||||
set descriptions[104] "Dismiss all or up to amount of notifications"
|
||||
set descriptions[106] "Set the xkb layout index for a keyboard"
|
||||
set descriptions[107] "Move window doesnt switch to the workspace"
|
||||
set descriptions[108] "Behave as moveintogroup"
|
||||
set descriptions[109] "Refresh state after issuing the command"
|
||||
set descriptions[110] "Move the focus in a direction"
|
||||
set descriptions[111] "Focus the urgent window or the last window"
|
||||
set descriptions[113] "Get the active workspace name and its properties"
|
||||
set descriptions[114] "Issue a dispatch to call a keybind dispatcher with an arg"
|
||||
set descriptions[116] "Center the active window"
|
||||
set descriptions[117] "HINT"
|
||||
set descriptions[118] "Interact with hyprpaper if present"
|
||||
set descriptions[119] "No Icon"
|
||||
set descriptions[120] "Force reload the config"
|
||||
set descriptions[122] "Print system info"
|
||||
set descriptions[123] "Interact with a plugin"
|
||||
set descriptions[125] "Get the active window name and its properties"
|
||||
set descriptions[126] "Swap the active workspaces between two monitors"
|
||||
set descriptions[127] "Print the current random splash"
|
||||
set descriptions[129] "Lock the focused group"
|
||||
set descriptions[132] "Lock the groups"
|
||||
set descriptions[133] "Move the cursor to the corner of the active window"
|
||||
set descriptions[136] "INFO"
|
||||
set descriptions[137] "Resize a selected window"
|
||||
set descriptions
|
||||
set descriptions[1] "Resize the active window"
|
||||
set descriptions[2] "Fullscreen"
|
||||
set descriptions[3] "Switch to the next window in a group"
|
||||
set descriptions[4] "Refresh state after issuing the command"
|
||||
set descriptions[5] "Move the active window into a group"
|
||||
set descriptions[7] "CONFUSED"
|
||||
set descriptions[9] "Print system info"
|
||||
set descriptions[11] "List all layouts available (including plugin ones)"
|
||||
set descriptions[12] "Set a property of a window"
|
||||
set descriptions[14] "Set the xkb layout index for a keyboard"
|
||||
set descriptions[16] "Prohibit the active window from becoming or being inserted into group"
|
||||
set descriptions[19] "Execute a shell command"
|
||||
set descriptions[20] "Set the cursor theme and reloads the cursor manager"
|
||||
set descriptions[22] "Focus the urgent window or the last window"
|
||||
set descriptions[23] "Get the list of defined workspace rules"
|
||||
set descriptions[24] "Move the active workspace to a monitor"
|
||||
set descriptions[25] "Move window doesnt switch to the workspace"
|
||||
set descriptions[26] "Interact with hyprpaper if present"
|
||||
set descriptions[29] "Swap the active window with the next or previous in a group"
|
||||
set descriptions[30] "Move the cursor to the corner of the active window"
|
||||
set descriptions[31] "Move a selected window"
|
||||
set descriptions[33] "Move the active window in a direction or to a monitor"
|
||||
set descriptions[34] "Lists all global shortcuts"
|
||||
set descriptions[35] "List all windows with their properties"
|
||||
set descriptions[37] "Temporarily enable or disable binds:ignore_group_lock"
|
||||
set descriptions[38] "Print the current random splash"
|
||||
set descriptions[39] "Execute a raw shell command"
|
||||
set descriptions[40] "List active outputs with their properties"
|
||||
set descriptions[43] "Disable output"
|
||||
set descriptions[44] "Gets the current config info about animations and beziers"
|
||||
set descriptions[47] "Change the split ratio"
|
||||
set descriptions[48] "Move the active window"
|
||||
set descriptions[49] "Pass the key to a specified window"
|
||||
set descriptions[50] "Swap the focused window with the next window"
|
||||
set descriptions[51] "List all connected keyboards and mice"
|
||||
set descriptions[52] "List the layers"
|
||||
set descriptions[54] "Lock the focused group"
|
||||
set descriptions[55] "OK"
|
||||
set descriptions[56] "Move a workspace to a monitor"
|
||||
set descriptions[58] "Specify the Hyprland instance"
|
||||
set descriptions[59] "Disable output"
|
||||
set descriptions[61] "Pin a window"
|
||||
set descriptions[62] "WARNING"
|
||||
set descriptions[63] "INFO"
|
||||
set descriptions[66] "Set the current window's floating state to true"
|
||||
set descriptions[69] "On shortcut X sends shortcut Y to a specified window"
|
||||
set descriptions[70] "List all workspaces with their properties"
|
||||
set descriptions[71] "Focus the next window on a workspace"
|
||||
set descriptions[72] "Modify the window stack order of the active or specified window"
|
||||
set descriptions[73] "Toggle the current active window into a group"
|
||||
set descriptions[74] "Lock the groups"
|
||||
set descriptions[76] "Set all monitors' DPMS status"
|
||||
set descriptions[77] "Switch focus from current to previously focused window"
|
||||
set descriptions[78] "No Icon"
|
||||
set descriptions[79] "Execute a batch of commands separated by ;"
|
||||
set descriptions[80] "Send a notification using the built-in Hyprland notification system"
|
||||
set descriptions[82] "List all running Hyprland instances and their info"
|
||||
set descriptions[83] "Maximize no fullscreen"
|
||||
set descriptions[84] "Maximize and fullscreen"
|
||||
set descriptions[85] "Move the active window out of a group"
|
||||
set descriptions[86] "Close the active window"
|
||||
set descriptions[87] "HINT"
|
||||
set descriptions[88] "Move the focused window to a workspace"
|
||||
set descriptions[89] "Move the cursor to a specified position"
|
||||
set descriptions[90] "List all current config parsing errors"
|
||||
set descriptions[91] "Close a specified window"
|
||||
set descriptions[92] "Swap the active window with another window"
|
||||
set descriptions[93] "Apply a tag to the window"
|
||||
set descriptions[94] "Force the renderer to reload all resources and outputs"
|
||||
set descriptions[95] "Center the active window"
|
||||
set descriptions[97] "Focus the first window matching"
|
||||
set descriptions[98] "Set the hyprctl error string"
|
||||
set descriptions[101] "List all registered binds"
|
||||
set descriptions[102] "Print the Hyprland version: flags, commit and branch of build"
|
||||
set descriptions[103] "Prints the help message"
|
||||
set descriptions[104] "Toggle a special workspace on/off"
|
||||
set descriptions[105] "Toggle the focused window's fullscreen state"
|
||||
set descriptions[107] "None"
|
||||
set descriptions[108] "Issue a keyword to call a config keyword dynamically"
|
||||
set descriptions[109] "Toggle the current window to always be opaque"
|
||||
set descriptions[110] "ERROR"
|
||||
set descriptions[111] "Specify the Hyprland instance"
|
||||
set descriptions[112] "Toggle the current window's floating state"
|
||||
set descriptions[113] "Rename a workspace"
|
||||
set descriptions[115] "Get the active workspace name and its properties"
|
||||
set descriptions[117] "Get into a kill mode, where you can kill an app by clicking on it"
|
||||
set descriptions[119] "Allows adding/removing fake outputs to a specific backend"
|
||||
set descriptions[120] "Execute a Global Shortcut using the GlobalShortcuts portal"
|
||||
set descriptions[121] "Issue a dispatch to call a keybind dispatcher with an arg"
|
||||
set descriptions[122] "Force reload the config"
|
||||
set descriptions[124] "Output in JSON format"
|
||||
set descriptions[125] "Emits a custom event to socket2"
|
||||
set descriptions[126] "Prints the help message"
|
||||
set descriptions[128] "Current"
|
||||
set descriptions[129] "Get the active window name and its properties"
|
||||
set descriptions[131] "Dismiss all or up to amount of notifications"
|
||||
set descriptions[132] "Focus a monitor"
|
||||
set descriptions[133] "Move the focus in a direction"
|
||||
set descriptions[134] "Interact with a plugin"
|
||||
set descriptions[135] "Exit the compositor with no questions asked"
|
||||
set descriptions[136] "Change the workspace"
|
||||
set descriptions[137] "Sets the focused window’s fullscreen mode and the one sent to the client"
|
||||
set descriptions[138] "Get the config option status (values)"
|
||||
set descriptions[141] "List all decorations and their info"
|
||||
set descriptions[142] "Set the current window's floating state to false"
|
||||
set descriptions[144] "Return a parsable JSON with all the config options, descriptions, value types and ranges"
|
||||
set descriptions[145] "Resize a selected window"
|
||||
set descriptions[146] "Toggle the focused window's internal fullscreen state"
|
||||
set descriptions[147] "Print tail of the log"
|
||||
set descriptions[148] "Swap the active workspaces between two monitors"
|
||||
set descriptions[149] "Change the current mapping group"
|
||||
set descriptions[151] "Behave as moveintogroup"
|
||||
set descriptions[152] "Get the current cursor pos in global layout coordinates"
|
||||
set descriptions[154] "Focus the requested workspace"
|
||||
|
||||
set --local literal_transitions
|
||||
set literal_transitions[1] "set inputs 104 75 34 2 3 78 106 37 109 41 46 113 85 114 52 54 89 118 120 122 16 59 60 18 123 20 125 127 26 68 97 98 28 29 101 103; set tos 2 3 4 3 3 3 5 3 6 3 3 3 7 9 3 3 10 3 3 3 3 11 3 12 13 3 3 3 14 3 6 3 3 15 3 6"
|
||||
set literal_transitions[4] "set inputs 73 14 33 55 56 90 105 121 77 17 124 4 6 64 128 130 81 131 84 32 49 13 86 11 87 138; set tos 19 3 19 19 19 19 3 3 2 3 19 2 3 19 3 19 19 19 19 19 3 3 19 19 19 19"
|
||||
set literal_transitions[8] "set inputs 104 75 34 2 3 78 106 37 41 46 113 85 114 52 54 89 118 120 122 16 59 60 18 123 20 125 127 26 68 98 28 29 101; set tos 2 3 4 3 3 3 5 3 3 3 3 7 9 3 3 10 3 3 3 3 11 3 12 13 3 3 3 14 3 3 3 15 3"
|
||||
set literal_transitions[9] "set inputs 129 132 1 74 36 107 38 108 5 79 40 80 111 7 42 43 82 83 47 48 10 110 51 53 12 116 88 50 57 91 58 92 93 61 62 126 94 63 21 96 23 24 65 66 25 133 27 69 99 70 30 137 71 100; set tos 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3"
|
||||
set literal_transitions[10] "set inputs 115 112; set tos 16 17"
|
||||
set literal_transitions[12] "set inputs 102; set tos 3"
|
||||
set literal_transitions[14] "set inputs 22 117 31 136 119 44 72; set tos 2 2 2 2 2 2 2"
|
||||
set literal_transitions[15] "set inputs 39; set tos 3"
|
||||
set literal_transitions[16] "set inputs 9 67 15 134; set tos 3 3 3 3"
|
||||
set literal_transitions[18] "set inputs 76; set tos 20"
|
||||
set literal_transitions[19] "set inputs 19 8; set tos 3 3"
|
||||
set literal_transitions[20] "set inputs 35 45; set tos 6 6"
|
||||
set literal_transitions[21] "set inputs 135 95; set tos 3 3"
|
||||
set literal_transitions
|
||||
set literal_transitions[1] "set inputs 121 44 126 82 4 52 51 129 90 59 9 11 12 131 14 98 102 103 134 101 138 23 20 141 26 144 108 147 70 34 35 79 115 38 152 117 122 124 40 43 80 119; set tos 15 3 22 3 22 3 3 3 3 22 3 3 4 5 6 7 3 22 8 3 3 3 3 9 3 3 10 11 3 3 3 22 3 3 3 3 14 22 12 22 16 13"
|
||||
set literal_transitions[2] "set inputs 82 52 51 129 9 90 11 12 131 14 98 102 134 101 23 20 138 141 26 144 108 147 70 34 35 115 38 152 117 40 119 122 121 80 44; set tos 3 3 3 3 3 3 3 4 5 6 7 3 8 3 3 3 3 9 3 3 10 11 3 3 3 3 3 3 3 12 13 14 15 16 3"
|
||||
set literal_transitions[4] "set inputs 140 64 65 46 106 28 27 53 6 67 68 130 114 13 75 100 36 153 99 60 118 42 18 139 155 123; set tos 3 17 17 17 17 3 3 5 17 3 17 17 17 3 5 3 17 17 17 17 17 17 3 17 3 17"
|
||||
set literal_transitions[7] "set inputs 127; set tos 3"
|
||||
set literal_transitions[11] "set inputs 57; set tos 3"
|
||||
set literal_transitions[12] "set inputs 10; set tos 3"
|
||||
set literal_transitions[13] "set inputs 15 81; set tos 20 23"
|
||||
set literal_transitions[14] "set inputs 143; set tos 3"
|
||||
set literal_transitions[15] "set inputs 1 85 3 86 5 88 89 91 92 93 94 95 97 16 19 104 22 105 24 25 29 30 31 109 112 33 113 37 39 120 125 47 48 49 50 54 56 132 133 135 136 61 137 142 66 145 146 69 148 71 72 73 74 149 76 77 151 154; set tos 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 21 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3"
|
||||
set literal_transitions[16] "set inputs 87 7 110 62 78 55 63; set tos 5 5 5 5 5 5 5"
|
||||
set literal_transitions[17] "set inputs 41 45; set tos 3 3"
|
||||
set literal_transitions[18] "set inputs 8; set tos 24"
|
||||
set literal_transitions[19] "set inputs 32 150; set tos 3 3"
|
||||
set literal_transitions[20] "set inputs 96 17 116 21; set tos 3 3 3 3"
|
||||
set literal_transitions[21] "set inputs 107 83 128 2 84; set tos 3 3 3 3 3"
|
||||
set literal_transitions[24] "set inputs 58 111; set tos 22 22"
|
||||
|
||||
set --local match_anything_transitions_from 2 1 7 21 11 3 8 13 15 17 5 12
|
||||
set --local match_anything_transitions_to 3 8 3 3 3 18 8 3 18 3 21 18
|
||||
set match_anything_transitions_from 7 8 1 23 6 5 3 19 12 9 10 14 11 2
|
||||
set match_anything_transitions_to 18 3 2 3 19 3 18 3 18 3 3 18 18 2
|
||||
|
||||
set --local state 1
|
||||
set --local word_index 2
|
||||
set state 1
|
||||
set word_index 2
|
||||
while test $word_index -lt $COMP_CWORD
|
||||
set --local -- word $COMP_WORDS[$word_index]
|
||||
set -- word $COMP_WORDS[$word_index]
|
||||
|
||||
if set --query literal_transitions[$state] && test -n $literal_transitions[$state]
|
||||
set --local --erase inputs
|
||||
set --local --erase tos
|
||||
set --erase inputs
|
||||
set --erase tos
|
||||
eval $literal_transitions[$state]
|
||||
|
||||
if contains -- $word $literals
|
||||
set --local literal_matched 0
|
||||
set literal_matched 0
|
||||
for literal_id in (seq 1 (count $literals))
|
||||
if test $literals[$literal_id] = $word
|
||||
set --local index (contains --index -- $literal_id $inputs)
|
||||
set index (contains --index -- $literal_id $inputs)
|
||||
set state $tos[$index]
|
||||
set word_index (math $word_index + 1)
|
||||
set literal_matched 1
|
||||
@@ -177,7 +196,7 @@ function _hyprctl
|
||||
end
|
||||
|
||||
if set --query match_anything_transitions_from[$state] && test -n $match_anything_transitions_from[$state]
|
||||
set --local index (contains --index -- $state $match_anything_transitions_from)
|
||||
set index (contains --index -- $state $match_anything_transitions_from)
|
||||
set state $match_anything_transitions_to[$index]
|
||||
set word_index (math $word_index + 1)
|
||||
continue
|
||||
@@ -187,8 +206,8 @@ function _hyprctl
|
||||
end
|
||||
|
||||
if set --query literal_transitions[$state] && test -n $literal_transitions[$state]
|
||||
set --local --erase inputs
|
||||
set --local --erase tos
|
||||
set --erase inputs
|
||||
set --erase tos
|
||||
eval $literal_transitions[$state]
|
||||
for literal_id in $inputs
|
||||
if test -n $descriptions[$literal_id]
|
||||
@@ -199,14 +218,14 @@ function _hyprctl
|
||||
end
|
||||
end
|
||||
|
||||
set command_states 17 5 13 11
|
||||
set command_ids 3 4 2 1
|
||||
set command_states 8 23 9 6
|
||||
set command_ids 1 2 4 3
|
||||
if contains $state $command_states
|
||||
set --local index (contains --index $state $command_states)
|
||||
set --local function_id $command_ids[$index]
|
||||
set --local function_name _hyprctl_$function_id
|
||||
set --local --erase inputs
|
||||
set --local --erase tos
|
||||
set index (contains --index $state $command_states)
|
||||
set function_id $command_ids[$index]
|
||||
set function_name _hyprctl_$function_id
|
||||
set --erase inputs
|
||||
set --erase tos
|
||||
$function_name "$COMP_WORDS[$COMP_CWORD]"
|
||||
end
|
||||
|
||||
|
@@ -8,13 +8,15 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
|
||||
| (-j) "Output in JSON format"
|
||||
| (-r) "Refresh state after issuing the command"
|
||||
| (--batch) "Execute a batch of commands separated by ;"
|
||||
| (-q | --quiet) "Disable output"
|
||||
| (-h | --help) "Prints the help message"
|
||||
;
|
||||
|
||||
<WINDOWS> ::= {{{ hyprctl clients | grep class | awk '{print $2}' }}};
|
||||
<WINDOWS> ::= {{{ hyprctl clients | awk '/class/{print $2}' }}};
|
||||
|
||||
<AVAILABLE_PLUGINS> ::= {{{ hyprpm list | grep "Plugin" | awk '{print $4}' }}};
|
||||
<AVAILABLE_PLUGINS> ::= {{{ hyprpm list | awk '/Plugin/{print $4}' }}};
|
||||
|
||||
<MONITORS> ::= {{{ hyprctl monitors | grep Monitor | awk '{ print $2 }' }}};
|
||||
<MONITORS> ::= {{{ hyprctl monitors | awk '/Monitor/{ print $2 }' }}};
|
||||
|
||||
<KEYBOARDS> ::= {{{ hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}' }}};
|
||||
|
||||
@@ -58,16 +60,18 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
|
||||
|
||||
<ARGUMENTS> ::= (activewindow) "Get the active window name and its properties"
|
||||
| (activeworkspace) "Get the active workspace name and its properties"
|
||||
| (animations) "Gets the current config info about animations and beziers"
|
||||
| (binds) "List all registered binds"
|
||||
| (clients) "List all windows with their properties"
|
||||
| (configerrors) "List all current config parsing errors"
|
||||
| (cursorpos) "Get the current cursor pos in global layout coordinates"
|
||||
| (decorations <WINDOWS>) "List all decorations and their info"
|
||||
| (descriptions) "Return a parsable JSON with all the config options, descriptions, value types and ranges"
|
||||
| (devices) "List all connected keyboards and mice"
|
||||
| (dismissnotify <NUM>) "Dismiss all or up to amount of notifications"
|
||||
| (dispatch <DISPATCHERS>) "Issue a dispatch to call a keybind dispatcher with an arg"
|
||||
| (getoption) "Get the config option status (values)"
|
||||
| (globalshortcuts) ""
|
||||
| (globalshortcuts) "Lists all global shortcuts"
|
||||
| (hyprpaper) "Interact with hyprpaper if present"
|
||||
| (instances) "List all running Hyprland instances and their info"
|
||||
| (keyword <KEYWORDS>) "Issue a keyword to call a config keyword dynamically"
|
||||
@@ -78,8 +82,8 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
|
||||
| (notify <NOTIFICATION_TYPES> <NUM>) "Send a notification using the built-in Hyprland notification system"
|
||||
| (output (create (wayland | x11 | headless | auto) | remove <MONITORS>)) "Allows adding/removing fake outputs to a specific backend"
|
||||
| (plugin <AVAILABLE_PLUGINS>) "Interact with a plugin"
|
||||
| (reload) "Force reload the config"
|
||||
| (rollinglog) "Print tail of the log"
|
||||
| (reload [config-only]) "Force reload the config"
|
||||
| (rollinglog [-f]) "Print tail of the log"
|
||||
| (setcursor) "Set the cursor theme and reloads the cursor manager"
|
||||
| (seterror [disable]) "Set the hyprctl error string"
|
||||
| (setprop <PROPS>) "Set a property of a window"
|
||||
@@ -91,9 +95,17 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
|
||||
| (workspaces) "List all workspaces with their properties"
|
||||
;
|
||||
|
||||
<WINDOW_STATE> ::= (-1) "Current"
|
||||
| (0) "None"
|
||||
| (1) "Maximize no fullscreen"
|
||||
| (2) "Fullscreen"
|
||||
| (3) "Maximize and fullscreen"
|
||||
;
|
||||
|
||||
<DISPATCHERS> ::= (exec) "Execute a shell command"
|
||||
| (execr) "Execute a raw shell command"
|
||||
| (pass) "Pass the key to a specified window"
|
||||
| (sendshortcut) "On shortcut X sends shortcut Y to a specified window"
|
||||
| (killactive) "Close the active window"
|
||||
| (closewindow) "Close a specified window"
|
||||
| (workspace) "Change the workspace"
|
||||
@@ -104,6 +116,7 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
|
||||
| (settiled) "Set the current window's floating state to false"
|
||||
| (fullscreen) "Toggle the focused window's fullscreen state"
|
||||
| (fakefullscreen) "Toggle the focused window's internal fullscreen state"
|
||||
| (fullscreenstate <WINDOW_STATE>) "Sets the focused window’s fullscreen mode and the one sent to the client"
|
||||
| (dpms) "Set all monitors' DPMS status"
|
||||
| (pin) "Pin a window"
|
||||
| (movefocus) "Move the focus in a direction"
|
||||
@@ -116,6 +129,7 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
|
||||
| (movewindowpixel) "Move a selected window"
|
||||
| (cyclenext) "Focus the next window on a workspace"
|
||||
| (swapnext) "Swap the focused window with the next window"
|
||||
| (tagwindow) "Apply a tag to the window"
|
||||
| (focuswindow) "Focus the first window matching"
|
||||
| (focusmonitor) "Focus a monitor"
|
||||
| (splitratio) "Change the split ratio"
|
||||
@@ -145,4 +159,5 @@ hyprctl [<OPTIONS>]... <ARGUMENTS>
|
||||
| (setignoregrouplock) "Temporarily enable or disable binds:ignore_group_lock"
|
||||
| (global) "Execute a Global Shortcut using the GlobalShortcuts portal"
|
||||
| (submap) "Change the current mapping group"
|
||||
| (event) "Emits a custom event to socket2"
|
||||
;
|
||||
|
@@ -1,141 +1,160 @@
|
||||
#compdef hyprctl
|
||||
|
||||
_hyprctl_cmd_2 () {
|
||||
hyprctl monitors | grep Monitor | awk '{ print $2 }'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_1 () {
|
||||
hyprpm list | grep "Plugin" | awk '{print $4}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_0 () {
|
||||
hyprctl clients | grep class | awk '{print $2}'
|
||||
hyprctl monitors | awk '/Monitor/{ print $2 }'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_3 () {
|
||||
hyprctl clients | awk '/class/{print $2}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_2 () {
|
||||
hyprctl devices | sed -n '/Keyboard at/{n; s/^\s\+//; p}'
|
||||
}
|
||||
|
||||
_hyprctl_cmd_0 () {
|
||||
hyprpm list | awk '/Plugin/{print $4}'
|
||||
}
|
||||
|
||||
_hyprctl () {
|
||||
local -a literals=("cyclenext" "globalshortcuts" "cursorpos" "bordersize" "renameworkspace" "animationstyle" "focuswindow" "0" "auto" "swapnext" "forceallowsinput" "moveactive" "activebordercolor" "alphafullscreen" "wayland" "layers" "minsize" "monitors" "1" "kill" "settiled" "3" "focusmonitor" "swapwindow" "moveoutofgroup" "notify" "movecursor" "setcursor" "seterror" "movecurrentworkspacetomonitor" "4" "nomaxsize" "forcenoanims" "setprop" "-i" "togglefloating" "workspacerules" "movetoworkspace" "disable" "setignoregrouplock" "workspaces" "movegroupwindow" "closewindow" "0" "--instance" "binds" "movewindow" "splitratio" "alpha" "denywindowfromgroup" "workspace" "configerrors" "togglegroup" "getoption" "forceopaque" "keepaspectratio" "killactive" "pass" "decorations" "devices" "focuscurrentorlast" "submap" "global" "alphafullscreenoverride" "forcerendererreload" "movewindowpixel" "headless" "version" "dpms" "resizeactive" "moveintogroup" "5" "alphaoverride" "setfloating" "rollinglog" "::=" "rounding" "layouts" "moveworkspacetomonitor" "exec" "alphainactiveoverride" "alterzorder" "fakefullscreen" "nofocus" "keyword" "forcenoborder" "forcenodim" "pin" "output" "forcenoblur" "togglespecialworkspace" "fullscreen" "toggleopaque" "focusworkspaceoncurrentmonitor" "next" "changegroupactive" "-j" "instances" "execr" "exit" "clients" "all" "--batch" "dismissnotify" "inactivebordercolor" "switchxkblayout" "movetoworkspacesilent" "movewindoworgroup" "-r" "movefocus" "focusurgentorlast" "remove" "activeworkspace" "dispatch" "create" "centerwindow" "2" "hyprpaper" "-1" "reload" "alphainactive" "systeminfo" "plugin" "dimaround" "activewindow" "swapactiveworkspaces" "splash" "maxsize" "lockactivegroup" "windowdancecompat" "forceopaqueoverriden" "lockgroups" "movecursortocorner" "x11" "prev" "1" "resizewindowpixel" "forcenoshadow")
|
||||
local -a literals=("resizeactive" "2" "changegroupactive" "-r" "moveintogroup" "forceallowsinput" "4" "::=" "systeminfo" "all" "layouts" "setprop" "animationstyle" "switchxkblayout" "create" "denywindowfromgroup" "headless" "activebordercolor" "exec" "setcursor" "wayland" "focusurgentorlast" "workspacerules" "movecurrentworkspacetomonitor" "movetoworkspacesilent" "hyprpaper" "alpha" "inactivebordercolor" "movegroupwindow" "movecursortocorner" "movewindowpixel" "prev" "movewindow" "globalshortcuts" "clients" "dimaround" "setignoregrouplock" "splash" "execr" "monitors" "0" "forcenoborder" "-q" "animations" "1" "nomaxsize" "splitratio" "moveactive" "pass" "swapnext" "devices" "layers" "rounding" "lockactivegroup" "5" "moveworkspacetomonitor" "-f" "-i" "--quiet" "forcenodim" "pin" "0" "1" "forceopaque" "forcenoshadow" "setfloating" "minsize" "alphaoverride" "sendshortcut" "workspaces" "cyclenext" "alterzorder" "togglegroup" "lockgroups" "bordersize" "dpms" "focuscurrentorlast" "-1" "--batch" "notify" "remove" "instances" "1" "3" "moveoutofgroup" "killactive" "2" "movetoworkspace" "movecursor" "configerrors" "closewindow" "swapwindow" "tagwindow" "forcerendererreload" "centerwindow" "auto" "focuswindow" "seterror" "nofocus" "alphafullscreen" "binds" "version" "-h" "togglespecialworkspace" "fullscreen" "windowdancecompat" "0" "keyword" "toggleopaque" "3" "--instance" "togglefloating" "renameworkspace" "alphafullscreenoverride" "activeworkspace" "x11" "kill" "forceopaqueoverriden" "output" "global" "dispatch" "reload" "forcenoblur" "-j" "event" "--help" "disable" "-1" "activewindow" "keepaspectratio" "dismissnotify" "focusmonitor" "movefocus" "plugin" "exit" "workspace" "fullscreenstate" "getoption" "alphainactiveoverride" "alphainactive" "decorations" "settiled" "config-only" "descriptions" "resizewindowpixel" "fakefullscreen" "rollinglog" "swapactiveworkspaces" "submap" "next" "movewindoworgroup" "cursorpos" "forcenoanims" "focusworkspaceoncurrentmonitor" "maxsize")
|
||||
|
||||
local -A descriptions
|
||||
descriptions[1]="Focus the next window on a workspace"
|
||||
descriptions[3]="Get the current cursor pos in global layout coordinates"
|
||||
descriptions[5]="Rename a workspace"
|
||||
descriptions[7]="Focus the first window matching"
|
||||
descriptions[10]="Swap the focused window with the next window"
|
||||
descriptions[12]="Move the active window"
|
||||
descriptions[16]="List the layers"
|
||||
descriptions[18]="List active outputs with their properties"
|
||||
descriptions[20]="Get into a kill mode, where you can kill an app by clicking on it"
|
||||
descriptions[21]="Set the current window's floating state to false"
|
||||
descriptions[22]="ERROR"
|
||||
descriptions[23]="Focus a monitor"
|
||||
descriptions[24]="Swap the active window with another window"
|
||||
descriptions[25]="Move the active window out of a group"
|
||||
descriptions[26]="Send a notification using the built-in Hyprland notification system"
|
||||
descriptions[27]="Move the cursor to a specified position"
|
||||
descriptions[28]="Set the cursor theme and reloads the cursor manager"
|
||||
descriptions[29]="Set the hyprctl error string"
|
||||
descriptions[30]="Move the active workspace to a monitor"
|
||||
descriptions[31]="CONFUSED"
|
||||
descriptions[34]="Set a property of a window"
|
||||
descriptions[35]="Specify the Hyprland instance"
|
||||
descriptions[36]="Toggle the current window's floating state"
|
||||
descriptions[37]="Get the list of defined workspace rules"
|
||||
descriptions[38]="Move the focused window to a workspace"
|
||||
descriptions[40]="Temporarily enable or disable binds:ignore_group_lock"
|
||||
descriptions[41]="List all workspaces with their properties"
|
||||
descriptions[42]="Swap the active window with the next or previous in a group"
|
||||
descriptions[43]="Close a specified window"
|
||||
descriptions[44]="WARNING"
|
||||
descriptions[45]="Specify the Hyprland instance"
|
||||
descriptions[46]="List all registered binds"
|
||||
descriptions[47]="Move the active window in a direction or to a monitor"
|
||||
descriptions[48]="Change the split ratio"
|
||||
descriptions[50]="Prohibit the active window from becoming or being inserted into group"
|
||||
descriptions[51]="Change the workspace"
|
||||
descriptions[52]="List all current config parsing errors"
|
||||
descriptions[53]="Toggle the current active window into a group"
|
||||
descriptions[54]="Get the config option status (values)"
|
||||
descriptions[57]="Close the active window"
|
||||
descriptions[58]="Pass the key to a specified window"
|
||||
descriptions[59]="List all decorations and their info"
|
||||
descriptions[60]="List all connected keyboards and mice"
|
||||
descriptions[61]="Switch focus from current to previously focused window"
|
||||
descriptions[62]="Change the current mapping group"
|
||||
descriptions[63]="Execute a Global Shortcut using the GlobalShortcuts portal"
|
||||
descriptions[65]="Force the renderer to reload all resources and outputs"
|
||||
descriptions[66]="Move a selected window"
|
||||
descriptions[68]="Print the Hyprland version: flags, commit and branch of build"
|
||||
descriptions[69]="Set all monitors' DPMS status"
|
||||
descriptions[70]="Resize the active window"
|
||||
descriptions[71]="Move the active window into a group"
|
||||
descriptions[72]="OK"
|
||||
descriptions[74]="Set the current window's floating state to true"
|
||||
descriptions[75]="Print tail of the log"
|
||||
descriptions[78]="List all layouts available (including plugin ones)"
|
||||
descriptions[79]="Move a workspace to a monitor"
|
||||
descriptions[80]="Execute a shell command"
|
||||
descriptions[82]="Modify the window stack order of the active or specified window"
|
||||
descriptions[83]="Toggle the focused window's internal fullscreen state"
|
||||
descriptions[85]="Issue a keyword to call a config keyword dynamically"
|
||||
descriptions[88]="Pin a window"
|
||||
descriptions[89]="Allows adding/removing fake outputs to a specific backend"
|
||||
descriptions[91]="Toggle a special workspace on/off"
|
||||
descriptions[92]="Toggle the focused window's fullscreen state"
|
||||
descriptions[93]="Toggle the current window to always be opaque"
|
||||
descriptions[94]="Focus the requested workspace"
|
||||
descriptions[96]="Switch to the next window in a group"
|
||||
descriptions[97]="Output in JSON format"
|
||||
descriptions[98]="List all running Hyprland instances and their info"
|
||||
descriptions[99]="Execute a raw shell command"
|
||||
descriptions[100]="Exit the compositor with no questions asked"
|
||||
descriptions[101]="List all windows with their properties"
|
||||
descriptions[103]="Execute a batch of commands separated by ;"
|
||||
descriptions[104]="Dismiss all or up to amount of notifications"
|
||||
descriptions[106]="Set the xkb layout index for a keyboard"
|
||||
descriptions[107]="Move window doesnt switch to the workspace"
|
||||
descriptions[108]="Behave as moveintogroup"
|
||||
descriptions[109]="Refresh state after issuing the command"
|
||||
descriptions[110]="Move the focus in a direction"
|
||||
descriptions[111]="Focus the urgent window or the last window"
|
||||
descriptions[113]="Get the active workspace name and its properties"
|
||||
descriptions[114]="Issue a dispatch to call a keybind dispatcher with an arg"
|
||||
descriptions[116]="Center the active window"
|
||||
descriptions[117]="HINT"
|
||||
descriptions[118]="Interact with hyprpaper if present"
|
||||
descriptions[119]="No Icon"
|
||||
descriptions[120]="Force reload the config"
|
||||
descriptions[122]="Print system info"
|
||||
descriptions[123]="Interact with a plugin"
|
||||
descriptions[125]="Get the active window name and its properties"
|
||||
descriptions[126]="Swap the active workspaces between two monitors"
|
||||
descriptions[127]="Print the current random splash"
|
||||
descriptions[129]="Lock the focused group"
|
||||
descriptions[132]="Lock the groups"
|
||||
descriptions[133]="Move the cursor to the corner of the active window"
|
||||
descriptions[136]="INFO"
|
||||
descriptions[137]="Resize a selected window"
|
||||
descriptions[1]="Resize the active window"
|
||||
descriptions[2]="Fullscreen"
|
||||
descriptions[3]="Switch to the next window in a group"
|
||||
descriptions[4]="Refresh state after issuing the command"
|
||||
descriptions[5]="Move the active window into a group"
|
||||
descriptions[7]="CONFUSED"
|
||||
descriptions[9]="Print system info"
|
||||
descriptions[11]="List all layouts available (including plugin ones)"
|
||||
descriptions[12]="Set a property of a window"
|
||||
descriptions[14]="Set the xkb layout index for a keyboard"
|
||||
descriptions[16]="Prohibit the active window from becoming or being inserted into group"
|
||||
descriptions[19]="Execute a shell command"
|
||||
descriptions[20]="Set the cursor theme and reloads the cursor manager"
|
||||
descriptions[22]="Focus the urgent window or the last window"
|
||||
descriptions[23]="Get the list of defined workspace rules"
|
||||
descriptions[24]="Move the active workspace to a monitor"
|
||||
descriptions[25]="Move window doesnt switch to the workspace"
|
||||
descriptions[26]="Interact with hyprpaper if present"
|
||||
descriptions[29]="Swap the active window with the next or previous in a group"
|
||||
descriptions[30]="Move the cursor to the corner of the active window"
|
||||
descriptions[31]="Move a selected window"
|
||||
descriptions[33]="Move the active window in a direction or to a monitor"
|
||||
descriptions[34]="Lists all global shortcuts"
|
||||
descriptions[35]="List all windows with their properties"
|
||||
descriptions[37]="Temporarily enable or disable binds:ignore_group_lock"
|
||||
descriptions[38]="Print the current random splash"
|
||||
descriptions[39]="Execute a raw shell command"
|
||||
descriptions[40]="List active outputs with their properties"
|
||||
descriptions[43]="Disable output"
|
||||
descriptions[44]="Gets the current config info about animations and beziers"
|
||||
descriptions[47]="Change the split ratio"
|
||||
descriptions[48]="Move the active window"
|
||||
descriptions[49]="Pass the key to a specified window"
|
||||
descriptions[50]="Swap the focused window with the next window"
|
||||
descriptions[51]="List all connected keyboards and mice"
|
||||
descriptions[52]="List the layers"
|
||||
descriptions[54]="Lock the focused group"
|
||||
descriptions[55]="OK"
|
||||
descriptions[56]="Move a workspace to a monitor"
|
||||
descriptions[58]="Specify the Hyprland instance"
|
||||
descriptions[59]="Disable output"
|
||||
descriptions[61]="Pin a window"
|
||||
descriptions[62]="WARNING"
|
||||
descriptions[63]="INFO"
|
||||
descriptions[66]="Set the current window's floating state to true"
|
||||
descriptions[69]="On shortcut X sends shortcut Y to a specified window"
|
||||
descriptions[70]="List all workspaces with their properties"
|
||||
descriptions[71]="Focus the next window on a workspace"
|
||||
descriptions[72]="Modify the window stack order of the active or specified window"
|
||||
descriptions[73]="Toggle the current active window into a group"
|
||||
descriptions[74]="Lock the groups"
|
||||
descriptions[76]="Set all monitors' DPMS status"
|
||||
descriptions[77]="Switch focus from current to previously focused window"
|
||||
descriptions[78]="No Icon"
|
||||
descriptions[79]="Execute a batch of commands separated by ;"
|
||||
descriptions[80]="Send a notification using the built-in Hyprland notification system"
|
||||
descriptions[82]="List all running Hyprland instances and their info"
|
||||
descriptions[83]="Maximize no fullscreen"
|
||||
descriptions[84]="Maximize and fullscreen"
|
||||
descriptions[85]="Move the active window out of a group"
|
||||
descriptions[86]="Close the active window"
|
||||
descriptions[87]="HINT"
|
||||
descriptions[88]="Move the focused window to a workspace"
|
||||
descriptions[89]="Move the cursor to a specified position"
|
||||
descriptions[90]="List all current config parsing errors"
|
||||
descriptions[91]="Close a specified window"
|
||||
descriptions[92]="Swap the active window with another window"
|
||||
descriptions[93]="Apply a tag to the window"
|
||||
descriptions[94]="Force the renderer to reload all resources and outputs"
|
||||
descriptions[95]="Center the active window"
|
||||
descriptions[97]="Focus the first window matching"
|
||||
descriptions[98]="Set the hyprctl error string"
|
||||
descriptions[101]="List all registered binds"
|
||||
descriptions[102]="Print the Hyprland version: flags, commit and branch of build"
|
||||
descriptions[103]="Prints the help message"
|
||||
descriptions[104]="Toggle a special workspace on/off"
|
||||
descriptions[105]="Toggle the focused window's fullscreen state"
|
||||
descriptions[107]="None"
|
||||
descriptions[108]="Issue a keyword to call a config keyword dynamically"
|
||||
descriptions[109]="Toggle the current window to always be opaque"
|
||||
descriptions[110]="ERROR"
|
||||
descriptions[111]="Specify the Hyprland instance"
|
||||
descriptions[112]="Toggle the current window's floating state"
|
||||
descriptions[113]="Rename a workspace"
|
||||
descriptions[115]="Get the active workspace name and its properties"
|
||||
descriptions[117]="Get into a kill mode, where you can kill an app by clicking on it"
|
||||
descriptions[119]="Allows adding/removing fake outputs to a specific backend"
|
||||
descriptions[120]="Execute a Global Shortcut using the GlobalShortcuts portal"
|
||||
descriptions[121]="Issue a dispatch to call a keybind dispatcher with an arg"
|
||||
descriptions[122]="Force reload the config"
|
||||
descriptions[124]="Output in JSON format"
|
||||
descriptions[125]="Emits a custom event to socket2"
|
||||
descriptions[126]="Prints the help message"
|
||||
descriptions[128]="Current"
|
||||
descriptions[129]="Get the active window name and its properties"
|
||||
descriptions[131]="Dismiss all or up to amount of notifications"
|
||||
descriptions[132]="Focus a monitor"
|
||||
descriptions[133]="Move the focus in a direction"
|
||||
descriptions[134]="Interact with a plugin"
|
||||
descriptions[135]="Exit the compositor with no questions asked"
|
||||
descriptions[136]="Change the workspace"
|
||||
descriptions[137]="Sets the focused window’s fullscreen mode and the one sent to the client"
|
||||
descriptions[138]="Get the config option status (values)"
|
||||
descriptions[141]="List all decorations and their info"
|
||||
descriptions[142]="Set the current window's floating state to false"
|
||||
descriptions[144]="Return a parsable JSON with all the config options, descriptions, value types and ranges"
|
||||
descriptions[145]="Resize a selected window"
|
||||
descriptions[146]="Toggle the focused window's internal fullscreen state"
|
||||
descriptions[147]="Print tail of the log"
|
||||
descriptions[148]="Swap the active workspaces between two monitors"
|
||||
descriptions[149]="Change the current mapping group"
|
||||
descriptions[151]="Behave as moveintogroup"
|
||||
descriptions[152]="Get the current cursor pos in global layout coordinates"
|
||||
descriptions[154]="Focus the requested workspace"
|
||||
|
||||
local -A literal_transitions
|
||||
literal_transitions[1]="([104]=2 [75]=3 [34]=4 [2]=3 [3]=3 [78]=3 [106]=5 [37]=3 [109]=6 [41]=3 [46]=3 [113]=3 [85]=7 [114]=9 [52]=3 [54]=3 [89]=10 [118]=3 [120]=3 [122]=3 [16]=3 [59]=11 [60]=3 [18]=12 [123]=13 [20]=3 [125]=3 [127]=3 [26]=14 [68]=3 [97]=6 [98]=3 [28]=3 [29]=15 [101]=3 [103]=6)"
|
||||
literal_transitions[4]="([73]=19 [14]=3 [33]=19 [55]=19 [56]=19 [90]=19 [105]=3 [121]=3 [77]=2 [17]=3 [124]=19 [4]=2 [6]=3 [64]=19 [128]=3 [130]=19 [81]=19 [131]=19 [84]=19 [32]=19 [49]=3 [13]=3 [86]=19 [11]=19 [87]=19 [138]=19)"
|
||||
literal_transitions[8]="([104]=2 [75]=3 [34]=4 [2]=3 [3]=3 [78]=3 [106]=5 [37]=3 [41]=3 [46]=3 [113]=3 [85]=7 [114]=9 [52]=3 [54]=3 [89]=10 [118]=3 [120]=3 [122]=3 [16]=3 [59]=11 [60]=3 [18]=12 [123]=13 [20]=3 [125]=3 [127]=3 [26]=14 [68]=3 [98]=3 [28]=3 [29]=15 [101]=3)"
|
||||
literal_transitions[9]="([129]=3 [132]=3 [1]=3 [74]=3 [36]=3 [107]=3 [38]=3 [108]=3 [5]=3 [79]=3 [40]=3 [80]=3 [111]=3 [7]=3 [42]=3 [43]=3 [82]=3 [83]=3 [47]=3 [48]=3 [10]=3 [110]=3 [51]=3 [53]=3 [12]=3 [116]=3 [88]=3 [50]=3 [57]=3 [91]=3 [58]=3 [92]=3 [93]=3 [61]=3 [62]=3 [126]=3 [94]=3 [63]=3 [21]=3 [96]=3 [23]=3 [24]=3 [65]=3 [66]=3 [25]=3 [133]=3 [27]=3 [69]=3 [99]=3 [70]=3 [30]=3 [137]=3 [71]=3 [100]=3)"
|
||||
literal_transitions[10]="([115]=16 [112]=17)"
|
||||
literal_transitions[12]="([102]=3)"
|
||||
literal_transitions[14]="([22]=2 [117]=2 [31]=2 [136]=2 [119]=2 [44]=2 [72]=2)"
|
||||
literal_transitions[15]="([39]=3)"
|
||||
literal_transitions[16]="([9]=3 [67]=3 [15]=3 [134]=3)"
|
||||
literal_transitions[18]="([76]=20)"
|
||||
literal_transitions[19]="([19]=3 [8]=3)"
|
||||
literal_transitions[20]="([35]=6 [45]=6)"
|
||||
literal_transitions[21]="([135]=3 [95]=3)"
|
||||
literal_transitions[1]="([121]=15 [44]=3 [126]=22 [82]=3 [4]=22 [52]=3 [51]=3 [129]=3 [90]=3 [59]=22 [9]=3 [11]=3 [12]=4 [131]=5 [14]=6 [98]=7 [102]=3 [103]=22 [134]=8 [101]=3 [138]=3 [23]=3 [20]=3 [141]=9 [26]=3 [144]=3 [108]=10 [147]=11 [70]=3 [34]=3 [35]=3 [79]=22 [115]=3 [38]=3 [152]=3 [117]=3 [122]=14 [124]=22 [40]=12 [43]=22 [80]=16 [119]=13)"
|
||||
literal_transitions[2]="([82]=3 [52]=3 [51]=3 [129]=3 [9]=3 [90]=3 [11]=3 [12]=4 [131]=5 [14]=6 [98]=7 [102]=3 [134]=8 [101]=3 [23]=3 [20]=3 [138]=3 [141]=9 [26]=3 [144]=3 [108]=10 [147]=11 [70]=3 [34]=3 [35]=3 [115]=3 [38]=3 [152]=3 [117]=3 [40]=12 [119]=13 [122]=14 [121]=15 [80]=16 [44]=3)"
|
||||
literal_transitions[4]="([140]=3 [64]=17 [65]=17 [46]=17 [106]=17 [28]=3 [27]=3 [53]=5 [6]=17 [67]=3 [68]=17 [130]=17 [114]=17 [13]=3 [75]=5 [100]=3 [36]=17 [153]=17 [99]=17 [60]=17 [118]=17 [42]=17 [18]=3 [139]=17 [155]=3 [123]=17)"
|
||||
literal_transitions[7]="([127]=3)"
|
||||
literal_transitions[11]="([57]=3)"
|
||||
literal_transitions[12]="([10]=3)"
|
||||
literal_transitions[13]="([15]=20 [81]=23)"
|
||||
literal_transitions[14]="([143]=3)"
|
||||
literal_transitions[15]="([1]=3 [85]=3 [3]=3 [86]=3 [5]=3 [88]=3 [89]=3 [91]=3 [92]=3 [93]=3 [94]=3 [95]=3 [97]=3 [16]=3 [19]=3 [104]=3 [22]=3 [105]=3 [24]=3 [25]=3 [29]=3 [30]=3 [31]=3 [109]=3 [112]=3 [33]=3 [113]=3 [37]=3 [39]=3 [120]=3 [125]=3 [47]=3 [48]=3 [49]=3 [50]=3 [54]=3 [56]=3 [132]=3 [133]=3 [135]=3 [136]=3 [61]=3 [137]=21 [142]=3 [66]=3 [145]=3 [146]=3 [69]=3 [148]=3 [71]=3 [72]=3 [73]=3 [74]=3 [149]=3 [76]=3 [77]=3 [151]=3 [154]=3)"
|
||||
literal_transitions[16]="([87]=5 [7]=5 [110]=5 [62]=5 [78]=5 [55]=5 [63]=5)"
|
||||
literal_transitions[17]="([41]=3 [45]=3)"
|
||||
literal_transitions[18]="([8]=24)"
|
||||
literal_transitions[19]="([32]=3 [150]=3)"
|
||||
literal_transitions[20]="([96]=3 [17]=3 [116]=3 [21]=3)"
|
||||
literal_transitions[21]="([107]=3 [83]=3 [128]=3 [2]=3 [84]=3)"
|
||||
literal_transitions[24]="([58]=22 [111]=22)"
|
||||
|
||||
local -A match_anything_transitions
|
||||
match_anything_transitions=([2]=3 [1]=8 [7]=3 [21]=3 [11]=3 [3]=18 [8]=8 [13]=3 [15]=18 [17]=3 [5]=21 [12]=18)
|
||||
match_anything_transitions=([7]=18 [8]=3 [1]=2 [23]=3 [6]=19 [5]=3 [3]=18 [19]=3 [12]=18 [9]=3 [10]=3 [14]=18 [11]=18 [2]=2)
|
||||
|
||||
declare -A subword_transitions
|
||||
|
||||
@@ -195,7 +214,7 @@ _hyprctl () {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
local -A commands=([17]=2 [5]=3 [13]=1 [11]=0)
|
||||
local -A commands=([8]=0 [23]=1 [9]=3 [6]=2)
|
||||
|
||||
if [[ -v "commands[$state]" ]]; then
|
||||
local command_id=${commands[$state]}
|
||||
@@ -248,4 +267,8 @@ _hyprctl () {
|
||||
return 0
|
||||
}
|
||||
|
||||
if [[ $ZSH_EVAL_CONTEXT =~ :file$ ]]; then
|
||||
compdef _hyprctl hyprctl
|
||||
else
|
||||
_hyprctl
|
||||
fi
|
||||
|
190
hyprctl/main.cpp
@@ -1,9 +1,9 @@
|
||||
#include <ctype.h>
|
||||
#include <cctype>
|
||||
#include <netdb.h>
|
||||
#include <netinet/in.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <cstdio>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
@@ -12,7 +12,7 @@
|
||||
#include <unistd.h>
|
||||
#include <ranges>
|
||||
#include <algorithm>
|
||||
#include <signal.h>
|
||||
#include <csignal>
|
||||
#include <format>
|
||||
|
||||
#include <iostream>
|
||||
@@ -22,14 +22,19 @@
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <filesystem>
|
||||
#include <stdarg.h>
|
||||
#include <cstdarg>
|
||||
#include <regex>
|
||||
#include <sys/socket.h>
|
||||
#include <hyprutils/string/String.hpp>
|
||||
#include <cstring>
|
||||
using namespace Hyprutils::String;
|
||||
|
||||
#include "Strings.hpp"
|
||||
|
||||
#define PAD
|
||||
|
||||
std::string instanceSignature;
|
||||
bool quiet = false;
|
||||
|
||||
struct SInstanceData {
|
||||
std::string id;
|
||||
@@ -39,6 +44,13 @@ struct SInstanceData {
|
||||
bool valid = true;
|
||||
};
|
||||
|
||||
void log(std::string str) {
|
||||
if (quiet)
|
||||
return;
|
||||
|
||||
std::cout << str << "\n";
|
||||
}
|
||||
|
||||
std::string getRuntimeDir() {
|
||||
const auto XDG = getenv("XDG_RUNTIME_DIR");
|
||||
|
||||
@@ -90,24 +102,64 @@ std::vector<SInstanceData> instances() {
|
||||
return result;
|
||||
}
|
||||
|
||||
void request(std::string arg, int minArgs = 0) {
|
||||
static volatile bool sigintReceived = false;
|
||||
void intHandler(int sig) {
|
||||
sigintReceived = true;
|
||||
std::cout << "[hyprctl] SIGINT received, closing connection" << std::endl;
|
||||
}
|
||||
|
||||
int rollingRead(const int socket) {
|
||||
sigintReceived = false;
|
||||
signal(SIGINT, intHandler);
|
||||
|
||||
constexpr size_t BUFFER_SIZE = 8192;
|
||||
std::array<char, BUFFER_SIZE> buffer = {0};
|
||||
long sizeWritten = 0;
|
||||
std::cout << "[hyprctl] reading from socket following up log:" << std::endl;
|
||||
while (!sigintReceived) {
|
||||
sizeWritten = read(socket, buffer.data(), BUFFER_SIZE);
|
||||
if (sizeWritten < 0 && errno != EAGAIN) {
|
||||
if (errno != EINTR)
|
||||
std::cout << "Couldn't read (5) " << strerror(errno) << ":" << errno << std::endl;
|
||||
close(socket);
|
||||
return 5;
|
||||
}
|
||||
|
||||
if (sizeWritten == 0)
|
||||
break;
|
||||
|
||||
if (sizeWritten > 0) {
|
||||
std::cout << std::string(buffer.data(), sizeWritten);
|
||||
buffer.fill('\0');
|
||||
}
|
||||
|
||||
usleep(100000);
|
||||
}
|
||||
close(socket);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int request(std::string arg, int minArgs = 0, bool needRoll = false) {
|
||||
const auto SERVERSOCKET = socket(AF_UNIX, SOCK_STREAM, 0);
|
||||
|
||||
auto t = timeval{.tv_sec = 5, .tv_usec = 0};
|
||||
setsockopt(SERVERSOCKET, SOL_SOCKET, SO_RCVTIMEO, &t, sizeof(struct timeval));
|
||||
|
||||
const auto ARGS = std::count(arg.begin(), arg.end(), ' ');
|
||||
|
||||
if (ARGS < minArgs) {
|
||||
std::cout << "Not enough arguments, expected at least " << minArgs;
|
||||
return;
|
||||
log(std::format("Not enough arguments in '{}', expected at least {}", arg, minArgs));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (SERVERSOCKET < 0) {
|
||||
std::cout << "Couldn't open a socket (1)";
|
||||
return;
|
||||
log("Couldn't open a socket (1)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (instanceSignature.empty()) {
|
||||
std::cout << "HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)";
|
||||
return;
|
||||
log("HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)");
|
||||
return 2;
|
||||
}
|
||||
|
||||
const std::string USERID = std::to_string(getpwuid(getuid())->pw_uid);
|
||||
@@ -120,25 +172,30 @@ void request(std::string arg, int minArgs = 0) {
|
||||
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
|
||||
|
||||
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
|
||||
std::cout << "Couldn't connect to " << socketPath << ". (3)";
|
||||
return;
|
||||
log("Couldn't connect to " + socketPath + ". (3)");
|
||||
return 3;
|
||||
}
|
||||
|
||||
auto sizeWritten = write(SERVERSOCKET, arg.c_str(), arg.length());
|
||||
|
||||
if (sizeWritten < 0) {
|
||||
std::cout << "Couldn't write (4)";
|
||||
return;
|
||||
log("Couldn't write (4)");
|
||||
return 4;
|
||||
}
|
||||
|
||||
if (needRoll)
|
||||
return rollingRead(SERVERSOCKET);
|
||||
|
||||
std::string reply = "";
|
||||
char buffer[8192] = {0};
|
||||
|
||||
sizeWritten = read(SERVERSOCKET, buffer, 8192);
|
||||
|
||||
if (sizeWritten < 0) {
|
||||
std::cout << "Couldn't read (5)";
|
||||
return;
|
||||
if (errno == EWOULDBLOCK)
|
||||
log("Hyprland IPC didn't respond in time\n");
|
||||
log("Couldn't read (5)");
|
||||
return 5;
|
||||
}
|
||||
|
||||
reply += std::string(buffer, sizeWritten);
|
||||
@@ -146,28 +203,30 @@ void request(std::string arg, int minArgs = 0) {
|
||||
while (sizeWritten == 8192) {
|
||||
sizeWritten = read(SERVERSOCKET, buffer, 8192);
|
||||
if (sizeWritten < 0) {
|
||||
std::cout << "Couldn't read (5)";
|
||||
return;
|
||||
log("Couldn't read (5)");
|
||||
return 5;
|
||||
}
|
||||
reply += std::string(buffer, sizeWritten);
|
||||
}
|
||||
|
||||
close(SERVERSOCKET);
|
||||
|
||||
std::cout << reply;
|
||||
log(reply);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void requestHyprpaper(std::string arg) {
|
||||
int 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;
|
||||
log("Couldn't open a socket (1)");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (instanceSignature.empty()) {
|
||||
std::cout << "HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)";
|
||||
return;
|
||||
log("HYPRLAND_INSTANCE_SIGNATURE was not set! (Is Hyprland running?)");
|
||||
return 2;
|
||||
}
|
||||
|
||||
sockaddr_un serverAddress = {0};
|
||||
@@ -180,8 +239,8 @@ void requestHyprpaper(std::string arg) {
|
||||
strncpy(serverAddress.sun_path, socketPath.c_str(), sizeof(serverAddress.sun_path) - 1);
|
||||
|
||||
if (connect(SERVERSOCKET, (sockaddr*)&serverAddress, SUN_LEN(&serverAddress)) < 0) {
|
||||
std::cout << "Couldn't connect to " << socketPath << ". (3)";
|
||||
return;
|
||||
log("Couldn't connect to " + socketPath + ". (3)");
|
||||
return 3;
|
||||
}
|
||||
|
||||
arg = arg.substr(arg.find_first_of('/') + 1); // strip flags
|
||||
@@ -190,8 +249,8 @@ void requestHyprpaper(std::string arg) {
|
||||
auto sizeWritten = write(SERVERSOCKET, arg.c_str(), arg.length());
|
||||
|
||||
if (sizeWritten < 0) {
|
||||
std::cout << "Couldn't write (4)";
|
||||
return;
|
||||
log("Couldn't write (4)");
|
||||
return 4;
|
||||
}
|
||||
|
||||
char buffer[8192] = {0};
|
||||
@@ -199,13 +258,15 @@ void requestHyprpaper(std::string arg) {
|
||||
sizeWritten = read(SERVERSOCKET, buffer, 8192);
|
||||
|
||||
if (sizeWritten < 0) {
|
||||
std::cout << "Couldn't read (5)";
|
||||
return;
|
||||
log("Couldn't read (5)");
|
||||
return 5;
|
||||
}
|
||||
|
||||
close(SERVERSOCKET);
|
||||
|
||||
std::cout << std::string(buffer);
|
||||
log(std::string(buffer));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void batchRequest(std::string arg, bool json) {
|
||||
@@ -226,12 +287,12 @@ void instancesRequest(bool json) {
|
||||
std::vector<SInstanceData> inst = instances();
|
||||
|
||||
if (!json) {
|
||||
for (auto& el : inst) {
|
||||
for (auto const& el : inst) {
|
||||
result += std::format("instance {}:\n\ttime: {}\n\tpid: {}\n\twl socket: {}\n\n", el.id, el.time, el.pid, el.wlSocket);
|
||||
}
|
||||
} else {
|
||||
result += '[';
|
||||
for (auto& el : inst) {
|
||||
for (auto const& el : inst) {
|
||||
result += std::format(R"#(
|
||||
{{
|
||||
"instance": "{}",
|
||||
@@ -246,7 +307,7 @@ void instancesRequest(bool json) {
|
||||
result += "\n]";
|
||||
}
|
||||
|
||||
std::cout << result << "\n";
|
||||
log(result + "\n");
|
||||
}
|
||||
|
||||
std::deque<std::string> splitArgs(int argc, char** argv) {
|
||||
@@ -258,12 +319,6 @@ std::deque<std::string> splitArgs(int argc, char** argv) {
|
||||
return result;
|
||||
}
|
||||
|
||||
bool isNumber(const std::string& str, bool allowfloat) {
|
||||
if (str.empty())
|
||||
return false;
|
||||
return std::ranges::all_of(str.begin(), str.end(), [&](char c) { return isdigit(c) != 0 || c == '-' || (allowfloat && c == '.'); });
|
||||
}
|
||||
|
||||
int main(int argc, char** argv) {
|
||||
bool parseArgs = true;
|
||||
|
||||
@@ -276,6 +331,7 @@ int main(int argc, char** argv) {
|
||||
std::string fullArgs = "";
|
||||
const auto ARGS = splitArgs(argc, argv);
|
||||
bool json = false;
|
||||
bool needRoll = false;
|
||||
std::string overrideInstance = "";
|
||||
|
||||
for (std::size_t i = 0; i < ARGS.size(); ++i) {
|
||||
@@ -293,6 +349,11 @@ int main(int argc, char** argv) {
|
||||
fullArgs += "r";
|
||||
} else if (ARGS[i] == "-a" && !fullArgs.contains("a")) {
|
||||
fullArgs += "a";
|
||||
} else if ((ARGS[i] == "-c" || ARGS[i] == "--config") && !fullArgs.contains("c")) {
|
||||
fullArgs += "c";
|
||||
} else if ((ARGS[i] == "-f" || ARGS[i] == "--follow") && !fullArgs.contains("f")) {
|
||||
fullArgs += "f";
|
||||
needRoll = true;
|
||||
} else if (ARGS[i] == "--batch") {
|
||||
fullRequest = "--batch ";
|
||||
} else if (ARGS[i] == "--instance" || ARGS[i] == "-i") {
|
||||
@@ -304,6 +365,8 @@ int main(int argc, char** argv) {
|
||||
}
|
||||
|
||||
overrideInstance = ARGS[i];
|
||||
} else if (ARGS[i] == "-q" || ARGS[i] == "--quiet") {
|
||||
quiet = true;
|
||||
} else if (ARGS[i] == "--help") {
|
||||
const std::string& cmd = ARGS[0];
|
||||
|
||||
@@ -350,11 +413,16 @@ int main(int argc, char** argv) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (needRoll && !fullRequest.contains("/rollinglog")) {
|
||||
log("only 'rollinglog' command supports '--follow' option");
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (overrideInstance.contains("_"))
|
||||
instanceSignature = overrideInstance;
|
||||
else if (!overrideInstance.empty()) {
|
||||
if (!isNumber(overrideInstance, false)) {
|
||||
std::cout << "instance invalid\n";
|
||||
log("instance invalid\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -363,7 +431,7 @@ int main(int argc, char** argv) {
|
||||
const auto INSTANCES = instances();
|
||||
|
||||
if (INSTANCENO < 0 || static_cast<std::size_t>(INSTANCENO) >= INSTANCES.size()) {
|
||||
std::cout << "no such instance\n";
|
||||
log("no such instance\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -372,7 +440,7 @@ int main(int argc, char** argv) {
|
||||
const auto ISIG = getenv("HYPRLAND_INSTANCE_SIGNATURE");
|
||||
|
||||
if (!ISIG) {
|
||||
std::cout << "HYPRLAND_INSTANCE_SIGNATURE not set! (is hyprland running?)\n";
|
||||
log("HYPRLAND_INSTANCE_SIGNATURE not set! (is hyprland running?)\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -384,35 +452,37 @@ int main(int argc, char** argv) {
|
||||
if (fullRequest.contains("/--batch"))
|
||||
batchRequest(fullRequest, json);
|
||||
else if (fullRequest.contains("/hyprpaper"))
|
||||
requestHyprpaper(fullRequest);
|
||||
exitStatus = requestHyprpaper(fullRequest);
|
||||
else if (fullRequest.contains("/switchxkblayout"))
|
||||
request(fullRequest, 2);
|
||||
exitStatus = request(fullRequest, 2);
|
||||
else if (fullRequest.contains("/seterror"))
|
||||
request(fullRequest, 1);
|
||||
exitStatus = request(fullRequest, 1);
|
||||
else if (fullRequest.contains("/setprop"))
|
||||
request(fullRequest, 3);
|
||||
exitStatus = request(fullRequest, 3);
|
||||
else if (fullRequest.contains("/plugin"))
|
||||
request(fullRequest, 1);
|
||||
exitStatus = request(fullRequest, 1);
|
||||
else if (fullRequest.contains("/dismissnotify"))
|
||||
request(fullRequest, 0);
|
||||
exitStatus = request(fullRequest, 0);
|
||||
else if (fullRequest.contains("/notify"))
|
||||
request(fullRequest, 2);
|
||||
exitStatus = request(fullRequest, 2);
|
||||
else if (fullRequest.contains("/output"))
|
||||
request(fullRequest, 2);
|
||||
exitStatus = request(fullRequest, 2);
|
||||
else if (fullRequest.contains("/setcursor"))
|
||||
request(fullRequest, 1);
|
||||
exitStatus = request(fullRequest, 1);
|
||||
else if (fullRequest.contains("/dispatch"))
|
||||
request(fullRequest, 1);
|
||||
exitStatus = request(fullRequest, 1);
|
||||
else if (fullRequest.contains("/keyword"))
|
||||
request(fullRequest, 2);
|
||||
exitStatus = request(fullRequest, 2);
|
||||
else if (fullRequest.contains("/decorations"))
|
||||
request(fullRequest, 1);
|
||||
exitStatus = request(fullRequest, 1);
|
||||
else if (fullRequest.contains("/--help"))
|
||||
std::cout << USAGE << std::endl;
|
||||
else if (fullRequest.contains("/rollinglog") && needRoll)
|
||||
exitStatus = request(fullRequest, 0, true);
|
||||
else {
|
||||
request(fullRequest);
|
||||
exitStatus = request(fullRequest);
|
||||
}
|
||||
|
||||
std::cout << std::endl;
|
||||
std::cout << std::flush;
|
||||
return exitStatus;
|
||||
}
|
||||
|
@@ -1,7 +1,26 @@
|
||||
executable('hyprctl', 'main.cpp',
|
||||
install: true
|
||||
executable(
|
||||
'hyprctl',
|
||||
'main.cpp',
|
||||
dependencies: [
|
||||
dependency('hyprutils', version: '>= 0.1.1'),
|
||||
],
|
||||
install: true,
|
||||
)
|
||||
|
||||
install_data('hyprctl.bash', install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'), install_tag: 'runtime', rename: 'hyprctl')
|
||||
install_data('hyprctl.fish', install_dir: join_paths(get_option('datadir'), 'fish/vendor_completions.d'), install_tag: 'runtime')
|
||||
install_data('hyprctl.zsh', install_dir: join_paths(get_option('datadir'), 'zsh/site-functions'), install_tag: 'runtime', rename: '_hyprctl')
|
||||
install_data(
|
||||
'hyprctl.bash',
|
||||
install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'),
|
||||
install_tag: 'runtime',
|
||||
rename: 'hyprctl',
|
||||
)
|
||||
install_data(
|
||||
'hyprctl.fish',
|
||||
install_dir: join_paths(get_option('datadir'), 'fish/vendor_completions.d'),
|
||||
install_tag: 'runtime',
|
||||
)
|
||||
install_data(
|
||||
'hyprctl.zsh',
|
||||
install_dir: join_paths(get_option('datadir'), 'zsh/site-functions'),
|
||||
install_tag: 'runtime',
|
||||
rename: '_hyprctl',
|
||||
)
|
||||
|
@@ -1,8 +1,7 @@
|
||||
prefix="@PREFIX@"
|
||||
includedir="${prefix}/include"
|
||||
prefix=@PREFIX@/@INCLUDEDIR@
|
||||
|
||||
Name: Hyprland
|
||||
URL: https://github.com/hyprwm/Hyprland
|
||||
Description: Hyprland header files
|
||||
Version: @HYPRLAND_VERSION@
|
||||
Cflags: -I"${includedir}/hyprland/protocols" -I"${includedir}/hyprland/wlroots-hyprland" -I"${includedir}"
|
||||
Cflags: -I${prefix} -I${prefix}/hyprland/protocols -I${prefix}/hyprland
|
||||
|
@@ -9,8 +9,21 @@ file(GLOB_RECURSE SRCFILES CONFIGURE_DEPENDS "src/*.cpp")
|
||||
|
||||
set(CMAKE_CXX_STANDARD 23)
|
||||
|
||||
pkg_check_modules(tomlplusplus REQUIRED IMPORTED_TARGET tomlplusplus)
|
||||
pkg_check_modules(deps REQUIRED IMPORTED_TARGET tomlplusplus hyprutils>=0.1.1)
|
||||
|
||||
add_executable(hyprpm ${SRCFILES})
|
||||
|
||||
target_link_libraries(hyprpm PUBLIC PkgConfig::tomlplusplus)
|
||||
target_link_libraries(hyprpm PUBLIC PkgConfig::deps)
|
||||
|
||||
# binary
|
||||
install(TARGETS hyprpm)
|
||||
|
||||
# shell completions
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprpm.bash
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/bash-completion/completions
|
||||
RENAME hyprpm)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprpm.fish
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/fish/vendor_completions.d)
|
||||
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/hyprpm.zsh
|
||||
DESTINATION ${CMAKE_INSTALL_DATADIR}/zsh/site-functions
|
||||
RENAME _hyprpm)
|
||||
|
@@ -1,5 +1,9 @@
|
||||
_hyprpm_cmd_0 () {
|
||||
hyprpm list | grep Plugin | awk '{print $4}'
|
||||
hyprpm list | awk '/Plugin/{print $4}'
|
||||
}
|
||||
|
||||
_hyprpm_cmd_1 () {
|
||||
hyprpm list | awk '/Repository/{print $4}' | sed 's/:$//'
|
||||
}
|
||||
|
||||
_hyprpm () {
|
||||
@@ -11,16 +15,13 @@ _hyprpm () {
|
||||
local words cword
|
||||
_get_comp_words_by_ref -n "$COMP_WORDBREAKS" words cword
|
||||
|
||||
local -a literals=("-n" "::=" "list" "disable" "--help" "update" "add" "--verbose" "-v" "--force" "remove" "enable" "--notify" "-h" "reload" "-f")
|
||||
|
||||
declare -a literals=(--no-shallow -n ::= disable list --help update add --verbose -v --force -s remove enable --notify -h reload -f)
|
||||
declare -A literal_transitions
|
||||
literal_transitions[0]="([9]=6 [2]=2 [7]=6 [8]=6 [4]=6 [10]=2 [11]=3 [5]=2 [13]=6 [3]=3 [14]=2 [15]=6 [6]=2)"
|
||||
literal_transitions[1]="([10]=2 [11]=3 [3]=3 [2]=2 [14]=2 [5]=2 [6]=2)"
|
||||
literal_transitions[4]="([1]=5)"
|
||||
literal_transitions[5]="([0]=6 [12]=6)"
|
||||
|
||||
declare -A match_anything_transitions
|
||||
match_anything_transitions=([3]=2 [2]=4 [0]=1 [1]=1)
|
||||
literal_transitions[0]="([0]=7 [3]=3 [4]=4 [8]=7 [9]=7 [6]=4 [7]=4 [11]=7 [5]=7 [10]=7 [12]=2 [13]=3 [15]=7 [16]=4 [17]=7)"
|
||||
literal_transitions[1]="([12]=2 [13]=3 [3]=3 [4]=4 [16]=4 [6]=4 [7]=4)"
|
||||
literal_transitions[5]="([2]=6)"
|
||||
literal_transitions[6]="([1]=7 [14]=7)"
|
||||
declare -A match_anything_transitions=([1]=1 [4]=5 [3]=4 [2]=4 [0]=1)
|
||||
declare -A subword_transitions
|
||||
|
||||
local state=0
|
||||
@@ -58,21 +59,9 @@ _hyprpm () {
|
||||
done
|
||||
|
||||
|
||||
local -a matches=()
|
||||
|
||||
local prefix="${words[$cword]}"
|
||||
|
||||
local shortest_suffix="$word"
|
||||
for ((i=0; i < ${#COMP_WORDBREAKS}; i++)); do
|
||||
local char="${COMP_WORDBREAKS:$i:1}"
|
||||
local candidate="${word##*$char}"
|
||||
if [[ ${#candidate} -lt ${#shortest_suffix} ]]; then
|
||||
shortest_suffix=$candidate
|
||||
fi
|
||||
done
|
||||
local superfluous_prefix=""
|
||||
if [[ "$shortest_suffix" != "$word" ]]; then
|
||||
local superfluous_prefix=${word%$shortest_suffix}
|
||||
fi
|
||||
|
||||
if [[ -v "literal_transitions[$state]" ]]; then
|
||||
local state_transitions_initializer=${literal_transitions[$state]}
|
||||
declare -A state_transitions
|
||||
@@ -81,25 +70,38 @@ _hyprpm () {
|
||||
for literal_id in "${!state_transitions[@]}"; do
|
||||
local literal="${literals[$literal_id]}"
|
||||
if [[ $literal = "${prefix}"* ]]; then
|
||||
local completion=${literal#"$superfluous_prefix"}
|
||||
COMPREPLY+=("$completion ")
|
||||
matches+=("$literal ")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
declare -A commands
|
||||
commands=([3]=0)
|
||||
commands=([3]=0 [2]=1)
|
||||
if [[ -v "commands[$state]" ]]; then
|
||||
local command_id=${commands[$state]}
|
||||
local completions=()
|
||||
mapfile -t completions < <(_hyprpm_cmd_${command_id} "$prefix" | cut -f1)
|
||||
readarray -t completions < <(_hyprpm_cmd_${command_id} "$prefix" | cut -f1)
|
||||
for item in "${completions[@]}"; do
|
||||
if [[ $item = "${prefix}"* ]]; then
|
||||
COMPREPLY+=("$item")
|
||||
matches+=("$item")
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
local shortest_suffix="$prefix"
|
||||
for ((i=0; i < ${#COMP_WORDBREAKS}; i++)); do
|
||||
local char="${COMP_WORDBREAKS:$i:1}"
|
||||
local candidate=${prefix##*$char}
|
||||
if [[ ${#candidate} -lt ${#shortest_suffix} ]]; then
|
||||
shortest_suffix=$candidate
|
||||
fi
|
||||
done
|
||||
local superfluous_prefix=""
|
||||
if [[ "$shortest_suffix" != "$prefix" ]]; then
|
||||
local superfluous_prefix=${prefix%$shortest_suffix}
|
||||
fi
|
||||
COMPREPLY=("${matches[@]#$superfluous_prefix}")
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -1,6 +1,11 @@
|
||||
function _hyprpm_1
|
||||
set 1 $argv[1]
|
||||
hyprpm list | grep Plugin | awk '{print $4}'
|
||||
hyprpm list | awk '/Plugin/{print $4}'
|
||||
end
|
||||
|
||||
function _hyprpm_2
|
||||
set 1 $argv[1]
|
||||
hyprpm list | awk '/Repository/{print $4}' | sed 's/:$//'
|
||||
end
|
||||
|
||||
function _hyprpm
|
||||
@@ -14,49 +19,51 @@ function _hyprpm
|
||||
set COMP_CWORD (count $COMP_WORDS)
|
||||
end
|
||||
|
||||
set --local literals "-n" "::=" "list" "disable" "--help" "update" "add" "--verbose" "-v" "--force" "remove" "enable" "--notify" "-h" "reload" "-f"
|
||||
set literals "--no-shallow" "-n" "::=" "disable" "list" "--help" "update" "add" "--verbose" "-v" "--force" "-s" "remove" "enable" "--notify" "-h" "reload" "-f"
|
||||
|
||||
set --local descriptions
|
||||
set descriptions[1] "Send a hyprland notification for important events (e.g. load fail)"
|
||||
set descriptions[3] "List all installed plugins"
|
||||
set descriptions
|
||||
set descriptions[1] "Disable shallow cloning of Hyprland sources"
|
||||
set descriptions[2] "Send a hyprland notification for important events (e.g. load fail)"
|
||||
set descriptions[4] "Unload a plugin"
|
||||
set descriptions[5] "Show help menu"
|
||||
set descriptions[6] "Check and update all plugins if needed"
|
||||
set descriptions[7] "Install a new plugin repository from git"
|
||||
set descriptions[8] "Enable too much loggin"
|
||||
set descriptions[5] "List all installed plugins"
|
||||
set descriptions[6] "Show help menu"
|
||||
set descriptions[7] "Check and update all plugins if needed"
|
||||
set descriptions[8] "Install a new plugin repository from git"
|
||||
set descriptions[9] "Enable too much loggin"
|
||||
set descriptions[10] "Force an operation ignoring checks (e.g. update -f)"
|
||||
set descriptions[11] "Remove a plugin repository"
|
||||
set descriptions[12] "Load a plugin"
|
||||
set descriptions[13] "Send a hyprland notification for important events (e.g. load fail)"
|
||||
set descriptions[14] "Show help menu"
|
||||
set descriptions[15] "Reload all plugins"
|
||||
set descriptions[16] "Force an operation ignoring checks (e.g. update -f)"
|
||||
set descriptions[10] "Enable too much loggin"
|
||||
set descriptions[11] "Force an operation ignoring checks (e.g. update -f)"
|
||||
set descriptions[12] "Disable shallow cloning of Hyprland sources"
|
||||
set descriptions[13] "Remove a plugin repository"
|
||||
set descriptions[14] "Load a plugin"
|
||||
set descriptions[15] "Send a hyprland notification for important events (e.g. load fail)"
|
||||
set descriptions[16] "Show help menu"
|
||||
set descriptions[17] "Reload all plugins"
|
||||
set descriptions[18] "Force an operation ignoring checks (e.g. update -f)"
|
||||
|
||||
set --local literal_transitions
|
||||
set literal_transitions[1] "set inputs 10 3 8 9 5 11 12 6 14 4 15 16 7; set tos 7 3 7 7 7 3 4 3 7 4 3 7 3"
|
||||
set literal_transitions[2] "set inputs 11 12 4 3 15 6 7; set tos 3 4 4 3 3 3 3"
|
||||
set literal_transitions[5] "set inputs 2; set tos 6"
|
||||
set literal_transitions[6] "set inputs 1 13; set tos 7 7"
|
||||
set literal_transitions
|
||||
set literal_transitions[1] "set inputs 1 4 5 9 10 7 8 12 6 11 13 14 16 17 18; set tos 8 4 5 8 8 5 5 8 8 8 3 4 8 5 8"
|
||||
set literal_transitions[2] "set inputs 13 14 4 5 17 7 8; set tos 3 4 4 5 5 5 5"
|
||||
set literal_transitions[6] "set inputs 3; set tos 7"
|
||||
set literal_transitions[7] "set inputs 2 15; set tos 8 8"
|
||||
|
||||
set --local match_anything_transitions_from 4 3 1 2
|
||||
set --local match_anything_transitions_to 3 5 2 2
|
||||
set match_anything_transitions_from 2 5 4 3 1
|
||||
set match_anything_transitions_to 2 6 5 5 2
|
||||
|
||||
set --local state 1
|
||||
set --local word_index 2
|
||||
set state 1
|
||||
set word_index 2
|
||||
while test $word_index -lt $COMP_CWORD
|
||||
set --local -- word $COMP_WORDS[$word_index]
|
||||
set -- word $COMP_WORDS[$word_index]
|
||||
|
||||
if set --query literal_transitions[$state] && test -n $literal_transitions[$state]
|
||||
set --local --erase inputs
|
||||
set --local --erase tos
|
||||
set --erase inputs
|
||||
set --erase tos
|
||||
eval $literal_transitions[$state]
|
||||
|
||||
if contains -- $word $literals
|
||||
set --local literal_matched 0
|
||||
set literal_matched 0
|
||||
for literal_id in (seq 1 (count $literals))
|
||||
if test $literals[$literal_id] = $word
|
||||
set --local index (contains --index -- $literal_id $inputs)
|
||||
set index (contains --index -- $literal_id $inputs)
|
||||
set state $tos[$index]
|
||||
set word_index (math $word_index + 1)
|
||||
set literal_matched 1
|
||||
@@ -70,7 +77,7 @@ function _hyprpm
|
||||
end
|
||||
|
||||
if set --query match_anything_transitions_from[$state] && test -n $match_anything_transitions_from[$state]
|
||||
set --local index (contains --index -- $state $match_anything_transitions_from)
|
||||
set index (contains --index -- $state $match_anything_transitions_from)
|
||||
set state $match_anything_transitions_to[$index]
|
||||
set word_index (math $word_index + 1)
|
||||
continue
|
||||
@@ -80,8 +87,8 @@ function _hyprpm
|
||||
end
|
||||
|
||||
if set --query literal_transitions[$state] && test -n $literal_transitions[$state]
|
||||
set --local --erase inputs
|
||||
set --local --erase tos
|
||||
set --erase inputs
|
||||
set --erase tos
|
||||
eval $literal_transitions[$state]
|
||||
for literal_id in $inputs
|
||||
if test -n $descriptions[$literal_id]
|
||||
@@ -92,14 +99,14 @@ function _hyprpm
|
||||
end
|
||||
end
|
||||
|
||||
set command_states 4
|
||||
set command_ids 1
|
||||
set command_states 4 3
|
||||
set command_ids 1 2
|
||||
if contains $state $command_states
|
||||
set --local index (contains --index $state $command_states)
|
||||
set --local function_id $command_ids[$index]
|
||||
set --local function_name _hyprpm_$function_id
|
||||
set --local --erase inputs
|
||||
set --local --erase tos
|
||||
set index (contains --index $state $command_states)
|
||||
set function_id $command_ids[$index]
|
||||
set function_name _hyprpm_$function_id
|
||||
set --erase inputs
|
||||
set --erase tos
|
||||
$function_name "$COMP_WORDS[$COMP_CWORD]"
|
||||
end
|
||||
|
||||
|
@@ -5,10 +5,11 @@ hyprpm [<FLAGS>]... <ARGUMENT>
|
||||
| (--help | -h) "Show help menu"
|
||||
| (--verbose | -v) "Enable too much loggin"
|
||||
| (--force | -f) "Force an operation ignoring checks (e.g. update -f)"
|
||||
| (--no-shallow | -s) "Disable shallow cloning of Hyprland sources"
|
||||
;
|
||||
|
||||
<ARGUMENT> ::= (add) "Install a new plugin repository from git"
|
||||
| (remove) "Remove a plugin repository"
|
||||
| (remove <PLUGIN_REPOS>) "Remove a plugin repository"
|
||||
| (update) "Check and update all plugins if needed"
|
||||
| (list) "List all installed plugins"
|
||||
| (enable <PLUGINS>) "Load a plugin"
|
||||
@@ -16,4 +17,5 @@ hyprpm [<FLAGS>]... <ARGUMENT>
|
||||
| (reload) "Reload all plugins"
|
||||
;
|
||||
|
||||
<PLUGINS> ::= {{{ hyprpm list | grep Plugin | awk '{print $4}' }}};
|
||||
<PLUGINS> ::= {{{ hyprpm list | awk '/Plugin/{print $4}' }}};
|
||||
<PLUGIN_REPOS> ::= {{{ hyprpm list | awk '/Repository/{print $4}' | sed 's/:$//' }}};
|
||||
|
@@ -1,37 +1,43 @@
|
||||
#compdef hyprpm
|
||||
|
||||
_hyprpm_cmd_0 () {
|
||||
hyprpm list | grep Plugin | awk '{print $4}'
|
||||
hyprpm list | awk '/Plugin/{print $4}'
|
||||
}
|
||||
|
||||
_hyprpm_cmd_1 () {
|
||||
hyprpm list | awk '/Repository/{print $4}' | sed 's/:$//'
|
||||
}
|
||||
|
||||
_hyprpm () {
|
||||
local -a literals=("-n" "::=" "list" "disable" "--help" "update" "add" "--verbose" "-v" "--force" "remove" "enable" "--notify" "-h" "reload" "-f")
|
||||
local -a literals=("--no-shallow" "-n" "::=" "disable" "list" "--help" "update" "add" "--verbose" "-v" "--force" "-s" "remove" "enable" "--notify" "-h" "reload" "-f")
|
||||
|
||||
local -A descriptions
|
||||
descriptions[1]="Send a hyprland notification for important events (e.g. load fail)"
|
||||
descriptions[3]="List all installed plugins"
|
||||
descriptions[1]="Disable shallow cloning of Hyprland sources"
|
||||
descriptions[2]="Send a hyprland notification for important events (e.g. load fail)"
|
||||
descriptions[4]="Unload a plugin"
|
||||
descriptions[5]="Show help menu"
|
||||
descriptions[6]="Check and update all plugins if needed"
|
||||
descriptions[7]="Install a new plugin repository from git"
|
||||
descriptions[8]="Enable too much loggin"
|
||||
descriptions[5]="List all installed plugins"
|
||||
descriptions[6]="Show help menu"
|
||||
descriptions[7]="Check and update all plugins if needed"
|
||||
descriptions[8]="Install a new plugin repository from git"
|
||||
descriptions[9]="Enable too much loggin"
|
||||
descriptions[10]="Force an operation ignoring checks (e.g. update -f)"
|
||||
descriptions[11]="Remove a plugin repository"
|
||||
descriptions[12]="Load a plugin"
|
||||
descriptions[13]="Send a hyprland notification for important events (e.g. load fail)"
|
||||
descriptions[14]="Show help menu"
|
||||
descriptions[15]="Reload all plugins"
|
||||
descriptions[16]="Force an operation ignoring checks (e.g. update -f)"
|
||||
descriptions[10]="Enable too much loggin"
|
||||
descriptions[11]="Force an operation ignoring checks (e.g. update -f)"
|
||||
descriptions[12]="Disable shallow cloning of Hyprland sources"
|
||||
descriptions[13]="Remove a plugin repository"
|
||||
descriptions[14]="Load a plugin"
|
||||
descriptions[15]="Send a hyprland notification for important events (e.g. load fail)"
|
||||
descriptions[16]="Show help menu"
|
||||
descriptions[17]="Reload all plugins"
|
||||
descriptions[18]="Force an operation ignoring checks (e.g. update -f)"
|
||||
|
||||
local -A literal_transitions
|
||||
literal_transitions[1]="([10]=7 [3]=3 [8]=7 [9]=7 [5]=7 [11]=3 [12]=4 [6]=3 [14]=7 [4]=4 [15]=3 [16]=7 [7]=3)"
|
||||
literal_transitions[2]="([11]=3 [12]=4 [4]=4 [3]=3 [15]=3 [6]=3 [7]=3)"
|
||||
literal_transitions[5]="([2]=6)"
|
||||
literal_transitions[6]="([1]=7 [13]=7)"
|
||||
literal_transitions[1]="([1]=8 [4]=4 [5]=5 [9]=8 [10]=8 [7]=5 [8]=5 [12]=8 [6]=8 [11]=8 [13]=3 [14]=4 [16]=8 [17]=5 [18]=8)"
|
||||
literal_transitions[2]="([13]=3 [14]=4 [4]=4 [5]=5 [17]=5 [7]=5 [8]=5)"
|
||||
literal_transitions[6]="([3]=7)"
|
||||
literal_transitions[7]="([2]=8 [15]=8)"
|
||||
|
||||
local -A match_anything_transitions
|
||||
match_anything_transitions=([4]=3 [3]=5 [1]=2 [2]=2)
|
||||
match_anything_transitions=([2]=2 [5]=6 [4]=5 [3]=5 [1]=2)
|
||||
|
||||
declare -A subword_transitions
|
||||
|
||||
@@ -91,7 +97,7 @@ _hyprpm () {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
local -A commands=([4]=0)
|
||||
local -A commands=([4]=0 [3]=1)
|
||||
|
||||
if [[ -v "commands[$state]" ]]; then
|
||||
local command_id=${commands[$state]}
|
||||
|
@@ -49,7 +49,7 @@ void DataState::addNewPluginRepo(const SPluginRepository& repo) {
|
||||
{"rev", repo.rev}
|
||||
}}
|
||||
};
|
||||
for (auto& p : repo.plugins) {
|
||||
for (auto const& p : repo.plugins) {
|
||||
// copy .so to the good place
|
||||
if (std::filesystem::exists(p.filename))
|
||||
std::filesystem::copy_file(p.filename, PATH + "/" + p.name + ".so");
|
||||
|
@@ -6,7 +6,7 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
|
||||
auto manifest = toml::parse_file(path);
|
||||
|
||||
if (type == MANIFEST_HYPRLOAD) {
|
||||
for (auto& [key, val] : manifest) {
|
||||
for (auto const& [key, val] : manifest) {
|
||||
if (key.str().ends_with(".build"))
|
||||
continue;
|
||||
|
||||
@@ -63,7 +63,7 @@ CManifest::CManifest(const eManifestType type, const std::string& path) {
|
||||
}
|
||||
}
|
||||
|
||||
for (auto& [key, val] : manifest) {
|
||||
for (auto const& [key, val] : manifest) {
|
||||
if (key.str() == "repository")
|
||||
continue;
|
||||
|
||||
|
@@ -19,30 +19,15 @@
|
||||
|
||||
#include <toml++/toml.hpp>
|
||||
|
||||
static std::string removeBeginEndSpacesTabs(std::string str) {
|
||||
if (str.empty())
|
||||
return str;
|
||||
|
||||
int countBefore = 0;
|
||||
while (str[countBefore] == ' ' || str[countBefore] == '\t') {
|
||||
countBefore++;
|
||||
}
|
||||
|
||||
int countAfter = 0;
|
||||
while ((int)str.length() - countAfter - 1 >= 0 && (str[str.length() - countAfter - 1] == ' ' || str[str.length() - 1 - countAfter] == '\t')) {
|
||||
countAfter++;
|
||||
}
|
||||
|
||||
str = str.substr(countBefore, str.length() - countBefore - countAfter);
|
||||
|
||||
return str;
|
||||
}
|
||||
#include <hyprutils/string/String.hpp>
|
||||
using namespace Hyprutils::String;
|
||||
|
||||
static std::string execAndGet(std::string cmd) {
|
||||
cmd += " 2>&1";
|
||||
std::array<char, 128> buffer;
|
||||
std::string result;
|
||||
const std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd.c_str(), "r"), pclose);
|
||||
using PcloseType = int (*)(FILE*);
|
||||
const std::unique_ptr<FILE, PcloseType> pipe(popen(cmd.c_str(), "r"), static_cast<PcloseType>(pclose));
|
||||
if (!pipe)
|
||||
return "";
|
||||
|
||||
@@ -187,6 +172,9 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
|
||||
std::cerr << "\n" << Colors::RED << "✖" << Colors::RESET << " Could not check out revision " << rev << ". shell returned:\n" << ret << "\n";
|
||||
return false;
|
||||
}
|
||||
ret = execAndGet("git -C " + m_szWorkingPluginDirectory + " submodule update --init");
|
||||
if (m_bVerbose)
|
||||
std::cout << Colors::BLUE << "[v] " << Colors::RESET << "git submodule update --init returned: " << ret << "\n";
|
||||
}
|
||||
|
||||
progress.m_iSteps = 1;
|
||||
@@ -216,9 +204,9 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
|
||||
|
||||
progress.m_iSteps = 2;
|
||||
progress.printMessageAbove(std::string{Colors::GREEN} + "✔" + Colors::RESET + " parsed manifest, found " + std::to_string(pManifest->m_vPlugins.size()) + " plugins:");
|
||||
for (auto& pl : pManifest->m_vPlugins) {
|
||||
for (auto const& pl : pManifest->m_vPlugins) {
|
||||
std::string message = std::string{Colors::RESET} + " → " + pl.name + " by ";
|
||||
for (auto& a : pl.authors) {
|
||||
for (auto const& a : pl.authors) {
|
||||
message += a + ", ";
|
||||
}
|
||||
if (pl.authors.size() > 0) {
|
||||
@@ -234,13 +222,19 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
|
||||
|
||||
progress.printMessageAbove(std::string{Colors::RESET} + " → Manifest has " + std::to_string(pManifest->m_sRepository.commitPins.size()) + " pins, checking");
|
||||
|
||||
for (auto& [hl, plugin] : pManifest->m_sRepository.commitPins) {
|
||||
for (auto const& [hl, plugin] : pManifest->m_sRepository.commitPins) {
|
||||
if (hl != HLVER.hash)
|
||||
continue;
|
||||
|
||||
progress.printMessageAbove(std::string{Colors::GREEN} + "✔" + Colors::RESET + " commit pin " + plugin + " matched hl, resetting");
|
||||
|
||||
execAndGet("cd " + m_szWorkingPluginDirectory + " && git reset --hard --recurse-submodules " + plugin);
|
||||
|
||||
ret = execAndGet("git -C " + m_szWorkingPluginDirectory + " submodule update --init");
|
||||
if (m_bVerbose)
|
||||
std::cout << Colors::BLUE << "[v] " << Colors::RESET << "git submodule update --init returned: " << ret << "\n";
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,7 +264,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
|
||||
|
||||
progress.printMessageAbove(std::string{Colors::RESET} + " → Building " + p.name);
|
||||
|
||||
for (auto& bs : p.buildSteps) {
|
||||
for (auto const& bs : p.buildSteps) {
|
||||
std::string cmd = std::format("cd {} && PKG_CONFIG_PATH=\"{}/share/pkgconfig\" {}", m_szWorkingPluginDirectory, DataState::getHeadersPath(), bs);
|
||||
out += " -> " + cmd + "\n" + execAndGet(cmd) + "\n";
|
||||
}
|
||||
@@ -305,7 +299,7 @@ bool CPluginManager::addNewPluginRepo(const std::string& url, const std::string&
|
||||
repo.url = url;
|
||||
repo.rev = rev;
|
||||
repo.hash = repohash;
|
||||
for (auto& p : pManifest->m_vPlugins) {
|
||||
for (auto const& p : pManifest->m_vPlugins) {
|
||||
repo.plugins.push_back(SPlugin{p.name, m_szWorkingPluginDirectory + "/" + p.output, false, p.failed});
|
||||
}
|
||||
DataState::addNewPluginRepo(repo);
|
||||
@@ -371,10 +365,10 @@ eHeadersErrors CPluginManager::headersValid() {
|
||||
else
|
||||
headers = "";
|
||||
|
||||
if (PATH.ends_with("protocols") || PATH.ends_with("wlroots-hyprland"))
|
||||
if (PATH.ends_with("protocols"))
|
||||
continue;
|
||||
|
||||
verHeader = removeBeginEndSpacesTabs(PATH.substr(2)) + "/hyprland/src/version.h";
|
||||
verHeader = trim(PATH.substr(2)) + "/hyprland/src/version.h";
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -442,14 +436,18 @@ bool CPluginManager::updateHeaders(bool force) {
|
||||
|
||||
progress.printMessageAbove(std::string{Colors::YELLOW} + "!" + Colors::RESET + " Cloning https://github.com/hyprwm/hyprland, this might take a moment.");
|
||||
|
||||
const bool bShallow = (HLVER.branch == "main" || HLVER.branch == "") && !m_bNoShallow;
|
||||
|
||||
// let us give a bit of leg-room for shallowing
|
||||
// due to timezones, etc.
|
||||
const std::string SHALLOW_DATE = removeBeginEndSpacesTabs(HLVER.date).empty() ? "" : execAndGet("date --date='" + HLVER.date + " - 1 weeks' '+\%a \%b \%d \%H:\%M:\%S \%Y'");
|
||||
const std::string SHALLOW_DATE =
|
||||
trim(HLVER.date).empty() ? "" : execAndGet("LC_TIME=\"en_US.UTF-8\" date --date='" + HLVER.date + " - 1 weeks' '+\%a \%b \%d \%H:\%M:\%S \%Y'");
|
||||
|
||||
if (m_bVerbose)
|
||||
if (m_bVerbose && bShallow)
|
||||
progress.printMessageAbove(std::string{Colors::BLUE} + "[v] " + Colors::RESET + "will shallow since: " + SHALLOW_DATE);
|
||||
|
||||
std::string ret = execAndGet("cd /tmp/hyprpm && git clone --recursive https://github.com/hyprwm/hyprland hyprland-" + USERNAME + " --shallow-since='" + SHALLOW_DATE + "'");
|
||||
std::string ret =
|
||||
execAndGet("cd /tmp/hyprpm && git clone --recursive https://github.com/hyprwm/hyprland hyprland-" + USERNAME + (bShallow ? " --shallow-since='" + SHALLOW_DATE + "'" : ""));
|
||||
|
||||
if (!std::filesystem::exists(WORKINGDIR)) {
|
||||
progress.printMessageAbove(std::string{Colors::RED} + "✖" + Colors::RESET + " Clone failed. Retrying without shallow.");
|
||||
@@ -466,12 +464,22 @@ bool CPluginManager::updateHeaders(bool force) {
|
||||
progress.m_szCurrentMessage = "Checking out sources";
|
||||
progress.print();
|
||||
|
||||
ret = execAndGet("cd " + WORKINGDIR + " && git checkout " + HLVER.branch + " 2>&1");
|
||||
if (m_bVerbose)
|
||||
progress.printMessageAbove(std::string{Colors::BLUE} + "[v] " + Colors::RESET + "will run: " + "cd " + WORKINGDIR + " && git checkout " + HLVER.hash + " 2>&1");
|
||||
|
||||
ret = execAndGet("cd " + WORKINGDIR + " && git checkout " + HLVER.hash + " 2>&1");
|
||||
|
||||
if (ret.contains("fatal: unable to read tree")) {
|
||||
std::cerr << "\n"
|
||||
<< Colors::RED << "✖" << Colors::RESET
|
||||
<< " Could not checkout the running Hyprland commit. If you are on -git, try updating.\nYou can also try re-running hyprpm update with --no-shallow.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
if (m_bVerbose)
|
||||
progress.printMessageAbove(std::string{Colors::BLUE} + "[v] " + Colors::RESET + "git returned (co): " + ret);
|
||||
|
||||
ret = execAndGet("cd " + WORKINGDIR + " && git rm subprojects/tracy && git submodule update --init 2>&1 && git reset --hard --recurse-submodules " + HLVER.hash);
|
||||
ret = execAndGet("cd " + WORKINGDIR + " ; git rm subprojects/tracy ; git submodule update --init 2>&1 ; git reset --hard --recurse-submodules " + HLVER.hash);
|
||||
|
||||
if (m_bVerbose)
|
||||
progress.printMessageAbove(std::string{Colors::BLUE} + "[v] " + Colors::RESET + "git returned (rs): " + ret);
|
||||
@@ -491,10 +499,18 @@ bool CPluginManager::updateHeaders(bool force) {
|
||||
if (m_bVerbose)
|
||||
progress.printMessageAbove(std::string{Colors::BLUE} + "[v] " + Colors::RESET + "cmake returned: " + ret);
|
||||
|
||||
// le hack. Wlroots has to generate its build/include
|
||||
ret = execAndGet("cd " + WORKINGDIR + "/subprojects/wlroots-hyprland && meson setup -Drenderers=gles2 -Dexamples=false build");
|
||||
if (m_bVerbose)
|
||||
progress.printMessageAbove(std::string{Colors::BLUE} + "[v] " + Colors::RESET + "meson returned: " + ret);
|
||||
if (ret.contains("CMake Error at")) {
|
||||
// missing deps, let the user know.
|
||||
std::string missing = ret.substr(ret.find("CMake Error at"));
|
||||
missing = ret.substr(ret.find_first_of('\n') + 1);
|
||||
missing = missing.substr(0, missing.find("-- Configuring incomplete"));
|
||||
missing = missing.substr(0, missing.find_last_of('\n'));
|
||||
|
||||
std::cerr << "\n"
|
||||
<< Colors::RED << "✖" << Colors::RESET << " Could not configure the hyprland source, cmake complained:\n"
|
||||
<< missing << "\n\nThis likely means that you are missing the above dependencies or they are out of date.\n";
|
||||
return false;
|
||||
}
|
||||
|
||||
progress.printMessageAbove(std::string{Colors::GREEN} + "✔" + Colors::RESET + " configured Hyprland");
|
||||
progress.m_iSteps = 4;
|
||||
@@ -523,7 +539,8 @@ bool CPluginManager::updateHeaders(bool force) {
|
||||
|
||||
std::cout << "\n";
|
||||
} else {
|
||||
progress.printMessageAbove(std::string{Colors::RED} + "✖" + Colors::RESET + " failed to install headers with error code " + std::to_string((int)HEADERSVALID));
|
||||
progress.printMessageAbove(std::string{Colors::RED} + "✖" + Colors::RESET + " failed to install headers with error code " + std::to_string((int)HEADERSVALID) + " (" +
|
||||
headerErrorShort(HEADERSVALID) + ")");
|
||||
progress.m_iSteps = 5;
|
||||
progress.m_szCurrentMessage = "Failed";
|
||||
progress.print();
|
||||
@@ -562,7 +579,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
|
||||
const std::string USERNAME = getpwuid(getuid())->pw_name;
|
||||
m_szWorkingPluginDirectory = "/tmp/hyprpm/" + USERNAME;
|
||||
|
||||
for (auto& repo : REPOS) {
|
||||
for (auto const& repo : REPOS) {
|
||||
bool update = forceUpdateAll;
|
||||
|
||||
progress.m_iSteps++;
|
||||
@@ -641,7 +658,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
|
||||
|
||||
progress.printMessageAbove(std::string{Colors::RESET} + " → Manifest has " + std::to_string(pManifest->m_sRepository.commitPins.size()) + " pins, checking");
|
||||
|
||||
for (auto& [hl, plugin] : pManifest->m_sRepository.commitPins) {
|
||||
for (auto const& [hl, plugin] : pManifest->m_sRepository.commitPins) {
|
||||
if (hl != HLVER.hash)
|
||||
continue;
|
||||
|
||||
@@ -662,7 +679,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
|
||||
|
||||
progress.printMessageAbove(std::string{Colors::RESET} + " → Building " + p.name);
|
||||
|
||||
for (auto& bs : p.buildSteps) {
|
||||
for (auto const& bs : p.buildSteps) {
|
||||
std::string cmd = std::format("cd {} && PKG_CONFIG_PATH=\"{}/share/pkgconfig\" {}", m_szWorkingPluginDirectory, DataState::getHeadersPath(), bs);
|
||||
out += " -> " + cmd + "\n" + execAndGet(cmd) + "\n";
|
||||
}
|
||||
@@ -692,7 +709,7 @@ bool CPluginManager::updatePlugins(bool forceUpdateAll) {
|
||||
if (repohash.length() > 0)
|
||||
repohash.pop_back();
|
||||
newrepo.hash = repohash;
|
||||
for (auto& p : pManifest->m_vPlugins) {
|
||||
for (auto const& p : pManifest->m_vPlugins) {
|
||||
const auto OLDPLUGINIT = std::find_if(repo.plugins.begin(), repo.plugins.end(), [&](const auto& other) { return other.name == p.name; });
|
||||
newrepo.plugins.push_back(SPlugin{p.name, m_szWorkingPluginDirectory + "/" + p.output, OLDPLUGINIT != repo.plugins.end() ? OLDPLUGINIT->enabled : false});
|
||||
}
|
||||
@@ -777,8 +794,8 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
|
||||
const auto REPOS = DataState::getAllRepositories();
|
||||
|
||||
auto enabled = [REPOS](const std::string& plugin) -> bool {
|
||||
for (auto& r : REPOS) {
|
||||
for (auto& p : r.plugins) {
|
||||
for (auto const& r : REPOS) {
|
||||
for (auto const& p : r.plugins) {
|
||||
if (p.name == plugin && p.enabled)
|
||||
return true;
|
||||
}
|
||||
@@ -788,8 +805,8 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
|
||||
};
|
||||
|
||||
auto repoForName = [REPOS](const std::string& name) -> std::string {
|
||||
for (auto& r : REPOS) {
|
||||
for (auto& p : r.plugins) {
|
||||
for (auto const& r : REPOS) {
|
||||
for (auto const& p : r.plugins) {
|
||||
if (p.name == name)
|
||||
return r.name;
|
||||
}
|
||||
@@ -799,7 +816,7 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
|
||||
};
|
||||
|
||||
// unload disabled plugins
|
||||
for (auto& p : loadedPlugins) {
|
||||
for (auto const& p : loadedPlugins) {
|
||||
if (!enabled(p)) {
|
||||
// unload
|
||||
loadUnloadPlugin(HYPRPMPATH + repoForName(p) + "/" + p + ".so", false);
|
||||
@@ -808,8 +825,8 @@ ePluginLoadStateReturn CPluginManager::ensurePluginsLoadState() {
|
||||
}
|
||||
|
||||
// load enabled plugins
|
||||
for (auto& r : REPOS) {
|
||||
for (auto& p : r.plugins) {
|
||||
for (auto const& r : REPOS) {
|
||||
for (auto const& p : r.plugins) {
|
||||
if (!p.enabled)
|
||||
continue;
|
||||
|
||||
@@ -838,10 +855,10 @@ bool CPluginManager::loadUnloadPlugin(const std::string& path, bool load) {
|
||||
void CPluginManager::listAllPlugins() {
|
||||
const auto REPOS = DataState::getAllRepositories();
|
||||
|
||||
for (auto& r : REPOS) {
|
||||
for (auto const& r : REPOS) {
|
||||
std::cout << std::string{Colors::RESET} + " → Repository " + r.name + ":\n";
|
||||
|
||||
for (auto& p : r.plugins) {
|
||||
for (auto const& p : r.plugins) {
|
||||
|
||||
std::cout << std::string{Colors::RESET} + " │ Plugin " + p.name;
|
||||
|
||||
@@ -874,10 +891,22 @@ std::string CPluginManager::headerError(const eHeadersErrors err) {
|
||||
return std::string{Colors::RED} + "✖" + Colors::RESET + " Unknown header error. Please run hyprpm update to fix those.\n";
|
||||
}
|
||||
|
||||
std::string CPluginManager::headerErrorShort(const eHeadersErrors err) {
|
||||
switch (err) {
|
||||
case HEADERS_CORRUPTED: return "Headers corrupted";
|
||||
case HEADERS_MISMATCHED: return "Headers version mismatched";
|
||||
case HEADERS_NOT_HYPRLAND: return "Not running on Hyprland";
|
||||
case HEADERS_MISSING: return "Headers missing";
|
||||
case HEADERS_DUPLICATED: return "Headers duplicated";
|
||||
default: break;
|
||||
}
|
||||
return "?";
|
||||
}
|
||||
|
||||
bool CPluginManager::hasDeps() {
|
||||
std::vector<std::string> deps = {"meson", "cpio", "cmake"};
|
||||
for (auto& d : deps) {
|
||||
if (!execAndGet("which " + d + " 2>&1").contains("/"))
|
||||
std::vector<std::string> deps = {"meson", "cpio", "cmake", "pkg-config"};
|
||||
for (auto const& d : deps) {
|
||||
if (!execAndGet("command -v " + d).contains("/"))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@@ -59,12 +59,14 @@ class CPluginManager {
|
||||
bool hasDeps();
|
||||
|
||||
bool m_bVerbose = false;
|
||||
bool m_bNoShallow = false;
|
||||
|
||||
// will delete recursively if exists!!
|
||||
bool createSafeDirectory(const std::string& path);
|
||||
|
||||
private:
|
||||
std::string headerError(const eHeadersErrors err);
|
||||
std::string headerErrorShort(const eHeadersErrors err);
|
||||
|
||||
std::string m_szWorkingPluginDirectory = "";
|
||||
};
|
||||
|
@@ -26,6 +26,7 @@ const std::string HELP = R"#(┏ hyprpm, a Hyprland Plugin Manager
|
||||
┣ --help | -h → Show this menu
|
||||
┣ --verbose | -v → Enable too much logging
|
||||
┣ --force | -f → Force an operation ignoring checks (e.g. update -f)
|
||||
┣ --no-shallow | -s → Disable shallow cloning of Hyprland sources
|
||||
┗
|
||||
)#";
|
||||
|
||||
@@ -41,7 +42,7 @@ int main(int argc, char** argv, char** envp) {
|
||||
}
|
||||
|
||||
std::vector<std::string> command;
|
||||
bool notify = false, verbose = false, force = false;
|
||||
bool notify = false, verbose = false, force = false, noShallow = false;
|
||||
|
||||
for (int i = 1; i < argc; ++i) {
|
||||
if (ARGS[i].starts_with("-")) {
|
||||
@@ -52,6 +53,8 @@ int main(int argc, char** argv, char** envp) {
|
||||
notify = true;
|
||||
} else if (ARGS[i] == "--verbose" || ARGS[i] == "-v") {
|
||||
verbose = true;
|
||||
} else if (ARGS[i] == "--no-shallow" || ARGS[i] == "-s") {
|
||||
noShallow = true;
|
||||
} else if (ARGS[i] == "--force" || ARGS[i] == "-f") {
|
||||
force = true;
|
||||
std::cout << Colors::RED << "!" << Colors::RESET << " Using --force, I hope you know what you are doing.\n";
|
||||
@@ -71,6 +74,7 @@ int main(int argc, char** argv, char** envp) {
|
||||
|
||||
g_pPluginManager = std::make_unique<CPluginManager>();
|
||||
g_pPluginManager->m_bVerbose = verbose;
|
||||
g_pPluginManager->m_bNoShallow = noShallow;
|
||||
|
||||
if (command[0] == "add") {
|
||||
if (command.size() < 2) {
|
||||
|
@@ -1,14 +1,31 @@
|
||||
globber = run_command('sh', '-c', 'find . -name "*.cpp" | sort', check: true)
|
||||
src = globber.stdout().strip().split('\n')
|
||||
|
||||
executable('hyprpm', src,
|
||||
executable(
|
||||
'hyprpm',
|
||||
src,
|
||||
dependencies: [
|
||||
dependency('hyprutils', version: '>= 0.1.1'),
|
||||
dependency('threads'),
|
||||
dependency('tomlplusplus')
|
||||
dependency('tomlplusplus'),
|
||||
],
|
||||
install : true
|
||||
install: true,
|
||||
)
|
||||
|
||||
install_data('../hyprpm.bash', install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'), install_tag: 'runtime', rename: 'hyprpm')
|
||||
install_data('../hyprpm.fish', install_dir: join_paths(get_option('datadir'), 'fish/vendor_completions.d'), install_tag: 'runtime')
|
||||
install_data('../hyprpm.zsh', install_dir: join_paths(get_option('datadir'), 'zsh/site-functions'), install_tag: 'runtime', rename: '_hyprpm')
|
||||
install_data(
|
||||
'../hyprpm.bash',
|
||||
install_dir: join_paths(get_option('datadir'), 'bash-completion/completions'),
|
||||
install_tag: 'runtime',
|
||||
rename: 'hyprpm',
|
||||
)
|
||||
install_data(
|
||||
'../hyprpm.fish',
|
||||
install_dir: join_paths(get_option('datadir'), 'fish/vendor_completions.d'),
|
||||
install_tag: 'runtime',
|
||||
)
|
||||
install_data(
|
||||
'../hyprpm.zsh',
|
||||
install_dir: join_paths(get_option('datadir'), 'zsh/site-functions'),
|
||||
install_tag: 'runtime',
|
||||
rename: '_hyprpm',
|
||||
)
|
||||
|
67
meson.build
@@ -1,58 +1,56 @@
|
||||
project('Hyprland', 'cpp', 'c',
|
||||
version : run_command('jq', '-r', '.version', join_paths(meson.source_root(), 'props.json'), check: true).stdout().strip(),
|
||||
project(
|
||||
'Hyprland',
|
||||
'cpp',
|
||||
'c',
|
||||
version: run_command('cat', join_paths(meson.project_source_root(), 'VERSION'), check: true).stdout().strip(),
|
||||
default_options: [
|
||||
'warning_level=2',
|
||||
'default_library=static',
|
||||
'optimization=3',
|
||||
'buildtype=release',
|
||||
'debug=false'
|
||||
# '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
|
||||
'debug=false',
|
||||
'cpp_std=c++26',
|
||||
],
|
||||
)
|
||||
|
||||
datarootdir = '-DDATAROOTDIR="' + get_option('prefix') / get_option('datadir') + '"'
|
||||
add_project_arguments(
|
||||
[
|
||||
'-Wno-unused-parameter',
|
||||
'-Wno-unused-value',
|
||||
'-Wno-missing-field-initializers',
|
||||
'-Wno-narrowing',
|
||||
'-Wno-pointer-arith', datarootdir,
|
||||
],
|
||||
language: 'cpp')
|
||||
language: 'cpp',
|
||||
)
|
||||
|
||||
cpp_compiler = meson.get_compiler('cpp')
|
||||
if cpp_compiler.check_header('execinfo.h')
|
||||
add_project_arguments('-DHAS_EXECINFO', language: 'cpp')
|
||||
endif
|
||||
|
||||
wlroots = subproject('wlroots-hyprland', default_options: ['examples=false', 'renderers=gles2'])
|
||||
have_xwlr = wlroots.get_variable('features').get('xwayland')
|
||||
aquamarine = dependency('aquamarine')
|
||||
add_project_arguments(['-DAQUAMARINE_VERSION="@0@"'.format(aquamarine.version())], language: 'cpp')
|
||||
|
||||
xcb_dep = dependency('xcb', required: get_option('xwayland'))
|
||||
xcb_composite_dep = dependency('xcb-composite', required: get_option('xwayland'))
|
||||
xcb_errors_dep = dependency('xcb-errors', required: get_option('xwayland'))
|
||||
xcb_icccm_dep = dependency('xcb-icccm', required: get_option('xwayland'))
|
||||
xcb_render_dep = dependency('xcb-render', required: get_option('xwayland'))
|
||||
xcb_res_dep = dependency('xcb-res', required: get_option('xwayland'))
|
||||
xcb_xfixes_dep = dependency('xcb-xfixes', required: get_option('xwayland'))
|
||||
|
||||
cmake = import('cmake')
|
||||
udis = cmake.subproject('udis86')
|
||||
udis86 = udis.dependency('libudis86')
|
||||
gio_dep = dependency('gio-2.0', required: true)
|
||||
|
||||
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
|
||||
|
||||
backtrace_dep = cpp_compiler.find_library('execinfo', required: false)
|
||||
epoll_dep = dependency('epoll-shim', required: false) # timerfd on BSDs
|
||||
|
||||
# Handle options
|
||||
if get_option('systemd').enabled()
|
||||
add_project_arguments('-DUSES_SYSTEMD', language: 'cpp')
|
||||
endif
|
||||
@@ -65,14 +63,22 @@ if get_option('buildtype') == 'debug'
|
||||
add_project_arguments('-DHYPRLAND_DEBUG', language: 'cpp')
|
||||
endif
|
||||
|
||||
version_h = run_command('sh', '-c', 'scripts/generateVersion.sh')
|
||||
# Generate hyprland version and populate version.h
|
||||
run_command('sh', '-c', 'scripts/generateVersion.sh', check: true)
|
||||
|
||||
# Install headers
|
||||
globber = run_command('find', 'src', '-name', '*.h*', check: true)
|
||||
headers = globber.stdout().strip().split('\n')
|
||||
foreach file : headers
|
||||
install_headers(file, subdir: 'hyprland', preserve_path: true)
|
||||
endforeach
|
||||
|
||||
tracy = dependency('tracy', static: true, required: get_option('tracy_enable'))
|
||||
|
||||
if get_option('tracy_enable') and get_option('buildtype') != 'debugoptimized'
|
||||
warning('Profiling builds should set -- buildtype = debugoptimized')
|
||||
endif
|
||||
|
||||
subdir('protocols')
|
||||
subdir('src')
|
||||
subdir('hyprctl')
|
||||
@@ -81,6 +87,7 @@ subdir('assets')
|
||||
subdir('example')
|
||||
subdir('docs')
|
||||
|
||||
# Generate hyprland.pc
|
||||
pkg_install_dir = join_paths(get_option('datadir'), 'pkgconfig')
|
||||
|
||||
import('pkgconfig').generate(
|
||||
@@ -89,5 +96,5 @@ import('pkgconfig').generate(
|
||||
url: 'https://github.com/hyprwm/Hyprland',
|
||||
description: 'Hyprland header files',
|
||||
install_dir: pkg_install_dir,
|
||||
subdirs: ['', 'hyprland/protocols', 'hyprland/wlroots'],
|
||||
subdirs: ['', 'hyprland/protocols', 'hyprland'],
|
||||
)
|
||||
|
@@ -1,3 +1,4 @@
|
||||
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
|
||||
option('systemd', type: 'feature', value: 'auto', description: 'Enable systemd integration')
|
||||
option('legacy_renderer', type: 'feature', value: 'disabled', description: 'Enable legacy renderer')
|
||||
option('tracy_enable', type: 'boolean', value: false , description: 'Enable profiling')
|
||||
|
136
nix/default.nix
@@ -1,37 +1,37 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
stdenvAdapters,
|
||||
pkg-config,
|
||||
pkgconf,
|
||||
makeWrapper,
|
||||
meson,
|
||||
ninja,
|
||||
aquamarine,
|
||||
binutils,
|
||||
cairo,
|
||||
git,
|
||||
hyprcursor,
|
||||
hyprland-protocols,
|
||||
hyprlang,
|
||||
hyprutils,
|
||||
hyprwayland-scanner,
|
||||
jq,
|
||||
libGL,
|
||||
libdrm,
|
||||
libexecinfo,
|
||||
libinput,
|
||||
libuuid,
|
||||
libxcb,
|
||||
libxkbcommon,
|
||||
libuuid,
|
||||
mesa,
|
||||
pango,
|
||||
pciutils,
|
||||
systemd,
|
||||
tomlplusplus,
|
||||
udis86,
|
||||
udis86-hyprland,
|
||||
wayland,
|
||||
wayland-protocols,
|
||||
wayland-scanner,
|
||||
wlroots-hyprland,
|
||||
xcbutilwm,
|
||||
xorg,
|
||||
xwayland,
|
||||
debug ? false,
|
||||
enableXWayland ? true,
|
||||
@@ -40,61 +40,64 @@
|
||||
wrapRuntimeDeps ? true,
|
||||
version ? "git",
|
||||
commit,
|
||||
revCount,
|
||||
date,
|
||||
# deprecated flags
|
||||
enableNvidiaPatches ? false,
|
||||
nvidiaPatches ? false,
|
||||
hidpiXWayland ? false,
|
||||
}:
|
||||
assert lib.assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
|
||||
assert lib.assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
|
||||
assert lib.assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland"; let
|
||||
wlr = wlroots-hyprland.override {inherit enableXWayland;};
|
||||
}: let
|
||||
inherit (builtins) baseNameOf foldl';
|
||||
inherit (lib.asserts) assertMsg;
|
||||
inherit (lib.attrsets) mapAttrsToList;
|
||||
inherit (lib.lists) flatten concatLists optional optionals;
|
||||
inherit (lib.sources) cleanSourceWith cleanSource;
|
||||
inherit (lib.strings) hasSuffix makeBinPath optionalString mesonBool mesonEnable;
|
||||
|
||||
adapters = flatten [
|
||||
stdenvAdapters.useMoldLinker
|
||||
];
|
||||
|
||||
customStdenv = foldl' (acc: adapter: adapter acc) stdenv adapters;
|
||||
in
|
||||
stdenv.mkDerivation {
|
||||
pname = "hyprland${lib.optionalString debug "-debug"}";
|
||||
assert assertMsg (!nvidiaPatches) "The option `nvidiaPatches` has been removed.";
|
||||
assert assertMsg (!enableNvidiaPatches) "The option `enableNvidiaPatches` has been removed.";
|
||||
assert assertMsg (!hidpiXWayland) "The option `hidpiXWayland` has been removed. Please refer https://wiki.hyprland.org/Configuring/XWayland";
|
||||
customStdenv.mkDerivation {
|
||||
pname = "hyprland${optionalString debug "-debug"}";
|
||||
inherit version;
|
||||
|
||||
src = lib.cleanSourceWith {
|
||||
src = cleanSourceWith {
|
||||
filter = name: type: let
|
||||
baseName = baseNameOf (toString name);
|
||||
in
|
||||
! (lib.hasSuffix ".nix" baseName);
|
||||
src = lib.cleanSource ../.;
|
||||
! (hasSuffix ".nix" baseName);
|
||||
src = cleanSource ../.;
|
||||
};
|
||||
|
||||
patches = [
|
||||
# make meson use the provided wlroots instead of the git submodule
|
||||
./patches/meson-build.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
# Fix hardcoded paths to /usr installation
|
||||
sed -i "s#/usr#$out#" src/render/OpenGL.cpp
|
||||
|
||||
# Generate version.h
|
||||
cp src/version.h.in src/version.h
|
||||
substituteInPlace src/version.h \
|
||||
--replace "@HASH@" '${commit}' \
|
||||
--replace "@BRANCH@" "" \
|
||||
--replace "@MESSAGE@" "" \
|
||||
--replace "@DATE@" "${date}" \
|
||||
--replace "@TAG@" "" \
|
||||
--replace "@DIRTY@" '${
|
||||
if commit == ""
|
||||
then "dirty"
|
||||
else ""
|
||||
}'
|
||||
# Remove extra @PREFIX@ to fix pkg-config paths
|
||||
sed -i "s#@PREFIX@/##g" hyprland.pc.in
|
||||
'';
|
||||
|
||||
COMMITS = revCount;
|
||||
DATE = date;
|
||||
DIRTY = optionalString (commit == "") "dirty";
|
||||
HASH = commit;
|
||||
|
||||
depsBuildBuild = [
|
||||
pkg-config
|
||||
];
|
||||
|
||||
nativeBuildInputs = [
|
||||
hyprwayland-scanner
|
||||
jq
|
||||
makeWrapper
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
wayland-scanner
|
||||
];
|
||||
|
||||
outputs = [
|
||||
@@ -103,14 +106,15 @@ in
|
||||
"dev"
|
||||
];
|
||||
|
||||
buildInputs =
|
||||
wlr.buildInputs
|
||||
++ [
|
||||
buildInputs = concatLists [
|
||||
[
|
||||
aquamarine
|
||||
cairo
|
||||
git
|
||||
hyprcursor.dev
|
||||
hyprcursor
|
||||
hyprland-protocols
|
||||
hyprlang
|
||||
hyprutils
|
||||
libdrm
|
||||
libGL
|
||||
libinput
|
||||
@@ -120,34 +124,48 @@ in
|
||||
pango
|
||||
pciutils
|
||||
tomlplusplus
|
||||
udis86
|
||||
udis86-hyprland
|
||||
wayland
|
||||
wayland-protocols
|
||||
wlr
|
||||
wayland-scanner
|
||||
xorg.libXcursor
|
||||
]
|
||||
++ lib.optionals stdenv.hostPlatform.isMusl [libexecinfo]
|
||||
++ lib.optionals enableXWayland [libxcb xcbutilwm xwayland]
|
||||
++ lib.optionals withSystemd [systemd];
|
||||
(optionals customStdenv.hostPlatform.isMusl [libexecinfo])
|
||||
(optionals enableXWayland [
|
||||
xorg.libxcb
|
||||
xorg.libXdmcp
|
||||
xorg.xcbutilerrors
|
||||
xorg.xcbutilrenderutil
|
||||
xorg.xcbutilwm
|
||||
xwayland
|
||||
])
|
||||
(optional withSystemd systemd)
|
||||
];
|
||||
|
||||
mesonBuildType =
|
||||
if debug
|
||||
then "debug"
|
||||
then "debugoptimized"
|
||||
else "release";
|
||||
|
||||
mesonAutoFeatures = "disabled";
|
||||
# we want as much debug info as possible
|
||||
dontStrip = debug;
|
||||
|
||||
mesonFlags = [
|
||||
(lib.mesonEnable "xwayland" enableXWayland)
|
||||
(lib.mesonEnable "legacy_renderer" legacyRenderer)
|
||||
(lib.mesonEnable "systemd" withSystemd)
|
||||
mesonFlags = flatten [
|
||||
(mapAttrsToList mesonEnable {
|
||||
"xwayland" = enableXWayland;
|
||||
"legacy_renderer" = legacyRenderer;
|
||||
"systemd" = withSystemd;
|
||||
})
|
||||
(mapAttrsToList mesonBool {
|
||||
"b_pch" = false;
|
||||
"tracy_enable" = false;
|
||||
})
|
||||
];
|
||||
|
||||
postInstall = ''
|
||||
ln -s ${wlr}/include/wlr $dev/include/hyprland/wlroots
|
||||
|
||||
${lib.optionalString wrapRuntimeDeps ''
|
||||
${optionalString wrapRuntimeDeps ''
|
||||
wrapProgram $out/bin/Hyprland \
|
||||
--suffix PATH : ${lib.makeBinPath [
|
||||
--suffix PATH : ${makeBinPath [
|
||||
binutils
|
||||
pciutils
|
||||
pkgconf
|
||||
@@ -157,11 +175,11 @@ in
|
||||
|
||||
passthru.providedSessions = ["hyprland"];
|
||||
|
||||
meta = with lib; {
|
||||
meta = {
|
||||
homepage = "https://github.com/hyprwm/Hyprland";
|
||||
description = "A dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
|
||||
license = licenses.bsd3;
|
||||
platforms = wlr.meta.platforms;
|
||||
description = "Dynamic tiling Wayland compositor that doesn't sacrifice on its looks";
|
||||
license = lib.licenses.bsd3;
|
||||
platforms = lib.platforms.linux;
|
||||
mainProgram = "Hyprland";
|
||||
};
|
||||
}
|
||||
|
@@ -3,13 +3,12 @@
|
||||
lib,
|
||||
inputs,
|
||||
}: let
|
||||
props = builtins.fromJSON (builtins.readFile ../props.json);
|
||||
|
||||
mkDate = longDate: (lib.concatStringsSep "-" [
|
||||
(builtins.substring 0 4 longDate)
|
||||
(builtins.substring 4 2 longDate)
|
||||
(builtins.substring 6 2 longDate)
|
||||
]);
|
||||
version = lib.removeSuffix "\n" (builtins.readFile ../VERSION);
|
||||
in {
|
||||
# Contains what a user is most likely to care about:
|
||||
# Hyprland itself, XDPH and the Share Picker.
|
||||
@@ -21,34 +20,37 @@ in {
|
||||
# Packages for variations of Hyprland, dependencies included.
|
||||
hyprland-packages = lib.composeManyExtensions [
|
||||
# Dependencies
|
||||
inputs.aquamarine.overlays.default
|
||||
inputs.hyprcursor.overlays.default
|
||||
inputs.hyprland-protocols.overlays.default
|
||||
inputs.hyprlang.overlays.default
|
||||
inputs.hyprutils.overlays.default
|
||||
inputs.hyprwayland-scanner.overlays.default
|
||||
self.overlays.wlroots-hyprland
|
||||
self.overlays.udis86
|
||||
self.overlays.wayland-protocols
|
||||
|
||||
# Hyprland packages themselves
|
||||
(final: prev: let
|
||||
date = mkDate (self.lastModifiedDate or "19700101");
|
||||
in {
|
||||
hyprland = final.callPackage ./default.nix {
|
||||
stdenv = final.gcc13Stdenv;
|
||||
version = "${props.version}+date=${date}_${self.shortRev or "dirty"}";
|
||||
stdenv = final.gcc14Stdenv;
|
||||
version = "${version}+date=${date}_${self.shortRev or "dirty"}";
|
||||
commit = self.rev or "";
|
||||
udis86 = final.udis86-hyprland; # explicit override until decided on breaking change of the name
|
||||
inherit (final) wlroots-hyprland; # explicit override until decided on breaking change of the name
|
||||
revCount = self.sourceInfo.revCount or "";
|
||||
inherit date;
|
||||
};
|
||||
hyprland-unwrapped = final.hyprland.override {wrapRuntimeDeps = false;};
|
||||
hyprland-debug = final.hyprland.override {debug = true;};
|
||||
hyprland-legacy-renderer = final.hyprland.override {legacyRenderer = true;};
|
||||
|
||||
# deprecated packages
|
||||
hyprland-nvidia =
|
||||
builtins.trace ''
|
||||
hyprland-nvidia was removed. Please use the hyprland package.
|
||||
Nvidia patches are no longer needed.
|
||||
''
|
||||
final.hyprland;
|
||||
|
||||
hyprland-hidpi =
|
||||
builtins.trace ''
|
||||
hyprland-hidpi was removed. Please use the hyprland package.
|
||||
@@ -64,27 +66,19 @@ in {
|
||||
inputs.xdph.overlays.xdg-desktop-portal-hyprland
|
||||
];
|
||||
|
||||
# udis86 from nixpkgs is too old, and also does not provide a .pc file
|
||||
# this version is the one used in the git submodule, and allows us to
|
||||
# fetch the source without '?submodules=1'
|
||||
udis86 = final: prev: {
|
||||
udis86-hyprland = final.callPackage ./udis86.nix {};
|
||||
udis86-hyprland = prev.udis86.overrideAttrs (self: super: {
|
||||
src = final.fetchFromGitHub {
|
||||
owner = "canihavesomecoffee";
|
||||
repo = "udis86";
|
||||
rev = "5336633af70f3917760a6d441ff02d93477b0c86";
|
||||
hash = "sha256-HifdUQPGsKQKQprByeIznvRLONdOXeolOsU5nkwIv3g=";
|
||||
};
|
||||
|
||||
# Patched version of wlroots for Hyprland.
|
||||
# It is under a new package name so as to not conflict with
|
||||
# the standard version in nixpkgs.
|
||||
wlroots-hyprland = final: prev: {
|
||||
wlroots-hyprland = final.callPackage ./wlroots.nix {
|
||||
version = "${mkDate (inputs.wlroots.lastModifiedDate or "19700101")}_${inputs.wlroots.shortRev or "dirty"}";
|
||||
src = inputs.wlroots;
|
||||
};
|
||||
};
|
||||
|
||||
wayland-protocols = final: prev: {
|
||||
wayland-protocols = prev.wayland-protocols.overrideAttrs (self: super: {
|
||||
version = "1.35";
|
||||
src = prev.fetchurl {
|
||||
url = "https://gitlab.freedesktop.org/wayland/${super.pname}/-/releases/${self.version}/downloads/${super.pname}-${self.version}.tar.xz";
|
||||
hash = "sha256-N6JxaigTPcgZNBxWiinSHoy3ITDlwSah/PyfQsI9las=";
|
||||
};
|
||||
patches = [];
|
||||
});
|
||||
};
|
||||
}
|
||||
|
@@ -1,61 +0,0 @@
|
||||
diff --git a/meson.build b/meson.build
|
||||
index 40883073..d8f2e536 100644
|
||||
--- a/meson.build
|
||||
+++ b/meson.build
|
||||
@@ -33,20 +33,7 @@ if cpp_compiler.check_header('execinfo.h')
|
||||
add_project_arguments('-DHAS_EXECINFO', language: 'cpp')
|
||||
endif
|
||||
|
||||
-wlroots = subproject('wlroots-hyprland', default_options: ['examples=false', 'renderers=gles2'])
|
||||
-have_xwlr = wlroots.get_variable('features').get('xwayland')
|
||||
-xcb_dep = dependency('xcb', required: get_option('xwayland'))
|
||||
-
|
||||
-cmake = import('cmake')
|
||||
-udis = cmake.subproject('udis86')
|
||||
-udis86 = udis.dependency('libudis86')
|
||||
-
|
||||
-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 get_option('xwayland').disabled()
|
||||
add_project_arguments('-DNO_XWAYLAND', language: 'cpp')
|
||||
endif
|
||||
|
||||
@@ -65,8 +52,6 @@ if get_option('buildtype') == 'debug'
|
||||
add_project_arguments('-DHYPRLAND_DEBUG', language: 'cpp')
|
||||
endif
|
||||
|
||||
-version_h = run_command('sh', '-c', 'scripts/generateVersion.sh')
|
||||
-
|
||||
globber = run_command('find', 'src', '-name', '*.h*', check: true)
|
||||
headers = globber.stdout().strip().split('\n')
|
||||
foreach file : headers
|
||||
diff --git a/src/meson.build b/src/meson.build
|
||||
index 15c69552..327aa4fb 100644
|
||||
--- a/src/meson.build
|
||||
+++ b/src/meson.build
|
||||
@@ -9,7 +9,7 @@ executable('Hyprland', src,
|
||||
server_protos,
|
||||
dependency('wayland-server'),
|
||||
dependency('wayland-client'),
|
||||
- wlroots.get_variable('wlroots'),
|
||||
+ dependency('wlroots'),
|
||||
dependency('cairo'),
|
||||
dependency('hyprcursor'),
|
||||
dependency('hyprlang', version: '>= 0.3.2'),
|
||||
@@ -17,10 +17,10 @@ executable('Hyprland', src,
|
||||
dependency('egl'),
|
||||
dependency('xkbcommon'),
|
||||
dependency('libinput'),
|
||||
- xcb_dep,
|
||||
+ dependency('xcb', required: get_option('xwayland')),
|
||||
backtrace_dep,
|
||||
epoll_dep,
|
||||
- udis86,
|
||||
+ dependency('udis86'),
|
||||
|
||||
dependency('pixman-1'),
|
||||
dependency('gl', 'opengl'),
|
@@ -1,32 +0,0 @@
|
||||
{
|
||||
lib,
|
||||
stdenv,
|
||||
fetchFromGitHub,
|
||||
autoreconfHook,
|
||||
python3,
|
||||
}:
|
||||
stdenv.mkDerivation {
|
||||
pname = "udis86";
|
||||
version = "unstable-2022-10-13";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "canihavesomecoffee";
|
||||
repo = "udis86";
|
||||
rev = "5336633af70f3917760a6d441ff02d93477b0c86";
|
||||
hash = "sha256-HifdUQPGsKQKQprByeIznvRLONdOXeolOsU5nkwIv3g=";
|
||||
};
|
||||
|
||||
nativeBuildInputs = [autoreconfHook python3];
|
||||
|
||||
configureFlags = ["--enable-shared"];
|
||||
|
||||
outputs = ["bin" "out" "dev" "lib"];
|
||||
|
||||
meta = with lib; {
|
||||
homepage = "https://udis86.sourceforge.net";
|
||||
license = licenses.bsd2;
|
||||
mainProgram = "udcli";
|
||||
description = "Easy-to-use, minimalistic x86 disassembler library (libudis86)";
|
||||
platforms = platforms.all;
|
||||
};
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
#!/usr/bin/env -S nix shell nixpkgs#gawk nixpkgs#git nixpkgs#gnused nixpkgs#ripgrep -c bash
|
||||
|
||||
# get wlroots revision from submodule
|
||||
SUB_REV=$(git submodule status | rg wlroots | awk '{ print substr($1,2) }')
|
||||
# and from lockfile
|
||||
CRT_REV=$(rg rev flake.nix | awk '{ print substr($3, 2, 40) }')
|
||||
|
||||
if [ "$SUB_REV" != "$CRT_REV" ]; then
|
||||
echo "Updating wlroots..."
|
||||
# update wlroots to submodule revision
|
||||
sed -Ei "s/\w{40}/$SUB_REV/g" flake.nix
|
||||
nix flake lock
|
||||
|
||||
echo "wlroots: $CRT_REV -> $SUB_REV"
|
||||
else
|
||||
echo "wlroots is up to date!"
|
||||
fi
|
@@ -1,16 +0,0 @@
|
||||
{
|
||||
version,
|
||||
src,
|
||||
git,
|
||||
wlroots,
|
||||
enableXWayland ? true,
|
||||
}:
|
||||
wlroots.overrideAttrs (old: {
|
||||
inherit version src enableXWayland;
|
||||
|
||||
pname = "${old.pname}-hyprland";
|
||||
|
||||
patches = [ ]; # don't inherit old.patches
|
||||
|
||||
nativeBuildInputs = old.nativeBuildInputs ++ [ git ];
|
||||
})
|
@@ -1,3 +0,0 @@
|
||||
{
|
||||
"version": "0.40.0"
|
||||
}
|
85
protocols/kde-server-decoration.xml
Normal file
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="server_decoration">
|
||||
<copyright><![CDATA[
|
||||
SPDX-FileCopyrightText: 2015 Martin Gräßlin
|
||||
|
||||
SPDX-License-Identifier: LGPL-2.1-or-later
|
||||
]]></copyright>
|
||||
<interface name="org_kde_kwin_server_decoration_manager" version="1">
|
||||
<description summary="Server side window decoration manager">
|
||||
This interface allows to coordinate whether the server should create
|
||||
a server-side window decoration around a wl_surface representing a
|
||||
shell surface (wl_shell_surface or similar). By announcing support
|
||||
for this interface the server indicates that it supports server
|
||||
side decorations.
|
||||
|
||||
Use in conjunction with zxdg_decoration_manager_v1 is undefined.
|
||||
</description>
|
||||
<request name="create">
|
||||
<description summary="Create a server-side decoration object for a given surface">
|
||||
When a client creates a server-side decoration object it indicates
|
||||
that it supports the protocol. The client is supposed to tell the
|
||||
server whether it wants server-side decorations or will provide
|
||||
client-side decorations.
|
||||
|
||||
If the client does not create a server-side decoration object for
|
||||
a surface the server interprets this as lack of support for this
|
||||
protocol and considers it as client-side decorated. Nevertheless a
|
||||
client-side decorated surface should use this protocol to indicate
|
||||
to the server that it does not want a server-side deco.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="org_kde_kwin_server_decoration"/>
|
||||
<arg name="surface" type="object" interface="wl_surface"/>
|
||||
</request>
|
||||
<enum name="mode">
|
||||
<description summary="Possible values to use in request_mode and the event mode."/>
|
||||
<entry name="None" value="0" summary="Undecorated: The surface is not decorated at all, neither server nor client-side. An example is a popup surface which should not be decorated."/>
|
||||
<entry name="Client" value="1" summary="Client-side decoration: The decoration is part of the surface and the client."/>
|
||||
<entry name="Server" value="2" summary="Server-side decoration: The server embeds the surface into a decoration frame."/>
|
||||
</enum>
|
||||
<event name="default_mode">
|
||||
<description summary="The default mode used on the server">
|
||||
This event is emitted directly after binding the interface. It contains
|
||||
the default mode for the decoration. When a new server decoration object
|
||||
is created this new object will be in the default mode until the first
|
||||
request_mode is requested.
|
||||
|
||||
The server may change the default mode at any time.
|
||||
</description>
|
||||
<arg name="mode" type="uint" summary="The default decoration mode applied to newly created server decorations."/>
|
||||
</event>
|
||||
</interface>
|
||||
<interface name="org_kde_kwin_server_decoration" version="1">
|
||||
<request name="release" type="destructor">
|
||||
<description summary="release the server decoration object"/>
|
||||
</request>
|
||||
<enum name="mode">
|
||||
<description summary="Possible values to use in request_mode and the event mode."/>
|
||||
<entry name="None" value="0" summary="Undecorated: The surface is not decorated at all, neither server nor client-side. An example is a popup surface which should not be decorated."/>
|
||||
<entry name="Client" value="1" summary="Client-side decoration: The decoration is part of the surface and the client."/>
|
||||
<entry name="Server" value="2" summary="Server-side decoration: The server embeds the surface into a decoration frame."/>
|
||||
</enum>
|
||||
<request name="request_mode">
|
||||
<description summary="The decoration mode the surface wants to use."/>
|
||||
<arg name="mode" type="uint" summary="The mode this surface wants to use."/>
|
||||
</request>
|
||||
<event name="mode">
|
||||
<description summary="The new decoration mode applied by the server">
|
||||
This event is emitted directly after the decoration is created and
|
||||
represents the base decoration policy by the server. E.g. a server
|
||||
which wants all surfaces to be client-side decorated will send Client,
|
||||
a server which wants server-side decoration will send Server.
|
||||
|
||||
The client can request a different mode through the decoration request.
|
||||
The server will acknowledge this by another event with the same mode. So
|
||||
even if a server prefers server-side decoration it's possible to force a
|
||||
client-side decoration.
|
||||
|
||||
The server may emit this event at any time. In this case the client can
|
||||
again request a different mode. It's the responsibility of the server to
|
||||
prevent a feedback loop.
|
||||
</description>
|
||||
<arg name="mode" type="uint" summary="The decoration mode applied to the surface by the server."/>
|
||||
</event>
|
||||
</interface>
|
||||
</protocol>
|
@@ -1,92 +1,76 @@
|
||||
wayland_protos = dependency('wayland-protocols',
|
||||
wayland_protos = dependency(
|
||||
'wayland-protocols',
|
||||
version: '>=1.32',
|
||||
fallback: 'wayland-protocols',
|
||||
default_options: ['tests=false'],
|
||||
)
|
||||
|
||||
hyprland_protos = dependency('hyprland-protocols',
|
||||
hyprland_protos = dependency(
|
||||
'hyprland-protocols',
|
||||
version: '>=0.2',
|
||||
fallback: 'hyprland-protocols',
|
||||
)
|
||||
|
||||
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
|
||||
hl_protocol_dir = hyprland_protos.get_variable('pkgdatadir')
|
||||
wayland_protocol_dir = wayland_protos.get_variable('pkgdatadir')
|
||||
hyprland_protocol_dir = hyprland_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,
|
||||
)
|
||||
hyprwayland_scanner_dep = dependency('hyprwayland-scanner', native: true)
|
||||
hyprwayland_scanner_dep = dependency('hyprwayland-scanner', version: '>=0.3.10', native: true)
|
||||
hyprwayland_scanner = find_program(
|
||||
hyprwayland_scanner_dep.get_variable('hyprwayland_scanner'),
|
||||
native: true,
|
||||
)
|
||||
|
||||
protocols = [
|
||||
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
|
||||
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v1.xml'],
|
||||
['wlr-layer-shell-unstable-v1.xml'],
|
||||
['wlr-screencopy-unstable-v1.xml'],
|
||||
['tablet-unstable-v2.xml'],
|
||||
[hl_protocol_dir, 'protocols/hyprland-toplevel-export-v1.xml'],
|
||||
[hl_protocol_dir, 'protocols/hyprland-global-shortcuts-v1.xml']
|
||||
'wlr-gamma-control-unstable-v1.xml',
|
||||
'wlr-foreign-toplevel-management-unstable-v1.xml',
|
||||
'wlr-output-power-management-unstable-v1.xml',
|
||||
'input-method-unstable-v2.xml',
|
||||
'virtual-keyboard-unstable-v1.xml',
|
||||
'wlr-virtual-pointer-unstable-v1.xml',
|
||||
'wlr-output-management-unstable-v1.xml',
|
||||
'kde-server-decoration.xml',
|
||||
'wlr-layer-shell-unstable-v1.xml',
|
||||
'wayland-drm.xml',
|
||||
'wlr-data-control-unstable-v1.xml',
|
||||
'wlr-screencopy-unstable-v1.xml',
|
||||
hyprland_protocol_dir / 'protocols/hyprland-global-shortcuts-v1.xml',
|
||||
hyprland_protocol_dir / 'protocols/hyprland-toplevel-export-v1.xml',
|
||||
hyprland_protocol_dir / 'protocols/hyprland-focus-grab-v1.xml',
|
||||
wayland_protocol_dir / 'staging/tearing-control/tearing-control-v1.xml',
|
||||
wayland_protocol_dir / 'staging/fractional-scale/fractional-scale-v1.xml',
|
||||
wayland_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
|
||||
wayland_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
|
||||
wayland_protocol_dir / 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml',
|
||||
wayland_protocol_dir / 'unstable/relative-pointer/relative-pointer-unstable-v1.xml',
|
||||
wayland_protocol_dir / 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml',
|
||||
wayland_protocol_dir / 'staging/alpha-modifier/alpha-modifier-v1.xml',
|
||||
wayland_protocol_dir / 'staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml',
|
||||
wayland_protocol_dir / 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml',
|
||||
wayland_protocol_dir / 'unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml',
|
||||
wayland_protocol_dir / 'unstable/text-input/text-input-unstable-v3.xml',
|
||||
wayland_protocol_dir / 'unstable/text-input/text-input-unstable-v1.xml',
|
||||
wayland_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml',
|
||||
wayland_protocol_dir / 'staging/xdg-activation/xdg-activation-v1.xml',
|
||||
wayland_protocol_dir / 'staging/ext-idle-notify/ext-idle-notify-v1.xml',
|
||||
wayland_protocol_dir / 'staging/ext-session-lock/ext-session-lock-v1.xml',
|
||||
wayland_protocol_dir / 'stable/tablet/tablet-v2.xml',
|
||||
wayland_protocol_dir / 'stable/presentation-time/presentation-time.xml',
|
||||
wayland_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
|
||||
wayland_protocol_dir / 'unstable/primary-selection/primary-selection-unstable-v1.xml',
|
||||
wayland_protocol_dir / 'staging/xwayland-shell/xwayland-shell-v1.xml',
|
||||
wayland_protocol_dir / 'stable/viewporter/viewporter.xml',
|
||||
wayland_protocol_dir / 'stable/linux-dmabuf/linux-dmabuf-v1.xml',
|
||||
wayland_protocol_dir / 'staging/drm-lease/drm-lease-v1.xml',
|
||||
wayland_protocol_dir / 'staging/linux-drm-syncobj/linux-drm-syncobj-v1.xml',
|
||||
wayland_protocol_dir / 'staging/xdg-dialog/xdg-dialog-v1.xml',
|
||||
wayland_protocol_dir / 'staging/single-pixel-buffer/single-pixel-buffer-v1.xml',
|
||||
]
|
||||
|
||||
new_protocols = [
|
||||
['wlr-gamma-control-unstable-v1.xml'],
|
||||
['wlr-foreign-toplevel-management-unstable-v1.xml'],
|
||||
['wlr-output-power-management-unstable-v1.xml'],
|
||||
['input-method-unstable-v2.xml'],
|
||||
['virtual-keyboard-unstable-v1.xml'],
|
||||
['wlr-virtual-pointer-unstable-v1.xml'],
|
||||
['wlr-output-management-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'staging/tearing-control/tearing-control-v1.xml'],
|
||||
[wl_protocol_dir, 'staging/fractional-scale/fractional-scale-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'staging/cursor-shape/cursor-shape-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/idle-inhibit/idle-inhibit-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/relative-pointer/relative-pointer-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/xdg-decoration/xdg-decoration-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'staging/alpha-modifier/alpha-modifier-v1.xml'],
|
||||
[wl_protocol_dir, 'staging/ext-foreign-toplevel-list/ext-foreign-toplevel-list-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/pointer-gestures/pointer-gestures-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/keyboard-shortcuts-inhibit/keyboard-shortcuts-inhibit-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'unstable/text-input/text-input-unstable-v3.xml'],
|
||||
[wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'],
|
||||
[wl_protocol_dir, 'staging/xdg-activation/xdg-activation-v1.xml'],
|
||||
[wl_protocol_dir, 'staging/ext-idle-notify/ext-idle-notify-v1.xml'],
|
||||
[wl_protocol_dir, 'staging/ext-session-lock/ext-session-lock-v1.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,
|
||||
install: true,
|
||||
install_dir: join_paths(get_option('includedir'), 'hyprland/protocols'),
|
||||
output: '@BASENAME@-protocol.h',
|
||||
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'],
|
||||
)
|
||||
endforeach
|
||||
|
||||
new_wl_protos = []
|
||||
foreach p : new_protocols
|
||||
xml = join_paths(p)
|
||||
new_wl_protos += custom_target(
|
||||
xml.underscorify(),
|
||||
input: xml,
|
||||
wl_protocols = []
|
||||
foreach protocol : protocols
|
||||
wl_protocols += custom_target(
|
||||
protocol.underscorify(),
|
||||
input: protocol,
|
||||
install: true,
|
||||
install_dir: [false, join_paths(get_option('includedir'), 'hyprland/protocols')],
|
||||
output: ['@BASENAME@.cpp', '@BASENAME@.hpp'],
|
||||
@@ -94,15 +78,26 @@ foreach p : new_protocols
|
||||
)
|
||||
endforeach
|
||||
|
||||
wayland_server = dependency('wayland-server', version: '>=1.20.0')
|
||||
# wayland.xml generation
|
||||
wayland_scanner = dependency('wayland-scanner')
|
||||
wayland_scanner_datadir = wayland_scanner.get_variable('pkgdatadir')
|
||||
|
||||
wayland_xml = wayland_scanner_datadir / 'wayland.xml'
|
||||
wayland_protocol = custom_target(
|
||||
wayland_xml.underscorify(),
|
||||
input: wayland_xml,
|
||||
install: true,
|
||||
install_dir: [false, join_paths(get_option('includedir'), 'hyprland/protocols')],
|
||||
output: ['@BASENAME@.cpp', '@BASENAME@.hpp'],
|
||||
command: [hyprwayland_scanner, '--wayland-enums', '@INPUT@', '@OUTDIR@'],
|
||||
)
|
||||
|
||||
lib_server_protos = static_library(
|
||||
'server_protos',
|
||||
wl_protos_src + wl_protos_headers + new_wl_protos,
|
||||
dependencies: wayland_server.partial_dependency(compile_args: true),
|
||||
wl_protocols + wayland_protocol,
|
||||
)
|
||||
|
||||
server_protos = declare_dependency(
|
||||
link_with: lib_server_protos,
|
||||
sources: wl_protos_headers + new_wl_protos,
|
||||
sources: wl_protocols + wayland_protocol,
|
||||
)
|
||||
|
189
protocols/wayland-drm.xml
Normal file
@@ -0,0 +1,189 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="drm">
|
||||
|
||||
<copyright>
|
||||
Copyright © 2008-2011 Kristian Høgsberg
|
||||
Copyright © 2010-2011 Intel Corporation
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that\n the above copyright notice appear in
|
||||
all copies and that both that copyright notice and this permission
|
||||
notice appear in supporting documentation, and that the name of
|
||||
the copyright holders not be used in advertising or publicity
|
||||
pertaining to distribution of the software without specific,
|
||||
written prior permission. The copyright holders make no
|
||||
representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<!-- drm support. This object is created by the server and published
|
||||
using the display's global event. -->
|
||||
<interface name="wl_drm" version="2">
|
||||
<enum name="error">
|
||||
<entry name="authenticate_fail" value="0"/>
|
||||
<entry name="invalid_format" value="1"/>
|
||||
<entry name="invalid_name" value="2"/>
|
||||
</enum>
|
||||
|
||||
<enum name="format">
|
||||
<!-- The drm format codes match the #defines in drm_fourcc.h.
|
||||
The formats actually supported by the compositor will be
|
||||
reported by the format event. New codes must not be added,
|
||||
unless directly taken from drm_fourcc.h. -->
|
||||
<entry name="c8" value="0x20203843"/>
|
||||
<entry name="rgb332" value="0x38424752"/>
|
||||
<entry name="bgr233" value="0x38524742"/>
|
||||
<entry name="xrgb4444" value="0x32315258"/>
|
||||
<entry name="xbgr4444" value="0x32314258"/>
|
||||
<entry name="rgbx4444" value="0x32315852"/>
|
||||
<entry name="bgrx4444" value="0x32315842"/>
|
||||
<entry name="argb4444" value="0x32315241"/>
|
||||
<entry name="abgr4444" value="0x32314241"/>
|
||||
<entry name="rgba4444" value="0x32314152"/>
|
||||
<entry name="bgra4444" value="0x32314142"/>
|
||||
<entry name="xrgb1555" value="0x35315258"/>
|
||||
<entry name="xbgr1555" value="0x35314258"/>
|
||||
<entry name="rgbx5551" value="0x35315852"/>
|
||||
<entry name="bgrx5551" value="0x35315842"/>
|
||||
<entry name="argb1555" value="0x35315241"/>
|
||||
<entry name="abgr1555" value="0x35314241"/>
|
||||
<entry name="rgba5551" value="0x35314152"/>
|
||||
<entry name="bgra5551" value="0x35314142"/>
|
||||
<entry name="rgb565" value="0x36314752"/>
|
||||
<entry name="bgr565" value="0x36314742"/>
|
||||
<entry name="rgb888" value="0x34324752"/>
|
||||
<entry name="bgr888" value="0x34324742"/>
|
||||
<entry name="xrgb8888" value="0x34325258"/>
|
||||
<entry name="xbgr8888" value="0x34324258"/>
|
||||
<entry name="rgbx8888" value="0x34325852"/>
|
||||
<entry name="bgrx8888" value="0x34325842"/>
|
||||
<entry name="argb8888" value="0x34325241"/>
|
||||
<entry name="abgr8888" value="0x34324241"/>
|
||||
<entry name="rgba8888" value="0x34324152"/>
|
||||
<entry name="bgra8888" value="0x34324142"/>
|
||||
<entry name="xrgb2101010" value="0x30335258"/>
|
||||
<entry name="xbgr2101010" value="0x30334258"/>
|
||||
<entry name="rgbx1010102" value="0x30335852"/>
|
||||
<entry name="bgrx1010102" value="0x30335842"/>
|
||||
<entry name="argb2101010" value="0x30335241"/>
|
||||
<entry name="abgr2101010" value="0x30334241"/>
|
||||
<entry name="rgba1010102" value="0x30334152"/>
|
||||
<entry name="bgra1010102" value="0x30334142"/>
|
||||
<entry name="yuyv" value="0x56595559"/>
|
||||
<entry name="yvyu" value="0x55595659"/>
|
||||
<entry name="uyvy" value="0x59565955"/>
|
||||
<entry name="vyuy" value="0x59555956"/>
|
||||
<entry name="ayuv" value="0x56555941"/>
|
||||
<entry name="xyuv8888" value="0x56555958"/>
|
||||
<entry name="nv12" value="0x3231564e"/>
|
||||
<entry name="nv21" value="0x3132564e"/>
|
||||
<entry name="nv16" value="0x3631564e"/>
|
||||
<entry name="nv61" value="0x3136564e"/>
|
||||
<entry name="yuv410" value="0x39565559"/>
|
||||
<entry name="yvu410" value="0x39555659"/>
|
||||
<entry name="yuv411" value="0x31315559"/>
|
||||
<entry name="yvu411" value="0x31315659"/>
|
||||
<entry name="yuv420" value="0x32315559"/>
|
||||
<entry name="yvu420" value="0x32315659"/>
|
||||
<entry name="yuv422" value="0x36315559"/>
|
||||
<entry name="yvu422" value="0x36315659"/>
|
||||
<entry name="yuv444" value="0x34325559"/>
|
||||
<entry name="yvu444" value="0x34325659"/>
|
||||
<entry name="abgr16f" value="0x48344241"/>
|
||||
<entry name="xbgr16f" value="0x48344258"/>
|
||||
</enum>
|
||||
|
||||
<!-- Call this request with the magic received from drmGetMagic().
|
||||
It will be passed on to the drmAuthMagic() or
|
||||
DRIAuthConnection() call. This authentication must be
|
||||
completed before create_buffer could be used. -->
|
||||
<request name="authenticate">
|
||||
<arg name="id" type="uint"/>
|
||||
</request>
|
||||
|
||||
<!-- Create a wayland buffer for the named DRM buffer. The DRM
|
||||
surface must have a name using the flink ioctl -->
|
||||
<request name="create_buffer">
|
||||
<arg name="id" type="new_id" interface="wl_buffer"/>
|
||||
<arg name="name" type="uint"/>
|
||||
<arg name="width" type="int"/>
|
||||
<arg name="height" type="int"/>
|
||||
<arg name="stride" type="uint"/>
|
||||
<arg name="format" type="uint"/>
|
||||
</request>
|
||||
|
||||
<!-- Create a wayland buffer for the named DRM buffer. The DRM
|
||||
surface must have a name using the flink ioctl -->
|
||||
<request name="create_planar_buffer">
|
||||
<arg name="id" type="new_id" interface="wl_buffer"/>
|
||||
<arg name="name" type="uint"/>
|
||||
<arg name="width" type="int"/>
|
||||
<arg name="height" type="int"/>
|
||||
<arg name="format" type="uint"/>
|
||||
<arg name="offset0" type="int"/>
|
||||
<arg name="stride0" type="int"/>
|
||||
<arg name="offset1" type="int"/>
|
||||
<arg name="stride1" type="int"/>
|
||||
<arg name="offset2" type="int"/>
|
||||
<arg name="stride2" type="int"/>
|
||||
</request>
|
||||
|
||||
<!-- Notification of the path of the drm device which is used by
|
||||
the server. The client should use this device for creating
|
||||
local buffers. Only buffers created from this device should
|
||||
be be passed to the server using this drm object's
|
||||
create_buffer request. -->
|
||||
<event name="device">
|
||||
<arg name="name" type="string"/>
|
||||
</event>
|
||||
|
||||
<event name="format">
|
||||
<arg name="format" type="uint"/>
|
||||
</event>
|
||||
|
||||
<!-- Raised if the authenticate request succeeded -->
|
||||
<event name="authenticated"/>
|
||||
|
||||
<enum name="capability" since="2">
|
||||
<description summary="wl_drm capability bitmask">
|
||||
Bitmask of capabilities.
|
||||
</description>
|
||||
<entry name="prime" value="1" summary="wl_drm prime available"/>
|
||||
</enum>
|
||||
|
||||
<event name="capabilities">
|
||||
<arg name="value" type="uint"/>
|
||||
</event>
|
||||
|
||||
<!-- Version 2 additions -->
|
||||
|
||||
<!-- Create a wayland buffer for the prime fd. Use for regular and planar
|
||||
buffers. Pass 0 for offset and stride for unused planes. -->
|
||||
<request name="create_prime_buffer" since="2">
|
||||
<arg name="id" type="new_id" interface="wl_buffer"/>
|
||||
<arg name="name" type="fd"/>
|
||||
<arg name="width" type="int"/>
|
||||
<arg name="height" type="int"/>
|
||||
<arg name="format" type="uint"/>
|
||||
<arg name="offset0" type="int"/>
|
||||
<arg name="stride0" type="int"/>
|
||||
<arg name="offset1" type="int"/>
|
||||
<arg name="stride1" type="int"/>
|
||||
<arg name="offset2" type="int"/>
|
||||
<arg name="stride2" type="int"/>
|
||||
</request>
|
||||
|
||||
</interface>
|
||||
|
||||
</protocol>
|
278
protocols/wlr-data-control-unstable-v1.xml
Normal file
@@ -0,0 +1,278 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="wlr_data_control_unstable_v1">
|
||||
<copyright>
|
||||
Copyright © 2018 Simon Ser
|
||||
Copyright © 2019 Ivan Molodetskikh
|
||||
|
||||
Permission to use, copy, modify, distribute, and sell this
|
||||
software and its documentation for any purpose is hereby granted
|
||||
without fee, provided that the above copyright notice appear in
|
||||
all copies and that both that copyright notice and this permission
|
||||
notice appear in supporting documentation, and that the name of
|
||||
the copyright holders not be used in advertising or publicity
|
||||
pertaining to distribution of the software without specific,
|
||||
written prior permission. The copyright holders make no
|
||||
representations about the suitability of this software for any
|
||||
purpose. It is provided "as is" without express or implied
|
||||
warranty.
|
||||
|
||||
THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS
|
||||
SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND
|
||||
FITNESS, IN NO EVENT SHALL THE COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
||||
SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN
|
||||
AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
|
||||
ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF
|
||||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<description summary="control data devices">
|
||||
This protocol allows a privileged client to control data devices. In
|
||||
particular, the client will be able to manage the current selection and take
|
||||
the role of a clipboard manager.
|
||||
|
||||
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_data_control_manager_v1" version="2">
|
||||
<description summary="manager to control data devices">
|
||||
This interface is a manager that allows creating per-seat data device
|
||||
controls.
|
||||
</description>
|
||||
|
||||
<request name="create_data_source">
|
||||
<description summary="create a new data source">
|
||||
Create a new data source.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwlr_data_control_source_v1"
|
||||
summary="data source to create"/>
|
||||
</request>
|
||||
|
||||
<request name="get_data_device">
|
||||
<description summary="get a data device for a seat">
|
||||
Create a data device that can be used to manage a seat's selection.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwlr_data_control_device_v1"/>
|
||||
<arg name="seat" type="object" interface="wl_seat"/>
|
||||
</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_data_control_device_v1" version="2">
|
||||
<description summary="manage a data device for a seat">
|
||||
This interface allows a client to manage a seat's selection.
|
||||
|
||||
When the seat is destroyed, this object becomes inert.
|
||||
</description>
|
||||
|
||||
<request name="set_selection">
|
||||
<description summary="copy data to the selection">
|
||||
This request asks the compositor to set the selection to the data from
|
||||
the source on behalf of the client.
|
||||
|
||||
The given source may not be used in any further set_selection or
|
||||
set_primary_selection requests. Attempting to use a previously used
|
||||
source is a protocol error.
|
||||
|
||||
To unset the selection, set the source to NULL.
|
||||
</description>
|
||||
<arg name="source" type="object" interface="zwlr_data_control_source_v1"
|
||||
allow-null="true"/>
|
||||
</request>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy this data device">
|
||||
Destroys the data device object.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="data_offer">
|
||||
<description summary="introduce a new wlr_data_control_offer">
|
||||
The data_offer event introduces a new wlr_data_control_offer object,
|
||||
which will subsequently be used in either the
|
||||
wlr_data_control_device.selection event (for the regular clipboard
|
||||
selections) or the wlr_data_control_device.primary_selection event (for
|
||||
the primary clipboard selections). Immediately following the
|
||||
wlr_data_control_device.data_offer event, the new data_offer object
|
||||
will send out wlr_data_control_offer.offer events to describe the MIME
|
||||
types it offers.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwlr_data_control_offer_v1"/>
|
||||
</event>
|
||||
|
||||
<event name="selection">
|
||||
<description summary="advertise new selection">
|
||||
The selection event is sent out to notify the client of a new
|
||||
wlr_data_control_offer for the selection for this device. The
|
||||
wlr_data_control_device.data_offer and the wlr_data_control_offer.offer
|
||||
events are sent out immediately before this event to introduce the data
|
||||
offer object. The selection event is sent to a client when a new
|
||||
selection is set. The wlr_data_control_offer is valid until a new
|
||||
wlr_data_control_offer or NULL is received. The client must destroy the
|
||||
previous selection wlr_data_control_offer, if any, upon receiving this
|
||||
event.
|
||||
|
||||
The first selection event is sent upon binding the
|
||||
wlr_data_control_device object.
|
||||
</description>
|
||||
<arg name="id" type="object" interface="zwlr_data_control_offer_v1"
|
||||
allow-null="true"/>
|
||||
</event>
|
||||
|
||||
<event name="finished">
|
||||
<description summary="this data control is no longer valid">
|
||||
This data control object is no longer valid and should be destroyed by
|
||||
the client.
|
||||
</description>
|
||||
</event>
|
||||
|
||||
<!-- Version 2 additions -->
|
||||
|
||||
<event name="primary_selection" since="2">
|
||||
<description summary="advertise new primary selection">
|
||||
The primary_selection event is sent out to notify the client of a new
|
||||
wlr_data_control_offer for the primary selection for this device. The
|
||||
wlr_data_control_device.data_offer and the wlr_data_control_offer.offer
|
||||
events are sent out immediately before this event to introduce the data
|
||||
offer object. The primary_selection event is sent to a client when a
|
||||
new primary selection is set. The wlr_data_control_offer is valid until
|
||||
a new wlr_data_control_offer or NULL is received. The client must
|
||||
destroy the previous primary selection wlr_data_control_offer, if any,
|
||||
upon receiving this event.
|
||||
|
||||
If the compositor supports primary selection, the first
|
||||
primary_selection event is sent upon binding the
|
||||
wlr_data_control_device object.
|
||||
</description>
|
||||
<arg name="id" type="object" interface="zwlr_data_control_offer_v1"
|
||||
allow-null="true"/>
|
||||
</event>
|
||||
|
||||
<request name="set_primary_selection" since="2">
|
||||
<description summary="copy data to the primary selection">
|
||||
This request asks the compositor to set the primary selection to the
|
||||
data from the source on behalf of the client.
|
||||
|
||||
The given source may not be used in any further set_selection or
|
||||
set_primary_selection requests. Attempting to use a previously used
|
||||
source is a protocol error.
|
||||
|
||||
To unset the primary selection, set the source to NULL.
|
||||
|
||||
The compositor will ignore this request if it does not support primary
|
||||
selection.
|
||||
</description>
|
||||
<arg name="source" type="object" interface="zwlr_data_control_source_v1"
|
||||
allow-null="true"/>
|
||||
</request>
|
||||
|
||||
<enum name="error" since="2">
|
||||
<entry name="used_source" value="1"
|
||||
summary="source given to set_selection or set_primary_selection was already used before"/>
|
||||
</enum>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_data_control_source_v1" version="1">
|
||||
<description summary="offer to transfer data">
|
||||
The wlr_data_control_source object is the source side of a
|
||||
wlr_data_control_offer. It is created by the source client in a data
|
||||
transfer and provides a way to describe the offered data and a way to
|
||||
respond to requests to transfer the data.
|
||||
</description>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="invalid_offer" value="1"
|
||||
summary="offer sent after wlr_data_control_device.set_selection"/>
|
||||
</enum>
|
||||
|
||||
<request name="offer">
|
||||
<description summary="add an offered MIME type">
|
||||
This request adds a MIME type to the set of MIME types advertised to
|
||||
targets. Can be called several times to offer multiple types.
|
||||
|
||||
Calling this after wlr_data_control_device.set_selection is a protocol
|
||||
error.
|
||||
</description>
|
||||
<arg name="mime_type" type="string"
|
||||
summary="MIME type offered by the data source"/>
|
||||
</request>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy this source">
|
||||
Destroys the data source object.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="send">
|
||||
<description summary="send the data">
|
||||
Request for data from the client. Send the data as the specified MIME
|
||||
type over the passed file descriptor, then close it.
|
||||
</description>
|
||||
<arg name="mime_type" type="string" summary="MIME type for the data"/>
|
||||
<arg name="fd" type="fd" summary="file descriptor for the data"/>
|
||||
</event>
|
||||
|
||||
<event name="cancelled">
|
||||
<description summary="selection was cancelled">
|
||||
This data source is no longer valid. The data source has been replaced
|
||||
by another data source.
|
||||
|
||||
The client should clean up and destroy this data source.
|
||||
</description>
|
||||
</event>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_data_control_offer_v1" version="1">
|
||||
<description summary="offer to transfer data">
|
||||
A wlr_data_control_offer represents a piece of data offered for transfer
|
||||
by another client (the source client). The offer describes the different
|
||||
MIME types that the data can be converted to and provides the mechanism
|
||||
for transferring the data directly from the source client.
|
||||
</description>
|
||||
|
||||
<request name="receive">
|
||||
<description summary="request that the data is transferred">
|
||||
To transfer the offered data, the client issues this request and
|
||||
indicates the MIME type it wants to receive. The transfer happens
|
||||
through the passed file descriptor (typically created with the pipe
|
||||
system call). The source client writes the data in the MIME type
|
||||
representation requested and then closes the file descriptor.
|
||||
|
||||
The receiving client reads from the read end of the pipe until EOF and
|
||||
then closes its end, at which point the transfer is complete.
|
||||
|
||||
This request may happen multiple times for different MIME types.
|
||||
</description>
|
||||
<arg name="mime_type" type="string"
|
||||
summary="MIME type desired by receiver"/>
|
||||
<arg name="fd" type="fd" summary="file descriptor for data transfer"/>
|
||||
</request>
|
||||
|
||||
<request name="destroy" type="destructor">
|
||||
<description summary="destroy this offer">
|
||||
Destroys the data offer object.
|
||||
</description>
|
||||
</request>
|
||||
|
||||
<event name="offer">
|
||||
<description summary="advertise offered MIME type">
|
||||
Sent immediately after creating the wlr_data_control_offer object.
|
||||
One event per offered MIME type.
|
||||
</description>
|
||||
<arg name="mime_type" type="string" summary="offered MIME type"/>
|
||||
</event>
|
||||
</interface>
|
||||
</protocol>
|
@@ -25,7 +25,7 @@
|
||||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_layer_shell_v1" version="4">
|
||||
<interface name="zwlr_layer_shell_v1" version="5">
|
||||
<description summary="create surfaces that are layers of the desktop">
|
||||
Clients can use this interface to assign the surface_layer role to
|
||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
@@ -100,7 +100,7 @@
|
||||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_layer_surface_v1" version="4">
|
||||
<interface name="zwlr_layer_surface_v1" version="5">
|
||||
<description summary="layer metadata interface">
|
||||
An interface that may be implemented by a wl_surface, for surfaces that
|
||||
are designed to be rendered as a layer of a stacked desktop-like
|
||||
@@ -367,6 +367,7 @@
|
||||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
||||
<entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/>
|
||||
</enum>
|
||||
|
||||
<enum name="anchor" bitfield="true">
|
||||
@@ -386,5 +387,21 @@
|
||||
</description>
|
||||
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||
</request>
|
||||
|
||||
<!-- Version 5 additions -->
|
||||
|
||||
<request name="set_exclusive_edge" since="5">
|
||||
<description summary="set the edge the exclusive zone will be applied to">
|
||||
Requests an edge for the exclusive zone to apply. The exclusive
|
||||
edge will be automatically deduced from anchor points when possible,
|
||||
but when the surface is anchored to a corner, it will be necessary
|
||||
to set it explicitly to disambiguate, as it is not possible to deduce
|
||||
which one of the two corner edges should be used.
|
||||
|
||||
The edge must be one the surface is anchored to, otherwise the
|
||||
invalid_exclusive_edge protocol error will be raised.
|
||||
</description>
|
||||
<arg name="edge" type="uint" enum="anchor"/>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
||||
|
@@ -1,13 +1,13 @@
|
||||
#!/bin/sh
|
||||
cp -fr ./src/version.h.in ./src/version.h
|
||||
|
||||
HASH=$(git rev-parse HEAD)
|
||||
BRANCH=$(git branch --show-current)
|
||||
MESSAGE=$(git show ${GIT_COMMIT_HASH} | head -n 5 | tail -n 1 | sed -e 's/#//g' -e 's/\"//g')
|
||||
DATE=$(git show ${GIT_COMMIT_HASH} --no-patch --format=%cd --date=local)
|
||||
DIRTY=$(git diff-index --quiet HEAD -- || echo dirty)
|
||||
TAG=$(git describe --tags)
|
||||
COMMITS=$(git rev-list --count HEAD)
|
||||
HASH=${HASH-$(git rev-parse HEAD)}
|
||||
BRANCH=${BRANCH-$(git branch --show-current)}
|
||||
MESSAGE=${MESSAGE-$(git show | head -n 5 | tail -n 1 | sed -e 's/#//g' -e 's/\"//g')}
|
||||
DATE=${DATE-$(git show --no-patch --format=%cd --date=local)}
|
||||
DIRTY=${DIRTY-$(git diff-index --quiet HEAD -- || echo dirty)}
|
||||
TAG=${TAG-$(git describe --tags)}
|
||||
COMMITS=${COMMITS-$(git rev-list --count HEAD)}
|
||||
|
||||
sed -i -e "s#@HASH@#${HASH}#" ./src/version.h
|
||||
sed -i -e "s#@BRANCH@#${BRANCH}#" ./src/version.h
|
||||
|
@@ -1,8 +1,8 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index f54cdf5d..ad7c3e73 100755
|
||||
index f26a5c3c..3dfef333 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -130,6 +130,8 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||
@@ -143,6 +143,8 @@ if(CMAKE_BUILD_TYPE MATCHES Debug OR CMAKE_BUILD_TYPE MATCHES DEBUG)
|
||||
message(STATUS "Enabling ASan")
|
||||
|
||||
target_link_libraries(Hyprland asan)
|
||||
|
1491
src/Compositor.cpp
@@ -3,6 +3,7 @@
|
||||
#include <memory>
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <sys/resource.h>
|
||||
|
||||
#include "defines.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
@@ -29,8 +30,14 @@
|
||||
#include "plugins/PluginSystem.hpp"
|
||||
#include "helpers/Watchdog.hpp"
|
||||
|
||||
#include <aquamarine/backend/Backend.hpp>
|
||||
#include <aquamarine/output/Output.hpp>
|
||||
|
||||
class CWLSurfaceResource;
|
||||
|
||||
enum eManagersInitStage {
|
||||
STAGE_PRIORITY = 0,
|
||||
STAGE_BASICINIT,
|
||||
STAGE_LATE
|
||||
};
|
||||
|
||||
@@ -39,31 +46,11 @@ class CCompositor {
|
||||
CCompositor();
|
||||
~CCompositor();
|
||||
|
||||
// ------------------ 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_output_layout* m_sWLROutputLayout;
|
||||
wlr_layer_shell_v1* m_sWLRLayerShell;
|
||||
wlr_xdg_shell* m_sWLRXDGShell;
|
||||
wlr_cursor* m_sWLRCursor;
|
||||
wlr_presentation* m_sWLRPresentation;
|
||||
wlr_egl* m_sWLREGL;
|
||||
int m_iDRMFD;
|
||||
wlr_server_decoration_manager* m_sWLRServerDecoMgr;
|
||||
wlr_tablet_manager_v2* m_sWLRTabletManager;
|
||||
wlr_xdg_foreign_registry* m_sWLRForeignRegistry;
|
||||
wlr_linux_dmabuf_v1* m_sWLRLinuxDMABuf;
|
||||
wlr_backend* m_sWLRHeadlessBackend;
|
||||
// ------------------------------------------------- //
|
||||
int m_iDRMFD = -1;
|
||||
bool m_bInitialized = false;
|
||||
SP<Aquamarine::CBackend> m_pAqBackend;
|
||||
|
||||
std::string m_szHyprTempDataRoot = "";
|
||||
|
||||
@@ -75,146 +62,141 @@ class CCompositor {
|
||||
std::vector<SP<CMonitor>> m_vMonitors;
|
||||
std::vector<SP<CMonitor>> m_vRealMonitors; // for all monitors, even those turned off
|
||||
std::vector<PHLWINDOW> m_vWindows;
|
||||
std::vector<PHLLS> m_vLayers;
|
||||
std::vector<PHLWORKSPACE> m_vWorkspaces;
|
||||
std::vector<PHLWINDOWREF> m_vWindowsFadingOut;
|
||||
std::vector<PHLLSREF> m_vSurfacesFadingOut;
|
||||
|
||||
std::unordered_map<std::string, uint64_t> m_mMonitorIDMap;
|
||||
std::unordered_map<std::string, MONITORID> m_mMonitorIDMap;
|
||||
|
||||
void initServer();
|
||||
void initServer(std::string socketName, int socketFd);
|
||||
void startCompositor();
|
||||
void stopCompositor();
|
||||
void cleanup();
|
||||
void createLockFile();
|
||||
void removeLockFile();
|
||||
void bumpNofile();
|
||||
void restoreNofile();
|
||||
|
||||
wlr_surface* m_pLastFocus = nullptr;
|
||||
WP<CWLSurfaceResource> m_pLastFocus;
|
||||
PHLWINDOWREF m_pLastWindow;
|
||||
CMonitor* m_pLastMonitor = nullptr;
|
||||
WP<CMonitor> m_pLastMonitor;
|
||||
|
||||
std::vector<PHLWINDOWREF> m_vWindowFocusHistory; // first element is the most recently focused.
|
||||
|
||||
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_bNextIsUnsafe = false; // because wlroots
|
||||
bool m_bNextIsUnsafe = false;
|
||||
CMonitor* m_pUnsafeOutput = nullptr; // fallback output for the unsafe state
|
||||
bool m_bExitTriggered = false; // For exit dispatcher
|
||||
bool m_bIsShuttingDown = false;
|
||||
bool m_bFinalRequests = false;
|
||||
bool m_bDesktopEnvSet = false;
|
||||
bool m_bEnableXwayland = true;
|
||||
|
||||
// ------------------------------------------------- //
|
||||
|
||||
CMonitor* getMonitorFromID(const int&);
|
||||
CMonitor* getMonitorFromID(const MONITORID&);
|
||||
CMonitor* getMonitorFromName(const std::string&);
|
||||
CMonitor* getMonitorFromDesc(const std::string&);
|
||||
CMonitor* getMonitorFromCursor();
|
||||
CMonitor* getMonitorFromVector(const Vector2D&);
|
||||
void removeWindowFromVectorSafe(PHLWINDOW);
|
||||
void focusWindow(PHLWINDOW, wlr_surface* pSurface = nullptr);
|
||||
void focusSurface(wlr_surface*, PHLWINDOW pWindowOwner = nullptr);
|
||||
void focusWindow(PHLWINDOW, SP<CWLSurfaceResource> pSurface = nullptr);
|
||||
void focusSurface(SP<CWLSurfaceResource>, PHLWINDOW pWindowOwner = nullptr);
|
||||
bool monitorExists(CMonitor*);
|
||||
PHLWINDOW vectorToWindowUnified(const Vector2D&, uint8_t properties, PHLWINDOW pIgnoreWindow = nullptr);
|
||||
wlr_surface* vectorToLayerSurface(const Vector2D&, std::vector<PHLLS>*, Vector2D*, PHLLS*);
|
||||
wlr_surface* vectorToLayerPopupSurface(const Vector2D&, CMonitor* monitor, Vector2D*, PHLLS*);
|
||||
wlr_surface* vectorWindowToSurface(const Vector2D&, PHLWINDOW, Vector2D& sl);
|
||||
Vector2D vectorToSurfaceLocal(const Vector2D&, PHLWINDOW, wlr_surface*);
|
||||
CMonitor* getMonitorFromOutput(wlr_output*);
|
||||
CMonitor* getRealMonitorFromOutput(wlr_output*);
|
||||
PHLWINDOW getWindowFromSurface(wlr_surface*);
|
||||
SP<CWLSurfaceResource> vectorToLayerSurface(const Vector2D&, std::vector<PHLLSREF>*, Vector2D*, PHLLS*);
|
||||
SP<CWLSurfaceResource> vectorToLayerPopupSurface(const Vector2D&, CMonitor* monitor, Vector2D*, PHLLS*);
|
||||
SP<CWLSurfaceResource> vectorWindowToSurface(const Vector2D&, PHLWINDOW, Vector2D& sl);
|
||||
Vector2D vectorToSurfaceLocal(const Vector2D&, PHLWINDOW, SP<CWLSurfaceResource>);
|
||||
CMonitor* getMonitorFromOutput(SP<Aquamarine::IOutput>);
|
||||
CMonitor* getRealMonitorFromOutput(SP<Aquamarine::IOutput>);
|
||||
PHLWINDOW getWindowFromSurface(SP<CWLSurfaceResource>);
|
||||
PHLWINDOW getWindowFromHandle(uint32_t);
|
||||
bool isWorkspaceVisible(PHLWORKSPACE);
|
||||
PHLWORKSPACE getWorkspaceByID(const int&);
|
||||
bool isWorkspaceVisibleNotCovered(PHLWORKSPACE);
|
||||
PHLWORKSPACE getWorkspaceByID(const WORKSPACEID&);
|
||||
PHLWORKSPACE getWorkspaceByName(const std::string&);
|
||||
PHLWORKSPACE getWorkspaceByString(const std::string&);
|
||||
void sanityCheckWorkspaces();
|
||||
void updateWorkspaceWindowDecos(const int&);
|
||||
void updateWorkspaceSpecialRenderData(const int&);
|
||||
int getWindowsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
|
||||
int getGroupsOnWorkspace(const int& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
|
||||
void updateWorkspaceWindowDecos(const WORKSPACEID&);
|
||||
void updateWorkspaceWindowData(const WORKSPACEID&);
|
||||
int getWindowsOnWorkspace(const WORKSPACEID& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
|
||||
int getGroupsOnWorkspace(const WORKSPACEID& id, std::optional<bool> onlyTiled = {}, std::optional<bool> onlyVisible = {});
|
||||
PHLWINDOW getUrgentWindow();
|
||||
bool hasUrgentWindowOnWorkspace(const int&);
|
||||
PHLWINDOW getFirstWindowOnWorkspace(const int&);
|
||||
PHLWINDOW getTopLeftWindowOnWorkspace(const int&);
|
||||
PHLWINDOW getFullscreenWindowOnWorkspace(const int&);
|
||||
bool doesSeatAcceptInput(wlr_surface*);
|
||||
bool hasUrgentWindowOnWorkspace(const WORKSPACEID&);
|
||||
PHLWINDOW getFirstWindowOnWorkspace(const WORKSPACEID&);
|
||||
PHLWINDOW getTopLeftWindowOnWorkspace(const WORKSPACEID&);
|
||||
PHLWINDOW getFullscreenWindowOnWorkspace(const WORKSPACEID&);
|
||||
bool isWindowActive(PHLWINDOW);
|
||||
void changeWindowZOrder(PHLWINDOW, bool);
|
||||
void cleanupFadingOut(const int& monid);
|
||||
void cleanupFadingOut(const MONITORID& monid);
|
||||
PHLWINDOW getWindowInDirection(PHLWINDOW, char);
|
||||
PHLWINDOW getNextWindowOnWorkspace(PHLWINDOW, bool focusableOnly = false, std::optional<bool> floating = {});
|
||||
PHLWINDOW getPrevWindowOnWorkspace(PHLWINDOW, bool focusableOnly = false, std::optional<bool> floating = {});
|
||||
int getNextAvailableNamedWorkspace();
|
||||
WORKSPACEID getNextAvailableNamedWorkspace();
|
||||
bool isPointOnAnyMonitor(const Vector2D&);
|
||||
bool isPointOnReservedArea(const Vector2D& point, const CMonitor* monitor = nullptr);
|
||||
CMonitor* getMonitorInDirection(const char&);
|
||||
CMonitor* getMonitorInDirection(CMonitor*, const char&);
|
||||
void updateAllWindowsAnimatedDecorationValues();
|
||||
void updateWorkspaceWindows(const int64_t& id);
|
||||
void updateWorkspaceWindows(const WORKSPACEID& id);
|
||||
void updateWindowAnimatedDecorationValues(PHLWINDOW);
|
||||
int getNextAvailableMonitorID(std::string const& name);
|
||||
MONITORID getNextAvailableMonitorID(std::string const& name);
|
||||
void moveWorkspaceToMonitor(PHLWORKSPACE, CMonitor*, bool noWarpCursor = false);
|
||||
void swapActiveWorkspaces(CMonitor*, CMonitor*);
|
||||
CMonitor* getMonitorFromString(const std::string&);
|
||||
bool workspaceIDOutOfBounds(const int64_t&);
|
||||
void setWindowFullscreen(PHLWINDOW, bool, eFullscreenMode mode = FULLSCREEN_INVALID);
|
||||
bool workspaceIDOutOfBounds(const WORKSPACEID&);
|
||||
void setWindowFullscreenInternal(const PHLWINDOW PWINDOW, const eFullscreenMode MODE);
|
||||
void setWindowFullscreenClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE);
|
||||
void setWindowFullscreenState(const PHLWINDOW PWINDOW, const sFullscreenState state);
|
||||
void changeWindowFullscreenModeInternal(const PHLWINDOW PWINDOW, const eFullscreenMode MODE, const bool ON);
|
||||
void changeWindowFullscreenModeClient(const PHLWINDOW PWINDOW, const eFullscreenMode MODE, const bool ON);
|
||||
void updateFullscreenFadeOnWorkspace(PHLWORKSPACE);
|
||||
PHLWINDOW getX11Parent(PHLWINDOW);
|
||||
void scheduleFrameForMonitor(CMonitor*);
|
||||
void scheduleFrameForMonitor(CMonitor*, Aquamarine::IOutput::scheduleFrameReason reason = Aquamarine::IOutput::AQ_SCHEDULE_CLIENT_UNKNOWN);
|
||||
void addToFadingOutSafe(PHLLS);
|
||||
void removeFromFadingOutSafe(PHLLS);
|
||||
void addToFadingOutSafe(PHLWINDOW);
|
||||
PHLWINDOW getWindowByRegex(const std::string&);
|
||||
void warpCursorTo(const Vector2D&, bool force = false);
|
||||
PHLLS getLayerSurfaceFromWlr(wlr_layer_surface_v1*);
|
||||
PHLLS getLayerSurfaceFromSurface(wlr_surface*);
|
||||
PHLLS getLayerSurfaceFromSurface(SP<CWLSurfaceResource>);
|
||||
void closeWindow(PHLWINDOW);
|
||||
Vector2D parseWindowVectorArgsRelative(const std::string&, const Vector2D&);
|
||||
void forceReportSizesToWindowsOnWorkspace(const int&);
|
||||
PHLWORKSPACE createNewWorkspace(const int&, const int&, const std::string& name = ""); // will be deleted next frame if left empty and unfocused!
|
||||
void renameWorkspace(const int&, const std::string& name = "");
|
||||
void forceReportSizesToWindowsOnWorkspace(const WORKSPACEID&);
|
||||
PHLWORKSPACE createNewWorkspace(const WORKSPACEID&, const MONITORID&, const std::string& name = "",
|
||||
bool isEmpty = true); // will be deleted next frame if left empty and unfocused!
|
||||
void renameWorkspace(const WORKSPACEID&, const std::string& name = "");
|
||||
void setActiveMonitor(CMonitor*);
|
||||
bool isWorkspaceSpecial(const int&);
|
||||
int getNewSpecialID();
|
||||
bool isWorkspaceSpecial(const WORKSPACEID&);
|
||||
WORKSPACEID getNewSpecialID();
|
||||
void performUserChecks();
|
||||
void moveWindowToWorkspaceSafe(PHLWINDOW pWindow, PHLWORKSPACE pWorkspace);
|
||||
PHLWINDOW getForceFocus();
|
||||
void arrangeMonitors();
|
||||
void enterUnsafeState();
|
||||
void leaveUnsafeState();
|
||||
void setPreferredScaleForSurface(wlr_surface* pSurface, double scale);
|
||||
void setPreferredTransformForSurface(wlr_surface* pSurface, wl_output_transform transform);
|
||||
void setPreferredScaleForSurface(SP<CWLSurfaceResource> pSurface, double scale);
|
||||
void setPreferredTransformForSurface(SP<CWLSurfaceResource> pSurface, wl_output_transform transform);
|
||||
void updateSuspendedStates();
|
||||
PHLWINDOW windowForCPointer(CWindow*);
|
||||
void onNewMonitor(SP<Aquamarine::IOutput> output);
|
||||
|
||||
std::string explicitConfigPath;
|
||||
|
||||
private:
|
||||
void initAllSignals();
|
||||
void removeAllSignals();
|
||||
void cleanEnvironment();
|
||||
void setRandomSplash();
|
||||
void initManagers(eManagersInitStage stage);
|
||||
void prepareFallbackOutput();
|
||||
|
||||
uint64_t m_iHyprlandPID = 0;
|
||||
wl_event_source* m_critSigSource = nullptr;
|
||||
rlimit m_sOriginalNofile = {0};
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CCompositor> g_pCompositor;
|
||||
|
||||
// For XWayland
|
||||
inline std::map<std::string, xcb_atom_t> HYPRATOMS = {HYPRATOM("_NET_WM_WINDOW_TYPE"),
|
||||
HYPRATOM("_NET_WM_WINDOW_TYPE_NORMAL"),
|
||||
HYPRATOM("_NET_WM_WINDOW_TYPE_DOCK"),
|
||||
HYPRATOM("_NET_WM_WINDOW_TYPE_DIALOG"),
|
||||
HYPRATOM("_NET_WM_WINDOW_TYPE_UTILITY"),
|
||||
HYPRATOM("_NET_WM_WINDOW_TYPE_TOOLBAR"),
|
||||
HYPRATOM("_NET_WM_WINDOW_TYPE_SPLASH"),
|
||||
HYPRATOM("_NET_WM_WINDOW_TYPE_MENU"),
|
||||
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("_KDE_NET_WM_WINDOW_TYPE_OVERRIDE"),
|
||||
HYPRATOM("_NET_SUPPORTING_WM_CHECK"),
|
||||
HYPRATOM("_NET_WM_NAME"),
|
||||
HYPRATOM("UTF8_STRING")};
|
||||
|
@@ -1,7 +1,11 @@
|
||||
#pragma once
|
||||
|
||||
#include "helpers/Vector2D.hpp"
|
||||
#include "helpers/math/Math.hpp"
|
||||
#include <functional>
|
||||
#include <any>
|
||||
#include <hyprutils/math/Box.hpp>
|
||||
|
||||
using namespace Hyprutils::Math;
|
||||
|
||||
enum eIcons {
|
||||
ICON_WARNING = 0,
|
||||
@@ -37,29 +41,6 @@ struct SCallbackInfo {
|
||||
bool cancelled = false; /* on cancellable events, will cancel the event. */
|
||||
};
|
||||
|
||||
struct SWindowDecorationExtents {
|
||||
Vector2D topLeft;
|
||||
Vector2D bottomRight;
|
||||
|
||||
//
|
||||
SWindowDecorationExtents operator*(const double& scale) const {
|
||||
return SWindowDecorationExtents{topLeft * scale, bottomRight * scale};
|
||||
}
|
||||
|
||||
SWindowDecorationExtents round() {
|
||||
return {topLeft.round(), bottomRight.round()};
|
||||
}
|
||||
|
||||
bool operator==(const SWindowDecorationExtents& other) const {
|
||||
return topLeft == other.topLeft && bottomRight == other.bottomRight;
|
||||
}
|
||||
|
||||
void addExtents(const SWindowDecorationExtents& other) {
|
||||
topLeft = topLeft.getComponentMax(other.topLeft);
|
||||
bottomRight = bottomRight.getComponentMax(other.bottomRight);
|
||||
}
|
||||
};
|
||||
|
||||
enum eHyprCtlOutputFormat {
|
||||
FORMAT_NORMAL = 0,
|
||||
FORMAT_JSON
|
||||
@@ -71,4 +52,8 @@ struct SHyprCtlCommand {
|
||||
std::function<std::string(eHyprCtlOutputFormat, std::string)> fn;
|
||||
};
|
||||
|
||||
typedef int64_t WINDOWID;
|
||||
typedef int64_t MONITORID;
|
||||
typedef int64_t WORKSPACEID;
|
||||
|
||||
typedef std::function<void(void*, SCallbackInfo&, std::any)> HOOK_CALLBACK_FN;
|
||||
|
@@ -1,6 +1,6 @@
|
||||
#pragma once
|
||||
#include "../defines.hpp"
|
||||
#include "../helpers/VarList.hpp"
|
||||
#include "../helpers/varlist/VarList.hpp"
|
||||
#include <vector>
|
||||
|
||||
enum eConfigValueDataTypes {
|
||||
|
1541
src/config/ConfigDescriptions.hpp
Normal file
@@ -6,6 +6,7 @@
|
||||
#include "../debug/Log.hpp"
|
||||
#include <unordered_map>
|
||||
#include "../defines.hpp"
|
||||
#include <variant>
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <algorithm>
|
||||
@@ -15,7 +16,7 @@
|
||||
#include <xf86drmMode.h>
|
||||
#include "../helpers/WLClasses.hpp"
|
||||
#include "../helpers/Monitor.hpp"
|
||||
#include "../helpers/VarList.hpp"
|
||||
#include "../helpers/varlist/VarList.hpp"
|
||||
#include "../desktop/Window.hpp"
|
||||
#include "../desktop/LayerSurface.hpp"
|
||||
|
||||
@@ -33,16 +34,16 @@ struct SWorkspaceRule {
|
||||
std::string monitor = "";
|
||||
std::string workspaceString = "";
|
||||
std::string workspaceName = "";
|
||||
int workspaceId = -1;
|
||||
WORKSPACEID workspaceId = -1;
|
||||
bool isDefault = false;
|
||||
bool isPersistent = false;
|
||||
std::optional<CCssGapData> gapsIn;
|
||||
std::optional<CCssGapData> gapsOut;
|
||||
std::optional<int64_t> borderSize;
|
||||
std::optional<int> border;
|
||||
std::optional<int> rounding;
|
||||
std::optional<int> decorate;
|
||||
std::optional<int> shadow;
|
||||
std::optional<bool> decorate;
|
||||
std::optional<bool> noRounding;
|
||||
std::optional<bool> noBorder;
|
||||
std::optional<bool> noShadow;
|
||||
std::optional<std::string> onCreatedEmptyRunCmd;
|
||||
std::optional<std::string> defaultName;
|
||||
std::map<std::string, std::string> layoutopts;
|
||||
@@ -83,6 +84,70 @@ struct SExecRequestedRule {
|
||||
uint64_t iPid = 0;
|
||||
};
|
||||
|
||||
enum eConfigOptionType : uint16_t {
|
||||
CONFIG_OPTION_BOOL = 0,
|
||||
CONFIG_OPTION_INT = 1, /* e.g. 0/1/2*/
|
||||
CONFIG_OPTION_FLOAT = 2,
|
||||
CONFIG_OPTION_STRING_SHORT = 3, /* e.g. "auto" */
|
||||
CONFIG_OPTION_STRING_LONG = 4, /* e.g. a command */
|
||||
CONFIG_OPTION_COLOR = 5,
|
||||
CONFIG_OPTION_CHOICE = 6, /* e.g. "one", "two", "three" */
|
||||
CONFIG_OPTION_GRADIENT = 7,
|
||||
CONFIG_OPTION_VECTOR = 8,
|
||||
};
|
||||
|
||||
enum eConfigOptionFlags : uint32_t {
|
||||
CONFIG_OPTION_FLAG_PERCENTAGE = (1 << 0),
|
||||
};
|
||||
|
||||
struct SConfigOptionDescription {
|
||||
|
||||
struct SBoolData {
|
||||
bool value = false;
|
||||
};
|
||||
|
||||
struct SRangeData {
|
||||
int value = 0, min = 0, max = 2;
|
||||
};
|
||||
|
||||
struct SFloatData {
|
||||
float value = 0, min = 0, max = 100;
|
||||
};
|
||||
|
||||
struct SStringData {
|
||||
std::string value;
|
||||
};
|
||||
|
||||
struct SColorData {
|
||||
CColor color;
|
||||
};
|
||||
|
||||
struct SChoiceData {
|
||||
int firstIndex = 0;
|
||||
std::string choices; // comma-separated
|
||||
};
|
||||
|
||||
struct SGradientData {
|
||||
std::string gradient;
|
||||
};
|
||||
|
||||
struct SVectorData {
|
||||
Vector2D vec, min, max;
|
||||
};
|
||||
|
||||
std::string value; // e.g. general:gaps_in
|
||||
std::string description;
|
||||
std::string specialCategory; // if value is special (e.g. device:abc) value will be abc and special device
|
||||
bool specialKey = false;
|
||||
eConfigOptionType type = CONFIG_OPTION_BOOL;
|
||||
uint32_t flags = 0; // eConfigOptionFlags
|
||||
|
||||
std::string jsonify() const;
|
||||
|
||||
//
|
||||
std::variant<SBoolData, SRangeData, SFloatData, SStringData, SColorData, SChoiceData, SGradientData, SVectorData> data;
|
||||
};
|
||||
|
||||
class CConfigManager {
|
||||
public:
|
||||
CConfigManager();
|
||||
@@ -101,10 +166,10 @@ class CConfigManager {
|
||||
void* const* getConfigValuePtr(const std::string&);
|
||||
Hyprlang::CConfigValue* getHyprlangConfigValuePtr(const std::string& name, const std::string& specialCat = "");
|
||||
void onPluginLoadUnload(const std::string& name, bool load);
|
||||
static std::string getConfigDir();
|
||||
static std::string getMainConfigPath();
|
||||
const std::string getConfigString();
|
||||
|
||||
SMonitorRule getMonitorRuleFor(const CMonitor&);
|
||||
SMonitorRule getMonitorRuleFor(const SP<CMonitor>);
|
||||
SWorkspaceRule getWorkspaceRuleFor(PHLWORKSPACE workspace);
|
||||
std::string getDefaultWorkspaceFor(const std::string&);
|
||||
|
||||
@@ -115,6 +180,8 @@ class CConfigManager {
|
||||
std::vector<SWindowRule> getMatchingRules(PHLWINDOW, bool dynamic = true, bool shadowExec = false);
|
||||
std::vector<SLayerRule> getMatchingRules(PHLLS);
|
||||
|
||||
const std::vector<SConfigOptionDescription>& getAllDescriptions();
|
||||
|
||||
std::unordered_map<std::string, SMonitorAdditionalReservedArea> m_mAdditionalReservedAreas;
|
||||
|
||||
std::unordered_map<std::string, SAnimationPropertyConfig> getAnimationConfig();
|
||||
@@ -125,12 +192,11 @@ class CConfigManager {
|
||||
|
||||
// no-op when done.
|
||||
void dispatchExecOnce();
|
||||
void dispatchExecShutdown();
|
||||
|
||||
void performMonitorReload();
|
||||
void appendMonitorRule(const SMonitorRule&);
|
||||
bool m_bWantsMonitorReload = false;
|
||||
bool m_bForceReload = false;
|
||||
bool m_bNoMonitorReload = false;
|
||||
bool replaceMonitorRule(const SMonitorRule&);
|
||||
void ensureMonitorStatus();
|
||||
void ensureVRR(CMonitor* pMonitor = nullptr);
|
||||
|
||||
@@ -148,6 +214,7 @@ class CConfigManager {
|
||||
// keywords
|
||||
std::optional<std::string> handleRawExec(const std::string&, const std::string&);
|
||||
std::optional<std::string> handleExecOnce(const std::string&, const std::string&);
|
||||
std::optional<std::string> handleExecShutdown(const std::string&, const std::string&);
|
||||
std::optional<std::string> handleMonitor(const std::string&, const std::string&);
|
||||
std::optional<std::string> handleBind(const std::string&, const std::string&);
|
||||
std::optional<std::string> handleUnbind(const std::string&, const std::string&);
|
||||
@@ -166,6 +233,37 @@ class CConfigManager {
|
||||
|
||||
std::string configCurrentPath;
|
||||
|
||||
std::unordered_map<std::string, std::function<CWindowOverridableVar<bool>*(PHLWINDOW)>> mbWindowProperties = {
|
||||
{"allowsinput", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.allowsInput; }},
|
||||
{"dimaround", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.dimAround; }},
|
||||
{"decorate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.decorate; }},
|
||||
{"focusonactivate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.focusOnActivate; }},
|
||||
{"keepaspectratio", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.keepAspectRatio; }},
|
||||
{"nearestneighbor", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.nearestNeighbor; }},
|
||||
{"noanim", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noAnim; }},
|
||||
{"noblur", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noBlur; }},
|
||||
{"noborder", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noBorder; }},
|
||||
{"nodim", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noDim; }},
|
||||
{"nofocus", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noFocus; }},
|
||||
{"nomaxsize", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noMaxSize; }},
|
||||
{"norounding", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noRounding; }},
|
||||
{"noshadow", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShadow; }},
|
||||
{"noshortcutsinhibit", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.noShortcutsInhibit; }},
|
||||
{"opaque", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.opaque; }},
|
||||
{"forcergbx", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.RGBX; }},
|
||||
{"syncfullscreen", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.syncFullscreen; }},
|
||||
{"immediate", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.tearing; }},
|
||||
{"xray", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.xray; }},
|
||||
};
|
||||
|
||||
std::unordered_map<std::string, std::function<CWindowOverridableVar<int>*(PHLWINDOW)>> miWindowProperties = {
|
||||
{"rounding", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.rounding; }}, {"bordersize", [](PHLWINDOW pWindow) { return &pWindow->m_sWindowData.borderSize; }}};
|
||||
|
||||
bool m_bWantsMonitorReload = false;
|
||||
bool m_bForceReload = false;
|
||||
bool m_bNoMonitorReload = false;
|
||||
bool isLaunchingExecOnce = false; // For exec-once to skip initial ws tracking
|
||||
|
||||
private:
|
||||
std::unique_ptr<Hyprlang::CConfig> m_pConfig;
|
||||
|
||||
@@ -193,6 +291,7 @@ class CConfigManager {
|
||||
bool firstExecDispatched = false;
|
||||
bool m_bManualCrashInitiated = false;
|
||||
std::deque<std::string> firstExecRequests;
|
||||
std::deque<std::string> finalExecRequests;
|
||||
|
||||
std::vector<std::pair<std::string, std::string>> m_vFailedPluginConfigValues; // for plugin values of unloaded plugins
|
||||
std::string m_szConfigErrors = "";
|
||||
@@ -202,7 +301,8 @@ class CConfigManager {
|
||||
void updateBlurredLS(const std::string&, const bool);
|
||||
void setDefaultAnimationVars();
|
||||
std::optional<std::string> resetHLConfig();
|
||||
std::optional<std::string> verifyConfigExists();
|
||||
static std::optional<std::string> generateConfig(std::string configPath);
|
||||
static std::optional<std::string> verifyConfigExists();
|
||||
void postConfigReload(const Hyprlang::CParseResult& result);
|
||||
void reload();
|
||||
SWorkspaceRule mergeWorkspaceRules(const SWorkspaceRule&, const SWorkspaceRule&);
|
||||
|
@@ -11,7 +11,7 @@ template <typename T>
|
||||
class CConfigValue {
|
||||
public:
|
||||
CConfigValue(const std::string& val) {
|
||||
const auto PVHYPRLANG = g_pConfigManager->getHyprlangConfigValuePtr(val.c_str());
|
||||
const auto PVHYPRLANG = g_pConfigManager->getHyprlangConfigValuePtr(val);
|
||||
|
||||
p_ = PVHYPRLANG->getDataStaticPtr();
|
||||
|
||||
|
@@ -138,7 +138,7 @@ dwindle {
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Master-Layout/ for more
|
||||
master {
|
||||
new_is_master = true
|
||||
new_status = master
|
||||
}
|
||||
|
||||
# https://wiki.hyprland.org/Configuring/Variables/#misc
|
||||
@@ -182,9 +182,9 @@ device {
|
||||
}
|
||||
|
||||
|
||||
####################
|
||||
### KEYBINDINGSS ###
|
||||
####################
|
||||
###################
|
||||
### KEYBINDINGS ###
|
||||
###################
|
||||
|
||||
# See https://wiki.hyprland.org/Configuring/Keywords/
|
||||
$mainMod = SUPER # Sets "Windows" key as main modifier
|
||||
@@ -241,6 +241,19 @@ bind = $mainMod, mouse_up, workspace, e-1
|
||||
bindm = $mainMod, mouse:272, movewindow
|
||||
bindm = $mainMod, mouse:273, resizewindow
|
||||
|
||||
# Laptop multimedia keys for volume and LCD brightness
|
||||
bindel = ,XF86AudioRaiseVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%+
|
||||
bindel = ,XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-
|
||||
bindel = ,XF86AudioMute, exec, wpctl set-mute @DEFAULT_AUDIO_SINK@ toggle
|
||||
bindel = ,XF86AudioMicMute, exec, wpctl set-mute @DEFAULT_AUDIO_SOURCE@ toggle
|
||||
bindel = ,XF86MonBrightnessUp, exec, brightnessctl s 10%+
|
||||
bindel = ,XF86MonBrightnessDown, exec, brightnessctl s 10%-
|
||||
|
||||
# Requires playerctl
|
||||
bindl = , XF86AudioNext, exec, playerctl next
|
||||
bindl = , XF86AudioPause, exec, playerctl play-pause
|
||||
bindl = , XF86AudioPlay, exec, playerctl play-pause
|
||||
bindl = , XF86AudioPrev, exec, playerctl previous
|
||||
|
||||
##############################
|
||||
### WINDOWS AND WORKSPACES ###
|
||||
@@ -255,5 +268,9 @@ bindm = $mainMod, mouse:273, resizewindow
|
||||
# Example windowrule v2
|
||||
# windowrulev2 = float,class:^(kitty)$,title:^(kitty)$
|
||||
|
||||
windowrulev2 = suppressevent maximize, class:.* # You'll probably like this.
|
||||
# Ignore maximize requests from apps. You'll probably like this.
|
||||
windowrulev2 = suppressevent maximize, class:.*
|
||||
|
||||
# Fix some dragging issues with XWayland
|
||||
windowrulev2 = nofocus,class:^$,title:^$,xwayland:1,floating:1,fullscreen:0,pinned:0
|
||||
)#";
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <sys/stat.h>
|
||||
#include <filesystem>
|
||||
|
||||
#include "../plugins/PluginSystem.hpp"
|
||||
#include "../signal-safe.hpp"
|
||||
@@ -85,7 +86,7 @@ void CrashReporter::createAndSaveCrash(int sig) {
|
||||
stderr.flush();
|
||||
}
|
||||
|
||||
reportFd = open(reportPath.get_str(), O_WRONLY | O_CREAT, S_IRWXU);
|
||||
reportFd = open(reportPath.get_str(), O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR);
|
||||
if (reportFd < 0) {
|
||||
exit_with_error("Failed to open crash report path for writing");
|
||||
}
|
||||
@@ -104,7 +105,19 @@ void CrashReporter::createAndSaveCrash(int sig) {
|
||||
finalCrashReport += GIT_COMMIT_HASH;
|
||||
finalCrashReport += "\nTag: ";
|
||||
finalCrashReport += GIT_TAG;
|
||||
finalCrashReport += "\n\n";
|
||||
finalCrashReport += "\nDate: ";
|
||||
finalCrashReport += GIT_COMMIT_DATE;
|
||||
finalCrashReport += "\nFlags:\n";
|
||||
#ifdef LEGACY_RENDERER
|
||||
finalCrashReport += "legacyrenderer\n";
|
||||
#endif
|
||||
#ifndef ISDEBUG
|
||||
finalCrashReport += "debug\n";
|
||||
#endif
|
||||
#ifdef NO_XWAYLAND
|
||||
finalCrashReport += "no xwayland\n";
|
||||
#endif
|
||||
finalCrashReport += "\n";
|
||||
|
||||
if (g_pPluginSystem && g_pPluginSystem->pluginCount() > 0) {
|
||||
finalCrashReport += "Hyprland seems to be running with plugins. This crash might not be Hyprland's fault.\nPlugins:\n";
|
||||
|
@@ -5,25 +5,36 @@
|
||||
#include "../helpers/MiscFunctions.hpp"
|
||||
#include <functional>
|
||||
|
||||
// exposed for main.cpp
|
||||
std::string systemInfoRequest(eHyprCtlOutputFormat format, std::string request);
|
||||
|
||||
class CHyprCtl {
|
||||
public:
|
||||
CHyprCtl();
|
||||
~CHyprCtl();
|
||||
|
||||
std::string makeDynamicCall(const std::string& input);
|
||||
std::shared_ptr<SHyprCtlCommand> registerCommand(SHyprCtlCommand cmd);
|
||||
void unregisterCommand(const std::shared_ptr<SHyprCtlCommand>& cmd);
|
||||
SP<SHyprCtlCommand> registerCommand(SHyprCtlCommand cmd);
|
||||
void unregisterCommand(const SP<SHyprCtlCommand>& cmd);
|
||||
std::string getReply(std::string);
|
||||
|
||||
int m_iSocketFD = -1;
|
||||
|
||||
struct {
|
||||
bool all = false;
|
||||
bool sysInfoConfig = false;
|
||||
} m_sCurrentRequestParams;
|
||||
|
||||
static std::string getWindowData(PHLWINDOW w, eHyprCtlOutputFormat format);
|
||||
static std::string getWorkspaceData(PHLWORKSPACE w, eHyprCtlOutputFormat format);
|
||||
static std::string getMonitorData(Hyprutils::Memory::CSharedPointer<CMonitor> m, eHyprCtlOutputFormat format);
|
||||
|
||||
private:
|
||||
void startHyprCtlSocket();
|
||||
|
||||
std::vector<std::shared_ptr<SHyprCtlCommand>> m_vCommands;
|
||||
std::vector<SP<SHyprCtlCommand>> m_vCommands;
|
||||
wl_event_source* m_eventSource = nullptr;
|
||||
std::string m_socketPath;
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CHyprCtl> g_pHyprCtl;
|
@@ -1,8 +1,14 @@
|
||||
#include <pango/pangocairo.h>
|
||||
#include "HyprDebugOverlay.hpp"
|
||||
#include "config/ConfigValue.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
|
||||
void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
|
||||
m_dLastRenderTimes.push_back(µs / 1000.f);
|
||||
CHyprDebugOverlay::CHyprDebugOverlay() {
|
||||
m_pTexture = makeShared<CTexture>();
|
||||
}
|
||||
|
||||
void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float durationUs) {
|
||||
m_dLastRenderTimes.push_back(durationUs / 1000.f);
|
||||
|
||||
if (m_dLastRenderTimes.size() > (long unsigned int)pMonitor->refreshRate)
|
||||
m_dLastRenderTimes.pop_front();
|
||||
@@ -11,8 +17,8 @@ void CHyprMonitorDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
|
||||
m_pMonitor = pMonitor;
|
||||
}
|
||||
|
||||
void CHyprMonitorDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) {
|
||||
m_dLastRenderTimesNoOverlay.push_back(µs / 1000.f);
|
||||
void CHyprMonitorDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float durationUs) {
|
||||
m_dLastRenderTimesNoOverlay.push_back(durationUs / 1000.f);
|
||||
|
||||
if (m_dLastRenderTimesNoOverlay.size() > (long unsigned int)pMonitor->refreshRate)
|
||||
m_dLastRenderTimesNoOverlay.pop_front();
|
||||
@@ -33,7 +39,7 @@ void CHyprMonitorDebugOverlay::frameData(CMonitor* pMonitor) {
|
||||
m_pMonitor = pMonitor;
|
||||
|
||||
// anim data too
|
||||
const auto PMONITORFORTICKS = g_pHyprRenderer->m_pMostHzMonitor ? g_pHyprRenderer->m_pMostHzMonitor : g_pCompositor->m_pLastMonitor;
|
||||
const auto PMONITORFORTICKS = g_pHyprRenderer->m_pMostHzMonitor ? g_pHyprRenderer->m_pMostHzMonitor : g_pCompositor->m_pLastMonitor.get();
|
||||
if (PMONITORFORTICKS) {
|
||||
if (m_dLastAnimationTicks.size() > (long unsigned int)PMONITORFORTICKS->refreshRate)
|
||||
m_dLastAnimationTicks.pop_front();
|
||||
@@ -47,16 +53,11 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
||||
if (!m_pMonitor)
|
||||
return 0;
|
||||
|
||||
int yOffset = offset;
|
||||
cairo_text_extents_t cairoExtents;
|
||||
float maxX = 0;
|
||||
std::string text = "";
|
||||
|
||||
// get avg fps
|
||||
float avgFrametime = 0;
|
||||
float maxFrametime = 0;
|
||||
float minFrametime = 9999;
|
||||
for (auto& ft : m_dLastFrametimes) {
|
||||
for (auto const& ft : m_dLastFrametimes) {
|
||||
if (ft > maxFrametime)
|
||||
maxFrametime = ft;
|
||||
if (ft < minFrametime)
|
||||
@@ -69,7 +70,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
||||
float avgRenderTime = 0;
|
||||
float maxRenderTime = 0;
|
||||
float minRenderTime = 9999;
|
||||
for (auto& rt : m_dLastRenderTimes) {
|
||||
for (auto const& rt : m_dLastRenderTimes) {
|
||||
if (rt > maxRenderTime)
|
||||
maxRenderTime = rt;
|
||||
if (rt < minRenderTime)
|
||||
@@ -82,7 +83,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
||||
float avgRenderTimeNoOverlay = 0;
|
||||
float maxRenderTimeNoOverlay = 0;
|
||||
float minRenderTimeNoOverlay = 9999;
|
||||
for (auto& rt : m_dLastRenderTimesNoOverlay) {
|
||||
for (auto const& rt : m_dLastRenderTimesNoOverlay) {
|
||||
if (rt > maxRenderTimeNoOverlay)
|
||||
maxRenderTimeNoOverlay = rt;
|
||||
if (rt < minRenderTimeNoOverlay)
|
||||
@@ -95,7 +96,7 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
||||
float avgAnimMgrTick = 0;
|
||||
float maxAnimMgrTick = 0;
|
||||
float minAnimMgrTick = 9999;
|
||||
for (auto& at : m_dLastAnimationTicks) {
|
||||
for (auto const& at : m_dLastAnimationTicks) {
|
||||
if (at > maxAnimMgrTick)
|
||||
maxAnimMgrTick = at;
|
||||
if (at < minAnimMgrTick)
|
||||
@@ -108,20 +109,46 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
||||
const float FPS = 1.f / (avgFrametime / 1000.f); // frametimes are in ms
|
||||
const float idealFPS = m_dLastFrametimes.size();
|
||||
|
||||
cairo_select_font_face(g_pDebugOverlay->m_pCairo, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
static auto fontFamily = CConfigValue<std::string>("misc:font_family");
|
||||
PangoLayout* layoutText = pango_cairo_create_layout(g_pDebugOverlay->m_pCairo);
|
||||
PangoFontDescription* pangoFD = pango_font_description_new();
|
||||
|
||||
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 10);
|
||||
pango_font_description_set_family(pangoFD, (*fontFamily).c_str());
|
||||
pango_font_description_set_style(pangoFD, PANGO_STYLE_NORMAL);
|
||||
pango_font_description_set_weight(pangoFD, PANGO_WEIGHT_NORMAL);
|
||||
|
||||
float maxTextW = 0;
|
||||
int fontSize = 0;
|
||||
auto cr = g_pDebugOverlay->m_pCairo;
|
||||
|
||||
auto showText = [cr, layoutText, pangoFD, &maxTextW, &fontSize](const char* text, int size) {
|
||||
if (fontSize != size) {
|
||||
pango_font_description_set_absolute_size(pangoFD, size * PANGO_SCALE);
|
||||
pango_layout_set_font_description(layoutText, pangoFD);
|
||||
fontSize = size;
|
||||
}
|
||||
|
||||
pango_layout_set_text(layoutText, text, -1);
|
||||
pango_cairo_show_layout(cr, layoutText);
|
||||
|
||||
int textW = 0, textH = 0;
|
||||
pango_layout_get_size(layoutText, &textW, &textH);
|
||||
textW /= PANGO_SCALE;
|
||||
textH /= PANGO_SCALE;
|
||||
if (textW > maxTextW)
|
||||
maxTextW = textW;
|
||||
|
||||
// move to next line
|
||||
cairo_rel_move_to(cr, 0, fontSize + 1);
|
||||
};
|
||||
|
||||
const int MARGIN_TOP = 8;
|
||||
const int MARGIN_LEFT = 4;
|
||||
cairo_move_to(cr, MARGIN_LEFT, MARGIN_TOP + offset);
|
||||
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
yOffset += 10;
|
||||
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
|
||||
text = m_pMonitor->szName;
|
||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||
if (cairoExtents.width > maxX)
|
||||
maxX = cairoExtents.width;
|
||||
|
||||
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 16);
|
||||
std::string text;
|
||||
showText(m_pMonitor->szName.c_str(), 10);
|
||||
|
||||
if (FPS > idealFPS * 0.95f)
|
||||
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 0.2f, 1.f, 0.2f, 1.f);
|
||||
@@ -130,65 +157,43 @@ int CHyprMonitorDebugOverlay::draw(int offset) {
|
||||
else
|
||||
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 0.2f, 0.2f, 1.f);
|
||||
|
||||
yOffset += 17;
|
||||
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
|
||||
text = std::format("{} FPS", (int)FPS);
|
||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||
if (cairoExtents.width > maxX)
|
||||
maxX = cairoExtents.width;
|
||||
showText(text.c_str(), 16);
|
||||
|
||||
cairo_set_font_size(g_pDebugOverlay->m_pCairo, 10);
|
||||
cairo_set_source_rgba(g_pDebugOverlay->m_pCairo, 1.f, 1.f, 1.f, 1.f);
|
||||
|
||||
yOffset += 11;
|
||||
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
|
||||
text = std::format("Avg Frametime: {:.2f}ms (var {:.2f}ms)", avgFrametime, varFrametime);
|
||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||
if (cairoExtents.width > maxX)
|
||||
maxX = cairoExtents.width;
|
||||
showText(text.c_str(), 10);
|
||||
|
||||
yOffset += 11;
|
||||
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
|
||||
text = std::format("Avg Rendertime: {:.2f}ms (var {:.2f}ms)", avgRenderTime, varRenderTime);
|
||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||
if (cairoExtents.width > maxX)
|
||||
maxX = cairoExtents.width;
|
||||
showText(text.c_str(), 10);
|
||||
|
||||
yOffset += 11;
|
||||
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
|
||||
text = std::format("Avg Rendertime (No Overlay): {:.2f}ms (var {:.2f}ms)", avgRenderTimeNoOverlay, varRenderTimeNoOverlay);
|
||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||
if (cairoExtents.width > maxX)
|
||||
maxX = cairoExtents.width;
|
||||
showText(text.c_str(), 10);
|
||||
|
||||
yOffset += 11;
|
||||
cairo_move_to(g_pDebugOverlay->m_pCairo, 0, yOffset);
|
||||
text = std::format("Avg Anim Tick: {:.2f}ms (var {:.2f}ms) ({:.2f} TPS)", avgAnimMgrTick, varAnimMgrTick, 1.0 / (avgAnimMgrTick / 1000.0));
|
||||
cairo_show_text(g_pDebugOverlay->m_pCairo, text.c_str());
|
||||
cairo_text_extents(g_pDebugOverlay->m_pCairo, text.c_str(), &cairoExtents);
|
||||
if (cairoExtents.width > maxX)
|
||||
maxX = cairoExtents.width;
|
||||
showText(text.c_str(), 10);
|
||||
|
||||
yOffset += 11;
|
||||
pango_font_description_free(pangoFD);
|
||||
g_object_unref(layoutText);
|
||||
|
||||
double posX = 0, posY = 0;
|
||||
cairo_get_current_point(cr, &posX, &posY);
|
||||
|
||||
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
|
||||
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};
|
||||
m_wbLastDrawnBox = {(int)g_pCompositor->m_vMonitors.front()->vecPosition.x + MARGIN_LEFT - 1, (int)g_pCompositor->m_vMonitors.front()->vecPosition.y + offset + MARGIN_TOP - 1,
|
||||
(int)maxTextW + 2, posY - offset - MARGIN_TOP + 2};
|
||||
g_pHyprRenderer->damageBox(&m_wbLastDrawnBox);
|
||||
|
||||
return yOffset - offset;
|
||||
return posY - offset;
|
||||
}
|
||||
|
||||
void CHyprDebugOverlay::renderData(CMonitor* pMonitor, float µs) {
|
||||
m_mMonitorOverlays[pMonitor].renderData(pMonitor, µs);
|
||||
void CHyprDebugOverlay::renderData(CMonitor* pMonitor, float durationUs) {
|
||||
m_mMonitorOverlays[pMonitor].renderData(pMonitor, durationUs);
|
||||
}
|
||||
|
||||
void CHyprDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float µs) {
|
||||
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, µs);
|
||||
void CHyprDebugOverlay::renderDataNoOverlay(CMonitor* pMonitor, float durationUs) {
|
||||
m_mMonitorOverlays[pMonitor].renderDataNoOverlay(pMonitor, durationUs);
|
||||
}
|
||||
|
||||
void CHyprDebugOverlay::frameData(CMonitor* pMonitor) {
|
||||
@@ -212,7 +217,7 @@ void CHyprDebugOverlay::draw() {
|
||||
|
||||
// draw the things
|
||||
int offsetY = 0;
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
||||
offsetY += m_mMonitorOverlays[m.get()].draw(offsetY);
|
||||
offsetY += 5; // for padding between mons
|
||||
}
|
||||
@@ -221,8 +226,8 @@ void CHyprDebugOverlay::draw() {
|
||||
|
||||
// copy the data to an OpenGL texture we have
|
||||
const auto DATA = cairo_image_surface_get_data(m_pCairoSurface);
|
||||
m_tTexture.allocate();
|
||||
glBindTexture(GL_TEXTURE_2D, m_tTexture.m_iTexID);
|
||||
m_pTexture->allocate();
|
||||
glBindTexture(GL_TEXTURE_2D, m_pTexture->m_iTexID);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
@@ -234,5 +239,5 @@ void CHyprDebugOverlay::draw() {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
|
||||
|
||||
CBox pMonBox = {0, 0, PMONITOR->vecPixelSize.x, PMONITOR->vecPixelSize.y};
|
||||
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
|
||||
g_pHyprOpenGL->renderTexture(m_pTexture, &pMonBox, 1.f);
|
||||
}
|
||||
|
@@ -13,8 +13,8 @@ class CHyprMonitorDebugOverlay {
|
||||
public:
|
||||
int draw(int offset);
|
||||
|
||||
void renderData(CMonitor* pMonitor, float µs);
|
||||
void renderDataNoOverlay(CMonitor* pMonitor, float µs);
|
||||
void renderData(CMonitor* pMonitor, float durationUs);
|
||||
void renderDataNoOverlay(CMonitor* pMonitor, float durationUs);
|
||||
void frameData(CMonitor* pMonitor);
|
||||
|
||||
private:
|
||||
@@ -31,9 +31,10 @@ class CHyprMonitorDebugOverlay {
|
||||
|
||||
class CHyprDebugOverlay {
|
||||
public:
|
||||
CHyprDebugOverlay();
|
||||
void draw();
|
||||
void renderData(CMonitor*, float µs);
|
||||
void renderDataNoOverlay(CMonitor*, float µs);
|
||||
void renderData(CMonitor*, float durationUs);
|
||||
void renderDataNoOverlay(CMonitor*, float durationUs);
|
||||
void frameData(CMonitor*);
|
||||
|
||||
private:
|
||||
@@ -42,7 +43,7 @@ class CHyprDebugOverlay {
|
||||
cairo_surface_t* m_pCairoSurface = nullptr;
|
||||
cairo_t* m_pCairo = nullptr;
|
||||
|
||||
CTexture m_tTexture;
|
||||
SP<CTexture> m_pTexture;
|
||||
|
||||
friend class CHyprMonitorDebugOverlay;
|
||||
friend class CHyprRenderer;
|
||||
|
@@ -1,6 +1,20 @@
|
||||
#include <numeric>
|
||||
#include <pango/pangocairo.h>
|
||||
#include "HyprNotificationOverlay.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include <pango/pangocairo.h>
|
||||
#include "../config/ConfigValue.hpp"
|
||||
|
||||
inline auto iconBackendFromLayout(PangoLayout* layout) {
|
||||
// preference: Nerd > FontAwesome > text
|
||||
auto eIconBackendChecks = std::array<eIconBackend, 2>{ICONS_BACKEND_NF, ICONS_BACKEND_FA};
|
||||
for (auto iconID : eIconBackendChecks) {
|
||||
auto iconsText = std::accumulate(ICONS_ARRAY[iconID].begin(), ICONS_ARRAY[iconID].end(), std::string());
|
||||
pango_layout_set_text(layout, iconsText.c_str(), -1);
|
||||
if (pango_layout_get_unknown_glyphs_count(layout) == 0)
|
||||
return iconID;
|
||||
}
|
||||
return ICONS_BACKEND_NONE;
|
||||
}
|
||||
|
||||
CHyprNotificationOverlay::CHyprNotificationOverlay() {
|
||||
static auto P = g_pHookSystem->hookDynamic("focusedMon", [&](void* self, SCallbackInfo& info, std::any param) {
|
||||
@@ -10,30 +24,7 @@ CHyprNotificationOverlay::CHyprNotificationOverlay() {
|
||||
g_pHyprRenderer->damageBox(&m_bLastDamage);
|
||||
});
|
||||
|
||||
// check for the icon backend
|
||||
std::string fonts = execAndGet("fc-list");
|
||||
std::string fontsLower = fonts;
|
||||
std::transform(fontsLower.begin(), fontsLower.end(), fontsLower.begin(), [&](char& i) { return std::tolower(i); });
|
||||
|
||||
size_t index = 0;
|
||||
|
||||
if (index = fontsLower.find("nerd"); index != std::string::npos) {
|
||||
m_eIconBackend = ICONS_BACKEND_NF;
|
||||
} else if (index = fontsLower.find("font awesome"); index != std::string::npos) {
|
||||
m_eIconBackend = ICONS_BACKEND_FA;
|
||||
} else if (index = fontsLower.find("fontawesome"); index != std::string::npos) {
|
||||
m_eIconBackend = ICONS_BACKEND_FA;
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
const auto LASTNEWLINE = fonts.find_last_of('\n', index);
|
||||
const auto COLON = fonts.find(':', LASTNEWLINE);
|
||||
const auto COMMA = fonts.find(',', COLON);
|
||||
const auto NEWLINE = fonts.find('\n', COLON);
|
||||
const auto LASTCHAR = COMMA < NEWLINE ? COMMA : NEWLINE;
|
||||
|
||||
m_szIconFontName = fonts.substr(COLON + 2, LASTCHAR - (COLON + 2));
|
||||
m_pTexture = makeShared<CTexture>();
|
||||
}
|
||||
|
||||
CHyprNotificationOverlay::~CHyprNotificationOverlay() {
|
||||
@@ -53,7 +44,7 @@ void CHyprNotificationOverlay::addNotification(const std::string& text, const CC
|
||||
PNOTIF->icon = icon;
|
||||
PNOTIF->fontSize = fontSize;
|
||||
|
||||
for (auto& m : g_pCompositor->m_vMonitors) {
|
||||
for (auto const& m : g_pCompositor->m_vMonitors) {
|
||||
g_pCompositor->scheduleFrameForMonitor(m.get());
|
||||
}
|
||||
}
|
||||
@@ -82,25 +73,24 @@ CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
|
||||
float maxWidth = 0;
|
||||
|
||||
const auto SCALE = pMonitor->scale;
|
||||
|
||||
const auto MONSIZE = pMonitor->vecTransformedSize;
|
||||
|
||||
cairo_text_extents_t cairoExtents;
|
||||
int iconW = 0, iconH = 0;
|
||||
static auto fontFamily = CConfigValue<std::string>("misc:font_family");
|
||||
|
||||
cairo_select_font_face(m_pCairo, "Sans", CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
|
||||
PangoLayout* layout = pango_cairo_create_layout(m_pCairo);
|
||||
PangoFontDescription* pangoFD = pango_font_description_new();
|
||||
|
||||
pango_font_description_set_family(pangoFD, (*fontFamily).c_str());
|
||||
pango_font_description_set_style(pangoFD, PANGO_STYLE_NORMAL);
|
||||
pango_font_description_set_weight(pangoFD, PANGO_WEIGHT_NORMAL);
|
||||
|
||||
const auto iconBackendID = iconBackendFromLayout(layout);
|
||||
const auto PBEZIER = g_pAnimationManager->getBezier("default");
|
||||
|
||||
for (auto& notif : m_dNotifications) {
|
||||
for (auto const& notif : m_dNotifications) {
|
||||
const auto ICONPADFORNOTIF = notif->icon == ICON_NONE ? 0 : ICON_PAD;
|
||||
const auto FONTSIZE = std::clamp((int)(notif->fontSize * ((pMonitor->vecPixelSize.x * SCALE) / 1920.f)), 8, 40);
|
||||
|
||||
PangoLayout* pangoLayout = pango_cairo_create_layout(m_pCairo);
|
||||
PangoFontDescription* pangoFD = pango_font_description_from_string(("Sans " + std::to_string(FONTSIZE * ICON_SCALE)).c_str());
|
||||
pango_layout_set_font_description(pangoLayout, pangoFD);
|
||||
cairo_set_font_size(m_pCairo, FONTSIZE);
|
||||
|
||||
// first rect (bg, col)
|
||||
const float FIRSTRECTANIMP =
|
||||
(notif->started.getMillis() > (ANIM_DURATION_MS - ANIM_LAG_MS) ?
|
||||
@@ -122,31 +112,37 @@ CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
|
||||
const float THIRDRECTPERC = notif->started.getMillis() / notif->timeMs;
|
||||
|
||||
// get text size
|
||||
cairo_text_extents(m_pCairo, notif->text.c_str(), &cairoExtents);
|
||||
const auto ICON = ICONS_ARRAY[m_eIconBackend][notif->icon];
|
||||
const auto ICON = ICONS_ARRAY[iconBackendID][notif->icon];
|
||||
const auto ICONCOLOR = ICONS_COLORS[notif->icon];
|
||||
pango_layout_set_text(pangoLayout, ICON.c_str(), -1);
|
||||
pango_layout_set_font_description(pangoLayout, pangoFD);
|
||||
pango_cairo_update_layout(m_pCairo, pangoLayout);
|
||||
pango_layout_get_size(pangoLayout, &iconW, &iconH);
|
||||
|
||||
int iconW = 0, iconH = 0;
|
||||
pango_font_description_set_absolute_size(pangoFD, PANGO_SCALE * FONTSIZE * ICON_SCALE);
|
||||
pango_layout_set_font_description(layout, pangoFD);
|
||||
pango_layout_set_text(layout, ICON.c_str(), -1);
|
||||
pango_layout_get_size(layout, &iconW, &iconH);
|
||||
iconW /= PANGO_SCALE;
|
||||
iconH /= PANGO_SCALE;
|
||||
|
||||
cairo_set_source_rgba(m_pCairo, notif->color.r, notif->color.g, notif->color.b, notif->color.a);
|
||||
int textW = 0, textH = 0;
|
||||
pango_font_description_set_absolute_size(pangoFD, PANGO_SCALE * FONTSIZE);
|
||||
pango_layout_set_font_description(layout, pangoFD);
|
||||
pango_layout_set_text(layout, notif->text.c_str(), -1);
|
||||
pango_layout_get_size(layout, &textW, &textH);
|
||||
textW /= PANGO_SCALE;
|
||||
textH /= PANGO_SCALE;
|
||||
|
||||
const auto NOTIFSIZE = Vector2D{cairoExtents.width + 20 + iconW + 2 * ICONPADFORNOTIF, cairoExtents.height + 10};
|
||||
const auto NOTIFSIZE = Vector2D{textW + 20.0 + iconW + 2 * ICONPADFORNOTIF, textH + 10.0};
|
||||
|
||||
// draw rects
|
||||
cairo_set_source_rgba(m_pCairo, notif->color.r, notif->color.g, notif->color.b, notif->color.a);
|
||||
cairo_rectangle(m_pCairo, MONSIZE.x - (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, offsetY, (NOTIFSIZE.x + NOTIF_LEFTBAR_SIZE) * FIRSTRECTPERC, NOTIFSIZE.y);
|
||||
cairo_fill(m_pCairo);
|
||||
|
||||
cairo_set_source_rgb(m_pCairo, 0.f, 0.f, 0.f);
|
||||
|
||||
cairo_rectangle(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC, offsetY, NOTIFSIZE.x * SECONDRECTPERC, NOTIFSIZE.y);
|
||||
cairo_fill(m_pCairo);
|
||||
|
||||
cairo_set_source_rgba(m_pCairo, notif->color.r, notif->color.g, notif->color.b, notif->color.a);
|
||||
|
||||
cairo_rectangle(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + 3, offsetY + NOTIFSIZE.y - 4, THIRDRECTPERC * (NOTIFSIZE.x - 6), 2);
|
||||
cairo_fill(m_pCairo);
|
||||
|
||||
@@ -164,25 +160,26 @@ CBox CHyprNotificationOverlay::drawNotifications(CMonitor* pMonitor) {
|
||||
|
||||
// draw icon
|
||||
cairo_set_source_rgb(m_pCairo, 1.f, 1.f, 1.f);
|
||||
cairo_move_to(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + NOTIF_LEFTBAR_SIZE + ICONPADFORNOTIF - 1, offsetY + std::round((NOTIFSIZE.y - iconH - 4) / 2.0));
|
||||
pango_cairo_show_layout(m_pCairo, pangoLayout);
|
||||
cairo_move_to(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + NOTIF_LEFTBAR_SIZE + ICONPADFORNOTIF - 1, offsetY - 2 + std::round((NOTIFSIZE.y - iconH) / 2.0));
|
||||
pango_layout_set_text(layout, ICON.c_str(), -1);
|
||||
pango_cairo_show_layout(m_pCairo, layout);
|
||||
}
|
||||
|
||||
// draw text
|
||||
cairo_set_font_size(m_pCairo, FONTSIZE);
|
||||
cairo_set_source_rgb(m_pCairo, 1.f, 1.f, 1.f);
|
||||
cairo_move_to(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + NOTIF_LEFTBAR_SIZE + iconW + 2 * ICONPADFORNOTIF, offsetY + FONTSIZE + (FONTSIZE / 10.0));
|
||||
cairo_show_text(m_pCairo, notif->text.c_str());
|
||||
cairo_move_to(m_pCairo, MONSIZE.x - NOTIFSIZE.x * SECONDRECTPERC + NOTIF_LEFTBAR_SIZE + iconW + 2 * ICONPADFORNOTIF, offsetY - 2 + std::round((NOTIFSIZE.y - textH) / 2.0));
|
||||
pango_layout_set_text(layout, notif->text.c_str(), -1);
|
||||
pango_cairo_show_layout(m_pCairo, layout);
|
||||
|
||||
// adjust offset and move on
|
||||
offsetY += NOTIFSIZE.y + 10;
|
||||
|
||||
if (maxWidth < NOTIFSIZE.x)
|
||||
maxWidth = NOTIFSIZE.x;
|
||||
}
|
||||
|
||||
pango_font_description_free(pangoFD);
|
||||
g_object_unref(pangoLayout);
|
||||
}
|
||||
g_object_unref(layout);
|
||||
|
||||
// cleanup notifs
|
||||
std::erase_if(m_dNotifications, [](const auto& notif) { return notif->started.getMillis() > notif->timeMs; });
|
||||
@@ -232,8 +229,8 @@ void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
|
||||
|
||||
// copy the data to an OpenGL texture we have
|
||||
const auto DATA = cairo_image_surface_get_data(m_pCairoSurface);
|
||||
m_tTexture.allocate();
|
||||
glBindTexture(GL_TEXTURE_2D, m_tTexture.m_iTexID);
|
||||
m_pTexture->allocate();
|
||||
glBindTexture(GL_TEXTURE_2D, m_pTexture->m_iTexID);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
|
||||
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
|
||||
|
||||
@@ -245,7 +242,7 @@ void CHyprNotificationOverlay::draw(CMonitor* pMonitor) {
|
||||
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, MONSIZE.x, MONSIZE.y, 0, GL_RGBA, GL_UNSIGNED_BYTE, DATA);
|
||||
|
||||
CBox pMonBox = {0, 0, MONSIZE.x, MONSIZE.y};
|
||||
g_pHyprOpenGL->renderTexture(m_tTexture, &pMonBox, 1.f);
|
||||
g_pHyprOpenGL->renderTexture(m_pTexture, &pMonBox, 1.f);
|
||||
}
|
||||
|
||||
bool CHyprNotificationOverlay::hasAny() {
|
||||
|
@@ -58,10 +58,7 @@ class CHyprNotificationOverlay {
|
||||
CMonitor* m_pLastMonitor = nullptr;
|
||||
Vector2D m_vecLastSize = Vector2D(-1, -1);
|
||||
|
||||
CTexture m_tTexture;
|
||||
|
||||
eIconBackend m_eIconBackend = ICONS_BACKEND_NONE;
|
||||
std::string m_szIconFontName = "Sans";
|
||||
SP<CTexture> m_pTexture;
|
||||
};
|
||||
|
||||
inline std::unique_ptr<CHyprNotificationOverlay> g_pHyprNotificationOverlay;
|
||||
|
@@ -1,36 +1,21 @@
|
||||
#include "Log.hpp"
|
||||
#include "../defines.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "RollingLogFollow.hpp"
|
||||
|
||||
#include <fstream>
|
||||
#include <iostream>
|
||||
#include <fcntl.h>
|
||||
|
||||
void Debug::init(const std::string& IS) {
|
||||
logFile = IS + (ISDEBUG ? "/hyprlandd.log" : "/hyprland.log");
|
||||
logOfs.open(logFile, std::ios::out | std::ios::app);
|
||||
auto handle = logOfs.native_handle();
|
||||
fcntl(handle, F_SETFD, FD_CLOEXEC);
|
||||
}
|
||||
|
||||
void Debug::wlrLog(wlr_log_importance level, const char* fmt, va_list args) {
|
||||
if (level > wlr_log_get_verbosity())
|
||||
return;
|
||||
|
||||
char* outputStr = nullptr;
|
||||
|
||||
vasprintf(&outputStr, fmt, args);
|
||||
|
||||
std::string output = std::string(outputStr);
|
||||
free(outputStr);
|
||||
|
||||
rollingLog += output + "\n";
|
||||
|
||||
if (!disableLogs || !**disableLogs) {
|
||||
std::ofstream ofs;
|
||||
ofs.open(logFile, std::ios::out | std::ios::app);
|
||||
ofs << "[wlr] " << output << "\n";
|
||||
ofs.close();
|
||||
}
|
||||
|
||||
if (!disableStdout)
|
||||
std::cout << output << "\n";
|
||||
void Debug::close() {
|
||||
logOfs.close();
|
||||
}
|
||||
|
||||
void Debug::log(LogLevel level, std::string str) {
|
||||
@@ -73,13 +58,13 @@ void Debug::log(LogLevel level, std::string str) {
|
||||
if (rollingLog.size() > ROLLING_LOG_SIZE)
|
||||
rollingLog = rollingLog.substr(rollingLog.size() - ROLLING_LOG_SIZE);
|
||||
|
||||
if (RollingLogFollow::Get().IsRunning())
|
||||
RollingLogFollow::Get().AddLog(str);
|
||||
|
||||
if (!disableLogs || !**disableLogs) {
|
||||
// log to a file
|
||||
std::ofstream ofs;
|
||||
ofs.open(logFile, std::ios::out | std::ios::app);
|
||||
ofs << str << "\n";
|
||||
|
||||
ofs.close();
|
||||
logOfs << str << "\n";
|
||||
logOfs.flush();
|
||||
}
|
||||
|
||||
// log it to the stdout too.
|
||||
|
@@ -4,6 +4,7 @@
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <chrono>
|
||||
#include <mutex>
|
||||
#include "../includes.hpp"
|
||||
#include "../helpers/MiscFunctions.hpp"
|
||||
|
||||
@@ -22,6 +23,7 @@ enum LogLevel {
|
||||
|
||||
namespace Debug {
|
||||
inline std::string logFile;
|
||||
inline std::ofstream logOfs;
|
||||
inline int64_t* const* disableLogs = nullptr;
|
||||
inline int64_t* const* disableTime = nullptr;
|
||||
inline bool disableStdout = false;
|
||||
@@ -30,14 +32,18 @@ namespace Debug {
|
||||
inline int64_t* const* coloredLogs = nullptr;
|
||||
|
||||
inline std::string rollingLog = ""; // rolling log contains the ROLLING_LOG_SIZE tail of the log
|
||||
inline std::mutex logMutex;
|
||||
|
||||
void init(const std::string& IS);
|
||||
void close();
|
||||
|
||||
//
|
||||
void log(LogLevel level, std::string str);
|
||||
|
||||
template <typename... Args>
|
||||
void log(LogLevel level, std::format_string<Args...> fmt, Args&&... args) {
|
||||
std::lock_guard<std::mutex> guard(logMutex);
|
||||
|
||||
if (level == TRACE && !trace)
|
||||
return;
|
||||
|
||||
@@ -49,11 +55,14 @@ namespace Debug {
|
||||
// print date and time to the ofs
|
||||
if (disableTime && !**disableTime) {
|
||||
#ifndef _LIBCPP_VERSION
|
||||
logMsg += std::format("[{:%T}] ", std::chrono::hh_mm_ss{std::chrono::system_clock::now() - std::chrono::floor<std::chrono::days>(std::chrono::system_clock::now())});
|
||||
static auto current_zone = std::chrono::current_zone();
|
||||
const auto zt = std::chrono::zoned_time{current_zone, std::chrono::system_clock::now()};
|
||||
const auto hms = std::chrono::hh_mm_ss{zt.get_local_time() - std::chrono::floor<std::chrono::days>(zt.get_local_time())};
|
||||
#else
|
||||
auto c = std::chrono::hh_mm_ss{std::chrono::system_clock::now() - std::chrono::floor<std::chrono::days>(std::chrono::system_clock::now())};
|
||||
logMsg += std::format("{:%H}:{:%M}:{:%S}", c.hours(), c.minutes(), c.subseconds());
|
||||
// TODO: current clang 17 does not support `zoned_time`, remove this once clang 19 is ready
|
||||
const auto hms = std::chrono::hh_mm_ss{std::chrono::system_clock::now() - std::chrono::floor<std::chrono::days>(std::chrono::system_clock::now())};
|
||||
#endif
|
||||
logMsg += std::format("[{}] ", hms);
|
||||
}
|
||||
|
||||
// no need for try {} catch {} because std::format_string<Args...> ensures that vformat never throw std::format_error
|
||||
@@ -65,6 +74,4 @@ namespace Debug {
|
||||
|
||||
log(level, logMsg);
|
||||
}
|
||||
|
||||
void wlrLog(wlr_log_importance level, const char* fmt, va_list args);
|
||||
};
|
||||
|
65
src/debug/RollingLogFollow.hpp
Normal file
@@ -0,0 +1,65 @@
|
||||
#pragma once
|
||||
|
||||
#include <shared_mutex>
|
||||
|
||||
namespace Debug {
|
||||
struct RollingLogFollow {
|
||||
std::unordered_map<int, std::string> socketToRollingLogFollowQueue;
|
||||
std::shared_mutex m;
|
||||
bool running = false;
|
||||
static constexpr size_t ROLLING_LOG_FOLLOW_TOO_BIG = 8192;
|
||||
|
||||
// Returns true if the queue is empty for the given socket
|
||||
bool isEmpty(int socket) {
|
||||
std::shared_lock<std::shared_mutex> r(m);
|
||||
return socketToRollingLogFollowQueue[socket].empty();
|
||||
}
|
||||
|
||||
std::string DebugInfo() {
|
||||
std::shared_lock<std::shared_mutex> r(m);
|
||||
return std::format("RollingLogFollow, got {} connections", socketToRollingLogFollowQueue.size());
|
||||
}
|
||||
|
||||
std::string GetLog(int socket) {
|
||||
std::unique_lock<std::shared_mutex> w(m);
|
||||
|
||||
const std::string ret = socketToRollingLogFollowQueue[socket];
|
||||
socketToRollingLogFollowQueue[socket] = "";
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
void AddLog(std::string log) {
|
||||
std::unique_lock<std::shared_mutex> w(m);
|
||||
running = true;
|
||||
std::vector<int> to_erase;
|
||||
for (const auto& p : socketToRollingLogFollowQueue)
|
||||
socketToRollingLogFollowQueue[p.first] += log + "\n";
|
||||
}
|
||||
|
||||
bool IsRunning() {
|
||||
std::shared_lock<std::shared_mutex> r(m);
|
||||
return running;
|
||||
}
|
||||
|
||||
void StopFor(int socket) {
|
||||
std::unique_lock<std::shared_mutex> w(m);
|
||||
socketToRollingLogFollowQueue.erase(socket);
|
||||
if (socketToRollingLogFollowQueue.empty())
|
||||
running = false;
|
||||
}
|
||||
|
||||
void StartFor(int socket) {
|
||||
std::unique_lock<std::shared_mutex> w(m);
|
||||
socketToRollingLogFollowQueue[socket] = std::format("[LOG] Following log to socket: {} started\n", socket);
|
||||
running = true;
|
||||
}
|
||||
|
||||
static RollingLogFollow& Get() {
|
||||
static RollingLogFollow instance;
|
||||
static std::mutex gm;
|
||||
std::lock_guard<std::mutex> lock(gm);
|
||||
return instance;
|
||||
};
|
||||
};
|
||||
}
|
@@ -1,18 +1,5 @@
|
||||
#include "includes.hpp"
|
||||
#include "debug/Log.hpp"
|
||||
#include "helpers/WLListener.hpp"
|
||||
#include "helpers/Color.hpp"
|
||||
#include "macros.hpp"
|
||||
|
||||
class CWindow;
|
||||
class CLayerSurface;
|
||||
|
||||
/* Shared pointer to a window */
|
||||
typedef SP<CWindow> PHLWINDOW;
|
||||
/* Weak pointer to a window */
|
||||
typedef WP<CWindow> PHLWINDOWREF;
|
||||
|
||||
/* Shared pointer to a layer surface */
|
||||
typedef SP<CLayerSurface> PHLLS;
|
||||
/* Weak pointer to a layer surface */
|
||||
typedef WP<CLayerSurface> PHLLSREF;
|
||||
#include "desktop/DesktopTypes.hpp"
|
||||
|
@@ -1,6 +1,20 @@
|
||||
#pragma once
|
||||
#include <memory>
|
||||
|
||||
#include "../macros.hpp"
|
||||
class CWorkspace;
|
||||
class CWindow;
|
||||
class CLayerSurface;
|
||||
|
||||
typedef std::shared_ptr<CWorkspace> PHLWORKSPACE;
|
||||
/* Shared pointer to a workspace */
|
||||
typedef SP<CWorkspace> PHLWORKSPACE;
|
||||
/* Weak pointer to a workspace */
|
||||
typedef WP<CWorkspace> PHLWORKSPACEREF;
|
||||
|
||||
/* Shared pointer to a window */
|
||||
typedef SP<CWindow> PHLWINDOW;
|
||||
/* Weak pointer to a window */
|
||||
typedef WP<CWindow> PHLWINDOWREF;
|
||||
|
||||
/* Shared pointer to a layer surface */
|
||||
typedef SP<CLayerSurface> PHLLS;
|
||||
/* Weak pointer to a layer surface */
|
||||
typedef WP<CLayerSurface> PHLLSREF;
|
||||
|
@@ -1,81 +1,33 @@
|
||||
#include "LayerSurface.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../events/Events.hpp"
|
||||
#include "../protocols/LayerShell.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../managers/SeatManager.hpp"
|
||||
|
||||
void Events::listener_newLayerSurface(wl_listener* listener, void* data) {
|
||||
const auto WLRLAYERSURFACE = (wlr_layer_surface_v1*)data;
|
||||
PHLLS CLayerSurface::create(SP<CLayerShellResource> resource) {
|
||||
PHLLS pLS = SP<CLayerSurface>(new CLayerSurface(resource));
|
||||
|
||||
if (!WLRLAYERSURFACE->output) {
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromCursor();
|
||||
CMonitor* pMonitor = resource->monitor.empty() ? g_pCompositor->getMonitorFromCursor() : g_pCompositor->getMonitorFromName(resource->monitor);
|
||||
|
||||
if (!PMONITOR) {
|
||||
Debug::log(ERR, "No monitor at cursor on new layer without a monitor. Ignoring.");
|
||||
wlr_layer_surface_v1_destroy(WLRLAYERSURFACE);
|
||||
return;
|
||||
pLS->surface->assign(resource->surface.lock(), pLS);
|
||||
|
||||
if (!pMonitor) {
|
||||
Debug::log(ERR, "New LS has no monitor??");
|
||||
return pLS;
|
||||
}
|
||||
|
||||
Debug::log(LOG, "New LayerSurface has no preferred monitor. Assigning Monitor {}", PMONITOR->szName);
|
||||
|
||||
WLRLAYERSURFACE->output = PMONITOR->output;
|
||||
}
|
||||
|
||||
auto PMONITOR = g_pCompositor->getMonitorFromOutput(WLRLAYERSURFACE->output);
|
||||
|
||||
if (!WLRLAYERSURFACE->output || !PMONITOR || PMONITOR->pMirrorOf) {
|
||||
PMONITOR = g_pCompositor->m_vMonitors.front().get();
|
||||
WLRLAYERSURFACE->output = PMONITOR->output; // TODO: current mon
|
||||
}
|
||||
|
||||
const auto PLS = PMONITOR->m_aLayerSurfaceLayers[WLRLAYERSURFACE->pending.layer].emplace_back(CLayerSurface::create(WLRLAYERSURFACE));
|
||||
|
||||
Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)WLRLAYERSURFACE, WLRLAYERSURFACE->_namespace, (int)PLS->layer, PMONITOR->szName);
|
||||
}
|
||||
|
||||
static void onCommit(void* owner, void* data) {
|
||||
const auto LS = ((CLayerSurface*)owner)->self.lock();
|
||||
|
||||
LS->onCommit();
|
||||
}
|
||||
|
||||
static void onMap(void* owner, void* data) {
|
||||
const auto LS = ((CLayerSurface*)owner)->self.lock();
|
||||
|
||||
LS->onMap();
|
||||
}
|
||||
|
||||
static void onUnmap(void* owner, void* data) {
|
||||
const auto LS = ((CLayerSurface*)owner)->self.lock();
|
||||
|
||||
LS->onUnmap();
|
||||
}
|
||||
|
||||
static void onDestroy(void* owner, void* data) {
|
||||
const auto LS = ((CLayerSurface*)owner)->self.lock();
|
||||
|
||||
LS->onDestroy();
|
||||
}
|
||||
|
||||
// IMPL
|
||||
|
||||
PHLLS CLayerSurface::create(wlr_layer_surface_v1* pWLRLS) {
|
||||
PHLLS pLS = std::shared_ptr<CLayerSurface>(new CLayerSurface);
|
||||
|
||||
auto PMONITOR = g_pCompositor->getMonitorFromOutput(pWLRLS->output);
|
||||
if (pMonitor->pMirrorOf)
|
||||
pMonitor = g_pCompositor->m_vMonitors.front().get();
|
||||
|
||||
pLS->self = pLS;
|
||||
|
||||
pLS->szNamespace = pWLRLS->_namespace;
|
||||
pLS->szNamespace = resource->layerNamespace;
|
||||
|
||||
pLS->hyprListener_commitLayerSurface.initCallback(&pWLRLS->surface->events.commit, ::onCommit, pLS.get(), "layerSurface");
|
||||
pLS->hyprListener_destroyLayerSurface.initCallback(&pWLRLS->events.destroy, ::onDestroy, pLS.get(), "layerSurface");
|
||||
pLS->hyprListener_mapLayerSurface.initCallback(&pWLRLS->surface->events.map, ::onMap, pLS.get(), "layerSurface");
|
||||
pLS->hyprListener_unmapLayerSurface.initCallback(&pWLRLS->surface->events.unmap, ::onUnmap, pLS.get(), "layerSurface");
|
||||
|
||||
pLS->layerSurface = pWLRLS;
|
||||
pLS->layer = pWLRLS->current.layer;
|
||||
pWLRLS->data = pLS.get();
|
||||
pLS->monitorID = PMONITOR->ID;
|
||||
pLS->layer = resource->current.layer;
|
||||
pLS->popupHead = std::make_unique<CPopup>(pLS);
|
||||
pLS->monitorID = pMonitor->ID;
|
||||
pMonitor->m_aLayerSurfaceLayers[resource->current.layer].emplace_back(pLS);
|
||||
|
||||
pLS->forceBlur = g_pConfigManager->shouldBlurLS(pLS->szNamespace);
|
||||
|
||||
@@ -90,7 +42,7 @@ PHLLS CLayerSurface::create(wlr_layer_surface_v1* pWLRLS) {
|
||||
|
||||
pLS->alpha.setValueAndWarp(0.f);
|
||||
|
||||
pLS->surface.assign(pWLRLS->surface);
|
||||
Debug::log(LOG, "LayerSurface {:x} (namespace {} layer {}) created on monitor {}", (uintptr_t)resource.get(), resource->layerNamespace, (int)pLS->layer, pMonitor->szName);
|
||||
|
||||
return pLS;
|
||||
}
|
||||
@@ -102,26 +54,36 @@ void CLayerSurface::registerCallbacks() {
|
||||
});
|
||||
}
|
||||
|
||||
CLayerSurface::CLayerSurface() {
|
||||
;
|
||||
CLayerSurface::CLayerSurface(SP<CLayerShellResource> resource_) : layerSurface(resource_) {
|
||||
listeners.commit = layerSurface->events.commit.registerListener([this](std::any d) { onCommit(); });
|
||||
listeners.map = layerSurface->events.map.registerListener([this](std::any d) { onMap(); });
|
||||
listeners.unmap = layerSurface->events.unmap.registerListener([this](std::any d) { onUnmap(); });
|
||||
listeners.destroy = layerSurface->events.destroy.registerListener([this](std::any d) { onDestroy(); });
|
||||
|
||||
surface = CWLSurface::create();
|
||||
}
|
||||
|
||||
CLayerSurface::~CLayerSurface() {
|
||||
if (!g_pHyprOpenGL)
|
||||
return;
|
||||
|
||||
surface.unassign();
|
||||
if (surface)
|
||||
surface->unassign();
|
||||
g_pHyprRenderer->makeEGLCurrent();
|
||||
std::erase_if(g_pHyprOpenGL->m_mLayerFramebuffers, [&](const auto& other) { return other.first.expired() || other.first.lock() == self.lock(); });
|
||||
|
||||
for (auto const& mon : g_pCompositor->m_vRealMonitors) {
|
||||
for (auto& lsl : mon->m_aLayerSurfaceLayers) {
|
||||
std::erase_if(lsl, [this](auto& ls) { return ls.expired() || ls.get() == this; });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CLayerSurface::onDestroy() {
|
||||
Debug::log(LOG, "LayerSurface {:x} destroyed", (uintptr_t)layerSurface);
|
||||
Debug::log(LOG, "LayerSurface {:x} destroyed", (uintptr_t)layerSurface.get());
|
||||
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
|
||||
|
||||
popupHead.reset();
|
||||
|
||||
if (!g_pCompositor->getMonitorFromID(monitorID))
|
||||
Debug::log(WARN, "Layersurface destroyed on an invalid monitor (removed?)");
|
||||
|
||||
@@ -137,12 +99,9 @@ void CLayerSurface::onDestroy() {
|
||||
}
|
||||
}
|
||||
|
||||
noProcess = true;
|
||||
popupHead.reset();
|
||||
|
||||
hyprListener_commitLayerSurface.removeCallback();
|
||||
hyprListener_destroyLayerSurface.removeCallback();
|
||||
hyprListener_mapLayerSurface.removeCallback();
|
||||
hyprListener_unmapLayerSurface.removeCallback();
|
||||
noProcess = true;
|
||||
|
||||
// rearrange to fix the reserved areas
|
||||
if (PMONITOR) {
|
||||
@@ -155,15 +114,27 @@ void CLayerSurface::onDestroy() {
|
||||
}
|
||||
|
||||
readyToDelete = true;
|
||||
layerSurface = nullptr;
|
||||
surface.unassign();
|
||||
layerSurface.reset();
|
||||
if (surface)
|
||||
surface->unassign();
|
||||
|
||||
listeners.unmap.reset();
|
||||
listeners.destroy.reset();
|
||||
listeners.map.reset();
|
||||
listeners.commit.reset();
|
||||
}
|
||||
|
||||
void CLayerSurface::onMap() {
|
||||
Debug::log(LOG, "LayerSurface {:x} mapped", (uintptr_t)layerSurface);
|
||||
Debug::log(LOG, "LayerSurface {:x} mapped", (uintptr_t)layerSurface.get());
|
||||
|
||||
mapped = true;
|
||||
keyboardExclusive = layerSurface->current.keyboard_interactive;
|
||||
interactivity = layerSurface->current.interactivity;
|
||||
|
||||
layerSurface->surface->map();
|
||||
|
||||
// this layer might be re-mapped.
|
||||
fadingOut = false;
|
||||
g_pCompositor->removeFromFadingOutSafe(self.lock());
|
||||
|
||||
// fix if it changed its mon
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
|
||||
@@ -173,38 +144,30 @@ void CLayerSurface::onMap() {
|
||||
|
||||
applyRules();
|
||||
|
||||
if ((uint64_t)monitorID != PMONITOR->ID) {
|
||||
const auto POLDMON = g_pCompositor->getMonitorFromID(monitorID);
|
||||
for (auto it = POLDMON->m_aLayerSurfaceLayers[layer].begin(); it != POLDMON->m_aLayerSurfaceLayers[layer].end(); it++) {
|
||||
if (*it == self.lock()) {
|
||||
PMONITOR->m_aLayerSurfaceLayers[layer].emplace_back(std::move(*it));
|
||||
POLDMON->m_aLayerSurfaceLayers[layer].erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
monitorID = PMONITOR->ID;
|
||||
PMONITOR->scheduledRecalc = true;
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(POLDMON->ID);
|
||||
}
|
||||
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||
|
||||
wlr_surface_send_enter(surface.wlr(), PMONITOR->output);
|
||||
surface->resource()->enter(PMONITOR->self.lock());
|
||||
|
||||
if (layerSurface->current.keyboard_interactive == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE)
|
||||
const bool ISEXCLUSIVE = layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;
|
||||
|
||||
if (ISEXCLUSIVE)
|
||||
g_pInputManager->m_dExclusiveLSes.push_back(self);
|
||||
|
||||
const bool GRABSFOCUS = layerSurface->current.keyboard_interactive != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE &&
|
||||
const bool GRABSFOCUS = ISEXCLUSIVE ||
|
||||
(layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE &&
|
||||
// don't focus if constrained
|
||||
(g_pCompositor->m_sSeat.mouse.expired() || !g_pInputManager->isConstrained());
|
||||
(g_pSeatManager->mouse.expired() || !g_pInputManager->isConstrained()));
|
||||
|
||||
if (GRABSFOCUS) {
|
||||
// TODO: use the new superb really very cool grab
|
||||
g_pSeatManager->setGrab(nullptr);
|
||||
g_pInputManager->releaseAllMouseButtons();
|
||||
g_pCompositor->focusSurface(surface.wlr());
|
||||
g_pCompositor->focusSurface(surface->resource());
|
||||
|
||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y);
|
||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, surface.wlr(), LOCAL.x, LOCAL.y);
|
||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
|
||||
g_pSeatManager->setPointerFocus(surface->resource(), LOCAL);
|
||||
g_pInputManager->m_bEmptyFocusCursorSet = false;
|
||||
}
|
||||
|
||||
@@ -213,7 +176,7 @@ void CLayerSurface::onMap() {
|
||||
CBox geomFixed = {geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y, geometry.width, geometry.height};
|
||||
g_pHyprRenderer->damageBox(&geomFixed);
|
||||
const auto WORKSPACE = PMONITOR->activeWorkspace;
|
||||
const bool FULLSCREEN = WORKSPACE->m_bHasFullscreenWindow && WORKSPACE->m_efFullscreenMode == FULLSCREEN_FULL;
|
||||
const bool FULLSCREEN = WORKSPACE->m_bHasFullscreenWindow && WORKSPACE->m_efFullscreenMode == FSMODE_FULLSCREEN;
|
||||
|
||||
startAnimation(!(layer == ZWLR_LAYER_SHELL_V1_LAYER_TOP && FULLSCREEN && !GRABSFOCUS));
|
||||
readyToDelete = false;
|
||||
@@ -222,27 +185,26 @@ void CLayerSurface::onMap() {
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"openlayer", szNamespace});
|
||||
EMIT_HOOK_EVENT("openLayer", self.lock());
|
||||
|
||||
g_pCompositor->setPreferredScaleForSurface(surface.wlr(), PMONITOR->scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(surface.wlr(), PMONITOR->transform);
|
||||
g_pCompositor->setPreferredScaleForSurface(surface->resource(), PMONITOR->scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(surface->resource(), PMONITOR->transform);
|
||||
}
|
||||
|
||||
void CLayerSurface::onUnmap() {
|
||||
Debug::log(LOG, "LayerSurface {:x} unmapped", (uintptr_t)layerSurface);
|
||||
Debug::log(LOG, "LayerSurface {:x} unmapped", (uintptr_t)layerSurface.get());
|
||||
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", std::string(layerSurface->_namespace ? layerSurface->_namespace : "")});
|
||||
g_pEventManager->postEvent(SHyprIPCEvent{"closelayer", layerSurface->layerNamespace});
|
||||
EMIT_HOOK_EVENT("closeLayer", self.lock());
|
||||
|
||||
std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == self.lock(); });
|
||||
|
||||
if (!g_pInputManager->m_dExclusiveLSes.empty())
|
||||
g_pCompositor->focusSurface(g_pInputManager->m_dExclusiveLSes[0].lock()->layerSurface->surface);
|
||||
|
||||
if (!g_pCompositor->getMonitorFromID(monitorID) || g_pCompositor->m_bUnsafeState) {
|
||||
Debug::log(WARN, "Layersurface unmapping on invalid monitor (removed?) ignoring.");
|
||||
|
||||
g_pCompositor->addToFadingOutSafe(self.lock());
|
||||
|
||||
mapped = false;
|
||||
if (layerSurface && layerSurface->surface)
|
||||
layerSurface->surface->unmap();
|
||||
|
||||
startAnimation(false);
|
||||
return;
|
||||
@@ -254,62 +216,53 @@ void CLayerSurface::onUnmap() {
|
||||
startAnimation(false);
|
||||
|
||||
mapped = false;
|
||||
if (layerSurface && layerSurface->surface)
|
||||
layerSurface->surface->unmap();
|
||||
|
||||
g_pCompositor->addToFadingOutSafe(self.lock());
|
||||
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layerSurface->output);
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
|
||||
|
||||
const bool WASLASTFOCUS = g_pCompositor->m_pLastFocus == layerSurface->surface;
|
||||
|
||||
surface = nullptr;
|
||||
const bool WASLASTFOCUS = g_pCompositor->m_pLastFocus == surface->resource();
|
||||
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
|
||||
// refocus if needed
|
||||
if (WASLASTFOCUS) {
|
||||
g_pInputManager->releaseAllMouseButtons();
|
||||
|
||||
Vector2D surfaceCoords;
|
||||
PHLLS pFoundLayerSurface;
|
||||
wlr_surface* foundSurface = nullptr;
|
||||
|
||||
g_pCompositor->m_pLastFocus = nullptr;
|
||||
|
||||
// find LS-es to focus
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_OVERLAY],
|
||||
&surfaceCoords, &pFoundLayerSurface);
|
||||
|
||||
if (!foundSurface)
|
||||
foundSurface = g_pCompositor->vectorToLayerSurface(g_pInputManager->getMouseCoordsInternal(), &PMONITOR->m_aLayerSurfaceLayers[ZWLR_LAYER_SHELL_V1_LAYER_TOP],
|
||||
&surfaceCoords, &pFoundLayerSurface);
|
||||
|
||||
if (!foundSurface && g_pCompositor->m_pLastWindow.lock() && g_pCompositor->isWorkspaceVisible(g_pCompositor->m_pLastWindow.lock()->m_pWorkspace)) {
|
||||
// if there isn't any, focus the last window
|
||||
const auto PLASTWINDOW = g_pCompositor->m_pLastWindow.lock();
|
||||
g_pCompositor->focusWindow(nullptr);
|
||||
g_pCompositor->focusWindow(PLASTWINDOW);
|
||||
} else {
|
||||
// otherwise, full refocus
|
||||
g_pInputManager->refocus();
|
||||
}
|
||||
}
|
||||
// vvvvvvvvvvvvv if there is a last focus and the last focus is not keyboard focusable, fallback to window
|
||||
if (WASLASTFOCUS || (g_pCompositor->m_pLastFocus && g_pCompositor->m_pLastFocus->hlSurface && !g_pCompositor->m_pLastFocus->hlSurface->keyboardFocusable()))
|
||||
g_pInputManager->refocusLastWindow(PMONITOR);
|
||||
else if (g_pCompositor->m_pLastFocus)
|
||||
g_pSeatManager->setKeyboardFocus(g_pCompositor->m_pLastFocus.lock());
|
||||
|
||||
CBox geomFixed = {geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y, geometry.width, geometry.height};
|
||||
g_pHyprRenderer->damageBox(&geomFixed);
|
||||
|
||||
geomFixed = {geometry.x + (int)PMONITOR->vecPosition.x, geometry.y + (int)PMONITOR->vecPosition.y, (int)layerSurface->surface->current.width,
|
||||
(int)layerSurface->surface->current.height};
|
||||
geomFixed = {geometry.x + (int)PMONITOR->vecPosition.x, geometry.y + (int)PMONITOR->vecPosition.y, (int)layerSurface->surface->current.size.x,
|
||||
(int)layerSurface->surface->current.size.y};
|
||||
g_pHyprRenderer->damageBox(&geomFixed);
|
||||
|
||||
g_pInputManager->sendMotionEventsToFocused();
|
||||
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(PMONITOR->ID);
|
||||
}
|
||||
|
||||
void CLayerSurface::onCommit() {
|
||||
if (!layerSurface || !layerSurface->output)
|
||||
if (!layerSurface)
|
||||
return;
|
||||
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromOutput(layerSurface->output);
|
||||
if (!mapped) {
|
||||
// we're re-mapping if this is the case
|
||||
if (layerSurface->surface && !layerSurface->surface->current.texture) {
|
||||
fadingOut = false;
|
||||
geometry = {};
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(monitorID);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromID(monitorID);
|
||||
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
@@ -320,29 +273,14 @@ void CLayerSurface::onCommit() {
|
||||
CBox geomFixed = {geometry.x, geometry.y, geometry.width, geometry.height};
|
||||
g_pHyprRenderer->damageBox(&geomFixed);
|
||||
|
||||
// fix if it changed its mon
|
||||
if ((uint64_t)monitorID != PMONITOR->ID) {
|
||||
const auto POLDMON = g_pCompositor->getMonitorFromID(monitorID);
|
||||
|
||||
for (auto it = POLDMON->m_aLayerSurfaceLayers[layer].begin(); it != POLDMON->m_aLayerSurfaceLayers[layer].end(); it++) {
|
||||
if (*it == self.lock()) {
|
||||
PMONITOR->m_aLayerSurfaceLayers[layer].emplace_back(std::move(*it));
|
||||
POLDMON->m_aLayerSurfaceLayers[layer].erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
monitorID = PMONITOR->ID;
|
||||
PMONITOR->scheduledRecalc = true;
|
||||
g_pHyprRenderer->arrangeLayersForMonitor(POLDMON->ID);
|
||||
}
|
||||
|
||||
if (layerSurface->current.committed != 0) {
|
||||
if (layer != layerSurface->current.layer) {
|
||||
if (layerSurface->current.committed & CLayerShellResource::eCommittedState::STATE_LAYER) {
|
||||
|
||||
for (auto it = PMONITOR->m_aLayerSurfaceLayers[layer].begin(); it != PMONITOR->m_aLayerSurfaceLayers[layer].end(); it++) {
|
||||
if (*it == self.lock()) {
|
||||
PMONITOR->m_aLayerSurfaceLayers[layerSurface->current.layer].emplace_back(std::move(*it));
|
||||
if (*it == self) {
|
||||
if (layerSurface->current.layer == layer)
|
||||
break;
|
||||
PMONITOR->m_aLayerSurfaceLayers[layerSurface->current.layer].emplace_back(*it);
|
||||
PMONITOR->m_aLayerSurfaceLayers[layer].erase(it);
|
||||
break;
|
||||
}
|
||||
@@ -361,12 +299,12 @@ void CLayerSurface::onCommit() {
|
||||
position = Vector2D(geometry.x, geometry.y);
|
||||
|
||||
// update geom if it changed
|
||||
if (layerSurface->surface->current.scale == 1 && PMONITOR->scale != 1.f && layerSurface->surface->current.viewport.has_dst) {
|
||||
if (layerSurface->surface->current.scale == 1 && PMONITOR->scale != 1.f && layerSurface->surface->current.viewport.hasDestination) {
|
||||
// fractional scaling. Dirty hack.
|
||||
geometry = {geometry.x, geometry.y, (int)(layerSurface->surface->current.viewport.dst_width), (int)(layerSurface->surface->current.viewport.dst_height)};
|
||||
geometry = {geometry.pos(), layerSurface->surface->current.viewport.destination};
|
||||
} else {
|
||||
// this is because some apps like e.g. rofi-lbonn can't fucking use the protocol correctly.
|
||||
geometry = {geometry.x, geometry.y, (int)layerSurface->surface->current.width, (int)layerSurface->surface->current.height};
|
||||
geometry = {geometry.pos(), layerSurface->surface->current.size};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -383,24 +321,40 @@ void CLayerSurface::onCommit() {
|
||||
realSize.setValueAndWarp(geometry.size());
|
||||
}
|
||||
|
||||
if (layerSurface->current.keyboard_interactive && (g_pCompositor->m_sSeat.mouse.expired() || !g_pInputManager->isConstrained()) // don't focus if constrained
|
||||
&& !keyboardExclusive && mapped) {
|
||||
g_pCompositor->focusSurface(layerSurface->surface);
|
||||
if (mapped) {
|
||||
const bool WASLASTFOCUS = g_pCompositor->m_pLastFocus == surface->resource();
|
||||
const bool WASEXCLUSIVE = interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;
|
||||
const bool ISEXCLUSIVE = layerSurface->current.interactivity == ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_EXCLUSIVE;
|
||||
|
||||
if (!WASEXCLUSIVE && ISEXCLUSIVE)
|
||||
g_pInputManager->m_dExclusiveLSes.push_back(self);
|
||||
else if (WASEXCLUSIVE && !ISEXCLUSIVE)
|
||||
std::erase_if(g_pInputManager->m_dExclusiveLSes, [this](const auto& other) { return !other.lock() || other.lock() == self.lock(); });
|
||||
|
||||
// if the surface was focused and interactive but now isn't, refocus
|
||||
if (WASLASTFOCUS && !layerSurface->current.interactivity) {
|
||||
// moveMouseUnified won't focus non interactive layers but it won't unfocus them either,
|
||||
// so unfocus the surface here.
|
||||
g_pCompositor->focusSurface(nullptr);
|
||||
g_pInputManager->refocusLastWindow(g_pCompositor->getMonitorFromID(monitorID));
|
||||
} else if (!WASEXCLUSIVE && ISEXCLUSIVE) {
|
||||
// if now exclusive and not previously
|
||||
g_pSeatManager->setGrab(nullptr);
|
||||
g_pInputManager->releaseAllMouseButtons();
|
||||
g_pCompositor->focusSurface(surface->resource());
|
||||
|
||||
const auto LOCAL = g_pInputManager->getMouseCoordsInternal() - Vector2D(geometry.x + PMONITOR->vecPosition.x, geometry.y + PMONITOR->vecPosition.y);
|
||||
wlr_seat_pointer_notify_enter(g_pCompositor->m_sSeat.seat, layerSurface->surface, LOCAL.x, LOCAL.y);
|
||||
wlr_seat_pointer_notify_motion(g_pCompositor->m_sSeat.seat, 0, LOCAL.x, LOCAL.y);
|
||||
g_pSeatManager->setPointerFocus(surface->resource(), LOCAL);
|
||||
g_pInputManager->m_bEmptyFocusCursorSet = false;
|
||||
} else if (!layerSurface->current.keyboard_interactive && (g_pCompositor->m_sSeat.mouse.expired() || !g_pInputManager->isConstrained()) && keyboardExclusive) {
|
||||
g_pInputManager->refocus();
|
||||
}
|
||||
}
|
||||
|
||||
keyboardExclusive = layerSurface->current.keyboard_interactive;
|
||||
interactivity = layerSurface->current.interactivity;
|
||||
|
||||
g_pHyprRenderer->damageSurface(layerSurface->surface, position.x, position.y);
|
||||
g_pHyprRenderer->damageSurface(surface->resource(), position.x, position.y);
|
||||
|
||||
g_pCompositor->setPreferredScaleForSurface(layerSurface->surface, PMONITOR->scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(layerSurface->surface, PMONITOR->transform);
|
||||
g_pCompositor->setPreferredScaleForSurface(surface->resource(), PMONITOR->scale);
|
||||
g_pCompositor->setPreferredTransformForSurface(surface->resource(), PMONITOR->transform);
|
||||
}
|
||||
|
||||
void CLayerSurface::applyRules() {
|
||||
@@ -412,7 +366,7 @@ void CLayerSurface::applyRules() {
|
||||
xray = -1;
|
||||
animationStyle.reset();
|
||||
|
||||
for (auto& rule : g_pConfigManager->getMatchingRules(self.lock())) {
|
||||
for (auto const& rule : g_pConfigManager->getMatchingRules(self.lock())) {
|
||||
if (rule.rule == "noanim")
|
||||
noAnimations = true;
|
||||
else if (rule.rule == "blur")
|
||||
@@ -440,6 +394,11 @@ void CLayerSurface::applyRules() {
|
||||
} else if (rule.rule.starts_with("animation")) {
|
||||
CVarList vars{rule.rule, 2, 's'};
|
||||
animationStyle = vars[1];
|
||||
} else if (rule.rule.starts_with("order")) {
|
||||
CVarList vars{rule.rule, 2, 's'};
|
||||
try {
|
||||
order = std::stoi(vars[1]);
|
||||
} catch (...) { Debug::log(ERR, "Invalid value passed to order"); }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -478,9 +437,9 @@ void CLayerSurface::startAnimation(bool in, bool instant) {
|
||||
}
|
||||
|
||||
const std::array<Vector2D, 4> edgePoints = {
|
||||
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x / 2, 0},
|
||||
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x / 2, 0.0},
|
||||
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x / 2, PMONITOR->vecSize.y},
|
||||
PMONITOR->vecPosition + Vector2D{0, PMONITOR->vecSize.y},
|
||||
PMONITOR->vecPosition + Vector2D{0.0, PMONITOR->vecSize.y},
|
||||
PMONITOR->vecPosition + Vector2D{PMONITOR->vecSize.x, PMONITOR->vecSize.y / 2},
|
||||
};
|
||||
|
||||
@@ -582,8 +541,7 @@ int CLayerSurface::popupsCount() {
|
||||
if (!layerSurface || !mapped || fadingOut)
|
||||
return 0;
|
||||
|
||||
int no = 0;
|
||||
wlr_layer_surface_v1_for_each_popup_surface(
|
||||
layerSurface, [](wlr_surface* s, int x, int y, void* data) { *(int*)data += 1; }, &no);
|
||||
int no = -1; // we have one dummy
|
||||
popupHead->breadthfirst([](CPopup* p, void* data) { *(int*)data += 1; }, &no);
|
||||
return no;
|
||||
}
|
@@ -4,19 +4,20 @@
|
||||
#include "../defines.hpp"
|
||||
#include "WLSurface.hpp"
|
||||
#include "../helpers/AnimatedVariable.hpp"
|
||||
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
||||
|
||||
struct SLayerRule {
|
||||
std::string targetNamespace = "";
|
||||
std::string rule = "";
|
||||
};
|
||||
|
||||
class CLayerShellResource;
|
||||
|
||||
class CLayerSurface {
|
||||
public:
|
||||
static PHLLS create(wlr_layer_surface_v1*);
|
||||
static PHLLS create(SP<CLayerShellResource>);
|
||||
|
||||
private:
|
||||
CLayerSurface();
|
||||
CLayerSurface(SP<CLayerShellResource>);
|
||||
|
||||
public:
|
||||
~CLayerSurface();
|
||||
@@ -30,16 +31,18 @@ class CLayerSurface {
|
||||
CAnimatedVariable<Vector2D> realSize;
|
||||
CAnimatedVariable<float> alpha;
|
||||
|
||||
wlr_layer_surface_v1* layerSurface;
|
||||
WP<CLayerShellResource> layerSurface;
|
||||
wl_list link;
|
||||
|
||||
bool keyboardExclusive = false;
|
||||
// the header providing the enum type cannot be imported here
|
||||
int interactivity = 0;
|
||||
|
||||
CWLSurface surface;
|
||||
SP<CWLSurface> surface;
|
||||
|
||||
bool mapped = false;
|
||||
uint32_t layer = 0;
|
||||
|
||||
int monitorID = -1;
|
||||
MONITORID monitorID = -1;
|
||||
|
||||
bool fadingOut = false;
|
||||
bool readyToDelete = false;
|
||||
@@ -48,20 +51,20 @@ class CLayerSurface {
|
||||
|
||||
bool forceBlur = false;
|
||||
bool forceBlurPopups = false;
|
||||
int xray = -1;
|
||||
int64_t xray = -1;
|
||||
bool ignoreAlpha = false;
|
||||
float ignoreAlphaValue = 0.f;
|
||||
bool dimAround = false;
|
||||
int64_t order = 0;
|
||||
|
||||
std::optional<std::string> animationStyle;
|
||||
|
||||
zwlr_layer_shell_v1_layer layer;
|
||||
|
||||
PHLLSREF self;
|
||||
|
||||
CBox geometry = {0, 0, 0, 0};
|
||||
Vector2D position;
|
||||
std::string szNamespace = "";
|
||||
std::unique_ptr<CPopup> popupHead;
|
||||
|
||||
void onDestroy();
|
||||
void onMap();
|
||||
@@ -69,12 +72,12 @@ class CLayerSurface {
|
||||
void onCommit();
|
||||
|
||||
private:
|
||||
std::unique_ptr<CPopup> popupHead;
|
||||
|
||||
DYNLISTENER(destroyLayerSurface);
|
||||
DYNLISTENER(mapLayerSurface);
|
||||
DYNLISTENER(unmapLayerSurface);
|
||||
DYNLISTENER(commitLayerSurface);
|
||||
struct {
|
||||
CHyprSignalListener destroy;
|
||||
CHyprSignalListener map;
|
||||
CHyprSignalListener unmap;
|
||||
CHyprSignalListener commit;
|
||||
} listeners;
|
||||
|
||||
void registerCallbacks();
|
||||
|
||||
|
@@ -1,6 +1,10 @@
|
||||
#include "Popup.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../protocols/LayerShell.hpp"
|
||||
#include "../protocols/XDGShell.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include <ranges>
|
||||
|
||||
CPopup::CPopup(PHLWINDOW pOwner) : m_pWindowOwner(pOwner) {
|
||||
initAllSignals();
|
||||
@@ -10,86 +14,49 @@ CPopup::CPopup(PHLLS pOwner) : m_pLayerOwner(pOwner) {
|
||||
initAllSignals();
|
||||
}
|
||||
|
||||
CPopup::CPopup(wlr_xdg_popup* popup, CPopup* pOwner) : m_pParent(pOwner), m_pWLR(popup) {
|
||||
m_pWLR->base->data = this;
|
||||
m_sWLSurface.assign(popup->base->surface, this);
|
||||
CPopup::CPopup(SP<CXDGPopupResource> popup, CPopup* pOwner) : m_pParent(pOwner), m_pResource(popup) {
|
||||
m_pWLSurface = CWLSurface::create();
|
||||
m_pWLSurface->assign(popup->surface->surface.lock(), this);
|
||||
|
||||
m_pLayerOwner = pOwner->m_pLayerOwner;
|
||||
m_pWindowOwner = pOwner->m_pWindowOwner;
|
||||
|
||||
m_vLastSize = {m_pWLR->current.geometry.width, m_pWLR->current.geometry.height};
|
||||
unconstrain();
|
||||
m_vLastSize = popup->surface->current.geometry.size();
|
||||
reposition();
|
||||
|
||||
initAllSignals();
|
||||
}
|
||||
|
||||
CPopup::~CPopup() {
|
||||
m_sWLSurface.unassign();
|
||||
if (m_pWLR)
|
||||
m_pWLR->base->data = nullptr;
|
||||
|
||||
hyprListener_commitPopup.removeCallback();
|
||||
hyprListener_repositionPopup.removeCallback();
|
||||
hyprListener_mapPopup.removeCallback();
|
||||
hyprListener_unmapPopup.removeCallback();
|
||||
hyprListener_newPopup.removeCallback();
|
||||
hyprListener_destroyPopup.removeCallback();
|
||||
}
|
||||
|
||||
static void onNewPopup(void* owner, void* data) {
|
||||
const auto POPUP = (CPopup*)owner;
|
||||
POPUP->onNewPopup((wlr_xdg_popup*)data);
|
||||
}
|
||||
|
||||
static void onMapPopup(void* owner, void* data) {
|
||||
const auto POPUP = (CPopup*)owner;
|
||||
POPUP->onMap();
|
||||
}
|
||||
|
||||
static void onDestroyPopup(void* owner, void* data) {
|
||||
const auto POPUP = (CPopup*)owner;
|
||||
POPUP->onDestroy();
|
||||
}
|
||||
|
||||
static void onUnmapPopup(void* owner, void* data) {
|
||||
const auto POPUP = (CPopup*)owner;
|
||||
POPUP->onUnmap();
|
||||
}
|
||||
|
||||
static void onCommitPopup(void* owner, void* data) {
|
||||
const auto POPUP = (CPopup*)owner;
|
||||
POPUP->onCommit();
|
||||
}
|
||||
|
||||
static void onRepositionPopup(void* owner, void* data) {
|
||||
const auto POPUP = (CPopup*)owner;
|
||||
POPUP->onReposition();
|
||||
if (m_pWLSurface)
|
||||
m_pWLSurface->unassign();
|
||||
}
|
||||
|
||||
void CPopup::initAllSignals() {
|
||||
|
||||
if (!m_pWLR) {
|
||||
if (!m_pResource) {
|
||||
if (!m_pWindowOwner.expired())
|
||||
hyprListener_newPopup.initCallback(&m_pWindowOwner.lock()->m_uSurface.xdg->events.new_popup, ::onNewPopup, this, "CPopup Head");
|
||||
else if (m_pLayerOwner)
|
||||
hyprListener_newPopup.initCallback(&m_pLayerOwner->layerSurface->events.new_popup, ::onNewPopup, this, "CPopup Head");
|
||||
listeners.newPopup = m_pWindowOwner->m_pXDGSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<SP<CXDGPopupResource>>(d)); });
|
||||
else if (!m_pLayerOwner.expired())
|
||||
listeners.newPopup = m_pLayerOwner->layerSurface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<SP<CXDGPopupResource>>(d)); });
|
||||
else
|
||||
ASSERT(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
hyprListener_repositionPopup.initCallback(&m_pWLR->events.reposition, ::onRepositionPopup, this, "CPopup");
|
||||
hyprListener_destroyPopup.initCallback(&m_pWLR->events.destroy, ::onDestroyPopup, this, "CPopup");
|
||||
hyprListener_mapPopup.initCallback(&m_sWLSurface.wlr()->events.map, ::onMapPopup, this, "CPopup");
|
||||
hyprListener_unmapPopup.initCallback(&m_sWLSurface.wlr()->events.unmap, ::onUnmapPopup, this, "CPopup");
|
||||
hyprListener_commitPopup.initCallback(&m_sWLSurface.wlr()->events.commit, ::onCommitPopup, this, "CPopup");
|
||||
hyprListener_newPopup.initCallback(&m_pWLR->base->events.new_popup, ::onNewPopup, this, "CPopup");
|
||||
listeners.reposition = m_pResource->events.reposition.registerListener([this](std::any d) { this->onReposition(); });
|
||||
listeners.map = m_pResource->surface->events.map.registerListener([this](std::any d) { this->onMap(); });
|
||||
listeners.unmap = m_pResource->surface->events.unmap.registerListener([this](std::any d) { this->onUnmap(); });
|
||||
listeners.dismissed = m_pResource->events.dismissed.registerListener([this](std::any d) { this->onUnmap(); });
|
||||
listeners.destroy = m_pResource->surface->events.destroy.registerListener([this](std::any d) { this->onDestroy(); });
|
||||
listeners.commit = m_pResource->surface->events.commit.registerListener([this](std::any d) { this->onCommit(); });
|
||||
listeners.newPopup = m_pResource->surface->events.newPopup.registerListener([this](std::any d) { this->onNewPopup(std::any_cast<SP<CXDGPopupResource>>(d)); });
|
||||
}
|
||||
|
||||
void CPopup::onNewPopup(wlr_xdg_popup* popup) {
|
||||
const auto POPUP = m_vChildren.emplace_back(std::make_unique<CPopup>(popup, this)).get();
|
||||
Debug::log(LOG, "New popup at wlr {:x} and hl {:x}", (uintptr_t)popup, (uintptr_t)POPUP);
|
||||
void CPopup::onNewPopup(SP<CXDGPopupResource> popup) {
|
||||
const auto POPUP = m_vChildren.emplace_back(makeShared<CPopup>(popup, this)).get();
|
||||
Debug::log(LOG, "New popup at {:x}", (uintptr_t)POPUP);
|
||||
}
|
||||
|
||||
void CPopup::onDestroy() {
|
||||
@@ -102,12 +69,17 @@ void CPopup::onDestroy() {
|
||||
}
|
||||
|
||||
void CPopup::onMap() {
|
||||
m_vLastSize = {m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height};
|
||||
const auto COORDS = coordsGlobal();
|
||||
if (m_bMapped)
|
||||
return;
|
||||
|
||||
CBox box;
|
||||
wlr_surface_get_extends(m_sWLSurface.wlr(), box.pWlr());
|
||||
box.applyFromWlr().translate(COORDS).expand(4);
|
||||
m_bMapped = true;
|
||||
m_vLastSize = m_pResource->surface->surface->current.size;
|
||||
|
||||
const auto COORDS = coordsGlobal();
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromVector(COORDS);
|
||||
|
||||
CBox box = m_pWLSurface->resource()->extends();
|
||||
box.translate(COORDS).expand(4);
|
||||
g_pHyprRenderer->damageBox(&box);
|
||||
|
||||
m_vLastPos = coordsRelativeToParent();
|
||||
@@ -116,38 +88,65 @@ void CPopup::onMap() {
|
||||
|
||||
m_pSubsurfaceHead = std::make_unique<CSubsurface>(this);
|
||||
|
||||
unconstrain();
|
||||
//unconstrain();
|
||||
sendScale();
|
||||
m_pResource->surface->surface->enter(PMONITOR->self.lock());
|
||||
|
||||
if (m_pLayerOwner && m_pLayerOwner->layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP)
|
||||
if (!m_pLayerOwner.expired() && m_pLayerOwner->layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP)
|
||||
g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_pLayerOwner->layer));
|
||||
}
|
||||
|
||||
void CPopup::onUnmap() {
|
||||
m_vLastSize = {m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height};
|
||||
if (!m_bMapped)
|
||||
return;
|
||||
|
||||
if (!m_pResource || !m_pResource->surface) {
|
||||
Debug::log(ERR, "CPopup: orphaned (no surface/resource) and unmaps??");
|
||||
onDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
m_vLastSize = m_pResource->surface->surface->current.size;
|
||||
|
||||
const auto COORDS = coordsGlobal();
|
||||
|
||||
CBox box;
|
||||
wlr_surface_get_extends(m_sWLSurface.wlr(), box.pWlr());
|
||||
box.applyFromWlr().translate(COORDS).expand(4);
|
||||
CBox box = m_pWLSurface->resource()->extends();
|
||||
box.translate(COORDS).expand(4);
|
||||
g_pHyprRenderer->damageBox(&box);
|
||||
|
||||
m_pSubsurfaceHead.reset();
|
||||
|
||||
g_pInputManager->simulateMouseMovement();
|
||||
|
||||
if (m_pLayerOwner && m_pLayerOwner->layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP)
|
||||
if (!m_pLayerOwner.expired() && m_pLayerOwner->layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP)
|
||||
g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_pLayerOwner->layer));
|
||||
|
||||
// damage all children
|
||||
breadthfirst(
|
||||
[](CPopup* p, void* data) {
|
||||
if (!p->m_pResource)
|
||||
return;
|
||||
|
||||
auto box = CBox{p->coordsGlobal(), p->size()};
|
||||
g_pHyprRenderer->damageBox(&box);
|
||||
},
|
||||
nullptr);
|
||||
}
|
||||
|
||||
void CPopup::onCommit(bool ignoreSiblings) {
|
||||
if (m_pWLR->base->initial_commit) {
|
||||
wlr_xdg_surface_schedule_configure(m_pWLR->base);
|
||||
if (!m_pResource || !m_pResource->surface) {
|
||||
Debug::log(ERR, "CPopup: orphaned (no surface/resource) and commits??");
|
||||
onDestroy();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_pWindowOwner.expired() && (!m_pWindowOwner.lock()->m_bIsMapped || !m_pWindowOwner.lock()->m_pWorkspace->m_bVisible)) {
|
||||
m_vLastSize = {m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height};
|
||||
if (m_pResource->surface->initialCommit) {
|
||||
m_pResource->surface->scheduleConfigure();
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_pWindowOwner.expired() && (!m_pWindowOwner->m_bIsMapped || !m_pWindowOwner->m_pWorkspace->m_bVisible)) {
|
||||
m_vLastSize = m_pResource->surface->surface->current.size;
|
||||
|
||||
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
|
||||
if (*PLOGDAMAGE)
|
||||
@@ -155,16 +154,16 @@ void CPopup::onCommit(bool ignoreSiblings) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!m_pWLR->base->surface->mapped)
|
||||
if (!m_pResource->surface->mapped)
|
||||
return;
|
||||
|
||||
const auto COORDS = coordsGlobal();
|
||||
const auto COORDSLOCAL = coordsRelativeToParent();
|
||||
|
||||
if (m_vLastSize != Vector2D{m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height} || m_bRequestedReposition || m_vLastPos != COORDSLOCAL) {
|
||||
if (m_vLastSize != m_pResource->surface->surface->current.size || m_bRequestedReposition || m_vLastPos != COORDSLOCAL) {
|
||||
CBox box = {localToGlobal(m_vLastPos), m_vLastSize};
|
||||
g_pHyprRenderer->damageBox(&box);
|
||||
m_vLastSize = {m_pWLR->base->current.geometry.width, m_pWLR->base->current.geometry.height};
|
||||
m_vLastSize = m_pResource->surface->surface->current.size;
|
||||
box = {COORDS, m_vLastSize};
|
||||
g_pHyprRenderer->damageBox(&box);
|
||||
|
||||
@@ -174,11 +173,11 @@ void CPopup::onCommit(bool ignoreSiblings) {
|
||||
if (!ignoreSiblings && m_pSubsurfaceHead)
|
||||
m_pSubsurfaceHead->recheckDamageForSubsurfaces();
|
||||
|
||||
g_pHyprRenderer->damageSurface(m_sWLSurface.wlr(), COORDS.x, COORDS.y);
|
||||
g_pHyprRenderer->damageSurface(m_pWLSurface->resource(), COORDS.x, COORDS.y);
|
||||
|
||||
m_bRequestedReposition = false;
|
||||
|
||||
if (m_pLayerOwner && m_pLayerOwner->layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP)
|
||||
if (!m_pLayerOwner.expired() && m_pLayerOwner->layer < ZWLR_LAYER_SHELL_V1_LAYER_TOP)
|
||||
g_pHyprOpenGL->markBlurDirtyForMonitor(g_pCompositor->getMonitorFromID(m_pLayerOwner->layer));
|
||||
}
|
||||
|
||||
@@ -189,31 +188,40 @@ void CPopup::onReposition() {
|
||||
|
||||
m_vLastPos = coordsRelativeToParent();
|
||||
|
||||
unconstrain();
|
||||
reposition();
|
||||
}
|
||||
|
||||
void CPopup::unconstrain() {
|
||||
void CPopup::reposition() {
|
||||
const auto COORDS = t1ParentCoords();
|
||||
const auto PMONITOR = g_pCompositor->getMonitorFromVector(COORDS);
|
||||
|
||||
if (!PMONITOR)
|
||||
return;
|
||||
|
||||
CBox box = {PMONITOR->vecPosition.x - COORDS.x, PMONITOR->vecPosition.y - COORDS.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
|
||||
wlr_xdg_popup_unconstrain_from_box(m_pWLR, box.pWlr());
|
||||
CBox box = {PMONITOR->vecPosition.x, PMONITOR->vecPosition.y, PMONITOR->vecSize.x, PMONITOR->vecSize.y};
|
||||
m_pResource->applyPositioning(box, COORDS);
|
||||
}
|
||||
|
||||
SP<CWLSurface> CPopup::getT1Owner() {
|
||||
if (m_pWindowOwner)
|
||||
return m_pWindowOwner->m_pWLSurface;
|
||||
else
|
||||
return m_pLayerOwner->surface;
|
||||
}
|
||||
|
||||
Vector2D CPopup::coordsRelativeToParent() {
|
||||
Vector2D offset;
|
||||
|
||||
if (!m_pResource)
|
||||
return {};
|
||||
|
||||
CPopup* current = this;
|
||||
offset -= current->m_pResource->surface->current.geometry.pos();
|
||||
|
||||
offset -= {m_pWLR->base->current.geometry.x, m_pWLR->base->current.geometry.y};
|
||||
while (current->m_pParent && current->m_pResource) {
|
||||
|
||||
while (current->m_pParent) {
|
||||
|
||||
offset += {current->m_sWLSurface.wlr()->current.dx, current->m_sWLSurface.wlr()->current.dy};
|
||||
offset += {current->m_pWLR->current.geometry.x, current->m_pWLR->current.geometry.y};
|
||||
offset += current->m_pWLSurface->resource()->current.offset;
|
||||
offset += current->m_pResource->geometry.pos();
|
||||
|
||||
current = current->m_pParent;
|
||||
}
|
||||
@@ -231,8 +239,8 @@ Vector2D CPopup::localToGlobal(const Vector2D& rel) {
|
||||
|
||||
Vector2D CPopup::t1ParentCoords() {
|
||||
if (!m_pWindowOwner.expired())
|
||||
return m_pWindowOwner.lock()->m_vRealPosition.value();
|
||||
if (m_pLayerOwner)
|
||||
return m_pWindowOwner->m_vRealPosition.value();
|
||||
if (!m_pLayerOwner.expired())
|
||||
return m_pLayerOwner->realPosition.value();
|
||||
|
||||
ASSERT(false);
|
||||
@@ -249,7 +257,8 @@ void CPopup::recheckTree() {
|
||||
}
|
||||
|
||||
void CPopup::recheckChildrenRecursive() {
|
||||
for (auto& c : m_vChildren) {
|
||||
auto cpy = m_vChildren;
|
||||
for (auto const& c : cpy) {
|
||||
c->onCommit(true);
|
||||
c->recheckChildrenRecursive();
|
||||
}
|
||||
@@ -261,9 +270,70 @@ Vector2D CPopup::size() {
|
||||
|
||||
void CPopup::sendScale() {
|
||||
if (!m_pWindowOwner.expired())
|
||||
g_pCompositor->setPreferredScaleForSurface(m_sWLSurface.wlr(), m_pWindowOwner.lock()->m_pWLSurface.m_fLastScale);
|
||||
else if (m_pLayerOwner)
|
||||
g_pCompositor->setPreferredScaleForSurface(m_sWLSurface.wlr(), m_pLayerOwner->surface.m_fLastScale);
|
||||
g_pCompositor->setPreferredScaleForSurface(m_pWLSurface->resource(), m_pWindowOwner->m_pWLSurface->m_fLastScale);
|
||||
else if (!m_pLayerOwner.expired())
|
||||
g_pCompositor->setPreferredScaleForSurface(m_pWLSurface->resource(), m_pLayerOwner->surface->m_fLastScale);
|
||||
else
|
||||
UNREACHABLE();
|
||||
}
|
||||
|
||||
bool CPopup::visible() {
|
||||
if (!m_pWindowOwner.expired())
|
||||
return g_pHyprRenderer->shouldRenderWindow(m_pWindowOwner.lock());
|
||||
if (!m_pLayerOwner.expired())
|
||||
return true;
|
||||
if (m_pParent)
|
||||
return m_pParent->visible();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void CPopup::bfHelper(std::vector<CPopup*> nodes, std::function<void(CPopup*, void*)> fn, void* data) {
|
||||
for (auto const& n : nodes) {
|
||||
fn(n, data);
|
||||
}
|
||||
|
||||
std::vector<CPopup*> nodes2;
|
||||
|
||||
for (auto const& n : nodes) {
|
||||
for (auto const& c : n->m_vChildren) {
|
||||
nodes2.push_back(c.get());
|
||||
}
|
||||
}
|
||||
|
||||
if (!nodes2.empty())
|
||||
bfHelper(nodes2, fn, data);
|
||||
}
|
||||
|
||||
void CPopup::breadthfirst(std::function<void(CPopup*, void*)> fn, void* data) {
|
||||
std::vector<CPopup*> popups;
|
||||
popups.push_back(this);
|
||||
bfHelper(popups, fn, data);
|
||||
}
|
||||
|
||||
CPopup* CPopup::at(const Vector2D& globalCoords, bool allowsInput) {
|
||||
std::vector<CPopup*> popups;
|
||||
breadthfirst([](CPopup* popup, void* data) { ((std::vector<CPopup*>*)data)->push_back(popup); }, &popups);
|
||||
|
||||
for (auto const& p : popups | std::views::reverse) {
|
||||
if (!p->m_pResource)
|
||||
continue;
|
||||
|
||||
if (!allowsInput) {
|
||||
const Vector2D offset = p->m_pResource ? (p->size() - p->m_pResource->geometry.size()) / 2.F : Vector2D{};
|
||||
const Vector2D size = p->m_pResource ? p->m_pResource->geometry.size() : p->size();
|
||||
|
||||
const auto BOX = CBox{p->coordsGlobal() + offset, size};
|
||||
if (BOX.containsPoint(globalCoords))
|
||||
return p;
|
||||
} else {
|
||||
const Vector2D offset = p->m_pResource ? (p->size() - p->m_pResource->geometry.size()) / 2.F : Vector2D{};
|
||||
const auto REGION =
|
||||
CRegion{p->m_pWLSurface->resource()->current.input}.intersect(CBox{{}, p->m_pWLSurface->resource()->current.size}).translate(p->coordsGlobal() + offset);
|
||||
if (REGION.containsPoint(globalCoords))
|
||||
return p;
|
||||
}
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
@@ -3,6 +3,9 @@
|
||||
#include <vector>
|
||||
#include <memory>
|
||||
#include "Subsurface.hpp"
|
||||
#include "../helpers/signal/Signal.hpp"
|
||||
|
||||
class CXDGPopupResource;
|
||||
|
||||
class CPopup {
|
||||
public:
|
||||
@@ -11,16 +14,17 @@ class CPopup {
|
||||
CPopup(PHLLS pOwner);
|
||||
|
||||
// real nodes
|
||||
CPopup(wlr_xdg_popup* popup, CPopup* pOwner);
|
||||
CPopup(SP<CXDGPopupResource> popup, CPopup* pOwner);
|
||||
|
||||
~CPopup();
|
||||
|
||||
SP<CWLSurface> getT1Owner();
|
||||
Vector2D coordsRelativeToParent();
|
||||
Vector2D coordsGlobal();
|
||||
|
||||
Vector2D size();
|
||||
|
||||
void onNewPopup(wlr_xdg_popup* popup);
|
||||
void onNewPopup(SP<CXDGPopupResource> popup);
|
||||
void onDestroy();
|
||||
void onMap();
|
||||
void onUnmap();
|
||||
@@ -29,17 +33,24 @@ class CPopup {
|
||||
|
||||
void recheckTree();
|
||||
|
||||
CWLSurface m_sWLSurface;
|
||||
bool visible();
|
||||
|
||||
// will also loop over this node
|
||||
void breadthfirst(std::function<void(CPopup*, void*)> fn, void* data);
|
||||
CPopup* at(const Vector2D& globalCoords, bool allowsInput = false);
|
||||
|
||||
//
|
||||
SP<CWLSurface> m_pWLSurface;
|
||||
|
||||
private:
|
||||
// T1 owners, each popup has to have one of these
|
||||
PHLWINDOWREF m_pWindowOwner;
|
||||
PHLLS m_pLayerOwner;
|
||||
PHLLSREF m_pLayerOwner;
|
||||
|
||||
// T2 owners
|
||||
CPopup* m_pParent = nullptr;
|
||||
|
||||
wlr_xdg_popup* m_pWLR = nullptr;
|
||||
WP<CXDGPopupResource> m_pResource;
|
||||
|
||||
Vector2D m_vLastSize = {};
|
||||
Vector2D m_vLastPos = {};
|
||||
@@ -47,24 +58,28 @@ class CPopup {
|
||||
bool m_bRequestedReposition = false;
|
||||
|
||||
bool m_bInert = false;
|
||||
bool m_bMapped = false;
|
||||
|
||||
//
|
||||
std::vector<std::unique_ptr<CPopup>> m_vChildren;
|
||||
std::vector<SP<CPopup>> m_vChildren;
|
||||
std::unique_ptr<CSubsurface> m_pSubsurfaceHead;
|
||||
|
||||
// signals
|
||||
DYNLISTENER(newPopup);
|
||||
DYNLISTENER(destroyPopup);
|
||||
DYNLISTENER(mapPopup);
|
||||
DYNLISTENER(unmapPopup);
|
||||
DYNLISTENER(commitPopup);
|
||||
DYNLISTENER(repositionPopup);
|
||||
struct {
|
||||
CHyprSignalListener newPopup;
|
||||
CHyprSignalListener destroy;
|
||||
CHyprSignalListener map;
|
||||
CHyprSignalListener unmap;
|
||||
CHyprSignalListener commit;
|
||||
CHyprSignalListener dismissed;
|
||||
CHyprSignalListener reposition;
|
||||
} listeners;
|
||||
|
||||
void initAllSignals();
|
||||
void unconstrain();
|
||||
void reposition();
|
||||
void recheckChildrenRecursive();
|
||||
void sendScale();
|
||||
|
||||
Vector2D localToGlobal(const Vector2D& rel);
|
||||
Vector2D t1ParentCoords();
|
||||
static void bfHelper(std::vector<CPopup*> nodes, std::function<void(CPopup*, void*)> fn, void* data);
|
||||
};
|
@@ -2,83 +2,54 @@
|
||||
#include "../events/Events.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../config/ConfigValue.hpp"
|
||||
|
||||
static void onNewSubsurface(void* owner, void* data);
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../protocols/core/Subcompositor.hpp"
|
||||
|
||||
CSubsurface::CSubsurface(PHLWINDOW pOwner) : m_pWindowParent(pOwner) {
|
||||
initSignals();
|
||||
initExistingSubsurfaces(pOwner->m_pWLSurface.wlr());
|
||||
initExistingSubsurfaces(pOwner->m_pWLSurface->resource());
|
||||
}
|
||||
|
||||
CSubsurface::CSubsurface(CPopup* pOwner) : m_pPopupParent(pOwner) {
|
||||
initSignals();
|
||||
initExistingSubsurfaces(pOwner->m_sWLSurface.wlr());
|
||||
initExistingSubsurfaces(pOwner->m_pWLSurface->resource());
|
||||
}
|
||||
|
||||
CSubsurface::CSubsurface(wlr_subsurface* pSubsurface, PHLWINDOW pOwner) : m_pSubsurface(pSubsurface), m_pWindowParent(pOwner) {
|
||||
m_sWLSurface.assign(pSubsurface->surface, this);
|
||||
CSubsurface::CSubsurface(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner) : m_pSubsurface(pSubsurface), m_pWindowParent(pOwner) {
|
||||
m_pWLSurface = CWLSurface::create();
|
||||
m_pWLSurface->assign(pSubsurface->surface.lock(), this);
|
||||
initSignals();
|
||||
initExistingSubsurfaces(pSubsurface->surface);
|
||||
initExistingSubsurfaces(pSubsurface->surface.lock());
|
||||
}
|
||||
|
||||
CSubsurface::CSubsurface(wlr_subsurface* pSubsurface, CPopup* pOwner) : m_pSubsurface(pSubsurface), m_pPopupParent(pOwner) {
|
||||
m_sWLSurface.assign(pSubsurface->surface, this);
|
||||
CSubsurface::CSubsurface(SP<CWLSubsurfaceResource> pSubsurface, CPopup* pOwner) : m_pSubsurface(pSubsurface), m_pPopupParent(pOwner) {
|
||||
m_pWLSurface = CWLSurface::create();
|
||||
m_pWLSurface->assign(pSubsurface->surface.lock(), this);
|
||||
initSignals();
|
||||
initExistingSubsurfaces(pSubsurface->surface);
|
||||
initExistingSubsurfaces(pSubsurface->surface.lock());
|
||||
}
|
||||
|
||||
CSubsurface::~CSubsurface() {
|
||||
hyprListener_newSubsurface.removeCallback();
|
||||
|
||||
if (!m_pSubsurface)
|
||||
return;
|
||||
|
||||
m_pSubsurface->data = nullptr;
|
||||
|
||||
hyprListener_commitSubsurface.removeCallback();
|
||||
hyprListener_destroySubsurface.removeCallback();
|
||||
}
|
||||
|
||||
static void onNewSubsurface(void* owner, void* data) {
|
||||
const auto PSUBSURFACE = (CSubsurface*)owner;
|
||||
PSUBSURFACE->onNewSubsurface((wlr_subsurface*)data);
|
||||
}
|
||||
|
||||
static void onDestroySubsurface(void* owner, void* data) {
|
||||
const auto PSUBSURFACE = (CSubsurface*)owner;
|
||||
PSUBSURFACE->onDestroy();
|
||||
}
|
||||
|
||||
static void onCommitSubsurface(void* owner, void* data) {
|
||||
const auto PSUBSURFACE = (CSubsurface*)owner;
|
||||
PSUBSURFACE->onCommit();
|
||||
}
|
||||
|
||||
static void onMapSubsurface(void* owner, void* data) {
|
||||
const auto PSUBSURFACE = (CSubsurface*)owner;
|
||||
PSUBSURFACE->onMap();
|
||||
}
|
||||
|
||||
static void onUnmapSubsurface(void* owner, void* data) {
|
||||
const auto PSUBSURFACE = (CSubsurface*)owner;
|
||||
PSUBSURFACE->onUnmap();
|
||||
;
|
||||
}
|
||||
|
||||
void CSubsurface::initSignals() {
|
||||
if (m_pSubsurface) {
|
||||
m_pSubsurface->data = this;
|
||||
hyprListener_commitSubsurface.initCallback(&m_pSubsurface->surface->events.commit, &onCommitSubsurface, this, "CSubsurface");
|
||||
hyprListener_destroySubsurface.initCallback(&m_pSubsurface->events.destroy, &onDestroySubsurface, this, "CSubsurface");
|
||||
hyprListener_newSubsurface.initCallback(&m_pSubsurface->surface->events.new_subsurface, &::onNewSubsurface, this, "CSubsurface");
|
||||
hyprListener_mapSubsurface.initCallback(&m_pSubsurface->surface->events.map, &onMapSubsurface, this, "CSubsurface");
|
||||
hyprListener_unmapSubsurface.initCallback(&m_pSubsurface->surface->events.unmap, &onUnmapSubsurface, this, "CSubsurface");
|
||||
listeners.commitSubsurface = m_pSubsurface->surface->events.commit.registerListener([this](std::any d) { onCommit(); });
|
||||
listeners.destroySubsurface = m_pSubsurface->events.destroy.registerListener([this](std::any d) { onDestroy(); });
|
||||
listeners.mapSubsurface = m_pSubsurface->surface->events.map.registerListener([this](std::any d) { onMap(); });
|
||||
listeners.unmapSubsurface = m_pSubsurface->surface->events.unmap.registerListener([this](std::any d) { onUnmap(); });
|
||||
listeners.newSubsurface =
|
||||
m_pSubsurface->surface->events.newSubsurface.registerListener([this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
|
||||
} else {
|
||||
if (!m_pWindowParent.expired())
|
||||
hyprListener_newSubsurface.initCallback(&m_pWindowParent.lock()->m_pWLSurface.wlr()->events.new_subsurface, &::onNewSubsurface, this, "CSubsurface Head");
|
||||
if (m_pWindowParent)
|
||||
listeners.newSubsurface = m_pWindowParent->m_pWLSurface->resource()->events.newSubsurface.registerListener(
|
||||
[this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
|
||||
else if (m_pPopupParent)
|
||||
hyprListener_newSubsurface.initCallback(&m_pPopupParent->m_sWLSurface.wlr()->events.new_subsurface, &::onNewSubsurface, this, "CSubsurface Head");
|
||||
listeners.newSubsurface = m_pPopupParent->m_pWLSurface->resource()->events.newSubsurface.registerListener(
|
||||
[this](std::any d) { onNewSubsurface(std::any_cast<SP<CWLSubsurfaceResource>>(d)); });
|
||||
else
|
||||
RASSERT(false, "CSubsurface::initSignals empty subsurface");
|
||||
ASSERT(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,28 +57,28 @@ void CSubsurface::checkSiblingDamage() {
|
||||
if (!m_pParent)
|
||||
return; // ??????????
|
||||
|
||||
const double SCALE = m_pWindowParent.lock() && m_pWindowParent.lock()->m_bIsX11 ? 1.0 / m_pWindowParent.lock()->m_fX11SurfaceScaledBy : 1.0;
|
||||
const double SCALE = m_pWindowParent.lock() && m_pWindowParent->m_bIsX11 ? 1.0 / m_pWindowParent->m_fX11SurfaceScaledBy : 1.0;
|
||||
|
||||
for (auto& n : m_pParent->m_vChildren) {
|
||||
for (auto const& n : m_pParent->m_vChildren) {
|
||||
if (n.get() == this)
|
||||
continue;
|
||||
|
||||
const auto COORDS = n->coordsGlobal();
|
||||
g_pHyprRenderer->damageSurface(n->m_sWLSurface.wlr(), COORDS.x, COORDS.y, SCALE);
|
||||
g_pHyprRenderer->damageSurface(n->m_pWLSurface->resource(), COORDS.x, COORDS.y, SCALE);
|
||||
}
|
||||
}
|
||||
|
||||
void CSubsurface::recheckDamageForSubsurfaces() {
|
||||
for (auto& n : m_vChildren) {
|
||||
for (auto const& n : m_vChildren) {
|
||||
const auto COORDS = n->coordsGlobal();
|
||||
g_pHyprRenderer->damageSurface(n->m_sWLSurface.wlr(), COORDS.x, COORDS.y);
|
||||
g_pHyprRenderer->damageSurface(n->m_pWLSurface->resource(), COORDS.x, COORDS.y);
|
||||
}
|
||||
}
|
||||
|
||||
void CSubsurface::onCommit() {
|
||||
// no damaging if it's not visible
|
||||
if (!m_pWindowParent.expired() && (!m_pWindowParent.lock()->m_bIsMapped || !m_pWindowParent.lock()->m_pWorkspace->m_bVisible)) {
|
||||
m_vLastSize = Vector2D{m_sWLSurface.wlr()->current.width, m_sWLSurface.wlr()->current.height};
|
||||
if (!m_pWindowParent.expired() && (!m_pWindowParent->m_bIsMapped || !m_pWindowParent->m_pWorkspace->m_bVisible)) {
|
||||
m_vLastSize = m_pWLSurface->resource()->current.size;
|
||||
|
||||
static auto PLOGDAMAGE = CConfigValue<Hyprlang::INT>("debug:log_damage");
|
||||
if (*PLOGDAMAGE)
|
||||
@@ -117,20 +88,20 @@ void CSubsurface::onCommit() {
|
||||
|
||||
const auto COORDS = coordsGlobal();
|
||||
|
||||
g_pHyprRenderer->damageSurface(m_sWLSurface.wlr(), COORDS.x, COORDS.y);
|
||||
g_pHyprRenderer->damageSurface(m_pWLSurface->resource(), COORDS.x, COORDS.y);
|
||||
|
||||
if (m_pPopupParent)
|
||||
m_pPopupParent->recheckTree();
|
||||
if (!m_pWindowParent.expired()) // I hate you firefox why are you doing this
|
||||
m_pWindowParent.lock()->m_pPopupHead->recheckTree();
|
||||
m_pWindowParent->m_pPopupHead->recheckTree();
|
||||
|
||||
// I do not think this is correct, but it solves a lot of issues with some apps (e.g. firefox)
|
||||
checkSiblingDamage();
|
||||
|
||||
if (m_vLastSize != Vector2D{m_sWLSurface.wlr()->current.width, m_sWLSurface.wlr()->current.height}) {
|
||||
if (m_vLastSize != m_pWLSurface->resource()->current.size) {
|
||||
CBox box{COORDS, m_vLastSize};
|
||||
g_pHyprRenderer->damageBox(&box);
|
||||
m_vLastSize = Vector2D{m_sWLSurface.wlr()->current.width, m_sWLSurface.wlr()->current.height};
|
||||
m_vLastSize = m_pWLSurface->resource()->current.size;
|
||||
box = {COORDS, m_vLastSize};
|
||||
g_pHyprRenderer->damageBox(&box);
|
||||
}
|
||||
@@ -149,20 +120,21 @@ void CSubsurface::onDestroy() {
|
||||
std::erase_if(m_pParent->m_vChildren, [this](const auto& other) { return other.get() == this; });
|
||||
}
|
||||
|
||||
void CSubsurface::onNewSubsurface(wlr_subsurface* pSubsurface) {
|
||||
void CSubsurface::onNewSubsurface(SP<CWLSubsurfaceResource> pSubsurface) {
|
||||
CSubsurface* PSUBSURFACE = nullptr;
|
||||
|
||||
if (!m_pWindowParent.expired())
|
||||
PSUBSURFACE = m_vChildren.emplace_back(std::make_unique<CSubsurface>(pSubsurface, m_pWindowParent.lock())).get();
|
||||
else if (m_pPopupParent)
|
||||
PSUBSURFACE = m_vChildren.emplace_back(std::make_unique<CSubsurface>(pSubsurface, m_pPopupParent)).get();
|
||||
PSUBSURFACE->m_pParent = this;
|
||||
|
||||
ASSERT(PSUBSURFACE);
|
||||
|
||||
PSUBSURFACE->m_pParent = this;
|
||||
}
|
||||
|
||||
void CSubsurface::onMap() {
|
||||
m_vLastSize = {m_sWLSurface.wlr()->current.width, m_sWLSurface.wlr()->current.height};
|
||||
m_vLastSize = m_pWLSurface->resource()->current.size;
|
||||
|
||||
const auto COORDS = coordsGlobal();
|
||||
CBox box{COORDS, m_vLastSize};
|
||||
@@ -170,7 +142,7 @@ void CSubsurface::onMap() {
|
||||
g_pHyprRenderer->damageBox(&box);
|
||||
|
||||
if (!m_pWindowParent.expired())
|
||||
m_pWindowParent.lock()->updateSurfaceScaleTransformDetails();
|
||||
m_pWindowParent->updateSurfaceScaleTransformDetails();
|
||||
}
|
||||
|
||||
void CSubsurface::onUnmap() {
|
||||
@@ -179,7 +151,7 @@ void CSubsurface::onUnmap() {
|
||||
box.expand(4);
|
||||
g_pHyprRenderer->damageBox(&box);
|
||||
|
||||
if (m_sWLSurface.wlr() == g_pCompositor->m_pLastFocus)
|
||||
if (m_pWLSurface->resource() == g_pCompositor->m_pLastFocus)
|
||||
g_pInputManager->releaseAllMouseButtons();
|
||||
|
||||
g_pInputManager->simulateMouseMovement();
|
||||
@@ -188,42 +160,41 @@ void CSubsurface::onUnmap() {
|
||||
}
|
||||
|
||||
Vector2D CSubsurface::coordsRelativeToParent() {
|
||||
Vector2D offset;
|
||||
|
||||
CSubsurface* current = this;
|
||||
|
||||
while (current->m_pParent) {
|
||||
|
||||
offset += {current->m_sWLSurface.wlr()->current.dx, current->m_sWLSurface.wlr()->current.dy};
|
||||
offset += {current->m_pSubsurface->current.x, current->m_pSubsurface->current.y};
|
||||
|
||||
current = current->m_pParent;
|
||||
}
|
||||
|
||||
return offset;
|
||||
if (!m_pSubsurface)
|
||||
return {};
|
||||
return m_pSubsurface->posRelativeToParent();
|
||||
}
|
||||
|
||||
Vector2D CSubsurface::coordsGlobal() {
|
||||
Vector2D coords = coordsRelativeToParent();
|
||||
|
||||
if (!m_pWindowParent.expired())
|
||||
coords += m_pWindowParent.lock()->m_vRealPosition.value();
|
||||
coords += m_pWindowParent->m_vRealPosition.value();
|
||||
else if (m_pPopupParent)
|
||||
coords += m_pPopupParent->coordsGlobal();
|
||||
|
||||
return coords;
|
||||
}
|
||||
|
||||
void CSubsurface::initExistingSubsurfaces(wlr_surface* pSurface) {
|
||||
wlr_subsurface* wlrSubsurface;
|
||||
wl_list_for_each(wlrSubsurface, &pSurface->current.subsurfaces_below, current.link) {
|
||||
::onNewSubsurface(this, wlrSubsurface);
|
||||
}
|
||||
wl_list_for_each(wlrSubsurface, &pSurface->current.subsurfaces_above, current.link) {
|
||||
::onNewSubsurface(this, wlrSubsurface);
|
||||
void CSubsurface::initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface) {
|
||||
for (auto const& s : pSurface->subsurfaces) {
|
||||
if (!s || s->surface->hlSurface /* already assigned */)
|
||||
continue;
|
||||
onNewSubsurface(s.lock());
|
||||
}
|
||||
}
|
||||
|
||||
Vector2D CSubsurface::size() {
|
||||
return {m_sWLSurface.wlr()->current.width, m_sWLSurface.wlr()->current.height};
|
||||
return m_pWLSurface->resource()->current.size;
|
||||
}
|
||||
|
||||
bool CSubsurface::visible() {
|
||||
if (!m_pWindowParent.expired())
|
||||
return g_pHyprRenderer->shouldRenderWindow(m_pWindowParent.lock());
|
||||
if (m_pPopupParent)
|
||||
return m_pPopupParent->visible();
|
||||
if (m_pParent)
|
||||
return m_pParent->visible();
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@@ -5,6 +5,7 @@
|
||||
#include "WLSurface.hpp"
|
||||
|
||||
class CPopup;
|
||||
class CWLSubsurfaceResource;
|
||||
|
||||
class CSubsurface {
|
||||
public:
|
||||
@@ -13,8 +14,8 @@ class CSubsurface {
|
||||
CSubsurface(CPopup* pOwner);
|
||||
|
||||
// real nodes
|
||||
CSubsurface(wlr_subsurface* pSubsurface, PHLWINDOW pOwner);
|
||||
CSubsurface(wlr_subsurface* pSubsurface, CPopup* pOwner);
|
||||
CSubsurface(SP<CWLSubsurfaceResource> pSubsurface, PHLWINDOW pOwner);
|
||||
CSubsurface(SP<CWLSubsurfaceResource> pSubsurface, CPopup* pOwner);
|
||||
|
||||
~CSubsurface();
|
||||
|
||||
@@ -25,21 +26,25 @@ class CSubsurface {
|
||||
|
||||
void onCommit();
|
||||
void onDestroy();
|
||||
void onNewSubsurface(wlr_subsurface* pSubsurface);
|
||||
void onNewSubsurface(SP<CWLSubsurfaceResource> pSubsurface);
|
||||
void onMap();
|
||||
void onUnmap();
|
||||
|
||||
bool visible();
|
||||
|
||||
void recheckDamageForSubsurfaces();
|
||||
|
||||
private:
|
||||
DYNLISTENER(destroySubsurface);
|
||||
DYNLISTENER(commitSubsurface);
|
||||
DYNLISTENER(newSubsurface);
|
||||
DYNLISTENER(mapSubsurface);
|
||||
DYNLISTENER(unmapSubsurface);
|
||||
struct {
|
||||
CHyprSignalListener destroySubsurface;
|
||||
CHyprSignalListener commitSubsurface;
|
||||
CHyprSignalListener mapSubsurface;
|
||||
CHyprSignalListener unmapSubsurface;
|
||||
CHyprSignalListener newSubsurface;
|
||||
} listeners;
|
||||
|
||||
wlr_subsurface* m_pSubsurface = nullptr;
|
||||
CWLSurface m_sWLSurface;
|
||||
WP<CWLSubsurfaceResource> m_pSubsurface;
|
||||
SP<CWLSurface> m_pWLSurface;
|
||||
Vector2D m_vLastSize = {};
|
||||
|
||||
// if nullptr, means it's a dummy node
|
||||
@@ -53,6 +58,6 @@ class CSubsurface {
|
||||
bool m_bInert = false;
|
||||
|
||||
void initSignals();
|
||||
void initExistingSubsurfaces(wlr_surface* pSurface);
|
||||
void initExistingSubsurfaces(SP<CWLSurfaceResource> pSurface);
|
||||
void checkSiblingDamage();
|
||||
};
|
@@ -1,36 +1,38 @@
|
||||
#include "WLSurface.hpp"
|
||||
#include "../Compositor.hpp"
|
||||
#include "../protocols/core/Compositor.hpp"
|
||||
#include "../protocols/LayerShell.hpp"
|
||||
|
||||
void CWLSurface::assign(wlr_surface* pSurface) {
|
||||
m_pWLRSurface = pSurface;
|
||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface) {
|
||||
m_pResource = pSurface;
|
||||
init();
|
||||
m_bInert = false;
|
||||
}
|
||||
|
||||
void CWLSurface::assign(wlr_surface* pSurface, PHLWINDOW pOwner) {
|
||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, PHLWINDOW pOwner) {
|
||||
m_pWindowOwner = pOwner;
|
||||
m_pWLRSurface = pSurface;
|
||||
m_pResource = pSurface;
|
||||
init();
|
||||
m_bInert = false;
|
||||
}
|
||||
|
||||
void CWLSurface::assign(wlr_surface* pSurface, PHLLS pOwner) {
|
||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, PHLLS pOwner) {
|
||||
m_pLayerOwner = pOwner;
|
||||
m_pWLRSurface = pSurface;
|
||||
m_pResource = pSurface;
|
||||
init();
|
||||
m_bInert = false;
|
||||
}
|
||||
|
||||
void CWLSurface::assign(wlr_surface* pSurface, CSubsurface* pOwner) {
|
||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, CSubsurface* pOwner) {
|
||||
m_pSubsurfaceOwner = pOwner;
|
||||
m_pWLRSurface = pSurface;
|
||||
m_pResource = pSurface;
|
||||
init();
|
||||
m_bInert = false;
|
||||
}
|
||||
|
||||
void CWLSurface::assign(wlr_surface* pSurface, CPopup* pOwner) {
|
||||
void CWLSurface::assign(SP<CWLSurfaceResource> pSurface, CPopup* pOwner) {
|
||||
m_pPopupOwner = pOwner;
|
||||
m_pWLRSurface = pSurface;
|
||||
m_pResource = pSurface;
|
||||
init();
|
||||
m_bInert = false;
|
||||
}
|
||||
@@ -44,20 +46,23 @@ CWLSurface::~CWLSurface() {
|
||||
}
|
||||
|
||||
bool CWLSurface::exists() const {
|
||||
return m_pWLRSurface;
|
||||
return m_pResource;
|
||||
}
|
||||
|
||||
wlr_surface* CWLSurface::wlr() const {
|
||||
return m_pWLRSurface;
|
||||
SP<CWLSurfaceResource> CWLSurface::resource() const {
|
||||
return m_pResource.lock();
|
||||
}
|
||||
|
||||
bool CWLSurface::small() const {
|
||||
if (!validMapped(m_pWindowOwner) || !exists())
|
||||
return false;
|
||||
|
||||
if (!m_pResource->current.texture)
|
||||
return false;
|
||||
|
||||
const auto O = m_pWindowOwner.lock();
|
||||
|
||||
return O->m_vReportedSize.x > m_pWLRSurface->current.buffer_width + 1 || O->m_vReportedSize.y > m_pWLRSurface->current.buffer_height + 1;
|
||||
return O->m_vReportedSize.x > m_pResource->current.size.x + 1 || O->m_vReportedSize.y > m_pResource->current.size.y + 1;
|
||||
}
|
||||
|
||||
Vector2D CWLSurface::correctSmallVec() const {
|
||||
@@ -70,114 +75,120 @@ Vector2D CWLSurface::correctSmallVec() const {
|
||||
return Vector2D{(O->m_vReportedSize.x - SIZE.x) / 2, (O->m_vReportedSize.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY}) * (O->m_vRealSize.value() / O->m_vReportedSize);
|
||||
}
|
||||
|
||||
Vector2D CWLSurface::getViewporterCorrectedSize() const {
|
||||
if (!exists())
|
||||
Vector2D CWLSurface::correctSmallVecBuf() const {
|
||||
if (!exists() || !small() || m_bFillIgnoreSmall || !m_pResource->current.texture)
|
||||
return {};
|
||||
|
||||
return m_pWLRSurface->current.viewport.has_dst ? Vector2D{m_pWLRSurface->current.viewport.dst_width, m_pWLRSurface->current.viewport.dst_height} :
|
||||
Vector2D{m_pWLRSurface->current.buffer_width, m_pWLRSurface->current.buffer_height};
|
||||
const auto SIZE = getViewporterCorrectedSize();
|
||||
const auto BS = m_pResource->current.bufferSize;
|
||||
|
||||
return Vector2D{(BS.x - SIZE.x) / 2, (BS.y - SIZE.y) / 2}.clamp({}, {INFINITY, INFINITY});
|
||||
}
|
||||
|
||||
CRegion CWLSurface::logicalDamage() const {
|
||||
CRegion damage{&m_pWLRSurface->buffer_damage};
|
||||
damage.transform(m_pWLRSurface->current.transform, m_pWLRSurface->current.buffer_width, m_pWLRSurface->current.buffer_height);
|
||||
damage.scale(1.0 / m_pWLRSurface->current.scale);
|
||||
Vector2D CWLSurface::getViewporterCorrectedSize() const {
|
||||
if (!exists() || !m_pResource->current.texture)
|
||||
return {};
|
||||
|
||||
const auto VPSIZE = getViewporterCorrectedSize();
|
||||
const auto CORRECTVEC = correctSmallVec();
|
||||
|
||||
if (m_pWLRSurface->current.viewport.has_src) {
|
||||
damage.intersect(CBox{std::floor(m_pWLRSurface->current.viewport.src.x), std::floor(m_pWLRSurface->current.viewport.src.y),
|
||||
std::ceil(m_pWLRSurface->current.viewport.src.width), std::ceil(m_pWLRSurface->current.viewport.src.height)});
|
||||
return m_pResource->current.viewport.hasDestination ? m_pResource->current.viewport.destination : m_pResource->current.bufferSize;
|
||||
}
|
||||
|
||||
const auto SCALEDSRCSIZE = m_pWLRSurface->current.viewport.has_src ?
|
||||
Vector2D{m_pWLRSurface->current.viewport.src.width, m_pWLRSurface->current.viewport.src.height} * m_pWLRSurface->current.scale :
|
||||
Vector2D{m_pWLRSurface->current.buffer_width, m_pWLRSurface->current.buffer_height};
|
||||
CRegion CWLSurface::computeDamage() const {
|
||||
if (!m_pResource->current.texture)
|
||||
return {};
|
||||
|
||||
damage.scale({VPSIZE.x / SCALEDSRCSIZE.x, VPSIZE.y / SCALEDSRCSIZE.y});
|
||||
CRegion damage = m_pResource->accumulateCurrentBufferDamage();
|
||||
damage.transform(wlTransformToHyprutils(m_pResource->current.transform), m_pResource->current.bufferSize.x, m_pResource->current.bufferSize.y);
|
||||
|
||||
const auto BUFSIZE = m_pResource->current.bufferSize;
|
||||
const auto CORRECTVEC = correctSmallVecBuf();
|
||||
|
||||
if (m_pResource->current.viewport.hasSource)
|
||||
damage.intersect(m_pResource->current.viewport.source);
|
||||
|
||||
const auto SCALEDSRCSIZE = m_pResource->current.viewport.hasSource ? m_pResource->current.viewport.source.size() * m_pResource->current.scale : m_pResource->current.bufferSize;
|
||||
|
||||
damage.scale({BUFSIZE.x / SCALEDSRCSIZE.x, BUFSIZE.y / SCALEDSRCSIZE.y});
|
||||
damage.translate(CORRECTVEC);
|
||||
|
||||
// go from buffer coords in the damage to hl logical
|
||||
|
||||
const auto BOX = getSurfaceBoxGlobal();
|
||||
const Vector2D SCALE = BOX.has_value() ? BOX->size() / m_pResource->current.bufferSize :
|
||||
Vector2D{1.0 / m_pResource->current.scale, 1.0 / m_pResource->current.scale /* Wrong... but we can't really do better */};
|
||||
|
||||
damage.scale(SCALE);
|
||||
|
||||
if (m_pWindowOwner)
|
||||
damage.scale(m_pWindowOwner->m_fX11SurfaceScaledBy); // fix xwayland:force_zero_scaling stuff that will be fucked by the above a bit
|
||||
|
||||
return damage;
|
||||
}
|
||||
|
||||
void CWLSurface::destroy() {
|
||||
if (!m_pWLRSurface)
|
||||
if (!m_pResource)
|
||||
return;
|
||||
|
||||
events.destroy.emit();
|
||||
|
||||
m_pConstraint.reset();
|
||||
|
||||
hyprListener_destroy.removeCallback();
|
||||
hyprListener_commit.removeCallback();
|
||||
m_pWLRSurface->data = nullptr;
|
||||
listeners.destroy.reset();
|
||||
m_pResource->hlSurface.reset();
|
||||
m_pWindowOwner.reset();
|
||||
m_pLayerOwner.reset();
|
||||
m_pPopupOwner = nullptr;
|
||||
m_pSubsurfaceOwner = nullptr;
|
||||
m_bInert = true;
|
||||
|
||||
if (g_pCompositor && g_pCompositor->m_pLastFocus == m_pWLRSurface)
|
||||
g_pCompositor->m_pLastFocus = nullptr;
|
||||
if (g_pInputManager && g_pInputManager->m_pLastMouseSurface == m_pWLRSurface)
|
||||
g_pInputManager->m_pLastMouseSurface = nullptr;
|
||||
if (g_pHyprRenderer && g_pHyprRenderer->m_sLastCursorData.surf == m_pWLRSurface)
|
||||
if (g_pHyprRenderer && g_pHyprRenderer->m_sLastCursorData.surf && g_pHyprRenderer->m_sLastCursorData.surf->get() == this)
|
||||
g_pHyprRenderer->m_sLastCursorData.surf.reset();
|
||||
|
||||
m_pWLRSurface = nullptr;
|
||||
m_pResource.reset();
|
||||
|
||||
Debug::log(LOG, "CWLSurface {:x} called destroy()", (uintptr_t)this);
|
||||
}
|
||||
|
||||
static void onCommit(void* owner, void* data) {
|
||||
const auto SURF = (CWLSurface*)owner;
|
||||
SURF->onCommit();
|
||||
}
|
||||
|
||||
void CWLSurface::init() {
|
||||
if (!m_pWLRSurface)
|
||||
if (!m_pResource)
|
||||
return;
|
||||
|
||||
RASSERT(!m_pWLRSurface->data, "Attempted to duplicate CWLSurface ownership!");
|
||||
RASSERT(!m_pResource->hlSurface, "Attempted to duplicate CWLSurface ownership!");
|
||||
|
||||
m_pWLRSurface->data = this;
|
||||
m_pResource->hlSurface = self.lock();
|
||||
|
||||
hyprListener_destroy.initCallback(
|
||||
&m_pWLRSurface->events.destroy, [&](void* owner, void* data) { destroy(); }, this, "CWLSurface");
|
||||
hyprListener_commit.initCallback(&m_pWLRSurface->events.commit, ::onCommit, this, "CWLSurface");
|
||||
listeners.destroy = m_pResource->events.destroy.registerListener([this](std::any d) { destroy(); });
|
||||
|
||||
Debug::log(LOG, "CWLSurface {:x} called init()", (uintptr_t)this);
|
||||
}
|
||||
|
||||
PHLWINDOW CWLSurface::getWindow() {
|
||||
PHLWINDOW CWLSurface::getWindow() const {
|
||||
return m_pWindowOwner.lock();
|
||||
}
|
||||
|
||||
PHLLS CWLSurface::getLayer() {
|
||||
PHLLS CWLSurface::getLayer() const {
|
||||
return m_pLayerOwner.lock();
|
||||
}
|
||||
|
||||
CPopup* CWLSurface::getPopup() {
|
||||
CPopup* CWLSurface::getPopup() const {
|
||||
return m_pPopupOwner;
|
||||
}
|
||||
|
||||
CSubsurface* CWLSurface::getSubsurface() {
|
||||
CSubsurface* CWLSurface::getSubsurface() const {
|
||||
return m_pSubsurfaceOwner;
|
||||
}
|
||||
|
||||
bool CWLSurface::desktopComponent() {
|
||||
bool CWLSurface::desktopComponent() const {
|
||||
return !m_pLayerOwner.expired() || !m_pWindowOwner.expired() || m_pSubsurfaceOwner || m_pPopupOwner;
|
||||
}
|
||||
|
||||
std::optional<CBox> CWLSurface::getSurfaceBoxGlobal() {
|
||||
std::optional<CBox> CWLSurface::getSurfaceBoxGlobal() const {
|
||||
if (!desktopComponent())
|
||||
return {};
|
||||
|
||||
if (!m_pWindowOwner.expired())
|
||||
return m_pWindowOwner.lock()->getWindowMainSurfaceBox();
|
||||
return m_pWindowOwner->getWindowMainSurfaceBox();
|
||||
if (!m_pLayerOwner.expired())
|
||||
return m_pLayerOwner.lock()->geometry;
|
||||
return m_pLayerOwner->geometry;
|
||||
if (m_pPopupOwner)
|
||||
return CBox{m_pPopupOwner->coordsGlobal(), m_pPopupOwner->size()};
|
||||
if (m_pSubsurfaceOwner)
|
||||
@@ -186,14 +197,36 @@ std::optional<CBox> CWLSurface::getSurfaceBoxGlobal() {
|
||||
return {};
|
||||
}
|
||||
|
||||
void CWLSurface::appendConstraint(std::weak_ptr<CPointerConstraint> constraint) {
|
||||
void CWLSurface::appendConstraint(WP<CPointerConstraint> constraint) {
|
||||
m_pConstraint = constraint;
|
||||
}
|
||||
|
||||
void CWLSurface::onCommit() {
|
||||
;
|
||||
}
|
||||
|
||||
std::shared_ptr<CPointerConstraint> CWLSurface::constraint() {
|
||||
SP<CPointerConstraint> CWLSurface::constraint() const {
|
||||
return m_pConstraint.lock();
|
||||
}
|
||||
|
||||
bool CWLSurface::visible() {
|
||||
if (!m_pWindowOwner.expired())
|
||||
return g_pHyprRenderer->shouldRenderWindow(m_pWindowOwner.lock());
|
||||
if (!m_pLayerOwner.expired())
|
||||
return true;
|
||||
if (m_pPopupOwner)
|
||||
return m_pPopupOwner->visible();
|
||||
if (m_pSubsurfaceOwner)
|
||||
return m_pSubsurfaceOwner->visible();
|
||||
return true; // non-desktop, we don't know much.
|
||||
}
|
||||
|
||||
SP<CWLSurface> CWLSurface::fromResource(SP<CWLSurfaceResource> pSurface) {
|
||||
if (!pSurface)
|
||||
return nullptr;
|
||||
return pSurface->hlSurface.lock();
|
||||
}
|
||||
|
||||
bool CWLSurface::keyboardFocusable() const {
|
||||
if (m_pWindowOwner || m_pPopupOwner || m_pSubsurfaceOwner)
|
||||
return true;
|
||||
if (m_pLayerOwner && m_pLayerOwner->layerSurface)
|
||||
return m_pLayerOwner->layerSurface->current.interactivity != ZWLR_LAYER_SURFACE_V1_KEYBOARD_INTERACTIVITY_NONE;
|
||||
return false;
|
||||
}
|
||||
|
@@ -1,24 +1,29 @@
|
||||
#pragma once
|
||||
|
||||
#include "../defines.hpp"
|
||||
#include "../helpers/Region.hpp"
|
||||
#include "../helpers/math/Math.hpp"
|
||||
#include "../helpers/signal/Signal.hpp"
|
||||
|
||||
class CSubsurface;
|
||||
class CPopup;
|
||||
class CPointerConstraint;
|
||||
class CWLSurfaceResource;
|
||||
|
||||
class CWLSurface {
|
||||
public:
|
||||
CWLSurface() = default;
|
||||
static SP<CWLSurface> create() {
|
||||
auto p = SP<CWLSurface>(new CWLSurface);
|
||||
p->self = p;
|
||||
return p;
|
||||
}
|
||||
~CWLSurface();
|
||||
|
||||
// anonymous surfaces are non-desktop components, e.g. a cursor surface or a DnD
|
||||
void assign(wlr_surface* pSurface);
|
||||
void assign(wlr_surface* pSurface, PHLWINDOW pOwner);
|
||||
void assign(wlr_surface* pSurface, PHLLS pOwner);
|
||||
void assign(wlr_surface* pSurface, CSubsurface* pOwner);
|
||||
void assign(wlr_surface* pSurface, CPopup* pOwner);
|
||||
void assign(SP<CWLSurfaceResource> pSurface);
|
||||
void assign(SP<CWLSurfaceResource> pSurface, PHLWINDOW pOwner);
|
||||
void assign(SP<CWLSurfaceResource> pSurface, PHLLS pOwner);
|
||||
void assign(SP<CWLSurfaceResource> pSurface, CSubsurface* pOwner);
|
||||
void assign(SP<CWLSurfaceResource> pSurface, CPopup* pOwner);
|
||||
void unassign();
|
||||
|
||||
CWLSurface(const CWLSurface&) = delete;
|
||||
@@ -26,24 +31,26 @@ class CWLSurface {
|
||||
CWLSurface& operator=(const CWLSurface&) = delete;
|
||||
CWLSurface& operator=(CWLSurface&&) = delete;
|
||||
|
||||
wlr_surface* wlr() const;
|
||||
SP<CWLSurfaceResource> resource() const;
|
||||
bool exists() const;
|
||||
bool small() const; // means surface is smaller than the requested size
|
||||
Vector2D correctSmallVec() const; // returns a corrective vector for small() surfaces
|
||||
Vector2D correctSmallVecBuf() const; // returns a corrective vector for small() surfaces, in BL coords
|
||||
Vector2D getViewporterCorrectedSize() const;
|
||||
CRegion logicalDamage() const;
|
||||
void onCommit();
|
||||
CRegion computeDamage() const; // logical coordinates. May be wrong if the surface is unassigned
|
||||
bool visible();
|
||||
bool keyboardFocusable() const;
|
||||
|
||||
// getters for owners.
|
||||
PHLWINDOW getWindow();
|
||||
PHLLS getLayer();
|
||||
CPopup* getPopup();
|
||||
CSubsurface* getSubsurface();
|
||||
PHLWINDOW getWindow() const;
|
||||
PHLLS getLayer() const;
|
||||
CPopup* getPopup() const;
|
||||
CSubsurface* getSubsurface() const;
|
||||
|
||||
// desktop components misc utils
|
||||
std::optional<CBox> getSurfaceBoxGlobal();
|
||||
void appendConstraint(std::weak_ptr<CPointerConstraint> constraint);
|
||||
std::shared_ptr<CPointerConstraint> constraint();
|
||||
std::optional<CBox> getSurfaceBoxGlobal() const;
|
||||
void appendConstraint(WP<CPointerConstraint> constraint);
|
||||
SP<CPointerConstraint> constraint() const;
|
||||
|
||||
// allow stretching. Useful for plugins.
|
||||
bool m_bFillIgnoreSmall = false;
|
||||
@@ -54,31 +61,27 @@ class CWLSurface {
|
||||
wl_output_transform m_eLastTransform = (wl_output_transform)-1;
|
||||
|
||||
//
|
||||
CWLSurface& operator=(wlr_surface* pSurface) {
|
||||
CWLSurface& operator=(SP<CWLSurfaceResource> pSurface) {
|
||||
destroy();
|
||||
m_pWLRSurface = pSurface;
|
||||
m_pResource = pSurface;
|
||||
init();
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
bool operator==(const CWLSurface& other) const {
|
||||
return other.wlr() == wlr();
|
||||
return other.resource() == resource();
|
||||
}
|
||||
|
||||
bool operator==(const wlr_surface* other) const {
|
||||
return other == wlr();
|
||||
bool operator==(const SP<CWLSurfaceResource> other) const {
|
||||
return other == resource();
|
||||
}
|
||||
|
||||
explicit operator bool() const {
|
||||
return exists();
|
||||
}
|
||||
|
||||
static CWLSurface* surfaceFromWlr(wlr_surface* pSurface) {
|
||||
if (!pSurface)
|
||||
return nullptr;
|
||||
return (CWLSurface*)pSurface->data;
|
||||
}
|
||||
static SP<CWLSurface> fromResource(SP<CWLSurfaceResource> pSurface);
|
||||
|
||||
// used by the alpha-modifier protocol
|
||||
float m_pAlphaModifier = 1.F;
|
||||
@@ -87,10 +90,14 @@ class CWLSurface {
|
||||
CSignal destroy;
|
||||
} events;
|
||||
|
||||
WP<CWLSurface> self;
|
||||
|
||||
private:
|
||||
CWLSurface() = default;
|
||||
|
||||
bool m_bInert = true;
|
||||
|
||||
wlr_surface* m_pWLRSurface = nullptr;
|
||||
WP<CWLSurfaceResource> m_pResource;
|
||||
|
||||
PHLWINDOWREF m_pWindowOwner;
|
||||
PHLLSREF m_pLayerOwner;
|
||||
@@ -98,14 +105,15 @@ class CWLSurface {
|
||||
CSubsurface* m_pSubsurfaceOwner = nullptr;
|
||||
|
||||
//
|
||||
std::weak_ptr<CPointerConstraint> m_pConstraint;
|
||||
WP<CPointerConstraint> m_pConstraint;
|
||||
|
||||
void destroy();
|
||||
void init();
|
||||
bool desktopComponent();
|
||||
bool desktopComponent() const;
|
||||
|
||||
DYNLISTENER(destroy);
|
||||
DYNLISTENER(commit);
|
||||
struct {
|
||||
CHyprSignalListener destroy;
|
||||
} listeners;
|
||||
|
||||
friend class CPointerConstraint;
|
||||
};
|