Open probonopd opened 8 years ago
Can you post a hello world with fltk? Could it be used to be embedded right into runtime.c even?
Here's a very simple dialog tool using fltk: https://gist.github.com/darealshinji/74985e3474574fc2bee456555a27b517 Note: fltk uses C++
Runtime dependencies in this case are:
libX11.so.6
libXext.so.6
libpthread.so.0
libXinerama.so.1
libXfixes.so.3
libXcursor.so.1
libXft.so.2
libXrender.so.1
libfontconfig.so.1
libdl.so.2
libstdc++.so.6
libm.so.6
libgcc_s.so.1
libc.so.6
Thanks for the example, look and feel is a bit non-native, still wondering if there are no more straightforward native solutions.
The problem here is KDE. Qt dialogs have a native look and feel to KDE but not to other environments, and they may not even run unless Qt libraries are already installed. GTK+ on the other side may look really ugly on KDE. The solution would be either to write two dialog tools and figure out at runtime whether we're on KDE or not, or you can use a toolkit like FTLK which is small, portable and requires only X11 libs.
edit:
Maybe this looks better:
Usage: ./appimage_dialog --message="Do you want to install desktop integration?" --title="Desktop Integration" --button1="Yes" --button2="No"
Code: https://gist.github.com/darealshinji/fe1845d4c90d62eee92c6bcf2860d2c3
Thanks @darealshinji. Much better, but still not really "native" looking. I need to play with it a bit under different Gtk+/KDE themes.
Looks very similar to https://en.wikipedia.org/wiki/Zenity but I've no idea how well Zenity performs / looks on different desktop environments.
EDIT: Doh! I must have been thinking of a different project. I forgot AppImages use zenity already, apologies for the noise ;-)
A little update: https://gist.github.com/darealshinji/fe1845d4c90d62eee92c6bcf2860d2c3
I hope this looks better. Options are:
--title=TITLE
--message=MESSAGE
--button1=LABEL
--button2=LABEL
Use only --button2
if you want just 1 button.
By the way, unless you use the native toolkit (Qt4, Qt5, GTK2, GTK3) it will never look 100% native.
What about a radio button list, so you would only need 1 window to pop up?
Though I must admit that all solutions have a "lot of" text, which may be an issue for people that are not good in English. Maybe a combination of short, clear hints and pictograms could do it.
Perhaps:
Do you want to...
3 buttons: [Never] [No] [Yes]
Here's my new draft, including an attempt to do some localization.
Usage is ./appimage_dialog AppName
What about this? Can be set via command line to either use the system colors or the blue from the AppImage icon. Icons are LGPL licensed. And the red button actually drops down when you press it.
Wow, looks impressive. I'd use the system color version but without the red X.
The second entry should be "Create menu entry and launch app".
Should I change the close button or should the window just use the window manager decoration instead? (you can actually drag the window by clicking on the background)
I'd say window manager decoration
Yeah, I'd say so too. I've attached the sources and the tool. First argument will be the window title, otherwise it defaults to "AppImage". Return values are: launch app -> 0, menu entry -> 1, disable message + launch app -> 2, close window -> 3.
I've added localization support: https://gist.github.com/darealshinji/fe1845d4c90d62eee92c6bcf2860d2c3#file-appimage_dialog-cpp-L66
Here are all source and images files, licenses and a build script: https://github.com/darealshinji/AppImageKit/tree/appimage-dialog
Thank you. Would you like to add the logic from the old desktopintegration
bash script?
I haven't tested it but I think this should work: https://gist.github.com/darealshinji/25cce18c4a8d6c9baae86f214de9c923#file-desktopintegration-sh-L203
Scroll down the revisions if you want to see the important changes: https://gist.github.com/darealshinji/25cce18c4a8d6c9baae86f214de9c923/revisions
Source files and build script added to AppImageKit: https://github.com/darealshinji/AppImageKit/tree/appimagetool_master_fltk I could make a PR if you want.
https://github.com/probonopd/AppImageKit/commit/b313884d56e5eeea17ffcf8ef51dc7316bdca317#commitcomment-19587596