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

Add the option to make the application run on startup for all users #74

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 12 additions & 3 deletions src/AutoLaunchWindows.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ module.exports =
# :appName - {String}
# :appPath - {String}
# :isHiddenOnLaunch - {Boolean}
# :onlyMe - (Optional) {Boolean}
# Returns a Promise
enable: ({appName, appPath, isHiddenOnLaunch}) ->
enable: ({appName, appPath, isHiddenOnLaunch,onlyMe}) ->
if(!onlyMe)
regKey.hive = Winreg.HKLM
return new Promise (resolve, reject) ->
pathToAutoLaunchedApp = appPath
args = ''
Expand All @@ -38,8 +41,11 @@ module.exports =


# appName - {String}
# onlyMe - (Optional) {Boolean}
# Returns a Promise
disable: (appName) ->
disable: (appName,onlyMe) ->
if(!onlyMe)
regKey.hive = Winreg.HKLM
return new Promise (resolve, reject) ->
regKey.remove appName, (err) ->
if err?
Expand All @@ -52,8 +58,11 @@ module.exports =


# appName - {String}
# onlyMe - (Optional) {Boolean}
Copy link
Contributor

Choose a reason for hiding this comment

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

A comment for mac is missing

Copy link
Contributor

@Oxalin Oxalin Dec 7, 2023

Choose a reason for hiding this comment

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

Please, use a name that is more representative of what's the purpose of the parameter. We usually talk about a user-wide or a system-wide installation (something like "systemWideInstall").

# Returns a Promise which resolves to a {Boolean}
isEnabled: (appName) ->
isEnabled: (appName,mac,onlyMe) ->
if(!onlyMe)
regKey.hive = Winreg.HKLM
return new Promise (resolve, reject) ->
regKey.get appName, (err, item) ->
return resolve false if err?
Expand Down
9 changes: 5 additions & 4 deletions src/index.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@ module.exports = class AutoLaunch
# to add Login Item
# :name - {String}
# :path - (Optional) {String}
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 add a new comment for the new option

constructor: ({name, isHidden, mac, path}) ->
constructor: ({name, isHidden, mac, path,onlyMe}) ->
throw new Error 'You must specify a name' unless name?

@opts =
appName: name
isHiddenOnLaunch: if isHidden? then isHidden else false
mac: mac ? {}
mac: mac ? {},
onlyMe:onlyMe?true
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add some spaces here please?

Copy link
Contributor

Choose a reason for hiding this comment

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

Same for a few other areas actually


versions = process?.versions
if path?
Expand Down Expand Up @@ -48,11 +49,11 @@ module.exports = class AutoLaunch
enable: => @api.enable @opts


disable: => @api.disable @opts.appName, @opts.mac
disable: => @api.disable @opts.appName, @opts.mac,@opts.onlyMe


# Returns a Promise which resolves to a {Boolean}
isEnabled: => @api.isEnabled @opts.appName, @opts.mac
isEnabled: => @api.isEnabled @opts.appName, @opts.mac,@opts.onlyMe


### Private ###
Expand Down