From 3cca9806a628b6ac5290b915f83f1ce3d8655d7d Mon Sep 17 00:00:00 2001 From: bh Date: Mon, 30 Mar 2026 14:55:48 +0800 Subject: rofi: start tweaking the theme --- .../rofi/.bak/.clipboard-launcher-enhanced.sh.bak | 206 --------------- .../rofi/.bak/.clipboard-launcher.sh.backup | 60 ----- rofi/.config/rofi/.bak/.clipboard-rasi.backup | 148 ----------- rofi/.config/rofi/.bak/.clipboard.rasi.bak | 148 ----------- .../.bak/bak/clipboard-launcher.sh.20251203_221032 | 114 --------- .../rofi/.bak/bak/clipboard.rasi.20251203_221213 | 197 --------------- .../rofi/.bak/bak2/clipboard.rasi.20251203_221807 | 201 --------------- .../clipboard-launcher-enhanced.sh.20251128_191045 | 278 --------------------- .../clipboard-launcher-enhanced.sh.20251203_223308 | 278 --------------------- .../clipboard-launcher-enhanced.sh.20251203_223628 | 278 --------------------- .../.bak/clipboard-launcher.sh.20251128_191045 | 25 -- .../.bak/clipboard-launcher.sh.20251128_191729 | 65 ----- .../.bak/clipboard-launcher.sh.20251128_192345 | 109 -------- .../.bak/clipboard-launcher.sh.20251203_222516 | 58 ----- .../.bak/clipboard-launcher.sh.20251203_222912 | 59 ----- .../rofi/.bak/clipboard.rasi.20251128_191045 | 187 -------------- .../rofi/.bak/clipboard.rasi.20251128_191729 | 197 --------------- .../rofi/.bak/clipboard.rasi.20251128_192345 | 197 --------------- .../rofi/.bak/clipboard.rasi.20251203_222142 | 201 --------------- rofi/.config/rofi/clipboard.rasi | 5 + rofi/.config/rofi/rofidmenu.rasi | 4 + rofi/.config/rofi/theal.rasi | 18 +- 22 files changed, 21 insertions(+), 3012 deletions(-) delete mode 100755 rofi/.config/rofi/.bak/.clipboard-launcher-enhanced.sh.bak delete mode 100755 rofi/.config/rofi/.bak/.clipboard-launcher.sh.backup delete mode 100644 rofi/.config/rofi/.bak/.clipboard-rasi.backup delete mode 100644 rofi/.config/rofi/.bak/.clipboard.rasi.bak delete mode 100755 rofi/.config/rofi/.bak/bak/clipboard-launcher.sh.20251203_221032 delete mode 100644 rofi/.config/rofi/.bak/bak/clipboard.rasi.20251203_221213 delete mode 100644 rofi/.config/rofi/.bak/bak2/clipboard.rasi.20251203_221807 delete mode 100755 rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251128_191045 delete mode 100755 rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251203_223308 delete mode 100755 rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251203_223628 delete mode 100755 rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_191045 delete mode 100755 rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_191729 delete mode 100755 rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_192345 delete mode 100755 rofi/.config/rofi/.bak/clipboard-launcher.sh.20251203_222516 delete mode 100755 rofi/.config/rofi/.bak/clipboard-launcher.sh.20251203_222912 delete mode 100644 rofi/.config/rofi/.bak/clipboard.rasi.20251128_191045 delete mode 100644 rofi/.config/rofi/.bak/clipboard.rasi.20251128_191729 delete mode 100644 rofi/.config/rofi/.bak/clipboard.rasi.20251128_192345 delete mode 100644 rofi/.config/rofi/.bak/clipboard.rasi.20251203_222142 diff --git a/rofi/.config/rofi/.bak/.clipboard-launcher-enhanced.sh.bak b/rofi/.config/rofi/.bak/.clipboard-launcher-enhanced.sh.bak deleted file mode 100755 index 5d39f5b..0000000 --- a/rofi/.config/rofi/.bak/.clipboard-launcher-enhanced.sh.bak +++ /dev/null @@ -1,206 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Enhanced greenclip launcher with image thumbnail support -#============================================================================== -# This script provides an enhanced clipboard manager interface using rofi -# and greenclip, with support for image thumbnails and text truncation. -# -# Features: -# - Displays clipboard history from greenclip -# - Shows thumbnails for copied images -# - Truncates long text entries for better readability -# - Preserves original content when pasting (fixes display vs. actual content) -# -# Requirements: -# - rofi (with script mode support) -# - greenclip (clipboard manager daemon) -# - xclip (for clipboard operations) -#============================================================================== - -# Directory where greenclip caches image files -# NOTE: This should match your greenclip.toml image_cache_directory setting -IMGDIR="/tmp/greenclip" - -#------------------------------------------------------------------------------ -# clipboard_mode() - Main function that provides rofi script mode interface -#------------------------------------------------------------------------------ -# This function is called by rofi in two different contexts: -# -# 1. ROFI_RETV=0 (Initial call): Generate and display the menu items -# - Reads clipboard history from greenclip -# - Formats items with icons and thumbnails -# - Preserves original content in the 'info' field -# -# 2. ROFI_RETV=1 (Item selected): User selected an item -# - Returns the ORIGINAL content (from ROFI_INFO) for pasting -# - NOT the modified display text (from $1) -#------------------------------------------------------------------------------ -clipboard_mode() { - if [ "$ROFI_RETV" = "0" ]; then - #---------------------------------------------------------------------- - # INITIAL CALL - Build the clipboard menu - #---------------------------------------------------------------------- - - # Read clipboard history from greenclip, process line by line - greenclip print | while IFS= read -r line; do - - # Store original line for later retrieval (crucial for correct pasting) - original_content="$line" - - #------------------------------------------------------------------ - # IMAGE DETECTION - Check if this entry might be an image - #------------------------------------------------------------------ - # Greenclip stores copied images as files in IMGDIR - # We detect them by checking for short clipboard entries that might - # be image placeholders, then matching against cached image files - #------------------------------------------------------------------ - - image_found=0 # Flag to track if we found a matching image - - if [ -d "$IMGDIR" ]; then - # Iterate through image files in the cache directory - # NOTE: Using a for loop instead of while to avoid subshell issues - for img in "$IMGDIR"/*.png "$IMGDIR"/*.jpg "$IMGDIR"/*.jpeg; do - # Skip if no files match the glob pattern - [ -f "$img" ] || continue - - imgname=$(basename "$img") - - # Heuristic: Short lines (<50 chars) might be image placeholders - # This is a simple detection method and may need refinement - if [ ${#line} -lt 50 ] && [ -f "$img" ]; then - # Format for rofi with thumbnail support: - # display_text \0 icon \x1f icon_path \0 info \x1f original_content - # - # Breaking down the format: - # - display_text: What the user sees (with emoji and filename) - # - \0icon\x1f: Separator + icon field marker - # - thumbnail://path: Tells rofi to show image thumbnail - # - \0info\x1f: Separator + info field marker - # - original_content: The ACTUAL content to paste (preserved here!) - printf '%s\0icon\x1fthumbnail://%s\0info\x1f%s\n' \ - "🖼️ Image: $imgname" \ - "$img" \ - "$original_content" - - image_found=1 - break # Found matching image, stop searching - fi - done - fi - - # Skip to next clipboard entry if we already handled this as an image - # FIXED: Previously used 'continue 2' which could skip entries - [ $image_found -eq 1 ] && continue - - #------------------------------------------------------------------ - # TEXT ENTRY - Format regular clipboard text entries - #------------------------------------------------------------------ - - # Truncate long text for better display in the menu - # But preserve original content in the info field for pasting - if [ ${#line} -gt 100 ]; then - # Display truncated version with ellipsis - display_text="${line:0:100}..." - - # Format: display_text \0 info \x1f original_content - # The info field contains the FULL original text for pasting - printf '%s\0info\x1f%s\n' "$display_text" "$original_content" - else - # Short enough to display as-is, but still use info field - # for consistency (makes the selection handler simpler) - printf '%s\0info\x1f%s\n' "$line" "$original_content" - fi - done - else - #---------------------------------------------------------------------- - # ITEM SELECTED - User chose an item from the menu - #---------------------------------------------------------------------- - # CRITICAL FIX: Output $ROFI_INFO (original content) NOT $1 (display text) - # - # - $1 contains the display text (e.g., "Some long text..." or "🖼️ Image: ...") - # - $ROFI_INFO contains the original content we stored in the info field - # - This ensures we paste the actual clipboard content, not the modified display - #---------------------------------------------------------------------- - - echo "$ROFI_INFO" - - # OLD BUGGY CODE (commented out for reference): - # echo "$1" - # This would paste the DISPLAY text instead of the ORIGINAL content! - # For example, pasting "Some long text..." instead of the full text, - # or pasting "🖼️ Image: file.png" instead of the actual image data. - fi -} - -#============================================================================== -# Export functions and variables for rofi script mode -#============================================================================== -# These exports make the function and variables available when rofi -# calls this script as a subprocess -export -f clipboard_mode -export IMGDIR - -#============================================================================== -# SCRIPT ENTRY POINT -#============================================================================== -# This script has two execution modes: -# -# 1. Direct execution (user runs the script): -# - ROFI_RETV is empty/unset -# - Script launches rofi with itself as the data source -# -# 2. Called by rofi (rofi script mode): -# - ROFI_RETV is set (0 for initial, 1+ for selection) -# - Script provides menu items or processes selection -#============================================================================== - -# OLD CODE (commented out - caused rofi-in-rofi infinite recursion bug) -# This version didn't check if it was being called by rofi, so it would -# launch rofi again, which would call the script again, creating an infinite loop -# -# # Launch rofi with custom script mode -# rofi -modi "clipboard:$0" \ -# -show clipboard \ -# -run-command 'echo -n {cmd} | xclip -selection clipboard' \ -# -theme ~/.config/rofi/clipboard.rasi -# -# # If running in script mode (called by rofi) -# if [ -n "$ROFI_RETV" ]; then -# clipboard_mode "$@" -# fi - -#------------------------------------------------------------------------------ -# FIXED CODE - Prevents rofi-in-rofi recursion bug -#------------------------------------------------------------------------------ -# Check ROFI_RETV to determine execution context -if [ -z "$ROFI_RETV" ]; then - #-------------------------------------------------------------------------- - # MODE 1: Direct execution by user - #-------------------------------------------------------------------------- - # Launch rofi with this script as the clipboard data provider - # - # Parameters explained: - # -modi "clipboard:$0" : Register this script as a rofi mode named "clipboard" - # -show clipboard : Open rofi showing the clipboard mode - # -run-command '...' : What to do with the selected item - # {cmd} is replaced with the script's output (from ROFI_INFO) - # The output is piped to xclip to copy to system clipboard - # -theme ... : Custom theme file for appearance - #-------------------------------------------------------------------------- - rofi -modi "clipboard:$0" \ - -show clipboard \ - -run-command 'echo -n {cmd} | xclip -selection clipboard' \ - -theme ~/.config/rofi/clipboard.rasi -else - #-------------------------------------------------------------------------- - # MODE 2: Called by rofi (script mode) - #-------------------------------------------------------------------------- - # Rofi is calling us to either: - # - Get the list of menu items (ROFI_RETV=0) - # - Process a user selection (ROFI_RETV=1) - # - # The clipboard_mode function handles both cases - #-------------------------------------------------------------------------- - clipboard_mode "$@" -fi diff --git a/rofi/.config/rofi/.bak/.clipboard-launcher.sh.backup b/rofi/.config/rofi/.bak/.clipboard-launcher.sh.backup deleted file mode 100755 index 5f81f0e..0000000 --- a/rofi/.config/rofi/.bak/.clipboard-launcher.sh.backup +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Simple Greenclip Clipboard Manager Launcher -#============================================================================== -# This is a straightforward wrapper around greenclip that provides a -# clipboard history interface using rofi. -# -# Features: -# - Simple, reliable clipboard history -# - No modifications to clipboard content -# - No image thumbnail support (use enhanced version for that) -# - Minimal overhead and complexity -# -# Usage: -# ./clipboard-launcher.sh -# -# Requirements: -# - rofi (launcher/menu application) -# - greenclip (clipboard manager daemon - must be running) -# - xclip (for clipboard operations) -# -# How it works: -# 1. User runs this script -# 2. Rofi displays clipboard history from greenclip -# 3. User selects an item -# 4. Selected text is copied to system clipboard via xclip -# 5. User can paste normally (Ctrl+V) -#============================================================================== - -#------------------------------------------------------------------------------ -# Launch rofi with greenclip integration -#------------------------------------------------------------------------------ -# Parameters explained: -# -# -modi "clipboard:greenclip print" -# Register a rofi mode called "clipboard" that uses "greenclip print" -# to generate the menu items. Greenclip print outputs clipboard history. -# -# -show clipboard -# Open rofi showing the clipboard mode we just registered -# -# -run-command 'echo -n {cmd} | xclip -selection clipboard' -# When user selects an item: -# - {cmd} is replaced with the selected clipboard entry -# - Echo it (without newline: -n flag) to xclip -# - This copies it to the system clipboard -# - User can then paste it anywhere -# -# PREVIOUS BUGGY VERSION (commented out): -# # -run-command '{cmd}' -# This would try to EXECUTE the clipboard content as a command, -# which doesn't paste it and could be dangerous! -# -# -theme ~/.config/rofi/clipboard.rasi -# Use custom theme for consistent appearance -#------------------------------------------------------------------------------ -rofi -modi "clipboard:greenclip print" \ - -show clipboard \ - -run-command 'echo -n {cmd} | xclip -selection clipboard' \ - -theme ~/.config/rofi/clipboard.rasi diff --git a/rofi/.config/rofi/.bak/.clipboard-rasi.backup b/rofi/.config/rofi/.bak/.clipboard-rasi.backup deleted file mode 100644 index fbf37b6..0000000 --- a/rofi/.config/rofi/.bak/.clipboard-rasi.backup +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************* - * CLIPBOARD MANAGER (GREENCLIP) - *******************************************************/ - - -configuration { - font: "Noto Sans Regular 10"; - show-icons: true; - icon-theme: "Qogir"; - display-clipboard: " "; - disable-history: false; - sidebar-mode: false; - kb-cancel: "Super+c,Escape"; -} - - -@import "~/.config/rofi/config.rasi" -/* Insert theme modifications after this */ - -window { - background-color: @background; - border: 0; - padding: 30; - width: 50%; -} -listview { - lines: 8; - columns: 1; -} -mainbox { - border: 0; - padding: 0; -} -message { - border: 2px 0px 0px; - border-color: @separatorcolor; - padding: 1px; -} -textbox { - text-color: @foreground; -} -listview { - fixed-height: 0; - border: 8px 0px 0px; - border-color: @separatorcolor; - /* spacing: 8px; */ - spacing: 2px; /* More condensed spacing */ - scrollbar: true; - padding: 2px 0px 0px; -} -element { - border: 0; - /* padding: 5px; */ - padding: 2px; /* More condensed padding */ - orientation: horizontal; -} -element-icon { - /* size: 2em; */ - size: 1.5em; /* Smaller icon for condensed view */ - /* padding: 0 10px 0 0; */ - padding: 0 5px 0 0; /* Less padding between icon and text */ -} -element-text { - background-color: inherit; - text-color: inherit; - vertical-align: 0.5; -} -element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} -element.normal.urgent { - background-color: @urgent-background; - text-color: @urgent-foreground; -} -element.normal.active { - background-color: @active-background; - text-color: @active-foreground; -} -element.selected.normal { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} -element.selected.urgent { - background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; -} -element.selected.active { - background-color: @selected-active-background; - text-color: @selected-active-foreground; -} -element.alternate.normal { - background-color: @alternate-normal-background; - text-color: @alternate-normal-foreground; -} -element.alternate.urgent { - background-color: @alternate-urgent-background; - text-color: @alternate-urgent-foreground; -} -element.alternate.active { - background-color: @alternate-active-background; - text-color: @alternate-active-foreground; -} -scrollbar { - width: 4px; - border: 0; - handle-color: @normal-foreground; - handle-width: 8px; - padding: 0; -} -mode-switcher { - border: 2px 0px 0px; - border-color: @separatorcolor; -} -button { - spacing: 0; - text-color: @normal-foreground; -} -button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} -inputbar { - spacing: 0; - text-color: @normal-foreground; - padding: 1px; -} -case-indicator { - spacing: 0; - text-color: @normal-foreground; -} -entry { - spacing: 0; - text-color: @normal-foreground; -} -prompt { - spacing: 0; - text-color: @normal-foreground; -} -inputbar { - children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; -} -textbox-prompt-colon { - expand: false; - str: ""; - margin: 0px 0.3em 0em 0em; - text-color: @normal-foreground; -} diff --git a/rofi/.config/rofi/.bak/.clipboard.rasi.bak b/rofi/.config/rofi/.bak/.clipboard.rasi.bak deleted file mode 100644 index fbf37b6..0000000 --- a/rofi/.config/rofi/.bak/.clipboard.rasi.bak +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************* - * CLIPBOARD MANAGER (GREENCLIP) - *******************************************************/ - - -configuration { - font: "Noto Sans Regular 10"; - show-icons: true; - icon-theme: "Qogir"; - display-clipboard: " "; - disable-history: false; - sidebar-mode: false; - kb-cancel: "Super+c,Escape"; -} - - -@import "~/.config/rofi/config.rasi" -/* Insert theme modifications after this */ - -window { - background-color: @background; - border: 0; - padding: 30; - width: 50%; -} -listview { - lines: 8; - columns: 1; -} -mainbox { - border: 0; - padding: 0; -} -message { - border: 2px 0px 0px; - border-color: @separatorcolor; - padding: 1px; -} -textbox { - text-color: @foreground; -} -listview { - fixed-height: 0; - border: 8px 0px 0px; - border-color: @separatorcolor; - /* spacing: 8px; */ - spacing: 2px; /* More condensed spacing */ - scrollbar: true; - padding: 2px 0px 0px; -} -element { - border: 0; - /* padding: 5px; */ - padding: 2px; /* More condensed padding */ - orientation: horizontal; -} -element-icon { - /* size: 2em; */ - size: 1.5em; /* Smaller icon for condensed view */ - /* padding: 0 10px 0 0; */ - padding: 0 5px 0 0; /* Less padding between icon and text */ -} -element-text { - background-color: inherit; - text-color: inherit; - vertical-align: 0.5; -} -element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} -element.normal.urgent { - background-color: @urgent-background; - text-color: @urgent-foreground; -} -element.normal.active { - background-color: @active-background; - text-color: @active-foreground; -} -element.selected.normal { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} -element.selected.urgent { - background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; -} -element.selected.active { - background-color: @selected-active-background; - text-color: @selected-active-foreground; -} -element.alternate.normal { - background-color: @alternate-normal-background; - text-color: @alternate-normal-foreground; -} -element.alternate.urgent { - background-color: @alternate-urgent-background; - text-color: @alternate-urgent-foreground; -} -element.alternate.active { - background-color: @alternate-active-background; - text-color: @alternate-active-foreground; -} -scrollbar { - width: 4px; - border: 0; - handle-color: @normal-foreground; - handle-width: 8px; - padding: 0; -} -mode-switcher { - border: 2px 0px 0px; - border-color: @separatorcolor; -} -button { - spacing: 0; - text-color: @normal-foreground; -} -button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} -inputbar { - spacing: 0; - text-color: @normal-foreground; - padding: 1px; -} -case-indicator { - spacing: 0; - text-color: @normal-foreground; -} -entry { - spacing: 0; - text-color: @normal-foreground; -} -prompt { - spacing: 0; - text-color: @normal-foreground; -} -inputbar { - children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; -} -textbox-prompt-colon { - expand: false; - str: ""; - margin: 0px 0.3em 0em 0em; - text-color: @normal-foreground; -} diff --git a/rofi/.config/rofi/.bak/bak/clipboard-launcher.sh.20251203_221032 b/rofi/.config/rofi/.bak/bak/clipboard-launcher.sh.20251203_221032 deleted file mode 100755 index 235caf0..0000000 --- a/rofi/.config/rofi/.bak/bak/clipboard-launcher.sh.20251203_221032 +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Safe Clipboard Launcher - Crash-Free Version -#============================================================================== -# FIXES: -# - Skips images with missing files (prevents crashes) -# - Only shows images that actually exist -# - Safer error handling -# - No thumbnails for now (simpler, more stable) -#============================================================================== - -# Directory where greenclip stores image files -IMGDIR="/tmp/greenclip" - -#------------------------------------------------------------------------------ -# clipboard_mode() - Handles rofi script mode SAFELY -#------------------------------------------------------------------------------ -clipboard_mode() { - if [ "$ROFI_RETV" = "0" ]; then - #---------------------------------------------------------------------- - # Show clipboard entries - SKIP BROKEN IMAGES - #---------------------------------------------------------------------- - greenclip print | while IFS= read -r line; do - - # Check if this is an image entry - if [[ "$line" =~ ^image/png ]]; then - # Extract hash (handles both "image/png HASH" and "image/png Zen HASH") - hash=$(echo "$line" | awk '{print $NF}') - imgfile="$IMGDIR/${hash}.png" - - # IMPORTANT: Only show image if file actually exists - # This prevents crashes from missing files - if [ -f "$imgfile" ]; then - # Show image entry (no thumbnail to keep it simple and stable) - # Store original line in info field - printf '[IMAGE] %s\0info\x1f%s\n' "$(basename "$imgfile")" "$line" - fi - # If file doesn't exist: SKIP IT (don't show at all) - # This prevents clicking on broken images - - else - # Regular text entry - show as-is - printf '%s\0info\x1f%s\n' "$line" "$line" - fi - done - - else - #---------------------------------------------------------------------- - # Handle selection SAFELY - #---------------------------------------------------------------------- - selection="$ROFI_INFO" - - # Safety check: exit if nothing selected - [ -z "$selection" ] && exit 0 - - if [[ "$selection" =~ ^image/png ]]; then - # Image selected - copy with extra safety checks - hash=$(echo "$selection" | awk '{print $NF}') - imgfile="$IMGDIR/${hash}.png" - - # Double-check file exists and is readable - if [ -f "$imgfile" ] && [ -r "$imgfile" ]; then - # Copy image safely - xclip -selection clipboard -t image/png -i "$imgfile" 2>/dev/null - exit_code=$? - if [ $exit_code -ne 0 ]; then - # xclip failed - notify user if possible - command -v dunstify &>/dev/null && dunstify -u critical "Clipboard Error" "Failed to copy image" - fi - fi - else - # Text selected - copy safely - echo -n "$selection" | xclip -selection clipboard 2>/dev/null - fi - - # Always exit cleanly - exit 0 - fi -} - -# Export for rofi script mode -export -f clipboard_mode -export IMGDIR - -#------------------------------------------------------------------------------ -# Main entry point - with safety check -#------------------------------------------------------------------------------ -if [ -z "$ROFI_RETV" ]; then - # Launch rofi - rofi -modi "clipboard:$0" \ - -show clipboard \ - -theme ~/.config/rofi/clipboard.rasi -else - # Handle rofi request - clipboard_mode "$@" -fi - -#============================================================================== -# OLD VERSIONS (kept for reference) -#============================================================================== - -# VERSION WITH THUMBNAILS (caused crashes): -# The thumbnail:// protocol might be causing rofi to crash -# when trying to load missing image files -# -# if [ -f "$imgfile" ]; then -# printf 'Image: %s\0icon\x1fthumbnail://%s\0info\x1f%s\n' \ -# "$(basename "$imgfile")" \ -# "$imgfile" \ -# "$line" -# fi - -# SIMPLE DMENU VERSION (no images at all): -# greenclip print | rofi -dmenu -i -p " " -theme ~/.config/rofi/clipboard.rasi | xclip -selection clipboard diff --git a/rofi/.config/rofi/.bak/bak/clipboard.rasi.20251203_221213 b/rofi/.config/rofi/.bak/bak/clipboard.rasi.20251203_221213 deleted file mode 100644 index 347d825..0000000 --- a/rofi/.config/rofi/.bak/bak/clipboard.rasi.20251203_221213 +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************* - * CLIPBOARD MANAGER - With Images - *******************************************************/ -/* - * Clipboard theme with nice padding and image support - * - Normal font (10pt) - * - Comfortable padding (like rofidmenu) - * - Icons and images enabled - * - Clean and simple - */ - -configuration { - font: "Noto Sans Regular 10"; - show-icons: true; /* Enable icons for images */ - icon-theme: "Qogir"; - display-clipboard: " "; /* Clipboard icon restored */ - disable-history: false; - sidebar-mode: false; - kb-cancel: "Super+c,Escape"; -} - -/* Import base theme */ -@import "~/.config/rofi/config.rasi" - -/* Window - comfortable padding like rofidmenu */ -window { - background-color: @background; - border: 0; - padding: 30; /* Nice padding like rofidmenu */ - width: 50%; -} - -mainbox { - border: 0; - padding: 0; -} - -/* List view - balanced spacing */ -listview { - lines: 10; /* Show 10 entries */ - columns: 1; - fixed-height: 0; - border: 8px 0px 0px; /* Like rofidmenu */ - border-color: @separatorcolor; - scrollbar: true; - padding: 2px 0px 0px; - spacing: 4px; /* Comfortable spacing */ -} - -/* Element - comfortable padding */ -element { - border: 0; - padding: 3px; /* Comfortable padding */ -} - -/* Icon configuration for images */ -element-icon { - size: 2em; /* Good size for image thumbnails */ - padding: 0 6px 0 0; /* Space between icon and text */ -} - -element-text { - background-color: inherit; - text-color: inherit; - vertical-align: 0.5; -} - -/* Element states */ -element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} - -element.selected.normal { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -element.alternate.normal { - background-color: @alternate-normal-background; - text-color: @alternate-normal-foreground; -} - -element.normal.urgent { - background-color: @urgent-background; - text-color: @urgent-foreground; -} - -element.selected.urgent { - background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; -} - -element.alternate.urgent { - background-color: @alternate-urgent-background; - text-color: @alternate-urgent-foreground; -} - -element.normal.active { - background-color: @active-background; - text-color: @active-foreground; -} - -element.selected.active { - background-color: @selected-active-background; - text-color: @selected-active-foreground; -} - -element.alternate.active { - background-color: @alternate-active-background; - text-color: @alternate-active-foreground; -} - -/* Scrollbar */ -scrollbar { - width: 4px; /* Like rofidmenu */ - border: 0; - handle-color: @normal-foreground; - handle-width: 8px; - padding: 0; -} - -/* Input bar */ -inputbar { - spacing: 0; - text-color: @normal-foreground; - padding: 1px; - children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; -} - -prompt { - spacing: 0; - text-color: @normal-foreground; -} - -textbox-prompt-colon { - expand: false; - str: ""; - margin: 0px 0.3em 0em 0em; - text-color: @normal-foreground; -} - -entry { - spacing: 0; - text-color: @normal-foreground; -} - -case-indicator { - spacing: 0; - text-color: @normal-foreground; -} - -message { - border: 2px 0px 0px; - border-color: @separatorcolor; - padding: 1px; -} - -textbox { - text-color: @foreground; -} - -mode-switcher { - border: 2px 0px 0px; - border-color: @separatorcolor; -} - -button { - spacing: 0; - text-color: @normal-foreground; -} - -button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -/*------------------------------------------------------- - * PREVIOUS CONFIGURATIONS (commented for reference) - *------------------------------------------------------- - * - * Ultra-compact version had: - * - Font: 8pt - * - Window padding: 10px - * - List lines: 12 - * - Element padding: 1px vertical - * - Spacing: 1px - * - Icons: disabled - * - * Current comfortable version: - * - Font: 10pt - * - Window padding: 30px (like rofidmenu) - * - List lines: 10 - * - Element padding: 3px - * - Spacing: 4px - * - Icons: enabled for images - */ diff --git a/rofi/.config/rofi/.bak/bak2/clipboard.rasi.20251203_221807 b/rofi/.config/rofi/.bak/bak2/clipboard.rasi.20251203_221807 deleted file mode 100644 index bcccfff..0000000 --- a/rofi/.config/rofi/.bak/bak2/clipboard.rasi.20251203_221807 +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************* - * CLIPBOARD MANAGER - With Images - *******************************************************/ -/* - * Clipboard theme with nice padding and image support - * - Normal font (10pt) - * - Comfortable padding (like rofidmenu) - * - Icons and images enabled - * - Clean and simple - */ - -configuration { - font: "Noto Sans Regular 10"; - show-icons: true; /* Enable icons for images */ - icon-theme: "Qogir"; - display-clipboard: " "; /* Clipboard icon restored */ - disable-history: false; - sidebar-mode: false; - kb-cancel: "Super+c,Escape"; -} - -/* Import base theme */ -@import "~/.config/rofi/config.rasi" - -/* Window - comfortable padding like rofidmenu */ -window { - background-color: @background; - border: 0; - padding: 30; /* Nice padding like rofidmenu */ - width: 50%; -} - -mainbox { - border: 0; - padding: 0; -} - -/* List view - compact vertical spacing */ -listview { - lines: 10; /* Show 10 entries */ - columns: 1; - fixed-height: 0; - border: 8px 0px 0px; /* Like rofidmenu */ - border-color: @separatorcolor; - scrollbar: true; - padding: 2px 0px 0px; - spacing: 2px; /* Reduced: was 4px, now 2px */ -} - -/* Element - compact vertical padding */ -element { - border: 0; - padding: 1px 3px; /* Reduced vertical: 1px top/bottom, 3px left/right (was 3px all) */ -} - -/* Icon configuration for images */ -element-icon { - size: 2em; /* Good size for image thumbnails */ - padding: 0 6px 0 0; /* Space between icon and text */ -} - -element-text { - background-color: inherit; - text-color: inherit; - vertical-align: 0.5; -} - -/* Element states */ -element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} - -element.selected.normal { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -element.alternate.normal { - background-color: @alternate-normal-background; - text-color: @alternate-normal-foreground; -} - -element.normal.urgent { - background-color: @urgent-background; - text-color: @urgent-foreground; -} - -element.selected.urgent { - background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; -} - -element.alternate.urgent { - background-color: @alternate-urgent-background; - text-color: @alternate-urgent-foreground; -} - -element.normal.active { - background-color: @active-background; - text-color: @active-foreground; -} - -element.selected.active { - background-color: @selected-active-background; - text-color: @selected-active-foreground; -} - -element.alternate.active { - background-color: @alternate-active-background; - text-color: @alternate-active-foreground; -} - -/* Scrollbar */ -scrollbar { - width: 4px; /* Like rofidmenu */ - border: 0; - handle-color: @normal-foreground; - handle-width: 8px; - padding: 0; -} - -/* Input bar */ -inputbar { - spacing: 0; - text-color: @normal-foreground; - padding: 1px; - children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; -} - -prompt { - spacing: 0; - text-color: @normal-foreground; -} - -textbox-prompt-colon { - expand: false; - str: ""; - margin: 0px 0.3em 0em 0em; - text-color: @normal-foreground; -} - -entry { - spacing: 0; - text-color: @normal-foreground; -} - -case-indicator { - spacing: 0; - text-color: @normal-foreground; -} - -message { - border: 2px 0px 0px; - border-color: @separatorcolor; - padding: 1px; -} - -textbox { - text-color: @foreground; -} - -mode-switcher { - border: 2px 0px 0px; - border-color: @separatorcolor; -} - -button { - spacing: 0; - text-color: @normal-foreground; -} - -button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -/*------------------------------------------------------- - * PREVIOUS CONFIGURATIONS (commented for reference) - *------------------------------------------------------- - * - * Ultra-compact version had: - * - Font: 8pt - * - Window padding: 10px - * - List lines: 12 - * - Element padding: 1px vertical - * - Spacing: 1px - * - Icons: disabled - * - * Comfortable version had: - * - Element padding: 3px all sides - * - Spacing: 4px - * - * Current version (compact vertical): - * - Font: 10pt - * - Window padding: 30px (like rofidmenu) - * - List lines: 10 - * - Element padding: 1px vertical, 3px horizontal - * - Spacing: 2px (smaller vertical gaps) - * - Icons: enabled for images - */ diff --git a/rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251128_191045 b/rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251128_191045 deleted file mode 100755 index 0c1589a..0000000 --- a/rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251128_191045 +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Enhanced Greenclip Clipboard Manager with Image Support -#============================================================================== -# This script provides a fully-functional clipboard manager using rofi and -# greenclip, with proper support for both text and images. -# -# Features: -# - Displays clipboard history from greenclip -# - Shows image thumbnails for copied images -# - Truncates long text for readability -# - Properly pastes both text AND images back to clipboard -# - Handles greenclip's image format: "image/png Zen [hash]" -# -# Requirements: -# - rofi (with script mode and thumbnail support) -# - greenclip (clipboard manager daemon must be running) -# - xclip (for clipboard operations) -# - Image files stored in /tmp/greenclip/ (configured in greenclip.toml) -# -# How Greenclip Stores Images: -# 1. Text entries: Stored as-is in clipboard history -# 2. Image entries: Stored as "image/png Zen [hash]" in history -# 3. Actual PNG files: Saved to /tmp/greenclip/[hash].png -# 4. This script: Detects images, shows thumbnails, and restores them properly -#============================================================================== - -# Directory where greenclip caches image files -# IMPORTANT: This must match image_cache_directory in ~/.config/greenclip.toml -IMGDIR="/tmp/greenclip" - -# Maximum text length to display before truncating -MAX_TEXT_LENGTH=100 - -#------------------------------------------------------------------------------ -# clipboard_mode() - Main rofi script mode handler -#------------------------------------------------------------------------------ -# Called by rofi in two contexts: -# -# Context 1: ROFI_RETV=0 (Initial call) -# - Generate the menu items from greenclip history -# - Detect image vs text entries -# - Format with thumbnails and truncation -# - Store original content in info field for later retrieval -# -# Context 2: ROFI_RETV=1 (User selected item) -# - Receive selection via $ROFI_INFO -# - Determine if it's an image or text -# - Copy to clipboard appropriately (file for images, text for text) -#------------------------------------------------------------------------------ -clipboard_mode() { - if [ "$ROFI_RETV" = "0" ]; then - #---------------------------------------------------------------------- - # CONTEXT 1: Generate Menu Items - #---------------------------------------------------------------------- - - # Read clipboard history line by line from greenclip - greenclip print | while IFS= read -r line; do - - #------------------------------------------------------------------ - # IMAGE DETECTION AND DISPLAY - #------------------------------------------------------------------ - # Greenclip outputs image entries in format: "image/png Zen [hash]" - # We need to: - # 1. Detect these entries (starts with "image/") - # 2. Extract the hash/ID - # 3. Find the corresponding PNG file in IMGDIR - # 4. Display with thumbnail icon - #------------------------------------------------------------------ - - if [[ "$line" =~ ^image/png ]]; then - # This is an image entry! - - # Extract the hash from "image/png Zen [hash]" - # The hash is the last field (may be negative number) - hash=$(echo "$line" | awk '{print $NF}') - - # Construct the image file path - # Note: greenclip saves as [hash].png or [-hash].png - imgfile="$IMGDIR/${hash}.png" - - # Check if image file exists - if [ -f "$imgfile" ]; then - # Get just the filename for display - imgname=$(basename "$imgfile") - - # Display format for rofi: - # [display text] \0 icon \x1f [thumbnail path] \0 info \x1f [original line] - # - # Components: - # - Display: "🖼️ Image: filename.png" (what user sees) - # - Icon: thumbnail://path (shows image preview) - # - Info: original greenclip line (used for restoration) - printf '🖼️ Image: %s\0icon\x1fthumbnail://%s\0info\x1f%s\n' \ - "$imgname" \ - "$imgfile" \ - "$line" - else - # Image file not found, show as broken/missing - # Still preserve the original line in case file appears later - printf '🖼️ Image (missing): %s\0info\x1f%s\n' \ - "$hash" \ - "$line" - fi - - # Done processing this image entry, move to next line - continue - fi - - #------------------------------------------------------------------ - # TEXT ENTRY DISPLAY - #------------------------------------------------------------------ - # For regular text clipboard entries: - # 1. Truncate if too long (for display) - # 2. Preserve full original text in info field (for pasting) - #------------------------------------------------------------------ - - if [ ${#line} -gt $MAX_TEXT_LENGTH ]; then - # Text is long - truncate for display but preserve original - display_text="${line:0:$MAX_TEXT_LENGTH}..." - - # Format: [truncated text] \0 info \x1f [full original text] - # User sees truncated version, but pastes full version - printf '%s\0info\x1f%s\n' "$display_text" "$line" - else - # Text is short - can display as-is - # Still use info field for consistency in selection handling - printf '%s\0info\x1f%s\n' "$line" "$line" - fi - done - - else - #---------------------------------------------------------------------- - # CONTEXT 2: Handle User Selection - #---------------------------------------------------------------------- - # User selected an item. $ROFI_INFO contains the original content - # we stored in the info field during menu generation. - # - # We need to: - # 1. Check if selection is an image or text - # 2. For images: Copy the PNG file to clipboard - # 3. For text: Copy the text to clipboard - #---------------------------------------------------------------------- - - selection="$ROFI_INFO" - - #---------------------------------------------------------------------- - # IMAGE SELECTION HANDLING - #---------------------------------------------------------------------- - # Check if selected item is an image entry (starts with "image/png") - #---------------------------------------------------------------------- - if [[ "$selection" =~ ^image/png ]]; then - # This is an image! Extract hash and copy the actual PNG file - - # Parse hash from "image/png Zen [hash]" - hash=$(echo "$selection" | awk '{print $NF}') - - # Construct image file path - imgfile="$IMGDIR/${hash}.png" - - # Verify image file exists before copying - if [ -f "$imgfile" ]; then - # Copy the actual PNG file to clipboard as image data - # -selection clipboard: Use the standard clipboard (Ctrl+V) - # -t image/png: Set clipboard type to PNG image - # -i: Read from file - xclip -selection clipboard -t image/png -i "$imgfile" - - # Exit successfully - image is now in clipboard - exit 0 - else - # Image file not found - show error notification if dunstify available - if command -v dunstify &> /dev/null; then - dunstify -u critical "Clipboard Error" "Image file not found: $imgfile" - fi - # Exit with error code - exit 1 - fi - else - #------------------------------------------------------------------ - # TEXT SELECTION HANDLING - #------------------------------------------------------------------ - # This is regular text - copy to clipboard as text - #------------------------------------------------------------------ - - # Copy text directly to clipboard using xclip - # -selection clipboard: Use standard clipboard (Ctrl+V) - # -i: Read from stdin - # Using echo -n to avoid adding newline - echo -n "$selection" | xclip -selection clipboard - - # Exit successfully - text is now in clipboard - exit 0 - fi - fi -} - -#============================================================================== -# Export for rofi script mode -#============================================================================== -# Make function and variables available when rofi spawns this script -export -f clipboard_mode -export IMGDIR -export MAX_TEXT_LENGTH - -#============================================================================== -# MAIN SCRIPT ENTRY POINT -#============================================================================== -# Two execution modes based on ROFI_RETV environment variable: -# -# MODE 1: Direct execution (ROFI_RETV is unset/empty) -# - User ran this script from command line or keybind -# - Launch rofi with this script as the clipboard provider -# - Rofi will then call this script again in MODE 2 -# -# MODE 2: Called by rofi (ROFI_RETV is set) -# - Rofi is calling us to get menu items or handle selection -# - Call clipboard_mode() function to handle the request -#============================================================================== - -if [ -z "$ROFI_RETV" ]; then - #-------------------------------------------------------------------------- - # MODE 1: Launch rofi - #-------------------------------------------------------------------------- - - # Launch rofi with this script as the data source for "clipboard" mode - # - # Rofi parameters: - # -modi "clipboard:$0" - # Register "clipboard" mode that runs this script for data - # - # -show clipboard - # Display the clipboard mode immediately - # - # NO -run-command needed! - # The script handles clipboard copying internally for both text and images - # When user selects an item, rofi calls the script with ROFI_RETV=1 - # The script then copies to clipboard directly and exits - # - # -theme ... - # Custom theme file for visual styling - #-------------------------------------------------------------------------- - - rofi -modi "clipboard:$0" \ - -show clipboard \ - -theme ~/.config/rofi/clipboard.rasi - - # NOTE: All clipboard operations are handled inside clipboard_mode() - # when ROFI_RETV=1 (selection mode). No post-processing needed here. - -else - #-------------------------------------------------------------------------- - # MODE 2: Provide data to rofi or handle selection - #-------------------------------------------------------------------------- - - # Rofi is calling us - hand off to clipboard_mode function - clipboard_mode "$@" -fi - -#============================================================================== -# OLD/ALTERNATIVE APPROACHES (Commented out for reference) -#============================================================================== -# -# APPROACH 1: Using -run-command with xclip for text -# This was the old approach that didn't handle images properly: -# -# rofi -modi "clipboard:$0" \ -# -show clipboard \ -# -run-command 'echo -n {cmd} | xclip -selection clipboard' \ -# -theme ~/.config/rofi/clipboard.rasi -# -# PROBLEM: This pipes ALL selections (including "image/png Zen [hash]" text) -# to xclip as text, which doesn't restore the actual image to clipboard. -# -# SOLUTION: Handle image copying inside the script, before rofi's -run-command, -# by detecting image format and using xclip with -t image/png and the file. -# -#============================================================================== diff --git a/rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251203_223308 b/rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251203_223308 deleted file mode 100755 index 0c1589a..0000000 --- a/rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251203_223308 +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Enhanced Greenclip Clipboard Manager with Image Support -#============================================================================== -# This script provides a fully-functional clipboard manager using rofi and -# greenclip, with proper support for both text and images. -# -# Features: -# - Displays clipboard history from greenclip -# - Shows image thumbnails for copied images -# - Truncates long text for readability -# - Properly pastes both text AND images back to clipboard -# - Handles greenclip's image format: "image/png Zen [hash]" -# -# Requirements: -# - rofi (with script mode and thumbnail support) -# - greenclip (clipboard manager daemon must be running) -# - xclip (for clipboard operations) -# - Image files stored in /tmp/greenclip/ (configured in greenclip.toml) -# -# How Greenclip Stores Images: -# 1. Text entries: Stored as-is in clipboard history -# 2. Image entries: Stored as "image/png Zen [hash]" in history -# 3. Actual PNG files: Saved to /tmp/greenclip/[hash].png -# 4. This script: Detects images, shows thumbnails, and restores them properly -#============================================================================== - -# Directory where greenclip caches image files -# IMPORTANT: This must match image_cache_directory in ~/.config/greenclip.toml -IMGDIR="/tmp/greenclip" - -# Maximum text length to display before truncating -MAX_TEXT_LENGTH=100 - -#------------------------------------------------------------------------------ -# clipboard_mode() - Main rofi script mode handler -#------------------------------------------------------------------------------ -# Called by rofi in two contexts: -# -# Context 1: ROFI_RETV=0 (Initial call) -# - Generate the menu items from greenclip history -# - Detect image vs text entries -# - Format with thumbnails and truncation -# - Store original content in info field for later retrieval -# -# Context 2: ROFI_RETV=1 (User selected item) -# - Receive selection via $ROFI_INFO -# - Determine if it's an image or text -# - Copy to clipboard appropriately (file for images, text for text) -#------------------------------------------------------------------------------ -clipboard_mode() { - if [ "$ROFI_RETV" = "0" ]; then - #---------------------------------------------------------------------- - # CONTEXT 1: Generate Menu Items - #---------------------------------------------------------------------- - - # Read clipboard history line by line from greenclip - greenclip print | while IFS= read -r line; do - - #------------------------------------------------------------------ - # IMAGE DETECTION AND DISPLAY - #------------------------------------------------------------------ - # Greenclip outputs image entries in format: "image/png Zen [hash]" - # We need to: - # 1. Detect these entries (starts with "image/") - # 2. Extract the hash/ID - # 3. Find the corresponding PNG file in IMGDIR - # 4. Display with thumbnail icon - #------------------------------------------------------------------ - - if [[ "$line" =~ ^image/png ]]; then - # This is an image entry! - - # Extract the hash from "image/png Zen [hash]" - # The hash is the last field (may be negative number) - hash=$(echo "$line" | awk '{print $NF}') - - # Construct the image file path - # Note: greenclip saves as [hash].png or [-hash].png - imgfile="$IMGDIR/${hash}.png" - - # Check if image file exists - if [ -f "$imgfile" ]; then - # Get just the filename for display - imgname=$(basename "$imgfile") - - # Display format for rofi: - # [display text] \0 icon \x1f [thumbnail path] \0 info \x1f [original line] - # - # Components: - # - Display: "🖼️ Image: filename.png" (what user sees) - # - Icon: thumbnail://path (shows image preview) - # - Info: original greenclip line (used for restoration) - printf '🖼️ Image: %s\0icon\x1fthumbnail://%s\0info\x1f%s\n' \ - "$imgname" \ - "$imgfile" \ - "$line" - else - # Image file not found, show as broken/missing - # Still preserve the original line in case file appears later - printf '🖼️ Image (missing): %s\0info\x1f%s\n' \ - "$hash" \ - "$line" - fi - - # Done processing this image entry, move to next line - continue - fi - - #------------------------------------------------------------------ - # TEXT ENTRY DISPLAY - #------------------------------------------------------------------ - # For regular text clipboard entries: - # 1. Truncate if too long (for display) - # 2. Preserve full original text in info field (for pasting) - #------------------------------------------------------------------ - - if [ ${#line} -gt $MAX_TEXT_LENGTH ]; then - # Text is long - truncate for display but preserve original - display_text="${line:0:$MAX_TEXT_LENGTH}..." - - # Format: [truncated text] \0 info \x1f [full original text] - # User sees truncated version, but pastes full version - printf '%s\0info\x1f%s\n' "$display_text" "$line" - else - # Text is short - can display as-is - # Still use info field for consistency in selection handling - printf '%s\0info\x1f%s\n' "$line" "$line" - fi - done - - else - #---------------------------------------------------------------------- - # CONTEXT 2: Handle User Selection - #---------------------------------------------------------------------- - # User selected an item. $ROFI_INFO contains the original content - # we stored in the info field during menu generation. - # - # We need to: - # 1. Check if selection is an image or text - # 2. For images: Copy the PNG file to clipboard - # 3. For text: Copy the text to clipboard - #---------------------------------------------------------------------- - - selection="$ROFI_INFO" - - #---------------------------------------------------------------------- - # IMAGE SELECTION HANDLING - #---------------------------------------------------------------------- - # Check if selected item is an image entry (starts with "image/png") - #---------------------------------------------------------------------- - if [[ "$selection" =~ ^image/png ]]; then - # This is an image! Extract hash and copy the actual PNG file - - # Parse hash from "image/png Zen [hash]" - hash=$(echo "$selection" | awk '{print $NF}') - - # Construct image file path - imgfile="$IMGDIR/${hash}.png" - - # Verify image file exists before copying - if [ -f "$imgfile" ]; then - # Copy the actual PNG file to clipboard as image data - # -selection clipboard: Use the standard clipboard (Ctrl+V) - # -t image/png: Set clipboard type to PNG image - # -i: Read from file - xclip -selection clipboard -t image/png -i "$imgfile" - - # Exit successfully - image is now in clipboard - exit 0 - else - # Image file not found - show error notification if dunstify available - if command -v dunstify &> /dev/null; then - dunstify -u critical "Clipboard Error" "Image file not found: $imgfile" - fi - # Exit with error code - exit 1 - fi - else - #------------------------------------------------------------------ - # TEXT SELECTION HANDLING - #------------------------------------------------------------------ - # This is regular text - copy to clipboard as text - #------------------------------------------------------------------ - - # Copy text directly to clipboard using xclip - # -selection clipboard: Use standard clipboard (Ctrl+V) - # -i: Read from stdin - # Using echo -n to avoid adding newline - echo -n "$selection" | xclip -selection clipboard - - # Exit successfully - text is now in clipboard - exit 0 - fi - fi -} - -#============================================================================== -# Export for rofi script mode -#============================================================================== -# Make function and variables available when rofi spawns this script -export -f clipboard_mode -export IMGDIR -export MAX_TEXT_LENGTH - -#============================================================================== -# MAIN SCRIPT ENTRY POINT -#============================================================================== -# Two execution modes based on ROFI_RETV environment variable: -# -# MODE 1: Direct execution (ROFI_RETV is unset/empty) -# - User ran this script from command line or keybind -# - Launch rofi with this script as the clipboard provider -# - Rofi will then call this script again in MODE 2 -# -# MODE 2: Called by rofi (ROFI_RETV is set) -# - Rofi is calling us to get menu items or handle selection -# - Call clipboard_mode() function to handle the request -#============================================================================== - -if [ -z "$ROFI_RETV" ]; then - #-------------------------------------------------------------------------- - # MODE 1: Launch rofi - #-------------------------------------------------------------------------- - - # Launch rofi with this script as the data source for "clipboard" mode - # - # Rofi parameters: - # -modi "clipboard:$0" - # Register "clipboard" mode that runs this script for data - # - # -show clipboard - # Display the clipboard mode immediately - # - # NO -run-command needed! - # The script handles clipboard copying internally for both text and images - # When user selects an item, rofi calls the script with ROFI_RETV=1 - # The script then copies to clipboard directly and exits - # - # -theme ... - # Custom theme file for visual styling - #-------------------------------------------------------------------------- - - rofi -modi "clipboard:$0" \ - -show clipboard \ - -theme ~/.config/rofi/clipboard.rasi - - # NOTE: All clipboard operations are handled inside clipboard_mode() - # when ROFI_RETV=1 (selection mode). No post-processing needed here. - -else - #-------------------------------------------------------------------------- - # MODE 2: Provide data to rofi or handle selection - #-------------------------------------------------------------------------- - - # Rofi is calling us - hand off to clipboard_mode function - clipboard_mode "$@" -fi - -#============================================================================== -# OLD/ALTERNATIVE APPROACHES (Commented out for reference) -#============================================================================== -# -# APPROACH 1: Using -run-command with xclip for text -# This was the old approach that didn't handle images properly: -# -# rofi -modi "clipboard:$0" \ -# -show clipboard \ -# -run-command 'echo -n {cmd} | xclip -selection clipboard' \ -# -theme ~/.config/rofi/clipboard.rasi -# -# PROBLEM: This pipes ALL selections (including "image/png Zen [hash]" text) -# to xclip as text, which doesn't restore the actual image to clipboard. -# -# SOLUTION: Handle image copying inside the script, before rofi's -run-command, -# by detecting image format and using xclip with -t image/png and the file. -# -#============================================================================== diff --git a/rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251203_223628 b/rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251203_223628 deleted file mode 100755 index 0c1589a..0000000 --- a/rofi/.config/rofi/.bak/clipboard-launcher-enhanced.sh.20251203_223628 +++ /dev/null @@ -1,278 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Enhanced Greenclip Clipboard Manager with Image Support -#============================================================================== -# This script provides a fully-functional clipboard manager using rofi and -# greenclip, with proper support for both text and images. -# -# Features: -# - Displays clipboard history from greenclip -# - Shows image thumbnails for copied images -# - Truncates long text for readability -# - Properly pastes both text AND images back to clipboard -# - Handles greenclip's image format: "image/png Zen [hash]" -# -# Requirements: -# - rofi (with script mode and thumbnail support) -# - greenclip (clipboard manager daemon must be running) -# - xclip (for clipboard operations) -# - Image files stored in /tmp/greenclip/ (configured in greenclip.toml) -# -# How Greenclip Stores Images: -# 1. Text entries: Stored as-is in clipboard history -# 2. Image entries: Stored as "image/png Zen [hash]" in history -# 3. Actual PNG files: Saved to /tmp/greenclip/[hash].png -# 4. This script: Detects images, shows thumbnails, and restores them properly -#============================================================================== - -# Directory where greenclip caches image files -# IMPORTANT: This must match image_cache_directory in ~/.config/greenclip.toml -IMGDIR="/tmp/greenclip" - -# Maximum text length to display before truncating -MAX_TEXT_LENGTH=100 - -#------------------------------------------------------------------------------ -# clipboard_mode() - Main rofi script mode handler -#------------------------------------------------------------------------------ -# Called by rofi in two contexts: -# -# Context 1: ROFI_RETV=0 (Initial call) -# - Generate the menu items from greenclip history -# - Detect image vs text entries -# - Format with thumbnails and truncation -# - Store original content in info field for later retrieval -# -# Context 2: ROFI_RETV=1 (User selected item) -# - Receive selection via $ROFI_INFO -# - Determine if it's an image or text -# - Copy to clipboard appropriately (file for images, text for text) -#------------------------------------------------------------------------------ -clipboard_mode() { - if [ "$ROFI_RETV" = "0" ]; then - #---------------------------------------------------------------------- - # CONTEXT 1: Generate Menu Items - #---------------------------------------------------------------------- - - # Read clipboard history line by line from greenclip - greenclip print | while IFS= read -r line; do - - #------------------------------------------------------------------ - # IMAGE DETECTION AND DISPLAY - #------------------------------------------------------------------ - # Greenclip outputs image entries in format: "image/png Zen [hash]" - # We need to: - # 1. Detect these entries (starts with "image/") - # 2. Extract the hash/ID - # 3. Find the corresponding PNG file in IMGDIR - # 4. Display with thumbnail icon - #------------------------------------------------------------------ - - if [[ "$line" =~ ^image/png ]]; then - # This is an image entry! - - # Extract the hash from "image/png Zen [hash]" - # The hash is the last field (may be negative number) - hash=$(echo "$line" | awk '{print $NF}') - - # Construct the image file path - # Note: greenclip saves as [hash].png or [-hash].png - imgfile="$IMGDIR/${hash}.png" - - # Check if image file exists - if [ -f "$imgfile" ]; then - # Get just the filename for display - imgname=$(basename "$imgfile") - - # Display format for rofi: - # [display text] \0 icon \x1f [thumbnail path] \0 info \x1f [original line] - # - # Components: - # - Display: "🖼️ Image: filename.png" (what user sees) - # - Icon: thumbnail://path (shows image preview) - # - Info: original greenclip line (used for restoration) - printf '🖼️ Image: %s\0icon\x1fthumbnail://%s\0info\x1f%s\n' \ - "$imgname" \ - "$imgfile" \ - "$line" - else - # Image file not found, show as broken/missing - # Still preserve the original line in case file appears later - printf '🖼️ Image (missing): %s\0info\x1f%s\n' \ - "$hash" \ - "$line" - fi - - # Done processing this image entry, move to next line - continue - fi - - #------------------------------------------------------------------ - # TEXT ENTRY DISPLAY - #------------------------------------------------------------------ - # For regular text clipboard entries: - # 1. Truncate if too long (for display) - # 2. Preserve full original text in info field (for pasting) - #------------------------------------------------------------------ - - if [ ${#line} -gt $MAX_TEXT_LENGTH ]; then - # Text is long - truncate for display but preserve original - display_text="${line:0:$MAX_TEXT_LENGTH}..." - - # Format: [truncated text] \0 info \x1f [full original text] - # User sees truncated version, but pastes full version - printf '%s\0info\x1f%s\n' "$display_text" "$line" - else - # Text is short - can display as-is - # Still use info field for consistency in selection handling - printf '%s\0info\x1f%s\n' "$line" "$line" - fi - done - - else - #---------------------------------------------------------------------- - # CONTEXT 2: Handle User Selection - #---------------------------------------------------------------------- - # User selected an item. $ROFI_INFO contains the original content - # we stored in the info field during menu generation. - # - # We need to: - # 1. Check if selection is an image or text - # 2. For images: Copy the PNG file to clipboard - # 3. For text: Copy the text to clipboard - #---------------------------------------------------------------------- - - selection="$ROFI_INFO" - - #---------------------------------------------------------------------- - # IMAGE SELECTION HANDLING - #---------------------------------------------------------------------- - # Check if selected item is an image entry (starts with "image/png") - #---------------------------------------------------------------------- - if [[ "$selection" =~ ^image/png ]]; then - # This is an image! Extract hash and copy the actual PNG file - - # Parse hash from "image/png Zen [hash]" - hash=$(echo "$selection" | awk '{print $NF}') - - # Construct image file path - imgfile="$IMGDIR/${hash}.png" - - # Verify image file exists before copying - if [ -f "$imgfile" ]; then - # Copy the actual PNG file to clipboard as image data - # -selection clipboard: Use the standard clipboard (Ctrl+V) - # -t image/png: Set clipboard type to PNG image - # -i: Read from file - xclip -selection clipboard -t image/png -i "$imgfile" - - # Exit successfully - image is now in clipboard - exit 0 - else - # Image file not found - show error notification if dunstify available - if command -v dunstify &> /dev/null; then - dunstify -u critical "Clipboard Error" "Image file not found: $imgfile" - fi - # Exit with error code - exit 1 - fi - else - #------------------------------------------------------------------ - # TEXT SELECTION HANDLING - #------------------------------------------------------------------ - # This is regular text - copy to clipboard as text - #------------------------------------------------------------------ - - # Copy text directly to clipboard using xclip - # -selection clipboard: Use standard clipboard (Ctrl+V) - # -i: Read from stdin - # Using echo -n to avoid adding newline - echo -n "$selection" | xclip -selection clipboard - - # Exit successfully - text is now in clipboard - exit 0 - fi - fi -} - -#============================================================================== -# Export for rofi script mode -#============================================================================== -# Make function and variables available when rofi spawns this script -export -f clipboard_mode -export IMGDIR -export MAX_TEXT_LENGTH - -#============================================================================== -# MAIN SCRIPT ENTRY POINT -#============================================================================== -# Two execution modes based on ROFI_RETV environment variable: -# -# MODE 1: Direct execution (ROFI_RETV is unset/empty) -# - User ran this script from command line or keybind -# - Launch rofi with this script as the clipboard provider -# - Rofi will then call this script again in MODE 2 -# -# MODE 2: Called by rofi (ROFI_RETV is set) -# - Rofi is calling us to get menu items or handle selection -# - Call clipboard_mode() function to handle the request -#============================================================================== - -if [ -z "$ROFI_RETV" ]; then - #-------------------------------------------------------------------------- - # MODE 1: Launch rofi - #-------------------------------------------------------------------------- - - # Launch rofi with this script as the data source for "clipboard" mode - # - # Rofi parameters: - # -modi "clipboard:$0" - # Register "clipboard" mode that runs this script for data - # - # -show clipboard - # Display the clipboard mode immediately - # - # NO -run-command needed! - # The script handles clipboard copying internally for both text and images - # When user selects an item, rofi calls the script with ROFI_RETV=1 - # The script then copies to clipboard directly and exits - # - # -theme ... - # Custom theme file for visual styling - #-------------------------------------------------------------------------- - - rofi -modi "clipboard:$0" \ - -show clipboard \ - -theme ~/.config/rofi/clipboard.rasi - - # NOTE: All clipboard operations are handled inside clipboard_mode() - # when ROFI_RETV=1 (selection mode). No post-processing needed here. - -else - #-------------------------------------------------------------------------- - # MODE 2: Provide data to rofi or handle selection - #-------------------------------------------------------------------------- - - # Rofi is calling us - hand off to clipboard_mode function - clipboard_mode "$@" -fi - -#============================================================================== -# OLD/ALTERNATIVE APPROACHES (Commented out for reference) -#============================================================================== -# -# APPROACH 1: Using -run-command with xclip for text -# This was the old approach that didn't handle images properly: -# -# rofi -modi "clipboard:$0" \ -# -show clipboard \ -# -run-command 'echo -n {cmd} | xclip -selection clipboard' \ -# -theme ~/.config/rofi/clipboard.rasi -# -# PROBLEM: This pipes ALL selections (including "image/png Zen [hash]" text) -# to xclip as text, which doesn't restore the actual image to clipboard. -# -# SOLUTION: Handle image copying inside the script, before rofi's -run-command, -# by detecting image format and using xclip with -t image/png and the file. -# -#============================================================================== diff --git a/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_191045 b/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_191045 deleted file mode 100755 index b26ad74..0000000 --- a/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_191045 +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Ultra-Simple Clipboard Launcher -#============================================================================== -# Displays greenclip clipboard history in rofi -# When you select an item, it copies to clipboard -# No images, no complexity, just works. -#============================================================================== - -# Simple approach: pipe greenclip history to rofi, then to xclip -greenclip print | rofi -dmenu -i -p " " -theme ~/.config/rofi/clipboard.rasi | xclip -selection clipboard - -# How it works: -# 1. greenclip print - Get all clipboard history -# 2. rofi -dmenu -i -p "..." - Show in rofi, case-insensitive search -# 3. User selects item -# 4. xclip -selection clipboard - Copy selection to clipboard - -#============================================================================== -# OLD VERSION (commented out - was more complex) -#============================================================================== -# rofi -modi "clipboard:greenclip print" \ -# -show clipboard \ -# -run-command 'echo -n {cmd} | xclip -selection clipboard' \ -# -theme ~/.config/rofi/clipboard.rasi diff --git a/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_191729 b/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_191729 deleted file mode 100755 index f8bad9d..0000000 --- a/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_191729 +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Simple Clipboard Launcher with Image Support -#============================================================================== -# Displays greenclip clipboard history in rofi -# Handles both text and images -# Simple and clean - no unnecessary complexity -#============================================================================== - -# Directory where greenclip stores image files -IMGDIR="/tmp/greenclip" - -# Show clipboard history in rofi and capture selection -selection=$(greenclip print | rofi -dmenu -i -p " " -theme ~/.config/rofi/clipboard.rasi) - -# Exit if nothing selected (user pressed Escape) -[ -z "$selection" ] && exit 0 - -#============================================================================== -# Handle the selection - check if image or text -#============================================================================== - -if [[ "$selection" =~ ^image/png ]]; then - #-------------------------------------------------------------------------- - # IMAGE HANDLING - Simple approach - #-------------------------------------------------------------------------- - # Greenclip stores images as: "image/png Zen [hash]" - # Extract the hash and copy the actual PNG file - - # Extract hash (last word in the line) - hash=$(echo "$selection" | awk '{print $NF}') - - # Construct image file path - imgfile="$IMGDIR/${hash}.png" - - # Copy image file to clipboard if it exists - if [ -f "$imgfile" ]; then - xclip -selection clipboard -t image/png -i "$imgfile" - else - # Image file not found - show notification if dunstify available - if command -v dunstify &> /dev/null; then - dunstify -u normal "Clipboard" "Image file not found" - fi - fi -else - #-------------------------------------------------------------------------- - # TEXT HANDLING - Simple approach - #-------------------------------------------------------------------------- - # Just copy the text to clipboard - - echo -n "$selection" | xclip -selection clipboard -fi - -#============================================================================== -# OLD VERSIONS (commented out for reference) -#============================================================================== - -# VERSION 1: Ultra-simple (no image support) -# greenclip print | rofi -dmenu -i -p " " -theme ~/.config/rofi/clipboard.rasi | xclip -selection clipboard - -# VERSION 2: Using rofi modi (was more complex and buggy) -# rofi -modi "clipboard:greenclip print" \ -# -show clipboard \ -# -run-command 'echo -n {cmd} | xclip -selection clipboard' \ -# -theme ~/.config/rofi/clipboard.rasi diff --git a/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_192345 b/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_192345 deleted file mode 100755 index 7961bb6..0000000 --- a/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251128_192345 +++ /dev/null @@ -1,109 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Simple Clipboard Launcher with Image Thumbnails -#============================================================================== -# Shows clipboard history with image thumbnails -# Simple script mode implementation - easy to understand and debug -#============================================================================== - -# Directory where greenclip stores image files -IMGDIR="/tmp/greenclip" - -#------------------------------------------------------------------------------ -# clipboard_mode() - Handles rofi script mode -#------------------------------------------------------------------------------ -# Two modes: -# 1. ROFI_RETV=0: Show menu items (with thumbnails for images) -# 2. ROFI_RETV=1: Handle selection (copy to clipboard) -#------------------------------------------------------------------------------ -clipboard_mode() { - if [ "$ROFI_RETV" = "0" ]; then - #---------------------------------------------------------------------- - # Show clipboard entries - #---------------------------------------------------------------------- - greenclip print | while IFS= read -r line; do - - # Check if this is an image entry - if [[ "$line" =~ ^image/png ]]; then - # Extract hash from "image/png Zen [hash]" - hash=$(echo "$line" | awk '{print $NF}') - imgfile="$IMGDIR/${hash}.png" - - # Show with thumbnail if file exists - if [ -f "$imgfile" ]; then - # Format: display_text \0 icon \x1f thumbnail://path \0 info \x1f original_line - # Display: Keep original text simple - # Icon: Show thumbnail - # Info: Store original line for later - printf 'Image: %s\0icon\x1fthumbnail://%s\0info\x1f%s\n' \ - "$(basename "$imgfile")" \ - "$imgfile" \ - "$line" - else - # Image file missing - show without thumbnail - printf '%s\0info\x1f%s\n' "$line" "$line" - fi - else - # Regular text entry - show as-is - # Store in info field for consistent handling - printf '%s\0info\x1f%s\n' "$line" "$line" - fi - done - - else - #---------------------------------------------------------------------- - # Handle selection - copy to clipboard - #---------------------------------------------------------------------- - # $ROFI_INFO contains the original greenclip line - selection="$ROFI_INFO" - - if [[ "$selection" =~ ^image/png ]]; then - # Copy image file to clipboard - hash=$(echo "$selection" | awk '{print $NF}') - imgfile="$IMGDIR/${hash}.png" - - if [ -f "$imgfile" ]; then - xclip -selection clipboard -t image/png -i "$imgfile" - fi - else - # Copy text to clipboard - echo -n "$selection" | xclip -selection clipboard - fi - fi -} - -# Export function for rofi script mode -export -f clipboard_mode -export IMGDIR - -#------------------------------------------------------------------------------ -# Main entry point -#------------------------------------------------------------------------------ -if [ -z "$ROFI_RETV" ]; then - # User running script directly - launch rofi - rofi -modi "clipboard:$0" \ - -show clipboard \ - -theme ~/.config/rofi/clipboard.rasi -else - # Rofi calling script - handle request - clipboard_mode "$@" -fi - -#============================================================================== -# OLD VERSIONS (commented for reference) -#============================================================================== - -# VERSION 1: Simple dmenu without thumbnails (worked for selection) -# IMGDIR="/tmp/greenclip" -# selection=$(greenclip print | rofi -dmenu -i -p " " -theme ~/.config/rofi/clipboard.rasi) -# [ -z "$selection" ] && exit 0 -# if [[ "$selection" =~ ^image/png ]]; then -# hash=$(echo "$selection" | awk '{print $NF}') -# imgfile="$IMGDIR/${hash}.png" -# [ -f "$imgfile" ] && xclip -selection clipboard -t image/png -i "$imgfile" -# else -# echo -n "$selection" | xclip -selection clipboard -# fi - -# VERSION 2: Complex version with lots of features (was buggy) -# [See clipboard-launcher-enhanced.sh for reference] diff --git a/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251203_222516 b/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251203_222516 deleted file mode 100755 index 3331159..0000000 --- a/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251203_222516 +++ /dev/null @@ -1,58 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Ultra-Simple Text-Only Clipboard Launcher -#============================================================================== -# NO images, NO thumbnails, NO script mode - just text clipboard -# This is the absolute simplest version that should never crash -#============================================================================== - -# Simple one-liner: show greenclip history, copy selection to clipboard -greenclip print | rofi -dmenu -i -p " " -theme ~/.config/rofi/clipboard.rasi | xclip -selection clipboard - -#============================================================================== -# OLD COMPLEX VERSIONS (commented out - they caused crashes) -#============================================================================== - -# VERSION WITH SCRIPT MODE (was crashing): -# IMGDIR="/tmp/greenclip" -# -# clipboard_mode() { -# if [ "$ROFI_RETV" = "0" ]; then -# greenclip print | while IFS= read -r line; do -# if [[ "$line" =~ ^image/png ]]; then -# hash=$(echo "$line" | awk '{print $NF}') -# imgfile="$IMGDIR/${hash}.png" -# if [ -f "$imgfile" ]; then -# printf '[IMAGE] %s\0info\x1f%s\n' "$(basename "$imgfile")" "$line" -# fi -# else -# printf '%s\0info\x1f%s\n' "$line" "$line" -# fi -# done -# else -# selection="$ROFI_INFO" -# [ -z "$selection" ] && exit 0 -# if [[ "$selection" =~ ^image/png ]]; then -# hash=$(echo "$selection" | awk '{print $NF}') -# imgfile="$IMGDIR/${hash}.png" -# if [ -f "$imgfile" ] && [ -r "$imgfile" ]; then -# xclip -selection clipboard -t image/png -i "$imgfile" 2>/dev/null -# fi -# else -# echo -n "$selection" | xclip -selection clipboard 2>/dev/null -# fi -# exit 0 -# fi -# } -# -# export -f clipboard_mode -# export IMGDIR -# -# if [ -z "$ROFI_RETV" ]; then -# rofi -modi "clipboard:$0" -show clipboard -theme ~/.config/rofi/clipboard.rasi -# else -# clipboard_mode "$@" -# fi - -# VERSION WITH THUMBNAILS (crashed even more): -# [See backup files for reference] diff --git a/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251203_222912 b/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251203_222912 deleted file mode 100755 index 1084295..0000000 --- a/rofi/.config/rofi/.bak/clipboard-launcher.sh.20251203_222912 +++ /dev/null @@ -1,59 +0,0 @@ -#!/usr/bin/env bash -#============================================================================== -# Ultra-Simple Text-Only Clipboard Launcher -#============================================================================== -# NO images, NO thumbnails, NO script mode - just text clipboard -# This is the absolute simplest version that should never crash -#============================================================================== - -# Simple one-liner: show greenclip history, copy selection to clipboard -# -p " " sets the prompt with clipboard icon -greenclip print | rofi -dmenu -i -p " " -theme ~/.config/rofi/clipboard.rasi | xclip -selection clipboard - -#============================================================================== -# OLD COMPLEX VERSIONS (commented out - they caused crashes) -#============================================================================== - -# VERSION WITH SCRIPT MODE (was crashing): -# IMGDIR="/tmp/greenclip" -# -# clipboard_mode() { -# if [ "$ROFI_RETV" = "0" ]; then -# greenclip print | while IFS= read -r line; do -# if [[ "$line" =~ ^image/png ]]; then -# hash=$(echo "$line" | awk '{print $NF}') -# imgfile="$IMGDIR/${hash}.png" -# if [ -f "$imgfile" ]; then -# printf '[IMAGE] %s\0info\x1f%s\n' "$(basename "$imgfile")" "$line" -# fi -# else -# printf '%s\0info\x1f%s\n' "$line" "$line" -# fi -# done -# else -# selection="$ROFI_INFO" -# [ -z "$selection" ] && exit 0 -# if [[ "$selection" =~ ^image/png ]]; then -# hash=$(echo "$selection" | awk '{print $NF}') -# imgfile="$IMGDIR/${hash}.png" -# if [ -f "$imgfile" ] && [ -r "$imgfile" ]; then -# xclip -selection clipboard -t image/png -i "$imgfile" 2>/dev/null -# fi -# else -# echo -n "$selection" | xclip -selection clipboard 2>/dev/null -# fi -# exit 0 -# fi -# } -# -# export -f clipboard_mode -# export IMGDIR -# -# if [ -z "$ROFI_RETV" ]; then -# rofi -modi "clipboard:$0" -show clipboard -theme ~/.config/rofi/clipboard.rasi -# else -# clipboard_mode "$@" -# fi - -# VERSION WITH THUMBNAILS (crashed even more): -# [See backup files for reference] diff --git a/rofi/.config/rofi/.bak/clipboard.rasi.20251128_191045 b/rofi/.config/rofi/.bak/clipboard.rasi.20251128_191045 deleted file mode 100644 index fc9ae01..0000000 --- a/rofi/.config/rofi/.bak/clipboard.rasi.20251128_191045 +++ /dev/null @@ -1,187 +0,0 @@ -/******************************************************* - * CLIPBOARD MANAGER - Simple & Compact - *******************************************************/ -/* - * Ultra-compact theme for text-only clipboard - * - Small font (8pt) - * - Minimal padding - * - No images - * - Shows more entries - */ - -configuration { - font: "Noto Sans Regular 10"; /* Smaller font */ - show-icons: false; /* No icons for compact view */ - display-clipboard: " "; - disable-history: false; - sidebar-mode: false; - kb-cancel: "Super+c,Escape"; -} - -/* Import base theme */ -@import "~/.config/rofi/config.rasi" - -/* Window - compact with minimal padding */ -window { - background-color: @background; - border: 0; - padding: 10; /* Minimal padding (was 30) */ - width: 50%; -} - -mainbox { - border: 0; - padding: 0; -} - -/* List view - show more entries, minimal spacing */ -listview { - lines: 12; /* Show more entries (was 8) */ - columns: 1; - fixed-height: 0; - border: 4px 0px 0px; /* Thinner border (was 8px) */ - border-color: @separatorcolor; - scrollbar: true; - padding: 0; /* No padding */ - spacing: 1px; /* Minimal spacing (was 2px) */ -} - -/* Element - minimal vertical padding */ -element { - border: 0; - padding: 1px 4px; /* Very compact: 1px vertical, 4px horizontal */ -} - -/* No icons, but keep config for compatibility */ -/* element-icon { */ -/* size: 0em; */ -/* padding: 0; */ -/* } */ - -element-text { - background-color: inherit; - text-color: inherit; - vertical-align: 0.5; -} - -/* Element states */ -element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} - -element.selected.normal { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -element.alternate.normal { - background-color: @alternate-normal-background; - text-color: @alternate-normal-foreground; -} - -element.normal.urgent { - background-color: @urgent-background; - text-color: @urgent-foreground; -} - -element.selected.urgent { - background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; -} - -element.alternate.urgent { - background-color: @alternate-urgent-background; - text-color: @alternate-urgent-foreground; -} - -element.normal.active { - background-color: @active-background; - text-color: @active-foreground; -} - -element.selected.active { - background-color: @selected-active-background; - text-color: @selected-active-foreground; -} - -element.alternate.active { - background-color: @alternate-active-background; - text-color: @alternate-active-foreground; -} - -/* Thin scrollbar */ -scrollbar { - width: 3px; /* Thinner (was 4px) */ - border: 0; - handle-color: @normal-foreground; - handle-width: 6px; - padding: 0; -} - -/* Input bar - minimal padding */ -inputbar { - spacing: 0; - text-color: @normal-foreground; - padding: 0; /* No padding (was 1px) */ - children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; -} - -prompt { - spacing: 0; - text-color: @normal-foreground; -} - -textbox-prompt-colon { - expand: false; - str: ""; - margin: 0px 0.3em 0em 0em; - text-color: @normal-foreground; -} - -entry { - spacing: 0; - text-color: @normal-foreground; -} - -case-indicator { - spacing: 0; - text-color: @normal-foreground; -} - -message { - border: 2px 0px 0px; - border-color: @separatorcolor; - padding: 1px; -} - -textbox { - text-color: @foreground; -} - -mode-switcher { - border: 2px 0px 0px; - border-color: @separatorcolor; -} - -button { - spacing: 0; - text-color: @normal-foreground; -} - -button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -/*------------------------------------------------------- - * OLD CONFIGURATION (commented out for reference) - *------------------------------------------------------- - * Previous version had: - * - Font: 10pt (now 8pt) - * - Window padding: 30px (now 10px) - * - List lines: 8 (now 12) - * - Element padding: 2px (now 1px vertical) - * - Spacing: 2px (now 1px) - * - Icons enabled (now disabled) - */ diff --git a/rofi/.config/rofi/.bak/clipboard.rasi.20251128_191729 b/rofi/.config/rofi/.bak/clipboard.rasi.20251128_191729 deleted file mode 100644 index 347d825..0000000 --- a/rofi/.config/rofi/.bak/clipboard.rasi.20251128_191729 +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************* - * CLIPBOARD MANAGER - With Images - *******************************************************/ -/* - * Clipboard theme with nice padding and image support - * - Normal font (10pt) - * - Comfortable padding (like rofidmenu) - * - Icons and images enabled - * - Clean and simple - */ - -configuration { - font: "Noto Sans Regular 10"; - show-icons: true; /* Enable icons for images */ - icon-theme: "Qogir"; - display-clipboard: " "; /* Clipboard icon restored */ - disable-history: false; - sidebar-mode: false; - kb-cancel: "Super+c,Escape"; -} - -/* Import base theme */ -@import "~/.config/rofi/config.rasi" - -/* Window - comfortable padding like rofidmenu */ -window { - background-color: @background; - border: 0; - padding: 30; /* Nice padding like rofidmenu */ - width: 50%; -} - -mainbox { - border: 0; - padding: 0; -} - -/* List view - balanced spacing */ -listview { - lines: 10; /* Show 10 entries */ - columns: 1; - fixed-height: 0; - border: 8px 0px 0px; /* Like rofidmenu */ - border-color: @separatorcolor; - scrollbar: true; - padding: 2px 0px 0px; - spacing: 4px; /* Comfortable spacing */ -} - -/* Element - comfortable padding */ -element { - border: 0; - padding: 3px; /* Comfortable padding */ -} - -/* Icon configuration for images */ -element-icon { - size: 2em; /* Good size for image thumbnails */ - padding: 0 6px 0 0; /* Space between icon and text */ -} - -element-text { - background-color: inherit; - text-color: inherit; - vertical-align: 0.5; -} - -/* Element states */ -element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} - -element.selected.normal { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -element.alternate.normal { - background-color: @alternate-normal-background; - text-color: @alternate-normal-foreground; -} - -element.normal.urgent { - background-color: @urgent-background; - text-color: @urgent-foreground; -} - -element.selected.urgent { - background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; -} - -element.alternate.urgent { - background-color: @alternate-urgent-background; - text-color: @alternate-urgent-foreground; -} - -element.normal.active { - background-color: @active-background; - text-color: @active-foreground; -} - -element.selected.active { - background-color: @selected-active-background; - text-color: @selected-active-foreground; -} - -element.alternate.active { - background-color: @alternate-active-background; - text-color: @alternate-active-foreground; -} - -/* Scrollbar */ -scrollbar { - width: 4px; /* Like rofidmenu */ - border: 0; - handle-color: @normal-foreground; - handle-width: 8px; - padding: 0; -} - -/* Input bar */ -inputbar { - spacing: 0; - text-color: @normal-foreground; - padding: 1px; - children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; -} - -prompt { - spacing: 0; - text-color: @normal-foreground; -} - -textbox-prompt-colon { - expand: false; - str: ""; - margin: 0px 0.3em 0em 0em; - text-color: @normal-foreground; -} - -entry { - spacing: 0; - text-color: @normal-foreground; -} - -case-indicator { - spacing: 0; - text-color: @normal-foreground; -} - -message { - border: 2px 0px 0px; - border-color: @separatorcolor; - padding: 1px; -} - -textbox { - text-color: @foreground; -} - -mode-switcher { - border: 2px 0px 0px; - border-color: @separatorcolor; -} - -button { - spacing: 0; - text-color: @normal-foreground; -} - -button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -/*------------------------------------------------------- - * PREVIOUS CONFIGURATIONS (commented for reference) - *------------------------------------------------------- - * - * Ultra-compact version had: - * - Font: 8pt - * - Window padding: 10px - * - List lines: 12 - * - Element padding: 1px vertical - * - Spacing: 1px - * - Icons: disabled - * - * Current comfortable version: - * - Font: 10pt - * - Window padding: 30px (like rofidmenu) - * - List lines: 10 - * - Element padding: 3px - * - Spacing: 4px - * - Icons: enabled for images - */ diff --git a/rofi/.config/rofi/.bak/clipboard.rasi.20251128_192345 b/rofi/.config/rofi/.bak/clipboard.rasi.20251128_192345 deleted file mode 100644 index 347d825..0000000 --- a/rofi/.config/rofi/.bak/clipboard.rasi.20251128_192345 +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************* - * CLIPBOARD MANAGER - With Images - *******************************************************/ -/* - * Clipboard theme with nice padding and image support - * - Normal font (10pt) - * - Comfortable padding (like rofidmenu) - * - Icons and images enabled - * - Clean and simple - */ - -configuration { - font: "Noto Sans Regular 10"; - show-icons: true; /* Enable icons for images */ - icon-theme: "Qogir"; - display-clipboard: " "; /* Clipboard icon restored */ - disable-history: false; - sidebar-mode: false; - kb-cancel: "Super+c,Escape"; -} - -/* Import base theme */ -@import "~/.config/rofi/config.rasi" - -/* Window - comfortable padding like rofidmenu */ -window { - background-color: @background; - border: 0; - padding: 30; /* Nice padding like rofidmenu */ - width: 50%; -} - -mainbox { - border: 0; - padding: 0; -} - -/* List view - balanced spacing */ -listview { - lines: 10; /* Show 10 entries */ - columns: 1; - fixed-height: 0; - border: 8px 0px 0px; /* Like rofidmenu */ - border-color: @separatorcolor; - scrollbar: true; - padding: 2px 0px 0px; - spacing: 4px; /* Comfortable spacing */ -} - -/* Element - comfortable padding */ -element { - border: 0; - padding: 3px; /* Comfortable padding */ -} - -/* Icon configuration for images */ -element-icon { - size: 2em; /* Good size for image thumbnails */ - padding: 0 6px 0 0; /* Space between icon and text */ -} - -element-text { - background-color: inherit; - text-color: inherit; - vertical-align: 0.5; -} - -/* Element states */ -element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} - -element.selected.normal { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -element.alternate.normal { - background-color: @alternate-normal-background; - text-color: @alternate-normal-foreground; -} - -element.normal.urgent { - background-color: @urgent-background; - text-color: @urgent-foreground; -} - -element.selected.urgent { - background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; -} - -element.alternate.urgent { - background-color: @alternate-urgent-background; - text-color: @alternate-urgent-foreground; -} - -element.normal.active { - background-color: @active-background; - text-color: @active-foreground; -} - -element.selected.active { - background-color: @selected-active-background; - text-color: @selected-active-foreground; -} - -element.alternate.active { - background-color: @alternate-active-background; - text-color: @alternate-active-foreground; -} - -/* Scrollbar */ -scrollbar { - width: 4px; /* Like rofidmenu */ - border: 0; - handle-color: @normal-foreground; - handle-width: 8px; - padding: 0; -} - -/* Input bar */ -inputbar { - spacing: 0; - text-color: @normal-foreground; - padding: 1px; - children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; -} - -prompt { - spacing: 0; - text-color: @normal-foreground; -} - -textbox-prompt-colon { - expand: false; - str: ""; - margin: 0px 0.3em 0em 0em; - text-color: @normal-foreground; -} - -entry { - spacing: 0; - text-color: @normal-foreground; -} - -case-indicator { - spacing: 0; - text-color: @normal-foreground; -} - -message { - border: 2px 0px 0px; - border-color: @separatorcolor; - padding: 1px; -} - -textbox { - text-color: @foreground; -} - -mode-switcher { - border: 2px 0px 0px; - border-color: @separatorcolor; -} - -button { - spacing: 0; - text-color: @normal-foreground; -} - -button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -/*------------------------------------------------------- - * PREVIOUS CONFIGURATIONS (commented for reference) - *------------------------------------------------------- - * - * Ultra-compact version had: - * - Font: 8pt - * - Window padding: 10px - * - List lines: 12 - * - Element padding: 1px vertical - * - Spacing: 1px - * - Icons: disabled - * - * Current comfortable version: - * - Font: 10pt - * - Window padding: 30px (like rofidmenu) - * - List lines: 10 - * - Element padding: 3px - * - Spacing: 4px - * - Icons: enabled for images - */ diff --git a/rofi/.config/rofi/.bak/clipboard.rasi.20251203_222142 b/rofi/.config/rofi/.bak/clipboard.rasi.20251203_222142 deleted file mode 100644 index d9490af..0000000 --- a/rofi/.config/rofi/.bak/clipboard.rasi.20251203_222142 +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************* - * CLIPBOARD MANAGER - With Images - *******************************************************/ -/* - * Clipboard theme with nice padding and image support - * - Normal font (10pt) - * - Comfortable padding (like rofidmenu) - * - Icons and images enabled - * - Clean and simple - */ - -configuration { - font: "Noto Sans Regular 10"; - show-icons: true; /* Enable icons for images */ - icon-theme: "Qogir"; - display-clipboard: " "; /* Clipboard icon restored */ - disable-history: false; - sidebar-mode: false; - kb-cancel: "Super+c,Escape"; -} - -/* Import base theme */ -@import "~/.config/rofi/config.rasi" - -/* Window - comfortable padding like rofidmenu */ -window { - background-color: @background; - border: 0; - padding: 30; /* Nice padding like rofidmenu */ - width: 50%; -} - -mainbox { - border: 0; - padding: 0; -} - -/* List view - compact vertical spacing */ -listview { - lines: 10; /* Show 10 entries */ - columns: 1; - fixed-height: 0; - border: 8px 0px 0px; /* Like rofidmenu */ - border-color: @separatorcolor; - scrollbar: true; - padding: 2px 0px 0px; - spacing: 2px; /* Reduced: was 4px, now 2px */ -} - -/* Element - minimal height (no vertical padding) */ -element { - border: 0; - padding: 0px 3px; /* No vertical padding: 0px top/bottom, 3px left/right */ -} - -/* Icon configuration for images */ -element-icon { - size: 2em; /* Good size for image thumbnails */ - padding: 0 6px 0 0; /* Space between icon and text */ -} - -element-text { - background-color: inherit; - text-color: inherit; - vertical-align: 0.5; -} - -/* Element states */ -element.normal.normal { - background-color: @normal-background; - text-color: @normal-foreground; -} - -element.selected.normal { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -element.alternate.normal { - background-color: @alternate-normal-background; - text-color: @alternate-normal-foreground; -} - -element.normal.urgent { - background-color: @urgent-background; - text-color: @urgent-foreground; -} - -element.selected.urgent { - background-color: @selected-urgent-background; - text-color: @selected-urgent-foreground; -} - -element.alternate.urgent { - background-color: @alternate-urgent-background; - text-color: @alternate-urgent-foreground; -} - -element.normal.active { - background-color: @active-background; - text-color: @active-foreground; -} - -element.selected.active { - background-color: @selected-active-background; - text-color: @selected-active-foreground; -} - -element.alternate.active { - background-color: @alternate-active-background; - text-color: @alternate-active-foreground; -} - -/* Scrollbar */ -scrollbar { - width: 4px; /* Like rofidmenu */ - border: 0; - handle-color: @normal-foreground; - handle-width: 8px; - padding: 0; -} - -/* Input bar */ -inputbar { - spacing: 0; - text-color: @normal-foreground; - padding: 1px; - children: [ prompt,textbox-prompt-colon,entry,case-indicator ]; -} - -prompt { - spacing: 0; - text-color: @normal-foreground; -} - -textbox-prompt-colon { - expand: false; - str: ""; - margin: 0px 0.3em 0em 0em; - text-color: @normal-foreground; -} - -entry { - spacing: 0; - text-color: @normal-foreground; -} - -case-indicator { - spacing: 0; - text-color: @normal-foreground; -} - -message { - border: 2px 0px 0px; - border-color: @separatorcolor; - padding: 1px; -} - -textbox { - text-color: @foreground; -} - -mode-switcher { - border: 2px 0px 0px; - border-color: @separatorcolor; -} - -button { - spacing: 0; - text-color: @normal-foreground; -} - -button.selected { - background-color: @selected-normal-background; - text-color: @selected-normal-foreground; -} - -/*------------------------------------------------------- - * PREVIOUS CONFIGURATIONS (commented for reference) - *------------------------------------------------------- - * - * Ultra-compact version had: - * - Font: 8pt - * - Window padding: 10px - * - List lines: 12 - * - Element padding: 1px vertical - * - Spacing: 1px - * - Icons: disabled - * - * Comfortable version had: - * - Element padding: 3px all sides - * - Spacing: 4px - * - * Current version (compact vertical): - * - Font: 10pt - * - Window padding: 30px (like rofidmenu) - * - List lines: 10 - * - Element padding: 1px vertical, 3px horizontal - * - Spacing: 2px (smaller vertical gaps) - * - Icons: enabled for images - */ diff --git a/rofi/.config/rofi/clipboard.rasi b/rofi/.config/rofi/clipboard.rasi index 4dbb08f..bc22851 100644 --- a/rofi/.config/rofi/clipboard.rasi +++ b/rofi/.config/rofi/clipboard.rasi @@ -56,15 +56,20 @@ element { /* Icon configuration for images */ element-icon { + background-color: inherit; size: 2em; /* Good size for image thumbnails */ padding: 0 6px 0 0; /* Space between icon and text */ } element-text { background-color: inherit; + highlight: bold underline; text-color: inherit; vertical-align: 0.5; } +element-text selected { + text-transform: none; +} /* Element states */ element.normal.normal { diff --git a/rofi/.config/rofi/rofidmenu.rasi b/rofi/.config/rofi/rofidmenu.rasi index 986e0df..7a9ccf4 100644 --- a/rofi/.config/rofi/rofidmenu.rasi +++ b/rofi/.config/rofi/rofidmenu.rasi @@ -57,8 +57,12 @@ element { } element-text { background-color: inherit; + highlight: bold underline; text-color: inherit; } +element-text selected { + text-transform: none; +} element.normal.normal { background-color: @normal-background; text-color: @normal-foreground; diff --git a/rofi/.config/rofi/theal.rasi b/rofi/.config/rofi/theal.rasi index a4a852e..c853d1d 100644 --- a/rofi/.config/rofi/theal.rasi +++ b/rofi/.config/rofi/theal.rasi @@ -4,34 +4,34 @@ *******************************************************/ * { - selected-normal-foreground: rgba(0, 255, 180, 100%); /* More cyanish light spring green */ + selected-normal-foreground: rgba(255, 198, 0, 100%); /* Amber */ foreground: rgba(138, 255, 255, 100%); /* #8affff */ normal-foreground: @foreground; alternate-normal-background: rgba(45, 48, 59, 1%); red: rgba(220, 50, 47, 100%); - selected-urgent-foreground: rgba(0, 255, 180, 100%); /* More cyanish light spring green */ + selected-urgent-foreground: rgba(255, 198, 0, 100%); /* Amber */ blue: rgba(38, 139, 210, 100%); urgent-foreground: rgba(204, 102, 102, 100%); alternate-urgent-background: rgba(75, 81, 96, 90%); active-foreground: rgba(101, 172, 255, 100%); lightbg: rgba(238, 232, 213, 100%); - selected-active-foreground: rgba(0, 255, 180, 100%); /* More cyanish light spring green */ + selected-active-foreground: rgba(255, 198, 0, 100%); /* Amber */ alternate-active-background: rgba(45, 48, 59, 88%); background: rgba(0, 54, 54, 60%); /* #003636 */ alternate-normal-foreground: @foreground; normal-background: rgba(45, 48, 59, 1%); lightfg: rgba(88, 104, 117, 100%); - selected-normal-background: rgba(0, 42, 42, 80%); /* Darker teal */ + selected-normal-background: rgba(17, 43, 43, 30%); /* #112b2b at 30% */ border-color: rgba(124, 131, 137, 100%); spacing: 2; separatorcolor: rgba(45, 48, 59, 1%); urgent-background: rgba(45, 48, 59, 15%); - selected-urgent-background: rgba(0, 42, 42, 80%); /* Darker teal */ + selected-urgent-background: rgba(17, 43, 43, 30%); /* #112b2b at 30% */ alternate-urgent-foreground: @urgent-foreground; background-color: rgba(0, 0, 0, 0%); alternate-active-foreground: @active-foreground; active-background: rgba(29, 31, 33, 17%); - selected-active-background: rgba(0, 42, 42, 80%); /* Darker teal */ + selected-active-background: rgba(17, 43, 43, 30%); /* #112b2b at 30% */ } @@ -68,6 +68,12 @@ element-text { background-color: inherit; text-color: inherit; } +element-icon { + background-color: inherit; +} +element-text selected { + text-transform: bold; +} element.normal.normal { background-color: @normal-background; text-color: @normal-foreground; -- cgit v1.2.3