Import/export of categorization rules

The categorization initial setting is nice, but maybe there could be a way for users to share with each other their settings so that one could pick from another user’s configuration. Maybe there could be some sort of profiles for different types of users (programmers, graphic designers, writers, gamers, etc.)

Obviously this would be an opt-in type of feature, privacy first.

Good idea!

Maybe add “profiles” for categorization which you can easily switch between.

Then add the ability to download/export a categorization profile as a file in json format and add the ability to import new ones so they become easy to share.

I would really like the ability to just opt in to send my categories to an anatomized aggregate of classifications. That way the program can suggest rules for you to add based on what other users group window titles together as. Also it could suggest rules to create based on your window history and what the rest of the users have grouped those windows with what categories.


Yes, nice hint. I would use the import/export option mainly for backup my config!

After Firefox decided to do some weird reset thing over night (all my pinned tabs are gone) and I lost all my categories I think this would be a cool feature to have! Keep up the good work!

That’s a great point. We’re currently working on moving the storage of categories to the server, after that we will implement some sort of export/import functionality.


that would be fantastic for lazy people like me :upside_down_face:

would be nice for sharing conf (or a part of) with work team

If you will make “profiles” for categorization, maybe also allow the user to schedule which profile to use for a weekends/weekdays or day/night? Although, the in the Activity Dashboard, we can only view the Activities in Day/Week/Month. So this might require more work, but I’m just sharing an Idea. :slight_smile:

Is there anyone working on this feature?

Here’s a possible implementation for the “profiles” feature tied in with the “export”/“import” feature which gives a lot of flexibility and good UX(I hope):

  1. When you export/import categories, you export/import them for a specific profile. You can have multiple profiles: “personal”, “work”, “aggregate”(provided by ActivityWatch), etc. Export format is standard JSON/YAML. For simplicity, name of the profile can be the name of the file, or maybe users can choose the profile name in the frontend when they are importing.
  2. You can use multiple profiles at the same time. AW will loop through the profiles and try to match an event against rules from first profile, then second, then third, etc. I don’t imagine that the average user will have more than 5 profiles(avg will probably be 2-3), so this should have negligible impact on performance. By default you have an empty “personal” profile first, and the “aggregate/default” profile second so your “personal” rules always override the default/aggregate rules.
  3. Profile management on UI:
    • You can add/delete profiles. You can either add a profile by “importing” it from a document, or by creating it manually on the UI.
    • You can enable/disable profiles, i.e maybe you only want to consider your “work” and “aggregate” profile, but not your “Personal” profile.
    • You can order existing profiles in the order in which you want them to be considered by ActivityWatch.
  4. The “aggregate” profile is a regular profile. It can be stored in the AW github repo, or in the cloud (Google Docs/Dropbox) with shared editing enabled. As an enhancement, AW can check daily if the document has been updated, and then import it if it has. Until then, users can also just import the document themselves, and we can include the link to the document in the settings. My thoughts on where to store the document:
    • Storing in Github repo allows maintainers to ensure that a new rule/category is both useful and has a valid format.
    • Storing on the cloud is a lot more user friendly, and makes it easier to contribute, but runs the risk of users adding rules that are very specific to them, or breaking the document with an invalid structure. You can go around the breaking of the document format by only importing only if the document is valid(check locally), but I’m not sure how we can solve the issue of users adding rules that are too specific and making the “aggregate” document be hundreds of lines long and very complex very quickly.
    • I think Github is the better of the two since it makes it easier to moderate the document.

Further notes: With this implementation, you only need to touch your own profiles (“personal”,“work”,etc), and just periodically sync the “aggregate” profile.

  • If you want to add a rule that’s missing in the “aggregate” profile, you just add it to one of your personal profiles.
  • If you want to override a rule from the “aggregate” profile, you can include it in your personal profiles under the category you want instead.
  • If you want to ignore a rule from the “aggregate” profile, you can just write it in an “ignore” category in your personal profile. This ensures that you never actually need to touch the “aggregate” profile and only need to manage your own.

I don’t think this is a good idea because it’s likely that different profiles will conflict with each other.
Because of that I think it’s better to only allow categorization of a single profile at a time, that way a profile is guaranteed to always work.
I also think the concept becomes quite complicated when you have to consider multiple profiles instead of thinking of the categorization rules of being as a single collection (which in the end it will become once sent to aw-server anyway).

Personally I would like to rearrange my categories and sub-categories as I prefer, having that structure forced on me would make me not want to use it.

You do have a great point though that it’s quite annoying to have to have to maintain regexes and such yourself.
To solve that issue I’d like to instead propose to maintain a list of regexes for applications and then within the web-ui instead of writing your own regex you could simply choose an application in a list (and search if there’s a lot of them). That way it’s easy to use yet does not force a specific category structure onto the user.