mirror of
https://github.com/swaywm/sway.git
synced 2026-06-13 14:33:19 -04:00
Merge branch 'master' into mouse_warping_position
This commit is contained in:
commit
2383cd6d37
158 changed files with 4587 additions and 2237 deletions
|
|
@ -4,6 +4,7 @@ packages:
|
|||
- eudev-dev
|
||||
- gdk-pixbuf-dev
|
||||
- json-c-dev
|
||||
- lcms2-dev
|
||||
- libdisplay-info-dev
|
||||
- libevdev-dev
|
||||
- libinput-dev
|
||||
|
|
@ -28,23 +29,28 @@ sources:
|
|||
tasks:
|
||||
- wlroots: |
|
||||
cd wlroots
|
||||
meson --prefix=/usr build -Dexamples=false
|
||||
meson setup --prefix=/usr build -Dexamples=false
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
- setup: |
|
||||
cd sway
|
||||
meson build --fatal-meson-warnings -Dauto_features=enabled -Dtray=disabled
|
||||
meson setup build --fatal-meson-warnings -Dauto_features=enabled -Dtray=disabled
|
||||
- build: |
|
||||
cd sway
|
||||
ninja -C build
|
||||
- build-no-xwayland: |
|
||||
cd sway
|
||||
cd wlroots
|
||||
meson configure build -Dxwayland=disabled
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
cd ../sway
|
||||
meson configure build --clearcache
|
||||
ninja -C build
|
||||
- build-static: |
|
||||
cd sway
|
||||
mkdir subprojects
|
||||
ln -s ../../wlroots subprojects/wlroots
|
||||
rm -rf build
|
||||
meson build --fatal-meson-warnings --default-library=static --force-fallback-for=wlroots
|
||||
meson setup build --fatal-meson-warnings --default-library=static --force-fallback-for=wlroots
|
||||
ninja -C build
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ packages:
|
|||
- cairo
|
||||
- gdk-pixbuf2
|
||||
- json-c
|
||||
- lcms2
|
||||
- libdisplay-info
|
||||
- libegl
|
||||
- libinput
|
||||
|
|
@ -25,12 +26,12 @@ sources:
|
|||
tasks:
|
||||
- wlroots: |
|
||||
cd wlroots
|
||||
meson --prefix=/usr build -Dexamples=false
|
||||
meson setup --prefix=/usr build -Dexamples=false
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
- setup: |
|
||||
cd sway
|
||||
meson build --fatal-meson-warnings -Dauto_features=enabled -Dsd-bus-provider=libsystemd
|
||||
meson setup build --fatal-meson-warnings -Dauto_features=enabled -Dsd-bus-provider=libsystemd
|
||||
- build: |
|
||||
cd sway
|
||||
ninja -C build
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ packages:
|
|||
- devel/pkgconf
|
||||
- graphics/cairo
|
||||
- graphics/gdk-pixbuf2
|
||||
- graphics/lcms2
|
||||
- graphics/wayland
|
||||
- graphics/wayland-protocols
|
||||
- textproc/scdoc
|
||||
|
|
@ -26,7 +27,7 @@ packages:
|
|||
- x11/libX11
|
||||
- x11/pixman
|
||||
- x11/xcb-util-wm
|
||||
- x11-servers/xwayland-devel
|
||||
- x11-servers/xwayland
|
||||
- misc/hwdata
|
||||
sources:
|
||||
- https://github.com/swaywm/sway
|
||||
|
|
@ -38,7 +39,7 @@ tasks:
|
|||
cd subprojects
|
||||
ln -s ../../wlroots wlroots
|
||||
cd ..
|
||||
meson build --fatal-meson-warnings -Dtray=enabled -Dsd-bus-provider=basu
|
||||
meson setup build --fatal-meson-warnings -Dtray=enabled -Dsd-bus-provider=basu
|
||||
- build: |
|
||||
cd sway
|
||||
ninja -C build
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ _\* Compile-time dep_
|
|||
|
||||
نفذ هذه الأوامر:
|
||||
|
||||
meson build/
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
|
|
|
|||
66
README.az.md
Normal file
66
README.az.md
Normal file
|
|
@ -0,0 +1,66 @@
|
|||
# sway
|
||||
|
||||
sway [i3]-ə uyğun [Wayland] kompozitorudur. [Tez-tez verilən sualları] oxuyun.
|
||||
[IRC kanalına] qoşulun ("irc.libera.chat"-da #sway).
|
||||
|
||||
## Buraxılış İmzaları
|
||||
|
||||
Buraxılışlar [E88F5E48] ilə imzalanıb və [GitHub-da][GitHub releases] dərc edilib.
|
||||
|
||||
## Quraşdırma
|
||||
|
||||
### Paketlərdən
|
||||
|
||||
Sway bir çox distributivdə mövcuddur. Öz distributiviniz üçün
|
||||
"sway" paketini quraşdırmağa çalışın.
|
||||
|
||||
### Mənbə kodundan kompilyasiya
|
||||
|
||||
Test və ya inkişaf üçün sway və wlroots-un HEAD-ini qurmaq istəyirsinizsə,
|
||||
[bu viki səhifəsini][Development setup] nəzərdən keçirin.
|
||||
|
||||
Asılılıqları quraşdırın:
|
||||
|
||||
* meson \*
|
||||
* [wlroots]
|
||||
* wayland
|
||||
* wayland-protocols \*
|
||||
* pcre2
|
||||
* json-c
|
||||
* pango
|
||||
* cairo
|
||||
* gdk-pixbuf2 (ixtiyari: sistem trayı üçün əlavə şəkil formatları)
|
||||
* [swaybg] (ixtiyari: divar kağızı)
|
||||
* [scdoc] (ixtiyari: man səhifələri) \*
|
||||
* git (ixtiyari: versiya məlumatı) \*
|
||||
|
||||
_\* Kompilyasiya asılılıqları_
|
||||
|
||||
Bu əmrləri icra edin:
|
||||
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
## Konfiqurasiya
|
||||
|
||||
Əgər artıq i3-dən istifadə edirsinizsə, i3 konfiqurasiyanızı `~/.config/sway/config`
|
||||
ünvanına köçürün və o, dərhal işləyəcək. Əks halda, nümunə konfiqurasiya faylını
|
||||
`~/.config/sway/config` ünvanına köçürün. O, adətən `/etc/sway/config` ünvanında yerləşir.
|
||||
Konfiqurasiya haqqında məlumat üçün `man 5 sway` əmrini icra edin.
|
||||
|
||||
## İşə Salma
|
||||
|
||||
TTY-dan `sway`-ı işə salın. Bəzi ekran menecerləri işləyə bilər, lakin sway tərəfindən
|
||||
dəstəklənmir (gdm-in kifayət qədər yaxşı işlədiyi məlumdur).
|
||||
|
||||
[i3]: https://i3wm.org/
|
||||
[Wayland]: http://wayland.freedesktop.org/
|
||||
[Tez-tez verilən sualları]: https://github.com/swaywm/sway/wiki
|
||||
[IRC kanalına]: https://web.libera.chat/gamja/?channels=#sway
|
||||
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||
[swaybg]: https://github.com/swaywm/swaybg/
|
||||
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
||||
37
README.cs.md
37
README.cs.md
|
|
@ -1,25 +1,24 @@
|
|||
# sway
|
||||
|
||||
[English][en] - **[Česky][cs]** - [Deutsch][de] - [Dansk][dk] - [Español][es] - [Français][fr] - [Svenska][sv] - [Ελληνικά][gr] - [हिन्दी][hi] - [Magyar][hu] - [فارسی][ir] - [Italiano][it] - [日本語][ja] - [한국어][ko] - [Nederlands][nl] - [Polski][pl] - [Português][pt] - [Română][ro] - [Русский][ru] - [Türkçe][tr] - [Українська][uk] - [中文-简体][zh-CN] - [中文-繁體][zh-TW]
|
||||
|
||||
sway je s [i3] kompatibilní [Wayland] kompozitor. Přečtěte si [FAQ]. Připojte se na
|
||||
[IRC kanál][IRC channel] \(#sway na irc.libera.chat).
|
||||
sway je [waylandový][Wayland] kompozitor kompatibilní s [i3]. Přečtěte si
|
||||
[FAQ (anglicky)][FAQ]. Připojte se na [IRC kanál (anglicky)][IRC channel]
|
||||
\(#sway na irc.libera.chat).
|
||||
|
||||
## Podpisy vydání
|
||||
|
||||
Vydání jsou podepsána [E88F5E48] a publikována [na GitHubu][GitHub releases].
|
||||
Vydané verze jsou podepsány klíčem [E88F5E48] a publikovány
|
||||
[na GitHubu][GitHub releases].
|
||||
|
||||
## Instalace
|
||||
|
||||
### Z balíčků
|
||||
### Z balíků
|
||||
|
||||
Sway je dostupný ve spoustě distribucí. Zkuste nainstalovat balíček "sway" ve vaší
|
||||
distribuci.
|
||||
Sway je dostupný v mnoha distribucích. Zkuste v té vaší nainstalovat balík "sway".
|
||||
|
||||
### Kompilace ze zdrojových kódů
|
||||
|
||||
Podívejte se na [tuto stránku wiki][Development setup], pokud chcete sestavit HEAD
|
||||
sway a wlroots pro testování nebo vývoj.
|
||||
Pokud chcete sestavit HEAD repozitáře sway a wlroots pro testování nebo vývoj,
|
||||
použijte návod na [této stránce na wiki (anglicky)][Development setup].
|
||||
|
||||
Nainstalujte závislosti:
|
||||
|
||||
|
|
@ -31,15 +30,16 @@ Nainstalujte závislosti:
|
|||
* json-c
|
||||
* pango
|
||||
* cairo
|
||||
* gdk-pixbuf2 (volitelné: oznamovací oblast)
|
||||
* [scdoc] (volitelné: manuálové stránky) \*
|
||||
* gdk-pixbuf2 (volitelné: dodatečné formáty ikon pro oznamovací oblast)
|
||||
* [swaybg] (volitelné: tapeta plochy)
|
||||
* [scdoc] (volitelné: man stránky) \*
|
||||
* git (volitelné: informace o verzi) \*
|
||||
|
||||
_\* Závislost pouze pro sestavení_
|
||||
_\* Závislost pouze pro kompilaci_
|
||||
|
||||
Spusťte tyto příkazy:
|
||||
|
||||
meson build/
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
|
|
@ -52,16 +52,16 @@ Pro více informací o konfiguraci spusťte `man 5 sway`.
|
|||
|
||||
## Spuštění
|
||||
|
||||
Spusťte `sway` z TTY. Některé správce zobrazení mohou fungovat, ale nejsou
|
||||
podporovány sway (je známo, že gdm funguje docela dobře).
|
||||
Spusťte `sway` z TTY nebo ze správce displeje.
|
||||
|
||||
[en]: https://github.com/swaywm/sway#readme
|
||||
[ar]: README.ar.md
|
||||
[cs]: README.cs.md
|
||||
[de]: README.de.md
|
||||
[dk]: README.dk.md
|
||||
[es]: README.es.md
|
||||
[fr]: README.fr.md
|
||||
[sv]: README.sv.md
|
||||
[ge]: README.ge.md
|
||||
[gr]: README.gr.md
|
||||
[hi]: README.hi.md
|
||||
[hu]: README.hu.md
|
||||
|
|
@ -70,10 +70,12 @@ podporovány sway (je známo, že gdm funguje docela dobře).
|
|||
[ja]: README.ja.md
|
||||
[ko]: README.ko.md
|
||||
[nl]: README.nl.md
|
||||
[no]: README.no.md
|
||||
[pl]: README.pl.md
|
||||
[pt]: README.pt.md
|
||||
[ro]: README.ro.md
|
||||
[ru]: README.ru.md
|
||||
[sv]: README.sv.md
|
||||
[tr]: README.tr.md
|
||||
[uk]: README.uk.md
|
||||
[zh-CN]: README.zh-CN.md
|
||||
|
|
@ -86,4 +88,5 @@ podporovány sway (je známo, že gdm funguje docela dobře).
|
|||
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||
[swaybg]: https://github.com/swaywm/swaybg/
|
||||
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
||||
|
|
|
|||
37
README.de.md
37
README.de.md
|
|
@ -1,21 +1,21 @@
|
|||
# Sway
|
||||
Sway ist ein [i3](https://i3wm.org/)-kompatibler [Wayland](http://wayland.freedesktop.org/)-Compositor. Lies die [FAQ](https://github.com/swaywm/sway/wiki). Tritt dem [IRC Channel](https://web.libera.chat/gamja/?channels=#sway) bei (#sway on irc.libera.chat; Englisch).
|
||||
Sway ist ein [i3]-kompatibler [Wayland]-Compositor. Lies die [FAQ]. Tritt dem [IRC Channel] bei (#sway on irc.libera.chat; Englisch).
|
||||
|
||||
## Signaturen
|
||||
Jedes Release wird mit dem PGP-Schlüssel [E88F5E48](https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48) signiert und [auf GitHub](https://github.com/swaywm/sway/releases) veröffentlicht.
|
||||
Jeder Release wird mit dem PGP-Schlüssel [E88F5E48] signiert und [auf GitHub][GitHub releases] veröffentlicht.
|
||||
|
||||
## Installation
|
||||
|
||||
### Über die Paketverwaltung
|
||||
|
||||
Sway kann in vielen Distributionen direkt durch die Paketverwaltung installiert werden. Versuche einfach das Packet "sway" zu installieren.
|
||||
Sway kann in vielen Distributionen direkt durch die Paketverwaltung installiert werden. Versuche einfach das Paket "sway" zu installieren.
|
||||
|
||||
### Quellcode selbst kompilieren
|
||||
|
||||
sway benötigt die folgenden Pakete:
|
||||
|
||||
* meson\*
|
||||
* [wlroots](https://gitlab.freedesktop.org/wlroots/wlroots)
|
||||
* meson \*
|
||||
* [wlroots]
|
||||
* wayland
|
||||
* wayland-protocols\*
|
||||
* pcre2
|
||||
|
|
@ -23,21 +23,34 @@ sway benötigt die folgenden Pakete:
|
|||
* pango
|
||||
* cairo
|
||||
* gdk-pixbuf2 (Optional, wird für das Benachrichtigungsfeld (System Tray) benötigt)
|
||||
* [scdoc](https://git.sr.ht/~sircmpwn/scdoc) (Optional, wird für die Dokumentation (Man Pages) benötigt)\*
|
||||
* [swaybg] (Optional, wird für das Setzen von Desktophintergrundbildern benötigt)
|
||||
* [scdoc] (Optional, wird für die Dokumentation (Man Pages) benötigt)\*
|
||||
* git (Optional: Versionsinfo)\*
|
||||
|
||||
_\*Werden nur während des Kompilierens benötigt_
|
||||
_\*Werden nur für das Kompilieren benötigt_
|
||||
|
||||
Führe die folgenden Befehle aus:
|
||||
|
||||
meson build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
Schaue in das [Wiki][Development setup] (Englisch) für Informationen, falls du zum Testen oder Entwickeln den neuesten Stand (HEAD) von sway und wlroots kompilieren willst.
|
||||
|
||||
## Konfiguration
|
||||
|
||||
Falls du von i3 migrierst, kannst du deine Konfigurationsdatei nach `~/.config/sway/config` kopieren und die Einstellungen sollten ohne Weiteres funktionieren. Ansonsten kannst du die Beispielkonfiguration, die normalerweise in `/etc/sway/config` liegt, nach `~/.config/sway/config` kopieren. Die Dokumentation zur Konfigurationsdatei findest du in `man 5 sway`.
|
||||
|
||||
## Sway starten
|
||||
Sway kann einfach mit dem Befehl `sway` vom TTY gestartet werden.
|
||||
Display-Manager werden nicht offiziell unterstützt. Es gibt aber durchaus einige, die mit Sway funktionieren (z.B. gdm).
|
||||
Sway kann einfach mit dem Befehl `sway` vom TTY oder mithilfe eines Displaymanagers gestartet werden.
|
||||
|
||||
[i3]: https://i3wm.org/
|
||||
[Wayland]: http://wayland.freedesktop.org/
|
||||
[FAQ]: https://github.com/swaywm/sway/wiki
|
||||
[IRC channel]: https://web.libera.chat/gamja/?channels=#sway
|
||||
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||
[swaybg]: https://github.com/swaywm/swaybg
|
||||
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ _\*Kompileringsafhængighed_
|
|||
|
||||
Kør følgende kommandoer:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
@ -54,8 +54,7 @@ Hvis du allerede bruger i3 kan du bare kopiere din i3 konfiguration til
|
|||
|
||||
## Eksekvering
|
||||
|
||||
Kør `sway` fra en TTY. Nogle display managers kan fungere, men Sway yder ikke
|
||||
support til dem (gdm er kendt for at fungere temmelig godt).
|
||||
Kør `sway` fra en TTY eller fra en display manager.
|
||||
|
||||
[i3]: https://i3wm.org/
|
||||
[Wayland]: http://wayland.freedesktop.org/
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ _\*Compile-time dep_
|
|||
|
||||
Desde su consola, ejecute las órdenes:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
|
|||
|
|
@ -47,7 +47,7 @@ _\* Requis uniquement pour la compilation_
|
|||
|
||||
Exécutez ces commandes :
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
@ -57,13 +57,11 @@ Si vous utilisez déjà i3, copiez votre configuration i3 vers
|
|||
`~/.config/sway/config` et sway fonctionnera directement. Sinon, copiez
|
||||
l'exemple de fichier de configuration vers `~/.config/sway/config`. Il se
|
||||
trouve généralement dans `/etc/sway/config`. Exécutez `man 5 sway` pour lire la
|
||||
documentation pour la configuration de sway.
|
||||
documentation sur la configuration de sway.
|
||||
|
||||
## Exécution
|
||||
|
||||
Exécutez `sway` à partir d'un TTY. Certains gestionnaires d'affichage peuvent
|
||||
fonctionner, mais ne sont pas supportés par Sway (gdm est réputé pour assez
|
||||
bien fonctionner).
|
||||
Exécutez `sway` à partir d'un TTY ou d'un gestionnaires d'affichage.
|
||||
|
||||
[Wayland]: http://wayland.freedesktop.org/
|
||||
[i3]: https://i3wm.org/
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ _\* Compile-time dep_
|
|||
|
||||
გაუშვით ეს ბრძანებები:
|
||||
|
||||
meson build/
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ _\*Compile-time dep_
|
|||
|
||||
Τρέξτε αυτά τα commands:
|
||||
|
||||
meson build/
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ _\* Compilation के समय आवश्यक_
|
|||
|
||||
ये commands चलाएं:
|
||||
|
||||
meson build/
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
|
|
|
|||
16
README.hu.md
16
README.hu.md
|
|
@ -1,10 +1,10 @@
|
|||
# sway
|
||||
|
||||
A Sway egy [i3]-kompatibilis [Wayland] kompozitor. Olvasd el a [Gyarkan Ismételt Kérdéseket][FAQ]. Csatlakozz az [IRC csatornához][IRC channel] \(`#sway` az `irc.libera.chat`-en).
|
||||
A Sway egy [i3]-kompatibilis [Wayland]-kompozitor. Olvasd el a [Gyarkan Ismételt Kérdéseket][FAQ]. Csatlakozz az [IRC-csatornához][IRC channel] \(`#sway` az `irc.libera.chat`-en).
|
||||
|
||||
## Csomag aláírások
|
||||
## Csomagaláírások
|
||||
|
||||
A kiadott csomagok az [E88F5E48] kulccsal vannak aláírva és [GitHub-on][GitHub releases] publikálva.
|
||||
A kiadott csomagok az [E88F5E48] kulccsal vannak aláírva, és [GitHubon][GitHub releases] publikálva.
|
||||
|
||||
## Telepítés
|
||||
|
||||
|
|
@ -13,12 +13,12 @@ A kiadott csomagok az [E88F5E48] kulccsal vannak aláírva és [GitHub-on][GitHu
|
|||
A Sway sok disztribúció csomagkezelőjéből elérhető, próbáld meg a "sway"
|
||||
csomagot telepíteni az általad használt eszközzel.
|
||||
|
||||
Ha szeretnél csomagot készíteni a saját disztribúciódhoz, ugorj be az IRC
|
||||
Ha szeretnél csomagot készíteni a saját disztribúciódhoz, ugorj be az IRC-
|
||||
csatornára, vagy küldj levelet a sir@cmpwn.com címre tanácsokért.
|
||||
|
||||
### Fordítás forráskódból
|
||||
|
||||
Olvasd el [ezt a wiki oldalt][Development setup], ha szeretnéd tesztelési vagy
|
||||
Olvasd el [ezt a wikioldalt][Development setup], ha szeretnéd tesztelési vagy
|
||||
fejlesztési célokból lefordítani az aktuális (HEAD) állapotát a `sway`-nek és a
|
||||
`wlroots`-nak.
|
||||
|
||||
|
|
@ -40,13 +40,13 @@ _\*Fordításidejű függőség_
|
|||
|
||||
Futtasd ezeket a parancsokat:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
## Konfiguráció
|
||||
|
||||
Ha előzőleg i3-mat használtál, akkor átmásolhatod az i3 beállításaidat a
|
||||
Ha előzőleg i3-at használtál, akkor átmásolhatod az i3-beállításaidat a
|
||||
`~/.config/sway/config` file-ba és ugyanúgy működni fognak. Egyéb esetben másold
|
||||
le kiindulási alapnak a mintát, ami általában az `etc/sway/config` elérési
|
||||
útvonalon található.
|
||||
|
|
@ -55,7 +55,7 @@ kapcsolatban.
|
|||
|
||||
## Futtatás
|
||||
|
||||
Futtasd a `sway` parancsot egy TTY felületről. Néhány bejelentkezéskezelő
|
||||
Futtasd a `sway` parancsot egy TTY-felületről. Néhány bejelentkezéskezelő
|
||||
(display manager) működhet, de alapvetően nem támogatottak a sway által. (A
|
||||
gdm-ről ismeretes, hogy egész jól működik.)
|
||||
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ _\*نیازمندیهای زمان کامپایل برنامه_
|
|||
|
||||
این فرمانها را اجرا کنید:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# sway
|
||||
|
||||
sway è un compositore di [Wayland] compatibile con [i3]. Leggi le [FAQ].
|
||||
Unisciti al [canale di IRC] \(#sway su irc.libera.chat).
|
||||
Unisciti al [canale IRC] \(#sway su irc.libera.chat).
|
||||
|
||||
## Firma delle versioni
|
||||
|
||||
|
|
@ -38,7 +38,7 @@ _\* Dipendenza necessaria per la compilazione_
|
|||
|
||||
Esegui questi comandi:
|
||||
|
||||
meson build/
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
|
|
@ -52,13 +52,12 @@ configurazione.
|
|||
|
||||
## Esecuzione
|
||||
|
||||
Lancia `sway` da un TTY. Alcuni gestori d'accesso potrebbero funzionare ma non
|
||||
sono supportati da sway (gdm funziona abbastanza bene).
|
||||
Lancia `sway` da un TTY o da un display manager.
|
||||
|
||||
[i3]: https://i3wm.org/
|
||||
[Wayland]: http://wayland.freedesktop.org/
|
||||
[FAQ]: https://github.com/swaywm/sway/wiki
|
||||
[canale di IRC]: https://web.libera.chat/gamja/?channels=#sway
|
||||
[canale IRC]: https://web.libera.chat/gamja/?channels=#sway
|
||||
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ _\*コンパイル時の依存_
|
|||
|
||||
次のコマンドを実行してください:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
@ -52,5 +52,4 @@ _\*コンパイル時の依存_
|
|||
|
||||
## 実行
|
||||
|
||||
`sway`をTTYから実行してください。いくつかのディスプレイマネージャは動くかもしれませんが、Swayからサポートされていません(gdmは非常に良く動作することが知られています)。
|
||||
|
||||
`sway`をTTYまたはディスプレイマネージャから実行してください。
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ _\*컴파일 떄 필요_
|
|||
|
||||
다음 명령을 실행하세요:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
@ -52,4 +52,4 @@ i3를 이미 사용 중이라면, i3 config을 `~/.config/sway/config`로 복사
|
|||
|
||||
## 실행
|
||||
|
||||
TTY에서 `sway`를 실행하세요. 일부 display manager는 작동하지만, sway로 부터 지원되지 않습니다(gdm은 상당히 잘 작동한다고 알려져 있습니다).
|
||||
TTY나 display manager에서 `sway`를 실행하세요.
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# sway
|
||||
|
||||
**[English][en]** - [عربي][ar] - [Česky][cs] - [Deutsch][de] - [Dansk][dk] - [Español][es] - [Français][fr] - [ქართული][ge] - [Ελληνικά][gr] - [हिन्दी][hi] - [Magyar][hu] - [فارسی][ir] - [Italiano][it] - [日本語][ja] - [한국어][ko] - [Nederlands][nl] - [Norsk][no] - [Polski][pl] - [Português][pt] - [Română][ro] - [Русский][ru] - [Svenska][sv] - [Türkçe][tr] - [Українська][uk] - [中文-简体][zh-CN] - [中文-繁體][zh-TW]
|
||||
**[English][en]** - [عربي][ar] - [Azərbaycanca][az] - [Česky][cs] - [Deutsch][de] - [Dansk][dk] - [Español][es] - [Français][fr] - [ქართული][ge] - [Ελληνικά][gr] - [हिन्दी][hi] - [Magyar][hu] - [فارسی][ir] - [Italiano][it] - [日本語][ja] - [한국어][ko] - [Nederlands][nl] - [Norsk][no] - [Polski][pl] - [Português][pt] - [Română][ro] - [Русский][ru] - [Српски][sr] - [Svenska][sv] - [Türkçe][tr] - [Українська][uk] - [中文-简体][zh-CN] - [中文-繁體][zh-TW]
|
||||
|
||||
sway is an [i3]-compatible [Wayland] compositor. Read the [FAQ]. Join the
|
||||
[IRC channel] \(#sway on irc.libera.chat).
|
||||
|
|
@ -40,7 +40,7 @@ _\* Compile-time dep_
|
|||
|
||||
Run these commands:
|
||||
|
||||
meson build/
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
|
|
@ -53,11 +53,11 @@ Run `man 5 sway` for information on the configuration.
|
|||
|
||||
## Running
|
||||
|
||||
Run `sway` from a TTY. Some display managers may work but are not supported by
|
||||
sway (gdm is known to work fairly well).
|
||||
Run `sway` from a TTY or from a display manager.
|
||||
|
||||
[en]: https://github.com/swaywm/sway#readme
|
||||
[ar]: README.ar.md
|
||||
[az]: README.az.md
|
||||
[cs]: README.cs.md
|
||||
[de]: README.de.md
|
||||
[dk]: README.dk.md
|
||||
|
|
@ -77,6 +77,7 @@ sway (gdm is known to work fairly well).
|
|||
[pt]: README.pt.md
|
||||
[ro]: README.ro.md
|
||||
[ru]: README.ru.md
|
||||
[sr]: README.sr.md
|
||||
[sv]: README.sv.md
|
||||
[tr]: README.tr.md
|
||||
[uk]: README.uk.md
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ _\* Compileerafhankelijkheden_
|
|||
|
||||
Voer deze opdrachten uit:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
|
|||
51
README.no.md
51
README.no.md
|
|
@ -1,29 +1,25 @@
|
|||
# Sway
|
||||
|
||||
Sway er en [i3]-kompatibel [Wayland] compositor. Les [Ofte stilte spørsmål].
|
||||
Delta på [IRC kanalen][IRC kanal] \(#sway på irc.libera.chat).
|
||||
Sway er en [i3]-kompatibel [Wayland]-compositor. Les [Ofte stilte spørsmål].
|
||||
Delta på [IRC-kanalen][IRC-kanal] \(#sway på irc.libera.chat).
|
||||
|
||||
## Utgivelses Signaturer
|
||||
## Signaturer
|
||||
|
||||
Utgivelser er signert med [E88F5E48] og publisert [på GitHub][GitHub
|
||||
releases].
|
||||
Utgivelser er signert med [E88F5E48] og publisert [på GitHub][GitHub releases].
|
||||
|
||||
## Installasjon
|
||||
|
||||
### Fra system pakker
|
||||
### Fra systempakker
|
||||
|
||||
Sway er tilgjengelig i mange distribusjoner. Prøv å installere "sway" pakken
|
||||
Sway er tilgjengelig i mange distribusjoner. Prøv å installere pakken "sway"
|
||||
fra din distro sine repoer.
|
||||
|
||||
Er du interessert i å pakke Sway for din distribusjon kan du ta turen innom
|
||||
IRC-kanalen eller send en e-post til sir@cmpwn.com for råd.
|
||||
|
||||
### Kompilering fra kildekode
|
||||
|
||||
Se [denne wiki-siden][Oppsetting for utvikling] hvis du vil bygge fra HEAD grenen av sway og
|
||||
wlroots for testing eller utvikling.
|
||||
Se [denne wiki-siden][Oppsetting for utvikling] hvis du vil bygge fra HEAD-grenen av
|
||||
sway og wlroots for testing eller utvikling.
|
||||
|
||||
Installasjonsavhengigheter:
|
||||
Installer avhengigheter:
|
||||
|
||||
* meson \*
|
||||
* [wlroots]
|
||||
|
|
@ -33,36 +29,37 @@ Installasjonsavhengigheter:
|
|||
* json-c
|
||||
* pango
|
||||
* cairo
|
||||
* gdk-pixbuf2 (valgfritt: system tray)
|
||||
* gdk-pixbuf2 (valgfritt: støtte for ekstra bildeformater i system tray)
|
||||
* [swaybg] (valgfritt: bakgrunnsbilde)
|
||||
* [scdoc] (valgfritt: man pages) \*
|
||||
* git \*
|
||||
* git (valgfritt: versjonsinformasjon) \*
|
||||
|
||||
_\*Kompileringsavhengigheter_
|
||||
_\* Kompileringsavhengigheter_
|
||||
|
||||
Kjør følgende kommandoer:
|
||||
|
||||
meson build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
## Konfigurasjon
|
||||
|
||||
Hvis du allerede bruker i3 kan du bare kopiere din i3 konfigurasjon til
|
||||
`~/.config/sway/config`. Ellers skal du kopiere eksempel konfigurasjonsfilen til
|
||||
`~/.config/sway/config`. Eksempel filen er normalt plasert i `/etc/sway/config`. Kjør
|
||||
`man 5 sway` for å få oplysninger om konfigurasjonen.
|
||||
Hvis du allerede bruker i3 kan du bare kopiere din i3-konfigurasjon til
|
||||
`~/.config/sway/config`. Ellers skal du kopiere eksempelkonfigurasjonsfilen til
|
||||
`~/.config/sway/config`. Eksempelfilen er normalt plasert i `/etc/sway/config`.
|
||||
Kjør `man 5 sway` for å få opplysninger om konfigurasjonen.
|
||||
|
||||
## Utførelse
|
||||
## Kjøring
|
||||
|
||||
Kjør `sway` fra en TTY. Noen display managers kan fungere, men Sway har ikke
|
||||
støtte for dem (gdm er kjent for å fungere ganske bra).
|
||||
Kjør `sway` fra en TTY eller fra en display manager.
|
||||
|
||||
[i3]: https://i3wm.org/
|
||||
[Wayland]: http://wayland.freedesktop.org/
|
||||
[Ofte stilte spørsmål]: https://github.com/swaywm/sway/wiki
|
||||
[IRC kanal]: https://web.libera.chat/gamja/?channels=#sway
|
||||
[IRC-kanal]: https://web.libera.chat/gamja/?channels=#sway
|
||||
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||
[Oppsetting for utvikling]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||
[swaybg]: https://github.com/swaywm/swaybg/
|
||||
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ _\*zależności kompilacji_
|
|||
|
||||
Wykonaj następujące polecenia:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
@ -53,5 +53,4 @@ Wykonaj polecenie `man 5 sway` aby uzyskać informacje dotyczące konfiguracji.
|
|||
|
||||
## Uruchamianie
|
||||
|
||||
Wykonaj polecenie `sway` z poziomu TTY. Niektóre menedżery wyświetlania mogą umożliwiać rozruch z ich
|
||||
poziomu, ale nie jest to wspierane przez sway (w gdm podobno działa to całkiem nieźle).
|
||||
Wykonaj polecenie `sway` z poziomu TTY lub menedżera wyświetlania.
|
||||
|
|
|
|||
|
|
@ -42,7 +42,7 @@ _\*Dependência de tempo de compilação_
|
|||
|
||||
Execute esses comandos:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ Dependențe pentru instalare:
|
|||
Rulați aceste comenzi:
|
||||
|
||||
```
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
```
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ _\*Зависимости для сборки_
|
|||
|
||||
Выполните эти команды:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
@ -54,8 +54,7 @@ _\*Зависимости для сборки_
|
|||
|
||||
## Запуск
|
||||
|
||||
Выполните команду `sway` прямо из TTY. Некоторые дисплейные менеджеры могут работать, но они не поддерживаются со стороны
|
||||
sway (gdm работает довольно неплохо).
|
||||
Выполните команду `sway` прямо из TTY или дисплейного менеджера.
|
||||
|
||||
[i3]: https://i3wm.org/
|
||||
[Wayland]: http://wayland.freedesktop.org/
|
||||
|
|
|
|||
65
README.sr.md
Normal file
65
README.sr.md
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
# sway
|
||||
|
||||
sway је [i3]-компатибилан [Wayland] композитор. Прочитајте [FAQ]. Придружите се
|
||||
[IRC каналу] \(#sway на irc.libera.chat).
|
||||
|
||||
## Потписи Издања
|
||||
|
||||
Издања су потписана са [E88F5E48] и објављена [на GitHub-у][GitHub releases].
|
||||
|
||||
## Инсталација
|
||||
|
||||
### Из пакета
|
||||
|
||||
Sway је доступан у многим дистрибуцијама. Покушајте да инсталирате "sway" пакет за
|
||||
вашу.
|
||||
|
||||
### Компајлирање из Извора
|
||||
|
||||
Погледајте [ову вики страницу][Development setup], ако желите да компајлирате HEAD верзију
|
||||
sway-а и wlroots-а за тестирање или развој.
|
||||
|
||||
Инсталирајте зависности:
|
||||
|
||||
* meson \*
|
||||
* [wlroots]
|
||||
* wayland
|
||||
* wayland-protocols \*
|
||||
* pcre2
|
||||
* json-c
|
||||
* pango
|
||||
* cairo
|
||||
* gdk-pixbuf2 (опционо: додатни формати слика за системску траку)
|
||||
* [swaybg] (опционо: позадина)
|
||||
* [scdoc] (опционо: man странице) \*
|
||||
* git (опционо: информације о верзији) \*
|
||||
|
||||
_\* Потребно само за компајлирање_
|
||||
|
||||
Покрените следеће команде:
|
||||
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
## Конфигурација
|
||||
|
||||
Ако већ користите i3, копирајте вашу i3 конфигурацију у `~/.config/sway/config` и
|
||||
радиће одмах. У супротном, копирајте пример конфигурационе датотеке у
|
||||
`~/.config/sway/config`. Обично се налази у `/etc/sway/config`.
|
||||
Покрените `man 5 sway` за информације о конфигурацији.
|
||||
|
||||
## Покретање
|
||||
|
||||
Покрените `sway` из TTY-a или из менаџера приказа.
|
||||
|
||||
[i3]: https://i3wm.org/
|
||||
[Wayland]: http://wayland.freedesktop.org/
|
||||
[FAQ]: https://github.com/swaywm/sway/wiki
|
||||
[IRC каналу]: https://web.libera.chat/gamja/?channels=#sway
|
||||
[E88F5E48]: https://keys.openpgp.org/search?q=34FF9526CFEF0E97A340E2E40FDE7BE0E88F5E48
|
||||
[GitHub releases]: https://github.com/swaywm/sway/releases
|
||||
[Development setup]: https://github.com/swaywm/sway/wiki/Development-Setup
|
||||
[wlroots]: https://gitlab.freedesktop.org/wlroots/wlroots
|
||||
[swaybg]: https://github.com/swaywm/swaybg/
|
||||
[scdoc]: https://git.sr.ht/~sircmpwn/scdoc
|
||||
|
|
@ -1,7 +1,5 @@
|
|||
# sway
|
||||
|
||||
[English][en] - [Deutsch][de] - [Dansk][dk] - [Español][es] - [Français][fr] - **[Svenska][sv]** - [Ελληνικά][gr] - [Magyar][hu] - [فارسی][ir] - [Italiano][it] - [日本語][ja] - [한국어][ko] - [Nederlands][nl] - [Polski][pl] - [Português][pt] - [Română][ro] - [Русский][ru] - [Türkçe][tr] - [Українська][uk] - [中文-简体][zh-CN] - [中文-繁體][zh-TW]
|
||||
|
||||
sway är en [i3]-kompatibel [Wayland] compositor. Läs våran [FAQ]-sida. Gå med i vår
|
||||
[IRC-kanal] \(#sway på irc.libera.chat).
|
||||
|
||||
|
|
@ -37,7 +35,7 @@ _\* Krav för kompilering_
|
|||
|
||||
Kör dessa kommandon:
|
||||
|
||||
meson build/
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ _\*Derleme-anı bağımlılıkları_
|
|||
|
||||
Şu komutları çalıştırın:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ _\*Лише для компіляції_
|
|||
|
||||
Виконайте ці команди:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ _\*编译时依赖_
|
|||
|
||||
运行如下命令:
|
||||
|
||||
meson build/
|
||||
meson setup build/
|
||||
ninja -C build/
|
||||
sudo ninja -C build/ install
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ _\*編譯時相依_
|
|||
|
||||
執行這些指令:
|
||||
|
||||
meson build
|
||||
meson setup build
|
||||
ninja -C build
|
||||
sudo ninja -C build install
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
@ -82,28 +84,48 @@ PangoLayout *get_pango_layout(cairo_t *cairo, const PangoFontDescription *desc,
|
|||
|
||||
void get_text_size(cairo_t *cairo, const PangoFontDescription *desc, int *width, int *height,
|
||||
int *baseline, double scale, bool markup, const char *fmt, ...) {
|
||||
if (width) {
|
||||
*width = 0;
|
||||
}
|
||||
if (height) {
|
||||
*height = 0;
|
||||
}
|
||||
if (baseline) {
|
||||
*baseline = 0;
|
||||
}
|
||||
|
||||
va_list args;
|
||||
va_start(args, fmt);
|
||||
char *buf = vformat_str(fmt, args);
|
||||
va_end(args);
|
||||
if (buf == NULL) {
|
||||
sway_log(SWAY_ERROR, "Failed to format string");
|
||||
return;
|
||||
}
|
||||
|
||||
PangoLayout *layout = get_pango_layout(cairo, desc, buf, scale, markup);
|
||||
pango_cairo_update_layout(cairo, layout);
|
||||
cairo_status_t status = cairo_status(cairo);
|
||||
if (status != CAIRO_STATUS_SUCCESS) {
|
||||
sway_log(SWAY_ERROR, "pango_cairo_update_layout() failed: %s",
|
||||
cairo_status_to_string(status));
|
||||
goto out;
|
||||
}
|
||||
|
||||
pango_layout_get_pixel_size(layout, width, height);
|
||||
if (baseline) {
|
||||
*baseline = pango_layout_get_baseline(layout) / PANGO_SCALE;
|
||||
}
|
||||
g_object_unref(layout);
|
||||
|
||||
out:
|
||||
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);
|
||||
PangoFontMap *fontmap = pango_cairo_font_map_get_default();
|
||||
PangoContext *pango = pango_font_map_create_context(fontmap);
|
||||
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);
|
||||
|
||||
|
|
@ -112,7 +134,6 @@ void get_text_metrics(const PangoFontDescription *description, int *height, int
|
|||
|
||||
pango_font_metrics_unref(metrics);
|
||||
g_object_unref(pango);
|
||||
cairo_destroy(cairo);
|
||||
}
|
||||
|
||||
void render_text(cairo_t *cairo, const PangoFontDescription *desc,
|
||||
|
|
@ -122,6 +143,7 @@ void render_text(cairo_t *cairo, const PangoFontDescription *desc,
|
|||
char *buf = vformat_str(fmt, args);
|
||||
va_end(args);
|
||||
if (buf == NULL) {
|
||||
sway_log(SWAY_ERROR, "Failed to format string");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -130,9 +152,18 @@ void render_text(cairo_t *cairo, const PangoFontDescription *desc,
|
|||
cairo_get_font_options(cairo, fo);
|
||||
pango_cairo_context_set_font_options(pango_layout_get_context(layout), fo);
|
||||
cairo_font_options_destroy(fo);
|
||||
pango_cairo_update_layout(cairo, layout);
|
||||
pango_cairo_show_layout(cairo, layout);
|
||||
g_object_unref(layout);
|
||||
|
||||
pango_cairo_update_layout(cairo, layout);
|
||||
cairo_status_t status = cairo_status(cairo);
|
||||
if (status != CAIRO_STATUS_SUCCESS) {
|
||||
sway_log(SWAY_ERROR, "pango_cairo_update_layout() failed: %s",
|
||||
cairo_status_to_string(status));
|
||||
goto out;
|
||||
}
|
||||
|
||||
pango_cairo_show_layout(cairo, layout);
|
||||
|
||||
out:
|
||||
g_object_unref(layout);
|
||||
free(buf);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -360,3 +360,7 @@ char *format_str(const char *fmt, ...) {
|
|||
va_end(args);
|
||||
return str;
|
||||
}
|
||||
|
||||
bool has_prefix(const char *str, const char *prefix) {
|
||||
return strncmp(str, prefix, strlen(prefix)) == 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -141,3 +141,9 @@ bool sway_set_cloexec(int fd, bool cloexec) {
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
uint32_t get_current_time_in_msec(void) {
|
||||
struct timespec now;
|
||||
clock_gettime(CLOCK_MONOTONIC, &now);
|
||||
return now.tv_sec * 1000 + now.tv_nsec / 1000000;
|
||||
}
|
||||
|
|
|
|||
34
config.in
34
config.in
|
|
@ -16,9 +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 | wmenu | xargs swaymsg exec --
|
||||
set $menu wmenu-run
|
||||
|
||||
### Output configuration
|
||||
#
|
||||
|
|
@ -48,14 +46,18 @@ output * bg @datadir@/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
|
|||
#
|
||||
# Example configuration:
|
||||
#
|
||||
# input "2:14:SynPS/2_Synaptics_TouchPad" {
|
||||
# input type:touchpad {
|
||||
# dwt enabled
|
||||
# tap enabled
|
||||
# natural_scroll enabled
|
||||
# middle_emulation enabled
|
||||
# }
|
||||
#
|
||||
# You can get the names of your inputs by running: swaymsg -t get_inputs
|
||||
# input type:keyboard {
|
||||
# xkb_layout "eu"
|
||||
# }
|
||||
#
|
||||
# You can also configure each device individually.
|
||||
# Read `man 5 sway-input` for more information about this section.
|
||||
|
||||
### Key bindings
|
||||
|
|
@ -195,6 +197,28 @@ 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 control media via playerctl
|
||||
bindsym --locked XF86AudioPlay exec playerctl play-pause
|
||||
bindsym --locked XF86AudioPause exec playerctl play-pause
|
||||
bindsym --locked XF86AudioPrev exec playerctl previous
|
||||
bindsym --locked XF86AudioNext exec playerctl next
|
||||
bindsym --locked XF86AudioStop exec playerctl stop
|
||||
|
||||
# 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:
|
||||
|
|
|
|||
|
|
@ -40,4 +40,6 @@ 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);
|
||||
|
||||
bool has_prefix(const char *str, const char *prefix);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ struct sway_container *container_find_resize_parent(struct sway_container *con,
|
|||
sway_cmd cmd_exec_validate;
|
||||
sway_cmd cmd_exec_process;
|
||||
|
||||
sway_cmd cmd_allow_tearing;
|
||||
sway_cmd cmd_assign;
|
||||
sway_cmd cmd_bar;
|
||||
sway_cmd cmd_bindcode;
|
||||
|
|
@ -250,6 +251,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;
|
||||
|
|
@ -283,10 +285,13 @@ 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;
|
||||
sway_cmd output_cmd_hdr;
|
||||
sway_cmd output_cmd_max_render_time;
|
||||
sway_cmd output_cmd_mode;
|
||||
sway_cmd output_cmd_modeline;
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
#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"
|
||||
|
|
@ -148,6 +149,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;
|
||||
|
|
@ -259,11 +261,18 @@ enum scale_filter_mode {
|
|||
};
|
||||
|
||||
enum render_bit_depth {
|
||||
RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8
|
||||
RENDER_BIT_DEPTH_DEFAULT, // the default is currently 8 for SDR, 10 for HDR
|
||||
RENDER_BIT_DEPTH_6,
|
||||
RENDER_BIT_DEPTH_8,
|
||||
RENDER_BIT_DEPTH_10,
|
||||
};
|
||||
|
||||
enum color_profile {
|
||||
COLOR_PROFILE_DEFAULT, // default is Transform with NULL color_transform
|
||||
COLOR_PROFILE_TRANSFORM, // use color_transform from output_config
|
||||
COLOR_PROFILE_TRANSFORM_WITH_DEVICE_PRIMARIES, // create transform from wlr_output
|
||||
};
|
||||
|
||||
/**
|
||||
* Size and position configuration for a particular output.
|
||||
*
|
||||
|
|
@ -285,6 +294,10 @@ struct output_config {
|
|||
int max_render_time; // In milliseconds
|
||||
int adaptive_sync;
|
||||
enum render_bit_depth render_bit_depth;
|
||||
enum color_profile color_profile;
|
||||
struct wlr_color_transform *color_transform;
|
||||
int allow_tearing;
|
||||
int hdr;
|
||||
|
||||
char *background;
|
||||
char *background_option;
|
||||
|
|
@ -689,22 +702,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);
|
||||
|
|
|
|||
|
|
@ -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,7 +40,7 @@ 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;
|
||||
|
|
@ -49,6 +53,10 @@ struct criteria {
|
|||
char urgent; // 'l' for latest or 'o' for oldest
|
||||
struct pattern *workspace;
|
||||
pid_t pid;
|
||||
struct pattern *sandbox_engine;
|
||||
struct pattern *sandbox_app_id;
|
||||
struct pattern *sandbox_instance_id;
|
||||
struct pattern *tag;
|
||||
};
|
||||
|
||||
bool criteria_is_empty(struct criteria *criteria);
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ enum sway_idle_inhibit_mode {
|
|||
struct sway_idle_inhibit_manager_v1 {
|
||||
struct wlr_idle_inhibit_manager_v1 *wlr_manager;
|
||||
struct wl_listener new_idle_inhibitor_v1;
|
||||
struct wl_listener manager_destroy;
|
||||
struct wl_list inhibitors;
|
||||
};
|
||||
|
||||
|
|
|
|||
|
|
@ -5,10 +5,11 @@
|
|||
#include <wlr/types/wlr_virtual_keyboard_v1.h>
|
||||
#include <wlr/types/wlr_virtual_pointer_v1.h>
|
||||
#include <wlr/types/wlr_transient_seat_v1.h>
|
||||
#include "sway/server.h"
|
||||
#include "sway/config.h"
|
||||
#include "list.h"
|
||||
|
||||
struct sway_server;
|
||||
|
||||
struct sway_input_device {
|
||||
char *identifier;
|
||||
struct wlr_input_device *wlr_device;
|
||||
|
|
@ -38,6 +39,8 @@ struct sway_input_manager {
|
|||
|
||||
struct sway_input_manager *input_manager_create(struct sway_server *server);
|
||||
|
||||
void input_manager_finish(struct sway_input_manager *input);
|
||||
|
||||
bool input_manager_has_focus(struct sway_node *node);
|
||||
|
||||
void input_manager_set_focus(struct sway_node *node);
|
||||
|
|
|
|||
|
|
@ -25,8 +25,10 @@ struct sway_input_method_relay {
|
|||
struct wlr_input_method_v2 *input_method; // doesn't have to be present
|
||||
|
||||
struct wl_listener text_input_new;
|
||||
struct wl_listener text_input_manager_destroy;
|
||||
|
||||
struct wl_listener input_method_new;
|
||||
struct wl_listener input_method_manager_destroy;
|
||||
struct wl_listener input_method_commit;
|
||||
struct wl_listener input_method_new_popup_surface;
|
||||
struct wl_listener input_method_grab_keyboard;
|
||||
|
|
|
|||
|
|
@ -9,11 +9,14 @@ struct sway_input_popup {
|
|||
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;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -9,7 +9,6 @@ struct sway_layer_surface {
|
|||
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;
|
||||
|
||||
|
|
@ -19,6 +18,8 @@ struct sway_layer_surface {
|
|||
struct sway_popup_desc desc;
|
||||
|
||||
struct sway_output *output;
|
||||
struct wl_list link; // sway_output.layer_surfaces
|
||||
|
||||
struct wlr_scene_layer_surface_v1 *scene;
|
||||
struct wlr_scene_tree *tree;
|
||||
struct wlr_layer_surface_v1 *layer_surface;
|
||||
|
|
@ -32,6 +33,7 @@ struct sway_layer_popup {
|
|||
struct wl_listener destroy;
|
||||
struct wl_listener new_popup;
|
||||
struct wl_listener commit;
|
||||
struct wl_listener reposition;
|
||||
};
|
||||
|
||||
struct sway_output;
|
||||
|
|
@ -41,4 +43,6 @@ struct wlr_layer_surface_v1 *toplevel_layer_surface_from_surface(
|
|||
|
||||
void arrange_layers(struct sway_output *output);
|
||||
|
||||
void destroy_layers(struct sway_output *output);
|
||||
|
||||
#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
|
||||
|
|
@ -52,25 +52,26 @@ struct sway_output {
|
|||
|
||||
bool enabled;
|
||||
list_t *workspaces;
|
||||
struct wl_list layer_surfaces; // sway_layer_surface.link
|
||||
|
||||
struct sway_output_state current;
|
||||
|
||||
struct wl_listener layout_destroy;
|
||||
struct wl_listener destroy;
|
||||
struct wl_listener commit;
|
||||
struct wl_listener present;
|
||||
struct wl_listener frame;
|
||||
struct wl_listener request_state;
|
||||
|
||||
struct {
|
||||
struct wl_signal disable;
|
||||
} events;
|
||||
struct wlr_color_transform *color_transform;
|
||||
struct wlr_ext_workspace_group_handle_v1 *ext_workspace_group;
|
||||
|
||||
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;
|
||||
bool hdr;
|
||||
};
|
||||
|
||||
struct sway_output_non_desktop {
|
||||
|
|
@ -90,6 +91,9 @@ struct sway_output *output_from_wlr_output(struct wlr_output *output);
|
|||
struct sway_output *output_get_in_direction(struct sway_output *reference,
|
||||
enum wlr_direction direction);
|
||||
|
||||
void output_configure_scene(struct sway_output *output,
|
||||
struct wlr_scene_node *node, float opacity);
|
||||
|
||||
void output_add_workspace(struct sway_output *output,
|
||||
struct sway_workspace *workspace);
|
||||
|
||||
|
|
@ -128,15 +132,13 @@ struct sway_container *output_find_container(struct sway_output *output,
|
|||
|
||||
void output_get_box(struct sway_output *output, struct wlr_box *box);
|
||||
|
||||
bool output_supports_hdr(struct wlr_output *output, const char **unsupported_reason_ptr);
|
||||
|
||||
enum sway_container_layout output_get_default_layout(
|
||||
struct sway_output *output);
|
||||
|
||||
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);
|
||||
|
||||
void handle_output_manager_test(struct wl_listener *listener, void *data);
|
||||
|
|
@ -146,4 +148,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
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@
|
|||
#include "config.h"
|
||||
#include "list.h"
|
||||
#include "sway/desktop/idle_inhibit_v1.h"
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
#include "sway/xwayland.h"
|
||||
#endif
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ struct sway_session_lock {
|
|||
struct sway_server {
|
||||
struct wl_display *wl_display;
|
||||
struct wl_event_loop *wl_event_loop;
|
||||
const char *socket;
|
||||
char *socket;
|
||||
|
||||
struct wlr_backend *backend;
|
||||
struct wlr_session *session;
|
||||
|
|
@ -45,8 +45,8 @@ 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 wl_event_source *recreating_renderer;
|
||||
|
||||
struct wlr_idle_notifier_v1 *idle_notifier_v1;
|
||||
struct sway_idle_inhibit_manager_v1 idle_inhibit_manager_v1;
|
||||
|
|
@ -59,7 +59,7 @@ struct sway_server {
|
|||
|
||||
struct wlr_tablet_manager_v2 *tablet_v2;
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
struct sway_xwayland xwayland;
|
||||
struct wl_listener xwayland_surface;
|
||||
struct wl_listener xwayland_ready;
|
||||
|
|
@ -81,6 +81,8 @@ struct sway_server {
|
|||
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;
|
||||
|
|
@ -103,17 +105,31 @@ struct sway_server {
|
|||
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_data_control_manager_v1 *wlr_data_control_manager_v1;
|
||||
struct wlr_ext_data_control_manager_v1 *ext_data_control_manager_v1;
|
||||
struct wlr_screencopy_manager_v1 *screencopy_manager_v1;
|
||||
struct wlr_ext_image_copy_capture_manager_v1 *ext_image_copy_capture_manager_v1;
|
||||
struct wlr_export_dmabuf_manager_v1 *export_dmabuf_manager_v1;
|
||||
struct wlr_security_context_manager_v1 *security_context_manager_v1;
|
||||
|
||||
struct wlr_ext_foreign_toplevel_image_capture_source_manager_v1 *ext_foreign_toplevel_image_capture_source_manager_v1;
|
||||
struct wl_listener new_foreign_toplevel_capture_request;
|
||||
|
||||
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 xdg_toplevel_tag_manager_v1_set_tag;
|
||||
|
||||
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 wlr_ext_workspace_manager_v1 *workspace_manager_v1;
|
||||
struct wl_listener workspace_manager_v1_commit;
|
||||
|
||||
struct wl_list pending_launcher_ctxs; // launcher_ctx::link
|
||||
|
||||
// The timeout for transactions, after which a transaction is applied
|
||||
|
|
@ -133,6 +149,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,31 +159,30 @@ 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 legacy_wl_drm; // Enable the legacy wl_drm interface
|
||||
};
|
||||
|
||||
extern struct sway_debug debug;
|
||||
|
||||
extern bool allow_unsupported_gpu;
|
||||
extern bool unsupported_gpu_detected;
|
||||
|
||||
void sway_terminate(int exit_code);
|
||||
|
||||
bool server_init(struct sway_server *server);
|
||||
void server_fini(struct sway_server *server);
|
||||
bool server_start(struct sway_server *server);
|
||||
void server_run(struct sway_server *server);
|
||||
|
||||
void restore_nofile_limit(void);
|
||||
|
||||
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);
|
||||
bool sway_session_lock_init(void);
|
||||
void sway_session_lock_add_output(struct sway_session_lock *lock,
|
||||
struct sway_output *output);
|
||||
bool sway_session_lock_has_surface(struct sway_session_lock *lock,
|
||||
struct wlr_surface *surface);
|
||||
void handle_xdg_shell_toplevel(struct wl_listener *listener, void *data);
|
||||
#if HAVE_XWAYLAND
|
||||
#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);
|
||||
|
|
@ -178,4 +195,6 @@ void xdg_activation_v1_handle_new_token(struct wl_listener *listener,
|
|||
|
||||
void set_rr_scheduling(void);
|
||||
|
||||
void handle_new_tearing_hint(struct wl_listener *listener, void *data);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -91,10 +91,6 @@ struct sway_container {
|
|||
} border;
|
||||
|
||||
struct wlr_scene_tree *content_tree;
|
||||
struct wlr_scene_buffer *output_handler;
|
||||
|
||||
struct wl_listener output_enter;
|
||||
struct wl_listener output_leave;
|
||||
|
||||
struct sway_container_state current;
|
||||
struct sway_container_state pending;
|
||||
|
|
@ -103,6 +99,8 @@ struct sway_container {
|
|||
char *formatted_title; // The title displayed in the title bar
|
||||
int title_width;
|
||||
|
||||
char *title_format;
|
||||
|
||||
enum sway_container_layout prev_split_layout;
|
||||
|
||||
// Whether stickiness has been enabled on this container. Use
|
||||
|
|
@ -175,8 +173,6 @@ 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_reap_empty(struct sway_container *con);
|
||||
|
||||
struct sway_container *container_flatten(struct sway_container *container);
|
||||
|
|
@ -185,6 +181,8 @@ 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);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,12 +2,12 @@
|
|||
#define _SWAY_ROOT_H
|
||||
#include <wayland-server-core.h>
|
||||
#include <wayland-util.h>
|
||||
#include <wlr/config.h>
|
||||
#include <wlr/types/wlr_output_layout.h>
|
||||
#include <wlr/types/wlr_scene.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;
|
||||
|
|
@ -16,8 +16,6 @@ struct sway_root {
|
|||
struct sway_node node;
|
||||
struct wlr_output_layout *output_layout;
|
||||
|
||||
struct wl_listener output_layout_change;
|
||||
|
||||
// scene node layout:
|
||||
// - root
|
||||
// - staging
|
||||
|
|
@ -47,7 +45,7 @@ struct sway_root {
|
|||
struct wlr_scene_tree *shell_top;
|
||||
struct wlr_scene_tree *fullscreen;
|
||||
struct wlr_scene_tree *fullscreen_global;
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
struct wlr_scene_tree *unmanaged;
|
||||
#endif
|
||||
struct wlr_scene_tree *shell_overlay;
|
||||
|
|
|
|||
|
|
@ -1,10 +1,12 @@
|
|||
#ifndef _SWAY_VIEW_H
|
||||
#define _SWAY_VIEW_H
|
||||
#include <wayland-server-core.h>
|
||||
#include <wlr/config.h>
|
||||
#include <wlr/types/wlr_compositor.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
#include <wlr/types/wlr_tearing_control_v1.h>
|
||||
#include "sway/config.h"
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
#include <wlr/xwayland.h>
|
||||
#endif
|
||||
#include "sway/input/input-manager.h"
|
||||
|
|
@ -15,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
|
||||
};
|
||||
|
|
@ -23,16 +25,23 @@ enum sway_view_type {
|
|||
enum sway_view_prop {
|
||||
VIEW_PROP_TITLE,
|
||||
VIEW_PROP_APP_ID,
|
||||
VIEW_PROP_TAG,
|
||||
VIEW_PROP_CLASS,
|
||||
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);
|
||||
|
|
@ -60,6 +69,12 @@ struct sway_view {
|
|||
struct wlr_scene_tree *scene_tree;
|
||||
struct wlr_scene_tree *content_tree;
|
||||
struct wlr_scene_tree *saved_surface_tree;
|
||||
struct wlr_scene_buffer *output_handler;
|
||||
|
||||
struct wl_listener outputs_update;
|
||||
|
||||
struct wlr_scene *image_capture_scene;
|
||||
struct wlr_ext_image_capture_source_v1 *image_capture_source;
|
||||
|
||||
struct sway_container *container; // NULL if unmapped and transactions finished
|
||||
struct wlr_surface *surface; // NULL for unmapped views
|
||||
|
|
@ -72,8 +87,6 @@ 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;
|
||||
|
|
@ -98,7 +111,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
|
||||
};
|
||||
|
|
@ -110,11 +123,17 @@ struct sway_view {
|
|||
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 {
|
||||
struct sway_view view;
|
||||
|
||||
struct wlr_scene_tree *image_capture_tree;
|
||||
char *tag;
|
||||
|
||||
struct wl_listener commit;
|
||||
struct wl_listener request_move;
|
||||
struct wl_listener request_resize;
|
||||
|
|
@ -127,12 +146,14 @@ 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 wlr_scene_surface *image_capture_scene_surface;
|
||||
|
||||
struct wl_listener commit;
|
||||
struct wl_listener request_move;
|
||||
struct wl_listener request_resize;
|
||||
|
|
@ -183,10 +204,12 @@ struct sway_popup_desc {
|
|||
|
||||
struct sway_xdg_popup {
|
||||
struct sway_view *view;
|
||||
struct wlr_xdg_popup *wlr_xdg_popup;
|
||||
|
||||
struct wlr_scene_tree *scene_tree;
|
||||
struct wlr_scene_tree *xdg_surface_tree;
|
||||
struct wlr_xdg_popup *wlr_xdg_popup;
|
||||
|
||||
struct wlr_scene_tree *image_capture_tree;
|
||||
|
||||
struct sway_popup_desc desc;
|
||||
|
||||
|
|
@ -212,6 +235,14 @@ const char *view_get_window_role(struct sway_view *view);
|
|||
|
||||
uint32_t view_get_window_type(struct sway_view *view);
|
||||
|
||||
const char *view_get_sandbox_engine(struct sway_view *view);
|
||||
|
||||
const char *view_get_sandbox_app_id(struct sway_view *view);
|
||||
|
||||
const char *view_get_sandbox_instance_id(struct sway_view *view);
|
||||
|
||||
const char *view_get_tag(struct sway_view *view);
|
||||
|
||||
const char *view_get_shell(struct sway_view *view);
|
||||
|
||||
void view_get_constraints(struct sway_view *view, double *min_width,
|
||||
|
|
@ -293,7 +324,7 @@ 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
|
||||
|
|
@ -334,4 +365,8 @@ void view_assign_ctx(struct sway_view *view, struct launcher_ctx *ctx);
|
|||
|
||||
void view_send_frame_done(struct sway_view *view);
|
||||
|
||||
bool view_can_tear(struct sway_view *view);
|
||||
|
||||
void xdg_toplevel_tag_manager_v1_handle_set_tag(struct wl_listener *listener, void *data);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
|
||||
#include <stdbool.h>
|
||||
#include <wlr/types/wlr_scene.h>
|
||||
#include <wlr/types/wlr_ext_workspace_v1.h>
|
||||
#include "sway/config.h"
|
||||
#include "sway/tree/container.h"
|
||||
#include "sway/tree/node.h"
|
||||
|
|
@ -51,6 +52,7 @@ struct sway_workspace {
|
|||
bool urgent;
|
||||
|
||||
struct sway_workspace_state current;
|
||||
struct wlr_ext_workspace_handle_v1 *ext_workspace; // Always set.
|
||||
};
|
||||
|
||||
struct workspace_config *workspace_find_config(const char *ws_name);
|
||||
|
|
@ -96,7 +98,7 @@ void workspace_output_add_priority(struct sway_workspace *workspace,
|
|||
struct sway_output *output);
|
||||
|
||||
struct sway_output *workspace_output_get_highest_available(
|
||||
struct sway_workspace *ws, struct sway_output *exclude);
|
||||
struct sway_workspace *ws);
|
||||
|
||||
void workspace_detect_urgent(struct sway_workspace *workspace);
|
||||
|
||||
|
|
@ -157,4 +159,11 @@ size_t workspace_num_sticky_containers(struct sway_workspace *ws);
|
|||
*/
|
||||
void workspace_squash(struct sway_workspace *workspace);
|
||||
|
||||
void workspace_move_to_output(struct sway_workspace *workspace,
|
||||
struct sway_output *output);
|
||||
|
||||
bool sway_ext_workspace_init(void);
|
||||
void sway_ext_workspace_output_enable(struct sway_output *output);
|
||||
void sway_ext_workspace_output_disable(struct sway_output *output);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -14,6 +14,11 @@ struct box_colors {
|
|||
uint32_t text;
|
||||
};
|
||||
|
||||
struct box_size {
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
};
|
||||
|
||||
struct config_output {
|
||||
struct wl_list link; // swaybar_config::outputs
|
||||
char *name;
|
||||
|
|
|
|||
|
|
@ -61,4 +61,6 @@ const char *sway_wl_output_subpixel_to_string(enum wl_output_subpixel subpixel);
|
|||
|
||||
bool sway_set_cloexec(int fd, bool cloexec);
|
||||
|
||||
uint32_t get_current_time_in_msec(void);
|
||||
|
||||
#endif
|
||||
|
|
|
|||
64
meson.build
64
meson.build
|
|
@ -1,13 +1,14 @@
|
|||
project(
|
||||
'sway',
|
||||
'c',
|
||||
version: '1.10-dev',
|
||||
version: '1.13-dev',
|
||||
license: 'MIT',
|
||||
meson_version: '>=0.60.0',
|
||||
meson_version: '>=1.3',
|
||||
default_options: [
|
||||
'c_std=c11',
|
||||
'warning_level=2',
|
||||
'werror=true',
|
||||
'wrap_mode=nodownload',
|
||||
],
|
||||
)
|
||||
|
||||
|
|
@ -38,14 +39,14 @@ if is_freebsd
|
|||
endif
|
||||
|
||||
# Execute the wlroots subproject, if any
|
||||
wlroots_version = ['>=0.18.0', '<0.19.0']
|
||||
wlroots_version = ['>=0.21.0', '<0.22.0']
|
||||
subproject(
|
||||
'wlroots',
|
||||
default_options: ['examples=false'],
|
||||
required: false,
|
||||
version: wlroots_version,
|
||||
)
|
||||
wlroots = dependency('wlroots', version: wlroots_version)
|
||||
wlroots = dependency('wlroots-0.21', version: wlroots_version, fallback: 'wlroots')
|
||||
wlroots_features = {
|
||||
'xwayland': false,
|
||||
'libinput_backend': false,
|
||||
|
|
@ -57,10 +58,6 @@ 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
|
||||
|
||||
null_dep = dependency('', required: false)
|
||||
|
||||
jsonc = dependency('json-c', version: '>=0.13')
|
||||
|
|
@ -68,7 +65,7 @@ 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')
|
||||
wayland_protos = dependency('wayland-protocols', version: '>=1.41', default_options: ['tests=false'])
|
||||
xkbcommon = dependency('xkbcommon', version: '>=1.5.0')
|
||||
cairo = dependency('cairo')
|
||||
pango = dependency('pango')
|
||||
|
|
@ -76,16 +73,14 @@ 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.21.0') : null_dep
|
||||
xcb = dependency('xcb', required: get_option('xwayland'))
|
||||
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 = dependency('xcb-icccm', required: get_option('xwayland'))
|
||||
threads = dependency('threads') # for pthread_setschedparam
|
||||
|
||||
have_xwayland = xcb.found() and xcb_icccm.found() and wlroots_features['xwayland']
|
||||
xcb_icccm = wlroots_features['xwayland'] ? dependency('xcb-icccm') : null_dep
|
||||
threads = dependency('threads') # for pthread_setschedparam and pthread_atfork
|
||||
|
||||
if get_option('sd-bus-provider') == 'auto'
|
||||
if not get_option('tray').disabled()
|
||||
|
|
@ -110,17 +105,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', 'LIBINPUT_SWITCH_KEYPAD_SLIDE']
|
||||
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()
|
||||
|
|
@ -167,8 +159,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(),
|
||||
|
|
@ -179,31 +171,10 @@ if git.found()
|
|||
endif
|
||||
add_project_arguments('-DSWAY_VERSION=@0@'.format(version), language: 'c')
|
||||
|
||||
# Compute the relative path used by compiler invocations.
|
||||
source_root = meson.current_source_dir().split('/')
|
||||
build_root = meson.global_build_root().split('/')
|
||||
relative_dir_parts = []
|
||||
i = 0
|
||||
in_prefix = true
|
||||
foreach p : build_root
|
||||
if i >= source_root.length() or not in_prefix or p != source_root[i]
|
||||
in_prefix = false
|
||||
relative_dir_parts += '..'
|
||||
endif
|
||||
i += 1
|
||||
endforeach
|
||||
i = 0
|
||||
in_prefix = true
|
||||
foreach p : source_root
|
||||
if i >= build_root.length() or not in_prefix or build_root[i] != p
|
||||
in_prefix = false
|
||||
relative_dir_parts += p
|
||||
endif
|
||||
i += 1
|
||||
endforeach
|
||||
relative_dir = join_paths(relative_dir_parts) + '/'
|
||||
fs = import('fs')
|
||||
|
||||
# Strip relative path prefixes from the code if possible, otherwise hide them.
|
||||
relative_dir = fs.relative_to(meson.current_source_dir(), meson.global_build_root()) + '/'
|
||||
if cc.has_argument('-fmacro-prefix-map=/prefix/to/hide=')
|
||||
add_project_arguments(
|
||||
'-fmacro-prefix-map=@0@='.format(relative_dir),
|
||||
|
|
@ -271,7 +242,6 @@ endif
|
|||
subdir('completions')
|
||||
|
||||
summary({
|
||||
'xwayland': have_xwayland,
|
||||
'gdk-pixbuf': gdk_pixbuf.found(),
|
||||
'tray': have_tray,
|
||||
'man-pages': scdoc.found(),
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ option('bash-completions', type: 'boolean', value: true, description: 'Install b
|
|||
option('fish-completions', type: 'boolean', value: true, description: 'Install fish shell completions.')
|
||||
option('swaybar', type: 'boolean', value: true, description: 'Enable support for swaybar')
|
||||
option('swaynag', type: 'boolean', value: true, description: 'Enable support for swaynag')
|
||||
option('xwayland', type: 'feature', value: 'auto', description: 'Enable support for X11 applications')
|
||||
option('tray', type: 'feature', value: 'auto', description: 'Enable support for swaybar tray')
|
||||
option('gdk-pixbuf', type: 'feature', value: 'auto', description: 'Enable support for more image formats in swaybar tray')
|
||||
option('man-pages', type: 'feature', value: 'auto', description: 'Generate and install man pages')
|
||||
|
|
|
|||
|
|
@ -1,49 +0,0 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<protocol name="idle">
|
||||
<copyright><![CDATA[
|
||||
Copyright (C) 2015 Martin Gräßlin
|
||||
|
||||
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 of the License, 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, see <http://www.gnu.org/licenses/>.
|
||||
]]></copyright>
|
||||
<interface name="org_kde_kwin_idle" version="1">
|
||||
<description summary="User idle time manager">
|
||||
This interface allows to monitor user idle time on a given seat. The interface
|
||||
allows to register timers which trigger after no user activity was registered
|
||||
on the seat for a given interval. It notifies when user activity resumes.
|
||||
|
||||
This is useful for applications wanting to perform actions when the user is not
|
||||
interacting with the system, e.g. chat applications setting the user as away, power
|
||||
management features to dim screen, etc..
|
||||
</description>
|
||||
<request name="get_idle_timeout">
|
||||
<arg name="id" type="new_id" interface="org_kde_kwin_idle_timeout"/>
|
||||
<arg name="seat" type="object" interface="wl_seat"/>
|
||||
<arg name="timeout" type="uint" summary="The idle timeout in msec"/>
|
||||
</request>
|
||||
</interface>
|
||||
<interface name="org_kde_kwin_idle_timeout" version="1">
|
||||
<request name="release" type="destructor">
|
||||
<description summary="release the timeout object"/>
|
||||
</request>
|
||||
<request name="simulate_user_activity">
|
||||
<description summary="Simulates user activity for this timeout, behaves just like real user activity on the seat"/>
|
||||
</request>
|
||||
<event name="idle">
|
||||
<description summary="Triggered when there has not been any user activity in the requested idle time interval"/>
|
||||
</event>
|
||||
<event name="resumed">
|
||||
<description summary="Triggered on the first user activity after an idle event"/>
|
||||
</event>
|
||||
</interface>
|
||||
</protocol>
|
||||
|
|
@ -7,15 +7,11 @@ wayland_scanner = find_program(
|
|||
)
|
||||
|
||||
protocols = [
|
||||
wl_protocol_dir / 'stable/tablet/tablet-v2.xml',
|
||||
wl_protocol_dir / 'stable/xdg-shell/xdg-shell.xml',
|
||||
wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
|
||||
wl_protocol_dir / 'unstable/pointer-constraints/pointer-constraints-unstable-v1.xml',
|
||||
wl_protocol_dir / 'unstable/tablet/tablet-unstable-v2.xml',
|
||||
wl_protocol_dir / 'unstable/linux-dmabuf/linux-dmabuf-unstable-v1.xml',
|
||||
wl_protocol_dir / 'staging/content-type/content-type-v1.xml',
|
||||
wl_protocol_dir / 'staging/cursor-shape/cursor-shape-v1.xml',
|
||||
wl_protocol_dir / 'unstable/xdg-output/xdg-output-unstable-v1.xml',
|
||||
'wlr-layer-shell-unstable-v1.xml',
|
||||
'idle.xml',
|
||||
'wlr-output-power-management-unstable-v1.xml',
|
||||
]
|
||||
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@
|
|||
THIS SOFTWARE.
|
||||
</copyright>
|
||||
|
||||
<interface name="zwlr_layer_shell_v1" version="4">
|
||||
<interface name="zwlr_layer_shell_v1" version="5">
|
||||
<description summary="create surfaces that are layers of the desktop">
|
||||
Clients can use this interface to assign the surface_layer role to
|
||||
wl_surfaces. Such surfaces are assigned to a "layer" of the output and
|
||||
|
|
@ -100,7 +100,7 @@
|
|||
</request>
|
||||
</interface>
|
||||
|
||||
<interface name="zwlr_layer_surface_v1" version="4">
|
||||
<interface name="zwlr_layer_surface_v1" version="5">
|
||||
<description summary="layer metadata interface">
|
||||
An interface that may be implemented by a wl_surface, for surfaces that
|
||||
are designed to be rendered as a layer of a stacked desktop-like
|
||||
|
|
@ -367,6 +367,7 @@
|
|||
<entry name="invalid_size" value="1" summary="size is invalid"/>
|
||||
<entry name="invalid_anchor" value="2" summary="anchor bitfield is invalid"/>
|
||||
<entry name="invalid_keyboard_interactivity" value="3" summary="keyboard interactivity is invalid"/>
|
||||
<entry name="invalid_exclusive_edge" value="4" summary="exclusive edge is invalid given the surface anchors"/>
|
||||
</enum>
|
||||
|
||||
<enum name="anchor" bitfield="true">
|
||||
|
|
@ -386,5 +387,21 @@
|
|||
</description>
|
||||
<arg name="layer" type="uint" enum="zwlr_layer_shell_v1.layer" summary="layer to move this surface to"/>
|
||||
</request>
|
||||
|
||||
<!-- Version 5 additions -->
|
||||
|
||||
<request name="set_exclusive_edge" since="5">
|
||||
<description summary="set the edge the exclusive zone will be applied to">
|
||||
Requests an edge for the exclusive zone to apply. The exclusive
|
||||
edge will be automatically deduced from anchor points when possible,
|
||||
but when the surface is anchored to a corner, it will be necessary
|
||||
to set it explicitly to disambiguate, as it is not possible to deduce
|
||||
which one of the two corner edges should be used.
|
||||
|
||||
The edge must be one the surface is anchored to, otherwise the
|
||||
invalid_exclusive_edge protocol error will be raised.
|
||||
</description>
|
||||
<arg name="edge" type="uint" enum="anchor"/>
|
||||
</request>
|
||||
</interface>
|
||||
</protocol>
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@
|
|||
|
||||
<request name="get_output_power">
|
||||
<description summary="get a power management for an output">
|
||||
Create a output power management mode control that can be used to
|
||||
Create an output power management mode control that can be used to
|
||||
adjust the power management mode for a given output.
|
||||
</description>
|
||||
<arg name="id" type="new_id" interface="zwlr_output_power_v1"/>
|
||||
|
|
@ -79,7 +79,7 @@
|
|||
</enum>
|
||||
|
||||
<enum name="error">
|
||||
<entry name="invalid_mode" value="1" summary="inexistent power save mode"/>
|
||||
<entry name="invalid_mode" value="1" summary="nonexistent power save mode"/>
|
||||
</enum>
|
||||
|
||||
<request name="set_mode">
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
#!/bin/sh -eu
|
||||
|
||||
prev=$(git describe --tags --abbrev=0)
|
||||
next=$(meson rewrite kwargs info project / 2>&1 >/dev/null | jq -r '.kwargs["project#/"].version')
|
||||
next=$(meson rewrite kwargs info project / | jq -r '.kwargs["project#/"].version')
|
||||
|
||||
case "$next" in
|
||||
*-dev)
|
||||
|
|
@ -28,4 +28,5 @@ archive=$prefix.tar.gz
|
|||
git archive --prefix="$prefix/" -o "$archive" "$next"
|
||||
gpg --output "$archive".sig --detach-sig "$archive"
|
||||
|
||||
git push --follow-tags
|
||||
gh release create "sway $next" -t "$next" -n "" -d "$archive" "$archive.sig"
|
||||
|
|
|
|||
|
|
@ -3,3 +3,4 @@ Name=Sway
|
|||
Comment=An i3-compatible Wayland compositor
|
||||
Exec=sway
|
||||
Type=Application
|
||||
DesktopNames=sway;wlroots
|
||||
|
|
|
|||
|
|
@ -113,6 +113,7 @@ static const struct cmd_handler config_handlers[] = {
|
|||
|
||||
/* Runtime-only commands. Keep alphabetized */
|
||||
static const struct cmd_handler command_handlers[] = {
|
||||
{ "allow_tearing", cmd_allow_tearing },
|
||||
{ "border", cmd_border },
|
||||
{ "create_output", cmd_create_output },
|
||||
{ "exit", cmd_exit },
|
||||
|
|
|
|||
24
sway/commands/allow_tearing.c
Normal file
24
sway/commands/allow_tearing.c
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
#include <sway/commands.h>
|
||||
#include "sway/config.h"
|
||||
#include "sway/tree/view.h"
|
||||
#include "util.h"
|
||||
|
||||
struct cmd_results *cmd_allow_tearing(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "allow_tearing", EXPECTED_AT_LEAST, 1))) {
|
||||
return error;
|
||||
}
|
||||
|
||||
struct sway_container *container = config->handler_context.container;
|
||||
if (!container || !container->view) {
|
||||
return cmd_results_new(CMD_INVALID, "Tearing can only be allowed on views");
|
||||
}
|
||||
|
||||
bool wants_tearing = parse_boolean(argv[0], true);
|
||||
|
||||
struct sway_view *view = container->view;
|
||||
view->tearing_mode = wants_tearing ? TEARING_OVERRIDE_TRUE :
|
||||
TEARING_OVERRIDE_FALSE;
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ struct cmd_results *cmd_assign(int argc, char **argv) {
|
|||
|
||||
--argc; ++argv;
|
||||
|
||||
if (strncmp(*argv, "→", strlen("→")) == 0) {
|
||||
if (has_prefix(*argv, "→")) {
|
||||
if (argc < 2) {
|
||||
free(criteria);
|
||||
return cmd_results_new(CMD_INVALID, "Missing workspace");
|
||||
|
|
|
|||
|
|
@ -72,6 +72,10 @@ static struct cmd_results *parse_three_colors(char ***colors,
|
|||
}
|
||||
|
||||
struct cmd_results *bar_cmd_colors(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "colors", EXPECTED_AT_LEAST, 1))) {
|
||||
return error;
|
||||
}
|
||||
return config_subcommand(argv, argc, bar_colors_handlers,
|
||||
sizeof(bar_colors_handlers));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ struct cmd_results *bar_cmd_font(int argc, char **argv) {
|
|||
char *font = join_args(argv, argc);
|
||||
free(config->current_bar->font);
|
||||
|
||||
if (strncmp(font, "pango:", 6) == 0) {
|
||||
if (has_prefix(font, "pango:")) {
|
||||
if (config->current_bar->pango_markup == PANGO_MARKUP_DEFAULT) {
|
||||
config->current_bar->pango_markup = true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -367,8 +367,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
|
|||
}
|
||||
} else if (strcmp("--exclude-titlebar", argv[0]) == 0) {
|
||||
exclude_titlebar = true;
|
||||
} else if (strncmp("--input-device=", argv[0],
|
||||
strlen("--input-device=")) == 0) {
|
||||
} else if (has_prefix(argv[0], "--input-device=")) {
|
||||
free(binding->input);
|
||||
binding->input = strdup(argv[0] + strlen("--input-device="));
|
||||
strip_quotes(binding->input);
|
||||
|
|
@ -399,7 +398,7 @@ static struct cmd_results *cmd_bindsym_or_bindcode(int argc, char **argv,
|
|||
list_t *split = split_string(argv[0], "+");
|
||||
for (int i = 0; i < split->length; ++i) {
|
||||
// Check for group
|
||||
if (strncmp(split->items[i], "Group", strlen("Group")) == 0) {
|
||||
if (has_prefix(split->items[i], "Group")) {
|
||||
if (binding->group != XKB_LAYOUT_INVALID) {
|
||||
free_sway_binding(binding);
|
||||
list_free_items_and_destroy(split);
|
||||
|
|
@ -544,6 +543,10 @@ struct cmd_results *cmd_bind_or_unbind_switch(int argc, char **argv,
|
|||
binding->type = WLR_SWITCH_TYPE_TABLET_MODE;
|
||||
} else if (strcmp(split->items[0], "lid") == 0) {
|
||||
binding->type = WLR_SWITCH_TYPE_LID;
|
||||
#if HAVE_LIBINPUT_SWITCH_KEYPAD_SLIDE
|
||||
} else if (strcmp(split->items[0], "keypad_slide") == 0) {
|
||||
binding->type = WLR_SWITCH_TYPE_KEYPAD_SLIDE;
|
||||
#endif
|
||||
} else {
|
||||
free_switch_binding(binding);
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
|
|
|
|||
|
|
@ -25,16 +25,6 @@ struct cmd_results *cmd_exec_validate(int argc, char **argv) {
|
|||
return error;
|
||||
}
|
||||
|
||||
static void export_xdga_token(struct launcher_ctx *ctx) {
|
||||
const char *token = launcher_ctx_get_token_name(ctx);
|
||||
setenv("XDG_ACTIVATION_TOKEN", token, 1);
|
||||
}
|
||||
|
||||
static void export_startup_id(struct launcher_ctx *ctx) {
|
||||
const char *token = launcher_ctx_get_token_name(ctx);
|
||||
setenv("DESKTOP_STARTUP_ID", token, 1);
|
||||
}
|
||||
|
||||
struct cmd_results *cmd_exec_process(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
char *cmd = NULL;
|
||||
|
|
@ -56,67 +46,37 @@ struct cmd_results *cmd_exec_process(int argc, char **argv) {
|
|||
|
||||
sway_log(SWAY_DEBUG, "Executing %s", cmd);
|
||||
|
||||
int fd[2];
|
||||
if (pipe(fd) != 0) {
|
||||
sway_log(SWAY_ERROR, "Unable to create pipe for fork");
|
||||
}
|
||||
|
||||
pid_t pid, child;
|
||||
struct launcher_ctx *ctx = launcher_ctx_create_internal();
|
||||
|
||||
// Fork process
|
||||
if ((pid = fork()) == 0) {
|
||||
// Fork child process again
|
||||
restore_nofile_limit();
|
||||
pid_t child = fork();
|
||||
if (child == 0) {
|
||||
setsid();
|
||||
sigset_t set;
|
||||
sigemptyset(&set);
|
||||
sigprocmask(SIG_SETMASK, &set, NULL);
|
||||
signal(SIGPIPE, SIG_DFL);
|
||||
close(fd[0]);
|
||||
if ((child = fork()) == 0) {
|
||||
close(fd[1]);
|
||||
if (ctx) {
|
||||
export_xdga_token(ctx);
|
||||
|
||||
if (ctx) {
|
||||
const char *token = launcher_ctx_get_token_name(ctx);
|
||||
setenv("XDG_ACTIVATION_TOKEN", token, 1);
|
||||
if (!no_startup_id) {
|
||||
setenv("DESKTOP_STARTUP_ID", token, 1);
|
||||
}
|
||||
if (ctx && !no_startup_id) {
|
||||
export_startup_id(ctx);
|
||||
}
|
||||
execlp("sh", "sh", "-c", cmd, (void *)NULL);
|
||||
sway_log_errno(SWAY_ERROR, "execlp failed");
|
||||
_exit(1);
|
||||
}
|
||||
ssize_t s = 0;
|
||||
while ((size_t)s < sizeof(pid_t)) {
|
||||
s += write(fd[1], ((uint8_t *)&child) + s, sizeof(pid_t) - s);
|
||||
}
|
||||
close(fd[1]);
|
||||
|
||||
execlp("sh", "sh", "-c", cmd, (void*)NULL);
|
||||
sway_log_errno(SWAY_ERROR, "execve failed");
|
||||
_exit(0); // Close child process
|
||||
} else if (pid < 0) {
|
||||
} else if (child < 0) {
|
||||
launcher_ctx_destroy(ctx);
|
||||
free(cmd);
|
||||
close(fd[0]);
|
||||
close(fd[1]);
|
||||
return cmd_results_new(CMD_FAILURE, "fork() failed");
|
||||
}
|
||||
free(cmd);
|
||||
close(fd[1]); // close write
|
||||
ssize_t s = 0;
|
||||
while ((size_t)s < sizeof(pid_t)) {
|
||||
s += read(fd[0], ((uint8_t *)&child) + s, sizeof(pid_t) - s);
|
||||
}
|
||||
close(fd[0]);
|
||||
// cleanup child process
|
||||
waitpid(pid, NULL, 0);
|
||||
if (child > 0) {
|
||||
sway_log(SWAY_DEBUG, "Child process created with pid %d", child);
|
||||
if (ctx != NULL) {
|
||||
sway_log(SWAY_DEBUG, "Recording workspace for process %d", child);
|
||||
ctx->pid = child;
|
||||
}
|
||||
} else {
|
||||
launcher_ctx_destroy(ctx);
|
||||
return cmd_results_new(CMD_FAILURE, "Second fork() failed");
|
||||
|
||||
sway_log(SWAY_DEBUG, "Child process created with pid %d", child);
|
||||
if (ctx != NULL) {
|
||||
sway_log(SWAY_DEBUG, "Recording workspace for process %d", child);
|
||||
ctx->pid = child;
|
||||
}
|
||||
|
||||
free(cmd);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,7 @@
|
|||
#include <stddef.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
|
||||
void sway_terminate(int exit_code);
|
||||
#include "sway/server.h"
|
||||
|
||||
struct cmd_results *cmd_exit(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
|
|
|
|||
|
|
@ -13,9 +13,9 @@ struct cmd_results *cmd_font(int argc, char **argv) {
|
|||
char *font = join_args(argv, argc);
|
||||
free(config->font);
|
||||
|
||||
if (strncmp(font, "pango:", 6) == 0) {
|
||||
if (has_prefix(font, "pango:")) {
|
||||
config->pango_markup = true;
|
||||
config->font = strdup(font + 6);
|
||||
config->font = strdup(font + strlen("pango:"));
|
||||
free(font);
|
||||
} else {
|
||||
config->pango_markup = false;
|
||||
|
|
|
|||
|
|
@ -215,15 +215,13 @@ struct cmd_results *cmd_gaps(int argc, char **argv) {
|
|||
return error;
|
||||
}
|
||||
|
||||
bool config_loading = !config->active || config->reloading;
|
||||
|
||||
if (argc == 2) {
|
||||
return gaps_set_defaults(argc, argv);
|
||||
}
|
||||
if (argc == 4 && !config_loading) {
|
||||
if (argc == 4 && !config->reading) {
|
||||
return gaps_set_runtime(argc, argv);
|
||||
}
|
||||
if (config_loading) {
|
||||
if (config->reading) {
|
||||
return cmd_results_new(CMD_INVALID, "Expected %s", expected_defaults);
|
||||
}
|
||||
return cmd_results_new(CMD_INVALID, "Expected %s or %s",
|
||||
|
|
|
|||
|
|
@ -121,8 +121,7 @@ static struct cmd_results *cmd_bind_or_unbind_gesture(int argc, char **argv, boo
|
|||
binding->flags |= BINDING_EXACT;
|
||||
} else if (strcmp("--no-warn", argv[0]) == 0) {
|
||||
warn = false;
|
||||
} else if (strncmp("--input-device=", argv[0],
|
||||
strlen("--input-device=")) == 0) {
|
||||
} else if (has_prefix(argv[0], "--input-device=")) {
|
||||
free(binding->input);
|
||||
binding->input = strdup(argv[0] + strlen("--input-device="));
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -3,12 +3,12 @@
|
|||
|
||||
struct cmd_results *cmd_include(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "include", EXPECTED_EQUAL_TO, 1))) {
|
||||
if ((error = checkarg(argc, "include", EXPECTED_AT_LEAST, 1))) {
|
||||
return error;
|
||||
}
|
||||
|
||||
char *files = join_args(argv, argc);
|
||||
// We don't care if the included config(s) fails to load.
|
||||
load_include_configs(argv[0], config, &config->swaynag_config_errors);
|
||||
load_include_configs(files, config, &config->swaynag_config_errors);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ static const struct cmd_handler input_handlers[] = {
|
|||
{ "accel_profile", input_cmd_accel_profile },
|
||||
{ "calibration_matrix", input_cmd_calibration_matrix },
|
||||
{ "click_method", input_cmd_click_method },
|
||||
{ "clickfinger_button_map", input_cmd_clickfinger_button_map },
|
||||
{ "drag", input_cmd_drag },
|
||||
{ "drag_lock", input_cmd_drag_lock },
|
||||
{ "dwt", input_cmd_dwt },
|
||||
|
|
@ -93,7 +94,7 @@ struct cmd_results *cmd_input(int argc, char **argv) {
|
|||
return res;
|
||||
}
|
||||
|
||||
if (!config->reloading) {
|
||||
if (!config->reading) {
|
||||
input_manager_apply_input_config(ic);
|
||||
}
|
||||
} else {
|
||||
|
|
|
|||
27
sway/commands/input/clickfinger_button_map.c
Normal file
27
sway/commands/input/clickfinger_button_map.c
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include "sway/config.h"
|
||||
#include "sway/commands.h"
|
||||
#include "sway/input/input-manager.h"
|
||||
|
||||
struct cmd_results *input_cmd_clickfinger_button_map(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "clickfinger_button_map", EXPECTED_AT_LEAST, 1))) {
|
||||
return error;
|
||||
}
|
||||
struct input_config *ic = config->handler_context.input_config;
|
||||
if (!ic) {
|
||||
return cmd_results_new(CMD_FAILURE, "No input device defined.");
|
||||
}
|
||||
|
||||
if (strcasecmp(argv[0], "lrm") == 0) {
|
||||
ic->clickfinger_button_map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LRM;
|
||||
} else if (strcasecmp(argv[0], "lmr") == 0) {
|
||||
ic->clickfinger_button_map = LIBINPUT_CONFIG_CLICKFINGER_MAP_LMR;
|
||||
} else {
|
||||
return cmd_results_new(CMD_INVALID,
|
||||
"Expected 'clickfinger_button_map <lrm|lmr>'");
|
||||
}
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
@ -15,6 +15,11 @@ struct cmd_results *input_cmd_drag_lock(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_FAILURE, "No input device defined.");
|
||||
}
|
||||
|
||||
#if HAVE_LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY
|
||||
if (strcmp(argv[0], "enabled_sticky") == 0) {
|
||||
ic->drag_lock = LIBINPUT_CONFIG_DRAG_LOCK_ENABLED_STICKY;
|
||||
} else
|
||||
#endif
|
||||
if (parse_boolean(argv[0], true)) {
|
||||
ic->drag_lock = LIBINPUT_CONFIG_DRAG_LOCK_ENABLED;
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include "sway/config.h"
|
||||
#include "sway/commands.h"
|
||||
#include "sway/input/input-manager.h"
|
||||
#include "sway/server.h"
|
||||
#include "log.h"
|
||||
|
||||
#if WLR_HAS_LIBINPUT_BACKEND
|
||||
|
|
@ -85,7 +86,7 @@ static void toggle_select_send_events_for_device(struct input_config *ic,
|
|||
static void toggle_send_events(int argc, char **argv) {
|
||||
struct input_config *ic = config->handler_context.input_config;
|
||||
bool wildcard = strcmp(ic->identifier, "*") == 0;
|
||||
const char *type = strncmp(ic->identifier, "type:", strlen("type:")) == 0
|
||||
const char *type = has_prefix(ic->identifier, "type:")
|
||||
? ic->identifier + strlen("type:") : NULL;
|
||||
struct sway_input_device *device = NULL;
|
||||
wl_list_for_each(device, &server.input->devices, link) {
|
||||
|
|
@ -145,8 +146,7 @@ struct cmd_results *input_cmd_events(int argc, char **argv) {
|
|||
|
||||
toggle_send_events(argc - 1, argv + 1);
|
||||
|
||||
if (strcmp(ic->identifier, "*") == 0 ||
|
||||
strncmp(ic->identifier, "type:", strlen("type:")) == 0) {
|
||||
if (strcmp(ic->identifier, "*") == 0 || has_prefix(ic->identifier, "type:")) {
|
||||
// Update the device input configs and then reset the type/wildcard
|
||||
// config send events mode so that is does not override the device
|
||||
// ones. The device ones will be applied when attempting to apply
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "sway/config.h"
|
||||
#include "sway/commands.h"
|
||||
#include "sway/input/input-manager.h"
|
||||
#include "sway/server.h"
|
||||
#include "log.h"
|
||||
|
||||
struct xkb_switch_layout_action {
|
||||
|
|
@ -94,10 +95,18 @@ struct cmd_results *input_cmd_xkb_switch_layout(int argc, char **argv) {
|
|||
continue;
|
||||
}
|
||||
|
||||
struct wlr_keyboard *keyboard =
|
||||
wlr_keyboard_from_input_device(dev->wlr_device);
|
||||
if (keyboard->keymap == NULL && dev->is_virtual) {
|
||||
// The `sway_keyboard_set_layout` function is by default skipped
|
||||
// when configuring virtual keyboards.
|
||||
continue;
|
||||
}
|
||||
|
||||
struct xkb_switch_layout_action *action =
|
||||
&actions[actions_len++];
|
||||
action->keyboard = keyboard;
|
||||
|
||||
action->keyboard = wlr_keyboard_from_input_device(dev->wlr_device);
|
||||
if (relative) {
|
||||
action->layout = get_layout_relative(action->keyboard, relative);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -134,6 +134,19 @@ struct cmd_results *cmd_layout(int argc, char **argv) {
|
|||
// Operate on parent container, like i3.
|
||||
if (container) {
|
||||
container = container->pending.parent;
|
||||
// If parent has only a singe child operate on its parent and
|
||||
// flatten once, like i3
|
||||
if (container && container->pending.children->length == 1) {
|
||||
// Also check grandparent to avoid restricting layouts
|
||||
struct sway_container *parent = container->pending.parent;
|
||||
if (parent && parent->pending.children->length == 1) {
|
||||
struct sway_container *child = container->pending.children->items[0];
|
||||
struct sway_container *parent = container->pending.parent;
|
||||
container_replace(container, child);
|
||||
container_begin_destroy(container);
|
||||
container = parent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// We could be working with a container OR a workspace. These are different
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ struct cmd_results *cmd_mark(int argc, char **argv) {
|
|||
}
|
||||
|
||||
bool add = false, toggle = false;
|
||||
while (argc > 0 && strncmp(*argv, "--", 2) == 0) {
|
||||
while (argc > 0 && has_prefix(*argv, "--")) {
|
||||
if (strcmp(*argv, "--add") == 0) {
|
||||
add = true;
|
||||
} else if (strcmp(*argv, "--replace") == 0) {
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@
|
|||
#include "sway/input/seat.h"
|
||||
#include "sway/ipc-server.h"
|
||||
#include "sway/output.h"
|
||||
#include "sway/server.h"
|
||||
#include "sway/tree/arrange.h"
|
||||
#include "sway/tree/container.h"
|
||||
#include "sway/tree/root.h"
|
||||
|
|
@ -221,6 +222,7 @@ static void container_move_to_workspace(struct sway_container *container,
|
|||
container_detach(container);
|
||||
if (workspace_is_empty(workspace) && container->pending.children) {
|
||||
workspace_unwrap_children(workspace, container);
|
||||
container_reap_empty(container);
|
||||
} else {
|
||||
container->pending.width = container->pending.height = 0;
|
||||
container->width_fraction = container->height_fraction = 0;
|
||||
|
|
@ -239,7 +241,6 @@ static void container_move_to_workspace(struct sway_container *container,
|
|||
static void container_move_to_container(struct sway_container *container,
|
||||
struct sway_container *destination) {
|
||||
if (container == destination
|
||||
|| container_has_ancestor(container, destination)
|
||||
|| container_has_ancestor(destination, container)) {
|
||||
return;
|
||||
}
|
||||
|
|
@ -509,6 +510,7 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
|
|||
}
|
||||
}
|
||||
ws = workspace_create(NULL, ws_name);
|
||||
arrange_workspace(ws);
|
||||
}
|
||||
free(ws_name);
|
||||
struct sway_container *dst = seat_get_focus_inactive_tiling(seat, ws);
|
||||
|
|
@ -625,40 +627,6 @@ static struct cmd_results *cmd_move_container(bool no_auto_back_and_forth,
|
|||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
||||
static void workspace_move_to_output(struct sway_workspace *workspace,
|
||||
struct sway_output *output) {
|
||||
if (workspace->output == output) {
|
||||
return;
|
||||
}
|
||||
struct sway_output *old_output = workspace->output;
|
||||
workspace_detach(workspace);
|
||||
struct sway_workspace *new_output_old_ws =
|
||||
output_get_active_workspace(output);
|
||||
if (!sway_assert(new_output_old_ws, "Expected output to have a workspace")) {
|
||||
return;
|
||||
}
|
||||
|
||||
output_add_workspace(output, workspace);
|
||||
|
||||
// If moving the last workspace from the old output, create a new workspace
|
||||
// on the old output
|
||||
struct sway_seat *seat = config->handler_context.seat;
|
||||
if (old_output->workspaces->length == 0) {
|
||||
char *ws_name = workspace_next_name(old_output->wlr_output->name);
|
||||
struct sway_workspace *ws = workspace_create(old_output, ws_name);
|
||||
free(ws_name);
|
||||
seat_set_raw_focus(seat, &ws->node);
|
||||
}
|
||||
|
||||
workspace_consider_destroy(new_output_old_ws);
|
||||
|
||||
output_sort_workspaces(output);
|
||||
struct sway_node *focus = seat_get_focus_inactive(seat, &workspace->node);
|
||||
seat_set_focus(seat, focus);
|
||||
workspace_output_raise_priority(workspace, old_output, output);
|
||||
ipc_event_workspace(NULL, workspace, "move");
|
||||
}
|
||||
|
||||
static struct cmd_results *cmd_move_workspace(int argc, char **argv) {
|
||||
struct cmd_results *error = NULL;
|
||||
if ((error = checkarg(argc, "move workspace", EXPECTED_AT_LEAST, 1))) {
|
||||
|
|
@ -694,6 +662,8 @@ static struct cmd_results *cmd_move_workspace(int argc, char **argv) {
|
|||
arrange_output(new_output);
|
||||
|
||||
struct sway_seat *seat = config->handler_context.seat;
|
||||
struct sway_node *focus = seat_get_focus_inactive(seat, &workspace->node);
|
||||
seat_set_focus(seat, focus);
|
||||
seat_consider_warp_to_focus(seat);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@
|
|||
#include <stdlib.h>
|
||||
#include <strings.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/tree/view.h"
|
||||
#include "sway/tree/container.h"
|
||||
#include "sway/output.h"
|
||||
#include "log.h"
|
||||
|
||||
struct cmd_results *cmd_opacity(int argc, char **argv) {
|
||||
|
|
@ -37,6 +38,7 @@ struct cmd_results *cmd_opacity(int argc, char **argv) {
|
|||
}
|
||||
|
||||
con->alpha = val;
|
||||
output_configure_scene(NULL, &con->scene_tree->node, 1);
|
||||
container_update(con);
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
|
|
|
|||
|
|
@ -8,11 +8,14 @@
|
|||
// must be in order for the bsearch
|
||||
static const struct cmd_handler output_handlers[] = {
|
||||
{ "adaptive_sync", output_cmd_adaptive_sync },
|
||||
{ "allow_tearing", output_cmd_allow_tearing },
|
||||
{ "background", output_cmd_background },
|
||||
{ "bg", output_cmd_background },
|
||||
{ "color_profile", output_cmd_color_profile },
|
||||
{ "disable", output_cmd_disable },
|
||||
{ "dpms", output_cmd_dpms },
|
||||
{ "enable", output_cmd_enable },
|
||||
{ "hdr", output_cmd_hdr },
|
||||
{ "max_render_time", output_cmd_max_render_time },
|
||||
{ "mode", output_cmd_mode },
|
||||
{ "modeline", output_cmd_modeline },
|
||||
|
|
@ -103,19 +106,18 @@ struct cmd_results *cmd_output(int argc, char **argv) {
|
|||
|
||||
bool background = output->background;
|
||||
|
||||
output = store_output_config(output);
|
||||
store_output_config(output);
|
||||
|
||||
// If reloading, the output configs will be applied after reading the
|
||||
// entire config and before the deferred commands so that an auto generated
|
||||
// workspace name is not given to re-enabled outputs.
|
||||
if (!config->reloading && !config->validating) {
|
||||
apply_output_config_to_outputs(output);
|
||||
if (background) {
|
||||
if (!spawn_swaybg()) {
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
"Failed to apply background configuration");
|
||||
}
|
||||
}
|
||||
if (config->reading) {
|
||||
// When reading the config file, we wait till the end to do a single
|
||||
// modeset and swaybg spawn.
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
request_modeset();
|
||||
|
||||
if (background && !spawn_swaybg()) {
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
"Failed to apply background configuration");
|
||||
}
|
||||
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
#include <strings.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/output.h"
|
||||
#include "util.h"
|
||||
|
||||
struct cmd_results *output_cmd_adaptive_sync(int argc, char **argv) {
|
||||
|
|
@ -10,12 +12,26 @@ struct cmd_results *output_cmd_adaptive_sync(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_INVALID, "Missing adaptive_sync argument");
|
||||
}
|
||||
|
||||
if (parse_boolean(argv[0], true)) {
|
||||
config->handler_context.output_config->adaptive_sync = 1;
|
||||
} else {
|
||||
config->handler_context.output_config->adaptive_sync = 0;
|
||||
bool current_value = true;
|
||||
if (strcasecmp(argv[0], "toggle") == 0) {
|
||||
const char *oc_name = config->handler_context.output_config->name;
|
||||
if (strcmp(oc_name, "*") == 0) {
|
||||
return cmd_results_new(CMD_INVALID,
|
||||
"Cannot apply toggle to all outputs");
|
||||
}
|
||||
|
||||
struct sway_output *sway_output = all_output_by_name_or_id(oc_name);
|
||||
if (!sway_output || !sway_output->wlr_output) {
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
"Cannot apply toggle to unknown output %s", oc_name);
|
||||
}
|
||||
|
||||
current_value =
|
||||
sway_output->wlr_output->adaptive_sync_status == WLR_OUTPUT_ADAPTIVE_SYNC_ENABLED;
|
||||
}
|
||||
|
||||
config->handler_context.output_config->adaptive_sync = parse_boolean(argv[0], current_value);
|
||||
|
||||
config->handler_context.leftovers.argc = argc - 1;
|
||||
config->handler_context.leftovers.argv = argv + 1;
|
||||
return NULL;
|
||||
|
|
|
|||
23
sway/commands/output/allow_tearing.c
Normal file
23
sway/commands/output/allow_tearing.c
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "util.h"
|
||||
|
||||
struct cmd_results *output_cmd_allow_tearing(int argc, char **argv) {
|
||||
if (!config->handler_context.output_config) {
|
||||
return cmd_results_new(CMD_FAILURE, "Missing output config");
|
||||
}
|
||||
if (argc == 0) {
|
||||
return cmd_results_new(CMD_INVALID, "Missing allow_tearing argument");
|
||||
}
|
||||
|
||||
if (parse_boolean(argv[0],
|
||||
(config->handler_context.output_config->allow_tearing == 1))) {
|
||||
config->handler_context.output_config->allow_tearing = 1;
|
||||
} else {
|
||||
config->handler_context.output_config->allow_tearing = 0;
|
||||
}
|
||||
|
||||
config->handler_context.leftovers.argc = argc - 1;
|
||||
config->handler_context.leftovers.argv = argv + 1;
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -3,10 +3,8 @@
|
|||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <unistd.h>
|
||||
#include <errno.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/swaynag.h"
|
||||
#include "log.h"
|
||||
#include "stringop.h"
|
||||
|
||||
|
|
@ -42,14 +40,14 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
|
|||
}
|
||||
|
||||
struct output_config *output = config->handler_context.output_config;
|
||||
|
||||
char *src = NULL;
|
||||
if (strcasecmp(argv[1], "solid_color") == 0) {
|
||||
if (!validate_color(argv[0])) {
|
||||
return cmd_results_new(CMD_INVALID,
|
||||
"Colors should be of the form #RRGGBB");
|
||||
}
|
||||
output->background = strdup(argv[0]);
|
||||
output->background_option = strdup("solid_color");
|
||||
if (!(output->background = strdup(argv[0]))) goto cleanup;
|
||||
if (!(output->background_option = strdup("solid_color"))) goto cleanup;
|
||||
output->background_fallback = NULL;
|
||||
argc -= 2; argv += 2;
|
||||
} else {
|
||||
|
|
@ -77,37 +75,25 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_INVALID, "Missing background file");
|
||||
}
|
||||
|
||||
char *src = join_args(argv, j);
|
||||
if (!(src = join_args(argv, j))) goto cleanup;
|
||||
if (!expand_path(&src)) {
|
||||
struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID,
|
||||
"Invalid syntax (%s)", src);
|
||||
free(src);
|
||||
return cmd_res;
|
||||
}
|
||||
if (!src) {
|
||||
sway_log(SWAY_ERROR, "Failed to allocate expanded path");
|
||||
return cmd_results_new(CMD_FAILURE, "Unable to allocate resource");
|
||||
}
|
||||
|
||||
if (config->reading && *src != '/') {
|
||||
// src file is inside configuration dir
|
||||
|
||||
char *conf = strdup(config->current_config_path);
|
||||
if (!conf) {
|
||||
sway_log(SWAY_ERROR, "Failed to duplicate string");
|
||||
free(src);
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
"Unable to allocate resources");
|
||||
}
|
||||
if (!conf) goto cleanup;
|
||||
|
||||
char *conf_path = dirname(conf);
|
||||
char *real_src = malloc(strlen(conf_path) + strlen(src) + 2);
|
||||
if (!real_src) {
|
||||
free(src);
|
||||
free(conf);
|
||||
sway_log(SWAY_ERROR, "Unable to allocate memory");
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
"Unable to allocate resources");
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
snprintf(real_src, strlen(conf_path) + strlen(src) + 2, "%s/%s", conf_path, src);
|
||||
|
|
@ -117,40 +103,48 @@ struct cmd_results *output_cmd_background(int argc, char **argv) {
|
|||
}
|
||||
|
||||
bool can_access = access(src, F_OK) != -1;
|
||||
argc -= j + 1; argv += j + 1;
|
||||
free(output->background_option);
|
||||
free(output->background_fallback);
|
||||
free(output->background);
|
||||
output->background = output->background_option = output->background_fallback = NULL;
|
||||
char *fallback = NULL;
|
||||
|
||||
if (argc && *argv[0] == '#') {
|
||||
if (validate_color(argv[0])) {
|
||||
if (!(fallback = strdup(argv[0]))) goto cleanup;
|
||||
output->background_fallback = fallback;
|
||||
} else {
|
||||
sway_log(SWAY_ERROR, "fallback '%s' should be of the form #RRGGBB", argv[0]);
|
||||
config_add_swaynag_warning("fallback '%s' should be of the form #RRGGBB\n", argv[0]);
|
||||
}
|
||||
argc--; argv++;
|
||||
}
|
||||
|
||||
if (!can_access) {
|
||||
sway_log_errno(SWAY_ERROR, "Unable to access background file '%s'",
|
||||
src);
|
||||
config_add_swaynag_warning("Unable to access background file '%s'",
|
||||
src);
|
||||
struct cmd_results *result = cmd_results_new(CMD_FAILURE,
|
||||
"unable to access background file '%s'", src);
|
||||
free(src);
|
||||
return result;
|
||||
if (!fallback) {
|
||||
sway_log(SWAY_ERROR, "Unable to access background file '%s' "
|
||||
"and no valid fallback provided", src);
|
||||
struct cmd_results *res = cmd_results_new(CMD_FAILURE, "Unable to access "
|
||||
"background file '%s' and no valid fallback provided", src);
|
||||
free(src);
|
||||
return res;
|
||||
}
|
||||
sway_log(SWAY_DEBUG, "Cannot access file '%s', using fallback '%s'", src, fallback);
|
||||
output->background = fallback;
|
||||
if (!(output->background_option = strdup("solid_color"))) goto cleanup;
|
||||
output->background_fallback = NULL;
|
||||
} else {
|
||||
output->background = src;
|
||||
output->background_option = strdup(mode);
|
||||
}
|
||||
argc -= j + 1; argv += j + 1;
|
||||
|
||||
output->background_fallback = NULL;
|
||||
if (argc && *argv[0] == '#') {
|
||||
if (!validate_color(argv[0])) {
|
||||
return cmd_results_new(CMD_INVALID,
|
||||
"fallback color should be of the form #RRGGBB");
|
||||
}
|
||||
|
||||
output->background_fallback = strdup(argv[0]);
|
||||
argc--; argv++;
|
||||
|
||||
if (!can_access) {
|
||||
output->background = output->background_fallback;
|
||||
output->background_option = strdup("solid_color");
|
||||
output->background_fallback = NULL;
|
||||
}
|
||||
if (!(output->background_option = strdup(mode))) goto cleanup;
|
||||
}
|
||||
}
|
||||
|
||||
config->handler_context.leftovers.argc = argc;
|
||||
config->handler_context.leftovers.argv = argv;
|
||||
return NULL;
|
||||
|
||||
cleanup:
|
||||
free(src);
|
||||
sway_log(SWAY_ERROR, "Failed to allocate resources");
|
||||
return cmd_results_new(CMD_FAILURE, "Unable to allocate resources");
|
||||
}
|
||||
|
|
|
|||
134
sway/commands/output/color_profile.c
Normal file
134
sway/commands/output/color_profile.c
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
#include <fcntl.h>
|
||||
#include <strings.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <wlr/render/color.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "stringop.h"
|
||||
|
||||
static bool read_file_into_buf(const char *path, void **buf, size_t *size) {
|
||||
/* Why not use fopen/fread directly? glibc will succesfully open directories,
|
||||
* not just files, and supports seeking on them. Instead, we directly
|
||||
* work with file descriptors and use the more consistent open/fstat/read. */
|
||||
int fd = open(path, O_RDONLY | O_NOCTTY | O_CLOEXEC);
|
||||
if (fd == -1) {
|
||||
return false;
|
||||
}
|
||||
char *b = NULL;
|
||||
struct stat info;
|
||||
if (fstat(fd, &info) == -1) {
|
||||
goto fail;
|
||||
}
|
||||
// only regular files, to avoid issues with e.g. opening pipes
|
||||
if (!S_ISREG(info.st_mode)) {
|
||||
goto fail;
|
||||
}
|
||||
off_t s = info.st_size;
|
||||
if (s <= 0) {
|
||||
goto fail;
|
||||
}
|
||||
b = calloc(1, s);
|
||||
if (!b) {
|
||||
goto fail;
|
||||
}
|
||||
size_t nread = 0;
|
||||
while (nread < (size_t)s) {
|
||||
size_t to_read = (size_t)s - nread;
|
||||
ssize_t r = read(fd, b + nread, to_read);
|
||||
if ((r == -1 && errno != EINTR) || r == 0) {
|
||||
goto fail;
|
||||
}
|
||||
nread += (size_t)r;
|
||||
}
|
||||
close(fd);
|
||||
*buf = b;
|
||||
*size = (size_t)s;
|
||||
return true; // success
|
||||
fail:
|
||||
free(b);
|
||||
close(fd);
|
||||
return false;
|
||||
}
|
||||
|
||||
struct cmd_results *output_cmd_color_profile(int argc, char **argv) {
|
||||
if (!config->handler_context.output_config) {
|
||||
return cmd_results_new(CMD_FAILURE, "Missing output config");
|
||||
}
|
||||
|
||||
enum color_profile new_mode = COLOR_PROFILE_TRANSFORM;
|
||||
if (argc >= 2 && strcmp(*argv, "--device-primaries") == 0) {
|
||||
new_mode = COLOR_PROFILE_TRANSFORM_WITH_DEVICE_PRIMARIES;
|
||||
argc--;
|
||||
argv++;
|
||||
}
|
||||
|
||||
if (!argc) {
|
||||
return cmd_results_new(CMD_INVALID, "Missing color_profile first argument.");
|
||||
}
|
||||
|
||||
if (strcmp(*argv, "gamma22") == 0) {
|
||||
wlr_color_transform_unref(config->handler_context.output_config->color_transform);
|
||||
config->handler_context.output_config->color_transform = NULL;
|
||||
config->handler_context.output_config->color_profile = new_mode;
|
||||
|
||||
config->handler_context.leftovers.argc = argc - 1;
|
||||
config->handler_context.leftovers.argv = argv + 1;
|
||||
} else if (strcmp(*argv, "srgb") == 0) {
|
||||
wlr_color_transform_unref(config->handler_context.output_config->color_transform);
|
||||
config->handler_context.output_config->color_transform =
|
||||
wlr_color_transform_init_linear_to_inverse_eotf(WLR_COLOR_TRANSFER_FUNCTION_SRGB);
|
||||
config->handler_context.output_config->color_profile = new_mode;
|
||||
|
||||
config->handler_context.leftovers.argc = argc - 1;
|
||||
config->handler_context.leftovers.argv = argv + 1;
|
||||
} else if (strcmp(*argv, "icc") == 0) {
|
||||
if (argc < 2) {
|
||||
return cmd_results_new(CMD_INVALID,
|
||||
"Invalid color profile specification: icc type requires a file");
|
||||
}
|
||||
if (new_mode != COLOR_PROFILE_TRANSFORM) {
|
||||
return cmd_results_new(CMD_INVALID,
|
||||
"Invalid color profile specification: --device-primaries cannot be used with icc");
|
||||
}
|
||||
|
||||
char *icc_path = strdup(argv[1]);
|
||||
if (!expand_path(&icc_path)) {
|
||||
struct cmd_results *cmd_res = cmd_results_new(CMD_INVALID,
|
||||
"Invalid color profile specification: invalid file path");
|
||||
free(icc_path);
|
||||
return cmd_res;
|
||||
}
|
||||
|
||||
void *data = NULL;
|
||||
size_t size = 0;
|
||||
if (!read_file_into_buf(icc_path, &data, &size)) {
|
||||
free(icc_path);
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
"Failed to load color profile: could not read ICC file");
|
||||
}
|
||||
free(icc_path);
|
||||
|
||||
struct wlr_color_transform *tmp =
|
||||
wlr_color_transform_init_linear_to_icc(data, size);
|
||||
if (!tmp) {
|
||||
free(data);
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
"Failed to load color profile: failed to initialize transform from ICC");
|
||||
}
|
||||
free(data);
|
||||
|
||||
wlr_color_transform_unref(config->handler_context.output_config->color_transform);
|
||||
config->handler_context.output_config->color_transform = tmp;
|
||||
config->handler_context.output_config->color_profile = COLOR_PROFILE_TRANSFORM;
|
||||
|
||||
config->handler_context.leftovers.argc = argc - 2;
|
||||
config->handler_context.leftovers.argv = argv + 2;
|
||||
} else {
|
||||
return cmd_results_new(CMD_INVALID,
|
||||
"Invalid color profile specification: "
|
||||
"first argument should be gamma22|icc|srgb");
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
37
sway/commands/output/hdr.c
Normal file
37
sway/commands/output/hdr.c
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
#include <strings.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/output.h"
|
||||
#include "util.h"
|
||||
|
||||
struct cmd_results *output_cmd_hdr(int argc, char **argv) {
|
||||
if (!config->handler_context.output_config) {
|
||||
return cmd_results_new(CMD_FAILURE, "Missing output config");
|
||||
}
|
||||
if (argc == 0) {
|
||||
return cmd_results_new(CMD_INVALID, "Missing hdr argument");
|
||||
}
|
||||
|
||||
bool current = false;
|
||||
if (strcasecmp(argv[0], "toggle") == 0) {
|
||||
const char *oc_name = config->handler_context.output_config->name;
|
||||
if (strcmp(oc_name, "*") == 0) {
|
||||
return cmd_results_new(CMD_INVALID,
|
||||
"Cannot apply toggle to all outputs");
|
||||
}
|
||||
|
||||
struct sway_output *output = all_output_by_name_or_id(oc_name);
|
||||
if (!output) {
|
||||
return cmd_results_new(CMD_FAILURE,
|
||||
"Cannot apply toggle to unknown output %s", oc_name);
|
||||
}
|
||||
|
||||
current = output->hdr;
|
||||
}
|
||||
|
||||
config->handler_context.output_config->hdr = parse_boolean(argv[0], current);
|
||||
|
||||
config->handler_context.leftovers.argc = argc - 1;
|
||||
config->handler_context.leftovers.argv = argv + 1;
|
||||
return NULL;
|
||||
}
|
||||
|
|
@ -11,7 +11,10 @@ struct cmd_results *output_cmd_render_bit_depth(int argc, char **argv) {
|
|||
return cmd_results_new(CMD_INVALID, "Missing bit depth argument.");
|
||||
}
|
||||
|
||||
if (strcmp(*argv, "8") == 0) {
|
||||
if (strcmp(*argv, "6") == 0) {
|
||||
config->handler_context.output_config->render_bit_depth =
|
||||
RENDER_BIT_DEPTH_6;
|
||||
} else if (strcmp(*argv, "8") == 0) {
|
||||
config->handler_context.output_config->render_bit_depth =
|
||||
RENDER_BIT_DEPTH_8;
|
||||
} else if (strcmp(*argv, "10") == 0) {
|
||||
|
|
@ -19,7 +22,7 @@ struct cmd_results *output_cmd_render_bit_depth(int argc, char **argv) {
|
|||
RENDER_BIT_DEPTH_10;
|
||||
} else {
|
||||
return cmd_results_new(CMD_INVALID,
|
||||
"Invalid bit depth. Must be a value in (8|10).");
|
||||
"Invalid bit depth. Must be a value in (6|8|10).");
|
||||
}
|
||||
|
||||
config->handler_context.leftovers.argc = argc - 1;
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ struct cmd_results *output_cmd_toggle(int argc, char **argv) {
|
|||
config->handler_context.output_config->enabled = 1;
|
||||
}
|
||||
|
||||
free(oc);
|
||||
free_output_config(oc);
|
||||
config->handler_context.leftovers.argc = argc;
|
||||
config->handler_context.leftovers.argv = argv;
|
||||
return NULL;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
#include <ctype.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <wlr/types/wlr_ext_workspace_v1.h>
|
||||
#include "log.h"
|
||||
#include "stringop.h"
|
||||
#include "sway/commands.h"
|
||||
|
|
@ -95,6 +96,8 @@ struct cmd_results *cmd_rename(int argc, char **argv) {
|
|||
free(workspace->name);
|
||||
workspace->name = new_name;
|
||||
|
||||
wlr_ext_workspace_handle_v1_set_name(workspace->ext_workspace, workspace->name);
|
||||
|
||||
output_sort_workspaces(workspace->output);
|
||||
ipc_event_workspace(NULL, workspace, "rename");
|
||||
|
||||
|
|
|
|||
|
|
@ -80,61 +80,46 @@ void container_resize_tiled(struct sway_container *con,
|
|||
}
|
||||
|
||||
// For HORIZONTAL or VERTICAL, we are growing in two directions so select
|
||||
// both adjacent siblings. For RIGHT or DOWN, just select the next sibling.
|
||||
// For LEFT or UP, convert it to a RIGHT or DOWN resize and reassign con to
|
||||
// the previous sibling.
|
||||
struct sway_container *prev = NULL;
|
||||
struct sway_container *next = NULL;
|
||||
// all adjacent siblings. For RIGHT or DOWN or LEFT or UP select just the
|
||||
// previous or next sibling.
|
||||
list_t *resize = create_list();
|
||||
list_t *siblings = container_get_siblings(con);
|
||||
int index = container_sibling_index(con);
|
||||
|
||||
if (axis == AXIS_HORIZONTAL || axis == AXIS_VERTICAL) {
|
||||
if (index == 0) {
|
||||
next = siblings->items[1];
|
||||
} else if (index == siblings->length - 1) {
|
||||
// Convert edge to top/left
|
||||
next = con;
|
||||
con = siblings->items[index - 1];
|
||||
amount = -amount;
|
||||
} else {
|
||||
prev = siblings->items[index - 1];
|
||||
next = siblings->items[index + 1];
|
||||
}
|
||||
list_cat(resize, siblings);
|
||||
} else if (axis == WLR_EDGE_TOP || axis == WLR_EDGE_LEFT) {
|
||||
if (!sway_assert(index > 0, "Didn't expect first child")) {
|
||||
return;
|
||||
goto cleanup;
|
||||
}
|
||||
next = con;
|
||||
con = siblings->items[index - 1];
|
||||
amount = -amount;
|
||||
list_add(resize, siblings->items[index - 1]);
|
||||
list_add(resize, con);
|
||||
} else {
|
||||
if (!sway_assert(index < siblings->length - 1,
|
||||
"Didn't expect last child")) {
|
||||
return;
|
||||
goto cleanup;
|
||||
}
|
||||
next = siblings->items[index + 1];
|
||||
list_add(resize, con);
|
||||
list_add(resize, siblings->items[index + 1]);
|
||||
}
|
||||
|
||||
// Apply new dimensions
|
||||
int sibling_amount = prev ? ceil((double)amount / 2.0) : amount;
|
||||
int sibling_amount = ceil((double)amount / (double)(resize->length - 1));
|
||||
|
||||
if (is_horizontal(axis)) {
|
||||
if (con->pending.width + amount < MIN_SANE_W) {
|
||||
return;
|
||||
}
|
||||
if (next->pending.width - sibling_amount < MIN_SANE_W) {
|
||||
return;
|
||||
}
|
||||
if (prev && prev->pending.width - sibling_amount < MIN_SANE_W) {
|
||||
return;
|
||||
for (int i = 0; i < resize->length; i++) {
|
||||
struct sway_container *sibling = resize->items[i];
|
||||
double change = sibling == con ? amount : -sibling_amount;
|
||||
if (sibling->pending.width + change < MIN_SANE_W) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
if (con->child_total_width <= 0) {
|
||||
return;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// We're going to resize so snap all the width fractions to full pixels
|
||||
// to avoid rounding issues
|
||||
list_t *siblings = container_get_siblings(con);
|
||||
for (int i = 0; i < siblings->length; ++i) {
|
||||
struct sway_container *con = siblings->items[i];
|
||||
con->width_fraction = con->pending.width / con->child_total_width;
|
||||
|
|
@ -142,30 +127,27 @@ void container_resize_tiled(struct sway_container *con,
|
|||
|
||||
double amount_fraction = (double)amount / con->child_total_width;
|
||||
double sibling_amount_fraction =
|
||||
prev ? amount_fraction / 2.0 : amount_fraction;
|
||||
amount_fraction / (double)(resize->length - 1);
|
||||
|
||||
con->width_fraction += amount_fraction;
|
||||
next->width_fraction -= sibling_amount_fraction;
|
||||
if (prev) {
|
||||
prev->width_fraction -= sibling_amount_fraction;
|
||||
for (int i = 0; i < resize->length; i++) {
|
||||
struct sway_container *sibling = resize->items[i];
|
||||
sibling->width_fraction +=
|
||||
sibling == con ? amount_fraction : -sibling_amount_fraction;
|
||||
}
|
||||
} else {
|
||||
if (con->pending.height + amount < MIN_SANE_H) {
|
||||
return;
|
||||
}
|
||||
if (next->pending.height - sibling_amount < MIN_SANE_H) {
|
||||
return;
|
||||
}
|
||||
if (prev && prev->pending.height - sibling_amount < MIN_SANE_H) {
|
||||
return;
|
||||
for (int i = 0; i < resize->length; i++) {
|
||||
struct sway_container *sibling = resize->items[i];
|
||||
double change = sibling == con ? amount : -sibling_amount;
|
||||
if (sibling->pending.height + change < MIN_SANE_H) {
|
||||
goto cleanup;
|
||||
}
|
||||
}
|
||||
if (con->child_total_height <= 0) {
|
||||
return;
|
||||
goto cleanup;
|
||||
}
|
||||
|
||||
// We're going to resize so snap all the height fractions to full pixels
|
||||
// to avoid rounding issues
|
||||
list_t *siblings = container_get_siblings(con);
|
||||
for (int i = 0; i < siblings->length; ++i) {
|
||||
struct sway_container *con = siblings->items[i];
|
||||
con->height_fraction = con->pending.height / con->child_total_height;
|
||||
|
|
@ -173,12 +155,12 @@ void container_resize_tiled(struct sway_container *con,
|
|||
|
||||
double amount_fraction = (double)amount / con->child_total_height;
|
||||
double sibling_amount_fraction =
|
||||
prev ? amount_fraction / 2.0 : amount_fraction;
|
||||
amount_fraction / (double)(resize->length - 1);
|
||||
|
||||
con->height_fraction += amount_fraction;
|
||||
next->height_fraction -= sibling_amount_fraction;
|
||||
if (prev) {
|
||||
prev->height_fraction -= sibling_amount_fraction;
|
||||
for (int i = 0; i < resize->length; i++) {
|
||||
struct sway_container *sibling = resize->items[i];
|
||||
sibling->height_fraction +=
|
||||
sibling == con ? amount_fraction : -sibling_amount_fraction;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -187,6 +169,9 @@ void container_resize_tiled(struct sway_container *con,
|
|||
} else {
|
||||
arrange_workspace(con->pending.workspace);
|
||||
}
|
||||
|
||||
cleanup:
|
||||
list_free(resize);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -457,7 +442,7 @@ static struct cmd_results *cmd_resize_set(int argc, char **argv) {
|
|||
if (argc > num_consumed_args) {
|
||||
return cmd_results_new(CMD_INVALID, "%s", usage);
|
||||
}
|
||||
if (width.unit == MOVEMENT_UNIT_INVALID) {
|
||||
if (height.unit == MOVEMENT_UNIT_INVALID) {
|
||||
return cmd_results_new(CMD_INVALID, "%s", usage);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -118,10 +118,10 @@ struct cmd_results *cmd_scratchpad(int argc, char **argv) {
|
|||
|
||||
// If using criteria, this command is executed for every container which
|
||||
// matches the criteria. If this container isn't in the scratchpad,
|
||||
// we'll just silently return a success. The same is true if the
|
||||
// we'll return an error. The same is true if the
|
||||
// overridden node is not a container.
|
||||
if (!con || !con->scratchpad) {
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
return cmd_results_new(CMD_INVALID, "Container is not in scratchpad.");
|
||||
}
|
||||
scratchpad_toggle_container(con);
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@
|
|||
#include <wlr/types/wlr_pointer.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/input/cursor.h"
|
||||
#include "sway/server.h"
|
||||
|
||||
static struct cmd_results *press_or_release(struct sway_cursor *cursor,
|
||||
char *action, char *button_str);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@
|
|||
#include "sway/config.h"
|
||||
#include "sway/input/cursor.h"
|
||||
#include "sway/input/seat.h"
|
||||
#include "sway/server.h"
|
||||
|
||||
enum operation {
|
||||
OP_ENABLE,
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
#include "sway/commands.h"
|
||||
#include "sway/input/seat.h"
|
||||
#include "sway/input/input-manager.h"
|
||||
#include "sway/server.h"
|
||||
#include "util.h"
|
||||
|
||||
static struct cmd_results *handle_action(struct seat_config *sc,
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
#include "sway/input/seat.h"
|
||||
#include "sway/server.h"
|
||||
#include "sway/tree/container.h"
|
||||
#include "sway/tree/view.h"
|
||||
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ static bool test_con_id(struct sway_container *container, void *data) {
|
|||
return container->node.id == *con_id;
|
||||
}
|
||||
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
static bool test_id(struct sway_container *container, void *data) {
|
||||
xcb_window_t *wid = data;
|
||||
return (container->view && container->view->type == SWAY_VIEW_XWAYLAND
|
||||
|
|
@ -53,7 +53,7 @@ struct cmd_results *cmd_swap(int argc, char **argv) {
|
|||
|
||||
char *value = join_args(argv + 3, argc - 3);
|
||||
if (strcasecmp(argv[2], "id") == 0) {
|
||||
#if HAVE_XWAYLAND
|
||||
#if WLR_HAS_XWAYLAND
|
||||
xcb_window_t id = strtol(value, NULL, 0);
|
||||
other = root_find_container(test_id, &id);
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,3 +1,4 @@
|
|||
#define _POSIX_C_SOURCE 200809L
|
||||
#include <string.h>
|
||||
#include "sway/commands.h"
|
||||
#include "sway/config.h"
|
||||
|
|
@ -11,16 +12,19 @@ struct cmd_results *cmd_title_format(int argc, char **argv) {
|
|||
return error;
|
||||
}
|
||||
struct sway_container *container = config->handler_context.container;
|
||||
if (!container || !container->view) {
|
||||
if (!container) {
|
||||
return cmd_results_new(CMD_INVALID,
|
||||
"Only views can have a title_format");
|
||||
"Only valid containers can have a title_format");
|
||||
}
|
||||
struct sway_view *view = container->view;
|
||||
char *format = join_args(argv, argc);
|
||||
if (view->title_format) {
|
||||
free(view->title_format);
|
||||
if (container->title_format) {
|
||||
free(container->title_format);
|
||||
}
|
||||
container->title_format = format;
|
||||
if (container->view) {
|
||||
view_update_title(container->view, true);
|
||||
} else {
|
||||
container_update_representation(container);
|
||||
}
|
||||
view->title_format = format;
|
||||
view_update_title(view, true);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,7 +8,7 @@ struct cmd_results *cmd_ws_auto_back_and_forth(int argc, char **argv) {
|
|||
if ((error = checkarg(argc, "workspace_auto_back_and_forth", EXPECTED_EQUAL_TO, 1))) {
|
||||
return error;
|
||||
}
|
||||
config->auto_back_and_forth =
|
||||
config->auto_back_and_forth =
|
||||
parse_boolean(argv[0], config->auto_back_and_forth);
|
||||
return cmd_results_new(CMD_SUCCESS, NULL);
|
||||
}
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue