arbtt
arbtt copied to clipboard
After spending a few hours trying to get arbtt working on windows, feeling very lost, can't tell if this is a bug or if I'm missing something obvious..
Original report by Anonymous.
Hello, I love the idea of arbtt and all the documentation, although sadly I am on Windows 10 and not Linux, so it looks like it's going to be more difficult to use.
I've downloaded the latest windows binary setup file for 0.9.1, and have logged 10h of samples with arbtt-capture.
However, I cannot for the life of me get the tagging to work the way I want it to. I'm thinking this might be because of some bug with the way that windows passes 'active window' strings to arbtt or something, attached is a screenshot of what shows up when I run arbtt-stats. I believe arbtt is pulling full program location names for the windows, but after some searching I couldn't figure out why windows was presenting those titles to arbtt, I also couldn't find any terminal command that would pull up what arbtt was pulling up.
I would really like to get arbtt configured and working correctly, and I've completely scoured multiple search engines looking for other threads or anything but I've come up empty handed, so I'm turning to this issue tracker.
My apologies if I need to resubmit or reformat this because of rules I may have missed, let me know and I can change whatever.
Thanks, Jacob
Original comment by Jacob Ollivier (Bitbucket: [Jacob Ollivier](https://bitbucket.org/Jacob Ollivier), ).
Just noticed I wasn’t logged in, wanted to add the lines I was adding to my categorize.cfg that were bearing no results:
current window $program == "_Device_HarddiskVolume3_Program_Files_Mozilla_Firefox_firefox_exe" ==> tag Web,
current window $program == "pycharm" &&
current window $title =~ /\.py/
==> tag Coding:python,
Also noticed how in categorize.cfg, it looks like both the rules
tag Program:$current.program,
tag Desktop:$desktop,
were shown in arbtt-stats, but
tag Title:$title,
is nowhere to be found.
Original comment by nomeata (Bitbucket: nomeata, GitHub: nomeata).
Oh, windows! I don’t think anyone has tried to use it windows since a decade or so… I am kinda happy to hear that it at least kinda works.
Can you share your full categorize.cfg
file?
Maybe it needs to be tag Title:$current.title
? (in analogy to the working Program
tag?)
Original comment by Jacob Ollivier (Bitbucket: [Jacob Ollivier](https://bitbucket.org/Jacob Ollivier), ).
Thanks for a reply! Yes, I’m on Windows 10 running things through the windows terminal with Cmder.
Here’s my full categorize.cfg
from my last screenshot, mostly the default, with a few additions.
-- -*- 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,
current window $program == "_Device_HarddiskVolume3_Program_Files_Mozilla_Firefox_firefox_exe" ==> tag Web,
current window $title =~ [/.*Hacker News.*/, /.*Less Wrong.*/, /.*reddit.*/, /.*Reddit.*/, /.*GitHub.*/, /.*Ask.fm.*/, /.*Goodreads.*/] ==> tag Graph:communities,
-- A rule that matches on a list of strings
current window $program == ["Navigator","galeon"] ==> tag Web,
current window $program == "sun-awt-X11-XFramePeer" &&
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,
If I add tag Title:$current.title
, it looks like it works somewhat in that I get new tags showing up with some titles:
However no matter how wide I make the window, the formatting remains a bit weird. Commenting out
-- tag Program:$current.program,
seems to leave the same formatting weirdness, along with that same
I’ve also noticed a few other things today:
If I run arbtt-stats --dump-samples
, it doesn’t display which windows are active through ( * )
like it describes in Effective Use of Arbtt.
I was also wondering why I wasn’t getting “a large amount (26586 lines) of hard-to-read output” (also from Effective Use of Arbtt). Instead I notice it reads at the bottom:
<stdout>: commitBuffer: invalid argument (invalid character)
Which through some googling has led me to check my windows ‘locale’ for what kind of character encoding I’m using:
Let me know what you think,
Jacob
Original comment by nomeata (Bitbucket: nomeata, GitHub: nomeata).
It’s good to see that arbtt-stats --dump-samples
shows all the data correctly.
I think when assigning tags, arbtt wants strings without spaces or special characters, hence the _
. The idea is that you don’t just use Program:$title
, but rather set up your rules to match on program name and title, and then assign meaningful tags (like Gaming:Minecraft
).
The formatting weirdness comes from the very long tags that your categorize produces, and it’s trying to format it as a nice table. Once you tweak your rules to produce shorter tags it should work better.
It seems that on windows, $current.program
includes the full path. You can probably use regexes to extract just the executable name, and use that in the tag, for a much nicer view.
I don’t know why the active window isn’t marked. Maybe a shortcoming of the (not very well tested) windows support.
Yes, this invalid argument
issue is annoying. It means that the program tried to print a special character that it can’t print in this locale. Although with these settings (en_GB.UTF-8
) it should work…
Original comment by Jacob Ollivier (Bitbucket: [Jacob Ollivier](https://bitbucket.org/Jacob Ollivier), ).
Those sound like great tips for categorizing the samples, thanks.
I’ve used regexes before in python, but I’m not sure about using them to extract just the name of the executable. Do you have any ideas of how I’d go about doing that?
Looks like the last thing actually preventing me from using arbtt correctly remains to be this weird invalid argument
thing, as I can work around the (*)
active window asterisk problem pretty easily. Do you have any ideas of what might be happening internally, or what I could research that might point me in the right direction?
I appreciate how helpful you’ve been as well, especially with me using an OS that was last tested a decade ago. I’m thinking I’ll be able to make some good progress on the tag making though.
Original comment by nomeata (Bitbucket: nomeata, GitHub: nomeata).
Regex, untested:
current window $program =~ m!.*\\(.*)\.exe! ==> tag Program:$1,
With this invalid argument
, does this work for you: https://stackoverflow.com/a/25373117/946226
Original comment by Jacob Ollivier (Bitbucket: [Jacob Ollivier](https://bitbucket.org/Jacob Ollivier), ).
Yes!! Thank you! Both of those worked perfectly.
Running chcp.com 65001
in my terminal solved that invalid argument
bug, now --dump-samples
and arbtt-stats
print their full output!
Adding your regex to my configuration.cfg
file also led to some good results right off the bat:
The next problem I ran into was in following the next steps of Effective Use, trying to
--dump-samples
and work through the output. There isn’t an | fgrep '(*)'
on windows, but after a little while I’ve found this seems to work: arbtt-stats --dump-samples --filter="$sampleage < 1:00" | findstr "(\*)"
Now I’m going to spend some time figuring out the rules!
Original comment by nomeata (Bitbucket: nomeata, GitHub: nomeata).
Please report back if you eventualy decide to continue using arbtt, then I am more inclined to make windows releases again; there are a few bugfixes since 0.9.1 (see https://arbtt.nomeata.de/doc/users_guide/release-notes.html#release-notes-0.9)
Original comment by Jacob Ollivier (Bitbucket: [Jacob Ollivier](https://bitbucket.org/Jacob Ollivier), ).
I’ve been using it for the last few days and I think I’ve got it mostly functional! A few windows workarounds and powershell commands to get around lack of bash and things like grep and I was able to follow most of the Effective Use doc to get setup. So great to hear you might be more inclined to make more windows releases!
A few questions:
-
I’d like to avoid giving two different samples overlapping tags without having to have both in the same category, is there a way to do this through the use of conditions?
- More specifically, I’d like to designate two samples of the same
$program
but different$title
independent of each other. One I’d like to designate something like “procrastination”, and the other I’d like as a catch-all for browsing, “firefox”. At the moment I believe their tags will overlap and the ‘Percentage’ column inarbtt-stats
won’t be accurate. Is my understanding of how this works here correct?
- More specifically, I’d like to designate two samples of the same
-
I have a rule for ‘tv’ that tracks if the current window matches $program and $title for firefox and tv website strings, however if I
--dump-samples
with and without--also-inactive
I see that some of my tv time is understandably getting lost to inactivity. Is there a way to specify on a single tag the inclusion of inactive samples? -
I also can’t seem to get the
!
operator working correctly, an earlier attempt for a browsing catch-all involved me doing this:
current window $program == "\\Device\\HarddiskVolume3\\Program Files\\Mozilla Firefox\\firefox.exe"
! current window $title =~ [/.*arbtt.*/]
==> tag firefox, -- Firefox catch-all
But that only leads to:
Let me know if you can offer any insight, I have really enjoyed using it so far.
Original comment by nomeata (Bitbucket: nomeata, GitHub: nomeata).
I’d like to avoid giving two different samples overlapping tags without having to have both in the same category, is there a way to do this through the use of conditions?
If you sequence a group of rules with ;
instead of ,
, then it will only use the first matching rule. You can combine such a set with {
… }
. That might help here?
I have a rule for ‘tv’ that tracks if the current window matches $program and $title for firefox and tv website strings, however if I
--dump-samples
with and without--also-inactive
I see that some of my tv time is understandably getting lost to inactivity. Is there a way to specify on a single tag the inclusion of inactive samples?
No, but remember that the tag inactive
is defined by you, probably with something like
$idle > 60 ==> tag inactive,
so you can change when you want to be considered inactive.
Or you pass --also-inactive
to arbtt-stats
when you care about the inactive times as well.
also can’t seem to get the
!
operator working correctly
You might be missing a &&
to combine multiple conditions. Try (untested):
current window $program == "\\Device\\HarddiskVolume3\\Program Files\\Mozilla Firefox\\firefox.exe" &&
! current window $title =~ [/.*arbtt.*/]
==> tag firefox, -- Firefox catch-all