THEAARBS menus - config

Published 05-05-2018 22:59:24

Raw

#!/bin/sh
# A menu script for conveniently accessing config files
# Bound to Mod+F2

# Each menu choice has a file to edit
# or command to run in the MenuCommands() function
MenuChoices="alias\nappearance\naudio\nbackup\nbash\nbookmarks\ncontacts\ndisks\nhosts\ni3\ni3blocks\ninput\nmpd\nmpv\nmutt\nnewsboat\nprinters\nprofile\nranger\nrss\nscreens\nscripts\nssh\nstartup\nsurf\nsynergy\ntmux\nvim\nx\nzathura"

MenuCommands(){
    case $chosen in
        alias)      openfile ~/.config/aliasrc ;;
        appearance) lxappearance &disown ;;
        audio)      pavucontrol &disown ;;
        backup)     openfile ~/.local/bin/backup ;;
        bash)       openfile ~/.bashrc ;;
        bookmarks)  openfile $BOOKMARKS ;;
        contacts)   openfile $CONTACTS ;;
        disks)      sudo gnome-disks &disown ;;
        hosts)      $runprefix sudo $EDITOR /etc/hosts ;;
        i3)     openfile ~/.config/i3/config ;;
        i3blocks)   openfile ~/.config/i3blocks/config ;;
        input)      lxinput &>/dev/null &disown ;;
        mpd)        openfile ~/.config/mpd/mpd.conf ;;
        mpv)        openfile ~/.config/mpv/input.conf ;;
        mutt)       openfile ~/.config/mutt/muttrc ;;
        newsboat)   openfile ~/.config/newsboat/config ;;
        printers)   system-config-printer &disown ;;
        profile)    openfile ~/.profile ;;
        ranger)     openfile ~/.config/ranger/rc.conf ;;
        rss)        openfile ~/.config/newsboat/urls ;;
        screens)    screen ;;
        scripts)    $runprefix $FILE ~/.local/bin ;;
        ssh)        openfile ~/.ssh/config ;;
        startup)    openfile ~/.local/bin/autostart &
                openfile ~/.config/autorun ;;
        synergy)    openfile ~/.config/Synergy/Synergy.conf ;;
        surf)       SurfStyles ;;
        tmux)       openfile ~/.config/tmux/tmux.conf ;;
        vim)        openfile ~/.vimrc ;;
        x)      openfile ~/.Xdefaults ;;
        zathura)    openfile ~/.config/zathura/zathurarc ;;
    esac ;}

# Choosing "surf" lists CSS choices
SurfStyles() {
    sstyle="default.css"
    chosen=$(echo -e "Dark Mode\nSolarized" | $mymenu) || exit
    stylenote() { notify-send "Surf stylesheet changed:" "$chosen" ;}
    case $chosen in
        "Dark Mode")  sstyle="dark.css" ;;
        "Solarized")  sstyle="solarized.css" ;;
    esac
    cp ~/.surf/styles/$sstyle ~/.surf/styles/default.css && stylenote
    exit ;}

# Colors dmenu with pywal colors
. ~/.cache/wal/colors.sh
chosen=$1
runprefix=
mymenu="fzf --prompt="Config""
amitty=$(tty)
case $amitty in
    *tty1|"not a tty")    runprefix="$TERMINAL -e"
                mymenu="dmenu -nb $color0 -nf $color7 -sb $color1 -sf $color7 -b -l 12 -p "Config"" ;;
esac
[[ -z $chosen ]] && chosen=$(echo -e "$MenuChoices" | sort -n | $mymenu)
MenuCommands
exit 0