XFCE auto system update script & VLC EOS skin/theme

VLC uses Qt, so you’ll need to follow the guide below to make it look like your GTK theme when using a GTK environment like Xfce.

Look and feel guide: https://wiki.archlinux.org/title/Uniform_look_for_Qt_and_GTK_applications


Regarding “auto-updating”, this is not recommended. That said, if you want to be notified of when updates are available, you may use the script below or possibly eos-update like mentioned above.

Simple Update Script:

#!/bin/bash

# Function to check for updates and send notification
check_updates() {
    updates=$(checkupdates && yay -Qua)

    if [ -n "$updates" ]; then
        notify-send -t 60000 -a "System Updates" "Updates Available" "Click to update in your terminal" -A "Update"

        if [ $? -eq 0 ]; then
            # Notification was clicked, launch xfce4-terminal and run pacman and yay
            xfce4-terminal -H -e "bash -c 'sudo pacman -Syu && yay -Sua; echo; read -p \"Press Enter to close this window...\"'"
        fi
    fi
}

# Main loop
while true; do
    check_updates
    sleep 6h
done

This script is designed to check for system updates on an Arch-based Linux distribution using both pacman and yay package managers. It runs in a continuous loop, checking for updates every 6 hours and sending a notification if updates are available.

You can use your preferred terminal. The xfce4-terminal is not a requirement.

Here’s how to use it and make it autostart under Xfce:

Script Analysis

  1. The script defines a function check_updates() that:

    • Checks for updates using checkupdates and yay -Qua
    • Sends a notification if updates are available
    • Opens xfce4-terminal terminal to perform the updates if the notification is clicked
  2. The main loop runs the check_updates() function every 6 hours

Instructions for Use and Autostart

  1. Save the script:

    • Create a new file, e.g., update_checker.sh
    • Copy the script into this file
    • Save it in a suitable location, e.g., ~/scripts/update_checker.sh
  2. Make the script executable:

    chmod +x ~/scripts/update_checker.sh
    
  3. Test the script:

    • Run it manually to ensure it works as expected:
      ~/scripts/update_checker.sh &
      
  4. Create an autostart entry in Xfce:

    • Open Xfce’s Settings Manager
    • Go to “Session and Startup”
    • Click on the “Application Autostart” tab
    • Click the “Add” button
    • Fill in the details:
      • Name: Update Checker
      • Description: Checks for system updates periodically
      • Command: /bin/bash -c "~/scripts/update_checker.sh &"
  5. Log out and log back in to Xfce, or restart your computer

The script will now run automatically when you log into your Xfce session. It will check for updates every 6 hours and notify you if any are available. Clicking the notification will open xfce4-terminal and run the update process.

Note: Ensure you have checkupdates, yay, notify-send, and xfce4-terminal installed on your system for the script to function properly.

Other Scripts: Useful and "Use Less" Scripts