summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--brightness-widget/brightness.lua31
-rw-r--r--calendar-widget/calendar.lua5
-rw-r--r--cmus-widget/README.md10
-rw-r--r--cmus-widget/cmus.lua33
-rw-r--r--weather-widget/locale/pt.lua14
-rw-r--r--weather-widget/weather.lua4
6 files changed, 77 insertions, 20 deletions
diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua
index 3a77a44..b1cb107 100644
--- a/brightness-widget/brightness.lua
+++ b/brightness-widget/brightness.lua
@@ -12,10 +12,11 @@ local awful = require("awful")
local wibox = require("wibox")
local watch = require("awful.widget.watch")
local spawn = require("awful.spawn")
+local gfs = require("gears.filesystem")
local naughty = require("naughty")
local beautiful = require("beautiful")
-local ICON_DIR = os.getenv("HOME") .. '/.config/awesome/awesome-wm-widgets/brightness-widget/'
+local ICON_DIR = gfs.get_configuration_dir() .. "awesome-wm-widgets/brightness-widget/"
local get_brightness_cmd
local set_brightness_cmd
local inc_brightness_cmd
@@ -24,15 +25,15 @@ local dec_brightness_cmd
local brightness_widget = {}
local function show_warning(message)
- naughty.notify{
- preset = naughty.config.presets.critical,
- title = 'Brightness Widget',
- text = message}
+ naughty.notify({
+ preset = naughty.config.presets.critical,
+ title = "Brightness Widget",
+ text = message,
+ })
end
local function worker(user_args)
-
- local args = user_args or {}
+ local args = user_args or {}
local type = args.type or 'arc' -- arc or icon_and_text
local path_to_icon = args.path_to_icon or ICON_DIR .. 'brightness.svg'
@@ -56,10 +57,10 @@ local function worker(user_args)
inc_brightness_cmd = 'xbacklight -inc ' .. step
dec_brightness_cmd = 'xbacklight -dec ' .. step
elseif program == 'brightnessctl' then
- get_brightness_cmd = 'bash -c "brightnessctl -m | cut -d, -f4 | tr -d %"'
- set_brightness_cmd = 'brightnessctl set %d%%' -- <level>
- inc_brightness_cmd = 'brightnessctl set +' .. step .. '%'
- dec_brightness_cmd = 'brightnessctl set ' .. step .. '-%'
+ get_brightness_cmd = "brightnessctl get"
+ set_brightness_cmd = "brightnessctl set %d%%" -- <level>
+ inc_brightness_cmd = "brightnessctl set +" .. step .. "%"
+ dec_brightness_cmd = "brightnessctl set " .. step .. "-%"
else
show_warning(program .. " command is not supported by the widget")
return
@@ -187,6 +188,8 @@ local function worker(user_args)
return brightness_widget.widget
end
-return setmetatable(brightness_widget, { __call = function(_, ...)
- return worker(...)
-end })
+return setmetatable(brightness_widget, {
+ __call = function(_, ...)
+ return worker(...)
+ end,
+})
diff --git a/calendar-widget/calendar.lua b/calendar-widget/calendar.lua
index 4bb637f..bc4a877 100644
--- a/calendar-widget/calendar.lua
+++ b/calendar-widget/calendar.lua
@@ -232,9 +232,14 @@ local function worker(user_args)
awful.placement.top(popup, { margins = { top = 30 }, parent = awful.screen.focused() })
elseif placement == 'top_right' then
awful.placement.top_right(popup, { margins = { top = 30, right = 10}, parent = awful.screen.focused() })
+ elseif placement == 'top_left' then
+ awful.placement.top_left(popup, { margins = { top = 30, left = 10}, parent = awful.screen.focused() })
elseif placement == 'bottom_right' then
awful.placement.bottom_right(popup, { margins = { bottom = 30, right = 10},
parent = awful.screen.focused() })
+ elseif placement == 'bottom_left' then
+ awful.placement.bottom_left(popup, { margins = { bottom = 30, left = 10},
+ parent = awful.screen.focused() })
else
awful.placement.top(popup, { margins = { top = 30 }, parent = awful.screen.focused() })
end
diff --git a/cmus-widget/README.md b/cmus-widget/README.md
index eec5773..e33655e 100644
--- a/cmus-widget/README.md
+++ b/cmus-widget/README.md
@@ -31,10 +31,12 @@ s.mytasklist, -- Middle widget
To improve responsiveness of the widget when playback is changed by a shortcut use corresponding methods of the widget:
```lua
-awful.key({ modkey, "Shift" },
- "p",
- function() cmus_widget:play_pause() end,
- {description = "play/pause cmus", group = "custom"}),
+awful.key({ modkey, "Shift" }, "p", function () cmus_widget:play_pause() end, {description = "toggle track", group = "cmus"}),
+awful.key({ }, "XF86AudioPlay", function () cmus_widget:play() end, {description = "play track", group = "cmus"}),
+awful.key({ }, "XF86AudioPause", function () cmus_widget:play() end, {description = "pause track", group = "cmus"}),
+awful.key({ }, "XF86AudioNext", function () cmus_widget:next_track() end, {description = "next track", group = "cmus"}),
+awful.key({ }, "XF86AudioPrev", function () cmus_widget:prev_track() end, {description = "previous track", group = "cmus"}),
+awful.key({ }, "XF86AudioStop", function () cmus_widget:stop() end, {description = "stop cmus", group = "cmus"}),
```
## Customization
diff --git a/cmus-widget/cmus.lua b/cmus-widget/cmus.lua
index 2ffa872..b1287c5 100644
--- a/cmus-widget/cmus.lua
+++ b/cmus-widget/cmus.lua
@@ -96,14 +96,43 @@ local function worker(user_args)
end
end
- function cmus_widget:play_pause()
- spawn("cmus-remote -u")
+ function cmus_widget:update()
spawn.easy_async("cmus-remote -Q",
function(stdout, _, _, code)
update_widget(cmus_widget.widget, stdout, _, _, code)
end)
end
+ function cmus_widget:play_pause()
+ spawn("cmus-remote -u")
+ cmus_widget.update()
+ end
+
+ function cmus_widget:pause()
+ spawn("cmus-remote -U")
+ cmus_widget.update()
+ end
+
+ function cmus_widget:play()
+ spawn("cmus-remote -p")
+ cmus_widget.update()
+ end
+
+ function cmus_widget:next_track()
+ spawn("cmus-remote -n")
+ cmus_widget.update()
+ end
+
+ function cmus_widget:prev_track()
+ spawn("cmus-remote -r")
+ cmus_widget.update()
+ end
+
+ function cmus_widget:stop()
+ spawn("cmus-remote -s")
+ cmus_widget.update()
+ end
+
cmus_widget.widget:buttons(
awful.util.table.join(
awful.button({}, 1, function() cmus_widget:play_pause() end)
diff --git a/weather-widget/locale/pt.lua b/weather-widget/locale/pt.lua
new file mode 100644
index 0000000..e7f4012
--- /dev/null
+++ b/weather-widget/locale/pt.lua
@@ -0,0 +1,14 @@
+local pt = {
+ warning_title = "Widget do tempo",
+ parameter_warning = "Parâmetros necessários não definidos: ",
+ directions = {
+ "N", "NNE", "NE", "ENE", "L", "ESE", "SE", "SSE", "S", "SSO", "SO",
+ "OSO", "O", "ONO", "NO", "NNO", "N"
+ },
+ feels_like = "Sensação de ",
+ wind = "Vento: ",
+ humidity = "Umidade: ",
+ uv = "UV: "
+}
+
+return pt
diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua
index 4e8e659..3ec1c3f 100644
--- a/weather-widget/weather.lua
+++ b/weather-widget/weather.lua
@@ -18,6 +18,10 @@ local WIDGET_DIR = HOME_DIR .. '/.config/awesome/awesome-wm-widgets/weather-widg
local GET_FORECAST_CMD = [[bash -c "curl -s --show-error -X GET '%s'"]]
local SYS_LANG = os.getenv("LANG"):sub(1, 2)
+if SYS_LANG == "C" or SYS_LANG == "C." then
+ -- C-locale is a common fallback for simple English
+ SYS_LANG = "en"
+end
-- default language is ENglish
local LANG = gears.filesystem.file_readable(WIDGET_DIR .. "/" .. "locale/" ..
SYS_LANG .. ".lua") and SYS_LANG or "en"