AppImageCommunity / pkg2appimage

Tool and recipes to convert existing deb packages to AppImage
http://appimage.org
MIT License
699 stars 216 forks source link

[desktopintegration] kdialog error? #116

Open probonopd opened 8 years ago

probonopd commented 8 years ago

https://github.com/probonopd/AppImageKit/commit/b313884d56e5eeea17ffcf8ef51dc7316bdca317#commitcomment-19587596

darealshinji commented 8 years ago

What about adding your own copy of a dialog program? YAD is lightweight, portable and depends only on GTK2 libs. Or I could try to write something using fltk, similar to what I've been working on here. fltk is very small and made for static linking.

probonopd commented 8 years ago

Can you post a hello world with fltk? Could it be used to be embedded right into runtime.c even?

darealshinji commented 8 years ago

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

spectacle v31852

probonopd commented 8 years ago

Thanks for the example, look and feel is a bit non-native, still wondering if there are no more straightforward native solutions.

darealshinji commented 7 years ago

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:

shot

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

probonopd commented 7 years ago

Thanks @darealshinji. Much better, but still not really "native" looking. I need to play with it a bit under different Gtk+/KDE themes.

lurch commented 7 years ago

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 ;-)

darealshinji commented 7 years ago

A little update: https://gist.github.com/darealshinji/fe1845d4c90d62eee92c6bcf2860d2c3

shot

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.

darealshinji commented 7 years ago

What about a radio button list, so you would only need 1 window to pop up?

list

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.

probonopd commented 7 years ago

Perhaps:

Do you want to...

3 buttons: [Never] [No] [Yes]

darealshinji commented 7 years ago

Here's my new draft, including an attempt to do some localization. Usage is ./appimage_dialog AppName

source

dlg

darealshinji commented 7 years ago

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.

dialog

probonopd commented 7 years ago

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".

darealshinji commented 7 years ago

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)

probonopd commented 7 years ago

I'd say window manager decoration

darealshinji commented 7 years ago

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.

appimage-dialog.zip

darealshinji commented 7 years ago

I've added localization support: https://gist.github.com/darealshinji/fe1845d4c90d62eee92c6bcf2860d2c3#file-appimage_dialog-cpp-L66

darealshinji commented 7 years ago

Here are all source and images files, licenses and a build script: https://github.com/darealshinji/AppImageKit/tree/appimage-dialog

probonopd commented 7 years ago

Thank you. Would you like to add the logic from the old desktopintegration bash script?

darealshinji commented 7 years ago

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

darealshinji commented 7 years ago

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.