Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions R/linux_clipboard.R
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@
has_util <- function(util_test) {
if (nzchar(Sys.which(util_test[1]))) {
# If utility is accessible, check that DISPLAY can be opened.
try_res <- tryCatch(system2(util_test[1], util_test[-1], stdout = TRUE, stderr = TRUE),
error = function(c) {
print(c)
return(FALSE)
},
warning = function(c) {
print(c)
return(FALSE)
}
try_res <- tryCatch(
system2(util_test[1], util_test[-1], stdout = TRUE, stderr = FALSE),
error = function(c) {
print(c)
return(FALSE)
},
warning = function(c) {
print(c)
return(FALSE)
}
)

# In the case of an error/warning on trying the function, then the util is
Expand Down Expand Up @@ -41,7 +42,7 @@ has_wl_clipboard <- function() has_wl_paste() & has_wl_copy()
has_wl_paste <- function() has_util(c("wl-paste", "--primary"))

# Determine if system has 'wl-paste' installed
has_wl_copy <- function() has_util(c("wl-copy", "--primary"))
has_wl_copy <- function() has_util(c("wl-copy", "--primary", "clipboard"))

# Stop read/write and return an error of missing clipboard software.
notify_no_cb <- function() {
Expand Down
Loading