Skip to content

Commit

Permalink
When copying to the clipboard, reset the expire timer
Browse files Browse the repository at this point in the history
  • Loading branch information
danieroux committed Dec 21, 2015
1 parent 0d96892 commit d751c2a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion id-manager.el
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,9 @@
(defvar idm-clipboard-expire-time-sec 5
"Expire time for the clipboard content.")

(defvar idm-clipboard-expire-timer nil
"The timer object that will expire the clipboard content.")

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Macros

Expand Down Expand Up @@ -630,8 +633,11 @@ lines. ORDER is sort key, which can be `time', `name' and `id'."
(idm-set-clipboard-expiry))

(defun idm-set-clipboard-expiry ()
(when idm-clipboard-expire-timer
(cancel-timer idm-clipboard-expire-timer))
(when idm-clipboard-expire-time-sec
(run-at-time idm-clipboard-expire-time-sec nil 'idm-expire-clipboard)))
(setq idm-clipboard-expire-timer
(run-at-time idm-clipboard-expire-time-sec nil 'idm-expire-clipboard))))

(defun idm-expire-clipboard ()
"Clear clipboard"
Expand Down

0 comments on commit d751c2a

Please sign in to comment.