nwjs How to distribute app on linux? - linux

I'm using nwjs 0.14.7, and ubuntu 32bit.
I recently updated from 0.12.2, and now the build process seems to be different or doesn't work.
I've added my files to package.nw and then appended to nw via:
cat nw app.nw > app && chmod +x app
Then in the docs it says "On Linux, you need to create proper .desktop file."
But there aren't any directions specific for this case, If I try running nw, it says "There is no application installed for "shared library" files. Do you want to search for an application to open this file?"
So I'm assuming the .desktop file would fix this? It says you can create it via a text editor, but I have no idea what I should put inside it. For 0.12.2 the .desktop step wasn't necessary so I'm a bit lost now.

I know I am using ubuntu 14.04 and what I did worked for me so this is how I did it.
Create a .desktop file for your app by:
1.press right click on mouse then 'New Document => Empty Document'.
2.inside the document insert the following text:
[Desktop Entry]
Version=1.0 (this is the version of the .desktop file and not your app version)
Type=Application
Terminal=false
Exec=/home/artechs/projects/copa-linux-x64/nw (this is the full path for the executable file)
Name=copa (this will show up on the menu)
Comment=secure sharing files application (this will show up if you right click on the app)
Icon=/home/artechs/projects/copa-linux-x64/package.nw/app/styles/COPA LOGO RGB-01.png (for the icon of this file and also the icon that will show up on the share applications)
Categories=Utility;Application;
3.press on the menu bar 'File => Save As...' and give it a name with .desktop extension for example copa.desktop
4.go to Terminal and to your app folder where this file is located and type: chmod +x <nameOFDesktopFile>.desktop
5.now you need to copy this file to share applications folder by type: cp <nameOFDesktopFile>.desktop /usr/share/applications
After doing this steps I could run my app through this desktop file or through the search by searching the name of my app.
Hope it will work for you as it worked for me.

Related

Windows Folder Shortcut of an Electron App - get the path of that folder?

TL;DR
I want to open my Electron App through a Windows Folder Shortcut (right-click on any folder and click Run In My Electron App), and get the folder path that initiated the app.
I managed to create the shortcut using windows Registry, but I can't find a way to get the path of the folder that initiated the app. (in the shortcut, "Temporary")
So in the above shortcut, the goal is to know the path of F:\ePC\Libraries\Videos\Loom\Temporary inside the electron app. (and the path should always be matching the folder that initiated the app).
A real-world working example: Just like when using WinRAR, you can right-click on a folder and click "Add to archive..." - the WinRAR app knows the path of the folder that has been right-clicked on. (Kind of like "open file with", but "open folder with").
Another real-world example that works with Electron is Visual Studio Code, you can right-click on a folder and click "Open With Code". How did they do that?
My Attempt
I tried to look over the documentation of Electron but only found a way to get the path of the EXE file, but not the folder that excecated that file using the Windows folder shortcut.
I tried also process.argv but it gives me the path of the exe file, and not the initiating folder.
Steps to reproduce the my attempt and test it yourself:
Get the repository and clone it. (It only has 3 files: index.js, index.html and package.json).
Open that folder in the command line and run npm install
Export the electron app by running npm run package-win. this should export the exe file to [relative app path]/rlease-builds/windows-folder-electron-shortcut-win32-ia32/windows-folder-electron-shortcut.exe.
To add the windows shortcut for the app: In the windows, registry create this:
HKEY_CLASSES_ROOT\Folder\shell\Run In My Electron App\command
Here's a step by step:
4 a. Open "Registry Editor" in Windows.
4 b. Head over to HKEY_CLASSES_ROOT\Folder\shell and create a new folder called "Run In My Electron App"
4 c. Inside the created folder, create command folder.
4 d. Double click on the default value and change it to the full path of the exe file.
(In my case the default value is: C:\Users\elron\apps\windows-folder-electron-shortcut\rlease-builds\Paste Folder Icon-win32-ia32\Paste Folder Icon.exe. Make sure that the path is YOUR path of .exe file of the exported app.)
When done with step 4, It should look something like this:
Result:
When running the app through a folder shortcut, it will give you the path of the EXE as expected, but not the path that initiated the app as shown in this screenshot:
And now you can test it.
Any help will be appreciated!
In the registry add this to your command value:
"C:\Users\elron\apps\windows-folder-electron-shortcut\rlease-builds\Paste Folder Icon-win32-ia32\Paste Folder Icon.exe" "%1"
The "%1" will pass the initiating directory to your electron application.
You can extract the directory path in your electron application like this:
const exePath = process.argv[0];
const folderPath = process.argv[1];

how to move workspace(a simple project) from windows file system (/mnt/) to linux (~/home)

I am developing a Django project (nothing) and trying to use using WSL2.
so if I use the Ubuntu Terminal from Windows to create a project and try running it in VScode, I got this little message,
I just don't know how to do that at all,
it's the first time I tried to use WSL2 (which is awesome), if someone could help, thank you very much.
If you have your project in some mounted folder -> linux path starting with /mnt/ e.g.
/mnt/c/Users/rasto/Desktop/some_folder/my_project/
When you open VS Code in this directory (via running command code . or opening the VS Code from windows) you get the warning:
This workspace is on the Windows file system (/mnt/). For best performance, we recommend moving the workspace to the Linux file system (~/home).
The solution is easy -> move/copy the project folder to ~/my_project/ directory:
In WSL terminal:
Recursively copy all files from source-path to destination-path and if the folder ~/my_project/ does not exists, it will be created
cp -R /mnt/c/Users/rasto/Desktop/some_folder/my_project/ ~/my_project
Move to the directory in your terminal
cd ~/my_project
And open VS Code from console with
code .
Note: To open VS Code from terminal you must have installe extension Remote Development extension pack
Note2: To access the linux folder from windows file explorer just right click in VS Code explorer and Reveal in explorer or with the path like: \\wsl$\Ubuntu-18.04\home\rasto\my_projects

Can Gnome Builder actually produce something else than flatpaks?

I can't seem to find any documentation as to how to configure builds to produce something else than the pre-configured flatpaks. Duplicating build configurations and changing the settings doesn't seem to give me the option to produce anything else than flatpaks. Changing the application runtime to "Host System" produces only flatpaks as well. I can't even find the preliminary binaries that seem to be produced somewhere before they're packaged. What am I doing wrong?
For reference, I am using Builder 3.36. My assumption based on your post is you're looking only for your application binary, and not a way to build some other package like .deb or .rpm.
There are a few ways you can do this.
Method 1: From your Flatpak build's directory
Click the omnibar and click "build", not "Export Bundle". When it's completed, click the "View build console contents" button from the same omnibar drop down where the "Export Bundle" button is.
Look at the last lines of output in the terminal for the "flatpak build" command. Look for the "build-dir" parameter passed to this command.
The path will be something like "~/.cache/gnome-builder/projects/AppName/builds/org.your.App.json-flatpak-org.gnome.Platform-x86_64-3.34-unversioned"
Go into this directory. It will have a subdirectory "src" which has your app.
Method 2: Change build configuration
If you click the "Switch Surface" button in the top left and go to "Build Configurations" you should see two configurations created for you by default (if you created the project through Builder). Builder defaults to your JSON file which builds Flatpaks.
Click the "Default" configuration, then click "Make Active" under "Overview". Then you can build the app as normal (e.g. with the omnibar at the top). Once it says "Build succeeded" the binary has been built.
But where? Look for the path listed in the "Overview" for the "Default" configuration -- under "Install Prefix". This will be something like "/home/user/.cache/gnome-builder/install/AppName/host"
In there is a "bin" directory with your app.
Method 3 (Preferred): Build using ninja
From the Editor surface, press CTRL+SHIFT+ALT+T to open a terminal inside Builder, which defaults to your $BUILDDIR
In the terminal that's open, simply type "ninja". If it says "ninja: no work to do." your app is already built and up to date. You can type "ninja clean" and then "ninja" if you want to do a fresh rebuild.
Inside this directory, (something like "~/.cache/gnome-builder/projects/AppName/builds/default-host-unversioned") there will be a "src" directory which is where the app is built.
Running your app
You may not be able to double click this from a file manager, so open the directory in a terminal and type "./appname" to run the app.
In addition to wappa's answer, for GNOME Builder 43, the file system is ~/.var/app/org.gnome.Builder/cache/gnome-builder/projects/<your-project-name>. The default build directory is builds/<your-application-id>.json-flatpak-org.gnome.Platform-43-x86_64-main under the file system; you can find object files, executable files, Meson and Ninja files including build.ninja, etc. here.
Besides, you can find the output Flatpak files at flatpak/staging/x86_64-main under the file system. To export a Flatpak bundle, you can click the down arrow on the top bar and click "export". The exported Flatpak bundle is at this directory. The executable binary file is under files/bin. You can also find application data, icons, font configurations, etc., under the files directory.
To configure the location, you can still click the down arrow on the top bar and click "Configure Project...". On the "Overview" page, you can view which configuration you are using currently, corresponding to the configuration options on the sidebar: "Default" (~/.var/app/org.gnome.Builder/cache/gnome-builder/install/<your-project-name>/host) and <your-application-id>.json. By default, the latter one is selected, whose installation prefix is /app. If you look at the Build Output, you can observe that the desktop file, source files, GSchema XML, AppData XML, Icons, etc., are installed into /app. The /app is the path in Flatpak's sandbox filesystem rather than the path in the main filesystem of your Linux OS.
If you want to avoid using Flatpak, you can go to the build directory and manually build by Meson and Ninja.

TYPO3 Dumy package does not show installation screen

I am trying to install the Dummy package to my laptop.
I have installed WAMP and i have placed the dummy package into the WWW directory.
However when i go to my Localhost from WAMP and click on the dummy page, instead of showing me the installation screen it shows my the directory index.
to create ENABLE_INSTALL_TOOL just use command line
win+r -> type cmd -> navigate to directory -> type: echo > ENABLE_INSTALL_TOOL
Dummy package has no sources inside, you can see, there's no even index.php file.
Use Source + Dummy which will give you an empty TYPO3 system or even better Introduction Package for learning purposes - working and containing lot of samples.
To create ENABLE_INSTALL_TOOL make sure that your system displays files' names with extension ie: open with the Windows Explorer folder where you unziped the package and make sure that it can see filenames as INSTALL.txt (not only INSTALL) if it doesn't you need to search in options of Windows Explorer...)
Then go to folder typo3conf and create just common, empty file ENABLE_INSTALL_TOOL.txt and finally chane it's name and remove .txt extension.
TYPOe install tool will be satisfied.

php-gtk2 installation on windows 7

i have downloaded the second link as shown , unzipped it. copied everything from php folder of my xampp installation into this php-gtk folder. im trying to run php-gtk sample helloworld.php program from the command prompt by typing drive\php-gtk2\helloworld.php. i have renamed php (application file) to php-gtk in this folder. It opens up test file in text editor but doesn't run it.
How to install and run program in php-gtk.Any help. Thx in advance
After downloading php-gtk, extract everything in a folder, let's say php-gtk, put that folder in any drive of your choice, then open php files with gtk code by
right click on the file
open with
browse to the folder php-gtk(in the drive u saved)
then select php.exe or php-win.exe
also you can run the program from command line by typing
cd C:\php-gtk
php YOUR_FILE_NAME.php

Resources