This update get_clipboard_files to work with Linux and default_browser_command to work cross-platform. This lays the groundwork for Bringme to be updated for Linux.
Windows has a clipboard formats CF_HDROP which returns a list of files/folders. There is no equivalent for CF_HDROP in Linux. Files and folders are represented in different ways within the clipboard depending on distribution.
Here's some work I've done for Linux.
get_clipboard_formats uses xclip to grab the available formats contents of the clipboard.
enum_files_from_clipboard clipboard contents that processes begins with file:// or generic lines of output. Then generates a list by processing into unverified absolute file/folder paths.
get_clipboard_files calls enum_files_from_clipboard based on available contents clipboard mime. Then validates file/folder paths effectively emulating win32clipboard.CF_HDROP
default_browser_command to work cross-platform.
How Has This Been Tested
This has been tested on the default windows manager Thunar and Gnome with Ubuntu/Pop_os/Debian.
The function can be called with get_clipboard_files(folders=False) or true. Then make sure to have files/folders in the clipboard.
Description
This update
get_clipboard_files
to work with Linux anddefault_browser_command
to work cross-platform. This lays the groundwork for Bringme to be updated for Linux.Related Issues
https://github.com/dictation-toolbox/Caster/issues/680
Motivation and Context
Windows has a clipboard formats CF_HDROP which returns a list of files/folders. There is no equivalent for
CF_HDROP
in Linux. Files and folders are represented in different ways within the clipboard depending on distribution.Here's some work I've done for Linux.
get_clipboard_formats uses xclip to grab the available formats contents of the clipboard.
enum_files_from_clipboard clipboard contents that processes begins with file:// or generic lines of output. Then generates a list by processing into unverified absolute file/folder paths.
get_clipboard_files calls enum_files_from_clipboard based on available contents clipboard mime. Then validates file/folder paths effectively emulating win32clipboard.CF_HDROP
default_browser_command
to work cross-platform.How Has This Been Tested
This has been tested on the default windows manager Thunar and Gnome with Ubuntu/Pop_os/Debian.
The function can be called with
get_clipboard_files(folders=False
) ortrue
. Then make sure to have files/folders in the clipboard.Types of changes
Checklist
Maintainer/Reviewer Checklist