#!/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" "Not found: $1 or $2\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