Skip to content

Commit 216e5e8

Browse files
authored
Add support for ObsidianPasteImg on FreeBSD (#615)
* feat: Add FreeBSD support to ObsidianPasteImg command * Update CHANGELOG for auto-check
1 parent fda8df4 commit 216e5e8

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111

1212
- Added config option `ui.max_file_length` to disable the UI for files with more than this many lines. Defaults to 5000.
1313
- 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.
14+
- Add FreeBSD support to ObsidianPasteImg command.
1415

1516
### Changed
1617

lua/obsidian/img_paste.lua

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ local M = {}
1111
local function get_clip_check_command()
1212
local check_cmd
1313
local this_os = util.get_os()
14-
if this_os == util.OSType.Linux then
14+
if this_os == util.OSType.Linux or this_os == util.OSType.FreeBSD then
1515
local display_server = os.getenv "XDG_SESSION_TYPE"
1616
if display_server == "x11" or display_server == "tty" then
1717
check_cmd = "xclip -selection clipboard -o -t TARGETS"
@@ -39,7 +39,7 @@ local function clipboard_is_img()
3939

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

60-
if this_os == util.OSType.Linux then
60+
if this_os == util.OSType.Linux or this_os == util.OSType.FreeBSD then
6161
local cmd
6262
local display_server = os.getenv "XDG_SESSION_TYPE"
6363
if display_server == "x11" or display_server == "tty" then

0 commit comments

Comments
 (0)