I've built an electron app which is only executable if I directly execute the file (double click or via Terminal) locates at MyApp.app/Contents/MacOs/MyApp.
When I click the app MyApp.app directly via Finder electron window appears but only with an empty window. The backend isn't starting and so no frotend appears. The dificult thing here actually is that there isn't any logging/error message(s) that help me to understand whats not working here.
The App is built using this command:
electron-packager --asar . MyApp --ignore='^/build' --platform=darwin --arch=x64 --overwrite
Inside the electron app (simplified) I start an express server beside the main electron process:
// The express application
require(path.join(__dirname + "/bundle/dist/server"));
// Standard electron scaffolding
const createWindow = () => {
const win = new BrowserWindow({
width: 800,
height: 600,
webPreferences: {
preload: path.join(__dirname, "scripts/preload.js"),
},
});
setTimeout(() => {
win.loadURL("http://localhost:1234");
}, 1000);
};
Can someone maybe give me an advice why it's only starting when going the way via Package content and not directly by clicking the app icon?
Related
I've been struggling with this for a while and still didn't find any good solution.
I am developing a Windows full-screen (kiosk) app and I need to have a modal window for a password to exit the app. I did the modal window and the functionality, but the problem is now that when the modal appears, the main window exits the full-screen and shows the Windows (OS) task-bar with both windows (main and modal).
One way to do fix this is force the app to become the Windows shell instead of Explorer.
I tried to do it by changing the reg. key HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon to my app exe file, but it doesn't work. When I restart, it still opens the explorer shell.
I also tried to edit the same Shell key in the HKEY_LOCAL_MACHINE\..., but that one requires you to run as Admin, which is another trouble cause I could not make Electron write that reg. key as admin.
Note: the code I use to open the main window is:
mainWindow = new BrowserWindow({
width: 800,
height: 600,
fullscreen: true,
frame: false,
autoHideMenuBar: true,
kiosk: true,
skipTaskbar: true,
webPreferences: {
preload: path.join(__dirname, 'preload.js'),
nodeIntegration: false,
devTools: true
}
})
So, does anyone please have any idea about how to:
- Either make the main app stay full-screen all the time, or...
- Make the "Shell" registry key be properly enabled and keep the value of the app.
Thank you very much for everyone's time and help!
You can include the code like this:
win.removeMenu();
or
win.setMenu(null);
where,
win is the instance of the created browser window forexample,
let win = new BrowserWindow(options:{
width: 1200,
height: 800,
icon: 'path/to/icon'
})
add the autoHideMenuBar: true key-value pair to your win definition:
win = new BrowserWindow({
width: 1250,
height: 660,
autoHideMenuBar: true,
icon: getAssetPath('icon.png'),
});
None of the already given answers are correct. You have to set the window as always on top with a maximum possible level, combined with fullscreen to achieve this.
mainWindow.setAlwaysOnTop(true, 'screen-saver');
The screen-saver level will make sure that the taskbar won't appear in-front of the the fullscreen window. Unfortunately you can't set the level in BrowserWindow configuration. Read more about this in the documentation.
This works for me. mainWindow.setFullScreen(true)
I have created an app in nw.js & it is running fine.
I have a requirement that I create a button in nwjs app (html page), and its click should open another .exe file in the user system(probably in the same directory along with nwjs.exe).
Can I do that and how?
Thanks
var exec = require('child_process').execFile;
exec('C:/asd/test.exe', function(err, data) {
console.log(err)
console.log(data.toString());
});
I have a PowerPoint content app that runs well in the desktop version of PowerPoint 2013 and 2016, but in PowerPoint Online it crashes (I believe) sometime during the execution of Office.context.document.settings.saveAsync() with this error:
I've traced it through this code:
var saveSelected = function (selected) {
if (Office.context && Office.context.document) {
Office.context.document.settings.set("selected", selected);
Office.context.document.settings.saveAsync();
}
else {
localStorage.setItem("selected", JSON.stringify(selected));
}
}
and can see the code run through this block as well as pop out of it to the parent function and finish execution, but a moment later it crashes and on a reload the setting hasn't been saved, so I'm assuming the crash happens somewhere inside the asynchronous save. The data I'm trying to save is an object that looks something like this:
{
siteUrl: "https://modtenant160315b.sharepoint.com",
type: "chart",
url:"/drives('b%21H9_EgioNdUWL9Etpw0KgzkCIo4W1XPBCt7YkrAyP0lx8OUvBlEQvQ52j2Fg2P-a0')/items('01DLGLVOTPCNS67WMCPBG22JL3VR4SOUWE')/workbook/worksheets(%27%7B00000000-0001-0000-0400-000000000000%7D%27)/charts(%27%7B00000000-0008-0000-0400-000002000000%7D%27)"
}
Any thoughts?
edit: I just added this to my app's landing page and it also causes the crash in PPT online, so it doesn't seem to take much:
Office.context.document.settings.set("dummySetting", "this is my setting");
Office.context.document.settings.saveAsync(function () {
var x = Office.context.document.settings.get("dummySetting");
$scope.sharepointUrl = x;
});
Turns out it was due to an outdated Office.js file. Switching from a local version to a hosted copy resolved the crash.
I am trying to supply a path, and open it with the "native open with" dialog of linux.
This is the native open with dialog seen on ubuntu:
I looked into GioLaunch and am able to launch things into their default application handler, but i cant manage to launch it into this "Open With" dialog.
This is my code for launching into default app:
var launcher = g_desktop_app_info_new_from_filename('blah blah blah');
var error = new TYPES.GError.ptr();
var rez_launch_uris = g_app_info_launch_uris(launcher.address(), null, null, error.address())
Xamarin Noob
Xamarin.Forms Noob
I am all hooked up. Business license on iOS and Android and developing from VS 2013.
I created the initial sample from the Xamarin Intro to Forms.
I 'Start'ed the app and it ran fine on my Mac. I saw the 'Hello, Forms !' label in the running app in the iOS simulator on my Mac Build Machine.
I then replaced the following code in my App.cs
public static Page GetMainPage()
{
return new ContentPage
{
Content = new Label
{
Text = "Hello, Forms !",
VerticalOptions = LayoutOptions.CenterAndExpand,
HorizontalOptions = LayoutOptions.CenterAndExpand,
},
};
}
with:
public static Page GetMainPage()
{
return new ContentPage()
{
Content = new StackLayout
{
Spacing = 10,
Children =
{
new Label
{
Text = "Stop",
BackgroundColor = Color.Red,
Font = Font.SystemFontOfSize(20)
},
new Label
{
Text = "Slow down",
BackgroundColor = Color.Yellow,
Font = Font.SystemFontOfSize(20)
},
new Label
{
Text = "Go",
BackgroundColor = Color.Green,
Font = Font.SystemFontOfSize(20)
}
}
}
};
}
That's all I did, but now the app will not run in the simulator - it always exists as soon as it starts...
I put the original code back again, and it still doesn't start.
I always see (in My VS 12013 Mac Server Log)
[10-Nov-2014 15:43:32] Request handled in 4.129ms
[10-Nov-2014 15:43:37] Request handled in 3.728ms
[10-Nov-2014 15:43:40] stdout: Starting iPhone 5s
Launching application
Application launched. PID = 2872
Press enter to terminate the application
>
Application Terminated
[10-Nov-2014 15:43:42] Request handled in 3.898ms
[10-Nov-2014 15:43:48] Request handled in 4.031ms
etc....
I have exited both the iOS simulator and VS 2013, paired them again, all to no avail...
What could possibly be wrong?
EDIT
Infact, when the app becomes visible in the simulators view of icons, clicking it brings up the original version of "Hello, Forms!" - so my new code is never deployed to the simulator...
EDIT 2
Ok, I got the new content moving and got it running:
I had to manually "Reset content on device" in the iOS simulator on the Mac.
I also had to manually clean each project in VS 2013 - just rebuilding the solution doesn't do anything to the content being sent to the Mac iOS simulator server, I guess.
I hope this helps someone as new as I am.
Try removing "." from your app's name in Info.plist file.
After fiddling..
The way to fix this is to change the build config on the solution.
In a fresh Xamarin.Forms solution in Visual Studio, you might have:
Solution 'MyXFormsSample' (3 projects)
v MyXFormsSample (Portable)
> Properties
> References
> App.cs
packages.config
> MyXFormsSample.Android
> MyXFormsSample.iOS
It seems that by default, in the solution's Configuration Manager's build configuration, the portable code project is not set to build for the iPhoneSimulator platform
I clicked that on for the debug, and also release, solution configurations, and still I had to Reset Content on the Mac's iOS simulator before debugging, then all I had to do was press the green 'Start' button in the menu - all was updated and released to the Mac Build server's iOS Simulator.