Desktop file for Flatpak app - flatpak

I have created a Flatpak app but I don't know how to specify icons and launcher information for my package.
The application has a desktop file but get this error message:
"Not exporting share/applications/myapp.desktop, wrong prefix"
The file is located in myapp/files/share/applications/myapp.desktop
Please help

The desktop file needs to be installed to:
/app/share/applications/<appid>.desktop
and the icon file to:
/app/share/icons/hicolor/<size>/apps/<appid>.<png|svg>
where your appid will be something like "com.example.myapp"
See http://docs.flatpak.org/en/latest/conventions.html
Note that the value for the "Exec" parameter in the desktop file should be the same as the "command" parameter in the flatpak manifest. The example given in the documentation is confusing because the name of the executable is the same as the appid, and if your executable is named differently you need to pick that instead. e.g. if your appid is "com.example.myapp" and your binary is just "myapp", you need "Exec=myapp" or even "Exec=/app/bin/myapp", not "Exec=com.example.myapp".
One last thing, if the desktop file appears to get installed, but nothing shows up in your program menu, it may be because your desktop environment needs you to log out and log back in again. See: https://ask.fedoraproject.org/en/question/128735/xfce-menu-doesnt-show-flatpak-apps/

Desktop file and icons should be stored in myapp/export instead of myapp/files.

The desktop launchers seem to be located in:
var/lib/flatpak/app//current/active/export/share/applications
You should copy the launcher to the Desktop,right click, Allow Launching.

Related

To Determine if a .exe file is an setup file

I need to write a c/c++/kernel driver program where I can check if an .exe file is an Setup file where I can install new application in my computer (Like an .MSI file) or an normal application (For Example: If I Open an .exe file which is named as chorme.exe then it is an normal window application which only opens chrome browser , but if I Open an .exe file which is chromeinstaller.exe it is an installer which installs chrome browser in my computer).
Is there any way to determine if it's a setup file or just a application.
Microsoft itself tried to solve this with "Installer Detection" , and from their solution it becomes obvious that there is no hard solution. They look for:
Filename includes keywords like "install," "setup," "update," etc.
Keywords in the following Versioning Resource fields: Vendor, Company Name, Product Name, File Description, Original Filename, Internal Name, and Export Name.
Keywords in the side-by-side manifest embedded in the executable.
Keywords in specific StringTable entries linked in the executable.
Key attributes in the RC data linked in the executable.
Targeted sequences of bytes within the executable.
We can safely assume they're doing this because there is no ready-made solution.

Open Public Documents folder in Windows Explorer

I have the following file I need to open in a windows explorer window
C:\Users\Public\Documents\folder1\test.txt
So far opening this file using the above path is fine and I can read it as usual.
However when trying to open this this folder through Windows Explorer using wxExecute((wxChar **)cmd, wxEXEC_ASYNC, NULL); where cmd is the above path(minus the file), It opens to my user documents.
I've tried various Windows API functions to get the path, some including where Public Documents has it's own ID and these still generate the path I already have. Are there any CLI options I can give to Windows Explorer so that it can actually open Public Documents without reverting to my User Documents folder?
First of all, why do you cast your string to wxChar**? This just can't be right.
Second, you should be using wxLaunchDefaultApplication() instead of "raw" wxExecute() in the first place (FWIW wxLaunchDefaultApplication() is a straightforward wrapper for ShellExecute() under MSW, while wxExecute() is much more complicated).
It's undocumented, but has worked across multiple windows Versions since at least XP with the following command line:
explorer.exe /select,"path-to-open"
Note the comma, and make sure the path is quoted. The path may include a file name, in which case that file gets selected.
(With Windows 10, it's actually a good idea to use a file name, since otherwise the parent folder is opened with the specified sub folder selected)
Should be the same with CreateProcess, ShellExecute, or system(), or whatever comfort wxWidgets offer.
Actually turned out to be an issue with wxExec from wxWidgets. Converting the command to a ShellExecute opened it up just fine. Potentially Widgets 2.9.5 can't handle Windows 10's pseudo folders and weirdness?.

How to get .exe program into startup by c++

At first I must say: IT IS NOT KEYLOGER OR ANOTHER VIRUS, I just writing a program to automize some actions on my computer. I know that I must change registry with IsMyProgramRegisteredForStartup(PCWSTR pszAppName) or RegOpenKey with RegSetValueEx, or something like this, but I actually don't know how to use it,
so please can someone help me with this problem or someone know another way to get it into startup.
All information that I can say that I on Windows 10, and for example I need to get someprogram.exe get into StartUp by c++ program
First, why do you have to set exe file as startup using C++ code? You can just create shortcut of your exe file. Copy that shortcut to this directory
Easiest way : press win+R and type shell:startup. It will open the startup directory right away
Or input the path manually:
For all users: C:\ProgramData\Microsoft\Windows\Start
Menu\Programs\StartUp
For current users:
C:\Users[Username]\AppData\Roaming\Microsoft\Windows\Start
Menu\Programs\Startup
After restart the windows and login, your exe file will automatically run. Plus you can check whether your exe file is already registered as startup program using task manager -> startup.

Make a Qt/C++ program show its file types as known on Windows

Using Qt 5.9 I codded a spreadsheet program and then created an installer for it by Qt Installer Framework (QtIFW2.0.1). Then I sent the program to many of my friends. They installed the app on their Windows machine and now using it, but they have all have a common problem:
when they save files of the app, those files are shown as "unknown" files on Desktop.
The problem is only with the shape and appearance of the stored files not their functionality, and they are opened by the app if double clicked.
The question is, what changes in the code is needed to have the program make its files' shape/appearance shown known?
For example, we offer the code a specific shape using an image file or like that, to be mapped on the stored files and that way they are shown known.
This has actually nothing to do with Qt or C++ itself. You just need to register your file extension in Windows shell, so it can be understood by other Windows components/shells.
Here is general information about File Types and File Associations under windows.
You need to make some Windows Registry entries which look like this:
example.reg:
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Classes\myfirm.myapp.v1\shell\open\command]
#="c:\path\to\your\app.exe \"%1\""
[HKEY_CURRENT_USER\Software\Classes\.myextension]
#="myfirm.myapp.v1"
Here you can read how it works in general
change myfirm.myapp.v1, .myextension and path to your .exe to your prefered names.
Now Windows will know what the files with extension .myextension should be opened by your app. And if you double click on this files your app will be run with path to file as an argument. You can get it in your main() function
To set icon for your extension add Registry entry in Software\\Classes\\.myextension\\DefaultIcon and set it default value to the full path to your app, so windows can get an icon for extension from your .exe app file.
You can also do it at runtime directly in your app:
QSettings s("HKEY_CURRENT_USER\\SOFTWARE\\CLASSES", QSettings::NativeFormat);
QString path = QDir::toNativeSeparators(qApp->applicationFilePath());
s.setValue(".myextension/DefaultIcon/.", path);
s.setValue(".myextension/.","myfirm.myapp.v1");
s.setValue("myfirm.myapp.v1/shell/open/command/.", QStringLiteral("\"%1\"").arg(path) + " \"%1\"");
EDIT: One more, to do it with Qt Installer look at the answers here

Errors I face at the final step of creating an installer for my Qt app

EDITED:
Hi all,
I used the Qt Documentations for creating an installer for my Qt app using Qt Installer Framework.
I think I'm at the final step. Please have a look at the issue:
I have a package_directory folder on my Windows Desktop with these sub-folders. The config.xml file contains this. The data subfolder contains the data.7z file. I then created a licens.txt file on my Desktop. The meta subfolder contains a package.xml file with this content.
Then I created a folder named Result on my Desktop and pasted the Cal.exe file from the Release folder onto it.
And finally Ran the following command:
C:\Qt\QtIFW2.0.3\bin\binarycreator.exe -c C:\Users\CS\Desktop\package_directory\config\config.xml -p C:\Users\CS\Desktop\package_directory\packages C:\Users\CS\Desktop\Result\Cal.exe
The installer was created in the Result folder. But I got the following message from the command line:
Warning: The <Name> tag in the 'C:/Users/CS/Desktop/package_directory/packag
es/com.vendor.product/meta/package.xml' is ignored - the installer uses the path
element right before the 'meta' ('com.vendor.product').
C:\Qt\QtIFW2.0.3\bin>
Should I ignore it? If not how to solve it, too, please?
The installer file exists in the Result folder on Desktop. When I install it and select a folder on Start Menu (say Accessories or Start Up) to have the shortcut of the program, no shortcut will be created or saved there!! :(
What is the reason for that problem and how should I solve it please?