melawy-skel-root/root/.local/bin/reset-layout.sh

50 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
theme="com.github.Melawy.Melawy-round-gray.Nier-A2.desktop"
# Force Zenity Status message box to always be on top.
(
sleep 30
echo "# Set theme"; sleep 1
plasma-apply-lookandfeel -a "$theme" --resetLayout
echo "25"
echo "# Remove unneeded link"; sleep 1
if [ "$(whoami)" != "liveuser" ]; then
sleep 5
if [ -f "$HOME/.config/autostart/reset-layout.desktop" ]; then
rm "$HOME/.config/autostart/reset-layout.desktop"
fi
# rm "$HOME/.local/bin/reset-layout.sh"
fi
echo "50"
echo "# Get status of plasmashell"; sleep 2
normal_process=$(ps -eo pcpu,stat,comm | grep plasmashell | grep 'S<sl')
echo "75"
if [ -z "$normal_process" ]; then
echo "# Restart plasma-plasmashell"; sleep 1
systemctl --user restart plasma-plasmashell
fi
echo "99"
echo "# All finished."; sleep 1
echo "100"
) |
zenity --progress \
--title="Waiting for the computer to complete setup. DO NOT CLOSE OR CANCEL!" \
--text="Run" \
--percentage=0 \
--auto-close \
--auto-kill
(( $? != 0 )) && zenity --error --text="Error in zenity command."
sleep 5
notify-send -t 5000 -a "Theme is" "$theme" "$(date '+%Y.%m.%d %H:%M:%S')"
echo "Ready"
exit 0