From cab1b9ec316b8db180c81e07b154a9646cc9f0ff Mon Sep 17 00:00:00 2001 From: spinach <19keegandeppe@gmail.com> Date: Sat, 11 Feb 2023 17:00:36 -0500 Subject: [PATCH] added seafile icon for status --- bin/seafile_check | 41 +++++++++++++++++++++++++++++++++++++++ gui/i3-desktop/config | 4 ++-- gui/polybar/config.ini | 12 ++++++++++-- meta/configs/scripts.yaml | 1 + 4 files changed, 54 insertions(+), 4 deletions(-) create mode 100755 bin/seafile_check diff --git a/bin/seafile_check b/bin/seafile_check new file mode 100755 index 0000000..3aa134c --- /dev/null +++ b/bin/seafile_check @@ -0,0 +1,41 @@ +#!/usr/bin/env bash + +# Gets the current seafile status to display icon + +SYNC_COMPLETE=$(printf '%s %s' '%{F#0F0}' $(echo -e '\Uf0216')) # green +SYNC_IN_PROGRESS=$(printf '%s %s' '%{F#FF0}' $(echo -e '\Uf1216')) # yellow +SYNC_FAILED=$(printf '%s %s' '%{F#F00}' $(echo -e '\Uf0b98')) # red + +if ! command -v seaf-cli &>/dev/null ; then + echo "Seafile not downloaded to device!">2 + echo "$SYNC_FAILED" + exit 1 +fi + +# getting folder status and trimming headers +SEAFILE_STATUS=$(seaf-cli status | tail -n +2) +ERRORS=$(echo "$SEAFILE_STATUS" | grep "error") +if [[ -n "$ERRORS" ]] ; then + # some directories have errors + echo "Error: Failed to sync">2 + echo "$ERRORS">2 + echo "$SYNC_FAILED" + exit 1 +fi + +IN_PROGRESS=$(echo "$SEAFILE_STATUS" | grep -v "synchronized") +if [[ -n "$IN_PROGRESS" ]] ; then + # some form of syncing in progress + echo "$SYNC_IN_PROGRESS" + exit 0 +fi + +if [[ -z "$IN_PROGRESS" ]] ; then + # nothing in progress and no errors + echo "$SYNC_COMPLETE" + exit 0 +fi + +# should never get here +echo "UNKNOWN_ERROR!">2 +exit 1 diff --git a/gui/i3-desktop/config b/gui/i3-desktop/config index de9fc47..45fc137 100644 --- a/gui/i3-desktop/config +++ b/gui/i3-desktop/config @@ -35,7 +35,7 @@ exec --no-startup-id dex --autostart --environment i3 'workspace 2; exec brave-b # xss-lock grabs a logind suspend inhibit lock and will use i3lock to lock the # screen before suspend. Use loginctl lock-session to lock your screen. -exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock --nofork +exec --no-startup-id xss-lock --transfer-sleep-lock -- i3lock-blur --nofork # NetworkManager is the most popular way to manage wireless networks on Linux, # and nm-applet is a desktop environment-independent system tray GUI for it. @@ -59,7 +59,7 @@ floating_modifier $mod bindsym $mod+Return exec st # lock the screen -bindsym $mod+q exec ~/.local/bin/i3lock-blur +bindsym $mod+q exec i3lock-blur # kill focused window bindsym $mod+Shift+q kill diff --git a/gui/polybar/config.ini b/gui/polybar/config.ini index 3558cbf..e609bcf 100644 --- a/gui/polybar/config.ini +++ b/gui/polybar/config.ini @@ -18,6 +18,8 @@ separator = | separator-foreground = ${colors.disabled} module-margin = 1 padding = 2 +; multi-monitor support +monitor = ${env:MONITOR} ; places bar at the top bottom = false fixed-center = true @@ -32,7 +34,7 @@ inherit = section/base-bar height = 16pt ; modules modules-left = xworkspaces xwindow-thinkpad weather-thinkpad -modules-right = battery pulseaudio memory cpu wlan date +modules-right = battery pulseaudio memory cpu wlan seafile date [bar/desktop-bar] ; desktop bar config @@ -42,7 +44,7 @@ height = 24pt ; modules modules-left = xworkspaces xwindow-desktop modules-center = weather-desktop -modules-right = pulseaudio memory cpu eth date +modules-right = pulseaudio memory cpu eth seafile date @@ -174,5 +176,11 @@ date-alt = %a, %b %d %l:%M %P label = %date% label-foreground = ${colors.primary} +[module/seafile] +; custom seafile script +type = custom/script +exec = seafile_check +interval = 3 + [settings] screenchange-reload = true diff --git a/meta/configs/scripts.yaml b/meta/configs/scripts.yaml index 572c533..57b4af0 100644 --- a/meta/configs/scripts.yaml +++ b/meta/configs/scripts.yaml @@ -9,6 +9,7 @@ ~/.local/bin/ssh_agent_check: bin/ssh_agent_check ~/.local/bin/display_uptime: bin/display_uptime ~/.local/bin/docker_check: bin/docker_check + ~/.local/bin/seafile_check: bin/seafile_check ~/.local/bin/watertracker: src/watertracker/watertracker ~/.local/bin/weather: src/weather/weather ~/.local/bin/bluebikes: src/bluebikes/bluebikes