mirror of
https://github.com/swaywm/sway.git
synced 2024-10-31 21:47:24 +00:00
Compare commits
620 commits
Author | SHA1 | Date | |
---|---|---|---|
d417a8fcd0 | |||
f38719f575 | |||
1e53007bc3 | |||
e7c972b04a | |||
839434abc0 | |||
015e357fce | |||
a63027245a | |||
17ecb9eb1d | |||
af0d4a048a | |||
7e0c0dda42 | |||
7d93652105 | |||
35d8adefc4 | |||
8363699f14 | |||
ce6b2db0f2 | |||
db76fefd0c | |||
dd063a0ef7 | |||
17e2e52c6d | |||
7f1cd0b73b | |||
f855b0898b | |||
c90cb37b2a | |||
9a9be01ad4 | |||
a2757e5f16 | |||
a0b3606f17 | |||
00e9a94152 | |||
63345977e2 | |||
cdff4f7c74 | |||
b73f54a966 | |||
b6da218974 | |||
861dde100a | |||
e9dd218231 | |||
74e507962e | |||
023f6b0a50 | |||
1537c9dae5 | |||
48069097ea | |||
266cd4515a | |||
e940acd374 | |||
9765c29be1 | |||
034d02f8a5 | |||
785a459a55 | |||
f957c7e658 | |||
d7a76d381b | |||
29b3f00e6f | |||
0496477f92 | |||
a0c0349934 | |||
fb5eadc363 | |||
c5ba7f23a5 | |||
f4a6b0395f | |||
14bff7b451 | |||
4f9ce4675c | |||
fc6b8d6af2 | |||
4fe054c6db | |||
cfb292cca7 | |||
af28ac04a4 | |||
6045ad9a02 | |||
b83e5aaa54 | |||
be840f730e | |||
980a4e0211 | |||
f2b2a81149 | |||
77b9ddabe2 | |||
f00f964abf | |||
7288f77bbe | |||
f9c0f043e5 | |||
ae7c1b139a | |||
c30c451907 | |||
c3279944fb | |||
5a3621460f | |||
6576b99c24 | |||
b44015578a | |||
9ba1beee58 | |||
f344e9d5a5 | |||
951a22c244 | |||
32e5e5232d | |||
3e956b9229 | |||
05e895c463 | |||
9a1c411abd | |||
b881c2e84c | |||
6e4ccb99c3 | |||
9bb45a4037 | |||
7e74a49142 | |||
4d4c88f0a7 | |||
3f327b3db0 | |||
a3a9ec1211 | |||
50073dc579 | |||
fc2796aee8 | |||
274a5fcb73 | |||
8c5b23e592 | |||
28fd73589d | |||
3d00552035 | |||
5be5a50051 | |||
818ea17389 | |||
d8c4a2d5fe | |||
fdcfe00781 | |||
5233a0bd2e | |||
a0a078f75e | |||
b04f4136bc | |||
e32bdaa7be | |||
4c3c060211 | |||
0386b2afcb | |||
dfbcd1fbaa | |||
4e38f93f36 | |||
1e0031781f | |||
5d237679f5 | |||
cdde0165da | |||
8f6bc5bb36 | |||
74cc02d60f | |||
fce8de0f67 | |||
5f15c5e91d | |||
cc34210769 | |||
40ca4150b2 | |||
2e9139df66 | |||
d0bd591ee7 | |||
df69367d92 | |||
700f4805bc | |||
a168b20299 | |||
9704152414 | |||
fd3b643d15 | |||
796898519b | |||
dcdb72757a | |||
30f5c3a911 | |||
b463957021 | |||
2686afb95c | |||
4c28916d68 | |||
ee5c4f38c9 | |||
646019cad9 | |||
ffcde7a70c | |||
087226d997 | |||
f11c5d562e | |||
1267e47de9 | |||
bc258a3be2 | |||
dcb142bf5e | |||
9e14651077 | |||
a4ef37752f | |||
26a9a6b479 | |||
c3fca26d30 | |||
9becff0ba5 | |||
56e97b7d60 | |||
3b419020a3 | |||
98be797356 | |||
923f642b70 | |||
3e03eb3a01 | |||
e2f3ebad8c | |||
125c74338a | |||
5a7477cb8f | |||
dc9f217307 | |||
9139da6149 | |||
3bc75221bc | |||
2b08e79061 | |||
2e951163c5 | |||
23389ebd1f | |||
3ef5abd405 | |||
4e6d7612ff | |||
f2a0e81b24 | |||
59f6292383 | |||
fd9ab9ee06 | |||
5e18ed3cf0 | |||
2058209a13 | |||
0b84d82b9a | |||
2867ef646b | |||
fca8474e9b | |||
469411d484 | |||
829c75b9c9 | |||
fc640d5f6c | |||
07b0598526 | |||
d6150b6bb0 | |||
7c11c463a3 | |||
d19810eba8 | |||
f6d22f8e68 | |||
541e6e260c | |||
ca40663d42 | |||
7a2ff7ba81 | |||
09c360d503 | |||
1846944f04 | |||
1dc661af17 | |||
1b5515400d | |||
88b2abf5f2 | |||
93d391651c | |||
f7a0f06dff | |||
ecfef1348a | |||
6b2aa83246 | |||
88e99fa84f | |||
ba427a469a | |||
c8676fad54 | |||
e39b0b816b | |||
f202bc84d2 | |||
a4e85332a1 | |||
e8c421e917 | |||
2c2625acd3 | |||
08a06a7b6b | |||
ae33f4eb37 | |||
5fc85c5066 | |||
7c635b61fe | |||
bab6b79af2 | |||
9da295c11f | |||
09e11dabb2 | |||
2e53de80bb | |||
5f0801b6f2 | |||
1e018e72b4 | |||
06ad734e70 | |||
ed2724bd6c | |||
6e5fc4c2aa | |||
b38ed8b479 | |||
08c484f46f | |||
6d7b1321db | |||
188811f808 | |||
5b8b505af5 | |||
946fc80945 | |||
869baff252 | |||
bac3ab5526 | |||
9a57966606 | |||
0639bde9fb | |||
c640c3015f | |||
9c17cba0b2 | |||
0e1a02bf0a | |||
1b09238645 | |||
1eb16d1367 | |||
dbd2fbf430 | |||
b4d7e84d38 | |||
2c69e19fd3 | |||
8d1b0cecd9 | |||
904d256581 | |||
c5fd8c050f | |||
7e69a7076f | |||
fa294a9094 | |||
95265fba59 | |||
0aceff7469 | |||
64d644f0da | |||
22d0dd8bde | |||
bbabb9aae8 | |||
c6edbb7e5a | |||
e8a0205607 | |||
607b8aed0c | |||
7ad8c80bfe | |||
dbd70faf2e | |||
a6ef12d968 | |||
ff07eab85b | |||
b81c4da494 | |||
255ff665c5 | |||
bf2b79b284 | |||
ae3acf26f8 | |||
f12023b1a2 | |||
2cd73a33c2 | |||
bc7d15d64d | |||
e633fe0b40 | |||
439122e887 | |||
39b9c0d6ba | |||
47e6a1164c | |||
128b6253a9 | |||
fd6d6f1d97 | |||
a946b1aecf | |||
4ad15a4015 | |||
bff991dfdc | |||
9d666a08e1 | |||
072fa60cb4 | |||
5bdd608514 | |||
86f96a786b | |||
c3ec141b34 | |||
f7a40cfa2f | |||
5c99b98805 | |||
7036769bea | |||
caa92ddee8 | |||
01dcad80e1 | |||
020a572ed6 | |||
6f6b82793d | |||
f2425b4fd6 | |||
647521244a | |||
47263aca28 | |||
0dfaf7ea63 | |||
f2425b5163 | |||
4326a26ad6 | |||
8a8fb76ec1 | |||
7cf4e1d5c6 | |||
b3519c2d2f | |||
68caa8deba | |||
8edc48f6dd | |||
d952ce403e | |||
3dd2f4a67f | |||
89f8531268 | |||
3d5ae9813d | |||
60a94b4916 | |||
bf44690ee8 | |||
4a2210577c | |||
d84b3832f4 | |||
a908651821 | |||
363c57984d | |||
bb91b7f5fa | |||
eebbecc780 | |||
f8ddd97e0e | |||
170598d71b | |||
d3626efe5e | |||
d557b6876b | |||
df8aad9c5a | |||
f436de9200 | |||
6bd11ad0df | |||
dc634c4a13 | |||
c3e6390073 | |||
ee4637b086 | |||
a34d785a26 | |||
9107907969 | |||
6c234d013a | |||
fc16fb6549 | |||
92244c87db | |||
20ffe545ba | |||
20c91335f6 | |||
974a8629a8 | |||
7fbd9fbf28 | |||
b762f455d9 | |||
5411ed4ef0 | |||
6f1a3b6652 | |||
876687000d | |||
c08762901e | |||
8b4b65d665 | |||
59c27c94d3 | |||
be14cd96cd | |||
6a1c176d14 | |||
65b1a6964c | |||
f3b8c9feee | |||
b1b3563d54 | |||
913a7679cb | |||
7ab8cb2ee6 | |||
b5cb49bce9 | |||
c001a57e8b | |||
c9e1dab318 | |||
72881b5d12 | |||
48d6eda3cb | |||
01b0c11394 | |||
19cc36accc | |||
0a951517ae | |||
393c29fc59 | |||
a79994e119 | |||
3cd7c71780 | |||
e8f7551e46 | |||
db7638a0e5 | |||
029b99b482 | |||
07cdf6ccd0 | |||
d5cc474aef | |||
33cfdbe886 | |||
08c1946d71 | |||
ac8962eb62 | |||
ea279f4df3 | |||
96cebb4fe6 | |||
a7b50f6c9c | |||
d6915f6428 | |||
bd58df61ef | |||
aab4c9da5f | |||
4118c49349 | |||
fcec581748 | |||
04904ab9a5 | |||
8d95638df6 | |||
63f9bdf001 | |||
ab4f460597 | |||
777df22377 | |||
5e847fe3c8 | |||
dadf3e9b78 | |||
e8fb7f53b8 | |||
fa7b686e61 | |||
9cf66e8c7c | |||
5d5b21dcce | |||
dee032d0a0 | |||
6701b90c55 | |||
4f6e559dec | |||
ac1ed638e9 | |||
f21090f978 | |||
90c2d631e2 | |||
ebeed7e303 | |||
51c9376c07 | |||
b28e1b0d3c | |||
b757ef94ef | |||
d63497698b | |||
9498e4d261 | |||
16b0afd433 | |||
c2ccc0c9d4 | |||
d6cb4fa8de | |||
423459723b | |||
4666d1785b | |||
7d2e4a5106 | |||
7a6c7d60d5 | |||
633d409b88 | |||
788118f194 | |||
9162b536f6 | |||
1cab17ada2 | |||
8e4b659578 | |||
fadfbe8dba | |||
1b27e8c8fd | |||
b4ce0a30c1 | |||
7d0351b411 | |||
4cda9ee3a3 | |||
dbc1eec850 | |||
842609da64 | |||
0780d3a465 | |||
0695f3fa2a | |||
f22d4dbab7 | |||
412b80983e | |||
9959e6b8dc | |||
b31e97e55d | |||
ae2d14ceeb | |||
40eb29e7c5 | |||
2e33b0276f | |||
ab9b164e52 | |||
2c0f68b7c6 | |||
36f627d0fa | |||
a7b9f6fedc | |||
6a3e265326 | |||
d5b69d5912 | |||
284966fd57 | |||
53c9a4a643 | |||
5e73acb431 | |||
2f2cdd60de | |||
3061999ec5 | |||
88c17ece3b | |||
714559812e | |||
9425ce2fba | |||
d8212243c9 | |||
6ec57271b6 | |||
9540591105 | |||
e3257e646c | |||
9e15e2fd4f | |||
0c23b0ec33 | |||
bd7466e1b7 | |||
fd0af78e43 | |||
1ade0ce753 | |||
e3c63bf58d | |||
fbf9191fb8 | |||
efd83cb8b9 | |||
991d75904f | |||
de3e6a0da0 | |||
c32a507303 | |||
e1b268af98 | |||
6b3245ac77 | |||
aa03a8fcb5 | |||
3bd657c726 | |||
e1d457c824 | |||
d41f11e6bd | |||
a358d6760e | |||
dca0bb5749 | |||
f54d22ca2a | |||
e62299daa4 | |||
46170580b2 | |||
e795ea6a0c | |||
5b64e2fc31 | |||
456f49db35 | |||
81518e299c | |||
37e4a3d637 | |||
94b69acf0d | |||
53f9dbd424 | |||
28fda4c0d3 | |||
30ad4dc4a5 | |||
bdeb9f9565 | |||
66568508c0 | |||
864b3a9a18 | |||
d75c9f9722 | |||
bd66f4943d | |||
3b49f2782e | |||
1c4b94ae3c | |||
eb5021ef99 | |||
af8a5a8918 | |||
e5475d9310 | |||
5be5a038da | |||
366f6ef3d3 | |||
e2bc8866f4 | |||
7623292734 | |||
717e9ef581 | |||
907ca48a61 | |||
024c3e4428 | |||
e1be46875d | |||
85005b52fe | |||
34933bb843 | |||
fdde67405e | |||
5c239eaac5 | |||
d945c8f519 | |||
7862fa670e | |||
dcd2076f38 | |||
6c3b35701d | |||
3e19836f0e | |||
e40eb338b9 | |||
0fdeb4ca84 | |||
7cc8ab6d6c | |||
a61815d385 | |||
8aa89dc277 | |||
8f7bb145b7 | |||
9d99bb956f | |||
5e514e6474 | |||
9400bd963c | |||
99fd096d69 | |||
7a6afc5199 | |||
c7bced9329 | |||
09354db878 | |||
99acdb4e62 | |||
be7707874a | |||
e2bb5799af | |||
d5659948f1 | |||
07c827b4be | |||
b00b05f792 | |||
04f8a655e7 | |||
78b5c0a77e | |||
f70d1e1b95 | |||
b0fc83485d | |||
cffb006feb | |||
52f0e3a4d5 | |||
c015db4a9f | |||
1c368fbb5f | |||
07bfeb2abc | |||
aaa6c4ac89 | |||
6e023257e8 | |||
ebf441b359 | |||
89d73beedb | |||
9e879242fd | |||
a5a44ba95b | |||
e98b97a45b | |||
6b97c4fa71 | |||
8d8a21c9c3 | |||
b69d637f7a | |||
798e3c8858 | |||
11e05c5711 | |||
80e386fd97 | |||
75605491a5 | |||
9e8866ae20 | |||
a55472c6d8 | |||
445bc2a943 | |||
122d8ce954 | |||
49cef51e6e | |||
1c69d0e72f | |||
956b689d6a | |||
e5728052b5 | |||
251a648e2c | |||
a5c2e9fee0 | |||
cab2189aa6 | |||
a535ed310f | |||
6a59e38aeb | |||
26a0e97634 | |||
d0b9bf94a5 | |||
f0d57da315 | |||
42b61ab27a | |||
75b2d0b105 | |||
a3a82efbf6 | |||
3f600565e4 | |||
ffc603d451 | |||
28941cee20 | |||
1e9be019b2 | |||
7cfa150788 | |||
c85d9af2b6 | |||
e8028be839 | |||
5d924f2b12 | |||
a7898637de | |||
519038a7e9 | |||
70d30ac72b | |||
3caf6914fe | |||
a5f01a0e04 | |||
2dace6b824 | |||
acdb48a59c | |||
d726e50643 | |||
cf413b9c0b | |||
20181974c2 | |||
09553a7b5b | |||
8f036b6f78 | |||
fb3330c1fb | |||
6c4c0387a2 | |||
ca016689a0 | |||
440d0bc22d | |||
49b3ac9a2c | |||
0345148ea6 | |||
1e79088a72 | |||
78758ef369 | |||
20729a6a5e | |||
4780afb68b | |||
0babfce4b5 | |||
f167acce3a | |||
3dffe7f3a6 | |||
dd8b6f5e68 | |||
f614f35e73 | |||
04676936e7 | |||
9f98c38d3e | |||
3444ce7302 | |||
d6f279902a | |||
061ffc30ea | |||
0ee54a5243 | |||
b38b845c63 | |||
85d1c98476 | |||
f8990523b4 | |||
f707f583e1 | |||
ac7892371c | |||
9a6687ee04 | |||
f795aa1c95 | |||
5c00f1f113 | |||
01706f7c90 | |||
c256fd4743 | |||
3a75b4a6a8 | |||
36f5467993 | |||
30d27b5996 | |||
ee7668c1f2 | |||
69b430201c | |||
518e18a54b | |||
cd1ee0e172 | |||
8ca2847b42 | |||
feea4b4410 | |||
b4fd4bca0e | |||
a1905c6a08 | |||
e4909ab4a3 | |||
b2ee964434 | |||
7d1ccafae5 | |||
fd53f80156 | |||
0ffd8178fe | |||
d6f8820a8b | |||
dbaf2e4fdb | |||
aa443629b5 | |||
e1db1f8218 | |||
470e04e8da | |||
6cb69a40c7 | |||
e2b4c573d6 | |||
1bf1d84b75 | |||
f92329701b | |||
107d15fafd | |||
bb60381c75 | |||
921b0a8633 | |||
b8995ced8f | |||
eaeb173a4b | |||
59aebaa5f9 | |||
414950bbc8 | |||
513fa00a5e | |||
d9ce781d4c | |||
17ee30d070 |
|
@ -4,6 +4,8 @@ packages:
|
||||||
- eudev-dev
|
- eudev-dev
|
||||||
- gdk-pixbuf-dev
|
- gdk-pixbuf-dev
|
||||||
- json-c-dev
|
- json-c-dev
|
||||||
|
- lcms2-dev
|
||||||
|
- libdisplay-info-dev
|
||||||
- libevdev-dev
|
- libevdev-dev
|
||||||
- libinput-dev
|
- libinput-dev
|
||||||
- libseat-dev
|
- libseat-dev
|
||||||
|
@ -12,13 +14,15 @@ packages:
|
||||||
- mesa-dev
|
- mesa-dev
|
||||||
- meson
|
- meson
|
||||||
- pango-dev
|
- pango-dev
|
||||||
|
- pcre2-dev
|
||||||
- pixman-dev
|
- pixman-dev
|
||||||
- scdoc
|
- scdoc
|
||||||
- wayland-dev
|
- wayland-dev
|
||||||
- wayland-protocols
|
- wayland-protocols
|
||||||
- xcb-util-image-dev
|
- xcb-util-image-dev
|
||||||
- xcb-util-wm-dev
|
- xcb-util-wm-dev
|
||||||
- xwayland
|
- xwayland-dev
|
||||||
|
- hwdata-dev
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||||
|
@ -35,9 +39,14 @@ tasks:
|
||||||
cd sway
|
cd sway
|
||||||
ninja -C build
|
ninja -C build
|
||||||
- build-no-xwayland: |
|
- build-no-xwayland: |
|
||||||
cd sway
|
cd wlroots
|
||||||
meson configure build -Dxwayland=disabled
|
meson configure build -Dxwayland=disabled
|
||||||
ninja -C build
|
ninja -C build
|
||||||
|
sudo ninja -C build install
|
||||||
|
|
||||||
|
cd ../sway
|
||||||
|
meson configure build --clearcache
|
||||||
|
ninja -C build
|
||||||
- build-static: |
|
- build-static: |
|
||||||
cd sway
|
cd sway
|
||||||
mkdir subprojects
|
mkdir subprojects
|
||||||
|
|
|
@ -3,12 +3,15 @@ packages:
|
||||||
- cairo
|
- cairo
|
||||||
- gdk-pixbuf2
|
- gdk-pixbuf2
|
||||||
- json-c
|
- json-c
|
||||||
|
- lcms2
|
||||||
|
- libdisplay-info
|
||||||
- libegl
|
- libegl
|
||||||
- libinput
|
- libinput
|
||||||
- libxcb
|
- libxcb
|
||||||
- libxkbcommon
|
- libxkbcommon
|
||||||
- meson
|
- meson
|
||||||
- pango
|
- pango
|
||||||
|
- pcre2
|
||||||
- scdoc
|
- scdoc
|
||||||
- wayland
|
- wayland
|
||||||
- wayland-protocols
|
- wayland-protocols
|
||||||
|
@ -16,6 +19,7 @@ packages:
|
||||||
- xcb-util-wm
|
- xcb-util-wm
|
||||||
- xorg-xwayland
|
- xorg-xwayland
|
||||||
- seatd
|
- seatd
|
||||||
|
- hwdata
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||||
|
|
|
@ -4,9 +4,11 @@ packages:
|
||||||
- devel/json-c
|
- devel/json-c
|
||||||
- devel/libevdev
|
- devel/libevdev
|
||||||
- devel/meson
|
- devel/meson
|
||||||
|
- devel/pcre2
|
||||||
- devel/pkgconf
|
- devel/pkgconf
|
||||||
- graphics/cairo
|
- graphics/cairo
|
||||||
- graphics/gdk-pixbuf2
|
- graphics/gdk-pixbuf2
|
||||||
|
- graphics/lcms2
|
||||||
- graphics/wayland
|
- graphics/wayland
|
||||||
- graphics/wayland-protocols
|
- graphics/wayland-protocols
|
||||||
- textproc/scdoc
|
- textproc/scdoc
|
||||||
|
@ -19,11 +21,14 @@ packages:
|
||||||
- devel/libudev-devd
|
- devel/libudev-devd
|
||||||
- graphics/libdrm
|
- graphics/libdrm
|
||||||
- graphics/mesa-libs
|
- graphics/mesa-libs
|
||||||
|
- sysutils/libdisplay-info
|
||||||
- sysutils/seatd
|
- sysutils/seatd
|
||||||
- x11/libinput
|
- x11/libinput
|
||||||
- x11/libX11
|
- x11/libX11
|
||||||
- x11/pixman
|
- x11/pixman
|
||||||
- x11/xcb-util-wm
|
- x11/xcb-util-wm
|
||||||
|
- x11-servers/xwayland
|
||||||
|
- misc/hwdata
|
||||||
sources:
|
sources:
|
||||||
- https://github.com/swaywm/sway
|
- https://github.com/swaywm/sway
|
||||||
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
- https://gitlab.freedesktop.org/wlroots/wlroots.git
|
||||||
|
|
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -6,6 +6,7 @@ bin/
|
||||||
test/
|
test/
|
||||||
build/
|
build/
|
||||||
build-*/
|
build-*/
|
||||||
|
.cache/
|
||||||
.lvimrc
|
.lvimrc
|
||||||
config-debug
|
config-debug
|
||||||
wayland-*-protocol.*
|
wayland-*-protocol.*
|
||||||
|
|
91
README.ar.md
Normal file
91
README.ar.md
Normal file
|
@ -0,0 +1,91 @@
|
||||||
|
# sway
|
||||||
|
|
||||||
|
sway
|
||||||
|
|
||||||
|
هو مدير للمجموعات المركبة لـ[Wayland] متوافق مع [i3] -
|
||||||
|
|
||||||
|
إقرأ [الأسئلة الشائعة](https://github.com/swaywm/sway/wiki)
|
||||||
|
|
||||||
|
انضم الى [قناة IRC](https://web.libera.chat/gamja/?channels=#sway)
|
||||||
|
|
||||||
|
|
||||||
|
## تواقيع الإصدار
|
||||||
|
تٌوقع الإصدارات بـواسطة [E88F5E48] و تُنشر على [GitHub](https://github.com/swaywm/sway/releases)
|
||||||
|
|
||||||
|
## التثبيت
|
||||||
|
|
||||||
|
### بإستخدام الحزم
|
||||||
|
|
||||||
|
يتوفر Sway للعديد من التوزيعات، حاول تثبيت حزمة "sway" لتوزيعتك
|
||||||
|
### التجميع من المصدر
|
||||||
|
إطلع على [صفحة الويكي هذه](https://github.com/swaywm/sway/wiki/Development-Setup) إذا أردت بناء الـHEAD من sway و wlroots لأغراض الفحص والتطوير
|
||||||
|
|
||||||
|
تثبيت اللوازم:
|
||||||
|
* meson \*
|
||||||
|
* [wlroots]
|
||||||
|
* wayland
|
||||||
|
* wayland-protocols \*
|
||||||
|
* pcre2
|
||||||
|
* json-c
|
||||||
|
* pango
|
||||||
|
* cairo
|
||||||
|
* gdk-pixbuf2 (optional: system tray)
|
||||||
|
* [scdoc] (optional: man pages) \*
|
||||||
|
* git (optional: version info) \*
|
||||||
|
|
||||||
|
_\* Compile-time dep_
|
||||||
|
|
||||||
|
نفذ هذه الأوامر:
|
||||||
|
|
||||||
|
meson build/
|
||||||
|
ninja -C build/
|
||||||
|
sudo ninja -C build/ install
|
||||||
|
|
||||||
|
## الإعدادات
|
||||||
|
|
||||||
|
إذا كنت بالفعل تستخدم i3، فعليك نسخ إعدادات i3 لديك إلى `~/.config/sway/config` وسوف تعمل تلقائياً.
|
||||||
|
|
||||||
|
و إلا عليك نسخ ملف الإعدادات النموذج إلى `config/sway/config` الموجود عادةً في `/etc/sway/config.`
|
||||||
|
|
||||||
|
|
||||||
|
## التشغيل
|
||||||
|
|
||||||
|
شغل `sway` بإستخدام أمر TTY.
|
||||||
|
قد يعمل بعض مدراء العرض مع أنهم غير مدعومون من sway
|
||||||
|
(gdm مثلاً يعمل بشكل جيد إلى حد ما)
|
||||||
|
|
||||||
|
[en]: https://github.com/swaywm/sway#readme
|
||||||
|
[ar]: README.ar.md
|
||||||
|
[cs]: README.cs.md
|
||||||
|
[de]: README.de.md
|
||||||
|
[dk]: README.dk.md
|
||||||
|
[es]: README.es.md
|
||||||
|
[fr]: README.fr.md
|
||||||
|
[ge]: README.ge.md
|
||||||
|
[gr]: README.gr.md
|
||||||
|
[hi]: README.hi.md
|
||||||
|
[hu]: README.hu.md
|
||||||
|
[ir]: README.ir.md
|
||||||
|
[it]: README.it.md
|
||||||
|
[ja]: README.ja.md
|
||||||
|
[ko]: README.ko.md
|
||||||
|
[nl]: README.nl.md
|
||||||
|
[no]: README.no.md
|
||||||
|
[pl]: README.pl.md
|
||||||
|
[pt]: README.pt.md
|
||||||
|
[ro]: README.ro.md
|
||||||
|
[ru]: README.ru.md
|
||||||
|
[sv]: README.sv.md
|
||||||
|
[tr]: README.tr.md
|
||||||
|
[uk]: README.uk.md
|
||||||
|
[zh-CN]: README.zh-CN.md
|
||||||
|
[zh-TW]: README.zh-TW.md
|
||||||
|
[i3]: https://i3wm.org/
|
||||||
|
[Wayland]: http://wayland.freedesktop.org/
|
||||||
|
[FAQ]: https://github.com/swaywm/sway/wiki
|
||||||
|
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
|
||||||
|
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||||
|
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||||
|
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||||
|
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||||
|
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
92
README.cs.md
Normal file
92
README.cs.md
Normal file
|
@ -0,0 +1,92 @@
|
||||||
|
# sway
|
||||||
|
|
||||||
|
sway je s [i3] kompatibilní [Wayland] kompozitor. Přečtěte si [FAQ]. Připojte se na
|
||||||
|
[IRC kanál][IRC channel] \(#sway na irc.libera.chat).
|
||||||
|
|
||||||
|
## Podpisy vydání
|
||||||
|
|
||||||
|
Vydání jsou podepsána [E88F5E48] a publikována [na GitHubu][GitHub releases].
|
||||||
|
|
||||||
|
## Instalace
|
||||||
|
|
||||||
|
### Z balíčků
|
||||||
|
|
||||||
|
Sway je dostupný ve spoustě distribucí. Zkuste nainstalovat balíček "sway" ve vaší
|
||||||
|
distribuci.
|
||||||
|
|
||||||
|
### Kompilace ze zdrojových kódů
|
||||||
|
|
||||||
|
Podívejte se na [tuto stránku wiki][Development setup], pokud chcete sestavit HEAD
|
||||||
|
sway a wlroots pro testování nebo vývoj.
|
||||||
|
|
||||||
|
Nainstalujte závislosti:
|
||||||
|
|
||||||
|
* meson \*
|
||||||
|
* [wlroots]
|
||||||
|
* wayland
|
||||||
|
* wayland-protocols \*
|
||||||
|
* pcre2
|
||||||
|
* json-c
|
||||||
|
* pango
|
||||||
|
* cairo
|
||||||
|
* gdk-pixbuf2 (volitelné: oznamovací oblast)
|
||||||
|
* [swaybg] (volitelné: tapeta)
|
||||||
|
* [scdoc] (volitelné: manuálové stránky) \*
|
||||||
|
* git (volitelné: informace o verzi) \*
|
||||||
|
|
||||||
|
_\* Závislost pouze pro kompilaci_
|
||||||
|
|
||||||
|
Spusťte tyto příkazy:
|
||||||
|
|
||||||
|
meson build/
|
||||||
|
ninja -C build/
|
||||||
|
sudo ninja -C build/ install
|
||||||
|
|
||||||
|
## Konfigurace
|
||||||
|
|
||||||
|
Pokud již používáte i3, zkopírujte svou konfiguraci i3 do `~/.config/sway/config`
|
||||||
|
a ta bude ihned fungovat. Jinak zkopírujte do `~/.config/sway/config` ukázkový
|
||||||
|
konfigurační soubor. Ten se obvykle nachází v `/etc/sway/config`.
|
||||||
|
Pro více informací o konfiguraci spusťte `man 5 sway`.
|
||||||
|
|
||||||
|
## Spuštění
|
||||||
|
|
||||||
|
Spusťte `sway` z TTY. Některé správce zobrazení mohou fungovat, ale nejsou
|
||||||
|
podporovány sway (je známo, že gdm funguje docela dobře).
|
||||||
|
|
||||||
|
[en]: https://github.com/swaywm/sway#readme
|
||||||
|
[ar]: README.ar.md
|
||||||
|
[cs]: README.cs.md
|
||||||
|
[de]: README.de.md
|
||||||
|
[dk]: README.dk.md
|
||||||
|
[es]: README.es.md
|
||||||
|
[fr]: README.fr.md
|
||||||
|
[ge]: README.ge.md
|
||||||
|
[gr]: README.gr.md
|
||||||
|
[hi]: README.hi.md
|
||||||
|
[hu]: README.hu.md
|
||||||
|
[ir]: README.ir.md
|
||||||
|
[it]: README.it.md
|
||||||
|
[ja]: README.ja.md
|
||||||
|
[ko]: README.ko.md
|
||||||
|
[nl]: README.nl.md
|
||||||
|
[no]: README.no.md
|
||||||
|
[pl]: README.pl.md
|
||||||
|
[pt]: README.pt.md
|
||||||
|
[ro]: README.ro.md
|
||||||
|
[ru]: README.ru.md
|
||||||
|
[sv]: README.sv.md
|
||||||
|
[tr]: README.tr.md
|
||||||
|
[uk]: README.uk.md
|
||||||
|
[zh-CN]: README.zh-CN.md
|
||||||
|
[zh-TW]: README.zh-TW.md
|
||||||
|
[i3]: https://i3wm.org/
|
||||||
|
[Wayland]: http://wayland.freedesktop.org/
|
||||||
|
[FAQ]: https://github.com/swaywm/sway/wiki
|
||||||
|
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
|
||||||
|
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||||
|
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||||
|
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||||
|
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||||
|
[swaybg]: https://github.com/swaywm/swaybg/
|
||||||
|
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
20
README.de.md
20
README.de.md
|
@ -2,13 +2,13 @@
|
||||||
Sway ist ein [i3](https://i3wm.org/)-kompatibler [Wayland](http://wayland.freedesktop.org/)-Compositor. Lies die [FAQ](https://github.com/swaywm/sway/wiki). Tritt dem [IRC Channel](https://web.libera.chat/gamja/?channels=#sway) bei (#sway on irc.libera.chat; Englisch).
|
Sway ist ein [i3](https://i3wm.org/)-kompatibler [Wayland](http://wayland.freedesktop.org/)-Compositor. Lies die [FAQ](https://github.com/swaywm/sway/wiki). Tritt dem [IRC Channel](https://web.libera.chat/gamja/?channels=#sway) bei (#sway on irc.libera.chat; Englisch).
|
||||||
|
|
||||||
## Signaturen
|
## Signaturen
|
||||||
Jedes Release wird mit dem PGP-Schlüssel [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48) signiert und auf GitHub veröffentlicht.
|
Jedes Release wird mit dem PGP-Schlüssel [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48) signiert und [auf GitHub](https://github.com/swaywm/sway/releases) veröffentlicht.
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
### Mit der Paketverwaltung
|
|
||||||
Sway kann in vielen Distributionen direkt durch die Paketverwaltung installiert werden. Das Paket sollte "sway" heißen. Falls es kein solches Paket gibt, kannst du im [Wiki](https://github.com/swaywm/sway/wiki/Unsupported-packages) (englisch) nach mehr Informationen bezüglich deiner Distribution suchen.
|
|
||||||
|
|
||||||
Falls du sway für deine eigene Distribution als Paket bereitstellen möchtest, solltest du die Entwickler per IRC oder E-Mail (sir@cmpwn.com) kontaktieren.
|
### Über die Paketverwaltung
|
||||||
|
|
||||||
|
Sway kann in vielen Distributionen direkt durch die Paketverwaltung installiert werden. Versuche einfach das Packet "sway" zu installieren.
|
||||||
|
|
||||||
### Quellcode selbst kompilieren
|
### Quellcode selbst kompilieren
|
||||||
|
|
||||||
|
@ -18,13 +18,13 @@ sway benötigt die folgenden Pakete:
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols\*
|
* wayland-protocols\*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
* gdk-pixbuf2 (Optional, wird für das Benachrichtigungsfeld (System Tray) benötigt)
|
* gdk-pixbuf2 (Optional, wird für das Benachrichtigungsfeld (System Tray) benötigt)
|
||||||
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc)\* (Optional, wird für die Dokumentation (Man Pages) benötigt)
|
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (Optional, wird für die Dokumentation (Man Pages) benötigt)\*
|
||||||
* git\*
|
* git (Optional: Versionsinfo)\*
|
||||||
|
|
||||||
_\*Werden nur während des Kompilierens benötigt_
|
_\*Werden nur während des Kompilierens benötigt_
|
||||||
|
|
||||||
|
@ -34,12 +34,6 @@ Führe die folgenden Befehle aus:
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
Falls dein System nicht logind benutzt, musst du sway noch die passenden Berechtigungen geben:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway läuft nur in der Startphase mit Root-Rechten.
|
|
||||||
|
|
||||||
## Konfiguration
|
## Konfiguration
|
||||||
|
|
||||||
Falls du von i3 migrierst, kannst du deine Konfigurationsdatei nach `~/.config/sway/config` kopieren und die Einstellungen sollten ohne Weiteres funktionieren. Ansonsten kannst du die Beispielkonfiguration, die normalerweise in `/etc/sway/config` liegt, nach `~/.config/sway/config` kopieren. Die Dokumentation zur Konfigurationsdatei findest du in `man 5 sway`.
|
Falls du von i3 migrierst, kannst du deine Konfigurationsdatei nach `~/.config/sway/config` kopieren und die Einstellungen sollten ohne Weiteres funktionieren. Ansonsten kannst du die Beispielkonfiguration, die normalerweise in `/etc/sway/config` liegt, nach `~/.config/sway/config` kopieren. Die Dokumentation zur Konfigurationsdatei findest du in `man 5 sway`.
|
||||||
|
|
|
@ -29,7 +29,7 @@ Installationsafhængigheder:
|
||||||
* [wlroots]
|
* [wlroots]
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -45,12 +45,6 @@ Kør følgende kommandoer:
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
På systemer uden logind eller seatd skal du sætte SUID bit på sway filen:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway dropper 'root' tilladelser kort efter opstart.
|
|
||||||
|
|
||||||
## Konfiguration
|
## Konfiguration
|
||||||
|
|
||||||
Hvis du allerede bruger i3 kan du bare kopiere din i3 konfiguration til
|
Hvis du allerede bruger i3 kan du bare kopiere din i3 konfiguration til
|
||||||
|
|
|
@ -28,7 +28,7 @@ Instale las dependencias:
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -44,12 +44,6 @@ Desde su consola, ejecute las órdenes:
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
En sistemas sin `logind`, necesitará cambiar los permisos del archivo compilado de sway:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway abandonará los permisos de super-usuario al poco de arrancar.
|
|
||||||
|
|
||||||
## Configuración
|
## Configuración
|
||||||
|
|
||||||
Si ya utiliza i3, copie su archivo de configuración de i3 a `~/.config/sway/config` y
|
Si ya utiliza i3, copie su archivo de configuración de i3 a `~/.config/sway/config` y
|
||||||
|
|
|
@ -35,7 +35,7 @@ Installez les dépendances :
|
||||||
* [wlroots]
|
* [wlroots]
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -51,12 +51,6 @@ Exécutez ces commandes :
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
Sur les systèmes sans logind, vous devez suid le binaire de sway :
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway se débarassera des permissions *root* peu de temps après le démarrage.
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Si vous utilisez déjà i3, copiez votre configuration i3 vers
|
Si vous utilisez déjà i3, copiez votre configuration i3 vers
|
||||||
|
|
61
README.ge.md
Normal file
61
README.ge.md
Normal file
|
@ -0,0 +1,61 @@
|
||||||
|
# sway
|
||||||
|
|
||||||
|
sway არის [i3]-თავსებადი [Wayland]-ის კომპოზიტორი. მეტი ინფორმაციისთვის იხილეთ
|
||||||
|
[FAQ]. დაუკავშირდით [IRC არხს][IRC channel] \(#sway irc.libera.chat-ზე).
|
||||||
|
|
||||||
|
## გამოშვების ხელმოწერები
|
||||||
|
|
||||||
|
გამოშვებები ხელმოწერილია [E88F5E48]-ით და გამოქვეყნებულია [GitHub-ზე][GitHub releases].
|
||||||
|
|
||||||
|
## ინსტალაცია
|
||||||
|
|
||||||
|
### რეპოზიტორიიდან
|
||||||
|
|
||||||
|
Sway არის ხელმისაწვდომი ბევრი დისტრიბუტაციისთვის. ცადეთ "sway" პაკეტის ინსტალაცია თქვენთვის.
|
||||||
|
|
||||||
|
### კოდის კომპილაცია
|
||||||
|
|
||||||
|
იხილეთ [ეს ვიკი გვერდი][Development setup] თუ გინდათ რომ ააწყოთ sway და wlroots სატესტოდ ან დეველოპმენტისთვის.
|
||||||
|
|
||||||
|
დააინსტალირეთ დამოკიდებულებები:
|
||||||
|
|
||||||
|
* meson \*
|
||||||
|
* [wlroots]
|
||||||
|
* wayland
|
||||||
|
* wayland-protocols \*
|
||||||
|
* pcre2
|
||||||
|
* json-c
|
||||||
|
* pango
|
||||||
|
* cairo
|
||||||
|
* gdk-pixbuf2 (ასევე არჩევითია: system tray)
|
||||||
|
* [scdoc] (ასევე არჩევითია: man pages) \*
|
||||||
|
* git (ასევე არჩევითია: version info) \*
|
||||||
|
|
||||||
|
_\* Compile-time dep_
|
||||||
|
|
||||||
|
გაუშვით ეს ბრძანებები:
|
||||||
|
|
||||||
|
meson build/
|
||||||
|
ninja -C build/
|
||||||
|
sudo ninja -C build/ install
|
||||||
|
|
||||||
|
## კონფიგურაცია
|
||||||
|
|
||||||
|
თუ უკვე იყენებთ i3-ს, მაშინ დააკოპირე i3 კონფიგურაცია და ჩასვი `~/.config/sway/config`
|
||||||
|
და უპრობლემოდ იმუშავებს პირდაპირ. წინააღმდეგ შემთხვევაში კონფიგურაციის ნიმუში ჩააკოპირეთ აქ: `~/.config/sway/config`. კომპიგურაციის ნიმუში ხშირ შემთხვევაში არის `/etc/sway/config`.
|
||||||
|
გაუშვი `man 5 sway` კონპიგურაციაზე ინფორმაციის მისაღებად.
|
||||||
|
|
||||||
|
## გაშვება
|
||||||
|
|
||||||
|
გაუშვი `sway` TTY-ისთვის. ზოგიერთმა ლოგინ მენეჯერმა შეიძლება იმუშავოს, მაგრამ არ
|
||||||
|
არის მხარდაჭერილი sway-სგან (როგორც წესი კარგად მუშაობს gdm).
|
||||||
|
|
||||||
|
[i3]: https://i3wm.org/
|
||||||
|
[Wayland]: http://wayland.freedesktop.org/
|
||||||
|
[FAQ]: https://github.com/swaywm/sway/wiki
|
||||||
|
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
|
||||||
|
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||||
|
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||||
|
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||||
|
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||||
|
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
|
@ -28,7 +28,7 @@ sway και wlroots γιά τεστάρισμα ή development.
|
||||||
* [wlroots]
|
* [wlroots]
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -44,12 +44,6 @@ _\*Compile-time dep_
|
||||||
ninja -C build/
|
ninja -C build/
|
||||||
sudo ninja -C build/ install
|
sudo ninja -C build/ install
|
||||||
|
|
||||||
Σε συστήματα χωρίς logind ή seatd, πρέπει να κάνετε suid το sway binary:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Το Sway θα κάνει drop root δικαιώματα λίγο μετά την εκκίνηση.
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Εάν ήδη χρησιμοποιήτε το i3, αντιγράψτε το i3 config σας στο `~/.config/sway/config` και
|
Εάν ήδη χρησιμοποιήτε το i3, αντιγράψτε το i3 config σας στο `~/.config/sway/config` και
|
||||||
|
|
63
README.hi.md
Normal file
63
README.hi.md
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
# sway
|
||||||
|
|
||||||
|
sway एक [i3](https://i3wm.org/)-अनुकूल
|
||||||
|
[Wayland](https://wayland.freedesktop.org/) Compositor है।
|
||||||
|
[FAQ](https://github.com/swaywm/sway/wiki) पढिये। [IRC
|
||||||
|
Channel](https://web.libera.chat/gamja/?channels=#sway)
|
||||||
|
(irc.libera.chat पर #sway) में भी जुडिये।
|
||||||
|
|
||||||
|
## रिलीज हस्ताक्षर
|
||||||
|
|
||||||
|
रिलीजें
|
||||||
|
[E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48)
|
||||||
|
से साइन होतें हैं और [Github पर](https://github.com/swaywm/sway/releases) प्रकाशित होते हैं।
|
||||||
|
|
||||||
|
## इंस्टौलेशन
|
||||||
|
|
||||||
|
### पैकेजों के द्वारा
|
||||||
|
|
||||||
|
Sway कई distributions में उप्लब्ध है। आप अपने में "sway" नामक पैकेज इंस्टौल करके देख
|
||||||
|
सकते हैं।
|
||||||
|
|
||||||
|
### Source से compile करके
|
||||||
|
|
||||||
|
यदि आप परीक्षण और विकास के लिए sway और wlroots के नवीनतम संस्करण बनाना
|
||||||
|
चाहते हैं, तो [यह विकी
|
||||||
|
पृष्ठ](https://github.com/swaywm/sway/wiki/Development-Setup) देखें।
|
||||||
|
|
||||||
|
निर्भरताएं:
|
||||||
|
|
||||||
|
* meson \*
|
||||||
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
|
* wayland
|
||||||
|
* wayland-protocols \*
|
||||||
|
* pcre2
|
||||||
|
* json-c
|
||||||
|
* pango
|
||||||
|
* cairo
|
||||||
|
* gdk-pixbuf (वैकल्पिक: system tray के लिये)
|
||||||
|
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (वैकल्पिक: man पृष्ठों के लिये)
|
||||||
|
\*
|
||||||
|
* git (वैकल्पिक: संस्करण जानने के लिये)
|
||||||
|
|
||||||
|
_\* Compilation के समय आवश्यक_
|
||||||
|
|
||||||
|
ये commands चलाएं:
|
||||||
|
|
||||||
|
meson build/
|
||||||
|
ninja -C build/
|
||||||
|
sudo ninja -C build/ install
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
अगर आप पहले से ही i3 का उपयोग करते हैं तो अपने i3 config को
|
||||||
|
`~/.config/sway/config` में copy कर लीजिये और वह बिना किसी परिवर्तन के काम
|
||||||
|
करेगा। अन्यथा, नमूने configuration file को `~/.config/sway/config` में copy
|
||||||
|
कर लीजिये। यह सामान्यतः `/etc/sway/config` में पाया जाता है। `man 5
|
||||||
|
sway` से आप configuration के बारे में जानकारी प्राप्त कर सकते हैं।
|
||||||
|
|
||||||
|
## चलाना
|
||||||
|
|
||||||
|
आप एक tty से `sway` को चला सकते हैं। कुछ display managers काम करते हैं परन्तु ये
|
||||||
|
sway के द्वारा समर्थित नहीं है (gdm के बारे में जाना गया है कि वह सही काम करता
|
||||||
|
है)।
|
|
@ -28,7 +28,7 @@ Telepítsd a függőségeket:
|
||||||
* [wlroots]
|
* [wlroots]
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -44,13 +44,6 @@ Futtasd ezeket a parancsokat:
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
Ha `logind` nélküli rendszert használsz, akkor be kell állítanod a `suid` bitet
|
|
||||||
a futtaható állományon:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
A Sway indulás után nem sokkal el fogja engedni a root jogosultságait.
|
|
||||||
|
|
||||||
## Konfiguráció
|
## Konfiguráció
|
||||||
|
|
||||||
Ha előzőleg i3-mat használtál, akkor átmásolhatod az i3 beállításaidat a
|
Ha előzőleg i3-mat használtál, akkor átmásolhatod az i3 beállításaidat a
|
||||||
|
|
|
@ -29,7 +29,7 @@ Patreon با نام کاربری SirCmpwn](https://patreon.com/sircmpwn) مرا
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -45,12 +45,6 @@ _\*نیازمندیهای زمان کامپایل برنامه_
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
روی سیستمهای بدون logind، باید فرمان زیر را برای suid کردن باینری sway اجرا کنید:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
‏sway پس از startup مجوزهای دسترسی root را رها میکند.
|
|
||||||
|
|
||||||
### شخصی سازی و تنظیمات
|
### شخصی سازی و تنظیمات
|
||||||
|
|
||||||
اگر در حال حاضر از i3 استفاده میکنید، تنظیمات i3 خودتان را در فایل `~/.config/sway/config` کپی کنید و بدون نیاز به تغییر کار خواهد کرد. در غیر اینصورت، فایل نمونه تنظیمات را استفاده کنید. این فایل عموما در `/etc/sway/config` قرار دارد. برای آگاهی بیشتر `man 5 sway` را اجرا کنید.
|
اگر در حال حاضر از i3 استفاده میکنید، تنظیمات i3 خودتان را در فایل `~/.config/sway/config` کپی کنید و بدون نیاز به تغییر کار خواهد کرد. در غیر اینصورت، فایل نمونه تنظیمات را استفاده کنید. این فایل عموما در `/etc/sway/config` قرار دارد. برای آگاهی بیشتر `man 5 sway` را اجرا کنید.
|
||||||
|
|
66
README.it.md
Normal file
66
README.it.md
Normal file
|
@ -0,0 +1,66 @@
|
||||||
|
# sway
|
||||||
|
|
||||||
|
sway è un compositore di [Wayland] compatibile con [i3]. Leggi le [FAQ].
|
||||||
|
Unisciti al [canale di IRC] \(#sway su irc.libera.chat).
|
||||||
|
|
||||||
|
## Firma delle versioni
|
||||||
|
|
||||||
|
Le versioni sono firmate con la chiave [E88F5E48] e sono pubblicate
|
||||||
|
[su GitHub][GitHub releases].
|
||||||
|
|
||||||
|
## Installazione
|
||||||
|
|
||||||
|
### Da un pacchetto
|
||||||
|
|
||||||
|
Sway è disponibile in molte distribuzioni, prova a installare il pacchetto
|
||||||
|
"sway" per la tua.
|
||||||
|
|
||||||
|
### Compilazione dei sorgenti
|
||||||
|
|
||||||
|
Consulta [questa pagina del wiki][Development setup] se vuoi compilare l'HEAD
|
||||||
|
di sway e wlroots per testarli o contribuire allo sviluppo.
|
||||||
|
|
||||||
|
Installa le dipendenze:
|
||||||
|
|
||||||
|
* meson \*
|
||||||
|
* [wlroots]
|
||||||
|
* wayland
|
||||||
|
* wayland-protocols \*
|
||||||
|
* pcre
|
||||||
|
* json-c
|
||||||
|
* pango
|
||||||
|
* cairo
|
||||||
|
* gdk-pixbuf2 (opzionale: area di notifica)
|
||||||
|
* [scdoc] (opzionale: pagine del manuale) \*
|
||||||
|
* git (opzionale: informazioni sulla versione) \*
|
||||||
|
|
||||||
|
_\* Dipendenza necessaria per la compilazione_
|
||||||
|
|
||||||
|
Esegui questi comandi:
|
||||||
|
|
||||||
|
meson build/
|
||||||
|
ninja -C build/
|
||||||
|
sudo ninja -C build/ install
|
||||||
|
|
||||||
|
## Configurazione
|
||||||
|
|
||||||
|
Se hai già usato i3, copia il tuo file di configurazione in
|
||||||
|
`~/.config/sway/config` e sway funzionerà immediatamente. Altrimenti, copia il
|
||||||
|
file d'esempio in `~/.config/sway/config`, generalmente è situato in
|
||||||
|
`/etc/sway/config`. Consulta `man 5 sway` per ulteriori informazioni sulla
|
||||||
|
configurazione.
|
||||||
|
|
||||||
|
## Esecuzione
|
||||||
|
|
||||||
|
Lancia `sway` da un TTY. Alcuni gestori d'accesso potrebbero funzionare ma non
|
||||||
|
sono supportati da sway (gdm funziona abbastanza bene).
|
||||||
|
|
||||||
|
[i3]: https://i3wm.org/
|
||||||
|
[Wayland]: http://wayland.freedesktop.org/
|
||||||
|
[FAQ]: https://github.com/swaywm/sway/wiki
|
||||||
|
[canale di IRC]: https://web.libera.chat/gamja/?channels=#sway
|
||||||
|
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||||
|
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||||
|
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||||
|
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||||
|
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
16
README.ja.md
16
README.ja.md
|
@ -30,15 +30,15 @@ Swayは沢山のディストリビューションで提供されています。"
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
* gdk-pixbuf2 (システムイコンで必要です)
|
* gdk-pixbuf2 (任意: システムイコンで必要です)
|
||||||
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (manで必要です) \*
|
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (任意: manで必要です) \*
|
||||||
* git \*
|
* git (任意: バージョン情報で必要です) \*
|
||||||
|
|
||||||
_\*コンパイルの時_
|
_\*コンパイル時の依存_
|
||||||
|
|
||||||
次のコマンドを実行してください:
|
次のコマンドを実行してください:
|
||||||
|
|
||||||
|
@ -46,12 +46,6 @@ _\*コンパイルの時_
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
logindを使用していないシステムでは、バイナリにsuidを設定する必要があります:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
swayは起動後、すぐにroot許可を落とします。
|
|
||||||
|
|
||||||
## 設定
|
## 設定
|
||||||
|
|
||||||
既にi3を使用している場合は、i3の設定ファイルを`~/.config/sway/config`にコピーすれば動きます。そうでない場合は、サンプルの設定ファイルを`~/.config/sway/config`にコピーしてください。サンプルの設定ファイルは、通常`/etc/sway/config`にあります。`man 5 sway`を実行することで、設定に関する情報を見ることができます。
|
既にi3を使用している場合は、i3の設定ファイルを`~/.config/sway/config`にコピーすれば動きます。そうでない場合は、サンプルの設定ファイルを`~/.config/sway/config`にコピーしてください。サンプルの設定ファイルは、通常`/etc/sway/config`にあります。`man 5 sway`を実行することで、設定に関する情報を見ることができます。
|
||||||
|
|
|
@ -27,7 +27,7 @@ IRC 채널을 방문하거나 sir@cmpwn.com으로 이메일을 보내 상담 받
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -43,12 +43,6 @@ _\*컴파일 떄 필요_
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
logind를 사용하고 있지 않는 시스템에서는, 바이너리에 suid를 설정할 필요가 있습니다:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway는 시작 후에 root 권한을 drop할 것 입니다.
|
|
||||||
|
|
||||||
## 설정
|
## 설정
|
||||||
|
|
||||||
i3를 이미 사용 중이라면, i3 config을 `~/.config/sway/config`로 복사하세요.
|
i3를 이미 사용 중이라면, i3 config을 `~/.config/sway/config`로 복사하세요.
|
||||||
|
|
57
README.md
57
README.md
|
@ -1,6 +1,6 @@
|
||||||
# sway
|
# sway
|
||||||
|
|
||||||
**[English][en]** - [日本語][ja] - [Français][fr] - [Українська][uk] - [Español][es] - [Polski][pl] - [中文-简体][zh-CN] - [Deutsch][de] - [Nederlands][nl] - [Русский][ru] - [中文-繁體][zh-TW] - [Português][pt] - [Dansk][dk] - [한국어][ko] - [Română][ro] - [Magyar][hu] - [Türkçe][tr] - [فارسی][ir] - [Ελληνικά][gr]
|
**[English][en]** - [عربي][ar] - [Česky][cs] - [Deutsch][de] - [Dansk][dk] - [Español][es] - [Français][fr] - [ქართული][ge] - [Ελληνικά][gr] - [हिन्दी][hi] - [Magyar][hu] - [فارسی][ir] - [Italiano][it] - [日本語][ja] - [한국어][ko] - [Nederlands][nl] - [Norsk][no] - [Polski][pl] - [Português][pt] - [Română][ro] - [Русский][ru] - [Svenska][sv] - [Türkçe][tr] - [Українська][uk] - [中文-简体][zh-CN] - [中文-繁體][zh-TW]
|
||||||
|
|
||||||
sway is an [i3]-compatible [Wayland] compositor. Read the [FAQ]. Join the
|
sway is an [i3]-compatible [Wayland] compositor. Read the [FAQ]. Join the
|
||||||
[IRC channel] \(#sway on irc.libera.chat).
|
[IRC channel] \(#sway on irc.libera.chat).
|
||||||
|
@ -27,11 +27,12 @@ Install dependencies:
|
||||||
* [wlroots]
|
* [wlroots]
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
* gdk-pixbuf2 (optional: system tray)
|
* gdk-pixbuf2 (optional: additional image formats for system tray)
|
||||||
|
* [swaybg] (optional: wallpaper)
|
||||||
* [scdoc] (optional: man pages) \*
|
* [scdoc] (optional: man pages) \*
|
||||||
* git (optional: version info) \*
|
* git (optional: version info) \*
|
||||||
|
|
||||||
|
@ -43,12 +44,6 @@ Run these commands:
|
||||||
ninja -C build/
|
ninja -C build/
|
||||||
sudo ninja -C build/ install
|
sudo ninja -C build/ install
|
||||||
|
|
||||||
On systems without logind nor seatd, you need to suid the sway binary:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway will drop root permissions shortly after startup.
|
|
||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
If you already use i3, then copy your i3 config to `~/.config/sway/config` and
|
If you already use i3, then copy your i3 config to `~/.config/sway/config` and
|
||||||
|
@ -62,24 +57,31 @@ Run `sway` from a TTY. Some display managers may work but are not supported by
|
||||||
sway (gdm is known to work fairly well).
|
sway (gdm is known to work fairly well).
|
||||||
|
|
||||||
[en]: https://github.com/swaywm/sway#readme
|
[en]: https://github.com/swaywm/sway#readme
|
||||||
[ja]: https://github.com/swaywm/sway/blob/master/README.ja.md
|
[ar]: README.ar.md
|
||||||
[fr]: https://github.com/swaywm/sway/blob/master/README.fr.md
|
[cs]: README.cs.md
|
||||||
[uk]: https://github.com/swaywm/sway/blob/master/README.uk.md
|
[de]: README.de.md
|
||||||
[es]: https://github.com/swaywm/sway/blob/master/README.es.md
|
[dk]: README.dk.md
|
||||||
[pl]: https://github.com/swaywm/sway/blob/master/README.pl.md
|
[es]: README.es.md
|
||||||
[zh-CN]: https://github.com/swaywm/sway/blob/master/README.zh-CN.md
|
[fr]: README.fr.md
|
||||||
[de]: https://github.com/swaywm/sway/blob/master/README.de.md
|
[ge]: README.ge.md
|
||||||
[nl]: https://github.com/swaywm/sway/blob/master/README.nl.md
|
[gr]: README.gr.md
|
||||||
[ru]: https://github.com/swaywm/sway/blob/master/README.ru.md
|
[hi]: README.hi.md
|
||||||
[zh-TW]: https://github.com/swaywm/sway/blob/master/README.zh-TW.md
|
[hu]: README.hu.md
|
||||||
[pt]: https://github.com/swaywm/sway/blob/master/README.pt.md
|
[ir]: README.ir.md
|
||||||
[dk]: https://github.com/swaywm/sway/blob/master/README.dk.md
|
[it]: README.it.md
|
||||||
[ko]: https://github.com/swaywm/sway/blob/master/README.ko.md
|
[ja]: README.ja.md
|
||||||
[ro]: https://github.com/swaywm/sway/blob/master/README.ro.md
|
[ko]: README.ko.md
|
||||||
[hu]: https://github.com/swaywm/sway/blob/master/README.hu.md
|
[nl]: README.nl.md
|
||||||
[tr]: https://github.com/swaywm/sway/blob/master/README.tr.md
|
[no]: README.no.md
|
||||||
[ir]: https://github.com/swaywm/sway/blob/master/README.ir.md
|
[pl]: README.pl.md
|
||||||
[gr]: https://github.com/swaywm/sway/blob/master/README.gr.md
|
[pt]: README.pt.md
|
||||||
|
[ro]: README.ro.md
|
||||||
|
[ru]: README.ru.md
|
||||||
|
[sv]: README.sv.md
|
||||||
|
[tr]: README.tr.md
|
||||||
|
[uk]: README.uk.md
|
||||||
|
[zh-CN]: README.zh-CN.md
|
||||||
|
[zh-TW]: README.zh-TW.md
|
||||||
[i3]: https://i3wm.org/
|
[i3]: https://i3wm.org/
|
||||||
[Wayland]: http://wayland.freedesktop.org/
|
[Wayland]: http://wayland.freedesktop.org/
|
||||||
[FAQ]: https://github.com/swaywm/sway/wiki
|
[FAQ]: https://github.com/swaywm/sway/wiki
|
||||||
|
@ -88,4 +90,5 @@ sway (gdm is known to work fairly well).
|
||||||
[GitHub releases]: https://github.com/swaywm/sway/releases
|
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||||
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||||
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||||
|
[swaybg]: https://github.com/swaywm/swaybg/
|
||||||
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
||||||
|
|
|
@ -28,7 +28,7 @@ Afhankelijkheden installeren:
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -44,12 +44,6 @@ Voer deze opdrachten uit:
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
Op systemen zonder logind, moet je bij het binaire bestand het suid bit instellen:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway zal root-rechten kort na het opstarten loslaten.
|
|
||||||
|
|
||||||
## Configuratie
|
## Configuratie
|
||||||
|
|
||||||
Als je al i3 gebruikt, kopieer dan je i3-configuratie naar `~/.config/sway/config` en
|
Als je al i3 gebruikt, kopieer dan je i3-configuratie naar `~/.config/sway/config` en
|
||||||
|
|
68
README.no.md
Normal file
68
README.no.md
Normal file
|
@ -0,0 +1,68 @@
|
||||||
|
# Sway
|
||||||
|
|
||||||
|
Sway er en [i3]-kompatibel [Wayland] compositor. Les [Ofte stilte spørsmål].
|
||||||
|
Delta på [IRC kanalen][IRC kanal] \(#sway på irc.libera.chat).
|
||||||
|
|
||||||
|
## Utgivelses Signaturer
|
||||||
|
|
||||||
|
Utgivelser er signert med [E88F5E48] og publisert [på GitHub][GitHub
|
||||||
|
releases].
|
||||||
|
|
||||||
|
## Installasjon
|
||||||
|
|
||||||
|
### Fra system pakker
|
||||||
|
|
||||||
|
Sway er tilgjengelig i mange distribusjoner. Prøv å installere "sway" pakken
|
||||||
|
fra din distro sine repoer.
|
||||||
|
|
||||||
|
Er du interessert i å pakke Sway for din distribusjon kan du ta turen innom
|
||||||
|
IRC-kanalen eller send en e-post til sir@cmpwn.com for råd.
|
||||||
|
|
||||||
|
### Kompilering fra kildekode
|
||||||
|
|
||||||
|
Se [denne wiki-siden][Oppsetting for utvikling] hvis du vil bygge fra HEAD grenen av sway og
|
||||||
|
wlroots for testing eller utvikling.
|
||||||
|
|
||||||
|
Installasjonsavhengigheter:
|
||||||
|
|
||||||
|
* meson \*
|
||||||
|
* [wlroots]
|
||||||
|
* wayland
|
||||||
|
* wayland-protocols \*
|
||||||
|
* pcre2
|
||||||
|
* json-c
|
||||||
|
* pango
|
||||||
|
* cairo
|
||||||
|
* gdk-pixbuf2 (valgfritt: system tray)
|
||||||
|
* [scdoc] (valgfritt: man pages) \*
|
||||||
|
* git \*
|
||||||
|
|
||||||
|
_\*Kompileringsavhengigheter_
|
||||||
|
|
||||||
|
Kjør følgende kommandoer:
|
||||||
|
|
||||||
|
meson build
|
||||||
|
ninja -C build
|
||||||
|
sudo ninja -C build install
|
||||||
|
|
||||||
|
## Konfigurasjon
|
||||||
|
|
||||||
|
Hvis du allerede bruker i3 kan du bare kopiere din i3 konfigurasjon til
|
||||||
|
`~/.config/sway/config`. Ellers skal du kopiere eksempel konfigurasjonsfilen til
|
||||||
|
`~/.config/sway/config`. Eksempel filen er normalt plasert i `/etc/sway/config`. Kjør
|
||||||
|
`man 5 sway` for å få oplysninger om konfigurasjonen.
|
||||||
|
|
||||||
|
## Utførelse
|
||||||
|
|
||||||
|
Kjør `sway` fra en TTY. Noen display managers kan fungere, men Sway har ikke
|
||||||
|
støtte for dem (gdm er kjent for å fungere ganske bra).
|
||||||
|
|
||||||
|
[i3]: https://i3wm.org/
|
||||||
|
[Wayland]: http://wayland.freedesktop.org/
|
||||||
|
[Ofte stilte spørsmål]: https://github.com/swaywm/sway/wiki
|
||||||
|
[IRC kanal]: https://web.libera.chat/gamja/?channels=#sway
|
||||||
|
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||||
|
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||||
|
[Oppsetting for utvikling]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||||
|
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||||
|
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
|
@ -28,7 +28,7 @@ Zainstaluj zależności:
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -44,12 +44,6 @@ Wykonaj następujące polecenia:
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
Na systemach bez logind należy wykonać polecenie suid na pliku wykonywalnym sway:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway pozbędzie się uprawnień roota tuż po wystartowaniu.
|
|
||||||
|
|
||||||
## Konfiguracja
|
## Konfiguracja
|
||||||
|
|
||||||
Jeśli już korzystasz z i3, skopiuj swoją konfigurację i3 do katalogu `~/.config/sway/config` i
|
Jeśli już korzystasz z i3, skopiuj swoją konfigurację i3 do katalogu `~/.config/sway/config` i
|
||||||
|
|
|
@ -30,7 +30,7 @@ Instale as dependências:
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -46,12 +46,6 @@ Execute esses comandos:
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
Em sistemas sem logind, você precisa preparar o binário do sway:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
O sway perderá as privilégios de de root logo após o início do sistema.
|
|
||||||
|
|
||||||
## Configuração
|
## Configuração
|
||||||
|
|
||||||
Se você já utiliza o i3, então copie os seus arquivos de configuração para `~/.config/sway/config` e
|
Se você já utiliza o i3, então copie os seus arquivos de configuração para `~/.config/sway/config` e
|
||||||
|
|
10
README.ro.md
10
README.ro.md
|
@ -25,7 +25,7 @@ Dependențe pentru instalare:
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -43,14 +43,6 @@ Rulați aceste comenzi:
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
```
|
```
|
||||||
|
|
||||||
Pe sisteme fără logind, trebuie să folosiți următoarea comandă pentru a marca binarul de Sway ca suid:
|
|
||||||
|
|
||||||
```
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
```
|
|
||||||
|
|
||||||
Imediat după pornire, Sway va renunța la permisiunile de root.
|
|
||||||
|
|
||||||
## Configurare
|
## Configurare
|
||||||
|
|
||||||
Dacă folosiți deja i3, copiați fișierul de configurare din i3 în `~/.config/sway/config`, și va funcționa fără a necesita nici o modificare. In caz contrar, copiați exemplul de configurare (disponibil de obicei în `/etc/sway/config`) în `~/.config/sway/config`.
|
Dacă folosiți deja i3, copiați fișierul de configurare din i3 în `~/.config/sway/config`, și va funcționa fără a necesita nici o modificare. In caz contrar, copiați exemplul de configurare (disponibil de obicei în `/etc/sway/config`) în `~/.config/sway/config`.
|
||||||
|
|
|
@ -29,7 +29,7 @@ sway и wlroots для тестирования или разработки.
|
||||||
* [wlroots]
|
* [wlroots]
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -45,12 +45,6 @@ _\*Зависимости для сборки_
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
На системах без logind вам понадобится добавить suid к файлу программы sway:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
sway сбросит root-права при запуске.
|
|
||||||
|
|
||||||
## Настройка
|
## Настройка
|
||||||
|
|
||||||
Если вы уже используете i3, скопируйте ваш конфигурационный файл i3 в `~/.config/sway/config`, и
|
Если вы уже используете i3, скопируйте ваш конфигурационный файл i3 в `~/.config/sway/config`, и
|
||||||
|
|
81
README.sv.md
Normal file
81
README.sv.md
Normal file
|
@ -0,0 +1,81 @@
|
||||||
|
# sway
|
||||||
|
|
||||||
|
sway är en [i3]-kompatibel [Wayland] compositor. Läs våran [FAQ]-sida. Gå med i vår
|
||||||
|
[IRC-kanal] \(#sway på irc.libera.chat).
|
||||||
|
|
||||||
|
## Utgåvosignaturer
|
||||||
|
|
||||||
|
Utgåvor är signerade med [E88F5E48] och publicerade på [GitHub][GitHub releases].
|
||||||
|
|
||||||
|
## Installering
|
||||||
|
|
||||||
|
### Med pakethanterare
|
||||||
|
|
||||||
|
Sway är tillgänglig i många distributioner. Prova att installera "sway" med din distributions pakethanterare.
|
||||||
|
|
||||||
|
### Genom att kompilera från källkod
|
||||||
|
|
||||||
|
Kolla in [denna wiki-sida][Development setup] om du vill bygga sway och wlroots HEAD för testning eller utveckling.
|
||||||
|
|
||||||
|
Installera paket som sway behöver:
|
||||||
|
|
||||||
|
* meson \*
|
||||||
|
* [wlroots]
|
||||||
|
* wayland
|
||||||
|
* wayland-protocols \*
|
||||||
|
* pcre2
|
||||||
|
* json-c
|
||||||
|
* pango
|
||||||
|
* cairo
|
||||||
|
* gdk-pixbuf2 (valbar: systembricka)
|
||||||
|
* [scdoc] (valbar: manualer) \*
|
||||||
|
* git (valbar: versioninfo) \*
|
||||||
|
|
||||||
|
_\* Krav för kompilering_
|
||||||
|
|
||||||
|
Kör dessa kommandon:
|
||||||
|
|
||||||
|
meson build/
|
||||||
|
ninja -C build/
|
||||||
|
sudo ninja -C build/ install
|
||||||
|
|
||||||
|
## Konfiguration
|
||||||
|
|
||||||
|
Ifall du redan använder i3 så kan du kopiera din konfigurationsfil till `~/.config/sway/config` och det kommer då att fungera som det ska.
|
||||||
|
Kopiera annars exemplarkonfigurationsfilen till `~/.config/sway/config`. Den ligger oftast i `/etc/sway/config`.
|
||||||
|
Kör `man 5 sway` för mer information kring konfigurationen.
|
||||||
|
|
||||||
|
## Att köra sway
|
||||||
|
|
||||||
|
Kör `sway` från en TTY. Vissa inloggningahanterare kan fungera men inte vara stödda av sway (gdm ska fungera hyfsat bra).
|
||||||
|
|
||||||
|
[en]: https://github.com/swaywm/sway#readme
|
||||||
|
[de]: README.de.md
|
||||||
|
[dk]: README.dk.md
|
||||||
|
[es]: README.es.md
|
||||||
|
[fr]: README.fr.md
|
||||||
|
[sv]: README.sv.md
|
||||||
|
[gr]: README.gr.md
|
||||||
|
[hu]: README.hu.md
|
||||||
|
[ir]: README.ir.md
|
||||||
|
[it]: README.it.md
|
||||||
|
[ja]: README.ja.md
|
||||||
|
[ko]: README.ko.md
|
||||||
|
[nl]: README.nl.md
|
||||||
|
[pl]: README.pl.md
|
||||||
|
[pt]: README.pt.md
|
||||||
|
[ro]: README.ro.md
|
||||||
|
[ru]: README.ru.md
|
||||||
|
[tr]: README.tr.md
|
||||||
|
[uk]: README.uk.md
|
||||||
|
[zh-CN]: README.zh-CN.md
|
||||||
|
[zh-TW]: README.zh-TW.md
|
||||||
|
[i3]: https://i3wm.org/
|
||||||
|
[Wayland]: http://wayland.freedesktop.org/
|
||||||
|
[FAQ]: https://github.com/swaywm/sway/wiki
|
||||||
|
[IRC-kanal]: https://web.libera.chat/gamja/?channels=#sway
|
||||||
|
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||||
|
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||||
|
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||||
|
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||||
|
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
|
@ -26,7 +26,7 @@ Aşağıdaki bağımlılıkları yükleyin:
|
||||||
* [wlroots]
|
* [wlroots]
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -42,12 +42,6 @@ _\*Derleme-anı bağımlılıkları_
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
logind olmayan sistemlerde, sway ikilisine (binary) izin vermeniz (suid) gerekir:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway, başlangıçtan kısa bir süre sonra kök(root) izinlerini bırakacaktır.
|
|
||||||
|
|
||||||
## Yapılandırma
|
## Yapılandırma
|
||||||
|
|
||||||
Zaten i3 kullanıyorsanız, i3 yapılandırmanızı `~/.config/sway/config` konumuna kopyalayın ve kutudan çıktığı gibi çalışacaktır. Aksi takdirde, örnek yapılandırma dosyasını `~/.config/sway/config` konumuna kopyalayın. Genellikle `/etc/sway/config` konumunda bulunur.
|
Zaten i3 kullanıyorsanız, i3 yapılandırmanızı `~/.config/sway/config` konumuna kopyalayın ve kutudan çıktığı gibi çalışacaktır. Aksi takdirde, örnek yapılandırma dosyasını `~/.config/sway/config` konumuna kopyalayın. Genellikle `/etc/sway/config` konumunda bulunur.
|
||||||
|
|
|
@ -39,7 +39,7 @@ Sway доступний у багатьох дистрибутивах Linux (а
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -55,12 +55,6 @@ _\*Лише для компіляції_
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
На системах без logind, необхідно встановити біт SUID на виконуваний файл sway:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway втратить права доступу root незабаром після запуску.
|
|
||||||
|
|
||||||
## Налаштування
|
## Налаштування
|
||||||
|
|
||||||
Якщо ви вже використовуєте i3, скопіюйте свій файл налаштувань
|
Якщо ви вже використовуєте i3, скопіюйте свій файл налаштувань
|
||||||
|
|
|
@ -1,63 +1,50 @@
|
||||||
# sway
|
# sway
|
||||||
|
|
||||||
sway 是和 [i3](https://i3wm.org/) 兼容的 [Wayland](http://wayland.freedesktop.org/) compositor.
|
sway 是和 [i3](https://i3wm.org/) 兼容的 [Wayland](http://wayland.freedesktop.org/) compositor。
|
||||||
阅读 [FAQ](https://github.com/swaywm/sway/wiki). 加入 [IRC
|
[查看FAQ](https://github.com/swaywm/sway/wiki)/ [加入IRC频道](https://web.libera.chat/gamja/?channels=#sway) (#sway on irc.libera.chat)
|
||||||
频道](https://web.libera.chat/gamja/?channels=#sway) (#sway on
|
|
||||||
irc.libera.chat).
|
|
||||||
|
|
||||||
## 发布签名
|
## 发行签名
|
||||||
|
|
||||||
发布是以 [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48) 签名
|
每个发行版都以 [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48) 的密钥签名并发布在 [GitHub](https://github.com/swaywm/sway/releases)上。
|
||||||
并发布在 [GitHub](https://github.com/swaywm/sway/releases).
|
|
||||||
|
|
||||||
## 安装
|
## 安装
|
||||||
|
|
||||||
### 从软件包中
|
### 从包管理器安装
|
||||||
|
|
||||||
Sway 在很多发行版中可用. 尝试在你的发行版中安装 "sway" 包.
|
Sway 在很多发行版中可用。请尝试在你的发行版中安装 `sway` 。
|
||||||
如果这不可用, 请到 [此 wiki 页](https://github.com/swaywm/sway/wiki/Unsupported-packages)
|
|
||||||
检查针对你的发行版关于安装的信息.
|
|
||||||
|
|
||||||
如果你有兴趣给你的发行版打包 sway, 停下来到 IRC 频道或者发邮件至 sir@cmpwn.com 获取建议.
|
### 从源码编译
|
||||||
|
|
||||||
### 从源代码编译
|
如果想要构建最新版sway和wlroots用以测试和开发,请查看 [此wiki页面](https://github.com/swaywm/sway/wiki/Development-Setup)
|
||||||
|
|
||||||
安装依赖:
|
安装如下依赖:
|
||||||
|
|
||||||
* meson \*
|
* meson \*
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
* gdk-pixbuf2 (可选的: system tray)
|
* gdk-pixbuf2 (可选的: system tray)
|
||||||
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (可选的: man pages) \*
|
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (可选: man pages) \*
|
||||||
* git \*
|
* git \*
|
||||||
|
|
||||||
_\*编译时依赖_
|
_\*编译时依赖_
|
||||||
|
|
||||||
运行这些命令:
|
运行如下命令:
|
||||||
|
|
||||||
meson build
|
meson build/
|
||||||
ninja -C build
|
ninja -C build/
|
||||||
sudo ninja -C build install
|
sudo ninja -C build/ install
|
||||||
|
|
||||||
在没有 logind 的系统上, 你需要给 sway 二进制设置 suid:
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway 将会在启动后尽快丢掉 root 权限.
|
|
||||||
|
|
||||||
## 配置
|
## 配置
|
||||||
|
|
||||||
如果你已经在使用 i3, 接下来复制你的 i3 配置到 `~/.config/sway/config`
|
如果你已经在使用i3,直接复制i3配置文件到 `~/.config/sway/config`,这是开箱即用的。或者,你可以复制配置样例到`~/.config/sway/config`。它通常位于 `/etc/sway/config`。
|
||||||
它可以直接工作. 或者, 复制样本配置文件到
|
运行 `man 5 sway` 获取关于配置的更多信息。
|
||||||
`~/.config/sway/config`. 它通常位于 `/etc/sway/config`.
|
|
||||||
运行 `man 5 sway` 获取关于配置的信息.
|
|
||||||
|
|
||||||
## 运行
|
## 运行
|
||||||
|
|
||||||
从 TTY 中运行 `sway` . 某些显示管理器可能会工作但并不被 sway 支持
|
从 TTY 中运行 `sway`。 某些显示管理器(Display Manager)也许可以工作但不被 sway 支持。
|
||||||
(已知的 gdm 工作得非常好).
|
(已知 gdm 工作得非常好)。
|
||||||
|
|
|
@ -28,7 +28,7 @@ Sway 在許多發行版都有提供。請自己嘗試於你的發行版安裝
|
||||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||||
* wayland
|
* wayland
|
||||||
* wayland-protocols \*
|
* wayland-protocols \*
|
||||||
* pcre
|
* pcre2
|
||||||
* json-c
|
* json-c
|
||||||
* pango
|
* pango
|
||||||
* cairo
|
* cairo
|
||||||
|
@ -44,12 +44,6 @@ _\*編譯時相依_
|
||||||
ninja -C build
|
ninja -C build
|
||||||
sudo ninja -C build install
|
sudo ninja -C build install
|
||||||
|
|
||||||
在沒有 logind 的系統上,你需要為 sway 的執行檔加上 suid。
|
|
||||||
|
|
||||||
sudo chmod a+s /usr/local/bin/sway
|
|
||||||
|
|
||||||
Sway 在啟動不久後就會放棄 root 權限。
|
|
||||||
|
|
||||||
## 設定檔
|
## 設定檔
|
||||||
|
|
||||||
如果你已經在使用 i3,你可以直接將你的 i3 設定檔複製到 `~/.config/sway/config` 然後就能直接使用。
|
如果你已經在使用 i3,你可以直接將你的 i3 設定檔複製到 `~/.config/sway/config` 然後就能直接使用。
|
||||||
|
|
|
@ -1,50 +1,42 @@
|
||||||
#define _POSIX_C_SOURCE 200809
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
|
#include <errno.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <sys/mman.h>
|
#include <sys/mman.h>
|
||||||
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wayland-client.h>
|
#include <wayland-client.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "pool-buffer.h"
|
#include "pool-buffer.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
|
||||||
static int create_pool_file(size_t size, char **name) {
|
static int anonymous_shm_open(void) {
|
||||||
static const char template[] = "sway-client-XXXXXX";
|
int retries = 100;
|
||||||
const char *path = getenv("XDG_RUNTIME_DIR");
|
|
||||||
if (path == NULL) {
|
|
||||||
fprintf(stderr, "XDG_RUNTIME_DIR is not set\n");
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
size_t name_size = strlen(template) + 1 + strlen(path) + 1;
|
do {
|
||||||
*name = malloc(name_size);
|
// try a probably-unique name
|
||||||
if (*name == NULL) {
|
struct timespec ts;
|
||||||
fprintf(stderr, "allocation failed\n");
|
clock_gettime(CLOCK_MONOTONIC, &ts);
|
||||||
return -1;
|
pid_t pid = getpid();
|
||||||
}
|
char name[50];
|
||||||
snprintf(*name, name_size, "%s/%s", path, template);
|
snprintf(name, sizeof(name), "/sway-%x-%x",
|
||||||
|
(unsigned int)pid, (unsigned int)ts.tv_nsec);
|
||||||
int fd = mkstemp(*name);
|
|
||||||
if (fd < 0) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!sway_set_cloexec(fd, true)) {
|
|
||||||
close(fd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ftruncate(fd, size) < 0) {
|
|
||||||
close(fd);
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// shm_open guarantees that O_CLOEXEC is set
|
||||||
|
int fd = shm_open(name, O_RDWR | O_CREAT | O_EXCL, 0600);
|
||||||
|
if (fd >= 0) {
|
||||||
|
shm_unlink(name);
|
||||||
return fd;
|
return fd;
|
||||||
|
}
|
||||||
|
|
||||||
|
--retries;
|
||||||
|
} while (retries > 0 && errno == EEXIST);
|
||||||
|
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void buffer_release(void *data, struct wl_buffer *wl_buffer) {
|
static void buffer_release(void *data, struct wl_buffer *wl_buffer) {
|
||||||
|
@ -62,17 +54,20 @@ static struct pool_buffer *create_buffer(struct wl_shm *shm,
|
||||||
uint32_t stride = width * 4;
|
uint32_t stride = width * 4;
|
||||||
size_t size = stride * height;
|
size_t size = stride * height;
|
||||||
|
|
||||||
char *name;
|
int fd = anonymous_shm_open();
|
||||||
int fd = create_pool_file(size, &name);
|
if (fd == -1) {
|
||||||
assert(fd != -1);
|
return NULL;
|
||||||
|
}
|
||||||
|
if (ftruncate(fd, size) < 0) {
|
||||||
|
close(fd);
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
void *data = mmap(NULL, size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, 0);
|
||||||
struct wl_shm_pool *pool = wl_shm_create_pool(shm, fd, size);
|
struct wl_shm_pool *pool = wl_shm_create_pool(shm, fd, size);
|
||||||
buf->buffer = wl_shm_pool_create_buffer(pool, 0,
|
buf->buffer = wl_shm_pool_create_buffer(pool, 0,
|
||||||
width, height, stride, format);
|
width, height, stride, format);
|
||||||
wl_shm_pool_destroy(pool);
|
wl_shm_pool_destroy(pool);
|
||||||
close(fd);
|
close(fd);
|
||||||
unlink(name);
|
|
||||||
free(name);
|
|
||||||
|
|
||||||
buf->size = size;
|
buf->size = size;
|
||||||
buf->width = width;
|
buf->width = width;
|
||||||
|
|
332
common/gesture.c
Normal file
332
common/gesture.c
Normal file
|
@ -0,0 +1,332 @@
|
||||||
|
#include "gesture.h"
|
||||||
|
|
||||||
|
#include <math.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include "list.h"
|
||||||
|
#include "log.h"
|
||||||
|
#include "stringop.h"
|
||||||
|
|
||||||
|
const uint8_t GESTURE_FINGERS_ANY = 0;
|
||||||
|
|
||||||
|
char *gesture_parse(const char *input, struct gesture *output) {
|
||||||
|
// Clear output in case of failure
|
||||||
|
output->type = GESTURE_TYPE_NONE;
|
||||||
|
output->fingers = GESTURE_FINGERS_ANY;
|
||||||
|
output->directions = GESTURE_DIRECTION_NONE;
|
||||||
|
|
||||||
|
// Split input type, fingers and directions
|
||||||
|
list_t *split = split_string(input, ":");
|
||||||
|
if (split->length < 1 || split->length > 3) {
|
||||||
|
return format_str(
|
||||||
|
"expected <gesture>[:<fingers>][:direction], got %s",
|
||||||
|
input);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse gesture type
|
||||||
|
if (strcmp(split->items[0], "hold") == 0) {
|
||||||
|
output->type = GESTURE_TYPE_HOLD;
|
||||||
|
} else if (strcmp(split->items[0], "pinch") == 0) {
|
||||||
|
output->type = GESTURE_TYPE_PINCH;
|
||||||
|
} else if (strcmp(split->items[0], "swipe") == 0) {
|
||||||
|
output->type = GESTURE_TYPE_SWIPE;
|
||||||
|
} else {
|
||||||
|
return format_str("expected hold|pinch|swipe, got %s",
|
||||||
|
(const char *)split->items[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Parse optional arguments
|
||||||
|
if (split->length > 1) {
|
||||||
|
char *next = split->items[1];
|
||||||
|
|
||||||
|
// Try to parse as finger count (1-9)
|
||||||
|
if (strlen(next) == 1 && '1' <= next[0] && next[0] <= '9') {
|
||||||
|
output->fingers = atoi(next);
|
||||||
|
|
||||||
|
// Move to next if available
|
||||||
|
next = split->length == 3 ? split->items[2] : NULL;
|
||||||
|
} else if (split->length == 3) {
|
||||||
|
// Fail here if argument can only be finger count
|
||||||
|
return format_str("expected 1-9, got %s", next);
|
||||||
|
}
|
||||||
|
|
||||||
|
// If there is an argument left, try to parse as direction
|
||||||
|
if (next) {
|
||||||
|
list_t *directions = split_string(next, "+");
|
||||||
|
|
||||||
|
for (int i = 0; i < directions->length; ++i) {
|
||||||
|
const char *item = directions->items[i];
|
||||||
|
if (strcmp(item, "any") == 0) {
|
||||||
|
continue;
|
||||||
|
} else if (strcmp(item, "up") == 0) {
|
||||||
|
output->directions |= GESTURE_DIRECTION_UP;
|
||||||
|
} else if (strcmp(item, "down") == 0) {
|
||||||
|
output->directions |= GESTURE_DIRECTION_DOWN;
|
||||||
|
} else if (strcmp(item, "left") == 0) {
|
||||||
|
output->directions |= GESTURE_DIRECTION_LEFT;
|
||||||
|
} else if (strcmp(item, "right") == 0) {
|
||||||
|
output->directions |= GESTURE_DIRECTION_RIGHT;
|
||||||
|
} else if (strcmp(item, "inward") == 0) {
|
||||||
|
output->directions |= GESTURE_DIRECTION_INWARD;
|
||||||
|
} else if (strcmp(item, "outward") == 0) {
|
||||||
|
output->directions |= GESTURE_DIRECTION_OUTWARD;
|
||||||
|
} else if (strcmp(item, "clockwise") == 0) {
|
||||||
|
output->directions |= GESTURE_DIRECTION_CLOCKWISE;
|
||||||
|
} else if (strcmp(item, "counterclockwise") == 0) {
|
||||||
|
output->directions |= GESTURE_DIRECTION_COUNTERCLOCKWISE;
|
||||||
|
} else {
|
||||||
|
return format_str("expected direction, got %s", item);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list_free_items_and_destroy(directions);
|
||||||
|
}
|
||||||
|
} // if optional args
|
||||||
|
|
||||||
|
list_free_items_and_destroy(split);
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *gesture_type_string(enum gesture_type type) {
|
||||||
|
switch (type) {
|
||||||
|
case GESTURE_TYPE_NONE:
|
||||||
|
return "none";
|
||||||
|
case GESTURE_TYPE_HOLD:
|
||||||
|
return "hold";
|
||||||
|
case GESTURE_TYPE_PINCH:
|
||||||
|
return "pinch";
|
||||||
|
case GESTURE_TYPE_SWIPE:
|
||||||
|
return "swipe";
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *gesture_direction_string(enum gesture_direction direction) {
|
||||||
|
switch (direction) {
|
||||||
|
case GESTURE_DIRECTION_NONE:
|
||||||
|
return "none";
|
||||||
|
case GESTURE_DIRECTION_UP:
|
||||||
|
return "up";
|
||||||
|
case GESTURE_DIRECTION_DOWN:
|
||||||
|
return "down";
|
||||||
|
case GESTURE_DIRECTION_LEFT:
|
||||||
|
return "left";
|
||||||
|
case GESTURE_DIRECTION_RIGHT:
|
||||||
|
return "right";
|
||||||
|
case GESTURE_DIRECTION_INWARD:
|
||||||
|
return "inward";
|
||||||
|
case GESTURE_DIRECTION_OUTWARD:
|
||||||
|
return "outward";
|
||||||
|
case GESTURE_DIRECTION_CLOCKWISE:
|
||||||
|
return "clockwise";
|
||||||
|
case GESTURE_DIRECTION_COUNTERCLOCKWISE:
|
||||||
|
return "counterclockwise";
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper to turn combination of directions flags into string representation.
|
||||||
|
static char *gesture_directions_to_string(uint32_t directions) {
|
||||||
|
char *result = NULL;
|
||||||
|
|
||||||
|
for (uint8_t bit = 0; bit < 32; bit++) {
|
||||||
|
uint32_t masked = directions & (1 << bit);
|
||||||
|
if (masked) {
|
||||||
|
const char *name = gesture_direction_string(masked);
|
||||||
|
|
||||||
|
if (!name) {
|
||||||
|
name = "unknown";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!result) {
|
||||||
|
result = strdup(name);
|
||||||
|
} else {
|
||||||
|
char *new = format_str("%s+%s", result, name);
|
||||||
|
free(result);
|
||||||
|
result = new;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!result) {
|
||||||
|
return strdup("any");
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *gesture_to_string(struct gesture *gesture) {
|
||||||
|
char *directions = gesture_directions_to_string(gesture->directions);
|
||||||
|
char *result = format_str("%s:%u:%s",
|
||||||
|
gesture_type_string(gesture->type),
|
||||||
|
gesture->fingers, directions);
|
||||||
|
free(directions);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gesture_check(struct gesture *target, enum gesture_type type, uint8_t fingers) {
|
||||||
|
// Check that gesture type matches
|
||||||
|
if (target->type != type) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check that finger count matches
|
||||||
|
if (target->fingers != GESTURE_FINGERS_ANY && target->fingers != fingers) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gesture_match(struct gesture *target, struct gesture *to_match, bool exact) {
|
||||||
|
// Check type and fingers
|
||||||
|
if (!gesture_check(target, to_match->type, to_match->fingers)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enforce exact matches ...
|
||||||
|
if (exact && target->directions != to_match->directions) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ... or ensure all target directions are matched
|
||||||
|
return (target->directions & to_match->directions) == target->directions;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gesture_equal(struct gesture *a, struct gesture *b) {
|
||||||
|
return a->type == b->type
|
||||||
|
&& a->fingers == b->fingers
|
||||||
|
&& a->directions == b->directions;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return count of set bits in directions bit field.
|
||||||
|
static uint8_t gesture_directions_count(uint32_t directions) {
|
||||||
|
uint8_t count = 0;
|
||||||
|
for (; directions; directions >>= 1) {
|
||||||
|
count += directions & 1;
|
||||||
|
}
|
||||||
|
return count;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compare direction bit count of two direction.
|
||||||
|
static int8_t gesture_directions_compare(uint32_t a, uint32_t b) {
|
||||||
|
return gesture_directions_count(a) - gesture_directions_count(b);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Compare two direction based on their direction bit count
|
||||||
|
int8_t gesture_compare(struct gesture *a, struct gesture *b) {
|
||||||
|
return gesture_directions_compare(a->directions, b->directions);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gesture_tracker_begin(struct gesture_tracker *tracker,
|
||||||
|
enum gesture_type type, uint8_t fingers) {
|
||||||
|
tracker->type = type;
|
||||||
|
tracker->fingers = fingers;
|
||||||
|
|
||||||
|
tracker->dx = 0.0;
|
||||||
|
tracker->dy = 0.0;
|
||||||
|
tracker->scale = 1.0;
|
||||||
|
tracker->rotation = 0.0;
|
||||||
|
|
||||||
|
sway_log(SWAY_DEBUG, "begin tracking %s:%u:? gesture",
|
||||||
|
gesture_type_string(type), fingers);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool gesture_tracker_check(struct gesture_tracker *tracker, enum gesture_type type) {
|
||||||
|
return tracker->type == type;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gesture_tracker_update(struct gesture_tracker *tracker,
|
||||||
|
double dx, double dy, double scale, double rotation) {
|
||||||
|
if (tracker->type == GESTURE_TYPE_HOLD) {
|
||||||
|
sway_assert(false, "hold does not update.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
tracker->dx += dx;
|
||||||
|
tracker->dy += dy;
|
||||||
|
|
||||||
|
if (tracker->type == GESTURE_TYPE_PINCH) {
|
||||||
|
tracker->scale = scale;
|
||||||
|
tracker->rotation += rotation;
|
||||||
|
}
|
||||||
|
|
||||||
|
sway_log(SWAY_DEBUG, "update tracking %s:%u:? gesture: %f %f %f %f",
|
||||||
|
gesture_type_string(tracker->type),
|
||||||
|
tracker->fingers,
|
||||||
|
tracker->dx, tracker->dy,
|
||||||
|
tracker->scale, tracker->rotation);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gesture_tracker_cancel(struct gesture_tracker *tracker) {
|
||||||
|
sway_log(SWAY_DEBUG, "cancel tracking %s:%u:? gesture",
|
||||||
|
gesture_type_string(tracker->type), tracker->fingers);
|
||||||
|
|
||||||
|
tracker->type = GESTURE_TYPE_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
struct gesture *gesture_tracker_end(struct gesture_tracker *tracker) {
|
||||||
|
struct gesture *result = calloc(1, sizeof(struct gesture));
|
||||||
|
|
||||||
|
// Ignore gesture under some threshold
|
||||||
|
// TODO: Make configurable
|
||||||
|
const double min_rotation = 5;
|
||||||
|
const double min_scale_delta = 0.1;
|
||||||
|
|
||||||
|
// Determine direction
|
||||||
|
switch(tracker->type) {
|
||||||
|
// Gestures with scale and rotation
|
||||||
|
case GESTURE_TYPE_PINCH:
|
||||||
|
if (tracker->rotation > min_rotation) {
|
||||||
|
result->directions |= GESTURE_DIRECTION_CLOCKWISE;
|
||||||
|
}
|
||||||
|
if (tracker->rotation < -min_rotation) {
|
||||||
|
result->directions |= GESTURE_DIRECTION_COUNTERCLOCKWISE;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tracker->scale > (1.0 + min_scale_delta)) {
|
||||||
|
result->directions |= GESTURE_DIRECTION_OUTWARD;
|
||||||
|
}
|
||||||
|
if (tracker->scale < (1.0 - min_scale_delta)) {
|
||||||
|
result->directions |= GESTURE_DIRECTION_INWARD;
|
||||||
|
}
|
||||||
|
__attribute__ ((fallthrough));
|
||||||
|
// Gestures with dx and dy
|
||||||
|
case GESTURE_TYPE_SWIPE:
|
||||||
|
if (fabs(tracker->dx) > fabs(tracker->dy)) {
|
||||||
|
if (tracker->dx > 0) {
|
||||||
|
result->directions |= GESTURE_DIRECTION_RIGHT;
|
||||||
|
} else {
|
||||||
|
result->directions |= GESTURE_DIRECTION_LEFT;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (tracker->dy > 0) {
|
||||||
|
result->directions |= GESTURE_DIRECTION_DOWN;
|
||||||
|
} else {
|
||||||
|
result->directions |= GESTURE_DIRECTION_UP;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Gesture without any direction
|
||||||
|
case GESTURE_TYPE_HOLD:
|
||||||
|
break;
|
||||||
|
// Not tracking any gesture
|
||||||
|
case GESTURE_TYPE_NONE:
|
||||||
|
sway_assert(false, "Not tracking any gesture.");
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
result->type = tracker->type;
|
||||||
|
result->fingers = tracker->fingers;
|
||||||
|
|
||||||
|
char *description = gesture_to_string(result);
|
||||||
|
sway_log(SWAY_DEBUG, "end tracking gesture: %s", description);
|
||||||
|
free(description);
|
||||||
|
|
||||||
|
tracker->type = GESTURE_TYPE_NONE;
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200112L
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200112L
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
lib_sway_common = static_library(
|
lib_sway_common = static_library(
|
||||||
'sway-common',
|
'sway-common',
|
||||||
files(
|
files(
|
||||||
'background-image.c',
|
|
||||||
'cairo.c',
|
'cairo.c',
|
||||||
|
'gesture.c',
|
||||||
'ipc-client.c',
|
'ipc-client.c',
|
||||||
'log.c',
|
'log.c',
|
||||||
'loop.c',
|
'loop.c',
|
||||||
|
@ -13,7 +13,6 @@ lib_sway_common = static_library(
|
||||||
),
|
),
|
||||||
dependencies: [
|
dependencies: [
|
||||||
cairo,
|
cairo,
|
||||||
gdk_pixbuf,
|
|
||||||
pango,
|
pango,
|
||||||
pangocairo,
|
pangocairo,
|
||||||
wayland_client.partial_dependency(compile_args: true)
|
wayland_client.partial_dependency(compile_args: true)
|
||||||
|
|
|
@ -50,9 +50,11 @@ size_t escape_markup_text(const char *src, char *dest) {
|
||||||
return length;
|
return length;
|
||||||
}
|
}
|
||||||
|
|
||||||
PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
|
PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc,
|
||||||
const char *text, double scale, bool markup) {
|
const char *text, double scale, bool markup) {
|
||||||
PangoLayout *layout = pango_cairo_create_layout(cairo);
|
PangoLayout *layout = pango_cairo_create_layout(cairo);
|
||||||
|
pango_context_set_round_glyph_positions(pango_layout_get_context(layout), false);
|
||||||
|
|
||||||
PangoAttrList *attrs;
|
PangoAttrList *attrs;
|
||||||
if (markup) {
|
if (markup) {
|
||||||
char *buf;
|
char *buf;
|
||||||
|
@ -73,46 +75,38 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
|
||||||
}
|
}
|
||||||
|
|
||||||
pango_attr_list_insert(attrs, pango_attr_scale_new(scale));
|
pango_attr_list_insert(attrs, pango_attr_scale_new(scale));
|
||||||
PangoFontDescription *desc = pango_font_description_from_string(font);
|
|
||||||
pango_layout_set_font_description(layout, desc);
|
pango_layout_set_font_description(layout, desc);
|
||||||
pango_layout_set_single_paragraph_mode(layout, 1);
|
pango_layout_set_single_paragraph_mode(layout, 1);
|
||||||
pango_layout_set_attributes(layout, attrs);
|
pango_layout_set_attributes(layout, attrs);
|
||||||
pango_attr_list_unref(attrs);
|
pango_attr_list_unref(attrs);
|
||||||
pango_font_description_free(desc);
|
|
||||||
return layout;
|
return layout;
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
|
void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height,
|
||||||
int *baseline, double scale, bool markup, const char *fmt, ...) {
|
int *baseline, double scale, bool markup, const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
// Add one since vsnprintf excludes null terminator.
|
char *buf = vformat_str(fmt, args);
|
||||||
int length = vsnprintf(NULL, 0, fmt, args) + 1;
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
char *buf = malloc(length);
|
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
sway_log(SWAY_ERROR, "Failed to allocate memory");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
va_start(args, fmt);
|
|
||||||
vsnprintf(buf, length, fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
PangoLayout *layout = get_pango_layout(cairo, font, buf, scale, markup);
|
PangoLayout *layout = get_pango_layout(cairo, desc, buf, scale, markup);
|
||||||
pango_cairo_update_layout(cairo, layout);
|
pango_cairo_update_layout(cairo, layout);
|
||||||
pango_layout_get_pixel_size(layout, width, height);
|
pango_layout_get_pixel_size(layout, width, height);
|
||||||
if (baseline) {
|
if (baseline) {
|
||||||
*baseline = pango_layout_get_baseline(layout) / PANGO_SCALE;
|
*baseline = pango_layout_get_baseline(layout) / PANGO_SCALE;
|
||||||
}
|
}
|
||||||
g_object_unref(layout);
|
g_object_unref(layout);
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
void get_text_metrics(const char *font, int *height, int *baseline) {
|
void get_text_metrics(const PangoFontDescription *description, int *height, int *baseline) {
|
||||||
cairo_t *cairo = cairo_create(NULL);
|
cairo_t *cairo = cairo_create(NULL);
|
||||||
PangoContext *pango = pango_cairo_create_context(cairo);
|
PangoContext *pango = pango_cairo_create_context(cairo);
|
||||||
PangoFontDescription *description = pango_font_description_from_string(font);
|
pango_context_set_round_glyph_positions(pango, false);
|
||||||
// When passing NULL as a language, pango uses the current locale.
|
// When passing NULL as a language, pango uses the current locale.
|
||||||
PangoFontMetrics *metrics = pango_context_get_metrics(pango, description, NULL);
|
PangoFontMetrics *metrics = pango_context_get_metrics(pango, description, NULL);
|
||||||
|
|
||||||
|
@ -120,29 +114,21 @@ void get_text_metrics(const char *font, int *height, int *baseline) {
|
||||||
*height = *baseline + pango_font_metrics_get_descent(metrics) / PANGO_SCALE;
|
*height = *baseline + pango_font_metrics_get_descent(metrics) / PANGO_SCALE;
|
||||||
|
|
||||||
pango_font_metrics_unref(metrics);
|
pango_font_metrics_unref(metrics);
|
||||||
pango_font_description_free(description);
|
|
||||||
g_object_unref(pango);
|
g_object_unref(pango);
|
||||||
cairo_destroy(cairo);
|
cairo_destroy(cairo);
|
||||||
}
|
}
|
||||||
|
|
||||||
void render_text(cairo_t *cairo, const char *font,
|
void render_text(cairo_t *cairo, const PangoFontDescription *desc,
|
||||||
double scale, bool markup, const char *fmt, ...) {
|
double scale, bool markup, const char *fmt, ...) {
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
// Add one since vsnprintf excludes null terminator.
|
char *buf = vformat_str(fmt, args);
|
||||||
int length = vsnprintf(NULL, 0, fmt, args) + 1;
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
|
|
||||||
char *buf = malloc(length);
|
|
||||||
if (buf == NULL) {
|
if (buf == NULL) {
|
||||||
sway_log(SWAY_ERROR, "Failed to allocate memory");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
va_start(args, fmt);
|
|
||||||
vsnprintf(buf, length, fmt, args);
|
|
||||||
va_end(args);
|
|
||||||
|
|
||||||
PangoLayout *layout = get_pango_layout(cairo, font, buf, scale, markup);
|
PangoLayout *layout = get_pango_layout(cairo, desc, buf, scale, markup);
|
||||||
cairo_font_options_t *fo = cairo_font_options_create();
|
cairo_font_options_t *fo = cairo_font_options_create();
|
||||||
cairo_get_font_options(cairo, fo);
|
cairo_get_font_options(cairo, fo);
|
||||||
pango_cairo_context_set_font_options(pango_layout_get_context(layout), fo);
|
pango_cairo_context_set_font_options(pango_layout_get_context(layout), fo);
|
||||||
|
@ -150,5 +136,6 @@ void render_text(cairo_t *cairo, const char *font,
|
||||||
pango_cairo_update_layout(cairo, layout);
|
pango_cairo_update_layout(cairo, layout);
|
||||||
pango_cairo_show_layout(cairo, layout);
|
pango_cairo_show_layout(cairo, layout);
|
||||||
g_object_unref(layout);
|
g_object_unref(layout);
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
#include <stdarg.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -328,3 +328,35 @@ bool expand_path(char **path) {
|
||||||
wordfree(&p);
|
wordfree(&p);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *vformat_str(const char *fmt, va_list args) {
|
||||||
|
char *str = NULL;
|
||||||
|
va_list args_copy;
|
||||||
|
va_copy(args_copy, args);
|
||||||
|
|
||||||
|
int len = vsnprintf(NULL, 0, fmt, args);
|
||||||
|
if (len < 0) {
|
||||||
|
sway_log_errno(SWAY_ERROR, "vsnprintf(\"%s\") failed", fmt);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
str = malloc(len + 1);
|
||||||
|
if (str == NULL) {
|
||||||
|
sway_log_errno(SWAY_ERROR, "malloc() failed");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
vsnprintf(str, len + 1, fmt, args_copy);
|
||||||
|
|
||||||
|
out:
|
||||||
|
va_end(args_copy);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *format_str(const char *fmt, ...) {
|
||||||
|
va_list args;
|
||||||
|
va_start(args, fmt);
|
||||||
|
char *str = vformat_str(fmt, args);
|
||||||
|
va_end(args);
|
||||||
|
return str;
|
||||||
|
}
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809L
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
@ -80,6 +79,12 @@ enum movement_unit parse_movement_unit(const char *unit) {
|
||||||
|
|
||||||
int parse_movement_amount(int argc, char **argv,
|
int parse_movement_amount(int argc, char **argv,
|
||||||
struct movement_amount *amount) {
|
struct movement_amount *amount) {
|
||||||
|
if (!sway_assert(argc > 0, "Expected args in parse_movement_amount")) {
|
||||||
|
amount->amount = 0;
|
||||||
|
amount->unit = MOVEMENT_UNIT_INVALID;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
char *err;
|
char *err;
|
||||||
amount->amount = (int)strtol(argv[0], &err, 10);
|
amount->amount = (int)strtol(argv[0], &err, 10);
|
||||||
if (*err) {
|
if (*err) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
_sway()
|
_sway()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev short long
|
||||||
_get_comp_words_by_ref cur prev
|
_get_comp_words_by_ref cur prev
|
||||||
|
|
||||||
short=(
|
short=(
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
_swaybar()
|
_swaybar()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev short long
|
||||||
_get_comp_words_by_ref cur prev
|
_get_comp_words_by_ref cur prev
|
||||||
|
|
||||||
short=(
|
short=(
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
_swaymsg()
|
_swaymsg()
|
||||||
{
|
{
|
||||||
local cur prev
|
local cur prev types short long
|
||||||
_get_comp_words_by_ref cur prev
|
_get_comp_words_by_ref cur prev
|
||||||
|
|
||||||
types=(
|
types=(
|
||||||
|
|
57
completions/meson.build
Normal file
57
completions/meson.build
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
if get_option('zsh-completions')
|
||||||
|
zsh_files = files(
|
||||||
|
'zsh/_sway',
|
||||||
|
'zsh/_swaymsg',
|
||||||
|
)
|
||||||
|
zsh_install_dir = join_paths(datadir, 'zsh', 'site-functions')
|
||||||
|
|
||||||
|
install_data(zsh_files, install_dir: zsh_install_dir)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('bash-completions')
|
||||||
|
bash_comp = dependency('bash-completion', required: false)
|
||||||
|
|
||||||
|
bash_files = files(
|
||||||
|
'bash/sway',
|
||||||
|
'bash/swaymsg',
|
||||||
|
)
|
||||||
|
|
||||||
|
if get_option('swaybar')
|
||||||
|
bash_files += files('bash/swaybar')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if bash_comp.found()
|
||||||
|
bash_install_dir = bash_comp.get_variable(
|
||||||
|
pkgconfig: 'completionsdir',
|
||||||
|
pkgconfig_define: ['datadir', datadir]
|
||||||
|
)
|
||||||
|
else
|
||||||
|
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
|
||||||
|
endif
|
||||||
|
|
||||||
|
install_data(bash_files, install_dir: bash_install_dir)
|
||||||
|
endif
|
||||||
|
|
||||||
|
if get_option('fish-completions')
|
||||||
|
fish_comp = dependency('fish', required: false)
|
||||||
|
|
||||||
|
fish_files = files(
|
||||||
|
'fish/sway.fish',
|
||||||
|
'fish/swaymsg.fish',
|
||||||
|
)
|
||||||
|
|
||||||
|
if get_option('swaynag')
|
||||||
|
fish_files += files('fish/swaynag.fish')
|
||||||
|
endif
|
||||||
|
|
||||||
|
if fish_comp.found()
|
||||||
|
fish_install_dir = fish_comp.get_variable(
|
||||||
|
pkgconfig: 'completionsdir',
|
||||||
|
pkgconfig_define: ['datadir', datadir]
|
||||||
|
)
|
||||||
|
else
|
||||||
|
fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
|
||||||
|
endif
|
||||||
|
|
||||||
|
install_data(fish_files, install_dir: fish_install_dir)
|
||||||
|
endif
|
21
config.in
21
config.in
|
@ -16,9 +16,7 @@ set $right l
|
||||||
# Your preferred terminal emulator
|
# Your preferred terminal emulator
|
||||||
set $term foot
|
set $term foot
|
||||||
# Your preferred application launcher
|
# Your preferred application launcher
|
||||||
# Note: pass the final command to swaymsg so that the resulting window can be opened
|
set $menu wmenu-run
|
||||||
# on the original workspace that the command was run on.
|
|
||||||
set $menu dmenu_path | dmenu | xargs swaymsg exec --
|
|
||||||
|
|
||||||
### Output configuration
|
### Output configuration
|
||||||
#
|
#
|
||||||
|
@ -37,7 +35,7 @@ output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
|
||||||
#
|
#
|
||||||
# exec swayidle -w \
|
# exec swayidle -w \
|
||||||
# timeout 300 'swaylock -f -c 000000' \
|
# timeout 300 'swaylock -f -c 000000' \
|
||||||
# timeout 600 'swaymsg "output * dpms off"' resume 'swaymsg "output * dpms on"' \
|
# timeout 600 'swaymsg "output * power off"' resume 'swaymsg "output * power on"' \
|
||||||
# before-sleep 'swaylock -f -c 000000'
|
# before-sleep 'swaylock -f -c 000000'
|
||||||
#
|
#
|
||||||
# This will lock your screen after 300 seconds of inactivity, then turn off
|
# This will lock your screen after 300 seconds of inactivity, then turn off
|
||||||
|
@ -195,6 +193,19 @@ mode "resize" {
|
||||||
bindsym Escape mode "default"
|
bindsym Escape mode "default"
|
||||||
}
|
}
|
||||||
bindsym $mod+r mode "resize"
|
bindsym $mod+r mode "resize"
|
||||||
|
#
|
||||||
|
# Utilities:
|
||||||
|
#
|
||||||
|
# Special keys to adjust volume via PulseAudio
|
||||||
|
bindsym --locked XF86AudioMute exec pactl set-sink-mute \@DEFAULT_SINK@ toggle
|
||||||
|
bindsym --locked XF86AudioLowerVolume exec pactl set-sink-volume \@DEFAULT_SINK@ -5%
|
||||||
|
bindsym --locked XF86AudioRaiseVolume exec pactl set-sink-volume \@DEFAULT_SINK@ +5%
|
||||||
|
bindsym --locked XF86AudioMicMute exec pactl set-source-mute \@DEFAULT_SOURCE@ toggle
|
||||||
|
# Special keys to adjust brightness via brightnessctl
|
||||||
|
bindsym --locked XF86MonBrightnessDown exec brightnessctl set 5%-
|
||||||
|
bindsym --locked XF86MonBrightnessUp exec brightnessctl set 5%+
|
||||||
|
# Special key to take a screenshot with grim
|
||||||
|
bindsym Print exec grim
|
||||||
|
|
||||||
#
|
#
|
||||||
# Status Bar:
|
# Status Bar:
|
||||||
|
@ -205,7 +216,7 @@ bar {
|
||||||
|
|
||||||
# When the status_command prints a new line to stdout, swaybar updates.
|
# When the status_command prints a new line to stdout, swaybar updates.
|
||||||
# The default just shows the current date and time.
|
# The default just shows the current date and time.
|
||||||
status_command while date +'%Y-%m-%d %I:%M:%S %p'; do sleep 1; done
|
status_command while date +'%Y-%m-%d %X'; do sleep 1; done
|
||||||
|
|
||||||
colors {
|
colors {
|
||||||
statusline #ffffff
|
statusline #ffffff
|
||||||
|
|
|
@ -1,124 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
# This script requires i3ipc-python package (install it from a system package manager
|
|
||||||
# or pip).
|
|
||||||
# It adds icons to the workspace name for each open window.
|
|
||||||
# Set your keybindings like this: set $workspace1 workspace number 1
|
|
||||||
# Add your icons to WINDOW_ICONS.
|
|
||||||
# Based on https://github.com/maximbaz/dotfiles/blob/master/bin/i3-autoname-workspaces
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import i3ipc
|
|
||||||
import logging
|
|
||||||
import re
|
|
||||||
import signal
|
|
||||||
import sys
|
|
||||||
|
|
||||||
WINDOW_ICONS = {
|
|
||||||
"firefox": "",
|
|
||||||
}
|
|
||||||
|
|
||||||
DEFAULT_ICON = ""
|
|
||||||
|
|
||||||
|
|
||||||
def icon_for_window(window):
|
|
||||||
name = None
|
|
||||||
if window.app_id is not None and len(window.app_id) > 0:
|
|
||||||
name = window.app_id.lower()
|
|
||||||
elif window.window_class is not None and len(window.window_class) > 0:
|
|
||||||
name = window.window_class.lower()
|
|
||||||
|
|
||||||
if name in WINDOW_ICONS:
|
|
||||||
return WINDOW_ICONS[name]
|
|
||||||
|
|
||||||
logging.info("No icon available for window with name: %s" % str(name))
|
|
||||||
return DEFAULT_ICON
|
|
||||||
|
|
||||||
def rename_workspaces(ipc):
|
|
||||||
for workspace in ipc.get_tree().workspaces():
|
|
||||||
name_parts = parse_workspace_name(workspace.name)
|
|
||||||
icon_tuple = ()
|
|
||||||
for w in workspace:
|
|
||||||
if w.app_id is not None or w.window_class is not None:
|
|
||||||
icon = icon_for_window(w)
|
|
||||||
if not ARGUMENTS.duplicates and icon in icon_tuple:
|
|
||||||
continue
|
|
||||||
icon_tuple += (icon,)
|
|
||||||
name_parts["icons"] = " ".join(icon_tuple) + " "
|
|
||||||
new_name = construct_workspace_name(name_parts)
|
|
||||||
ipc.command('rename workspace "%s" to "%s"' % (workspace.name, new_name))
|
|
||||||
|
|
||||||
|
|
||||||
def undo_window_renaming(ipc):
|
|
||||||
for workspace in ipc.get_tree().workspaces():
|
|
||||||
name_parts = parse_workspace_name(workspace.name)
|
|
||||||
name_parts["icons"] = None
|
|
||||||
new_name = construct_workspace_name(name_parts)
|
|
||||||
ipc.command('rename workspace "%s" to "%s"' % (workspace.name, new_name))
|
|
||||||
ipc.main_quit()
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
def parse_workspace_name(name):
|
|
||||||
return re.match(
|
|
||||||
"(?P<num>[0-9]+):?(?P<shortname>\w+)? ?(?P<icons>.+)?", name
|
|
||||||
).groupdict()
|
|
||||||
|
|
||||||
|
|
||||||
def construct_workspace_name(parts):
|
|
||||||
new_name = str(parts["num"])
|
|
||||||
if parts["shortname"] or parts["icons"]:
|
|
||||||
new_name += ":"
|
|
||||||
|
|
||||||
if parts["shortname"]:
|
|
||||||
new_name += parts["shortname"]
|
|
||||||
|
|
||||||
if parts["icons"]:
|
|
||||||
new_name += " " + parts["icons"]
|
|
||||||
|
|
||||||
return new_name
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
description="This script automatically changes the workspace name in sway depending on your open applications."
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"--duplicates",
|
|
||||||
"-d",
|
|
||||||
action="store_true",
|
|
||||||
help="Set it when you want an icon for each instance of the same application per workspace.",
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"--logfile",
|
|
||||||
"-l",
|
|
||||||
type=str,
|
|
||||||
default="/tmp/sway-autoname-workspaces.log",
|
|
||||||
help="Path for the logfile.",
|
|
||||||
)
|
|
||||||
args = parser.parse_args()
|
|
||||||
global ARGUMENTS
|
|
||||||
ARGUMENTS = args
|
|
||||||
|
|
||||||
logging.basicConfig(
|
|
||||||
level=logging.INFO,
|
|
||||||
filename=ARGUMENTS.logfile,
|
|
||||||
filemode="w",
|
|
||||||
format="%(message)s",
|
|
||||||
)
|
|
||||||
|
|
||||||
ipc = i3ipc.Connection()
|
|
||||||
|
|
||||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
|
||||||
signal.signal(sig, lambda signal, frame: undo_window_renaming(ipc))
|
|
||||||
|
|
||||||
def window_event_handler(ipc, e):
|
|
||||||
if e.change in ["new", "close", "move"]:
|
|
||||||
rename_workspaces(ipc)
|
|
||||||
|
|
||||||
ipc.on("window", window_event_handler)
|
|
||||||
|
|
||||||
rename_workspaces(ipc)
|
|
||||||
|
|
||||||
ipc.main()
|
|
||||||
|
|
154
contrib/grimshot
154
contrib/grimshot
|
@ -1,154 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
## Grimshot: a helper for screenshots within sway
|
|
||||||
## Requirements:
|
|
||||||
## - `grim`: screenshot utility for wayland
|
|
||||||
## - `slurp`: to select an area
|
|
||||||
## - `swaymsg`: to read properties of current window
|
|
||||||
## - `wl-copy`: clipboard utility
|
|
||||||
## - `jq`: json utility to parse swaymsg output
|
|
||||||
## - `notify-send`: to show notifications
|
|
||||||
## Those are needed to be installed, if unsure, run `grimshot check`
|
|
||||||
##
|
|
||||||
## See `man 1 grimshot` or `grimshot usage` for further details.
|
|
||||||
|
|
||||||
getTargetDirectory() {
|
|
||||||
test -f ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs && \
|
|
||||||
. ${XDG_CONFIG_HOME:-~/.config}/user-dirs.dirs
|
|
||||||
|
|
||||||
echo ${XDG_SCREENSHOTS_DIR:-${XDG_PICTURES_DIR:-$HOME}}
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$1" = "--notify" ]; then
|
|
||||||
NOTIFY=yes
|
|
||||||
shift 1
|
|
||||||
else
|
|
||||||
NOTIFY=no
|
|
||||||
fi
|
|
||||||
|
|
||||||
ACTION=${1:-usage}
|
|
||||||
SUBJECT=${2:-screen}
|
|
||||||
FILE=${3:-$(getTargetDirectory)/$(date -Ins).png}
|
|
||||||
|
|
||||||
if [ "$ACTION" != "save" ] && [ "$ACTION" != "copy" ] && [ "$ACTION" != "check" ]; then
|
|
||||||
echo "Usage:"
|
|
||||||
echo " grimshot [--notify] (copy|save) [active|screen|output|area|window] [FILE|-]"
|
|
||||||
echo " grimshot check"
|
|
||||||
echo " grimshot usage"
|
|
||||||
echo ""
|
|
||||||
echo "Commands:"
|
|
||||||
echo " copy: Copy the screenshot data into the clipboard."
|
|
||||||
echo " save: Save the screenshot to a regular file or '-' to pipe to STDOUT."
|
|
||||||
echo " check: Verify if required tools are installed and exit."
|
|
||||||
echo " usage: Show this message and exit."
|
|
||||||
echo ""
|
|
||||||
echo "Targets:"
|
|
||||||
echo " active: Currently active window."
|
|
||||||
echo " screen: All visible outputs."
|
|
||||||
echo " output: Currently active output."
|
|
||||||
echo " area: Manually select a region."
|
|
||||||
echo " window: Manually select a window."
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
notify() {
|
|
||||||
notify-send -t 3000 -a grimshot "$@"
|
|
||||||
}
|
|
||||||
notifyOk() {
|
|
||||||
[ "$NOTIFY" = "no" ] && return
|
|
||||||
|
|
||||||
TITLE=${2:-"Screenshot"}
|
|
||||||
MESSAGE=${1:-"OK"}
|
|
||||||
notify "$TITLE" "$MESSAGE"
|
|
||||||
}
|
|
||||||
notifyError() {
|
|
||||||
if [ $NOTIFY = "yes" ]; then
|
|
||||||
TITLE=${2:-"Screenshot"}
|
|
||||||
MESSAGE=${1:-"Error taking screenshot with grim"}
|
|
||||||
notify -u critical "$TITLE" "$MESSAGE"
|
|
||||||
else
|
|
||||||
echo $1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
die() {
|
|
||||||
MSG=${1:-Bye}
|
|
||||||
notifyError "Error: $MSG"
|
|
||||||
exit 2
|
|
||||||
}
|
|
||||||
|
|
||||||
check() {
|
|
||||||
COMMAND=$1
|
|
||||||
if command -v "$COMMAND" > /dev/null 2>&1; then
|
|
||||||
RESULT="OK"
|
|
||||||
else
|
|
||||||
RESULT="NOT FOUND"
|
|
||||||
fi
|
|
||||||
echo " $COMMAND: $RESULT"
|
|
||||||
}
|
|
||||||
|
|
||||||
takeScreenshot() {
|
|
||||||
FILE=$1
|
|
||||||
GEOM=$2
|
|
||||||
OUTPUT=$3
|
|
||||||
if [ ! -z "$OUTPUT" ]; then
|
|
||||||
grim -o "$OUTPUT" "$FILE" || die "Unable to invoke grim"
|
|
||||||
elif [ -z "$GEOM" ]; then
|
|
||||||
grim "$FILE" || die "Unable to invoke grim"
|
|
||||||
else
|
|
||||||
grim -g "$GEOM" "$FILE" || die "Unable to invoke grim"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ "$ACTION" = "check" ] ; then
|
|
||||||
echo "Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH..."
|
|
||||||
check grim
|
|
||||||
check slurp
|
|
||||||
check swaymsg
|
|
||||||
check wl-copy
|
|
||||||
check jq
|
|
||||||
check notify-send
|
|
||||||
exit
|
|
||||||
elif [ "$SUBJECT" = "area" ] ; then
|
|
||||||
GEOM=$(slurp -d)
|
|
||||||
# Check if user exited slurp without selecting the area
|
|
||||||
if [ -z "$GEOM" ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
WHAT="Area"
|
|
||||||
elif [ "$SUBJECT" = "active" ] ; then
|
|
||||||
FOCUSED=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)')
|
|
||||||
GEOM=$(echo "$FOCUSED" | jq -r '.rect | "\(.x),\(.y) \(.width)x\(.height)"')
|
|
||||||
APP_ID=$(echo "$FOCUSED" | jq -r '.app_id')
|
|
||||||
WHAT="$APP_ID window"
|
|
||||||
elif [ "$SUBJECT" = "screen" ] ; then
|
|
||||||
GEOM=""
|
|
||||||
WHAT="Screen"
|
|
||||||
elif [ "$SUBJECT" = "output" ] ; then
|
|
||||||
GEOM=""
|
|
||||||
OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name')
|
|
||||||
WHAT="$OUTPUT"
|
|
||||||
elif [ "$SUBJECT" = "window" ] ; then
|
|
||||||
GEOM=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)
|
|
||||||
# Check if user exited slurp without selecting the area
|
|
||||||
if [ -z "$GEOM" ]; then
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
WHAT="Window"
|
|
||||||
else
|
|
||||||
die "Unknown subject to take a screen shot from" "$SUBJECT"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "$ACTION" = "copy" ] ; then
|
|
||||||
takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error"
|
|
||||||
notifyOk "$WHAT copied to buffer"
|
|
||||||
else
|
|
||||||
if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
|
|
||||||
TITLE="Screenshot of $SUBJECT"
|
|
||||||
MESSAGE=$(basename "$FILE")
|
|
||||||
notifyOk "$MESSAGE" "$TITLE"
|
|
||||||
echo $FILE
|
|
||||||
else
|
|
||||||
notifyError "Error taking screenshot with grim"
|
|
||||||
fi
|
|
||||||
fi
|
|
|
@ -1,104 +0,0 @@
|
||||||
.\" Generated by scdoc 1.11.1
|
|
||||||
.\" Complete documentation for this program is not available as a GNU info page
|
|
||||||
.ie \n(.g .ds Aq \(aq
|
|
||||||
.el .ds Aq '
|
|
||||||
.nh
|
|
||||||
.ad l
|
|
||||||
.\" Begin generated content:
|
|
||||||
.TH "grimshot" "1" "2021-02-23"
|
|
||||||
.P
|
|
||||||
.SH NAME
|
|
||||||
.P
|
|
||||||
grimshot - a helper for screenshots within sway
|
|
||||||
.P
|
|
||||||
.SH SYNOPSIS
|
|
||||||
.P
|
|
||||||
\fBgrimshot\fR [--notify] (copy|save) [TARGET] [FILE]
|
|
||||||
.br
|
|
||||||
\fBgrimshot\fR check
|
|
||||||
.br
|
|
||||||
\fBgrimshot\fR usage
|
|
||||||
.P
|
|
||||||
.SH OPTIONS
|
|
||||||
.P
|
|
||||||
\fB--notify\fR
|
|
||||||
.RS 4
|
|
||||||
Show notifications to the user that a screenshot has been taken.\&
|
|
||||||
.P
|
|
||||||
.RE
|
|
||||||
\fBsave\fR
|
|
||||||
.RS 4
|
|
||||||
Save the screenshot into a regular file.\& Grimshot will write images
|
|
||||||
files to \fBXDG_SCREENSHOTS_DIR\fR if this is set (or defined
|
|
||||||
in \fBuser-dirs.\&dir\fR), or otherwise fall back to \fBXDG_PICTURES_DIR\fR.\&
|
|
||||||
Set FILE to '-' to pipe the output to STDOUT.\&
|
|
||||||
.P
|
|
||||||
.RE
|
|
||||||
\fBcopy\fR
|
|
||||||
.RS 4
|
|
||||||
Copy the screenshot data (as image/png) into the clipboard.\&
|
|
||||||
.P
|
|
||||||
.RE
|
|
||||||
.SH DESCRIPTION
|
|
||||||
.P
|
|
||||||
Grimshot is an easy-to-use screenshot utility for sway.\& It provides a
|
|
||||||
convenient interface over grim, slurp and jq, and supports storing the
|
|
||||||
screenshot either directly to the clipboard using wl-copy or to a file.\&
|
|
||||||
.P
|
|
||||||
.SH EXAMPLES
|
|
||||||
.P
|
|
||||||
An example usage pattern is to add these bindings to your sway config:
|
|
||||||
.P
|
|
||||||
.nf
|
|
||||||
.RS 4
|
|
||||||
# Screenshots:
|
|
||||||
# Super+P: Current window
|
|
||||||
# Super+Shift+p: Select area
|
|
||||||
# Super+Alt+p Current output
|
|
||||||
# Super+Ctrl+p Select a window
|
|
||||||
|
|
||||||
bindsym Mod4+p exec grimshot save active
|
|
||||||
bindsym Mod4+Shift+p exec grimshot save area
|
|
||||||
bindsym Mod4+Mod1+p exec grimshot save output
|
|
||||||
bindsym Mod4+Ctrl+p exec grimshot save window
|
|
||||||
.fi
|
|
||||||
.RE
|
|
||||||
.P
|
|
||||||
.SH TARGETS
|
|
||||||
.P
|
|
||||||
grimshot can capture the following named targets:
|
|
||||||
.P
|
|
||||||
\fIactive\fR
|
|
||||||
.RS 4
|
|
||||||
Captures the currently active window.\&
|
|
||||||
.P
|
|
||||||
.RE
|
|
||||||
\fIscreen\fR
|
|
||||||
.RS 4
|
|
||||||
Captures the entire screen.\& This includes all visible outputs.\&
|
|
||||||
.P
|
|
||||||
.RE
|
|
||||||
\fIarea\fR
|
|
||||||
.RS 4
|
|
||||||
Allows manually selecting a rectangular region, and captures that.\&
|
|
||||||
.P
|
|
||||||
.RE
|
|
||||||
\fIwindow\fR
|
|
||||||
.RS 4
|
|
||||||
Allows manually selecting a single window (by clicking on it), and
|
|
||||||
captures it.\&
|
|
||||||
.P
|
|
||||||
.RE
|
|
||||||
\fIoutput\fR
|
|
||||||
.RS 4
|
|
||||||
Captures the currently active output.\&
|
|
||||||
.P
|
|
||||||
.RE
|
|
||||||
.SH OUTPUT
|
|
||||||
.P
|
|
||||||
Grimshot will print the filename of the captured screenshot to stdout if called
|
|
||||||
with the \fIsave\fR subcommand.\&
|
|
||||||
.P
|
|
||||||
.SH SEE ALSO
|
|
||||||
.P
|
|
||||||
\fBgrim\fR(1)
|
|
|
@ -1,77 +0,0 @@
|
||||||
grimshot(1)
|
|
||||||
|
|
||||||
# NAME
|
|
||||||
|
|
||||||
grimshot - a helper for screenshots within sway
|
|
||||||
|
|
||||||
# SYNOPSIS
|
|
||||||
|
|
||||||
*grimshot* [--notify] (copy|save) [TARGET] [FILE]++
|
|
||||||
*grimshot* check++
|
|
||||||
*grimshot* usage
|
|
||||||
|
|
||||||
# OPTIONS
|
|
||||||
|
|
||||||
*--notify*
|
|
||||||
Show notifications to the user that a screenshot has been taken.
|
|
||||||
|
|
||||||
*save*
|
|
||||||
Save the screenshot into a regular file. Grimshot will write images
|
|
||||||
files to *XDG_SCREENSHOTS_DIR* if this is set (or defined
|
|
||||||
in *user-dirs.dir*), or otherwise fall back to *XDG_PICTURES_DIR*.
|
|
||||||
Set FILE to '-' to pipe the output to STDOUT.
|
|
||||||
|
|
||||||
*copy*
|
|
||||||
Copy the screenshot data (as image/png) into the clipboard.
|
|
||||||
|
|
||||||
# DESCRIPTION
|
|
||||||
|
|
||||||
Grimshot is an easy-to-use screenshot utility for sway. It provides a
|
|
||||||
convenient interface over grim, slurp and jq, and supports storing the
|
|
||||||
screenshot either directly to the clipboard using wl-copy or to a file.
|
|
||||||
|
|
||||||
# EXAMPLES
|
|
||||||
|
|
||||||
An example usage pattern is to add these bindings to your sway config:
|
|
||||||
|
|
||||||
```
|
|
||||||
# Screenshots:
|
|
||||||
# Super+P: Current window
|
|
||||||
# Super+Shift+p: Select area
|
|
||||||
# Super+Alt+p Current output
|
|
||||||
# Super+Ctrl+p Select a window
|
|
||||||
|
|
||||||
bindsym Mod4+p exec grimshot save active
|
|
||||||
bindsym Mod4+Shift+p exec grimshot save area
|
|
||||||
bindsym Mod4+Mod1+p exec grimshot save output
|
|
||||||
bindsym Mod4+Ctrl+p exec grimshot save window
|
|
||||||
```
|
|
||||||
|
|
||||||
# TARGETS
|
|
||||||
|
|
||||||
grimshot can capture the following named targets:
|
|
||||||
|
|
||||||
_active_
|
|
||||||
Captures the currently active window.
|
|
||||||
|
|
||||||
_screen_
|
|
||||||
Captures the entire screen. This includes all visible outputs.
|
|
||||||
|
|
||||||
_area_
|
|
||||||
Allows manually selecting a rectangular region, and captures that.
|
|
||||||
|
|
||||||
_window_
|
|
||||||
Allows manually selecting a single window (by clicking on it), and
|
|
||||||
captures it.
|
|
||||||
|
|
||||||
_output_
|
|
||||||
Captures the currently active output.
|
|
||||||
|
|
||||||
# OUTPUT
|
|
||||||
|
|
||||||
Grimshot will print the filename of the captured screenshot to stdout if called
|
|
||||||
with the _save_ subcommand.
|
|
||||||
|
|
||||||
# SEE ALSO
|
|
||||||
|
|
||||||
*grim*(1)
|
|
|
@ -1,69 +0,0 @@
|
||||||
#!/usr/bin/python
|
|
||||||
|
|
||||||
# This script requires i3ipc-python package (install it from a system package manager
|
|
||||||
# or pip).
|
|
||||||
# It makes inactive windows transparent. Use `transparency_val` variable to control
|
|
||||||
# transparency strength in range of 0…1 or use the command line argument -o.
|
|
||||||
|
|
||||||
import argparse
|
|
||||||
import i3ipc
|
|
||||||
import signal
|
|
||||||
import sys
|
|
||||||
from functools import partial
|
|
||||||
|
|
||||||
def on_window_focus(inactive_opacity, ipc, event):
|
|
||||||
global prev_focused
|
|
||||||
global prev_workspace
|
|
||||||
|
|
||||||
focused_workspace = ipc.get_tree().find_focused()
|
|
||||||
|
|
||||||
if focused_workspace == None:
|
|
||||||
return
|
|
||||||
|
|
||||||
focused = event.container
|
|
||||||
workspace = focused_workspace.workspace().num
|
|
||||||
|
|
||||||
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
|
|
||||||
focused.command("opacity 1")
|
|
||||||
if workspace == prev_workspace:
|
|
||||||
prev_focused.command("opacity " + inactive_opacity)
|
|
||||||
prev_focused = focused
|
|
||||||
prev_workspace = workspace
|
|
||||||
|
|
||||||
|
|
||||||
def remove_opacity(ipc):
|
|
||||||
for workspace in ipc.get_tree().workspaces():
|
|
||||||
for w in workspace:
|
|
||||||
w.command("opacity 1")
|
|
||||||
ipc.main_quit()
|
|
||||||
sys.exit(0)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
transparency_val = "0.80"
|
|
||||||
|
|
||||||
parser = argparse.ArgumentParser(
|
|
||||||
description="This script allows you to set the transparency of unfocused windows in sway."
|
|
||||||
)
|
|
||||||
parser.add_argument(
|
|
||||||
"--opacity",
|
|
||||||
"-o",
|
|
||||||
type=str,
|
|
||||||
default=transparency_val,
|
|
||||||
help="set opacity value in range 0...1",
|
|
||||||
)
|
|
||||||
args = parser.parse_args()
|
|
||||||
|
|
||||||
ipc = i3ipc.Connection()
|
|
||||||
prev_focused = None
|
|
||||||
prev_workspace = ipc.get_tree().find_focused().workspace().num
|
|
||||||
|
|
||||||
for window in ipc.get_tree():
|
|
||||||
if window.focused:
|
|
||||||
prev_focused = window
|
|
||||||
else:
|
|
||||||
window.command("opacity " + args.opacity)
|
|
||||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
|
||||||
signal.signal(sig, lambda signal, frame: remove_opacity(ipc))
|
|
||||||
ipc.on("window::focus", partial(on_window_focus, args.opacity))
|
|
||||||
ipc.main()
|
|
|
@ -1,20 +0,0 @@
|
||||||
#ifndef _SWAY_BACKGROUND_IMAGE_H
|
|
||||||
#define _SWAY_BACKGROUND_IMAGE_H
|
|
||||||
#include "cairo_util.h"
|
|
||||||
|
|
||||||
enum background_mode {
|
|
||||||
BACKGROUND_MODE_STRETCH,
|
|
||||||
BACKGROUND_MODE_FILL,
|
|
||||||
BACKGROUND_MODE_FIT,
|
|
||||||
BACKGROUND_MODE_CENTER,
|
|
||||||
BACKGROUND_MODE_TILE,
|
|
||||||
BACKGROUND_MODE_SOLID_COLOR,
|
|
||||||
BACKGROUND_MODE_INVALID,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum background_mode parse_background_mode(const char *mode);
|
|
||||||
cairo_surface_t *load_background_image(const char *path);
|
|
||||||
void render_background_image(cairo_t *cairo, cairo_surface_t *image,
|
|
||||||
enum background_mode mode, int buffer_width, int buffer_height);
|
|
||||||
|
|
||||||
#endif
|
|
104
include/gesture.h
Normal file
104
include/gesture.h
Normal file
|
@ -0,0 +1,104 @@
|
||||||
|
#ifndef _SWAY_GESTURE_H
|
||||||
|
#define _SWAY_GESTURE_H
|
||||||
|
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A gesture type used in binding.
|
||||||
|
*/
|
||||||
|
enum gesture_type {
|
||||||
|
GESTURE_TYPE_NONE = 0,
|
||||||
|
GESTURE_TYPE_HOLD,
|
||||||
|
GESTURE_TYPE_PINCH,
|
||||||
|
GESTURE_TYPE_SWIPE,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Turns single type enum value to constant string representation.
|
||||||
|
const char *gesture_type_string(enum gesture_type direction);
|
||||||
|
|
||||||
|
// Value to use to accept any finger count
|
||||||
|
extern const uint8_t GESTURE_FINGERS_ANY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A gesture direction used in binding.
|
||||||
|
*/
|
||||||
|
enum gesture_direction {
|
||||||
|
GESTURE_DIRECTION_NONE = 0,
|
||||||
|
// Directions based on delta x and y
|
||||||
|
GESTURE_DIRECTION_UP = 1 << 0,
|
||||||
|
GESTURE_DIRECTION_DOWN = 1 << 1,
|
||||||
|
GESTURE_DIRECTION_LEFT = 1 << 2,
|
||||||
|
GESTURE_DIRECTION_RIGHT = 1 << 3,
|
||||||
|
// Directions based on scale
|
||||||
|
GESTURE_DIRECTION_INWARD = 1 << 4,
|
||||||
|
GESTURE_DIRECTION_OUTWARD = 1 << 5,
|
||||||
|
// Directions based on rotation
|
||||||
|
GESTURE_DIRECTION_CLOCKWISE = 1 << 6,
|
||||||
|
GESTURE_DIRECTION_COUNTERCLOCKWISE = 1 << 7,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Turns single direction enum value to constant string representation.
|
||||||
|
const char *gesture_direction_string(enum gesture_direction direction);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Struct representing a pointer gesture
|
||||||
|
*/
|
||||||
|
struct gesture {
|
||||||
|
enum gesture_type type;
|
||||||
|
uint8_t fingers;
|
||||||
|
uint32_t directions;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Parses gesture from <gesture>[:<fingers>][:<directions>] string.
|
||||||
|
*
|
||||||
|
* Return NULL on success, otherwise error message string
|
||||||
|
*/
|
||||||
|
char *gesture_parse(const char *input, struct gesture *output);
|
||||||
|
|
||||||
|
// Turns gesture into string representation
|
||||||
|
char *gesture_to_string(struct gesture *gesture);
|
||||||
|
|
||||||
|
// Check if gesture is of certain type and finger count.
|
||||||
|
bool gesture_check(struct gesture *target,
|
||||||
|
enum gesture_type type, uint8_t fingers);
|
||||||
|
|
||||||
|
// Check if a gesture target/binding is match by other gesture/input
|
||||||
|
bool gesture_match(struct gesture *target,
|
||||||
|
struct gesture *to_match, bool exact);
|
||||||
|
|
||||||
|
// Returns true if gesture are exactly the same
|
||||||
|
bool gesture_equal(struct gesture *a, struct gesture *b);
|
||||||
|
|
||||||
|
// Compare distance between two matched target gestures.
|
||||||
|
int8_t gesture_compare(struct gesture *a, struct gesture *b);
|
||||||
|
|
||||||
|
// Small helper struct to track gestures over time
|
||||||
|
struct gesture_tracker {
|
||||||
|
enum gesture_type type;
|
||||||
|
uint8_t fingers;
|
||||||
|
double dx, dy;
|
||||||
|
double scale;
|
||||||
|
double rotation;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Begin gesture tracking
|
||||||
|
void gesture_tracker_begin(struct gesture_tracker *tracker,
|
||||||
|
enum gesture_type type, uint8_t fingers);
|
||||||
|
|
||||||
|
// Check if the provides type is currently being tracked
|
||||||
|
bool gesture_tracker_check(struct gesture_tracker *tracker,
|
||||||
|
enum gesture_type type);
|
||||||
|
|
||||||
|
// Update gesture track with new data point
|
||||||
|
void gesture_tracker_update(struct gesture_tracker *tracker, double dx,
|
||||||
|
double dy, double scale, double rotation);
|
||||||
|
|
||||||
|
// Reset tracker
|
||||||
|
void gesture_tracker_cancel(struct gesture_tracker *tracker);
|
||||||
|
|
||||||
|
// Reset tracker and return gesture tracked
|
||||||
|
struct gesture *gesture_tracker_end(struct gesture_tracker *tracker);
|
||||||
|
|
||||||
|
#endif
|
|
@ -5,6 +5,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
#include <pango/pangocairo.h>
|
#include <pango/pangocairo.h>
|
||||||
|
#include "stringop.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function which escape characters a & < > ' ".
|
* Utility function which escape characters a & < > ' ".
|
||||||
|
@ -13,12 +14,12 @@
|
||||||
* escaped string to dest if provided.
|
* escaped string to dest if provided.
|
||||||
*/
|
*/
|
||||||
size_t escape_markup_text(const char *src, char *dest);
|
size_t escape_markup_text(const char *src, char *dest);
|
||||||
PangoLayout *get_pango_layout(cairo_t *cairo, const char *font,
|
PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc,
|
||||||
const char *text, double scale, bool markup);
|
const char *text, double scale, bool markup);
|
||||||
void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
|
void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height,
|
||||||
int *baseline, double scale, bool markup, const char *fmt, ...);
|
int *baseline, double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(8, 9);
|
||||||
void get_text_metrics(const char *font, int *height, int *baseline);
|
void get_text_metrics(const PangoFontDescription *desc, int *height, int *baseline);
|
||||||
void render_text(cairo_t *cairo, const char *font,
|
void render_text(cairo_t *cairo, PangoFontDescription *desc,
|
||||||
double scale, bool markup, const char *fmt, ...);
|
double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(5, 6);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,8 +2,15 @@
|
||||||
#define _SWAY_STRINGOP_H
|
#define _SWAY_STRINGOP_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stddef.h>
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
#define _SWAY_ATTRIB_PRINTF(start, end) __attribute__((format(printf, start, end)))
|
||||||
|
#else
|
||||||
|
#define _SWAY_ATTRIB_PRINTF(start, end)
|
||||||
|
#endif
|
||||||
|
|
||||||
void strip_whitespace(char *str);
|
void strip_whitespace(char *str);
|
||||||
void strip_quotes(char *str);
|
void strip_quotes(char *str);
|
||||||
|
|
||||||
|
@ -30,4 +37,7 @@ char *argsep(char **stringp, const char *delim, char *matched_delim);
|
||||||
// Expand a path using shell replacements such as $HOME and ~
|
// Expand a path using shell replacements such as $HOME and ~
|
||||||
bool expand_path(char **path);
|
bool expand_path(char **path);
|
||||||
|
|
||||||
|
char *vformat_str(const char *fmt, va_list args) _SWAY_ATTRIB_PRINTF(1, 0);
|
||||||
|
char *format_str(const char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,13 +3,14 @@
|
||||||
|
|
||||||
#include <wlr/util/edges.h>
|
#include <wlr/util/edges.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
#include "stringop.h"
|
||||||
|
|
||||||
struct sway_container;
|
struct sway_container;
|
||||||
|
|
||||||
typedef struct cmd_results *sway_cmd(int argc, char **argv);
|
typedef struct cmd_results *sway_cmd(int argc, char **argv);
|
||||||
|
|
||||||
struct cmd_handler {
|
struct cmd_handler {
|
||||||
char *command;
|
const char *command;
|
||||||
sway_cmd *handle;
|
sway_cmd *handle;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -46,7 +47,7 @@ enum expected_args {
|
||||||
struct cmd_results *checkarg(int argc, const char *name,
|
struct cmd_results *checkarg(int argc, const char *name,
|
||||||
enum expected_args type, int val);
|
enum expected_args type, int val);
|
||||||
|
|
||||||
const struct cmd_handler *find_handler(char *line,
|
const struct cmd_handler *find_handler(const char *line,
|
||||||
const struct cmd_handler *cmd_handlers, size_t handlers_size);
|
const struct cmd_handler *cmd_handlers, size_t handlers_size);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,7 +77,7 @@ struct cmd_results *config_commands_command(char *exec);
|
||||||
/**
|
/**
|
||||||
* Allocates a cmd_results object.
|
* Allocates a cmd_results object.
|
||||||
*/
|
*/
|
||||||
struct cmd_results *cmd_results_new(enum cmd_status status, const char *error, ...);
|
struct cmd_results *cmd_results_new(enum cmd_status status, const char *error, ...) _SWAY_ATTRIB_PRINTF(2, 3);
|
||||||
/**
|
/**
|
||||||
* Frees a cmd_results object.
|
* Frees a cmd_results object.
|
||||||
*/
|
*/
|
||||||
|
@ -103,9 +104,11 @@ struct sway_container *container_find_resize_parent(struct sway_container *con,
|
||||||
sway_cmd cmd_exec_validate;
|
sway_cmd cmd_exec_validate;
|
||||||
sway_cmd cmd_exec_process;
|
sway_cmd cmd_exec_process;
|
||||||
|
|
||||||
|
sway_cmd cmd_allow_tearing;
|
||||||
sway_cmd cmd_assign;
|
sway_cmd cmd_assign;
|
||||||
sway_cmd cmd_bar;
|
sway_cmd cmd_bar;
|
||||||
sway_cmd cmd_bindcode;
|
sway_cmd cmd_bindcode;
|
||||||
|
sway_cmd cmd_bindgesture;
|
||||||
sway_cmd cmd_bindswitch;
|
sway_cmd cmd_bindswitch;
|
||||||
sway_cmd cmd_bindsym;
|
sway_cmd cmd_bindsym;
|
||||||
sway_cmd cmd_border;
|
sway_cmd cmd_border;
|
||||||
|
@ -158,12 +161,11 @@ sway_cmd cmd_new_float;
|
||||||
sway_cmd cmd_new_window;
|
sway_cmd cmd_new_window;
|
||||||
sway_cmd cmd_nop;
|
sway_cmd cmd_nop;
|
||||||
sway_cmd cmd_opacity;
|
sway_cmd cmd_opacity;
|
||||||
sway_cmd cmd_new_float;
|
|
||||||
sway_cmd cmd_new_window;
|
|
||||||
sway_cmd cmd_no_focus;
|
sway_cmd cmd_no_focus;
|
||||||
sway_cmd cmd_output;
|
sway_cmd cmd_output;
|
||||||
sway_cmd cmd_permit;
|
sway_cmd cmd_permit;
|
||||||
sway_cmd cmd_popup_during_fullscreen;
|
sway_cmd cmd_popup_during_fullscreen;
|
||||||
|
sway_cmd cmd_primary_selection;
|
||||||
sway_cmd cmd_reject;
|
sway_cmd cmd_reject;
|
||||||
sway_cmd cmd_reload;
|
sway_cmd cmd_reload;
|
||||||
sway_cmd cmd_rename;
|
sway_cmd cmd_rename;
|
||||||
|
@ -191,6 +193,7 @@ sway_cmd cmd_titlebar_border_thickness;
|
||||||
sway_cmd cmd_titlebar_padding;
|
sway_cmd cmd_titlebar_padding;
|
||||||
sway_cmd cmd_unbindcode;
|
sway_cmd cmd_unbindcode;
|
||||||
sway_cmd cmd_unbindswitch;
|
sway_cmd cmd_unbindswitch;
|
||||||
|
sway_cmd cmd_unbindgesture;
|
||||||
sway_cmd cmd_unbindsym;
|
sway_cmd cmd_unbindsym;
|
||||||
sway_cmd cmd_unmark;
|
sway_cmd cmd_unmark;
|
||||||
sway_cmd cmd_urgent;
|
sway_cmd cmd_urgent;
|
||||||
|
@ -247,9 +250,11 @@ sway_cmd input_cmd_seat;
|
||||||
sway_cmd input_cmd_accel_profile;
|
sway_cmd input_cmd_accel_profile;
|
||||||
sway_cmd input_cmd_calibration_matrix;
|
sway_cmd input_cmd_calibration_matrix;
|
||||||
sway_cmd input_cmd_click_method;
|
sway_cmd input_cmd_click_method;
|
||||||
|
sway_cmd input_cmd_clickfinger_button_map;
|
||||||
sway_cmd input_cmd_drag;
|
sway_cmd input_cmd_drag;
|
||||||
sway_cmd input_cmd_drag_lock;
|
sway_cmd input_cmd_drag_lock;
|
||||||
sway_cmd input_cmd_dwt;
|
sway_cmd input_cmd_dwt;
|
||||||
|
sway_cmd input_cmd_dwtp;
|
||||||
sway_cmd input_cmd_events;
|
sway_cmd input_cmd_events;
|
||||||
sway_cmd input_cmd_left_handed;
|
sway_cmd input_cmd_left_handed;
|
||||||
sway_cmd input_cmd_map_from_region;
|
sway_cmd input_cmd_map_from_region;
|
||||||
|
@ -258,10 +263,12 @@ sway_cmd input_cmd_map_to_region;
|
||||||
sway_cmd input_cmd_middle_emulation;
|
sway_cmd input_cmd_middle_emulation;
|
||||||
sway_cmd input_cmd_natural_scroll;
|
sway_cmd input_cmd_natural_scroll;
|
||||||
sway_cmd input_cmd_pointer_accel;
|
sway_cmd input_cmd_pointer_accel;
|
||||||
|
sway_cmd input_cmd_rotation_angle;
|
||||||
sway_cmd input_cmd_scroll_factor;
|
sway_cmd input_cmd_scroll_factor;
|
||||||
sway_cmd input_cmd_repeat_delay;
|
sway_cmd input_cmd_repeat_delay;
|
||||||
sway_cmd input_cmd_repeat_rate;
|
sway_cmd input_cmd_repeat_rate;
|
||||||
sway_cmd input_cmd_scroll_button;
|
sway_cmd input_cmd_scroll_button;
|
||||||
|
sway_cmd input_cmd_scroll_button_lock;
|
||||||
sway_cmd input_cmd_scroll_method;
|
sway_cmd input_cmd_scroll_method;
|
||||||
sway_cmd input_cmd_tap;
|
sway_cmd input_cmd_tap;
|
||||||
sway_cmd input_cmd_tap_button_map;
|
sway_cmd input_cmd_tap_button_map;
|
||||||
|
@ -277,7 +284,9 @@ sway_cmd input_cmd_xkb_switch_layout;
|
||||||
sway_cmd input_cmd_xkb_variant;
|
sway_cmd input_cmd_xkb_variant;
|
||||||
|
|
||||||
sway_cmd output_cmd_adaptive_sync;
|
sway_cmd output_cmd_adaptive_sync;
|
||||||
|
sway_cmd output_cmd_allow_tearing;
|
||||||
sway_cmd output_cmd_background;
|
sway_cmd output_cmd_background;
|
||||||
|
sway_cmd output_cmd_color_profile;
|
||||||
sway_cmd output_cmd_disable;
|
sway_cmd output_cmd_disable;
|
||||||
sway_cmd output_cmd_dpms;
|
sway_cmd output_cmd_dpms;
|
||||||
sway_cmd output_cmd_enable;
|
sway_cmd output_cmd_enable;
|
||||||
|
@ -285,12 +294,14 @@ sway_cmd output_cmd_max_render_time;
|
||||||
sway_cmd output_cmd_mode;
|
sway_cmd output_cmd_mode;
|
||||||
sway_cmd output_cmd_modeline;
|
sway_cmd output_cmd_modeline;
|
||||||
sway_cmd output_cmd_position;
|
sway_cmd output_cmd_position;
|
||||||
|
sway_cmd output_cmd_power;
|
||||||
sway_cmd output_cmd_render_bit_depth;
|
sway_cmd output_cmd_render_bit_depth;
|
||||||
sway_cmd output_cmd_scale;
|
sway_cmd output_cmd_scale;
|
||||||
sway_cmd output_cmd_scale_filter;
|
sway_cmd output_cmd_scale_filter;
|
||||||
sway_cmd output_cmd_subpixel;
|
sway_cmd output_cmd_subpixel;
|
||||||
sway_cmd output_cmd_toggle;
|
sway_cmd output_cmd_toggle;
|
||||||
sway_cmd output_cmd_transform;
|
sway_cmd output_cmd_transform;
|
||||||
|
sway_cmd output_cmd_unplug;
|
||||||
|
|
||||||
sway_cmd seat_cmd_attach;
|
sway_cmd seat_cmd_attach;
|
||||||
sway_cmd seat_cmd_cursor;
|
sway_cmd seat_cmd_cursor;
|
||||||
|
|
|
@ -7,15 +7,19 @@
|
||||||
#include <wlr/interfaces/wlr_switch.h>
|
#include <wlr/interfaces/wlr_switch.h>
|
||||||
#include <wlr/types/wlr_tablet_tool.h>
|
#include <wlr/types/wlr_tablet_tool.h>
|
||||||
#include <wlr/util/box.h>
|
#include <wlr/util/box.h>
|
||||||
|
#include <wlr/render/color.h>
|
||||||
#include <xkbcommon/xkbcommon.h>
|
#include <xkbcommon/xkbcommon.h>
|
||||||
#include <xf86drmMode.h>
|
#include <xf86drmMode.h>
|
||||||
#include "../include/config.h"
|
#include "../include/config.h"
|
||||||
|
#include "gesture.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
#include "stringop.h"
|
||||||
#include "swaynag.h"
|
#include "swaynag.h"
|
||||||
#include "tree/container.h"
|
#include "tree/container.h"
|
||||||
#include "sway/input/tablet.h"
|
#include "sway/input/tablet.h"
|
||||||
#include "sway/tree/root.h"
|
#include "sway/tree/root.h"
|
||||||
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
#include "wlr-layer-shell-unstable-v1-protocol.h"
|
||||||
|
#include <pango/pangocairo.h>
|
||||||
|
|
||||||
// TODO: Refactor this shit
|
// TODO: Refactor this shit
|
||||||
|
|
||||||
|
@ -32,7 +36,8 @@ enum binding_input_type {
|
||||||
BINDING_KEYSYM,
|
BINDING_KEYSYM,
|
||||||
BINDING_MOUSECODE,
|
BINDING_MOUSECODE,
|
||||||
BINDING_MOUSESYM,
|
BINDING_MOUSESYM,
|
||||||
BINDING_SWITCH
|
BINDING_SWITCH, // dummy, only used to call seat_execute_command
|
||||||
|
BINDING_GESTURE // dummy, only used to call seat_execute_command
|
||||||
};
|
};
|
||||||
|
|
||||||
enum binding_flags {
|
enum binding_flags {
|
||||||
|
@ -45,10 +50,11 @@ enum binding_flags {
|
||||||
BINDING_RELOAD = 1 << 6, // switch only; (re)trigger binding on reload
|
BINDING_RELOAD = 1 << 6, // switch only; (re)trigger binding on reload
|
||||||
BINDING_INHIBITED = 1 << 7, // keyboard only: ignore shortcut inhibitor
|
BINDING_INHIBITED = 1 << 7, // keyboard only: ignore shortcut inhibitor
|
||||||
BINDING_NOREPEAT = 1 << 8, // keyboard only; do not trigger when repeating a held key
|
BINDING_NOREPEAT = 1 << 8, // keyboard only; do not trigger when repeating a held key
|
||||||
|
BINDING_EXACT = 1 << 9, // gesture only; only trigger on exact match
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A key binding and an associated command.
|
* A key (or mouse) binding and an associated command.
|
||||||
*/
|
*/
|
||||||
struct sway_binding {
|
struct sway_binding {
|
||||||
enum binding_input_type type;
|
enum binding_input_type type;
|
||||||
|
@ -62,12 +68,10 @@ struct sway_binding {
|
||||||
char *command;
|
char *command;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
enum sway_switch_trigger {
|
||||||
* A mouse binding and an associated command.
|
SWAY_SWITCH_TRIGGER_OFF,
|
||||||
*/
|
SWAY_SWITCH_TRIGGER_ON,
|
||||||
struct sway_mouse_binding {
|
SWAY_SWITCH_TRIGGER_TOGGLE,
|
||||||
uint32_t button;
|
|
||||||
char *command;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,11 +79,21 @@ struct sway_mouse_binding {
|
||||||
*/
|
*/
|
||||||
struct sway_switch_binding {
|
struct sway_switch_binding {
|
||||||
enum wlr_switch_type type;
|
enum wlr_switch_type type;
|
||||||
enum wlr_switch_state state;
|
enum sway_switch_trigger trigger;
|
||||||
uint32_t flags;
|
uint32_t flags;
|
||||||
char *command;
|
char *command;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A gesture binding and an associated command.
|
||||||
|
*/
|
||||||
|
struct sway_gesture_binding {
|
||||||
|
char *input;
|
||||||
|
uint32_t flags;
|
||||||
|
struct gesture gesture;
|
||||||
|
char *command;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Focus on window activation.
|
* Focus on window activation.
|
||||||
*/
|
*/
|
||||||
|
@ -99,6 +113,7 @@ struct sway_mode {
|
||||||
list_t *keycode_bindings;
|
list_t *keycode_bindings;
|
||||||
list_t *mouse_bindings;
|
list_t *mouse_bindings;
|
||||||
list_t *switch_bindings;
|
list_t *switch_bindings;
|
||||||
|
list_t *gesture_bindings;
|
||||||
bool pango;
|
bool pango;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -134,17 +149,21 @@ struct input_config {
|
||||||
int accel_profile;
|
int accel_profile;
|
||||||
struct calibration_matrix calibration_matrix;
|
struct calibration_matrix calibration_matrix;
|
||||||
int click_method;
|
int click_method;
|
||||||
|
int clickfinger_button_map;
|
||||||
int drag;
|
int drag;
|
||||||
int drag_lock;
|
int drag_lock;
|
||||||
int dwt;
|
int dwt;
|
||||||
|
int dwtp;
|
||||||
int left_handed;
|
int left_handed;
|
||||||
int middle_emulation;
|
int middle_emulation;
|
||||||
int natural_scroll;
|
int natural_scroll;
|
||||||
float pointer_accel;
|
float pointer_accel;
|
||||||
|
float rotation_angle;
|
||||||
float scroll_factor;
|
float scroll_factor;
|
||||||
int repeat_delay;
|
int repeat_delay;
|
||||||
int repeat_rate;
|
int repeat_rate;
|
||||||
int scroll_button;
|
int scroll_button;
|
||||||
|
int scroll_button_lock;
|
||||||
int scroll_method;
|
int scroll_method;
|
||||||
int send_events;
|
int send_events;
|
||||||
int tap;
|
int tap;
|
||||||
|
@ -234,12 +253,6 @@ struct seat_config {
|
||||||
} xcursor_theme;
|
} xcursor_theme;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum config_dpms {
|
|
||||||
DPMS_IGNORE,
|
|
||||||
DPMS_ON,
|
|
||||||
DPMS_OFF,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum scale_filter_mode {
|
enum scale_filter_mode {
|
||||||
SCALE_FILTER_DEFAULT, // the default is currently smart
|
SCALE_FILTER_DEFAULT, // the default is currently smart
|
||||||
SCALE_FILTER_LINEAR,
|
SCALE_FILTER_LINEAR,
|
||||||
|
@ -249,6 +262,7 @@ enum scale_filter_mode {
|
||||||
|
|
||||||
enum render_bit_depth {
|
enum render_bit_depth {
|
||||||
RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8
|
RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8
|
||||||
|
RENDER_BIT_DEPTH_6,
|
||||||
RENDER_BIT_DEPTH_8,
|
RENDER_BIT_DEPTH_8,
|
||||||
RENDER_BIT_DEPTH_10,
|
RENDER_BIT_DEPTH_10,
|
||||||
};
|
};
|
||||||
|
@ -261,6 +275,7 @@ enum render_bit_depth {
|
||||||
struct output_config {
|
struct output_config {
|
||||||
char *name;
|
char *name;
|
||||||
int enabled;
|
int enabled;
|
||||||
|
int power;
|
||||||
int width, height;
|
int width, height;
|
||||||
float refresh_rate;
|
float refresh_rate;
|
||||||
int custom_mode;
|
int custom_mode;
|
||||||
|
@ -273,11 +288,13 @@ struct output_config {
|
||||||
int max_render_time; // In milliseconds
|
int max_render_time; // In milliseconds
|
||||||
int adaptive_sync;
|
int adaptive_sync;
|
||||||
enum render_bit_depth render_bit_depth;
|
enum render_bit_depth render_bit_depth;
|
||||||
|
bool set_color_transform;
|
||||||
|
struct wlr_color_transform *color_transform;
|
||||||
|
int allow_tearing;
|
||||||
|
|
||||||
char *background;
|
char *background;
|
||||||
char *background_option;
|
char *background_option;
|
||||||
char *background_fallback;
|
char *background_fallback;
|
||||||
enum config_dpms dpms_state;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -492,7 +509,8 @@ struct sway_config {
|
||||||
char *floating_scroll_right_cmd;
|
char *floating_scroll_right_cmd;
|
||||||
enum sway_container_layout default_orientation;
|
enum sway_container_layout default_orientation;
|
||||||
enum sway_container_layout default_layout;
|
enum sway_container_layout default_layout;
|
||||||
char *font;
|
char *font; // Used for IPC.
|
||||||
|
PangoFontDescription *font_description; // Used internally for rendering and validating.
|
||||||
int font_height;
|
int font_height;
|
||||||
int font_baseline;
|
int font_baseline;
|
||||||
bool pango_markup;
|
bool pango_markup;
|
||||||
|
@ -521,6 +539,7 @@ struct sway_config {
|
||||||
bool auto_back_and_forth;
|
bool auto_back_and_forth;
|
||||||
bool show_marks;
|
bool show_marks;
|
||||||
enum alignment title_align;
|
enum alignment title_align;
|
||||||
|
bool primary_selection;
|
||||||
|
|
||||||
bool tiling_drag;
|
bool tiling_drag;
|
||||||
int tiling_drag_threshold;
|
int tiling_drag_threshold;
|
||||||
|
@ -614,7 +633,7 @@ void run_deferred_bindings(void);
|
||||||
/**
|
/**
|
||||||
* Adds a warning entry to the swaynag instance used for errors.
|
* Adds a warning entry to the swaynag instance used for errors.
|
||||||
*/
|
*/
|
||||||
void config_add_swaynag_warning(char *fmt, ...);
|
void config_add_swaynag_warning(char *fmt, ...) _SWAY_ATTRIB_PRINTF(1, 2);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Free config struct
|
* Free config struct
|
||||||
|
@ -667,22 +686,26 @@ const char *sway_output_scale_filter_to_string(enum scale_filter_mode scale_filt
|
||||||
|
|
||||||
struct output_config *new_output_config(const char *name);
|
struct output_config *new_output_config(const char *name);
|
||||||
|
|
||||||
void merge_output_config(struct output_config *dst, struct output_config *src);
|
bool apply_output_configs(struct output_config **ocs, size_t ocs_len,
|
||||||
|
bool test_only, bool degrade_to_off);
|
||||||
|
|
||||||
bool apply_output_config(struct output_config *oc, struct sway_output *output);
|
void apply_stored_output_configs(void);
|
||||||
|
|
||||||
bool test_output_config(struct output_config *oc, struct sway_output *output);
|
/**
|
||||||
|
* store_output_config stores a new output config. An output may be matched by
|
||||||
struct output_config *store_output_config(struct output_config *oc);
|
* three different config types, in order of precedence: Identifier, name and
|
||||||
|
* wildcard. When storing a config type of lower precedence, assume that the
|
||||||
|
* user wants the config to take immediate effect by superseding (clearing) the
|
||||||
|
* same values from higher presedence configuration.
|
||||||
|
*/
|
||||||
|
void store_output_config(struct output_config *oc);
|
||||||
|
|
||||||
struct output_config *find_output_config(struct sway_output *output);
|
struct output_config *find_output_config(struct sway_output *output);
|
||||||
|
|
||||||
void apply_output_config_to_outputs(struct output_config *oc);
|
|
||||||
|
|
||||||
void reset_outputs(void);
|
|
||||||
|
|
||||||
void free_output_config(struct output_config *oc);
|
void free_output_config(struct output_config *oc);
|
||||||
|
|
||||||
|
void request_modeset(void);
|
||||||
|
|
||||||
bool spawn_swaybg(void);
|
bool spawn_swaybg(void);
|
||||||
|
|
||||||
int workspace_output_cmp_workspace(const void *a, const void *b);
|
int workspace_output_cmp_workspace(const void *a, const void *b);
|
||||||
|
@ -691,6 +714,8 @@ void free_sway_binding(struct sway_binding *sb);
|
||||||
|
|
||||||
void free_switch_binding(struct sway_switch_binding *binding);
|
void free_switch_binding(struct sway_switch_binding *binding);
|
||||||
|
|
||||||
|
void free_gesture_binding(struct sway_gesture_binding *binding);
|
||||||
|
|
||||||
void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding);
|
void seat_execute_command(struct sway_seat *seat, struct sway_binding *binding);
|
||||||
|
|
||||||
void load_swaybar(struct bar_config *bar);
|
void load_swaybar(struct bar_config *bar);
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
#ifndef _SWAY_CRITERIA_H
|
#ifndef _SWAY_CRITERIA_H
|
||||||
#define _SWAY_CRITERIA_H
|
#define _SWAY_CRITERIA_H
|
||||||
|
|
||||||
#include <pcre.h>
|
#define PCRE2_CODE_UNIT_WIDTH 8
|
||||||
|
#include <pcre2.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "tree/view.h"
|
#include "tree/view.h"
|
||||||
|
|
||||||
|
#if WLR_HAS_XWAYLAND
|
||||||
|
#include "sway/xwayland.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
enum criteria_type {
|
enum criteria_type {
|
||||||
CT_COMMAND = 1 << 0,
|
CT_COMMAND = 1 << 0,
|
||||||
CT_ASSIGN_OUTPUT = 1 << 1,
|
CT_ASSIGN_OUTPUT = 1 << 1,
|
||||||
|
@ -15,13 +20,13 @@ enum criteria_type {
|
||||||
};
|
};
|
||||||
|
|
||||||
enum pattern_type {
|
enum pattern_type {
|
||||||
PATTERN_PCRE,
|
PATTERN_PCRE2,
|
||||||
PATTERN_FOCUSED,
|
PATTERN_FOCUSED,
|
||||||
};
|
};
|
||||||
|
|
||||||
struct pattern {
|
struct pattern {
|
||||||
enum pattern_type match_type;
|
enum pattern_type match_type;
|
||||||
pcre *regex;
|
pcre2_code *regex;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct criteria {
|
struct criteria {
|
||||||
|
@ -35,13 +40,14 @@ struct criteria {
|
||||||
struct pattern *app_id;
|
struct pattern *app_id;
|
||||||
struct pattern *con_mark;
|
struct pattern *con_mark;
|
||||||
uint32_t con_id; // internal ID
|
uint32_t con_id; // internal ID
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
struct pattern *class;
|
struct pattern *class;
|
||||||
uint32_t id; // X11 window ID
|
uint32_t id; // X11 window ID
|
||||||
struct pattern *instance;
|
struct pattern *instance;
|
||||||
struct pattern *window_role;
|
struct pattern *window_role;
|
||||||
enum atom_name window_type;
|
enum atom_name window_type;
|
||||||
#endif
|
#endif
|
||||||
|
bool all;
|
||||||
bool floating;
|
bool floating;
|
||||||
bool tiling;
|
bool tiling;
|
||||||
char urgent; // 'l' for latest or 'o' for oldest
|
char urgent; // 'l' for latest or 'o' for oldest
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
#include <wlr/types/wlr_surface.h>
|
|
||||||
|
|
||||||
struct sway_container;
|
|
||||||
struct sway_view;
|
|
||||||
|
|
||||||
void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly,
|
|
||||||
bool whole);
|
|
||||||
|
|
||||||
void desktop_damage_whole_container(struct sway_container *con);
|
|
||||||
|
|
||||||
void desktop_damage_box(struct wlr_box *box);
|
|
||||||
|
|
||||||
void desktop_damage_view(struct sway_view *view);
|
|
|
@ -1,8 +1,6 @@
|
||||||
#ifndef _SWAY_DESKTOP_IDLE_INHIBIT_V1_H
|
#ifndef _SWAY_DESKTOP_IDLE_INHIBIT_V1_H
|
||||||
#define _SWAY_DESKTOP_IDLE_INHIBIT_V1_H
|
#define _SWAY_DESKTOP_IDLE_INHIBIT_V1_H
|
||||||
#include <wlr/types/wlr_idle_inhibit_v1.h>
|
#include <wlr/types/wlr_idle_inhibit_v1.h>
|
||||||
#include <wlr/types/wlr_idle.h>
|
|
||||||
#include "sway/server.h"
|
|
||||||
|
|
||||||
enum sway_idle_inhibit_mode {
|
enum sway_idle_inhibit_mode {
|
||||||
INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible)
|
INHIBIT_IDLE_APPLICATION, // Application set inhibitor (when visible)
|
||||||
|
@ -16,12 +14,9 @@ struct sway_idle_inhibit_manager_v1 {
|
||||||
struct wlr_idle_inhibit_manager_v1 *wlr_manager;
|
struct wlr_idle_inhibit_manager_v1 *wlr_manager;
|
||||||
struct wl_listener new_idle_inhibitor_v1;
|
struct wl_listener new_idle_inhibitor_v1;
|
||||||
struct wl_list inhibitors;
|
struct wl_list inhibitors;
|
||||||
|
|
||||||
struct wlr_idle *idle;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_idle_inhibitor_v1 {
|
struct sway_idle_inhibitor_v1 {
|
||||||
struct sway_idle_inhibit_manager_v1 *manager;
|
|
||||||
struct wlr_idle_inhibitor_v1 *wlr_inhibitor;
|
struct wlr_idle_inhibitor_v1 *wlr_inhibitor;
|
||||||
struct sway_view *view;
|
struct sway_view *view;
|
||||||
enum sway_idle_inhibit_mode mode;
|
enum sway_idle_inhibit_mode mode;
|
||||||
|
@ -33,8 +28,7 @@ struct sway_idle_inhibitor_v1 {
|
||||||
bool sway_idle_inhibit_v1_is_active(
|
bool sway_idle_inhibit_v1_is_active(
|
||||||
struct sway_idle_inhibitor_v1 *inhibitor);
|
struct sway_idle_inhibitor_v1 *inhibitor);
|
||||||
|
|
||||||
void sway_idle_inhibit_v1_check_active(
|
void sway_idle_inhibit_v1_check_active(void);
|
||||||
struct sway_idle_inhibit_manager_v1 *manager);
|
|
||||||
|
|
||||||
void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view,
|
void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view,
|
||||||
enum sway_idle_inhibit_mode mode);
|
enum sway_idle_inhibit_mode mode);
|
||||||
|
@ -48,6 +42,6 @@ struct sway_idle_inhibitor_v1 *sway_idle_inhibit_v1_application_inhibitor_for_vi
|
||||||
void sway_idle_inhibit_v1_user_inhibitor_destroy(
|
void sway_idle_inhibit_v1_user_inhibitor_destroy(
|
||||||
struct sway_idle_inhibitor_v1 *inhibitor);
|
struct sway_idle_inhibitor_v1 *inhibitor);
|
||||||
|
|
||||||
struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create(
|
bool sway_idle_inhibit_manager_v1_init(void);
|
||||||
struct wl_display *wl_display, struct wlr_idle *idle);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
40
include/sway/desktop/launcher.h
Normal file
40
include/sway/desktop/launcher.h
Normal file
|
@ -0,0 +1,40 @@
|
||||||
|
#ifndef _SWAY_LAUNCHER_H
|
||||||
|
#define _SWAY_LAUNCHER_H
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <wayland-server-core.h>
|
||||||
|
#include "sway/input/seat.h"
|
||||||
|
|
||||||
|
struct launcher_ctx {
|
||||||
|
pid_t pid;
|
||||||
|
char *fallback_name;
|
||||||
|
struct wlr_xdg_activation_token_v1 *token;
|
||||||
|
struct wl_listener token_destroy;
|
||||||
|
struct sway_seat *seat;
|
||||||
|
struct wl_listener seat_destroy;
|
||||||
|
|
||||||
|
bool activated;
|
||||||
|
bool had_focused_surface;
|
||||||
|
|
||||||
|
struct sway_node *node;
|
||||||
|
struct wl_listener node_destroy;
|
||||||
|
|
||||||
|
struct wl_list link; // sway_server::pending_launcher_ctxs
|
||||||
|
};
|
||||||
|
|
||||||
|
struct launcher_ctx *launcher_ctx_find_pid(pid_t pid);
|
||||||
|
|
||||||
|
struct sway_workspace *launcher_ctx_get_workspace(struct launcher_ctx *ctx);
|
||||||
|
|
||||||
|
void launcher_ctx_consume(struct launcher_ctx *ctx);
|
||||||
|
|
||||||
|
void launcher_ctx_destroy(struct launcher_ctx *ctx);
|
||||||
|
|
||||||
|
struct launcher_ctx *launcher_ctx_create_internal(void);
|
||||||
|
|
||||||
|
struct launcher_ctx *launcher_ctx_create(
|
||||||
|
struct wlr_xdg_activation_token_v1 *token, struct sway_node *node);
|
||||||
|
|
||||||
|
const char *launcher_ctx_get_token_name(struct launcher_ctx *ctx);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef _SWAY_TRANSACTION_H
|
#ifndef _SWAY_TRANSACTION_H
|
||||||
#define _SWAY_TRANSACTION_H
|
#define _SWAY_TRANSACTION_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transactions enable us to perform atomic layout updates.
|
* Transactions enable us to perform atomic layout updates.
|
||||||
|
@ -38,8 +40,11 @@ void transaction_commit_dirty_client(void);
|
||||||
* Notify the transaction system that a view is ready for the new layout.
|
* Notify the transaction system that a view is ready for the new layout.
|
||||||
*
|
*
|
||||||
* When all views in the transaction are ready, the layout will be applied.
|
* When all views in the transaction are ready, the layout will be applied.
|
||||||
|
*
|
||||||
|
* A success boolean is returned denoting that this part of the transaction is
|
||||||
|
* ready.
|
||||||
*/
|
*/
|
||||||
void transaction_notify_view_ready_by_serial(struct sway_view *view,
|
bool transaction_notify_view_ready_by_serial(struct sway_view *view,
|
||||||
uint32_t serial);
|
uint32_t serial);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -47,8 +52,13 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view,
|
||||||
* identifying the instruction by geometry rather than by serial.
|
* identifying the instruction by geometry rather than by serial.
|
||||||
*
|
*
|
||||||
* This is used by xwayland views, as they don't have serials.
|
* This is used by xwayland views, as they don't have serials.
|
||||||
|
*
|
||||||
|
* A success boolean is returned denoting that this part of the transaction is
|
||||||
|
* ready.
|
||||||
*/
|
*/
|
||||||
void transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
bool transaction_notify_view_ready_by_geometry(struct sway_view *view,
|
||||||
double x, double y, int width, int height);
|
double x, double y, int width, int height);
|
||||||
|
|
||||||
|
void arrange_popups(struct wlr_scene_tree *popups);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <wlr/types/wlr_pointer_constraints_v1.h>
|
#include <wlr/types/wlr_pointer_constraints_v1.h>
|
||||||
#include <wlr/types/wlr_pointer_gestures_v1.h>
|
#include <wlr/types/wlr_pointer_gestures_v1.h>
|
||||||
#include <wlr/types/wlr_surface.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
#include "sway/input/seat.h"
|
#include "sway/input/seat.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
|
@ -35,7 +35,8 @@ struct sway_cursor {
|
||||||
pixman_region32_t confine; // invalid if active_constraint == NULL
|
pixman_region32_t confine; // invalid if active_constraint == NULL
|
||||||
bool active_confine_requires_warp;
|
bool active_confine_requires_warp;
|
||||||
|
|
||||||
struct wlr_pointer_gestures_v1 *pointer_gestures;
|
struct wl_listener hold_begin;
|
||||||
|
struct wl_listener hold_end;
|
||||||
struct wl_listener pinch_begin;
|
struct wl_listener pinch_begin;
|
||||||
struct wl_listener pinch_update;
|
struct wl_listener pinch_update;
|
||||||
struct wl_listener pinch_end;
|
struct wl_listener pinch_end;
|
||||||
|
@ -51,6 +52,7 @@ struct sway_cursor {
|
||||||
|
|
||||||
struct wl_listener touch_down;
|
struct wl_listener touch_down;
|
||||||
struct wl_listener touch_up;
|
struct wl_listener touch_up;
|
||||||
|
struct wl_listener touch_cancel;
|
||||||
struct wl_listener touch_motion;
|
struct wl_listener touch_motion;
|
||||||
struct wl_listener touch_frame;
|
struct wl_listener touch_frame;
|
||||||
bool simulating_pointer_from_touch;
|
bool simulating_pointer_from_touch;
|
||||||
|
@ -62,6 +64,7 @@ struct sway_cursor {
|
||||||
struct wl_listener tool_proximity;
|
struct wl_listener tool_proximity;
|
||||||
struct wl_listener tool_button;
|
struct wl_listener tool_button;
|
||||||
bool simulating_pointer_from_tool_tip;
|
bool simulating_pointer_from_tool_tip;
|
||||||
|
bool simulating_pointer_from_tool_button;
|
||||||
uint32_t tool_buttons;
|
uint32_t tool_buttons;
|
||||||
|
|
||||||
struct wl_listener request_set_cursor;
|
struct wl_listener request_set_cursor;
|
||||||
|
@ -105,12 +108,16 @@ void cursor_unhide(struct sway_cursor *cursor);
|
||||||
int cursor_get_timeout(struct sway_cursor *cursor);
|
int cursor_get_timeout(struct sway_cursor *cursor);
|
||||||
void cursor_notify_key_press(struct sway_cursor *cursor);
|
void cursor_notify_key_press(struct sway_cursor *cursor);
|
||||||
|
|
||||||
|
void pointer_motion(struct sway_cursor *cursor, uint32_t time_msec,
|
||||||
|
struct wlr_input_device *device, double dx, double dy,
|
||||||
|
double dx_unaccel, double dy_unaccel);
|
||||||
|
|
||||||
void dispatch_cursor_button(struct sway_cursor *cursor,
|
void dispatch_cursor_button(struct sway_cursor *cursor,
|
||||||
struct wlr_input_device *device, uint32_t time_msec, uint32_t button,
|
struct wlr_input_device *device, uint32_t time_msec, uint32_t button,
|
||||||
enum wlr_button_state state);
|
enum wl_pointer_button_state state);
|
||||||
|
|
||||||
void dispatch_cursor_axis(struct sway_cursor *cursor,
|
void dispatch_cursor_axis(struct sway_cursor *cursor,
|
||||||
struct wlr_event_pointer_axis *event);
|
struct wlr_pointer_axis_event *event);
|
||||||
|
|
||||||
void cursor_set_image(struct sway_cursor *cursor, const char *image,
|
void cursor_set_image(struct sway_cursor *cursor, const char *image,
|
||||||
struct wl_client *client);
|
struct wl_client *client);
|
||||||
|
@ -138,4 +145,6 @@ uint32_t get_mouse_button(const char *name, char **error);
|
||||||
|
|
||||||
const char *get_mouse_button_name(uint32_t button);
|
const char *get_mouse_button_name(uint32_t button);
|
||||||
|
|
||||||
|
void handle_request_set_cursor_shape(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
#ifndef _SWAY_INPUT_INPUT_MANAGER_H
|
#ifndef _SWAY_INPUT_INPUT_MANAGER_H
|
||||||
#define _SWAY_INPUT_INPUT_MANAGER_H
|
#define _SWAY_INPUT_INPUT_MANAGER_H
|
||||||
#include <libinput.h>
|
#include <libinput.h>
|
||||||
#include <wlr/types/wlr_input_inhibitor.h>
|
|
||||||
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
||||||
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
||||||
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
||||||
#include "sway/server.h"
|
#include <wlr/types/wlr_transient_seat_v1.h>
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
|
struct sway_server;
|
||||||
|
|
||||||
struct sway_input_device {
|
struct sway_input_device {
|
||||||
char *identifier;
|
char *identifier;
|
||||||
struct wlr_input_device *wlr_device;
|
struct wlr_input_device *wlr_device;
|
||||||
|
@ -21,10 +22,11 @@ struct sway_input_manager {
|
||||||
struct wl_list devices;
|
struct wl_list devices;
|
||||||
struct wl_list seats;
|
struct wl_list seats;
|
||||||
|
|
||||||
struct wlr_input_inhibit_manager *inhibit;
|
|
||||||
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
|
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
|
||||||
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
|
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
|
||||||
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
|
struct wlr_virtual_pointer_manager_v1 *virtual_pointer;
|
||||||
|
struct wlr_pointer_gestures_v1 *pointer_gestures;
|
||||||
|
struct wlr_transient_seat_manager_v1 *transient_seat_manager;
|
||||||
|
|
||||||
struct wl_listener new_input;
|
struct wl_listener new_input;
|
||||||
struct wl_listener inhibit_activate;
|
struct wl_listener inhibit_activate;
|
||||||
|
@ -32,6 +34,7 @@ struct sway_input_manager {
|
||||||
struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor;
|
struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor;
|
||||||
struct wl_listener virtual_keyboard_new;
|
struct wl_listener virtual_keyboard_new;
|
||||||
struct wl_listener virtual_pointer_new;
|
struct wl_listener virtual_pointer_new;
|
||||||
|
struct wl_listener transient_seat_create;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_input_manager *input_manager_create(struct sway_server *server);
|
struct sway_input_manager *input_manager_create(struct sway_server *server);
|
||||||
|
@ -44,7 +47,7 @@ void input_manager_configure_xcursor(void);
|
||||||
|
|
||||||
void input_manager_apply_input_config(struct input_config *input_config);
|
void input_manager_apply_input_config(struct input_config *input_config);
|
||||||
|
|
||||||
void input_manager_configure_all_inputs(void);
|
void input_manager_configure_all_input_mappings(void);
|
||||||
|
|
||||||
void input_manager_reset_input(struct sway_input_device *input_device);
|
void input_manager_reset_input(struct sway_input_device *input_device);
|
||||||
|
|
||||||
|
|
|
@ -50,6 +50,7 @@ struct sway_shortcut_state {
|
||||||
|
|
||||||
struct sway_keyboard {
|
struct sway_keyboard {
|
||||||
struct sway_seat_device *seat_device;
|
struct sway_seat_device *seat_device;
|
||||||
|
struct wlr_keyboard *wlr;
|
||||||
|
|
||||||
struct xkb_keymap *keymap;
|
struct xkb_keymap *keymap;
|
||||||
xkb_layout_index_t effective_layout;
|
xkb_layout_index_t effective_layout;
|
||||||
|
|
|
@ -2,7 +2,10 @@
|
||||||
#define _SWAY_INPUT_LIBINPUT_H
|
#define _SWAY_INPUT_LIBINPUT_H
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
|
|
||||||
void sway_input_configure_libinput_device(struct sway_input_device *device);
|
bool sway_input_configure_libinput_device(struct sway_input_device *device);
|
||||||
|
|
||||||
|
void sway_input_configure_libinput_device_send_events(
|
||||||
|
struct sway_input_device *device);
|
||||||
|
|
||||||
void sway_input_reset_libinput_device(struct sway_input_device *device);
|
void sway_input_reset_libinput_device(struct sway_input_device *device);
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,9 @@
|
||||||
|
|
||||||
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include <wlr/types/wlr_seat.h>
|
#include <wlr/types/wlr_seat.h>
|
||||||
|
#include <wlr/types/wlr_touch.h>
|
||||||
#include <wlr/util/edges.h>
|
#include <wlr/util/edges.h>
|
||||||
#include "sway/config.h"
|
#include "sway/config.h"
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
|
@ -15,19 +17,41 @@ struct sway_seat;
|
||||||
struct sway_seatop_impl {
|
struct sway_seatop_impl {
|
||||||
void (*button)(struct sway_seat *seat, uint32_t time_msec,
|
void (*button)(struct sway_seat *seat, uint32_t time_msec,
|
||||||
struct wlr_input_device *device, uint32_t button,
|
struct wlr_input_device *device, uint32_t button,
|
||||||
enum wlr_button_state state);
|
enum wl_pointer_button_state state);
|
||||||
void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec);
|
void (*pointer_motion)(struct sway_seat *seat, uint32_t time_msec);
|
||||||
void (*pointer_axis)(struct sway_seat *seat,
|
void (*pointer_axis)(struct sway_seat *seat,
|
||||||
struct wlr_event_pointer_axis *event);
|
struct wlr_pointer_axis_event *event);
|
||||||
|
void (*hold_begin)(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_hold_begin_event *event);
|
||||||
|
void (*hold_end)(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_hold_end_event *event);
|
||||||
|
void (*pinch_begin)(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_pinch_begin_event *event);
|
||||||
|
void (*pinch_update)(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_pinch_update_event *event);
|
||||||
|
void (*pinch_end)(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_pinch_end_event *event);
|
||||||
|
void (*swipe_begin)(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_swipe_begin_event *event);
|
||||||
|
void (*swipe_update)(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_swipe_update_event *event);
|
||||||
|
void (*swipe_end)(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_swipe_end_event *event);
|
||||||
void (*rebase)(struct sway_seat *seat, uint32_t time_msec);
|
void (*rebase)(struct sway_seat *seat, uint32_t time_msec);
|
||||||
|
void (*touch_motion)(struct sway_seat *seat,
|
||||||
|
struct wlr_touch_motion_event *event, double lx, double ly);
|
||||||
|
void (*touch_up)(struct sway_seat *seat,
|
||||||
|
struct wlr_touch_up_event *event);
|
||||||
|
void (*touch_down)(struct sway_seat *seat,
|
||||||
|
struct wlr_touch_down_event *event, double lx, double ly);
|
||||||
|
void (*touch_cancel)(struct sway_seat *seat,
|
||||||
|
struct wlr_touch_cancel_event *event);
|
||||||
void (*tablet_tool_motion)(struct sway_seat *seat,
|
void (*tablet_tool_motion)(struct sway_seat *seat,
|
||||||
struct sway_tablet_tool *tool, uint32_t time_msec);
|
struct sway_tablet_tool *tool, uint32_t time_msec);
|
||||||
void (*tablet_tool_tip)(struct sway_seat *seat, struct sway_tablet_tool *tool,
|
void (*tablet_tool_tip)(struct sway_seat *seat, struct sway_tablet_tool *tool,
|
||||||
uint32_t time_msec, enum wlr_tablet_tool_tip_state state);
|
uint32_t time_msec, enum wlr_tablet_tool_tip_state state);
|
||||||
void (*end)(struct sway_seat *seat);
|
void (*end)(struct sway_seat *seat);
|
||||||
void (*unref)(struct sway_seat *seat, struct sway_container *con);
|
void (*unref)(struct sway_seat *seat, struct sway_container *con);
|
||||||
void (*render)(struct sway_seat *seat, struct sway_output *output,
|
|
||||||
pixman_region32_t *damage);
|
|
||||||
bool allow_set_cursor;
|
bool allow_set_cursor;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -50,19 +74,6 @@ struct sway_seat_node {
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_drag_icon {
|
|
||||||
struct sway_seat *seat;
|
|
||||||
struct wlr_drag_icon *wlr_drag_icon;
|
|
||||||
struct wl_list link; // sway_root::drag_icons
|
|
||||||
|
|
||||||
double x, y; // in layout-local coordinates
|
|
||||||
|
|
||||||
struct wl_listener surface_commit;
|
|
||||||
struct wl_listener map;
|
|
||||||
struct wl_listener unmap;
|
|
||||||
struct wl_listener destroy;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_drag {
|
struct sway_drag {
|
||||||
struct sway_seat *seat;
|
struct sway_seat *seat;
|
||||||
struct wlr_drag *wlr_drag;
|
struct wlr_drag *wlr_drag;
|
||||||
|
@ -73,16 +84,23 @@ struct sway_seat {
|
||||||
struct wlr_seat *wlr_seat;
|
struct wlr_seat *wlr_seat;
|
||||||
struct sway_cursor *cursor;
|
struct sway_cursor *cursor;
|
||||||
|
|
||||||
|
// Seat scene tree structure
|
||||||
|
// - scene_tree
|
||||||
|
// - drag icons
|
||||||
|
// - drag icon 1
|
||||||
|
// - drag icon 2
|
||||||
|
// - seatop specific stuff
|
||||||
|
struct wlr_scene_tree *scene_tree;
|
||||||
|
struct wlr_scene_tree *drag_icons;
|
||||||
|
|
||||||
bool has_focus;
|
bool has_focus;
|
||||||
struct wl_list focus_stack; // list of containers in focus order
|
struct wl_list focus_stack; // list of containers in focus order
|
||||||
struct sway_workspace *workspace;
|
struct sway_workspace *workspace;
|
||||||
char *prev_workspace_name; // for workspace back_and_forth
|
char *prev_workspace_name; // for workspace back_and_forth
|
||||||
|
|
||||||
// If the focused layer is set, views cannot receive keyboard focus
|
|
||||||
struct wlr_layer_surface_v1 *focused_layer;
|
struct wlr_layer_surface_v1 *focused_layer;
|
||||||
|
// If the exclusive layer is set, views cannot receive keyboard focus
|
||||||
// If exclusive_client is set, no other clients will receive input events
|
bool has_exclusive_layer;
|
||||||
struct wl_client *exclusive_client;
|
|
||||||
|
|
||||||
// Last touch point
|
// Last touch point
|
||||||
int32_t touch_id;
|
int32_t touch_id;
|
||||||
|
@ -106,6 +124,7 @@ struct sway_seat {
|
||||||
struct wl_listener start_drag;
|
struct wl_listener start_drag;
|
||||||
struct wl_listener request_set_selection;
|
struct wl_listener request_set_selection;
|
||||||
struct wl_listener request_set_primary_selection;
|
struct wl_listener request_set_primary_selection;
|
||||||
|
struct wl_listener destroy;
|
||||||
|
|
||||||
struct wl_list devices; // sway_seat_device::link
|
struct wl_list devices; // sway_seat_device::link
|
||||||
struct wl_list keyboard_groups; // sway_keyboard_group::link
|
struct wl_list keyboard_groups; // sway_keyboard_group::link
|
||||||
|
@ -141,6 +160,9 @@ void seat_add_device(struct sway_seat *seat,
|
||||||
void seat_configure_device(struct sway_seat *seat,
|
void seat_configure_device(struct sway_seat *seat,
|
||||||
struct sway_input_device *device);
|
struct sway_input_device *device);
|
||||||
|
|
||||||
|
void seat_configure_device_mapping(struct sway_seat *seat,
|
||||||
|
struct sway_input_device *input_device);
|
||||||
|
|
||||||
void seat_reset_device(struct sway_seat *seat,
|
void seat_reset_device(struct sway_seat *seat,
|
||||||
struct sway_input_device *input_device);
|
struct sway_input_device *input_device);
|
||||||
|
|
||||||
|
@ -171,8 +193,7 @@ void seat_set_focus_surface(struct sway_seat *seat,
|
||||||
void seat_set_focus_layer(struct sway_seat *seat,
|
void seat_set_focus_layer(struct sway_seat *seat,
|
||||||
struct wlr_layer_surface_v1 *layer);
|
struct wlr_layer_surface_v1 *layer);
|
||||||
|
|
||||||
void seat_set_exclusive_client(struct sway_seat *seat,
|
void seat_unfocus_unless_client(struct sway_seat *seat, struct wl_client *client);
|
||||||
struct wl_client *client);
|
|
||||||
|
|
||||||
struct sway_node *seat_get_focus(struct sway_seat *seat);
|
struct sway_node *seat_get_focus(struct sway_seat *seat);
|
||||||
|
|
||||||
|
@ -231,7 +252,7 @@ void seat_idle_notify_activity(struct sway_seat *seat,
|
||||||
|
|
||||||
bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
|
bool seat_is_input_allowed(struct sway_seat *seat, struct wlr_surface *surface);
|
||||||
|
|
||||||
void drag_icon_update_position(struct sway_drag_icon *icon);
|
void drag_icons_update_position(struct sway_seat *seat);
|
||||||
|
|
||||||
enum wlr_edges find_resize_edge(struct sway_container *cont,
|
enum wlr_edges find_resize_edge(struct sway_container *cont,
|
||||||
struct wlr_surface *surface, struct sway_cursor *cursor);
|
struct wlr_surface *surface, struct sway_cursor *cursor);
|
||||||
|
@ -239,10 +260,13 @@ enum wlr_edges find_resize_edge(struct sway_container *cont,
|
||||||
void seatop_begin_default(struct sway_seat *seat);
|
void seatop_begin_default(struct sway_seat *seat);
|
||||||
|
|
||||||
void seatop_begin_down(struct sway_seat *seat, struct sway_container *con,
|
void seatop_begin_down(struct sway_seat *seat, struct sway_container *con,
|
||||||
uint32_t time_msec, double sx, double sy);
|
double sx, double sy);
|
||||||
|
|
||||||
void seatop_begin_down_on_surface(struct sway_seat *seat,
|
void seatop_begin_down_on_surface(struct sway_seat *seat,
|
||||||
struct wlr_surface *surface, uint32_t time_msec, double sx, double sy);
|
struct wlr_surface *surface, double sx, double sy);
|
||||||
|
|
||||||
|
void seatop_begin_touch_down(struct sway_seat *seat, struct wlr_surface *surface,
|
||||||
|
struct wlr_touch_down_event *event, double sx, double sy, double lx, double ly);
|
||||||
|
|
||||||
void seatop_begin_move_floating(struct sway_seat *seat,
|
void seatop_begin_move_floating(struct sway_seat *seat,
|
||||||
struct sway_container *con);
|
struct sway_container *con);
|
||||||
|
@ -263,18 +287,18 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
|
||||||
struct sway_workspace *workspace);
|
struct sway_workspace *workspace);
|
||||||
|
|
||||||
void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,
|
void seat_pointer_notify_button(struct sway_seat *seat, uint32_t time_msec,
|
||||||
uint32_t button, enum wlr_button_state state);
|
uint32_t button, enum wl_pointer_button_state state);
|
||||||
|
|
||||||
void seat_consider_warp_to_focus(struct sway_seat *seat);
|
void seat_consider_warp_to_focus(struct sway_seat *seat);
|
||||||
|
|
||||||
void seatop_button(struct sway_seat *seat, uint32_t time_msec,
|
void seatop_button(struct sway_seat *seat, uint32_t time_msec,
|
||||||
struct wlr_input_device *device, uint32_t button,
|
struct wlr_input_device *device, uint32_t button,
|
||||||
enum wlr_button_state state);
|
enum wl_pointer_button_state state);
|
||||||
|
|
||||||
void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec);
|
void seatop_pointer_motion(struct sway_seat *seat, uint32_t time_msec);
|
||||||
|
|
||||||
void seatop_pointer_axis(struct sway_seat *seat,
|
void seatop_pointer_axis(struct sway_seat *seat,
|
||||||
struct wlr_event_pointer_axis *event);
|
struct wlr_pointer_axis_event *event);
|
||||||
|
|
||||||
void seatop_tablet_tool_tip(struct sway_seat *seat,
|
void seatop_tablet_tool_tip(struct sway_seat *seat,
|
||||||
struct sway_tablet_tool *tool, uint32_t time_msec,
|
struct sway_tablet_tool *tool, uint32_t time_msec,
|
||||||
|
@ -283,6 +307,37 @@ void seatop_tablet_tool_tip(struct sway_seat *seat,
|
||||||
void seatop_tablet_tool_motion(struct sway_seat *seat,
|
void seatop_tablet_tool_motion(struct sway_seat *seat,
|
||||||
struct sway_tablet_tool *tool, uint32_t time_msec);
|
struct sway_tablet_tool *tool, uint32_t time_msec);
|
||||||
|
|
||||||
|
void seatop_hold_begin(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_hold_begin_event *event);
|
||||||
|
void seatop_hold_end(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_hold_end_event *event);
|
||||||
|
|
||||||
|
void seatop_pinch_begin(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_pinch_begin_event *event);
|
||||||
|
void seatop_pinch_update(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_pinch_update_event *event);
|
||||||
|
void seatop_pinch_end(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_pinch_end_event *event);
|
||||||
|
|
||||||
|
void seatop_swipe_begin(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_swipe_begin_event *event);
|
||||||
|
void seatop_swipe_update(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_swipe_update_event *event);
|
||||||
|
void seatop_swipe_end(struct sway_seat *seat,
|
||||||
|
struct wlr_pointer_swipe_end_event *event);
|
||||||
|
|
||||||
|
void seatop_touch_motion(struct sway_seat *seat,
|
||||||
|
struct wlr_touch_motion_event *event, double lx, double ly);
|
||||||
|
|
||||||
|
void seatop_touch_up(struct sway_seat *seat,
|
||||||
|
struct wlr_touch_up_event *event);
|
||||||
|
|
||||||
|
void seatop_touch_down(struct sway_seat *seat,
|
||||||
|
struct wlr_touch_down_event *event, double lx, double ly);
|
||||||
|
|
||||||
|
void seatop_touch_cancel(struct sway_seat *seat,
|
||||||
|
struct wlr_touch_cancel_event *event);
|
||||||
|
|
||||||
void seatop_rebase(struct sway_seat *seat, uint32_t time_msec);
|
void seatop_rebase(struct sway_seat *seat, uint32_t time_msec);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -297,13 +352,6 @@ void seatop_end(struct sway_seat *seat);
|
||||||
*/
|
*/
|
||||||
void seatop_unref(struct sway_seat *seat, struct sway_container *con);
|
void seatop_unref(struct sway_seat *seat, struct sway_container *con);
|
||||||
|
|
||||||
/**
|
|
||||||
* Instructs a seatop to render anything that it needs to render
|
|
||||||
* (eg. dropzone for move-tiling)
|
|
||||||
*/
|
|
||||||
void seatop_render(struct sway_seat *seat, struct sway_output *output,
|
|
||||||
pixman_region32_t *damage);
|
|
||||||
|
|
||||||
bool seatop_allows_set_cursor(struct sway_seat *seat);
|
bool seatop_allows_set_cursor(struct sway_seat *seat);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
struct sway_switch {
|
struct sway_switch {
|
||||||
struct sway_seat_device *seat_device;
|
struct sway_seat_device *seat_device;
|
||||||
|
struct wlr_switch *wlr;
|
||||||
enum wlr_switch_state state;
|
enum wlr_switch_state state;
|
||||||
enum wlr_switch_type type;
|
enum wlr_switch_type type;
|
||||||
|
|
||||||
|
|
|
@ -32,6 +32,7 @@ struct sway_tablet_pad {
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
struct sway_seat_device *seat_device;
|
struct sway_seat_device *seat_device;
|
||||||
struct sway_tablet *tablet;
|
struct sway_tablet *tablet;
|
||||||
|
struct wlr_tablet_pad *wlr;
|
||||||
struct wlr_tablet_v2_tablet_pad *tablet_v2_pad;
|
struct wlr_tablet_v2_tablet_pad *tablet_v2_pad;
|
||||||
|
|
||||||
struct wl_listener attach;
|
struct wl_listener attach;
|
||||||
|
@ -62,7 +63,7 @@ void sway_configure_tablet_pad(struct sway_tablet_pad *tablet_pad);
|
||||||
|
|
||||||
void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad);
|
void sway_tablet_pad_destroy(struct sway_tablet_pad *tablet_pad);
|
||||||
|
|
||||||
void sway_tablet_pad_notify_enter(struct sway_tablet_pad *tablet_pad,
|
void sway_tablet_pad_set_focus(struct sway_tablet_pad *tablet_pad,
|
||||||
struct wlr_surface *surface);
|
struct wlr_surface *surface);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3,13 +3,12 @@
|
||||||
|
|
||||||
#include <wlr/types/wlr_text_input_v3.h>
|
#include <wlr/types/wlr_text_input_v3.h>
|
||||||
#include <wlr/types/wlr_input_method_v2.h>
|
#include <wlr/types/wlr_input_method_v2.h>
|
||||||
#include <wlr/types/wlr_surface.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
#include "sway/input/seat.h"
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The relay structure manages the relationship between text-input and
|
* The relay structure manages the relationship between text-input and
|
||||||
* input_method interfaces on a given seat. Multiple text-input interfaces may
|
* input_method interfaces on a given seat. Multiple text-input interfaces may
|
||||||
* be bound to a relay, but at most one will be focused (reveiving events) at
|
* be bound to a relay, but at most one will be focused (receiving events) at
|
||||||
* a time. At most one input-method interface may be bound to the seat. The
|
* a time. At most one input-method interface may be bound to the seat. The
|
||||||
* relay manages life cycle of both sides. When both sides are present and
|
* relay manages life cycle of both sides. When both sides are present and
|
||||||
* focused, the relay passes messages between them.
|
* focused, the relay passes messages between them.
|
||||||
|
@ -22,18 +21,21 @@ struct sway_input_method_relay {
|
||||||
struct sway_seat *seat;
|
struct sway_seat *seat;
|
||||||
|
|
||||||
struct wl_list text_inputs; // sway_text_input::link
|
struct wl_list text_inputs; // sway_text_input::link
|
||||||
|
struct wl_list input_popups; // sway_input_popup::link
|
||||||
struct wlr_input_method_v2 *input_method; // doesn't have to be present
|
struct wlr_input_method_v2 *input_method; // doesn't have to be present
|
||||||
|
|
||||||
struct wl_listener text_input_new;
|
struct wl_listener text_input_new;
|
||||||
|
|
||||||
struct wl_listener input_method_new;
|
struct wl_listener input_method_new;
|
||||||
struct wl_listener input_method_commit;
|
struct wl_listener input_method_commit;
|
||||||
|
struct wl_listener input_method_new_popup_surface;
|
||||||
struct wl_listener input_method_grab_keyboard;
|
struct wl_listener input_method_grab_keyboard;
|
||||||
struct wl_listener input_method_destroy;
|
struct wl_listener input_method_destroy;
|
||||||
|
|
||||||
struct wl_listener input_method_keyboard_grab_destroy;
|
struct wl_listener input_method_keyboard_grab_destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
struct sway_text_input {
|
struct sway_text_input {
|
||||||
struct sway_input_method_relay *relay;
|
struct sway_input_method_relay *relay;
|
||||||
|
|
||||||
|
|
23
include/sway/input/text_input_popup.h
Normal file
23
include/sway/input/text_input_popup.h
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#ifndef _SWAY_INPUT_TEXT_INPUT_POPUP_H
|
||||||
|
#define _SWAY_INPUT_TEXT_INPUT_POPUP_H
|
||||||
|
|
||||||
|
#include "sway/tree/view.h"
|
||||||
|
|
||||||
|
struct sway_input_popup {
|
||||||
|
struct sway_input_method_relay *relay;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *scene_tree;
|
||||||
|
struct sway_popup_desc desc;
|
||||||
|
struct wlr_input_popup_surface_v2 *popup_surface;
|
||||||
|
struct wlr_output *fixed_output;
|
||||||
|
|
||||||
|
struct wl_list link;
|
||||||
|
|
||||||
|
struct wl_listener popup_destroy;
|
||||||
|
struct wl_listener popup_surface_commit;
|
||||||
|
struct wl_listener popup_surface_map;
|
||||||
|
struct wl_listener popup_surface_unmap;
|
||||||
|
|
||||||
|
struct wl_listener focused_surface_unmap;
|
||||||
|
};
|
||||||
|
#endif
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef _SWAY_IPC_JSON_H
|
#ifndef _SWAY_IPC_JSON_H
|
||||||
#define _SWAY_IPC_JSON_H
|
#define _SWAY_IPC_JSON_H
|
||||||
#include <json.h>
|
#include <json.h>
|
||||||
|
#include "sway/output.h"
|
||||||
#include "sway/tree/container.h"
|
#include "sway/tree/container.h"
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
|
|
||||||
|
@ -9,6 +10,7 @@ json_object *ipc_json_get_version(void);
|
||||||
json_object *ipc_json_get_binding_mode(void);
|
json_object *ipc_json_get_binding_mode(void);
|
||||||
|
|
||||||
json_object *ipc_json_describe_disabled_output(struct sway_output *o);
|
json_object *ipc_json_describe_disabled_output(struct sway_output *o);
|
||||||
|
json_object *ipc_json_describe_non_desktop_output(struct sway_output_non_desktop *o);
|
||||||
json_object *ipc_json_describe_node(struct sway_node *node);
|
json_object *ipc_json_describe_node(struct sway_node *node);
|
||||||
json_object *ipc_json_describe_node_recursive(struct sway_node *node);
|
json_object *ipc_json_describe_node_recursive(struct sway_node *node);
|
||||||
json_object *ipc_json_describe_input(struct sway_input_device *device);
|
json_object *ipc_json_describe_input(struct sway_input_device *device);
|
||||||
|
|
|
@ -21,5 +21,6 @@ void ipc_event_mode(const char *mode, bool pango);
|
||||||
void ipc_event_shutdown(const char *reason);
|
void ipc_event_shutdown(const char *reason);
|
||||||
void ipc_event_binding(struct sway_binding *binding);
|
void ipc_event_binding(struct sway_binding *binding);
|
||||||
void ipc_event_input(const char *change, struct sway_input_device *device);
|
void ipc_event_input(const char *change, struct sway_input_device *device);
|
||||||
|
void ipc_event_output(void);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,60 +1,44 @@
|
||||||
#ifndef _SWAY_LAYERS_H
|
#ifndef _SWAY_LAYERS_H
|
||||||
#define _SWAY_LAYERS_H
|
#define _SWAY_LAYERS_H
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <wlr/types/wlr_surface.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
#include <wlr/types/wlr_layer_shell_v1.h>
|
||||||
|
#include "sway/tree/view.h"
|
||||||
enum layer_parent {
|
|
||||||
LAYER_PARENT_LAYER,
|
|
||||||
LAYER_PARENT_POPUP,
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_layer_surface {
|
struct sway_layer_surface {
|
||||||
struct wlr_layer_surface_v1 *layer_surface;
|
|
||||||
struct wl_list link;
|
|
||||||
|
|
||||||
struct wl_listener destroy;
|
|
||||||
struct wl_listener map;
|
struct wl_listener map;
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener surface_commit;
|
struct wl_listener surface_commit;
|
||||||
struct wl_listener output_destroy;
|
struct wl_listener output_destroy;
|
||||||
|
struct wl_listener node_destroy;
|
||||||
struct wl_listener new_popup;
|
struct wl_listener new_popup;
|
||||||
struct wl_listener new_subsurface;
|
|
||||||
|
|
||||||
struct wlr_box geo;
|
|
||||||
bool mapped;
|
bool mapped;
|
||||||
struct wlr_box extent;
|
|
||||||
enum zwlr_layer_shell_v1_layer layer;
|
struct wlr_scene_tree *popups;
|
||||||
|
struct sway_popup_desc desc;
|
||||||
|
|
||||||
|
struct sway_output *output;
|
||||||
|
struct wlr_scene_layer_surface_v1 *scene;
|
||||||
|
struct wlr_scene_tree *tree;
|
||||||
|
struct wlr_layer_surface_v1 *layer_surface;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_layer_popup {
|
struct sway_layer_popup {
|
||||||
struct wlr_xdg_popup *wlr_popup;
|
struct wlr_xdg_popup *wlr_popup;
|
||||||
enum layer_parent parent_type;
|
struct wlr_scene_tree *scene;
|
||||||
union {
|
struct sway_layer_surface *toplevel;
|
||||||
struct sway_layer_surface *parent_layer;
|
|
||||||
struct sway_layer_popup *parent_popup;
|
|
||||||
};
|
|
||||||
struct wl_listener map;
|
|
||||||
struct wl_listener unmap;
|
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
struct wl_listener commit;
|
|
||||||
struct wl_listener new_popup;
|
struct wl_listener new_popup;
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_layer_subsurface {
|
|
||||||
struct wlr_subsurface *wlr_subsurface;
|
|
||||||
struct sway_layer_surface *layer_surface;
|
|
||||||
|
|
||||||
struct wl_listener map;
|
|
||||||
struct wl_listener unmap;
|
|
||||||
struct wl_listener destroy;
|
|
||||||
struct wl_listener commit;
|
struct wl_listener commit;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_output;
|
struct sway_output;
|
||||||
|
|
||||||
|
struct wlr_layer_surface_v1 *toplevel_layer_surface_from_surface(
|
||||||
|
struct wlr_surface *surface);
|
||||||
|
|
||||||
void arrange_layers(struct sway_output *output);
|
void arrange_layers(struct sway_output *output);
|
||||||
|
|
||||||
struct sway_layer_surface *layer_from_wlr_layer_surface_v1(
|
|
||||||
struct wlr_layer_surface_v1 *layer_surface);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
6
include/sway/lock.h
Normal file
6
include/sway/lock.h
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
#ifndef _SWAY_LOCK_H
|
||||||
|
#define _SWAY_LOCK_H
|
||||||
|
|
||||||
|
void arrange_locks(void);
|
||||||
|
|
||||||
|
#endif
|
|
@ -3,7 +3,9 @@
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
|
#include <wlr/types/wlr_damage_ring.h>
|
||||||
#include <wlr/types/wlr_output.h>
|
#include <wlr/types/wlr_output.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "sway/tree/node.h"
|
#include "sway/tree/node.h"
|
||||||
#include "sway/tree/view.h"
|
#include "sway/tree/view.h"
|
||||||
|
@ -18,43 +20,64 @@ struct sway_output_state {
|
||||||
|
|
||||||
struct sway_output {
|
struct sway_output {
|
||||||
struct sway_node node;
|
struct sway_node node;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wlr_scene_tree *shell_background;
|
||||||
|
struct wlr_scene_tree *shell_bottom;
|
||||||
|
struct wlr_scene_tree *tiling;
|
||||||
|
struct wlr_scene_tree *fullscreen;
|
||||||
|
struct wlr_scene_tree *shell_top;
|
||||||
|
struct wlr_scene_tree *shell_overlay;
|
||||||
|
struct wlr_scene_tree *session_lock;
|
||||||
|
} layers;
|
||||||
|
|
||||||
|
// when a container is fullscreen, in case the fullscreen surface is
|
||||||
|
// translucent (can see behind) we must make sure that the background is a
|
||||||
|
// solid color in order to conform to the wayland protocol. This rect
|
||||||
|
// ensures that when looking through a surface, all that will be seen
|
||||||
|
// is black.
|
||||||
|
struct wlr_scene_rect *fullscreen_background;
|
||||||
|
|
||||||
struct wlr_output *wlr_output;
|
struct wlr_output *wlr_output;
|
||||||
|
struct wlr_scene_output *scene_output;
|
||||||
struct sway_server *server;
|
struct sway_server *server;
|
||||||
struct wl_list link;
|
struct wl_list link;
|
||||||
|
|
||||||
struct wl_list layers[4]; // sway_layer_surface::link
|
|
||||||
struct wlr_box usable_area;
|
struct wlr_box usable_area;
|
||||||
|
|
||||||
struct timespec last_frame;
|
|
||||||
struct wlr_output_damage *damage;
|
|
||||||
|
|
||||||
int lx, ly; // layout coords
|
int lx, ly; // layout coords
|
||||||
int width, height; // transformed buffer size
|
int width, height; // transformed buffer size
|
||||||
enum wl_output_subpixel detected_subpixel;
|
enum wl_output_subpixel detected_subpixel;
|
||||||
enum scale_filter_mode scale_filter;
|
enum scale_filter_mode scale_filter;
|
||||||
// last applied mode when the output is DPMS'ed
|
|
||||||
struct wlr_output_mode *current_mode;
|
|
||||||
|
|
||||||
bool enabling, enabled;
|
bool enabled;
|
||||||
list_t *workspaces;
|
list_t *workspaces;
|
||||||
|
|
||||||
struct sway_output_state current;
|
struct sway_output_state current;
|
||||||
|
|
||||||
|
struct wl_listener layout_destroy;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
struct wl_listener commit;
|
|
||||||
struct wl_listener mode;
|
|
||||||
struct wl_listener present;
|
struct wl_listener present;
|
||||||
struct wl_listener damage_destroy;
|
struct wl_listener frame;
|
||||||
struct wl_listener damage_frame;
|
struct wl_listener request_state;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal disable;
|
struct wl_signal disable;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
|
struct wlr_color_transform *color_transform;
|
||||||
|
|
||||||
struct timespec last_presentation;
|
struct timespec last_presentation;
|
||||||
uint32_t refresh_nsec;
|
uint32_t refresh_nsec;
|
||||||
int max_render_time; // In milliseconds
|
int max_render_time; // In milliseconds
|
||||||
struct wl_event_source *repaint_timer;
|
struct wl_event_source *repaint_timer;
|
||||||
|
bool allow_tearing;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sway_output_non_desktop {
|
||||||
|
struct wlr_output *wlr_output;
|
||||||
|
|
||||||
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_output *output_create(struct wlr_output *wlr_output);
|
struct sway_output *output_create(struct wlr_output *wlr_output);
|
||||||
|
@ -75,18 +98,8 @@ typedef void (*sway_surface_iterator_func_t)(struct sway_output *output,
|
||||||
struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box,
|
struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box,
|
||||||
void *user_data);
|
void *user_data);
|
||||||
|
|
||||||
void output_damage_whole(struct sway_output *output);
|
bool output_match_name_or_id(struct sway_output *output,
|
||||||
|
const char *name_or_id);
|
||||||
void output_damage_surface(struct sway_output *output, double ox, double oy,
|
|
||||||
struct wlr_surface *surface, bool whole);
|
|
||||||
|
|
||||||
void output_damage_from_view(struct sway_output *output,
|
|
||||||
struct sway_view *view);
|
|
||||||
|
|
||||||
void output_damage_box(struct sway_output *output, struct wlr_box *box);
|
|
||||||
|
|
||||||
void output_damage_whole_container(struct sway_output *output,
|
|
||||||
struct sway_container *con);
|
|
||||||
|
|
||||||
// this ONLY includes the enabled outputs
|
// this ONLY includes the enabled outputs
|
||||||
struct sway_output *output_by_name_or_id(const char *name_or_id);
|
struct sway_output *output_by_name_or_id(const char *name_or_id);
|
||||||
|
@ -100,47 +113,8 @@ void output_enable(struct sway_output *output);
|
||||||
|
|
||||||
void output_disable(struct sway_output *output);
|
void output_disable(struct sway_output *output);
|
||||||
|
|
||||||
bool output_has_opaque_overlay_layer_surface(struct sway_output *output);
|
|
||||||
|
|
||||||
struct sway_workspace *output_get_active_workspace(struct sway_output *output);
|
struct sway_workspace *output_get_active_workspace(struct sway_output *output);
|
||||||
|
|
||||||
void output_render(struct sway_output *output, struct timespec *when,
|
|
||||||
pixman_region32_t *damage);
|
|
||||||
|
|
||||||
void output_surface_for_each_surface(struct sway_output *output,
|
|
||||||
struct wlr_surface *surface, double ox, double oy,
|
|
||||||
sway_surface_iterator_func_t iterator, void *user_data);
|
|
||||||
|
|
||||||
void output_view_for_each_surface(struct sway_output *output,
|
|
||||||
struct sway_view *view, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
void output_view_for_each_popup_surface(struct sway_output *output,
|
|
||||||
struct sway_view *view, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
void output_layer_for_each_surface(struct sway_output *output,
|
|
||||||
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
void output_layer_for_each_toplevel_surface(struct sway_output *output,
|
|
||||||
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
void output_layer_for_each_popup_surface(struct sway_output *output,
|
|
||||||
struct wl_list *layer_surfaces, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
|
||||||
void output_unmanaged_for_each_surface(struct sway_output *output,
|
|
||||||
struct wl_list *unmanaged, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
void output_drag_icons_for_each_surface(struct sway_output *output,
|
|
||||||
struct wl_list *drag_icons, sway_surface_iterator_func_t iterator,
|
|
||||||
void *user_data);
|
|
||||||
|
|
||||||
void output_for_each_workspace(struct sway_output *output,
|
void output_for_each_workspace(struct sway_output *output,
|
||||||
void (*f)(struct sway_workspace *ws, void *data), void *data);
|
void (*f)(struct sway_workspace *ws, void *data), void *data);
|
||||||
|
|
||||||
|
@ -158,18 +132,8 @@ void output_get_box(struct sway_output *output, struct wlr_box *box);
|
||||||
enum sway_container_layout output_get_default_layout(
|
enum sway_container_layout output_get_default_layout(
|
||||||
struct sway_output *output);
|
struct sway_output *output);
|
||||||
|
|
||||||
void render_rect(struct sway_output *output,
|
|
||||||
pixman_region32_t *output_damage, const struct wlr_box *_box,
|
|
||||||
float color[static 4]);
|
|
||||||
|
|
||||||
void premultiply_alpha(float color[4], float opacity);
|
|
||||||
|
|
||||||
void scale_box(struct wlr_box *box, float scale);
|
|
||||||
|
|
||||||
enum wlr_direction opposite_direction(enum wlr_direction d);
|
enum wlr_direction opposite_direction(enum wlr_direction d);
|
||||||
|
|
||||||
void handle_output_layout_change(struct wl_listener *listener, void *data);
|
|
||||||
|
|
||||||
void handle_output_manager_apply(struct wl_listener *listener, void *data);
|
void handle_output_manager_apply(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
void handle_output_manager_test(struct wl_listener *listener, void *data);
|
void handle_output_manager_test(struct wl_listener *listener, void *data);
|
||||||
|
@ -177,4 +141,8 @@ void handle_output_manager_test(struct wl_listener *listener, void *data);
|
||||||
void handle_output_power_manager_set_mode(struct wl_listener *listener,
|
void handle_output_power_manager_set_mode(struct wl_listener *listener,
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
|
struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output);
|
||||||
|
|
||||||
|
void update_output_manager_config(struct sway_server *server);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
33
include/sway/scene_descriptor.h
Normal file
33
include/sway/scene_descriptor.h
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
/**
|
||||||
|
* Across a wayland compositor, there are multiple shells: It can be
|
||||||
|
* a toplevel, or a layer_shell, or even something more meta like a drag
|
||||||
|
* icon or highlight indicators when dragging windows around.
|
||||||
|
*
|
||||||
|
* This object lets us store values that represent these modes of operation
|
||||||
|
* and keep track of what object is being represented.
|
||||||
|
*/
|
||||||
|
#ifndef _SWAY_SCENE_DESCRIPTOR_H
|
||||||
|
#define _SWAY_SCENE_DESCRIPTOR_H
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
|
|
||||||
|
enum sway_scene_descriptor_type {
|
||||||
|
SWAY_SCENE_DESC_BUFFER_TIMER,
|
||||||
|
SWAY_SCENE_DESC_NON_INTERACTIVE,
|
||||||
|
SWAY_SCENE_DESC_CONTAINER,
|
||||||
|
SWAY_SCENE_DESC_VIEW,
|
||||||
|
SWAY_SCENE_DESC_LAYER_SHELL,
|
||||||
|
SWAY_SCENE_DESC_XWAYLAND_UNMANAGED,
|
||||||
|
SWAY_SCENE_DESC_POPUP,
|
||||||
|
SWAY_SCENE_DESC_DRAG_ICON,
|
||||||
|
};
|
||||||
|
|
||||||
|
bool scene_descriptor_assign(struct wlr_scene_node *node,
|
||||||
|
enum sway_scene_descriptor_type type, void *data);
|
||||||
|
|
||||||
|
void *scene_descriptor_try_get(struct wlr_scene_node *node,
|
||||||
|
enum sway_scene_descriptor_type type);
|
||||||
|
|
||||||
|
void scene_descriptor_destroy(struct wlr_scene_node *node,
|
||||||
|
enum sway_scene_descriptor_type type);
|
||||||
|
|
||||||
|
#endif
|
|
@ -2,44 +2,41 @@
|
||||||
#define _SWAY_SERVER_H
|
#define _SWAY_SERVER_H
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/backend.h>
|
|
||||||
#include <wlr/backend/session.h>
|
|
||||||
#include <wlr/render/allocator.h>
|
|
||||||
#include <wlr/render/wlr_renderer.h>
|
|
||||||
#include <wlr/types/wlr_compositor.h>
|
|
||||||
#include <wlr/types/wlr_data_device.h>
|
|
||||||
#include <wlr/types/wlr_input_method_v2.h>
|
|
||||||
#include <wlr/types/wlr_foreign_toplevel_management_v1.h>
|
|
||||||
#include <wlr/types/wlr_drm_lease_v1.h>
|
|
||||||
#include <wlr/types/wlr_layer_shell_v1.h>
|
|
||||||
#include <wlr/types/wlr_output_management_v1.h>
|
|
||||||
#include <wlr/types/wlr_output_power_management_v1.h>
|
|
||||||
#include <wlr/types/wlr_presentation_time.h>
|
|
||||||
#include <wlr/types/wlr_relative_pointer_v1.h>
|
|
||||||
#include <wlr/types/wlr_server_decoration.h>
|
|
||||||
#include <wlr/types/wlr_text_input_v3.h>
|
|
||||||
#include <wlr/types/wlr_xdg_shell.h>
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#if HAVE_XWAYLAND
|
#include "sway/desktop/idle_inhibit_v1.h"
|
||||||
|
#if WLR_HAS_XWAYLAND
|
||||||
#include "sway/xwayland.h"
|
#include "sway/xwayland.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
struct sway_transaction;
|
struct sway_transaction;
|
||||||
|
|
||||||
|
struct sway_session_lock {
|
||||||
|
struct wlr_session_lock_v1 *lock;
|
||||||
|
struct wlr_surface *focused;
|
||||||
|
bool abandoned;
|
||||||
|
|
||||||
|
struct wl_list outputs; // struct sway_session_lock_output
|
||||||
|
|
||||||
|
// invalid if the session is abandoned
|
||||||
|
struct wl_listener new_surface;
|
||||||
|
struct wl_listener unlock;
|
||||||
|
struct wl_listener destroy;
|
||||||
|
};
|
||||||
|
|
||||||
struct sway_server {
|
struct sway_server {
|
||||||
struct wl_display *wl_display;
|
struct wl_display *wl_display;
|
||||||
struct wl_event_loop *wl_event_loop;
|
struct wl_event_loop *wl_event_loop;
|
||||||
const char *socket;
|
const char *socket;
|
||||||
|
|
||||||
struct wlr_backend *backend;
|
struct wlr_backend *backend;
|
||||||
|
struct wlr_session *session;
|
||||||
// secondary headless backend used for creating virtual outputs on-the-fly
|
// secondary headless backend used for creating virtual outputs on-the-fly
|
||||||
struct wlr_backend *headless_backend;
|
struct wlr_backend *headless_backend;
|
||||||
struct wlr_renderer *renderer;
|
struct wlr_renderer *renderer;
|
||||||
struct wlr_allocator *allocator;
|
struct wlr_allocator *allocator;
|
||||||
|
|
||||||
struct wlr_compositor *compositor;
|
struct wlr_compositor *compositor;
|
||||||
struct wl_listener compositor_new_surface;
|
|
||||||
|
|
||||||
struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1;
|
struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1;
|
||||||
|
|
||||||
|
@ -48,20 +45,20 @@ struct sway_server {
|
||||||
struct sway_input_manager *input;
|
struct sway_input_manager *input;
|
||||||
|
|
||||||
struct wl_listener new_output;
|
struct wl_listener new_output;
|
||||||
struct wl_listener output_layout_change;
|
struct wl_listener renderer_lost;
|
||||||
|
|
||||||
struct wlr_idle *idle;
|
struct wlr_idle_notifier_v1 *idle_notifier_v1;
|
||||||
struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1;
|
struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1;
|
||||||
|
|
||||||
struct wlr_layer_shell_v1 *layer_shell;
|
struct wlr_layer_shell_v1 *layer_shell;
|
||||||
struct wl_listener layer_shell_surface;
|
struct wl_listener layer_shell_surface;
|
||||||
|
|
||||||
struct wlr_xdg_shell *xdg_shell;
|
struct wlr_xdg_shell *xdg_shell;
|
||||||
struct wl_listener xdg_shell_surface;
|
struct wl_listener xdg_shell_toplevel;
|
||||||
|
|
||||||
struct wlr_tablet_manager_v2 *tablet_v2;
|
struct wlr_tablet_manager_v2 *tablet_v2;
|
||||||
|
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
struct sway_xwayland xwayland;
|
struct sway_xwayland xwayland;
|
||||||
struct wl_listener xwayland_surface;
|
struct wl_listener xwayland_surface;
|
||||||
struct wl_listener xwayland_ready;
|
struct wl_listener xwayland_ready;
|
||||||
|
@ -80,23 +77,49 @@ struct sway_server {
|
||||||
struct wlr_drm_lease_v1_manager *drm_lease_manager;
|
struct wlr_drm_lease_v1_manager *drm_lease_manager;
|
||||||
struct wl_listener drm_lease_request;
|
struct wl_listener drm_lease_request;
|
||||||
|
|
||||||
struct wlr_presentation *presentation;
|
|
||||||
|
|
||||||
struct wlr_pointer_constraints_v1 *pointer_constraints;
|
struct wlr_pointer_constraints_v1 *pointer_constraints;
|
||||||
struct wl_listener pointer_constraint;
|
struct wl_listener pointer_constraint;
|
||||||
|
|
||||||
|
struct wlr_xdg_output_manager_v1 *xdg_output_manager_v1;
|
||||||
|
|
||||||
struct wlr_output_manager_v1 *output_manager_v1;
|
struct wlr_output_manager_v1 *output_manager_v1;
|
||||||
struct wl_listener output_manager_apply;
|
struct wl_listener output_manager_apply;
|
||||||
struct wl_listener output_manager_test;
|
struct wl_listener output_manager_test;
|
||||||
|
|
||||||
|
struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1;
|
||||||
|
struct wl_listener gamma_control_set_gamma;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct sway_session_lock *lock;
|
||||||
|
struct wlr_session_lock_manager_v1 *manager;
|
||||||
|
|
||||||
|
struct wl_listener new_lock;
|
||||||
|
struct wl_listener manager_destroy;
|
||||||
|
} session_lock;
|
||||||
|
|
||||||
struct wlr_output_power_manager_v1 *output_power_manager_v1;
|
struct wlr_output_power_manager_v1 *output_power_manager_v1;
|
||||||
struct wl_listener output_power_manager_set_mode;
|
struct wl_listener output_power_manager_set_mode;
|
||||||
struct wlr_input_method_manager_v2 *input_method;
|
struct wlr_input_method_manager_v2 *input_method;
|
||||||
struct wlr_text_input_manager_v3 *text_input;
|
struct wlr_text_input_manager_v3 *text_input;
|
||||||
|
struct wlr_ext_foreign_toplevel_list_v1 *foreign_toplevel_list;
|
||||||
struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
|
struct wlr_foreign_toplevel_manager_v1 *foreign_toplevel_manager;
|
||||||
|
struct wlr_content_type_manager_v1 *content_type_manager_v1;
|
||||||
|
struct wlr_data_control_manager_v1 *data_control_manager_v1;
|
||||||
|
struct wlr_screencopy_manager_v1 *screencopy_manager_v1;
|
||||||
|
struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1;
|
||||||
|
struct wlr_security_context_manager_v1 *security_context_manager_v1;
|
||||||
|
|
||||||
struct wlr_xdg_activation_v1 *xdg_activation_v1;
|
struct wlr_xdg_activation_v1 *xdg_activation_v1;
|
||||||
struct wl_listener xdg_activation_v1_request_activate;
|
struct wl_listener xdg_activation_v1_request_activate;
|
||||||
|
struct wl_listener xdg_activation_v1_new_token;
|
||||||
|
|
||||||
|
struct wl_listener request_set_cursor_shape;
|
||||||
|
|
||||||
|
struct wlr_tearing_control_manager_v1 *tearing_control_v1;
|
||||||
|
struct wl_listener tearing_control_new_object;
|
||||||
|
struct wl_list tearing_controllers; // sway_tearing_controller::link
|
||||||
|
|
||||||
|
struct wl_list pending_launcher_ctxs; // launcher_ctx::link
|
||||||
|
|
||||||
// The timeout for transactions, after which a transaction is applied
|
// The timeout for transactions, after which a transaction is applied
|
||||||
// regardless of readiness.
|
// regardless of readiness.
|
||||||
|
@ -115,6 +138,8 @@ struct sway_server {
|
||||||
// Stores the nodes that have been marked as "dirty" and will be put into
|
// Stores the nodes that have been marked as "dirty" and will be put into
|
||||||
// the pending transaction.
|
// the pending transaction.
|
||||||
list_t *dirty_nodes;
|
list_t *dirty_nodes;
|
||||||
|
|
||||||
|
struct wl_event_source *delayed_modeset;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct sway_server server;
|
extern struct sway_server server;
|
||||||
|
@ -123,19 +148,13 @@ struct sway_debug {
|
||||||
bool noatomic; // Ignore atomic layout updates
|
bool noatomic; // Ignore atomic layout updates
|
||||||
bool txn_timings; // Log verbose messages about transactions
|
bool txn_timings; // Log verbose messages about transactions
|
||||||
bool txn_wait; // Always wait for the timeout before applying
|
bool txn_wait; // Always wait for the timeout before applying
|
||||||
bool noscanout; // Disable direct scan-out
|
bool legacy_wl_drm; // Enable the legacy wl_drm interface
|
||||||
|
|
||||||
enum {
|
|
||||||
DAMAGE_DEFAULT, // Default behaviour
|
|
||||||
DAMAGE_HIGHLIGHT, // Highlight regions of the screen being damaged
|
|
||||||
DAMAGE_RERENDER, // Render the full output when any damage occurs
|
|
||||||
} damage;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
extern struct sway_debug debug;
|
extern struct sway_debug debug;
|
||||||
|
|
||||||
/* Prepares an unprivileged server_init by performing all privileged operations in advance */
|
extern bool allow_unsupported_gpu;
|
||||||
bool server_privileged_prepare(struct sway_server *server);
|
|
||||||
bool server_init(struct sway_server *server);
|
bool server_init(struct sway_server *server);
|
||||||
void server_fini(struct sway_server *server);
|
void server_fini(struct sway_server *server);
|
||||||
bool server_start(struct sway_server *server);
|
bool server_start(struct sway_server *server);
|
||||||
|
@ -143,13 +162,17 @@ void server_run(struct sway_server *server);
|
||||||
|
|
||||||
void restore_nofile_limit(void);
|
void restore_nofile_limit(void);
|
||||||
|
|
||||||
void handle_compositor_new_surface(struct wl_listener *listener, void *data);
|
|
||||||
void handle_new_output(struct wl_listener *listener, void *data);
|
void handle_new_output(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data);
|
void handle_idle_inhibitor_v1(struct wl_listener *listener, void *data);
|
||||||
void handle_layer_shell_surface(struct wl_listener *listener, void *data);
|
void handle_layer_shell_surface(struct wl_listener *listener, void *data);
|
||||||
void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
|
void sway_session_lock_init(void);
|
||||||
#if HAVE_XWAYLAND
|
void sway_session_lock_add_output(struct sway_session_lock *lock,
|
||||||
|
struct sway_output *output);
|
||||||
|
bool sway_session_lock_has_surface(struct sway_session_lock *lock,
|
||||||
|
struct wlr_surface *surface);
|
||||||
|
void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data);
|
||||||
|
#if WLR_HAS_XWAYLAND
|
||||||
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
||||||
#endif
|
#endif
|
||||||
void handle_server_decoration(struct wl_listener *listener, void *data);
|
void handle_server_decoration(struct wl_listener *listener, void *data);
|
||||||
|
@ -157,5 +180,11 @@ void handle_xdg_decoration(struct wl_listener *listener, void *data);
|
||||||
void handle_pointer_constraint(struct wl_listener *listener, void *data);
|
void handle_pointer_constraint(struct wl_listener *listener, void *data);
|
||||||
void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
|
void xdg_activation_v1_handle_request_activate(struct wl_listener *listener,
|
||||||
void *data);
|
void *data);
|
||||||
|
void xdg_activation_v1_handle_new_token(struct wl_listener *listener,
|
||||||
|
void *data);
|
||||||
|
|
||||||
|
void set_rr_scheduling(void);
|
||||||
|
|
||||||
|
void handle_new_tearing_hint(struct wl_listener *listener, void *data);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
#ifndef _SWAY_SURFACE_H
|
|
||||||
#define _SWAY_SURFACE_H
|
|
||||||
#include <wlr/types/wlr_surface.h>
|
|
||||||
|
|
||||||
struct sway_surface {
|
|
||||||
struct wlr_surface *wlr_surface;
|
|
||||||
|
|
||||||
struct wl_listener destroy;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* This timer can be used for issuing delayed frame done callbacks (for
|
|
||||||
* example, to improve presentation latency). Its handler is set to a
|
|
||||||
* function that issues a frame done callback to this surface.
|
|
||||||
*/
|
|
||||||
struct wl_event_source *frame_done_timer;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
28
include/sway/sway_text_node.h
Normal file
28
include/sway/sway_text_node.h
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
#ifndef _SWAY_BUFFER_H
|
||||||
|
#define _SWAY_BUFFER_H
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
|
|
||||||
|
struct sway_text_node {
|
||||||
|
int width;
|
||||||
|
int max_width;
|
||||||
|
int height;
|
||||||
|
int baseline;
|
||||||
|
bool pango_markup;
|
||||||
|
float color[4];
|
||||||
|
float background[4];
|
||||||
|
|
||||||
|
struct wlr_scene_node *node;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct sway_text_node *sway_text_node_create(struct wlr_scene_tree *parent,
|
||||||
|
char *text, float color[4], bool pango_markup);
|
||||||
|
|
||||||
|
void sway_text_node_set_color(struct sway_text_node *node, float color[4]);
|
||||||
|
|
||||||
|
void sway_text_node_set_text(struct sway_text_node *node, char *text);
|
||||||
|
|
||||||
|
void sway_text_node_set_max_width(struct sway_text_node *node, int max_width);
|
||||||
|
|
||||||
|
void sway_text_node_set_background(struct sway_text_node *node, float background[4]);
|
||||||
|
|
||||||
|
#endif
|
|
@ -1,6 +1,7 @@
|
||||||
#ifndef _SWAY_SWAYNAG_H
|
#ifndef _SWAY_SWAYNAG_H
|
||||||
#define _SWAY_SWAYNAG_H
|
#define _SWAY_SWAYNAG_H
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
|
#include "stringop.h"
|
||||||
|
|
||||||
struct swaynag_instance {
|
struct swaynag_instance {
|
||||||
struct wl_client *client;
|
struct wl_client *client;
|
||||||
|
@ -21,7 +22,7 @@ bool swaynag_spawn(const char *swaynag_command,
|
||||||
// Write a log message to swaynag->fd[1]. This will fail when swaynag->detailed
|
// Write a log message to swaynag->fd[1]. This will fail when swaynag->detailed
|
||||||
// is false.
|
// is false.
|
||||||
void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag,
|
void swaynag_log(const char *swaynag_command, struct swaynag_instance *swaynag,
|
||||||
const char *fmt, ...);
|
const char *fmt, ...) _SWAY_ATTRIB_PRINTF(3, 4);
|
||||||
|
|
||||||
// If swaynag->detailed, close swaynag->fd[1] so swaynag displays
|
// If swaynag->detailed, close swaynag->fd[1] so swaynag displays
|
||||||
void swaynag_show(struct swaynag_instance *swaynag);
|
void swaynag_show(struct swaynag_instance *swaynag);
|
||||||
|
|
|
@ -2,7 +2,8 @@
|
||||||
#define _SWAY_CONTAINER_H
|
#define _SWAY_CONTAINER_H
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <wlr/types/wlr_surface.h>
|
#include <wlr/types/wlr_compositor.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "sway/tree/node.h"
|
#include "sway/tree/node.h"
|
||||||
|
|
||||||
|
@ -68,11 +69,41 @@ struct sway_container {
|
||||||
struct sway_node node;
|
struct sway_node node;
|
||||||
struct sway_view *view;
|
struct sway_view *view;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *scene_tree;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wlr_scene_tree *tree;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *border;
|
||||||
|
struct wlr_scene_tree *background;
|
||||||
|
|
||||||
|
struct sway_text_node *title_text;
|
||||||
|
struct sway_text_node *marks_text;
|
||||||
|
} title_bar;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wlr_scene_tree *tree;
|
||||||
|
|
||||||
|
struct wlr_scene_rect *top;
|
||||||
|
struct wlr_scene_rect *bottom;
|
||||||
|
struct wlr_scene_rect *left;
|
||||||
|
struct wlr_scene_rect *right;
|
||||||
|
} border;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *content_tree;
|
||||||
|
struct wlr_scene_buffer *output_handler;
|
||||||
|
|
||||||
|
struct wl_listener output_enter;
|
||||||
|
struct wl_listener output_leave;
|
||||||
|
|
||||||
struct sway_container_state current;
|
struct sway_container_state current;
|
||||||
struct sway_container_state pending;
|
struct sway_container_state pending;
|
||||||
|
|
||||||
char *title; // The view's title (unformatted)
|
char *title; // The view's title (unformatted)
|
||||||
char *formatted_title; // The title displayed in the title bar
|
char *formatted_title; // The title displayed in the title bar
|
||||||
|
int title_width;
|
||||||
|
|
||||||
|
char *title_format;
|
||||||
|
|
||||||
enum sway_container_layout prev_split_layout;
|
enum sway_container_layout prev_split_layout;
|
||||||
|
|
||||||
|
@ -100,33 +131,19 @@ struct sway_container {
|
||||||
double child_total_width;
|
double child_total_width;
|
||||||
double child_total_height;
|
double child_total_height;
|
||||||
|
|
||||||
// In most cases this is the same as the content x and y, but if the view
|
|
||||||
// refuses to resize to the content dimensions then it can be smaller.
|
|
||||||
// These are in layout coordinates.
|
|
||||||
double surface_x, surface_y;
|
|
||||||
|
|
||||||
// Outputs currently being intersected
|
|
||||||
list_t *outputs; // struct sway_output
|
|
||||||
|
|
||||||
// Indicates that the container is a scratchpad container.
|
// Indicates that the container is a scratchpad container.
|
||||||
// Both hidden and visible scratchpad containers have scratchpad=true.
|
// Both hidden and visible scratchpad containers have scratchpad=true.
|
||||||
// Hidden scratchpad containers have a NULL parent.
|
// Hidden scratchpad containers have a NULL parent.
|
||||||
bool scratchpad;
|
bool scratchpad;
|
||||||
|
|
||||||
|
// Stores last output size and position for adjusting coordinates of
|
||||||
|
// scratchpad windows.
|
||||||
|
// Unused for non-scratchpad windows.
|
||||||
|
struct wlr_box transform;
|
||||||
|
|
||||||
float alpha;
|
float alpha;
|
||||||
|
|
||||||
struct wlr_texture *title_focused;
|
|
||||||
struct wlr_texture *title_focused_inactive;
|
|
||||||
struct wlr_texture *title_focused_tab_title;
|
|
||||||
struct wlr_texture *title_unfocused;
|
|
||||||
struct wlr_texture *title_urgent;
|
|
||||||
|
|
||||||
list_t *marks; // char *
|
list_t *marks; // char *
|
||||||
struct wlr_texture *marks_focused;
|
|
||||||
struct wlr_texture *marks_focused_inactive;
|
|
||||||
struct wlr_texture *marks_focused_tab_title;
|
|
||||||
struct wlr_texture *marks_unfocused;
|
|
||||||
struct wlr_texture *marks_urgent;
|
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
struct wl_signal destroy;
|
struct wl_signal destroy;
|
||||||
|
@ -146,19 +163,6 @@ void container_begin_destroy(struct sway_container *con);
|
||||||
struct sway_container *container_find_child(struct sway_container *container,
|
struct sway_container *container_find_child(struct sway_container *container,
|
||||||
bool (*test)(struct sway_container *view, void *data), void *data);
|
bool (*test)(struct sway_container *view, void *data), void *data);
|
||||||
|
|
||||||
/**
|
|
||||||
* Find a container at the given coordinates. Returns the surface and
|
|
||||||
* surface-local coordinates of the given layout coordinates if the container
|
|
||||||
* is a view and the view contains a surface at those coordinates.
|
|
||||||
*/
|
|
||||||
struct sway_container *container_at(struct sway_workspace *workspace,
|
|
||||||
double lx, double ly, struct wlr_surface **surface,
|
|
||||||
double *sx, double *sy);
|
|
||||||
|
|
||||||
struct sway_container *tiling_container_at(
|
|
||||||
struct sway_node *parent, double lx, double ly,
|
|
||||||
struct wlr_surface **surface, double *sx, double *sy);
|
|
||||||
|
|
||||||
void container_for_each_child(struct sway_container *container,
|
void container_for_each_child(struct sway_container *container,
|
||||||
void (*f)(struct sway_container *container, void *data), void *data);
|
void (*f)(struct sway_container *container, void *data), void *data);
|
||||||
|
|
||||||
|
@ -173,15 +177,15 @@ struct sway_container *container_obstructing_fullscreen_container(struct sway_co
|
||||||
bool container_has_ancestor(struct sway_container *container,
|
bool container_has_ancestor(struct sway_container *container,
|
||||||
struct sway_container *ancestor);
|
struct sway_container *ancestor);
|
||||||
|
|
||||||
void container_update_textures_recursive(struct sway_container *con);
|
|
||||||
|
|
||||||
void container_damage_whole(struct sway_container *container);
|
|
||||||
|
|
||||||
void container_reap_empty(struct sway_container *con);
|
void container_reap_empty(struct sway_container *con);
|
||||||
|
|
||||||
struct sway_container *container_flatten(struct sway_container *container);
|
struct sway_container *container_flatten(struct sway_container *container);
|
||||||
|
|
||||||
void container_update_title_textures(struct sway_container *container);
|
void container_update_title_bar(struct sway_container *container);
|
||||||
|
|
||||||
|
void container_update_marks(struct sway_container *container);
|
||||||
|
|
||||||
|
size_t parse_title_format(struct sway_container *container, char *buffer);
|
||||||
|
|
||||||
size_t container_build_representation(enum sway_container_layout layout,
|
size_t container_build_representation(enum sway_container_layout layout,
|
||||||
list_t *children, char *buffer);
|
list_t *children, char *buffer);
|
||||||
|
@ -196,6 +200,9 @@ size_t container_titlebar_height(void);
|
||||||
void floating_calculate_constraints(int *min_width, int *max_width,
|
void floating_calculate_constraints(int *min_width, int *max_width,
|
||||||
int *min_height, int *max_height);
|
int *min_height, int *max_height);
|
||||||
|
|
||||||
|
void floating_fix_coordinates(struct sway_container *con,
|
||||||
|
struct wlr_box *old, struct wlr_box *new);
|
||||||
|
|
||||||
void container_floating_resize_and_center(struct sway_container *con);
|
void container_floating_resize_and_center(struct sway_container *con);
|
||||||
|
|
||||||
void container_floating_set_default_size(struct sway_container *con);
|
void container_floating_set_default_size(struct sway_container *con);
|
||||||
|
@ -214,11 +221,6 @@ void container_set_geometry_from_content(struct sway_container *con);
|
||||||
*/
|
*/
|
||||||
bool container_is_floating(struct sway_container *container);
|
bool container_is_floating(struct sway_container *container);
|
||||||
|
|
||||||
/**
|
|
||||||
* Same as above, but for current container state.
|
|
||||||
*/
|
|
||||||
bool container_is_current_floating(struct sway_container *container);
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a container's box in layout coordinates.
|
* Get a container's box in layout coordinates.
|
||||||
*/
|
*/
|
||||||
|
@ -281,26 +283,12 @@ bool container_is_floating_or_child(struct sway_container *container);
|
||||||
*/
|
*/
|
||||||
bool container_is_fullscreen_or_child(struct sway_container *container);
|
bool container_is_fullscreen_or_child(struct sway_container *container);
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the output which will be used for scale purposes.
|
|
||||||
* This is the most recently entered output.
|
|
||||||
* If the container is not on any output, return NULL.
|
|
||||||
*/
|
|
||||||
struct sway_output *container_get_effective_output(struct sway_container *con);
|
|
||||||
|
|
||||||
void container_discover_outputs(struct sway_container *con);
|
|
||||||
|
|
||||||
enum sway_container_layout container_parent_layout(struct sway_container *con);
|
enum sway_container_layout container_parent_layout(struct sway_container *con);
|
||||||
|
|
||||||
enum sway_container_layout container_current_parent_layout(
|
|
||||||
struct sway_container *con);
|
|
||||||
|
|
||||||
list_t *container_get_siblings(struct sway_container *container);
|
list_t *container_get_siblings(struct sway_container *container);
|
||||||
|
|
||||||
int container_sibling_index(struct sway_container *child);
|
int container_sibling_index(struct sway_container *child);
|
||||||
|
|
||||||
list_t *container_get_current_siblings(struct sway_container *container);
|
|
||||||
|
|
||||||
void container_handle_fullscreen_reparent(struct sway_container *con);
|
void container_handle_fullscreen_reparent(struct sway_container *con);
|
||||||
|
|
||||||
void container_add_child(struct sway_container *parent,
|
void container_add_child(struct sway_container *parent,
|
||||||
|
@ -348,8 +336,6 @@ bool container_has_mark(struct sway_container *container, char *mark);
|
||||||
|
|
||||||
void container_add_mark(struct sway_container *container, char *mark);
|
void container_add_mark(struct sway_container *container, char *mark);
|
||||||
|
|
||||||
void container_update_marks_textures(struct sway_container *container);
|
|
||||||
|
|
||||||
void container_raise_floating(struct sway_container *con);
|
void container_raise_floating(struct sway_container *con);
|
||||||
|
|
||||||
bool container_is_scratchpad_hidden(struct sway_container *con);
|
bool container_is_scratchpad_hidden(struct sway_container *con);
|
||||||
|
@ -364,7 +350,7 @@ bool container_is_sticky_or_child(struct sway_container *con);
|
||||||
* This will destroy pairs of redundant H/V splits
|
* This will destroy pairs of redundant H/V splits
|
||||||
* e.g. H[V[H[app app]] app] -> H[app app app]
|
* e.g. H[V[H[app app]] app] -> H[app app app]
|
||||||
* The middle "V[H[" are eliminated by a call to container_squash
|
* The middle "V[H[" are eliminated by a call to container_squash
|
||||||
* on the V[ con. It's grandchildren are added to it's parent.
|
* on the V[ con. It's grandchildren are added to its parent.
|
||||||
*
|
*
|
||||||
* This function is roughly equivalent to i3's tree_flatten here:
|
* This function is roughly equivalent to i3's tree_flatten here:
|
||||||
* https://github.com/i3/i3/blob/1f0c628cde40cf87371481041b7197344e0417c6/src/tree.c#L651
|
* https://github.com/i3/i3/blob/1f0c628cde40cf87371481041b7197344e0417c6/src/tree.c#L651
|
||||||
|
@ -373,4 +359,10 @@ bool container_is_sticky_or_child(struct sway_container *con);
|
||||||
*/
|
*/
|
||||||
int container_squash(struct sway_container *con);
|
int container_squash(struct sway_container *con);
|
||||||
|
|
||||||
|
void container_arrange_title_bar(struct sway_container *con);
|
||||||
|
|
||||||
|
void container_update(struct sway_container *con);
|
||||||
|
|
||||||
|
void container_update_itself_and_parents(struct sway_container *con);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,6 +1,8 @@
|
||||||
#ifndef _SWAY_NODE_H
|
#ifndef _SWAY_NODE_H
|
||||||
#define _SWAY_NODE_H
|
#define _SWAY_NODE_H
|
||||||
|
#include <wayland-server-core.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
#define MIN_SANE_W 100
|
#define MIN_SANE_W 100
|
||||||
|
@ -74,4 +76,15 @@ list_t *node_get_children(struct sway_node *node);
|
||||||
|
|
||||||
bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor);
|
bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor);
|
||||||
|
|
||||||
|
// when destroying a sway tree, it's not known which order the tree will be
|
||||||
|
// destroyed. To prevent freeing of scene_nodes recursing up the tree,
|
||||||
|
// let's use this helper function to disown them to the staging node.
|
||||||
|
void scene_node_disown_children(struct wlr_scene_tree *tree);
|
||||||
|
|
||||||
|
// a helper function used to allocate tree nodes. If an allocation failure
|
||||||
|
// occurs a flag is flipped that can be checked later to destroy a parent
|
||||||
|
// of this scene node preventing memory leaks.
|
||||||
|
struct wlr_scene_tree *alloc_scene_tree(struct wlr_scene_tree *parent,
|
||||||
|
bool *failed);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,11 +2,12 @@
|
||||||
#define _SWAY_ROOT_H
|
#define _SWAY_ROOT_H
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wayland-util.h>
|
#include <wayland-util.h>
|
||||||
|
#include <wlr/config.h>
|
||||||
#include <wlr/types/wlr_output_layout.h>
|
#include <wlr/types/wlr_output_layout.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
#include <wlr/render/wlr_texture.h>
|
#include <wlr/render/wlr_texture.h>
|
||||||
#include "sway/tree/container.h"
|
#include "sway/tree/container.h"
|
||||||
#include "sway/tree/node.h"
|
#include "sway/tree/node.h"
|
||||||
#include "config.h"
|
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
extern struct sway_root *root;
|
extern struct sway_root *root;
|
||||||
|
@ -15,11 +16,43 @@ struct sway_root {
|
||||||
struct sway_node node;
|
struct sway_node node;
|
||||||
struct wlr_output_layout *output_layout;
|
struct wlr_output_layout *output_layout;
|
||||||
|
|
||||||
struct wl_listener output_layout_change;
|
// scene node layout:
|
||||||
#if HAVE_XWAYLAND
|
// - root
|
||||||
struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
|
// - staging
|
||||||
|
// - layer shell stuff
|
||||||
|
// - tiling
|
||||||
|
// - floating
|
||||||
|
// - fullscreen stuff
|
||||||
|
// - seat stuff
|
||||||
|
// - ext_session_lock
|
||||||
|
struct wlr_scene *root_scene;
|
||||||
|
|
||||||
|
// since wlr_scene nodes can't be orphaned and must always
|
||||||
|
// have a parent, use this staging scene_tree so that a
|
||||||
|
// node always have a valid parent. Nothing in this
|
||||||
|
// staging node will be visible.
|
||||||
|
struct wlr_scene_tree *staging;
|
||||||
|
|
||||||
|
// tree containing all layers the compositor will render. Cursor handling
|
||||||
|
// will end up iterating this tree.
|
||||||
|
struct wlr_scene_tree *layer_tree;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wlr_scene_tree *shell_background;
|
||||||
|
struct wlr_scene_tree *shell_bottom;
|
||||||
|
struct wlr_scene_tree *tiling;
|
||||||
|
struct wlr_scene_tree *floating;
|
||||||
|
struct wlr_scene_tree *shell_top;
|
||||||
|
struct wlr_scene_tree *fullscreen;
|
||||||
|
struct wlr_scene_tree *fullscreen_global;
|
||||||
|
#if WLR_HAS_XWAYLAND
|
||||||
|
struct wlr_scene_tree *unmanaged;
|
||||||
#endif
|
#endif
|
||||||
struct wl_list drag_icons; // sway_drag_icon::link
|
struct wlr_scene_tree *shell_overlay;
|
||||||
|
struct wlr_scene_tree *popup;
|
||||||
|
struct wlr_scene_tree *seat;
|
||||||
|
struct wlr_scene_tree *session_lock;
|
||||||
|
} layers;
|
||||||
|
|
||||||
// Includes disabled outputs
|
// Includes disabled outputs
|
||||||
struct wl_list all_outputs; // sway_output::link
|
struct wl_list all_outputs; // sway_output::link
|
||||||
|
@ -28,6 +61,7 @@ struct sway_root {
|
||||||
double width, height;
|
double width, height;
|
||||||
|
|
||||||
list_t *outputs; // struct sway_output
|
list_t *outputs; // struct sway_output
|
||||||
|
list_t *non_desktop_outputs; // struct sway_output_non_desktop
|
||||||
list_t *scratchpad; // struct sway_container
|
list_t *scratchpad; // struct sway_container
|
||||||
|
|
||||||
// For when there's no connected outputs
|
// For when there's no connected outputs
|
||||||
|
@ -40,7 +74,7 @@ struct sway_root {
|
||||||
} events;
|
} events;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_root *root_create(void);
|
struct sway_root *root_create(struct wl_display *display);
|
||||||
|
|
||||||
void root_destroy(struct sway_root *root);
|
void root_destroy(struct sway_root *root);
|
||||||
|
|
||||||
|
@ -68,12 +102,6 @@ void root_scratchpad_show(struct sway_container *con);
|
||||||
*/
|
*/
|
||||||
void root_scratchpad_hide(struct sway_container *con);
|
void root_scratchpad_hide(struct sway_container *con);
|
||||||
|
|
||||||
struct sway_workspace *root_workspace_for_pid(pid_t pid);
|
|
||||||
|
|
||||||
void root_record_workspace_pid(pid_t pid);
|
|
||||||
|
|
||||||
void root_remove_workspace_pid(pid_t pid);
|
|
||||||
|
|
||||||
void root_for_each_workspace(void (*f)(struct sway_workspace *ws, void *data),
|
void root_for_each_workspace(void (*f)(struct sway_workspace *ws, void *data),
|
||||||
void *data);
|
void *data);
|
||||||
|
|
||||||
|
@ -91,6 +119,4 @@ struct sway_container *root_find_container(
|
||||||
|
|
||||||
void root_get_box(struct sway_root *root, struct wlr_box *box);
|
void root_get_box(struct sway_root *root, struct wlr_box *box);
|
||||||
|
|
||||||
void root_rename_pid_workspaces(const char *old_name, const char *new_name);
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1,9 +1,12 @@
|
||||||
#ifndef _SWAY_VIEW_H
|
#ifndef _SWAY_VIEW_H
|
||||||
#define _SWAY_VIEW_H
|
#define _SWAY_VIEW_H
|
||||||
#include <wayland-server-core.h>
|
#include <wayland-server-core.h>
|
||||||
#include <wlr/types/wlr_surface.h>
|
#include <wlr/config.h>
|
||||||
#include "config.h"
|
#include <wlr/types/wlr_compositor.h>
|
||||||
#if HAVE_XWAYLAND
|
#include <wlr/types/wlr_scene.h>
|
||||||
|
#include <wlr/types/wlr_tearing_control_v1.h>
|
||||||
|
#include "sway/config.h"
|
||||||
|
#if WLR_HAS_XWAYLAND
|
||||||
#include <wlr/xwayland.h>
|
#include <wlr/xwayland.h>
|
||||||
#endif
|
#endif
|
||||||
#include "sway/input/input-manager.h"
|
#include "sway/input/input-manager.h"
|
||||||
|
@ -14,7 +17,7 @@ struct sway_xdg_decoration;
|
||||||
|
|
||||||
enum sway_view_type {
|
enum sway_view_type {
|
||||||
SWAY_VIEW_XDG_SHELL,
|
SWAY_VIEW_XDG_SHELL,
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
SWAY_VIEW_XWAYLAND,
|
SWAY_VIEW_XWAYLAND,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -26,12 +29,18 @@ enum sway_view_prop {
|
||||||
VIEW_PROP_INSTANCE,
|
VIEW_PROP_INSTANCE,
|
||||||
VIEW_PROP_WINDOW_TYPE,
|
VIEW_PROP_WINDOW_TYPE,
|
||||||
VIEW_PROP_WINDOW_ROLE,
|
VIEW_PROP_WINDOW_ROLE,
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
VIEW_PROP_X11_WINDOW_ID,
|
VIEW_PROP_X11_WINDOW_ID,
|
||||||
VIEW_PROP_X11_PARENT_ID,
|
VIEW_PROP_X11_PARENT_ID,
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum sway_view_tearing_mode {
|
||||||
|
TEARING_OVERRIDE_FALSE,
|
||||||
|
TEARING_OVERRIDE_TRUE,
|
||||||
|
TEARING_WINDOW_HINT,
|
||||||
|
};
|
||||||
|
|
||||||
struct sway_view_impl {
|
struct sway_view_impl {
|
||||||
void (*get_constraints)(struct sway_view *view, double *min_width,
|
void (*get_constraints)(struct sway_view *view, double *min_width,
|
||||||
double *max_width, double *min_height, double *max_height);
|
double *max_width, double *min_height, double *max_height);
|
||||||
|
@ -45,10 +54,6 @@ struct sway_view_impl {
|
||||||
void (*set_fullscreen)(struct sway_view *view, bool fullscreen);
|
void (*set_fullscreen)(struct sway_view *view, bool fullscreen);
|
||||||
void (*set_resizing)(struct sway_view *view, bool resizing);
|
void (*set_resizing)(struct sway_view *view, bool resizing);
|
||||||
bool (*wants_floating)(struct sway_view *view);
|
bool (*wants_floating)(struct sway_view *view);
|
||||||
void (*for_each_surface)(struct sway_view *view,
|
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
||||||
void (*for_each_popup_surface)(struct sway_view *view,
|
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
||||||
bool (*is_transient_for)(struct sway_view *child,
|
bool (*is_transient_for)(struct sway_view *child,
|
||||||
struct sway_view *ancestor);
|
struct sway_view *ancestor);
|
||||||
void (*close)(struct sway_view *view);
|
void (*close)(struct sway_view *view);
|
||||||
|
@ -56,46 +61,36 @@ struct sway_view_impl {
|
||||||
void (*destroy)(struct sway_view *view);
|
void (*destroy)(struct sway_view *view);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_saved_buffer {
|
|
||||||
struct wlr_client_buffer *buffer;
|
|
||||||
int x, y;
|
|
||||||
int width, height;
|
|
||||||
enum wl_output_transform transform;
|
|
||||||
struct wlr_fbox source_box;
|
|
||||||
struct wl_list link; // sway_view::saved_buffers
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_view {
|
struct sway_view {
|
||||||
enum sway_view_type type;
|
enum sway_view_type type;
|
||||||
const struct sway_view_impl *impl;
|
const struct sway_view_impl *impl;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *scene_tree;
|
||||||
|
struct wlr_scene_tree *content_tree;
|
||||||
|
struct wlr_scene_tree *saved_surface_tree;
|
||||||
|
|
||||||
struct sway_container *container; // NULL if unmapped and transactions finished
|
struct sway_container *container; // NULL if unmapped and transactions finished
|
||||||
struct wlr_surface *surface; // NULL for unmapped views
|
struct wlr_surface *surface; // NULL for unmapped views
|
||||||
struct sway_xdg_decoration *xdg_decoration;
|
struct sway_xdg_decoration *xdg_decoration;
|
||||||
|
|
||||||
pid_t pid;
|
pid_t pid;
|
||||||
|
struct launcher_ctx *ctx;
|
||||||
|
|
||||||
// The size the view would want to be if it weren't tiled.
|
// The size the view would want to be if it weren't tiled.
|
||||||
// Used when changing a view from tiled to floating.
|
// Used when changing a view from tiled to floating.
|
||||||
int natural_width, natural_height;
|
int natural_width, natural_height;
|
||||||
|
|
||||||
char *title_format;
|
|
||||||
|
|
||||||
bool using_csd;
|
bool using_csd;
|
||||||
|
|
||||||
struct timespec urgent;
|
struct timespec urgent;
|
||||||
bool allow_request_urgent;
|
bool allow_request_urgent;
|
||||||
struct wl_event_source *urgent_timer;
|
struct wl_event_source *urgent_timer;
|
||||||
|
|
||||||
struct wl_list saved_buffers; // sway_saved_buffer::link
|
|
||||||
|
|
||||||
// The geometry for whatever the client is committing, regardless of
|
// The geometry for whatever the client is committing, regardless of
|
||||||
// transaction state. Updated on every commit.
|
// transaction state. Updated on every commit.
|
||||||
struct wlr_box geometry;
|
struct wlr_box geometry;
|
||||||
|
|
||||||
// The "old" geometry during a transaction. Used to damage the old location
|
struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel;
|
||||||
// when a transaction is applied.
|
|
||||||
struct wlr_box saved_geometry;
|
|
||||||
|
|
||||||
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
|
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
|
||||||
struct wl_listener foreign_activate_request;
|
struct wl_listener foreign_activate_request;
|
||||||
|
@ -108,8 +103,8 @@ struct sway_view {
|
||||||
list_t *executed_criteria; // struct criteria *
|
list_t *executed_criteria; // struct criteria *
|
||||||
|
|
||||||
union {
|
union {
|
||||||
struct wlr_xdg_surface *wlr_xdg_surface;
|
struct wlr_xdg_toplevel *wlr_xdg_toplevel;
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
@ -118,11 +113,12 @@ struct sway_view {
|
||||||
struct wl_signal unmap;
|
struct wl_signal unmap;
|
||||||
} events;
|
} events;
|
||||||
|
|
||||||
struct wl_listener surface_new_subsurface;
|
|
||||||
|
|
||||||
int max_render_time; // In milliseconds
|
int max_render_time; // In milliseconds
|
||||||
|
|
||||||
enum seat_config_shortcuts_inhibit shortcuts_inhibit;
|
enum seat_config_shortcuts_inhibit shortcuts_inhibit;
|
||||||
|
|
||||||
|
enum sway_view_tearing_mode tearing_mode;
|
||||||
|
enum wp_tearing_control_v1_presentation_hint tearing_hint;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_xdg_shell_view {
|
struct sway_xdg_shell_view {
|
||||||
|
@ -131,6 +127,7 @@ struct sway_xdg_shell_view {
|
||||||
struct wl_listener commit;
|
struct wl_listener commit;
|
||||||
struct wl_listener request_move;
|
struct wl_listener request_move;
|
||||||
struct wl_listener request_resize;
|
struct wl_listener request_resize;
|
||||||
|
struct wl_listener request_maximize;
|
||||||
struct wl_listener request_fullscreen;
|
struct wl_listener request_fullscreen;
|
||||||
struct wl_listener set_title;
|
struct wl_listener set_title;
|
||||||
struct wl_listener set_app_id;
|
struct wl_listener set_app_id;
|
||||||
|
@ -139,10 +136,12 @@ struct sway_xdg_shell_view {
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
struct sway_xwayland_view {
|
struct sway_xwayland_view {
|
||||||
struct sway_view view;
|
struct sway_view view;
|
||||||
|
|
||||||
|
struct wlr_scene_tree *surface_tree;
|
||||||
|
|
||||||
struct wl_listener commit;
|
struct wl_listener commit;
|
||||||
struct wl_listener request_move;
|
struct wl_listener request_move;
|
||||||
struct wl_listener request_resize;
|
struct wl_listener request_resize;
|
||||||
|
@ -154,71 +153,55 @@ struct sway_xwayland_view {
|
||||||
struct wl_listener set_title;
|
struct wl_listener set_title;
|
||||||
struct wl_listener set_class;
|
struct wl_listener set_class;
|
||||||
struct wl_listener set_role;
|
struct wl_listener set_role;
|
||||||
|
struct wl_listener set_startup_id;
|
||||||
struct wl_listener set_window_type;
|
struct wl_listener set_window_type;
|
||||||
struct wl_listener set_hints;
|
struct wl_listener set_hints;
|
||||||
struct wl_listener set_decorations;
|
struct wl_listener set_decorations;
|
||||||
|
struct wl_listener associate;
|
||||||
|
struct wl_listener dissociate;
|
||||||
struct wl_listener map;
|
struct wl_listener map;
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
struct wl_listener override_redirect;
|
struct wl_listener override_redirect;
|
||||||
|
|
||||||
|
struct wl_listener surface_tree_destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_xwayland_unmanaged {
|
struct sway_xwayland_unmanaged {
|
||||||
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
||||||
struct wl_list link;
|
|
||||||
|
|
||||||
int lx, ly;
|
struct wlr_scene_surface *surface_scene;
|
||||||
|
|
||||||
|
struct wl_listener request_activate;
|
||||||
struct wl_listener request_configure;
|
struct wl_listener request_configure;
|
||||||
struct wl_listener request_fullscreen;
|
struct wl_listener request_fullscreen;
|
||||||
struct wl_listener commit;
|
|
||||||
struct wl_listener set_geometry;
|
struct wl_listener set_geometry;
|
||||||
|
struct wl_listener associate;
|
||||||
|
struct wl_listener dissociate;
|
||||||
struct wl_listener map;
|
struct wl_listener map;
|
||||||
struct wl_listener unmap;
|
struct wl_listener unmap;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
struct wl_listener override_redirect;
|
struct wl_listener override_redirect;
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
struct sway_view_child;
|
|
||||||
|
|
||||||
struct sway_view_child_impl {
|
|
||||||
void (*get_view_coords)(struct sway_view_child *child, int *sx, int *sy);
|
|
||||||
void (*destroy)(struct sway_view_child *child);
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A view child is a surface in the view tree, such as a subsurface or a popup.
|
|
||||||
*/
|
|
||||||
struct sway_view_child {
|
|
||||||
const struct sway_view_child_impl *impl;
|
|
||||||
struct wl_list link;
|
|
||||||
|
|
||||||
|
struct sway_popup_desc {
|
||||||
|
struct wlr_scene_node *relative;
|
||||||
struct sway_view *view;
|
struct sway_view *view;
|
||||||
struct sway_view_child *parent;
|
|
||||||
struct wl_list children; // sway_view_child::link
|
|
||||||
struct wlr_surface *surface;
|
|
||||||
bool mapped;
|
|
||||||
|
|
||||||
struct wl_listener surface_commit;
|
|
||||||
struct wl_listener surface_new_subsurface;
|
|
||||||
struct wl_listener surface_map;
|
|
||||||
struct wl_listener surface_unmap;
|
|
||||||
struct wl_listener surface_destroy;
|
|
||||||
struct wl_listener view_unmap;
|
|
||||||
};
|
|
||||||
|
|
||||||
struct sway_subsurface {
|
|
||||||
struct sway_view_child child;
|
|
||||||
|
|
||||||
struct wl_listener destroy;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct sway_xdg_popup {
|
struct sway_xdg_popup {
|
||||||
struct sway_view_child child;
|
struct sway_view *view;
|
||||||
|
|
||||||
struct wlr_xdg_surface *wlr_xdg_surface;
|
struct wlr_scene_tree *scene_tree;
|
||||||
|
struct wlr_scene_tree *xdg_surface_tree;
|
||||||
|
struct wlr_xdg_popup *wlr_xdg_popup;
|
||||||
|
|
||||||
|
struct sway_popup_desc desc;
|
||||||
|
|
||||||
|
struct wl_listener surface_commit;
|
||||||
struct wl_listener new_popup;
|
struct wl_listener new_popup;
|
||||||
|
struct wl_listener reposition;
|
||||||
struct wl_listener destroy;
|
struct wl_listener destroy;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -267,7 +250,12 @@ void view_set_activated(struct sway_view *view, bool activated);
|
||||||
/**
|
/**
|
||||||
* Called when the view requests to be focused.
|
* Called when the view requests to be focused.
|
||||||
*/
|
*/
|
||||||
void view_request_activate(struct sway_view *view);
|
void view_request_activate(struct sway_view *view, struct sway_seat *seat);
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Called when the view requests urgent state
|
||||||
|
*/
|
||||||
|
void view_request_urgent(struct sway_view *view);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If possible, instructs the client to change their decoration mode.
|
* If possible, instructs the client to change their decoration mode.
|
||||||
|
@ -286,23 +274,9 @@ void view_close(struct sway_view *view);
|
||||||
|
|
||||||
void view_close_popups(struct sway_view *view);
|
void view_close_popups(struct sway_view *view);
|
||||||
|
|
||||||
void view_damage_from(struct sway_view *view);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterate all surfaces of a view (toplevels + popups).
|
|
||||||
*/
|
|
||||||
void view_for_each_surface(struct sway_view *view,
|
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Iterate all popup surfaces of a view.
|
|
||||||
*/
|
|
||||||
void view_for_each_popup_surface(struct sway_view *view,
|
|
||||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
|
||||||
|
|
||||||
// view implementation
|
// view implementation
|
||||||
|
|
||||||
void view_init(struct sway_view *view, enum sway_view_type type,
|
bool view_init(struct sway_view *view, enum sway_view_type type,
|
||||||
const struct sway_view_impl *impl);
|
const struct sway_view_impl *impl);
|
||||||
|
|
||||||
void view_destroy(struct sway_view *view);
|
void view_destroy(struct sway_view *view);
|
||||||
|
@ -324,23 +298,18 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
|
||||||
void view_unmap(struct sway_view *view);
|
void view_unmap(struct sway_view *view);
|
||||||
|
|
||||||
void view_update_size(struct sway_view *view);
|
void view_update_size(struct sway_view *view);
|
||||||
void view_center_surface(struct sway_view *view);
|
void view_center_and_clip_surface(struct sway_view *view);
|
||||||
|
|
||||||
void view_child_init(struct sway_view_child *child,
|
|
||||||
const struct sway_view_child_impl *impl, struct sway_view *view,
|
|
||||||
struct wlr_surface *surface);
|
|
||||||
|
|
||||||
void view_child_destroy(struct sway_view_child *child);
|
|
||||||
|
|
||||||
|
|
||||||
struct sway_view *view_from_wlr_xdg_surface(
|
struct sway_view *view_from_wlr_xdg_surface(
|
||||||
struct wlr_xdg_surface *xdg_surface);
|
struct wlr_xdg_surface *xdg_surface);
|
||||||
#if HAVE_XWAYLAND
|
#if WLR_HAS_XWAYLAND
|
||||||
struct sway_view *view_from_wlr_xwayland_surface(
|
struct sway_view *view_from_wlr_xwayland_surface(
|
||||||
struct wlr_xwayland_surface *xsurface);
|
struct wlr_xwayland_surface *xsurface);
|
||||||
#endif
|
#endif
|
||||||
struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
|
struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
|
||||||
|
|
||||||
|
void view_update_app_id(struct sway_view *view);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Re-read the view's title property and update any relevant title bars.
|
* Re-read the view's title property and update any relevant title bars.
|
||||||
* The force argument makes it recreate the title bars even if the title hasn't
|
* The force argument makes it recreate the title bars even if the title hasn't
|
||||||
|
@ -370,4 +339,10 @@ void view_save_buffer(struct sway_view *view);
|
||||||
|
|
||||||
bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor);
|
bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor);
|
||||||
|
|
||||||
|
void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx);
|
||||||
|
|
||||||
|
void view_send_frame_done(struct sway_view *view);
|
||||||
|
|
||||||
|
bool view_can_tear(struct sway_view *view);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
#define _SWAY_WORKSPACE_H
|
#define _SWAY_WORKSPACE_H
|
||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <wlr/types/wlr_scene.h>
|
||||||
|
#include "sway/config.h"
|
||||||
#include "sway/tree/container.h"
|
#include "sway/tree/container.h"
|
||||||
#include "sway/tree/node.h"
|
#include "sway/tree/node.h"
|
||||||
|
|
||||||
|
@ -22,6 +24,12 @@ struct sway_workspace_state {
|
||||||
|
|
||||||
struct sway_workspace {
|
struct sway_workspace {
|
||||||
struct sway_node node;
|
struct sway_node node;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
struct wlr_scene_tree *tiling;
|
||||||
|
struct wlr_scene_tree *fullscreen;
|
||||||
|
} layers;
|
||||||
|
|
||||||
struct sway_container *fullscreen;
|
struct sway_container *fullscreen;
|
||||||
|
|
||||||
char *name;
|
char *name;
|
||||||
|
|
|
@ -16,4 +16,6 @@ struct sway_xdg_decoration {
|
||||||
struct sway_xdg_decoration *xdg_decoration_from_surface(
|
struct sway_xdg_decoration *xdg_decoration_from_surface(
|
||||||
struct wlr_surface *surface);
|
struct wlr_surface *surface);
|
||||||
|
|
||||||
|
void set_xdg_decoration_mode(struct sway_xdg_decoration *deco);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "input.h"
|
#include "input.h"
|
||||||
#include "pool-buffer.h"
|
#include "pool-buffer.h"
|
||||||
|
#include "cursor-shape-v1-client-protocol.h"
|
||||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||||
#include "xdg-output-unstable-v1-client-protocol.h"
|
#include "xdg-output-unstable-v1-client-protocol.h"
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@ struct swaybar {
|
||||||
struct wl_compositor *compositor;
|
struct wl_compositor *compositor;
|
||||||
struct zwlr_layer_shell_v1 *layer_shell;
|
struct zwlr_layer_shell_v1 *layer_shell;
|
||||||
struct zxdg_output_manager_v1 *xdg_output_manager;
|
struct zxdg_output_manager_v1 *xdg_output_manager;
|
||||||
|
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
|
||||||
struct wl_shm *shm;
|
struct wl_shm *shm;
|
||||||
|
|
||||||
struct swaybar_config *config;
|
struct swaybar_config *config;
|
||||||
|
@ -58,7 +60,6 @@ struct swaybar_output {
|
||||||
struct zxdg_output_v1 *xdg_output;
|
struct zxdg_output_v1 *xdg_output;
|
||||||
struct wl_surface *surface;
|
struct wl_surface *surface;
|
||||||
struct zwlr_layer_surface_v1 *layer_surface;
|
struct zwlr_layer_surface_v1 *layer_surface;
|
||||||
struct wl_region *input_region;
|
|
||||||
uint32_t wl_name;
|
uint32_t wl_name;
|
||||||
|
|
||||||
struct wl_list workspaces; // swaybar_workspace::link
|
struct wl_list workspaces; // swaybar_workspace::link
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
#include "../include/config.h"
|
#include "../include/config.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
|
#include <pango/pangocairo.h>
|
||||||
|
|
||||||
struct box_colors {
|
struct box_colors {
|
||||||
uint32_t border;
|
uint32_t border;
|
||||||
|
@ -28,7 +29,7 @@ struct swaybar_config {
|
||||||
char *status_command;
|
char *status_command;
|
||||||
bool pango_markup;
|
bool pango_markup;
|
||||||
uint32_t position; // zwlr_layer_surface_v1_anchor
|
uint32_t position; // zwlr_layer_surface_v1_anchor
|
||||||
char *font;
|
PangoFontDescription *font_description;
|
||||||
char *sep_symbol;
|
char *sep_symbol;
|
||||||
char *mode;
|
char *mode;
|
||||||
char *hidden_state;
|
char *hidden_state;
|
||||||
|
|
|
@ -30,6 +30,6 @@ void i3bar_block_unref(struct i3bar_block *block);
|
||||||
bool i3bar_handle_readable(struct status_line *status);
|
bool i3bar_handle_readable(struct status_line *status);
|
||||||
enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
|
enum hotspot_event_handling i3bar_block_send_click(struct status_line *status,
|
||||||
struct i3bar_block *block, double x, double y, double rx, double ry,
|
struct i3bar_block *block, double x, double y, double rx, double ry,
|
||||||
double w, double h, int scale, uint32_t button);
|
double w, double h, int scale, uint32_t button, bool released);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
7
include/swaybar/image.h
Normal file
7
include/swaybar/image.h
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
#ifndef _SWAYBAR_IMAGE_H
|
||||||
|
#define _SWAYBAR_IMAGE_H
|
||||||
|
#include <cairo.h>
|
||||||
|
|
||||||
|
cairo_surface_t *load_image(const char *path);
|
||||||
|
|
||||||
|
#endif
|
|
@ -49,7 +49,7 @@ struct swaybar_hotspot {
|
||||||
int x, y, width, height;
|
int x, y, width, height;
|
||||||
enum hotspot_event_handling (*callback)(struct swaybar_output *output,
|
enum hotspot_event_handling (*callback)(struct swaybar_output *output,
|
||||||
struct swaybar_hotspot *hotspot, double x, double y, uint32_t button,
|
struct swaybar_hotspot *hotspot, double x, double y, uint32_t button,
|
||||||
void *data);
|
bool released, void *data);
|
||||||
void (*destroy)(void *data);
|
void (*destroy)(void *data);
|
||||||
void *data;
|
void *data;
|
||||||
};
|
};
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
#include <cairo.h>
|
#include <cairo.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
#include <wayland-util.h>
|
||||||
#include "swaybar/tray/tray.h"
|
#include "swaybar/tray/tray.h"
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include <strings.h>
|
#include <strings.h>
|
||||||
#include "list.h"
|
#include "list.h"
|
||||||
#include "pool-buffer.h"
|
#include "pool-buffer.h"
|
||||||
|
#include "cursor-shape-v1-client-protocol.h"
|
||||||
|
|
||||||
#include "swaynag/types.h"
|
#include "swaynag/types.h"
|
||||||
|
|
||||||
#define SWAYNAG_MAX_HEIGHT 500
|
#define SWAYNAG_MAX_HEIGHT 500
|
||||||
|
@ -58,6 +60,7 @@ struct swaynag_button {
|
||||||
struct swaynag_details {
|
struct swaynag_details {
|
||||||
bool visible;
|
bool visible;
|
||||||
char *message;
|
char *message;
|
||||||
|
char *details_text;
|
||||||
|
|
||||||
int x;
|
int x;
|
||||||
int y;
|
int y;
|
||||||
|
@ -84,6 +87,7 @@ struct swaynag {
|
||||||
struct swaynag_output *output;
|
struct swaynag_output *output;
|
||||||
struct zwlr_layer_shell_v1 *layer_shell;
|
struct zwlr_layer_shell_v1 *layer_shell;
|
||||||
struct zwlr_layer_surface_v1 *layer_surface;
|
struct zwlr_layer_surface_v1 *layer_surface;
|
||||||
|
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
|
||||||
struct wl_surface *surface;
|
struct wl_surface *surface;
|
||||||
|
|
||||||
uint32_t width;
|
uint32_t width;
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
#ifndef _SWAYNAG_TYPES_H
|
#ifndef _SWAYNAG_TYPES_H
|
||||||
#define _SWAYNAG_TYPES_H
|
#define _SWAYNAG_TYPES_H
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <pango/pangocairo.h>
|
||||||
|
#include "list.h"
|
||||||
|
|
||||||
struct swaynag_type {
|
struct swaynag_type {
|
||||||
char *name;
|
char *name;
|
||||||
|
|
||||||
char *font;
|
PangoFontDescription *font_description;
|
||||||
char *output;
|
char *output;
|
||||||
uint32_t anchors;
|
uint32_t anchors;
|
||||||
int32_t layer; // enum zwlr_layer_shell_v1_layer or -1 if unset
|
int32_t layer; // enum zwlr_layer_shell_v1_layer or -1 if unset
|
||||||
|
|
177
meson.build
177
meson.build
|
@ -1,9 +1,9 @@
|
||||||
project(
|
project(
|
||||||
'sway',
|
'sway',
|
||||||
'c',
|
'c',
|
||||||
version: '1.6',
|
version: '1.10-dev',
|
||||||
license: 'MIT',
|
license: 'MIT',
|
||||||
meson_version: '>=0.60.0',
|
meson_version: '>=1.3',
|
||||||
default_options: [
|
default_options: [
|
||||||
'c_std=c11',
|
'c_std=c11',
|
||||||
'warning_level=2',
|
'warning_level=2',
|
||||||
|
@ -14,10 +14,12 @@ project(
|
||||||
add_project_arguments(
|
add_project_arguments(
|
||||||
[
|
[
|
||||||
'-DWLR_USE_UNSTABLE',
|
'-DWLR_USE_UNSTABLE',
|
||||||
|
'-D_POSIX_C_SOURCE=200809L',
|
||||||
|
|
||||||
'-Wno-unused-parameter',
|
'-Wno-unused-parameter',
|
||||||
'-Wno-unused-result',
|
'-Wno-unused-result',
|
||||||
'-Wno-missing-braces',
|
'-Wno-missing-braces',
|
||||||
|
'-Wno-format-zero-length',
|
||||||
'-Wundef',
|
'-Wundef',
|
||||||
'-Wvla',
|
'-Wvla',
|
||||||
],
|
],
|
||||||
|
@ -35,47 +37,19 @@ if is_freebsd
|
||||||
add_project_arguments('-D_C11_SOURCE', language: 'c')
|
add_project_arguments('-D_C11_SOURCE', language: 'c')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
jsonc = dependency('json-c', version: '>=0.13')
|
# Execute the wlroots subproject, if any
|
||||||
pcre = dependency('libpcre')
|
wlroots_version = ['>=0.19.0', '<0.20.0']
|
||||||
wayland_server = dependency('wayland-server', version: '>=1.20.0')
|
subproject(
|
||||||
wayland_client = dependency('wayland-client')
|
|
||||||
wayland_cursor = dependency('wayland-cursor')
|
|
||||||
wayland_egl = dependency('wayland-egl')
|
|
||||||
wayland_protos = dependency('wayland-protocols', version: '>=1.24')
|
|
||||||
xkbcommon = dependency('xkbcommon')
|
|
||||||
cairo = dependency('cairo')
|
|
||||||
pango = dependency('pango')
|
|
||||||
pangocairo = dependency('pangocairo')
|
|
||||||
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
|
|
||||||
pixman = dependency('pixman-1')
|
|
||||||
glesv2 = dependency('glesv2')
|
|
||||||
libevdev = dependency('libevdev')
|
|
||||||
libinput = dependency('libinput', version: '>=1.6.0')
|
|
||||||
xcb = dependency('xcb', required: get_option('xwayland'))
|
|
||||||
drm_full = dependency('libdrm') # only needed for drm_fourcc.h
|
|
||||||
drm = drm_full.partial_dependency(compile_args: true, includes: true)
|
|
||||||
libudev = dependency('libudev')
|
|
||||||
bash_comp = dependency('bash-completion', required: false)
|
|
||||||
fish_comp = dependency('fish', required: false)
|
|
||||||
math = cc.find_library('m')
|
|
||||||
rt = cc.find_library('rt')
|
|
||||||
|
|
||||||
# Try first to find wlroots as a subproject, then as a system dependency
|
|
||||||
wlroots_version = ['>=0.15.0', '<0.16.0']
|
|
||||||
wlroots_proj = subproject(
|
|
||||||
'wlroots',
|
'wlroots',
|
||||||
default_options: ['examples=false'],
|
default_options: ['examples=false'],
|
||||||
required: false,
|
required: false,
|
||||||
version: wlroots_version,
|
version: wlroots_version,
|
||||||
)
|
)
|
||||||
if wlroots_proj.found()
|
wlroots = dependency('wlroots-0.19', version: wlroots_version, fallback: 'wlroots')
|
||||||
wlroots = wlroots_proj.get_variable('wlroots')
|
|
||||||
else
|
|
||||||
wlroots = dependency('wlroots', version: wlroots_version)
|
|
||||||
endif
|
|
||||||
|
|
||||||
wlroots_features = {
|
wlroots_features = {
|
||||||
'xwayland': false,
|
'xwayland': false,
|
||||||
|
'libinput_backend': false,
|
||||||
|
'session': false,
|
||||||
}
|
}
|
||||||
foreach name, _ : wlroots_features
|
foreach name, _ : wlroots_features
|
||||||
var_name = 'have_' + name.underscorify()
|
var_name = 'have_' + name.underscorify()
|
||||||
|
@ -83,33 +57,63 @@ foreach name, _ : wlroots_features
|
||||||
wlroots_features += { name: have }
|
wlroots_features += { name: have }
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
if get_option('xwayland').enabled() and not wlroots_features['xwayland']
|
null_dep = dependency('', required: false)
|
||||||
error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
|
|
||||||
endif
|
jsonc = dependency('json-c', version: '>=0.13')
|
||||||
have_xwayland = xcb.found() and wlroots_features['xwayland']
|
pcre2 = dependency('libpcre2-8')
|
||||||
|
wayland_server = dependency('wayland-server', version: '>=1.21.0')
|
||||||
|
wayland_client = dependency('wayland-client')
|
||||||
|
wayland_cursor = dependency('wayland-cursor')
|
||||||
|
wayland_protos = dependency('wayland-protocols', version: '>=1.24', default_options: ['tests=false'])
|
||||||
|
xkbcommon = dependency('xkbcommon', version: '>=1.5.0')
|
||||||
|
cairo = dependency('cairo')
|
||||||
|
pango = dependency('pango')
|
||||||
|
pangocairo = dependency('pangocairo')
|
||||||
|
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
|
||||||
|
pixman = dependency('pixman-1')
|
||||||
|
libevdev = dependency('libevdev')
|
||||||
|
libinput = wlroots_features['libinput_backend'] ? dependency('libinput', version: '>=1.26.0') : null_dep
|
||||||
|
xcb = wlroots_features['xwayland'] ? dependency('xcb') : null_dep
|
||||||
|
drm = dependency('libdrm')
|
||||||
|
libudev = wlroots_features['libinput_backend'] ? dependency('libudev') : null_dep
|
||||||
|
math = cc.find_library('m')
|
||||||
|
rt = cc.find_library('rt')
|
||||||
|
xcb_icccm = wlroots_features['xwayland'] ? dependency('xcb-icccm') : null_dep
|
||||||
|
threads = dependency('threads') # for pthread_setschedparam
|
||||||
|
|
||||||
if get_option('sd-bus-provider') == 'auto'
|
if get_option('sd-bus-provider') == 'auto'
|
||||||
if not get_option('tray').disabled()
|
if not get_option('tray').disabled()
|
||||||
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
|
assert(get_option('auto_features').auto(), 'sd-bus-provider must not be set to auto since auto_features != auto')
|
||||||
endif
|
endif
|
||||||
sdbus = dependency(['libsystemd', 'libelogind', 'basu'],
|
sdbus = dependency(['libsystemd', 'libelogind'],
|
||||||
required: get_option('tray'),
|
required: false,
|
||||||
version: '>=239',
|
version: '>=239',
|
||||||
)
|
)
|
||||||
|
if not sdbus.found()
|
||||||
|
sdbus = dependency('basu', required: false)
|
||||||
|
endif
|
||||||
else
|
else
|
||||||
sdbus = dependency(get_option('sd-bus-provider'), required: get_option('tray'))
|
sdbus = dependency(get_option('sd-bus-provider'), required: get_option('tray'))
|
||||||
endif
|
endif
|
||||||
|
|
||||||
have_tray = sdbus.found()
|
tray_deps_found = sdbus.found()
|
||||||
|
if get_option('tray').enabled() and not tray_deps_found
|
||||||
|
error('Building with -Dtray=enabled, but sd-bus has not been not found')
|
||||||
|
endif
|
||||||
|
have_tray = (not get_option('tray').disabled()) and tray_deps_found
|
||||||
|
|
||||||
conf_data = configuration_data()
|
conf_data = configuration_data()
|
||||||
|
|
||||||
conf_data.set10('HAVE_XWAYLAND', have_xwayland)
|
|
||||||
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
|
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
|
||||||
conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd')
|
conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd')
|
||||||
conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind')
|
conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind')
|
||||||
conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu')
|
conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu')
|
||||||
conf_data.set10('HAVE_TRAY', have_tray)
|
conf_data.set10('HAVE_TRAY', have_tray)
|
||||||
|
conf_data.set10('HAVE_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM', cc.has_header_symbol(
|
||||||
|
'libinput.h',
|
||||||
|
'LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM',
|
||||||
|
dependencies: libinput,
|
||||||
|
))
|
||||||
|
|
||||||
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
|
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
|
||||||
if scdoc.found()
|
if scdoc.found()
|
||||||
|
@ -156,8 +160,8 @@ add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir
|
||||||
version = '"@0@"'.format(meson.project_version())
|
version = '"@0@"'.format(meson.project_version())
|
||||||
git = find_program('git', native: true, required: false)
|
git = find_program('git', native: true, required: false)
|
||||||
if git.found()
|
if git.found()
|
||||||
git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'])
|
git_commit = run_command([git, '--git-dir=.git', 'rev-parse', '--short', 'HEAD'], check: false)
|
||||||
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'])
|
git_branch = run_command([git, '--git-dir=.git', 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
|
||||||
if git_commit.returncode() == 0 and git_branch.returncode() == 0
|
if git_commit.returncode() == 0 and git_branch.returncode() == 0
|
||||||
version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
|
version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
|
||||||
meson.project_version(),
|
meson.project_version(),
|
||||||
|
@ -168,31 +172,10 @@ if git.found()
|
||||||
endif
|
endif
|
||||||
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
|
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
|
||||||
|
|
||||||
# Compute the relative path used by compiler invocations.
|
fs = import('fs')
|
||||||
source_root = meson.current_source_dir().split('/')
|
|
||||||
build_root = meson.global_build_root().split('/')
|
|
||||||
relative_dir_parts = []
|
|
||||||
i = 0
|
|
||||||
in_prefix = true
|
|
||||||
foreach p : build_root
|
|
||||||
if i >= source_root.length() or not in_prefix or p != source_root[i]
|
|
||||||
in_prefix = false
|
|
||||||
relative_dir_parts += '..'
|
|
||||||
endif
|
|
||||||
i += 1
|
|
||||||
endforeach
|
|
||||||
i = 0
|
|
||||||
in_prefix = true
|
|
||||||
foreach p : source_root
|
|
||||||
if i >= build_root.length() or not in_prefix or build_root[i] != p
|
|
||||||
in_prefix = false
|
|
||||||
relative_dir_parts += p
|
|
||||||
endif
|
|
||||||
i += 1
|
|
||||||
endforeach
|
|
||||||
relative_dir = join_paths(relative_dir_parts) + '/'
|
|
||||||
|
|
||||||
# Strip relative path prefixes from the code if possible, otherwise hide them.
|
# Strip relative path prefixes from the code if possible, otherwise hide them.
|
||||||
|
relative_dir = fs.relative_to(meson.current_source_dir(), meson.global_build_root()) + '/'
|
||||||
if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
|
if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
|
||||||
add_project_arguments(
|
add_project_arguments(
|
||||||
'-fmacro-prefix-map=@0@='.format(relative_dir),
|
'-fmacro-prefix-map=@0@='.format(relative_dir),
|
||||||
|
@ -257,64 +240,10 @@ if get_option('default-wallpaper')
|
||||||
install_data(wallpaper_files, install_dir: wallpaper_install_dir)
|
install_data(wallpaper_files, install_dir: wallpaper_install_dir)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if get_option('zsh-completions')
|
subdir('completions')
|
||||||
zsh_files = files(
|
|
||||||
'completions/zsh/_sway',
|
|
||||||
'completions/zsh/_swaymsg',
|
|
||||||
)
|
|
||||||
zsh_install_dir = join_paths(datadir, 'zsh', 'site-functions')
|
|
||||||
|
|
||||||
install_data(zsh_files, install_dir: zsh_install_dir)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if get_option('bash-completions')
|
|
||||||
bash_files = files(
|
|
||||||
'completions/bash/sway',
|
|
||||||
'completions/bash/swaymsg',
|
|
||||||
)
|
|
||||||
|
|
||||||
if get_option('swaybar')
|
|
||||||
bash_files += files('completions/bash/swaybar')
|
|
||||||
endif
|
|
||||||
|
|
||||||
if bash_comp.found()
|
|
||||||
bash_install_dir = bash_comp.get_variable(
|
|
||||||
pkgconfig: 'completionsdir',
|
|
||||||
pkgconfig_define: ['datadir', datadir]
|
|
||||||
)
|
|
||||||
else
|
|
||||||
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
|
|
||||||
endif
|
|
||||||
|
|
||||||
install_data(bash_files, install_dir: bash_install_dir)
|
|
||||||
endif
|
|
||||||
|
|
||||||
if get_option('fish-completions')
|
|
||||||
fish_files = files(
|
|
||||||
'completions/fish/sway.fish',
|
|
||||||
'completions/fish/swaymsg.fish',
|
|
||||||
)
|
|
||||||
|
|
||||||
if get_option('swaynag')
|
|
||||||
fish_files += files('completions/fish/swaynag.fish')
|
|
||||||
endif
|
|
||||||
|
|
||||||
if fish_comp.found()
|
|
||||||
fish_install_dir = fish_comp.get_variable(
|
|
||||||
pkgconfig: 'completionsdir',
|
|
||||||
pkgconfig_define: ['datadir', datadir]
|
|
||||||
)
|
|
||||||
else
|
|
||||||
fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
|
|
||||||
endif
|
|
||||||
|
|
||||||
install_data(fish_files, install_dir: fish_install_dir)
|
|
||||||
endif
|
|
||||||
|
|
||||||
summary({
|
summary({
|
||||||
'xwayland': have_xwayland,
|
|
||||||
'gdk-pixbuf': gdk_pixbuf.found(),
|
'gdk-pixbuf': gdk_pixbuf.found(),
|
||||||
'tray': have_tray,
|
'tray': have_tray,
|
||||||
'man-pages': scdoc.found(),
|
'man-pages': scdoc.found(),
|
||||||
}, bool_yn: true)
|
}, bool_yn: true)
|
||||||
|
|
||||||
|
|
|
@ -4,8 +4,7 @@ option('bash-completions', type: 'boolean', value: true, description: 'Install b
|
||||||
option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')
|
option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')
|
||||||
option('swaybar', type: 'boolean', value: true, description: 'Enable support for swaybar')
|
option('swaybar', type: 'boolean', value: true, description: 'Enable support for swaybar')
|
||||||
option('swaynag', type: 'boolean', value: true, description: 'Enable support for swaynag')
|
option('swaynag', type: 'boolean', value: true, description: 'Enable support for swaynag')
|
||||||
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
|
|
||||||
option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray')
|
option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray')
|
||||||
option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybg')
|
option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybar tray')
|
||||||
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
|
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
|
||||||
option('sd-bus-provider', type: 'combo', choices: ['auto', 'libsystemd', 'libelogind', 'basu'], value: 'auto', description: 'Provider of the sd-bus library')
|
option('sd-bus-provider', type: 'combo', choices: ['auto', 'libsystemd', 'libelogind', 'basu'], value: 'auto', description: 'Provider of the sd-bus library')
|
||||||
|
|
|
@ -1,81 +1,44 @@
|
||||||
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
|
wl_protocol_dir = wayland_protos.get_variable('pkgdatadir')
|
||||||
|
|
||||||
wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)
|
wayland_scanner_dep = dependency('wayland-scanner', native: true)
|
||||||
if wayland_scanner_dep.found()
|
wayland_scanner = find_program(
|
||||||
wayland_scanner = find_program(
|
wayland_scanner_dep.get_variable('wayland_scanner'),
|
||||||
wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner'),
|
|
||||||
native: true,
|
native: true,
|
||||||
)
|
)
|
||||||
else
|
|
||||||
wayland_scanner = find_program('wayland-scanner', native: true)
|
|
||||||
endif
|
|
||||||
|
|
||||||
protocols = [
|
protocols = [
|
||||||
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
|
wl_protocol_dir / 'stable/tablet/tablet-v2.xml',
|
||||||
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
|
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
|
||||||
[wl_protocol_dir, 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml'],
|
wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
|
||||||
[wl_protocol_dir, 'unstable/tablet/tablet-unstable-v2.xml'],
|
wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml',
|
||||||
[wl_protocol_dir, 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml'],
|
wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
|
||||||
['wlr-layer-shell-unstable-v1.xml'],
|
wl_protocol_dir / 'staging/content-type/content-type-v1.xml',
|
||||||
['idle.xml'],
|
wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
|
||||||
['wlr-input-inhibitor-unstable-v1.xml'],
|
wl_protocol_dir / 'staging/tearing-control/tearing-control-v1.xml',
|
||||||
['wlr-output-power-management-unstable-v1.xml'],
|
'wlr-layer-shell-unstable-v1.xml',
|
||||||
]
|
'idle.xml',
|
||||||
|
'wlr-output-power-management-unstable-v1.xml',
|
||||||
client_protocols = [
|
|
||||||
[wl_protocol_dir, 'stable/xdg-shell/xdg-shell.xml'],
|
|
||||||
[wl_protocol_dir, 'unstable/xdg-output/xdg-output-unstable-v1.xml'],
|
|
||||||
['wlr-layer-shell-unstable-v1.xml'],
|
|
||||||
['wlr-input-inhibitor-unstable-v1.xml'],
|
|
||||||
]
|
]
|
||||||
|
|
||||||
wl_protos_src = []
|
wl_protos_src = []
|
||||||
wl_protos_headers = []
|
|
||||||
|
|
||||||
foreach p : protocols
|
foreach xml : protocols
|
||||||
xml = join_paths(p)
|
|
||||||
wl_protos_src += custom_target(
|
wl_protos_src += custom_target(
|
||||||
xml.underscorify() + '_server_c',
|
xml.underscorify() + '_c',
|
||||||
input: xml,
|
input: xml,
|
||||||
output: '@BASENAME@-protocol.c',
|
output: '@BASENAME@-protocol.c',
|
||||||
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
|
command: [wayland_scanner, 'private-code', '@INPUT@', '@OUTPUT@'],
|
||||||
)
|
)
|
||||||
wl_protos_headers += custom_target(
|
wl_protos_src += custom_target(
|
||||||
xml.underscorify() + '_server_h',
|
xml.underscorify() + '_server_h',
|
||||||
input: xml,
|
input: xml,
|
||||||
output: '@BASENAME@-protocol.h',
|
output: '@BASENAME@-protocol.h',
|
||||||
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'],
|
command: [wayland_scanner, 'server-header', '@INPUT@', '@OUTPUT@'],
|
||||||
)
|
)
|
||||||
endforeach
|
wl_protos_src += custom_target(
|
||||||
|
|
||||||
foreach p : client_protocols
|
|
||||||
xml = join_paths(p)
|
|
||||||
wl_protos_headers += custom_target(
|
|
||||||
xml.underscorify() + '_client_h',
|
xml.underscorify() + '_client_h',
|
||||||
input: xml,
|
input: xml,
|
||||||
output: '@BASENAME@-client-protocol.h',
|
output: '@BASENAME@-client-protocol.h',
|
||||||
command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
|
command: [wayland_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
|
||||||
)
|
)
|
||||||
endforeach
|
endforeach
|
||||||
|
|
||||||
lib_client_protos = static_library(
|
|
||||||
'client_protos',
|
|
||||||
wl_protos_src + wl_protos_headers,
|
|
||||||
dependencies: wayland_client.partial_dependency(compile_args: true),
|
|
||||||
)
|
|
||||||
|
|
||||||
client_protos = declare_dependency(
|
|
||||||
link_with: lib_client_protos,
|
|
||||||
sources: wl_protos_headers,
|
|
||||||
)
|
|
||||||
|
|
||||||
lib_server_protos = static_library(
|
|
||||||
'server_protos',
|
|
||||||
wl_protos_src + wl_protos_headers,
|
|
||||||
dependencies: wayland_server.partial_dependency(compile_args: true),
|
|
||||||
)
|
|
||||||
|
|
||||||
server_protos = declare_dependency(
|
|
||||||
link_with: lib_server_protos,
|
|
||||||
sources: wl_protos_headers,
|
|
||||||
)
|
|
||||||
|
|
|
@ -1,67 +0,0 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<protocol name="wlr_input_inhibit_unstable_v1">
|
|
||||||
<copyright>
|
|
||||||
Copyright © 2018 Drew DeVault
|
|
||||||
|
|
||||||
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>
|
|
||||||
|
|
||||||
<interface name="zwlr_input_inhibit_manager_v1" version="1">
|
|
||||||
<description summary="inhibits input events to other clients">
|
|
||||||
Clients can use this interface to prevent input events from being sent to
|
|
||||||
any surfaces but its own, which is useful for example in lock screen
|
|
||||||
software. It is assumed that access to this interface will be locked down
|
|
||||||
to whitelisted clients by the compositor.
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<request name="get_inhibitor">
|
|
||||||
<description summary="inhibit input to other clients">
|
|
||||||
Activates the input inhibitor. As long as the inhibitor is active, the
|
|
||||||
compositor will not send input events to other clients.
|
|
||||||
</description>
|
|
||||||
<arg name="id" type="new_id" interface="zwlr_input_inhibitor_v1"/>
|
|
||||||
</request>
|
|
||||||
|
|
||||||
<enum name="error">
|
|
||||||
<entry name="already_inhibited" value="0" summary="an input inhibitor is already in use on the compositor"/>
|
|
||||||
</enum>
|
|
||||||
</interface>
|
|
||||||
|
|
||||||
<interface name="zwlr_input_inhibitor_v1" version="1">
|
|
||||||
<description summary="inhibits input to other clients">
|
|
||||||
While this resource exists, input to clients other than the owner of the
|
|
||||||
inhibitor resource will not receive input events. The client that owns
|
|
||||||
this resource will receive all input events normally. The compositor will
|
|
||||||
also disable all of its own input processing (such as keyboard shortcuts)
|
|
||||||
while the inhibitor is active.
|
|
||||||
|
|
||||||
The compositor may continue to send input events to selected clients,
|
|
||||||
such as an on-screen keyboard (via the input-method protocol).
|
|
||||||
</description>
|
|
||||||
|
|
||||||
<request name="destroy" type="destructor">
|
|
||||||
<description summary="destroy the input inhibitor object">
|
|
||||||
Destroy the inhibitor and allow other clients to receive input.
|
|
||||||
</description>
|
|
||||||
</request>
|
|
||||||
</interface>
|
|
||||||
</protocol>
|
|
32
release.sh
Executable file
32
release.sh
Executable file
|
@ -0,0 +1,32 @@
|
||||||
|
#!/bin/sh -eu
|
||||||
|
|
||||||
|
prev=$(git describe --tags --abbrev=0)
|
||||||
|
next=$(meson rewrite kwargs info project / | jq -r '.kwargs["project#/"].version')
|
||||||
|
|
||||||
|
case "$next" in
|
||||||
|
*-dev)
|
||||||
|
echo "This is a development version"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
if [ "$prev" = "$next" ]; then
|
||||||
|
echo "Version not bumped in meson.build"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! git diff-index --quiet HEAD -- meson.build; then
|
||||||
|
echo "meson.build not committed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
shortlog="$(git shortlog --no-merges "$prev..")"
|
||||||
|
(echo "sway $next"; echo ""; echo "$shortlog") | git tag "$next" -ase -F -
|
||||||
|
|
||||||
|
prefix=sway-$next
|
||||||
|
archive=$prefix.tar.gz
|
||||||
|
git archive --prefix="$prefix/" -o "$archive" "$next"
|
||||||
|
gpg --output "$archive".sig --detach-sig "$archive"
|
||||||
|
|
||||||
|
git push --follow-tags
|
||||||
|
gh release create "sway $next" -t "$next" -n "" -d "$archive" "$archive.sig"
|
|
@ -1,4 +1,3 @@
|
||||||
#define _POSIX_C_SOURCE 200809
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
@ -46,6 +45,7 @@ static const struct cmd_handler handlers[] = {
|
||||||
{ "assign", cmd_assign },
|
{ "assign", cmd_assign },
|
||||||
{ "bar", cmd_bar },
|
{ "bar", cmd_bar },
|
||||||
{ "bindcode", cmd_bindcode },
|
{ "bindcode", cmd_bindcode },
|
||||||
|
{ "bindgesture", cmd_bindgesture },
|
||||||
{ "bindswitch", cmd_bindswitch },
|
{ "bindswitch", cmd_bindswitch },
|
||||||
{ "bindsym", cmd_bindsym },
|
{ "bindsym", cmd_bindsym },
|
||||||
{ "client.background", cmd_client_noop },
|
{ "client.background", cmd_client_noop },
|
||||||
|
@ -92,6 +92,7 @@ static const struct cmd_handler handlers[] = {
|
||||||
{ "titlebar_border_thickness", cmd_titlebar_border_thickness },
|
{ "titlebar_border_thickness", cmd_titlebar_border_thickness },
|
||||||
{ "titlebar_padding", cmd_titlebar_padding },
|
{ "titlebar_padding", cmd_titlebar_padding },
|
||||||
{ "unbindcode", cmd_unbindcode },
|
{ "unbindcode", cmd_unbindcode },
|
||||||
|
{ "unbindgesture", cmd_unbindgesture },
|
||||||
{ "unbindswitch", cmd_unbindswitch },
|
{ "unbindswitch", cmd_unbindswitch },
|
||||||
{ "unbindsym", cmd_unbindsym },
|
{ "unbindsym", cmd_unbindsym },
|
||||||
{ "workspace", cmd_workspace },
|
{ "workspace", cmd_workspace },
|
||||||
|
@ -102,6 +103,7 @@ static const struct cmd_handler handlers[] = {
|
||||||
static const struct cmd_handler config_handlers[] = {
|
static const struct cmd_handler config_handlers[] = {
|
||||||
{ "default_orientation", cmd_default_orientation },
|
{ "default_orientation", cmd_default_orientation },
|
||||||
{ "include", cmd_include },
|
{ "include", cmd_include },
|
||||||
|
{ "primary_selection", cmd_primary_selection },
|
||||||
{ "swaybg_command", cmd_swaybg_command },
|
{ "swaybg_command", cmd_swaybg_command },
|
||||||
{ "swaynag_command", cmd_swaynag_command },
|
{ "swaynag_command", cmd_swaynag_command },
|
||||||
{ "workspace_layout", cmd_workspace_layout },
|
{ "workspace_layout", cmd_workspace_layout },
|
||||||
|
@ -110,6 +112,7 @@ static const struct cmd_handler config_handlers[] = {
|
||||||
|
|
||||||
/* Runtime-only commands. Keep alphabetized */
|
/* Runtime-only commands. Keep alphabetized */
|
||||||
static const struct cmd_handler command_handlers[] = {
|
static const struct cmd_handler command_handlers[] = {
|
||||||
|
{ "allow_tearing", cmd_allow_tearing },
|
||||||
{ "border", cmd_border },
|
{ "border", cmd_border },
|
||||||
{ "create_output", cmd_create_output },
|
{ "create_output", cmd_create_output },
|
||||||
{ "exit", cmd_exit },
|
{ "exit", cmd_exit },
|
||||||
|
@ -145,7 +148,7 @@ static int handler_compare(const void *_a, const void *_b) {
|
||||||
return strcasecmp(a->command, b->command);
|
return strcasecmp(a->command, b->command);
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct cmd_handler *find_handler(char *line,
|
const struct cmd_handler *find_handler(const char *line,
|
||||||
const struct cmd_handler *handlers, size_t handlers_size) {
|
const struct cmd_handler *handlers, size_t handlers_size) {
|
||||||
if (!handlers || !handlers_size) {
|
if (!handlers || !handlers_size) {
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -378,10 +381,13 @@ struct cmd_results *config_command(char *exec, char **new_block) {
|
||||||
sway_log(SWAY_INFO, "Config command: %s", exec);
|
sway_log(SWAY_INFO, "Config command: %s", exec);
|
||||||
const struct cmd_handler *handler = find_core_handler(argv[0]);
|
const struct cmd_handler *handler = find_core_handler(argv[0]);
|
||||||
if (!handler || !handler->handle) {
|
if (!handler || !handler->handle) {
|
||||||
const char *error = handler
|
if (handler) {
|
||||||
? "Command '%s' is shimmed, but unimplemented"
|
results = cmd_results_new(CMD_INVALID,
|
||||||
: "Unknown/invalid command '%s'";
|
"Command '%s' is shimmed, but unimplemented", argv[0]);
|
||||||
results = cmd_results_new(CMD_INVALID, error, argv[0]);
|
} else {
|
||||||
|
results = cmd_results_new(CMD_INVALID,
|
||||||
|
"Unknown/invalid command '%s'", argv[0]);
|
||||||
|
}
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -407,6 +413,7 @@ struct cmd_results *config_command(char *exec, char **new_block) {
|
||||||
&& handler->handle != cmd_bindsym
|
&& handler->handle != cmd_bindsym
|
||||||
&& handler->handle != cmd_bindcode
|
&& handler->handle != cmd_bindcode
|
||||||
&& handler->handle != cmd_bindswitch
|
&& handler->handle != cmd_bindswitch
|
||||||
|
&& handler->handle != cmd_bindgesture
|
||||||
&& handler->handle != cmd_set
|
&& handler->handle != cmd_set
|
||||||
&& handler->handle != cmd_for_window
|
&& handler->handle != cmd_for_window
|
||||||
&& (*argv[i] == '\"' || *argv[i] == '\'')) {
|
&& (*argv[i] == '\"' || *argv[i] == '\'')) {
|
||||||
|
@ -482,14 +489,10 @@ struct cmd_results *cmd_results_new(enum cmd_status status,
|
||||||
}
|
}
|
||||||
results->status = status;
|
results->status = status;
|
||||||
if (format) {
|
if (format) {
|
||||||
char *error = malloc(256);
|
|
||||||
va_list args;
|
va_list args;
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
if (error) {
|
results->error = vformat_str(format, args);
|
||||||
vsnprintf(error, 256, format, args);
|
|
||||||
}
|
|
||||||
va_end(args);
|
va_end(args);
|
||||||
results->error = error;
|
|
||||||
} else {
|
} else {
|
||||||
results->error = NULL;
|
results->error = NULL;
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue