Compare commits

..

2 Commits

Author SHA1 Message Date
9352d0d900 feat: added portprotonqt-desktop-return script and added Hyprland support to it
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-09 22:39:16 +05:00
e9b7dc3759 fix: prevent error if plasmax11.desktop is missing
Signed-off-by: Boris Yumankulov <boria138@altlinux.org>
2025-06-09 22:17:11 +05:00
3 changed files with 39 additions and 7 deletions

View File

@@ -57,7 +57,7 @@ configure_sddm() {
} }
yad_question() { yad_question() {
env GDK_BACKEND="x11" yad --window-icon="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --image="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --question --title="$1" --text="$2" --width=300 --text-align=center yad --window-icon="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --image="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --question --title="$1" --text="$2" --width=300 --text-align=center
[[ "$?" != 0 ]] && return 1 || return 0 [[ "$?" != 0 ]] && return 1 || return 0
} }
@@ -66,9 +66,12 @@ if [[ -z $SENTINEL_CREATED ]]; then
export SENTINEL_CREATED=1 export SENTINEL_CREATED=1
fi fi
if [[ $(grep -E '^X-KDE-PluginInfo-Version=' /usr/share/xsessions/plasmax11.desktop | cut -d'=' -f2) =~ 6.* ]] ; then if [[ -f /usr/share/xsessions/plasmax11.desktop ]]; then
version=$(grep -E '^X-KDE-PluginInfo-Version=' /usr/share/xsessions/plasmax11.desktop | cut -d'=' -f2)
if [[ $version =~ ^6.* ]]; then
KDE6="true" KDE6="true"
fi fi
fi
case "$session" in case "$session" in
desktop) desktop)
@@ -78,6 +81,8 @@ case "$session" in
elif [[ "$DE" == "KDE" ]]; then elif [[ "$DE" == "KDE" ]]; then
session_launcher="plasma" session_launcher="plasma"
[[ "$KDE6" != "true" ]] && session_launcher="plasmawayland" [[ "$KDE6" != "true" ]] && session_launcher="plasmawayland"
elif [[ "$DE" == "Hyprland" ]]; then
session_launcher="hyprland"
fi fi
else else
if [[ "$DE" == "GNOME" ]]; then if [[ "$DE" == "GNOME" ]]; then
@@ -92,7 +97,7 @@ case "$session" in
create_sentinel=1 create_sentinel=1
;; ;;
gamescope) gamescope)
session_launcher="gamescope-session-steam" session_launcher="gamescope-session-portprotonqt"
create_sentinel=1 create_sentinel=1
;; ;;
*) *)
@@ -107,12 +112,12 @@ if [[ ! -z $4 ]]; then
fi fi
if systemctl is-active --quiet gdm; then if systemctl is-active --quiet gdm; then
env GDK_BACKEND="x11" yad --window-icon="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --image="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --title="Требуется подтверждение" --text="Для работы данной функии требуется LIGHTDM или SDDM, GDM не поддерживается" --width=290 --text-align=center --button="OK" yad --window-icon="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --image="/usr/share/icons/hicolor/scalable/actions/steamdeck-gaming-return.svg" --title="Требуется подтверждение" --text="Для работы данной функии требуется LIGHTDM или SDDM, GDM не поддерживается" --width=290 --text-align=center --button="OK"
echo "autologin=false" >> "$config_dir/$SENTINEL_FILE" echo "autologin=false" >> "$config_dir/$SENTINEL_FILE"
die "Autologin configuration aborted due to GDM." die "Autologin configuration aborted due to GDM."
fi fi
if ! grep -iq "autologin" "$config_dir/$SENTINEL_FILE" || [[ "$2" == "plasma" ]] || [[ "$2" == "desktop" ]] ; then if ! grep -iq "autologin" "$config_dir/$SENTINEL_FILE" && [[ "$2" == "desktop" ]]; then
if yad_question "Требуется подтверждение" "Для работы данной функции требуется настроить автологин. Хотите ли вы, чтобы это было настроено автоматически?" ; then if yad_question "Требуется подтверждение" "Для работы данной функции требуется настроить автологин. Хотите ли вы, чтобы это было настроено автоматически?" ; then
echo "autologin=true" >> "$config_dir/$SENTINEL_FILE" echo "autologin=true" >> "$config_dir/$SENTINEL_FILE"
echo "autologin enabled" echo "autologin enabled"

View File

@@ -0,0 +1,27 @@
#!/usr/bin/env bash
/usr/bin/portproton-session-select gamescope
CONFIG_FILE="$HOME/.config/gamescope-session-type"
if [[ -f "$CONFIG_FILE" ]] && grep -q 'autologin="true"' "$CONFIG_FILE"; then
case "$XDG_CURRENT_DESKTOP" in
GNOME)
exec gnome-session-quit --no-prompt
;;
KDE)
VERSION=$(grep -E '^X-KDE-PluginInfo-Version=' /usr/share/xsessions/plasmax11.desktop 2>/dev/null | cut -d'=' -f2)
if [[ "$VERSION" =~ ^6\..* ]]; then
exec qdbus org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
else
exec qdbus org.kde.ksmserver /KSMServer logout 0 0 0
fi
;;
MATE)
exec mate-session-save --force-logout
;;
Hyprland)
exec loginctl terminate-user "$(id -u)"
;;
esac
fi

View File

@@ -1,6 +1,6 @@
[Desktop Entry] [Desktop Entry]
Name=Return to PortProtonQt Name=Return to PortProtonQt
Exec=portproton-session-select gamescope Exec=portprotonqt-desktop-return
Icon=steamdeck-gaming-return Icon=steamdeck-gaming-return
Terminal=false Terminal=false
Type=Application Type=Application