Gaming Scripts in Rofi Menu

- Add script to emulate DualSense as Xbox 360 controller
- Fix "help" output of brightness.sh
- Add rofi menu for gaming scripts
- Add gaming rofi menu to control center
This commit is contained in:
Sravan Balaji
2022-09-18 18:10:55 -04:00
parent c280c408a3
commit c2dd0cca51
5 changed files with 152 additions and 2 deletions

View File

@@ -1,6 +1,6 @@
#!/bin/bash
help_menu() {
echo "Script to interact with pactl. Use only one argument at a time."
echo "Script to control brightness. Use only one argument at a time."
# echo " - Play / Pause: playerctl.sh --play-pause"
# echo " - Next: playerctl.sh --next"
# echo " - Previous: playerctl.sh --prev"

View File

@@ -19,6 +19,7 @@ rofi_menu() {
" Backup - backup"
" Startup Processes - startup"
" Hardware - cpu-gpu"
" Gaming - gaming"
" Power Menu - session"
" Back - back"
" Quit - quit"
@@ -67,6 +68,9 @@ main() {
--cpu-gpu)
/home/sravan/.scripts/cpu-gpu.sh --rofi
;;
--gaming)
/home/sravan/.scripts/gaming.sh --rofi
;;
--session)
/home/sravan/.scripts/session.sh --rofi
;;

View File

@@ -0,0 +1,9 @@
#!/bin/bash
xboxdrv \
--evdev /dev/input/by-id/usb-Sony_Interactive_Entertainment_Wireless_Controller-if03-event-joystick \
--evdev-absmap ABS_HAT0X=dpad_x,ABS_HAT0Y=dpad_y,ABS_X=X1,ABS_Y=Y1,ABS_RX=X2,ABS_RY=Y2,ABS_Z=LT,ABS_RZ=RT \
--evdev-keymap BTN_SOUTH=A,BTN_EAST=B,BTN_NORTH=Y,BTN_WEST=X,BTN_START=start,BTN_MODE=guide,BTN_SELECT=back \
--evdev-keymap BTN_TL=LB,BTN_TR=RB,BTN_TL2=LT,BTN_TR2=RT,BTN_THUMBL=TL,BTN_THUMBR=TR \
--axismap -y1=y1,-y2=y2 \
--mimic-xpad \
--silent

56
.scripts/gaming.sh Executable file
View File

@@ -0,0 +1,56 @@
#!/bin/bash
help_menu() {
echo "Script to control gaming related things. Use only one argument at a time."
# echo " - Play / Pause: playerctl.sh --play-pause"
# echo " - Next: playerctl.sh --next"
# echo " - Previous: playerctl.sh --prev"
# echo " - Change Player: playerctl.sh --change"
# echo " - Rofi Menu: playerctl.sh --rofi"
# echo " - Help: playerctl.sh --help OR playerctl.sh -h"
}
rofi_menu() {
declare -a options=(
"調 DualSense to Xbox 360 Mapping - dualsense-to-xbox-360"
" Game Launch Settings - game-launch"
" Game Exit Settings - game-exit"
" Back - back"
" Quit - quit"
)
choice=$(printf '%s\n' "${options[@]}" | rofi -dmenu -i)
option=$(printf '%s\n' "${choice}" | awk '{print $NF}')
if [[ "$option" == "quit" ]]; then
killall rofi
elif [[ "$option" != "back" ]]; then
main "--$option" && killall rofi
fi
}
main() {
if [ $# -eq 0 ]; then
# No arguments
help_menu
else
case $1 in
--help | -h)
help_menu
;;
--dualsense-to-xbox-360)
kitty --hold /home/sravan/.scripts/dualsense_to_xbox_360_controller.sh
;;
--game-launch)
/home/sravan/.scripts/game_launch.sh
;;
--game-exit)
/home/sravan/.scripts/game_exit.sh
;;
--rofi)
rofi_menu
;;
esac
fi
}
main $@