Files
dotfiles/scripts/i3wm_key_help.sh
2024-08-15 17:56:06 +02:00

104 lines
2.7 KiB
Bash
Executable File

#!/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 "%b%b%b%b" "$_CR" "$_E1" "$_BOLD" "$_BLACK$1"
[[ -n $3 ]] && printf "%b" "$_E_RIGHT"
for (( i=0; i<( 10 - ${#2} / 2 ); i++ ))
do
printf " "
done
printf "%s" "$2"
for (( i=0; i<( 10 - ${#2} / 2 ); i++ ))
do
printf " "
done
(( ${#2} % 2 == 0 )) && printf " "
printf "%b%b" "$_RESET" "$_CR"
}
# _shortcut [string:modifier] [string:key] [string:message] [bool:right]
_shortcut() {
_MODIFIER=${1//+/\\\e[38;5;1m+\\\e[38;5;5m}
[[ -n $4 ]] && printf "%b" "$_E_RIGHT"
printf "%b" "$_E2"
printf "%b%b%b" "$_PURPLE" "$_MODIFIER" "$_RESET"
[[ -n $1 ]] && printf "%b+%b" "$_RED" "$_RESET"
printf "%b%s%b" "$_CYAN" "$2" "$_RESET"
printf " %s" "$3"
printf "%b" "$_CR"
}
_move() {
printf "\e[%s;%b" "$1" "$2H"
}
tput civis
clear
_title "\e[48;5;063m" "i3"
_shortcut "Super" "l" "Shutdown menu"
_title "\e[48;5;035m" "Applications"
_shortcut "Super" "d" "Rofi"
_shortcut "Super" "b" "Bookmarks"
_shortcut "Super" "m" "Mpv"
_shortcut "Super" "g" "Google search"
_shortcut "Super" "c" "Calc"
_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 -r -n 1 -s