From 7022775a58362d797da060fcdd07f25c50a2b5dd Mon Sep 17 00:00:00 2001
From: JSON Derulo <136133082+xXJSONDeruloXx@users.noreply.github.com>
Date: Thu, 9 Jan 2025 00:23:12 -0500
Subject: [PATCH 1/2] feat: Add 'restore-gamemode-shortcut' and restore
'configure-grub' with ugum styling (#2092)
* feat: add ujust cmd 'restore-gamemode-shortcut' if user accidentally deletes Return.desktop
* fix: adjusted restore gamemode cmd to pull from skel instead of build from scratch
* fix: restore ujust configure-grub functionality with ugum styling per HikariKnight
* chore: lint just files
* fix: restore hide for install-system-flatpaks
* fix: moved restore-gamemode-shortcut to deck specific just file
* feat: add help, pre-selection options to configure-grub
* chore: just syntax 2 spaces, added exit option to GRUB config picker
* chore: just 2 space syntax cleanup on restore-gamemode-shortcut
* chore: add newlines for linter
* chore: just fmt for linter, for real this time
* chore: just cleanup from hikariknight script
---
.../share/ublue-os/just/85-bazzite-image.just | 27 +++++
.../usr/share/ublue-os/just/80-bazzite.just | 114 ++++++++++++++++--
2 files changed, 131 insertions(+), 10 deletions(-)
diff --git a/system_files/deck/shared/usr/share/ublue-os/just/85-bazzite-image.just b/system_files/deck/shared/usr/share/ublue-os/just/85-bazzite-image.just
index e65cb0a5f5..fa688c0838 100644
--- a/system_files/deck/shared/usr/share/ublue-os/just/85-bazzite-image.just
+++ b/system_files/deck/shared/usr/share/ublue-os/just/85-bazzite-image.just
@@ -203,3 +203,30 @@ _toggle-autologin:
else
sudo touch $DESKTOP_AUTOLOGIN
fi
+
+# Restore the "Return to Gaming Mode" shortcut on the Desktop
+restore-gamemode-shortcut:
+ #!/usr/bin/bash
+ # Define paths
+ SHORTCUT_FILE="$HOME/Desktop/Return.desktop"
+ SKEL_FILE="/etc/skel/Desktop/Return.desktop"
+ # Check if the shortcut already exists
+ if [ -f "$SHORTCUT_FILE" ]; then
+ echo "The shortcut 'Return to Gaming Mode' already exists at $SHORTCUT_FILE."
+ echo "No changes were made."
+ exit 0
+ fi
+ # Check if the original file exists in skel
+ if [ ! -f "$SKEL_FILE" ]; then
+ echo "Error: The original file does not exist at $SKEL_FILE."
+ echo "Unable to restore the shortcut."
+ exit 1
+ fi
+ # Copy the file from skel to the desktop
+ echo "Restoring the 'Return to Gaming Mode' shortcut from $SKEL_FILE..."
+ mkdir -p "$HOME/Desktop" # Ensure the Desktop directory exists
+ cp "$SKEL_FILE" "$SHORTCUT_FILE"
+ # Ensure the file is executable
+ chmod +x "$SHORTCUT_FILE"
+ echo "Shortcut restored successfully at $SHORTCUT_FILE."
+ echo "Note: The first time you use the shortcut, it may ask you to trust it. Please accept."
diff --git a/system_files/desktop/shared/usr/share/ublue-os/just/80-bazzite.just b/system_files/desktop/shared/usr/share/ublue-os/just/80-bazzite.just
index 8b4dce21fe..512a2a8de7 100644
--- a/system_files/desktop/shared/usr/share/ublue-os/just/80-bazzite.just
+++ b/system_files/desktop/shared/usr/share/ublue-os/just/80-bazzite.just
@@ -13,19 +13,113 @@ _install-system-flatpaks:
FLATPAK_LIST="$(curl https://raw.githubusercontent.com/ublue-os/bazzite/main/installer/${FLATPAKS} | tr '\n' ' ')"
flatpak --system -y install --or-update ${FLATPAK_LIST}
-# Configure grub bootmenu visibility and fix duplicate entries
+# Configure grub bootmenu visibility. pass action 'help' for more info.
configure-grub ACTION="":
#!/usr/bin/bash
- echo "Editing grub is no longer recommended and this script has been removed"
- echo
- echo "Reason:"
- echo "Grub is auto-hidden now on successful boots and reappears only if you"
- echo "shutdown too early. You can still access it by holding shift. Deck"
- echo "images will also automatically rollback after 2 failed boots, so grub"
- echo "will need to be visible for you to see that."
+ source /usr/lib/ujust/ujust.sh
+ # Function to display usage/help with some color
+ print_help() {
+ echo -e "Usage: ujust configure-grub