pauldub / activity-watch-mode

Emacs plugin for automatic time tracking and metrics generated from your programming activity.
https://activitywatch.net
70 stars 9 forks source link

Disable mode for Tramp sessions #16

Open bkaczynski opened 4 years ago

bkaczynski commented 4 years ago

Is it possible to have enabled global-activity-watch-mode and disable it only for tramp sessions?

I have something like this, but it's doesn't work: (use-package activity-watch-mode :load-path (lambda () (when (file-remote-p default-directory) (global-activity-watch-mode nil)))) :config (global-activity-watch-mode t))

pauldub commented 4 years ago

Hi, I think it should be possible by hooking into find-file-hook and disabling activity watch:

(defun disable-activity-watch-tramp ()
  (when (and (buffer-file-name) (file-remote-p (buffer-file-name)))
    (activity-watch-mode nil)))

(add-hook 'find-file-hook 'disable-activity-watch-tramp)

Note that I have not tested this snippet but it can be a starting point.