buttercup / buttercup-desktop

:key: Cross-Platform Passwords & Secrets Vault
https://buttercup.pw
GNU General Public License v3.0
4.31k stars 330 forks source link

Does not run under Wayland #1168

Open hellium6 opened 2 years ago

hellium6 commented 2 years ago

On Arch Linux, under Wayland, running appimage shows:

./Buttercup-linux-x86_64.AppImage
Setting $HOME to /home/username/bin/Buttercup-linux-x86_64.AppImage.home
Setting $XDG_CONFIG_HOME to /home/username/bin/Buttercup-linux-x86_64.AppImage.config
[INF] 08:29:51: Application starting
[INF] 08:29:51: Registering protocol: buttercup
[ERR] 08:29:51: Failed registering protocol: buttercup
[2670:0914/082951.204761:ERROR:browser_main_loop.cc(1400)] Unable to open X display.
The futex facility returned an unexpected error code.
Aborted (core dumped)
perry-mitchell commented 2 years ago

@hellium6 Have you tried this? https://stackoverflow.com/a/67842921/966338

hellium6 commented 2 years ago

@hellium6 Have you tried this? https://stackoverflow.com/a/67842921/966338

I tried running export DISPLAY=$(cat /etc/resolv.conf | grep nameserver | awk '{print $2}'):0 and then running the appimage but got the same error. Then I realized it requires me to install X server. I have X installed. I can run other X apps on the system. Maybe it works for WSL/Windows only, not Arch?

With a little bit of searching I think I found a better solution which works. I tried running with --enable-features=UseOzonePlatform --ozone-platform=wayland according to this and this. It worked.

$ ./Buttercup-linux-x86_64.AppImage --enable-features=UseOzonePlatform --ozone-platform=wayland
Setting $HOME to /home/username/bin/Buttercup-linux-x86_64.AppImage.home
Setting $XDG_CONFIG_HOME to /home/username/bin/Buttercup-linux-x86_64.AppImage.config
[INF] 15:57:17: Application starting
[INF] 15:57:17: Registering protocol: buttercup
[ERR] 15:57:17: Failed registering protocol: buttercup
[INF] 15:57:17: Application ready
[INF] 15:57:17: Application session started: 2022-09-16T15:57:17.904Z
[INF] 15:57:17: Logs location: /home/username/bin/Buttercup-linux-x86_64.AppImage.home/.local/state/Buttercup-nodejs/buttercup-desktop.log
[INF] 15:57:17: Config location: /home/username/bin/Buttercup-linux-x86_64.AppImage.config/Buttercup-nodejs/desktop.config.json
[INF] 15:57:17: Vault config storage location: /home/username/bin/Buttercup-linux-x86_64.AppImage.home/.local/share/Buttercup-nodejs/vaults.json
[INF] 15:57:17: System locale detected: en-US
[INF] 15:57:17: Starting with language: en-US
...

No errors related to display and Buttercup window appears on screen.

hellium6 commented 2 years ago

I was able to make it work on both X11 and Wayland with this trick:

mkdir -p /tmp/bc-mod
cp Buttercup-linux-x86_64.AppImage /tmp/bc-mod/Buttercup-linux-x86_64.AppImage
cd /tmp/bc-mod
"./Buttercup-linux-x86_64.AppImage" --appimage-extract
cd squashfs-root

I made the following changes to AppRun:

--- AppRun.old  2022-09-16 17:54:52.897049000 +0000
+++ AppRun  2022-09-16 18:27:35.027133460 +0000
@@ -10,6 +10,7 @@ THIS="$0"
 # http://stackoverflow.com/questions/3190818/
 args=("$@")
 NUMBER_OF_ARGS="$#"
+[ -n "$WAYLAND_DISPLAY" ] && WAYLAND_ARGS="--enable-features=UseOzonePlatform --ozone-platform=wayland"

 if [ -z "$APPDIR" ] ; then
   # Find the AppDir. It is the directory that contains AppRun.
@@ -40,9 +41,9 @@ atexit()
 {
   if [ $isEulaAccepted == 1 ] ; then
     if [ $NUMBER_OF_ARGS -eq 0 ] ; then
-      exec "$BIN"
+      exec "$BIN" $WAYLAND_ARGS
     else
-      exec "$BIN" "${args[@]}"
+      exec "$BIN" "${args[@]}" $WAYLAND_ARGS
     fi
   fi
 }
cd ..
appimagetool -v squashfs-root "Buttercup-linux-x86_64.AppImage" || /path/to/appimagetool.appimage -v squashfs-root "Buttercup-linux-x86_64.AppImage"
mv -i "Buttercup-linux-x86_64.AppImage" "/home/username/bin/Buttercup-linux-x86_64.AppImage"
hellium6 commented 2 years ago

If this is too much work, try passing the .appimage file to this script: https://gist.github.com/hellium6/fd90d75002e98befa29492ecdf9e42ed

This way:

wayland-mod.sh /path/to/buttercup.appimage

It will automatically apply the modification, re-create the appimage and then ask you whether you want to replace the original. It may work on other Electron appimages (ie. would allow them to run under Wayland) but haven't tested extensively.

perry-mitchell commented 1 year ago

I would accept a PR for this.. but unfortunately don't have time to tackle it myself, sorry.

DanielR-I commented 2 months ago

With a little bit of searching I think I found a better solution which works. I tried running with --enable-features=UseOzonePlatform --ozone-platform=wayland according to this and this. It worked.

Thank you for this. I wasn't having any issues launching buttercup-dektop (v2.28) under KDE6 Wayland, but I was experiencing an issue pasting data into a field which made it "hang"/think/retry... edited the menu application by adding --enable-features=UseOzonePlatform --ozone-platform=wayland as arguements and now I can paste normally.

Thank you.