Compare commits

...
Sign in to create a new pull request.

164 commits

Author SHA1 Message Date
Penelope Gwen
5977be943e add build.sh 2025-02-26 04:55:34 +00:00
Penelope Gwen
02f5a26b23 remove unneeded file 2025-02-26 04:50:21 +00:00
Penelope Gwen
33e4784748 separate swayfx background package 2025-02-26 04:48:46 +00:00
Penelope Gwen
a18bd148a2 separate swayfx background package 2025-02-26 04:44:12 +00:00
Penelope Gwen
9f2ff33433 ignore meson errors 2025-02-25 23:39:22 +00:00
Penelope Gwen
c31e4c9f29 Merge remote-tracking branch 'upstream/master' 2025-02-25 23:32:12 +00:00
Penelope Gwen
a0d96ad34f rebase on sway 1.10.1 debian release 2025-02-25 23:31:05 +00:00
William McKinnon
c17a9ca357 ver: increment to 0.5 2025-02-25 13:29:40 -05:00
William McKinnon
f29300f757 fix: smart borders 2025-02-25 13:22:15 -05:00
William McKinnon
b05c76dd0a temp fix: 1px line at top of bottom border 2025-02-24 23:01:16 -05:00
William McKinnon
95e722431c fix: border corners appearing when border set to 0 2025-02-23 15:39:56 -05:00
William McKinnon
835f796b9a update flake.lock 2025-02-23 02:07:36 -05:00
John Axel Eriksson
ba743d298d
fix: flake building (#383) 2025-02-23 02:05:22 -05:00
Erik Reider
50d4cf45ab
Sway 1.10.1 Rebase (#382) 2025-02-17 16:45:01 +01:00
William McKinnon
03a0796973 update: meson.build 2025-02-16 15:53:38 -05:00
William McKinnon
82fe097b31
feat: sway 1.10 rebase (#367)
Co-authored-by: Erik Reider <35975961+ErikReider@users.noreply.github.com>
2025-02-16 15:33:52 -05:00
askiiart
3e4b6b75f4
Fix incorrect shadow_blur_radius max in README (#365) 2024-11-15 15:48:25 -05:00
William McKinnon
d131b4dfbf Revert "fix: compilation error"
This reverts commit 7a235d282b.
2024-10-31 03:16:41 -04:00
William McKinnon
7a235d282b fix: compilation error 2024-10-30 17:48:15 -04:00
amy
5ee4d73771
fix top border size and placement (#356) 2024-10-09 11:25:07 -04:00
Halano
91e6591fd6
Add scenefx to README.md as dependence for swayfx (#355) 2024-10-09 11:23:59 -04:00
William McKinnon
ef08085153 updated lock 2024-09-25 00:29:14 -04:00
eri
aa65c3a9e3
feat: add provided sessions (#349) 2024-09-05 20:06:38 -04:00
Zephyr Lykos
19f76f3dcd
text_input: Implement input-method popups (#315) 2024-08-14 00:39:55 -04:00
eri
c861623887
fix: wlroots version (#341) 2024-08-14 00:39:06 -04:00
Erik Reider
4d7ca7d975
Fixed blur opacity. Fixes #338 (#339) 2024-07-29 12:13:11 -04:00
Penelope Gwen
178c6db807 redo debian packaging 2024-06-15 15:17:59 -06:00
Penelope Gwen
6dfcc056b3 redo debian packaging 2024-06-15 15:14:44 -06:00
Erik Reider
da559b3ea1
Fixed blurred tiling indicator not drawing on the right coordinates (#319) 2024-06-01 00:24:08 -04:00
famfo
3c621dec7d
Update flake.lock (#316) 2024-05-09 12:45:44 -04:00
William McKinnon
aaa3c7536e removed unneeded build scripts and workflows 2024-05-08 00:34:46 -04:00
Åsmund Balke
d4f8c9d0b8
update wlroots (#312) 2024-05-07 23:50:33 -04:00
Eric Chastain
e45b420ccc
Update server.c removing duplicated code block (#306) 2024-04-30 23:38:49 -04:00
William McKinnon
c6b4411b86
Removed git only messages 2024-04-29 02:09:52 -04:00
William McKinnon
80c0c50673 removed old publish script, updated to 0.4 2024-04-29 01:33:43 -04:00
Erik Reider
a5a69d4d4e
fix: gray background rect not being expanded by blur size (#295) 2024-04-22 17:41:51 -04:00
ozwaldorf
4b954d5a05
flake: update for swayfx 0.4 (#284) 2024-04-18 23:51:51 -04:00
Erik Reider
40a5ebf109
Fix segfaults (#291)
* Add NULL checks for effect_fbos

* Fix freeing undefined pixman region
2024-04-18 01:03:25 +02:00
Erik Reider
8ad2605c65
Fixed compilation errors (#290) 2024-04-17 19:29:15 +02:00
ozwaldorf
a4d51d55e5
fix: update sway original version (#289) 2024-04-16 11:10:19 +02:00
William McKinnon
62472238ca
added git only message for shadow offset 2024-04-15 01:43:19 -04:00
Reza Jelveh
fb86ed6b05
feat: 1.9 merge (#277)
Co-authored-by: William McKinnon <contact@willmckinnon.com>
Co-authored-by: Erik Reider <35975961+ErikReider@users.noreply.github.com>
2024-04-15 01:39:41 -04:00
ozwaldorf
a5e79676c4
flake: switch default overlay to insert for wider compatibility (#282)
Advanced users can opt into using the override flake for layering on top of the flake, given they are on a compatible nixpkgs version and know what they are doing
2024-04-15 01:32:43 -04:00
William McKinnon
477686adb0 added hwdata wlroots dependency 2024-04-14 18:52:22 -04:00
sntx
167a4ea0ae
fix: Changes outputs, nix flake show now completes (#280)
Removed the `default` attribute from `outputs.formatter.<system>`,
instead parse the formatter derivation directly.

This fixes the issue that `nix flake show` doesn't complete.

Co-authored-by: sntx <sntx.htqjd@simplelogin.com>
2024-04-10 11:55:22 -04:00
ozwaldorf
8afe66ab31
Overhaul nix flake (#279) 2024-04-10 00:58:34 -04:00
Erik Reider
2bd366f337
Add blur to tiling indicator (#252) 2024-02-15 09:48:31 +01:00
Erik Reider
d1482ad992
Added sway-portal.conf to COPR (#234) 2024-02-15 09:47:41 +01:00
Rolf Vidar Mazunki Hoksaas
271af3d474
enhancement: update version printing format (#254)
* enhancement: update version printing format

as mentioned in #253, version numbers can be confusing if you don't know
or realize you're running SwayFX instead of standard sway.

to fix this issue, I've updated the way we display versions, replacing
"sway version X" to "swayfx version X", suffixed by the sway upstream
version which swayfx is based upon.

while not immediately displaying we come from swayfx in
swaymsg/swaynag/swaybar, we do display we're based off a specific
upstream sway version.

note: this requires updating `meson.build` (currently `meson.build:181`)
each time we rebase into a new sway version.

Closes: Issue #253
Signed-off-by: Mazunki Hoksaas <rolferen@gmail.com>

* reduce linelength

---------

Signed-off-by: Mazunki Hoksaas <rolferen@gmail.com>
2024-02-14 21:29:04 -05:00
Babymusk
cf3ef50a3f
Added guide for Debian users (#268)
* Create INSTALL-deb

* Rename INSTALL-deb to INSTALL-deb.md

* Update README.md to include debian

* Added a guide

* Update README.md

* Update INSTALL-deb.md

* Version change
2024-02-14 21:27:51 -05:00
famfo
f0ecffe593
Fix shadow_offset position (#263) 2024-01-05 12:43:07 +01:00
Erik Reider
303b7dfb69
Fixed #258 blur regression (#261) 2024-01-05 02:47:43 -05:00
ozwaldorf
04b657b58c
feat: blur tweaks (#258) 2024-01-03 12:38:44 -05:00
Erik Reider
1c5c60d928
Blur damage compensation fixes (#259)
* Increased blur size to match what WayFire uses

* Fix damage compensation not being scaled
2023-12-28 11:10:05 +01:00
famfo
ca42d41453
Implement shadow_offset (#255) 2023-12-22 01:08:09 -05:00
Erik Reider
5e866d0345
Limit corner radius size to the smallest box dimension (#251)
One example would be the tiling indicator sometimes experiencing a "sharp" edge when the radii was larger than the
height/width
2023-12-17 01:00:22 +01:00
Erik Reider
fd0f4ea54f
Readds check if the floating child is in a container for xray (#250) 2023-12-17 00:59:06 +01:00
Mubin
ac52c2874e
Update README.md (#243)
Simple fix in README.
2023-12-08 00:30:28 -05:00
Erik Reider
7c8d46bbaa
Fixed AUR Github Action not including sway-portals.conf (#247)
* Added sway-portals.conf to AUR publish Action

* Bumped PKGBUILD pkgrel
2023-12-03 18:46:09 +01:00
Elias Elwyn
7c75b21933
fix(PKGBUILD): support new portals req for XDG_CURRENT_DESKTOP (#239)
Integrates commits c85a455e and 2f9c63b0 from extra/sway.

Copied from c85a455e:

> As of version 1.17, xdg-desktop-portal requires desktops to declare
> which portals should be used. For Sway, this requires a file
> /usr/share/xdg-desktop-portal/sway-portals.conf (or a local user
> config).
>
> A reasonable default is to use GTK for the file picker (as wlr doesn't
> have file picker support) and wlr for screencast/screenshot support.
> Fedora does this similarly. [1]
>
> Upstream is not interested in shipping a configuration file [2] so we
> need to do it downstream.
>
> [1] https://src.fedoraproject.org/rpms/sway/blob/rawhide/f/sway-portals.conf
> [2] https://github.com/swaywm/sway/issues/7773

c85a455eb6
2f9c63b053
2023-11-26 20:57:41 -05:00
Elias Elwyn
e6ddd16a1b
chore: Update pkgrel in PKGBUILDs (#238)
Update pkgrel twice for changes in #237 and #240
2023-11-26 01:32:08 -05:00
Ben
ab6dc54e6a
fix: aur build failed: sd-bus-provider set to auto (#240)
> swayfx/meson.build:92:2: ERROR: Assert failed: sd-bus-provider must
not be set to auto since auto_features != auto
2023-11-25 11:53:46 -05:00
Danie
9cd02fc480
Update PKGBUILD to fix breakage due to wlroots0.17 (#237) 2023-11-24 15:46:50 -05:00
eri
2d6944dc14
feat: add shadow color for inactive windows (#230) 2023-10-23 10:58:47 -04:00
Erik Reider
d89c365106
Add layer effect option to ignore transparent regions when blurring (#159) 2023-09-20 21:35:49 -04:00
William McKinnon
6f6991a1b3
refactor: simplify blur (#219)
* refactor: removed surface_width + surface_height from render_blur()

* Fixed scaling issues

* Minor refactors

* removed scaled_dst box

* removed uneeded fb bind

* removed unneeded src_box

* removed unneeded wlr_fbox_from_box function

* removed src_box

* Don't scale the blur translucent region twice

* Renamed extended_damage to original_damage to reflect better what it actually is

* Removed unneeded clearing of the wlr fbo before rendering onto it

* Removed the need for our own main FBO, also fixes some damage bugs

* Simplified detection of blur on workspace

* cleaned up comments

---------

Co-authored-by: Erik Reider <35975961+ErikReider@users.noreply.github.com>
2023-09-06 00:32:08 -04:00
Erik Reider
13eeea5ed5
Removed systemd requirement in both AUR PKGBUILDs (#212) 2023-08-22 23:35:39 -04:00
Erik Reider
c47aa61c64
fix: not being able to build without xwayland support (#209) 2023-07-29 13:13:26 -04:00
Erik Reider
fade58b6be
fix: floating child always using blur xray (#210) 2023-07-29 13:12:21 -04:00
honchokomodo
c15e9f5d39
replace mascot art (#205)
* add updated mascot art

* Delete swayfx_mascot.png

* re-add old mascot image

oops
2023-07-23 22:08:35 -04:00
sntx
c7fa46face
More eyecandy for the readme (#194)
Co-authored-by: sntx <sntx.htqjd@simplelogin.com>
2023-07-21 17:35:34 -04:00
Yaroslav
7b7f060552
fix: crash when moving to scratchpad tiled window (#202) 2023-07-18 23:37:23 -04:00
Basil
c2b01d74a4
Update README.md (#204) 2023-07-18 18:30:34 -04:00
Sntx_
c89e4c9bf2
README: Inline the repology badge and swayfx mascot (#193)
* README: Inline the repology badge and swayfx mascot

* README: Removed unused style from html tag
2023-07-07 05:10:42 -04:00
William McKinnon
7fe10260d9 ver: bump to 0.3.2 2023-07-06 23:18:00 -04:00
Evy Garden
061dfaa2e7
Fix toplevel borders (#171)
* added check for smart

* expose gaps_to_edge

* add smart variable
2023-07-06 23:11:21 -04:00
William McKinnon
ab8106add4 updated branding 2023-07-06 23:09:12 -04:00
Erik Reider
cda17aee16
Fixed blur/surfaces dst_box not being offset by the titlebar height (#185) 2023-07-03 18:45:26 +02:00
RAR27
edd7aa72bc
fix: crash when splitting inside stacking container (#187) 2023-06-07 00:22:46 -04:00
rti
3e6626d6c3
fix: consider dim introduced transparency for blur (#184)
The blur rendering logic includes the optimization to render blur only
for transparent surfaces. This patch considers surfaces as transparent
also when the transparency is only introduced by the dim color.

We can now have windows, that are opaque by default become transparent
with blurred background as soon as they loose focus.

Example configuration:

```
blur on
blur_passes 3
blur_radius 5

default_dim_inactive 0.15
dim_inactive_colors.unfocused #00000000
```
2023-06-04 15:48:19 -04:00
RAR27
6a6cf2841c
fix: crash when moving tabbed container to scratchpad (#182)
when `scratchpad_minimize` enabled
2023-06-02 20:19:25 -04:00
William McKinnon
15bf6ae835 ver: bump to 0.3.1 2023-06-02 19:21:26 -04:00
William McKinnon
11451465ad
added layer namespace information 2023-06-02 18:58:16 -04:00
William McKinnon
588fca381e default scratchpad_minimize to false and add warning 2023-06-02 18:56:43 -04:00
Erik Reider
212c51f62c
fix: update stencil if the output size changes (#178) 2023-06-02 18:53:41 -04:00
RAR27
22327ef300
fix: crash when splitting inside tabbed container (#180) 2023-06-02 18:46:39 -04:00
Erik Reider
c95306fcdf
fix: blur not being able to blur edges of damage (#168) 2023-05-30 00:18:58 -04:00
William McKinnon
8e6667ddad
Update README.md 2023-05-23 22:21:40 -04:00
William McKinnon
a41eaa8d83 added blur-xray explanation 2023-05-22 23:13:00 -04:00
Ricardo Steijn
60e24c9cf4
flake: remove libinput patch (#163)
This was backported to SwayFX in 3c2e38b
2023-05-21 10:04:34 -04:00
William McKinnon
3c2e38be03 upstream: ipc: add LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM entry 2023-05-21 00:23:40 -04:00
William McKinnon
0ca4062d6d fix: layer old damage not being offset by the monitor layout coords 2023-05-21 00:13:31 -04:00
William McKinnon
d010f48f9a bump version to 0.3 2023-05-21 00:10:36 -04:00
William McKinnon
ff2a37cfbd updated README to reflect 0.3 2023-05-20 21:26:37 -04:00
Erik Reider
c4a0bb268a
Fix layer surface damage not being extended if using effects (#160) 2023-05-20 17:21:02 -04:00
William McKinnon
d2ad352c7f fix: maybe-uninitialized error 2023-05-20 17:03:20 -04:00
Erik Reider
415e072a3a
Add blur, shadow, and corner radius to layer-shell surfaces (#144)
Co-authored-by: Will McKinnon <contact@willmckinnon.com>
2023-05-19 21:14:06 +02:00
William McKinnon
6707842942 improved blur optimization checks 2023-05-19 13:24:37 -04:00
William McKinnon
476a88d200 add link to fedora copr package, remove extra lines about discord server 2023-05-19 01:56:08 -04:00
Erik Reider
aa6b2fcd79
Fix damage being extended after clearing the previous frame (#158)
* Fix damage being extended after clearing the previous frame

* Ensure that damage expansion only occurs if it's smaller than the monitor
2023-05-18 23:14:37 -04:00
Erik Reider
a160b2c850
Flipped the order of which the stencil add function is called (#157) 2023-05-18 09:47:14 -04:00
Erik Reider
acafb20b11
Move stencil into each framebuffer (#156)
* Move stencil into each framebuffer

Also fixes the stencil being added to the wrong framebuffer

* Initialize texture members on framebuffer init

* removed bind arg

* renamed init to create, changed existing create to update

* moved stencil buffer creation to new function

* removed some now misleading comments

---------

Co-authored-by: William McKinnon <contact@willmckinnon.com>
2023-05-17 19:39:48 -04:00
William McKinnon
2c4fe20456
Blur damage tracking simplification (#155)
* suplified conditional in find_con_effect_iterator

* removed has_blur

* simplified optimized blur check

* moved damage expansion to output.c

* removed extraneous fx_renderer_scissor

* cleaned up render_output

* removed unneeded damage scale

* moved workspace optimized check function to workspace.c

* renamed ws iterator function

* added back region expansion

* removed uneeded parameter from get_main_buffer_blur

* returned extended damage

* moved get_blur_size back to original spot (reduce diff size)

* Fixed blur artifacting

* Fixed damage highlight not clearing correct framebuffer

* removed unneeded conditional

* moved initial damage expansion to output.c

* moved extended damage to the top of output_render

* moved blur damage to damage_surface_iterator

* ensure damage doesnt expand beyond output size

* removed stdint import

---------

Co-authored-by: Erik Reider <ereider20010103@gmail.com>
2023-05-16 02:26:01 -04:00
William McKinnon
479cc4e745 style: simplified render_whole_output 2023-05-15 01:11:09 -04:00
William McKinnon
6e53c04abf
fix: shadow clipping & shadow corners (#153) 2023-05-05 16:07:50 -04:00
William McKinnon
94a6340f9f updated flake lock 2023-05-04 22:17:32 -04:00
Will McKinnon
74e7012b21 fix: smart_corners with shadow and titlebars 2023-04-30 14:51:04 -04:00
Will McKinnon
15db638ccb improved stenciling region 2023-04-30 14:06:57 -04:00
Will McKinnon
d86e349290 fix: blurred region is rounded below titlebars 2023-04-30 14:03:51 -04:00
Will McKinnon
ace9a222b8 style: created struct for each shader type 2023-04-30 13:35:01 -04:00
Will McKinnon
06339c325c style: moved stencil mask to its own shader 2023-04-30 12:53:26 -04:00
Erik Reider
5366c49b56
Fix: rotated outputs (#112) 2023-04-27 18:50:36 -04:00
Will McKinnon
3d1b294cc0 removed width and height parameters from fx_framebuffer_bind() 2023-04-24 00:53:55 -04:00
Will McKinnon
b61041980f store viewport width & height in fx_renderer 2023-04-24 00:11:55 -04:00
Erik Reider
50e2422e74
Only offset view by border size if not fullscreen (#145) 2023-04-21 03:00:38 -04:00
William McKinnon
10c74b6124 fixed error in config 2023-04-21 02:56:37 -04:00
William McKinnon
3f00052a90 fixed shadow corner_radius scaling 2023-04-18 19:04:00 -04:00
Will McKinnon
e02e338d45 updated README 2023-04-17 17:50:21 -04:00
Will McKinnon
7e302de4c2 fix: redefinition of state 2023-04-17 17:42:14 -04:00
Erik Reider
cbfb7af7fd
Add kawase blur (#120)
Co-authored-by: Erik Reider <erik.reider@protonmail.com>
Co-authored-by: Will McKinnon <contact@willmckinnon.com>
2023-04-17 23:24:48 +02:00
Will McKinnon
7d774f769c style: moved border_thickness out of render_shadow 2023-04-15 19:55:47 -04:00
Will McKinnon
8d3b7e13df style: .dim_color spacing 2023-04-15 13:44:56 -04:00
Will McKinnon
f74c0fedb2 minor shadow optimization 2023-04-07 00:26:23 -04:00
Will McKinnon
3e6f2366e7 updated docs from on|off to enable|disable 2023-04-06 20:36:18 -04:00
Will McKinnon
420364dd19 structure: moved fx_renderer and related fuctions to a folder 2023-04-06 20:30:42 -04:00
Will McKinnon
c24fccd45c style: moved damage creation to function 2023-04-04 09:58:41 -04:00
Will McKinnon
41df328325 style: unified rounded quad shaders 2023-04-03 20:16:54 -04:00
Inconn
4d1af65004
fix: remove 'f' suffixes from tex.frag to fix nvidia (#136) 2023-03-26 19:14:33 -04:00
Erik Reider
f2d29ceb6b
Extend minimize logic to work with XWayland and XDG applications (#132)
* Extend minimize logic

* Removed redundant xwayland minimize logic

* minor fixes

* Fixed not properly checking if window is ran though XWayland

* Added config option with default being off

* Set scratchpad_minimize to true by default

* Improve config dependant logic

* Switch to using enable|disable instead of on|off
2023-03-26 11:44:21 -04:00
Will McKinnon
7d5d7a3022 style: cleaned up fx_renderer.c 2023-03-20 13:00:31 -04:00
Will McKinnon
474bfb460a fix: updated flake 2023-03-18 01:59:12 -04:00
Will McKinnon
9a0d2899a2 fix: removed duplicate session_lock logic 2023-03-18 01:58:15 -04:00
Will McKinnon
1a10c61165 refactor: merged tex shaders 2023-03-18 01:03:02 -04:00
Erik Reider
f1e3fe92ce
Fixed PKGBUILD trying to build with wlroots0.15 (#125)
* Fixed PKGBUILD trying to build with wlroots0.15

* Bumped pkgrel
2023-03-16 14:00:14 -04:00
head-gardener
ac31a61216
feature: hide separator between titlebar and content (#91) 2023-03-12 03:20:50 -04:00
William McKinnon
3b101734e6
Update README.md 2023-03-10 22:56:24 -05:00
Glitchy Crafting
83d7316a04
doc: add repology badge to README (#115)
closes #103
2023-03-10 22:52:41 -05:00
Erik Reider
695000b344
ver: bump to 0.2 (#87)
Co-authored-by: Erik Reider <erik.reider@protonmail.com>
2023-03-10 22:51:11 -05:00
William McKinnon
4222b98a39
feat: tabbed layout now only rounds outer titlebar corners (#90) 2023-02-20 22:10:01 -05:00
Will McKinnon
e9781805a7 fix: shadow alignment 2023-02-18 18:51:58 -05:00
famfo
9f20a52638
Implement for_window support for dim_inactive (#109)
* Implement for_window support for dim_inactive

* Update file names, add check if the container is null, add docs

* Fix typo

* Update meson.build

* Update commands.c

* Update render.c

* Update container.c

* Update render.c

* Update container.h
2023-02-14 20:19:02 -05:00
Erik Reider
e78fc3364b
upstream update: merge sway 1.8.1 (#111) 2023-02-14 10:51:29 -05:00
Erik Reider
3efd3b558f
Add option for enabling shadows for CSD windows (#106)
* Add option for enabling shadows for CSD windows

* Disable drawing borders when CSD and shadows csd is enabled
2023-02-01 01:13:04 +01:00
rti
9345749a90
fix: no dim on parent select in tabbed and stacked (#107) 2023-01-26 23:33:04 -05:00
Erik Reider
8f8a5c0492
Use view dimensions for windows instead of surface dimensions (#94) 2023-01-24 19:52:55 +01:00
Will McKinnon
dd67fdb6c3 fix: don't round view popup corners 2023-01-23 02:35:46 -05:00
rti
9e6901264b
feat: smart smart_corner_radius (#101) 2023-01-19 17:33:56 -05:00
rti
dbe2be6a36
fix: dim color on focus parent (#102) 2023-01-19 23:32:36 +01:00
rti
d3df665f03
chore: update flake to base on nixpkgs sway-1.8 (#100) 2023-01-19 17:27:13 -05:00
Rahul Sandhu
3d55fa487f
Add gentoo install instructions (guru) to the readme (#98) 2023-01-18 20:10:26 -05:00
William McKinnon
ba35ad0f24
Clarified shadows are not released 2023-01-18 02:08:29 -05:00
Will McKinnon
44fc516a5d updated discord invite link 2023-01-18 01:58:08 -05:00
William McKinnon
588ea8e290
feat: Add box shadows (#64)
Co-authored-by: Erik Reider <35975961+ErikReider@users.noreply.github.com>
2023-01-18 01:49:26 -05:00
Erik Reider
1baba77c74
Fix building non-git PKGBUILD (#88) 2023-01-08 21:53:05 +01:00
Erik Reider
558c67378f
Fix non git PKGBUILD requiring wlroots 0.16 (#86)
* Require wlroots0.15

* Use pcre instead of pcre2
2023-01-06 00:15:34 +01:00
Erik Reider
94ebb45ee3
rebase: Sway 1.8 (#78)
* build: bump wlroots dependency to 0.16.0

* swaymsg: replace if with switch in pretty_print

* swaymsg: add GET_TREE pretty-printing

* swaybar: fix errno handling in status_handle_readable

If getline fails once, it was not reset before the next getline
call. errno is only overwritten by getline on error.

* Add cairo_image_surface_create error handling

cairo_image_surface_create can fail, e.g. when running out of
memory or when the size is too big. Avoid crashing in this case.

Closes: https://github.com/swaywm/sway/issues/6531

* build: bump version to 1.8-dev

Historically we've been sticking with the last release number in
the master branch. However that's a bit confusing, people can't
easily figure out whether they're using a release or a work-in-progress
snapshot. Only the commit hash appended to the version number may
help, but that's not very explicit and disappears when using a
tarball.

We could bump the version in master to the next release number.
However during the RC cycle there would be a downgrade from 1.8 to
1.8-rc1. Also it would be hard to tell the difference between a
stable release and an old snapshot.

This patch introduces a new pre-release identifier, "dev". It's
alphabetically before "rc" so it should be correctly sorted by
semver comparisons. "dev" is upgraded to "rc" (and then to stable)
when doing a release. The master branch always uses a "dev"
version, only release branches use "rc" or stable versions.

* [IPC] Add repeat delay/rate info to keyboard

Closes #6735

wlroots already has the info in the struct so let's access it and print it out.

* input/seat: unset has_focus when focus_stack becomes empty

We currently track the focus of a seat in two ways: we use a list called
focus_stack to track the order in which nodes have been focused, with
the first node representing what's currently focused, and we use a
variable called has_focus to indicate whether anything has focus--i.e.
whether we should actually treat that first node as focused at any given
time.

In a number of places, we treat has_focus as implying that a focused
node exists. If it's true, we attempt to dereference the return value of
seat_get_focus(), our helper function for getting the first node in
focus_list, with no further checks. But this isn't quite correct with
the current implementation of seat_get_focus(): not only does it return
NULL when has_focus is false, it also returns NULL when focus_stack
contains no items.

In most cases, focus_stack never becomes empty and so this doesn't
matter at all. Since focus_stack stores a history of focused nodes, we
rarely remove nodes from it. The exception to this is when a node itself
goes away. In that case, we call seat_node_destroy() to remove it from
focus_stack and free it. But we don't unset has_focus if we've removed
the final node! This lets us get into a state where has_focus is true
but seat_get_focus() returns NULL, leading to a segfault when we try to
dereference it.

Fix the issue both by updating has_focus in seat_node_destroy() and by
adding an assertion in seat_get_focus() that ensures focus_stack and
has_focus are in sync, which will make it easier to track down similar
issues in the future.

Fixes #6395.

[1] There's some discussion in #1585 from when this was implemented
about whether has_focus is actually necessary; it's possible we could
remove it entirely, but for the moment this is the architecture we have.

* swaybar: fix tray_padding vs min-height re: scale

Co-authored-by: xdavidwu <xdavidwuph@gmail.com>

* swaybar: fix tray item icon scaling, positioning

* container: Fix crash when view unmaps + maps quickly

Followup on 4e4898e90f.

If a view quickly maps and unmaps repeatedly, there will be multiple
destroyed containers with same view in a single transaction. Each of
these containers will then try to destroy this view, resulting in use
after free.
The container should only destroy the view if the view still belongs
to the container.

Simple reproducer: couple XMapWindow + XUnmapWindow in a loop followed
by XDestroyWindow.

See #6605

* commands/move: Fix crash when pos_y is omitted

Fixes #6737

* Destroy sub-surfaces with parent layer-shell surface

Closes: https://github.com/swaywm/sway/issues/6337

* Add safety assert in parse_movement_unit

Let's add this just in case a caller passes argc == 0.

References: https://github.com/swaywm/sway/issues/6737#issuecomment-1008082540

* meson: check: false on run_command

Future meson releases will change the default and warns when the
implicit default is used, breaking builds.

Explicitly set check: false to maintain behavior and silence warnings.

* Print deprecation notice when running SUID

SUID privilege drop is needed for the "builtin"-backend of libseat,
which copied our old "direct" backend behavior for the sake of
compatibility and ease of transition.

libseat now has a better alternative in the form of seatd-launch. It
uses the normal seatd daemon and libseat backend and takes care of SUID
for us.

Add a soft deprecation warning to highlight our future intent of
removing this code. The deprecation cycle is needed to avoid surprises
when sway no longer drops privileges.

* xdg-shell: use toplevel geometry to adjust the popup box

`popup_unconstrain` uses view coordinates to init the output box for
popups. However wlroots expects the box to be set in a toplevel surface
coordinate system, which is not always equal to view. The difference
between those is a window geometry set via xdg-shell.

GTK4 reserves some space for client-side decoration and thus has a
window with top left corner not matching to (0, 0) of a surface. The box
calculated without taking that into account was slightly shifted
compared to the actual output and allowed to position part of the popup
off screen.

* build: fix building with basu

02b412a introduced the use of list for sdbus deps, however
it was assuming that all packages which were in a list has a version
higher than 239. That is true for libsystemd and libelogind, since they
use the same versions, however basu is using version numbers which are
way lower than what libsystemd/libelogind are using, so basu only build
is failing.

* Upgrade for wlroots surface refactoring

See [1] for details.

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3412

* commands/focus: drop trailing whitespace

* input/cursor: count pointer gestures as idle activity

Fixes https://github.com/swaywm/sway/issues/6765.

* input/cursor: treat swipe begin as idle activity too

Accidentally overlooked in fd53f80.

* treat fullscreen windows as 'tiled' for commands/focus

* transaction: destroying nodes aren't hidden

Commit 37d7bc6998 ("transaction: Only wait for ack from visible
views") introduced a check which uses view_is_visible() to check if a view
is still visible on the screen. However view_is_visible() will early
return in case the node is in the destroying state. This is incorrect
for transactions, since a destroying view which is visible will trigger
configure events for other clients. This bug was visible when repeatedly
opening and closing two views side by side, since we ignore the
destroying node we get a frame where the still open view is shown with
the old configure values and the rest is the desktop background. The
next frame is than correct again.

Fix this by considering destroying views as visible, we correctly wait
for them and send the configure events to other views in time, fixing
the background flicker.

Fixes #6473

* build: execute wlroots subproject before finding deps

wlroots often requires dependencies more recent than Sway's.
Executing the wlroots subproject first will give Meson a chance to
find these newer dependencies, possibly via subprojects.

The subproject will override the "wlroots" dependency when executed,
so we don't need to use get_variable anymore.

References: https://github.com/swaywm/sway/pull/6498#issuecomment-1001746017

* tray: do not render passive items

https://www.freedesktop.org/wiki/Specifications/StatusNotifierItem/StatusNotifierItem/#org.freedesktop.statusnotifieritem.status

* cmd/swap: error on swapping a container with itself

* input/cursor: pass through pointer hold gestures

This just follows swaywm/wlroots#3047, so `wl_pointer_gestures_v1`
clients can be notified of these events.

* swaynag: remove buffer destruction condition

An address of a variable can never be NULL, so checking it doesn't make
sense; and `destroy_buffer()` can operate on already destroyed buffers
anyway.

Fixes #6780

* Use bools for CLI flags

* xwayland: listen to `request_activate` event

When REAPER submenu is closed `XCB_CLIENT_MESSAGE` with type
`NET_ACTIVE_WINDOW` is sent to set focus to parent menu.

Closes: https://github.com/swaywm/sway/issues/6324

* chore: chase wlr_output_layout_get_box() update

https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3439

* Chase wlroots xdg-shell refactor

* Minor update to focus_on_window_activation

Removed xwayland limitation since wayland clients are supported via xdg-activation.

* Translated README into Italian

* readme: add link to Italian translation

* readme: sort language list alphabetically

* readme: use relative links for translations

* xdg-shell: use wlr_xdg_toplevel in sway_view

Improved type safety.

Closes: https://github.com/swaywm/sway/issues/6813

* xdg-shell: use wlr_xdg_popup in sway_xdg_popup

Improved type safety.

* Fix snprintf compiler warning

* Remove all sprintf calls

Replace them with snprintf, which ensures buffer overflows won't
happen.

* sway/commands: add missing wlr_keyboard interface include in xkb_switch_layout

* sway/input: use wlr_input_device from input device base

* Remove some erroneous apostrophes in comments

* Don't enter seatop_move_floating when fullscreen

Currently, a floating window that's been fullscreened can send us
xdg_toplevel::move, and we'll enter seatop_move_floating, which lets us
drag the surface around while it's fullscreen. We don't want
this--fullscreen surfaces should always be aligned to the screen--so add
the same check that seatop_default already does when entering this mode.

Tested with Weston's weston-fullscreen demo, which sends a move request
if you click anywhere on its surface.

* swaynag: die on all allocation failures

* sway/input: don't pass possibly invalid modifiers pointer

active_keyboard may be NULL, in which case an invalid pointer could be
passed to wlr_input_method_keyboard_grab_v2_send_modifiers. This
procedure call is unnecessary since wlroots commit 372a52ec "input
method: send modifiers in set_keyboard", so the call can simply be
removed.

Fixes #6836.

* sway/input: destroy sway_switch properly

Fix: #6861
Added seat_device_destroy function to seat_device_destroy function.

* commands/focus: fix segfault when no container is already focused.

Fixes #6690.

* Remove WLR_SWITCH_STATE_TOGGLE usage

Ref [1].

[1]: 4792446ee8

* Replace pcre with pcre2

Closes: https://github.com/swaywm/sway/issues/6838

* swaybar: remove swaybar_output.input_region

No need to keep the region around, we can immediately destroy it
after the wl_surface.set_input_region request.

* swaybar: set opaque region

When the background color is fully opaque, set the surface's opaque
region to the whole surface.

* Updating criteria checking with PCRE2

* swaynag: allocate button_details with details

They are used together, so it doesn't make sense to allocate them
separately.

* swaynag: statically allocate button_close, and move declaration

Every swaynag has a close button, so it doesn't make sense to
allocate it dynamically. The declaration is moved later to when
it is actually needed.

* swaynag: remove unnecessary zero of swaynag struct

Global variables are initialized to 0.

* swaynag: remove redundant status variables in main

Instead, we just use `status` for all failures.

* remove unnecessary strlen call

* sway/input/cursor: take device mm size from wlr_tablet

* sway/input/seat: take output name from specialized input device

* sway/input: follow up wlroots input device events renaming

* sway/input: fix bad position of wlr_drag

* sway/input: wlr_seat_keyboard() now takes wlr_keyboard

* bash-completion: localize variables

* sway/main: move constants off the stack

This makes stack traces from gdb slightly easier to read.

* Fix farsi label

* Avoid format-truncation warning

The existing code gives this error when compiled with GCC 12:

../sway/server.c: In function ‘server_init’:
../sway/server.c:217:75: error: ‘%d’ directive output may be truncated writing between 1 and 11 bytes into a region of size 8 [-Werror=format-truncation=]
  217 |                 snprintf(name_candidate, sizeof(name_candidate), "wayland-%d", i);
      |                                                                           ^~
../sway/server.c:217:66: note: directive argument in the range [-2147483647, 32]
  217 |                 snprintf(name_candidate, sizeof(name_candidate), "wayland-%d", i);
      |                                                                  ^~~~~~~~~~~~
../sway/server.c:217:17: note: ‘snprintf’ output between 10 and 20 bytes into a destination of size 16
  217 |                 snprintf(name_candidate, sizeof(name_candidate), "wayland-%d", i);
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Because i is never negative, this is a false positive, but it is easy to
change i to unsigned to silence the error.

* Shuffle variables to satisfy -Werror=restrict

This also fixes an invalid strlen invocation on uninitialized memory.

* layer_shell: keep output non-NULL wherever possible

Our layer shell implementation assigns every layer surface to an output
on creation. It tracks this output using the output field on the
underlying wlr_layer_surface_v1 structure. As such, much of the existing
code assumes that output is always non-NULL and omits NULL checks
accordingly.

However, there are currently two cases where we destroy a
sway_layer_surface and output is NULL. The first is when we can't find
an output to assign the surface to and destroy it immediately after
creation. The second is when we destroy a surface in response to its
output getting destroyed, as we set output to NULL in
handle_output_destroy() before we call wlr_layer_surface_v1_destroy(),
which is what calls the appropriate unmap and destroy callbacks.

The former case doesn't cause any problems, since we haven't even
allocated a sway_layer_surface at that point or registered any
callbacks. The latter case, however, currently triggers a crash (#6120)
if a popup is visible, since our popup_handle_unmap() implementation
can't handle a NULL output.

To fix this issue, keep output set until right before we free the
sway_layer_surface. All we need to do is remove some of the cleanup
logic from handle_output_destroy(), since as of commit c9060bcc12
("layer-shell: replace close() with destroy()") that same logic is
guaranteed to be happen later when wlroots calls handle_destroy() as
part of wlr_layer_surface_v1_destroy().

This lets us remove some NULL checks from other unmap/destroy callbacks,
which is nice. We also don't need to check that the wlr_output points to
a valid sway_output anymore, since we unset that pointer after disabling
the output as of commit a0bbe67076 ("Address emersions comments on
output re-enabling") Just to be safe, I've added assertions that the
wlr_output is non-NULL wherever we use it.

Fixes #6120.

* Chase wlroots X11 hints update

* Add Swedish README

* Support cursor capture in grimshot

Refactor argument parser

Bring back `sh` compatibility

Default to NOTIFY=no

* Update grimshot.1.scd

Fixed typo. The object is **files**, which is plural. **image** modifies files; it's not countable.

* xkb_switch_layout: fix relative layout switches

Fixes #6011

* Implement ext-session-lock-v1

* Avoid inspecting a NULL view in seat_set_focus

Fixes #6968

* swaynag: do error checking and rename read_from_stdin

read_from_stdin not only read from stdin, but trimming trailing
newlines, so rename it to reflect this.

* swaynag: improve robustness when loading config

* swaynag: combine consecutive declaration/assignments

* config: Remove unused mouse binding structure

Mouse bindings are handled alongside normal bindings. Remove the unused
separate data structure definition to avoid confusion.

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>

* Replace strncpy with memcpy

strncpy is useless here, is dangerous because it doesn't guarantee
that the string is NUL-terminated and causes the following warning:

    ../sway/criteria.c: In function ‘criteria_parse’:
    ../sway/criteria.c:712:25: error: ‘strncpy’ destination unchanged after copying no bytes [-Werror=stringop-truncation]
      712 |                         strncpy(value, valuestart, head - valuestart);
          |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Add descriptions for `stacking` and `tabbed` layouts

Resolves #5918

* man: Fix trailing spaces

* server: request xdg-shell v2

Wlroots does not yet support the newer xdg-shell versions and now
requires the compositor to set the supported xdg-shell version during
creation. Set this to v2 for sway as well.

Fixes https://github.com/swaywm/sway/issues/7001

* realtime: request SCHED_RR using CAP_SYS_NICE

Try to gain SCHED_RR (round-robin) realtime scheduling privileges before
starting the server. This requires CAP_SYS_NICE on Linux systems.
We additionally register a pthread_atfork callback which resets the
scheduling class back to SCHED_OTHER (the Linux system default).

Due to CAP_SYS_NICE, setting RLIMIT_RTPRIO has no effect on the process
as documented within man 7 sched (from Linux):

  Privileged (CAP_SYS_NICE) threads ignore the RLIMIT_RTPRIO limit;
  as with older kernels, they can make arbitrary changes to
  scheduling policy and priority. See getrlimit(2) for further
  information on RLIMIT_RTPRIO

Note that this requires the sway distribution packagers to set the
CAP_SYS_NICE capability on the sway binary.

Supersedes #6992

* ext-session-lock: disable direct scan-out when locked

* Polish the language in README.zh-CN.md & sync with English one

Co-Authored-By: Urey. Xue <urey.s.knowledge@gmail.com>

* De-duplicate IPC output descriptions

* Handle NULL output make/model/serial

* chore: chase wlroots xdg-shell update

* xdg-shell: schedule a configure on maximize request

This commit reverts 03879290dbee26127f6867ef60bc2a7f9a6c8c5f and
fc84bcb7fb0ffa29b1f9bed287762241a3473803.

* Add a Hindi (हिन्दी) translation to the README

Hindi is one of the most prominent languages of the Indian Subcontinent.
This commit adds the translation of the README into the Hindi language.
Some of the words are still written in English because there wasn't an
appropriate technical term of the word in the language.

Co-authored-by: Surendrajat <surendrajat@protonmail.com>

* sway: add bindgesture command

Co-authored-by: Michael Weiser <michael.weiser@gmx.de>

* build: link with -pthread

Fixes the following FreeBSD error:

    ld: error: undefined symbol: pthread_getschedparam
    >>> referenced by realtime.c:25 (../sway/realtime.c:25)
    >>>               sway/sway.p/realtime.c.o:(set_rr_scheduling)

Fixes: a3a82efbf6b5 ("realtime: request SCHED_RR using CAP_SYS_NICE")

* ipc: remove chatty debug log messages

These aren't particularly useful, and clobber the debug logs.

* Refuse to start when SUID is detected

This ensures that those surprised by the deprecation of SUID operation
receive an error rather than accidentally having sway run as root.

This detection will be removed in a future release.

* swaynag: move close_button up to fix SIGSEGV

When swaynag_parse_options encounters '--dismiss-button' (or its
shorthand '-s'), it sets the text of the first button in the
swaynag.buttons list, which is expected to exist and to be the dismiss
button, to the one passed by the user.

Commit 4780afb68b4ee2cdf0e4925f40cf885819f8a74a ("swaynag: statically
allocate button_close, and move declaration") moved the list
initialization to after swaynag_parse_options is called which made that
code fail.

For example, the command 'swaynag --dismiss-button Dismiss' crashes and
'swaynag --message Message --button Yes "" --dismiss-button Dismiss'
shows the wrong buttons.

Move it back to before swaynag_parse_options is called.

* config/output: use wlr_output_commit_state

This makes the code more robust because we don't potentially leave
bad state in wlr_output.pending behind anymore. This also fixes a
bug.

Closes: https://github.com/swaywm/sway/issues/7043
References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3610

* Allocate enough space for `cmd_results->error`

* Remove access to wlr_input_device union

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3626
Closes: https://github.com/swaywm/sway/issues/7077

* Rename dpms output command to power

The "dpms" command refers to VESA Display Power Management
Signaling, a deprecated standard. It's superseded by VESA DPM.

Instead of tying out command name to a particular standard, use the
neutral term "power".

* Strip quotes in bindsym --input-device=...

If the input device is quoted, which is common when using variables in the
config file, those quotes must be ignored here, or the input device will be
ignored.

Fixes #7029.

* Avoid unecessary string copy

* Reject font values that are invalid for pango

Use pango to parse font configuration early, and reject the command as
invalid if the value is invalid for pango. Since we're already parsing
the font into a `PangoFontDescription`, keep that instance around and
avoid re-parsing the font each time we render text.

Fixes: https://github.com/swaywm/sway/issues/6805

* Reuse parsed PangoFontDescription

Avoids parsing the configured font each time text is rendered.

* ipc: add "power" to output reply

* config.in: switch to `output power`

* Remove internal references to DPMS

While at it, use an int for the config field, just like we do for
all other fields.

* fix: remove redundant empty statement in main.c

This semi-colon looks like a typo. Luckily, it has no effect on the code as it's treated as an empty statement leading the switch case.

Really straightforward nitpick change, was just something I was confused by when reading over the code.

* input: chase delta_discrete semantics change

* swaymsg: fix floating_nodes being ignored

Fix floating_nodes being ignored in pretty_print_tree.

* ipc: make get_deco_rect check config->hide_lone_tab

Without this, the `IPC_GET_TREE` ipc call would return false information
about the container's `deco_rect` and `rect` properties if
`hide_edge_borders --i3` was in effect.

* grimshot: fix tilde expansion within quotes

* Enable single-pixel-buffer-v1

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3428

* sway-output.5: improve display of parameter

Since "width" and "height" are separate parameters, show them as such.

* man: sway(5) move fixes

* ipc: drop WLR_OUTPUT_ADAPTIVE_SYNC_UNKNOWN case

This has been removed from wlroots.

* config/output: test adaptive sync

Required for [1].

[1]: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3637

* Fix crash in xdg_activation_v1.c

wlr_xdg_surface_from_wlr_surface() can return a NULL pointer, so check for NULL before dereferencing it.

* sway: Add non-desktop-output type

Currently, when encountering a non-desktop display, sway offers the
output for leasing and returns without storing it in a sway specific
output type like `struct sway_output`.  Additionally, running
`swaymsg -t get_outputs` doesn't show non-desktop outputs.

This commit stores the non-desktop outputs into a struct called
`sway_output_non_desktop`, and adds them to a list on `sway_root`

* sway: add non-desktop outputs to json when running `swaymsg -t get_outputs`

* swaymsg: show non-desktop property when pretty printing outputs

* man: Add XWayland information

* ipc: expose mode picture aspect ratio

* swaymsg: show mode picture aspect ratio

* build: simplify protocol paths

No need for arrays here.

* sway/commands/output: Add command for unplugging non-physical outputs

* Improve Japanese translation

* allow pointer_constraints on layer_shell surfaces

* check for NULL

* use seat directly

* Use keyboard_state.focused_surface directly

* input: focus floating container when clicked on border

Fixes #7209.

* input: focus container when scrolling on titlebar

Fixes #6503.

* Fix leaks in criteria_destroy()

* Avoid double free in criteria_destroy()

* Add support for ext-idle-notify-v1

References: https://gitlab.freedesktop.org/wlroots/wlroots/-/merge_requests/3753

* input: tweak focus behavior to allow focusing parent containers

Sway focuses the inactive child when focusing split containers. However,
there is currently no way to focus the parent container itself by mouse.
A user must use the keyboard to do so.

This commit maintains the current behavior, but makes it such that a
second click on the split container titlebar (i.e., after its children
are visible) focuses the split container itself.

* Fix keymap being NULL and segfaulting on dev add

Moved `libinput_config` to the callers of
`sway_input_configure_libinput_device` so that we send the event after
the added event.

* Rework session lock keyboard focus handling

When removing outputs, it is possible to end up in a situation where
none of the session lock client's surfaces have keyboard focus,
resulting in it not receiving keyboard events.  Track the focused
surface and update it as needed on surface destroy.

* Fix focus tracking when session lock is active

Remove the incorrect attempt to block focus changes when an input grab
is present and replace it with the same logic used for layer_shell-based
screen lockers: restore the focus after changing it.

This fixes a use-after-free of seat->workspace if outputs are destroyed
while a screen lock is enabled.

* container_floating_set_default_size: Store workspace size box on the stack

* Support libinput's 1.21 new dwtp option

Support the new dwtp (disable while trackpointing) option introduced in
libinput 1.21, allowing users to control whether the trackpoint (like
those in Thinkpads, but not only) should be disabled while using the
keyboard/touchpad.

See: https://gitlab.freedesktop.org/libinput/libinput/-/issues/731

* tree: support formatting null titles

Any windows that have never had a title set visually behave closer to
that of an empty title, but are unformattable, as the code bails out
early on a NULL title.

* criteria: allow matching on empty (NULL) titles

* criteria: allow matching for NULL string criteria

* ci: install hwdata

* Use wl_signal_emit_mutable()

This function fixes segfaults when emitting a signal potentially
removes arbitrary listeners.

* Use wlr_damage_ring

wlr_output_damage is to be replaced with wlr_damage_ring, so use that.

* lock: fix crash on output destroy

Closes: https://github.com/swaywm/sway/issues/7120

* container_get_siblings: handle NULL workspace

* ci: checkout wlroots 0.16.0

* workspace_create: Don't allow NULL name

(cherry picked from commit 34933bb84350fe805d82276ea02d5732546e9993)

* output: set damage ring bounds to pixel values

Fixes: https://github.com/swaywm/sway/issues/7254
(cherry picked from commit 85005b52fe5b832e4ea914fa28048b0c5c803769)

* Use shm_open instead of mkstemp

shm_open is more reliable because it does not require
a writeable filesystem folder, unlike mkstemp.

(cherry picked from commit e2bc8866f46701e9c825ad7fa5baac02b2e4898f)

* build: drop wayland-scanner fallback

(cherry picked from commit 366f6ef3d31688631dc453028e108f98a1d7ab57)

* build: unify server & client protocol generation

No need to make a difference here, let's just generate header
files for both.

(cherry picked from commit 5be5a038da8a3789a19945719f2a27233291445d)

* build: drop "server" from target name for protocol code

(cherry picked from commit e5475d9310941ce88ed016ce1515b36e3a440252)

* build: drop intermediate libraries for protocols

(cherry picked from commit af8a5a8918ef42336194fb1077b008a736de7af9)

* root: move the workspace matching code to its own file

This removes the pid_workspace bits from tree/root before it gets
too interesting.

No functional change.

(cherry picked from commit eb5021ef990fb29ff86544aea58d687ad62c757a)

* node: prettify node type names

(cherry picked from commit 1c4b94ae3ca94b972410c80a61404a347af1ee68)

* launcher: track workspaces by node

This removes the need to rename the pid_workspaces when a workspace
is renamed.

It also opens the possibility of tracking other node types. Tracking
containers would allow application to be placed correctly in the
container tree even if the user has moved their focus elsewhere since
it was launched.

(cherry picked from commit 3b49f2782e8faf68766269b9c7390b16e25ae824)

* launcher: use xdga tokens

This reuses wlroots token tracking for workspace matching. It doesn't
export any xdga tokens for clients yet.

(cherry picked from commit bd66f4943da1c96edc3ba49573e27b42b688c543)

* launcher: rename pid_workspace to launcher_ctx

Soon we will match views with more than just a pid.

(cherry picked from commit d75c9f9722389d441fd24bd490c5cf12c4bef39a)

* view: associate launch contexts with views

Views now maintain a reference to a launch context which, as a last
resort, is populated at map time with a context associated with its pid.
This opens the possibility of populating it before map via another
source, e.g. xdga-tokens or configuration.

(cherry picked from commit 864b3a9a18f236f92f1898bb44ab977ceaebfd68)

* launcher: initialize launcher_ctxs once on startup

(cherry picked from commit 66568508c06267445489d655c91c94a34d6d9ffe)

* launcher: fudge the interface a bit

We want to create a context before knowing the pid it will match with.

(cherry picked from commit bdeb9f95651f6c99cc2f4cfb59020ddee202cf36)

* launcher: export xdga tokens and use them for workspace matching

(cherry picked from commit 30ad4dc4a5a41ce7c7aa85096a6e18f374172983)

* launcher: export X startup ids and use them for workspace matching

(cherry picked from commit 28fda4c0d38907fab94dc7d82c9dcf0754748b4e)

* swaybar: Prioritize hotspot events to bar bindings

This is consistent with i3bar's behaviour, and for example, allows binding a
command to button1, while still being able to click on tray icons or other
zones on the bar's status line which may have their own bindings.

E.g., in Sway, without this commit, this config. makes tray icons unclickable:

    bar {
        # ...
        bindsym button1 exec swaynag -m You_clicked_the_tray._Want_some_help?
    }

But the same configuration in i3 (with i3-nagbar) keeps tray items clickable.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
(cherry picked from commit 53f9dbd424dc173a85c9f4cd30802259d38b1ef4)

* swaybar: Make hotspots block bar release bindings

The previous commit prioritized hotspots before bar bindings for press events,
which matches i3's behaviour. However, since hotspots don't need to do any
processing on release events, those were not handled, and simply fell through
to `bindsym --release` bar bindings (if any).

This is counter-intuitive, and doesn't match i3's behaviour. Instead in case
a hotspot handles the press event, it should also handle the release event,
doing nothing, but blocking the event from triggering a --release bar binding.

E.g., in Sway, without this commit, this config. shows a text on tray clicks:

    bar {
        # ...
        bindsym --release button1 exec swaynag -m I_got_the_release_event.
    }

But the same configuration in i3 (with i3-nagbar) doesn't show the text.

Signed-off-by: Joan Bruguera <joanbrugueram@gmail.com>
(cherry picked from commit 94b69acf0d7b26ee5af2172300cb18473508da76)

* build: drop unused wayland-egl dependency

(cherry picked from commit 37e4a3d6370dc6ba2b0877d588845c06781e880e)

* build: bump version to 1.8-rc1

* Fix build on Debian Stable

(cherry picked from commit dca0bb5749bc16f91ab964fc1b06ebb9a453368f)

* build: fix have_xwayland when xcb-icccm is not found

xcb-icccm is required to build Xwayland support.

Backported from commit d41f11e6bd8cef80f02dda4c66d4a31611aed753.

* build: bump version to 1.8-rc2

* seat: Avoid sending redundant keymaps on reload

When we reload the config, we reset every input device and re-apply
configuration from the config file. This means that the keyboard keymap
is updated at least once during config reload, more if the config file
contains keyboard configuration.

When they keyboard keymap changes and is updated through wlr_seat, the
keymap ends up sent to every keyboard bound in every client, seemingly
multiple times. On an x230 of mine with a keyboard layout set in the
config file, I see 42 keymap events sent to foot on config reload.

Reduce events from keyboard configurations by skipping all but the
currently active keyboard for the seat, and by clearing the active
keyboard during input manager device reset. After this change, I only
see a single just-in-time keymap event.

Fixes: https://github.com/swaywm/sway/issues/6654

* criteria: be lenient on window_role and instance too

* build: bump version to 1.8-rc3

* commands/move: Warp cursor after moving workspace to another output

This makes sway's behavior consistent with i3 when `mouse_warping` is
set to any value besides `none`.

Fixes #7027.

(cherry picked from commit e3c63bf58d0744dfb436f0f38442ce3735e40f47)

* seat: Set keyboard if seat keyboard is NULL

sway sends wl_keyboard.enter on seat focus change and when a keyboard
active on a seat is configured. If all keyboards are removed and a
keyboard is added back without changing the focused client, no new
notify event would be sent despite having keyboard focus. This could
lead to key events without notify, which is a protocol violation.

As a quick fix, when configuring a keyboard on a seat where no keyboard
is currently active, activate the keyboard so that a focused surface
will receive a notify event.

Regressed by: e1b268af98edeb09e570e8855ef64f0719cbafe2
Closes: https://github.com/swaywm/sway/issues/7330

(cherry picked from commit 1ade0ce753dc5f588584f444ce80d27c3b1e4300)

* build: bump version to 1.8-rc4

* swaynag: fix NULL font description

The font description was only set if provided on the CLI. It was
left NULL for the defaults and when reading from the config file.

Closes: https://github.com/swaywm/sway/issues/7186
(cherry picked from commit fd0af78e43f4dd67a404f475c676b25ae38a4b82)

* build: bump version to 1.8

* Removed other README languages

* Fixed build issues

* Removed alpha from render_data struct

* Updated PKGBUILDs and COPR spec

* Update sway/desktop/render.c

Co-authored-by: Alexis Tacnet <alexistacnet@gmail.com>

* Fixed deco_data not being initialized properly

* Replaced wlr_egl_(make|unset)_current with eglMakeCurrent

* Added matrix_projection into fx_renderer

Signed-off-by: Michael Weiser <michael.weiser@gmx.de>
Co-authored-by: Sefa Eyeoglu <contact@scrumplex.net>
Co-authored-by: Simon Ser <contact@emersion.fr>
Co-authored-by: Seth Barberee <seth.barberee@gmail.com>
Co-authored-by: Thomas Hebb <tommyhebb@gmail.com>
Co-authored-by: Nathan Schulte <nmschulte@gmail.com>
Co-authored-by: xdavidwu <xdavidwuph@gmail.com>
Co-authored-by: David Rosca <nowrep@gmail.com>
Co-authored-by: David96 <david@hameipe.de>
Co-authored-by: Kenny Levinsen <kl@kl.wtf>
Co-authored-by: Aleksei Bavshin <alebastr89@gmail.com>
Co-authored-by: Kirill Chibisov <contact@kchibisov.com>
Co-authored-by: Tudor Brindus <me@tbrindus.ca>
Co-authored-by: Patrick Hilhorst <git@hilhorst.be>
Co-authored-by: Rouven Czerwinski <rouven@czerwinskis.de>
Co-authored-by: Tobias Bengfort <tobias.bengfort@posteo.de>
Co-authored-by: Ronan Pigott <rpigott@berkeley.edu>
Co-authored-by: Kirill Primak <vyivel@eclair.cafe>
Co-authored-by: Tuomas Yrjölä <mail@yrhki.fi>
Co-authored-by: Kirill Primak <vyivel@posteo.net>
Co-authored-by: Alexander Browne <elcste@users.noreply.github.com>
Co-authored-by: Marco Rubin <20150305+Rubo3@users.noreply.github.com>
Co-authored-by: Muhamed Hobi <woohoomoo2u@gmail.com>
Co-authored-by: Simon Zeni <simon@bl4ckb0ne.ca>
Co-authored-by: Nihal Jere <nihal@nihaljere.xyz>
Co-authored-by: Alexander Gramiak <agrambot@gmail.com>
Co-authored-by: Moon Sungjoon <sumoon@seoulsaram.org>
Co-authored-by: Nicolas Avrutin <nicolas@avrutin.net>
Co-authored-by: ndren <andreien@ctemplar.com>
Co-authored-by: Bill Li <billli11hkb@gmail.com>
Co-authored-by: Leonardo Hernández Hernández <leohdz172@protonmail.com>
Co-authored-by: Oğuz Ersen <oguz@ersen.moe>
Co-authored-by: Manuel Stoeckl <code@mstoeckl.com>
Co-authored-by: Yasin Silavi <59373143+sttatusx@users.noreply.github.com>
Co-authored-by: Daniel De Graaf <code@danieldg.net>
Co-authored-by: kraftwerk28 <kefirchik3@gmail.com>
Co-authored-by: Eskil <67291226+eschillus@users.noreply.github.com>
Co-authored-by: Alice Carroll <git@alice-carroll.pet>
Co-authored-by: Alan <51193876+Pound-Hash@users.noreply.github.com>
Co-authored-by: Victor Makarov <vitja.makarov@gmail.com>
Co-authored-by: Michael Weiser <michael.weiser@gmx.de>
Co-authored-by: -k <slowdive@me.com>
Co-authored-by: Hongyi <61831273+FrozenArcher@users.noreply.github.com>
Co-authored-by: Urey. Xue <urey.s.knowledge@gmail.com>
Co-authored-by: LordRishav <75823494+LordRishav@users.noreply.github.com>
Co-authored-by: Surendrajat <surendrajat@protonmail.com>
Co-authored-by: Florian Franzen <Florian.Franzen@gmail.com>
Co-authored-by: Greg Depoire--Ferrer <greg@gregdf.com>
Co-authored-by: Thomas Jost <schnouki@schnouki.net>
Co-authored-by: Hugo Osvaldo Barrera <hugo@barrera.io>
Co-authored-by: zkldi <ktchidev@gmail.com>
Co-authored-by: llyyr <llyyr.public@gmail.com>
Co-authored-by: Baltazár Radics <baltazar.radics@gmail.com>
Co-authored-by: Martin Michlmayr <tbm@cyrius.com>
Co-authored-by: Filip Szczepański <jazz2rulez@gmail.com>
Co-authored-by: Alex Maese <memaese@hotmail.com>
Co-authored-by: マリウス <marius@xn--gckvb8fzb.com>
Co-authored-by: Andri Yngvason <andri@yngvason.is>
Co-authored-by: ohno418 <yutaro.ono.418@gmail.com>
Co-authored-by: Ferdinand Schober <ferdinand.schober@fau.de>
Co-authored-by: cparm <armelcadetpetit@gmail.com>
Co-authored-by: Yaroslav de la Peña Smirnov <yps@yaroslavps.com>
Co-authored-by: Alexander Orzechowski <orzechowski.alexander@gmail.com>
Co-authored-by: pudiva chip líquida <pudiva@skylittlesystem.org>
Co-authored-by: Puck Meerburg <puck@puckipedia.com>
Co-authored-by: Callum Andrew <calcium@mailbox.org>
Co-authored-by: Ronan Pigott <ronan@rjp.ie>
Co-authored-by: Joan Bruguera <joanbrugueram@gmail.com>
Co-authored-by: nerdopolis <bluescreen_avenger@verizon.net>
Co-authored-by: Ankit Pandey <anpandey@protonmail.com>
Co-authored-by: Alexis Tacnet <alexistacnet@gmail.com>
2023-01-04 17:32:43 -05:00
Erik Reider
0365cc5d50
Rename .desktop name to SwayFX (#84) 2023-01-04 17:22:10 -05:00
Erik Reider
b9174c4692
Fixed top and bottom borders being to large (#81) 2023-01-02 16:17:00 -05:00
Will McKinnon
a6f60eeb31 feat: avoid rounding corners when there are no gaps 2022-12-28 15:20:11 -05:00
Will McKinnon
768be91e09 revert: temp removed smart gaps support due to bug 2022-12-25 13:40:07 -05:00
Will McKinnon
2342ded880 fix: only round top titlebar in stacked layout 2022-12-24 01:33:47 -05:00
Erik Reider
d1fc6f9d53
ver: bumped version to v0.1.1 (#65) 2022-12-11 20:54:28 -05:00
Will McKinnon
c0d490e3cb refactor: deduplicate vertex shaders 2022-12-11 14:59:11 -05:00
Erik Reider
2f3e039029
Fixed dim_inactive default value being set to 1.0f (#69) 2022-12-09 09:14:20 -05:00
316 changed files with 12806 additions and 10358 deletions

View file

@ -1,54 +0,0 @@
name: Package for the AUR
on:
release:
types: [published]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
aur-publish-stable:
runs-on: ubuntu-latest
steps:
- name: Check out sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Publish AUR Stable package
uses: ulises-jeremias/github-actions-aur-publish@v1
with:
pkgname: swayfx
pkgbuild: ./build-scripts/aur/PKGBUILD
assets: |
./build-scripts/aur/50-systemd-user.conf
./build-scripts/aur/sway.install
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Update AUR package
ssh_keyscan_types: rsa,dsa,ecdsa,ed25519
update_pkgver: false
aur-publish-git:
runs-on: ubuntu-latest
steps:
- name: Check out sources
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Publish AUR -git package
uses: ulises-jeremias/github-actions-aur-publish@v1
with:
pkgname: swayfx-git
pkgbuild: ./build-scripts/aur-git/PKGBUILD
assets: |
./build-scripts/aur-git/50-systemd-user.conf
./build-scripts/aur-git/sway.install
commit_username: ${{ secrets.AUR_USERNAME }}
commit_email: ${{ secrets.AUR_EMAIL }}
ssh_private_key: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
commit_message: Update AUR package
ssh_keyscan_types: rsa,dsa,ecdsa,ed25519
update_pkgver: false

View file

@ -1,29 +0,0 @@
name: Check git build for Arch.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
arch-build-git:
container: archlinux:latest
runs-on: ubuntu-latest
steps:
# It is necessary to checkout into sub-directory, because of some weird ownership problems cause by using containers
- name: Check out sources
uses: actions/checkout@v3
with:
fetch-depth: 0
path: swayfx
- name: Git makepkg build and check
id: makepkg
uses: edlanglois/pkgbuild-action@v1
with:
pkgdir: ./swayfx/build-scripts/aur-git

View file

@ -1,29 +0,0 @@
name: Check stable build for Arch.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
arch-build-stable:
container: archlinux:latest
runs-on: ubuntu-latest
steps:
# It is necessary to checkout into sub-directory, because of some weird ownership problems cause by using containers
- name: Check out sources
uses: actions/checkout@v3
with:
fetch-depth: 0
path: swayfx
- name: Stable makepkg build and check
id: makepkg
uses: edlanglois/pkgbuild-action@v1
with:
pkgdir: ./swayfx/build-scripts/aur

View file

@ -1,51 +0,0 @@
name: Check build for Fedora.
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
fedora-build:
container: fedora:37
runs-on: ubuntu-latest
steps:
- name: Install tooling for source RPM build
run: |
dnf -y install @development-tools @rpm-development-tools
dnf -y install rpkg git
dnf -y install 'dnf-command(builddep)'
# It is necessary to checkout into sub-directory, because of some weird ownership problems cause by using containers
- name: Check out sources
uses: actions/checkout@v3
with:
fetch-depth: 0
path: swayfx
- name: Copy spec into root dir
run: |
cd swayfx
cp ./build-scripts/swayfx.rpkg.spec ./
- name: Generate spec
run: |
cd swayfx
mkdir specs
rpkg spec --source --outdir specs
- name: Install build dependencies
run: |
cd swayfx
dnf -y builddep ./specs/swayfx.rpkg.spec
- name: Local build
run: |
cd swayfx
mkdir -p out
rpkg local --out `pwd`/out

View file

@ -1,86 +0,0 @@
name: Package for Fedora Copr repo
on:
release:
types: [published]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
fedora-copr:
container: fedora:latest
runs-on: ubuntu-latest
steps:
- name: Install API token for copr-cli
env:
# To generate a new token: https://copr.fedorainfracloud.org/api/.
API_LOGIN: ${{ secrets.COPR_API_LOGIN }}
API_USERNAME: ${{ secrets.COPR_API_USERNAME }}
API_TOKEN_CONTENT: ${{ secrets.COPR_API_TOKEN }}
run: |
mkdir -p "$HOME/.config"
# To generate a new token: https://copr.fedorainfracloud.org/api/.
echo "[copr-cli]" >> "$HOME/.config/copr"
echo "login = $API_LOGIN" >> "$HOME/.config/copr"
echo "username = $API_USERNAME" >> "$HOME/.config/copr"
echo "token = $API_TOKEN_CONTENT" >> "$HOME/.config/copr"
echo "copr_url = https://copr.fedorainfracloud.org" >> "$HOME/.config/copr"
- name: Install tooling for source RPM build
run: |
dnf -y install @development-tools @rpm-development-tools copr-cli rpkg git 'dnf-command(builddep)'
# It is necessary to checkout into sub-directory, because of some weird ownership problems cause by using containers
- name: Check out sources
uses: actions/checkout@v3
with:
fetch-depth: 0
path: swayfx
- name: Check out the latest tag
run: |
cp ./swayfx/build-scripts/swayfx.rpkg.spec ./
cd swayfx
git stash save "Action stashing changes"
latestTag=$(git describe --abbrev=0 --tags)
git checkout $latestTag
- name: Copy master spec into root dir
run: |
cd swayfx
cp ../swayfx.rpkg.spec ./
- name: Generate spec
run: |
cd swayfx
mkdir specs
rpkg spec --source --outdir specs
- name: Install build dependencies
run: |
cd swayfx
dnf -y builddep ./specs/swayfx.rpkg.spec
- name: Local build
run: |
cd swayfx
mkdir -p out
rpkg local --out `pwd`/out
- name: Test if installation of package is successful
run: |
cd swayfx/out
packages=(`rpmspec -q --nodebuginfo --qf \
"./%{ARCH}/%{Name}-%{Version}-%{Release}.%{ARCH}.rpm\n" \
../specs/swayfx.rpkg.spec`)
for i in "${packages[@]}"; do
dnf -y install "$i"
done
- name: Submit the build to copr
run: |
cd swayfx
rpkg -v copr-build -w ${{ secrets.COPR_REPO_NAME }}

2
.gitignore vendored
View file

@ -2,11 +2,11 @@ install_manifest.txt
*.swp
*.o
*.a
.cache/
bin/
test/
build/
build-*/
.cache/
!build-scripts
!build-scripts/*
.lvimrc

84
.gitlab-ci.yml Normal file
View file

@ -0,0 +1,84 @@
# Is performed before the scripts in the stages step
before_script:
- source /etc/profile
# Defines stages which are to be executed
stages:
- build
- upload
- release
.setup_script: &setup_scripts
- apt-get update
- apt-get -y build-dep .
- apt-get -y install hwdata libpixman-1-dev libdrm-dev libegl-dev libgles2-mesa-dev libegl1-mesa-dev dpkg-dev xwayland
- mkdir -p subprojects/scenefx
- wget -qO- 'https://github.com/wlrfx/scenefx/archive/refs/tags/0.1.tar.gz' | tar -xz --strip-components=1 -C subprojects/scenefx
- mkdir -p subprojects/scenefx/subprojects/wlroots
- wget -qO- 'https://gitlab.freedesktop.org/wlroots/wlroots/-/releases/0.17.3/downloads/wlroots-0.17.3.tar.gz' | tar -xz --strip-components=1 -C subprojects/scenefx/subprojects/wlroots
- sed -i 's/werror=true/werror=false/' meson.build
.compile: &compile
stage: compile
only:
- tags
script:
- *setup_scripts
- ls
- dpkg-buildpackage -b
- mkdir -p ./build/{release,debug}
- find ../ -name "*.deb" -not -name "*dbgsym*" -exec mv {} ./build/release/ \;
- find ../ -name "*dbgsym*.deb" -exec mv {} ./build/debug/ \;
artifacts:
paths:
- build/release/*
- build/debug/*
untracked: true
build:x86_64:
<<: *compile
stage: build
tags:
- x86_64
build:aarch64:
<<: *compile
stage: build
tags:
- aarch64
upload:
stage: upload
dependencies:
- build:x86_64
- build:aarch64
only:
- tags
script:
- find ./build/release -name "*.deb"
- debs=( $( find ./build/release -name "*.deb" ) )
- assets=""
- for d in ${debs[@]};do
- file=$( basename ${d} )
- url="${CI_API_V4_URL}/projects/${CI_PROJECT_ID}/packages/generic/swayfx/${CI_COMMIT_TAG}/${file}"
- assets="${assets} --assets-link {\"name\":\"${file}\",\"url\":\"${url}\",\"link_type\":\"other\"} "
- "curl --header \"JOB-TOKEN: $CI_JOB_TOKEN\" --upload-file \"${d}\" \"${url}\""
- done
- echo "ASSETS_ARG=${assets}" >> assets.env
artifacts:
reports:
dotenv: assets.env
tags:
- x86_64
release:
stage: release
image: registry.gitlab.com/gitlab-org/release-cli:latest
only:
- tags
script:
- echo "making release!"
- echo ${ASSETS_ARG}
- release-cli create --name "Release ${CI_COMMIT_TAG}" --tag-name "${CI_COMMIT_TAG}" ${ASSETS_ARG}
tags:
- x86_64

49
INSTALL-deb.md Normal file
View file

@ -0,0 +1,49 @@
## A guide to installing swayfx on Debian
( You may have to adapt this guide to install on other distros )
### First install all required dependencies and download the source code
```bash
sudo apt install meson wayland-protocols wayland libpcre2-dev libjson-c-dev libpango-1.0-0 libcairo2-dev wget
```
### Next setup the build enviroment
```bash
mkdir ~/build
cd ~/build # Or whatever you have named it
# Downloading Wlroots
wget https://gitlab.freedesktop.org/wlroots/wlroots/-/archive/0.16.2/wlroots-0.16.2.tar.gz
tar -xf wlroots-0.16.2.tar.gz
rm wlroots-0.16.2.tar.gz
# Downloaing Swayfx
wget https://github.com/WillPower3309/swayfx/archive/refs/tags/0.3.2.tar.gz
tar -xf 0.3.2.tar.gz
rm 0.3.2.tar.gz
```
swayfx and wlroots should now be located in the `build` directory.
```
.
├── swayfx-0.3.2
├── wlroots-0.16.2
```
___
### Compiling
You MUST compile wlroots first.
```bash
cd wlroots-0.16.2
meson setup build/
ninja -C build/
```
Now to compile swayfx.
```bash
cd swayfx-0.3.2
meson build/
ninja -C build/
sudo ninja -C build/ install
```
Reboot and then add the desired effects in your ~/.config/sway/config file <br/>
e.g. `blur enable|disable`
+ Guide created with ♥️ by babymusk

View file

@ -1,32 +1,83 @@
# SwayFX: A Beautiful Sway Fork
<p align="center">
<img src="assets/swayfx_logo.svg" width="256" alt="swayfx logo">
</p>
![](assets/swayfx_screenshot.jpg)
---
Sway is an incredible window manager, and certainly one of the most well established wayland window managers. However, it is restricted to only include the functionality that existed in i3. This fork ditches the simple wlr_renderer, and replaces it with our fx_renderer, capable of rendering with fancy GLES2 effects. This, along with a couple of minor changes, expands sway's featureset to include the following:
+ **Blur**
+ **Anti-aliased rounded corners, borders, and titlebars**
+ **Shadows**
+ **Dim unfocused windows**
+ **Per application saturation control**: Allows the user to set the saturation (Digital Vibrance) for specific applications. Great for some FPS games!
+ **Scratchpad treated as minimize**: Allows docks, or panels with a taskbar, to correctly interpret minimize / unminimize requests ([thanks to LCBCrion](https://github.com/swaywm/sway/issues/6457))
+ **Add a nix flake to the repo**: Allows nixos users to easily contribute to and test this project
+ **nixify the repo**: Allows nixos users to easily contribute to and test this project
<p align="center">
<a href="https://repology.org/project/swayfx/versions"><img src="https://repology.org/badge/vertical-allrepos/swayfx.svg" height="282"/></a>
<img src="assets/swayfx_screenshot.jpg" width="500"/>
</p>
[SwayFX is also available on the Fedora copr](https://copr.fedorainfracloud.org/coprs/swayfx/swayfx/)
[Join our Discord](https://discord.gg/qsSx397rkh)
## New Configuration Options
+ Window blur:
- `blur enable|disable`
- `blur_xray enable|disable`: this will set floating windows to blur based on the background, not the windows below. You probably want to set this to `disable` :)
- `blur_passes <integer value 0 - 10>`
- `blur_radius <integer value 0 - 10>`
- `blur_noise <float value 0 - 1>`
- `blur_brightness <float value 0 - 2>`
- `blur_contrast <float value 0 - 2>`
- `blur_saturation <float value 0 - 2>`
+ Corner radius: `corner_radius <val>`
+ Application saturation: `for_window [CRITERIA HERE] saturation <set|plus|minus> <val 0.0 <-> 2.0>`
+ Window shadows:
- `shadows enable|disable`
- `shadows_on_csd enable|disable` (**Note**: The shadow might not fit some windows)
- `shadow_blur_radius <integer value 0 - 99>`
- `shadow_color <hex color with alpha> ex, #0000007F`
- `shadow_offset <x offset> <y offset>`
- `shadow_inactive_color <hex color with alpha> ex, #0000007F`
+ LayerShell effects (to blur panels / notifications etc):
- `layer_effects <layer namespace> <effects>`
- The current layer namespaces can be shown with `swaymsg -r -t get_outputs | jq '.[0].layer_shell_surfaces | .[] | .namespace'`
- Example: `layer_effects "waybar" blur enable; shadows enable; corner_radius 6`
- Note: If an application uses gtk, its namespace is likely to be "gtk-layer-shell"
- SwayIPC Example: `swaymsg layer_effects "waybar" "blur enable"` (you can only set one effect at a time through `swaymsg`)
- Config Example:
```
layer_effects "waybar" {
blur enable;
blur_xray enable;
blur_ignore_transparent enable;
shadows enable;
corner_radius 20;
}
```
- Available Effects:
- `blur <enable|disable>`
- `blur_xray <enable|disable>`
- `blur_ignore_transparent <enable|disable>`
- `shadows <enable|disable>`
- `corner_radius <int>`
- `reset`: To reset/disable all previously applied effects to the layer application
+ Dim unfocused windows:
- `dim_inactive <float value 0.0 - 1.0>`
- `default_dim_inactive <float value 0.0 - 1.0>`
- `for_window [CRITERIA_HERE] dim_inactive <float value 0.0 - 1.0>`
- `dim_inactive_colors.unfocused <hex color> ex, #000000FF`
- `dim_inactive_colors.urgent <hex color> ex, #900000FF`
+ Keep/remove separator border between titlebar and content: `titlebar_separator enable|disable`
+ Treat Scratchpad as minimized: `scratchpad_minimize enable|disable`: **we recommend keeping this setting off, as there are many kinks to iron out here**
## Roadmap
+ fade in / out animations
+ window movement animations
+ drop shadows
+ blur
## Installation
## Compiling From Source
### Nix
@ -42,8 +93,11 @@ You can also bring up a development shell and follow the build instructions belo
```
nix develop
```
### Debian
Check [INSTALL-deb.md](/INSTALL-deb.md)
### Compiling from Source
### Manual Steps
Install dependencies:
@ -51,11 +105,13 @@ Install dependencies:
* wlroots
* wayland
* wayland-protocols \*
* pcre
* pcre2
* json-c
* pango
* cairo
* gdk-pixbuf2 (optional: system tray)
* [scenefx](https://github.com/wlrfx/scenefx)
* gdk-pixbuf2 (optional: additional image formats for system tray)
* [swaybg] (optional: wallpaper)
* [scdoc] (optional: man pages) \*
* git (optional: version info) \*
@ -77,10 +133,13 @@ SwayFX will drop root permissions shortly after startup.
SwayFX would love to receive any new features that you're willing to build! Generally, we'd like to focus on eye-candy type improvements to keep our scope appropriate. If you'd like to build something that you think may be out of that focus, please raise an issue and we can discuss whether or not it will fit within this project.
Here's a quick outline of where most of our changes lie vs the main sway repository:
+ `sway/desktop/render.c`: the file that handles calling `fx_renderer` to render to the screen, handles damage tracking and scaling
+ `sway/desktop/fx_renderer.c`: the meat and potatoes of this project, structured as similarly to wlr_renderer as possible
+ `sway/desktop/shaders`: where all of the shaders that fx_renderer uses live
## Acknowledgements
Please join our (for the time being very small) Discord server for development chatter! https://discord.gg/jVjjFdcN
The SwayFX team would like to first and foremost thank the maintainers and contributors of the Sway window manager. We are but a humble group of Sway enthusiasts who wanted to expand upon your creation.
We would also like to thank the talented artists in our community for contibuting the visual assets that give this project charm:
+ pkdesuwu and honchokomodo for creating the swayfx mascot: https://twitter.com/pkdesuwu/status/1664517033017368576
+ spooky_skeleton for the swayfx logo, and [Basil](https://basil.cafe) for making some fine adjustments to it
Lastly, we would like to thank you, the community, for enjoying and using window manager that we have spent so much time maintaining.

Binary file not shown.

After

Width:  |  Height:  |  Size: 169 KiB

191
assets/swayfx_logo.svg Normal file
View file

@ -0,0 +1,191 @@
<svg width="460" height="540" viewBox="0 0 460 540" fill="none" xmlns="http://www.w3.org/2000/svg">
<g filter="url(#filter0_dd_1507_417)">
<path d="M115.288 499.64C109.869 499.64 104.792 498.616 100.056 496.568C99.544 496.355 99.1173 496.013 98.776 495.544C98.4347 495.032 98.264 494.499 98.264 493.944C98.264 493.219 98.4987 492.6 98.968 492.088C99.48 491.533 100.12 491.256 100.888 491.256C101.315 491.256 101.72 491.341 102.104 491.512C106.029 493.261 110.232 494.136 114.712 494.136C122.179 494.136 125.912 491.683 125.912 486.776C125.912 485.496 125.421 484.429 124.44 483.576C123.501 482.723 122.328 482.061 120.92 481.592C119.512 481.08 117.507 480.483 114.904 479.8C111.448 478.904 108.653 478.051 106.52 477.24C104.387 476.387 102.552 475.128 101.016 473.464C99.48 471.8 98.712 469.581 98.712 466.808C98.712 464.376 99.352 462.179 100.632 460.216C101.912 458.211 103.789 456.632 106.264 455.48C108.781 454.285 111.789 453.688 115.288 453.688C119.981 453.688 124.227 454.392 128.024 455.8C129.219 456.227 129.816 457.08 129.816 458.36C129.816 459.043 129.581 459.661 129.112 460.216C128.643 460.771 128.024 461.048 127.256 461.048C127 461.048 126.659 460.963 126.232 460.792C122.904 459.64 119.469 459.064 115.928 459.064C112.557 459.064 109.805 459.704 107.672 460.984C105.581 462.264 104.536 464.056 104.536 466.36C104.536 467.896 105.027 469.155 106.008 470.136C107.032 471.075 108.291 471.821 109.784 472.376C111.32 472.888 113.389 473.443 115.992 474.04C119.363 474.851 122.072 475.661 124.12 476.472C126.211 477.283 127.981 478.541 129.432 480.248C130.925 481.955 131.672 484.259 131.672 487.16C131.672 489.549 130.989 491.704 129.624 493.624C128.259 495.501 126.339 496.973 123.864 498.04C121.389 499.107 118.531 499.64 115.288 499.64ZM147.159 499.32C146.306 499.32 145.538 499.064 144.855 498.552C144.172 498.04 143.703 497.4 143.447 496.632L134.359 470.008C134.231 469.624 134.167 469.261 134.167 468.92C134.167 468.109 134.444 467.427 134.999 466.872C135.554 466.317 136.236 466.04 137.047 466.04C137.644 466.04 138.178 466.211 138.647 466.552C139.159 466.851 139.5 467.256 139.671 467.768L147.159 492.408L154.583 468.344C154.796 467.661 155.18 467.107 155.735 466.68C156.332 466.253 156.994 466.04 157.719 466.04C158.444 466.04 159.084 466.253 159.639 466.68C160.236 467.107 160.642 467.661 160.855 468.344L168.279 492.408L175.767 467.768C175.938 467.256 176.258 466.851 176.727 466.552C177.239 466.211 177.794 466.04 178.391 466.04C179.202 466.04 179.884 466.317 180.439 466.872C180.994 467.427 181.271 468.109 181.271 468.92C181.271 469.261 181.207 469.624 181.079 470.008L171.991 496.632C171.735 497.4 171.266 498.04 170.583 498.552C169.9 499.064 169.132 499.32 168.279 499.32C167.426 499.32 166.658 499.064 165.975 498.552C165.292 498.04 164.802 497.379 164.503 496.568L157.719 475.384L150.935 496.568C150.636 497.379 150.146 498.04 149.463 498.552C148.78 499.064 148.012 499.32 147.159 499.32ZM196.064 499.64C194.186 499.64 192.437 499.256 190.816 498.488C189.237 497.72 187.978 496.611 187.04 495.16C186.101 493.667 185.632 491.96 185.632 490.04C185.632 486.883 186.869 484.365 189.344 482.488C191.861 480.611 195.53 479.672 200.352 479.672H208.096V479.16C208.096 476.344 207.392 474.317 205.984 473.08C204.618 471.843 202.464 471.224 199.52 471.224C197.898 471.224 196.448 471.352 195.168 471.608C193.93 471.864 192.544 472.248 191.008 472.76C190.666 472.845 190.389 472.888 190.176 472.888C189.536 472.888 188.981 472.653 188.512 472.184C188.042 471.715 187.808 471.139 187.808 470.456C187.808 469.304 188.362 468.493 189.472 468.024C193.098 466.488 196.789 465.72 200.544 465.72C203.488 465.72 205.962 466.317 207.968 467.512C210.016 468.707 211.509 470.264 212.448 472.184C213.429 474.061 213.92 476.109 213.92 478.328V496.44C213.92 497.251 213.621 497.933 213.024 498.488C212.469 499.043 211.786 499.32 210.976 499.32C210.165 499.32 209.482 499.043 208.928 498.488C208.373 497.933 208.096 497.251 208.096 496.44V494.776C204.938 498.019 200.928 499.64 196.064 499.64ZM198.24 494.52C200.117 494.52 201.93 494.072 203.68 493.176C205.429 492.237 206.901 491.085 208.096 489.72V484.344H201.12C194.677 484.344 191.456 486.029 191.456 489.4C191.456 490.936 191.968 492.173 192.992 493.112C194.058 494.051 195.808 494.52 198.24 494.52ZM230.415 514.04C229.647 514.04 228.985 513.763 228.431 513.208C227.919 512.653 227.663 511.992 227.663 511.224C227.663 510.883 227.727 510.541 227.855 510.2L232.015 499.512L219.983 470.2C219.812 469.773 219.727 469.368 219.727 468.984C219.727 468.173 220.004 467.491 220.559 466.936C221.113 466.339 221.796 466.04 222.607 466.04C223.204 466.04 223.737 466.211 224.207 466.552C224.719 466.893 225.081 467.32 225.295 467.832L235.151 492.28L245.199 467.96C245.753 466.68 246.649 466.04 247.887 466.04C248.697 466.04 249.38 466.339 249.935 466.936C250.489 467.491 250.767 468.173 250.767 468.984C250.767 469.368 250.703 469.731 250.575 470.072L233.103 512.056C232.505 513.379 231.609 514.04 230.415 514.04Z" fill="#49D1F8"/>
</g>
<g filter="url(#filter1_dd_1507_417)">
<path d="M275.784 489C275.784 488.872 275.784 488.744 275.848 488.552C273.928 488.936 272.072 489.384 270.216 489.832C268.68 490.152 267.144 490.536 265.608 490.984C265.224 491.048 264.904 491.304 264.584 491.432C263.304 491.688 262.088 491.944 260.872 491.56C260.808 491.56 260.744 491.56 260.744 491.56C260.424 491.304 260.168 491.048 259.848 490.792C260.104 490.472 260.296 490.088 260.616 489.96C262.792 488.744 265.16 488.04 267.592 487.4C270.408 486.696 273.288 485.992 276.168 485.288C276.552 485.16 276.744 484.968 276.872 484.584C277.32 482.536 277.896 480.488 278.28 478.44C278.472 477.672 278.344 476.776 278.216 475.944C277.192 470.376 273.928 466.664 268.68 464.616C265.736 463.464 262.728 462.824 259.656 462.184C257.928 461.8 256.2 461.288 254.472 460.776C253.896 460.648 253.384 460.328 252.936 459.944C251.912 459.176 251.656 458.088 252.36 457C252.936 456.168 253.64 455.4 254.408 454.76C256.84 452.84 259.592 451.432 262.344 450.152C268.936 447.016 275.848 444.648 282.888 442.6C291.784 439.912 300.808 437.736 309.896 436.008C317.704 434.536 325.448 433.192 333.256 431.784C334.344 431.592 335.432 431.336 336.52 431.08C336.904 431.016 337.224 430.824 337.608 430.696C339.336 429.928 341.064 429.864 342.856 430.632C343.88 431.144 343.88 431.784 343.176 432.744C342.536 433.64 341.704 433.64 340.744 433.704C339.848 433.832 338.952 434.152 338.056 434.344C333.64 435.112 329.224 435.88 324.808 436.648C309.448 439.208 294.28 442.216 279.432 447.016C273.992 448.808 268.488 450.728 263.368 453.352C261.64 454.248 260.04 455.336 258.376 456.36C257.928 456.68 257.544 457.128 257.224 457.512C256.52 458.408 256.712 459.112 257.736 459.432C258.952 459.88 260.168 460.2 261.384 460.456C264.648 461.288 267.976 461.992 271.176 463.272C273.736 464.296 276.232 465.576 278.088 467.688C278.856 468.584 279.496 469.608 280.2 470.632C280.456 469.736 280.712 468.776 280.904 467.816C282.376 462.184 283.72 456.488 285.576 450.92C285.96 449.832 286.472 448.68 286.92 447.592C287.24 446.568 288.008 446.12 288.968 446.12C289.736 446.12 290.568 446.184 291.272 446.376C292.296 446.696 292.488 447.144 292.296 448.168C291.848 450.28 291.4 452.392 290.952 454.568C290.696 455.592 290.568 456.616 290.312 457.64C289.992 459.048 289.544 460.456 289.224 461.928C287.624 468.904 286.088 475.88 284.488 482.856C284.424 482.984 284.424 483.176 284.36 483.368C284.872 483.304 285.32 483.176 285.768 483.112C288.776 482.536 291.72 481.96 294.728 481.448C296.072 481.192 297.416 481.192 298.76 481.576C299.208 481.768 299.72 482.024 300.104 482.344C300.616 482.792 300.616 483.304 300.04 483.752C299.784 483.944 299.528 484.136 299.272 484.264C296.904 485.416 294.536 486.376 291.976 486.696C290.632 486.888 289.288 486.888 288.072 486.184C287.944 486.12 287.752 486.12 287.56 486.184C286.344 486.376 285.128 486.632 283.912 486.888C283.72 486.952 283.528 487.144 283.464 487.336C281.992 493.224 280.52 499.112 279.112 505.064C278.792 506.344 278.6 507.624 278.28 508.904C277.64 511.144 276.296 513.064 275.08 515.048C274.888 515.368 274.376 515.624 273.928 515.688C272.904 515.944 271.944 515.816 270.984 515.304C270.6 515.112 270.344 514.856 270.472 514.344C271.88 507.624 273.224 500.84 274.632 494.056C274.952 492.328 275.4 490.664 275.784 489ZM326.957 480.744C326.445 479.912 325.997 479.08 325.485 478.184C324.845 478.888 324.269 479.592 323.693 480.232C317.869 487.144 312.365 494.312 307.309 501.8C306.221 503.4 305.389 505.128 304.429 506.856C304.429 506.92 304.365 506.984 304.365 507.048C303.981 507.496 302.701 507.688 301.869 507.304C301.229 507.048 300.909 506.472 301.165 505.768C301.421 504.872 301.741 504.04 302.125 503.272C304.685 498.6 307.181 493.928 310.189 489.64C313.453 484.968 317.101 480.616 320.749 476.264C321.389 475.496 322.029 474.728 322.733 473.96C323.053 473.64 323.053 473.384 322.861 473C320.685 468.52 318.701 463.976 317.357 459.24C316.781 457.192 316.269 455.08 315.885 453.032C315.565 451.304 316.077 450.728 317.741 450.6C318.061 450.6 318.317 450.6 318.637 450.6C319.661 450.664 320.429 451.112 320.813 452.2C322.157 455.912 323.565 459.624 325.037 463.272C325.677 464.936 326.381 466.6 327.085 468.2C327.149 468.392 327.213 468.52 327.341 468.712C327.597 468.392 327.789 468.2 328.045 467.944C335.597 459.432 343.853 451.496 352.237 443.816C354.477 441.832 356.589 439.848 358.829 437.864C360.685 436.328 362.861 435.752 365.293 436.328C366.957 436.776 367.021 437.8 366.125 439.08C365.677 439.848 364.909 440.424 364.269 441C359.021 445.608 353.773 450.216 348.525 454.824C342.125 460.584 336.045 466.664 330.157 473C329.453 473.768 329.453 473.448 329.965 474.408C335.085 484.584 340.845 494.376 347.885 503.336C349.037 504.872 350.189 506.408 351.341 507.944C351.789 508.456 351.661 508.776 351.021 508.968C349.997 509.224 349.037 509.096 348.205 508.264C339.885 500.072 332.589 491.048 326.957 480.744Z" fill="#FF7070"/>
</g>
<g filter="url(#filter2_dd_1507_417)">
<path d="M229.232 390.316L230.299 390.722L231.367 390.316L432.8 313.701V338.646L230.301 415.901L28 338.646V313.665L229.232 390.316Z" stroke="#FF7070" stroke-width="6"/>
</g>
<g filter="url(#filter3_dd_1507_417)">
<path d="M66.5 289.434C62.7345 290.794 58.9314 292.097 55.16 293.389C50.774 294.892 46.43 296.38 42.181 297.947C40.962 298.369 37.071 299.857 33.363 301.287L230.301 376.302L427.398 301.336C417.116 297.431 406.906 293.62 396.714 289.815C378.857 283.15 361.052 276.504 343.002 269.404L342.992 269.4C313.96 257.867 283.919 249.923 253.174 255.757C245.264 257.339 237.513 259.546 229.65 261.785C228.961 261.981 228.272 262.177 227.582 262.373C219.05 264.796 210.378 267.19 201.493 268.671L201.474 268.674L201.455 268.677C193.53 269.893 185.838 269.246 178.403 268.379C177.111 268.229 175.83 268.072 174.557 267.917C168.399 267.164 162.414 266.432 156.242 266.512C139.521 266.761 122.728 269.589 106.5 274.378" stroke="#F5E755" stroke-width="6" stroke-linecap="round"/>
</g>
<g filter="url(#filter4_dd_1507_417)">
<path d="M186.455 188.736C187.159 188.349 187.86 187.965 188.563 187.579C207.223 177.396 227.746 165.892 242.459 150.898C251.254 141.935 257.901 131.804 260.791 120L251.073 117C247.695 132.008 236.928 144.049 224.313 153.602C209.23 165.045 192.372 174.082 175.789 182.972L175.783 182.975L175.704 183.017C169.762 186.203 163.856 189.369 158.078 192.623C117.392 215.759 76.605 251.626 78.595 301.132C78.87 304.42 81.46 306.187 84.388 306.187C85.841 306.187 87.104 305.72 87.932 304.98C88.689 304.304 89.288 303.229 89.204 301.455L89.203 301.443C87.161 254.895 123.715 225.552 159.427 204.058C160.354 203.5 163 204.058 163 204.058C199.6 211.687 238.997 207.877 272.5 192.731L249.5 190.607C227.885 197.443 204.884 199.835 182.222 197.282C180.924 197.136 179.87 196.166 179.615 194.885C179.361 193.603 179.966 192.305 181.11 191.674C182.911 190.681 184.696 189.701 186.455 188.736Z" stroke="#FEDEDC" stroke-width="6" stroke-linejoin="round"/>
</g>
<g filter="url(#filter5_dd_1507_417)">
<path d="M258.177 47.973C252.162 50.673 246.09 53.167 239.968 55.682C238.658 56.22 237.346 56.759 236.031 57.301C228.599 60.366 221.125 63.522 213.783 67.116C211.358 68.297 208.326 69.991 205.009 71.846C204.329 72.225 203.638 72.612 202.937 73.002C198.761 75.327 194.159 77.839 189.465 80.063C184.763 82.292 180.055 84.189 175.681 85.314C171.277 86.447 167.461 86.731 164.416 85.999C163.059 85.658 161.842 85.108 161.121 84.507L161.028 84.43L160.93 84.361C159.252 83.177 158.253 81.222 158.038 78.831C157.822 76.42 158.44 73.796 159.747 71.698L159.761 71.674L159.775 71.651C162.102 67.758 166.125 63.75 170.814 60.072C175.466 56.423 180.586 53.243 184.901 50.965L184.913 50.958C196.538 44.752 208.65 39.73 221.148 35.99C222.596 35.569 224.039 35.145 225.479 34.723C236.493 31.488 247.298 28.316 258.401 27.197L258.416 27.195L258.431 27.194C261.326 26.872 267.423 26.828 272.629 28.046C275.243 28.657 277.355 29.524 278.732 30.606C279.998 31.602 280.558 32.684 280.502 34.094L280.501 34.135L280.5 34.175C280.489 35.057 279.977 36.236 278.413 37.723C276.878 39.182 274.673 40.603 272.119 41.943C268.586 43.797 264.966 45.23 261.993 46.408C260.537 46.985 259.236 47.5 258.177 47.973Z" stroke="#C7E133" stroke-width="6"/>
</g>
<g filter="url(#filter6_dd_1507_417)">
<path d="M389.71 76.516L390.083 76.265C392.8 74.437 395.722 72.465 398.535 70.44C401.352 68.412 404.008 66.367 406.196 64.405C408.422 62.408 409.983 60.655 410.79 59.232C412.739 55.784 411.898 52.084 408.781 48.435C405.631 44.747 400.553 41.719 395.715 40.407C385.786 37.722 375.207 37.265 364.398 37.709C357.435 37.996 350.552 38.641 343.709 39.283C339.838 39.646 335.981 40.008 332.129 40.303H332.125C308.736 42.065 284.825 50.104 263.934 59.999C263.119 60.423 262.33 60.819 261.56 61.205L256.484 63.919C250.793 67.157 245.838 70.557 242.166 74.678C236.743 81.094 235.556 86.226 236.371 90.213C237.206 94.303 240.319 98.067 245.348 101.301C255.444 107.793 271.605 111.042 283.846 110.416C285.729 110.319 287.621 110.202 289.52 110.065C290.985 109.959 292.312 110.93 292.654 112.36C292.665 112.409 292.678 112.458 292.691 112.508C294.263 117.829 299.155 122.194 304.922 124.057C310.84 125.969 317.441 125.916 324.113 125.518C348.176 123.939 371.949 118.316 394.144 109.044C394.155 109.039 394.166 109.034 394.177 109.03C394.187 109.026 394.197 109.022 394.207 109.018C398.721 107.252 402.432 105.467 405.227 102.452C407.812 99.224 408.756 95.346 407.322 92.464C406.41 90.681 404.774 89.417 402.499 88.555C400.193 87.681 397.434 87.305 394.697 87.21L394.67 87.209C390.951 87.047 387.255 87.235 383.539 87.619C382.173 87.76 380.887 86.957 380.414 85.668C379.941 84.38 380.403 82.935 381.536 82.16L389.71 76.516Z" stroke="#C7E133" stroke-width="6" stroke-linejoin="round"/>
</g>
<g filter="url(#filter7_dd_1507_417)">
<path d="M311.562 204.936C311.265 203.386 311.733 201.847 313.059 200.137C314.398 198.409 316.403 196.801 318.52 195.437C324.363 191.703 340.499 183.83 356.211 179.635C364.083 177.534 371.566 176.435 377.48 177.079C383.336 177.716 387.067 179.953 388.719 184.037C389.803 186.722 389.839 188.968 389.239 190.918C388.624 192.919 387.254 194.88 385.078 196.782C380.663 200.642 373.486 203.776 365.152 206.152C356.898 208.505 347.846 210.022 339.975 210.837C332.041 211.659 325.555 211.741 322.38 211.336L322.37 211.335L322.359 211.334C319.712 211.014 317.009 210.272 314.952 209.096C312.91 207.927 311.819 206.534 311.562 204.936Z" stroke="#C7E133" stroke-width="6"/>
</g>
<g filter="url(#filter8_dd_1507_417)">
<path d="M187.525 143.975C182.106 145.895 174.583 144.865 169.358 141.584C166.794 139.974 165.019 137.968 164.219 135.783C163.45 133.681 163.455 131.074 165.072 127.877C166.558 124.994 169.678 121.27 173.963 117.393C178.205 113.554 183.406 109.731 188.842 106.615C194.297 103.487 199.861 101.144 204.839 100.147C209.861 99.142 213.86 99.583 216.651 101.418L216.665 101.427L216.678 101.435C219.596 103.312 221.015 107.453 220.433 111.366C219.484 117.612 214.631 124.654 207.988 130.872C201.407 137.03 193.586 141.893 187.525 143.975Z" stroke="#C7E133" stroke-width="6"/>
</g>
<g filter="url(#filter9_dd_1507_417)">
<path d="M261.356 181.033C259.417 180.802 257.464 180.358 255.939 179.615C254.438 178.884 253.669 178.031 253.386 177.091C253.113 176.075 253.391 174.914 254.643 173.448C255.916 171.959 257.877 170.571 259.92 169.455C267.612 165.388 275.796 161.94 284.175 159.3C284.412 159.225 284.64 159.121 284.852 158.989C285.052 158.865 285.254 158.747 285.457 158.634C285.474 158.625 285.491 158.615 285.508 158.606C308.412 145.294 335.096 138.705 361.545 138.312C361.571 138.311 361.598 138.311 361.625 138.309C363.725 138.222 365.9 138.521 367.51 139.209C369.077 139.878 369.686 140.693 369.83 141.539C369.928 142.366 369.647 143.291 368.788 144.387C367.904 145.517 366.587 146.579 365.174 147.491L365.168 147.495C355.489 153.77 344.655 158.785 333.358 162.04C332.058 162.415 331.169 163.614 331.189 164.967C331.2 165.707 331.074 166.432 330.816 167.095C329.552 170.158 326.275 171.992 321.875 173.593L321.84 173.605C302.684 180.838 281.769 183.475 261.356 181.033Z" stroke="#C7E133" stroke-width="6" stroke-linejoin="round"/>
</g>
<g filter="url(#filter10_dd_1507_417)">
<path d="M147.692 120.75L147.731 120.889C148.017 121.825 147.93 122.941 147.37 124.322C146.805 125.716 145.837 127.173 144.676 128.614C138.353 136.251 127.33 143.121 117.173 143.312C113.983 143.31 111.862 142.908 110.564 142.373C109.308 141.855 109.12 141.356 109.076 141.201C109.002 140.94 108.963 140.229 109.694 138.89C110.408 137.582 111.695 135.993 113.626 134.225L113.635 134.216C113.813 134.052 114.006 133.873 114.212 133.683C117.839 130.325 125.598 123.142 133.118 118.827C137.17 116.502 140.592 115.348 143.016 115.553C144.114 115.646 144.956 116.011 145.65 116.676C146.381 117.377 147.148 118.606 147.692 120.75Z" stroke="#C7E133" stroke-width="6"/>
</g>
<defs>
<filter id="filter0_dd_1507_417" x="74.264" y="429.688" width="200.502" height="108.352" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="6"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.286275 0 0 0 0 0.819608 0 0 0 0 0.972549 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.286275 0 0 0 0 0.819608 0 0 0 0 0.972549 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
<filter id="filter1_dd_1507_417" x="227.656" y="405.864" width="163.365" height="134.08" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="4"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 0.439216 0 0 0 0 0.439216 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 0.439216 0 0 0 0 0.439216 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
<filter id="filter2_dd_1507_417" x="1" y="285.312" width="458.8" height="157.8" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="6"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 0.439216 0 0 0 0 0.439216 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 1 0 0 0 0 0.439216 0 0 0 0 0.439216 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
<filter id="filter3_dd_1507_417" x="0.980591" y="226.794" width="458.862" height="176.718" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="6"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.960784 0 0 0 0 0.905882 0 0 0 0 0.333333 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.960784 0 0 0 0 0.905882 0 0 0 0 0.333333 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
<filter id="filter4_dd_1507_417" x="51.5248" y="90" width="247.975" height="243.187" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="6"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.996078 0 0 0 0 0.870588 0 0 0 0 0.862745 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.996078 0 0 0 0 0.870588 0 0 0 0 0.862745 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
<filter id="filter5_dd_1507_417" x="130.996" y="0.000289917" width="176.51" height="113.402" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="6"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
<filter id="filter6_dd_1507_417" x="209.137" y="10.5606" width="229.698" height="142.181" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="6"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
<filter id="filter7_dd_1507_417" x="284.475" y="149.896" width="132.153" height="88.6769" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="6"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
<filter id="filter8_dd_1507_417" x="136.721" y="72.6216" width="110.838" height="99.3166" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="6"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
<filter id="filter9_dd_1507_417" x="226.287" y="111.294" width="170.562" height="97.6261" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="6"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
<filter id="filter10_dd_1507_417" x="82.0369" y="88.53" width="92.8538" height="81.7821" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">
<feFlood flood-opacity="0" result="BackgroundImageFix"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="6"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow_1507_417"/>
<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0" result="hardAlpha"/>
<feOffset/>
<feGaussianBlur stdDeviation="12"/>
<feColorMatrix type="matrix" values="0 0 0 0 0.780392 0 0 0 0 0.882353 0 0 0 0 0.2 0 0 0 1 0"/>
<feBlend mode="normal" in2="effect1_dropShadow_1507_417" result="effect2_dropShadow_1507_417"/>
<feBlend mode="normal" in="SourceGraphic" in2="effect2_dropShadow_1507_417" result="shape"/>
</filter>
</defs>
</svg>

After

Width:  |  Height:  |  Size: 28 KiB

BIN
assets/swayfx_mascot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 936 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 KiB

After

Width:  |  Height:  |  Size: 147 KiB

View file

@ -1,7 +0,0 @@
# sway does not set DISPLAY/WAYLAND_DISPLAY in the systemd user environment
# See FS#63021
# Adapted from xorg's 50-systemd-user.sh, which achieves a similar goal.
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP

View file

@ -1,78 +0,0 @@
# Maintainer: Erik Reider <erik.reider@protonmail.com>
_pkgname=swayfx
pkgname="$_pkgname-git"
pkgver=r6905.e2ef3ceb
pkgrel=1
license=("MIT")
pkgdesc="SwayFX: Sway, but with eye candy!"
makedepends=(
"git"
"meson"
"scdoc"
"wayland-protocols"
)
depends=(
"cairo"
"gdk-pixbuf2"
"libevdev.so"
"libinput"
"libjson-c.so"
"libudev.so"
"libwayland-server.so"
"libwlroots.so"
"libxcb"
"libxkbcommon.so"
"pango"
"pcre"
"ttf-font"
"wlroots<0.16"
)
optdepends=(
"alacritty: Terminal emulator used by the default config"
"dmenu: Application launcher"
"grim: Screenshot utility"
"i3status: Status line"
"mako: Lightweight notification daemon"
"slurp: Select a region"
"swayidle: Idle management daemon"
"swaylock: Screen locker"
"wallutils: Timed wallpapers"
"waybar: Highly customizable bar"
)
backup=(etc/sway/config)
arch=("i686" "x86_64")
url="https://github.com/WillPower3309/swayfx"
source=("${pkgname%-*}::git+${url}.git"
50-systemd-user.conf)
sha512sums=(
"SKIP"
"c2b7d808f4231f318e03789015624fd4cf32b81434b15406570b4e144c0defc54e216d881447e6fd9fc18d7da608cccb61c32e0e1fab2f1fe2750acf812d3137")
provides=("sway" "swayfx")
conflicts=("sway" "swayfx")
options=(debug)
install=sway.install
pkgver() {
cd "$_pkgname"
printf "r%s.%s" "$(git rev-list --count HEAD)" "$(git rev-parse --short HEAD)"
}
build() {
arch-meson \
-Dsd-bus-provider=libsystemd \
-Dwerror=false \
"$_pkgname" build
meson compile -C build
}
package() {
install -Dm644 50-systemd-user.conf -t "$pkgdir/etc/sway/config.d/"
DESTDIR="$pkgdir" meson install -C build
cd "$_pkgname"
install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
for util in autoname-workspaces.py inactive-windows-transparency.py grimshot; do
install -Dm755 "contrib/$util" -t "$pkgdir/usr/share/$pkgname/scripts"
done
}

View file

@ -1,31 +0,0 @@
post_install() {
cat << EOD
Sway requires additional setup for privilege escalation. Without this setup,
sway will fail to start with session activation permission failures. Choose one
of the two available options (In alphabetical, not recommended, order):
1. polkit: This will make sway "just work" right after installation but may be
a weightier solution than desired.
2. seatd: Already required as a sway dependency, this is a lighter-weight
solution but requires some user configuration: Enabling the service,
adding your user to the "seat" group, then logging out/in again.
Either option should provide the same functionality/stability. Refer to the
Sway wiki page for information.
EOD
}
post_upgrade() {
cat << EOD
Sway's necessary privileges can now be obtained through seatd as well as the
incumbent polkit package. As such, polkit has been relegated to an optional
dependency.
Note that using seatd instead of polkit means that a user must be a part of the
"seat" group: Otherwise, the user will not be able to achieve the appropriate
privileged actions.
For more information, refer to the Sway wiki page.
EOD
}

View file

@ -1,7 +0,0 @@
# sway does not set DISPLAY/WAYLAND_DISPLAY in the systemd user environment
# See FS#63021
# Adapted from xorg's 50-systemd-user.sh, which achieves a similar goal.
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP
exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK XDG_CURRENT_DESKTOP

View file

@ -1,73 +0,0 @@
# Maintainer: Erik Reider <erik.reider@protonmail.com>
_pkgname=swayfx
pkgname="$_pkgname"
pkgver=0.1
pkgrel=1
license=("MIT")
pkgdesc="SwayFX: Sway, but with eye candy!"
makedepends=(
"git"
"meson"
"scdoc"
"wayland-protocols"
)
depends=(
"cairo"
"gdk-pixbuf2"
"libevdev.so"
"libinput"
"libjson-c.so"
"libudev.so"
"libwayland-server.so"
"libwlroots.so"
"libxcb"
"libxkbcommon.so"
"pango"
"pcre"
"ttf-font"
"wlroots<0.16"
)
optdepends=(
"alacritty: Terminal emulator used by the default config"
"dmenu: Application launcher"
"grim: Screenshot utility"
"i3status: Status line"
"mako: Lightweight notification daemon"
"slurp: Select a region"
"swayidle: Idle management daemon"
"swaylock: Screen locker"
"wallutils: Timed wallpapers"
"waybar: Highly customizable bar"
)
backup=(etc/sway/config)
arch=("i686" "x86_64")
url="https://github.com/WillPower3309/swayfx"
source=("${_pkgname}-${pkgver}.tar.gz::${url}/archive/refs/tags/$pkgver.tar.gz"
50-systemd-user.conf)
sha512sums=(
"SKIP"
"c2b7d808f4231f318e03789015624fd4cf32b81434b15406570b4e144c0defc54e216d881447e6fd9fc18d7da608cccb61c32e0e1fab2f1fe2750acf812d3137")
provides=("sway" "swayfx")
conflicts=("sway" "swayfx")
options=(debug)
install=sway.install
build() {
arch-meson \
-Dsd-bus-provider=libsystemd \
-Dwerror=false \
"${_pkgname}-${pkgver}" build
meson compile -C build
}
package() {
install -Dm644 50-systemd-user.conf -t "$pkgdir/etc/sway/config.d/"
DESTDIR="$pkgdir" meson install -C build
cd "${_pkgname}-${pkgver}"
install -Dm644 "LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
for util in autoname-workspaces.py inactive-windows-transparency.py grimshot; do
install -Dm755 "contrib/$util" -t "$pkgdir/usr/share/$pkgname/scripts"
done
}

View file

@ -1,31 +0,0 @@
post_install() {
cat << EOD
Sway requires additional setup for privilege escalation. Without this setup,
sway will fail to start with session activation permission failures. Choose one
of the two available options (In alphabetical, not recommended, order):
1. polkit: This will make sway "just work" right after installation but may be
a weightier solution than desired.
2. seatd: Already required as a sway dependency, this is a lighter-weight
solution but requires some user configuration: Enabling the service,
adding your user to the "seat" group, then logging out/in again.
Either option should provide the same functionality/stability. Refer to the
Sway wiki page for information.
EOD
}
post_upgrade() {
cat << EOD
Sway's necessary privileges can now be obtained through seatd as well as the
incumbent polkit package. As such, polkit has been relegated to an optional
dependency.
Note that using seatd instead of polkit means that a user must be a part of the
"seat" group: Otherwise, the user will not be able to achieve the appropriate
privileged actions.
For more information, refer to the Sway wiki page.
EOD
}

View file

@ -1,156 +0,0 @@
# vim: syntax=spec
### CHANGE THESE VARIABLES BEFORE RELEASE:
# Change to current Sway base version!
%global SwayBaseVersion 1.7
# Change to current SwayFX tag!
%global Tag 0.1
Name: {{{ git_dir_name }}}
Version: %{Tag}
Release: 2%{?dist}
Summary: SwayFX: Sway, but with eye candy!
License: MIT
URL: https://github.com/WillPower3309/swayfx
VCS: {{{ git_dir_vcs }}}
Source: {{{ git_dir_pack }}}
BuildRequires: gcc-c++
BuildRequires: gnupg2
BuildRequires: meson >= 0.60.0
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(gdk-pixbuf-2.0)
BuildRequires: pkgconfig(json-c) >= 0.13
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(libevdev)
BuildRequires: pkgconfig(libinput) >= 1.6.0
BuildRequires: pkgconfig(libpcre)
BuildRequires: pkgconfig(libsystemd) >= 239
BuildRequires: pkgconfig(libudev)
BuildRequires: pkgconfig(pango)
BuildRequires: pkgconfig(pangocairo)
BuildRequires: pkgconfig(scdoc)
BuildRequires: pkgconfig(wayland-client)
BuildRequires: pkgconfig(wayland-cursor)
BuildRequires: pkgconfig(wayland-egl)
BuildRequires: pkgconfig(wayland-server) >= 1.20.0
BuildRequires: pkgconfig(wayland-protocols) >= 1.24
BuildRequires: (pkgconfig(wlroots) >= 0.15.0 with pkgconfig(wlroots) < 0.16)
BuildRequires: pkgconfig(xcb)
BuildRequires: pkgconfig(xkbcommon)
# Dmenu is the default launcher in sway
Recommends: dmenu
# In addition, xargs is recommended for use in such a launcher arrangement
Recommends: findutils
# Install configs and scripts for better integration with systemd user session
Recommends: sway-systemd
Requires: swaybg
Recommends: swayidle
Recommends: swaylock
# By default the Fedora background is used
Recommends: desktop-backgrounds-compat
# Lack of graphical drivers may hurt the common use case
Recommends: mesa-dri-drivers
# Minimal installation doesn't include Qt Wayland backend
Recommends: (qt5-qtwayland if qt5-qtbase-gui)
Recommends: (qt6-qtwayland if qt6-qtbase-gui)
# dmenu (as well as rxvt any many others) requires XWayland on Sway
Requires: xorg-x11-server-Xwayland
# Sway binds the terminal shortcut to one specific terminal. In our case foot
Recommends: foot
# grim is the recommended way to take screenshots on sway 1.0+
Recommends: grim
%{?systemd_requires}
Conflicts: sway
Provides: sway = %{SwayBaseVersion}
%description
SwayFX: Sway, but with eye candy!
# The artwork is heavy and we don't use it with our default config
%package wallpapers
Summary: Wallpapers for Sway
BuildArch: noarch
License: CC0
%description wallpapers
Wallpaper collection provided with Sway
%package -n grimshot
Summary: Helper for screenshots within sway
Requires: grim
Requires: jq
Requires: slurp
Requires: /usr/bin/wl-copy
Recommends: /usr/bin/notify-send
%description -n grimshot
Grimshot is an easy to use screenshot tool for sway. It relies on grim,
slurp and jq to do the heavy lifting, and mostly provides an easy to use
interface.
%prep
{{{ git_dir_setup_macro }}}
%build
%meson \
-Dsd-bus-provider=libsystemd \
-Dwerror=false
%meson_build
%install
%meson_install
# Set Fedora background as default background
sed -i "s|^output \* bg .*|output * bg /usr/share/backgrounds/default.png fill|" %{buildroot}%{_sysconfdir}/sway/config
# Create directory for extra config snippets
install -d -m755 -pv %{buildroot}%{_sysconfdir}/sway/config.d
# install python scripts from contrib
install -D -m644 -pv -t %{buildroot}%{_datadir}/sway/contrib contrib/*.py
# install contrib/grimshot tool
scdoc <contrib/grimshot.1.scd >%{buildroot}%{_mandir}/man1/grimshot.1
install -D -m755 -pv contrib/grimshot %{buildroot}%{_bindir}/grimshot
%files
%license LICENSE
%doc README.md
%dir %{_sysconfdir}/sway
%dir %{_sysconfdir}/sway/config.d
%config(noreplace) %{_sysconfdir}/sway/config
%{_mandir}/man1/sway*
%{_mandir}/man5/*
%{_mandir}/man7/*
%{_bindir}/sway
%{_bindir}/swaybar
%{_bindir}/swaymsg
%{_bindir}/swaynag
%{_datadir}/sway
%{_datadir}/wayland-sessions/sway.desktop
%dir %{_datadir}/zsh
%dir %{_datadir}/zsh/site-functions
%{_datadir}/zsh/site-functions/_sway*
%dir %{_datadir}/bash-completion
%dir %{_datadir}/bash-completion/completions
%{_datadir}/bash-completion/completions/sway*
%dir %{_datadir}/fish
%dir %{_datadir}/fish/vendor_completions.d
%{_datadir}/fish/vendor_completions.d/sway*
%files wallpapers
%license assets/LICENSE
%{_datadir}/backgrounds/sway
%files -n grimshot
%{_bindir}/grimshot
%{_mandir}/man1/grimshot.1*
# Changelog will be empty until you make first annotated Git tag.
%changelog
{{{ git_dir_changelog }}}

7
build.sh Executable file
View file

@ -0,0 +1,7 @@
#!/bin/bash
apt-get update
apt-get -y build-dep .
mkdir -p subprojects/scenefx
wget -qO- 'https://github.com/wlrfx/scenefx/archive/refs/tags/0.2.1.tar.gz' | tar -xz --strip-components=1 -C subprojects/scenefx
dpkg-buildpackage -b

View file

@ -1,50 +1,42 @@
#define _POSIX_C_SOURCE 200809
#include <assert.h>
#include <cairo.h>
#include <errno.h>
#include <fcntl.h>
#include <pango/pangocairo.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/mman.h>
#include <time.h>
#include <unistd.h>
#include <wayland-client.h>
#include "config.h"
#include "pool-buffer.h"
#include "util.h"
static int create_pool_file(size_t size, char **name) {
static const char template[] = "sway-client-XXXXXX";
const char *path = getenv("XDG_RUNTIME_DIR");
if (path == NULL) {
fprintf(stderr, "XDG_RUNTIME_DIR is not set\n");
return -1;
}
static int anonymous_shm_open(void) {
int retries = 100;
size_t name_size = strlen(template) + 1 + strlen(path) + 1;
*name = malloc(name_size);
if (*name == NULL) {
fprintf(stderr, "allocation failed\n");
return -1;
}
snprintf(*name, name_size, "%s/%s", path, template);
do {
// try a probably-unique name
struct timespec ts;
clock_gettime(CLOCK_MONOTONIC, &ts);
pid_t pid = getpid();
char name[50];
snprintf(name, sizeof(name), "/sway-%x-%x",
(unsigned int)pid, (unsigned int)ts.tv_nsec);
int fd = mkstemp(*name);
if (fd < 0) {
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;
}
if (!sway_set_cloexec(fd, true)) {
close(fd);
return -1;
}
--retries;
} while (retries > 0 && errno == EEXIST);
if (ftruncate(fd, size) < 0) {
close(fd);
return -1;
}
return fd;
return -1;
}
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;
size_t size = stride * height;
char *name;
int fd = create_pool_file(size, &name);
assert(fd != -1);
int fd = anonymous_shm_open();
if (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);
struct wl_shm_pool *pool = wl_shm_create_pool(shm, fd, size);
buf->buffer = wl_shm_pool_create_buffer(pool, 0,
width, height, stride, format);
wl_shm_pool_destroy(pool);
close(fd);
unlink(name);
free(name);
buf->size = size;
buf->width = width;

332
common/gesture.c Normal file
View 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;
}

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <stdio.h>
#include <stdint.h>
#include <stdlib.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200112L
#include <signal.h>
#include <stdarg.h>
#include <stdio.h>

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200112L
#include <limits.h>
#include <string.h>
#include <stdbool.h>

View file

@ -1,8 +1,8 @@
lib_sway_common = static_library(
'sway-common',
files(
'background-image.c',
'cairo.c',
'gesture.c',
'ipc-client.c',
'log.c',
'loop.c',
@ -13,7 +13,6 @@ lib_sway_common = static_library(
),
dependencies: [
cairo,
gdk_pixbuf,
pango,
pangocairo,
wayland_client.partial_dependency(compile_args: true)

View file

@ -50,9 +50,11 @@ size_t escape_markup_text(const char *src, char *dest) {
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) {
PangoLayout *layout = pango_cairo_create_layout(cairo);
pango_context_set_round_glyph_positions(pango_layout_get_context(layout), false);
PangoAttrList *attrs;
if (markup) {
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));
PangoFontDescription *desc = pango_font_description_from_string(font);
pango_layout_set_font_description(layout, desc);
pango_layout_set_single_paragraph_mode(layout, 1);
pango_layout_set_attributes(layout, attrs);
pango_attr_list_unref(attrs);
pango_font_description_free(desc);
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, ...) {
va_list args;
va_start(args, fmt);
// Add one since vsnprintf excludes null terminator.
int length = vsnprintf(NULL, 0, fmt, args) + 1;
char *buf = vformat_str(fmt, args);
va_end(args);
char *buf = malloc(length);
if (buf == NULL) {
sway_log(SWAY_ERROR, "Failed to allocate memory");
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_layout_get_pixel_size(layout, width, height);
if (baseline) {
*baseline = pango_layout_get_baseline(layout) / PANGO_SCALE;
}
g_object_unref(layout);
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);
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.
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;
pango_font_metrics_unref(metrics);
pango_font_description_free(description);
g_object_unref(pango);
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, ...) {
va_list args;
va_start(args, fmt);
// Add one since vsnprintf excludes null terminator.
int length = vsnprintf(NULL, 0, fmt, args) + 1;
char *buf = vformat_str(fmt, args);
va_end(args);
char *buf = malloc(length);
if (buf == NULL) {
sway_log(SWAY_ERROR, "Failed to allocate memory");
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_get_font_options(cairo, 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_show_layout(cairo, layout);
g_object_unref(layout);
free(buf);
}

View file

@ -1,5 +1,5 @@
#define _POSIX_C_SOURCE 200809L
#include <ctype.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
@ -328,3 +328,35 @@ bool expand_path(char **path) {
wordfree(&p);
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;
}

View file

@ -1,4 +1,3 @@
#define _POSIX_C_SOURCE 200809L
#include <ctype.h>
#include <fcntl.h>
#include <math.h>

View file

@ -2,7 +2,7 @@
_sway()
{
local cur prev
local cur prev short long
_get_comp_words_by_ref cur prev
short=(

View file

@ -2,7 +2,7 @@
_swaybar()
{
local cur prev
local cur prev short long
_get_comp_words_by_ref cur prev
short=(

View file

@ -2,7 +2,7 @@
_swaymsg()
{
local cur prev
local cur prev types short long
_get_comp_words_by_ref cur prev
types=(

57
completions/meson.build Normal file
View 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

View file

@ -16,18 +16,7 @@ set $right l
# Your preferred terminal emulator
set $term foot
# Your preferred application launcher
# Note: pass the final command to swaymsg so that the resulting window can be opened
# on the original workspace that the command was run on.
set $menu dmenu_path | dmenu | xargs swaymsg exec --
### Appearance
# window corner radius in px
corner_radius 10
# inactive window fade amount. 0.0 = no dimming, 1.0 = fully dimmed
dim_inactive 0.0
dim_inactive_colors.unfocused #000000FF
dim_inactive_colors.urgent #900000FF
set $menu wmenu-run
### Output configuration
#
@ -46,7 +35,7 @@ output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
#
# exec swayidle -w \
# 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'
#
# This will lock your screen after 300 seconds of inactivity, then turn off
@ -204,6 +193,19 @@ mode "resize" {
bindsym Escape mode "default"
}
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:
@ -214,7 +216,7 @@ bar {
# When the status_command prints a new line to stdout, swaybar updates.
# 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 {
statusline #ffffff

View file

@ -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()

View file

@ -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

View file

@ -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)

View file

@ -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)

View file

@ -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
debian/.pc/.quilt_patches vendored Normal file
View file

@ -0,0 +1 @@
patches

1
debian/.pc/.quilt_series vendored Normal file
View file

@ -0,0 +1 @@
series

1
debian/.pc/.version vendored Normal file
View file

@ -0,0 +1 @@
2

6
debian/README.Debian vendored Normal file
View file

@ -0,0 +1,6 @@
swayfx for Debian
----------------
<Possible notes regarding this package - if none, delete this file.>
-- Penelope Gwen <support@pogmom.me> Mon, 22 Apr 2024 19:41:11 -0600

10
debian/README.source vendored Normal file
View file

@ -0,0 +1,10 @@
swayfx for Debian
----------------
<This file describes information about the source package, see Debian policy
manual section 4.14. You WILL either need to modify or delete this file.>
-- Penelope Gwen <support@pogmom.me> Mon, 22 Apr 2024 19:41:11 -0600

23
debian/changelog vendored Normal file
View file

@ -0,0 +1,23 @@
swayfx (0.5-1) unstable; urgency=medium
* new upstream release
-- Penelope Gwen <support@pogmom.me> Tue, 25 Feb 2025 23:12:07 +0000
swayfx (0.4-2) unstable; urgency=medium
* built on cleaner source
-- Penelope Gwen <support@pogmom.me> Sat, 15 Jun 2024 15:13:48 -0600
swayfx (0.4-1) unstable; urgency=medium
* new upstream release
-- Penelope Gwen <support@pogmom.me> Wed, 22 May 2024 17:24:28 -0600
swayfx (0.3.2-1) unstable; urgency=medium
* Compiled deb from upstream source
-- Penelope Gwen <support@pogmom.me> Mon, 22 Apr 2024 19:41:11 -0600

View file

@ -0,0 +1 @@
output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill

9
debian/config.d/50-systemd-user.conf vendored Normal file
View file

@ -0,0 +1,9 @@
# import variables into system-user enviroment
# based on the instructions in the sway wiki
# see also https://github.com/swaywm/sway/issues/5732
# and https://github.com/systemd/systemd/blob/dfc637d0ff756889e8e5b7cb4ec991eb06069aa1/xorg/50-systemd-user.sh
exec systemctl --user import-environment DISPLAY WAYLAND_DISPLAY SWAYSOCK
exec hash dbus-update-activation-environment 2>/dev/null && \
dbus-update-activation-environment --systemd DISPLAY WAYLAND_DISPLAY SWAYSOCK

71
debian/control vendored Normal file
View file

@ -0,0 +1,71 @@
Source: swayfx
Section: x11
Priority: optional
Maintainer: Penelope Gwen <support@pogmom.me>
Build-Depends:
debhelper-compat (= 13),
libcairo2-dev,
libevdev-dev,
libgdk-pixbuf-2.0-dev,
libinput-dev (>= 1.21.0),
libjson-c-dev (>= 0.13),
libpango1.0-dev,
libpcre2-dev,
libpixman-1-dev,
libseat-dev,
libsystemd-dev (>= 239) | libelogind-dev (>= 239),
libwayland-dev (>= 1.21.0),
libwlroots-0.18-dev (>= 0.18.0),
libxkbcommon-dev (>= 1.5.0),
meson (>=0.60),
pkgconf,
scdoc (>= 1.9.2),
tree,
wayland-protocols (>= 1.24)
Standards-Version: 4.7.0
Homepage: https://github.com/WillPower3309/swayfx
Rules-Requires-Root: no
Package: swayfx
Architecture: any
Depends:
libgl1-mesa-dri,
swaybg,
${misc:Depends},
${shlibs:Depends}
Recommends:
polkitd,
wmenu,
foot
Suggests:
swayfx-backgrounds,
swayidle,
swaylock,
xdg-desktop-portal-wlr,
xdg-desktop-portal-gtk
Provides:
sway
Description: Sway, but with eye candy!
Sway is an incredible window manager, and certainly one of the most well
established wayland window managers. However, it is restricted to only
include the functionality that existed in i3. This fork ditches the simple
wlr_renderer, and replaces it with our fx_renderer, capable of rendering
with fancy GLES2 effects.
Package: swayfx-backgrounds
Architecture: all
Multi-Arch: foreign
Depends:
${misc:Depends},
${shlibs:Depends}
Suggests:
swayfx
Provides:
sway-backgrounds
Description: Set of backgrounds packaged with the sway window manager
sway (SirCmpwn's Wayland compositor) is a tiling Wayland compositor and a
drop-in replacement for the i3 window manager for X11. It works with your
existing i3 configuration and supports most of i3's features, plus a few
extras. This means it is a minimalist, tiling window manager.
.
This package contains a set of desktop backgrounds that come with sway.

80
debian/copyright vendored Normal file
View file

@ -0,0 +1,80 @@
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
Source: https://github.com/swaywm/sway
Upstream-Name: sway
Files: *
Copyright: © 2016-2018 Drew DeVault <sir@cmpwn.com>
License: Expat
Files: protocols/wlr-layer-shell-unstable-v1.xml
Copyright: © 2017 Drew DeVault
License: MIT-like
Files: protocols/idle.xml
Copyright: (C) 2015 Martin Gräßlin
License: LGPL-2.1+
Files: protocols/wlr-output-power-management-unstable-v1.xml
Copyright: (C) 2019 Purism SPC
License: Expat
Files: debian/*
Copyright: © 2018 Nicolas Braud-Santoni <nicolas@braud-santoni.eu>
© 2018-2024 Birger Schacht <birger@debian.org>
License: Expat
License: LGPL-2.1+
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1, or (at your option)
any later version.
.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Lesser General Public License for more details.
.
You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation,
Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
.
On Debian systems, the complete text of the GNU Lesser General Public
License version 2.1 can be found in /usr/share/common-licenses/LGPL-2.1.
License: Expat
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do
so, subject to the following conditions:
.
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
License: MIT-like
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.

3
debian/gbp.conf vendored Normal file
View file

@ -0,0 +1,3 @@
[DEFAULT]
pristine-tar = True
debian-branch = debian/sid

8
debian/gitlab-ci.yml vendored Normal file
View file

@ -0,0 +1,8 @@
---
include:
- https://salsa.debian.org/salsa-ci-team/pipeline/raw/master/recipes/debian.yml
variables:
# For Salsa CI to also extract the upstream tarball when using the
# export-dir option, gbp buildpackage needs the --git-overlay option set.
SALSA_CI_GBP_BUILDPACKAGE_ARGS: "--git-overlay"

30
debian/rules vendored Executable file
View file

@ -0,0 +1,30 @@
#!/usr/bin/make -f
# -*- makefile -*-
export DH_VERBOSE=1
export DH_OPTIONS=-v
include /usr/share/dpkg/pkg-info.mk
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND = -Wno-error=deprecated-declarations
export DEB_BUILD_OPTIONS=noautodbgsym
%:
dh $@
.PHONY: override_dh_auto_configure
override_dh_auto_configure:
dh_auto_configure -- --libexecdir=lib
.PHONY: override_dh_missing
override_dh_missing:
dh_missing --fail-missing
.PHONY: override_dh_install
override_dh_install:
if ! dh_install; then \
tree debian; \
exit 1; \
fi

1
debian/source/format vendored Normal file
View file

@ -0,0 +1 @@
3.0 (quilt)

2
debian/sway-portals.conf vendored Normal file
View file

@ -0,0 +1,2 @@
[preferred]
default=wlr;gtk;

1
debian/sway.maintscript vendored Normal file
View file

@ -0,0 +1 @@
rm_conffile /etc/sway/config-vars.d/00-set-term-foot.conf 1.5-7~

2
debian/swayfx-backgrounds.install vendored Normal file
View file

@ -0,0 +1,2 @@
usr/share/backgrounds
debian/config.d/40-sway-background.conf /etc/sway/config.d/

2
debian/swayfx-docs.docs vendored Normal file
View file

@ -0,0 +1,2 @@
README.source
README.Debian

14
debian/swayfx.install vendored Normal file
View file

@ -0,0 +1,14 @@
debian/config.d/50-systemd-user.conf /etc/sway/config.d/
debian/sway-portals.conf /usr/share/xdg-desktop-portal/
etc/sway
usr/bin/sway*
usr/share/bash-completion/completions/sway*
usr/share/fish/vendor_completions.d/sway*
usr/share/man/man1/sway*
usr/share/man/man5/sway*
usr/share/man/man7/sway*
usr/share/wayland-sessions
usr/share/zsh/site-functions/_sway*
usr/include/scenefx-0.2/scenefx/*
usr/lib/*/libscenefx-0.2.so
usr/lib/*/pkgconfig/scenefx-0.2.pc

10
debian/upstream/metadata.ex vendored Normal file
View file

@ -0,0 +1,10 @@
# Example file for upstream/metadata.
# See https://wiki.debian.org/UpstreamMetadata for more info/fields.
# Below an example based on a github project.
# Bug-Database: https://github.com/<user>/swayfx/issues
# Bug-Submit: https://github.com/<user>/swayfx/issues/new
# Changelog: https://github.com/<user>/swayfx/blob/master/CHANGES
# Documentation: https://github.com/<user>/swayfx/wiki
# Repository-Browse: https://github.com/<user>/swayfx
# Repository: https://github.com/<user>/swayfx.git

3
debian/watch vendored Normal file
View file

@ -0,0 +1,3 @@
version=4
opts="mode=git,pgpmode=gittag,uversionmangle=s/(\d)[_\.\-\+]?((rc|beta|alpha)[\d.]*)$/$1~$2/," \
https://github.com/swaywm/sway refs/tags/v?(\d\S+)

46
flake.lock generated
View file

@ -1,28 +1,12 @@
{
"nodes": {
"flake-compat": {
"flake": false,
"locked": {
"lastModified": 1650374568,
"narHash": "sha256-Z+s0J8/r907g149rllvwhb4pKi8Wam5ij0st8PwAh+E=",
"owner": "edolstra",
"repo": "flake-compat",
"rev": "b4a34015c698c7793d592d66adbab377907a2be8",
"type": "github"
},
"original": {
"owner": "edolstra",
"repo": "flake-compat",
"type": "github"
}
},
"nixpkgs": {
"locked": {
"lastModified": 1668531822,
"narHash": "sha256-rNt2SphDCQTbAgWBX9ZCMIn5ISxeb0l6b6kRLvzbFVo=",
"lastModified": 1740019556,
"narHash": "sha256-vn285HxnnlHLWnv59Og7muqECNMS33mWLM14soFIv2g=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "97b8d9459f7922ce0e666113a1e8e6071424ae16",
"rev": "dad564433178067be1fbdfcce23b546254b6d641",
"type": "github"
},
"original": {
@ -34,8 +18,28 @@
},
"root": {
"inputs": {
"flake-compat": "flake-compat",
"nixpkgs": "nixpkgs"
"nixpkgs": "nixpkgs",
"scenefx": "scenefx"
}
},
"scenefx": {
"inputs": {
"nixpkgs": [
"nixpkgs"
]
},
"locked": {
"lastModified": 1739733667,
"narHash": "sha256-BLIADMQwPJUtl6hFBhh5/xyYwLFDnNQz0RtgWO/Ua8s=",
"owner": "wlrfx",
"repo": "scenefx",
"rev": "87c0e8b6d5c86557a800445e8e4c322f387fe19c",
"type": "github"
},
"original": {
"owner": "wlrfx",
"repo": "scenefx",
"type": "github"
}
}
},

127
flake.nix
View file

@ -1,62 +1,89 @@
{
description = "swaywm development environment";
description = "Swayfx development environment";
inputs = {
flake-compat = {
url = "github:edolstra/flake-compat";
flake = false;
};
nixpkgs.url = "github:nixos/nixpkgs/nixpkgs-unstable";
scenefx = {
url = "github:wlrfx/scenefx";
inputs.nixpkgs.follows = "nixpkgs";
};
};
outputs = { self, nixpkgs, flake-compat, ... }:
let
pkgsFor = system:
import nixpkgs {
inherit system;
overlays = [ ];
};
targetSystems = [ "aarch64-linux" "x86_64-linux" ];
in
outputs =
{
overlays.default = final: prev: {
swayfx-unwrapped = prev.sway-unwrapped.overrideAttrs
(old: { src = builtins.path { path = prev.lib.cleanSource ./.; }; });
self,
nixpkgs,
scenefx,
...
}:
let
mkPackage = pkgs: {
swayfx-unwrapped =
(pkgs.swayfx-unwrapped.override {
wlroots_0_17 = pkgs.wlroots_0_18;
}).overrideAttrs
(old: {
version = "0.4.0-git";
src = pkgs.lib.cleanSource ./.;
nativeBuildInputs = old.nativeBuildInputs ++ [ pkgs.cmake ];
buildInputs = old.buildInputs ++ [ pkgs.scenefx ];
providedSessions = [ pkgs.swayfx-unwrapped.meta.mainProgram ];
patches = []; ## this should probably be fixed properly
mesonFlags = let
inherit (pkgs.lib.strings) mesonEnable mesonOption;
in
[
(mesonOption "sd-bus-provider" "libsystemd")
(mesonEnable "tray" true)
];
});
};
packages = nixpkgs.lib.genAttrs targetSystems (system:
let pkgs = pkgsFor system;
in (self.overlays.default pkgs pkgs) // {
default = self.packages.${system}.swayfx-unwrapped;
});
targetSystems = [
"aarch64-linux"
"x86_64-linux"
];
pkgsFor =
system:
import nixpkgs {
inherit system;
overlays = [ scenefx.overlays.insert ];
};
forEachSystem = f: nixpkgs.lib.genAttrs targetSystems (system: f (pkgsFor system));
in
{
overlays = rec {
default = insert;
# Insert using the locked nixpkgs. Can be used with any nixpkgs version.
insert = _: prev: mkPackage (pkgsFor prev.system);
# Override onto the input nixpkgs. Users *MUST* have a scenefx overlay
# used before this overlay, otherwise pkgs.scenefx will be unavailable
override = _: prev: mkPackage prev;
};
devShells = nixpkgs.lib.genAttrs targetSystems (system:
let
pkgs = pkgsFor system;
in
{
default = pkgs.mkShell {
name = "swayfx-shell";
depsBuildBuild = with pkgs; [ pkg-config ];
inputsFrom = [ self.packages.${system}.swayfx-unwrapped pkgs.wlroots ];
packages = forEachSystem (
pkgs: (mkPackage pkgs // { default = self.packages.${pkgs.system}.swayfx-unwrapped; })
);
nativeBuildInputs = with pkgs; [
cmake
meson
ninja
pkg-config
wayland-scanner
scdoc
];
shellHook = with pkgs; ''(
mkdir -p "$PWD/subprojects"
cd "$PWD/subprojects"
cp -R --no-preserve=mode,ownership ${wlroots.src} wlroots
devShells = forEachSystem (pkgs: {
default = pkgs.mkShell {
name = "swayfx-shell";
inputsFrom = [
self.packages.${pkgs.system}.swayfx-unwrapped
pkgs.wlroots_0_18
pkgs.scenefx
];
packages = with pkgs; [
gdb # for debugging
];
shellHook = ''
(
# Copy the nix version of wlroots and scenefx into the project
mkdir -p "$PWD/subprojects" && cd "$PWD/subprojects"
cp -R --no-preserve=mode,ownership ${pkgs.wlroots_0_18.src} wlroots
cp -R --no-preserve=mode,ownership ${pkgs.scenefx.src} scenefx
)'';
};
});
};
});
formatter = forEachSystem (pkgs: pkgs.nixfmt-rfc-style);
};
}

View file

@ -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
View 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

View file

@ -5,6 +5,7 @@
#include <stdint.h>
#include <cairo.h>
#include <pango/pangocairo.h>
#include "stringop.h"
/**
* Utility function which escape characters a & < > ' ".
@ -13,12 +14,12 @@
* escaped string to dest if provided.
*/
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);
void get_text_size(cairo_t *cairo, const char *font, int *width, int *height,
int *baseline, double scale, bool markup, const char *fmt, ...);
void get_text_metrics(const char *font, int *height, int *baseline);
void render_text(cairo_t *cairo, const char *font,
double scale, bool markup, const char *fmt, ...);
void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height,
int *baseline, double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(8, 9);
void get_text_metrics(const PangoFontDescription *desc, int *height, int *baseline);
void render_text(cairo_t *cairo, PangoFontDescription *desc,
double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(5, 6);
#endif

View file

@ -2,8 +2,15 @@
#define _SWAY_STRINGOP_H
#include <stdbool.h>
#include <stddef.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_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 ~
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

View file

@ -3,13 +3,14 @@
#include <wlr/util/edges.h>
#include "config.h"
#include "stringop.h"
struct sway_container;
typedef struct cmd_results *sway_cmd(int argc, char **argv);
struct cmd_handler {
char *command;
const char *command;
sway_cmd *handle;
};
@ -17,9 +18,9 @@ struct cmd_handler {
* Indicates the result of a command's execution.
*/
enum cmd_status {
CMD_SUCCESS, /**< The command was successful */
CMD_SUCCESS, /**< The command was successful */
CMD_FAILURE, /**< The command resulted in an error */
CMD_INVALID, /**< Unknown command or parser error */
CMD_INVALID, /**< Unknown command or parser error */
CMD_DEFER, /**< Command execution deferred */
CMD_BLOCK,
CMD_BLOCK_COMMANDS,
@ -46,7 +47,7 @@ enum expected_args {
struct cmd_results *checkarg(int argc, const char *name,
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);
/**
@ -76,7 +77,7 @@ struct cmd_results *config_commands_command(char *exec);
/**
* 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.
*/
@ -96,6 +97,10 @@ void container_resize_tiled(struct sway_container *parent, uint32_t axis,
struct sway_container *container_find_resize_parent(struct sway_container *con,
uint32_t edge);
/**
* Effect handlers value parsers
*/
bool cmd_corner_radius_parse_value(char *arg, int* result);
/**
* Handlers shared by exec and exec_always.
@ -103,11 +108,21 @@ struct sway_container *container_find_resize_parent(struct sway_container *con,
sway_cmd cmd_exec_validate;
sway_cmd cmd_exec_process;
sway_cmd cmd_allow_tearing;
sway_cmd cmd_assign;
sway_cmd cmd_bar;
sway_cmd cmd_bindcode;
sway_cmd cmd_bindgesture;
sway_cmd cmd_bindswitch;
sway_cmd cmd_bindsym;
sway_cmd cmd_blur;
sway_cmd cmd_blur_brightness;
sway_cmd cmd_blur_contrast;
sway_cmd cmd_blur_noise;
sway_cmd cmd_blur_passes;
sway_cmd cmd_blur_radius;
sway_cmd cmd_blur_saturation;
sway_cmd cmd_blur_xray;
sway_cmd cmd_border;
sway_cmd cmd_client_noop;
sway_cmd cmd_client_focused;
@ -121,6 +136,7 @@ sway_cmd cmd_commands;
sway_cmd cmd_corner_radius;
sway_cmd cmd_create_output;
sway_cmd cmd_default_border;
sway_cmd cmd_default_dim_inactive;
sway_cmd cmd_default_floating_border;
sway_cmd cmd_default_orientation;
sway_cmd cmd_dim_inactive;
@ -151,6 +167,7 @@ sway_cmd cmd_input;
sway_cmd cmd_seat;
sway_cmd cmd_ipc;
sway_cmd cmd_kill;
sway_cmd cmd_layer_effects;
sway_cmd cmd_layout;
sway_cmd cmd_log_colors;
sway_cmd cmd_mark;
@ -162,23 +179,29 @@ sway_cmd cmd_new_float;
sway_cmd cmd_new_window;
sway_cmd cmd_nop;
sway_cmd cmd_opacity;
sway_cmd cmd_saturation;
sway_cmd cmd_new_float;
sway_cmd cmd_new_window;
sway_cmd cmd_no_focus;
sway_cmd cmd_output;
sway_cmd cmd_permit;
sway_cmd cmd_popup_during_fullscreen;
sway_cmd cmd_primary_selection;
sway_cmd cmd_reject;
sway_cmd cmd_reload;
sway_cmd cmd_rename;
sway_cmd cmd_resize;
sway_cmd cmd_scratchpad;
sway_cmd cmd_scratchpad_minimize;
sway_cmd cmd_seamless_mouse;
sway_cmd cmd_set;
sway_cmd cmd_shadow_blur_radius;
sway_cmd cmd_shadow_color;
sway_cmd cmd_shadow_offset;
sway_cmd cmd_shadow_inactive_color;
sway_cmd cmd_shadows;
sway_cmd cmd_shadows_on_csd;
sway_cmd cmd_shortcuts_inhibitor;
sway_cmd cmd_show_marks;
sway_cmd cmd_smart_borders;
sway_cmd cmd_smart_corner_radius;
sway_cmd cmd_smart_gaps;
sway_cmd cmd_split;
sway_cmd cmd_splith;
@ -194,8 +217,10 @@ sway_cmd cmd_title_align;
sway_cmd cmd_title_format;
sway_cmd cmd_titlebar_border_thickness;
sway_cmd cmd_titlebar_padding;
sway_cmd cmd_titlebar_separator;
sway_cmd cmd_unbindcode;
sway_cmd cmd_unbindswitch;
sway_cmd cmd_unbindgesture;
sway_cmd cmd_unbindsym;
sway_cmd cmd_unmark;
sway_cmd cmd_urgent;
@ -252,9 +277,11 @@ sway_cmd input_cmd_seat;
sway_cmd input_cmd_accel_profile;
sway_cmd input_cmd_calibration_matrix;
sway_cmd input_cmd_click_method;
sway_cmd input_cmd_clickfinger_button_map;
sway_cmd input_cmd_drag;
sway_cmd input_cmd_drag_lock;
sway_cmd input_cmd_dwt;
sway_cmd input_cmd_dwtp;
sway_cmd input_cmd_events;
sway_cmd input_cmd_left_handed;
sway_cmd input_cmd_map_from_region;
@ -263,10 +290,12 @@ sway_cmd input_cmd_map_to_region;
sway_cmd input_cmd_middle_emulation;
sway_cmd input_cmd_natural_scroll;
sway_cmd input_cmd_pointer_accel;
sway_cmd input_cmd_rotation_angle;
sway_cmd input_cmd_scroll_factor;
sway_cmd input_cmd_repeat_delay;
sway_cmd input_cmd_repeat_rate;
sway_cmd input_cmd_scroll_button;
sway_cmd input_cmd_scroll_button_lock;
sway_cmd input_cmd_scroll_method;
sway_cmd input_cmd_tap;
sway_cmd input_cmd_tap_button_map;
@ -282,7 +311,9 @@ sway_cmd input_cmd_xkb_switch_layout;
sway_cmd input_cmd_xkb_variant;
sway_cmd output_cmd_adaptive_sync;
sway_cmd output_cmd_allow_tearing;
sway_cmd output_cmd_background;
sway_cmd output_cmd_color_profile;
sway_cmd output_cmd_disable;
sway_cmd output_cmd_dpms;
sway_cmd output_cmd_enable;
@ -290,12 +321,14 @@ sway_cmd output_cmd_max_render_time;
sway_cmd output_cmd_mode;
sway_cmd output_cmd_modeline;
sway_cmd output_cmd_position;
sway_cmd output_cmd_power;
sway_cmd output_cmd_render_bit_depth;
sway_cmd output_cmd_scale;
sway_cmd output_cmd_scale_filter;
sway_cmd output_cmd_subpixel;
sway_cmd output_cmd_toggle;
sway_cmd output_cmd_transform;
sway_cmd output_cmd_unplug;
sway_cmd seat_cmd_attach;
sway_cmd seat_cmd_cursor;

View file

@ -1,21 +1,26 @@
#ifndef _SWAY_CONFIG_H
#define _SWAY_CONFIG_H
#include <libinput.h>
#include <scenefx/types/fx/blur_data.h>
#include <stdint.h>
#include <string.h>
#include <time.h>
#include <wlr/interfaces/wlr_switch.h>
#include <wlr/types/wlr_tablet_tool.h>
#include <wlr/util/box.h>
#include <wlr/render/color.h>
#include <xkbcommon/xkbcommon.h>
#include <xf86drmMode.h>
#include "../include/config.h"
#include "gesture.h"
#include "list.h"
#include "stringop.h"
#include "swaynag.h"
#include "tree/container.h"
#include "sway/input/tablet.h"
#include "sway/tree/root.h"
#include "wlr-layer-shell-unstable-v1-protocol.h"
#include <pango/pangocairo.h>
// TODO: Refactor this shit
@ -32,7 +37,8 @@ enum binding_input_type {
BINDING_KEYSYM,
BINDING_MOUSECODE,
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 {
@ -45,10 +51,11 @@ enum binding_flags {
BINDING_RELOAD = 1 << 6, // switch only; (re)trigger binding on reload
BINDING_INHIBITED = 1 << 7, // keyboard only: ignore shortcut inhibitor
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 {
enum binding_input_type type;
@ -62,12 +69,10 @@ struct sway_binding {
char *command;
};
/**
* A mouse binding and an associated command.
*/
struct sway_mouse_binding {
uint32_t button;
char *command;
enum sway_switch_trigger {
SWAY_SWITCH_TRIGGER_OFF,
SWAY_SWITCH_TRIGGER_ON,
SWAY_SWITCH_TRIGGER_TOGGLE,
};
/**
@ -75,11 +80,21 @@ struct sway_mouse_binding {
*/
struct sway_switch_binding {
enum wlr_switch_type type;
enum wlr_switch_state state;
enum sway_switch_trigger trigger;
uint32_t flags;
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.
*/
@ -99,6 +114,7 @@ struct sway_mode {
list_t *keycode_bindings;
list_t *mouse_bindings;
list_t *switch_bindings;
list_t *gesture_bindings;
bool pango;
};
@ -134,17 +150,21 @@ struct input_config {
int accel_profile;
struct calibration_matrix calibration_matrix;
int click_method;
int clickfinger_button_map;
int drag;
int drag_lock;
int dwt;
int dwtp;
int left_handed;
int middle_emulation;
int natural_scroll;
float pointer_accel;
float rotation_angle;
float scroll_factor;
int repeat_delay;
int repeat_rate;
int scroll_button;
int scroll_button_lock;
int scroll_method;
int send_events;
int tap;
@ -234,12 +254,6 @@ struct seat_config {
} xcursor_theme;
};
enum config_dpms {
DPMS_IGNORE,
DPMS_ON,
DPMS_OFF,
};
enum scale_filter_mode {
SCALE_FILTER_DEFAULT, // the default is currently smart
SCALE_FILTER_LINEAR,
@ -249,6 +263,7 @@ enum scale_filter_mode {
enum render_bit_depth {
RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8
RENDER_BIT_DEPTH_6,
RENDER_BIT_DEPTH_8,
RENDER_BIT_DEPTH_10,
};
@ -261,6 +276,7 @@ enum render_bit_depth {
struct output_config {
char *name;
int enabled;
int power;
int width, height;
float refresh_rate;
int custom_mode;
@ -273,11 +289,13 @@ struct output_config {
int max_render_time; // In milliseconds
int adaptive_sync;
enum render_bit_depth render_bit_depth;
bool set_color_transform;
struct wlr_color_transform *color_transform;
int allow_tearing;
char *background;
char *background_option;
char *background_fallback;
enum config_dpms dpms_state;
};
/**
@ -466,15 +484,31 @@ enum xwayland_mode {
* The configuration struct. The result of loading a config file.
*/
struct sway_config {
// SwayFX config options
int corner_radius;
float dim_inactive;
// dim_inactive colors
bool smart_corner_radius;
float default_dim_inactive;
struct {
float unfocused[4];
float urgent[4];
} dim_inactive_colors;
bool blur_enabled;
bool blur_xray;
struct blur_data blur_data;
bool shadow_enabled;
bool shadows_on_csd_enabled;
int shadow_blur_sigma;
float shadow_color[4];
float shadow_inactive_color[4];
float shadow_offset_x, shadow_offset_y;
bool titlebar_separator;
bool scratchpad_minimize;
list_t *layer_criteria;
char *swaynag_command;
struct swaynag_instance swaynag_config_errors;
list_t *symbols;
@ -501,7 +535,8 @@ struct sway_config {
char *floating_scroll_right_cmd;
enum sway_container_layout default_orientation;
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_baseline;
bool pango_markup;
@ -530,6 +565,7 @@ struct sway_config {
bool auto_back_and_forth;
bool show_marks;
enum alignment title_align;
bool primary_selection;
bool tiling_drag;
int tiling_drag_threshold;
@ -623,7 +659,7 @@ void run_deferred_bindings(void);
/**
* 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
@ -676,22 +712,28 @@ const char *sway_output_scale_filter_to_string(enum scale_filter_mode scale_filt
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);
struct output_config *store_output_config(struct output_config *oc);
/**
* store_output_config stores a new output config. An output may be matched by
* 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);
void apply_output_config_to_outputs(struct output_config *oc);
void reset_outputs(void);
void free_output_config(struct output_config *oc);
void request_modeset(void);
void force_modeset(void);
bool modeset_is_pending(void);
bool spawn_swaybg(void);
int workspace_output_cmp_workspace(const void *a, const void *b);
@ -700,6 +742,8 @@ void free_sway_binding(struct sway_binding *sb);
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 load_swaybar(struct bar_config *bar);

View file

@ -1,11 +1,16 @@
#ifndef _SWAY_CRITERIA_H
#define _SWAY_CRITERIA_H
#include <pcre.h>
#define PCRE2_CODE_UNIT_WIDTH 8
#include <pcre2.h>
#include "config.h"
#include "list.h"
#include "tree/view.h"
#if WLR_HAS_XWAYLAND
#include "sway/xwayland.h"
#endif
enum criteria_type {
CT_COMMAND = 1 << 0,
CT_ASSIGN_OUTPUT = 1 << 1,
@ -15,13 +20,13 @@ enum criteria_type {
};
enum pattern_type {
PATTERN_PCRE,
PATTERN_PCRE2,
PATTERN_FOCUSED,
};
struct pattern {
enum pattern_type match_type;
pcre *regex;
pcre2_code *regex;
};
struct criteria {
@ -35,13 +40,14 @@ struct criteria {
struct pattern *app_id;
struct pattern *con_mark;
uint32_t con_id; // internal ID
#if HAVE_XWAYLAND
#if WLR_HAS_XWAYLAND
struct pattern *class;
uint32_t id; // X11 window ID
struct pattern *instance;
struct pattern *window_role;
enum atom_name window_type;
#endif
bool all;
bool floating;
bool tiling;
char urgent; // 'l' for latest or 'o' for oldest

View file

@ -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);

View file

@ -1,121 +0,0 @@
#ifndef _SWAY_OPENGL_H
#define _SWAY_OPENGL_H
#include <GLES2/gl2.h>
#include <GLES2/gl2ext.h>
#include <stdbool.h>
enum corner_location { ALL, TOP_LEFT, TOP_RIGHT, BOTTOM_LEFT, BOTTOM_RIGHT };
struct decoration_data {
float alpha;
float saturation;
int corner_radius;
float dim;
float* dim_color;
bool has_titlebar;
};
struct gles2_tex_shader {
GLuint program;
GLint proj;
GLint tex;
GLint alpha;
GLint pos_attrib;
GLint tex_attrib;
GLint size;
GLint position;
GLint radius;
GLint saturation;
GLint dim;
GLint dim_color;
GLint has_titlebar;
};
struct rounded_quad_shader {
GLuint program;
GLint proj;
GLint color;
GLint pos_attrib;
GLint size;
GLint position;
GLint radius;
};
struct fx_renderer {
struct wlr_egl *egl;
float projection[9];
struct {
bool OES_egl_image_external;
} exts;
struct {
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
} procs;
// Shaders
struct {
struct {
GLuint program;
GLint proj;
GLint color;
GLint pos_attrib;
} quad;
struct rounded_quad_shader rounded_quad;
struct rounded_quad_shader rounded_tl_quad;
struct rounded_quad_shader rounded_tr_quad;
struct {
GLuint program;
GLint proj;
GLint color;
GLint pos_attrib;
GLint is_top_left;
GLint is_top_right;
GLint is_bottom_left;
GLint is_bottom_right;
GLint position;
GLint radius;
GLint half_size;
GLint half_thickness;
} corner;
struct gles2_tex_shader tex_rgba;
struct gles2_tex_shader tex_rgbx;
struct gles2_tex_shader tex_ext;
} shaders;
};
struct fx_renderer *fx_renderer_create(struct wlr_egl *egl);
void fx_renderer_begin(struct fx_renderer *renderer, uint32_t width, uint32_t height);
void fx_renderer_end();
void fx_renderer_clear(const float color[static 4]);
void fx_renderer_scissor(struct wlr_box *box);
bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer, struct wlr_texture *wlr_texture,
const struct wlr_fbox *src_box, const struct wlr_box *dst_box, const float matrix[static 9],
struct decoration_data deco_data);
bool fx_render_texture_with_matrix(struct fx_renderer *renderer, struct wlr_texture *wlr_texture,
const struct wlr_box *dst_box, const float matrix[static 9], struct decoration_data deco_data);
void fx_render_rect(struct fx_renderer *renderer, const struct wlr_box *box,
const float color[static 4], const float projection[static 9]);
void fx_render_rounded_rect(struct fx_renderer *renderer, const struct wlr_box *box,
const float color[static 4], const float projection[static 9],
int radius, enum corner_location corner_location);
void fx_render_border_corner(struct fx_renderer *renderer, const struct wlr_box *box,
const float color[static 4], const float projection[static 9],
enum corner_location corner_location, int radius, int border_thickness);
#endif

View file

@ -1,8 +1,6 @@
#ifndef _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.h>
#include "sway/server.h"
enum sway_idle_inhibit_mode {
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 wl_listener new_idle_inhibitor_v1;
struct wl_list inhibitors;
struct wlr_idle *idle;
};
struct sway_idle_inhibitor_v1 {
struct sway_idle_inhibit_manager_v1 *manager;
struct wlr_idle_inhibitor_v1 *wlr_inhibitor;
struct sway_view *view;
enum sway_idle_inhibit_mode mode;
@ -33,8 +28,7 @@ struct sway_idle_inhibitor_v1 {
bool sway_idle_inhibit_v1_is_active(
struct sway_idle_inhibitor_v1 *inhibitor);
void sway_idle_inhibit_v1_check_active(
struct sway_idle_inhibit_manager_v1 *manager);
void sway_idle_inhibit_v1_check_active(void);
void sway_idle_inhibit_v1_user_inhibitor_register(struct sway_view *view,
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(
struct sway_idle_inhibitor_v1 *inhibitor);
struct sway_idle_inhibit_manager_v1 *sway_idle_inhibit_manager_v1_create(
struct wl_display *wl_display, struct wlr_idle *idle);
bool sway_idle_inhibit_manager_v1_init(void);
#endif

View 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

View file

@ -1,6 +1,8 @@
#ifndef _SWAY_TRANSACTION_H
#define _SWAY_TRANSACTION_H
#include <scenefx/types/wlr_scene.h>
#include <stdint.h>
#include <stdbool.h>
/**
* 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.
*
* 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);
/**
@ -47,8 +52,13 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view,
* identifying the instruction by geometry rather than by serial.
*
* 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);
void arrange_popups(struct wlr_scene_tree *popups);
#endif

View file

@ -4,7 +4,7 @@
#include <stdint.h>
#include <wlr/types/wlr_pointer_constraints_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 "config.h"
@ -35,7 +35,8 @@ struct sway_cursor {
pixman_region32_t confine; // invalid if active_constraint == NULL
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_update;
struct wl_listener pinch_end;
@ -51,6 +52,7 @@ struct sway_cursor {
struct wl_listener touch_down;
struct wl_listener touch_up;
struct wl_listener touch_cancel;
struct wl_listener touch_motion;
struct wl_listener touch_frame;
bool simulating_pointer_from_touch;
@ -62,6 +64,7 @@ struct sway_cursor {
struct wl_listener tool_proximity;
struct wl_listener tool_button;
bool simulating_pointer_from_tool_tip;
bool simulating_pointer_from_tool_button;
uint32_t tool_buttons;
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);
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,
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,
struct wlr_event_pointer_axis *event);
struct wlr_pointer_axis_event *event);
void cursor_set_image(struct sway_cursor *cursor, const char *image,
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);
void handle_request_set_cursor_shape(struct wl_listener *listener, void *data);
#endif

View file

@ -1,14 +1,15 @@
#ifndef _SWAY_INPUT_INPUT_MANAGER_H
#define _SWAY_INPUT_INPUT_MANAGER_H
#include <libinput.h>
#include <wlr/types/wlr_input_inhibitor.h>
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
#include <wlr/types/wlr_virtual_keyboard_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 "list.h"
struct sway_server;
struct sway_input_device {
char *identifier;
struct wlr_input_device *wlr_device;
@ -21,10 +22,11 @@ struct sway_input_manager {
struct wl_list devices;
struct wl_list seats;
struct wlr_input_inhibit_manager *inhibit;
struct wlr_keyboard_shortcuts_inhibit_manager_v1 *keyboard_shortcuts_inhibit;
struct wlr_virtual_keyboard_manager_v1 *virtual_keyboard;
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 inhibit_activate;
@ -32,6 +34,7 @@ struct sway_input_manager {
struct wl_listener keyboard_shortcuts_inhibit_new_inhibitor;
struct wl_listener virtual_keyboard_new;
struct wl_listener virtual_pointer_new;
struct wl_listener transient_seat_create;
};
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_configure_all_inputs(void);
void input_manager_configure_all_input_mappings(void);
void input_manager_reset_input(struct sway_input_device *input_device);

View file

@ -50,6 +50,7 @@ struct sway_shortcut_state {
struct sway_keyboard {
struct sway_seat_device *seat_device;
struct wlr_keyboard *wlr;
struct xkb_keymap *keymap;
xkb_layout_index_t effective_layout;

View file

@ -2,7 +2,10 @@
#define _SWAY_INPUT_LIBINPUT_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);

View file

@ -1,9 +1,11 @@
#ifndef _SWAY_INPUT_SEAT_H
#define _SWAY_INPUT_SEAT_H
#include <scenefx/types/wlr_scene.h>
#include <wlr/types/wlr_keyboard_shortcuts_inhibit_v1.h>
#include <wlr/types/wlr_layer_shell_v1.h>
#include <wlr/types/wlr_seat.h>
#include <wlr/types/wlr_touch.h>
#include <wlr/util/edges.h>
#include "sway/config.h"
#include "sway/input/input-manager.h"
@ -15,19 +17,41 @@ struct sway_seat;
struct sway_seatop_impl {
void (*button)(struct sway_seat *seat, uint32_t time_msec,
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_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 (*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,
struct sway_tablet_tool *tool, uint32_t time_msec);
void (*tablet_tool_tip)(struct sway_seat *seat, struct sway_tablet_tool *tool,
uint32_t time_msec, enum wlr_tablet_tool_tip_state state);
void (*end)(struct sway_seat *seat);
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;
};
@ -50,19 +74,6 @@ struct sway_seat_node {
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_seat *seat;
struct wlr_drag *wlr_drag;
@ -73,16 +84,23 @@ struct sway_seat {
struct wlr_seat *wlr_seat;
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;
struct wl_list focus_stack; // list of containers in focus order
struct sway_workspace *workspace;
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;
// If exclusive_client is set, no other clients will receive input events
struct wl_client *exclusive_client;
// If the exclusive layer is set, views cannot receive keyboard focus
bool has_exclusive_layer;
// Last touch point
int32_t touch_id;
@ -106,6 +124,7 @@ struct sway_seat {
struct wl_listener start_drag;
struct wl_listener request_set_selection;
struct wl_listener request_set_primary_selection;
struct wl_listener destroy;
struct wl_list devices; // sway_seat_device::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,
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,
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,
struct wlr_layer_surface_v1 *layer);
void seat_set_exclusive_client(struct sway_seat *seat,
struct wl_client *client);
void seat_unfocus_unless_client(struct sway_seat *seat, struct wl_client *client);
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);
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,
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_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,
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,
struct sway_container *con);
@ -263,18 +287,18 @@ struct sway_container *seat_get_focus_inactive_floating(struct sway_seat *seat,
struct sway_workspace *workspace);
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 seatop_button(struct sway_seat *seat, uint32_t time_msec,
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_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,
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,
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);
/**
@ -297,13 +352,6 @@ void seatop_end(struct sway_seat *seat);
*/
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);
/**

View file

@ -5,6 +5,7 @@
struct sway_switch {
struct sway_seat_device *seat_device;
struct wlr_switch *wlr;
enum wlr_switch_state state;
enum wlr_switch_type type;

View file

@ -32,6 +32,7 @@ struct sway_tablet_pad {
struct wl_list link;
struct sway_seat_device *seat_device;
struct sway_tablet *tablet;
struct wlr_tablet_pad *wlr;
struct wlr_tablet_v2_tablet_pad *tablet_v2_pad;
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_notify_enter(struct sway_tablet_pad *tablet_pad,
void sway_tablet_pad_set_focus(struct sway_tablet_pad *tablet_pad,
struct wlr_surface *surface);
#endif

View file

@ -3,13 +3,12 @@
#include <wlr/types/wlr_text_input_v3.h>
#include <wlr/types/wlr_input_method_v2.h>
#include <wlr/types/wlr_surface.h>
#include "sway/input/seat.h"
#include <wlr/types/wlr_compositor.h>
/**
* The relay structure manages the relationship between text-input and
* 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
* relay manages life cycle of both sides. When both sides are present and
* focused, the relay passes messages between them.
@ -22,18 +21,21 @@ struct sway_input_method_relay {
struct sway_seat *seat;
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 wl_listener text_input_new;
struct wl_listener input_method_new;
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_destroy;
struct wl_listener input_method_keyboard_grab_destroy;
};
struct sway_text_input {
struct sway_input_method_relay *relay;

View 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

View file

@ -1,6 +1,7 @@
#ifndef _SWAY_IPC_JSON_H
#define _SWAY_IPC_JSON_H
#include <json.h>
#include "sway/output.h"
#include "sway/tree/container.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_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_recursive(struct sway_node *node);
json_object *ipc_json_describe_input(struct sway_input_device *device);

View file

@ -21,5 +21,6 @@ void ipc_event_mode(const char *mode, bool pango);
void ipc_event_shutdown(const char *reason);
void ipc_event_binding(struct sway_binding *binding);
void ipc_event_input(const char *change, struct sway_input_device *device);
void ipc_event_output(void);
#endif

View file

@ -0,0 +1,19 @@
#include <stdbool.h>
struct layer_criteria {
char *namespace;
char *cmdlist;
bool shadow_enabled;
bool blur_enabled;
bool blur_xray;
bool blur_ignore_transparent;
int corner_radius;
};
void layer_criteria_destroy(struct layer_criteria *criteria);
struct layer_criteria *layer_criteria_add(char *namespace, char *cmdlist);
// Get the matching criteria for a specified `sway_layer_surface`
struct layer_criteria *layer_criteria_for_namespace(char *namespace);

View file

@ -1,63 +1,54 @@
#ifndef _SWAY_LAYERS_H
#define _SWAY_LAYERS_H
#include <stdbool.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_compositor.h>
#include <wlr/types/wlr_layer_shell_v1.h>
enum layer_parent {
LAYER_PARENT_LAYER,
LAYER_PARENT_POPUP,
};
#include "sway/layer_criteria.h"
#include "sway/tree/view.h"
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 unmap;
struct wl_listener surface_commit;
struct wl_listener output_destroy;
struct wl_listener node_destroy;
struct wl_listener new_popup;
struct wl_listener new_subsurface;
struct wlr_box geo;
bool mapped;
struct wlr_box extent;
enum zwlr_layer_shell_v1_layer layer;
struct wl_list subsurfaces;
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_scene_shadow *shadow_node;
struct wlr_layer_surface_v1 *layer_surface;
bool shadow_enabled;
bool blur_enabled;
bool blur_xray;
bool blur_ignore_transparent;
int corner_radius;
};
struct sway_layer_popup {
struct wlr_xdg_popup *wlr_popup;
enum layer_parent parent_type;
union {
struct sway_layer_surface *parent_layer;
struct sway_layer_popup *parent_popup;
};
struct wl_listener map;
struct wl_listener unmap;
struct wlr_scene_tree *scene;
struct sway_layer_surface *toplevel;
struct wl_listener destroy;
struct wl_listener commit;
struct wl_listener new_popup;
};
struct sway_layer_subsurface {
struct wlr_subsurface *wlr_subsurface;
struct sway_layer_surface *layer_surface;
struct wl_list link;
struct wl_listener map;
struct wl_listener unmap;
struct wl_listener destroy;
struct wl_listener commit;
};
struct sway_output;
struct wlr_layer_surface_v1 *toplevel_layer_surface_from_surface(
struct wlr_surface *surface);
void arrange_layers(struct sway_output *output);
struct sway_layer_surface *layer_from_wlr_layer_surface_v1(
struct wlr_layer_surface_v1 *layer_surface);
void layer_apply_criteria(struct sway_layer_surface *surface, struct layer_criteria *criteria);
#endif

6
include/sway/lock.h Normal file
View file

@ -0,0 +1,6 @@
#ifndef _SWAY_LOCK_H
#define _SWAY_LOCK_H
void arrange_locks(void);
#endif

View file

@ -1,11 +1,12 @@
#ifndef _SWAY_OUTPUT_H
#define _SWAY_OUTPUT_H
#include <scenefx/types/wlr_scene.h>
#include <time.h>
#include <unistd.h>
#include <wayland-server-core.h>
#include <wlr/types/wlr_damage_ring.h>
#include <wlr/types/wlr_output.h>
#include "config.h"
#include "sway/desktop/fx_renderer.h"
#include "sway/tree/node.h"
#include "sway/tree/view.h"
@ -19,43 +20,68 @@ struct sway_output_state {
struct sway_output {
struct sway_node node;
struct {
struct wlr_scene_tree *shell_background;
struct wlr_scene_tree *shell_bottom;
// Used for optimized blur. Everything exclusively below gets blurred
struct wlr_scene_optimized_blur *blur_layer;
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_scene_output *scene_output;
struct sway_server *server;
struct wl_list link;
struct wl_list layers[4]; // sway_layer_surface::link
struct wlr_box usable_area;
struct timespec last_frame;
struct wlr_output_damage *damage;
int lx, ly; // layout coords
int width, height; // transformed buffer size
enum wl_output_subpixel detected_subpixel;
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;
struct sway_output_state current;
struct wl_listener layout_destroy;
struct wl_listener destroy;
struct wl_listener commit;
struct wl_listener mode;
struct wl_listener present;
struct wl_listener damage_destroy;
struct wl_listener damage_frame;
struct wl_listener frame;
struct wl_listener request_state;
struct {
struct wl_signal disable;
} events;
struct wlr_color_transform *color_transform;
struct timespec last_presentation;
uint32_t refresh_nsec;
int max_render_time; // In milliseconds
struct wl_event_source *repaint_timer;
bool gamma_lut_changed;
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);
@ -76,18 +102,8 @@ typedef void (*sway_surface_iterator_func_t)(struct sway_output *output,
struct sway_view *view, struct wlr_surface *surface, struct wlr_box *box,
void *user_data);
void output_damage_whole(struct sway_output *output);
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);
bool output_match_name_or_id(struct sway_output *output,
const char *name_or_id);
// this ONLY includes the enabled outputs
struct sway_output *output_by_name_or_id(const char *name_or_id);
@ -101,47 +117,8 @@ void output_enable(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);
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 (*f)(struct sway_workspace *ws, void *data), void *data);
@ -159,23 +136,10 @@ void output_get_box(struct sway_output *output, struct wlr_box *box);
enum sway_container_layout output_get_default_layout(
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 render_rounded_rect(struct sway_output *output,
pixman_region32_t *output_damage, const struct wlr_box *_box,
float color[static 4], int corner_radius,
enum corner_location corner_location);
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);
void handle_output_layout_change(struct wl_listener *listener, void *data);
void handle_gamma_control_set_gamma(struct wl_listener *listener, void *data);
void handle_output_manager_apply(struct wl_listener *listener, void *data);
@ -184,4 +148,8 @@ void handle_output_manager_test(struct wl_listener *listener, void *data);
void handle_output_power_manager_set_mode(struct wl_listener *listener,
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

View 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 <scenefx/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

View file

@ -2,45 +2,41 @@
#define _SWAY_SERVER_H
#include <stdbool.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 "list.h"
#if HAVE_XWAYLAND
#include "sway/desktop/idle_inhibit_v1.h"
#if WLR_HAS_XWAYLAND
#include "sway/xwayland.h"
#endif
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 wl_display *wl_display;
struct wl_event_loop *wl_event_loop;
const char *socket;
struct wlr_backend *backend;
struct wlr_session *session;
// secondary headless backend used for creating virtual outputs on-the-fly
struct wlr_backend *headless_backend;
struct wlr_renderer *wlr_renderer;
struct fx_renderer *renderer;
struct wlr_renderer *renderer;
struct wlr_allocator *allocator;
struct wlr_compositor *compositor;
struct wl_listener compositor_new_surface;
struct wlr_linux_dmabuf_v1 *linux_dmabuf_v1;
@ -49,20 +45,20 @@ struct sway_server {
struct sway_input_manager *input;
struct wl_listener new_output;
struct wl_listener output_layout_change;
struct wl_listener renderer_lost;
struct wlr_idle *idle;
struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1;
struct wlr_idle_notifier_v1 *idle_notifier_v1;
struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1;
struct wlr_layer_shell_v1 *layer_shell;
struct wl_listener layer_shell_surface;
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;
#if HAVE_XWAYLAND
#if WLR_HAS_XWAYLAND
struct sway_xwayland xwayland;
struct wl_listener xwayland_surface;
struct wl_listener xwayland_ready;
@ -81,23 +77,49 @@ struct sway_server {
struct wlr_drm_lease_v1_manager *drm_lease_manager;
struct wl_listener drm_lease_request;
struct wlr_presentation *presentation;
struct wlr_pointer_constraints_v1 *pointer_constraints;
struct wl_listener pointer_constraint;
struct wlr_xdg_output_manager_v1 *xdg_output_manager_v1;
struct wlr_output_manager_v1 *output_manager_v1;
struct wl_listener output_manager_apply;
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 wl_listener output_power_manager_set_mode;
struct wlr_input_method_manager_v2 *input_method;
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_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 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
// regardless of readiness.
@ -116,6 +138,8 @@ struct sway_server {
// Stores the nodes that have been marked as "dirty" and will be put into
// the pending transaction.
list_t *dirty_nodes;
struct wl_event_source *delayed_modeset;
};
extern struct sway_server server;
@ -124,19 +148,13 @@ struct sway_debug {
bool noatomic; // Ignore atomic layout updates
bool txn_timings; // Log verbose messages about transactions
bool txn_wait; // Always wait for the timeout before applying
bool noscanout; // Disable direct scan-out
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;
bool legacy_wl_drm; // Enable the legacy wl_drm interface
};
extern struct sway_debug debug;
/* Prepares an unprivileged server_init by performing all privileged operations in advance */
bool server_privileged_prepare(struct sway_server *server);
extern bool allow_unsupported_gpu;
bool server_init(struct sway_server *server);
void server_fini(struct sway_server *server);
bool server_start(struct sway_server *server);
@ -144,13 +162,17 @@ void server_run(struct sway_server *server);
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_idle_inhibitor_v1(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);
#if HAVE_XWAYLAND
void sway_session_lock_init(void);
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);
#endif
void handle_server_decoration(struct wl_listener *listener, void *data);
@ -158,5 +180,11 @@ void handle_xdg_decoration(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 *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

View file

@ -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

View file

@ -0,0 +1,28 @@
#ifndef _SWAY_BUFFER_H
#define _SWAY_BUFFER_H
#include <scenefx/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

View file

@ -1,6 +1,7 @@
#ifndef _SWAY_SWAYNAG_H
#define _SWAY_SWAYNAG_H
#include <wayland-server-core.h>
#include "stringop.h"
struct swaynag_instance {
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
// is false.
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
void swaynag_show(struct swaynag_instance *swaynag);

View file

@ -1,8 +1,9 @@
#ifndef _SWAY_CONTAINER_H
#define _SWAY_CONTAINER_H
#include <scenefx/types/wlr_scene.h>
#include <stdint.h>
#include <sys/types.h>
#include <wlr/types/wlr_surface.h>
#include <wlr/types/wlr_compositor.h>
#include "list.h"
#include "sway/tree/node.h"
@ -68,11 +69,44 @@ struct sway_container {
struct sway_node node;
struct sway_view *view;
struct wlr_scene_tree *scene_tree;
struct {
struct wlr_scene_tree *tree;
struct wlr_scene_rect *border;
struct wlr_scene_rect *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_shadow *shadow;
struct wlr_scene_tree *content_tree;
struct wlr_scene_rect *dim_rect;
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 pending;
char *title; // The view's title (unformatted)
char *formatted_title; // The title displayed in the title bar
int title_width;
char *title_format;
enum sway_container_layout prev_split_layout;
@ -100,37 +134,24 @@ struct sway_container {
double child_total_width;
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.
// Both hidden and visible scratchpad containers have scratchpad=true.
// Hidden scratchpad containers have a NULL parent.
bool scratchpad;
float saturation;
// Stores last output size and position for adjusting coordinates of
// scratchpad windows.
// Unused for non-scratchpad windows.
struct wlr_box transform;
float alpha;
int corner_radius;
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;
bool blur_enabled;
bool shadow_enabled;
float dim;
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 wl_signal destroy;
@ -150,19 +171,6 @@ void container_begin_destroy(struct sway_container *con);
struct sway_container *container_find_child(struct sway_container *container,
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 (*f)(struct sway_container *container, void *data), void *data);
@ -177,15 +185,15 @@ struct sway_container *container_obstructing_fullscreen_container(struct sway_co
bool container_has_ancestor(struct sway_container *container,
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);
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,
list_t *children, char *buffer);
@ -200,6 +208,9 @@ size_t container_titlebar_height(void);
void floating_calculate_constraints(int *min_width, int *max_width,
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_set_default_size(struct sway_container *con);
@ -218,11 +229,6 @@ void container_set_geometry_from_content(struct sway_container *con);
*/
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.
*/
@ -285,26 +291,12 @@ bool container_is_floating_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_current_parent_layout(
struct sway_container *con);
list_t *container_get_siblings(struct sway_container *container);
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_add_child(struct sway_container *parent,
@ -352,8 +344,6 @@ bool container_has_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);
bool container_is_scratchpad_hidden(struct sway_container *con);
@ -368,7 +358,7 @@ bool container_is_sticky_or_child(struct sway_container *con);
* This will destroy pairs of redundant H/V splits
* e.g. H[V[H[app app]] app] -> H[app app app]
* 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:
* https://github.com/i3/i3/blob/1f0c628cde40cf87371481041b7197344e0417c6/src/tree.c#L651
@ -377,4 +367,14 @@ bool container_is_sticky_or_child(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);
bool container_has_shadow(struct sway_container *con);
bool container_has_corner_radius(struct sway_container *con);
#endif

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