Skip to content

Commit

Permalink
Add support for ObsidianPasteImg on FreeBSD (#615)
Browse files Browse the repository at this point in the history
* feat: Add FreeBSD support to ObsidianPasteImg command

* Update CHANGELOG for auto-check
  • Loading branch information
xorander00 committed Jun 4, 2024
1 parent fda8df4 commit 216e5e8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- Added config option `ui.max_file_length` to disable the UI for files with more than this many lines. Defaults to 5000.
- Added config option `search_max_lines` (defaults to 1000) for controlling the max number of lines read from disk from note files during certain searches.
- Add FreeBSD support to ObsidianPasteImg command.

### Changed

Expand Down
6 changes: 3 additions & 3 deletions lua/obsidian/img_paste.lua
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ local M = {}
local function get_clip_check_command()
local check_cmd
local this_os = util.get_os()
if this_os == util.OSType.Linux then
if this_os == util.OSType.Linux or this_os == util.OSType.FreeBSD then
local display_server = os.getenv "XDG_SESSION_TYPE"
if display_server == "x11" or display_server == "tty" then
check_cmd = "xclip -selection clipboard -o -t TARGETS"
Expand Down Expand Up @@ -39,7 +39,7 @@ local function clipboard_is_img()

-- See: [Data URI scheme](https://en.wikipedia.org/wiki/Data_URI_scheme)
local this_os = util.get_os()
if this_os == util.OSType.Linux then
if this_os == util.OSType.Linux or this_os == util.OSType.FreeBSD then
return vim.tbl_contains(content, "image/png")
elseif this_os == util.OSType.Darwin then
return string.sub(content[1], 1, 9) == "iVBORw0KG" -- Magic png number in base64
Expand All @@ -57,7 +57,7 @@ end
local function save_clipboard_image(path)
local this_os = util.get_os()

if this_os == util.OSType.Linux then
if this_os == util.OSType.Linux or this_os == util.OSType.FreeBSD then
local cmd
local display_server = os.getenv "XDG_SESSION_TYPE"
if display_server == "x11" or display_server == "tty" then
Expand Down

0 comments on commit 216e5e8

Please sign in to comment.