Adding ruby script to put notmuch inbox/unread count in os x menu bar. Tweaking afew filters
This commit is contained in:
11
afew/config
11
afew/config
@@ -7,6 +7,8 @@
|
||||
#[FolderNameFilter]
|
||||
#folder_blacklist = iocom/INBOX gmail/INBOX gmail/[Gmail].Important gmail/[Gmail].Starred
|
||||
#folder_transforms = Archive:archive Drafts:drafts Sent:sent Trash:trash Builder:builder Info:info Netmon:netmon Spam:spam "gmail/Kara Hetz":"Kara Hetz" "All Mail":archive "gmail/[Gmail].Drafts":drafts "gmail/[Gmail].Sent Mail":sent "Spam":spam "Important":important "gmail/[Gmail].Trash":trash
|
||||
#folder_explicit_list = gmail/
|
||||
#folder_transforms = Archive:archive Drafts:drafts Sent:sent Trash:trash Builder:builder Info:info Netmon:netmon Spam:spam "gmail/Kara Hetz":"Kara Hetz" "All Mail":archive "gmail/[Gmail].Drafts":drafts "gmail/[Gmail].Sent Mail":sent "Spam":spam "Important":important "gmail/[Gmail].Trash":trash
|
||||
# This is getting nasty. Let's just use filters
|
||||
|
||||
[Filter.1]
|
||||
@@ -73,15 +75,12 @@ tags = +bugzilla
|
||||
[InboxFilter]
|
||||
|
||||
[MailMover]
|
||||
folders = iocom/INBOX/ iocom/INBOX.Archive/
|
||||
#max_age = 15
|
||||
folders = iocom/INBOX/ iocom/INBOX.Archive/ gmail/INBOX/
|
||||
max_age = 15
|
||||
|
||||
iocom/INBOX/ = 'NOT tag:inbox':iocom/INBOX.Archive/
|
||||
iocom/INBOX.Archive/ = 'tag:inbox':iocom/INBOX/
|
||||
|
||||
gmail/INBOX = 'NOT tag:inbox':gmail/archive/
|
||||
#gmail/INBOX/ = 'NOT tag:inbox':"gmail/[Gmail].All Mail"
|
||||
#gmail/[Gmail].Important/ = 'NOT tag:inbox':"gmail/[Gmail].All Mail"
|
||||
gmail/INBOX/ = 'NOT tag:inbox':gmail/archive/
|
||||
|
||||
# TODO All folders <-> tags
|
||||
#
|
||||
|
||||
27
bin/notmuch_osx_menubar_count.rb
Executable file
27
bin/notmuch_osx_menubar_count.rb
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
|
||||
|
||||
require "osx/cocoa"
|
||||
include OSX
|
||||
|
||||
class Timer
|
||||
def init
|
||||
tick
|
||||
end
|
||||
def tick(a)
|
||||
count = `notmuch count -- tag:inbox AND tag:unread`
|
||||
foreground = count.to_i > 0 ? NSColor.whiteColor : NSColor.blackColor
|
||||
background = count.to_i > 0 ? NSColor.colorWithSRGBRed_green_blue_alpha(0.8, 0.1, 0.1, 0.6) : NSColor.clearColor
|
||||
dict = NSDictionary.dictionaryWithObjects_forKeys([background, foreground, NSFont.systemFontOfSize(16)], [NSBackgroundColorAttributeName, NSForegroundColorAttributeName, NSFontAttributeName])
|
||||
str = NSAttributedString.alloc().initWithString_attributes("\n ✉ " + count, dict)
|
||||
$statusitem.setAttributedTitle(str)
|
||||
end
|
||||
def click(a)
|
||||
NSLog("hiiii")
|
||||
end
|
||||
end
|
||||
|
||||
app = NSApplication.sharedApplication
|
||||
$statusitem = NSStatusBar.systemStatusBar().statusItemWithLength(NSVariableStatusItemLength)
|
||||
NSTimer.scheduledTimerWithTimeInterval_target_selector_userInfo_repeats(10.0, Timer.new, 'tick:', nil, true)
|
||||
|
||||
app.run
|
||||
Reference in New Issue
Block a user