fixed auto sync with calcurse hooks and added general purpose i3 scratchpad to auto launch after closure

nvim
spinach 2 years ago
parent c0194b9119
commit 330097f4e7

@ -2,7 +2,6 @@
# yellow for in progress
polybar-msg action calendar-sync hook 3 1>/dev/null
OUTPUT=$(CALCURSE_CALDAV_PASSWORD=$(pass show cal.keegandeppe.com/kdeppe 2>&1) calcurse-caldav 2>&1)
ERRORS=$(echo "$OUTPUT" | grep error)
@ -10,9 +9,9 @@ if [ -n "$ERRORS" ] ; then
polybar-msg action calendar-sync hook 2 1>/dev/null
exit 0
fi
# success, show green for a few seconds and quit
polybar-msg action calendar-sync hook 1 1>/dev/null
sleep 3
polybar-msg action calendar-sync hook 0 1>/dev/null
exit 0
exit 0

@ -0,0 +1,20 @@
#!/bin/bash
# checks if instance of arg 1 exists, will show it if it does
exists=$(i3-msg "[instance=$1] scratchpad show" 2>&1 | grep ERROR)
if [ -n "$exists" ] ; then
# creating it then showing
if [ -z "$1" ] ; then
echo "Missing class in arg 1" >&2
exit 1
elif [ -z "$2" ] ; then
echo "Missing command to launch application in arg 2" >&2
exit 1
fi
# runs remaining commands and shows
${@:2} 2>&1 1>/dev/null &
sleep 1
# lets application load then shows it on scratchpad
i3-msg "[instance=$1] scratchpad show" 1>/dev/null
fi

@ -7,7 +7,7 @@ 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 "Seafile not downloaded to device!">&2
echo "$SYNC_FAILED"
exit 1
fi
@ -17,8 +17,8 @@ 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 "Error: Failed to sync">&2
echo "$ERRORS">&2
echo "$SYNC_FAILED"
exit 1
fi
@ -37,5 +37,5 @@ if [[ -z "$IN_PROGRESS" ]] ; then
fi
# should never get here
echo "UNKNOWN_ERROR!">2
echo "UNKNOWN_ERROR!">&2
exit 1

@ -52,10 +52,12 @@ bindsym $mod+d exec --no-startup-id rofi-launcher
# setting up a vimscratch pad to use vimwiki
for_window [instance="todo"] move window to scratchpad
for_window [instance="cal"] move window to scratchpad
exec --no-startup-id st -n todo -e vim ~/vimwiki/todo/index.md
exec --no-startup-id st -n cal -e calcurse
bindsym $mod+s [instance="todo"] scratchpad show
bindsym $mod+c [instance="cal"] scratchpad show
for_window [instance="spotify"] move window to scratchpad
# bindings
bindsym $mod+s exec i3-scratchpad.sh todo st -n todo -e vim ~/vimwiki/todo/index.md
bindsym $mod+c exec i3-scratchpad.sh cal st -n cal -e calcurse
bindsym $mod+m exec i3-scratchpad.sh spotify spotify
# change focus
bindsym $mod+h focus left

@ -8,6 +8,7 @@
- link:
~/.local/bin/ssh_agent_check: bin/ssh_agent_check
~/.local/bin/poly_spotify: bin/poly_spotify
~/.local/bin/i3-scratchpad.sh: bin/i3-scratchpad.sh
~/.local/bin/todo_display.sh: bin/todo_display.sh
~/.local/bin/display_uptime: bin/display_uptime
~/.local/bin/docker_check: bin/docker_check

@ -19,13 +19,13 @@ format.notifydate=%a %F
format.notifytime=%T
format.outputdate=%D
format.dayheading=%B %e, %Y
general.autogc=no
general.autogc=yes
general.autosave=yes
general.confirmdelete=yes
general.confirmquit=yes
general.firstdayofweek=monday
general.multipledays=yes
general.periodicsave=10
general.periodicsave=0
general.systemevents=yes
notification.command=printf '\a'
notification.notifyall=flagged-only

Loading…
Cancel
Save