add new .desktop files and new xDaily

This commit is contained in:
manuel 2024-03-26 11:25:28 -01:00
parent 469f8752a0
commit 3c5d507323
5 changed files with 485 additions and 208 deletions

View File

@ -1,210 +1,3 @@
#!/bin/bash
PROGNAME="xDaily"
[ "$USER" != "root" ] &&
echo -e "\t$PROGNAME must be run as root. \n\tOr with \`sudo $PROGNAME\` ." && exit
### Our options are going to be
# = "full output to the terminal, no stopping."
# -i = "interactive"
# -q = "interactive but suppressed output"
OPTIND="0"
for i in _quiet _interactive ; do unset -v $i ; done
while getopts 'iq' OPTION; do
case "$OPTION" in
i)
_interactive="yes"
echo -e " Entering interactive mode\n"
break
;;
q)
_quiet="yes"
echo -e " Entering interactive mode, without verbose output.\n"
break
;;
?)
echo "Usage: $(basename ${PROGNAME}) [-i = interactive] [-q = suppressed ouput]"
return 1
;;
esac
done
[ "$(which nala)" ] && PkgMgr="nala" || PkgMgr="apt"
see_it() {
[ "$_interactive" = "yes" ] && ( read -n1 -p " $_msg ? \"Y/n\" " answ
[ -z $answ ] || [ "$answ" = "y" ] || [ "$answ" = "Y" ] && echo &&
do_it &&
echo -e " $_msg - Completed.\n" ||
echo -e "\r $_msg - Skipped.\n" )
}
no_see() {
[ "$_quiet" = "yes" ] && ( read -n1 -p " $_msg ? \"Y/n\" " answ
[ -z $answ ] || [ "$answ" = "y" ] || [ "$answ" = "Y" ] && echo &&
do_it > /dev/null &&
echo -e " $_msg - Completed.\n" ||
echo -e "\r $_msg - Skipped.\n" )
}
run_it() {
[ "$_interactive" != "yes" ] && [ "$_quiet" != "yes" ] && (
echo -e "\n $_msg ." &&
do_it &&
echo -e " $_msg - Completed." )
}
# Begin xDaily command functions
_update() {
_msg="Check apt repositories for Updates"
do_it() {
[ "$_quiet" != "yes" ] &&
$PkgMgr update ||
$PkgMgr update 2>&1 >/dev/null
}
see_it
no_see
run_it
}
_upgradable() {
_msg="See upgradable packages"
do_it() {
[ "$_quiet" != "yes" ] &&
$PkgMgr list --upgradable ||
$PkgMgr list --upgradable 2>&1 >/dev/null
}
see_it
# no_see
# run_it
}
_upgrade() {
_msg="Install available updated packages"
do_it() {
[ "$_quiet" != "yes" ] &&
$PkgMgr upgrade ||
$PkgMgr upgrade 2>&1 >/dev/null
}
see_it
no_see
run_it
}
_apt_clean() {
_msg="Remove unneccessary packages from APT cache"
do_it() {
[ "$_quiet" != "yes" ] &&
$PkgMgr clean ||
$PkgMgr clean 2>&1 >/dev/null
}
see_it
no_see
run_it
}
_autoclean () {
_msg="Remove unavailable entries from APT cache"
do_it() {
[ "$_quiet" != "yes" ] &&
$PkgMgr autoclean ||
$PkgMgr autoclean 2>&1 >/dev/null
}
see_it
no_see
run_it
}
_autoremove() {
_msg="Remove old dependencies not required by the system"
do_it() {
[ "$_quiet" != "yes" ] &&
$PkgMgr autoremove ||
$PkgMgr autoremove 2>&1 >/dev/null
}
see_it
no_see
run_it
}
_clear_thumbnails() {
_msg="Clear browser thumbnail caches"
do_it() {
for i in ".thumbnails" ".cache/thumbnails" ; do
for j in "*/*.png" "*/*/*.png" ; do
[ "$_quiet" != "yes" ] &&
rm -v /home/${SUDO_USER}/${i}/${j} 2>/dev/null ||
rm /home/${SUDO_USER}/${i}/${j} 2>/dev/null
done
done ; true
}
see_it
no_see
run_it
}
_clear_recents() {
_msg="Clear the \"Recently Used\" list in FireFox"
do_it() {
dd bs=1 count=1 status=none if=/dev/null of=/home/${SUDO_USER}/.local/share/recently-used.xbel
chown ${SUDO_USER} /home/${SUDO_USER}/.local/share/recently-used.xbel
}
see_it
no_see
run_it
}
_rbranding() {
_msg="Reconfirm Peppermint Branding in os-release"
do_it() {
diff -q /opt/pepconf/os-release /usr/lib/os-release || cp /opt/pepconf/os-release /usr/lib/os-release
diff -q /opt/pepconf/os-release /etc/os-release || cp /opt/pepconf/os-release /etc/os-release
}
see_it
no_see
run_it
}
_ssd_trimfs() {
_msg="For SSDs: trim eligible ext2/3/4 filesystems"
do_it() {
for mnt in $(grep -E "(ext2|ext3|ext4)" /etc/mtab | cut -f2 -d" ")
do fstrim ${mnt} &>/dev/null &&
echo -e " Completed fstrim for \"${mnt}\"" ||
echo -e " No fstrim required for \"${mnt}\""
done
}
see_it
no_see
run_it
}
_udcache() {
_msg="Caching icons at /usr/share/icons/"
do_it() { update-icon-caches /usr/share/icons/* ;}
see_it
no_see
run_it
}
_update
_upgradable
_upgrade
_apt_clean
if [ "$PkgMgr" = "apt" ]; then _autoclean ; fi
_autoremove
_clear_thumbnails
_clear_recents
_udcache
_rbranding
_ssd_trimfs
[ "$_interactive" = "yes" ] &&
read -n1 -p " Press any key to continue ... " answ
echo
pkexec python3 ~/.local/share/pmostools/peptools/xDaily.py

View File

@ -0,0 +1,295 @@
[Desktop Entry]
Name=GParted
Name[ar]=مُقسِّمج
Name[be]=GParted
Name[bg]=GParted
Name[br]=GParted
Name[bs]=GParted
Name[ca]=GParted
Name[ca@valencia]=GParted
Name[cs]=GParted
Name[da]=GParted
Name[de]=GParted
Name[dz]=
Name[el]=GParted
Name[en_CA]=GParted
Name[en_GB]=GParted
Name[eo]=GParted
Name[es]=GParted
Name[et]=GParted
Name[eu]=GParted
Name[fa]=GParted
Name[fi]=GParted
Name[fr]=GParted
Name[fur]=GParted
Name[gd]=GParted
Name[gl]=GParted
Name[gu]=GParted
Name[he]=GParted
Name[hr]=GParted
Name[hu]=GParted
Name[id]=GParted
Name[is]=GParted
Name[it]=GParted
Name[ja]=GParted
Name[kk]=GParted
Name[ko]=GParted
Name[lt]=GParted
Name[lv]=GParted
Name[mk]=Гпартед
Name[ml]=
Name[nb]=GParted
Name[ne]=ि
Name[nl]=GParted
Name[nn]=GParted
Name[oc]=GParted
Name[pa]=GParted
Name[pl]=GParted
Name[pt]=GParted
Name[pt_BR]=GParted
Name[ro]=GParted
Name[ru]=GParted
Name[si]=GParted
Name[sk]=GParted
Name[sl]=GParted
Name[sr]=Гпартед
Name[sr@latin]=Gparted
Name[sv]=GParted
Name[te]=ి
Name[th]=GParted
Name[tr]=GParted
Name[uk]=GParted
Name[vi]=GParted
Name[zh_CN]=GParted
Name[zh_HK]=GParted
Name[zh_TW]=GParted
GenericName=Partition Editor
GenericName[ar]=محرر الأقسام
GenericName[be]=Рэдактар раздзелаў
GenericName[bg]=Редактор на дялове
GenericName[br]=Embanner parzhad
GenericName[bs]=Uređivač particija
GenericName[ca]=Editor de particions
GenericName[ca@valencia]=Editor de particions
GenericName[cs]=Editor oddílů
GenericName[da]=Partitioneringsprogram
GenericName[de]=Partitionierungswerkzeug
GenericName[el]=Επεξεργαστής κατατμήσεων
GenericName[en_CA]=Partition Editor
GenericName[en_GB]=Partition Editor
GenericName[eo]=Subdiskoredaktilo
GenericName[es]=Editor de particiones
GenericName[et]=Partitsiooniredaktor
GenericName[eu]=Partizio-editorea
GenericName[fa]=ویرایشگر پارتیشن
GenericName[fi]=Levyosioiden muokkain
GenericName[fr]=Éditeur de partitions
GenericName[fur]=Editôr di partizions
GenericName[gd]=Deasaiche pàirteachaidh
GenericName[gl]=Editor de particións
GenericName[he]=עורך המחיצות
GenericName[hr]=Uređivač particija
GenericName[hu]=Partíciószerkesztő
GenericName[id]=Penyunting Partisi
GenericName[is]=Disksneiðastjóri
GenericName[it]=Editor di partizioni
GenericName[ja]=
GenericName[kk]=Қатты диск бөлімдерін басқару
GenericName[ko]=
GenericName[lt]=Skaidinių redaktorius
GenericName[lv]=Nodalījumu redaktors
GenericName[ml]=
GenericName[nb]=Partisjonsredigering
GenericName[nl]=Partitiebewerker
GenericName[nn]=Partisjonshandsaming
GenericName[oc]=Editor de particions de GNOME
GenericName[pa]=
GenericName[pl]=Edytor partycji
GenericName[pt]=Editor de partições
GenericName[pt_BR]=Editor de Partições
GenericName[ro]=Editor de partiții
GenericName[ru]=Редактор разделов
GenericName[sk]=Editor diskových oddielov
GenericName[sl]=Urejevalnik razdelkov
GenericName[sr]=Уређивач партиција
GenericName[sr@latin]=Uređivač particija
GenericName[sv]=Partitionsredigerare
GenericName[te]=ి
GenericName[th]=
GenericName[tr]=Disk Bölümü Düzenleyicisi
GenericName[uk]=Редактор розділів
GenericName[vi]=ng dng sa phân vùng
GenericName[zh_CN]=
GenericName[zh_HK]=
GenericName[zh_TW]=
X-GNOME-FullName=GParted Partition Editor
X-GNOME-FullName[ar]=محرّر الأقسام مُقسِّمج
X-GNOME-FullName[be]=Рэдактар раздзелаў GParted
X-GNOME-FullName[bg]=Редактор на дялове на дискове за GNOME
X-GNOME-FullName[bs]=GParted uređivač particija
X-GNOME-FullName[ca]=Editor de particions GParted
X-GNOME-FullName[ca@valencia]=Editor de particions GParted
X-GNOME-FullName[cs]=Editor oddílů GParted
X-GNOME-FullName[da]=GParted - partitioneringsprogram
X-GNOME-FullName[de]=GParted Partitionierungswerkzeug
X-GNOME-FullName[el]=Επεξεργαστής κατατμήσεων GParted
X-GNOME-FullName[en_CA]=GParted Partition Editor
X-GNOME-FullName[en_GB]=GParted Partition Editor
X-GNOME-FullName[eo]=GParted Subdiskoredaktilo
X-GNOME-FullName[es]=Editor de particiones GParted
X-GNOME-FullName[et]=GParted partitsioonihaldur
X-GNOME-FullName[eu]=GParted partizio-editorea
X-GNOME-FullName[fa]=ویرایشگر پارتیشن GParted
X-GNOME-FullName[fi]=GParted - levyosioiden muokkain
X-GNOME-FullName[fr]=Éditeur de partitions GParted
X-GNOME-FullName[fur]=Editôr di partizions GParted
X-GNOME-FullName[gd]=Deasaiche pàirteachaidh GParted
X-GNOME-FullName[gl]=Editor de particións GParted
X-GNOME-FullName[gu]=GParted
X-GNOME-FullName[he]=עורך המחיצות GParted
X-GNOME-FullName[hr]=GParted uređivač particija
X-GNOME-FullName[hu]=GParted partíciószerkesztő
X-GNOME-FullName[id]=GParted Penyunting Partisi
X-GNOME-FullName[is]=GParted disksneiðastjórinn
X-GNOME-FullName[it]=Editor di partizioni GParted
X-GNOME-FullName[ja]=GParted
X-GNOME-FullName[kk]=GParted бөлімдерді басқарушысы
X-GNOME-FullName[ko]=GParted
X-GNOME-FullName[lt]=Skaidinių redaktorius GParted
X-GNOME-FullName[lv]=GParted nodalījumu redaktors
X-GNOME-FullName[ml]=
X-GNOME-FullName[nb]=GParted partisjonsredigering
X-GNOME-FullName[nl]=GParted partitiebewerker
X-GNOME-FullName[nn]=GParted partisjonshandsaming
X-GNOME-FullName[oc]=Editor de particions de GNOME
X-GNOME-FullName[pa]=
X-GNOME-FullName[pl]=Edytor partycji GParted
X-GNOME-FullName[pt]=Editor de partições GParted
X-GNOME-FullName[pt_BR]=Editor de partições GParted
X-GNOME-FullName[ro]=GParted - Editor de partiții
X-GNOME-FullName[ru]=Редактор разделов GParted
X-GNOME-FullName[sk]=GParted - editor diskových oddielov
X-GNOME-FullName[sl]=GParted urejevalnik razdelkov
X-GNOME-FullName[sr]=Уређивач партиција Гпартед
X-GNOME-FullName[sr@latin]=Uređivač particija Gparted
X-GNOME-FullName[sv]=GParted partitionsredigerare
X-GNOME-FullName[te]=ి ి
X-GNOME-FullName[th]= GParted
X-GNOME-FullName[tr]=GParted Disk Bölümü Düzenleyicisi
X-GNOME-FullName[uk]=Редактор розділів GParted
X-GNOME-FullName[vi]=ng dng hiu chnh phân vùng GParted
X-GNOME-FullName[zh_CN]=GParted
X-GNOME-FullName[zh_HK]=GParted
X-GNOME-FullName[zh_TW]=GParted
Comment=Create, reorganize, and delete partitions
Comment[ar]=أنشئ الأقسام ونظّمها واحذفها
Comment[be]=Стварыць, пераразмеркаваць альбо выдаліць раздзелы
Comment[bg]=Създаване, подреждане и изтриване на дялове
Comment[br]=Krouiñ, adaozañ ha dilemel ar parzhadoù
Comment[bs]=Kreiranje, reorganiziranje i brisanje particija
Comment[ca]=Creeu, reorganitzeu i suprimiu particions
Comment[ca@valencia]=Creeu, reorganitzeu i suprimiu particions
Comment[cs]=Vytvářejte, přeuspořádávejte a odstraňujte diskové oddíly
Comment[da]=Opret, omorganisér og slet partitioner
Comment[de]=Partitionen erzeugen, reorganisieren und löschen
Comment[el]=Δημιουργία, επεξεργασία και διαγραφή κατατμήσεων
Comment[en_CA]=Create, reorganise, and delete partitions
Comment[en_GB]=Create, reorganise, and delete partitions
Comment[eo]=Krei, reorganizi, kaj forigi subdiskojn
Comment[es]=Cree, reorganice y elimine particiones
Comment[et]=Partitsioonide loomine, muutmine ja kustutamine
Comment[eu]=Sortu, berrantolatu eta ezabatu partizioak
Comment[fa]=ساخت، بازسازی و حذف پارتیشنها
Comment[fi]=Luo, järjestele ja poista osioita
Comment[fr]=Crée, réorganise et supprime des partitions
Comment[fur]=Cree, torne a organizâ e elimine lis partizions
Comment[gd]=Cruthaich no sguab pàirteachaidhean às no cuir rian ùr orra
Comment[gl]=Crear, reorganizar e eliminar particións
Comment[he]=יצירה, ארגון מחדש ומחיקה של מחיצות
Comment[hr]=Stvori, preuredi, i obriši particije
Comment[hu]=Partíciók létrehozása, újraszervezése és törlése
Comment[id]=Membuat, mengorganisasi ulang, serta menghapus partisi
Comment[is]=Búa til, raða og eyða disksneiðum
Comment[it]=Crea, riorganizza ed elimina partizioni
Comment[ja]=
Comment[kk]=Бөлімдерді жасау, басқару және өшіру
Comment[ko]= , ,
Comment[lt]=Kurkite, pertvarkykite ir trinkite skaidinius
Comment[lv]=Veido, pārkārto un dzēš disku nodalījumus
Comment[ml]=ി ിി, ി,
Comment[nb]=Lag, omorganiser og slett partisjoner
Comment[nl]=Partities aanmaken, ordenen en verwijderen
Comment[nn]=Lag, omorganiser og slett partisjonar
Comment[oc]=Crèa, reorganiza e suprimís de particions
Comment[pa]= ,
Comment[pl]=Tworzenie, reorganizacja i usuwanie partycji
Comment[pt]=Criar, reorganizar e eliminar partições
Comment[pt_BR]=Crie, reorganize e exclua partições
Comment[ro]=Creează, reorganizează și șterge partiții
Comment[ru]=Создание, перераспределение и удаление разделов
Comment[sk]=Vytvára, reorganizuje a odstraňuje diskové oddiely
Comment[sl]=Ustvarjanje, urejanje in brisanje razdelkov
Comment[sr]=Стварајте, реорганизујте и бришите партиције
Comment[sr@latin]=Stvarajte, reorganizujte i brišite particije
Comment[sv]=Skapa, organisera om och ta bort partitioner
Comment[te]=ి ి, ి, ి ి
Comment[th]=
Comment[tr]=Bölümler oluştur, yeniden düzenle ve sil
Comment[uk]=Створення, переміщення або вилучення розділів
Comment[vi]=To, t chc li và xóa b phân vùng
Comment[zh_CN]=
Comment[zh_HK]=
Comment[zh_TW]=
Exec=/usr/sbin/gparted %f
Icon=gparted
Terminal=false
Type=Application
Categories=GNOME;System;Filesystem;System;Settings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings
Keywords=Partition;
Keywords[ar]=قسم;
Keywords[be]=Раздзел;
Keywords[bs]=particija;
Keywords[ca]=Partició;
Keywords[cs]=oddíl;disk;
Keywords[da]=Partition;
Keywords[de]=Partition;
Keywords[el]=Κατάτμηση;Partition;
Keywords[en_GB]=Partition;
Keywords[eo]=Subdisko;
Keywords[es]=Partición;
Keywords[eu]=Partizioa;
Keywords[fi]=Osio;
Keywords[fr]=Partition;
Keywords[fur]=Partizion;
Keywords[gd]=Partition;Pàirteachadh;Pàirtich;
Keywords[gl]=Partición;
Keywords[hr]=Particija;
Keywords[hu]=Partíció;
Keywords[id]=Partisi;
Keywords[is]=Disksneið;
Keywords[it]=Partizione;
Keywords[kk]=Бөлім;
Keywords[ko]=Partition;;;;
Keywords[lt]=Skaidinys;
Keywords[lv]=Nodalījums;
Keywords[nb]=Partisjon;
Keywords[nl]=Partition;Partitie;
Keywords[oc]=Particion ;
Keywords[pa]=;
Keywords[pl]=Partycja;Partycje;Patrycja;Patrycje;Partycjonowanie;Patrycjonowanie;Dyski;twarde;twardy;HDD;SSD;Systemy;plików;Woluminy;Wolumeny;Napędy;
Keywords[pt]=Partição;
Keywords[pt_BR]=Partição;Partition;
Keywords[ro]=Partiție;
Keywords[ru]=Раздел;
Keywords[sk]=Oddiel;
Keywords[sl]=Razdelek;
Keywords[sr]=партиција;
Keywords[sr@latin]=particija;
Keywords[sv]=Partition;
Keywords[th]=;
Keywords[tr]=Bölüm;
Keywords[uk]=Розділ;
Keywords[vi]=Partition;Phân vùng;Phan vung;
Keywords[zh_CN]=Partition;;
Keywords[zh_TW]=;
StartupNotify=true

View File

@ -0,0 +1,32 @@
[Desktop Entry]
Name=Timeshift
Exec=timeshift-launcher
Type=Application
GenericName=System Restore Utility
GenericName[ca]=Utilitat de restauració del sistema
GenericName[cs]=Nástroj pro obnovení systému
GenericName[da]=Værktøj til systemgendannelse
GenericName[fr]=Utilitaire de restauration système
GenericName[hr]=Alat obnove sustava
GenericName[ja]=
GenericName[ko]=
GenericName[lt]=Sistemos atkūrimo paslaugų programa
GenericName[nl]=Hulpmiddel voor systeemherstel
GenericName[ru]=Программа для восстановления системы
Terminal=false
Icon=timeshift
Comment=System Restore Utility
Comment[ca]=Utilitat de restauració del sistema
Comment[cs]=Nástroj pro obnovení systému
Comment[da]=Værktøj til systemgendannelse
Comment[fr]=Utilitaire de restauration système
Comment[hr]=Alat obnove sustava
Comment[ja]=
Comment[ko]=
Comment[lt]=Sistemos atkūrimo paslaugų programa
Comment[nl]=Hulpmiddel voor systeemherstel
Comment[ru]=Программа для восстановления системы
X-KDE-StartupNotify=false
Categories=System;System;Settings;X-XFCE-SettingsDialog;X-XFCE-SystemSettings
X-GNOME-UsesNotifications=true
Keywords=backup;btrfs;rsync;

View File

@ -0,0 +1,21 @@
[Desktop Entry]
Version=1.0
Type=Application
Name=xDaily
Name[en]=xDaily
Name[es]=xDaily
Name[fr]=xDaily
Name[de]=xDaily
Name[it]=xDaily
Name[pt]=xDaily
Name[pt_BR]=xDaily
Name[ru]=xDaily
Name[zh_CN]=xDaily
Name[zh_TW]=xDaily
Name[ja]=xDaily
Name[ko]=xDaily
Exec=//usr/local/bin/xDaily
Icon=/usr/share/pixmaps/xd.png
Terminal=false
StartupNotify=false
Categories=Utility;

View File

@ -0,0 +1,136 @@
#!/usr/bin/env python3
import subprocess
import os
import tkinter as tk
from tkinter import ttk
from tkinter.scrolledtext import ScrolledText
from ttkbootstrap import Style
PROGNAME = "xDaily"
class XDailyApp:
def __init__(self, root):
self.root = root
self.root.title("xDaily - Automated System Maintenance")
self.root.geometry("800x600")
self.root.grid_rowconfigure(0, weight=1)
self.root.grid_columnconfigure(0, weight=1)
self.style = Style(theme="peppermint")
self.main_frame = ttk.Frame(self.root)
self.main_frame.grid(row=0, column=0, sticky="nsew", padx=10, pady=10)
self.output_text = ScrolledText(self.main_frame, wrap=tk.WORD)
self.output_text.grid(row=0, column=1, sticky="nsew", padx=10, pady=10)
self.execute_button = ttk.Button(self.main_frame, text="Execute All Tasks", command=self.execute_all_tasks, style="Danger.TButton")
self.execute_button.grid(row=1, column=1, pady=5, padx=(0, 10), sticky="e")
self.task_buttons_frame = ttk.Frame(self.main_frame, borderwidth=2, relief="solid")
self.task_buttons_frame.grid(row=0, column=0, rowspan=2, sticky="nsw", padx=10, pady=5)
self.create_task_buttons()
self.main_frame.grid_rowconfigure(0, weight=1)
self.main_frame.grid_columnconfigure(1, weight=1)
self.output_text.grid_rowconfigure(0, weight=1)
self.output_text.grid_columnconfigure(0, weight=1)
self.show_welcome_message()
def create_task_buttons(self):
tasks = [
"Check apt repositories for Updates",
"See upgradable packages",
"Install available updated packages",
"Remove unnecessary packages from APT cache",
"Remove unavailable entries from APT cache",
"Remove old dependencies not required by the system",
"Clear browser thumbnail caches",
"Clear the \"Recently Used\" list in FireFox",
"Reconfirm Peppermint Branding in os-release",
"For SSDs: trim eligible ext2/3/4 filesystems",
"Caching icons at /usr/share/icons/"
]
self.task_buttons = []
for task in tasks:
button = ttk.Button(self.task_buttons_frame, text=task, command=lambda t=task: self.execute_task(t), style="Danger.TButton", compound=tk.RIGHT)
button.pack(fill="x", padx=5, pady=5)
self.task_buttons.append(button)
def execute_all_tasks(self):
self.clear_output()
for button in self.task_buttons:
button.state(["disabled"])
for task_button in self.task_buttons:
task = task_button.cget("text")
result = self.execute_task(task)
if result is not None:
self.show_output(result)
for button in self.task_buttons:
button.state(["!disabled"])
def execute_task(self, task):
self.clear_output()
self.show_output(f"Running task: {task}\n")
try:
if task == "Check apt repositories for Updates":
output = subprocess.check_output(["apt", "update"], text=True)
elif task == "See upgradable packages":
output = subprocess.check_output(["apt", "list", "--upgradable"], text=True)
elif task == "Install available updated packages":
output = subprocess.check_output(["apt", "upgrade", "-y"], text=True)
elif task == "Remove unnecessary packages from APT cache":
output = subprocess.check_output(["apt", "clean"], text=True)
elif task == "Remove unavailable entries from APT cache":
output = subprocess.check_output(["apt", "autoclean"], text=True)
elif task == "Remove old dependencies not required by the system":
output = subprocess.check_output(["apt", "autoremove", "-y"], text=True)
elif task == "Clear browser thumbnail caches":
output = subprocess.check_output(["rm", "-v", "/home/" + os.getlogin() + "/.thumbnails/*/*.png"], text=True, stderr=subprocess.DEVNULL)
output += subprocess.check_output(["rm", "-v", "/home/" + os.getlogin() + "/.cache/thumbnails/*/*.png"], text=True, stderr=subprocess.DEVNULL)
elif task == "Clear the \"Recently Used\" list in FireFox":
output = subprocess.check_output(["dd", "bs=1", "count=1", "status=none", "if=/dev/null", "of=/home/" + os.getlogin() + "/.local/share/recently-used.xbel"], text=True, stderr=subprocess.DEVNULL)
output += subprocess.check_output(["chown", os.getlogin(), "/home/" + os.getlogin() + "/.local/share/recently-used.xbel"], text=True)
elif task == "Reconfirm Peppermint Branding in os-release":
output = subprocess.check_output(["diff", "-q", "/opt/pepconf/os-release", "/usr/lib/os-release"], text=True, stderr=subprocess.DEVNULL)
output += subprocess.check_output(["diff", "-q", "/opt/pepconf/os-release", "/etc/os-release"], text=True, stderr=subprocess.DEVNULL)
elif task == "For SSDs: trim eligible ext2/3/4 filesystems":
mounts = subprocess.check_output(["grep", "-E", "(ext2|ext3|ext4)", "/etc/mtab"], text=True)
mounts_list = mounts.splitlines()
for mount in mounts_list:
mount_path = mount.split()[1]
output = subprocess.check_output(["sudo", "fstrim", mount_path], text=True)
elif task == "Caching icons at /usr/share/icons/":
output = subprocess.check_output(["sudo", "update-icon-caches", "/usr/share/icons/*"], text=True)
self.show_output(output)
return output
except subprocess.CalledProcessError as e:
self.show_output(f"Error executing task: {e.output}\n")
def clear_output(self):
self.output_text.delete(1.0, tk.END)
def show_output(self, text):
self.output_text.insert(tk.END, text)
self.output_text.see(tk.END)
def show_welcome_message(self):
welcome_message = "Welcome to xDaily!\n\nThis application allows you to perform automated system maintenance tasks.\nYou can either execute all tasks at once or choose individual tasks to execute.\n\nSelect individual tasks from the list below or click 'Execute All Tasks' to start.\n"
self.show_output(welcome_message)
def main():
root = tk.Tk()
app = XDailyApp(root)
app.root.configure(bg="#c0c0c0") # Set background color to grey
root.mainloop()
if __name__ == "__main__":
main()