Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
9efa0b110d | |||
c1278a81ee | |||
fa0c32297c | |||
c6f97648c3 | |||
ec8aa3c00a | |||
de95c4284a | |||
390fc4c114 | |||
71cd45f781 | |||
6702dc357b | |||
a7f22597f1 | |||
530c9e5073 | |||
73d16bde78 | |||
ccbb89e372 | |||
8ce2e7eb32 | |||
0e7125d2fc | |||
5671b31715 | |||
a28cbc59ff | |||
ce5f632bfc | |||
2953ecd157 | |||
64cffc7fc7 |
19
README.md
19
README.md
@ -6,6 +6,7 @@ Accessibility setup script for the i3 window manager.
|
|||||||
Released under the terms of the WTFPL License: http://www.wtfpl.net
|
Released under the terms of the WTFPL License: http://www.wtfpl.net
|
||||||
This is a Stormux project: https://stormux.org
|
This is a Stormux project: https://stormux.org
|
||||||
|
|
||||||
|
|
||||||
## Why the name?
|
## Why the name?
|
||||||
|
|
||||||
An uppercase I looks like a 1, 3 from i3, and 8 because the song [We Are 138](https://www.youtube.com/watch?v=-n2Mkdw4q44) rocks!
|
An uppercase I looks like a 1, 3 from i3, and 8 because the song [We Are 138](https://www.youtube.com/watch?v=-n2Mkdw4q44) rocks!
|
||||||
@ -13,9 +14,10 @@ An uppercase I looks like a 1, 3 from i3, and 8 because the song [We Are 138](ht
|
|||||||
|
|
||||||
## Requirements
|
## Requirements
|
||||||
|
|
||||||
|
- i3-wm: The i3 window manager.
|
||||||
- acpi: [optional] for battery status. It will still work even without this package, but uses it if it is installed.
|
- acpi: [optional] for battery status. It will still work even without this package, but uses it if it is installed.
|
||||||
|
- dex: [optional] Alternative method for auto starting applications.
|
||||||
- clipster: clipboard manager
|
- clipster: clipboard manager
|
||||||
- grun: Run application dialog
|
|
||||||
- jq: for getting the current workspace
|
- jq: for getting the current workspace
|
||||||
- libnotify: For sending notifications
|
- libnotify: For sending notifications
|
||||||
- notification-daemon: To handle notifications
|
- notification-daemon: To handle notifications
|
||||||
@ -31,6 +33,7 @@ An uppercase I looks like a 1, 3 from i3, and 8 because the song [We Are 138](ht
|
|||||||
|
|
||||||
I38 will try to detect your browser, file manager, and web browser and present you with a list of options to bind to their launch keys. It will also create bindings for pidgin and mumble if they are installed. To use the bindings, press your ratpoison mode key which is set when you run the i38.sh script. next, press the binding for the application you want, w for web browser, e for text editor, f for file manager, m for mumble, etc. To learn all the bindings, find and read the mode ratpoison section of ~/.config/i3/config.
|
I38 will try to detect your browser, file manager, and web browser and present you with a list of options to bind to their launch keys. It will also create bindings for pidgin and mumble if they are installed. To use the bindings, press your ratpoison mode key which is set when you run the i38.sh script. next, press the binding for the application you want, w for web browser, e for text editor, f for file manager, m for mumble, etc. To learn all the bindings, find and read the mode ratpoison section of ~/.config/i3/config.
|
||||||
|
|
||||||
|
|
||||||
## Usage:
|
## Usage:
|
||||||
|
|
||||||
- With no arguments, create the i3 configuration.
|
- With no arguments, create the i3 configuration.
|
||||||
@ -38,3 +41,17 @@ I38 will try to detect your browser, file manager, and web browser and present y
|
|||||||
- -u: Copy over the latest version of scripts.
|
- -u: Copy over the latest version of scripts.
|
||||||
- -x: Generate ~/.xinitrc and ~/.xprofile.
|
- -x: Generate ~/.xinitrc and ~/.xprofile.
|
||||||
- -X: Generate ~/.xprofile only.
|
- -X: Generate ~/.xprofile only.
|
||||||
|
|
||||||
|
|
||||||
|
## Ratpoison Mode
|
||||||
|
|
||||||
|
I38 is an adaptation of the old Strychnine project which was based on the Ratpoison window manager. Ratpoison is a screen like window manager, and the important concept from that, which applies to I38, is adding keyboard shortcuts without conflicting application shortcuts. This is done with an "escape key".
|
||||||
|
|
||||||
|
When creating I38, I really wanted to port that functionality over, because it is very powerful and allows for lots and lots of shortcuts while minimizing collisions between shortcuts. So, for example, if you have chosen brave as your web browser, and selected alt+escape as your ratpoison mode key, you can quickly launch brave by pressing alt+escape followed by the letter w.
|
||||||
|
|
||||||
|
|
||||||
|
## I38 Help
|
||||||
|
|
||||||
|
To get help for I38, you can press the top level keybinding alt+shift+F1. It is also available by pressing the ratpoison mode key followed by question mark. A limitation of yad, which is used to display the help text means that the cursor starts at the bottom of the text. Please press control+home to jump to the top. You can navigate with the arrow keys, and use control+f to find text within the document.
|
||||||
|
|
||||||
|
The help text is a modified version of the configuration file itself that is intended to be easier to read. I have tried to add in comments that should also serve to make things more clear.
|
||||||
|
94
i38.sh
94
i38.sh
@ -10,7 +10,7 @@ i3msg="i3-msg"
|
|||||||
export DIALOGOPTS='--no-lines --visit-items'
|
export DIALOGOPTS='--no-lines --visit-items'
|
||||||
|
|
||||||
# Check to make sure minimum requirements are installed.
|
# Check to make sure minimum requirements are installed.
|
||||||
for i in dialog grun jq sgtk-menu yad ; do
|
for i in dialog jq sgtk-menu yad ; do
|
||||||
if ! command -v "$i" &> /dev/null ; then
|
if ! command -v "$i" &> /dev/null ; then
|
||||||
missing+=("$i")
|
missing+=("$i")
|
||||||
fi
|
fi
|
||||||
@ -155,15 +155,14 @@ while getopts "${args}" i ; do
|
|||||||
done
|
done
|
||||||
|
|
||||||
# Configuration questions
|
# Configuration questions
|
||||||
export i3Mode=$(yesno "Would you like to use ratpoison mode? This behaves more like strychnine, with an escape key followed by keybindings.")
|
export i3Mode=$(yesno "Would you like to use ratpoison mode? This behaves more like strychnine, with an escape key followed by keybindings. (Recommended)")
|
||||||
if [[ $i3Mode -eq 1 ]]; then
|
|
||||||
mod="Mod4"
|
|
||||||
fi
|
|
||||||
# Prevent setting ratpoison mode key to the same as default mode key
|
# Prevent setting ratpoison mode key to the same as default mode key
|
||||||
while [[ "$escapeKey" == "$mod" ]]; do
|
while [[ "$escapeKey" == "$mod" ]]; do
|
||||||
escapeKey="$(menulist "Ratpoison mode key:" Control+t Control+z Control+Escape Alt+Escape Control+Space Super)"
|
if [[ $i3Mode -eq 0 ]]; then
|
||||||
escapeKey="${escapeKey//Alt/Mod1}"
|
escapeKey="$(menulist "Ratpoison mode key:" Control+t Control+z Control+Escape Alt+Escape Control+Space Super)"
|
||||||
escapeKey="${escapeKey//Super/Mod4}"
|
escapeKey="${escapeKey//Alt/Mod1}"
|
||||||
|
escapeKey="${escapeKey//Super/Mod4}"
|
||||||
|
fi
|
||||||
mod="$(menulist "I3 mod key, for top level bindings:" Alt Control Super)"
|
mod="$(menulist "I3 mod key, for top level bindings:" Alt Control Super)"
|
||||||
mod="${mod//Alt/Mod1}"
|
mod="${mod//Alt/Mod1}"
|
||||||
mod="${mod//Super/Mod4}"
|
mod="${mod//Super/Mod4}"
|
||||||
@ -192,7 +191,7 @@ fi
|
|||||||
webBrowser="$(command -v $webBrowser)"
|
webBrowser="$(command -v $webBrowser)"
|
||||||
# Text editor
|
# Text editor
|
||||||
unset programList
|
unset programList
|
||||||
for i in geany gedit kate kwrite l3afpad leafpad libreoffice mousepad pluma ; do
|
for i in emacs geany gedit kate kwrite l3afpad leafpad libreoffice mousepad pluma ; do
|
||||||
if hash ${i/#-/} &> /dev/null ; then
|
if hash ${i/#-/} &> /dev/null ; then
|
||||||
if [ -n "$programList" ]; then
|
if [ -n "$programList" ]; then
|
||||||
programList="$programList $i"
|
programList="$programList $i"
|
||||||
@ -274,8 +273,11 @@ focus_follows_mouse no
|
|||||||
# is used in the bar {} block below.
|
# is used in the bar {} block below.
|
||||||
font pango:monospace 8
|
font pango:monospace 8
|
||||||
|
|
||||||
|
# I38 help
|
||||||
|
bindsym \$mod+Shift+F1 exec ${i3Path}/scripts/i38-help.sh
|
||||||
|
|
||||||
# Run dialog
|
# Run dialog
|
||||||
bindsym \$mod+F2 exec grun
|
bindsym \$mod+F2 exec ${i3Path}/scripts/run_dialog.sh
|
||||||
|
|
||||||
# Clipboard manager
|
# Clipboard manager
|
||||||
bindsym \$mod+Control+c exec clipster -s
|
bindsym \$mod+Control+c exec clipster -s
|
||||||
@ -372,6 +374,8 @@ if [[ -n "${escapeKey}" ]]; then
|
|||||||
cat << EOF >> ${i3Path}/config
|
cat << EOF >> ${i3Path}/config
|
||||||
bindsym $escapeKey mode "ratpoison"
|
bindsym $escapeKey mode "ratpoison"
|
||||||
mode "ratpoison" {
|
mode "ratpoison" {
|
||||||
|
# I38 help bound to ?
|
||||||
|
bindsym Shift+slash exec ${i3Path}/scripts/i38-help.sh, mode "default"
|
||||||
# Terminal emulator bound to c
|
# Terminal emulator bound to c
|
||||||
bindsym c exec i3-sensible-terminal, mode "default"
|
bindsym c exec i3-sensible-terminal, mode "default"
|
||||||
# Text editor bound to e
|
# Text editor bound to e
|
||||||
@ -380,17 +384,23 @@ bindsym e exec $textEditor, mode "default"
|
|||||||
bindsym f exec $fileBrowser, mode "default"
|
bindsym f exec $fileBrowser, mode "default"
|
||||||
# Web browser bound to w
|
# Web browser bound to w
|
||||||
bindsym w exec $webBrowser, mode "default"
|
bindsym w exec $webBrowser, mode "default"
|
||||||
|
# Kill window bound to k
|
||||||
|
bindsym k kill, mode "default"
|
||||||
$(if command -v mumble &> /dev/null ; then
|
$(if command -v mumble &> /dev/null ; then
|
||||||
|
echo "# Mumble bound to m"
|
||||||
echo "bindsym m exec $(command -v mumble), mode \"default\""
|
echo "bindsym m exec $(command -v mumble), mode \"default\""
|
||||||
fi)
|
fi)
|
||||||
$(if command -v ocrdesktop &> /dev/null ; then
|
$(if command -v ocrdesktop &> /dev/null ; then
|
||||||
|
echo "# OCR desktop bound to print screen alternative \$mod+r"
|
||||||
echo "bindsym Print exec $(command -v ocrdesktop) -b, mode \"default\""
|
echo "bindsym Print exec $(command -v ocrdesktop) -b, mode \"default\""
|
||||||
echo "bindsym \$mod+r exec $(command -v ocrdesktop) -b, mode \"default\""
|
echo "bindsym \$mod+r exec $(command -v ocrdesktop) -b, mode \"default\""
|
||||||
fi)
|
fi)
|
||||||
$(if command -v pidgin &> /dev/null ; then
|
$(if command -v pidgin &> /dev/null ; then
|
||||||
|
echo "# p bound to pidgin"
|
||||||
echo "bindsym p exec $(command -v pidgin), mode \"default\""
|
echo "bindsym p exec $(command -v pidgin), mode \"default\""
|
||||||
fi)
|
fi)
|
||||||
$(if command -v transfersh &> /dev/null ; then
|
$(if command -v transfersh &> /dev/null ; then
|
||||||
|
echo "# 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\""
|
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)
|
fi)
|
||||||
|
|
||||||
@ -419,69 +429,19 @@ bindsym Shift+o exec $(command -v orca) --replace, mode "default"
|
|||||||
bindsym Control+semicolon exec bash -c '$i3msg -t run_command reload && spd-say -P important -Cw "I38 Configuration reloaded."', mode "default"
|
bindsym Control+semicolon exec bash -c '$i3msg -t run_command reload && spd-say -P important -Cw "I38 Configuration reloaded."', mode "default"
|
||||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
||||||
bindsym Control+Shift+semicolon exec bash -c '$i3msg -t run_command restart && spd-say -P important -Cw "I3 restarted."', mode "default"
|
bindsym Control+Shift+semicolon exec bash -c '$i3msg -t run_command restart && spd-say -P important -Cw "I3 restarted."', mode "default"
|
||||||
|
# Run dialog with exclamation
|
||||||
|
bindsym Shift+exclam exec ${i3Path}/scripts/run_dialog.sh, mode "default"
|
||||||
# exit i3 (logs you out of your X session)
|
# exit i3 (logs you out of your X session)
|
||||||
bindsym Control+q exec bash -c 'yad --image "dialog-question" --title "I38" --button=yes:0 --button=no:1 --text "You pressed the exit shortcut. Do you really want to exit i3? This will end your X session." && $i3msg -t run_command exit'
|
bindsym Control+q exec bash -c 'yad --image "dialog-question" --title "I38" --button=yes:0 --button=no:1 --text "You pressed the exit shortcut. Do you really want to exit i3? This will end your X session." && $i3msg -t run_command exit'
|
||||||
|
# Exit ratpoison mode without any action escape or Control+g
|
||||||
bindsym Escape mode "default"
|
bindsym Escape mode "default"
|
||||||
|
bindsym Control+g mode "default"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For those who do not want ratpoison mode.
|
|
||||||
if [[ -z "${escapeKey}" ]]; then
|
|
||||||
cat << EOF >> ${i3Path}/config
|
|
||||||
# Text editor bound to $mod+e
|
|
||||||
bindsym \$mod+e exec $textEditor
|
|
||||||
# File browser bound to $mod+f
|
|
||||||
bindsym \$mod+f exec $fileBrowser
|
|
||||||
# Web browser bound to $mod+w
|
|
||||||
bindsym \$mod+w exec $webBrowser
|
|
||||||
|
|
||||||
$(if command -v mumble &> /dev/null ; then
|
|
||||||
echo "bindsym \$mod+m exec $(command -v mumble)"
|
|
||||||
fi)
|
|
||||||
$(if command -v ocrdesktop &> /dev/null ; then
|
|
||||||
echo "bindsym Print exec $(command -v ocrdesktop)' -b"
|
|
||||||
fi)
|
|
||||||
$(if command -v pidgin &> /dev/null ; then
|
|
||||||
echo "bindsym \$mod+p exec $(command -v pidgin)"
|
|
||||||
fi)
|
|
||||||
$(if command -v transfersh &> /dev/null ; then
|
|
||||||
echo 'bindsym \$mod+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)'"'"
|
|
||||||
fi)
|
|
||||||
#Keyboard based volume controls using pulseaudio
|
|
||||||
bindsym \$mod+Shift+0 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +${volumeJump}% & play -qnG synth 0.03 sin 440
|
|
||||||
bindsym \$mod+Shift+9 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -${volumeJump}% & play -qnG synth 0.03 sin 440
|
|
||||||
# Music player controls
|
|
||||||
# Requires playerctl.
|
|
||||||
bindsym \$mod+Shift+equal exec --no-startup-id ${i3Path}/scripts/music_controler.sh incvol $volumeJump
|
|
||||||
bindsym \$mod+Shift+minus exec --no-startup-id ${i3Path}/scripts/music_controler.sh decvol $volumeJump
|
|
||||||
bindsym \$mod+Shift+z exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh prev
|
|
||||||
bindsym \$mod+Shift+c exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh pause
|
|
||||||
bindsym \$mod+Shift+x exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh play
|
|
||||||
bindsym \$mod+Shift+v exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh stop
|
|
||||||
bindsym \$mod+Shift+b exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh next
|
|
||||||
bindsym \$mod+Shift+u exec --no-startup-id play -qV0 "| sox -np synth 0.03 sin 2000 pad 0 .02" "| sox -np synth 0.03 sin 2000" norm 1.0 vol 0.4 & ${i3Path}/scripts/music_controler.sh info
|
|
||||||
#Check battery status
|
|
||||||
bindsym \$mod+b exec --no-startup-id ${i3Path}/scripts/battery_status.sh
|
|
||||||
#Check controller battery status
|
|
||||||
bindsym \$mod+g exec ${i3Path}/scripts/game_controler.sh -s
|
|
||||||
# Get a list of windows in the current workspace
|
|
||||||
bindsym \$mod+apostrophe exec --no-startup-id ${i3Path}/scripts/window_list.sh
|
|
||||||
# Restart orca
|
|
||||||
bindsym \$mod+Shift+o exec $(command -v orca) --replace
|
|
||||||
# reload the configuration file
|
|
||||||
bindsym \$mod+Control+semicolon exec bash -c '$i3msg -t run_command reload && spd-say -P important -Cw "I38 Configuration reloaded."'
|
|
||||||
# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)
|
|
||||||
bindsym \$mod+Control+Shift+semicolon exec bash -c '$i3msg -t run_command restart && spd-say -P important -Cw "I3 restarted."'
|
|
||||||
# exit i3 (logs you out of your X session)
|
|
||||||
bindsym \$mod+Control+q exec bash -c 'yad --image "dialog-question" --title "I38" --button=yes:0 --button=no:1 --text "You pressed the exit shortcut. Do you really want to exit i3? This will end your X session." && $i3msg -t run_command exit'
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
EOF
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat << EOF >> ${i3Path}/config
|
cat << EOF >> ${i3Path}/config
|
||||||
# Auto start section
|
# Auto start section
|
||||||
@ -494,13 +454,17 @@ fi
|
|||||||
if [[ -x "/usr/lib/notification-daemon-1.0/notification-daemon" ]]; then
|
if [[ -x "/usr/lib/notification-daemon-1.0/notification-daemon" ]]; then
|
||||||
echo 'exec_always --no-startup-id /usr/lib/notification-daemon-1.0/notification-daemon -r'
|
echo 'exec_always --no-startup-id /usr/lib/notification-daemon-1.0/notification-daemon -r'
|
||||||
fi
|
fi
|
||||||
|
# Work around for weird Void Linux stuff.
|
||||||
|
if [[ -x "/usr/libexec/notification-daemon" ]]; then
|
||||||
|
echo 'exec_always --no-startup-id /usr/libexec/notification-daemon -r'
|
||||||
|
fi
|
||||||
if [[ $dex -eq 0 ]]; then
|
if [[ $dex -eq 0 ]]; then
|
||||||
echo '# Start XDG autostart .desktop files using dex. See also'
|
echo '# Start XDG autostart .desktop files using dex. See also'
|
||||||
echo '# https://wiki.archlinux.org/index.php/XDG_Autostart'
|
echo '# https://wiki.archlinux.org/index.php/XDG_Autostart'
|
||||||
echo 'exec --no-startup-id dex --autostart --environment i3'
|
echo 'exec --no-startup-id dex --autostart --environment i3'
|
||||||
else
|
else
|
||||||
echo '# Startup applications'
|
echo '# Startup applications'
|
||||||
echo 'exec clipster -d'
|
echo 'exec --no-startup-id clipster -d'
|
||||||
echo 'exec orca'
|
echo 'exec orca'
|
||||||
fi)
|
fi)
|
||||||
|
|
||||||
|
32
scripts/i38-help.sh
Executable file
32
scripts/i38-help.sh
Executable file
@ -0,0 +1,32 @@
|
|||||||
|
#!/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/}"
|
||||||
|
helpText[$i]="${helpText[$i]/, exec announce*/$'\n'}"
|
||||||
|
helpText[$i]="${helpText[$i]/, exec spd-say*/$'\n'}"
|
||||||
|
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
|
45
scripts/run_dialog.sh
Executable file
45
scripts/run_dialog.sh
Executable file
@ -0,0 +1,45 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
|
||||||
|
write_history(){
|
||||||
|
oldHistory="$(grep -v "$txt" "${historyPath}/.history" | head -n 49)"
|
||||||
|
echo -e "$txt\n$oldHistory" | sed 's/^$//g' > "${historyPath}/.history"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
historyPath="$(readlink -f $0)"
|
||||||
|
historyPath="${historyPath%/*}"
|
||||||
|
if ! [[ -d "$historyPath" ]]; then
|
||||||
|
mkdir -p "$historyPath"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -f "${historyPath}/.history" ]]; then
|
||||||
|
txt="$(yad --entry --editable --title "I38" --text "Execute program or enter file" --button "Open:0" --separator "\n" --rest "${historyPath}/.history")"
|
||||||
|
else
|
||||||
|
txt="$(yad --entry --title "I38" --text "Execute program or enter file" --button "Open:0")"
|
||||||
|
fi
|
||||||
|
if [[ -z "$txt" ]]; then
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [[ "$txt" =~ ^ftp://|^http://|^https://|^www.* ]]; then
|
||||||
|
xdg-open $txt
|
||||||
|
write_history
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [[ "$txt" =~ ^mailto://.* ]]; then
|
||||||
|
xdg-email $txt
|
||||||
|
write_history
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if [[ "$txt" =~ ^man://.* ]]; then
|
||||||
|
eval "${txt/:\/\// }" | yad --text-info --show-cursor --button "Close:0" --title "I38" -
|
||||||
|
write_history
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
if command -v "$(echo "$txt" | cut -d " " -f1)" &> /dev/null ; then
|
||||||
|
eval $txt&
|
||||||
|
else
|
||||||
|
xdg-open $txt&
|
||||||
|
fi
|
||||||
|
write_history
|
||||||
|
exit 0
|
Reference in New Issue
Block a user