-
Notifications
You must be signed in to change notification settings - Fork 0
/
.functions
41 lines (34 loc) · 991 Bytes
/
.functions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
function toast_notification() {
local message="$1"
local duration="$2"
# Save cursor position
tput sc
# Calculate starting position to center the message
local start_pos=$(( ($(tput cols) - ${#message} - 4) / 2 ))
# Move cursor to last line
tput cup 0 $start_pos
# Print notification
local full_message="✨ $message ✨"
printf "%s" "$full_message"
# Restore cursor position
tput rc
# Wait for the duration
sleep $duration
# Restore original line
tput sc
tput cup 0 $start_pos
tput setaf 14 # Set cyan color
local full_message_length=$(echo -n "$full_message" | wc -c)
printf '─%.0s' $(seq 1 $full_message_length)
tput sgr0 # Reset color
tput rc
}
function start_agent {
echo "Initializing new SSH agent..."
# spawn ssh-agent
/usr/bin/ssh-agent | sed 's/^echo/#echo/' > ${SSH_ENV}
echo succeeded
chmod 600 ${SSH_ENV}
. ${SSH_ENV} > /dev/null
/usr/bin/ssh-add
}