summaryrefslogtreecommitdiff
path: root/plugins/osx/osx.plugin.zsh
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/osx/osx.plugin.zsh')
-rw-r--r--plugins/osx/osx.plugin.zsh35
1 files changed, 31 insertions, 4 deletions
diff --git a/plugins/osx/osx.plugin.zsh b/plugins/osx/osx.plugin.zsh
index 4dbc75787..6a4b6eec4 100644
--- a/plugins/osx/osx.plugin.zsh
+++ b/plugins/osx/osx.plugin.zsh
@@ -44,7 +44,7 @@ EOF
elif [[ "$the_app" == 'iTerm2' ]]; then
osascript <<EOF
- tell application "iTerm"
+ tell application "iTerm2"
tell current window
create tab with default profile
tell current session to write text "${command}"
@@ -81,7 +81,7 @@ EOF
elif [[ "$the_app" == 'iTerm2' ]]; then
osascript <<EOF
- tell application "iTerm"
+ tell application "iTerm2"
tell current session of first window
set newSession to (split vertically with same profile)
tell newSession
@@ -121,7 +121,7 @@ EOF
elif [[ "$the_app" == 'iTerm2' ]]; then
osascript <<EOF
- tell application "iTerm"
+ tell application "iTerm2"
tell current session of first window
set newSession to (split horizontally with same profile)
tell newSession
@@ -184,6 +184,7 @@ function vncviewer() {
# iTunes control function
function itunes() {
local opt=$1
+ local playlist=$2
shift
case "$opt" in
launch|play|pause|stop|rewind|resume|quit)
@@ -200,6 +201,19 @@ function itunes() {
vol)
opt="set sound volume to $1" #$1 Due to the shift
;;
+ playlist)
+ # Inspired by: https://gist.github.com/nakajijapan/ac8b45371064ae98ea7f
+if [[ ! -z "$playlist" ]]; then
+ osascript -e 'tell application "iTunes"' -e "set new_playlist to \"$playlist\" as string" -e "play playlist new_playlist" -e "end tell" 2>/dev/null;
+ if [[ $? -eq 0 ]]; then
+ opt="play"
+ else
+ opt="stop"
+ fi
+ else
+ opt="set allPlaylists to (get name of every playlist)"
+ fi
+ ;;
playing|status)
local state=`osascript -e 'tell application "iTunes" to player state as string'`
if [[ "$state" = "playing" ]]; then
@@ -227,7 +241,7 @@ function itunes() {
case "$state" in
on|off)
- # Inspired by: http://stackoverflow.com/a/14675583
+ # Inspired by: https://stackoverflow.com/a/14675583
osascript 1>/dev/null 2>&1 <<-EOF
tell application "System Events" to perform action "AXPress" of (menu item "${state}" of menu "Shuffle" of menu item "Shuffle" of menu "Controls" of menu bar item "Controls" of menu bar 1 of application process "iTunes" )
EOF
@@ -250,6 +264,7 @@ EOF
echo "\tshuf|shuffle [on|off|toggle]\tSet shuffled playback. Default: toggle. Note: toggle doesn't support the MiniPlayer."
echo "\tvol\tSet the volume, takes an argument from 0 to 100"
echo "\tplaying|status\tShow what song is currently playing in iTunes."
+ echo "\tplaylist [playlist name]\t Play specific playlist"
echo "\thelp\tshow this message and exit"
return 0
;;
@@ -260,3 +275,15 @@ EOF
esac
osascript -e "tell application \"iTunes\" to $opt"
}
+
+# Spotify control function
+source ${ZSH}/plugins/osx/spotify
+
+# Show/hide hidden files in the Finder
+alias showfiles="defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder"
+alias hidefiles="defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder"
+
+# Remove .DS_Store files recursively in a directory, default .
+rmdsstore() {
+ find "${@:-.}" -type f -name .DS_Store -delete
+}