Merge pull request #273 from PasteBar/double-click-tray-icon-open-app

Enable customizable tray icon behavior on Windows
This commit is contained in:
Sergey 2025-06-21 14:49:37 -04:00 committed by GitHub
commit b34ace03b7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
17 changed files with 400 additions and 43 deletions

View File

@ -0,0 +1,5 @@
---
'pastebar-app-ui': patch
---
Added: customizable tray icon behavior on Windows as user settings

View File

@ -228,6 +228,12 @@ function App() {
settings.isKeepPinnedOnClearEnabled?.valueBool ?? false,
isKeepStarredOnClearEnabled:
settings.isKeepStarredOnClearEnabled?.valueBool ?? false,
isDoubleClickTrayToOpenEnabledOnWindows:
settings.isDoubleClickTrayToOpenEnabledOnWindows?.valueBool ?? false,
isLeftClickTrayDisabledOnWindows:
settings.isLeftClickTrayDisabledOnWindows?.valueBool ?? false,
isLeftClickTrayToOpenEnabledOnWindows:
settings.isLeftClickTrayToOpenEnabledOnWindows?.valueBool ?? false,
globalTemplatesEnabled: settings.globalTemplatesEnabled?.valueBool ?? true, // Default to true
globalTemplates: settings.globalTemplates?.valueText
? settings.globalTemplates.valueText // Will be parsed by initSettings in store

View File

@ -48,16 +48,16 @@ Enable single-click to copy/paste clipboard history items and saved clips instea
Single Click Copy/Paste action: Einfachklick Kopieren/Einfügen-Aktion
Single Click Copy/Paste: Einfachklick Kopieren/Einfügen
Quick Paste Window Options: Schnelleinfügen-Fenster-Optionen
Configure the behavior of the Quick Paste window when selecting items: Verhalten des Schnelleinfügen-Fensters beim Auswählen von Elementen konfigurieren
Copy items only (no auto-paste): Nur Elemente kopieren (kein automatisches Einfügen)
Auto-close window after action: Fenster nach Aktion automatisch schließen
When enabled, the Quick Paste window will automatically close after copying or pasting an item.: Wenn aktiviert, wird das Schnelleinfügen-Fenster nach dem Kopieren oder Einfügen eines Elements automatisch geschlossen.
? When enabled, clicking menu items will only copy content to clipboard instead of auto-pasting. This gives you more control over when and where content is pasted.
: Wenn aktiviert, wird beim Klicken auf Menüelemente der Inhalt nur in die Zwischenablage kopiert, anstatt automatisch eingefügt zu werden. Dies gibt Ihnen mehr Kontrolle darüber, wann und wo Inhalte eingefügt werden.
? When enabled, clicking or pressing Enter on items in Quick Paste window will only copy them to clipboard without automatically pasting.
: Wenn aktiviert, werden beim Klicken oder Drücken der Eingabetaste auf Elemente im Schnelleinfügen-Fenster diese nur in die Zwischenablage kopiert, ohne sie automatisch einzufügen.
? When enabled, single click will copy/paste items in Quick Paste window. If global single click is also enabled, both settings work together.
: Wenn aktiviert, werden Elemente im Schnelleinfügen-Fenster mit einem einfachen Klick kopiert/eingefügt. Wenn globaler Einfachklick ebenfalls aktiviert ist, funktionieren beide Einstellungen zusammen.
Configure how the system tray icon responds to mouse clicks: Konfigurieren Sie, wie das Systemtray-Symbol auf Mausklicks reagiert
Configure the behavior of the Quick Paste window when selecting items: Konfigurieren Sie das Verhalten des Schnelleinfügen-Fensters beim Auswählen von Elementen
Disable left-click context menu: Linksklick-Kontextmenü deaktivieren
Double-click toggles app visibility: Doppelklick schaltet App-Sichtbarkeit um
Double-clicking the tray icon shows or hides the main application window: Doppelklick auf das Tray-Symbol zeigt oder verbirgt das Hauptanwendungsfenster
Enabling either left-click option will disable the context menu to ensure proper functionality.: Das Aktivieren einer der beiden Linksklick-Optionen deaktiviert das Kontextmenü, um ordnungsgemäße Funktionalität sicherzustellen.
Left-click toggles app visibility: Linksklick schaltet App-Sichtbarkeit um
Left-clicking the tray icon shows or hides the main application window: Linksklick auf das Tray-Symbol zeigt oder verbirgt das Hauptanwendungsfenster
Prevents the context menu from appearing when left-clicking the tray icon: Verhindert, dass das Kontextmenü beim Linksklick auf das Tray-Symbol erscheint
Tray Icon Behavior on Windows: Tray-Symbol-Verhalten unter Windows
Configure which items to preserve when clearing clipboard history (both manual and auto-clear operations).: Konfigurieren Sie, welche Elemente beim Löschen des Zwischenablageverlaufs beibehalten werden sollen (sowohl manuell als auch automatisch).
Keep Items on Clear: Elemente beim Löschen beibehalten
Keep Pinned Items: Angehängte Elemente beibehalten

View File

@ -6,16 +6,21 @@ Both clipboard history and saved clips panels visible: Both clipboard history an
Change: Change
Click Set/Change button to start recording: Click Set/Change button to start recording
Clipboard history panel visible: Clipboard history panel visible
Configure how the system tray icon responds to mouse clicks: Configure how the system tray icon responds to mouse clicks
Configure the behavior of the Quick Paste window when selecting items: Configure the behavior of the Quick Paste window when selecting items
Configure which items to preserve when clearing clipboard history (both manual and auto-clear operations).: Configure which items to preserve when clearing clipboard history (both manual and auto-clear operations).
Control which panels are visible in the main window: Control which panels are visible in the main window
Copy items only (no auto-paste): Copy items only (no auto-paste)
Copy only from menu items: Copy only from menu items
Default Note Icon Type: Default Note Icon Type
Disable left-click context menu: Disable left-click context menu
Display navbar items only when the mouse hovers over the navigation bar to minimize visible UI elements: Display navbar items only when the mouse hovers over the navigation bar to minimize visible UI elements
Display persistent icons on clips that have notes to improve visual organization and make notes easier to discover.: Display persistent icons on clips that have notes to improve visual organization and make notes easier to discover.
Double-click toggles app visibility: Double-click toggles app visibility
Double-clicking the tray icon shows or hides the main application window: Double-clicking the tray icon shows or hides the main application window
Enable simplified, less boxy layout for a cleaner and more streamlined interface design: Enable simplified, less boxy layout for a cleaner and more streamlined interface design
Enable single-click to copy/paste clipboard history items and saved clips instead of requiring double-click.: Enable single-click to copy/paste clipboard history items and saved clips instead of requiring double-click.
Enabling either left-click option will disable the context menu to ensure proper functionality.: Enabling either left-click option will disable the context menu to ensure proper functionality.
Global System OS Hotkeys: Global System OS Hotkeys
Hide Collections Navbar: Hide Collections Navbar
Hide collections menu dropdown on the navigation bar: Hide collections menu dropdown on the navigation bar
@ -28,6 +33,8 @@ Keep Pinned Items: Keep Pinned Items
Keep Starred Items: Keep Starred Items
? Keep the main application window hidden when the app restarts. You can reopen it using the menu bar or taskbar menu, or using global hotkeys.
: Keep the main application window hidden when the app restarts. You can reopen it using the menu bar or taskbar menu, or using global hotkeys.
Left-click toggles app visibility: Left-click toggles app visibility
Left-clicking the tray icon shows or hides the main application window: Left-clicking the tray icon shows or hides the main application window
No keys set: No keys set
'Note: At least one panel must remain visible in main window.': 'Note: At least one panel must remain visible in main window.'
Panel Visibility: Panel Visibility
@ -39,6 +46,7 @@ Press Enter to confirm or Escape to cancel: Press Enter to confirm or Escape to
Press keys: Press keys
Press your desired key combination (e.g., Ctrl+Shift+V): Press your desired key combination (e.g., Ctrl+Shift+V)
Press your key combination...: Press your key combination...
Prevents the context menu from appearing when left-clicking the tray icon: Prevents the context menu from appearing when left-clicking the tray icon
Preview Max Lines: Preview Max Lines
Quick Paste Window: Quick Paste Window
Quick Paste Window Options: Quick Paste Window Options
@ -62,6 +70,7 @@ Simplified Panel Layout: Simplified Panel Layout
Single Click Copy/Paste: Single Click Copy/Paste
Single Click Copy/Paste action: Single Click Copy/Paste action
This sets the default icon type for new clips with notes. You can customize individual clips via the context menu.: This sets the default icon type for new clips with notes. You can customize individual clips via the context menu.
Tray Icon Behavior on Windows: Tray Icon Behavior on Windows
? When enabled, clicking menu items will only copy content to clipboard instead of auto-pasting. This gives you more control over when and where content is pasted.
: When enabled, clicking menu items will only copy content to clipboard instead of auto-pasting. This gives you more control over when and where content is pasted.
? When enabled, clicking or pressing Enter on items in Quick Paste window will only copy them to clipboard without automatically pasting.

View File

@ -48,9 +48,15 @@ Single Click Copy/Paste action: Acción de clic simple Copiar/Pegar
Single Click Copy/Paste: Clic simple Copiar/Pegar
Quick Paste Window Options: Opciones de la ventana de pegado rápido
Configure the behavior of the Quick Paste window when selecting items: Configurar el comportamiento de la ventana de pegado rápido al seleccionar elementos
Copy items only (no auto-paste): Copiar elementos solamente (sin pegado automático)
Auto-close window after action: Cerrar ventana automáticamente después de la acción
When enabled, the Quick Paste window will automatically close after copying or pasting an item.: Cuando esté habilitado, la ventana de pegado rápido se cerrará automáticamente después de copiar o pegar un elemento.
Configure how the system tray icon responds to mouse clicks: Configurar cómo responde el icono de la bandeja del sistema a los clics del ratón
Disable left-click context menu: Deshabilitar menú contextual del clic izquierdo
Double-click toggles app visibility: El doble clic alterna la visibilidad de la aplicación
Double-clicking the tray icon shows or hides the main application window: Hacer doble clic en el icono de la bandeja muestra u oculta la ventana principal de la aplicación
Enabling either left-click option will disable the context menu to ensure proper functionality.: Habilitar cualquiera de las opciones de clic izquierdo deshabilitará el menú contextual para asegurar el funcionamiento adecuado.
Left-click toggles app visibility: El clic izquierdo alterna la visibilidad de la aplicación
Left-clicking the tray icon shows or hides the main application window: Hacer clic izquierdo en el icono de la bandeja muestra u oculta la ventana principal de la aplicación
Prevents the context menu from appearing when left-clicking the tray icon: Previene que aparezca el menú contextual al hacer clic izquierdo en el icono de la bandeja
Tray Icon Behavior on Windows: Comportamiento del icono de la bandeja en Windows
This sets the default icon type for new clips with notes. You can customize individual clips via the context menu.: Esto establece el tipo de icono predeterminado para nuevos clips con notas. Puedes personalizar clips individuales a través del menú contextual.
? When enabled, clicking menu items will only copy content to clipboard instead of auto-pasting. This gives you more control over when and where content is pasted.
: Cuando está habilitado, hacer clic en elementos del menú solo copiará el contenido al portapapeles en lugar de pegarlo automáticamente. Esto te da más control sobre cuándo y dónde se pega el contenido.

View File

@ -67,3 +67,12 @@ Preserve starred items when clearing history: Conserver les éléments favoris l
History Item Preview Max Lines: Limite maximale de lignes d'aperçu des éléments de l'historique
Set the maximum number of lines to display in the preview of a history item: Définir le nombre maximal de lignes à afficher dans l'aperçu d'un élément de l'historique
Preview Max Lines: Lignes d'aperçu
Configure how the system tray icon responds to mouse clicks: Configurer comment l'icône de la barre système répond aux clics de souris
Disable left-click context menu: Désactiver le menu contextuel du clic gauche
Double-click toggles app visibility: Le double-clic bascule la visibilité de l'application
Double-clicking the tray icon shows or hides the main application window: Double-cliquer sur l'icône de la barre système affiche ou masque la fenêtre principale de l'application
Enabling either left-click option will disable the context menu to ensure proper functionality.: L'activation de l'une ou l'autre des options de clic gauche désactivera le menu contextuel pour assurer un bon fonctionnement.
Left-click toggles app visibility: Le clic gauche bascule la visibilité de l'application
Left-clicking the tray icon shows or hides the main application window: Cliquer gauche sur l'icône de la barre système affiche ou masque la fenêtre principale de l'application
Prevents the context menu from appearing when left-clicking the tray icon: Empêche le menu contextuel d'apparaître lors du clic gauche sur l'icône de la barre système
Tray Icon Behavior on Windows: Comportement de l'icône de la barre système sur Windows

View File

@ -1,8 +1,13 @@
App restart required: Riavvio necessario
Application Starts with Main Window Hidden: L'applicazione si avvia con la finestra principale nascosta
Change: Modifica
Configure how the system tray icon responds to mouse clicks: Configura come l'icona della barra di sistema risponde ai clic del mouse
Copy only from menu items: Copia solo dagli elementi del menu
Disable left-click context menu: Disabilita menu contestuale clic sinistro
Display navbar items only when the mouse hovers over the navigation bar to minimize visible UI elements: Mostra gli elementi della barra di navigazione solo al passaggio del mouse per minimizzare gli elementi visibili dell'interfaccia
Double-click toggles app visibility: Il doppio clic commuta la visibilità dell'app
Double-clicking the tray icon shows or hides the main application window: Fare doppio clic sull'icona della barra di sistema mostra o nasconde la finestra principale dell'applicazione
Enabling either left-click option will disable the context menu to ensure proper functionality.: L'abilitazione di una delle opzioni di clic sinistro disabiliterà il menu contestuale per garantire il corretto funzionamento.
Global System OS Hotkeys: Tasti di scelta rapida globali del sistema
Hide Collections Navbar: Nascondi barra delle collezioni
Hide collections menu dropdown on the navigation bar: Nascondi il menu a discesa delle collezioni nella barra di navigazione

View File

@ -48,9 +48,15 @@ Single Click Copy/Paste: Копирование/вставка одним кли
Quick Paste Window: Окно быстрой вставки
Quick Paste Window Options: Параметры окна быстрой вставки
Configure the behavior of the Quick Paste window when selecting items: Настроить поведение окна быстрой вставки при выборе элементов
Copy items only (no auto-paste): Только копировать элементы (без автовставки)
Auto-close window after action: Автоматически закрывать окно после действия
When enabled, the Quick Paste window will automatically close after copying or pasting an item.: Когда включено, окно быстрой вставки будет автоматически закрываться после копирования или вставки элемента.
Configure how the system tray icon responds to mouse clicks: Настроить, как иконка системного трея реагирует на клики мыши
Disable left-click context menu: Отключить контекстное меню левого клика
Double-click toggles app visibility: Двойной клик переключает видимость приложения
Double-clicking the tray icon shows or hides the main application window: Двойной клик по иконке трея показывает или скрывает главное окно приложения
Enabling either left-click option will disable the context menu to ensure proper functionality.: Включение любой из опций левого клика отключит контекстное меню для обеспечения правильной функциональности.
Left-click toggles app visibility: Левый клик переключает видимость приложения
Left-clicking the tray icon shows or hides the main application window: Левый клик по иконке трея показывает или скрывает главное окно приложения
Prevents the context menu from appearing when left-clicking the tray icon: Предотвращает появление контекстного меню при левом клике по иконке трея
Tray Icon Behavior on Windows: Поведение иконки трея в Windows
This sets the default icon type for new clips with notes. You can customize individual clips via the context menu.: Это устанавливает тип иконки по умолчанию для новых клипов с заметками. Вы можете настроить отдельные клипы через контекстное меню.
? When enabled, clicking menu items will only copy content to clipboard instead of auto-pasting. This gives you more control over when and where content is pasted.
: Когда включено, нажатие на элементы меню будет только копировать содержимое в буфер обмена вместо автоматической вставки. Это дает вам больше контроля над тем, когда и где вставляется содержимое.

View File

@ -67,3 +67,12 @@ Preserve starred items when clearing history: Geçmişi temizlerken favorilenmi
History Item Preview Max Lines: Geçmiş öğesi önizleme maksimum satır sayısı
Set the maximum number of lines to display in the preview of a history item: Bir geçmiş öğesinin önizlemesinde gösterilecek maksimum satır sayısını ayarla
Preview Max Lines: Önizleme Satırları
Configure how the system tray icon responds to mouse clicks: Sistem tepsisi simgesinin fare tıklamalarına nasıl yanıt verdiğini yapılandır
Disable left-click context menu: Sol tık bağlam menüsünü devre dışı bırak
Double-click toggles app visibility: Çift tık uygulama görünürlüğünü değiştirir
Double-clicking the tray icon shows or hides the main application window: Tepsi simgesine çift tıklamak ana uygulama penceresini gösterir veya gizler
Enabling either left-click option will disable the context menu to ensure proper functionality.: Sol tık seçeneklerinden birini etkinleştirmek, düzgün işlevselliği sağlamak için bağlam menüsünü devre dışı bırakır.
Left-click toggles app visibility: Sol tık uygulama görünürlüğünü değiştirir
Left-clicking the tray icon shows or hides the main application window: Tepsi simgesine sol tıklamak ana uygulama penceresini gösterir veya gizler
Prevents the context menu from appearing when left-clicking the tray icon: Tepsi simgesine sol tıklarken bağlam menüsünün görünmesini engeller
Tray Icon Behavior on Windows: Windows'ta Tepsi Simgesi Davranışı

View File

@ -67,3 +67,12 @@ Preserve starred items when clearing history: Зберігати обрані е
History Item Preview Max Lines: Рядки перегляду історії
Set the maximum number of lines to display in the preview of a history item: Встановити максимальну кількість рядків для відображення в попередньому перегляді елемента історії
Preview Max Lines: Рядки перегляду
Configure how the system tray icon responds to mouse clicks: Налаштувати, як іконка системного трея реагує на кліки миші
Disable left-click context menu: Вимкнути контекстне меню лівого кліка
Double-click toggles app visibility: Подвійний клік перемикає видимість додатку
Double-clicking the tray icon shows or hides the main application window: Подвійний клік по іконці трея показує або приховує головне вікно додатку
Enabling either left-click option will disable the context menu to ensure proper functionality.: Увімкнення будь-якої з опцій лівого кліка вимкне контекстне меню для забезпечення правильної функціональності.
Left-click toggles app visibility: Лівий клік перемикає видимість додатку
Left-clicking the tray icon shows or hides the main application window: Лівий клік по іконці трея показує або приховує головне вікно додатку
Prevents the context menu from appearing when left-clicking the tray icon: Запобігає появі контекстного меню при лівому кліку по іконці трея
Tray Icon Behavior on Windows: Поведінка іконки трея в Windows

View File

@ -48,17 +48,19 @@ Single Click Copy/Paste action: 单击复制/粘贴操作
Single Click Copy/Paste: 单击复制/粘贴
Quick Paste Window Options: 快速粘贴窗口选项
Configure the behavior of the Quick Paste window when selecting items: 配置选择项目时快速粘贴窗口的行为
Copy items only (no auto-paste): 仅复制项目(无自动粘贴)
Auto-close window after action: 操作后自动关闭窗口
When enabled, the Quick Paste window will automatically close after copying or pasting an item.: 启用后,快速粘贴窗口将在复制或粘贴项目后自动关闭。
This sets the default icon type for new clips with notes. You can customize individual clips via the context menu.: 这设置了带有注释的新剪辑的默认图标类型。您可以通过上下文菜单自定义单个剪辑。
? When enabled, clicking menu items will only copy content to clipboard instead of auto-pasting. This gives you more control over when and where content is pasted.
: 启用后,点击菜单项只会将内容复制到剪贴板而不是自动粘贴。这让您更好地控制内容粘贴的时间和位置。
? When enabled, clicking or pressing Enter on items in Quick Paste window will only copy them to clipboard without automatically pasting.
: 启用后在快速粘贴窗口中点击或按Enter键只会将项目复制到剪贴板而不会自动粘贴。
? When enabled, single click will copy/paste items in Quick Paste window. If global single click is also enabled, both settings work together.
: 启用后,单击将在快速粘贴窗口中复制/粘贴项目。如果全局单击也启用了,两个设置会一起工作。
Configure which items to preserve when clearing clipboard history (both manual and auto-clear operations).: 配置在清除剪贴板历史记录时要保留的项目(包括手动和自动清除操作)。
Configure how the system tray icon responds to mouse clicks: 配置系统托盘图标如何响应鼠标点击
Disable left-click context menu: 禁用左键上下文菜单
Double-click toggles app visibility: 双击切换应用可见性
Double-clicking the tray icon shows or hides the main application window: 双击托盘图标显示或隐藏主应用窗口
Enabling either left-click option will disable the context menu to ensure proper functionality.: 启用任一左键选项将禁用上下文菜单以确保功能正常。
Left-click toggles app visibility: 左键点击切换应用可见性
Left-clicking the tray icon shows or hides the main application window: 左键点击托盘图标显示或隐藏主应用窗口
Prevents the context menu from appearing when left-clicking the tray icon: 防止左键点击托盘图标时出现上下文菜单
Tray Icon Behavior on Windows: Windows 托盘图标行为
Clipboard History: 剪贴板历史记录
Saved Clips: 已保存的剪辑
Clear Clipboard History: 清除剪贴板历史记录
Are you sure you want to clear the clipboard history? This action cannot be undone.: 您确定要清除剪贴板历史记录吗?此操作无法撤消。
Keep Items on Clear: 清除时保留项目
Keep Pinned Items: 保留已固定项目
Keep Starred Items: 保留已星标项目

View File

@ -106,10 +106,23 @@ export default function UserPreferences() {
setIsSingleClickToCopyPaste,
isSingleClickToCopyPasteQuickWindow,
setIsSingleClickToCopyPasteQuickWindow,
isDoubleClickTrayToOpenEnabledOnWindows,
setIsDoubleClickTrayToOpenEnabledOnWindows,
isLeftClickTrayToOpenEnabledOnWindows,
setIsLeftClickTrayToOpenEnabledOnWindows,
isLeftClickTrayDisabledOnWindows,
setIsLeftClickTrayDisabledOnWindows,
} = useAtomValue(settingsStoreAtom)
const { setFontSize, fontSize, setIsSwapPanels, isSwapPanels, returnRoute, isMacOSX } =
useAtomValue(uiStoreAtom)
const {
setFontSize,
fontSize,
setIsSwapPanels,
isSwapPanels,
returnRoute,
isWindows,
isMacOSX,
} = useAtomValue(uiStoreAtom)
const isSinglePanelView = isHistoryPanelVisibleOnly || isSavedClipsPanelVisibleOnly
@ -341,6 +354,128 @@ export default function UserPreferences() {
</Card>
</Box>
{isWindows && (
<Box className="animate-in fade-in max-w-xl mt-4">
<Card>
<CardHeader className="pb-2">
<CardTitle className="animate-in fade-in text-md font-medium">
{t('Tray Icon Behavior on Windows', { ns: 'settings2' })}
</CardTitle>
</CardHeader>
<CardContent>
<Text className="text-sm text-muted-foreground mb-4">
{t(
'Configure how the system tray icon responds to mouse clicks',
{
ns: 'settings2',
}
)}
</Text>
<div className="space-y-3">
<div className="flex items-center justify-between">
<div>
<Text className="text-[15px] font-semibold">
{t('Double-click toggles app visibility', {
ns: 'settings2',
})}
</Text>
<Text className="text-xs text-muted-foreground">
{t(
'Double-clicking the tray icon shows or hides the main application window',
{ ns: 'settings2' }
)}
</Text>
</div>
<Switch
checked={isDoubleClickTrayToOpenEnabledOnWindows}
onCheckedChange={() => {
if (
isLeftClickTrayToOpenEnabledOnWindows &&
!isDoubleClickTrayToOpenEnabledOnWindows
) {
setIsLeftClickTrayToOpenEnabledOnWindows(false)
}
setIsDoubleClickTrayToOpenEnabledOnWindows(
!isDoubleClickTrayToOpenEnabledOnWindows
)
}}
/>
</div>
<div className="flex items-center justify-between">
<div>
<Text className="text-[15px] font-semibold">
{t('Left-click toggles app visibility', {
ns: 'settings2',
})}
</Text>
<Text className="text-xs text-muted-foreground">
{t(
'Left-clicking the tray icon shows or hides the main application window',
{ ns: 'settings2' }
)}
</Text>
</div>
<Switch
checked={isLeftClickTrayToOpenEnabledOnWindows}
onCheckedChange={() => {
if (
isDoubleClickTrayToOpenEnabledOnWindows &&
!isLeftClickTrayToOpenEnabledOnWindows
) {
setIsDoubleClickTrayToOpenEnabledOnWindows(false)
}
setIsLeftClickTrayToOpenEnabledOnWindows(
!isLeftClickTrayToOpenEnabledOnWindows
)
}}
/>
</div>
<div className="flex items-center justify-between">
<div>
<Text className="text-[15px] font-semibold">
{t('Disable left-click context menu', {
ns: 'settings2',
})}
</Text>
<Text className="text-xs text-muted-foreground">
{t(
'Prevents the context menu from appearing when left-clicking the tray icon',
{ ns: 'settings2' }
)}
</Text>
</div>
<Switch
checked={isLeftClickTrayDisabledOnWindows}
onCheckedChange={() => {
setIsLeftClickTrayDisabledOnWindows(
!isLeftClickTrayDisabledOnWindows
)
}}
/>
</div>
</div>
{(isLeftClickTrayToOpenEnabledOnWindows ||
isLeftClickTrayDisabledOnWindows) && (
<div className="mt-3 p-2 bg-blue-50 dark:bg-blue-900/20 rounded border-l-4 border-blue-300 dark:border-blue-600">
<Text className="text-xs text-blue-700 dark:text-blue-300">
{t(
'Enabling either left-click option will disable the context menu to ensure proper functionality.',
{
ns: 'settings2',
}
)}
</Text>
</div>
)}
</CardContent>
</Card>
</Box>
)}
<CustomDatabaseLocationSettings />
<Spacer h={6} />
@ -577,7 +712,7 @@ export default function UserPreferences() {
<div className="space-y-3">
<div className="flex items-center justify-between">
<div>
<Text className="text-sm font-medium">
<Text className="text-[15px] font-semibold">
{t('Show History Panel Only', { ns: 'settings2' })}
</Text>
<Text className="text-xs text-muted-foreground">
@ -601,7 +736,7 @@ export default function UserPreferences() {
<div className="flex items-center justify-between">
<div>
<Text className="text-sm font-medium">
<Text className="text-[15px] font-semibold">
{t('Show Boards and Clips Panel Only', { ns: 'settings2' })}
</Text>
<Text className="text-xs text-muted-foreground">
@ -626,7 +761,7 @@ export default function UserPreferences() {
</div>
<div className="flex items-center justify-between">
<div>
<Text className="text-sm font-medium">
<Text className="text-[15px] font-semibold">
{t('Show Both Panels', { ns: 'settings2' })}
</Text>
<Text className="text-xs text-muted-foreground">

View File

@ -108,6 +108,9 @@ type Settings = {
protectedCollections: string[]
globalTemplatesEnabled: boolean
globalTemplates: Array<{ id: string; name: string; value: string; isEnabled: boolean }>
isDoubleClickTrayToOpenEnabledOnWindows: boolean
isLeftClickTrayToOpenEnabledOnWindows: boolean
isLeftClickTrayDisabledOnWindows: boolean
}
type Constants = {
@ -161,6 +164,8 @@ export interface SettingsStoreState {
setIsAutoPreviewLinkCardsEnabled: (isEnabled: boolean) => void
setIsAutoGenerateLinkCardsEnabled: (isEnabled: boolean) => void
setIsAutoFavoriteOnDoubleCopyEnabled: (isEnabled: boolean) => void
setIsLeftClickTrayToOpenEnabledOnWindows: (isEnabled: boolean) => void
setIsLeftClickTrayDisabledOnWindows: (isEnabled: boolean) => void
setIsSearchNameOrLabelOnly: (isEnabled: boolean) => void
initConstants: (CONST: Constants) => void
setIsShowCollectionNameOnNavBar: (isEnabled: boolean) => void
@ -229,6 +234,7 @@ export interface SettingsStoreState {
}) => void
deleteGlobalTemplate: (templateId: string) => void
toggleGlobalTemplateEnabledState: (templateId: string) => void
setIsDoubleClickTrayToOpenEnabledOnWindows: (isEnabled: boolean) => void
}
const initialState: SettingsStoreState & Settings = {
@ -313,6 +319,12 @@ const initialState: SettingsStoreState & Settings = {
hasPinProtectedCollections: false,
globalTemplatesEnabled: true,
globalTemplates: [],
isDoubleClickTrayToOpenEnabledOnWindows: false,
isLeftClickTrayToOpenEnabledOnWindows: false,
isLeftClickTrayDisabledOnWindows: false,
setIsDoubleClickTrayToOpenEnabledOnWindows: () => {},
setIsLeftClickTrayToOpenEnabledOnWindows: () => {},
setIsLeftClickTrayDisabledOnWindows: () => {},
setHasPinProtectedCollections: async () => {},
CONST: {
APP_DETECT_LANGUAGES_SUPPORTED: [],
@ -867,6 +879,47 @@ export const settingsStore = createStore<SettingsStoreState & Settings>()((set,
get().syncStateUpdate('globalTemplates', updatedTemplates)
return get().updateSetting('globalTemplates', JSON.stringify(updatedTemplates))
},
setIsDoubleClickTrayToOpenEnabledOnWindows: async (isEnabled: boolean) => {
return get().updateSetting('isDoubleClickTrayToOpenEnabledOnWindows', isEnabled)
},
setIsLeftClickTrayToOpenEnabledOnWindows: async (isEnabled: boolean) => {
const result = await get().updateSetting(
'isLeftClickTrayToOpenEnabledOnWindows',
isEnabled
)
// Update the environment variable with current values to avoid race conditions
const { isLeftClickTrayDisabledOnWindows } = get()
try {
await invoke('update_left_click_tray_env', {
isToggleEnabled: isEnabled,
isDisabled: isLeftClickTrayDisabledOnWindows,
})
} catch (error) {
console.error('Failed to update left click tray environment variable:', error)
}
return result
},
setIsLeftClickTrayDisabledOnWindows: async (isDisabled: boolean) => {
const result = await get().updateSetting(
'isLeftClickTrayDisabledOnWindows',
isDisabled
)
// Update the environment variable with current values to avoid race conditions
const { isLeftClickTrayToOpenEnabledOnWindows } = get()
try {
await invoke('update_left_click_tray_env', {
isToggleEnabled: isLeftClickTrayToOpenEnabledOnWindows,
isDisabled: isDisabled,
})
} catch (error) {
console.error('Failed to update left click tray environment variable:', error)
}
return result
},
setProtectedCollections: async (ids: string[]) => {
return get().updateSetting('protectedCollections', ids.join(','))
},

View File

@ -9,6 +9,7 @@ mod runner;
use crossbeam_channel::{self as channel, Receiver, Sender};
use parking_lot::Mutex;
use raw_window_handle::{RawDisplayHandle, WindowsDisplayHandle};
use std::env;
use std::{
cell::Cell,
collections::VecDeque,

View File

@ -318,20 +318,30 @@ unsafe extern "system" fn tray_subclass_proc(
match lparam.0 as u32 {
win32wm::WM_LBUTTONUP => {
println!("left click");
// println!("left click");
(subclass_input.sender)(Event::TrayEvent {
id: subclass_input.id,
event: TrayEvent::LeftClick,
position,
bounds,
});
if let Some(menu) = subclass_input.hmenu {
show_tray_menu(hwnd, menu, cursor.x, cursor.y);
// Check environment variable to see if we should show context menu on left click
let enable_left_click_menu = std::env::var("PASTEBAR_ENABLE_LEFT_CLICK_MENU")
.unwrap_or_else(|_| "false".to_string())
.parse::<bool>()
.unwrap_or(false);
// Only show context menu on left click if not disabled
if !enable_left_click_menu {
if let Some(menu) = subclass_input.hmenu {
show_tray_menu(hwnd, menu, cursor.x, cursor.y);
}
}
}
win32wm::WM_RBUTTONUP => {
println!("right click");
// println!("right click");
(subclass_input.sender)(Event::TrayEvent {
id: subclass_input.id,
event: TrayEvent::RightClick,

View File

@ -325,8 +325,17 @@ unsafe extern "system" fn tray_subclass_proc(
bounds,
});
if let Some(menu) = subclass_input.hmenu {
show_tray_menu(hwnd, menu, cursor.x, cursor.y);
// Check environment variable to see if we should show context menu on left click
let enable_left_click_menu = std::env::var("PASTEBAR_ENABLE_LEFT_CLICK_MENU")
.unwrap_or_else(|_| "false".to_string())
.parse::<bool>()
.unwrap_or(false);
// Only show context menu on left click if not disabled
if !enable_left_click_menu {
if let Some(menu) = subclass_input.hmenu {
show_tray_menu(hwnd, menu, cursor.x, cursor.y);
}
}
}

View File

@ -50,8 +50,8 @@ use crate::models::Setting;
use crate::services::history_service;
use crate::services::settings_service::get_all_settings;
use crate::services::translations::translations::Translations;
use crate::services::utils::{apply_global_templates, ensure_url_or_email_prefix};
use crate::services::utils::remove_special_bbcode_tags;
use crate::services::utils::{apply_global_templates, ensure_url_or_email_prefix};
use commands::backup_restore_commands;
use commands::clipboard_commands;
use commands::collections_commands;
@ -176,6 +176,18 @@ fn update_setting(setting: Setting, app_handle: tauri::AppHandle) -> Result<Stri
}
}
#[cfg(target_os = "windows")]
#[tauri::command]
fn update_left_click_tray_env(is_toggle_enabled: bool, is_disabled: bool) -> Result<(), String> {
let should_disable_context_menu = is_disabled || is_toggle_enabled;
std::env::set_var(
"PASTEBAR_ENABLE_LEFT_CLICK_MENU",
should_disable_context_menu.to_string(),
);
Ok(())
}
#[tauri::command]
fn is_autostart_enabled() -> Result<bool, bool> {
let current_exe = current_exe().unwrap();
@ -956,10 +968,56 @@ async fn main() {
}
},
#[cfg(target_os = "windows")]
SystemTrayEvent::LeftClick { .. } => {
let app_settings = app.state::<Mutex<HashMap<String, Setting>>>();
let settings_map = app_settings.lock().unwrap();
let enable_left_click = settings_map
.get("isLeftClickTrayToOpenEnabledOnWindows")
.and_then(|setting| setting.value_bool)
.unwrap_or(false);
if enable_left_click {
let window = app.get_window("main").unwrap();
if window.is_visible().unwrap() {
window.hide().unwrap();
window
.emit_all("window-events", "main-window-hide")
.unwrap();
} else {
window.show().unwrap();
window.unminimize().unwrap();
window.set_focus().unwrap();
window
.emit_all("window-events", "main-window-show")
.unwrap();
}
}
}
#[cfg(target_os = "windows")]
SystemTrayEvent::DoubleClick { .. } => {
let window = app.get_window("main").unwrap();
window.show().unwrap();
window.set_focus().unwrap();
let app_settings = app.state::<Mutex<HashMap<String, Setting>>>();
let settings_map = app_settings.lock().unwrap();
let is_enabled = settings_map
.get("isDoubleClickTrayToOpenEnabledOnWindows")
.and_then(|setting| setting.value_bool)
.unwrap_or(true);
if is_enabled {
let window = app.get_window("main").unwrap();
if window.is_visible().unwrap() {
window.hide().unwrap();
window
.emit_all("window-events", "main-window-hide")
.unwrap();
} else {
window.show().unwrap();
window.unminimize().unwrap();
window.set_focus().unwrap();
window
.emit_all("window-events", "main-window-show")
.unwrap();
}
}
}
_ => {}
})
@ -1101,6 +1159,30 @@ async fn main() {
app_settings,
) {
Ok(tray_menu) => {
#[cfg(target_os = "windows")]
{
let app_settings_for_tray = app_handle.state::<Mutex<HashMap<String, Setting>>>();
let settings_map = app_settings_for_tray.lock().unwrap();
// Check both settings to determine the environment variable value
let is_disabled = settings_map
.get("isLeftClickTrayDisabledOnWindows")
.and_then(|setting| setting.value_bool)
.unwrap_or(false);
let is_toggle_enabled = settings_map
.get("isLeftClickTrayToOpenEnabledOnWindows")
.and_then(|setting| setting.value_bool)
.unwrap_or(false);
let should_disable_context_menu = is_disabled || is_toggle_enabled;
std::env::set_var(
"PASTEBAR_ENABLE_LEFT_CLICK_MENU",
should_disable_context_menu.to_string(),
);
}
let menu = SystemTray::new().with_id(tray_id).with_menu(tray_menu);
menu.build(app)?;
}
@ -1194,6 +1276,7 @@ async fn main() {
app_ready,
get_app_settings,
update_setting,
update_left_click_tray_env,
backup_restore_commands::create_backup,
backup_restore_commands::list_backups,
backup_restore_commands::restore_backup,