Suppress GUI Mode in install4j for Linux Installer While Allowing GUI Mode for Windows Installer - install4j

We are using install4j to generate a Windows and a Linux installer for our application. We would like our users to use the GUI mode for installations on Windows and the console mode for installations on Linux.
This works by passing the -c parameter to the installer, I know. But I would also like to suppress the usage of the GUI mode for Linux. Similarly to the "Disable console mode on Windows" option in the installer settings. Is there something I did not see, that enables this behavior?
If there is no option to suppress this, we will add an action to the installer to quit if it was started from Linux and is in GUI mode.

As of install4j 8.0.8 there is no way to prohibit the GUI mode, you would indeed have to add a "Run script" action with the script
!(Util.isLinux() && context.isGui())
and set its "Failure strategy" property to "Quit on Failure" and its "Error message" property to "GUI mode not allowed" or something similar.
There is also a "Default execution mode" property on the Installer, you can right-click it, select "Switch to text mode" from the context menu and set the text field to
${compiler:executionMode}
Then, define a compiler variable on "General Settings->Compiler Variables" named "executionMode" with the value "GUI". In the media wizard of the Linux media file, go to the "Customize project defaults->Compiler Variables" step and override the "executionMode" compiler variable with the value "CONSOLE".
Then your users do not have to pass -c as the argument on Linux.
Update: As of 8.0.8 there is a bug in install4j that prevents the replacement of compiler variables for this property. It will be fixed in 8.0.9.

Related

Should debugger be launched always in VScode when only running a file (not debugging) using code-runner?

In a VScode C/C++ programming setup on Windows 10 system, the "C/C++ Extension Pack", "Code Runner", "WSL" extensions are installed, which use Alpine Linux target on WSL on this PC. Alpine Linux WSL instance has the gcc dev environment, build-tools, gdb etc. installed, apart from the necessary VScode extensions needed inside WSL.
In this environment I am able to write C/C++ programs, build them, execute them, interact with them through the built-in terminal. I use the "Code Runner" "Run C/C++ file" shortcut button to build(if necessary) and run individual C/C++ program files (there is no Makefile and these are simple programs all thrown in a single folder, not in a project structure).
Recently however, I noticed that whenever I try to "Run C/C++ file", debugger is also launched and I get a screen like this (notice the 2 yellow/orange arrows indicating what I am trying to draw attention to):
I do not remember this being the case earlier, but I think this started after I tried to debug a program by setting a breakpoint, which I later cleared. I've also ensured that "Run > Remove All Breakpoints" is done, to make sure that there are absolutely no breakpoints. Therefore wondering if:
it is normal for debugger to get launched in this manner ?
if not, what exactly might have caused it ?
finally, what can I do to make sure that the debugger is not launched, when all I want to do is "Run" ?
In "Code Runner" settings file, I did not find anything that might control this behaviour, but then I am quite new to VScode so not sure if I am missing anything obvious.

How to automatically set environment variable for eclipse terminal view?

I use the terminal view in eclipse:
Every time I start the terminal I run a command to set an environment variable, e.g.
SET HTTPS_PROXY=***.**.***.***:****
I need this as a prerequisite to be able to download some python packages with the python package manager, e.g
pip install mesa
=> Is there a way to automatically run a "startup command" when the Eclipse terminal is opened?
I expected that there would be some Eclipse setting to configure the environment variables for the terminal or to specify some initialization script. However, I could not find such a setting.
I tried to set the proxy settings in eclipse.ini
-Dhttp.proxyHost=***.**.***.***
-Dhttp.proxyPort=****
-Dhttp.nonProxyHosts=localhost|127.0.0.1
However, that does not seem to influence the proxy for the terminal view.
(I actually use a portable version of eclipse with EclipseProtable and in EclipsePortable.ini I am already able to specify some extra paths that will be known when I open a terminal view, e.g.
AdditionalPaths=./App/WinPython/python-3.7.2.amd64;
Also see https://portableapps.com/node/32861 for informatino about EclipsePortable
However, I was not able to set envirionment variables in the ini file EclipsePortable.ini.
)
You can use your system environment variable.
In Windows search the "User Account" parameter.
It must show your current account, search for "Environment variable".
Now you can set all the variables you need and they will be used by default in any terminal in Eclipse (restart Eclipse if it was running).

Execute Powershell from File Explorer after installing VS Code

VS Code is trying to position itself as a new way to work with Powershell, and one of the changes it makes upon installation is to replace the File Explorer context menu option "Run with PowerShell" on .ps1 files with a new "Open with Code" option instead.
Is there a way to remove the "Open with Code" option and replace it with the old "Run with PowerShell" option? I assume this would involve the registry somehow but I don't know enough about the registry in general to do it safely.
Try this:
Save the following contents into a file "EnablePowerShellRightClickRun.reg", then right click - merge.
Then it doesn't matter which application you associate .ps1 files with - you still have "Run with Powershell" as a right click option.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\SystemFileAssociations\.ps1]
[HKEY_CLASSES_ROOT\SystemFileAssociations\.ps1\shell]
[HKEY_CLASSES_ROOT\SystemFileAssociations\.ps1\shell\RunPS]
#="Run with Powershell"
[HKEY_CLASSES_ROOT\SystemFileAssociations\.ps1\shell\RunPS\command]
#="\"C:\\Windows\\system32\\WindowsPowerShell\\v1.0\\powershell.exe\" -File \"%1\""
VS Code is not really positioning itself as the new way to work with PowerShell, it will be the only "built-in" way with Windows to work with it because the PowerShell ISE is being depreciated.
Either way, VS Code did not cause that option to disappear. I have VS Code and the PS extension on my machine and still have access to both options:
When you install VS Code you are prompted to add the right-click menu options, so if you opt'ed into those then it is not what removed your "Run with PowerShell" option.
If you want to remove those right-click options then you would have to uninstall VS Code and install it again, making sure those options are not checked.
To restore your menu option to Run with PowerShell verify you have not changed the default program for PowerShell files (e.g. ps1). If you set that to VS Code it will cause the option to be removed from your right-click menu. You can restore it by changing the default program in Windows back to Notepad.

Customize VSCode to use a console emulator instead of the command prompt

Can I customize VSCode to use a console emulator instead of the command prompt?
I want to use something like conemu, but don't want to use "force conemu as default terminal for console applications" setting in conemu.
It has a specific warning "enabling this option may cause false alarms in antiviral programs", and I'm on my work computer.
They have just implemented this feature:
https://github.com/Microsoft/vscode/pull/3495
You'll have the externalTerminal.windowsExec and externalTerminal.linuxExec user settings, where you can define what console emulator to use.
In my case, I'm on windows using conEmu. My user settings (settings.json) are configured like follows:
{
"externalTerminal.windowsExec": "conEmu64.exe"
}
EDIT: It's already available in the stable version.
I just wrote a simple extension that overrides key binding Ctrl/Cmd+Shift+C with command console.open defined by this extension.
https://marketplace.visualstudio.com/items/vilicvane.console
It's not working with "Open in Command Prompt" context menu item though.

C++ Eclipse: Debugging with optirun/primusrun on Linux

How can I debug my Program with optirun or primusrun? When simply running it, I can use the workaround of running primusrun with my program as parameter, but this does not work for debugging. I tried replacing "gdb" with "primusrun gdb" and starting eclipse with primusrun but it does not do anything.
You can start Eclipse under primusrun. gdb and the debbugged process will "inherit" this, thus running themselves on the discrete card.
Unfortunately, this means that Eclipse itself is also holding the card active, thereby increasing the power consumption.
Instead of having to start Eclipse using optirun, you can change the command used to launch GDB as follows:
Click on "Debug configurations..." on the Run menu.
Click on the launch configuration for your application.
Go to the Debugger tab.
Change the "GDB debugger" field to optirun gdb.
On my system (eclipse neon, Debian stretch), you have to put a absolute path to make this working (/usr/bin/optirun gdb).
For Run Configurations another solution is to set optirun (absolute path) as "C/C++ Application" and the name of your Application (e.g. "Debug/appName") as an Argument ("Arguments" Tab, "Program arguments").