#!/usr/bin/env bash # ----------------------------------------------------------------------------- # Info: # author: Colin Powell # file: slack.sh # created: 20.03.2020 # revision: --- # version: 1.0 # ----------------------------------------------------------------------------- # Requirements: # rofi # Description: # Use rofi to update slack # Usage: # slack.sh # ----------------------------------------------------------------------------- # Script: declare -A OPTIONS OPTIONS=( ["set status"]="slack status edit " ["clear status"]="slack status edit " ["set away"]="slack presence away" ["set available"]="slack presence active" ) # List for rofi gen_list() { for i in "${!OPTIONS[@]}" do echo "$i" done } main() { # Pass the list to rofi platform=$( (gen_list) | rofi -dmenu -matching fuzzy -no-custom -location 0 -p "Command -> " ) if [[ -n "$platform" ]]; then query=$( (echo ) | rofi -dmenu -matching fuzzy -location 0 -p "Input -> " ) if [[ -n "$query" ]]; then option=${OPTIONS[$platform]}$query eval "$option" else exit fi else exit fi } main exit 0