change name to f0ckm-uploader
This commit is contained in:
16
README.md
16
README.md
@@ -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`%).
|
||||
- **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**.
|
||||
- **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**:
|
||||
- **Images**: Fast native scaling via PySide6.
|
||||
- **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:
|
||||
|
||||
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.
|
||||
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`).
|
||||
@@ -117,13 +117,13 @@ To bind a keyboard shortcut to capture a screen region and upload it immediately
|
||||
|
||||
```bash
|
||||
# Capture screen region and upload
|
||||
kde-uploader-gui --spectacle
|
||||
f0ckm-uploader-gui --spectacle
|
||||
|
||||
# Upload a specific file
|
||||
kde-uploader-gui --upload="/path/to/file.mp4"
|
||||
f0ckm-uploader-gui --upload="/path/to/file.mp4"
|
||||
|
||||
# Open settings dialog
|
||||
kde-uploader-gui
|
||||
f0ckm-uploader-gui
|
||||
```
|
||||
|
||||
---
|
||||
@@ -132,9 +132,9 @@ kde-uploader-gui
|
||||
|
||||
- **Configuration File**: `~/.config/f0ckm-uploader/config.json`
|
||||
- **Environment File**: `~/.local/bin/.env`
|
||||
- **Application Binary**: `~/.local/bin/kde-uploader-gui`
|
||||
- **Start Menu Entry**: `~/.local/share/applications/kde-uploader-gui.desktop`
|
||||
- **Dolphin Service Menu**: `~/.local/share/kio/servicemenus/kde-uploader-servicemenu.desktop`
|
||||
- **Application Binary**: `~/.local/bin/f0ckm-uploader-gui`
|
||||
- **Start Menu Entry**: `~/.local/share/applications/f0ckm-uploader-gui.desktop`
|
||||
- **Dolphin Service Menu**: `~/.local/share/kio/servicemenus/f0ckm-uploader-servicemenu.desktop`
|
||||
|
||||
---
|
||||
|
||||
|
||||
20
gui.py
20
gui.py
@@ -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()
|
||||
|
||||
36
install.sh
36
install.sh
@@ -9,12 +9,18 @@ LEGACY_SERVICE_MENU_DIR="$HOME/.local/share/kservices5/ServiceMenus"
|
||||
# Create necessary directories
|
||||
mkdir -p "$INSTALL_DIR" "$APP_DIR" "$SERVICE_MENU_DIR" "$LEGACY_SERVICE_MENU_DIR"
|
||||
|
||||
# 1. Install the scripts
|
||||
cp uploader.sh "$INSTALL_DIR/kde-uploader"
|
||||
chmod +x "$INSTALL_DIR/kde-uploader"
|
||||
# Clean legacy kde-uploader names
|
||||
rm -f "$INSTALL_DIR/kde-uploader" "$INSTALL_DIR/kde-uploader-gui"
|
||||
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"
|
||||
chmod +x "$INSTALL_DIR/kde-uploader-gui"
|
||||
# 1. Install the scripts
|
||||
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/pixmaps"
|
||||
@@ -72,22 +78,22 @@ rm -f "$APP_DIR/net.local.spectacle_uploader.sh.desktop"
|
||||
ICON_PATH="f0ckm-uploader"
|
||||
|
||||
# 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"
|
||||
chmod +x "$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/f0ckm-uploader.desktop"
|
||||
|
||||
# 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"
|
||||
chmod +x "$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/f0ckm-uploader-gui.desktop"
|
||||
|
||||
update-desktop-database "$APP_DIR" &> /dev/null
|
||||
gtk-update-icon-cache -f -t "$HOME/.local/share/icons/hicolor" &> /dev/null || true
|
||||
kbuildsycoca6 --noincremental &> /dev/null || kbuildsycoca5 --noincremental &> /dev/null || true
|
||||
|
||||
# 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"
|
||||
chmod +x "$SERVICE_MENU_DIR/kde-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"
|
||||
chmod +x "$LEGACY_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/f0ckm-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/f0ckm-uploader-servicemenu.desktop"
|
||||
|
||||
# 5. Migrate config to config.json if not present
|
||||
CONFIG_DIR="$HOME/.config/f0ckm-uploader"
|
||||
@@ -111,8 +117,8 @@ EOF
|
||||
fi
|
||||
|
||||
echo "Installation complete!"
|
||||
echo "The script has been installed to $INSTALL_DIR/kde-uploader"
|
||||
echo "The GUI has been installed to $INSTALL_DIR/kde-uploader-gui"
|
||||
echo "The script has been installed to $INSTALL_DIR/f0ckm-uploader"
|
||||
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 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."
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pass execution directly to the Python GUI engine
|
||||
exec kde-uploader-gui --spectacle "$@"
|
||||
exec f0ckm-uploader-gui --spectacle "$@"
|
||||
|
||||
48
uninstall.sh
48
uninstall.sh
@@ -7,45 +7,23 @@ SERVICE_MENU_DIR="$HOME/.local/share/kio/servicemenus"
|
||||
LEGACY_SERVICE_MENU_DIR="$HOME/.local/share/kservices5/ServiceMenus"
|
||||
|
||||
# 1. Remove the executable scripts
|
||||
if [ -f "$INSTALL_DIR/kde-uploader" ]; then
|
||||
rm "$INSTALL_DIR/kde-uploader"
|
||||
echo "Removed uploader executable 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
|
||||
rm -f "$INSTALL_DIR/kde-uploader" "$INSTALL_DIR/f0ckm-uploader"
|
||||
rm -f "$INSTALL_DIR/kde-uploader-gui" "$INSTALL_DIR/f0ckm-uploader-gui"
|
||||
echo "Removed executables from $INSTALL_DIR"
|
||||
|
||||
# 2. Remove the application entries
|
||||
if [ -f "$APP_DIR/kde-uploader.desktop" ]; then
|
||||
rm "$APP_DIR/kde-uploader.desktop"
|
||||
echo "Removed application entry 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
|
||||
rm -f "$APP_DIR/kde-uploader.desktop" "$APP_DIR/f0ckm-uploader.desktop"
|
||||
rm -f "$APP_DIR/kde-uploader-gui.desktop" "$APP_DIR/f0ckm-uploader-gui.desktop"
|
||||
echo "Removed application entries from $APP_DIR"
|
||||
update-desktop-database "$APP_DIR" &> /dev/null
|
||||
|
||||
# 3. Remove the modern KDE Service Menu entry
|
||||
if [ -f "$SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" ]; then
|
||||
rm "$SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop"
|
||||
echo "Removed service menu entry from $SERVICE_MENU_DIR"
|
||||
fi
|
||||
# 3. Remove KDE Service Menu entries
|
||||
rm -f "$SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" "$SERVICE_MENU_DIR/f0ckm-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 entries"
|
||||
|
||||
# 4. Remove the legacy KDE Service Menu entry
|
||||
if [ -f "$LEGACY_SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop" ]; then
|
||||
rm "$LEGACY_SERVICE_MENU_DIR/kde-uploader-servicemenu.desktop"
|
||||
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
|
||||
# 4. Remove autostart entry
|
||||
rm -f "$HOME/.config/autostart/kde-uploader-gui.desktop" "$HOME/.config/autostart/f0ckm-uploader-gui.desktop"
|
||||
echo "Removed autostart entries"
|
||||
|
||||
echo "Uninstallation complete! The custom upload options, GUI, and scripts have been removed."
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
#!/usr/bin/env bash
|
||||
# Pass execution directly to the Python GUI engine
|
||||
exec kde-uploader-gui --upload="$1"
|
||||
exec f0ckm-uploader-gui --upload="$1"
|
||||
|
||||
Reference in New Issue
Block a user