Update scripts to check if using wayland or x11

- game launch/exit script's picom disable/enable
  and xfce power manager presentation mode only
  apply when running dwm
- GPU profile switching with nvidia-settings only
  works when running x11
This commit is contained in:
Sravan Balaji
2024-09-04 20:14:10 -04:00
parent c4b75ed1c8
commit e3b86d708f
4 changed files with 68 additions and 24 deletions

View File

@@ -7467,11 +7467,14 @@ These are scripts that should be run from Lutris when launching or exiting a gam
*Preferences > System options > Pre-launch script* *Preferences > System options > Pre-launch script*
#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle gaming/.scripts/game_launch.sh #+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle gaming/.scripts/game_launch.sh
/home/sravan/.scripts/picom.sh --off & if [ $XDG_SESSION_DESKTOP == "dwm" ]; then
/home/sravan/.scripts/picom.sh --off &
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true &
fi
/home/sravan/.scripts/cpu-gpu.sh --cpu-profile-performance & /home/sravan/.scripts/cpu-gpu.sh --cpu-profile-performance &
/home/sravan/.scripts/cpu-gpu.sh --gpu-profile-performance & /home/sravan/.scripts/cpu-gpu.sh --gpu-profile-performance &
/home/sravan/.scripts/dunst.sh --pause & /home/sravan/.scripts/dunst.sh --pause &
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true &
#+END_SRC #+END_SRC
*** Post-Exit Script *** Post-Exit Script
@@ -7479,11 +7482,14 @@ These are scripts that should be run from Lutris when launching or exiting a gam
*Preferences > System options > Post-exit script* *Preferences > System options > Post-exit script*
#+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle gaming/.scripts/game_exit.sh #+BEGIN_SRC shell :shebang #!/usr/bin/env bash :tangle gaming/.scripts/game_exit.sh
/home/sravan/.scripts/picom.sh --on & if [ $XDG_SESSION_DESKTOP == "dwm" ]; then
/home/sravan/.scripts/picom.sh --on &
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false &
fi
/home/sravan/.scripts/dunst.sh --unpause & /home/sravan/.scripts/dunst.sh --unpause &
/home/sravan/.scripts/cpu-gpu.sh --cpu-profile-balanced & /home/sravan/.scripts/cpu-gpu.sh --cpu-profile-balanced &
/home/sravan/.scripts/cpu-gpu.sh --gpu-profile-adaptive & /home/sravan/.scripts/cpu-gpu.sh --gpu-profile-adaptive &
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false &
#+END_SRC #+END_SRC
*** PlayStation 5 (DualSense) to Xbox 360 Controller Button Mapping *** PlayStation 5 (DualSense) to Xbox 360 Controller Button Mapping
@@ -9425,20 +9431,36 @@ main() {
rofi_gpu_profile_menu rofi_gpu_profile_menu
;; ;;
--gpu-profile-query) --gpu-profile-query)
current_profile=$(nvidia-settings -q GpuPowerMizerMode) if [ $XDG_SESSION_TYPE == "x11" ]; then
notify-send "NVIDIA GPU Profile" "$current_profile" current_profile=$(nvidia-settings -q GpuPowerMizerMode)
notify-send "NVIDIA GPU Profile" "$current_profile"
elif [ $XDG_SESSION_TYPE == "wayland" ]; then
notify-send "NVIDIA GPU Profile not supported on Wayland"
fi
;; ;;
--gpu-profile-adaptive) --gpu-profile-adaptive)
nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=0" if [ $XDG_SESSION_TYPE == "x11" ]; then
notify-send "NVIDIA GPU Profile" "Switched to Adaptive Profile" nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=0"
notify-send "NVIDIA GPU Profile" "Switched to Adaptive Profile"
elif [ $XDG_SESSION_TYPE == "wayland" ]; then
notify-send "NVIDIA GPU Profile not supported on Wayland"
fi
;; ;;
--gpu-profile-performance) --gpu-profile-performance)
nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=1" if [ $XDG_SESSION_TYPE == "x11" ]; then
notify-send "NVIDIA GPU Profile" "Switched to Performance Profile" nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=1"
notify-send "NVIDIA GPU Profile" "Switched to Performance Profile"
elif [ $XDG_SESSION_TYPE == "wayland" ]; then
notify-send "NVIDIA GPU Profile not supported on Wayland"
fi
;; ;;
--gpu-profile-auto) --gpu-profile-auto)
nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=2" if [ $XDG_SESSION_TYPE == "x11" ]; then
notify-send "NVIDIA GPU Profile" "Switched to Auto Profile" nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=2"
notify-send "NVIDIA GPU Profile" "Switched to Auto Profile"
elif [ $XDG_SESSION_TYPE == "wayland" ]; then
notify-send "NVIDIA GPU Profile not supported on Wayland"
fi
;; ;;
--rofi) --rofi)
rofi_menu rofi_menu

View File

@@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
/home/sravan/.scripts/picom.sh --on & if [ $XDG_SESSION_DESKTOP == "dwm" ]; then
/home/sravan/.scripts/picom.sh --on &
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false &
fi
/home/sravan/.scripts/dunst.sh --unpause & /home/sravan/.scripts/dunst.sh --unpause &
/home/sravan/.scripts/cpu-gpu.sh --cpu-profile-balanced & /home/sravan/.scripts/cpu-gpu.sh --cpu-profile-balanced &
/home/sravan/.scripts/cpu-gpu.sh --gpu-profile-adaptive & /home/sravan/.scripts/cpu-gpu.sh --gpu-profile-adaptive &
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false &

View File

@@ -1,6 +1,9 @@
#!/usr/bin/env bash #!/usr/bin/env bash
/home/sravan/.scripts/picom.sh --off & if [ $XDG_SESSION_DESKTOP == "dwm" ]; then
/home/sravan/.scripts/picom.sh --off &
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true &
fi
/home/sravan/.scripts/cpu-gpu.sh --cpu-profile-performance & /home/sravan/.scripts/cpu-gpu.sh --cpu-profile-performance &
/home/sravan/.scripts/cpu-gpu.sh --gpu-profile-performance & /home/sravan/.scripts/cpu-gpu.sh --gpu-profile-performance &
/home/sravan/.scripts/dunst.sh --pause & /home/sravan/.scripts/dunst.sh --pause &
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true &

View File

@@ -148,20 +148,36 @@ main() {
rofi_gpu_profile_menu rofi_gpu_profile_menu
;; ;;
--gpu-profile-query) --gpu-profile-query)
current_profile=$(nvidia-settings -q GpuPowerMizerMode) if [ $XDG_SESSION_TYPE == "x11" ]; then
notify-send "NVIDIA GPU Profile" "$current_profile" current_profile=$(nvidia-settings -q GpuPowerMizerMode)
notify-send "NVIDIA GPU Profile" "$current_profile"
elif [ $XDG_SESSION_TYPE == "wayland" ]; then
notify-send "NVIDIA GPU Profile not supported on Wayland"
fi
;; ;;
--gpu-profile-adaptive) --gpu-profile-adaptive)
nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=0" if [ $XDG_SESSION_TYPE == "x11" ]; then
notify-send "NVIDIA GPU Profile" "Switched to Adaptive Profile" nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=0"
notify-send "NVIDIA GPU Profile" "Switched to Adaptive Profile"
elif [ $XDG_SESSION_TYPE == "wayland" ]; then
notify-send "NVIDIA GPU Profile not supported on Wayland"
fi
;; ;;
--gpu-profile-performance) --gpu-profile-performance)
nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=1" if [ $XDG_SESSION_TYPE == "x11" ]; then
notify-send "NVIDIA GPU Profile" "Switched to Performance Profile" nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=1"
notify-send "NVIDIA GPU Profile" "Switched to Performance Profile"
elif [ $XDG_SESSION_TYPE == "wayland" ]; then
notify-send "NVIDIA GPU Profile not supported on Wayland"
fi
;; ;;
--gpu-profile-auto) --gpu-profile-auto)
nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=2" if [ $XDG_SESSION_TYPE == "x11" ]; then
notify-send "NVIDIA GPU Profile" "Switched to Auto Profile" nvidia-settings -a "[gpu:0]/GpuPowerMizerMode=2"
notify-send "NVIDIA GPU Profile" "Switched to Auto Profile"
elif [ $XDG_SESSION_TYPE == "wayland" ]; then
notify-send "NVIDIA GPU Profile not supported on Wayland"
fi
;; ;;
--rofi) --rofi)
rofi_menu rofi_menu