Skip to content

thevindu-w/clip_share_desktop

Repository files navigation

ClipShare - Desktop

Share Clipboard and Files. Copy on one device. Paste on another device.

Build and Test Last commit License Latest release


ClipShare is a lightweight and cross-platform tool for clipboard sharing. ClipShare enables copying text, files, and images on one device and pasting on another. ClipShare is simple and easy to use while being highly configurable. This is the desktop client of ClipShare that connects to a server running on the other machine to share copied text, files, and images.

Download

Server

Desktop
Get it on GitHub
Download the server from Releases.

Client

Android Desktop
Get it on IzzyOnDroid
Download the Android client app from apt.izzysoft.de/fdroid/index/apk/com.tw.clipshare
or from GitHub Releases.
Get it on GitHub
Download the desktop client from Releases.

Table of Contents


How to Use

GUI client

The GUI client provides a web interface similar to the mobile client app. The client app acts as a bridge to use the web interface. To use the client in this web GUI mode, you need to run the client program.

  • You can run the client from a terminal or by double-clicking on the program (if the file manager supports executing programs in that way).
  • When the client starts, it will not display any visible window or produce any output.
  • Once the client starts, open a web browser (ex: Google Chrome, Microsoft Edge, Firefox, or any modern web browser) and visit http://localhost:8888/. This should open the ClipShare client web app. (The port 8888 can be changed in the configuration file)
  • Using the GUI client is similar to using the mobile client except the desktop client uses the Send File button to send both copied files and folders.
  • To use the desktop client to send copied text or files, copy the text or files you want to send (just like you would copy them to paste somewhere else). Then press the correct Send button on the web app (either Send Text or Send File). Then you can paste them on the machine that runs the ClipShare server.
  • To use the desktop client to receive copied text, an image, or files, copy the text or files on the machine that runs the ClipShare server. Then press the correct Get button on the web app (either Get Text, Get Image, or Get File). Then you can paste them on the machine that runs the client.
  • If something goes wrong, it will create a client_err.log file. That file will contain what went wrong.

CLI client

The CLI client enables using this desktop client with a command. To use the client in this CLI mode, you need to run the client program with the following command line arguments.

clip-share-client -c COMMAND <server-address-ipv4> [optional args]

Commands available:

  • sc  : Scan - server address is not needed
  • g   : Get copied text
  • s   : Send copied text
  • fg  : Get copied files
  • fs  : Send copied files
  • i   : Get image
  • ic  : Get copied image
  • is  : Get screenshot - Display number can be used as an optional arg.

Examples:

# Get copied text from the device having IP address 192.168.21.42
clip-share-client -c g 192.168.21.42
# Get a screenshot of screen number 1 from the device having IP address 192.168.21.42
clip-share-client -c is 192.168.21.42 1
# Scan and output IP addresses of available servers.
clip-share-client -c sc

Installation

Note: This section is optional if you prefer manually starting the server over automatically starting on login/reboot.

Installer scripts are available in the archives (zip for Windows and macOS, and tar.gz for Linux) attached to releases on GitHub. They are also available in the helper_tools/ directory. You must have the clip-share-client (or clip-share-client.exe on Windows) executable in the current working directory to run the installer. If you download the archive from releases and extract it, you will have the executable, along with the installer script. Run the interactive script and follow the instructions to install ClipShare.

Note: These installers do NOT need admin or superuser privileges to run. Therefore, do not run them with elevated privileges.

Linux and macOS
  1. Open a terminal in the directory where the clip-share-client executable is available (the executable name may have suffixes like _GLIBC* on Linux or arm64 or x86_64 on macOS).
  2. Run the install script as shown below, and follow the instructions of it.
# on Linux
chmod +x install-linux.sh
./install-linux.sh
# on macOS
chmod +x install-mac.sh
./install-mac.sh
Windows
  1. Place the install-windows.bat file and the clip-share-client.exe executable in the same folder. (the executable name may have suffixes)
  2. Double-click on the install-windows.bat installer script to run it. It will open a Command Prompt window. Follow the instructions on it to install ClipShare. (If double-clicking did not run the installer, right-click on it and select Run)

Configuration

The ClipShare desktop client can be configured using a configuration file. The configuration file should be named clipshare-desktop.conf. The application searches for the configuration file in the following paths in the same order until it finds one.

  1. Current working directory where the application was started.
  2. $XDG_CONFIG_HOME directory if the variable is set to an existing directory (on Linux and macOS only).
  3. ~/.config/ directory if the directory exists (on Linux and macOS only).
  4. Current user's home directory (also called user profile directory on Windows).

If it can't find a configuration file in any of the above directories, it will use the default values specified in the table below.

To customize the client, create a file named   clipshare-desktop.conf   in any of the directories mentioned above and add the following lines to that configuration file. You may omit some lines to keep the default values.

Sample configuration file
app_port=4337
web_port=8888

working_dir=./path/to/work_dir
bind_address=127.0.0.1
max_text_length=4194304
max_file_size=68719476736
cut_received_files=false
min_proto_version=1
max_proto_version=3
auto_send_text=false

# Windows and macOS only
tray_icon=true

Note that all the lines in the configuration file are optional. You may omit some lines if they need to get their default values.

Configuration options
Property Description Accepted values Default
app_port The TCP port on which the server listens for unencrypted TCP connections. (Refer to the corresponding configuration value of the server) TCP port number used for the server (1 - 65535) 4337
web_port The TCP port on which the application listens for connections from the web browser. This setting is used only for the GUI client. (Values below 1024 may require superuser/admin privileges) Any valid, unused TCP port number (1 - 65535) 8888
working_dir The working directory where the application should run. All the files and images, that are fetched from the server, will be saved in this directory. It will follow symlinks if this is a path to a symlink. The user running this application should have write access to the directory Absolute or relative path to an existing directory . (i.e. Current directory)
bind_address The address of the interface to which the application should bind when listening for connections from the web browser in the GUI mode. It will listen on all interfaces if this is set to 0.0.0.0. (Usually, this should have the loopback address 127.0.0.1 except for some rare cases) IP address of an interface or wildcard address. IPv4 dot-decimal notation (ex: 192.168.37.5) or 0.0.0.0 127.0.0.1
max_text_length The maximum length of text that can be transferred. This is the number of bytes of the text encoded in UTF-8. Any integer between 1 and 4294967295 (nearly 4 GiB) inclusive. Suffixes K, M, and G (case insensitive) denote x103, x106, and x109, respectively. 4194304 (i.e. 4 MiB)
max_file_size The maximum size of a single file in bytes that can be transferred. Any integer between 1 and 9223372036854775807 (nearly 8 EiB) inclusive. Suffixes K, M, G, and T (case insensitive) denote x103, x106, x109, and x1012, respectively. 68719476736 (i.e. 64 GiB)
cut_received_files Whether to automatically cut the files into the clipboard on the Get Files and Get Image methods. true, false, 1, 0 (Case insensitive) false
min_proto_version The minimum protocol version the client should accept from a server after negotiation. Any protocol version number greater than or equal to the minimum protocol version the client has implemented. (ex: 1) The minimum protocol version the client has implemented
max_proto_version The maximum protocol version the client should accept from a server after negotiation. Any protocol version number less than or equal to the maximum protocol version the client has implemented. (ex: 3) The maximum protocol version the client has implemented
auto_send_text Whether the application should auto-send the text when copied. The values true or 1 will enable auto-sending copied text, while false or 0 will disable the feature. true, false, 1, 0 (Case insensitive) false
tray_icon Whether the application should display a system tray icon when running in GUI mode. This option is available only on Windows and macOS. The values true or 1 will display the icon, while false or 0 will prevent displaying the icon. true, false, 1, 0 (Case insensitive) true


If you changed the configuration file, you must restart the server to apply the changes.

Build from Source

Note: If you prefer using the pre-built binaries from Releases, you can ignore this section and follow the instructions in the How to Use section.

Build tools

Compiling ClipShare Desktop needs the following tools,

  • gcc (or clang on Windows)
  • make
  • xxd
Linux

On Linux, these tools can be installed with the following command:

  • On Debian-based or Ubuntu-based distros,

    sudo apt-get install gcc make xxd
  • On Redhat-based or Fedora-based distros,

    sudo yum install gcc make xxd
  • On Arch-based distros,

    sudo pacman -S gcc make tinyxxd
Windows

On Windows, these tools can be installed with MSYS2 using pacman with the following command:

pacman -S mingw-w64-clang-x86_64-clang make vim
macOS

On macOS, these tools are installed with Xcode Command Line Tools.


Dependencies

Linux

The following development libraries are required.

  • libc

  • libx11

  • libxmu

  • libunistring

  • libmicrohttpd

    They can be installed with the following command:

  • On Debian-based or Ubuntu-based distros,

    sudo apt-get install libc6-dev libx11-dev libxmu-dev libxfixes-dev libunistring-dev libmicrohttpd-dev
  • On Redhat-based or Fedora-based distros,

    sudo yum install glibc-devel libX11-devel libXmu-devel libXfixes-devel libunistring-devel libmicrohttpd-devel
  • On Arch-based distros,

    sudo pacman -S libx11 libxmu libxfixes libunistring libmicrohttpd

    glibc should already be available on Arch distros. But you may need to upgrade it with the following command. (You need to do this only if the build fails)

    sudo pacman -S glibc
Windows

The following development libraries are required.

In an MSYS2 environment, these libraries can be installed using pacman with the following command:

pacman -S mingw-w64-clang-x86_64-libunistring

However, installing libmicrohttpd from GNU is recommended. You can download the library from ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-latest-w32-bin.zip and extract the files in it to the correct include and library directories in the MSYS2 environment. Alternatively, you may extract the library to a separate directory and set the CPATH and LIBRARY_PATH environment variables to the include and link-library paths, respectively.

macOS

The following development libraries are required.

These libraries can be installed using Homebrew with the following command:

brew install libunistring

However, installing libmicrohttpd from GNU source is recommended. You can download the library source from ftpmirror.gnu.org/libmicrohttpd/libmicrohttpd-latest.tar.gz and compile it with the following commands.

tar -xzf libmicrohttpd-latest.tar.gz
cd libmicrohttpd*
LIBMICROHTTPD_PATH=~/libmicrohttpd # This is where the compiled library and header files are installed. Change the path as neccessary
mkdir -p "$LIBMICROHTTPD_PATH"
./configure --without-gnutls --prefix="$LIBMICROHTTPD_PATH"
make -j4
make install # If you selected a system path above for LIBMICROHTTPD_PATH, this command may need sudo

Then, set the CPATH and LIBRARY_PATH environment variables, respectively, to the include and link-library paths in the directory where libmicrohttpd is installed (value of LIBMICROHTTPD_PATH in above commands). Delete the dylib file in the libmicrohttpd installation if you want to static link libmicrohttpd.


Compiling

  1. Open a terminal / command prompt / Powershell in the project directory

    This can be done using the GUI or the cd command.

  2. Run the following command to make the executable file

    make

    This will generate the executable named clip-share-client (or clip-share-client.exe on Windows).

About

Desktop client for ClipShare

Resources

License

Stars

Watchers

Forks

Contributors 2

  •  
  •