Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal #996

Closed
Twig6943 opened this issue Oct 11, 2024 · 42 comments
Closed

Signal #996

Twig6943 opened this issue Oct 11, 2024 · 42 comments

Comments

@Twig6943
Copy link
Contributor

To help us make adding AppImages quicker and easier, please try to follow the following two syntaxes.

If available on Github.com

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

hi, I can't see the AppImage

@Twig6943
Copy link
Contributor Author

an appimage doesnt exist (I was wondering if u could pacakge it)

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

I'm actually trying to get rid of as many repositories as possible (too much work)

@Twig6943
Copy link
Contributor Author

ooh 👍

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

anyway, have you tried to use Archimage? https://github.com/ivan-hc/ArchImage maybe I can help you in case you have doubts

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

It is preferable that whoever builds it knows what is needed to make it work as it should. I have never used Signal. Skype yes (and I have a repo).

@Twig6943
Copy link
Contributor Author

failed w archimage

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

let me do a test

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

I created this script

signal-desktop-junest.sh.txt

Signal is in the arch linux repos https://archlinux.org/packages/extra/x86_64/signal-desktop/ not an AUR package

to create the above script:

  1. name: signal-desktop
  2. name binary: leave blank, its the same
  3. dependences: none
  4. include all dependences: y
  5. use defaults: y

video:

simplescreenrecorder-2024-10-11_21.17.41.mkv.mp4

AppImage is 296 MB

here is what happens when I run it

simplescreenrecorder-2024-10-11_21.19.40.mkv.mp4

to fix it you can start to read the logs and see what files are missing, like this

simplescreenrecorder-2024-10-11_21.21.17.mkv.mp4

it is looking for a missing module, contained into a package to search on google (or in my case startpage), in this case the package is xapp

all you need to do is to take note of the missing package and then add to dependences, like this

simplescreenrecorder-2024-10-11_21.25.28.mkv.mp4

and as you can see, xapp is downloaded and then it wil be extracted with all the other packages listed during this process in the "deps" directory

the appimage is increased of 0,1 MB, let we see if it works...

simplescreenrecorder-2024-10-11_21.28.40.mkv.mp4

also this time it is not working, but I've found that there is a missing library "libgnomekbdui", contained in the "libgnomekbd" arch linux package... so I'll do the same as I did with xapp

now the package is 296,2 MB... let we see if it runs...

simplescreenrecorder-2024-10-11_21.34.44.mkv.mp4

this time it is missing the library "libudev.so", I'll add the keyword "libudev" to $LIBSAVED, to fetch all files containing this word, for this will be added all depending libraries and it too will be bundled in the appimage

in case it is not saved, search the package containing that library as I did with xapp

now the package is 296,3 MB... let se again

simplescreenrecorder-2024-10-11_21.40.48.mkv.mp4

magic!

If the app works, you are good with it, but it is suggested to find missing libraries.

Also, now that you know that it works, you can start debloating (play by running the AppRun script in the AppDir directory, use Baobab or something else to find the size of packages, try to move them elsewhere and run the AppRun, and see if it works... if it is ok, take note of all files you can remove, and the package will be smaller once you add them to the list "ADDITIONAL REMOVALS"

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

The working script I got in the final video is now here https://github.com/ivan-hc/ArchImage/blob/main/drafts/signal-desktop-junest.sh

Now you know how to build an archimage correctly :)

@Twig6943
Copy link
Contributor Author

@ivan-hc compiling rn (tysm for the script)

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

@ivan-hc compiling rn (tysm for the script)

???

@Twig6943
Copy link
Contributor Author

I mean packaging****

(signal-desktop-junest.sh)

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

Consider this script as a gift

Seriously, I don't want to open more repositories. I have too many to maintain, and each of them has problems.

PS: I posted my comment as a "tutorial", I can't do better than that https://github.com/ivan-hc/ArchImage#tutorial

I've been building them for years and trying to build easy alternatives to package AppImages, adding tutorials and videos. But I've gotten to the point where I've created so many of them, and it's hard to keep up with all of them. Especially when github changes the "workflow" mechanism. I'm doing everything I can to reduce the number of active repositories.

@Twig6943
Copy link
Contributor Author

@ivan-hc wayland doesnt work with the appimage package
image
image

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

try to add "wayland" as a dependency, or as a keyword

I am still on X11 btw (XFCE4.18).

@Twig6943
Copy link
Contributor Author

DEPENDENCES="wayland ca-certificates xapp libgnomekbd"

Still the same result with the --ozone-platform=auto

@Twig6943
Copy link
Contributor Author

also https://github.com/Twig6943/Signal-AppImage/releases/tag/1.0 (WIP pkg) (WIP cuz wayland doesnt work like I said)

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

run it with LD_DEBUG=libs and see the missing library

you need to read the whole log and see where there is an error message, for example, in the appimage you provided, I've found that it have not "libxklavier"

Istantanea_2024-10-12_01-06-22 png

note the side bar of my terminal, I'm in the middle of the log

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

NOTE, to made this search may take a whole day, also for me.

You need to read and understand each line. The last one I have pointed, as all of them, mean that the program is looking for a library to load. In this case "libxklavier". If it is in "junest-backups" you can add "libxklavier" in LIBSAVED as a keyword, else add directly the dependency that brings that library with it (in this case "libxklavier").

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

NOTE, to made this search may take a whole day, also for me.

You need to read and understand each line. The last one I have pointed, as all of them, mean that the program is looking for a library to load. In this case "libxklavier". If it is in "junest-backups" you can add "libxklavier" in LIBSAVED as a keyword, else add directly the dependency that brings that library with it (in this case "libxklavier").

I'm not sure if it is enough to solve the issue with wayland. You need to try and try and re-try until it works the way you want.

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 11, 2024

uhm...just noticed that your script https://github.com/Twig6943/Signal-AppImage/blob/main/signal-desktop-junest.sh is different from this I linked at the end of my tutorial https://github.com/ivan-hc/ArchImage/blob/main/drafts/signal-desktop-junest.sh have you used the correct one?

@Twig6943
Copy link
Contributor Author

I tried your script last night but wayland didnt work w that one (app still works fine via xwayland tho) so I edited the script a bit to make wayland work but still no dice

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 12, 2024

uhm... if you use other archimages I created and they work in wayland, you should check what I added in that scripts, it may help

for what I know, xwayland semms to be the easier way to made it work, but maybe I'm wrong, I don't use Wayland at all... I should wait in december or january I guess, for xfce4.20

@Twig6943
Copy link
Contributor Author

Well I'm too lazy to get the app to run with wayland could u add it to AM's main repo regardless?
https://github.com/Twig6943/Signal-AppImage/releases

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 18, 2024

Hi, create a /.github/workflows/CI.yml file in your repo with this content

name: Appimage
concurrency:
  group: build-${{ github.ref }}
  cancel-in-progress: true

on:
  schedule:
    - cron: "0 21 * * 0"
  workflow_dispatch:

jobs:
  build:
    runs-on: ubuntu-22.04
    steps:
    - uses: actions/checkout@v3

    - name: build
      if: always()
      run: |
        sudo apt update
        sudo apt install libfuse2 desktop-file-utils
        chmod a+x ./*junest.sh
        ./*junest.sh
        mkdir dist
        mv *AppImage* dist/

    - name: Upload artifact
      uses: actions/[email protected]
      with:
        name: AppImage
        path: 'dist'
        
  release:
      needs: [build]
      permissions: write-all
      runs-on: ubuntu-latest

      steps:
        - uses: actions/[email protected]
          with:
            name: AppImage

        - name: release
          uses: marvinpinto/action-automatic-releases@latest
          with:
            title: Continuous build
            automatic_release_tag: continuous
            prerelease: false
            draft: false
            files: |
              *.AppImage*
            repo_token: ${{ secrets.GITHUB_TOKEN }}

and then go in the "Actions" tab of your repo and run it, it should update the build every day in authomatic, to tag "continuous"

EDIT: this is the kind of workflow I use in all my repos

@Twig6943
Copy link
Contributor Author

@ivan-hc done

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 18, 2024

@Twig6943 I've done too e311722 lol

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 18, 2024

and also this Portable-Linux-Apps/Portable-Linux-Apps.github.io@70c4004

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 18, 2024

Now its time to debloat the AppImage

simplescreenrecorder-2024-10-19_01.15.03.mkv.mp4

directories "man" and "gir*" in .junest/usr/share an already save 20+ MB

fun fact, here is what happens when I run the content of the big one, under .junest/usr/lib

simplescreenrecorder-2024-10-19_01.17.55.mkv.mp4

essentially, instead of running the /usr/bin/signal-desktop reference, it would be enough to run /usr/lib/signal-desktop/signal-desktop, being it an electron app

so other big files can be also removed... but this needs a deeper search

libraries into that directories are against container's glibc, this means that on a recent distro such as Arch Linux or my Debian Testing, such files work without problems... while on an old distro like Debian Stable and Oldstable the app should not work at all.

So it is important to keep the structure of the JuNest container for this.

Jou can start to get note of the libraries you may not need, and then add them to the list of removable files, like this

simplescreenrecorder-2024-10-19_01.24.26.mkv.mp4

in this case I've found that libgo* is not needed

until now I have found that you can edit this part of the script

function _enable_mountpoints_for_the_inbuilt_bubblewrap() {
	mkdir -p ./"$APP".AppDir/.junest/home
	mkdir -p ./"$APP".AppDir/.junest/media
	mkdir -p ./"$APP".AppDir/.junest/usr/lib/locale
	mkdir -p ./"$APP".AppDir/.junest/usr/share/fonts
	mkdir -p ./"$APP".AppDir/.junest/usr/share/themes
	mkdir -p ./"$APP".AppDir/.junest/run/user
	rm -f ./"$APP".AppDir/.junest/etc/localtime && touch ./"$APP".AppDir/.junest/etc/localtime
	[ ! -f ./"$APP".AppDir/.junest/etc/asound.conf ] && touch ./"$APP".AppDir/.junest/etc/asound.conf
}

like this

function _enable_mountpoints_for_the_inbuilt_bubblewrap() {
	mkdir -p ./"$APP".AppDir/.junest/home
	mkdir -p ./"$APP".AppDir/.junest/media
	mkdir -p ./"$APP".AppDir/.junest/usr/lib/locale
	mkdir -p ./"$APP".AppDir/.junest/usr/share/fonts
	mkdir -p ./"$APP".AppDir/.junest/usr/share/themes
	mkdir -p ./"$APP".AppDir/.junest/run/user
	rm -f ./"$APP".AppDir/.junest/etc/localtime && touch ./"$APP".AppDir/.junest/etc/localtime
	[ ! -f ./"$APP".AppDir/.junest/etc/asound.conf ] && touch ./"$APP".AppDir/.junest/etc/asound.conf
	mkdir -p ./"$APP".AppDir/.junest/usr/share/man
	mkdir -p ./"$APP".AppDir/.junest/usr/share/gir*
	mkdir -p ./"$APP".AppDir/.junest/usr/lib/libgo.so*
}

and NOTE, you can do this without editing the AppRun.

Do this test for all files you think that are not needed.

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 18, 2024

PS: I have custom actions in Thunar to extract the AppImages and I use Baobab to find the big files. In thunar I just sorted by size all files and directories to find the big ones.

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 19, 2024

And about electron apps, I have another method that mades it even easier to obtain a 155 MB AppImage.

Snap2AppImage: https://github.com/ivan-hc/Snap2AppImage

All it does is to download, extract and repack the Snap program into an AppImage.

You need "squashfs-tools" installed on your system, it is needed to extract Snap packages.

This is the script I wrote:

#!/bin/sh

APP=signal-desktop

# TEMPORARY DIRECTORY
mkdir -p tmp
cd ./tmp || exit 1

# WGET VERSION USAGE
_wget_version_usage() {
	if wget --version | head -1 | grep -q ' 1.'; then
		wget -q --show-progress "$@"
	else
		wget "$@"
	fi
}

# DOWNLOAD APPIMAGETOOL
if ! test -f ./appimagetool; then
	_wget_version_usage https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage -O appimagetool
	chmod a+x ./appimagetool
fi

# DOWNLOAD THE SNAP PACKAGE
if ! test -f ./*.snap; then
	_wget_version_usage "$(curl -H 'Snap-Device-Series: 16' http://api.snapcraft.io/v2/snaps/info/signal-desktop --silent | sed 's/[()",{} ]/\n/g' | grep "^http" | head -1)"
fi

# EXTRACT THE SNAP PACKAGE
if ! test -d ./squashfs-root; then
	unsquashfs -f ./*.snap
fi

# FIND PACKAGE VERSION
VERSION=$(cat $(find . -name snapcraft.yaml | head -1) | grep "^version" | head -1 | cut -c 10- | sed 's/"//g; s/ /-/g')

# CREATE THE APPDIR AND COMPILE THE APPIMAGE
mkdir -p "$APP".AppDir
rm -Rf ./"$APP".AppDir/*

# FIND THE .DESKTOP FILE AND REPLACE THE "ICON" ENTRY
cp -r "$(find . -name "$APP".desktop | head -1)" ./"$APP".AppDir/
sed -i "s/^Icon=.*/Icon=$APP/g" ./"$APP".AppDir/*.desktop

# FIND THE APPNAME
APPNAME="$(cat ./"$APP".AppDir/*.desktop | grep '^Name=' | head -1 | cut -c 6- | sed 's/ /-/g')"

# FIND THE ICON
cp -r "$(find . -name *.png | grep -i "$APP" | sort | head -1)" ./"$APP".AppDir/"$APP".png 2> /dev/null
cp -r "$(find . -name *.svg | grep -i "$APP" | sort | head -1)" ./"$APP".AppDir/"$APP".svg 2> /dev/null

# IMPORT COMMON LINUX DIRECTORIES
if test -d ./squashfs-root/etc; then cp -r ./squashfs-root/etc ./"$APP".AppDir/; fi
if test -d ./squashfs-root/lib; then cp -r ./squashfs-root/lib* ./"$APP".AppDir/; fi
if test -d ./squashfs-root/usr; then cp -r ./squashfs-root/usr ./"$APP".AppDir/; fi
if test -d ./squashfs-root/opt; then cp -r ./squashfs-root/opt ./"$APP".AppDir/; fi

# APPRUN
cat >> ./"$APP".AppDir/AppRun << 'EOF'
#!/bin/sh
HERE="$(dirname "$(readlink -f "${0}")")"
export UNION_PRELOAD=/:"${HERE}"
export LD_LIBRARY_PATH="${HERE}"/usr/lib/:"${HERE}"/usr/lib/i386-linux-gnu/:"${HERE}"/usr/lib/x86_64-linux-gnu/:"${HERE}"/lib/:"${HERE}"/lib/i386-linux-gnu/:"${HERE}"/lib/x86_64-linux-gnu/:"${LD_LIBRARY_PATH}"
export PATH="${HERE}"/usr/bin/:"${HERE}"/usr/sbin/:"${HERE}"/usr/games/:"${HERE}"/bin/:"${HERE}"/sbin/:"${PATH}"
export PYTHONPATH="${HERE}"/usr/share/pyshared/:"${HERE}"/usr/lib/python*/:"${PYTHONPATH}"
export PYTHONHOME="${HERE}"/usr/:"${HERE}"/usr/lib/python*/
export XDG_DATA_DIRS="${HERE}"/usr/share/:"${XDG_DATA_DIRS}"
export PERLLIB="${HERE}"/usr/share/perl5/:"${HERE}"/usr/lib/perl5/:"${PERLLIB}"
export GSETTINGS_SCHEMA_DIR="${HERE}"/usr/share/glib-2.0/schemas/:"${GSETTINGS_SCHEMA_DIR}"
export QT_PLUGIN_PATH="${HERE}"/usr/lib/qt4/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt4/plugins/:"${HERE}"/usr/lib32/qt4/plugins/:"${HERE}"/usr/lib64/qt4/plugins/:"${HERE}"/usr/lib/qt5/plugins/:"${HERE}"/usr/lib/i386-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib/x86_64-linux-gnu/qt5/plugins/:"${HERE}"/usr/lib32/qt5/plugins/:"${HERE}"/usr/lib64/qt5/plugins/:"${QT_PLUGIN_PATH}"
exec ${HERE}/opt/Signal/signal-desktop "$@"
EOF
chmod a+x ./"$APP".AppDir/AppRun

# CONVERT THE APPDIR INTO AN APPIMAGE
ARCH=x86_64 ./appimagetool --comp zstd --mksquashfs-opt -Xcompression-level --mksquashfs-opt 20 ./"$APP".AppDir
cd ..
mv ./tmp/*.AppImage ./"$APPNAME"-"$VERSION"-x86_64.AppImage

and this is it in action:

simplescreenrecorder-2024-10-19_02.05.07.mkv.mp4

if you compare the content of the script above with the original one, there is not much difference https://github.com/ivan-hc/Snap2AppImage/blob/main/snap2appimage.sh I only added the internal /opt directory containing Signal and changed the reference in the AppRun

@Samueru-sama take a look at this

@ivan-hc
Copy link
Owner

ivan-hc commented Oct 19, 2024

Snap2AppImage is the best one for electron apps, among my tools

@Twig6943 Twig6943 reopened this Oct 19, 2024
@Twig6943
Copy link
Contributor Author

I'll give snap2appimage a shot soon

@Samueru-sama
Copy link
Contributor

snap2appimage may not work here because iirc signal as a dependency to gtk3, so hopefully it comes already in the snap bundled.

@karo-solutions
Copy link

Not sure if this is helpful at this point, but just in case:
Here is a simple and easy to follow guide on how to build the Signal-Desktop AppImage from the official source code: https://github.com/karo-solutions/Signal-Desktop-AppImage

The only prerequisite is docker or podman and the version of Signal can be specified.
The latest stable (v7.29.0) AppImage has about 160 MB and can be found in Releases

Will try to keep the repository updated and might add a GitHub action in the future 👍

@Twig6943
Copy link
Contributor Author

@karo-solutions does this package run with the "--ozone-platform-hint=wayland" flag on your system (It doesnt on me)

@karo-solutions
Copy link

@karo-solutions does this package run with the "--ozone-platform-hint=wayland" flag on your system (It doesnt on me)

The following command works on my system (Fedora 40; Gnome 46):
./Signal-7.29.0.AppImage --use-tray-icon --no-sandbox %U --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations
Confirmed with xeyes that it is really using wayland 👍

I found this solution in this comment: signalapp/Signal-Desktop#3411 (comment)
There you can also find a more detailed description and possible implications of these flags.
For me the App seem to be useable, the only two problems I have found are:

  • Window resizing does not work (snapping does)
  • The app starts minimized (have to click the icon in the taskbar)

Btw. there is also a feature request for Signal to support Wayland and additional information: https://community.signalusers.org/t/support-wayland-natively/58021

@Twig6943
Copy link
Contributor Author

@ivan-hc please switch the package (the one thats downloaded when the user runs am -i signal) to @karo-solutions 's package (it works with wayland)

ivan-hc added a commit that referenced this issue Oct 24, 2024
@ivan-hc
Copy link
Owner

ivan-hc commented Oct 24, 2024

@ivan-hc please switch the package (the one thats downloaded when the user runs am -i signal) to @karo-solutions 's package (it works with wayland)

done

@Twig6943
Copy link
Contributor Author

@karo-solutions does this package run with the "--ozone-platform-hint=wayland" flag on your system (It doesnt on me)

The following command works on my system (Fedora 40; Gnome 46): ./Signal-7.29.0.AppImage --use-tray-icon --no-sandbox %U --enable-features=UseOzonePlatform --ozone-platform=wayland --enable-features=WaylandWindowDecorations Confirmed with xeyes that it is really using wayland 👍

this got it working thanks ❤️

@karo-solutions
Copy link

this got it working thanks ❤️

You are very welcome!

Just for information:
I added a GitHub Action that checks for a new Signal Version weekly, rebuilds the AppImage on demand and uploads it to Releases .

I also now re-pack the AppImage with a static appimage runtime and use zstd compression, which makes it "only" 144MiB. (see karo-solutions/Signal-Desktop-AppImage#1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants