change name to f0ckm-uploader

This commit is contained in:
2026-08-11 23:16:32 +02:00
parent 1409b8f5ff
commit e4b119e0b8
9 changed files with 56 additions and 68 deletions

20
gui.py
View File

@@ -51,7 +51,7 @@ def copy_to_clipboard(text: str):
subprocess.run(["xsel", "--clipboard", "--input"], input=text.encode("utf-8"), check=False)
except Exception as e:
print(f"xsel error: {e}")
from PySide6.QtCore import Qt, QThread, QObject, Signal, QUrl, QFile, QIODevice, QTimer, QMimeData
from PySide6.QtCore import Qt, QThread, QObject, Signal, QUrl, QFile, QIODevice, QTimer, QMimeData, QProcess
from PySide6.QtGui import QIcon, QAction, QPixmap, QPainter, QColor, QFont, QPen, QImage, QDesktopServices, QDrag, QClipboard
from PySide6.QtNetwork import QNetworkAccessManager, QNetworkRequest, QHttpMultiPart, QHttpPart, QNetworkReply, QLocalServer, QLocalSocket
from PySide6.QtWidgets import (
@@ -174,13 +174,13 @@ def save_config(config):
def set_autostart(enabled):
autostart_dir = os.path.expanduser("~/.config/autostart")
autostart_path = os.path.join(autostart_dir, "kde-uploader-gui.desktop")
autostart_path = os.path.join(autostart_dir, "f0ckm-uploader-gui.desktop")
if enabled:
try:
os.makedirs(autostart_dir, exist_ok=True)
# Use the installed path ~/.local/bin/kde-uploader-gui if possible
exec_path = os.path.expanduser("~/.local/bin/kde-uploader-gui")
# Use the installed path ~/.local/bin/f0ckm-uploader-gui if possible
exec_path = os.path.expanduser("~/.local/bin/f0ckm-uploader-gui")
if not os.path.exists(exec_path):
exec_path = os.path.abspath(sys.argv[0])
@@ -1228,12 +1228,16 @@ class SystemTrayApp(QObject):
save_path = os.path.join(screenshot_dir, f"screenshot_{time.strftime('%Y%m%d_%H%M%S')}.png")
try:
res = subprocess.run(["spectacle", "-r", "-b", "-n", "-o", save_path])
if os.path.exists(save_path) and os.path.getsize(save_path) > 0:
self.upload_file_direct(save_path)
self.spectacle_proc = QProcess(self)
self.spectacle_proc.finished.connect(lambda exit_code, exit_status: self._on_spectacle_finished(save_path, exit_code))
self.spectacle_proc.start("spectacle", ["-r", "-b", "-n", "-o", save_path])
except Exception as e:
self.show_message("Upload Error", f"Failed to capture screenshot: {e}", QSystemTrayIcon.Critical)
def _on_spectacle_finished(self, save_path, exit_code):
if os.path.exists(save_path) and os.path.getsize(save_path) > 0:
self.upload_file_direct(save_path)
def upload_file_direct(self, file_path):
file_path = normalize_file_path(file_path)
if not file_path or not os.path.exists(file_path):
@@ -1503,7 +1507,7 @@ class SingleInstanceApp:
def main():
app = QApplication(sys.argv)
app.setApplicationName("f0ckm Uploader")
app.setDesktopFileName("kde-uploader-gui")
app.setDesktopFileName("f0ckm-uploader-gui")
app.setQuitOnLastWindowClosed(False)
app_icon = get_app_icon()