aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Hilburn <bhilburn@gmail.com>2017-10-07 03:44:00 +0300
committerGitHub <noreply@github.com>2017-10-07 03:44:00 +0300
commit6136152997444dd0b25a6ad2879b496b2fe474a6 (patch)
treefeb2b5848f4ab9d5f56c026b657d2d8b033403fd
parente9e60324cde4279e5724d94905d61986ed9c4b3b (diff)
parentb87c3b85ace58b4a247046a51c37a5b043fcefb5 (diff)
Merge pull request #638 from TimothyEarley/dropbox-integration
Added Dropbox segment
-rw-r--r--README.md1
-rw-r--r--functions/icons.zsh7
-rwxr-xr-xpowerlevel9k.zsh-theme17
3 files changed, 25 insertions, 0 deletions
diff --git a/README.md b/README.md
index 4b0c2791..c4ff1c1f 100644
--- a/README.md
+++ b/README.md
@@ -140,6 +140,7 @@ The segments that are currently available are:
* `aws_eb_env` - The current Elastic Beanstalk Environment.
* `docker_machine` - The current Docker Machine.
* `kubecontext` - The current context of your `kubectl` configuration.
+* `dropbox` - Indicates Dropbox directory and syncing status using `dropbox-cli`
**Other:**
* [`custom_command`](#custom_command) - Create a custom segment to display the
diff --git a/functions/icons.zsh b/functions/icons.zsh
index a20cef2c..76913a81 100644
--- a/functions/icons.zsh
+++ b/functions/icons.zsh
@@ -87,6 +87,7 @@ case $POWERLEVEL9K_MODE in
SSH_ICON '(ssh)'
VPN_ICON '(vpn)'
KUBERNETES_ICON $'\U2388' # ⎈
+ DROPBOX_ICON $'\UF16B' # 
)
;;
'awesome-fontconfig')
@@ -158,6 +159,7 @@ case $POWERLEVEL9K_MODE in
SSH_ICON '(ssh)'
VPN_ICON $'\uF023'
KUBERNETES_ICON $'\U2388' # ⎈
+ DROPBOX_ICON $'\UF16B' # 
)
;;
'awesome-mapped-fontconfig')
@@ -232,6 +234,9 @@ case $POWERLEVEL9K_MODE in
LOCK_ICON '\u'$CODEPOINT_OF_AWESOME_LOCK # 
EXECUTION_TIME_ICON '\u'$CODEPOINT_OF_AWESOME_HOURGLASS_END # 
SSH_ICON '(ssh)'
+ VPN_ICON '\u'$CODEPOINT_OF_AWESOME_LOCK
+ KUBERNETES_ICON $'\U2388' # ⎈
+ DROPBOX_ICON '\u'$CODEPOINT_OF_AWESOME_DROPBOX # 
)
;;
'nerdfont-complete'|'nerdfont-fontconfig')
@@ -303,6 +308,7 @@ case $POWERLEVEL9K_MODE in
SSH_ICON $'\uF489' # 
VPN_ICON '(vpn)'
KUBERNETES_ICON $'\U2388' # ⎈
+ DROPBOX_ICON $'\UF16B' # 
)
;;
*)
@@ -374,6 +380,7 @@ case $POWERLEVEL9K_MODE in
SSH_ICON '(ssh)'
VPN_ICON '(vpn)'
KUBERNETES_ICON $'\U2388' # ⎈
+ DROPBOX_ICON 'Dropbox'
)
;;
esac
diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme
index 9a146fa8..7770fb0a 100755
--- a/powerlevel9k.zsh-theme
+++ b/powerlevel9k.zsh-theme
@@ -1423,6 +1423,23 @@ prompt_kubecontext() {
fi
}
+# Dropbox status
+prompt_dropbox() {
+ # The first column is just the directory, so cut it
+ local dropbox_status="$(dropbox-cli filestatus . | cut -d\ -f2-)"
+
+ # Only show if the folder is tracked and dropbox is running
+ if [[ "$dropbox_status" != 'unwatched' && "$dropbox_status" != "isn't running!" ]]; then
+ # If "up to date", only show the icon
+ if [[ "$dropbox_status" =~ 'up to date' ]]; then
+ dropbox_status=""
+ fi
+
+ "$1_prompt_segment" "$0" "$2" "white" "blue" "$dropbox_status" "DROPBOX_ICON"
+ fi
+
+}
+
################################################################
# Prompt processing and drawing