17 Commits

Author SHA1 Message Date
390fc4c114 Fixed a bug in the run dialog. 2023-03-29 18:22:36 -04:00
71cd45f781 More work on the help display. 2023-03-29 00:47:07 -04:00
6702dc357b Added control+g to exit ratpoison mode, so that it is more in line with ratpoison. 2023-03-28 19:56:08 -04:00
a7f22597f1 Fixed a bug in rp mode kill. 2023-03-28 19:43:00 -04:00
530c9e5073 Kill window shortcut added to ratpoison mode as k. Comments should show up now that did not before in the config file. 2023-03-28 18:43:13 -04:00
73d16bde78 Added emacs as an editor choice. 2023-03-28 00:38:57 -04:00
ccbb89e372 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. 2023-03-27 23:44:42 -04:00
8ce2e7eb32 Updated the README. 2023-03-24 18:40:46 -04:00
0e7125d2fc Replacement for grun, added custom I38 run dialog instead. 2023-03-24 18:40:01 -04:00
5671b31715 Replacement for grun, added custom I38 run dialog instead. 2023-03-24 18:34:09 -04:00
a28cbc59ff Replacement for grun, added custom I38 run dialog instead. 2023-03-24 18:21:55 -04:00
ce5f632bfc Fixed a bug where i3's mod key was being automatically set to super if a ratpoison mode key was not selected. 2023-03-24 17:29:18 -04:00
2953ecd157 Added dex to package list. It's an optional alternative for automatically launching applications when i3 starts. 2023-03-19 17:25:25 -04:00
64cffc7fc7 Added i3-wm to dependency list because it's surprisingly easy to forget to install it. 2023-03-04 17:37:21 -05:00
e0ac69b66e Updated ocrdesktop to use -b for faster recognission.
Added mod+r in ratpoison layer for those who don't have a prinnt key.
2023-02-05 09:36:56 -07:00
689b997dae Added keybinding to ratpoison mode to launch a terminal. 2023-01-23 12:34:58 -05:00
1a0daf36a8 Ever had an old discman? I certainly did. Now music related keys apart from music volume beep, just like that discman you had back in the late 90s and early 2000s! 2022-12-23 05:27:33 -07:00
4 changed files with 126 additions and 31 deletions

View File

@ -13,9 +13,10 @@ An uppercase I looks like a 1, 3 from i3, and 8 because the song [We Are 138](ht
## 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.
- dex: [optional] Alternative method for auto starting applications.
- clipster: clipboard manager
- grun: Run application dialog
- jq: for getting the current workspace
- libnotify: For sending notifications
- notification-daemon: To handle notifications

77
i38.sh
View File

@ -10,7 +10,7 @@ i3msg="i3-msg"
export DIALOGOPTS='--no-lines --visit-items'
# 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
missing+=("$i")
fi
@ -156,14 +156,13 @@ done
# Configuration questions
export i3Mode=$(yesno "Would you like to use ratpoison mode? This behaves more like strychnine, with an escape key followed by keybindings.")
if [[ $i3Mode -eq 1 ]]; then
mod="Mod4"
fi
# Prevent setting ratpoison mode key to the same as default mode key
while [[ "$escapeKey" == "$mod" ]]; do
escapeKey="$(menulist "Ratpoison mode key:" Control+t Control+z Control+Escape Alt+Escape Control+Space Super)"
escapeKey="${escapeKey//Alt/Mod1}"
escapeKey="${escapeKey//Super/Mod4}"
if [[ $i3Mode -eq 0 ]]; then
escapeKey="$(menulist "Ratpoison mode key:" Control+t Control+z Control+Escape Alt+Escape Control+Space Super)"
escapeKey="${escapeKey//Alt/Mod1}"
escapeKey="${escapeKey//Super/Mod4}"
fi
mod="$(menulist "I3 mod key, for top level bindings:" Alt Control Super)"
mod="${mod//Alt/Mod1}"
mod="${mod//Super/Mod4}"
@ -192,7 +191,7 @@ fi
webBrowser="$(command -v $webBrowser)"
# Text editor
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 [ -n "$programList" ]; then
programList="$programList $i"
@ -274,8 +273,11 @@ 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 grun
bindsym \$mod+F2 exec ${i3Path}/scripts/run_dialog.sh
# Clipboard manager
bindsym \$mod+Control+c exec clipster -s
@ -292,12 +294,12 @@ bindsym \$mod+XF86AudioMute exec --no-startup-id ${i3Path}/scripts/mute-unmute.s
# Requires playerctl.
bindsym XF86AudioRaiseVolume exec --no-startup-id ${i3Path}/scripts/music_controler.sh incvol $volumeJump
bindsym XF86AudioLowerVolume exec --no-startup-id ${i3Path}/scripts/music_controler.sh decvol $volumeJump
bindsym XF86AudioPrev exec --no-startup-id ${i3Path}/scripts/music_controler.sh prev
bindsym XF86AudioMute exec --no-startup-id ${i3Path}/scripts/music_controler.sh pause
bindsym XF86AudioPlay exec --no-startup-id ${i3Path}/scripts/music_controler.sh play
bindsym \$mod+XF86AudioPlay exec --no-startup-id ${i3Path}/scripts/music_controler.sh info
bindsym XF86AudioStop exec --no-startup-id ${i3Path}/scripts/music_controler.sh stop
bindsym XF86AudioNext exec --no-startup-id ${i3Path}/scripts/music_controler.sh next
bindsym XF86AudioPrev 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 XF86AudioMute 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 XF86AudioPlay 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+XF86AudioPlay 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
bindsym XF86AudioStop 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 XF86AudioNext 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
# start a terminal
bindsym \$mod+Return exec i3-sensible-terminal
@ -372,22 +374,33 @@ 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
bindsym e exec $textEditor, mode "default"
# File browser bound to f
bindsym f exec $fileBrowser, mode "default"
# Web browser bound to w
bindsym w exec $webBrowser, mode "default"
# Kill window bound to k
bindsym k kill, mode "default"
$(if command -v mumble &> /dev/null ; then
echo "# Mumble bound to m"
echo "bindsym m exec $(command -v mumble), mode \"default\""
fi)
$(if command -v ocrdesktop &> /dev/null ; then
echo "bindsym Print exec $(command -v ocrdesktop), mode \"default\""
echo "# 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
echo "# p bound to pidgin"
echo "bindsym p exec $(command -v pidgin), mode \"default\""
fi)
$(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\""
fi)
@ -397,13 +410,13 @@ bindsym Mod1+Shift+9 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ -
# Music player controls
# Requires playerctl.
bindsym Mod1+Shift+equal exec --no-startup-id ${i3Path}/scripts/music_controler.sh incvol $volumeJump, mode "default"
bindsym Mod1+Shift+minus exec --no-startup-id ${i3Path}/scripts/music_controler.sh decvol $volumeJump, mode "default"
bindsym Mod1+Shift+z exec --no-startup-id ${i3Path}/scripts/music_controler.sh prev, mode "default"
bindsym Mod1+Shift+c exec --no-startup-id ${i3Path}/scripts/music_controler.sh pause, mode "default"
bindsym Mod1+Shift+x exec --no-startup-id ${i3Path}/scripts/music_controler.sh play, mode "default"
bindsym Mod1+Shift+v exec --no-startup-id ${i3Path}/scripts/music_controler.sh stop, mode "default"
bindsym Mod1+Shift+b exec --no-startup-id ${i3Path}/scripts/music_controler.sh next, mode "default"
bindsym Mod1+Shift+u exec --no-startup-id ${i3Path}/scripts/music_controler.sh info, mode "default"
bindsym Mod1+Shift+minus exec --no-startup-id ${i3Path}/scripts/music_controler.sh decvol $volumeJump, mode "default"
bindsym Mod1+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, mode "default"
bindsym Mod1+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, mode "default"
bindsym Mod1+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, mode "default"
bindsym Mod1+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, mode "default"
bindsym Mod1+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, mode "default"
bindsym Mod1+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, mode "default"
#Check battery status
bindsym Mod1+b exec --no-startup-id ${i3Path}/scripts/battery_status.sh, mode "default"
#Check controller battery status
@ -416,9 +429,13 @@ 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"
# 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"
# Run dialog with exclamation
bindsym Shift+exclam exec ${i3Path}/scripts/run_dialog.sh, mode "default"
# 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'
# Exit ratpoison mode without any action escape or Control+g
bindsym Escape mode "default"
bindsym Control+g mode "default"
}
@ -439,7 +456,7 @@ $(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)"
echo "bindsym Print exec $(command -v ocrdesktop)' -b"
fi)
$(if command -v pidgin &> /dev/null ; then
echo "bindsym \$mod+p exec $(command -v pidgin)"
@ -454,12 +471,12 @@ bindsym \$mod+Shift+9 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@
# 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 ${i3Path}/scripts/music_controler.sh prev
bindsym \$mod+Shift+c exec --no-startup-id ${i3Path}/scripts/music_controler.sh pause
bindsym \$mod+Shift+x exec --no-startup-id ${i3Path}/scripts/music_controler.sh play
bindsym \$mod+Shift+v exec --no-startup-id ${i3Path}/scripts/music_controler.sh stop
bindsym \$mod+Shift+b exec --no-startup-id ${i3Path}/scripts/music_controler.sh next
bindsym \$mod+Shift+u exec --no-startup-id ${i3Path}/scripts/music_controler.sh info
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

32
scripts/i38-help.sh Executable file
View 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
View 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