PasteBar Documentation

repository·main·Indexed 24 days ago

https://github.com/pastebar/pastebarapp

A free and open-source cross-platform clipboard manager for macOS and Windows. Features include unlimited history with search and notes, organization via collections and boards, PIN-protected secure storage, and automatic programming language detection. The documentation covers application build and development setup, as well as internal library implementations for auto-launch, deep linking, input simulation via InputBot, and machine ID generation using the mid crate.

Tokens
59.6K
Snippets
86
Records
380
Agent score
84%

What's inside PasteBar

  1. Overview of PasteBar features

    main

    PasteBar is a free and open-source clipboard manager for macOS and Windows. It provides:

    Clipboard Management

    • Unlimited clipboard history with search and notes support.
    • Organization via collections, tabs, and boards.
    • Support for text, images, files, links, and code snippets.

    Security & Privacy

    • Local storage for data privacy.
    • PIN-protected collections for sensitive clips.
    • Lock screen and passcode protection.

    Smart Workflow Features

    • Automatic programming language detection and syntax highlighting.
    • Smart Auto-Search: The Quick Paste window activates search automatically when typing.
    • Specialized copy/paste operations (over 30 context-aware options).
    • Markdown support in notes and descriptions.

    Customization

    • Advanced hotkey configuration (up to 3-key combinations).
    • Customizable tray icon behavior and clip/menu settings.
    • Custom data location support (useful for cloud syncing).
  2. Configure auto-launch on macOS

    main

    macOS supports two auto-launch methods: Launch Agent or AppleScript.

    • Launch Agent: Set use_launch_agent to true (via AutoLaunchBuilder).
    • AppleScript: Set use_launch_agent to false.

    Important macOS Constraints:

    • app_path must be an absolute path that exists.
    • When using AppleScript, the app_name should match the basename of the app_path (otherwise it is corrected automatically).
    • When using AppleScript, only --hidden and --minimized are valid arguments in the args array to hide the app on launch.
    use auto_launch::AutoLaunch;
    
    fn main() {
        let app_name = "the-app";
        let app_path = "/path/to/the-app.app";
        // false indicates using AppleScript
        let auto = AutoLaunch::new(app_name, app_path, false, &[] as &[&str]);
    
        auto.enable().is_ok();
        auto.is_enabled().unwrap();
    
        auto.disable().is_ok();
        auto.is_enabled().unwrap();
    }
  3. Configure auto-launch on Windows

    main

    On Windows, auto-launch manages startup by adding registry entries to:

    • \HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
    • \HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartupApproved\Run

    The library can detect if startup was disabled via Task Manager or Windows Settings and re-enable it.

    use auto_launch::AutoLaunch;
    
    fn main() {
        let app_name = "the-app";
        let app_path = "C:\\path\\to\\the-app.exe";
        let auto = AutoLaunch::new(app_name, app_path, &[] as &[&str]);
    
        auto.enable().is_ok();
        auto.is_enabled().unwrap();
    
        auto.disable().is_ok();
        auto.is_enabled().unwrap();
    }
  4. Consider tauri-plugin-oauth for OAuth workflows

    main

    If your primary use case is implementing OAuth flows (such as Login with Google), consider using tauri-plugin-oauth instead of tauri-plugin-deep-link.

    tauri-plugin-oauth uses a minimalistic localhost server for the OAuth process rather than custom URI schemes. This is often easier to implement and is required by certain providers like Google that do not support custom URI schemes for OAuth.

  5. Understand Primary and Secondary panes in SplitView

    main

    In SplitView, the terms "primary" and "secondary" refer to how the resize handle behaves, not the importance of the content:

    • Primary Pane (SplitPanePrimary): This is the pane whose size is controlled by the resize handle.
    • Secondary Pane (SplitPaneSecondary): This pane automatically fills the remaining available space.

    You can swap which content is in which pane, but the handle will always control the size of the SplitPanePrimary component.

    <SplitView minSize={100} maxSize={400} defaultSize={200} height="element.xlarge">
      <SplitPaneSecondary>
        <Text>Secondary</Text>
      </SplitPaneSecondary>
      <SplitPanePrimary paddingX="regular">
        <Text>Primary</Text>
      </SplitPanePrimary>
    </SplitView>
  6. Understand the parameters used for Machine ID generation

    main

    The mid crate collects specific hardware parameters to ensure the hash remains stable. The parameters vary by platform:

    MacOS

    Uses system_profiler to collect:

    • Model Number
    • Serial Number
    • Hardware UUID
    • Provisioning UDID
    • Platform ID (from Secure Element)
    • SEID (from Secure Element)

    Windows

    Uses PowerShell Get-WmiObject to collect:

    • Win32_ComputerSystemProduct (UUID/Motherboard ID)
    • Win32_BIOS (BIOS serial number)
    • Win32_BaseBoard (Baseboard serial number)
    • Win32_Processor (Processor identifier)

    Linux

    • Uses the machine-id file.
    • Note: This parameter is subject to user modification and is considered less reliable than other platforms.
  7. Configure auto-launch on Linux

    main

    On Linux, use AutoLaunch::new providing the application name, the absolute path to the executable, and an array of arguments.

    use auto_launch::AutoLaunch;
    
    fn main() {
        let app_name = "the-app";
        let app_path = "/path/to/the-app";
        let auto = AutoLaunch::new(app_name, app_path, &[] as &[&str]);
    
        // enable the auto launch
        auto.enable().is_ok();
        auto.is_enabled().unwrap();
    
        // disable the auto launch
        auto.disable().is_ok();
        auto.is_enabled().unwrap();
    }
  8. Quickstart with react-resizable-panels

    main

    To create a resizable layout, import Panel, PanelGroup, and PanelResizeHandle from react-resizable-panels. Wrap your components in a PanelGroup and place PanelResizeHandle components between your Panel components to create the draggable boundaries.

    import { Panel, PanelGroup, PanelResizeHandle } from 'react-resizable-panels'
    
    ;<PanelGroup autoSaveId="example" direction="horizontal">
      <Panel defaultSize={25}>
        <SourcesExplorer />
      </Panel>
      <PanelResizeHandle />
      <Panel>
        <SourceViewer />
      </Panel>
      <PanelResizeHandle />
      <Panel defaultSize={25}>
        <Console />
      </Panel>
    </PanelGroup>