arbtt icon indicating copy to clipboard operation
arbtt copied to clipboard

Allow interpolating variables like $date and expressions like (year $date) in strings

Open nomeata opened this issue 10 years ago • 1 comments

Original report by utapyngo (Bitbucket: utapyngo, GitHub: utapyngo).


It would be great if arbtt could produce statistics by day, week, month, and year, using rules like these:

#!haskell

tag $date,
tag (year $date),
tag (month $date), -- should be more elaborate expression to show "January 2014"
tag (week $date), -- same as above, should look like "Week 10 of 2014"

nomeata avatar May 10 '14 13:05 nomeata

Original comment by Maciek Żuk (Bitbucket: [Maciek Żuk](https://bitbucket.org/Maciek Żuk), ).


i made change myself which suited my needs, maybe it will help:

#!diff

--- Categorize.hs	2014-09-08 21:47:00.000000000 +0200
+++ Categorize.hs	2014-11-07 12:31:17.000000000 +0100
@@ -523,6 +523,8 @@
                 return p
 getVar "desktop" ctx = do
                 return $ cDesktop (tlData (cNow ctx))
+getVar "date" ctx = do
+                return (T.pack (formatTime defaultTimeLocale (iso8601DateFormat Nothing) (tlTime (cNow ctx))))
 getVar v ctx = error $ "Unknown variable " ++ v
 
 getNumVar :: String -> CtxFun Integer

nomeata avatar Nov 07 '14 11:11 nomeata