Skip to content

Feature Request: loginItems option to manage macOS Login Items declaratively #1740

@matsjfunke

Description

@matsjfunke

It would be really cool to have a options like:

system.loginItems = [ "AppName.app" ]
# or
system.defaults = {    
    loginItems = [ "AppName.app" ]
}

that take a list of app paths and manages them declaratively via the macOS Login Items API

The current workaround requires a home-manager activationScript with raw osascript, which is brittle and not discoverable:

  home.activation.loginItems = lib.hm.dag.entryAfter [ "writeBoundary" ] ''
    run /usr/bin/osascript <<'EOF'
      tell application "System Events"
        delete every login item
        set appPaths to {"/Applications/AppName.app"}
        repeat with appPath in appPaths
          make login item at end with properties {path:appPath, hidden:false}
        end repeat
      end tell
EOF
  '';

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions