import os
import shutil
import tempfile
import tkinter as tk
from tkinter import ttk
import psutil
import ctypes
def calcular_tamanho(path)
total = 0
if [Link](path)
total += [Link](path)
elif [Link](path)
for dirpath, _, filenames in [Link](path)
for f in filenames
try
fp = [Link](dirpath, f)
if [Link](fp)
total += [Link](fp)
except
pass
return total
def limpar_caminho(path, filtro=None)
liberado = 0
if not [Link](path)
return 0
try
for item in [Link](path)
if filtro and not [Link](filtro)
continue
item_path = [Link](path, item)
liberado += calcular_tamanho(item_path)
if [Link](item_path)
[Link](item_path)
elif [Link](item_path)
[Link](item_path, ignore_errors=True)
except
pass
return liberado
def formatar_tamanho(bytes)
mb = bytes (1024 1024)
return f{mb.2f} MB if mb 1024 else f{mb 1024.2f} GB
def trim_working_set()
count = 0
for proc in psutil.process_iter(['pid', 'name'])
try
handle = [Link](0x001F0FFF, False,
[Link])
if handle
[Link](handle)
[Link](handle)
count += 1
except
pass
return f🧠 Working Set reduzido em {count} processos ativos.
def limpar_clipboard()
try
[Link](0)
[Link]()
[Link]()
return 📋 Área de transferência esvaziada com sucesso.
except
return ⚠️ Falha ao esvaziar a área de transferência.
# --- Lixeira ---
def tamanho_lixeira()
total = 0
root_drive = [Link](SystemDrive, C)
recycle_bin = [Link](root_drive, $[Link])
if [Link](recycle_bin)
for dirpath, _, filenames in [Link](recycle_bin)
for f in filenames
try
fp = [Link](dirpath, f)
if [Link](fp)
total += [Link](fp)
except
pass
return total
def limpar_lixeira()
try
antes = tamanho_lixeira()
SHERB_NOCONFIRMATION = 0x00000001
SHERB_NOPROGRESSUI = 0x00000002
SHERB_NOSOUND = 0x00000004
[Link](
None, None,
SHERB_NOCONFIRMATION SHERB_NOPROGRESSUI SHERB_NOSOUND
)
depois = tamanho_lixeira()
liberado = max(0, antes - depois)
return f Lixeira esvaziada {formatar_tamanho(liberado)} liberado.
except
return ⚠️ Falha ao esvaziar a lixeira.
def caminhos_temp()
local = [Link](LOCALAPPDATA)
system = [Link](SystemRoot, CWindows)
root_drive = [Link](SystemDrive, C)
return {
TEMP do usuário ([Link](), None),
TEMP do sistema ([Link](system, Temp), None),
WinRAR TEMP ([Link](), Rar$),
Prefetch ([Link](system, Prefetch), None),
Windows Update ([Link](system, SoftwareDistribution, Download),
None),
Arquivos de Otimização de Entrega ([Link](system,
SoftwareDistribution, DeliveryOptimization), None),
Logs do Windows ([Link](system, Logs), None),
Backup do Windows ([Link](system, System32, config, RegBack),
None),
Backup de Update ([Link](system, WinSxS, Backup), None),
Fragmentos do Chkdsk ([Link](root_drive, found.000), None),
Cache do CapCut ([Link](local, CapCut, Cache) if local else ,
None),
}
# --- Interface gráfica ---
root = [Link]()
[Link](Alien Cleaner — Turbo Edition)
[Link](560x752)
[Link](bg=#1e1e1e)
titulo = [Link](
root, text=Alien Cleaner — Turbo Edition,
font=(Segoe UI, 18, bold), fg=#ff3c3c, bg=#1e1e1e
)
[Link](pady=10)
progress_bar = [Link](root, orient=horizontal, length=500,
mode=determinate)
progress_bar.pack(pady=5)
status_label = [Link](root, text=, font=(Segoe UI, 10), fg=white, bg=#1e1e1e)
status_label.pack()
frame_opcoes = [Link](root, bg=#1e1e1e)
frame_opcoes.pack(pady=10)
checkboxes = {}
nomes_opcoes = list(caminhos_temp().keys()) + [
Esvaziar área de transferência,
Trim Working Set,
Limpar Lixeira
]
coluna1 = nomes_opcoes[len(nomes_opcoes)2]
coluna2 = nomes_opcoes[len(nomes_opcoes)2]
frame_col1 = [Link](frame_opcoes, bg=#1e1e1e)
frame_col1.grid(row=0, column=0, padx=20)
frame_col2 = [Link](frame_opcoes, bg=#1e1e1e)
frame_col2.grid(row=0, column=1, padx=20)
for nome in coluna1
var = [Link](value=True)
cb = [Link](
frame_col1, text=nome, variable=var, font=(Segoe UI, 10),
fg=white, bg=#1e1e1e,
activebackground=#2e2e2e, activeforeground=white, selectcolor=#1e1e1e
)
[Link](anchor=w)
checkboxes[nome] = var
for nome in coluna2
var = [Link](value=True)
cb = [Link](
frame_col2, text=nome, variable=var, font=(Segoe UI, 10),
fg=white, bg=#1e1e1e,
activebackground=#2e2e2e, activeforeground=white, selectcolor=#1e1e1e
)
[Link](anchor=w)
checkboxes[nome] = var
resultado_text = [Link](root, height=12, width=70, bg=#2c2c2c, fg=#d0d0d0,
font=(Consolas, 9))
resultado_text.pack(pady=10)
frame_botoes = [Link](root, bg=#1e1e1e)
frame_botoes.pack()
def executar_limpeza()
total_liberado = 0
resultado_text.delete(1.0, [Link])
caminhos = caminhos_temp()
selecionados = [nome for nome, var in [Link]() if [Link]()]
total_itens = len(selecionados) if selecionados else 1
atual = 0
for nome in selecionados
if nome in caminhos
caminho, filtro = caminhos[nome]
status_label.config(text=fLimpando {nome})
root.update_idletasks()
liberado = limpar_caminho(caminho, filtro)
total_liberado += liberado
resultado_text.insert([Link], f{nome} {formatar_tamanho(liberado)}
liberadon)
elif nome == Esvaziar área de transferência
status_label.config(text=Esvaziando área de transferência)
root.update_idletasks()
resultado_text.insert([Link], f{limpar_clipboard()}n)
elif nome == Limpar Lixeira
status_label.config(text=Esvaziando lixeira)
root.update_idletasks()
resultado_text.insert([Link], f{limpar_lixeira()}n)
atual += 1
progress_bar[value] = (atual total_itens) 100
root.update_idletasks()
status_label.config(text=🧹 Limpeza concluída!)
resultado_text.insert([Link], fn💾 Total liberado
{formatar_tamanho(total_liberado)}n)
def acao_trim_working_set()
if [Link](Trim Working Set) and checkboxes[Trim Working Set].get()
status_label.config(text=Reduzindo Working Set dos processos)
root.update_idletasks()
resultado = trim_working_set()
resultado_text.insert([Link], fn{resultado}n)
def botao_moderno(texto, comando, cor)
return [Link](
frame_botoes, text=texto, command=comando, font=(Segoe UI, 10, bold),
bg=cor, fg=white, activebackground=#ff6666, activeforeground=white,
relief=flat, padx=10, pady=5
)
botao_limpeza = botao_moderno(Limpar Arquivos, executar_limpeza, #ff3c3c)
botao_limpeza.grid(row=0, column=0, padx=10, pady=5)
botao_proc = botao_moderno(Fechar Processos, acao_trim_working_set, #4444ff)
botao_proc.grid(row=0, column=1, padx=10, pady=5)
[Link]()