#!/bin/bash
# Tune Debian 12 desktop for older machines

# System services
sudo systemctl mask ModemManager.service
sudo systemctl mask anacron.service
sudo systemctl mask avahi-daemon.service
sudo systemctl mask fwupd.service
sudo systemctl mask colord.service
sudo systemctl mask geoclue.service
sudo systemctl mask packagekit.service
sudo systemctl mask low-memory-monitor.service
sudo systemctl mask power-profiles-daemon.service
sudo systemctl mask switcheroo-control.service
sudo systemctl mask cups.service
sudo systemctl mask cups-browsed.service


# User services
systemctl --user mask tracker-miner-fs-3.service
systemctl --user mask evolution-addressbook-factory.service evolution-calendar-factory.service evolution-source-registry.service
systemctl --user mask gvfs-afc-volume-monitor.service gvfs-goa-volume-monitor.service gvfs-gphoto2-volume-monitor.service gvfs-mtp-volume-monitor.service
systemctl --user mask xdg-document-portal.service xdg-desktop-portal.service xdg-desktop-portal-gtk.service xdg-desktop-portal-gnome.service
systemctl --user mask gcr-ssh-agent.service
systemctl --user mask org.gnome.SettingsDaemon.Wacom.service
systemctl --user mask org.gnome.SettingsDaemon.Smartcard.service
systemctl --user mask org.gnome.SettingsDaemon.PrintNotifications.service
systemctl --user mask org.gnome.SettingsDaemon.UsbProtection.service
systemctl --user mask org.freedesktop.IBus.session.GNOME.service

sudo sed -i "s@Exec=.*@Exec=/bin/true@" /usr/share/dbus-1/services/org.gnome.Calendar.service
sudo sed -i "s@Exec=.*@Exec=/bin/true@" /usr/share/dbus-1/services/org.gnome.Software.service 
sudo sed -i "s@Exec=.*@Exec=/bin/true@" /usr/share/dbus-1/services/org.gnome.seahorse.Application.service 
sudo sed -i "s@Exec=.*@Exec=/bin/true@" /usr/share/dbus-1/services/org.freedesktop.PackageKit.service
sudo sed -i "s@Exec=.*@Exec=/bin/true@" /usr/share/dbus-1/services/org.gnome.Calculator.SearchProvider.service
sudo sed -i "s@Exec=.*@Exec=/bin/true@" /usr/share/dbus-1/services/org.gnome.Characters.service
sudo sed -i "s@Exec=.*@Exec=/bin/true@" /usr/share/dbus-1/services/org.gnome.Settings.SearchProvider.service 

sudo sed -i "s@Exec=.*@Exec=/bin/true@" /etc/xdg/autostart/org.gnome.Software.desktop
sudo sed -i "s@Exec=.*@Exec=/bin/true@" /etc/xdg/autostart/org.gnome.SettingsDaemon.Color.desktop
sudo sed -i "s@Exec=.*@Exec=/bin/true@" /etc/xdg/autostart/org.gnome.SettingsDaemon.MediaKeys.desktop

sudo tee /etc/dconf/db/local.d/01-tune-debian12-desktop <<EOF
[org/gnome/desktop/search-providers]
disable-external=true
EOF

sudo sed -i "s@^use-ssh-agent@#use-ssh-agent@" /etc/X11/Xsession.options

