Add CPU Profile to Game Scripts

- Remove unnecessary `pkexec` from system76-power calls
  since user is in `adm` group, eliminates need to
  enter password every time this runs
- Change CPU profile between balanced and performance
  when exit or launching a game
This commit is contained in:
Sravan Balaji
2023-12-27 12:28:12 -05:00
parent 980b05ecf6
commit 9f57acb440
4 changed files with 24 additions and 18 deletions

View File

@@ -102,46 +102,46 @@ main() {
rofi_graphics_menu rofi_graphics_menu
;; ;;
--graphics-query) --graphics-query)
current_graphics=$(pkexec system76-power graphics) current_graphics=$(system76-power graphics)
notify-send "System76-Power Graphics" "$current_graphics" notify-send "System76-Power Graphics" "$current_graphics"
;; ;;
--graphics-compute) --graphics-compute)
notify-send "System76-Power Graphics" "Switching to Compute Graphics..." notify-send "System76-Power Graphics" "Switching to Compute Graphics..."
pkexec system76-power graphics compute system76-power graphics compute
notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics" notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics"
;; ;;
--graphics-hybrid) --graphics-hybrid)
notify-send "System76-Power Graphics" "Switching to Hybrid Graphics..." notify-send "System76-Power Graphics" "Switching to Hybrid Graphics..."
pkexec system76-power graphics hybrid system76-power graphics hybrid
notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics" notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics"
;; ;;
--graphics-integrated) --graphics-integrated)
notify-send "System76-Power Graphics" "Switching to Integrated Graphics..." notify-send "System76-Power Graphics" "Switching to Integrated Graphics..."
pkexec system76-power graphics integrated system76-power graphics integrated
notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics" notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics"
;; ;;
--graphics-nvidia) --graphics-nvidia)
notify-send "System76-Power Graphics" "Switching to Nvidia Graphics..." notify-send "System76-Power Graphics" "Switching to Nvidia Graphics..."
pkexec system76-power graphics nvidia system76-power graphics nvidia
notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics" notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics"
;; ;;
--rofi-cpu-profile) --rofi-cpu-profile)
rofi_cpu_profile_menu rofi_cpu_profile_menu
;; ;;
--cpu-profile-query) --cpu-profile-query)
current_profile=$(pkexec system76-power profile) current_profile=$(system76-power profile)
notify-send "System76-Power CPU Profile" "$current_profile" notify-send "System76-Power CPU Profile" "$current_profile"
;; ;;
--cpu-profile-battery) --cpu-profile-battery)
pkexec system76-power profile battery system76-power profile battery
notify-send "System76-Power CPU Profile" "Switched to Battery Profile" notify-send "System76-Power CPU Profile" "Switched to Battery Profile"
;; ;;
--cpu-profile-balanced) --cpu-profile-balanced)
pkexec system76-power profile balanced system76-power profile balanced
notify-send "System76-Power CPU Profile" "Switched to Balanced Profile" notify-send "System76-Power CPU Profile" "Switched to Balanced Profile"
;; ;;
--cpu-profile-performance) --cpu-profile-performance)
pkexec system76-power profile performance system76-power profile performance
notify-send "System76-Power CPU Profile" "Switched to Performance Profile" notify-send "System76-Power CPU Profile" "Switched to Performance Profile"
;; ;;
--rofi-gpu-profile) --rofi-gpu-profile)

View File

@@ -1,4 +1,6 @@
#!/bin/bash #!/bin/bash
/home/sravan/.scripts/picom.sh --on
/home/sravan/.scripts/deadd.sh --unpause /home/sravan/.scripts/deadd.sh --unpause
/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 /usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false

View File

@@ -1,5 +1,6 @@
#!/bin/bash #!/bin/bash
/home/sravan/.scripts/picom.sh --off /home/sravan/.scripts/picom.sh --off
/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/deadd.sh --pause /home/sravan/.scripts/deadd.sh --pause
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true /usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true

View File

@@ -7832,6 +7832,7 @@ These are scripts that should be run from Lutris when launching or exiting a gam
#+BEGIN_SRC shell :shebang #!/bin/bash :tangle .scripts/game_launch.sh #+BEGIN_SRC shell :shebang #!/bin/bash :tangle .scripts/game_launch.sh
/home/sravan/.scripts/picom.sh --off /home/sravan/.scripts/picom.sh --off
/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/deadd.sh --pause /home/sravan/.scripts/deadd.sh --pause
/usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true /usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s true
@@ -7842,7 +7843,9 @@ 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 #!/bin/bash :tangle .scripts/game_exit.sh #+BEGIN_SRC shell :shebang #!/bin/bash :tangle .scripts/game_exit.sh
/home/sravan/.scripts/picom.sh --on
/home/sravan/.scripts/deadd.sh --unpause /home/sravan/.scripts/deadd.sh --unpause
/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 /usr/bin/xfconf-query -c xfce4-power-manager -p /xfce4-power-manager/presentation-mode -s false
#+END_SRC #+END_SRC
@@ -9249,46 +9252,46 @@ main() {
rofi_graphics_menu rofi_graphics_menu
;; ;;
--graphics-query) --graphics-query)
current_graphics=$(pkexec system76-power graphics) current_graphics=$(system76-power graphics)
notify-send "System76-Power Graphics" "$current_graphics" notify-send "System76-Power Graphics" "$current_graphics"
;; ;;
--graphics-compute) --graphics-compute)
notify-send "System76-Power Graphics" "Switching to Compute Graphics..." notify-send "System76-Power Graphics" "Switching to Compute Graphics..."
pkexec system76-power graphics compute system76-power graphics compute
notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics" notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics"
;; ;;
--graphics-hybrid) --graphics-hybrid)
notify-send "System76-Power Graphics" "Switching to Hybrid Graphics..." notify-send "System76-Power Graphics" "Switching to Hybrid Graphics..."
pkexec system76-power graphics hybrid system76-power graphics hybrid
notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics" notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics"
;; ;;
--graphics-integrated) --graphics-integrated)
notify-send "System76-Power Graphics" "Switching to Integrated Graphics..." notify-send "System76-Power Graphics" "Switching to Integrated Graphics..."
pkexec system76-power graphics integrated system76-power graphics integrated
notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics" notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics"
;; ;;
--graphics-nvidia) --graphics-nvidia)
notify-send "System76-Power Graphics" "Switching to Nvidia Graphics..." notify-send "System76-Power Graphics" "Switching to Nvidia Graphics..."
pkexec system76-power graphics nvidia system76-power graphics nvidia
notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics" notify-send -u critical -t 0 "System76-Power Graphics" "Please reboot computer to switch graphics"
;; ;;
--rofi-cpu-profile) --rofi-cpu-profile)
rofi_cpu_profile_menu rofi_cpu_profile_menu
;; ;;
--cpu-profile-query) --cpu-profile-query)
current_profile=$(pkexec system76-power profile) current_profile=$(system76-power profile)
notify-send "System76-Power CPU Profile" "$current_profile" notify-send "System76-Power CPU Profile" "$current_profile"
;; ;;
--cpu-profile-battery) --cpu-profile-battery)
pkexec system76-power profile battery system76-power profile battery
notify-send "System76-Power CPU Profile" "Switched to Battery Profile" notify-send "System76-Power CPU Profile" "Switched to Battery Profile"
;; ;;
--cpu-profile-balanced) --cpu-profile-balanced)
pkexec system76-power profile balanced system76-power profile balanced
notify-send "System76-Power CPU Profile" "Switched to Balanced Profile" notify-send "System76-Power CPU Profile" "Switched to Balanced Profile"
;; ;;
--cpu-profile-performance) --cpu-profile-performance)
pkexec system76-power profile performance system76-power profile performance
notify-send "System76-Power CPU Profile" "Switched to Performance Profile" notify-send "System76-Power CPU Profile" "Switched to Performance Profile"
;; ;;
--rofi-gpu-profile) --rofi-gpu-profile)