├── AUTHORS ├── LICENSE ├── Makefile ├── README.md ├── Xweston ├── dummy-client └── weston.ini.in /AUTHORS: -------------------------------------------------------------------------------- 1 | Alain Kalker 2 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2014-2015 Alain Kalker. All rights reserved. 2 | 3 | Permission is hereby granted, free of charge, to any person 4 | obtaining a copy of this software and associated 5 | documentation files (the "Software"), to deal in the 6 | Software without restriction, including without limitation 7 | the rights to use, copy, modify, merge, publish, distribute, 8 | sublicense, and/or sell copies of the Software, and to 9 | permit persons to whom the Software is furnished to do so, 10 | subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall 13 | be included in all copies or substantial portions of the 14 | Software. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 17 | KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 18 | WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR 19 | PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS 20 | BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 21 | IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 22 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 23 | OTHER DEALINGS IN THE SOFTWARE. 24 | 25 | Except as contained in this notice, the names of the authors 26 | or their institutions shall not be used in advertising or 27 | otherwise to promote the sale, use or other dealings in this 28 | Software without prior written authorization from the 29 | authors. 30 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | PREFIX = /usr/local 2 | BINDIR = bin 3 | DESTDIR = 4 | LIBDIR = lib 5 | 6 | clientdir = $(PREFIX)/$(LIBDIR)/Xweston 7 | 8 | all: weston.ini 9 | 10 | clean: 11 | rm -f weston.ini 12 | 13 | install: all 14 | install -D -m755 Xweston $(DESTDIR)/$(PREFIX)/$(BINDIR)/Xweston 15 | install -D -m755 dummy-client $(DESTDIR)/$(clientdir)/dummy-client 16 | install -D -m644 weston.ini $(DESTDIR)/$(clientdir)/weston.ini 17 | 18 | uninstall: 19 | rm -f $(DESTDIR)/$(PREFIX)/$(BINDIR)/Xweston 20 | rm -f $(DESTDIR)/$(clientdir)/dummy-client 21 | rm -f weston.ini $(DESTDIR)/$(clientdir)/weston.ini 22 | -rmdir $(DESTDIR)/$(clientdir) 23 | 24 | release: 25 | 26 | weston.ini: weston.ini.in 27 | sed -e "s|@clientdir@|$(clientdir)|g" < $< > $@ 28 | 29 | .PHONY: all clean install uninstall release 30 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | Xweston - Xwayland with weston 2 | ============================== 3 | 4 | Introduction 5 | ------------ 6 | While it is possible to run X clients in Weston by loading the xwayland.so 7 | module, running X display managers and window managers in an ordinary Weston 8 | session doesn't work because Weston normally uses its own window manager. 9 | Xweston should allow one to run Xwayland as a bare X server (i.e. taking 10 | over the root window) hosted by Weston. 11 | 12 | Like Weston, Xweston can be started from within an existing X session, another 13 | Wayland session, or standalone, i.e. a free VT. 14 | 15 | Note: this is still experimental, there are many known issues and probably bugs. 16 | 17 | Installing 18 | ---------- 19 | 20 | Xweston doesn't need any configuration, just run: 21 | 22 | # make install 23 | 24 | to have it installed under /usr/local . 25 | To specify an alternative prefix, like /usr, run 26 | 27 | # make PREFIX=/usr install 28 | 29 | For packaging, add DESTDIR= as usual. 30 | 31 | Usage 32 | ----- 33 | 34 | Xweston can be started like any ordinary X server. 35 | 36 | Some examples: 37 | 38 | Using startx, this should also works from within a running X session: 39 | 40 | $ startx -- /usr/bin/Xweston 41 | 42 | Using startx from within a running X session, passing extra commandline options to weston: 43 | 44 | $ WESTON_OPTS=--fullscreen startx -- /usr/bin/Xweston 45 | 46 | Addong a dynamic seat from within a running LightDM session: 47 | 48 | # dm-tool add-seat xlocal xserver-command=/usr/bin/Xweston 49 | 50 | Contributing 51 | ------------ 52 | 53 | Xweston is licensed under the GPL, version 2. 54 | Its source code is hosted on Github: https://github.com/ackalker/Xweston 55 | 56 | Please feel free to report any issues, make feature requests or contribute 57 | to the Wiki. 58 | 59 | License 60 | ------- 61 | 62 | Released under the MIT license. Copyright (c) 2014-2015 Alain Kalker. 63 | -------------------------------------------------------------------------------- /Xweston: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Xweston - launch Xwayland hosted by weston 4 | 5 | # Initialize 6 | display=:0 7 | tty=$(tty) 8 | weston_opts=$WESTON_OPTS 9 | weston_launch_opts=$WESTON_LAUNCH_OPTS 10 | unset WESTON_OPTS WESTON_LAUNCH_OPTS 11 | 12 | # Parse commandline arguments 13 | for opt; do 14 | case $opt in 15 | :[0-9]*) 16 | display=$opt 17 | ;; 18 | vt[0-9]*) 19 | tty=/dev/tty${opt#vt} 20 | weston_opts="$weston_opts --tty=${tty#/dev/tty}" 21 | continue 22 | ;; 23 | -novtswitch) 24 | # Not supported by Xweston, ignore 25 | continue 26 | ;; 27 | esac 28 | xwayland_opts="$xwayland_opts $opt" 29 | done 30 | 31 | # X session and display manager support 32 | if [ -z "$XDG_RUNTIME_DIR" ]; then 33 | export XDG_RUNTIME_DIR=/tmp/.Xweston/$display 34 | mkdir -p "$XDG_RUNTIME_DIR" 35 | chmod 0700 "$XDG_RUNTIME_DIR" 36 | fi 37 | 38 | # dummy-client will signal us when weston is ready for connections 39 | # The handler is a no-op, actual processing is done after `wait` below 40 | trap : USR2 41 | 42 | # Start weston 43 | ( 44 | # Set XDG_CONFIG_HOME (highest priority) for loading our custom weston.ini 45 | export XDG_CONFIG_HOME=/usr/lib/Xweston 46 | 47 | if [ $UID -ne 0 ] && [ -z "$DISPLAY" ]; then 48 | exec weston-launch $weston_launch_opts -- $weston_opts < $tty 49 | else 50 | exec weston $weston_opts 51 | fi 52 | ) & 53 | 54 | # Wait for signal from dummy-client 55 | wait 56 | 57 | # All done, start Xwayland 58 | exec Xwayland $xwayland_opts 59 | -------------------------------------------------------------------------------- /dummy-client: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # dummy-client - Weston shell client that does nothing 4 | # but send a signal to Xweston when Weston is ready 5 | 6 | PROGNAME=$(basename "$0") 7 | 8 | # Find ancestor process given its process name and a starting PID 9 | # Return PID if found, 0 if not found 10 | find_ancestor() { 11 | local name pid 12 | name=$1 13 | pid=$2 14 | while [ $pid -ne 0 ]; do 15 | set -- $(ps -o comm= -o ppid= -p $pid) 16 | [ "$1" = "$name" ] && break 17 | pid=$2 18 | done 19 | echo $pid 20 | } 21 | 22 | error() { 23 | echo "$PROGNAME: Error: $1" >&2 24 | } 25 | 26 | # Exit with error if not running under weston (perhaps we were orphaned) 27 | weston_pid=$(find_ancestor "weston" $$) 28 | if [ $weston_pid -eq 0 ]; then 29 | error "not running under weston" 30 | exit 1 31 | fi 32 | 33 | # Find PID of Xweston, exit with error if not found 34 | xweston_pid=$(find_ancestor "Xweston" $weston_pid) 35 | if [ $xweston_pid -eq 0 ]; then 36 | error "not started by Xweston" 37 | # Shutdown weston 38 | kill -TERM $weston_pid 39 | # If we exit before weston, we might be respawned. Give it some time 40 | sleep 1 41 | exit 1 42 | fi 43 | 44 | # Signal Xweston that weston is ready for connections 45 | kill -USR2 $xweston_pid 46 | 47 | # Execute the real desktop shell 48 | exec /usr/lib/weston/weston-desktop-shell 49 | -------------------------------------------------------------------------------- /weston.ini.in: -------------------------------------------------------------------------------- 1 | [shell] 2 | client=@clientdir@/dummy-client 3 | background-color=0xff000000 4 | panel-location=none 5 | --------------------------------------------------------------------------------