Classification of keystrokes
Looks like you have a classification problem. A simple way to solve this is with a linear regression model. Here is how I would do that with the data you've provided:

1) Determine a "unit" of time, for example 1 minute of keystrokes. Once this process is complete you can tweak the unit of time to see if different intervals give you better results (5 minutes, 10 minutes, etc...)

2) Split all keystrokes into 1 minute chunks, and categorize those chunks as work, study, play, etc... Now you basically have a bunch of character strings that are categorized into activity types.

3) Create variables to describe your chunks. Word count, character count, wpm, # of times "lol" was typed, etc...Get creative.

4) Create a test set and training set of chunks.

5) Create a linear regression model to predict type of activity based upon the variables you created.

This is a pretty simple solution but if you can come up with good variables to distinguish your activity types it can work.