From 692e3abc68fb6e1c0eda894b01221198a81ea280 Mon Sep 17 00:00:00 2001
From: speedie
Date: Fri, 2 Jun 2023 18:37:51 +0200
Subject: [PATCH] Add experimental native Wayland support
---
.gitignore | 2 +
PKGBUILD | 30 +-
README.html | 76 +-
README.md | 52 +-
code.html | 4 +-
docs/docs.md | 41 +-
docs/example.Xresources | 1 -
docs/spmenu.conf | 7 +-
keybinds.h | 78 +
libs/arg.c | 6 +-
libs/argv.c | 132 +-
libs/colors.h | 48 +-
libs/conf/config.c | 1610 ++++++------
libs/conf/config.h | 166 +-
libs/draw.c | 219 +-
libs/draw.h | 1 +
libs/img.c | 4 +-
libs/libdrw/drw.c | 225 +-
libs/libdrw/drw.h | 31 +-
libs/match.c | 11 +-
libs/schemes.c | 71 +-
libs/schemes.h | 22 -
libs/stream.c | 10 +-
libs/theme/theme.c | 78 +-
libs/wl/inc.c | 6 +
libs/wl/inc.h | 6 +
libs/wl/init.c | 64 +
libs/wl/init.h | 3 +
libs/wl/shm.c | 43 +
libs/wl/wayland.c | 666 +++++
libs/wl/wayland.h | 204 ++
...-layer-shell-unstable-v1-client-protocol.h | 563 ++++
.../wl/wlr-layer-shell-unstable-v1-protocol.c | 81 +
.../xdg-output-unstable-v1-client-protocol.h | 414 +++
libs/wl/xdg-output-unstable-v1-protocol.c | 68 +
libs/wl/xdg-shell-client-protocol.h | 2290 +++++++++++++++++
libs/wl/xdg-shell-protocol.c | 173 ++
libs/x11/client.c | 68 +-
libs/x11/client.h | 11 +-
libs/x11/event.c | 6 +-
libs/x11/event.h | 2 +-
libs/x11/init.c | 70 +-
libs/x11/init.h | 7 +-
libs/x11/key.c | 4 +-
libs/x11/key.h | 4 +-
libs/x11/mouse.c | 16 +-
libs/x11/mouse.h | 3 +-
libs/x11/xresources.h | 1 -
meson.build | 17 +-
meson.options | 7 +
mouse.h | 22 +-
options.h | 6 +-
protocols/wlr-layer-shell-unstable-v1.xml | 285 ++
protocols/xdg-output-unstable-v1.xml | 222 ++
protocols/xdg-shell.xml | 1361 ++++++++++
scripts/make/build.sh | 4 +
scripts/make/generate-headers.sh | 31 +
scripts/make/generate-pkg.sh | 2 +-
scripts/spmenu_test | 4 +-
spmenu.1 | 60 +-
spmenu.c | 116 +-
spmenu.html | 51 +-
spmenu_run.1 | 2 +-
63 files changed, 8444 insertions(+), 1444 deletions(-)
create mode 100644 libs/wl/inc.c
create mode 100644 libs/wl/inc.h
create mode 100644 libs/wl/init.c
create mode 100644 libs/wl/init.h
create mode 100644 libs/wl/shm.c
create mode 100644 libs/wl/wayland.c
create mode 100644 libs/wl/wayland.h
create mode 100644 libs/wl/wlr-layer-shell-unstable-v1-client-protocol.h
create mode 100644 libs/wl/wlr-layer-shell-unstable-v1-protocol.c
create mode 100644 libs/wl/xdg-output-unstable-v1-client-protocol.h
create mode 100644 libs/wl/xdg-output-unstable-v1-protocol.c
create mode 100644 libs/wl/xdg-shell-client-protocol.h
create mode 100644 libs/wl/xdg-shell-protocol.c
create mode 100644 protocols/wlr-layer-shell-unstable-v1.xml
create mode 100644 protocols/xdg-output-unstable-v1.xml
create mode 100644 protocols/xdg-shell.xml
create mode 100755 scripts/make/generate-headers.sh
diff --git a/.gitignore b/.gitignore
index df5fe98..ef6af8d 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,6 +2,8 @@
*.o
*zst*
*sig*
+*gz*
+*tar*
spmenu
buildconf_dev
buildconf
diff --git a/PKGBUILD b/PKGBUILD
index d69c62c..6433d59 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -3,21 +3,43 @@
pkgname=spmenu
pkgver=VERSION
pkgrel=1
-pkgdesc="Fancy dynamic menu, compatible with dmenu!"
+pkgdesc="Fancy dynamic menu for X11 and Wayland, compatible with dmenu!"
url="https://spmenu.speedie.site"
arch=(i686 x86_64)
license=(MIT)
-depends=(sh libxinerama cairo pango libx11 imlib2 fribidi libconfig)
-makedepends=(git meson ninja)
+depends=(
+ sh
+ libxinerama
+ cairo
+ pango
+ wayland
+ wayland-protocols
+ libxkbcommon
+ libx11
+ imlib2
+ fribidi
+ libconfig
+)
+
+makedepends=(
+ git
+ meson
+ ninja
+)
+
provides=($pkgname)
conflicts=($pkgname)
source=(
"$pkgname-$pkgver.tar.gz"
"$pkgname-$pkgver.tar.gz.sig"
#"https://ls.speedie.site/releases/$pkgname/$pkgname-$pkgver.tar.gz"
+ #"https://ls.speedie.site/releases/$pkgname/$pkgname-$pkgver.tar.gz.sig"
)
-md5sums=(MD5SUM 'SKIP')
+md5sums=(
+ MD5SUM
+ 'SKIP'
+)
build(){
cd $pkgname-$pkgver
diff --git a/README.html b/README.html
index 27b4abb..ec8b614 100644
--- a/README.html
+++ b/README.html
@@ -174,9 +174,9 @@
-spmenu is an X11 menu application which takes standard input, parses
-it, and lets the user choose an option and sends the selected option to
-standard output.
+spmenu is a simple X11 and Wayland menu application which takes
+standard input, parses it, lets the user choose an option and sends the
+selected option to standard output.
In addition to this, it also serves as a run launcher through the
included shell script spmenu_run
, which handles both $PATH
listing, .desktop entries and file listing.
@@ -185,10 +185,28 @@ dmenu, spmenu introduces many new features which can be useful in shell
scripting. There are way too many to list, but spmenu has a wiki which goes through features
in more detail.
+It also serves as a dmenu replacement for Wayland users.
Dependencies
+- wayland-client
+
+- For Wayland support, which is optional.
+
+- wayland-scanner
+
+- For Wayland support, which is optional.
+
+- wayland-protocols
+
+- For Wayland support, which is optional.
+
+- xkbcommon
+
+- For Wayland support, which is optional.
+
- libX11
+- For X11 support
- If you’re using macOS, XQuartz is a dependency instead.
- If you’re using Wayland,
xorg-xwayland
is a
dependency.
@@ -274,10 +292,36 @@ instead.
See this
wiki article for more information.
+Wayland support
+Note that Wayland support is still experimental, and some features do
+not currently work under Wayland. Some will never work under Wayland due
+to limitations. These are:
+
+- Image support
+
+- Images simply will not be drawn on Wayland.
+- Will eventually be solved by replacing imlib2 with cairo.
+
+--x-position
and --y-position
arguments
+
+- These arguments do not work under Wayland, because the layer_shell
+protocol doesn’t allow clients to be placed on a specific position.
+
+- Embedding
-w
and window manager managed
+-wm
+
+- These arguments do not make much sense on Wayland, and embedding is
+not possible due to the original implementation using XEmbed. If the
+embed argument is passed it will simply be ignored and the window will
+be layered as normal.
+
+--monitor
argument
+- Window borders
+- Pasting
+
TODO
Pull requests would be greatly appreciated for any of these
issues!
-General
- Image support: Stop using OpenSSL for caching images, mostly because
MD5() is deprecated as of OpenSSL 3.0, but this would also make it very
@@ -290,29 +334,9 @@ easy to have LibreSSL compatibility.
- Matching: Add support for contextual completions similar to
xprompt
-- Matching: Regex matching
-
-- Probably use some minimal public domain library for this, I’d like
-to avoid adding more external dependencies unless it’s a common
-dependency most people already have.
-
-
-Unlikely,
-but maybe at some point in the distant future
-
+- Matching: Regex matching
- X11: Move from Xlib to libXcb
-- Wayland: Wayland support, but only if it doesn’t require writing any
-extra code which as of now seems unlikely, or if someone makes a patch.
-
-- Before this can even be done, deal with keybinds in some Wayland
-compatible way, remove .Xresources usage and figure out a way to
-preserve X11 compatibility as I do not want to use Wayland as of
-now.
-- You can just use XWayland anyway if you happen to use Wayland, so
-it’s not like you will be unable to use spmenu in its current
-state.
-
+- Wayland: Anything listed as broken under ‘Wayland support’.
Scripts
There’s a page dedicated to user scripts
-
spmenu documentation 1.2.1
+ spmenu documentation 2.0