├── README.md ├── background.coffee ├── battery.coffee ├── date.coffee ├── mail.coffee ├── morning.coffee ├── reminders.coffee ├── screenshot.png ├── screenshots ├── screenshot.png ├── screenshot2.png ├── screenshot3.png └── screenshot4.png ├── spotify.coffee ├── time.coffee ├── weather.coffee └── weatherscript.py /README.md: -------------------------------------------------------------------------------- 1 | # Ubersicht-BetterBar-widget 2 | 3 | The original is by [Herrbischoff](https://github.com/herrbischoff/nerdbar.widget) - Check it out! 4 | 5 | This is my betterbar widget pack cobbled together from a lot of other widgets and lovingly assembled by me. It's made for [Übersicht](http://tracesof.net/uebersicht/) and displays a lot of information in a compact bar. 6 | 7 | ![betterbar](./screenshots/screenshot.png) 8 | 9 | ## Installation 10 | Place "Betterbar-master" in the **Übersicht Widget Directory** or if you want to only install one or a few of the widgets, just remove them from "Betterbar-master" and put them in the Widget Directory. 11 | 12 | This bar also pairs pretty well with [kwm](https://github.com/koekeishiya/kwm). 13 | 14 | ### So what can each widget do? 15 | 16 | ![closeup](./screenshots/screenshot2.png) 17 | 18 | #### - background.coffee 19 | 20 | This is simply the dark bar going across the screen - this is identical to the one found in nerdbar 21 | 22 | #### - battery.coffee 23 | 24 | ![battery](./screenshots/screenshot3.png) 25 | 26 | This is the battery widget. It will display the percentage of charge your MacBook has left and has a little visual indicator for how much charge is left i.e. the battery icon slowly empties and at critical battery it will turn red. Along with this - when your battery is on charge it will change to a blue charging icon to let you know. 27 | 28 | The code for this widget is made from multiple others - the first being the one included in Herrbischoff's bar, then the colours and icon from Apierz' bar and finally the charging state function was found in [bcseda's BatteryCharge Widget](https://github.com/bcseda/BatteryCharge). 29 | 30 | #### - date.coffee/time.coffee 31 | 32 | Pretty self explanatory, shows the time and date along with cute little icons. 33 | 34 | #### - mail.coffee/reminders.coffee 35 | 36 | These will show you how many reminders and emails you have that are uncompleted/unread - at the moment they only work with the default reminders.app and mail.app. 37 | 38 | #### - spotify.coffee 39 | 40 | ![spotify](./screenshots/screenshot4.png) 41 | 42 | Shows the current playing song on Spotify - can be adjusted to also work with other music players but not in a very user-friendly way. 43 | 44 | Thanks to [levifig for their spotify widget here](https://github.com/levifig/now-playing.widget) which I used some of the code from to create this widget. 45 | 46 | #### - weather.coffee 47 | 48 | This shows the current weather according to your location - this is near enough a direct copy of the one [Apierz made here](https://github.com/apierz/nerdbar.widget) (Go check out their version of this bar, it's what partially inspired me to create this one!) - It's just changed to use celcius instead of fahrenheit.
49 | You will need to go to that repository in order to get the python script for getting the weather. 50 | 51 | #### - morning.coffee 52 | 53 | This is just a friendly little widget that says good morning/afternoon/evening to you and says your name (provdied you enter it - otherwise it'll say my name). 54 | 55 | This widget is derived from the [Morning widget by imRohan](https://github.com/imRohan/ubersicht-morning.widget). 56 | 57 | ### To do 58 | 59 | * Make improvements to the morning.coffee widget 60 | * Add launch functionality by clicking icons 61 | * Create imessage widget to display unread messages 62 | 63 | I use [Hack](http://sourcefoundry.org/hack/) typeface for the main text using Osaka-Mono.
[FontAwesome](http://fontawesome.io) for the icons and [All-the-icons](https://github.com/domtronn/all-the-icons.el) for the weather icons.
64 | (You'll need these installed for stuff to work). 65 | -------------------------------------------------------------------------------- /background.coffee: -------------------------------------------------------------------------------- 1 | refreshFrequency: false 2 | 3 | render: (output) -> 4 | "" 5 | 6 | style: """ 7 | top: 0 8 | left: 0 9 | height: 20px 10 | width: 100% 11 | background-color: #171717 12 | opacity: 0.9 13 | z-index: -1 14 | """ 15 | -------------------------------------------------------------------------------- /battery.coffee: -------------------------------------------------------------------------------- 1 | command: "pmset -g batt | grep \"%\" | awk 'BEGINN { FS = \";\" };{ print $3,$2 }' | sed -e 's/-I/I/' -e 's/-0//' -e 's/;//' -e 's/;//'" 2 | 3 | refreshFrequency: 1000 # ms 4 | 5 | render: (output, domEl) -> 6 | 7 | values = output.split(' ') 8 | state = values[0] 9 | batnum = parseInt(values[1]); 10 | 11 | if state != 'discharging' and batnum >= 90 12 | htmlString = "#{batnum}%" 13 | else if state != 'discharging' and batnum >= 50 and batnum < 90 14 | htmlString = "#{batnum}%" 15 | else if state != 'discharging' and batnum < 50 and batnum >= 15 16 | htmlString = "#{batnum}%" 17 | else if state != 'discharging' and batnum < 15 18 | htmlString = "#{batnum}%" 19 | else if batnum >= 90 20 | htmlString = "#{batnum}%" 21 | else if batnum >= 50 and batnum < 90 22 | htmlString = "#{batnum}%" 23 | else if batnum < 50 and batnum >= 15 24 | htmlString = "#{batnum}%" 25 | else if batnum < 15 26 | htmlString = "#{batnum}%" 27 | 28 | style: """ 29 | -webkit-font-smoothing: antialiased 30 | font: 11px Osaka-Mono 31 | top: 5px 32 | right: 142px 33 | color: #FABD2F 34 | .green 35 | color: #7bc275 36 | .yellow 37 | color: #FABD2F 38 | .red 39 | color: #ff665c 40 | .blue 41 | color: #00b3ef 42 | .icon 43 | font: 11px fontawesome 44 | .charging 45 | color: #FFFFFF 46 | position: relative 47 | font: 8px fontawesome 48 | top: -1px 49 | right: -11px 50 | 51 | i { 52 | font-size: 80% 53 | } 54 | """ 55 | -------------------------------------------------------------------------------- /date.coffee: -------------------------------------------------------------------------------- 1 | command: "date +\"%a %d %b\"" 2 | 3 | refreshFrequency: 10000 4 | 5 | render: (output) -> 6 | htmlString = "#{output} """ 28 |
29 | """ 30 | 31 | update: (numberOfUnreadMails, domEl) -> 32 | $(domEl).find('.mail-count').html(" Mail: #{numberOfUnreadMails}") 33 | -------------------------------------------------------------------------------- /morning.coffee: -------------------------------------------------------------------------------- 1 | # Lovingly crafted by Rohan Likhite [rohanlikhite.com] 2 | 3 | command: "finger `whoami`" 4 | 5 | 6 | #Refresh time (default: 1/2 minute 30000) 7 | refreshFrequency: (1000 * 60) 8 | 9 | 10 | #Body Style 11 | style: """ 12 | 13 | top: 5px 14 | left: 6px 15 | width: 1000px 16 | 17 | .text 18 | -webkit-font-smoothing: antialiased 19 | color: #458588 20 | font: 11px Osaka-Mono 21 | .icon 22 | font: 11px fontawesome 23 | color: grey 24 | 25 | """ 26 | 27 | #Render function 28 | render: -> """ 29 |
30 | 31 | 32 |
33 | 34 | """ 35 | 36 | #Update function 37 | update: (output, domEl) -> 38 | 39 | #Time Segmends for the day 40 | segments = ["morning", "afternoon", "evening", "night"] 41 | segmentsalt = ["Test", "Test2"] 42 | #Grab the name of the current user. 43 | #If you would like to edit this, replace "output.split(' ')" with your name 44 | name = "Jack" 45 | 46 | #Creating a new Date object 47 | date = new Date() 48 | hour = date.getHours() 49 | 50 | #timeSegment logic 51 | timeSegment = segments[0] if 4 < hour <= 11 52 | timeSegment = segments[1] if 11 < hour <= 17 53 | timeSegment = segments[2] if 17 < hour <= 24 54 | timeSegment = segments[3] if hour <= 4 55 | 56 | #DOM manipulation 57 | $(domEl).find('.salutation').html("  Good #{timeSegment}, Jack.") 58 | -------------------------------------------------------------------------------- /reminders.coffee: -------------------------------------------------------------------------------- 1 | command: "osascript -e 'tell application \"Reminders\" to set reminderCount to count of (reminders whose completed is false)'" 2 | 3 | refreshFrequency: 120000 4 | 5 | style: """ 6 | -webkit-font-smoothing: antialiased 7 | top: 5px 8 | right: 260px 9 | color: #FABD2F 10 | font: 11px Osaka-Mono 11 | 12 | div 13 | display: block 14 | text-shadow: 0 0 1px rgba(#000, 0.5) 15 | font-size: 11px 16 | font-weight: 100 17 | 18 | .reminders 19 | color: #D5C4A1 20 | 21 | .icon 22 | font: 11px fontawesome 23 | color: #FABD2F 24 | 25 | """ 26 | 27 | 28 | render: -> """ 29 |
30 | """ 31 | 32 | update: (reminderCount, domEl) -> 33 | $(domEl).find('.reminder-count').html("Reminders: #{reminderCount}") 34 | -------------------------------------------------------------------------------- /screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/J-Mills/Betterbar/6158b8d7ff9b8b53b26a3c5df1411b0c98820f91/screenshot.png -------------------------------------------------------------------------------- /screenshots/screenshot.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/J-Mills/Betterbar/6158b8d7ff9b8b53b26a3c5df1411b0c98820f91/screenshots/screenshot.png -------------------------------------------------------------------------------- /screenshots/screenshot2.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/J-Mills/Betterbar/6158b8d7ff9b8b53b26a3c5df1411b0c98820f91/screenshots/screenshot2.png -------------------------------------------------------------------------------- /screenshots/screenshot3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/J-Mills/Betterbar/6158b8d7ff9b8b53b26a3c5df1411b0c98820f91/screenshots/screenshot3.png -------------------------------------------------------------------------------- /screenshots/screenshot4.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/J-Mills/Betterbar/6158b8d7ff9b8b53b26a3c5df1411b0c98820f91/screenshots/screenshot4.png -------------------------------------------------------------------------------- /spotify.coffee: -------------------------------------------------------------------------------- 1 | command: """ 2 | read -r running <<<"$(ps -ef | grep \"MacOS/Spotify\" | grep -v \"grep\" | wc -l)" && 3 | test $running != 0 && 4 | IFS='|' read -r theArtist theName theState <<<"$(osascript <<<'tell application "Spotify" 5 | set theTrack to current track 6 | set theArtist to artist of theTrack 7 | set theName to name of theTrack 8 | set theState to player state as string 9 | return theArtist & "|" & theName & "|" & theState 10 | end tell')" && 11 | echo "$theArtist -$theName" || echo "Not Connected To Spotify" 12 | """ 13 | 14 | refreshFrequency: 60000 15 | 16 | style: """ 17 | -webkit-font-smoothing: antialiased 18 | text-align: center 19 | top: 5px 20 | left: 25% 21 | color: #d5c4a1 22 | width: 50% 23 | 24 | .text 25 | height: 16px 26 | color: #9C9486 27 | font-family: Osaka-Mono 28 | font-size: 11px 29 | 30 | .title 31 | color: #d5c4a1 32 | margin-right: 5px 33 | 34 | .artist 35 | color: #d5c4a1 36 | opacity: 0.8; 37 | .icon 38 | color: green 39 | font: 11px fontawesome 40 | """ 41 | 42 | render: (output) -> """ 43 |
44 |
#{output}
45 |
46 | """ 47 | -------------------------------------------------------------------------------- /time.coffee: -------------------------------------------------------------------------------- 1 | command: "date +\"%H:%M\"" 2 | 3 | refreshFrequency: 10000 # ms 4 | 5 | render: (output) -> 6 | htmlString = "#{output}" 7 | 8 | style: """ 9 | -webkit-font-smoothing: antialiased 10 | color: #458588 11 | font: 11px Osaka-Mono 12 | right: 10px 13 | top: 5px 14 | .icon 15 | font: 11px fontawesome 16 | """ 17 | -------------------------------------------------------------------------------- /weather.coffee: -------------------------------------------------------------------------------- 1 | command: "/usr/local/bin/python3 ~/.kwm/scripts/weatherscript.py 2>/dev/null" 2 | 3 | refreshFrequency: 10000 # ms 4 | 5 | render: (output, domEl) -> 6 | 7 | values = output.split('@', 2); 8 | temp = values[0]; 9 | condition = values[1]; 10 | tempnum = parseInt(temp); 11 | connum = parseInt(condition); 12 | celciustemp = Math.round((parseInt(temp) - 32) * (5/9)); 13 | 14 | htmlString = "" 15 | 16 | #add temp to htmlString 17 | 18 | if tempnum >= 90 19 | htmlString += " #{celciustemp}° " + htmlString; 20 | if tempnum < 90 and tempnum >= 65 21 | htmlString += " #{celciustemp}° " + htmlString; 22 | if tempnum < 65 23 | htmlString += " #{celciustemp}° " + htmlString; 24 | 25 | # Tornados and Hurricanes 26 | if connum <= 2 27 | htmlString = "" + htmlString; 28 | #Thunderstorms 29 | if connum > 2 and connum <= 4 30 | htmlString = "" + htmlString; 31 | #Freezing Rain / Sleet 32 | if (connum >= 5 and connum <= 8) or connum == 10 or connum == 18 33 | htmlString = "" + htmlString; 34 | #Drizzle 35 | if connum == 9 36 | htmlString = "" + htmlString; 37 | #Rain 38 | if connum == 11 or connum == 12 39 | htmlString = "" + htmlString; 40 | #Snow 41 | if connum >= 13 and connum <= 16 42 | htmlString = "" + htmlString; 43 | #Hail 44 | if connum == 17 45 | htmlString = "" + htmlString; 46 | #Dust, fog, haze, etc 47 | if connum >= 19 and connum <= 22 48 | htmlString = "" + htmlString; 49 | # Windy 50 | if connum == 23 or connum == 24 51 | htmlString = "" + htmlString; 52 | #cold 53 | if connum == 25 54 | htmlString = "" + htmlString; 55 | #cloudy 56 | if connum == 26 57 | htmlString = "" + htmlString; 58 | #mostly cloudy (night) 59 | if connum == 27 60 | htmlString = "" + htmlString; 61 | #mostly cloudy (day) 62 | if connum == 28 63 | htmlString = "" + htmlString; 64 | #partly cloudy (night) 65 | if connum == 29 66 | htmlString = ">" + htmlString; 67 | #partly cloudy (day) 68 | if connum == 30 69 | htmlString = "" + htmlString; 70 | # clear night 71 | if connum == 31 72 | htmlString = "" + htmlString; 73 | #Sunny 74 | if connum == 32 75 | htmlString = "" + htmlString; 76 | #Fair, night 77 | if connum == 33 78 | htmlString = "" + htmlString; 79 | #Fair, day 80 | if connum == 34 81 | htmlString = "" + htmlString; 82 | # mixed rain and hail 83 | if connum == 35 84 | htmlString = "" + htmlString; 85 | #hot 86 | if connum == 36 87 | htmlString = "" + htmlString; 88 | #thunder storms 89 | if connum >= 37 and connum <= 39 90 | htmlString = "" + htmlString; 91 | #scattered showers 92 | if connum == 40 93 | htmlString = "" + htmlString; 94 | # snow 95 | if connum >= 41 and connum <=43 96 | htmlString = "" + htmlString; 97 | #partly cloudy 98 | if connum == 44 99 | htmlString = "" + htmlString; 100 | #thunder showers 101 | if connum == 45 102 | htmlString = "" + htmlString; 103 | #snow showers 104 | if connum == 46 105 | htmlString = "" + htmlString; 106 | # isolated thundershowers 107 | if connum == 47 108 | htmlString = "" + htmlString; 109 | #Adding the wifi symbol 110 | if connum isnt 99 111 | htmlString += "  "; 112 | if connum is 99 113 | htmlString = "  "; 114 | else 115 | htmlString += ""; 116 | 117 | 118 | style: """ 119 | -webkit-font-smoothing: antialiased 120 | font: 11px Osaka-Mono 121 | top: 2px 122 | right: 347px 123 | color: #D5C4A1 124 | .icon 125 | font: 11px fontawesome 126 | .move 127 | position: relative 128 | top: 3px 129 | .weather 130 | font: 11px WeatherIcons-Regular 131 | .blue 132 | color: #00b3ef 133 | .cyan 134 | color: #46d9ff 135 | .grey 136 | color: #b5babf 137 | .white 138 | color: #eeeeee 139 | .green 140 | color: #7bc275 141 | .yellow 142 | color: #ecbe7b 143 | .red 144 | color: #ff665c 145 | """ 146 | -------------------------------------------------------------------------------- /weatherscript.py: -------------------------------------------------------------------------------- 1 | #! /usr/local/bin/python3 2 | 3 | import json 4 | import urllib.request 5 | 6 | def check_connectivity(reference): 7 | try: 8 | urllib.request.urlopen(reference, timeout=1) 9 | return True 10 | except urllib.request.URLError: 11 | return False 12 | except Exception: 13 | pass 14 | 15 | def main(): 16 | if check_connectivity("http://www.google.co.uk") == True: 17 | loc_json = "http://ip-api.com/json" 18 | loc_result = urllib.request.urlopen(loc_json).read() 19 | loc_data = json.loads(loc_result.decode()) 20 | latitude = str(loc_data['lat']) 21 | longitude = str(loc_data['lon']) 22 | city = loc_data['city'] 23 | region = loc_data['region'] 24 | # print(city + region) 25 | 26 | baseurl = "https://query.yahooapis.com/v1/public/yql?" 27 | yql_query = 'SELECT item.condition FROM weather.forecast where woeid in (SELECT woeid FROM geo.places(1) WHERE text="'+ city + ', ' + region + '")' 28 | yql_url = baseurl + urllib.parse.urlencode({'q':yql_query}) + "&format=json" 29 | result = urllib.request.urlopen(yql_url).read() 30 | data = json.loads(result.decode()) 31 | print(data['query']['results']['channel']['item']['condition']['temp'] + '@' + data['query']['results']['channel']['item']['condition']['code']) 32 | else: 33 | print("--@99") 34 | 35 | 36 | main() 37 | --------------------------------------------------------------------------------