From e37d7133edf558ff5341b3e6d9e3adfc2fc65f74 Mon Sep 17 00:00:00 2001 From: Colin Powell Date: Thu, 26 Mar 2020 09:28:36 -0400 Subject: [PATCH] Add readme and start of rofi slack plugin --- README.org | 23 +++++++++++++++ rofi/.config/rofi/slack.sh | 58 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+) create mode 100644 README.org create mode 100755 rofi/.config/rofi/slack.sh diff --git a/README.org b/README.org new file mode 100644 index 0000000..7f34f77 --- /dev/null +++ b/README.org @@ -0,0 +1,23 @@ +#+TITLE: Dotfiles + +I use: + ++-----+--------------------+ +| OS | FreeBSD 12.1 | ++-----+--------------------+ +| WM | i3-gaps | ++-----+--------------------+ +| Compositor | compton | ++-----+--------------------+ +| Editor | DOOM Emacs | ++-----+--------------------+ +| Terminal | Alacritty | ++-----+--------------------+ +| Shell | fish | ++-----+--------------------+ +| PDF-viewer | Zathura | ++-----+--------------------+ +| Mail | notmuch + Emacs | ++-----+--------------------+ +| Browser | Firefox / surf | ++-----+--------------------+ diff --git a/rofi/.config/rofi/slack.sh b/rofi/.config/rofi/slack.sh new file mode 100755 index 0000000..d42d7c2 --- /dev/null +++ b/rofi/.config/rofi/slack.sh @@ -0,0 +1,58 @@ +#!/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