blob: a070d3d183b38b7f486dd30fcbda95310244963a (
plain) (
blame)
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
|
#!/bin/sh
# If you want to add another profile, create `~/.config/messenger-profiles` and
# use the following format:
#
# profile_app_id:profile_name
run_either() {
if [ -n "$profile_app_id" ] && grep -q "$profile_app_id" "${XDG_CONFIG_HOME:-$HOME/.config}/messenger-profiles"; then
profile_name="$(printf "Default\n%s" "$(grep "$profile_app_id" "${XDG_CONFIG_HOME:-$HOME/.config}/messenger-profiles" | cut -d: -f2)" | dmenu -i -p 'Profile')"
[ -z "$profile_name" ] && exit
case "$profile_name" in
"Default") profile_flags="";;
*) profile_flags="--profile $(printf "%s" "$profile_name" | cut -d: -f2)";;
esac
fi
if type "$1" 1>/dev/null 2>&1; then
# shellcheck disable=SC2086
setsid -f "$1" $profile_flags
elif type "$2" 1>/dev/null 2>&1; then
# shellcheck disable=SC2086
setsid -f "$2" $profile_flags
else
notify-send "Messenger is not installed" "<i>Not found: $1 or $2</i>\n\nInstall one of these with your system package manager or Flatpak"
fi
}
messenger="$(printf "Element\nSignal\nDiscord\nTelegram" | dmenu -i -p 'Messenger')"
case "$messenger" in
"Element") profile_app_id="Element" run_either element-desktop im.riot.Riot;;
"Signal") profile_app_id="Signal" run_either signal-desktop org.signal.Signal;;
"Discord") profile_app_id="Discord" run_either discord com.discordapp.Discord;;
"Telegram") run_either telegram-desktop org.telegram.desktop;;
esac
|