mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-14 15:44:47 +02:00
GNOME: pin the Return to Gaming Mode launcher to the dash; relogin waits for the runtime dir
This commit is contained in:
1 parent
fc28ea4c64
commit
ae12c1bb41
2 files changed
+28
-1
No files matched your search
@@ -77,6 +77,7 @@ EOF
|
|||||||
cp "$shortcut_path" "$user_home/.local/share/applications/steamify-return-to-gaming-mode.desktop"
|
cp "$shortcut_path" "$user_home/.local/share/applications/steamify-return-to-gaming-mode.desktop"
|
||||||
# GNOME only starts launchers it trusts.
|
# GNOME only starts launchers it trusts.
|
||||||
gio set "$shortcut_path" metadata::trusted true 2>/dev/null || true
|
gio set "$shortcut_path" metadata::trusted true 2>/dev/null || true
|
||||||
|
gnome_dash_pin
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ok "Desktop shortcut created successfully."
|
ok "Desktop shortcut created successfully."
|
||||||
@@ -94,5 +95,29 @@ remove_desktop_shortcut() {
|
|||||||
local desktop_dir
|
local desktop_dir
|
||||||
desktop_dir="$(xdg-user-dir DESKTOP 2>/dev/null || echo "$HOME/Desktop")"
|
desktop_dir="$(xdg-user-dir DESKTOP 2>/dev/null || echo "$HOME/Desktop")"
|
||||||
rm -f "$desktop_dir/Return to Gaming Mode.desktop" "$HOME/.local/share/applications/steamify-return-to-gaming-mode.desktop"
|
rm -f "$desktop_dir/Return to Gaming Mode.desktop" "$HOME/.local/share/applications/steamify-return-to-gaming-mode.desktop"
|
||||||
|
gnome_dash_unpin
|
||||||
sudo rm -f /etc/sudoers.d/gamescope-session-switch
|
sudo rm -f /etc/sudoers.d/gamescope-session-switch
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# GNOME draws no icons on the desktop: the shortcut is pinned to the dash
|
||||||
|
# (the favorites bar) as well. Only in a running session (gsettings needs its dconf).
|
||||||
|
GNOME_SHORTCUT_ID=steamify-return-to-gaming-mode.desktop
|
||||||
|
|
||||||
|
gnome_dash_pin() {
|
||||||
|
user_session && command -v gsettings >/dev/null || return 0
|
||||||
|
local favorites
|
||||||
|
favorites="$(gsettings get org.gnome.shell favorite-apps 2>/dev/null)" || return 0
|
||||||
|
[[ "$favorites" == *"$GNOME_SHORTCUT_ID"* ]] && return 0
|
||||||
|
favorites="$(sed "s/\]\$/, '$GNOME_SHORTCUT_ID']/; s/^\[, /[/; s/\[\], /[/" <<< "$favorites")"
|
||||||
|
[[ "$favorites" == "[ '$GNOME_SHORTCUT_ID']" ]] && favorites="['$GNOME_SHORTCUT_ID']"
|
||||||
|
gsettings set org.gnome.shell favorite-apps "$favorites"
|
||||||
|
}
|
||||||
|
|
||||||
|
gnome_dash_unpin() {
|
||||||
|
user_session && command -v gsettings >/dev/null || return 0
|
||||||
|
local favorites
|
||||||
|
favorites="$(gsettings get org.gnome.shell favorite-apps 2>/dev/null)" || return 0
|
||||||
|
[[ "$favorites" == *"$GNOME_SHORTCUT_ID"* ]] || return 0
|
||||||
|
favorites="$(sed -e "s/, '$GNOME_SHORTCUT_ID'//; s/'$GNOME_SHORTCUT_ID', //; s/'$GNOME_SHORTCUT_ID'//" <<< "$favorites")"
|
||||||
|
gsettings set org.gnome.shell favorite-apps "$favorites"
|
||||||
|
}
|
||||||
@@ -16,5 +16,7 @@ USER_NAME="$2"
|
|||||||
# already running!", or the session dies at once), so wait until it is gone.
|
# already running!", or the session dies at once), so wait until it is gone.
|
||||||
systemctl stop gdm.service
|
systemctl stop gdm.service
|
||||||
loginctl terminate-user "$USER_NAME"
|
loginctl terminate-user "$USER_NAME"
|
||||||
for _ in $(seq 120); do loginctl show-user "$USER_NAME" >/dev/null 2>&1 || break; sleep 0.25; done
|
# (not `loginctl show-user`: it still lists the user about 10 s after it is gone)
|
||||||
|
USER_RUNTIME="/run/user/$(id -u "$USER_NAME")"
|
||||||
|
for _ in $(seq 120); do [[ -d "$USER_RUNTIME" ]] || break; sleep 0.25; done
|
||||||
systemctl start gdm.service
|
systemctl start gdm.service
|
||||||
Reference in new issue
Block a user