-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathwchat
executable file
·52 lines (46 loc) · 1.46 KB
/
wchat
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
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
export AUTOSSH_DEBUG=1
export AUTOSSH_LOGFILE=/tmp/autossh-wchat$DISPLAY.$$.log
set -x
# exec 2>$AUTOSSH_LOGFILE
REMOTE="$(dotfiles-decrypt "U2FsdGVkX1/LmnoTx9JbSg8Q2ptnvXq4l/fY8HmZyle9N50WTSga6fs0W+XWsdbcAqaZD1T3qcCex1pzFpEccecs+J4hz0ymmKslbjBwGzGu3vcd8aOeGWaLIudH59sL")"
if [ -z "$REMOTE" ]; then
echo "Could not decrypt remote." >&2
exit 1
fi
# shellcheck disable=SC2088
REMOTE_CMD='~/bin/weechat'
# Start new instance.
ssh="ssh -AX -tt"
# if command -v mosh >/dev/null 2>&1; then
# # NOTE: mosh and urxvt have problems with pasting special unicode symbols, e.g. 🐍 (<0001f40d>).
# cmd="mosh $cmd"
if hash autossh >/dev/null; then
export AUTOSSH_PORT=0
# ssh="auto$ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=1"
ssh="auto$ssh -o ServerAliveInterval=30 -o ServerAliveCountMax=1"
fi
cmd="$ssh $REMOTE $REMOTE_CMD"
icon=
for i in /usr/share/icons/HighContrast/scalable/apps-extra/internet-group-chat.svg \
/usr/share/icons/Numix/64/categories/applications-chat.svg \
/usr/share/icons/Neu/scalable/apps/internet-group-chat.svg; do
if [ -e "$i" ]; then
icon=$i
break
fi
done
# If not in a terminal, or for TERM=dumb (with awesome's run prompt in Arch Linux).
if [ "${TERM:-dumb}" = "dumb" ]; then
if [ -n "$icon" ]; then
# shellcheck disable=SC2086
exec urxvt -n weechat -icon "$icon" -e $cmd
fi
# shellcheck disable=SC2086
exec urxvt -n weechat -e $cmd
fi
$cmd || {
ret=$?
notify-send "Failed to start wchat."
exit $ret
}