aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--sway/sway.conf2
-rwxr-xr-xsway/wrap33
3 files changed, 37 insertions, 0 deletions
diff --git a/README.md b/README.md
index 69df07b5..a183e53f 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,8 @@ by far the most cursed one, using vkcube to render.
only works on sway. requires wf-recorder, jq, ffmpeg and imagemagick.
+if you are not running a sway session, run `mkcube` or `make` under `sway/wrap`: `sway/wrap make cube`
+
make sure to build vulkan tools: `cmake -S tools/Vulkan-Tools -B tools/Vulkan-Tools/build && make -C tools/Vulkan-Tools/build vkcube`.
make sure to add sway config rule: `for_window [title="^vkcube$"] floating enable`.
diff --git a/sway/sway.conf b/sway/sway.conf
new file mode 100644
index 00000000..f0cd6d77
--- /dev/null
+++ b/sway/sway.conf
@@ -0,0 +1,2 @@
+exec --no-startup-id sh -c 'export -p > sway/env'
+for_window [title="^vkcube$"] floating enable
diff --git a/sway/wrap b/sway/wrap
new file mode 100755
index 00000000..28110ed7
--- /dev/null
+++ b/sway/wrap
@@ -0,0 +1,33 @@
+#!/bin/sh
+if ! test -f sway/wrap; then
+ printf 'Must be run in the root of usermoji repository.\n' >&2
+ exit 1
+fi
+rm -f sway/env || exit
+WLR_BACKENDS=headless WLR_LIBINPUT_NO_DEVICES=1 sway -c sway/sway.conf &
+SWAYPID=$!
+cleanup() {
+ kill $SWAYPID
+ rm -f sway/env
+}
+trap cleanup EXIT
+
+Etimeout=50
+while ! test -f sway/env; do
+ {
+ sleep 0.1 2>/dev/null &&
+ Etimeout=$((Etimeout - 1))
+ } || {
+ sleep 1 &&
+ Etimeout=$((Etimeout - 10))
+ }
+ if test 0 -ge $Etimeout; then
+ printf 'Sway environment initialization failure.\n' >&2
+ exit 1;
+ fi
+done
+unset Etimeout
+
+. sway/env
+"$@"
+cleanup