From 81cbd65142609da34f463046abec8ad456440056 Mon Sep 17 00:00:00 2001 From: Timothy Earley Date: Sun, 1 Oct 2017 17:53:07 +0200 Subject: [PATCH 1/3] Added dropbox segment --- README.md | 1 + functions/icons.zsh | 4 ++++ powerlevel9k.zsh-theme | 17 +++++++++++++++++ 3 files changed, 22 insertions(+) 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..3fc6d3b0 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') @@ -303,6 +305,7 @@ case $POWERLEVEL9K_MODE in SSH_ICON $'\uF489' #  VPN_ICON '(vpn)' KUBERNETES_ICON $'\U2388' # ⎈ + DROPBOX_ICON $'\UF16B' #  ) ;; *) @@ -374,6 +377,7 @@ case $POWERLEVEL9K_MODE in SSH_ICON '(ssh)' VPN_ICON '(vpn)' KUBERNETES_ICON $'\U2388' # ⎈ + DROPBOX_ICON $'\UF16B' #  ) ;; esac diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 9a146fa8..792771ac 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 + if [[ "$dropbox_status" != 'unwatched' ]]; 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 From 985dac910cd52f22aa81de8442f335fd08dbd515 Mon Sep 17 00:00:00 2001 From: Timothy Earley Date: Mon, 2 Oct 2017 14:24:06 +0200 Subject: [PATCH 2/3] Don't show when dropbox is not running --- powerlevel9k.zsh-theme | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/powerlevel9k.zsh-theme b/powerlevel9k.zsh-theme index 792771ac..7770fb0a 100755 --- a/powerlevel9k.zsh-theme +++ b/powerlevel9k.zsh-theme @@ -1428,8 +1428,8 @@ 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 - if [[ "$dropbox_status" != 'unwatched' ]]; then + # 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="" From b87c3b85ace58b4a247046a51c37a5b043fcefb5 Mon Sep 17 00:00:00 2001 From: Ben Hilburn Date: Fri, 6 Oct 2017 20:41:51 -0400 Subject: [PATCH 3/3] Updating Dropbox icon for non-awesome fonts --- functions/icons.zsh | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/functions/icons.zsh b/functions/icons.zsh index 3fc6d3b0..76913a81 100644 --- a/functions/icons.zsh +++ b/functions/icons.zsh @@ -234,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') @@ -377,7 +380,7 @@ case $POWERLEVEL9K_MODE in SSH_ICON '(ssh)' VPN_ICON '(vpn)' KUBERNETES_ICON $'\U2388' # ⎈ - DROPBOX_ICON $'\UF16B' #  + DROPBOX_ICON 'Dropbox' ) ;; esac