mirror of
https://github.com/theupriser/steamify-cachyos.git
synced 2026-10-03 17:41:58 +02:00
75 lines
3.0 KiB
Bash
75 lines
3.0 KiB
Bash
#!/bin/bash
|
|
# Steam in the Plasma desktop session: gamepad UI args, virtual keyboard,
|
|
# autostart. Part of the SteamOS conversion (gaming_enable/gaming_disable).
|
|
# Sourced by steamify.sh; not meant to be run on its own.
|
|
|
|
steam_enable() {
|
|
info "Applying non-optional SteamOS environment & keyboard fixes..."
|
|
local steam_env_dir
|
|
steam_env_dir="$HOME/.config/environment.d"
|
|
mkdir -p "$steam_env_dir"
|
|
|
|
# 2. Prevent KDE Wayland from blocking the virtual keyboard overlay
|
|
echo "KWIN_IM_SHOW_ALWAYS=1" > "$steam_env_dir/99-kde-virtual-keyboard.conf"
|
|
|
|
ok "Steam UI parameters and keyboard fix deployed successfully."
|
|
}
|
|
|
|
# Sub-option of the SteamOS conversion: Steam starts silently (in the tray,
|
|
# no window) on the Plasma desktop.
|
|
silent_status() {
|
|
[[ -f "$HOME/.config/systemd/user/steam-desktop-autostart.service" ]]
|
|
}
|
|
|
|
silent_enable() {
|
|
local systemd_user_dir="$HOME/.config/systemd/user"
|
|
mkdir -p "$systemd_user_dir"
|
|
service_file steam-desktop-autostart.service > "$systemd_user_dir/steam-desktop-autostart.service"
|
|
# Clean out old .desktop shortcut so they don't fight
|
|
rm -f "$HOME/.config/autostart/steam.desktop"
|
|
user_systemctl daemon-reload
|
|
user_systemctl enable --now steam-desktop-autostart.service
|
|
ok "Steam starts silently on the desktop."
|
|
}
|
|
|
|
silent_disable() {
|
|
user_systemctl disable --now steam-desktop-autostart.service 2>/dev/null
|
|
rm -f "$HOME/.config/systemd/user/steam-desktop-autostart.service"
|
|
user_systemctl daemon-reload
|
|
ok "Steam no longer starts by itself on the desktop."
|
|
}
|
|
|
|
steam_disable() {
|
|
info "Removing Steam desktop settings..."
|
|
# The autostart unit is the `silent` option's: removed with it, and here
|
|
# too for when the conversion goes off by itself.
|
|
silent_status && silent_disable
|
|
rm -f "$HOME/.config/environment.d/99-kde-virtual-keyboard.conf"
|
|
ok "Steam desktop settings removed (takes full effect at next login)."
|
|
}
|
|
|
|
# "Steam Deck/Machine icons" menu item: Steam's gamepad UI in SteamOS 3
|
|
# mode, which shows Steam Deck button glyphs in gaming mode.
|
|
glyphs_status() {
|
|
[[ -f "$HOME/.config/environment.d/99-gamescope-steam-glyphs.conf" ]]
|
|
}
|
|
|
|
glyphs_enable() {
|
|
local gs_env="$HOME/.config/gamescope-session/environment"
|
|
mkdir -p "$HOME/.config/environment.d"
|
|
echo 'STEAM_GAMEPADUI_ARGS="-gamepadui -steamos3"' > "$HOME/.config/environment.d/99-gamescope-steam-glyphs.conf"
|
|
if [[ -d "$HOME/.config/gamescope-session" ]]; then
|
|
touch "$gs_env"
|
|
sed -i '/^STEAM_GAMEPADUI_ARGS=/d' "$gs_env"
|
|
echo 'STEAM_GAMEPADUI_ARGS="-gamepadui -steamos3"' >> "$gs_env"
|
|
fi
|
|
ok "Steam Deck/Machine icons on (from the next gaming mode start)."
|
|
}
|
|
|
|
glyphs_disable() {
|
|
rm -f "$HOME/.config/environment.d/99-gamescope-steam-glyphs.conf"
|
|
[[ -f "$HOME/.config/gamescope-session/environment" ]] &&
|
|
sed -i '/^STEAM_GAMEPADUI_ARGS=/d' "$HOME/.config/gamescope-session/environment"
|
|
ok "Steam's default button icons are back (from the next gaming mode start)."
|
|
}
|