Skip to content

Commit

Permalink
Merge branch 'testing'
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleGospo committed Jan 9, 2025
2 parents b065f95 + 868f434 commit 15ab635
Show file tree
Hide file tree
Showing 3 changed files with 133 additions and 10 deletions.
2 changes: 2 additions & 0 deletions Containerfile
Original file line number Diff line number Diff line change
Expand Up @@ -735,6 +735,8 @@ RUN rm -f /etc/profile.d/toolbox.sh && \
cp --no-dereference --preserve=links /usr/lib/libdrm.so.2 /usr/lib/libdrm.so && \
cp --no-dereference --preserve=links /usr/lib64/libdrm.so.2 /usr/lib64/libdrm.so && \
sed -i 's@/usr/bin/steam@/usr/bin/bazzite-steam@g' /usr/share/applications/steam.desktop && \
echo "Replace steam BPM shortcut action" && \
sed -i 's@Exec=steam steam://open/bigpicture@Exec=/usr/bin/bazzite-steam-bpm@g' /usr/share/applications/steam.desktop && \
mkdir -p /etc/skel/.config/autostart/ && \
cp "/usr/share/applications/steam.desktop" "/etc/skel/.config/autostart/steam.desktop" && \
sed -i 's@/usr/bin/bazzite-steam %U@/usr/bin/bazzite-steam -silent %U@g' /etc/skel/.config/autostart/steam.desktop && \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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."
114 changes: 104 additions & 10 deletions system_files/desktop/shared/usr/share/ublue-os/just/80-bazzite.just
Original file line number Diff line number Diff line change
Expand Up @@ -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 <option>"
echo
echo -e "Where <option> can be:"
echo -e " ${bold}${cyan}hide${normal} = GRUB is hidden after a successful boot, even for dual-boot setups."
echo -e " ${bold}${yellow}unhide${normal} = GRUB is hidden after a successful boot, but it will show if dual-booting."
echo -e " ${bold}${green}show${normal} = GRUB always shows on boot."
echo
echo "If <option> is omitted, you will be prompted to choose interactively."
}
# Function to get the current GRUB menu_auto_hide setting and explain it
get_current_setting() {
local CURRENT_SETTING
CURRENT_SETTING=$(sudo grub2-editenv - list | grep menu_auto_hide | cut -d= -f2)
if [ -z "$CURRENT_SETTING" ]; then
echo "Current GRUB menu_auto_hide setting: ${bold}${red}Not Set (default to 0)${normal}"
echo "Explanation:"
echo " - ${bold}0${normal}: GRUB always shows on boot."
return 0
else
case "$CURRENT_SETTING" in
0)
echo "Current GRUB menu_auto_hide setting: ${bold}${green}0 (Always Show)${normal}"
echo "Explanation:"
echo " - ${bold}0${normal}: GRUB always shows on boot."
;;
1)
echo "Current GRUB menu_auto_hide setting: ${bold}${yellow}1 (Hide After Successful Boot)${normal}"
echo "Explanation:"
echo " - ${bold}1${normal}: GRUB is hidden after a successful boot, but it will show if dual-booting."
;;
2)
echo "Current GRUB menu_auto_hide setting: ${bold}${cyan}2 (Always Hide)${normal}"
echo "Explanation:"
echo " - ${bold}2${normal}: GRUB is hidden after a successful boot, even for dual-boot setups."
;;
*)
echo "Current GRUB menu_auto_hide setting: ${bold}${red}Unknown${normal}"
echo "Explanation:"
echo " - This setting is unrecognized. Reset it to 0, 1, or 2."
;;
esac
fi
}
# Interactive menu for choosing the new behavior
interactive_menu() {
local options=(
"Always Hide Grub (menu_auto_hide=2)"
"Hide After Successful Boot (menu_auto_hide=1)"
"Always Show Grub (menu_auto_hide=0)"
"Exit without changes"
)
local choice
choice=$(ugum choose "${options[@]}")
echo "$choice"
}
# Function to apply the selected setting
apply_setting() {
local selected_option="$1"
# Support the interactive strings as well as short commands
case "$(echo "$selected_option" | tr '[:upper:]' '[:lower:]')" in
*"(menu_auto_hide=2)"*|hide)
sudo grub2-editenv - set menu_auto_hide=2
echo "GRUB menu is now set to ${bold}${cyan}Always Hide${normal}."
;;
*"(menu_auto_hide=1)"*|unhide)
sudo grub2-editenv - set menu_auto_hide=1
echo "GRUB menu is now set to ${bold}${yellow}Hide After Successful Boot${normal}."
;;
*"(menu_auto_hide=0)"*|show)
sudo grub2-editenv - set menu_auto_hide=0
echo "GRUB menu is now set to ${bold}${green}Always Show${normal}."
;;
*"exit without changes"*|exit)
echo "${bold}No changes were made. Exiting...${normal}"
;;
help)
print_help
;;
*)
echo "${bold}${red}Invalid option selected. No changes were made.${normal}"
;;
esac
}
OPTION="{{ ACTION }}" # from “configure-grub ACTION=...”
if [ "$OPTION" == "help" ]; then
print_help
exit 0
fi
get_current_setting
echo
echo "You can edit /etc/default/grub to change settings manually, then:"
echo "grub2-mkconfig -o /etc/grub2-efi.cfg"
# If no ACTION was passed, go interactive
if [ -z "$OPTION" ]; then
NEW_SETTING=$(interactive_menu)
if [ -n "$NEW_SETTING" ]; then
apply_setting "$NEW_SETTING"
else
echo "${bold}No changes were made.${normal}"
fi
else
apply_setting "$OPTION"
fi

# Add user to "input" group required by certain controller drivers
add-user-to-input-group:
Expand Down

0 comments on commit 15ab635

Please sign in to comment.