Skip to content

Commit

Permalink
feat(mli): Manage macOS Login Items
Browse files Browse the repository at this point in the history
Automatically load when running setup.
  • Loading branch information
5ouma committed Mar 10, 2024
1 parent 53f0859 commit 89bf442
Show file tree
Hide file tree
Showing 6 changed files with 155 additions and 4 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- name: 🍎 Install macOS tools via Homebrew
if: ${{ matrix.os == 'macOS-13' || matrix.os == 'macOS-14' }}
run: brew install 5ouma/formula/mksei blacktop/tap/lporg
run: brew install 5ouma/formula/mksei 5ouma/formula/mli blacktop/tap/lporg

- name: ⚙️ Run setup
env:
Expand Down
7 changes: 7 additions & 0 deletions config/topgrade/.config/topgrade/topgrade.toml
Original file line number Diff line number Diff line change
Expand Up @@ -49,3 +49,10 @@ repos = ["~/*", "~/ghq/*/*/*"]
printf '\\033[33;1mSkipped\\033[m\n'
fi
"""
"mli" = """
if (type mli &>/dev/null); then
mli save -f --file="$data/login_items.json"
else
printf '\\033[33;1mSkipped\\033[m\n'
fi
"""
2 changes: 1 addition & 1 deletion config/zsh/.config/zsh/.zshenv
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ if [[ "$(uname)" == 'Darwin' ]]; then
[[ "$(uname -m)" == 'arm64' ]] && eval "$(/opt/homebrew/bin/brew shellenv)"
else
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
export HOMEBREW_BUNDLE_BREW_SKIP='5ouma/formula/mksei blacktop/tap/lporg'
export HOMEBREW_BUNDLE_BREW_SKIP='5ouma/formula/mksei 5ouma/formula/mli blacktop/tap/lporg'
fi

# dotfiles
Expand Down
1 change: 1 addition & 0 deletions data/Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ brew "zoxide"
brew "zsh"
brew "5ouma/formula/gh-dash"
brew "5ouma/formula/mksei"
brew "5ouma/formula/mli"
brew "blacktop/tap/lporg"
brew "pomdtr/tap/tweety"
cask "1password"
Expand Down
137 changes: 137 additions & 0 deletions data/login_items.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
[
{
"Name": "1Password",
"Path": "/Applications/1Password.app",
"Hidden": false
},
{
"Name": "Activity Monitor",
"Path": "/System/Applications/Utilities/Activity Monitor.app",
"Hidden": false
},
{
"Name": "Alfred 5",
"Path": "/Applications/Alfred 5.app",
"Hidden": false
},
{
"Name": "Discord",
"Path": "/Applications/Discord.app",
"Hidden": false
},
{
"Name": "Discord PTB",
"Path": "/Applications/Discord PTB.app",
"Hidden": false
},
{
"Name": "Displaperture",
"Path": "/Applications/Displaperture.app",
"Hidden": false
},
{
"Name": "Email",
"Path": "/Applications/Email.app",
"Hidden": false
},
{
"Name": "FigmaAgent",
"Path": "/Users/souma/Library/Application Support/Figma/FigmaAgent.app",
"Hidden": false
},
{
"Name": "Fuwari",
"Path": "/Applications/Fuwari.app",
"Hidden": false
},
{
"Name": "Gitify",
"Path": "/Applications/Gitify.app",
"Hidden": false
},
{
"Name": "Google Drive",
"Path": "/Applications/Google Drive.app",
"Hidden": false
},
{
"Name": "Hammerspoon",
"Path": "/Applications/Hammerspoon.app",
"Hidden": false
},
{
"Name": "HandyPalette",
"Path": "/Applications/HandyPalette.app",
"Hidden": false
},
{
"Name": "Hidden Bar",
"Path": "/Applications/Hidden Bar.app",
"Hidden": false
},
{
"Name": "HotKey",
"Path": "/Applications/HotKey.app",
"Hidden": false
},
{
"Name": "Itsycal",
"Path": "/Applications/Itsycal.app",
"Hidden": false
},
{
"Name": "LINE",
"Path": "/Applications/LINE.app",
"Hidden": false
},
{
"Name": "MacUpdater",
"Path": "/Applications/MacUpdater.app",
"Hidden": false
},
{
"Name": "Mail",
"Path": "/System/Applications/Mail.app",
"Hidden": false
},
{
"Name": "Notion",
"Path": "/Applications/Notion.app",
"Hidden": false
},
{
"Name": "OrbStack",
"Path": "/Applications/OrbStack.app",
"Hidden": false
},
{
"Name": "Raycast",
"Path": "/Applications/Raycast.app",
"Hidden": false
},
{
"Name": "Rectangle",
"Path": "/Applications/Rectangle.app",
"Hidden": false
},
{
"Name": "RunCat",
"Path": "/Applications/RunCat.app",
"Hidden": false
},
{
"Name": "Spark Desktop",
"Path": "/Applications/Spark Desktop.app",
"Hidden": false
},
{
"Name": "Speedtest",
"Path": "/Applications/Speedtest.app",
"Hidden": false
},
{
"Name": "TickTick",
"Path": "/Applications/TickTick.app",
"Hidden": false
}
]
10 changes: 8 additions & 2 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ getGum() {
curl -sL "$gumUrl" | tar zxC "$TMPDIR" 'gum' && alias gumCom='$TMPDIR/gum'
printf '\r '
else
alias gumCom='$(which gum)'
alias gumCom="$(which gum)"
fi

if [[ ! -f "$data/blue.json" ]]; then
Expand Down Expand Up @@ -285,7 +285,7 @@ EOM
#==================================================[ Apps ]==================================================#

installApps() {
(! isDarwin) && export HOMEBREW_BUNDLE_BREW_SKIP='5ouma/formula/mksei blacktop/tap/lporg'
(! isDarwin) && export HOMEBREW_BUNDLE_BREW_SKIP='5ouma/formula/mksei 5ouma/formula/mli blacktop/tap/lporg'
(gum run "Satisfying Brewfile's dependencies..." -- brew bundle check --file="$data/Brewfile") && skip
brew update && brew bundle install --no-lock --file="$data/Brewfile"
} && run 'installApps' '## 📲 Install commands and apps'
Expand Down Expand Up @@ -321,6 +321,12 @@ restoreAppShortcuts() {
gum run 'Running `mksei load`...' -- mksei load "$data/keyboard_shortcuts.json"
} && run 'restoreAppShortcuts' '## ⌨️ Restore App Shortcuts' true

restoreLoginItems() {
(mli check --file="$data/login_items.json" &>/dev/null) && skip
# shellcheck disable=SC2016
gum run 'Running `mli load`...' -- mli load --file="$data/login_items.json"
} && run 'restoreLoginItems' '## 📑 Restore Login Items' true

generateGitHooks() {
[[ -f "$XDG_CONFIG_HOME/git/hooks/pre-commit" && -f "$XDG_CONFIG_HOME/git/hooks/commit-msg" ]] && skip
pre-commit init-templatedir "$XDG_CONFIG_HOME/git" -c="$data/pre-commit.yml" | sed -n 1p
Expand Down

0 comments on commit 89bf442

Please sign in to comment.