2024-05-27 13:16:51 +02:00
|
|
|
#/bin/bash
|
|
|
|
|
2024-05-29 16:09:19 +02:00
|
|
|
set -eou pipefail
|
|
|
|
|
2024-05-27 13:16:51 +02:00
|
|
|
# Create systemd user directory
|
2024-05-29 19:05:02 +02:00
|
|
|
echo "Creating systemd user directory:"
|
2024-05-28 10:35:43 +02:00
|
|
|
mkdir -vp ~/.config/systemd/user
|
2024-05-29 16:09:19 +02:00
|
|
|
echo
|
2024-05-27 13:16:51 +02:00
|
|
|
|
|
|
|
# Copy unit files
|
2024-05-29 19:05:02 +02:00
|
|
|
echo "Copying unit files:"
|
2024-05-28 10:35:43 +02:00
|
|
|
cp -v theme-switcher.{service,timer} ~/.config/systemd/user
|
2024-05-29 16:09:19 +02:00
|
|
|
echo
|
2024-05-27 13:16:51 +02:00
|
|
|
|
2024-05-27 13:36:31 +02:00
|
|
|
# Add username to service file
|
2024-05-29 19:05:02 +02:00
|
|
|
echo "Editing service unit file:"
|
2024-05-27 13:36:31 +02:00
|
|
|
sed -i "s/username/$(whoami)/g" ~/.config/systemd/user/theme-switcher.service
|
2024-05-29 16:09:19 +02:00
|
|
|
echo
|
2024-05-27 13:36:31 +02:00
|
|
|
|
2024-05-27 13:16:51 +02:00
|
|
|
# Make directory for scripts
|
2024-05-29 19:05:02 +02:00
|
|
|
echo "Creating script directory in /home:"
|
2024-05-28 10:35:43 +02:00
|
|
|
mkdir -vp ~/.theme-switcher
|
2024-05-29 16:09:19 +02:00
|
|
|
echo
|
2024-05-27 13:16:51 +02:00
|
|
|
|
|
|
|
# Copy script file
|
2024-05-29 19:05:02 +02:00
|
|
|
echo "Copying script into directory:"
|
2024-05-28 10:35:43 +02:00
|
|
|
cp -v *.sh ~/.theme-switcher
|
2024-05-29 16:09:19 +02:00
|
|
|
echo
|
2024-05-27 13:16:51 +02:00
|
|
|
|
2024-05-29 19:05:02 +02:00
|
|
|
# Make script executable
|
|
|
|
echo "Making script executable"
|
|
|
|
chmod +x ~/.theme-switcher/theme-switcher.sh
|
|
|
|
|
|
|
|
# Create autostart directory
|
|
|
|
echo "Creating autostart directory:"
|
|
|
|
mkdir -vp ~/.config/autostart
|
|
|
|
|
|
|
|
# Copy autostart file
|
|
|
|
echo "Copying autostart file:"
|
|
|
|
cp -v theme-switcher.sh.desktop ~/.config/autostart
|
|
|
|
|
|
|
|
# Add username to autostart file
|
|
|
|
echo "Editing autostart file:"
|
|
|
|
sed -i "s/username/$(whoami)/g" ~/.config/autostart/theme-switcher.sh.desktop
|
|
|
|
echo
|
|
|
|
|
2024-05-27 13:16:51 +02:00
|
|
|
# Enable and start timer
|
2024-05-28 10:35:43 +02:00
|
|
|
echo "Enabling timer."
|
2024-05-27 13:16:51 +02:00
|
|
|
systemctl --user enable theme-switcher.timer
|
2024-05-29 16:09:19 +02:00
|
|
|
echo
|
2024-05-28 10:35:43 +02:00
|
|
|
echo "Starting timer."
|
2024-05-27 13:36:31 +02:00
|
|
|
systemctl --user start theme-switcher.timer
|
2024-05-29 16:09:19 +02:00
|
|
|
echo
|
2024-05-28 10:35:43 +02:00
|
|
|
echo "Starting service."
|
2024-05-29 16:09:19 +02:00
|
|
|
systemctl --user start theme-switcher
|
|
|
|
echo
|