Reputation: 464
I'm new to this so bear with me but I'm trying to do a rule that splits out my time on Firefox tabs using arbtt v0.7 in categorize.cfg:
-- Firefox
current window ($program == "Navigator") ==>
if $title =~ /^(.*) - (.*@.*) - .* Mail - Mozilla Firefox$/ then tag Email:$2-$1 else
if $title =~ /^(.*) - Calendar - Mozilla Firefox$/ then tag Calendar:$1 else
if $title =~ /^(.*) - Mozilla Firefox$/ then tag Firefox:$1 else
tag Firefox,
But I get:
Parser error: "/home/rich/.arbtt/categorize.cfg" (line 29, column 3): unexpected "i" expecting "else"
I have also tried another approach with more success:
current window ( $program == "Navigator" && $title =~ /^(.*) - (.*@.*) - .* Mail - Mozilla Firefox$/ )
==> tag Email:$2-$1,
current window ( $program == "Navigator" && $title =~ /^(.*) - Calendar - Mozilla Firefox$/ )
==> tag Calendar:$1,
current window ( $program == "Navigator" && $title =~ /^((?!.*\b(Calendar|Mail)\b)) - Mozilla Firefox$/ )
==> tag Firefox:$1,
But the last clause doesn't return any results; the first two clauses do.
Cheers, Rich
Upvotes: 2
Views: 316
Reputation: 25782
It looks like a bug in arbtt
; I agree that your code looks correct.
But anyways, it might be more idiomatic to use the ;
operator, which means “Try the first thing, and if it does not assign a tag, try the second thing”:
current window ($program == "Navigator") ==>
{ $title =~ /^(.*) - (.*@.*) - .* Mail - Mozilla Firefox$/ ==> tag Email:$2-$1;;
$title =~ /^(.*) - Calendar - Mozilla Firefox$/ ==> tag Calendar:$1;
$title =~ /^(.*) - Mozilla Firefox$/ ==> tag Firefox:$1;
tag Firefox },
(The ;;
is because of another bug in the parser – guess that part hasn’t been used a lot yet.)
In your second attempt, there is simply a problem with the regex: It should be /^(?!.*\b(Calendar|Mail)\b)(.*) - Mozilla Firefox$/
– (?!...)
is a zero-width pattern.
Upvotes: 1