Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Startup option in preferences (WIP) #837

Closed
wants to merge 1 commit into from
Closed

Startup option in preferences (WIP) #837

wants to merge 1 commit into from

Conversation

noamokman
Copy link
Contributor

Hi there,
This is about #835,
Still WIP,
Need to test and create startup on first boot or install.

Would love to help more along the way 😄
Thanks,
Noam

function install () {
var appPath = process.execPath

startup.add('webtorrent-desktop', appPath)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this work on Windows and OS X?

Copy link
Contributor Author

@noamokman noamokman Aug 26, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

waiting for typicode/user-startup#7 to land,
apparently all params are required.

@noamokman
Copy link
Contributor Author

@feross where do you think is a good place to have the initial startup installation?
The default value is true so we need to run startup.install at least once.

@noamokman
Copy link
Contributor Author

switched to use auto-launch due to better electron support

@noamokman
Copy link
Contributor Author

@grunjol thanks!
removed the .idea from the gitignore file

@feross
Copy link
Member

feross commented Aug 26, 2016

@dcposch do you have thoughts on this?
On Fri, Aug 26, 2016 at 9:48 AM Noam Okman [email protected] wrote:

@feross https://github.com/feross where do you think is a good place to
have the initial startup installation?
The default value is true so we need to run startup.install at least once.


You are receiving this because you were mentioned.

Reply to this email directly, view it on GitHub
#837 (comment),
or mute the thread
https://github.com/notifications/unsubscribe-auth/AAHbphwBvQkIYGQelERvTUjshk675RK6ks5qjvtigaJpZM4JtwA_
.

@@ -107,7 +107,8 @@ function setupSavedState (cb) {
downloadPath: config.DEFAULT_DOWNLOAD_PATH,
isFileHandler: false,
openExternalPlayer: false,
externalPlayerPath: null
externalPlayerPath: null,
startup: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Default should not be true IMHO

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not? There's a pref to disable

Looks like uTorrent not only starts automatically, but it re-enables that option after every auto-update (!) https://forum.utorrent.com/topic/92281-disable-utorrent-program-auto-start-as-default-setting/

Obv we don't want to do that---if someone turns off the pref, we'll respect it permanently---but I think auto start after they first install WebTorrent is fine.

Copy link
Contributor

@grunjol grunjol Aug 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me be clear, I'm not against create a startup feature, but do not force the user beforehand.

  • The application is not a daemon, so the user should indicate when start.
  • The user will be surprised with the first autostart (even more if its a updating user).
  • A lot of users care about their privacy, hence use VPNs, (manually started in most of the cases) so first autostart will be offensive.
  • Even in the forum post you mention, the users ask for the same expected behavior
    image

he is not complaining about not respecting user's preference but the default behavior.

@dcposch
Copy link
Contributor

dcposch commented Aug 27, 2016

LGTM! @noamokman thanks for doing this!

For future PRs that add new UI (in this case, new controls on the Prefs page), consider posting a screenshot. Github lets you just paste images directly into a PR, so on Windows you can open the prefs page -> Alt + PrintScr -> paste into Github

@noamokman
Copy link
Contributor Author

@dcposch cool! it looks something like that:
image

@noamokman
Copy link
Contributor Author

Hi everyone,
That's the remaining work:

  • test startup on all platforms
    • windows
    • linux
    • mac
  • disable feature on portable - should I hide hide the pref section ui or show it as disabled?
  • add migrations function to handle the startup value?
  • run install on app load (install checks if the auto launch is already enabled first so its safe to run it every single time.

I'm having problems packaging the app on my machine.
So helping at testing the startup on other platforms is appreciated 😄
Still need to decide about the other stuff on the list though.

@grunjol
Copy link
Contributor

grunjol commented Aug 27, 2016

You don't need to implement the last 2 if the default behavior is not run at startup (simply install or uninstall on preference change)
I can test it in debian and ubuntu.

@noamokman
Copy link
Contributor Author

Yeah, that's true.
Thanks!

@noamokman
Copy link
Contributor Author

@dcposch @grunjol @feross
Final verdict on the default value for startup?
I wanna make adjustments and hopefully merge

@dcposch
Copy link
Contributor

dcposch commented Aug 27, 2016

Final verdict on the default value for startup?

We can have it off by default, for now, as @grunjol suggested. Sounds like it'll be easier to ship that way. If we make it the default in the future, it will only affect new installs (not existing users). CC @feross

disable feature on portable - should I hide hide the pref section ui or show it as disabled?

I'd just hide it.

test startup on all platforms

I can test on Mac and Windows

var AutoLaunch = require('auto-launch')

var appLauncher = new AutoLaunch({
name: 'WebTorrent Desktop'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you should get the app name from config

@grunjol
Copy link
Contributor

grunjol commented Aug 27, 2016

image

auto-start on linux only grabs the first word (WebTorrent) to create the file and launcher... not a big deal.

@grunjol
Copy link
Contributor

grunjol commented Aug 27, 2016

Working fine on Ubuntu and Debian GNOME.

It starts the app with torrent list. I am guessing... can we make it start 'minimized' from autostart? (maybe with a command line)

@noamokman
Copy link
Contributor Author

Working fine on Ubuntu and Debian GNOME.

Great 👍 thanks

starts the app with torrent list. I am guessing... can we make it start 'minimized' from autostart? (maybe with a command line)

on it!

@grunjol
Copy link
Contributor

grunjol commented Aug 27, 2016

Reading a little more, it seems it already has an isHidden: true option.
which basically adds a --hidden to the command line.

@dcposch
Copy link
Contributor

dcposch commented Aug 27, 2016

On Mac (El Capitan) and Windows (Win 10), I'm getting the following error:

module.js:442 Uncaught Error: Cannot find module '../components/Header'

...but only when running the packaged app. npm start works fine.

After testing on the master branch, turns out it's happening there as well.

@feross looks like the React / Material UI change doesn't work with the packaging script yet. I'll try to fix it later today.

@grunjol
Copy link
Contributor

grunjol commented Aug 27, 2016

already reported #842 its a case sensitive issue

@grunjol
Copy link
Contributor

grunjol commented Aug 27, 2016

@noamokman processArgv should digest the --hidden parameter and keep it tracked to prevent main.show() being excuted on function onOpen (e, torrentId)

@noamokman
Copy link
Contributor Author

@grunjol oops, didnt see the messages while working on it, check the latest commit.
opening a torrent should show the main window.

@dcposch
Copy link
Contributor

dcposch commented Aug 27, 2016

After rebasing on top of #843, auto start works on Mac, but it pops up two windows. One is the WebTorrent window (should start minimized), the other is a terminal:

screen shot 2016-08-27 at 9 17 20 am

@noamokman
Copy link
Contributor Author

@dcposch weird... maybe merge #843, I'll rebase my branch.
The window should be hidden now. dont know about the terminal though

@dcposch
Copy link
Contributor

dcposch commented Aug 27, 2016

Works great on Windows!

Looks like there are three things left to do:

  • disable feature, hide from prefs section in the portable windows app
  • auto-start minimized
  • don't start a terminal on Mac

@noamokman
Copy link
Contributor Author

noamokman commented Aug 27, 2016

disable feature, hide from prefs section in the portable windows app
auto-start minimized

these two are already pushed

@noamokman
Copy link
Contributor Author

The implementation for linux and windows is an hidden argument.
Not sure what this does for mac:
https://github.com/Teamwork/node-auto-launch/blob/master/src/AutoLaunchMac.coffee#L10

@grunjol
Copy link
Contributor

grunjol commented Aug 27, 2016

i think you get this wrong, you need to add isHidden: true option in auto-launch and that will add a --hidden parameter on launch

@noamokman
Copy link
Contributor Author

noamokman commented Aug 27, 2016

@grunjol yeah I did,
that argument is used to optionally add the --hidden agrument on startup.
not sure it works the same on mac

@@ -21,6 +21,7 @@ var windows = require('./windows')

var shouldQuit = false
var argv = sliceArgv(process.argv)
var hidden = argv.includes('--hidden')
Copy link
Contributor

@grunjol grunjol Aug 27, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

instead of set hidden value here, do it in function processArgv (argv), this also prevents --hidden be treated as torrentId

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to leave it here so that the main windows starts hidden,
placing the hide function in the processArgv function makes the window flash for a sec.
Made the processArgv function ignore the value as a torrent id

@dcposch
Copy link
Contributor

dcposch commented Aug 27, 2016

these two are already pushed

just tried it again--on mac, it still shows the window and the terminal after booting

#843 is merged btw

@grunjol
Copy link
Contributor

grunjol commented Aug 27, 2016

@dcposch terminal showing issue:

Teamwork/node-auto-launch#28

Check the latest message it has a possible solution

@noamokman
Copy link
Contributor Author

noamokman commented Aug 28, 2016

waiting for Teamwork/node-auto-launch#38 to land 👍
also rebased the branch.
sorted the process args function ot ignore --hidden

@dcposch
Copy link
Contributor

dcposch commented Sep 14, 2016

Rebased, added some fixes, merged. See #923 . Thanks @noamokman !

@dcposch dcposch closed this Sep 14, 2016
@noamokman noamokman deleted the startup branch September 24, 2016 05:05
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants