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

View File

@@ -9,7 +9,7 @@ A modern, high-contrast **KDE Plasma System Tray Uploader** and desktop integrat
- **System Tray App with Live Progress**: Dynamic system tray icon displaying live upload percentage (`0``99`%). - **System Tray App with Live Progress**: Dynamic system tray icon displaying live upload percentage (`0``99`%).
- **Single-Instance IPC Architecture**: 100% Python-based daemon (`PySide6`). Multiple invocations (hotkeys, Dolphin context menu) delegate directly to the running tray instance without spawning duplicates. - **Single-Instance IPC Architecture**: 100% Python-based daemon (`PySide6`). Multiple invocations (hotkeys, Dolphin context menu) delegate directly to the running tray instance without spawning duplicates.
- **Dolphin Context Menu Integration**: Right-click any file in Dolphin -> **Actions** -> **Upload to f0ckm**. - **Dolphin Context Menu Integration**: Right-click any file in Dolphin -> **Actions** -> **Upload to f0ckm**.
- **Spectacle Screenshot Capture**: Region capture integration via hotkeys or menu trigger (`kde-uploader-gui --spectacle`). - **Spectacle Screenshot Capture**: Region capture integration via hotkeys or menu trigger (`f0ckm-uploader-gui --spectacle`).
- **Smart Notification Previews**: - **Smart Notification Previews**:
- **Images**: Fast native scaling via PySide6. - **Images**: Fast native scaling via PySide6.
- **Videos** (`.mp4`, `.webm`, etc.): Automatic frame extraction at `00:00:01` via `ffmpeg`. - **Videos** (`.mp4`, `.webm`, etc.): Automatic frame extraction at `00:00:01` via `ffmpeg`.
@@ -77,7 +77,7 @@ chmod +x install.sh
The installer will automatically: The installer will automatically:
1. Copy binaries to `~/.local/bin/kde-uploader-gui` and `~/.local/bin/kde-uploader`. 1. Copy binaries to `~/.local/bin/f0ckm-uploader-gui` and `~/.local/bin/f0ckm-uploader`.
2. Generate multi-resolution icons (`32x32`, `48x48`, `64x64`, `128x128`, `256x256`) for KRunner & Start Menu compatibility. 2. Generate multi-resolution icons (`32x32`, `48x48`, `64x64`, `128x128`, `256x256`) for KRunner & Start Menu compatibility.
3. Register the Dolphin context menu action in `~/.local/share/kio/servicemenus/`. 3. Register the Dolphin context menu action in `~/.local/share/kio/servicemenus/`.
4. Register the `.desktop` application launchers and rebuild the KDE Plasma cache (`kbuildsycoca6`). 4. Register the `.desktop` application launchers and rebuild the KDE Plasma cache (`kbuildsycoca6`).
@@ -117,13 +117,13 @@ To bind a keyboard shortcut to capture a screen region and upload it immediately
```bash ```bash
# Capture screen region and upload # Capture screen region and upload
kde-uploader-gui --spectacle f0ckm-uploader-gui --spectacle
# Upload a specific file # Upload a specific file
kde-uploader-gui --upload="/path/to/file.mp4" f0ckm-uploader-gui --upload="/path/to/file.mp4"
# Open settings dialog # Open settings dialog
kde-uploader-gui f0ckm-uploader-gui
``` ```
--- ---
@@ -132,9 +132,9 @@ kde-uploader-gui
- **Configuration File**: `~/.config/f0ckm-uploader/config.json` - **Configuration File**: `~/.config/f0ckm-uploader/config.json`
- **Environment File**: `~/.local/bin/.env` - **Environment File**: `~/.local/bin/.env`
- **Application Binary**: `~/.local/bin/kde-uploader-gui` - **Application Binary**: `~/.local/bin/f0ckm-uploader-gui`
- **Start Menu Entry**: `~/.local/share/applications/kde-uploader-gui.desktop` - **Start Menu Entry**: `~/.local/share/applications/f0ckm-uploader-gui.desktop`
- **Dolphin Service Menu**: `~/.local/share/kio/servicemenus/kde-uploader-servicemenu.desktop` - **Dolphin Service Menu**: `~/.local/share/kio/servicemenus/f0ckm-uploader-servicemenu.desktop`
--- ---

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) subprocess.run(["xsel", "--clipboard", "--input"], input=text.encode("utf-8"), check=False)
except Exception as e: except Exception as e:
print(f"xsel error: {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.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.QtNetwork import QNetworkAccessManager, QNetworkRequest, QHttpMultiPart, QHttpPart, QNetworkReply, QLocalServer, QLocalSocket
from PySide6.QtWidgets import ( from PySide6.QtWidgets import (
@@ -174,13 +174,13 @@ def save_config(config):
def set_autostart(enabled): def set_autostart(enabled):
autostart_dir = os.path.expanduser("~/.config/autostart") 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: if enabled:
try: try:
os.makedirs(autostart_dir, exist_ok=True) os.makedirs(autostart_dir, exist_ok=True)
# Use the installed path ~/.local/bin/kde-uploader-gui if possible # Use the installed path ~/.local/bin/f0ckm-uploader-gui if possible
exec_path = os.path.expanduser("~/.local/bin/kde-uploader-gui") exec_path = os.path.expanduser("~/.local/bin/f0ckm-uploader-gui")
if not os.path.exists(exec_path): if not os.path.exists(exec_path):
exec_path = os.path.abspath(sys.argv[0]) 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") save_path = os.path.join(screenshot_dir, f"screenshot_{time.strftime('%Y%m%d_%H%M%S')}.png")
try: try:
res = subprocess.run(["spectacle", "-r", "-b", "-n", "-o", save_path]) self.spectacle_proc = QProcess(self)
if os.path.exists(save_path) and os.path.getsize(save_path) > 0: self.spectacle_proc.finished.connect(lambda exit_code, exit_status: self._on_spectacle_finished(save_path, exit_code))
self.upload_file_direct(save_path) self.spectacle_proc.start("spectacle", ["-r", "-b", "-n", "-o", save_path])
except Exception as e: except Exception as e:
self.show_message("Upload Error", f"Failed to capture screenshot: {e}", QSystemTrayIcon.Critical) 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): def upload_file_direct(self, file_path):
file_path = normalize_file_path(file_path) file_path = normalize_file_path(file_path)
if not file_path or not os.path.exists(file_path): if not file_path or not os.path.exists(file_path):
@@ -1503,7 +1507,7 @@ class SingleInstanceApp:
def main(): def main():
app = QApplication(sys.argv) app = QApplication(sys.argv)
app.setApplicationName("f0ckm Uploader") app.setApplicationName("f0ckm Uploader")
app.setDesktopFileName("kde-uploader-gui") app.setDesktopFileName("f0ckm-uploader-gui")
app.setQuitOnLastWindowClosed(False) app.setQuitOnLastWindowClosed(False)
app_icon = get_app_icon() app_icon = get_app_icon()

View File

@@ -9,12 +9,18 @@ LEGACY_SERVICE_MENU_DIR="$HOME/.local/share/kservices5/ServiceMenus"
# Create necessary directories # Create necessary directories
mkdir -p "$INSTALL_DIR" "$APP_DIR" "$SERVICE_MENU_DIR" "$LEGACY_SERVICE_MENU_DIR" mkdir -p "$INSTALL_DIR" "$APP_DIR" "$SERVICE_MENU_DIR" "$LEGACY_SERVICE_MENU_DIR"
# 1. Install the scripts # Clean legacy kde-uploader names
cp uploader.sh "$INSTALL_DIR/kde-uploader" rm -f "$INSTALL_DIR/kde-uploader" "$INSTALL_DIR/kde-uploader-gui"
chmod +x "$INSTALL_DIR/kde-uploader" rm -f "$APP_DIR/kde-uploader.desktop" "$APP_DIR/kde-uploader-gui.desktop"
rm -f "$SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" "$LEGACY_SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop"
rm -f "$HOME/.config/autostart/kde-uploader-gui.desktop"
cp gui.py "$INSTALL_DIR/kde-uploader-gui" # 1. Install the scripts
chmod +x "$INSTALL_DIR/kde-uploader-gui" cp uploader.sh "$INSTALL_DIR/f0ckm-uploader"
chmod +x "$INSTALL_DIR/f0ckm-uploader"
cp gui.py "$INSTALL_DIR/f0ckm-uploader-gui"
chmod +x "$INSTALL_DIR/f0ckm-uploader-gui"
mkdir -p "$HOME/.local/share/icons/hicolor/scalable/apps" mkdir -p "$HOME/.local/share/icons/hicolor/scalable/apps"
mkdir -p "$HOME/.local/share/pixmaps" mkdir -p "$HOME/.local/share/pixmaps"
@@ -72,22 +78,22 @@ rm -f "$APP_DIR/net.local.spectacle_uploader.sh.desktop"
ICON_PATH="f0ckm-uploader" ICON_PATH="f0ckm-uploader"
# 2. Install standard application entry (for Spectacle - hidden from main menu) # 2. Install standard application entry (for Spectacle - hidden from main menu)
sed -e "s|__EXEC_PATH__|$INSTALL_DIR/kde-uploader-gui --spectacle|g" -e "s|__ICON_PATH__|$ICON_PATH|g" kde-uploader.desktop > "$APP_DIR/kde-uploader.desktop" sed -e "s|__EXEC_PATH__|$INSTALL_DIR/f0ckm-uploader-gui --spectacle|g" -e "s|__ICON_PATH__|$ICON_PATH|g" f0ckm-uploader.desktop > "$APP_DIR/f0ckm-uploader.desktop"
chmod +x "$APP_DIR/kde-uploader.desktop" chmod +x "$APP_DIR/f0ckm-uploader.desktop"
# 3. Install the GUI application entry (visible in main menu) # 3. Install the GUI application entry (visible in main menu)
sed -e "s|__EXEC_PATH__|$INSTALL_DIR/kde-uploader-gui|g" -e "s|__ICON_PATH__|$ICON_PATH|g" kde-uploader-gui.desktop > "$APP_DIR/kde-uploader-gui.desktop" sed -e "s|__EXEC_PATH__|$INSTALL_DIR/f0ckm-uploader-gui|g" -e "s|__ICON_PATH__|$ICON_PATH|g" f0ckm-uploader-gui.desktop > "$APP_DIR/f0ckm-uploader-gui.desktop"
chmod +x "$APP_DIR/kde-uploader-gui.desktop" chmod +x "$APP_DIR/f0ckm-uploader-gui.desktop"
update-desktop-database "$APP_DIR" &> /dev/null update-desktop-database "$APP_DIR" &> /dev/null
gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" &> /dev/null || true gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" &> /dev/null || true
kbuildsycoca6 --noincremental &> /dev/null || kbuildsycoca5 --noincremental &> /dev/null || true kbuildsycoca6 --noincremental &> /dev/null || kbuildsycoca5 --noincremental &> /dev/null || true
# 4. Install KDE Service Menu entry (for Dolphin) # 4. Install KDE Service Menu entry (for Dolphin)
sed "s|__EXEC_PATH__|$INSTALL_DIR/kde-uploader-gui --upload|g" kde-uploader-servicemenu.desktop > "$SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" sed "s|__EXEC_PATH__|$INSTALL_DIR/f0ckm-uploader-gui --upload|g" f0ckm-uploader-servicemenu.desktop > "$SERVICE_MENU_DIR/f0ckm-uploader-servicemenu.desktop"
chmod +x "$SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" chmod +x "$SERVICE_MENU_DIR/f0ckm-uploader-servicemenu.desktop"
sed "s|__EXEC_PATH__|$INSTALL_DIR/kde-uploader-gui --upload|g" kde-uploader-servicemenu.desktop > "$LEGACY_SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" sed "s|__EXEC_PATH__|$INSTALL_DIR/f0ckm-uploader-gui --upload|g" f0ckm-uploader-servicemenu.desktop > "$LEGACY_SERVICE_MENU_DIR/f0ckm-uploader-servicemenu.desktop"
chmod +x "$LEGACY_SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" chmod +x "$LEGACY_SERVICE_MENU_DIR/f0ckm-uploader-servicemenu.desktop"
# 5. Migrate config to config.json if not present # 5. Migrate config to config.json if not present
CONFIG_DIR="$HOME/.config/f0ckm-uploader" CONFIG_DIR="$HOME/.config/f0ckm-uploader"
@@ -111,8 +117,8 @@ EOF
fi fi
echo "Installation complete!" echo "Installation complete!"
echo "The script has been installed to $INSTALL_DIR/kde-uploader" echo "The script has been installed to $INSTALL_DIR/f0ckm-uploader"
echo "The GUI has been installed to $INSTALL_DIR/kde-uploader-gui" echo "The GUI has been installed to $INSTALL_DIR/f0ckm-uploader-gui"
echo "You can launch the GUI uploader from your applications menu (f0ckm Uploader GUI)." echo "You can launch the GUI uploader from your applications menu (f0ckm Uploader GUI)."
echo "You can now right click files in Dolphin and find 'Upload to f0ckm' in the Actions menu." echo "You can now right click files in Dolphin and find 'Upload to f0ckm' in the Actions menu."
echo "In Spectacle, you should find 'Upload to f0ckm' in the Export or Share menu." echo "In Spectacle, you should find 'Upload to f0ckm' in the Export or Share menu."

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pass execution directly to the Python GUI engine # Pass execution directly to the Python GUI engine
exec kde-uploader-gui --spectacle "$@" exec f0ckm-uploader-gui --spectacle "$@"

View File

@@ -7,45 +7,23 @@ SERVICE_MENU_DIR="$HOME/.local/share/kio/servicemenus"
LEGACY_SERVICE_MENU_DIR="$HOME/.local/share/kservices5/ServiceMenus" LEGACY_SERVICE_MENU_DIR="$HOME/.local/share/kservices5/ServiceMenus"
# 1. Remove the executable scripts # 1. Remove the executable scripts
if [ -f "$INSTALL_DIR/kde-uploader" ]; then rm -f "$INSTALL_DIR/kde-uploader" "$INSTALL_DIR/f0ckm-uploader"
rm "$INSTALL_DIR/kde-uploader" rm -f "$INSTALL_DIR/kde-uploader-gui" "$INSTALL_DIR/f0ckm-uploader-gui"
echo "Removed uploader executable from $INSTALL_DIR" echo "Removed executables from $INSTALL_DIR"
fi
if [ -f "$INSTALL_DIR/kde-uploader-gui" ]; then
rm "$INSTALL_DIR/kde-uploader-gui"
echo "Removed GUI executable from $INSTALL_DIR"
fi
# 2. Remove the application entries # 2. Remove the application entries
if [ -f "$APP_DIR/kde-uploader.desktop" ]; then rm -f "$APP_DIR/kde-uploader.desktop" "$APP_DIR/f0ckm-uploader.desktop"
rm "$APP_DIR/kde-uploader.desktop" rm -f "$APP_DIR/kde-uploader-gui.desktop" "$APP_DIR/f0ckm-uploader-gui.desktop"
echo "Removed application entry from $APP_DIR" echo "Removed application entries from $APP_DIR"
fi
if [ -f "$APP_DIR/kde-uploader-gui.desktop" ]; then
rm "$APP_DIR/kde-uploader-gui.desktop"
echo "Removed GUI application entry from $APP_DIR"
fi
update-desktop-database "$APP_DIR" &> /dev/null update-desktop-database "$APP_DIR" &> /dev/null
# 3. Remove the modern KDE Service Menu entry # 3. Remove KDE Service Menu entries
if [ -f "$SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" ]; then rm -f "$SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" "$SERVICE_MENU_DIR/f0ckm-uploader-servicemenu.desktop"
rm "$SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" rm -f "$LEGACY_SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" "$LEGACY_SERVICE_MENU_DIR/f0ckm-uploader-servicemenu.desktop"
echo "Removed service menu entry from $SERVICE_MENU_DIR" echo "Removed service menu entries"
fi
# 4. Remove the legacy KDE Service Menu entry # 4. Remove autostart entry
if [ -f "$LEGACY_SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" ]; then rm -f "$HOME/.config/autostart/kde-uploader-gui.desktop" "$HOME/.config/autostart/f0ckm-uploader-gui.desktop"
rm "$LEGACY_SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" echo "Removed autostart entries"
echo "Removed legacy service menu entry from $LEGACY_SERVICE_MENU_DIR"
fi
# 5. Remove autostart entry
AUTOSTART_FILE="$HOME/.config/autostart/kde-uploader-gui.desktop"
if [ -f "$AUTOSTART_FILE" ]; then
rm "$AUTOSTART_FILE"
echo "Removed autostart entry"
fi
echo "Uninstallation complete! The custom upload options, GUI, and scripts have been removed." echo "Uninstallation complete! The custom upload options, GUI, and scripts have been removed."

View File

@@ -1,3 +1,3 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Pass execution directly to the Python GUI engine # Pass execution directly to the Python GUI engine
exec kde-uploader-gui --upload="$1" exec f0ckm-uploader-gui --upload="$1"