safeeyes / safeeyes-plugins

Thirdparty plugins for Safe Eyes
http://slgobinath.github.io/SafeEyes/
GNU General Public License v3.0
14 stars 6 forks source link

[SUGGESTION] Curated-list style #2

Open xZero707 opened 6 years ago

xZero707 commented 6 years ago

In my opinion it would be easier, and also more structured to allow adding plugins in curated list style. Example: https://github.com/ziadoz/awesome-php

That way, users can have their own repos which allows much easier maintaining and better structure (hence git history is not mixed/shared between plugins).

Adding a plugin would be simple pull-request just to add it to the list.

You still can keep GPL-3 requirement, and analyze plugins.

One issue might be: What happens if plugin is updated AFTER you reviewed it and added to the list.

slgobinath commented 6 years ago

Sorry I didn't notice this issue. It is a good idea. I can just list them and leave the users to verify before code.

What happens if plugin is updated AFTER you reviewed it and added to the list.

We can offer both. Similar to Ubuntu official PPA. I will list other's plugins in the curated list. This repo will also act as an official repo so that they can send PRs for their stable versions which I can verify and merge. Anyone who cares security should clone from this repo. If they need the latest version, they can clone from developer's repo.

seekM commented 6 years ago

I wrote a plugin which displays the number of keystrokes recorded and the number of minutes actively spent on the computer this day on the break screen. However, it depends on a different (simple) project which does the logging regarding keystrokes and minutes. Due to the dependency I think the plugin's code should not be in this repository, but maybe it could be mentioned in the curated list?

slgobinath commented 6 years ago

@seekM,

+1 for your plugin and I am happy to the first plugin developer :-)

Plugins are allowed to have their own dependency. I like to include this in this repository if you make the following changes:

  1. Create a folder named activity-today or whatever the name you prefer
  2. Move config.json and plugin.py into that folder
  3. You can also have the shell scripts inside that folder
  4. Then I guess you can use relative paths for file_keystrokes and file_minutes
  5. Define any external dependencies you have in config.json shell_commands (https://github.com/seekM/safeeyes-plugin-log-activity/blob/master/config.json#L9). (See smart pause plugin for example https://github.com/slgobinath/SafeEyes/blob/master/safeeyes/plugins/smartpause/config.json#L9). Then if those shell commands are not available, Safe Eyes will warn the user to install them.
  6. Use a name with words separated by space and first letter capitalized in https://github.com/seekM/safeeyes-plugin-log-activity/blob/master/config.json#L3. This is the name displayed in the Settings dialog. (See https://github.com/slgobinath/SafeEyes/blob/master/safeeyes/plugins/smartpause/config.json#L3)
  7. I also recommend using a unique icon for your plugin though it is optional. I recommend using http://fa2png.io/ in which you can select a font awesome icon and export it to png. (Please use a black 24x24 px png icon)

FYI: There are some more lifecycle methods which you can use if you want to execute your scripts beforehand. I couldn't write a proper documentation due to my limited time. However, you may get some ideas by looking at other plugins. I think you may find on_start and on_stop functions useful which are called by Safe Eyes when a user starts safe eyes and when he/she quits safe eyes respectively. (See https://github.com/slgobinath/SafeEyes/blob/master/safeeyes/plugins/smartpause/plugin.py#L135 for more details)

slgobinath commented 6 years ago

Also please have your README file inside the folder you created because that is a good way to introduce the plugin to users. I will add one for the weather plugin I already have here.

slgobinath commented 6 years ago

Hi @seekM,

Please note that your plugin is listed on the readme file (https://github.com/safeeyes/safeeyes-plugins#third-party-plugins). I also have added a README.md to weather plugin and recommend a similar format to maintain the consistency across all plugins.

Thanks

seekM commented 6 years ago

Thanks for your detailed instructions! It's a nice experience to participate. I created a branch on which I will work on the integration. What's currently missing is the on_start function which shall trigger the execution of the two bash scripts when SafeEyes is started. I'm not familar with Python or Thread Safety and not sure if I need the later / the locks. I'll have to take a deeper look into your Smart Pause example. As long as I haven't finished this, I'll leave the master branch as it is now such that your reference in the readme file stays valid.

slgobinath commented 6 years ago

Sounds like a plan. I am now busy with my school. Once I get some time I will also contribute to your plugin :-)