Skip to content

Commit

Permalink
Add opengamepadui sessions (#548)
Browse files Browse the repository at this point in the history
  • Loading branch information
Derek J. Clark committed Mar 31, 2023
1 parent 3d33b85 commit 7745466
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
3 changes: 3 additions & 0 deletions manifest
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ export PACKAGES="\
ethtool \
ffmpeg \
file-roller \
firejail \
flatpak \
fmt \
fuse2 \
Expand Down Expand Up @@ -156,6 +157,8 @@ export AUR_PACKAGES="\
libretro-stella2014-git \
libretro-virtualjaguar-git \
nintendo-udev \
opengamepadui-bin \
opengamepadui-session-git \
oxp-platform-dkms-git \
python-vdf \
r8152-dkms \
Expand Down
5 changes: 5 additions & 0 deletions rootfs/etc/sudoers.d/systemctl_needed
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Provide nopasswd access for the session script to modify these specific systemd units
ALL ALL=(ALL) NOPASSWD: /usr/bin/systemctl enable --now handycon
ALL ALL=(ALL) NOPASSWD: /usr/bin/systemctl disable --now handycon
ALL ALL=(ALL) NOPASSWD: /usr/bin/systemctl enable --now ryzenadj-controller
ALL ALL=(ALL) NOPASSWD: /usr/bin/systemctl disable --now ryzenadj-controller
35 changes: 34 additions & 1 deletion rootfs/usr/bin/chimera-session
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ DATA_HOME=${XDG_DATA_HOME:-$HOME/.local/share}
CONFIG_HOME=${XDG_CONFIG_HOME:-$HOME/.config}
SESSION_CONFIG="${CONFIG_HOME}/environment.d/01-chimera-session.conf"
SESSION_LIGHTDM_CONFIG="/etc/lightdm/lightdm.conf.d/10-chimeraos-session.conf"
SESSION_LIST=('bigpicture' 'desktop' 'desktop-xorg' 'gamepadui')
SESSION_LIST=('bigpicture' 'desktop' 'desktop-xorg' 'gamepadui' 'opengamepadui' 'gamepadui-with-qam')
SELECTED_SESSION="$1"


Expand All @@ -29,6 +29,15 @@ function print_session_list() {
CURRENT_SESSION="gamepadui"
fi

if grep "opengamepadui-session" ${SESSION_LIGHTDM_CONFIG} &> /dev/null; then
CURRENT_SESSION="opengamepadui"
fi

if grep "gamescope-ogui-qam-session" ${SESSION_LIGHTDM_CONFIG} &> /dev/null; then
CURRENT_SESSION="gamepadui-with-qam"
fi


# print active and available sessions
for t in ${SESSION_LIST[@]}; do
if [ "${CURRENT_SESSION}" = "${t}" ]; then
Expand Down Expand Up @@ -68,6 +77,24 @@ function gamepadui() {
# switch to Gamepad/Deck UI (Gamescope/Wayland)
echo '' > ${SESSION_CONFIG}
sudo chimera-session-use-lightdm gamescope-session
sudo systemctl enable --now handycon
sudo systemctl enable --now ryzenadj-controller
}

function opengamepadui() {
# switch to Gamepad/Deck UI (Gamescope/Wayland)
echo '' > ${SESSION_CONFIG}
sudo chimera-session-use-lightdm opengamepadui-session
sudo systemctl disable --now handycon
sudo systemctl disable --now ryzenadj-controller
}

function gamepaduiqam() {
# switch to OpenGamepadUI (Gamescope/Wayland)
echo '' > ${SESSION_CONFIG}
sudo chimera-session-use-lightdm gamescope-ogui-qam-session
sudo systemctl disable --now handycon
sudo systemctl disable --now ryzenadj-controller
}

function print_invalid_session() {
Expand Down Expand Up @@ -104,4 +131,10 @@ elif [ "${SELECTED_SESSION}" = "desktop-xorg" ]; then
elif [ "${SELECTED_SESSION}" = "gamepadui" ]; then
echo "Switching to gamepadui"
gamepadui
elif [ "${SELECTED_SESSION}" = "opengamepadui" ]; then
echo "Switching to opengamepadui"
opengamepadui
elif [ "${SELECTED_SESSION}" = "gamepadui-with-qam" ]; then
echo "Switching to gamepadui with opengamepadui quick access menu"
gamepaduiqam
fi

0 comments on commit 7745466

Please sign in to comment.