Compare commits
46 commits
scenefx_re
...
master
Author | SHA1 | Date | |
---|---|---|---|
|
5977be943e | ||
|
02f5a26b23 | ||
|
33e4784748 | ||
|
a18bd148a2 | ||
|
9f2ff33433 | ||
|
c31e4c9f29 | ||
|
a0d96ad34f | ||
|
c17a9ca357 | ||
|
f29300f757 | ||
|
b05c76dd0a | ||
|
95e722431c | ||
|
835f796b9a | ||
|
ba743d298d | ||
|
50d4cf45ab | ||
|
03a0796973 | ||
|
82fe097b31 | ||
|
3e4b6b75f4 | ||
|
d131b4dfbf | ||
|
7a235d282b | ||
|
5ee4d73771 | ||
|
91e6591fd6 | ||
|
ef08085153 | ||
|
aa65c3a9e3 | ||
|
19f76f3dcd | ||
|
c861623887 | ||
|
4d7ca7d975 | ||
|
178c6db807 | ||
|
6dfcc056b3 | ||
|
da559b3ea1 | ||
|
3c621dec7d | ||
|
aaa3c7536e | ||
|
d4f8c9d0b8 | ||
|
e45b420ccc | ||
|
c6b4411b86 | ||
|
80c0c50673 | ||
|
a5a69d4d4e | ||
|
4b954d5a05 | ||
|
40a5ebf109 | ||
|
8ad2605c65 | ||
|
a4d51d55e5 | ||
|
62472238ca | ||
|
fb86ed6b05 | ||
|
a5e79676c4 | ||
|
477686adb0 | ||
|
167a4ea0ae | ||
|
8afe66ab31 |
295 changed files with 8547 additions and 11498 deletions
56
.github/workflows/AUR_publish.yml
vendored
56
.github/workflows/AUR_publish.yml
vendored
|
@ -1,56 +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/sway-portals.conf
|
||||
./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/sway-portals.conf
|
||||
./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
|
29
.github/workflows/arch-build-git.yml
vendored
29
.github/workflows/arch-build-git.yml
vendored
|
@ -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
|
29
.github/workflows/arch-build-stable.yml
vendored
29
.github/workflows/arch-build-stable.yml
vendored
|
@ -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
|
51
.github/workflows/fedora-build.yml
vendored
51
.github/workflows/fedora-build.yml
vendored
|
@ -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:latest
|
||||
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
|
86
.github/workflows/fedora-copr.yml
vendored
86
.github/workflows/fedora-copr.yml
vendored
|
@ -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
2
.gitignore
vendored
|
@ -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
84
.gitlab-ci.yml
Normal 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
|
36
README.md
36
README.md
|
@ -10,7 +10,6 @@ Sway is an incredible window manager, and certainly one of the most well establi
|
|||
+ **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))
|
||||
+ **nixify the repo**: Allows nixos users to easily contribute to and test this project
|
||||
|
||||
|
@ -30,15 +29,15 @@ Sway is an incredible window manager, and certainly one of the most well establi
|
|||
- `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>` (**Note**: git only, percentage of noise to add)
|
||||
- `blur_brightness <float value 0 - 2>` (**Note**: git only, percentage of original brightness to adjust)
|
||||
- `blur_contrast <float value 0 - 2>` (**Note**: git only, percentage of original contrast to adjust)
|
||||
- `blur_saturation <float value 0 - 2>` (**Note**: git only, percentage of original saturation to adjust)
|
||||
- `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>`
|
||||
+ Window shadows:
|
||||
- `shadows enable|disable`
|
||||
- `shadows_on_csd enable|disable` (**Note**: The shadow might not fit some windows)
|
||||
- `shadow_blur_radius <integer value 0 - 100>`
|
||||
- `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`
|
||||
|
@ -47,18 +46,29 @@ Sway is an incredible window manager, and certainly one of the most well establi
|
|||
- 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; shadows enable; corner_radius 6'"`
|
||||
- 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:
|
||||
- `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`
|
||||
+ Application saturation: `for_window [CRITERIA HERE] saturation <set|plus|minus> <val 0.0 <-> 2.0>`
|
||||
+ 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**
|
||||
|
||||
|
@ -99,7 +109,9 @@ Install dependencies:
|
|||
* 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) \*
|
||||
|
||||
|
@ -121,12 +133,6 @@ 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/fx_renderer.c`: the meat and potatoes of this project, structured as similarly to wlr_renderer as possible
|
||||
+ `sway/desktop/fx_renderer/shaders`: where all of the shaders that fx_renderer uses live
|
||||
|
||||
## Acknowledgements
|
||||
|
||||
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.
|
||||
|
|
|
@ -1,16 +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.
|
||||
|
||||
# Upstream refuses to set XDG_CURRENT_DESKTOP so we have to.
|
||||
exec systemctl --user set-environment XDG_CURRENT_DESKTOP=sway
|
||||
exec systemctl --user import-environment DISPLAY \
|
||||
SWAYSOCK \
|
||||
WAYLAND_DISPLAY \
|
||||
XDG_CURRENT_DESKTOP
|
||||
|
||||
exec hash dbus-update-activation-environment 2>/dev/null && \
|
||||
dbus-update-activation-environment --systemd DISPLAY \
|
||||
SWAYSOCK \
|
||||
XDG_CURRENT_DESKTOP=sway \
|
||||
WAYLAND_DISPLAY
|
|
@ -1,83 +0,0 @@
|
|||
# Maintainer: Erik Reider <erik.reider@protonmail.com>
|
||||
_pkgname=swayfx
|
||||
pkgname="$_pkgname-git"
|
||||
pkgver=r7023.9cd02fc4
|
||||
pkgrel=5
|
||||
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=11"
|
||||
"libxcb"
|
||||
"libxkbcommon.so"
|
||||
"pango"
|
||||
"pcre2"
|
||||
"ttf-font"
|
||||
)
|
||||
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"
|
||||
"xdg-desktop-portal-gtk: Default xdg-desktop-portal for file picking"
|
||||
"xdg-desktop-portal-wlr: xdg-desktop-portal backend"
|
||||
)
|
||||
backup=(etc/sway/config)
|
||||
arch=("i686" "x86_64")
|
||||
url="https://github.com/WillPower3309/swayfx"
|
||||
source=("${pkgname%-*}::git+${url}.git"
|
||||
50-systemd-user.conf
|
||||
sway-portals.conf)
|
||||
sha512sums=(
|
||||
"SKIP"
|
||||
"d5f9aadbb4bbef067c31d4c8c14dad220eb6f3e559e9157e20e1e3d47faf2f77b9a15e52519c3ffc53dc8a5202cb28757b81a4b3b0cc5dd50a4ddc49e03fe06e"
|
||||
"790741df028822bf4d83170dea57e1c63f7d7938cf31969e4cd347b0fc07330322b603c9ec0091b7a3f425132bed9dee6f261074cc273555120858beaaaf5da1")
|
||||
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() {
|
||||
export PKG_CONFIG_PATH='/usr/lib/wlroots0.16/pkgconfig'
|
||||
arch-meson \
|
||||
-Dwerror=false \
|
||||
-Dsd-bus-provider=libsystemd \
|
||||
"$_pkgname" build
|
||||
meson compile -C build
|
||||
}
|
||||
|
||||
package() {
|
||||
install -Dm644 50-systemd-user.conf -t "$pkgdir/etc/sway/config.d/"
|
||||
install -Dm644 sway-portals.conf "$pkgdir/usr/share/xdg-desktop-portal/sway-portals.conf"
|
||||
|
||||
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
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
[preferred]
|
||||
# Use xdg-desktop-portal-gtk for every portal interface...
|
||||
default=gtk
|
||||
# ... except for the ScreenCast and Screenshot
|
||||
org.freedesktop.impl.portal.ScreenCast=wlr
|
||||
org.freedesktop.impl.portal.Screenshot=wlr
|
|
@ -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
|
||||
}
|
|
@ -1,16 +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.
|
||||
|
||||
# Upstream refuses to set XDG_CURRENT_DESKTOP so we have to.
|
||||
exec systemctl --user set-environment XDG_CURRENT_DESKTOP=sway
|
||||
exec systemctl --user import-environment DISPLAY \
|
||||
SWAYSOCK \
|
||||
WAYLAND_DISPLAY \
|
||||
XDG_CURRENT_DESKTOP
|
||||
|
||||
exec hash dbus-update-activation-environment 2>/dev/null && \
|
||||
dbus-update-activation-environment --systemd DISPLAY \
|
||||
SWAYSOCK \
|
||||
XDG_CURRENT_DESKTOP=sway \
|
||||
WAYLAND_DISPLAY
|
|
@ -1,78 +0,0 @@
|
|||
# Maintainer: Erik Reider <erik.reider@protonmail.com>
|
||||
_pkgname=swayfx
|
||||
pkgname="$_pkgname"
|
||||
pkgver=0.3.2
|
||||
pkgrel=5
|
||||
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=11"
|
||||
"libxcb"
|
||||
"libxkbcommon.so"
|
||||
"pango"
|
||||
"pcre2"
|
||||
"ttf-font"
|
||||
)
|
||||
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"
|
||||
"xdg-desktop-portal-gtk: Default xdg-desktop-portal for file picking"
|
||||
"xdg-desktop-portal-wlr: xdg-desktop-portal backend"
|
||||
)
|
||||
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
|
||||
sway-portals.conf)
|
||||
sha512sums=(
|
||||
"SKIP"
|
||||
"d5f9aadbb4bbef067c31d4c8c14dad220eb6f3e559e9157e20e1e3d47faf2f77b9a15e52519c3ffc53dc8a5202cb28757b81a4b3b0cc5dd50a4ddc49e03fe06e"
|
||||
"790741df028822bf4d83170dea57e1c63f7d7938cf31969e4cd347b0fc07330322b603c9ec0091b7a3f425132bed9dee6f261074cc273555120858beaaaf5da1")
|
||||
provides=("sway" "swayfx")
|
||||
conflicts=("sway" "swayfx")
|
||||
options=(debug)
|
||||
install=sway.install
|
||||
|
||||
build() {
|
||||
export PKG_CONFIG_PATH='/usr/lib/wlroots0.16/pkgconfig'
|
||||
arch-meson \
|
||||
-Dwerror=false \
|
||||
-Dsd-bus-provider=libsystemd \
|
||||
"${_pkgname}-${pkgver}" build
|
||||
meson compile -C build
|
||||
}
|
||||
|
||||
package() {
|
||||
install -Dm644 50-systemd-user.conf -t "$pkgdir/etc/sway/config.d/"
|
||||
install -Dm644 sway-portals.conf "$pkgdir/usr/share/xdg-desktop-portal/sway-portals.conf"
|
||||
|
||||
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
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
[preferred]
|
||||
# Use xdg-desktop-portal-gtk for every portal interface...
|
||||
default=gtk
|
||||
# ... except for the ScreenCast and Screenshot
|
||||
org.freedesktop.impl.portal.ScreenCast=wlr
|
||||
org.freedesktop.impl.portal.Screenshot=wlr
|
|
@ -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
|
||||
}
|
|
@ -1,158 +0,0 @@
|
|||
# vim: syntax=spec
|
||||
|
||||
### CHANGE THESE VARIABLES BEFORE RELEASE:
|
||||
# Change to current Sway base version!
|
||||
%global SwayBaseVersion 1.8.1
|
||||
# Change to current SwayFX tag!
|
||||
%global Tag 0.3.2
|
||||
|
||||
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 }}}
|
||||
Source101: sway-portals.conf
|
||||
|
||||
BuildRequires: gcc-c++
|
||||
BuildRequires: gnupg2
|
||||
BuildRequires: meson >= 0.60.0
|
||||
BuildRequires: pkgconfig(cairo)
|
||||
BuildRequires: pkgconfig(gdk-pixbuf-2.0)
|
||||
BuildRequires: pkgconfig(glesv2)
|
||||
BuildRequires: pkgconfig(json-c) >= 0.13
|
||||
BuildRequires: pkgconfig(libdrm)
|
||||
BuildRequires: pkgconfig(libevdev)
|
||||
BuildRequires: pkgconfig(libinput) >= 1.21.0
|
||||
BuildRequires: pkgconfig(libpcre2-8)
|
||||
BuildRequires: pkgconfig(libsystemd) >= 239
|
||||
BuildRequires: pkgconfig(libudev)
|
||||
BuildRequires: pkgconfig(pango)
|
||||
BuildRequires: pkgconfig(pangocairo)
|
||||
BuildRequires: pkgconfig(pixman-1)
|
||||
BuildRequires: pkgconfig(scdoc)
|
||||
BuildRequires: pkgconfig(wayland-client)
|
||||
BuildRequires: pkgconfig(wayland-cursor)
|
||||
BuildRequires: pkgconfig(wayland-server) >= 1.21.0
|
||||
BuildRequires: pkgconfig(wayland-protocols) >= 1.24
|
||||
BuildRequires: (pkgconfig(wlroots) >= 0.16.0 with pkgconfig(wlroots) < 0.17)
|
||||
BuildRequires: pkgconfig(xcb)
|
||||
BuildRequires: pkgconfig(xcb-icccm)
|
||||
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 portals.conf for xdg-desktop-portal
|
||||
install -D -m644 -pv %{SOURCE101} %{buildroot}%{_datadir}/xdg-desktop-portal/sway-portals.conf
|
||||
|
||||
# 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}/xdg-desktop-portal
|
||||
%{_datadir}/xdg-desktop-portal/sway-portals.conf
|
||||
%{bash_completions_dir}/sway*
|
||||
%{fish_completions_dir}/sway*.fish
|
||||
%{zsh_completions_dir}/_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
7
build.sh
Executable 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
|
|
@ -1,4 +1,3 @@
|
|||
#define _POSIX_C_SOURCE 200809
|
||||
#include <assert.h>
|
||||
#include <cairo.h>
|
||||
#include <errno.h>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include "gesture.h"
|
||||
|
||||
#include <math.h>
|
||||
|
@ -12,23 +11,6 @@
|
|||
|
||||
const uint8_t GESTURE_FINGERS_ANY = 0;
|
||||
|
||||
// Helper to easily allocate and format string
|
||||
static char *strformat(const char *format, ...) {
|
||||
va_list args;
|
||||
va_start(args, format);
|
||||
int length = vsnprintf(NULL, 0, format, args) + 1;
|
||||
va_end(args);
|
||||
|
||||
char *result = malloc(length);
|
||||
if (result) {
|
||||
va_start(args, format);
|
||||
vsnprintf(result, length, format, args);
|
||||
va_end(args);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
char *gesture_parse(const char *input, struct gesture *output) {
|
||||
// Clear output in case of failure
|
||||
output->type = GESTURE_TYPE_NONE;
|
||||
|
@ -38,7 +20,7 @@ char *gesture_parse(const char *input, struct gesture *output) {
|
|||
// Split input type, fingers and directions
|
||||
list_t *split = split_string(input, ":");
|
||||
if (split->length < 1 || split->length > 3) {
|
||||
return strformat(
|
||||
return format_str(
|
||||
"expected <gesture>[:<fingers>][:direction], got %s",
|
||||
input);
|
||||
}
|
||||
|
@ -51,8 +33,8 @@ char *gesture_parse(const char *input, struct gesture *output) {
|
|||
} else if (strcmp(split->items[0], "swipe") == 0) {
|
||||
output->type = GESTURE_TYPE_SWIPE;
|
||||
} else {
|
||||
return strformat("expected hold|pinch|swipe, got %s",
|
||||
split->items[0]);
|
||||
return format_str("expected hold|pinch|swipe, got %s",
|
||||
(const char *)split->items[0]);
|
||||
}
|
||||
|
||||
// Parse optional arguments
|
||||
|
@ -67,7 +49,7 @@ char *gesture_parse(const char *input, struct gesture *output) {
|
|||
next = split->length == 3 ? split->items[2] : NULL;
|
||||
} else if (split->length == 3) {
|
||||
// Fail here if argument can only be finger count
|
||||
return strformat("expected 1-9, got %s", next);
|
||||
return format_str("expected 1-9, got %s", next);
|
||||
}
|
||||
|
||||
// If there is an argument left, try to parse as direction
|
||||
|
@ -95,7 +77,7 @@ char *gesture_parse(const char *input, struct gesture *output) {
|
|||
} else if (strcmp(item, "counterclockwise") == 0) {
|
||||
output->directions |= GESTURE_DIRECTION_COUNTERCLOCKWISE;
|
||||
} else {
|
||||
return strformat("expected direction, got %s", item);
|
||||
return format_str("expected direction, got %s", item);
|
||||
}
|
||||
}
|
||||
list_free_items_and_destroy(directions);
|
||||
|
@ -163,7 +145,7 @@ static char *gesture_directions_to_string(uint32_t directions) {
|
|||
if (!result) {
|
||||
result = strdup(name);
|
||||
} else {
|
||||
char *new = strformat("%s+%s", result, name);
|
||||
char *new = format_str("%s+%s", result, name);
|
||||
free(result);
|
||||
result = new;
|
||||
}
|
||||
|
@ -179,7 +161,7 @@ static char *gesture_directions_to_string(uint32_t directions) {
|
|||
|
||||
char *gesture_to_string(struct gesture *gesture) {
|
||||
char *directions = gesture_directions_to_string(gesture->directions);
|
||||
char *result = strformat("%s:%u:%s",
|
||||
char *result = format_str("%s:%u:%s",
|
||||
gesture_type_string(gesture->type),
|
||||
gesture->fingers, directions);
|
||||
free(directions);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdlib.h>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#define _POSIX_C_SOURCE 200112L
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdio.h>
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#define _POSIX_C_SOURCE 200112L
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <stdbool.h>
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
lib_sway_common = static_library(
|
||||
'sway-common',
|
||||
files(
|
||||
'background-image.c',
|
||||
'cairo.c',
|
||||
'gesture.c',
|
||||
'ipc-client.c',
|
||||
|
@ -14,7 +13,6 @@ lib_sway_common = static_library(
|
|||
),
|
||||
dependencies: [
|
||||
cairo,
|
||||
gdk_pixbuf,
|
||||
pango,
|
||||
pangocairo,
|
||||
wayland_client.partial_dependency(compile_args: true)
|
||||
|
|
|
@ -53,6 +53,8 @@ size_t escape_markup_text(const char *src, char *dest) {
|
|||
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;
|
||||
|
@ -84,18 +86,11 @@ void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width,
|
|||
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, desc, buf, scale, markup);
|
||||
pango_cairo_update_layout(cairo, layout);
|
||||
|
@ -104,12 +99,14 @@ void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width,
|
|||
*baseline = pango_layout_get_baseline(layout) / PANGO_SCALE;
|
||||
}
|
||||
g_object_unref(layout);
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
||||
void get_text_metrics(const PangoFontDescription *description, int *height, int *baseline) {
|
||||
cairo_t *cairo = cairo_create(NULL);
|
||||
PangoContext *pango = pango_cairo_create_context(cairo);
|
||||
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);
|
||||
|
||||
|
@ -125,18 +122,11 @@ 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, desc, buf, scale, markup);
|
||||
cairo_font_options_t *fo = cairo_font_options_create();
|
||||
|
@ -146,5 +136,6 @@ void render_text(cairo_t *cairo, const PangoFontDescription *desc,
|
|||
pango_cairo_update_layout(cairo, layout);
|
||||
pango_cairo_show_layout(cairo, layout);
|
||||
g_object_unref(layout);
|
||||
|
||||
free(buf);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include <ctype.h>
|
||||
#include <fcntl.h>
|
||||
#include <math.h>
|
||||
|
|
57
completions/meson.build
Normal file
57
completions/meson.build
Normal file
|
@ -0,0 +1,57 @@
|
|||
if get_option('zsh-completions')
|
||||
zsh_files = files(
|
||||
'zsh/_sway',
|
||||
'zsh/_swaymsg',
|
||||
)
|
||||
zsh_install_dir = join_paths(datadir, 'zsh', 'site-functions')
|
||||
|
||||
install_data(zsh_files, install_dir: zsh_install_dir)
|
||||
endif
|
||||
|
||||
if get_option('bash-completions')
|
||||
bash_comp = dependency('bash-completion', required: false)
|
||||
|
||||
bash_files = files(
|
||||
'bash/sway',
|
||||
'bash/swaymsg',
|
||||
)
|
||||
|
||||
if get_option('swaybar')
|
||||
bash_files += files('bash/swaybar')
|
||||
endif
|
||||
|
||||
if bash_comp.found()
|
||||
bash_install_dir = bash_comp.get_variable(
|
||||
pkgconfig: 'completionsdir',
|
||||
pkgconfig_define: ['datadir', datadir]
|
||||
)
|
||||
else
|
||||
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
|
||||
endif
|
||||
|
||||
install_data(bash_files, install_dir: bash_install_dir)
|
||||
endif
|
||||
|
||||
if get_option('fish-completions')
|
||||
fish_comp = dependency('fish', required: false)
|
||||
|
||||
fish_files = files(
|
||||
'fish/sway.fish',
|
||||
'fish/swaymsg.fish',
|
||||
)
|
||||
|
||||
if get_option('swaynag')
|
||||
fish_files += files('fish/swaynag.fish')
|
||||
endif
|
||||
|
||||
if fish_comp.found()
|
||||
fish_install_dir = fish_comp.get_variable(
|
||||
pkgconfig: 'completionsdir',
|
||||
pkgconfig_define: ['datadir', datadir]
|
||||
)
|
||||
else
|
||||
fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
|
||||
endif
|
||||
|
||||
install_data(fish_files, install_dir: fish_install_dir)
|
||||
endif
|
42
config.in
42
config.in
|
@ -16,32 +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
|
||||
|
||||
# Window background blur
|
||||
blur off
|
||||
blur_xray off
|
||||
blur_passes 2
|
||||
blur_radius 5
|
||||
|
||||
shadows off
|
||||
shadows_on_csd off
|
||||
shadow_blur_radius 20
|
||||
shadow_color #0000007F
|
||||
|
||||
# inactive window fade amount. 0.0 = no dimming, 1.0 = fully dimmed
|
||||
default_dim_inactive 0.0
|
||||
dim_inactive_colors.unfocused #000000FF
|
||||
dim_inactive_colors.urgent #900000FF
|
||||
|
||||
# Move minimized windows into Scratchpad (enable|disable)
|
||||
scratchpad_minimize disable
|
||||
set $menu wmenu-run
|
||||
|
||||
### Output configuration
|
||||
#
|
||||
|
@ -218,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:
|
||||
|
@ -228,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
|
||||
|
|
|
@ -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()
|
||||
|
168
contrib/grimshot
168
contrib/grimshot
|
@ -1,168 +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:-$HOME/.config}/user-dirs.dirs" && \
|
||||
. "${XDG_CONFIG_HOME:-$HOME/.config}/user-dirs.dirs"
|
||||
|
||||
echo "${XDG_SCREENSHOTS_DIR:-${XDG_PICTURES_DIR:-$HOME}}"
|
||||
}
|
||||
|
||||
NOTIFY=no
|
||||
CURSOR=
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
key="$1"
|
||||
|
||||
case $key in
|
||||
-n|--notify)
|
||||
NOTIFY=yes
|
||||
shift # past argument
|
||||
;;
|
||||
-c|--cursor)
|
||||
CURSOR=yes
|
||||
shift # past argument
|
||||
;;
|
||||
*) # unknown option
|
||||
break # done with parsing --flags
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
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] [--cursor] (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 [ -n "$OUTPUT" ]; then
|
||||
grim ${CURSOR:+-c} -o "$OUTPUT" "$FILE" || die "Unable to invoke grim"
|
||||
elif [ -z "$GEOM" ]; then
|
||||
grim ${CURSOR:+-c} "$FILE" || die "Unable to invoke grim"
|
||||
else
|
||||
grim ${CURSOR:+-c} -g "$GEOM" "$FILE" || die "Unable to invoke grim"
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$ACTION" = "check" ] ; then
|
||||
echo "Checking if required tools are installed. If something is missing, install it to your system and make it available in PATH..."
|
||||
check grim
|
||||
check slurp
|
||||
check swaymsg
|
||||
check wl-copy
|
||||
check jq
|
||||
check notify-send
|
||||
exit
|
||||
elif [ "$SUBJECT" = "area" ] ; then
|
||||
GEOM=$(slurp -d)
|
||||
# Check if user exited slurp without selecting the area
|
||||
if [ -z "$GEOM" ]; then
|
||||
exit 1
|
||||
fi
|
||||
WHAT="Area"
|
||||
elif [ "$SUBJECT" = "active" ] ; then
|
||||
FOCUSED=$(swaymsg -t get_tree | jq -r 'recurse(.nodes[]?, .floating_nodes[]?) | select(.focused)')
|
||||
GEOM=$(echo "$FOCUSED" | jq -r '.rect | "\(.x),\(.y) \(.width)x\(.height)"')
|
||||
APP_ID=$(echo "$FOCUSED" | jq -r '.app_id')
|
||||
WHAT="$APP_ID window"
|
||||
elif [ "$SUBJECT" = "screen" ] ; then
|
||||
GEOM=""
|
||||
WHAT="Screen"
|
||||
elif [ "$SUBJECT" = "output" ] ; then
|
||||
GEOM=""
|
||||
OUTPUT=$(swaymsg -t get_outputs | jq -r '.[] | select(.focused)' | jq -r '.name')
|
||||
WHAT="$OUTPUT"
|
||||
elif [ "$SUBJECT" = "window" ] ; then
|
||||
GEOM=$(swaymsg -t get_tree | jq -r '.. | select(.pid? and .visible?) | .rect | "\(.x),\(.y) \(.width)x\(.height)"' | slurp)
|
||||
# Check if user exited slurp without selecting the area
|
||||
if [ -z "$GEOM" ]; then
|
||||
exit 1
|
||||
fi
|
||||
WHAT="Window"
|
||||
else
|
||||
die "Unknown subject to take a screen shot from" "$SUBJECT"
|
||||
fi
|
||||
|
||||
if [ "$ACTION" = "copy" ] ; then
|
||||
takeScreenshot - "$GEOM" "$OUTPUT" | wl-copy --type image/png || die "Clipboard error"
|
||||
notifyOk "$WHAT copied to buffer"
|
||||
else
|
||||
if takeScreenshot "$FILE" "$GEOM" "$OUTPUT"; then
|
||||
TITLE="Screenshot of $SUBJECT"
|
||||
MESSAGE=$(basename "$FILE")
|
||||
notifyOk "$MESSAGE" "$TITLE"
|
||||
echo "$FILE"
|
||||
else
|
||||
notifyError "Error taking screenshot with grim"
|
||||
fi
|
||||
fi
|
|
@ -1,109 +0,0 @@
|
|||
.\" Generated by scdoc 1.11.2
|
||||
.\" 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" "2022-03-31"
|
||||
.P
|
||||
.SH NAME
|
||||
.P
|
||||
grimshot - a helper for screenshots within sway
|
||||
.P
|
||||
.SH SYNOPSIS
|
||||
.P
|
||||
\fBgrimshot\fR [--notify] [--cursor] (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
|
||||
\fB--cursor\fR
|
||||
.RS 4
|
||||
Include cursors in the screenshot.\&
|
||||
.P
|
||||
.RE
|
||||
\fBsave\fR
|
||||
.RS 4
|
||||
Save the screenshot into a regular file.\& Grimshot will write images
|
||||
files to \fBXDG_SCREENSHOTS_DIR\fR if this is set (or defined
|
||||
in \fBuser-dirs.\&dir\fR), or otherwise fall back to \fBXDG_PICTURES_DIR\fR.\&
|
||||
Set FILE to '\&-'\& to pipe the output to STDOUT.\&
|
||||
.P
|
||||
.RE
|
||||
\fBcopy\fR
|
||||
.RS 4
|
||||
Copy the screenshot data (as image/png) into the clipboard.\&
|
||||
.P
|
||||
.RE
|
||||
.SH DESCRIPTION
|
||||
.P
|
||||
Grimshot is an easy-to-use screenshot utility for sway.\& It provides a
|
||||
convenient interface over grim, slurp and jq, and supports storing the
|
||||
screenshot either directly to the clipboard using wl-copy or to a file.\&
|
||||
.P
|
||||
.SH EXAMPLES
|
||||
.P
|
||||
An example usage pattern is to add these bindings to your sway config:
|
||||
.P
|
||||
.nf
|
||||
.RS 4
|
||||
# Screenshots:
|
||||
# Super+P: Current window
|
||||
# Super+Shift+p: Select area
|
||||
# Super+Alt+p Current output
|
||||
# Super+Ctrl+p Select a window
|
||||
|
||||
bindsym Mod4+p exec grimshot save active
|
||||
bindsym Mod4+Shift+p exec grimshot save area
|
||||
bindsym Mod4+Mod1+p exec grimshot save output
|
||||
bindsym Mod4+Ctrl+p exec grimshot save window
|
||||
.fi
|
||||
.RE
|
||||
.P
|
||||
.SH TARGETS
|
||||
.P
|
||||
grimshot can capture the following named targets:
|
||||
.P
|
||||
\fIactive\fR
|
||||
.RS 4
|
||||
Captures the currently active window.\&
|
||||
.P
|
||||
.RE
|
||||
\fIscreen\fR
|
||||
.RS 4
|
||||
Captures the entire screen.\& This includes all visible outputs.\&
|
||||
.P
|
||||
.RE
|
||||
\fIarea\fR
|
||||
.RS 4
|
||||
Allows manually selecting a rectangular region, and captures that.\&
|
||||
.P
|
||||
.RE
|
||||
\fIwindow\fR
|
||||
.RS 4
|
||||
Allows manually selecting a single window (by clicking on it), and
|
||||
captures it.\&
|
||||
.P
|
||||
.RE
|
||||
\fIoutput\fR
|
||||
.RS 4
|
||||
Captures the currently active output.\&
|
||||
.P
|
||||
.RE
|
||||
.SH OUTPUT
|
||||
.P
|
||||
Grimshot will print the filename of the captured screenshot to stdout if called
|
||||
with the \fIsave\fR subcommand.\&
|
||||
.P
|
||||
.SH SEE ALSO
|
||||
.P
|
||||
\fBgrim\fR(1)
|
|
@ -1,80 +0,0 @@
|
|||
grimshot(1)
|
||||
|
||||
# NAME
|
||||
|
||||
grimshot - a helper for screenshots within sway
|
||||
|
||||
# SYNOPSIS
|
||||
|
||||
*grimshot* [--notify] [--cursor] (copy|save) [TARGET] [FILE]++
|
||||
*grimshot* check++
|
||||
*grimshot* usage
|
||||
|
||||
# OPTIONS
|
||||
|
||||
*--notify*
|
||||
Show notifications to the user that a screenshot has been taken.
|
||||
|
||||
*--cursor*
|
||||
Include cursors in the screenshot.
|
||||
|
||||
*save*
|
||||
Save the screenshot into a regular file. Grimshot will write image
|
||||
files to *XDG_SCREENSHOTS_DIR* if this is set (or defined
|
||||
in *user-dirs.dir*), or otherwise fall back to *XDG_PICTURES_DIR*.
|
||||
Set FILE to '-' to pipe the output to STDOUT.
|
||||
|
||||
*copy*
|
||||
Copy the screenshot data (as image/png) into the clipboard.
|
||||
|
||||
# DESCRIPTION
|
||||
|
||||
Grimshot is an easy-to-use screenshot utility for sway. It provides a
|
||||
convenient interface over grim, slurp and jq, and supports storing the
|
||||
screenshot either directly to the clipboard using wl-copy or to a file.
|
||||
|
||||
# EXAMPLES
|
||||
|
||||
An example usage pattern is to add these bindings to your sway config:
|
||||
|
||||
```
|
||||
# Screenshots:
|
||||
# Super+P: Current window
|
||||
# Super+Shift+p: Select area
|
||||
# Super+Alt+p Current output
|
||||
# Super+Ctrl+p Select a window
|
||||
|
||||
bindsym Mod4+p exec grimshot save active
|
||||
bindsym Mod4+Shift+p exec grimshot save area
|
||||
bindsym Mod4+Mod1+p exec grimshot save output
|
||||
bindsym Mod4+Ctrl+p exec grimshot save window
|
||||
```
|
||||
|
||||
# TARGETS
|
||||
|
||||
grimshot can capture the following named targets:
|
||||
|
||||
_active_
|
||||
Captures the currently active window.
|
||||
|
||||
_screen_
|
||||
Captures the entire screen. This includes all visible outputs.
|
||||
|
||||
_area_
|
||||
Allows manually selecting a rectangular region, and captures that.
|
||||
|
||||
_window_
|
||||
Allows manually selecting a single window (by clicking on it), and
|
||||
captures it.
|
||||
|
||||
_output_
|
||||
Captures the currently active output.
|
||||
|
||||
# OUTPUT
|
||||
|
||||
Grimshot will print the filename of the captured screenshot to stdout if called
|
||||
with the _save_ subcommand.
|
||||
|
||||
# SEE ALSO
|
||||
|
||||
*grim*(1)
|
|
@ -1,69 +0,0 @@
|
|||
#!/usr/bin/python
|
||||
|
||||
# This script requires i3ipc-python package (install it from a system package manager
|
||||
# or pip).
|
||||
# It makes inactive windows transparent. Use `transparency_val` variable to control
|
||||
# transparency strength in range of 0…1 or use the command line argument -o.
|
||||
|
||||
import argparse
|
||||
import i3ipc
|
||||
import signal
|
||||
import sys
|
||||
from functools import partial
|
||||
|
||||
def on_window_focus(inactive_opacity, ipc, event):
|
||||
global prev_focused
|
||||
global prev_workspace
|
||||
|
||||
focused_workspace = ipc.get_tree().find_focused()
|
||||
|
||||
if focused_workspace == None:
|
||||
return
|
||||
|
||||
focused = event.container
|
||||
workspace = focused_workspace.workspace().num
|
||||
|
||||
if focused.id != prev_focused.id: # https://github.com/swaywm/sway/issues/2859
|
||||
focused.command("opacity 1")
|
||||
if workspace == prev_workspace:
|
||||
prev_focused.command("opacity " + inactive_opacity)
|
||||
prev_focused = focused
|
||||
prev_workspace = workspace
|
||||
|
||||
|
||||
def remove_opacity(ipc):
|
||||
for workspace in ipc.get_tree().workspaces():
|
||||
for w in workspace:
|
||||
w.command("opacity 1")
|
||||
ipc.main_quit()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
transparency_val = "0.80"
|
||||
|
||||
parser = argparse.ArgumentParser(
|
||||
description="This script allows you to set the transparency of unfocused windows in sway."
|
||||
)
|
||||
parser.add_argument(
|
||||
"--opacity",
|
||||
"-o",
|
||||
type=str,
|
||||
default=transparency_val,
|
||||
help="set opacity value in range 0...1",
|
||||
)
|
||||
args = parser.parse_args()
|
||||
|
||||
ipc = i3ipc.Connection()
|
||||
prev_focused = None
|
||||
prev_workspace = ipc.get_tree().find_focused().workspace().num
|
||||
|
||||
for window in ipc.get_tree():
|
||||
if window.focused:
|
||||
prev_focused = window
|
||||
else:
|
||||
window.command("opacity " + args.opacity)
|
||||
for sig in [signal.SIGINT, signal.SIGTERM]:
|
||||
signal.signal(sig, lambda signal, frame: remove_opacity(ipc))
|
||||
ipc.on("window::focus", partial(on_window_focus, args.opacity))
|
||||
ipc.main()
|
1
debian/.pc/.quilt_patches
vendored
Normal file
1
debian/.pc/.quilt_patches
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
patches
|
1
debian/.pc/.quilt_series
vendored
Normal file
1
debian/.pc/.quilt_series
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
series
|
1
debian/.pc/.version
vendored
Normal file
1
debian/.pc/.version
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
2
|
6
debian/README.Debian
vendored
Normal file
6
debian/README.Debian
vendored
Normal 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
10
debian/README.source
vendored
Normal 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
23
debian/changelog
vendored
Normal 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
|
1
debian/config.d/40-sway-background.conf
vendored
Normal file
1
debian/config.d/40-sway-background.conf
vendored
Normal 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
9
debian/config.d/50-systemd-user.conf
vendored
Normal 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
71
debian/control
vendored
Normal 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
80
debian/copyright
vendored
Normal 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
3
debian/gbp.conf
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
[DEFAULT]
|
||||
pristine-tar = True
|
||||
debian-branch = debian/sid
|
8
debian/gitlab-ci.yml
vendored
Normal file
8
debian/gitlab-ci.yml
vendored
Normal 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
30
debian/rules
vendored
Executable 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
1
debian/source/format
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
3.0 (quilt)
|
2
debian/sway-portals.conf
vendored
Normal file
2
debian/sway-portals.conf
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
[preferred]
|
||||
default=wlr;gtk;
|
1
debian/sway.maintscript
vendored
Normal file
1
debian/sway.maintscript
vendored
Normal 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
2
debian/swayfx-backgrounds.install
vendored
Normal 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
2
debian/swayfx-docs.docs
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
README.source
|
||||
README.Debian
|
14
debian/swayfx.install
vendored
Normal file
14
debian/swayfx.install
vendored
Normal 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
10
debian/upstream/metadata.ex
vendored
Normal 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
3
debian/watch
vendored
Normal 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
46
flake.lock
generated
|
@ -1,28 +1,12 @@
|
|||
{
|
||||
"nodes": {
|
||||
"flake-compat": {
|
||||
"flake": false,
|
||||
"locked": {
|
||||
"lastModified": 1696426674,
|
||||
"narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
|
||||
"type": "github"
|
||||
},
|
||||
"original": {
|
||||
"owner": "edolstra",
|
||||
"repo": "flake-compat",
|
||||
"type": "github"
|
||||
}
|
||||
},
|
||||
"nixpkgs": {
|
||||
"locked": {
|
||||
"lastModified": 1709905912,
|
||||
"narHash": "sha256-TofHtnlrOBCxtSZ9nnlsTybDnQXUmQrlIleXF1RQAwQ=",
|
||||
"lastModified": 1740019556,
|
||||
"narHash": "sha256-vn285HxnnlHLWnv59Og7muqECNMS33mWLM14soFIv2g=",
|
||||
"owner": "nixos",
|
||||
"repo": "nixpkgs",
|
||||
"rev": "a343533bccc62400e8a9560423486a3b6c11a23b",
|
||||
"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"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
138
flake.nix
138
flake.nix
|
@ -1,73 +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 ./.; };
|
||||
patches =
|
||||
let
|
||||
removePatches = [
|
||||
"LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM.patch"
|
||||
];
|
||||
in
|
||||
builtins.filter
|
||||
(patch: !builtins.elem (patch.name or null) removePatches)
|
||||
(old.patches or [ ]);
|
||||
});
|
||||
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_0_17 ];
|
||||
packages = forEachSystem (
|
||||
pkgs: (mkPackage pkgs // { default = self.packages.${pkgs.system}.swayfx-unwrapped; })
|
||||
);
|
||||
|
||||
nativeBuildInputs = with pkgs; [
|
||||
cmake
|
||||
meson
|
||||
ninja
|
||||
pkg-config
|
||||
wayland-scanner
|
||||
scdoc
|
||||
hwdata # for wlroots
|
||||
];
|
||||
|
||||
shellHook = with pkgs; ''(
|
||||
mkdir -p "$PWD/subprojects"
|
||||
cd "$PWD/subprojects"
|
||||
cp -R --no-preserve=mode,ownership ${wlroots_0_17.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);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
|
@ -5,6 +5,7 @@
|
|||
#include <stdint.h>
|
||||
#include <cairo.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include "stringop.h"
|
||||
|
||||
/**
|
||||
* Utility function which escape characters a & < > ' ".
|
||||
|
@ -16,9 +17,9 @@ size_t escape_markup_text(const char *src, char *dest);
|
|||
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 PangoFontDescription *desc, int *width, int *height,
|
||||
int *baseline, double scale, bool markup, const char *fmt, ...);
|
||||
int *baseline, double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(8, 9);
|
||||
void get_text_metrics(const PangoFontDescription *desc, int *height, int *baseline);
|
||||
void render_text(cairo_t *cairo, PangoFontDescription *desc,
|
||||
double scale, bool markup, const char *fmt, ...);
|
||||
double scale, bool markup, const char *fmt, ...) _SWAY_ATTRIB_PRINTF(5, 6);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -5,6 +5,12 @@
|
|||
#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);
|
||||
|
||||
|
@ -31,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
|
||||
|
|
|
@ -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,7 +97,6 @@ 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
|
||||
*/
|
||||
|
@ -108,6 +108,7 @@ bool cmd_corner_radius_parse_value(char *arg, int* result);
|
|||
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;
|
||||
|
@ -178,13 +179,11 @@ 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;
|
||||
|
@ -193,13 +192,13 @@ sway_cmd cmd_scratchpad;
|
|||
sway_cmd cmd_scratchpad_minimize;
|
||||
sway_cmd cmd_seamless_mouse;
|
||||
sway_cmd cmd_set;
|
||||
sway_cmd cmd_shortcuts_inhibitor;
|
||||
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;
|
||||
|
@ -278,6 +277,7 @@ 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;
|
||||
|
@ -290,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;
|
||||
|
@ -309,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;
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
#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"
|
||||
|
@ -147,6 +150,7 @@ 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;
|
||||
|
@ -155,10 +159,12 @@ struct input_config {
|
|||
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;
|
||||
|
@ -257,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,
|
||||
};
|
||||
|
@ -282,6 +289,9 @@ 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;
|
||||
|
@ -470,15 +480,6 @@ enum xwayland_mode {
|
|||
XWAYLAND_MODE_IMMEDIATE,
|
||||
};
|
||||
|
||||
struct blur_parameters {
|
||||
int num_passes;
|
||||
int radius;
|
||||
float noise;
|
||||
float brightness;
|
||||
float contrast;
|
||||
float saturation;
|
||||
};
|
||||
|
||||
/**
|
||||
* The configuration struct. The result of loading a config file.
|
||||
*/
|
||||
|
@ -492,6 +493,10 @@ struct sway_config {
|
|||
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;
|
||||
|
@ -499,10 +504,6 @@ struct sway_config {
|
|||
float shadow_inactive_color[4];
|
||||
float shadow_offset_x, shadow_offset_y;
|
||||
|
||||
bool blur_enabled;
|
||||
bool blur_xray;
|
||||
struct blur_parameters blur_params;
|
||||
|
||||
bool titlebar_separator;
|
||||
bool scratchpad_minimize;
|
||||
|
||||
|
@ -564,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;
|
||||
|
@ -657,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
|
||||
|
@ -710,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);
|
||||
|
@ -769,14 +777,6 @@ void translate_keysyms(struct input_config *input_config);
|
|||
|
||||
void binding_add_translated(struct sway_binding *binding, list_t *bindings);
|
||||
|
||||
int config_get_blur_size();
|
||||
|
||||
bool config_should_parameters_blur();
|
||||
|
||||
bool config_should_parameters_blur_effects();
|
||||
|
||||
bool config_should_parameters_shadow();
|
||||
|
||||
/* Global config singleton. */
|
||||
extern struct sway_config *config;
|
||||
|
||||
|
|
|
@ -7,6 +7,10 @@
|
|||
#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,
|
||||
|
@ -36,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
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
#include <wlr/types/wlr_compositor.h>
|
||||
|
||||
struct sway_container;
|
||||
struct sway_view;
|
||||
|
||||
void desktop_damage_surface(struct wlr_surface *surface, double lx, double ly,
|
||||
bool whole);
|
||||
|
||||
void desktop_damage_whole_container(struct sway_container *con);
|
||||
|
||||
void desktop_damage_box(struct wlr_box *box);
|
||||
|
||||
void desktop_damage_view(struct sway_view *view);
|
|
@ -1,27 +0,0 @@
|
|||
#ifndef FX_FRAMEBUFFER_H
|
||||
#define FX_FRAMEBUFFER_H
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
#include <stdbool.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
|
||||
#include "sway/desktop/fx_renderer/fx_stencilbuffer.h"
|
||||
#include "sway/desktop/fx_renderer/fx_texture.h"
|
||||
|
||||
struct fx_framebuffer {
|
||||
GLuint fb;
|
||||
struct fx_stencilbuffer stencil_buffer;
|
||||
struct fx_texture texture;
|
||||
};
|
||||
|
||||
struct fx_framebuffer fx_framebuffer_create();
|
||||
|
||||
void fx_framebuffer_bind(struct fx_framebuffer *buffer);
|
||||
|
||||
void fx_framebuffer_update(struct fx_framebuffer *buffer, int width, int height);
|
||||
|
||||
void fx_framebuffer_add_stencil_buffer(struct fx_framebuffer *buffer, int width, int height);
|
||||
|
||||
void fx_framebuffer_release(struct fx_framebuffer *buffer);
|
||||
|
||||
#endif
|
|
@ -1,236 +0,0 @@
|
|||
#ifndef _SWAY_OPENGL_H
|
||||
#define _SWAY_OPENGL_H
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
#include <GLES2/gl2ext.h>
|
||||
#include <stdbool.h>
|
||||
#include <wlr/render/egl.h>
|
||||
|
||||
#include "sway/desktop/fx_renderer/fx_framebuffer.h"
|
||||
#include "sway/desktop/fx_renderer/fx_texture.h"
|
||||
|
||||
enum corner_location { TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT, BOTTOM_LEFT, ALL, NONE };
|
||||
|
||||
enum fx_tex_shader_source {
|
||||
SHADER_SOURCE_TEXTURE_RGBA = 1,
|
||||
SHADER_SOURCE_TEXTURE_RGBX = 2,
|
||||
SHADER_SOURCE_TEXTURE_EXTERNAL = 3,
|
||||
};
|
||||
|
||||
enum fx_rounded_quad_shader_source {
|
||||
SHADER_SOURCE_QUAD_ROUND = 1,
|
||||
SHADER_SOURCE_QUAD_ROUND_TOP_LEFT = 2,
|
||||
SHADER_SOURCE_QUAD_ROUND_TOP_RIGHT = 3,
|
||||
SHADER_SOURCE_QUAD_ROUND_BOTTOM_RIGHT = 4,
|
||||
SHADER_SOURCE_QUAD_ROUND_BOTTOM_LEFT = 5,
|
||||
};
|
||||
|
||||
struct decoration_data {
|
||||
float alpha;
|
||||
float saturation;
|
||||
int corner_radius;
|
||||
float dim;
|
||||
float *dim_color;
|
||||
bool has_titlebar;
|
||||
bool discard_transparent;
|
||||
bool blur;
|
||||
bool shadow;
|
||||
};
|
||||
|
||||
struct blur_shader {
|
||||
GLuint program;
|
||||
GLint proj;
|
||||
GLint tex;
|
||||
GLint pos_attrib;
|
||||
GLint tex_attrib;
|
||||
GLint radius;
|
||||
GLint halfpixel;
|
||||
};
|
||||
|
||||
struct effects_shader {
|
||||
GLuint program;
|
||||
GLint proj;
|
||||
GLint tex;
|
||||
GLint pos_attrib;
|
||||
GLint tex_attrib;
|
||||
GLfloat noise;
|
||||
GLfloat brightness;
|
||||
GLfloat contrast;
|
||||
GLfloat saturation;
|
||||
};
|
||||
|
||||
struct box_shadow_shader {
|
||||
GLuint program;
|
||||
GLint proj;
|
||||
GLint color;
|
||||
GLint pos_attrib;
|
||||
GLint position;
|
||||
GLint size;
|
||||
GLint blur_sigma;
|
||||
GLint corner_radius;
|
||||
};
|
||||
|
||||
struct corner_shader {
|
||||
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;
|
||||
};
|
||||
|
||||
struct quad_shader {
|
||||
GLuint program;
|
||||
GLint proj;
|
||||
GLint color;
|
||||
GLint pos_attrib;
|
||||
};
|
||||
|
||||
struct rounded_quad_shader {
|
||||
GLuint program;
|
||||
GLint proj;
|
||||
GLint color;
|
||||
GLint pos_attrib;
|
||||
GLint size;
|
||||
GLint position;
|
||||
GLint radius;
|
||||
};
|
||||
|
||||
struct stencil_mask_shader {
|
||||
GLuint program;
|
||||
GLint proj;
|
||||
GLint color;
|
||||
GLint pos_attrib;
|
||||
GLint half_size;
|
||||
GLint position;
|
||||
GLint radius;
|
||||
};
|
||||
|
||||
struct 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;
|
||||
GLint discard_transparent;
|
||||
};
|
||||
|
||||
struct fx_renderer {
|
||||
float projection[9];
|
||||
|
||||
int viewport_width, viewport_height;
|
||||
|
||||
struct wlr_output *wlr_output;
|
||||
|
||||
// The framebuffer used by wlroots
|
||||
struct fx_framebuffer wlr_buffer;
|
||||
// Contains the blurred background for tiled windows
|
||||
struct fx_framebuffer blur_buffer;
|
||||
// Contains the original pixels to draw over the areas where artifact are visible
|
||||
struct fx_framebuffer blur_saved_pixels_buffer;
|
||||
// Blur swaps between the two effects buffers everytime it scales the image
|
||||
// Buffer used for effects
|
||||
struct fx_framebuffer effects_buffer;
|
||||
// Swap buffer used for effects
|
||||
struct fx_framebuffer effects_buffer_swapped;
|
||||
|
||||
// The region where there's blur
|
||||
pixman_region32_t blur_padding_region;
|
||||
|
||||
bool blur_buffer_dirty;
|
||||
|
||||
struct {
|
||||
bool OES_egl_image_external;
|
||||
} exts;
|
||||
|
||||
struct {
|
||||
PFNGLEGLIMAGETARGETTEXTURE2DOESPROC glEGLImageTargetTexture2DOES;
|
||||
} procs;
|
||||
|
||||
struct {
|
||||
struct box_shadow_shader box_shadow;
|
||||
struct blur_shader blur1;
|
||||
struct blur_shader blur2;
|
||||
struct effects_shader blur_effects;
|
||||
struct corner_shader corner;
|
||||
struct quad_shader quad;
|
||||
struct rounded_quad_shader rounded_quad;
|
||||
struct rounded_quad_shader rounded_tl_quad;
|
||||
struct rounded_quad_shader rounded_tr_quad;
|
||||
struct rounded_quad_shader rounded_bl_quad;
|
||||
struct rounded_quad_shader rounded_br_quad;
|
||||
struct stencil_mask_shader stencil_mask;
|
||||
struct tex_shader tex_rgba;
|
||||
struct tex_shader tex_rgbx;
|
||||
struct tex_shader tex_ext;
|
||||
} shaders;
|
||||
};
|
||||
|
||||
struct decoration_data get_undecorated_decoration_data();
|
||||
|
||||
struct fx_renderer *fx_renderer_create(struct wlr_egl *egl, struct wlr_output *output);
|
||||
|
||||
void fx_renderer_fini(struct fx_renderer *renderer);
|
||||
|
||||
void fx_renderer_begin(struct fx_renderer *renderer, int width, int height);
|
||||
|
||||
void fx_renderer_end(struct fx_renderer *renderer);
|
||||
|
||||
void fx_renderer_clear(const float color[static 4]);
|
||||
|
||||
void fx_renderer_scissor(struct wlr_box *box);
|
||||
|
||||
// Initialize the stenciling work
|
||||
void fx_renderer_stencil_mask_init();
|
||||
|
||||
// Close the mask
|
||||
void fx_renderer_stencil_mask_close(bool draw_inside_mask);
|
||||
|
||||
// Finish stenciling and clear the buffer
|
||||
void fx_renderer_stencil_mask_fini();
|
||||
|
||||
bool fx_render_subtexture_with_matrix(struct fx_renderer *renderer, struct fx_texture *fx_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 fx_texture *fx_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 matrix[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 matrix[static 9],
|
||||
enum corner_location corner_location, int radius, int border_thickness);
|
||||
|
||||
void fx_render_box_shadow(struct fx_renderer *renderer, const struct wlr_box *box,
|
||||
const struct wlr_box *inner_box, const float color[static 4],
|
||||
const float matrix[static 9], int corner_radius, float blur_sigma);
|
||||
|
||||
void fx_render_blur(struct fx_renderer *renderer, const float matrix[static 9],
|
||||
struct fx_framebuffer **buffer, struct blur_shader *shader,
|
||||
const struct wlr_box *box, int blur_radius);
|
||||
|
||||
void fx_render_blur_effects(struct fx_renderer *renderer, const float matrix[static 9],
|
||||
struct fx_framebuffer **buffer, float blur_noise, float blur_brightness,
|
||||
float blur_contrast, float blur_saturation);
|
||||
|
||||
#endif
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef FX_STENCILBUFFER_H
|
||||
#define FX_STENCILBUFFER_H
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
#include <stdbool.h>
|
||||
#include <wlr/render/wlr_texture.h>
|
||||
|
||||
struct fx_stencilbuffer {
|
||||
GLuint rb;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
struct fx_stencilbuffer fx_stencilbuffer_create();
|
||||
|
||||
void fx_stencilbuffer_release(struct fx_stencilbuffer *stencil_buffer);
|
||||
|
||||
#endif
|
|
@ -1,22 +0,0 @@
|
|||
#ifndef FX_TEXTURE_H
|
||||
#define FX_TEXTURE_H
|
||||
|
||||
#include <GLES2/gl2.h>
|
||||
#include <stdbool.h>
|
||||
#include <wlr/render/wlr_texture.h>
|
||||
|
||||
struct fx_texture {
|
||||
GLuint target;
|
||||
GLuint id;
|
||||
bool has_alpha;
|
||||
int width;
|
||||
int height;
|
||||
};
|
||||
|
||||
struct fx_texture fx_texture_create();
|
||||
|
||||
struct fx_texture fx_texture_from_wlr_texture(struct wlr_texture *tex);
|
||||
|
||||
void fx_texture_release(struct fx_texture *texture);
|
||||
|
||||
#endif
|
|
@ -1,9 +0,0 @@
|
|||
#ifndef _MATRIX_H
|
||||
#define _MATRIX_H
|
||||
|
||||
#include <wlr/types/wlr_output.h>
|
||||
|
||||
void matrix_projection(float mat[static 9], int width, int height,
|
||||
enum wl_output_transform transform);
|
||||
|
||||
#endif
|
|
@ -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
|
||||
|
|
|
@ -2,14 +2,19 @@
|
|||
#define _SWAY_LAUNCHER_H
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include "sway/input/seat.h"
|
||||
|
||||
struct launcher_ctx {
|
||||
pid_t pid;
|
||||
char *name;
|
||||
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;
|
||||
|
@ -25,7 +30,10 @@ void launcher_ctx_consume(struct launcher_ctx *ctx);
|
|||
|
||||
void launcher_ctx_destroy(struct launcher_ctx *ctx);
|
||||
|
||||
struct launcher_ctx *launcher_ctx_create(void);
|
||||
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);
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -35,7 +35,6 @@ 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;
|
||||
|
@ -53,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;
|
||||
|
@ -64,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;
|
||||
|
@ -107,9 +108,13 @@ 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_pointer_axis_event *event);
|
||||
|
@ -140,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
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -4,6 +4,9 @@
|
|||
|
||||
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);
|
||||
|
||||
bool sway_libinput_device_is_builtin(struct sway_input_device *device);
|
||||
|
|
|
@ -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,7 +17,7 @@ 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_pointer_axis_event *event);
|
||||
|
@ -36,14 +38,20 @@ struct sway_seatop_impl {
|
|||
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;
|
||||
};
|
||||
|
||||
|
@ -66,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;
|
||||
|
@ -89,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;
|
||||
|
@ -122,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
|
||||
|
@ -157,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);
|
||||
|
||||
|
@ -187,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);
|
||||
|
||||
|
@ -247,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);
|
||||
|
@ -255,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);
|
||||
|
@ -279,13 +287,13 @@ 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);
|
||||
|
||||
|
@ -318,6 +326,18 @@ void seatop_swipe_update(struct sway_seat *seat,
|
|||
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);
|
||||
|
||||
/**
|
||||
|
@ -332,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);
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
#include <wlr/types/wlr_text_input_v3.h>
|
||||
#include <wlr/types/wlr_input_method_v2.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include "sway/input/seat.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;
|
||||
|
||||
|
|
23
include/sway/input/text_input_popup.h
Normal file
23
include/sway/input/text_input_popup.h
Normal file
|
@ -0,0 +1,23 @@
|
|||
#ifndef _SWAY_INPUT_TEXT_INPUT_POPUP_H
|
||||
#define _SWAY_INPUT_TEXT_INPUT_POPUP_H
|
||||
|
||||
#include "sway/tree/view.h"
|
||||
|
||||
struct sway_input_popup {
|
||||
struct sway_input_method_relay *relay;
|
||||
|
||||
struct wlr_scene_tree *scene_tree;
|
||||
struct sway_popup_desc desc;
|
||||
struct wlr_input_popup_surface_v2 *popup_surface;
|
||||
struct wlr_output *fixed_output;
|
||||
|
||||
struct wl_list link;
|
||||
|
||||
struct wl_listener popup_destroy;
|
||||
struct wl_listener popup_surface_commit;
|
||||
struct wl_listener popup_surface_map;
|
||||
struct wl_listener popup_surface_unmap;
|
||||
|
||||
struct wl_listener focused_surface_unmap;
|
||||
};
|
||||
#endif
|
|
@ -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
|
||||
|
|
|
@ -1,20 +1,19 @@
|
|||
#include <stdbool.h>
|
||||
#include "sway/layers.h"
|
||||
#include "sway/config.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);
|
||||
|
||||
bool layer_criteria_is_equal(struct layer_criteria *a, struct layer_criteria *b);
|
||||
struct layer_criteria *layer_criteria_add(char *namespace, char *cmdlist);
|
||||
|
||||
bool layer_criteria_already_exists(struct layer_criteria *criteria);
|
||||
|
||||
// Gathers all of the matching criterias for a specified `sway_layer_surface`
|
||||
list_t *layer_criterias_for_sway_layer_surface(struct sway_layer_surface *sway_layer);
|
||||
|
||||
// Parses the `layer_criteria` and applies the effects to the `sway_layer_surface`
|
||||
void layer_criteria_parse(struct sway_layer_surface *sway_layer, struct layer_criteria *criteria);
|
||||
// Get the matching criteria for a specified `sway_layer_surface`
|
||||
struct layer_criteria *layer_criteria_for_namespace(char *namespace);
|
||||
|
|
|
@ -3,66 +3,52 @@
|
|||
#include <stdbool.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;
|
||||
|
||||
bool has_shadow;
|
||||
bool has_blur;
|
||||
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
6
include/sway/lock.h
Normal file
|
@ -0,0 +1,6 @@
|
|||
#ifndef _SWAY_LOCK_H
|
||||
#define _SWAY_LOCK_H
|
||||
|
||||
void arrange_locks(void);
|
||||
|
||||
#endif
|
|
@ -1,30 +1,18 @@
|
|||
#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/fx_renderer.h"
|
||||
#include "sway/tree/node.h"
|
||||
#include "sway/tree/view.h"
|
||||
|
||||
struct sway_server;
|
||||
struct sway_container;
|
||||
|
||||
struct render_data {
|
||||
pixman_region32_t *damage;
|
||||
struct wlr_box *clip_box;
|
||||
struct decoration_data deco_data;
|
||||
};
|
||||
|
||||
struct blur_stencil_data {
|
||||
struct fx_texture *stencil_texture;
|
||||
const struct wlr_fbox *stencil_src_box;
|
||||
float *stencil_matrix;
|
||||
};
|
||||
|
||||
struct sway_output_state {
|
||||
list_t *workspaces;
|
||||
struct sway_workspace *active_workspace;
|
||||
|
@ -32,46 +20,62 @@ 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 fx_renderer *renderer;
|
||||
|
||||
struct wl_list layers[4]; // sway_layer_surface::link
|
||||
struct wlr_box usable_area;
|
||||
|
||||
struct timespec last_frame;
|
||||
struct wlr_damage_ring damage_ring;
|
||||
|
||||
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 powered off
|
||||
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;
|
||||
struct wl_listener frame;
|
||||
struct wl_listener needs_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 {
|
||||
|
@ -98,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);
|
||||
|
@ -123,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);
|
||||
|
||||
|
@ -181,28 +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 render_blur(bool optimized, struct sway_output *output,
|
||||
pixman_region32_t *output_damage, const struct wlr_box *dst_box,
|
||||
pixman_region32_t *opaque_region, struct decoration_data *deco_data,
|
||||
struct blur_stencil_data *stencil_data);
|
||||
|
||||
|
||||
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);
|
||||
|
||||
|
@ -213,4 +150,6 @@ void handle_output_power_manager_set_mode(struct wl_listener *listener,
|
|||
|
||||
struct sway_output_non_desktop *output_non_desktop_create(struct wlr_output *wlr_output);
|
||||
|
||||
void update_output_manager_config(struct sway_server *server);
|
||||
|
||||
#endif
|
||||
|
|
33
include/sway/scene_descriptor.h
Normal file
33
include/sway/scene_descriptor.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/**
|
||||
* Across a wayland compositor, there are multiple shells: It can be
|
||||
* a toplevel, or a layer_shell, or even something more meta like a drag
|
||||
* icon or highlight indicators when dragging windows around.
|
||||
*
|
||||
* This object lets us store values that represent these modes of operation
|
||||
* and keep track of what object is being represented.
|
||||
*/
|
||||
#ifndef _SWAY_SCENE_DESCRIPTOR_H
|
||||
#define _SWAY_SCENE_DESCRIPTOR_H
|
||||
#include <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
|
|
@ -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_session_lock_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 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,21 +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 wlr_idle_notifier_v1 *idle_notifier_v1;
|
||||
struct sway_idle_inhibit_manager_v1 *idle_inhibit_manager_v1;
|
||||
struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1;
|
||||
|
||||
struct wlr_layer_shell_v1 *layer_shell;
|
||||
struct 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;
|
||||
|
@ -82,24 +77,21 @@ 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 {
|
||||
bool locked;
|
||||
struct wlr_session_lock_manager_v1 *manager;
|
||||
struct wlr_gamma_control_manager_v1 *gamma_control_manager_v1;
|
||||
struct wl_listener gamma_control_set_gamma;
|
||||
|
||||
struct wlr_session_lock_v1 *lock;
|
||||
struct wlr_surface *focused;
|
||||
struct wl_listener lock_new_surface;
|
||||
struct wl_listener lock_unlock;
|
||||
struct wl_listener lock_destroy;
|
||||
struct {
|
||||
struct sway_session_lock *lock;
|
||||
struct wlr_session_lock_manager_v1 *manager;
|
||||
|
||||
struct wl_listener new_lock;
|
||||
struct wl_listener manager_destroy;
|
||||
|
@ -109,10 +101,23 @@ struct sway_server {
|
|||
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
|
||||
|
||||
|
@ -133,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;
|
||||
|
@ -141,17 +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;
|
||||
|
||||
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);
|
||||
|
@ -159,14 +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 sway_session_lock_init(void);
|
||||
void handle_xdg_shell_surface(struct wl_listener *listener, void *data);
|
||||
#if HAVE_XWAYLAND
|
||||
void sway_session_lock_add_output(struct sway_session_lock *lock,
|
||||
struct sway_output *output);
|
||||
bool sway_session_lock_has_surface(struct sway_session_lock *lock,
|
||||
struct wlr_surface *surface);
|
||||
void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data);
|
||||
#if WLR_HAS_XWAYLAND
|
||||
void handle_xwayland_surface(struct wl_listener *listener, void *data);
|
||||
#endif
|
||||
void handle_server_decoration(struct wl_listener *listener, void *data);
|
||||
|
@ -174,7 +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
|
||||
|
|
|
@ -1,18 +0,0 @@
|
|||
#ifndef _SWAY_SURFACE_H
|
||||
#define _SWAY_SURFACE_H
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
|
||||
struct sway_surface {
|
||||
struct wlr_surface *wlr_surface;
|
||||
|
||||
struct wl_listener destroy;
|
||||
|
||||
/**
|
||||
* This timer can be used for issuing delayed frame done callbacks (for
|
||||
* example, to improve presentation latency). Its handler is set to a
|
||||
* function that issues a frame done callback to this surface.
|
||||
*/
|
||||
struct wl_event_source *frame_done_timer;
|
||||
};
|
||||
|
||||
#endif
|
28
include/sway/sway_text_node.h
Normal file
28
include/sway/sway_text_node.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
#ifndef _SWAY_BUFFER_H
|
||||
#define _SWAY_BUFFER_H
|
||||
#include <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
|
|
@ -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);
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#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_compositor.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,43 +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;
|
||||
|
||||
bool shadow_enabled;
|
||||
|
||||
bool blur_enabled;
|
||||
|
||||
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;
|
||||
|
||||
bool blur_enabled;
|
||||
bool shadow_enabled;
|
||||
float dim;
|
||||
|
||||
struct wlr_texture *title_focused;
|
||||
struct wlr_texture *title_focused_inactive;
|
||||
struct wlr_texture *title_focused_tab_title;
|
||||
struct wlr_texture *title_unfocused;
|
||||
struct wlr_texture *title_urgent;
|
||||
|
||||
list_t *marks; // char *
|
||||
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;
|
||||
|
@ -156,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);
|
||||
|
||||
|
@ -183,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);
|
||||
|
@ -206,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);
|
||||
|
@ -224,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.
|
||||
*/
|
||||
|
@ -291,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,
|
||||
|
@ -358,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);
|
||||
|
@ -383,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
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#ifndef _SWAY_NODE_H
|
||||
#define _SWAY_NODE_H
|
||||
#include <scenefx/types/wlr_scene.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <stdbool.h>
|
||||
#include "list.h"
|
||||
|
||||
|
@ -74,4 +76,19 @@ list_t *node_get_children(struct sway_node *node);
|
|||
|
||||
bool node_has_ancestor(struct sway_node *node, struct sway_node *ancestor);
|
||||
|
||||
// when destroying a sway tree, it's not known which order the tree will be
|
||||
// destroyed. To prevent freeing of scene_nodes recursing up the tree,
|
||||
// let's use this helper function to disown them to the staging node.
|
||||
void scene_node_disown_children(struct wlr_scene_tree *tree);
|
||||
|
||||
// a helper function used to allocate tree nodes. If an allocation failure
|
||||
// occurs a flag is flipped that can be checked later to destroy a parent
|
||||
// of this scene node preventing memory leaks.
|
||||
struct wlr_scene_tree *alloc_scene_tree(struct wlr_scene_tree *parent,
|
||||
bool *failed);
|
||||
|
||||
struct wlr_scene_shadow *alloc_scene_shadow(struct wlr_scene_tree *parent,
|
||||
int width, int height, int corner_radius, float blur_sigma,
|
||||
const float color [static 4], bool *failed);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
#ifndef _SWAY_ROOT_H
|
||||
#define _SWAY_ROOT_H
|
||||
#include <scenefx/types/wlr_scene.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wayland-util.h>
|
||||
#include <wlr/config.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/render/wlr_texture.h>
|
||||
#include "sway/tree/container.h"
|
||||
#include "sway/tree/node.h"
|
||||
#include "config.h"
|
||||
#include "list.h"
|
||||
|
||||
extern struct sway_root *root;
|
||||
|
@ -15,11 +16,44 @@ struct sway_root {
|
|||
struct sway_node node;
|
||||
struct wlr_output_layout *output_layout;
|
||||
|
||||
struct wl_listener output_layout_change;
|
||||
#if HAVE_XWAYLAND
|
||||
struct wl_list xwayland_unmanaged; // sway_xwayland_unmanaged::link
|
||||
// scene node layout:
|
||||
// - root
|
||||
// - staging
|
||||
// - layer shell stuff
|
||||
// - tiling
|
||||
// - floating
|
||||
// - fullscreen stuff
|
||||
// - seat stuff
|
||||
// - ext_session_lock
|
||||
struct wlr_scene *root_scene;
|
||||
|
||||
// since wlr_scene nodes can't be orphaned and must always
|
||||
// have a parent, use this staging scene_tree so that a
|
||||
// node always have a valid parent. Nothing in this
|
||||
// staging node will be visible.
|
||||
struct wlr_scene_tree *staging;
|
||||
|
||||
// tree containing all layers the compositor will render. Cursor handling
|
||||
// will end up iterating this tree.
|
||||
struct wlr_scene_tree *layer_tree;
|
||||
|
||||
struct {
|
||||
struct wlr_scene_tree *shell_background;
|
||||
struct wlr_scene_tree *shell_bottom;
|
||||
struct wlr_scene_tree *blur_tree;
|
||||
struct wlr_scene_tree *tiling;
|
||||
struct wlr_scene_tree *floating;
|
||||
struct wlr_scene_tree *shell_top;
|
||||
struct wlr_scene_tree *fullscreen;
|
||||
struct wlr_scene_tree *fullscreen_global;
|
||||
#if WLR_HAS_XWAYLAND
|
||||
struct wlr_scene_tree *unmanaged;
|
||||
#endif
|
||||
struct wl_list drag_icons; // sway_drag_icon::link
|
||||
struct wlr_scene_tree *shell_overlay;
|
||||
struct wlr_scene_tree *popup;
|
||||
struct wlr_scene_tree *seat;
|
||||
struct wlr_scene_tree *session_lock;
|
||||
} layers;
|
||||
|
||||
// Includes disabled outputs
|
||||
struct wl_list all_outputs; // sway_output::link
|
||||
|
@ -41,7 +75,7 @@ struct sway_root {
|
|||
} events;
|
||||
};
|
||||
|
||||
struct sway_root *root_create(void);
|
||||
struct sway_root *root_create(struct wl_display *display);
|
||||
|
||||
void root_destroy(struct sway_root *root);
|
||||
|
||||
|
|
|
@ -1,9 +1,12 @@
|
|||
#ifndef _SWAY_VIEW_H
|
||||
#define _SWAY_VIEW_H
|
||||
#include <scenefx/types/wlr_scene.h>
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/config.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include "config.h"
|
||||
#if HAVE_XWAYLAND
|
||||
#include <wlr/types/wlr_tearing_control_v1.h>
|
||||
#include "sway/config.h"
|
||||
#if WLR_HAS_XWAYLAND
|
||||
#include <wlr/xwayland.h>
|
||||
#endif
|
||||
#include "sway/input/input-manager.h"
|
||||
|
@ -14,7 +17,7 @@ struct sway_xdg_decoration;
|
|||
|
||||
enum sway_view_type {
|
||||
SWAY_VIEW_XDG_SHELL,
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
SWAY_VIEW_XWAYLAND,
|
||||
#endif
|
||||
};
|
||||
|
@ -26,12 +29,18 @@ enum sway_view_prop {
|
|||
VIEW_PROP_INSTANCE,
|
||||
VIEW_PROP_WINDOW_TYPE,
|
||||
VIEW_PROP_WINDOW_ROLE,
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
VIEW_PROP_X11_WINDOW_ID,
|
||||
VIEW_PROP_X11_PARENT_ID,
|
||||
#endif
|
||||
};
|
||||
|
||||
enum sway_view_tearing_mode {
|
||||
TEARING_OVERRIDE_FALSE,
|
||||
TEARING_OVERRIDE_TRUE,
|
||||
TEARING_WINDOW_HINT,
|
||||
};
|
||||
|
||||
struct sway_view_impl {
|
||||
void (*get_constraints)(struct sway_view *view, double *min_width,
|
||||
double *max_width, double *min_height, double *max_height);
|
||||
|
@ -45,10 +54,6 @@ struct sway_view_impl {
|
|||
void (*set_fullscreen)(struct sway_view *view, bool fullscreen);
|
||||
void (*set_resizing)(struct sway_view *view, bool resizing);
|
||||
bool (*wants_floating)(struct sway_view *view);
|
||||
void (*for_each_surface)(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||
void (*for_each_popup_surface)(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||
bool (*is_transient_for)(struct sway_view *child,
|
||||
struct sway_view *ancestor);
|
||||
void (*close)(struct sway_view *view);
|
||||
|
@ -56,19 +61,14 @@ struct sway_view_impl {
|
|||
void (*destroy)(struct sway_view *view);
|
||||
};
|
||||
|
||||
struct sway_saved_buffer {
|
||||
struct wlr_client_buffer *buffer;
|
||||
int x, y;
|
||||
int width, height;
|
||||
enum wl_output_transform transform;
|
||||
struct wlr_fbox source_box;
|
||||
struct wl_list link; // sway_view::saved_buffers
|
||||
};
|
||||
|
||||
struct sway_view {
|
||||
enum sway_view_type type;
|
||||
const struct sway_view_impl *impl;
|
||||
|
||||
struct wlr_scene_tree *scene_tree;
|
||||
struct wlr_scene_tree *content_tree;
|
||||
struct wlr_scene_tree *saved_surface_tree;
|
||||
|
||||
struct sway_container *container; // NULL if unmapped and transactions finished
|
||||
struct wlr_surface *surface; // NULL for unmapped views
|
||||
struct sway_xdg_decoration *xdg_decoration;
|
||||
|
@ -80,30 +80,24 @@ struct sway_view {
|
|||
// Used when changing a view from tiled to floating.
|
||||
int natural_width, natural_height;
|
||||
|
||||
char *title_format;
|
||||
|
||||
bool using_csd;
|
||||
|
||||
struct timespec urgent;
|
||||
bool allow_request_urgent;
|
||||
struct wl_event_source *urgent_timer;
|
||||
|
||||
struct wl_list saved_buffers; // sway_saved_buffer::link
|
||||
|
||||
// The geometry for whatever the client is committing, regardless of
|
||||
// transaction state. Updated on every commit.
|
||||
struct wlr_box geometry;
|
||||
|
||||
// The "old" geometry during a transaction. Used to damage the old location
|
||||
// when a transaction is applied.
|
||||
struct wlr_box saved_geometry;
|
||||
struct wlr_ext_foreign_toplevel_handle_v1 *ext_foreign_toplevel;
|
||||
|
||||
struct wlr_foreign_toplevel_handle_v1 *foreign_toplevel;
|
||||
struct wl_listener foreign_activate_request;
|
||||
struct wl_listener foreign_fullscreen_request;
|
||||
struct wl_listener foreign_close_request;
|
||||
struct wl_listener foreign_destroy;
|
||||
struct wl_listener foreign_minimize;
|
||||
struct wl_listener foreign_destroy;
|
||||
|
||||
bool destroying;
|
||||
|
||||
|
@ -111,7 +105,7 @@ struct sway_view {
|
|||
|
||||
union {
|
||||
struct wlr_xdg_toplevel *wlr_xdg_toplevel;
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
||||
#endif
|
||||
};
|
||||
|
@ -120,11 +114,12 @@ struct sway_view {
|
|||
struct wl_signal unmap;
|
||||
} events;
|
||||
|
||||
struct wl_listener surface_new_subsurface;
|
||||
|
||||
int max_render_time; // In milliseconds
|
||||
|
||||
enum seat_config_shortcuts_inhibit shortcuts_inhibit;
|
||||
|
||||
enum sway_view_tearing_mode tearing_mode;
|
||||
enum wp_tearing_control_v1_presentation_hint tearing_hint;
|
||||
};
|
||||
|
||||
struct sway_xdg_shell_view {
|
||||
|
@ -143,10 +138,12 @@ struct sway_xdg_shell_view {
|
|||
struct wl_listener unmap;
|
||||
struct wl_listener destroy;
|
||||
};
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
struct sway_xwayland_view {
|
||||
struct sway_view view;
|
||||
|
||||
struct wlr_scene_tree *surface_tree;
|
||||
|
||||
struct wl_listener commit;
|
||||
struct wl_listener request_move;
|
||||
struct wl_listener request_resize;
|
||||
|
@ -162,69 +159,51 @@ struct sway_xwayland_view {
|
|||
struct wl_listener set_window_type;
|
||||
struct wl_listener set_hints;
|
||||
struct wl_listener set_decorations;
|
||||
struct wl_listener associate;
|
||||
struct wl_listener dissociate;
|
||||
struct wl_listener map;
|
||||
struct wl_listener unmap;
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener override_redirect;
|
||||
|
||||
struct wl_listener surface_tree_destroy;
|
||||
};
|
||||
|
||||
struct sway_xwayland_unmanaged {
|
||||
struct wlr_xwayland_surface *wlr_xwayland_surface;
|
||||
struct wl_list link;
|
||||
|
||||
int lx, ly;
|
||||
struct wlr_scene_surface *surface_scene;
|
||||
|
||||
struct wl_listener request_activate;
|
||||
struct wl_listener request_configure;
|
||||
struct wl_listener request_fullscreen;
|
||||
struct wl_listener commit;
|
||||
struct wl_listener set_geometry;
|
||||
struct wl_listener associate;
|
||||
struct wl_listener dissociate;
|
||||
struct wl_listener map;
|
||||
struct wl_listener unmap;
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener override_redirect;
|
||||
};
|
||||
#endif
|
||||
struct sway_view_child;
|
||||
|
||||
struct sway_view_child_impl {
|
||||
void (*get_view_coords)(struct sway_view_child *child, int *sx, int *sy);
|
||||
void (*destroy)(struct sway_view_child *child);
|
||||
};
|
||||
|
||||
/**
|
||||
* A view child is a surface in the view tree, such as a subsurface or a popup.
|
||||
*/
|
||||
struct sway_view_child {
|
||||
const struct sway_view_child_impl *impl;
|
||||
struct wl_list link;
|
||||
|
||||
struct sway_popup_desc {
|
||||
struct wlr_scene_node *relative;
|
||||
struct sway_view *view;
|
||||
struct sway_view_child *parent;
|
||||
struct wl_list children; // sway_view_child::link
|
||||
struct wlr_surface *surface;
|
||||
bool mapped;
|
||||
|
||||
struct wl_listener surface_commit;
|
||||
struct wl_listener surface_new_subsurface;
|
||||
struct wl_listener surface_map;
|
||||
struct wl_listener surface_unmap;
|
||||
struct wl_listener surface_destroy;
|
||||
struct wl_listener view_unmap;
|
||||
};
|
||||
|
||||
struct sway_subsurface {
|
||||
struct sway_view_child child;
|
||||
|
||||
struct wl_listener destroy;
|
||||
};
|
||||
|
||||
struct sway_xdg_popup {
|
||||
struct sway_view_child child;
|
||||
struct sway_view *view;
|
||||
|
||||
struct wlr_scene_tree *scene_tree;
|
||||
struct wlr_scene_tree *xdg_surface_tree;
|
||||
struct wlr_xdg_popup *wlr_xdg_popup;
|
||||
|
||||
struct sway_popup_desc desc;
|
||||
|
||||
struct wl_listener surface_commit;
|
||||
struct wl_listener new_popup;
|
||||
struct wl_listener reposition;
|
||||
struct wl_listener destroy;
|
||||
};
|
||||
|
||||
|
@ -273,7 +252,12 @@ void view_set_activated(struct sway_view *view, bool activated);
|
|||
/**
|
||||
* Called when the view requests to be focused.
|
||||
*/
|
||||
void view_request_activate(struct sway_view *view);
|
||||
void view_request_activate(struct sway_view *view, struct sway_seat *seat);
|
||||
|
||||
/*
|
||||
* Called when the view requests urgent state
|
||||
*/
|
||||
void view_request_urgent(struct sway_view *view);
|
||||
|
||||
/**
|
||||
* If possible, instructs the client to change their decoration mode.
|
||||
|
@ -292,23 +276,9 @@ void view_close(struct sway_view *view);
|
|||
|
||||
void view_close_popups(struct sway_view *view);
|
||||
|
||||
void view_damage_from(struct sway_view *view);
|
||||
|
||||
/**
|
||||
* Iterate all surfaces of a view (toplevels + popups).
|
||||
*/
|
||||
void view_for_each_surface(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||
|
||||
/**
|
||||
* Iterate all popup surfaces of a view.
|
||||
*/
|
||||
void view_for_each_popup_surface(struct sway_view *view,
|
||||
wlr_surface_iterator_func_t iterator, void *user_data);
|
||||
|
||||
// view implementation
|
||||
|
||||
void view_init(struct sway_view *view, enum sway_view_type type,
|
||||
bool view_init(struct sway_view *view, enum sway_view_type type,
|
||||
const struct sway_view_impl *impl);
|
||||
|
||||
void view_destroy(struct sway_view *view);
|
||||
|
@ -330,23 +300,18 @@ void view_map(struct sway_view *view, struct wlr_surface *wlr_surface,
|
|||
void view_unmap(struct sway_view *view);
|
||||
|
||||
void view_update_size(struct sway_view *view);
|
||||
void view_center_surface(struct sway_view *view);
|
||||
|
||||
void view_child_init(struct sway_view_child *child,
|
||||
const struct sway_view_child_impl *impl, struct sway_view *view,
|
||||
struct wlr_surface *surface);
|
||||
|
||||
void view_child_destroy(struct sway_view_child *child);
|
||||
|
||||
void view_center_and_clip_surface(struct sway_view *view);
|
||||
|
||||
struct sway_view *view_from_wlr_xdg_surface(
|
||||
struct wlr_xdg_surface *xdg_surface);
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
struct sway_view *view_from_wlr_xwayland_surface(
|
||||
struct wlr_xwayland_surface *xsurface);
|
||||
#endif
|
||||
struct sway_view *view_from_wlr_surface(struct wlr_surface *surface);
|
||||
|
||||
void view_update_app_id(struct sway_view *view);
|
||||
|
||||
/**
|
||||
* Re-read the view's title property and update any relevant title bars.
|
||||
* The force argument makes it recreate the title bars even if the title hasn't
|
||||
|
@ -378,6 +343,8 @@ bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor);
|
|||
|
||||
void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx);
|
||||
|
||||
bool gaps_to_edge(struct sway_view *view);
|
||||
void view_send_frame_done(struct sway_view *view);
|
||||
|
||||
bool view_can_tear(struct sway_view *view);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
#ifndef _SWAY_WORKSPACE_H
|
||||
#define _SWAY_WORKSPACE_H
|
||||
|
||||
#include <scenefx/types/wlr_scene.h>
|
||||
#include <stdbool.h>
|
||||
#include "sway/config.h"
|
||||
#include "sway/tree/container.h"
|
||||
#include "sway/tree/node.h"
|
||||
|
||||
|
@ -22,6 +24,12 @@ struct sway_workspace_state {
|
|||
|
||||
struct sway_workspace {
|
||||
struct sway_node node;
|
||||
|
||||
struct {
|
||||
struct wlr_scene_tree *tiling;
|
||||
struct wlr_scene_tree *fullscreen;
|
||||
} layers;
|
||||
|
||||
struct sway_container *fullscreen;
|
||||
|
||||
char *name;
|
||||
|
@ -92,9 +100,6 @@ struct sway_output *workspace_output_get_highest_available(
|
|||
|
||||
void workspace_detect_urgent(struct sway_workspace *workspace);
|
||||
|
||||
bool workspace_get_blur_info(struct sway_workspace *ws,
|
||||
pixman_region32_t *blur_region);
|
||||
|
||||
void workspace_for_each_container(struct sway_workspace *ws,
|
||||
void (*f)(struct sway_container *con, void *data), void *data);
|
||||
|
||||
|
|
|
@ -16,4 +16,6 @@ struct sway_xdg_decoration {
|
|||
struct sway_xdg_decoration *xdg_decoration_from_surface(
|
||||
struct wlr_surface *surface);
|
||||
|
||||
void set_xdg_decoration_mode(struct sway_xdg_decoration *deco);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -4,6 +4,7 @@
|
|||
#include "config.h"
|
||||
#include "input.h"
|
||||
#include "pool-buffer.h"
|
||||
#include "cursor-shape-v1-client-protocol.h"
|
||||
#include "wlr-layer-shell-unstable-v1-client-protocol.h"
|
||||
#include "xdg-output-unstable-v1-client-protocol.h"
|
||||
|
||||
|
@ -30,6 +31,7 @@ struct swaybar {
|
|||
struct wl_compositor *compositor;
|
||||
struct zwlr_layer_shell_v1 *layer_shell;
|
||||
struct zxdg_output_manager_v1 *xdg_output_manager;
|
||||
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
|
||||
struct wl_shm *shm;
|
||||
|
||||
struct swaybar_config *config;
|
||||
|
|
7
include/swaybar/image.h
Normal file
7
include/swaybar/image.h
Normal file
|
@ -0,0 +1,7 @@
|
|||
#ifndef _SWAYBAR_IMAGE_H
|
||||
#define _SWAYBAR_IMAGE_H
|
||||
#include <cairo.h>
|
||||
|
||||
cairo_surface_t *load_image(const char *path);
|
||||
|
||||
#endif
|
|
@ -4,6 +4,7 @@
|
|||
#include <cairo.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
#include <wayland-util.h>
|
||||
#include "swaybar/tray/tray.h"
|
||||
#include "list.h"
|
||||
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include <strings.h>
|
||||
#include "list.h"
|
||||
#include "pool-buffer.h"
|
||||
#include "cursor-shape-v1-client-protocol.h"
|
||||
|
||||
#include "swaynag/types.h"
|
||||
|
||||
#define SWAYNAG_MAX_HEIGHT 500
|
||||
|
@ -58,6 +60,7 @@ struct swaynag_button {
|
|||
struct swaynag_details {
|
||||
bool visible;
|
||||
char *message;
|
||||
char *details_text;
|
||||
|
||||
int x;
|
||||
int y;
|
||||
|
@ -67,7 +70,7 @@ struct swaynag_details {
|
|||
int offset;
|
||||
int visible_lines;
|
||||
int total_lines;
|
||||
struct swaynag_button button_details;
|
||||
struct swaynag_button *button_details;
|
||||
struct swaynag_button button_up;
|
||||
struct swaynag_button button_down;
|
||||
};
|
||||
|
@ -84,6 +87,7 @@ struct swaynag {
|
|||
struct swaynag_output *output;
|
||||
struct zwlr_layer_shell_v1 *layer_shell;
|
||||
struct zwlr_layer_surface_v1 *layer_surface;
|
||||
struct wp_cursor_shape_manager_v1 *cursor_shape_manager;
|
||||
struct wl_surface *surface;
|
||||
|
||||
uint32_t width;
|
||||
|
|
|
@ -1,10 +1,13 @@
|
|||
#ifndef _SWAYNAG_TYPES_H
|
||||
#define _SWAYNAG_TYPES_H
|
||||
|
||||
#include <stdint.h>
|
||||
#include <pango/pangocairo.h>
|
||||
#include "list.h"
|
||||
|
||||
struct swaynag_type {
|
||||
char *name;
|
||||
|
||||
char *font; // Used for debugging.
|
||||
PangoFontDescription *font_description;
|
||||
char *output;
|
||||
uint32_t anchors;
|
||||
|
|
145
meson.build
145
meson.build
|
@ -1,23 +1,27 @@
|
|||
project(
|
||||
'sway',
|
||||
'c',
|
||||
version: '0.3.2',
|
||||
version: '0.5',
|
||||
license: 'MIT',
|
||||
meson_version: '>=0.60.0',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
'warning_level=2',
|
||||
'werror=true',
|
||||
'werror=false',
|
||||
],
|
||||
)
|
||||
|
||||
original_version = '1.10.1'
|
||||
|
||||
add_project_arguments(
|
||||
[
|
||||
'-DWLR_USE_UNSTABLE',
|
||||
'-O',
|
||||
'-D_POSIX_C_SOURCE=200809L',
|
||||
|
||||
'-Wno-unused-parameter',
|
||||
'-Wno-unused-result',
|
||||
'-Wno-missing-braces',
|
||||
'-Wno-format-zero-length',
|
||||
'-Wundef',
|
||||
'-Wvla',
|
||||
],
|
||||
|
@ -40,47 +44,21 @@ subproject(
|
|||
'scenefx',
|
||||
required: false,
|
||||
)
|
||||
scenefx = dependency('scenefx-0.2', fallback: 'scenefx')
|
||||
|
||||
# Execute the wlroots subproject, if any
|
||||
wlroots_version = ['>=0.17.0', '<0.18.0']
|
||||
wlroots_version = ['>=0.18.0', '<0.19.0']
|
||||
subproject(
|
||||
'wlroots',
|
||||
default_options: ['examples=false'],
|
||||
required: false,
|
||||
version: wlroots_version,
|
||||
)
|
||||
|
||||
jsonc = dependency('json-c', version: '>=0.13')
|
||||
pcre2 = dependency('libpcre2-8')
|
||||
wayland_server = dependency('wayland-server', version: '>=1.21.0')
|
||||
wayland_client = dependency('wayland-client')
|
||||
wayland_cursor = dependency('wayland-cursor')
|
||||
wayland_egl = dependency('wayland-egl')
|
||||
egl = dependency('egl')
|
||||
wayland_protos = dependency('wayland-protocols', version: '>=1.24')
|
||||
wlroots = dependency('wlroots', version: wlroots_version)
|
||||
xkbcommon = dependency('xkbcommon')
|
||||
cairo = dependency('cairo')
|
||||
pango = dependency('pango')
|
||||
pangocairo = dependency('pangocairo')
|
||||
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
|
||||
pixman = dependency('pixman-1')
|
||||
glesv2 = dependency('glesv2')
|
||||
libevdev = dependency('libevdev')
|
||||
libinput = dependency('libinput', version: '>=1.21.0')
|
||||
xcb = dependency('xcb', required: get_option('xwayland'))
|
||||
drm_full = dependency('libdrm') # only needed for drm_fourcc.h
|
||||
drm = drm_full.partial_dependency(compile_args: true, includes: true)
|
||||
libudev = dependency('libudev')
|
||||
bash_comp = dependency('bash-completion', required: false)
|
||||
fish_comp = dependency('fish', required: false)
|
||||
math = cc.find_library('m')
|
||||
rt = cc.find_library('rt')
|
||||
xcb_icccm = dependency('xcb-icccm', required: get_option('xwayland'))
|
||||
threads = dependency('threads') # for pthread_setschedparam
|
||||
|
||||
wlroots = dependency('wlroots-0.18', version: wlroots_version, fallback: 'wlroots')
|
||||
wlroots_features = {
|
||||
'xwayland': false,
|
||||
'libinput_backend': false,
|
||||
'session': false,
|
||||
}
|
||||
foreach name, _ : wlroots_features
|
||||
var_name = 'have_' + name.underscorify()
|
||||
|
@ -88,10 +66,29 @@ foreach name, _ : wlroots_features
|
|||
wlroots_features += { name: have }
|
||||
endforeach
|
||||
|
||||
if get_option('xwayland').enabled() and not wlroots_features['xwayland']
|
||||
error('Cannot enable Xwayland in sway: wlroots has been built without Xwayland support')
|
||||
endif
|
||||
have_xwayland = xcb.found() and xcb_icccm.found() and wlroots_features['xwayland']
|
||||
null_dep = dependency('', required: false)
|
||||
|
||||
jsonc = dependency('json-c', version: '>=0.13')
|
||||
pcre2 = dependency('libpcre2-8')
|
||||
wayland_server = dependency('wayland-server', version: '>=1.21.0')
|
||||
wayland_client = dependency('wayland-client')
|
||||
wayland_cursor = dependency('wayland-cursor')
|
||||
wayland_protos = dependency('wayland-protocols', version: '>=1.24', default_options: ['tests=false'])
|
||||
xkbcommon = dependency('xkbcommon', version: '>=1.5.0')
|
||||
cairo = dependency('cairo')
|
||||
pango = dependency('pango')
|
||||
pangocairo = dependency('pangocairo')
|
||||
gdk_pixbuf = dependency('gdk-pixbuf-2.0', required: get_option('gdk-pixbuf'))
|
||||
pixman = dependency('pixman-1')
|
||||
libevdev = dependency('libevdev')
|
||||
libinput = wlroots_features['libinput_backend'] ? dependency('libinput', version: '>=1.26.0') : null_dep
|
||||
xcb = wlroots_features['xwayland'] ? dependency('xcb') : null_dep
|
||||
drm = dependency('libdrm')
|
||||
libudev = wlroots_features['libinput_backend'] ? dependency('libudev') : null_dep
|
||||
math = cc.find_library('m')
|
||||
rt = cc.find_library('rt')
|
||||
xcb_icccm = wlroots_features['xwayland'] ? dependency('xcb-icccm') : null_dep
|
||||
threads = dependency('threads') # for pthread_setschedparam
|
||||
|
||||
if get_option('sd-bus-provider') == 'auto'
|
||||
if not get_option('tray').disabled()
|
||||
|
@ -116,17 +113,14 @@ have_tray = (not get_option('tray').disabled()) and tray_deps_found
|
|||
|
||||
conf_data = configuration_data()
|
||||
|
||||
conf_data.set10('HAVE_XWAYLAND', have_xwayland)
|
||||
conf_data.set10('HAVE_GDK_PIXBUF', gdk_pixbuf.found())
|
||||
conf_data.set10('HAVE_LIBSYSTEMD', sdbus.found() and sdbus.name() == 'libsystemd')
|
||||
conf_data.set10('HAVE_LIBELOGIND', sdbus.found() and sdbus.name() == 'libelogind')
|
||||
conf_data.set10('HAVE_BASU', sdbus.found() and sdbus.name() == 'basu')
|
||||
conf_data.set10('HAVE_TRAY', have_tray)
|
||||
conf_data.set10('HAVE_LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM', cc.has_header_symbol(
|
||||
'libinput.h',
|
||||
'LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM',
|
||||
dependencies: libinput,
|
||||
))
|
||||
foreach sym : ['LIBINPUT_CONFIG_ACCEL_PROFILE_CUSTOM', 'LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY']
|
||||
conf_data.set10('HAVE_' + sym, cc.has_header_symbol('libinput.h', sym, dependencies: libinput))
|
||||
endforeach
|
||||
|
||||
scdoc = dependency('scdoc', version: '>=1.9.2', native: true, required: get_option('man-pages'))
|
||||
if scdoc.found()
|
||||
|
@ -173,8 +167,8 @@ add_project_arguments('-DSYSCONFDIR="/@0@"'.format(join_paths(prefix, sysconfdir
|
|||
version = '"@0@"'.format(meson.project_version())
|
||||
git = find_program('git', native: true, required: false)
|
||||
if git.found()
|
||||
git_commit = run_command([git, 'rev-parse', '--short', 'HEAD'], check: false)
|
||||
git_branch = run_command([git, 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
|
||||
git_commit = run_command([git, '--git-dir=.git', 'rev-parse', '--short', 'HEAD'], check: false)
|
||||
git_branch = run_command([git, '--git-dir=.git', 'rev-parse', '--abbrev-ref', 'HEAD'], check: false)
|
||||
if git_commit.returncode() == 0 and git_branch.returncode() == 0
|
||||
version = '"@0@-@1@ (" __DATE__ ", branch \'@2@\')"'.format(
|
||||
meson.project_version(),
|
||||
|
@ -184,7 +178,8 @@ if git.found()
|
|||
endif
|
||||
endif
|
||||
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
|
||||
add_project_arguments('-DSWAY_ORIGINAL_VERSION="1.8.1"', language: 'c')
|
||||
add_project_arguments('-DSWAY_ORIGINAL_VERSION="@0@"'.format(original_version), language: 'c')
|
||||
add_project_arguments('-DSCENEFX_VERSION="@0@"'.format(scenefx.version()), language: 'c')
|
||||
|
||||
# Compute the relative path used by compiler invocations.
|
||||
source_root = meson.current_source_dir().split('/')
|
||||
|
@ -275,64 +270,10 @@ if get_option('default-wallpaper')
|
|||
install_data(wallpaper_files, install_dir: wallpaper_install_dir)
|
||||
endif
|
||||
|
||||
if get_option('zsh-completions')
|
||||
zsh_files = files(
|
||||
'completions/zsh/_sway',
|
||||
'completions/zsh/_swaymsg',
|
||||
)
|
||||
zsh_install_dir = join_paths(datadir, 'zsh', 'site-functions')
|
||||
|
||||
install_data(zsh_files, install_dir: zsh_install_dir)
|
||||
endif
|
||||
|
||||
if get_option('bash-completions')
|
||||
bash_files = files(
|
||||
'completions/bash/sway',
|
||||
'completions/bash/swaymsg',
|
||||
)
|
||||
|
||||
if get_option('swaybar')
|
||||
bash_files += files('completions/bash/swaybar')
|
||||
endif
|
||||
|
||||
if bash_comp.found()
|
||||
bash_install_dir = bash_comp.get_variable(
|
||||
pkgconfig: 'completionsdir',
|
||||
pkgconfig_define: ['datadir', datadir]
|
||||
)
|
||||
else
|
||||
bash_install_dir = join_paths(datadir, 'bash-completion', 'completions')
|
||||
endif
|
||||
|
||||
install_data(bash_files, install_dir: bash_install_dir)
|
||||
endif
|
||||
|
||||
if get_option('fish-completions')
|
||||
fish_files = files(
|
||||
'completions/fish/sway.fish',
|
||||
'completions/fish/swaymsg.fish',
|
||||
)
|
||||
|
||||
if get_option('swaynag')
|
||||
fish_files += files('completions/fish/swaynag.fish')
|
||||
endif
|
||||
|
||||
if fish_comp.found()
|
||||
fish_install_dir = fish_comp.get_variable(
|
||||
pkgconfig: 'completionsdir',
|
||||
pkgconfig_define: ['datadir', datadir]
|
||||
)
|
||||
else
|
||||
fish_install_dir = join_paths(datadir, 'fish', 'vendor_completions.d')
|
||||
endif
|
||||
|
||||
install_data(fish_files, install_dir: fish_install_dir)
|
||||
endif
|
||||
subdir('completions')
|
||||
|
||||
summary({
|
||||
'xwayland': have_xwayland,
|
||||
'gdk-pixbuf': gdk_pixbuf.found(),
|
||||
'tray': have_tray,
|
||||
'man-pages': scdoc.found(),
|
||||
}, bool_yn: true)
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue