Git Product home page Git Product logo

gedit-wakatime's Introduction

gedit-wakatime

Gedit 3.8+ plugin to quantify your coding at https://wakatime.com

Download

See GitHub releases

Installation

  1. Run the install.py script.

  2. Edit ~/.wakatime.cfg and add your apikey as follows:

    [settings]
    api_key = <your-api-key>
    
  3. Activate the plugin in Gedit Edit > Preferences > Plugins

Note: If your Gedit plugins directory is non-standard pass it to install.py like:

./install.py ~/.gnome2/gedit/plugins/

Screen Shots

Project Overview

Special Thanks

This plugin was contributed by WakaTime community member Ricardo Gemignani.

gedit-wakatime's People

Contributors

ahmubashshir avatar alanhamlett avatar lioman avatar mvolfik avatar rickgemignani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

gedit-wakatime's Issues

Install script internal issues

Hello, I have a few issues regarding the install script. I understand that this plugin is rather small and can't address complex and rare situations during its installations. But I'll list them anyway:

  • Why does it need sudo? It doesn't fail without it, and there shouldn't be a reason for it to - we're only copying files into a folder under ~/.local. If the user decides to use a different directory for plugins and root privileges are required for that, he will most likely know himself that he needs sudo

  • pip, WakaTime CLI installation

    • pip shouldn't be used by importing. Replace with subprocess
    • wakatime presence is detected by importing, but always used as subprocess. This also broke in my case, as I had WakaTime CLI installed with pipx โ€“ in an isolated environment, and only a special wakatime executable is placed in ~/.local/bin. However, it's not available for import, so the install script didn't detect it, and installed it again with pip, overwriting the executable.
    • The CLI should probably be updated at some point too,
  • Gedit version detection. Currently, there's hardcoded version 3. I found two places where I could get some versions โ€“ gi.__version__ gives me 3.36.0, gi._versions["Gedit"] gives 3.0. But my Gedit shows 3.36.2.

Please help me

I could not find the wakatime.cfg
Operating System: Ubuntu

ModuleNotFoundError: No module named 'wakatime'

env

pip --version
pip 19.2.1 from /usr/local/lib/python3.6/dist-packages/pip (python 3.6)
python --version
Python 3.6.8

install.py

host:~/download/gedit-wakatime-1.0.1
@user $ sudo ./install.py 
Traceback (most recent call last):
  File "./install.py", line 32, in check_wakatime
    import wakatime
ModuleNotFoundError: No module named 'wakatime'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "./install.py", line 56, in <module>
    install()
  File "./install.py", line 45, in install
    check_wakatime()
  File "./install.py", line 37, in check_wakatime
    pip.main(['install', 'wakatime'])
AttributeError: module 'pip' has no attribute 'main'

[BUG] Doesn't work on Gedit 40.0

Gedit 40.0 removed a few properties and methods, so it didn't send heartbeat to wakatime for last 7 days.

diff --git a/gedit_wakatime/plugin.py b/gedit_wakatime/plugin.py
index ee2335f..7e11c19 100644
--- a/gedit_wakatime/plugin.py
+++ b/gedit_wakatime/plugin.py
@@ -43,15 +43,15 @@ class WakatimePlugin(GObject.Object, Gedit.WindowActivatable):
       if doc not in _documents:
           _documents.append(doc)
           doc.connect('saved', self.on_document_saved)
-            doc.connect('cursor-moved', self.on_document_changed)
+            doc.connect('tepl-cursor-moved', self.on_document_changed)
 
   def on_document_saved(self, document, data=None):
-        file_uri = document.get_uri_for_display()
+        file_uri = document.get_file ().get_location ().get_path ()
       logger.debug('Document saved: {}'.format(file_uri))
       send_heartbeat(file_uri, write=True)
 
   def on_document_changed(self, document, data=None):
-        file_uri = document.get_uri_for_display()
+        file_uri = document.get_file ().get_location ().get_path ()
       logger.debug('Document changed: {}'.format(file_uri))
       send_heartbeat(file_uri)

<- this patch fixed the plugin.

Feat: Consider using python3-setuptools instead of install.py

Hello there,

I'm an Ubuntu/Debian Contributor (sort of). I think packaging this would be cool, and I would LOVE to do it but I have an idea:

For this gedit plugin we're using a self-made install.py script. It may be better to use what most gedit plugins use, python3-setuptools. While upstream GNOME Gedit plugin repo's aren't made this way, for Debian packaging it would be a) much nicer and b) easier to use. A few examples of this is in Nemo, an alternative to GNOME's Nautilus for Cinnamon's extensions repo, which has lots of python plugins and each of them have setuptools python files. (example: nemo-compare)

With debian pacakging tools such as dh_python3 this makes things a lot easier.

I'll probably open a PR for this but I thought I should open this for discussion first.

trying install

Ubuntu 14.04

sudo python ~/gedit-wakatime-master/install.py 
Traceback (most recent call last):
  File "/home/username/gedit-wakatime-master/install.py", line 38, in <module>
    except PermissionError:
NameError: name 'PermissionError' is not defined

What should I do?

fedora 25 uses /usr/lib64/gedit/plugins

Hi,

I just found out that fedora 25 does not use /usr/lib/gedit/plugins but /usr/lib64/gedit/plugins. I moved the files and it is now available at the plugins list of gedit.

Thanks!

Not working

Ubuntu Linux 22.04.1 LTS
gedit-wakatime-2.0.1
Gedit 21.0

  1. Added and saved .wakatime.cfg in home folder:
[settings]
api_key = mykeyhere
  1. Ran install script.
  2. Plugin appeared in Gedit plugins menu OK.
  3. Enabled plugin.
  4. Restarted couple of times.
  5. Used Gedit for good while.
  6. No statistics

I get statistics from Rider, Chrome, and Obsidian - no problem.

Nothing from Gedit.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.