#!/bin/bash _CR="\e[170D\e[1B" _E1="\e[1C" _E2="\e[2C" _E_RIGHT="\e[70C" _BOLD="\e[1m" _BLACK="\e[38;5;0m" _RED="\e[38;5;1m" _BLUE="\e[38;5;4m" _PURPLE="\e[38;5;5m" _CYAN="\e[38;5;6m" _BG_RED="\e[48;5;1m" _RESET="\e[0m" # _title [string:bg_color] [string:message] [bool:right] _title() { printf "$_CR$_E1$_BOLD$_BLACK$1" [[ ! -z $3 ]] && printf "$_E_RIGHT" for (( i=0; i<(( 10 - ${#2} / 2 )); i++ )) do printf " " done printf "$2" for (( i=0; i<(( 10 - ${#2} / 2 )); i++ )) do printf " " done (( ${#2} % 2 == 0 )) && printf " " printf "$_RESET$_CR" } # _shortcut [string:modifier] [string:key] [string:message] [bool:right] _shortcut() { _MODIFIER=$(sed "s|+|\\\e[38;5;1m+\\\e[38;5;5m|g" <<< $1) [[ ! -z $4 ]] && printf "$_E_RIGHT" printf "$_E2" printf "$_PURPLE$_MODIFIER$_RESET" [[ ! -z $1 ]] && printf "$_RED+$_RESET" printf "$_CYAN$2$_RESET" printf " $3" printf "$_CR" } _move() { printf "\e[$1;$2H" } tput civis clear _title "\e[48;5;063m" "i3" _shortcut "Super" "c" "Reload i3" _shortcut "Super" "r" "Restart i3" _shortcut "Super" "e" "Exit i3" _title "\e[48;5;035m" "Applications" _shortcut "Super" "d" "Dmenu" _shortcut "Super+Shift" "f" "Firefox" _shortcut "Super+Shift" "s" "Steam" _shortcut "Super+Shift" "d" "Discord" _shortcut "Super+Shift" "p" "Pavucontrol" _title "\e[48;5;191m" "Window" _shortcut "Super" "q" "Kill window" _shortcut "Super" "o" "Move window to next screen" _shortcut "Super" "h" "Split horizontally" _shortcut "Super" "v" "Split vertically" _shortcut "Super" "f" "Toggle fullscreen" _shortcut "Super" "Space" "Toggle layout" _shortcut "Super" "arrows" "Change window focus" _shortcut "Super+Shift" "arrows" "Resize window" _shortcut "Super+ctrl" "arrows" "Move focused window" _shortcut "Super+Ctrl" "Space" "Toggle window split" _title "\e[48;5;170m" "Workspace" _shortcut "Super" "Numpad" "Move to workspace n" _shortcut "Super+Ctrl" "Numpad" "Move focused window to workspace n" _title "\e[48;5;092m" "Sound" _shortcut "" "F4" "Decrease volume" _shortcut "" "F5" "Increase volume" _move 1 1 _title "\e[48;5;204m" "Urxvt" true _shortcut "Alt" "Up" "Increase font size" true _shortcut "Alt" "Down" "Decrease font size" true _shortcut "Alt" "=" "Reset font size" true _shortcut "Alt" "/" "Show font" true _shortcut "Alt" "u" "Url matcher" true _shortcut "Shift" "Up" "Scroll up one line" true _shortcut "Shift" "PageUp" "Scroll one page" true _shortcut "Shift" "Down" "Scroll down one line" true _shortcut "Shift" "PageDown" "Scroll down one page" true _title "\e[48;5;214m" "Tmux" true _move 1 1 read -n 1 -s