Skip to content

Commit

Permalink
improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
Pavel Makhov committed Mar 31, 2021
1 parent abe9908 commit 953b97b
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 15 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/blank.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
on:
push:
# Sequence of patterns matched against refs/tags
tags:
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10

name: Upload Release Asset

jobs:
build:
name: Upload Release Asset
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Build project # This would actually build your project, using zip for an example artifact
run: |
zip -r ${{ github.event.repository.name }}.zip . -x ".git/*" ".github/* ${{ github.event.repository.name }}.zip"
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./${{ github.event.repository.name }}.zip
asset_name: ${{ github.event.repository.name }}.zip
asset_content_type: application/zip
26 changes: 23 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,40 @@
# Weather

TBD
A menubar app which shows current weather for a given location:

![screenshot](./screenshots/screenshot.png)

![screenshot](./screenshots/screenshot2.png)

Whem clicked, a menu with more detailed information is shown, it also includes the sunrise and sunset times.

# Installation

This app is using [OpenWeather](https://openweathermap.org) as the data provider, so first you need to create an account and get an app id in order to use the API. Then

- install [Hammerspoon](http://www.hammerspoon.org/) - a powerful automation tool for OS X
- Manually:

Download the [latest release](https://github.com/Hammerspoon/hammerspoon/releases/latest), and drag Hammerspoon.app from your Downloads folder to Applications.
- Homebrew:

```brew install hammerspoon --cask```
- download [weather.spoon](https://github.com/fork-my-spoons/github-activity.spoon/releases/download/v1.0/github-activity.spoon.zip), unzip and double click on a .spoon file. It will be installed under ~/.hammerspoon/Spoons folder.
- open ~/.hammerspoon/init.lua and add the following snippet:

```lua
-- weather
hs.loadSpoon('weather')
spoon.weather:setup{
app_id = 'owm app id',
app_id = '<your app id>',
-- units = 'f',
lat = 45.501670,
lon = -73.567221,
-- city = 'Montreal,QC,CA'
}
spoon.weather:start()
```
```

By defaul the temperature is in celsius, to change it to fahrenheit add parameter units with value 'f'. For the location you can either use latitude and longtitude, or [city name](https://openweathermap.org/current#name).

This app uses icons, to properly display them, install a [feather-font](https://github.com/AT-UI/feather-font) by [downloading](https://github.com/AT-UI/feather-font/raw/master/src/fonts/feather.ttf) this .ttf font and installing it.
22 changes: 10 additions & 12 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ obj.__index = obj
obj.name = "weather"
obj.version = "1.0"
obj.author = "Pavel Makhov"
obj.homepage = "https://github.com/fork-my-spoons/jira-issues.spoon"
obj.homepage = "https://fork-my-spoons.github.io/"
obj.license = "MIT - https://opensource.org/licenses/MIT"

obj.indicator = nil
Expand Down Expand Up @@ -85,17 +85,15 @@ local function updateMenu()

table.insert(menu, {title = '-'})
table.insert(menu, {
disabled = false,
title =
(is_night and sunset_icon or sunrise_icon)
.. hs.styledtext.new(string.rep(' ', c))
.. (is_night and moon_icon or sun_icon)
.. hs.styledtext.new(string.rep(' ', 40 - c))
.. (is_night and sunrise_icon or sunset_icon)
.. hs.styledtext.new('\n')
.. hs.styledtext.new(os.date("%H:%M", s))
.. hs.styledtext.new(string.rep(' ', 38))
.. hs.styledtext.new(os.date("%H:%M", e), {color = {hex = '#ffffff'}})
title = (is_night and sunset_icon or sunrise_icon)
.. hs.styledtext.new(string.rep(' ', c))
.. (is_night and moon_icon or sun_icon)
.. hs.styledtext.new(string.rep(' ', 40 - c))
.. (is_night and sunrise_icon or sunset_icon)
.. hs.styledtext.new('\n')
.. hs.styledtext.new(os.date("%H:%M", s))
.. hs.styledtext.new(string.rep(' ', 38))
.. hs.styledtext.new(os.date("%H:%M", e), {color = {hex = '#ffffff'}})
})
obj.indicator:setMenu(menu)

Expand Down

0 comments on commit 953b97b

Please sign in to comment.