Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Gmail sublet file
- # Created with sur-0.2
- require "gmail"
- configure :gmail do |s|
- s.interval = s.config[:interval ] || 120
- s.icon = Subtlext::Icon.new("mail.xbm")
- s.user = s.config[:user]
- s.pass = s.config[:password]
- s.urgent_background = s.config[:urgent_bg]
- s.normal_background = s.config[:sublets_bg]
- s.count = 0
- end
- on :run do |s|
- begin
- gmail = Gmail.new(s.user, s.pass)
- numb = gmail.inbox.count(:unread)
- gmail.logout
- s.count = numb
- if s.count > numb
- # s.background = s.normal_background
- s.data = s.icon + numb
- elsif numb == 0
- # s.background = s.normal_background
- s.data = s.icon + numb
- else
- s.background = s.urgent_background
- s.data = s.icon + numb
- end
- rescue => err # Sanitize to prevent unloading
- s.background = s.urgent_background
- s.data = "error"
- p err
- end
- end
Add Comment
Please, Sign In to add comment