Add macos app search function
This commit is contained in:
parent
32068c288e
commit
959bf773cb
1 changed files with 24 additions and 12 deletions
|
|
@ -21,22 +21,10 @@ in
|
||||||
shellAliases = {
|
shellAliases = {
|
||||||
ll = "ls -alF";
|
ll = "ls -alF";
|
||||||
zi = "z -i"; # Interactive selection with fzf
|
zi = "z -i"; # Interactive selection with fzf
|
||||||
firefox = "open -a Firefox";
|
|
||||||
preview = "open -a Preview";
|
preview = "open -a Preview";
|
||||||
iina = "open -a IINA";
|
|
||||||
dict = "open -a 'WordWeb Pro'";
|
|
||||||
slide = "open -a SlidePilot";
|
slide = "open -a SlidePilot";
|
||||||
ovito = "open -a Ovito";
|
|
||||||
appcleaner = "open -a AppCleaner";
|
|
||||||
wechat = "open -a WeChat";
|
|
||||||
message = "open -a Messages";
|
|
||||||
tmeet = "open -a TencentMeeting";
|
|
||||||
pixel = "open -a 'Pixelmator Pro'";
|
pixel = "open -a 'Pixelmator Pro'";
|
||||||
keepass = "open -a KeePassXC";
|
|
||||||
inkscape = "open -a Inkscape";
|
inkscape = "open -a Inkscape";
|
||||||
powerpoint = "open -a 'Microsoft PowerPoint'";
|
|
||||||
word = "open -a 'Microsoft Word'";
|
|
||||||
excel = "open -a 'Microsoft Excel'";
|
|
||||||
|
|
||||||
# Nix helpers
|
# Nix helpers
|
||||||
hm = "home-manager";
|
hm = "home-manager";
|
||||||
|
|
@ -119,6 +107,30 @@ in
|
||||||
[[ -d "$target" ]] && cd "$target" || cd "$(dirname "$target")"
|
[[ -d "$target" ]] && cd "$target" || cd "$(dirname "$target")"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Function to search and open all macOS applications
|
||||||
|
function app() {
|
||||||
|
local app_path
|
||||||
|
local file_to_open="$1"
|
||||||
|
|
||||||
|
app_path=$( (find -L /Applications -name "*.app" -maxdepth 2 2>/dev/null; \
|
||||||
|
find -L ~/Applications -name "*.app" -maxdepth 3 2>/dev/null; \
|
||||||
|
find /System/Applications -name "*.app" -maxdepth 2 2>/dev/null; \
|
||||||
|
find /System/Applications/Utilities -name "*.app" -maxdepth 1 2>/dev/null) |
|
||||||
|
sort | uniq |
|
||||||
|
fzf --header="Select app to open''${file_to_open:+ file: $file_to_open}" \
|
||||||
|
--preview 'basename {} .app' \
|
||||||
|
--preview-window=up:1 \
|
||||||
|
--height=40%)
|
||||||
|
|
||||||
|
if [[ -n "$app_path" ]]; then
|
||||||
|
if [[ -n "$file_to_open" ]]; then
|
||||||
|
open -a "$app_path" "$file_to_open"
|
||||||
|
else
|
||||||
|
open "$app_path"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
}
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue