From eaa9d3e7c39c7d887a7a5ae1deb0af3e4bd55abd Mon Sep 17 00:00:00 2001 From: Dylan Donnell Date: Fri, 6 Mar 2026 17:45:24 +0000 Subject: [PATCH 1/2] ci: install dbus packages --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 70df7e2..23bcbe8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -34,7 +34,7 @@ jobs: run: v install vglyph - name: Install C development dependencies (headers and libs) if: runner.os == 'Linux' - run: v retry -- sudo apt -qq update && v retry -- sudo apt install libpango1.0-dev libfontconfig1-dev libfribidi-dev libharfbuzz-dev libfreetype-dev libgl1-mesa-dri xvfb libxcursor-dev libxi-dev libxrandr-dev freeglut3-dev + run: v retry -- sudo apt -qq update && v retry -- sudo apt install libpango1.0-dev libfontconfig1-dev libfribidi-dev libharfbuzz-dev libfreetype-dev libgl1-mesa-dri xvfb libxcursor-dev libxi-dev libxrandr-dev freeglut3-dev dbus libdbus-1-dev libdbus-glib-1-2 libdbus-glib-1-dev - name: Install development dependencies on macos (headers and libs) if: runner.os == 'macOS' run: v retry -- brew install pango harfbuzz freetype2 @@ -68,7 +68,7 @@ jobs: run: v install vglyph - name: Install X11/GL development dependencies (headers and libs) if: runner.os == 'Linux' - run: v retry -- sudo apt -qq update && v retry -- sudo apt install libpango1.0-dev libfontconfig1-dev libfribidi-dev libharfbuzz-dev libfreetype-dev libgl1-mesa-dri xvfb libxcursor-dev libxi-dev libxrandr-dev freeglut3-dev + run: v retry -- sudo apt -qq update && v retry -- sudo apt install libpango1.0-dev libfontconfig1-dev libfribidi-dev libharfbuzz-dev libfreetype-dev libgl1-mesa-dri xvfb libxcursor-dev libxi-dev libxrandr-dev freeglut3-dev dbus libdbus-1-dev libdbus-glib-1-2 libdbus-glib-1-dev - name: Install development dependencies on macos (headers and libs) if: runner.os == 'macOS' run: v retry -- brew install pango harfbuzz freetype2 From c312ce928a0d8d5e1a590844bdb031c9dafe2024 Mon Sep 17 00:00:00 2001 From: Dylan Donnell Date: Fri, 6 Mar 2026 18:25:13 +0000 Subject: [PATCH 2/2] fix: additional clipboard availability detection --- view_text_xtra.v | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/view_text_xtra.v b/view_text_xtra.v index ad467e0..26f9a17 100644 --- a/view_text_xtra.v +++ b/view_text_xtra.v @@ -9,6 +9,7 @@ module gui // import clipboard import encoding.utf8 +import os import vglyph // text_width calculates the width of a given text based on its style and window configuration, @@ -418,21 +419,38 @@ fn collapse_spaces(text string) string { // from_clipboard retrieves text content from the system clipboard and returns // it as a string. Creates a temporary clipboard instance that is automatically -// freed after the paste operation completes. +// freed after the paste operation completes. Returns empty string if clipboard +// is unavailable. pub fn from_clipboard() string { + $if !android && !ios { + if os.getenv('DISPLAY') == '' && os.getenv('WAYLAND_DISPLAY') == '' { + return '' + } + } mut cb := clipboard.new() defer { cb.free() } + if !cb.is_available() { + return '' + } return cb.paste() } // to_clipboard copies the provided string to the system clipboard if a value // is present. Creates a temporary clipboard instance that is automatically // freed after the copy operation completes. Returns true if the copy operation -// was successful, false if the input was none. +// was successful, false if the input was none or clipboard unavailable. pub fn to_clipboard(s ?string) bool { if s != none { + $if !android && !ios { + if os.getenv('DISPLAY') == '' && os.getenv('WAYLAND_DISPLAY') == '' { + return false + } + } mut cb := clipboard.new() defer { cb.free() } + if !cb.is_available() { + return false + } return cb.copy(s) } return false