simplified config a bit
This commit is contained in:
@@ -76,46 +76,6 @@ Never falls back to or checks the Emacs kill ring."
|
||||
(message "System clipboard staged to kill ring."))
|
||||
(user-error "System clipboard is empty"))))
|
||||
|
||||
(defun dired-wayland-copy-marked-files ()
|
||||
"Copy marked files in Dired to the Wayland clipboard as text/uri-list."
|
||||
(interactive)
|
||||
(let* ((files (dired-get-marked-files))
|
||||
;; Convert paths to file:// URIs and join with newlines
|
||||
(uri-list (mapconcat (lambda (file) (concat "file://" file)) files "\n")))
|
||||
(when files
|
||||
(let ((process-connection-type nil))
|
||||
(let ((proc (start-process "wl-copy-uri" nil "wl-copy" "-t" "text/uri-list")))
|
||||
(process-send-string proc uri-list)
|
||||
(process-send-eof proc)))
|
||||
(message "Copied %d file(s) to Wayland clipboard." (length files)))))
|
||||
|
||||
(defun dired-wayland-paste-files ()
|
||||
"Paste files from the Wayland clipboard (text/uri-list) into the current Dired directory."
|
||||
(interactive)
|
||||
(let ((default-directory (dired-current-directory)))
|
||||
(with-temp-buffer
|
||||
;; Call wl-paste to get the uri-list
|
||||
(call-process "wl-paste" nil t nil "-t" "text/uri-list")
|
||||
(goto-char (point-min))
|
||||
(let ((files '()))
|
||||
;; Parse file:// URIs line by line
|
||||
(while (re-search-forward "^file://\\(.*\\)$" nil t)
|
||||
(push (match-string 1) files))
|
||||
(if files
|
||||
(progn
|
||||
;; Copy files to the current directory using dired's native copying
|
||||
(dolist (file files)
|
||||
(when (file-exists-p file)
|
||||
(dired-copy-file file default-directory t)))
|
||||
(revert-buffer) ; Refresh dired buffer
|
||||
(message "Pasted %d file(s)." (length files)))
|
||||
(message "No files found in Wayland clipboard."))))))
|
||||
|
||||
;; Bind keys in dired-mode
|
||||
(with-eval-after-load 'dired
|
||||
(define-key dired-mode-map (kbd "Y") #'dired-wayland-copy-marked-files)
|
||||
(define-key dired-mode-map (kbd "P") #'dired-wayland-paste-files))
|
||||
|
||||
(defun my/mc-copy-regions-as-block ()
|
||||
"Copy all active multiple-cursors regions joined by newlines into the kill ring."
|
||||
(interactive)
|
||||
|
||||
Reference in New Issue
Block a user