chore: First pass of nested desktop support

This commit is contained in:
Kyle Gospodnetich 2023-10-22 11:33:11 -07:00
parent 71026dabcd
commit c3ba77abff
12 changed files with 158 additions and 1 deletions

View File

@ -10,6 +10,9 @@ Source1: https://gitlab.com/evlaV/steamdeck-kde-presets/-/archive/master/
BuildArch: noarch
Conflicts: steamdeck-kde-presets
Conflicts: steamdeck-kde-presets-desktop
%description
Backgrounds from Valve's SteamOS 3.0

View File

@ -0,0 +1,58 @@
Name: steamdeck-gnome-presets
Version: {{{ git_dir_version }}}
Release: 1%{?dist}
Summary: Portions of steamdeck-kde-presets reconfigured for use in GNOME
License: GPLv2
URL: https://github.com/ublue-os/bazzite
Source: https://gitlab.com/evlaV/%{name}/-/archive/master/%{name}-master.tar.gz
BuildArch: noarch
Patch0: fedora.patch
Requires: steamdeck-backgrounds
Requires: zenity
Conflicts: steamdeck-kde-presets
Conflicts: steamdeck-kde-presets-desktop
%description
Portions of steamdeck-kde-presets reconfigured for use in GNOME
# Disable debug packages
%define debug_package %{nil}
%prep
%autosetup -p1 -n %{name}-master
%build
%install
mkdir -p %{buildroot}%{_datadir}/
mkdir -p %{buildroot}%{_bindir}/
mkdir -p %{buildroot}%{_prefix}/lib/
mkdir -p %{buildroot}%{_sysconfdir}/
cp -rv usr/share/* %{buildroot}%{_datadir}
cp -rv usr/bin/* %{buildroot}%{_bindir}
cp -rv usr/lib/* %{buildroot}%{_prefix}/lib
cp -rv etc/* %{buildroot}%{_sysconfdir}
mv %{buildroot}%{_sysconfdir}/skel %{buildroot}%{_sysconfdir}/skel.d
mv %{buildroot}%{_datadir}/icons/hicolor/scalable/places/distributor-logo-steamdeck.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/places/steamdeck.svg
# Remove unneeded files
rm %{buildroot}%{_datadir}/icons/hicolor/scalable/places/distributor-logo.svg
rm %{buildroot}%{_sysconfdir}/xdg/autostart/steam.desktop
rm %{buildroot}%{_datadir}/applications/org.mozilla.firefox.desktop
rm %{buildroot}%{_sysconfdir}/profile.d/kde.sh
rm %{buildroot}%{_sysconfdir}/xdg/kcm-about-distrorc
rm %{buildroot}%{_sysconfdir}/X11/Xsession.d/50rotate-screen
# This lists all the files that are included in the rpm package and that
# are going to be installed into target system where the rpm is installed.
%files
%{_bindir}/steamos-add-to-steam
%{_bindir}/steamos-nested-desktop
%{_datadir}/applications/steam/steamos-nested-desktop
# Finally, changes from the latest release of your application are generated from
# your project's Git history. It will be empty until you make first annotated Git tag.
%changelog
{{{ git_dir_changelog }}}

View File

@ -0,0 +1,55 @@
#! /bin/sh
set -e
add_to_steam() {
encodedUrl="steam://addnonsteamgame/$(python3 -c "import urllib.parse;print(urllib.parse.quote(\"$1\", safe=''))")"
touch /tmp/addnonsteamgamefile
steam "$encodedUrl"
}
show_error() {
if [ "$show_dialog" = "1" ]; then
zenity --title Error --error --text "$1"
else
echo "$1" >&2
fi
}
if [ $(id -u) = "0" ]; then
show_error "This script cannot be run as root"
exit 1
fi
if [ "$XDG_SESSION_TYPE" = "tty" ] && ! pgrep -x steam >/dev/null 2>&1; then
show_error "Cannot run this script from a tty if Steam is not running"
exit 1
fi
if [ "$1" = "-ui" ]; then
show_dialog=1
shift
fi
file=$(realpath "$1")
if [ ! -e "$file" ]
then
echo "Usage: steamos-add-to-steam [-ui] <path>"
exit 1
fi
mime=$(kmimetypefinder "$file")
case "$mime" in
"application/x-desktop"|"application/x-ms-dos-executable")
add_to_steam "$file"
;;
"application/x-executable"|"application/vnd.appimage"|"application/x-shellscript")
if [ -x "$file" ]; then
add_to_steam "$file"
else
show_error "Unable to add non-Steam game. Is the file executable?"
fi
;;
*)
show_error "Unsupported file type"
;;
esac

View File

@ -0,0 +1,18 @@
#!/bin/sh
# Remove the performance overlay, it meddles with some tasks
unset LD_PRELOAD
## Shadow kwin_wayland_wrapper so that we can pass args to kwin wrapper
## whilst being launched by plasma-session
mkdir $XDG_RUNTIME_DIR/nested_plasma -p
cat <<EOF > $XDG_RUNTIME_DIR/nested_plasma/kwin_wayland_wrapper
#!/bin/sh
/usr/bin/kwin_wayland_wrapper --width 1280 --height 800 --no-lockscreen \$@
EOF
chmod a+x $XDG_RUNTIME_DIR/nested_plasma/kwin_wayland_wrapper
export PATH=$XDG_RUNTIME_DIR/nested_plasma:$PATH
dbus-run-session startplasma-wayland
rm $XDG_RUNTIME_DIR/nested_plasma/kwin_wayland_wrapper

Binary file not shown.

After

Width:  |  Height:  |  Size: 170 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 188 KiB

View File

@ -0,0 +1,19 @@
[Desktop Entry]
Type=Application
Name=Nested Desktop
Exec=steamos-nested-desktop
Categories=Desktop;
# Regular icon/logo. Any size, 1:1.
Icon=/usr/share/applications/steam/steamos-nested-desktop/icon.png
# 600x900px Capsule Art
X-Steam-Library-Capsule=/usr/share/applications/steam/steamos-nested-desktop/capsule.png
# 3840x1240 Hero Art Background
X-Steam-Library-Hero=/usr/share/applications/steam/steamos-nested-desktop/hero.png
# 1280x720 Logo
X-Steam-Library-Logo=/usr/share/applications/steam/steamos-nested-desktop/logo.png
# 1280x720 Store Logo (Horizontal Capsule)
X-Steam-Library-StoreCapsule=/usr/share/applications/steam/steamos-nested-desktop/store-logo.png
# What controller preset to use.
X-Steam-Controller-Template=Desktop

Binary file not shown.

After

Width:  |  Height:  |  Size: 264 KiB

View File

@ -15,6 +15,8 @@ BuildArch: noarch
Requires: kde-filesystem
Conflicts: steamdeck-kde-presets
Conflicts: steamdeck-backgrounds
Conflicts: steameck-gnome-presets
%description
KDE Presets from Valve's SteamOS 3.0 for desktops

View File

@ -11,7 +11,9 @@ Patch0: fedora.patch
Requires: kde-filesystem
Conflicts: steamdeck-kde-themes
Conflicts: steamdeck-kde-presets-desktop
Conflicts: steamdeck-backgrounds
Conflicts: steameck-gnome-presets
%description
KDE Presets from Valve's SteamOS 3.0