Experimental way to add applications to ratpoison modd during I38 configuration. Removed transfer.sh because I think it's dead.
This commit is contained in:
parent
0368d764c6
commit
365d7ec37b
126
README.md
126
README.md
@ -38,7 +38,6 @@ scrot: For OCR
|
||||
- sox: for sounds.
|
||||
- tesseract: For OCR
|
||||
- tesseract-data-eng: For OCR
|
||||
- transfersh: [optional] for file sharing GUI
|
||||
- udiskie: [optional] for automatically mounting removable storage
|
||||
- x11bell: [optional] Bell support if you do not have a PC speaker. Available from https://github.com/jovanlanik/x11bell
|
||||
- xbacklight: [optional] for screen brightness adjustment
|
||||
@ -47,9 +46,11 @@ scrot: For OCR
|
||||
- xorg-setxkbmap: [optional] for multiple keyboard layouts
|
||||
- yad: For screen reader accessible dialogs
|
||||
|
||||
I38 will try to detect your browser, file manager, and text editor 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 or use the help binding key, alt or super depending on your settings with Shift+F1.
|
||||
I38 will try to detect your browser, file manager, and text editor 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. Additionally, you can now add custom applications with your own keybindings during the setup process. 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 or use the help binding key, alt or super depending on your settings with Shift+F1.
|
||||
|
||||
The login sound uses the GTK sound theme. Configure this using GTK configuration files or gsettings. Replace "name" with the name of the theme you want to use.
|
||||
Ratpoison mode is now enabled by default for better accessibility and ease of use.
|
||||
|
||||
Sound themes can be configured using GTK configuration files or gsettings. Replace "name" with the name of the theme you want to use.
|
||||
|
||||
Note that if you enable all sound events as shown below, you'll also hear GTK sounds when moving around menus, buttons, etc, if the sound theme has sounds for those events.
|
||||
|
||||
@ -94,6 +95,125 @@ I38 is an adaptation of the old Strychnine project which was based on the Ratpoi
|
||||
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.
|
||||
|
||||
|
||||
## Custom Applications in Ratpoison Mode
|
||||
|
||||
I38 now includes a powerful system for adding custom applications to ratpoison mode with user-defined keybindings. During the configuration process, after setting up window event sounds, you'll be prompted to add custom applications that will be accessible through ratpoison mode.
|
||||
|
||||
### How It Works
|
||||
|
||||
The system will prompt you through a series of questions for each application you want to add:
|
||||
|
||||
1. **Application Name**: A descriptive name for the application
|
||||
2. **Execution Command**: The full path or command to run the application
|
||||
3. **Command Flags**: Optional command-line arguments
|
||||
4. **Keybinding**: A custom key combination using I38's notation system
|
||||
|
||||
### Keybinding Notation System
|
||||
|
||||
I38 uses a simple notation system to define keybindings that supports modifiers and special keys:
|
||||
|
||||
#### Modifiers
|
||||
- `^` = Control (Ctrl)
|
||||
- `!` = Alt
|
||||
- `#` = Super (Windows/Cmd key)
|
||||
- `m` = Your chosen mod key (configured during setup)
|
||||
- Uppercase letters automatically add Shift (e.g., `C` = Shift+c)
|
||||
|
||||
#### Special Keys
|
||||
- **Function Keys**: `f1`, `f2`, ... `f12`
|
||||
- **Arrow Keys**: `up`, `down`, `left`, `right`
|
||||
- **Navigation Keys**: `home`, `end`, `pageup`, `pagedown`
|
||||
- **Editing Keys**: `insert`, `delete`, `backspace`
|
||||
- **Other Keys**: `space`, `tab`, `return`, `escape`, `print`
|
||||
|
||||
#### Example Keybindings
|
||||
- `c` = Just the 'c' key
|
||||
- `^c` = Control+c
|
||||
- `!f1` = Alt+F1
|
||||
- `mspace` = Your mod key + Space
|
||||
- `^!up` = Control+Alt+Up arrow
|
||||
- `#pagedown` = Super+Page Down
|
||||
- `C` = Shift+c
|
||||
- `^C` = Control+Shift+c
|
||||
|
||||
### Example Configuration Session
|
||||
|
||||
Here's what the configuration prompts look like:
|
||||
|
||||
```
|
||||
Enter application name (or press enter when finished): Discord
|
||||
Enter execution path/command for Discord: discord
|
||||
Enter command line flags for Discord (optional): --no-sandbox
|
||||
Enter keybinding for Discord (Examples: c, ^c, !f1, mspace, ^!up) or ? for help: d
|
||||
```
|
||||
|
||||
Another example:
|
||||
```
|
||||
Enter application name (or press enter when finished): Terminal Calculator
|
||||
Enter execution path/command for Terminal Calculator: gnome-calculator
|
||||
Enter command line flags for Terminal Calculator (optional):
|
||||
Enter keybinding for Terminal Calculator (Examples: c, ^c, !f1, mspace, ^!up) or ? for help: ^#c
|
||||
```
|
||||
|
||||
### Getting Help During Configuration
|
||||
|
||||
If you type `?` when prompted for a keybinding, I38 will display a comprehensive help screen with:
|
||||
- Complete modifier notation reference
|
||||
- List of all supported special keys
|
||||
- Multiple examples of different keybinding combinations
|
||||
- Rules about uppercase letters and Shift
|
||||
|
||||
### Conflict Detection
|
||||
|
||||
I38 automatically prevents keybinding conflicts by:
|
||||
- Maintaining a list of all existing ratpoison mode bindings
|
||||
- Checking your custom keybinding against reserved keys
|
||||
- Showing an error message if you try to use a taken keybinding
|
||||
- Asking you to choose a different key combination
|
||||
|
||||
### Reserved Keybindings
|
||||
|
||||
The following keys are already used in ratpoison mode and cannot be assigned to custom applications:
|
||||
|
||||
- `c` = Terminal
|
||||
- `e` = Text editor
|
||||
- `f` = File manager
|
||||
- `w` = Web browser
|
||||
- `k` = Kill window
|
||||
- `m` = Mumble (if installed)
|
||||
- `p` = Pidgin (if installed)
|
||||
- `g` = Game controller status
|
||||
- Various modifier combinations for volume, music controls, etc.
|
||||
|
||||
### Using Your Custom Applications
|
||||
|
||||
Once configured, access your custom applications by:
|
||||
1. Press your ratpoison mode key (e.g., Alt+Escape)
|
||||
2. Press your custom keybinding (e.g., `d` for Discord)
|
||||
3. The application launches and ratpoison mode exits
|
||||
|
||||
### Advanced Examples
|
||||
|
||||
**Media Applications:**
|
||||
- `vlc` bound to `v` for VLC media player
|
||||
- `spotify` bound to `^s` for Spotify with Control+s
|
||||
|
||||
**Development Tools:**
|
||||
- `code` bound to `mf2` for VS Code with mod+F2
|
||||
- `gimp` bound to `!g` for GIMP with Alt+g
|
||||
|
||||
**System Tools:**
|
||||
- `htop` bound to `^#h` for system monitor with Control+Super+h
|
||||
- `pavucontrol` bound to `!space` for audio control with Alt+Space
|
||||
|
||||
### Tips for Choosing Keybindings
|
||||
|
||||
1. **Keep it memorable**: Use the first letter of the application name when possible
|
||||
2. **Group related apps**: Use similar modifiers for related applications
|
||||
3. **Consider frequency**: Use simpler keys for frequently used applications
|
||||
4. **Avoid conflicts**: The system will warn you, but plan ahead for a logical layout
|
||||
|
||||
|
||||
## Panel Mode
|
||||
|
||||
Very similar to ratpoison, accessed with Alt+Control+Tab. It contains items that would normally be found in a traditional desktop's panel. For example, it has a simple note app, system information, weather, bluetooth and power options, and remind.
|
||||
|
185
i38.sh
185
i38.sh
@ -178,6 +178,162 @@ yesno() {
|
||||
echo $?
|
||||
}
|
||||
|
||||
# Custom application keybinding functions
|
||||
declare -A usedKeys
|
||||
declare -a customApps
|
||||
|
||||
showKeybindingHelp() {
|
||||
dialog --title "I38 Keybinding Help" --msgbox \
|
||||
"Keybinding Notation:
|
||||
Modifiers: ^ = Ctrl, ! = Alt, # = Super, m = your mod key
|
||||
Special keys: f1-f12, up/down/left/right, space, tab, return
|
||||
home/end/insert/delete/pageup/pagedown, print
|
||||
backspace, escape
|
||||
|
||||
Examples:
|
||||
c = just 'c' key
|
||||
^c = Ctrl+c
|
||||
!f1 = Alt+F1
|
||||
mspace = mod+Space
|
||||
^!up = Ctrl+Alt+Up
|
||||
#pagedown = Super+Page_Down
|
||||
|
||||
Uppercase letters imply Shift (e.g., C = Shift+c)" 0 0
|
||||
}
|
||||
|
||||
convertKeybinding() {
|
||||
local input="$1"
|
||||
local result=""
|
||||
local baseKey=""
|
||||
|
||||
# Handle modifiers
|
||||
if [[ "$input" == *"^"* ]]; then
|
||||
result+="Control+"
|
||||
input="${input//^/}"
|
||||
fi
|
||||
if [[ "$input" == *"!"* ]]; then
|
||||
result+="Mod1+"
|
||||
input="${input//!/}"
|
||||
fi
|
||||
if [[ "$input" == *"#"* ]]; then
|
||||
result+="Mod4+"
|
||||
input="${input//#/}"
|
||||
fi
|
||||
if [[ "$input" == *"m"* ]]; then
|
||||
result+="\$mod+"
|
||||
input="${input//m/}"
|
||||
fi
|
||||
|
||||
# Handle shift for uppercase letters
|
||||
if [[ "$input" =~ [A-Z] ]]; then
|
||||
result+="Shift+"
|
||||
input="${input,,}"
|
||||
fi
|
||||
|
||||
# Convert special keys
|
||||
case "$input" in
|
||||
f[1-9]|f1[0-2]) baseKey="F${input#f}" ;;
|
||||
up|down|left|right) baseKey="$input" ;;
|
||||
space) baseKey="space" ;;
|
||||
tab) baseKey="Tab" ;;
|
||||
return) baseKey="Return" ;;
|
||||
escape) baseKey="Escape" ;;
|
||||
backspace) baseKey="BackSpace" ;;
|
||||
print) baseKey="Print" ;;
|
||||
home) baseKey="Home" ;;
|
||||
end) baseKey="End" ;;
|
||||
insert) baseKey="Insert" ;;
|
||||
delete) baseKey="Delete" ;;
|
||||
pageup) baseKey="Page_Up" ;;
|
||||
pagedown) baseKey="Page_Down" ;;
|
||||
*) baseKey="$input" ;;
|
||||
esac
|
||||
|
||||
echo "${result}${baseKey}"
|
||||
}
|
||||
|
||||
populateUsedKeys() {
|
||||
# Populate with existing ratpoison mode bindings
|
||||
usedKeys["Shift+slash"]=1
|
||||
usedKeys["c"]=1
|
||||
usedKeys["e"]=1
|
||||
usedKeys["f"]=1
|
||||
usedKeys["\$mod+e"]=1
|
||||
usedKeys["w"]=1
|
||||
usedKeys["k"]=1
|
||||
usedKeys["m"]=1
|
||||
usedKeys["Print"]=1
|
||||
usedKeys["\$mod+r"]=1
|
||||
usedKeys["p"]=1
|
||||
usedKeys["\$mod+s"]=1
|
||||
usedKeys["Mod1+Shift+0"]=1
|
||||
usedKeys["Mod1+Shift+9"]=1
|
||||
usedKeys["Mod1+Shift+equal"]=1
|
||||
usedKeys["Mod1+Shift+minus"]=1
|
||||
usedKeys["Mod1+Shift+z"]=1
|
||||
usedKeys["Mod1+Shift+c"]=1
|
||||
usedKeys["Mod1+Shift+x"]=1
|
||||
usedKeys["Mod1+Shift+v"]=1
|
||||
usedKeys["Mod1+Shift+b"]=1
|
||||
usedKeys["Mod1+Shift+u"]=1
|
||||
usedKeys["Mod1+b"]=1
|
||||
usedKeys["g"]=1
|
||||
usedKeys["apostrophe"]=1
|
||||
usedKeys["Shift+c"]=1
|
||||
usedKeys["Shift+o"]=1
|
||||
usedKeys["Shift+t"]=1
|
||||
usedKeys["Control+semicolon"]=1
|
||||
usedKeys["Control+Shift+semicolon"]=1
|
||||
usedKeys["Shift+exclam"]=1
|
||||
usedKeys["Control+q"]=1
|
||||
usedKeys["Escape"]=1
|
||||
usedKeys["Control+g"]=1
|
||||
}
|
||||
|
||||
inputText() {
|
||||
# Args: prompt text
|
||||
dialog --title "I38" --inputbox "$1" 0 0 --stdout
|
||||
}
|
||||
|
||||
addCustomApplication() {
|
||||
local appName appCommand appFlags keybinding convertedKey
|
||||
|
||||
populateUsedKeys
|
||||
|
||||
while true; do
|
||||
appName="$(inputText "Custom Applications:\n\nEnter application name (or press enter when finished):")"
|
||||
[[ -z "$appName" ]] && break
|
||||
|
||||
appCommand="$(inputText "Enter execution path/command for $appName:")"
|
||||
[[ -z "$appCommand" ]] && continue
|
||||
|
||||
appFlags="$(inputText "Enter command line flags for $appName (optional):")"
|
||||
|
||||
while true; do
|
||||
keybinding="$(inputText "Enter keybinding for $appName (Examples: c, ^c, !f1, mspace, ^!up) or ? for help:")"
|
||||
|
||||
if [[ "$keybinding" == "?" ]]; then
|
||||
showKeybindingHelp
|
||||
continue
|
||||
fi
|
||||
|
||||
[[ -z "$keybinding" ]] && break
|
||||
|
||||
convertedKey="$(convertKeybinding "$keybinding")"
|
||||
|
||||
if [[ -n "${usedKeys[$convertedKey]}" ]]; then
|
||||
dialog --title "I38" --msgbox "Keybinding '$keybinding' ($convertedKey) is already in use. Please choose another." 0 0
|
||||
continue
|
||||
fi
|
||||
|
||||
# Add to arrays
|
||||
customApps+=("$appName|$appCommand|$appFlags|$convertedKey")
|
||||
usedKeys["$convertedKey"]=1
|
||||
break
|
||||
done
|
||||
done
|
||||
}
|
||||
|
||||
help() {
|
||||
echo "${0##*/}"
|
||||
echo "Released under the terms of the GPL V3 License: https://www.gnu.org/licenses/"
|
||||
@ -281,14 +437,13 @@ done
|
||||
# Mod2 and Mod3 not usually defined.
|
||||
|
||||
# Configuration questions
|
||||
export i3Mode=$(yesno "Would you like to use ratpoison mode? This behaves more like strychnine, with an escape key followed by keybindings. (Recommended)")
|
||||
# Ratpoison mode is enabled by default
|
||||
export i3Mode=0
|
||||
# Prevent setting ratpoison mode key to the same as default mode key
|
||||
while [[ "$escapeKey" == "$mod" ]]; do
|
||||
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}"
|
||||
@ -412,11 +567,8 @@ brlapi=1
|
||||
brlapi=$(yesno "Do you want to use a braille display with ${screenReader##*/}?")
|
||||
sounds=1
|
||||
sounds=$(yesno "Do you want window event sounds?")
|
||||
# Play Login Sound
|
||||
loginSound=1
|
||||
if command -v canberra-gtk-play &> /dev/null ; then
|
||||
export loginSound=$(yesno "Would you like to play the default desktop-login sound according to your GTK sound theme upon login?")
|
||||
fi
|
||||
# Custom applications for ratpoison mode
|
||||
addCustomApplication
|
||||
|
||||
if [[ -d "${i3Path}" ]]; then
|
||||
yesno "This will replace your existing configuration at ${i3Path}. Do you want to continue?" || exit 0
|
||||
@ -662,10 +814,6 @@ $(if command -v xrandr &> /dev/null ; then
|
||||
echo "# alt+s bound to brightness control"
|
||||
echo "bindsym \$mod+s exec --no-startup-id ${i3Path}/scripts/screen_controller.sh, 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)
|
||||
|
||||
#Keyboard based volume Controls with pulseaudio
|
||||
bindsym Mod1+Shift+0 exec --no-startup-id pactl set-sink-volume @DEFAULT_SINK@ +${volumeJump}% & play -qnG synth 0.03 sin 440
|
||||
@ -702,6 +850,16 @@ else
|
||||
echo "# restart i3 inplace (preserves your layout/session, can be used to upgrade i3)"
|
||||
echo "bindsym Control+Shift+semicolon exec $i3msg -t run_command restart && spd-say -P important -Cw "I3 restarted.", mode "default""
|
||||
fi)
|
||||
# Custom applications
|
||||
$(for app in "${customApps[@]}"; do
|
||||
IFS='|' read -r appName appCommand appFlags appKey <<< "$app"
|
||||
echo "# $appName bound to $appKey"
|
||||
if [[ -n "$appFlags" ]]; then
|
||||
echo "bindsym $appKey exec $appCommand $appFlags, mode \"default\""
|
||||
else
|
||||
echo "bindsym $appKey exec $appCommand, mode \"default\""
|
||||
fi
|
||||
done)
|
||||
# Run dialog with exclamation
|
||||
bindsym Shift+exclam exec ${i3Path}/scripts/run_dialog.sh, mode "default"
|
||||
# exit i3 (logs you out of your X session)
|
||||
@ -725,9 +883,6 @@ $(if [[ $sounds -eq 0 ]]; then
|
||||
echo "exec_always --no-startup-id ${i3Path}/scripts/sound.py"
|
||||
fi
|
||||
fi
|
||||
if [[ $loginSound -eq 0 ]]; then
|
||||
echo 'exec --no-startup-id canberra-gtk-play -i desktop-login'
|
||||
fi
|
||||
if [[ $brlapi -eq 0 ]]; then
|
||||
echo 'exec --no-startup-id xbrlapi --quiet'
|
||||
fi
|
||||
|
Loading…
x
Reference in New Issue
Block a user