-
Notifications
You must be signed in to change notification settings - Fork 36
/
Copy pathcategorize.cfg
134 lines (109 loc) · 5.18 KB
/
categorize.cfg
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
-- -*- mode: haskell; -*-
-- Comments in this file use the Haskell syntax:
-- A "--" comments the rest of the line.
-- A set of {- ... -} comments out a group of lines.
-- This defines some aliases, to make the reports look nicer:
aliases (
"sun-awt-X11-XFramePeer" -> "java",
"sun-awt-X11-XDialogPeer" -> "java",
"sun-awt-X11-XWindowPeer" -> "java",
"gramps.py" -> "gramps",
"___nforschung" -> "ahnenforschung",
"Pidgin" -> "pidgin"
)
-- A rule that probably everybody wants. Being inactive for over a minute
-- causes this sample to be ignored by default.
$idle > 60 ==> tag inactive,
-- A rule that matches on a list of strings
current window $program == ["Navigator","galeon"] ==> tag Web,
-- Use condition bindings to reduce duplication
condition isJava = current window $program ==
["sun-awt-X11-XFramePeer", "sun-awt-X11-XDialogPeer", "sun-awt-X11-XWindowPeer"]
in $isJava && current window $title == "I3P" ==> tag Program:I3P,
current window $program == "sun-awt-X11-XDialogPeer" &&
current window $title == " " &&
any window $title == "I3P"
==> tag Program:I3P,
-- Simple rule that just tags the current program
tag Program:$current.program,
-- Another simple rule, just tags the current desktop (a.k.a. workspace)
tag Desktop:$desktop,
-- I'd like to know what evolution folders I'm working in. But when sending a
-- mail, the window title only contains the (not very helpful) subject. So I do
-- not tag necessarily by the active window title, but the title that contains
-- the folder
current window $program == "evolution" &&
any window ($program == "evolution" && $title =~ /^(.*) \([0-9]+/)
==> tag Evo-Folder:$1,
-- A general rule that works well with gvim and gnome-terminal and tells me
-- what project I'm currently working on
current window $title =~ m!(?:~|home/jojo)/projekte/(?:programming/(?:haskell/)?)?([^/)]*)!
==> tag Project:$1,
current window $title =~ m!(?:~|home/jojo)/debian!
==> tag Project:Debian,
-- This was a frequently looked-at pdf-File
current window $title =~ m!output.pdf! &&
any window ($title =~ /nforschung/)
==> tag Project:ahnenforschung,
-- My diploma thesis is in a different directory
current window $title =~ [ m!(?:~|home/jojo)/dokumente/Uni/DA!
, m!Diplomarbeit.pdf!
, m!LoopSubgroupPaper.pdf! ]
==> tag Project:DA,
current window $title =~ m!TDM!
==> tag Project:TDM,
( $date >= 2010-08-01 &&
$date <= 2010-12-01 &&
( current window $program == "sun-awt-X11-XFramePeer" &&
current window $title == "I3P" ||
current window $program == "sun-awt-X11-XDialogPeer" &&
current window $title == " " &&
any window $title == "I3P" ||
current window $title =~ m!(?:~|home/jojo)/dokumente/Uni/SA! ||
current window $title =~ m!Isabelle200! ||
current window $title =~ m!isar-ref.pdf! ||
current window $title =~ m!document.pdf! ||
current window $title =~ m!outline.pdf! ||
current window $title =~ m!Studienarbeit.pdf! )
) ==> tag Project:SA,
-- Out of curiosity: what percentage of my time am I actually coding Haskell?
current window ($program == "gvim" && $title =~ /^[^ ]+\.hs \(/ )
==> tag Editing-Haskell,
{-
-- Example of time-related rules. I do not use these myself.
-- To be able to match on the time of day, I introduce tags for that as well.
-- $time evaluates to local time.
$time >= 2:00 && $time < 8:00 ==> tag time-of-day:night,
$time >= 8:00 && $time < 12:00 ==> tag time-of-day:morning,
$time >= 12:00 && $time < 14:00 ==> tag time-of-day:lunchtime,
$time >= 14:00 && $time < 18:00 ==> tag time-of-day:afternoon,
$time >= 18:00 && $time < 22:00 ==> tag time-of-day:evening,
$time >= 22:00 || $time < 2:00 ==> tag time-of-day:late-evening,
-- This tag always refers to the last 24h
$sampleage <= 24:00 ==> tag last-day,
-- To categorize by calendar periods (months, weeks, or arbitrary periods),
-- I use $date variable, and some auxiliary functions. All these functions
-- evaluate dates in local time. Set TZ environment variable if you need
-- statistics in a different time zone.
-- You can compare dates:
$date >= 2001-01-01 ==> tag this_century,
-- You have to write them in YYYY-MM-DD format, else they will not be recognized.
-- “format $date” produces a string with the date in ISO 8601 format
-- (YYYY-MM-DD), it may be compared with strings. For example, to match
-- everything on and after a particular date I can use
format $date =~ /.*-03-19/ ==> tag period:on_a_special_day,
-- but note that this is a rather expensive operation and will slow down your
-- data processing considerably.
-- “day of month $date” gives the day of month (1..31),
-- “day of week $date” gives a sequence number of the day of week
-- (1..7, Monday is 1):
(day of month $date == 13) && (day of week $date == 5) ==> tag day:friday_13,
-- “month $date” gives a month number (1..12), “year $date” gives a year:
month $date == 1 ==> tag month:January,
month $date == 2 ==> tag month:February,
year $date == 2010 ==> tag year:2010,
-- “$now” evaluates to the current time
day of month $now == day of month $date ==> tag current-day,
month $now == month $date ==> tag current-month,
year $now == year $date ==> tag current-year,
-}