Added a help system. It is mod+shift+f1 or in ratpoison mode, ?. I tried to make it more readable, which took some doing, so if something is wrong with it please let me know.
This commit is contained in:
parent
8ce2e7eb32
commit
ccbb89e372
9
i38.sh
9
i38.sh
@ -273,6 +273,9 @@ focus_follows_mouse no
|
||||
# is used in the bar {} block below.
|
||||
font pango:monospace 8
|
||||
|
||||
# I38 help
|
||||
bindsym \$mod+Shift+F1 exec ${i3Path}/scripts/i38-help.sh
|
||||
|
||||
# Run dialog
|
||||
bindsym \$mod+F2 exec ${i3Path}/scripts/run_dialog.sh
|
||||
|
||||
@ -371,6 +374,8 @@ if [[ -n "${escapeKey}" ]]; then
|
||||
cat << EOF >> ${i3Path}/config
|
||||
bindsym $escapeKey mode "ratpoison"
|
||||
mode "ratpoison" {
|
||||
# I38 help bound to ?
|
||||
bindsym Shift+slash exec ${i3Path}/scripts/i38-help.sh, mode "default"
|
||||
# Terminal emulator bound to c
|
||||
bindsym c exec i3-sensible-terminal, mode "default"
|
||||
# Text editor bound to e
|
||||
@ -380,16 +385,20 @@ bindsym f exec $fileBrowser, mode "default"
|
||||
# Web browser bound to w
|
||||
bindsym w exec $webBrowser, mode "default"
|
||||
$(if command -v mumble &> /dev/null ; then
|
||||
# Mumble bound to m
|
||||
echo "bindsym m exec $(command -v mumble), mode \"default\""
|
||||
fi)
|
||||
$(if command -v ocrdesktop &> /dev/null ; then
|
||||
# OCR desktop bound to print screen alternative \$mod+r
|
||||
echo "bindsym Print exec $(command -v ocrdesktop) -b, mode \"default\""
|
||||
echo "bindsym \$mod+r exec $(command -v ocrdesktop) -b, mode \"default\""
|
||||
fi)
|
||||
$(if command -v pidgin &> /dev/null ; then
|
||||
# p bound to pidgin
|
||||
echo "bindsym p exec $(command -v pidgin), mode \"default\""
|
||||
fi)
|
||||
$(if command -v transfersh &> /dev/null ; then
|
||||
# t bound to share file with transfer.sh
|
||||
echo 'bindsym t exec bash -c '"'"'fileName="$(yad --title "I38 Upload File" --file)" && url="$(transfersh "${fileName}" | tee >(yad --title "I38 - Uploading ${fileName##*/} ..." --progress --pulsate --auto-close))" && echo "${url#*saved at: }" | tee >(yad --title "I38 - Upload URL" --show-cursor --show-uri --button yad-close --sticky --text-info) >(xclip -selection clipboard)'"', mode \"default\""
|
||||
fi)
|
||||
|
||||
|
30
scripts/i38-help.sh
Executable file
30
scripts/i38-help.sh
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
|
||||
configPath="$(readlink -f $0)"
|
||||
configPath="${configPath%/*/*}"
|
||||
|
||||
if [[ -f "${configPath}/config" ]]; then
|
||||
mod="$(grep 'set $mod ' "${configPath}/config" | cut -d ' ' -f3)"
|
||||
mod="${mod//Mod1/Alt}"
|
||||
mod="${mod//Mod4/Super}"
|
||||
mapfile helpText < <(sed -e '/set \($mod\|mod\)/d' \
|
||||
-e '/set $ws/d' \
|
||||
-e 's/bindsym/Key:/g' \
|
||||
-e 's/Mod1/Alt/g' \
|
||||
-e 's/, mode "default"//g' \
|
||||
-e 's/--no-startup-id //g' \
|
||||
-e 's/$ws\([0-9]\)/\1/g' \
|
||||
-e 's/play \(.*\)& //g' \
|
||||
-e "s/\$mod/$mod/g" "${configPath}/config")
|
||||
else
|
||||
exit 1
|
||||
fi
|
||||
for i in "${!helpText[@]}" ; do
|
||||
helpText[$i]="${helpText[$i]//${configPath}\/scripts\//}"
|
||||
helpText[$i]="${helpText[$i]/.sh/}"
|
||||
done
|
||||
helpText+=("End of text. Please press Control+Home to jump to the beginning of this document.")
|
||||
echo "${helpText[@]}" | yad --text-info --show-cursor --title "I38 help" --button "Close:0" --listen
|
||||
|
||||
exit 0
|
Loading…
Reference in New Issue
Block a user