|
| 1 | +# Clipboard Widget for YASB |
| 2 | + |
| 3 | +A lightweight clipboard manager for YASB that integrates directly with the native Windows Clipboard History (Win + V). This widget provides real-time access to your system's clip buffer without the need for heavy local storage or complex background monitoring. |
| 4 | + |
| 5 | +## Features |
| 6 | +- **Native Windows Sync**: Syncs in real-time with your official Windows Clipboard History. |
| 7 | +- **Search**: Built-in real-time search bar to filter through your text-based history. |
| 8 | +- **History**: View your Clipboard history and delete a single history item or your entire history. |
| 9 | +- **Image Support**: Full support for re-copying images directly from the history list. |
| 10 | +- **Long text preview**: Hover over a copied long piece of text to display text preview (configurable). |
| 11 | +- **Image list info**: Show image dimensions, size, and date in the history list (configurable). |
| 12 | +- **Feedback**: Visual feedback when content is copied. |
| 13 | +- **Customizable tooltips**: Enable/disable tooltips and adjust delay. |
| 14 | + |
| 15 | +## Options |
| 16 | + |
| 17 | +| Option | Type | Default | Description | |
| 18 | +| :--- | :--- | :--- | :--- | |
| 19 | +| `type` | `string` | `yasb.clipboard.ClipboardWidget` | The widget class identifier. | |
| 20 | +| `label` | `string` | `<span>\udb80\udd4d</span>` | Primary label format. | |
| 21 | +| `label_alt` | `string` | `CLIPBOARD` | Alternative label format (swapped on right-click). | |
| 22 | +| `max_history` | `integer` | `50` | Maximum number of history items to fetch from Windows. | |
| 23 | +| `class_name` | `string` | `""` | Additional CSS class for the widget container. | |
| 24 | +| `copied_feedback` | `string` | `\uf00c` | Feedback message when copying. | |
| 25 | +| `menu` | `dict` | (See Schema) | Configuration for the popup menu. | |
| 26 | +| `icons` | `dict` | (See Schema) | Custom icons for clipboard actions. | |
| 27 | +| `animation` | `dict` | (See Schema) | Animation configuration for label toggling. | |
| 28 | +| `label_shadow` | `dict` | (See Schema) | Shadow configuration for the label. | |
| 29 | +| `container_shadow` | `dict` | (See Schema) | Shadow configuration for the widget container. | |
| 30 | + |
| 31 | +## Icons Configuration Defaults |
| 32 | + |
| 33 | +| Key | Default | Description | |
| 34 | +| :--- | :--- | :--- | |
| 35 | +| `clear_icon` | `\uf1f8` | Clear all history icon. | |
| 36 | +| `delete_icon` | `\uf1f8` | Delete item icon. | |
| 37 | + |
| 38 | +## Menu Configuration Defaults |
| 39 | + |
| 40 | +| Key | Default | Description | |
| 41 | +| :--- | :--- | :--- | |
| 42 | +| `blur` | `true` | Enable blur effect on popup. | |
| 43 | +| `round_corners` | `true` | Enable rounded corners on popup. | |
| 44 | +| `round_corners_type` | `"normal"` | Corner radius style (`"normal"` or `"small"`). | |
| 45 | +| `border_color` | `"System"` | Border color for the popup. | |
| 46 | +| `alignment` | `"right"` | Horizontal alignment relative to widget (`"left"`, `"right"`, `"center"`). | |
| 47 | +| `direction` | `"down"` | Vertical direction for popup (`"up"` or `"down"`). | |
| 48 | +| `offset_top` | `6` | Top offset in pixels. | |
| 49 | +| `offset_left` | `0` | Left offset in pixels. | |
| 50 | +| `max_item_length` | `50` | Max characters to display for text items (10-200). | |
| 51 | +| `tooltip_enabled` | `true` | Enable custom tooltips for history items. | |
| 52 | +| `tooltip_delay` | `400` | Delay in milliseconds before showing tooltip (0-2000). | |
| 53 | +| `show_image_thumbnail` | `true` | Show image thumbnail in history list. If false, shows `image_replacement_text` instead. | |
| 54 | +| `image_replacement_text` | `"[Image]"` | Text to display for image items in history list when `show_image_thumbnail` is false. | |
| 55 | +| `show_image_list_info` | `true` | Show image dimensions, date, and size below the image in the history list. | |
| 56 | + |
| 57 | +## Callbacks |
| 58 | + |
| 59 | +| Function | Description | |
| 60 | +| :--- | :--- | |
| 61 | +| `toggle_menu` | Opens/closes the clipboard history popup (Scheduled asynchronously). | |
| 62 | +| `toggle_label` | Switches display between `label` and `label_alt` on the bar. | |
| 63 | + |
| 64 | +--- |
| 65 | + |
| 66 | + |
| 67 | +## Configuration Example |
| 68 | + |
| 69 | +```yaml |
| 70 | + |
| 71 | + clipboard: |
| 72 | + type: "yasb.clipboard.ClipboardWidget" |
| 73 | + options: |
| 74 | + label: "<span>\uf0ea</span>" |
| 75 | + label_alt: "<span>CLIPBOARD</span>" |
| 76 | + icons: |
| 77 | + delete_icon: "\uf1f8" |
| 78 | + clear_icon: "\uf1f8" |
| 79 | + copied_feedback: "\uf00c" |
| 80 | + menu: |
| 81 | + blur: true |
| 82 | + round_corners: true |
| 83 | + alignment: "right" |
| 84 | + direction: "down" |
| 85 | + tooltip_enabled: true |
| 86 | + tooltip_delay: 400 |
| 87 | + show_image_thumbnail: true |
| 88 | + image_replacement_text: "[IMAGE]" |
| 89 | + show_image_list_info: true |
| 90 | + callbacks: |
| 91 | + on_left: "toggle_menu" |
| 92 | + on_right: "toggle_label" |
| 93 | +``` |
| 94 | +
|
| 95 | +## Styling |
| 96 | +
|
| 97 | +### Example CSS |
| 98 | +
|
| 99 | +```css |
| 100 | +/* Widget on the bar */ |
| 101 | +.clipboard-widget { |
| 102 | + font-family: "JetBrainsMono Nerd Font", "Segoe UI Variable"; |
| 103 | +} |
| 104 | + |
| 105 | +.clipboard-widget .label { |
| 106 | +} |
| 107 | + |
| 108 | +/* Main Popup Container */ |
| 109 | +.clipboard-menu { |
| 110 | + background-color: #1e1e2e; |
| 111 | + border: 1px solid #11111b; |
| 112 | + border-radius: 10px; |
| 113 | + padding: 8px; |
| 114 | +} |
| 115 | + |
| 116 | +/* Search Bar */ |
| 117 | +.clipboard-menu .search-input { |
| 118 | + background-color: rgba(255, 255, 255, 0.05); |
| 119 | + border: 1px solid rgba(255, 255, 255, 0.1); |
| 120 | + border-radius: 6px; |
| 121 | + padding: 6px 10px; |
| 122 | + margin-bottom: 6px; |
| 123 | + color: #cdd6f4; |
| 124 | + font-size: 13px; |
| 125 | +} |
| 126 | + |
| 127 | +.clipboard-menu .search-input:focus { |
| 128 | + border: 1px solid #89b4fa; |
| 129 | +} |
| 130 | + |
| 131 | +/* Global Clear Button */ |
| 132 | +.clipboard-menu .clear-button { |
| 133 | + background-color: #cb3b42; |
| 134 | + border-radius: 6px; |
| 135 | + padding: 5px; |
| 136 | + margin-bottom: 8px; |
| 137 | + font-weight: bold; |
| 138 | + font-size: 11px; |
| 139 | +} |
| 140 | + |
| 141 | +.clipboard-menu .clear-button:hover { |
| 142 | + background-color: #cc6a6f; |
| 143 | +} |
| 144 | + |
| 145 | +/* Clipboard Items */ |
| 146 | +.clipboard-menu .clipboard-item { |
| 147 | + background-color: rgba(255, 255, 255, 0.03); |
| 148 | + border-radius: 10%; |
| 149 | + margin-bottom: 4px; |
| 150 | + font-size: 12px; |
| 151 | +} |
| 152 | + |
| 153 | +.clipboard-menu .clipboard-item:hover { |
| 154 | + background-color: rgba(255, 255, 255, 0.08); |
| 155 | + border: 1px solid #11111b; |
| 156 | +} |
| 157 | + |
| 158 | +/* Image Item */ |
| 159 | +.clipboard-menu .image-item { |
| 160 | + /* Styles for image items in the list */ |
| 161 | +} |
| 162 | + |
| 163 | +/* Image List Info (shown below image in list) */ |
| 164 | +.clipboard-menu .image-list-info { |
| 165 | + font-size: 10px; |
| 166 | + color: #ffffff; |
| 167 | + padding-left: 4px; |
| 168 | +} |
| 169 | + |
| 170 | +/* Scroll Area */ |
| 171 | +.clipboard-menu .scroll-area { |
| 172 | + background: transparent; |
| 173 | +} |
| 174 | + |
| 175 | +/* Delete Button */ |
| 176 | +.clipboard-menu .delete-button { |
| 177 | + background: #cb3b42; |
| 178 | +} |
| 179 | +.clipboard-menu .delete-button:hover { |
| 180 | + background-color: #cc6a6f; |
| 181 | +} |
| 182 | +``` |
0 commit comments