Tomas-M / xlunch

Graphical app launcher for X with minimal dependencies
http://xlunch.org
GNU General Public License v3.0
219 stars 37 forks source link

Create a snap package #57

Closed Winael closed 6 years ago

Winael commented 6 years ago

Hi,

This launcher seems pretty awesome. Why don't you create a snap package ? Using build.snapcraft.io you can automate it and create a package that can be use on Debian, Fedora, Ubuntu, Arch, Gentoo and Suse

I didn't succcess to build it on my Ubuntu 17.04, I guess due to missing requierement, and the documentation is pretty light. So maybe with a snap you can win more users.

Cheers Winael

Tomas-M commented 6 years ago

With Snap, it is going to include million MB of additional libraries in the package, right? :) Anyway, ... you should be able to build xlunch as soon as you install imlib2, that is the only dependency.

 apt-get install libimlib2 libimlib2-dev
Winael commented 6 years ago

@Tomas-M Not at all, only the necessary libs. To use X, snap expose an AppArmor/Seccomp profie to be allowed to use it. More and more snaps are lighter and lighter, think about SOA philosophy. Anyway, trying to install xlunch with dependancies this morning and this is the output :( :

winael@winael-laptop:~/xlunch$ sudo make install
gcc xlunch.c -o xlunch -lImlib2 -lX11 -O2 -s
mkdir -p /etc/xlunch/
mkdir -p /usr/share/xlunch/svgicons/
mkdir -p /usr/bin/
mkdir -p /usr/share/icons/hicolor/48x48/apps
mkdir -p /usr/share/applications
cp extra/ghost.png /usr/share/icons/hicolor/48x48/apps/xlunch_ghost.png
cp docs/logo.png /usr/share/icons/hicolor/48x48/apps/xlunch.png
cp xlunch /usr/bin/
cp extra/genentries /usr/bin
cp extra/genentries.desktop /usr/share/applications/
sh extra/genentries --path /usr/share/xlunch/svgicons/ > /etc/xlunch/entries.dsv
extra/genentries: 9: extra/genentries: [[: not found
extra/genentries: 69: extra/genentries: declare: not found
extra/genentries: 70: extra/genentries: Syntax error: "(" unexpected
Makefile:9 : la recette pour la cible « install » a échouée
make: *** [install] Erreur 2

Still doesn't work. So still stuck with rofi on my i3wm. Your launcher seems to be so nicer

Cheers

Tomas-M commented 6 years ago

[[: not found

@PMunch, this syntax in genconf script is causing troubles for lots of people, I got few emails already... This is most likely your work since I have no idea what [[ should do in a bash script. Can you please rewrite the script to be more universal? You know, people are running it on different linuxes, and are having troubles. Perhaps avoid using [[ and use some older syntax....

Tomas-M commented 6 years ago

Plus the other things, as you can see the debug log ... we should be as much portable as we can.

Tomas-M commented 6 years ago

@Winael, you have probably xlunch compiled properly. Only the generation of entries.dev file fails for some reason, please create one manually and put it in /etc/xlunch/entries.dsv

You can find example in the "extra" directory (sample_entries.dsv)

PMunch commented 6 years ago

Well, [[ became part of the bash standard in version 2.02, in 1998.. So it's hardly some new fancy feature.. If I were to guess he has either symlinked bash to something else, or created an alias for it. Some people do this, and it breaks all sorts of things. @Winael what is the output of type bash and bash --version.

Tomas-M commented 6 years ago

Ah, 1998 is pretty old :) Strange that it doesn't work everywhere.

PMunch commented 6 years ago

I noticed that the Makefile did a call through sh, that might've been the problem. Fixed this in https://github.com/Tomas-M/xlunch/commit/430f8b1a3a51d660929a4a085e7b74ae9e7aa259. This might fix the issue.

Tomas-M commented 6 years ago

@PMunch good work spotting that there! :) @Winael can you get newest updates from github, try again, and report here? Thanks

Winael commented 6 years ago

@Tomas-M it's pretty much better

~/xlunch$ sudo make install
mkdir -p /etc/xlunch/
mkdir -p /usr/share/xlunch/svgicons/
mkdir -p /usr/bin/
mkdir -p /usr/share/icons/hicolor/48x48/apps
mkdir -p /usr/share/applications
cp extra/ghost.png /usr/share/icons/hicolor/48x48/apps/xlunch_ghost.png
cp docs/logo.png /usr/share/icons/hicolor/48x48/apps/xlunch.png
cp xlunch /usr/bin/
cp extra/genentries /usr/bin
cp extra/genentries.desktop /usr/share/applications/
bash extra/genentries --path /usr/share/xlunch/svgicons/ > /etc/xlunch/entries.dsv
Generating entries file...
Converting /home/winael/.local/share/icons/Humanity/apps/64/utilities-terminal.svg to png
Converting /usr/share/icons/hicolor/scalable/apps/session-properties.svg to png
Converting /usr/share/icons/hicolor/scalable/apps/usb-creator-gtk.svg to png
Converting /home/winael/.local/share/icons/Humanity/apps/24/utilities-system-monitor.svg to png
Converting /home/winael/.local/share/icons/Humanity/categories/64/preferences-system.svg to png
Converting /usr/share/icons/hicolor/48x48/apps/gnome-do.svg to png
Converting /home/winael/.local/share/icons/Humanity/places/64/folder-remote.svg to png
Converting /home/winael/.local/share/icons/Humanity/apps/128/system-software-update.svg to png
Converting /usr/share/icons/hicolor/scalable/apps/ibus-setup.svg to png
Converting /home/winael/.local/share/icons/Humanity/apps/22/accessories-calculator.svg to png
Converting /home/winael/.local/share/icons/Humanity/devices/16/input-keyboard.svg to png
Converting /usr/share/icons/hicolor/scalable/apps/byobu.svg to png
Converting /home/winael/.local/share/icons/Humanity/apps/24/jockey.svg to png
Converting /home/winael/.local/share/icons/Humanity/apps/24/preferences-desktop-remote-desktop.svg to png
Converting /home/winael/.local/share/icons/Humanity/apps/22/preferences-desktop-theme.svg to png
Converting /home/winael/.local/share/icons/Humanity/categories/64/preferences-system-network.svg to png
cp -r svgicons/ /usr/share/xlunch/ 2>/dev/null || :

But xlunch doesn't work...

winael@winael-laptop:~/xlunch$ xlunch -g ../Images/ubuntu-1704-default-wallpaper.jpg -f "extra/OpenSans-Regular.ttf/10" -i /etc/xlunch/entries.dsv -b 140 --outputonly
winael@winael-laptop:~/xlunch$ echo $?
3

I didn't find how to activate debug to help you to troubleshoot. and I didn't find any log files either.

Plz tell me how can I help you guys :)

Cheers

PMunch commented 6 years ago

Hmm, 3 means it has trouble with opening the lock. Maybe you have another xlunch instance running somehow? Try killall xlunch and maybe rm /tmp/xlunch.lock, or use --multiple when calling xlunch to avoid the check completely. @Tomas-M I see there is a check before showing the error message, since he doesn't get the error what else could be happening?

Tomas-M commented 6 years ago

Hm, there are these possible errors:

EBADF - fd is not an open file descriptor EINTR - While waiting to acquire a lock, the call was interrupted by delivery of a signal EINVAL - operation is invalid ENOLCK - The kernel ran out of memory for allocating lock records EWOULDBLOCK - The file is locked and the LOCK_NB flag was selected

I can see I didn't consider the other errors at all. If the lock fails, but due to other things than EWOULDBLOCK, we should probably let xlunch run ....

Tomas-M commented 6 years ago

So the code should probably be

if (rc && errno == EWOULDBLOCK) { printf(...); exit(3); }
PMunch commented 6 years ago

Or at least have a different error message when errno != EWOULDBLOCK

Winael commented 6 years ago

Ok I did some test.

So let's me explain. I had to install xlunch with sudo. And the only way that I can run xlunch it's with sudo. So it seems that there's some rights management issue somewhere

Cheers

PMunch commented 6 years ago

Well, installing with sudo is normal. You don't have the correct permissions to create files in the directories were xlunch installs with normal user privileges. However it will allow the program to be run as a regular user. It might be possible though that you've run xlunch once with sudo, which has created a lock file owned by root without the proper permissions. So try to run sudo rm /tmp/xlunch.lock and then start xlunch again without sudo.

Tomas-M commented 6 years ago

Closing since it looks like resolved. I do not feel the need to distribute our own snap package.