diff --git a/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE/bug_report.md similarity index 71% rename from ISSUE_TEMPLATE.md rename to .github/ISSUE_TEMPLATE/bug_report.md index e9dcc0b..d4297ce 100644 --- a/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE/bug_report.md @@ -1,19 +1,19 @@ -# Please, read me! +--- +name: Bugs +about: Bugs and unintended behavior -So that I can help you quickly and without having to redirect you here. +--- -# If you have an issue +**Please read the [wiki](https://github.com/lcpz/lain/wiki) and browse the [Issues section](https://github.com/lcpz/lain/issues) first.** -**Please read the [wiki](https://github.com/lcpz/lain/wiki) and search the [Issues section](https://github.com/lcpz/lain/issues) first.** - -If you can't find a solution there, then go ahead and provide: +If you can't find a solution, then please provide: * output of `awesome -v` and `lua -v` * expected behavior and actual behavior * steps to reproduce the problem * X error log -# How to provide X error log +### How to provide X error log There are two ways: diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 37957f6..3193e0b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -9,9 +9,28 @@ jobs: linting: runs-on: ubuntu-latest steps: - - run: echo "Running tests triggered by a ${{ github.event_name }} event." - - run: echo "Testing ${{ github.ref }} from ${{ github.repository }} on ${{ runner.os }}" - - name: Check out code + - name: Checkout uses: actions/checkout@v3 - - name: Run tests + + - name: Luacheck linter uses: lunarmodules/luacheck@v0 + + rockspec: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: leafo/gh-actions-lua@v9 + - uses: leafo/gh-actions-luarocks@v4 + + - name: Update Rockspec + shell: bash + env: + LUAROCKS_API_KEY: ${{ secrets.LUAROCKS_API_KEY }} + run: | + if [[ $(git diff *.rockspec | grep "+version") ]] + then + echo "Rockspec changed, uploading to LuaRocks.org" + luarocks upload *.rockspec --api-key "$LUAROCKS_API_KEY" + else + echo "Rockspec unchanged, nothing to do" + fi diff --git a/lain-scm-1.rockspec b/lain-scm-1.rockspec index 70b0f43..57fd1f5 100644 --- a/lain-scm-1.rockspec +++ b/lain-scm-1.rockspec @@ -1,13 +1,15 @@ +rockspec_format = "3.0" package = "lain" version = "scm-1" source = { - url = "git+https://github.com/lcpz/lain.git", - tag = "master" + url = "git+https://github.com/lcpz/lain.git" } description = { summary = "Layout, widgets and utilities for Awesome WM", detailed = "Alternative layouts, asynchronous widgets and utility functions for Awesome WM. Non-Lua dependency: curl (for IMAP, MPD and weather widgets).", homepage = "https://github.com/lcpz/lain", + issues_url = "https://github.com/lcpz/lain/issues", + maintainer = "Luca Cpz", license = "GPL2" } dependencies = { @@ -17,6 +19,39 @@ dependencies = { supported_platforms = { "linux" } build = { type = "builtin", - modules = { lain = "init.lua" } + modules = { + ["lain"] = "init.lua", + ["lain.helpers"] = "helpers.lua", + ["lain.layout"] = "layout/init.lua", + ["lain.layout.cascade"] = "layout/cascade.lua", + ["lain.layout.centerwork"] = "layout/centerwork.lua", + ["lain.layout.termfair"] = "layout/termfair.lua", + ["lain.util"] = "util/init.lua", + -- ["lain.util.dkjson"] = "util/dkjson.lua", -- RESOLVED BY DEPENDENCY TO dkjson + ["lain.util.markup"] = "util/markup.lua", + ["lain.util.menu_iterator"] = "util/menu_iterator.lua", + ["lain.util.quake"] = "util/quake.lua", + ["lain.util.separators"] = "util/separators.lua", + ["lain.widget"] = "widget/init.lua", + ["lain.widget.contrib"] = "widget/contrib/init.lua", + ["lain.widget.contrib.moc"] = "widget/contrib/moc.lua", + ["lain.widget.contrib.redshift"] = "widget/contrib/redshift.lua", + ["lain.widget.contrib.task"] = "widget/contrib/task.lua", + ["lain.widget.contrib.tp_smapi"] = "widget/contrib/tp_smapi.lua", + ["lain.widget.alsa"] = "widget/alsa.lua", + ["lain.widget.alsabar"] = "widget/alsabar.lua", + ["lain.widget.bat"] = "widget/bat.lua", + ["lain.widget.cal"] = "widget/cal.lua", + ["lain.widget.cpu"] = "widget/cpu.lua", + ["lain.widget.fs"] = "widget/fs.lua", + ["lain.widget.imap"] = "widget/imap.lua", + ["lain.widget.mem"] = "widget/mem.lua", + ["lain.widget.mpd"] = "widget/mpd.lua", + ["lain.widget.net"] = "widget/net.lua", + ["lain.widget.pulse"] = "widget/pulse.lua", + ["lain.widget.pulsebar"] = "widget/pulsebar.lua", + ["lain.widget.sysload"] = "widget/sysload.lua", + ["lain.widget.temp"] = "widget/temp.lua", + ["lain.widget.weather"] = "widget/weather.lua" + } } - diff --git a/widget/weather.lua b/widget/weather.lua index 835b222..9626afb 100644 --- a/widget/weather.lua +++ b/widget/weather.lua @@ -24,11 +24,12 @@ local function factory(args) args = args or {} local weather = { widget = args.widget or wibox.widget.textbox() } - local APPID = args.APPID -- mandatory - local timeout = args.timeout or 60 * 15 -- 15 min - local current_call = args.current_call or "curl -s 'https://api.openweathermap.org/data/2.5/weather?id=%s&units=%s&lang=%s&APPID=%s'" - local forecast_call = args.forecast_call or "curl -s 'https://api.openweathermap.org/data/2.5/forecast?id=%s&units=%s&lang=%s&APPID=%s'" - local city_id = args.city_id or 0 -- placeholder + local APPID = args.APPID -- mandatory api key + local timeout = args.timeout or 900 -- 15 min + local current_call = args.current_call or "curl -s 'https://api.openweathermap.org/data/2.5/weather?lat=%s&lon=%s&APPID=%s&units=%s&lang=%s'" + local forecast_call = args.forecast_call or "curl -s 'https://api.openweathermap.org/data/2.5/forecast?lat=%s&lon=%s&APPID=%s&cnt=%s&units=%s&lang=%s'" + local lat = args.lat or 0 -- placeholder + local lon = args.lon or 0 -- placeholder local units = args.units or "metric" local lang = args.lang or "en" local cnt = args.cnt or 5 @@ -87,7 +88,8 @@ local function factory(args) end function weather.forecast_update() - local cmd = string.format(forecast_call, city_id, units, lang, APPID) + local cmd = string.format(forecast_call, lat, lon, APPID, cnt, units, lang) + helpers.async(cmd, function(f) local err weather_now, _, err = json.decode(f, 1, nil) @@ -106,7 +108,8 @@ local function factory(args) end function weather.update() - local cmd = string.format(current_call, city_id, units, lang, APPID) + local cmd = string.format(current_call, lat, lon, APPID, units, lang) + helpers.async(cmd, function(f) local err weather_now, _, err = json.decode(f, 1, nil) @@ -137,8 +140,8 @@ local function factory(args) if showpopup == "on" then weather.attach(weather.widget) end - weather.timer = helpers.newtimer("weather-" .. city_id, timeout, weather.update, false, true) - weather.timer_forecast = helpers.newtimer("weather_forecast-" .. city_id, timeout, weather.forecast_update, false, true) + weather.timer = helpers.newtimer("weather-" .. lat .. ":" .. lon, timeout, weather.update, false, true) + weather.timer_forecast = helpers.newtimer("weather_forecast-" .. lat .. ":" .. lon, timeout, weather.forecast_update, false, true) return weather end diff --git a/wiki b/wiki index ad8081c..d73b84d 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit ad8081cb3e3cb336323d1f72d34c7c8304490b14 +Subproject commit d73b84de973e4087087a371210c6fc0ad88e8bd5