summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rw-r--r--battery-widget/battery.lua2
-rw-r--r--batteryarc-widget/README.md2
-rw-r--r--batteryarc-widget/batteryarc.lua2
-rw-r--r--brightness-widget/brightness.lua34
-rw-r--r--cpu-widget/cpu-widget.lua13
-rw-r--r--mpdarc-widget/README.md14
-rw-r--r--mpdarc-widget/mpdarc.lua27
-rw-r--r--pomodoroarc-widget/README.md16
-rw-r--r--pomodoroarc-widget/pomodoroarc.lua135
-rw-r--r--ram-widget/ram-widget.lua3
-rw-r--r--run-shell/run-shell.lua91
-rwxr-xr-xrun-shell/scratch_6.sh40
-rw-r--r--spotify-shell/spotify-shell.lua3
-rw-r--r--spotify-widget/spotify.lua14
-rw-r--r--translate-widget/translate.lua5
-rw-r--r--volume-widget/README.md4
-rw-r--r--volume-widget/audio-volume-muted-symbolic_new.svg81
-rw-r--r--volume-widget/volume.lua18
-rw-r--r--volumearc-widget/volumearc.lua10
-rw-r--r--volumebar-widget/volumebar.lua28
-rw-r--r--weather-widget/weather.lua11
22 files changed, 477 insertions, 78 deletions
diff --git a/README.md b/README.md
index eb98f06..f7f8b97 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,8 @@ or with separators
![screenshot](./screenshot_with_sprtrs.png)
+Some more screenshots in this reddit [post](https://www.reddit.com/r/unixporn/comments/8qijmx/awesomewm_dark_theme/)
+
From left to right:
- [spotify-widget](https://github.com/streetturtle/AwesomeWM/tree/master/spotify-widget) / [rhythmbox-widget](https://github.com/streetturtle/AwesomeWM/tree/master/rhythmbox-widget)
diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua
index 9adc7ea..a472bbf 100644
--- a/battery-widget/battery.lua
+++ b/battery-widget/battery.lua
@@ -100,7 +100,7 @@ watch("acpi -i", 10,
charge = charge + batt.charge * capacities[i]
end
- charge = charge // capacity
+ charge = charge / capacity
if (charge >= 0 and charge < 15) then
batteryType = "battery-empty%s-symbolic"
diff --git a/batteryarc-widget/README.md b/batteryarc-widget/README.md
index 6a451d1..cb73e09 100644
--- a/batteryarc-widget/README.md
+++ b/batteryarc-widget/README.md
@@ -29,7 +29,7 @@ which means that you need to copy the code above and paste it in your **theme.lu
Clone repo, include widget and use it in **rc.lua**:
```lua
-require("volumearc")
+local batteryarc_widget = require("awesome-wm-widgets.batteryarc-widget.batteryarc")
...
s.mytasklist, -- Middle widget
{ -- Right widgets
diff --git a/batteryarc-widget/batteryarc.lua b/batteryarc-widget/batteryarc.lua
index b6fa95c..6b28c46 100644
--- a/batteryarc-widget/batteryarc.lua
+++ b/batteryarc-widget/batteryarc.lua
@@ -71,7 +71,7 @@ watch("acpi -i", 10,
charge = charge + batt.charge * capacities[i]
end
- charge = charge // capacity
+ charge = charge / capacity
widget.value = charge / 100
if status == 'Charging' then
diff --git a/brightness-widget/brightness.lua b/brightness-widget/brightness.lua
index ef30905..1b2e8a6 100644
--- a/brightness-widget/brightness.lua
+++ b/brightness-widget/brightness.lua
@@ -10,17 +10,19 @@
local wibox = require("wibox")
local watch = require("awful.widget.watch")
+local spawn = require("awful.spawn")
---local GET_BRIGHTNESS_CMD = "xbacklight -get"
-local GET_BRIGHTNESS_CMD = "light -G"
-local path_to_icons = "/usr/share/icons/Arc/status/symbolic/"
+local PATH_TO_ICON = "/usr/share/icons/Arc/status/symbolic/display-brightness-symbolic.svg"
+local GET_BRIGHTNESS_CMD = "light -G" -- "xbacklight -get"
+local INC_BRIGHTNESS_CMD = "light -A 1" -- "xbacklight -inc 5"
+local DEC_BRIGHTNESS_CMD = "light -U 1" -- "xbacklight -dec 5"
local brightness_text = wibox.widget.textbox()
brightness_text:set_font('Play 9')
local brightness_icon = wibox.widget {
{
- image = path_to_icons .. "display-brightness-symbolic.svg",
+ image = PATH_TO_ICON,
resize = false,
widget = wibox.widget.imagebox,
},
@@ -34,13 +36,21 @@ local brightness_widget = wibox.widget {
layout = wibox.layout.fixed.horizontal,
}
-watch(
- GET_BRIGHTNESS_CMD, 1,
- function(widget, stdout, stderr, exitreason, exitcode)
- local brightness_level = tonumber(string.format("%.0f", stdout))
- widget:set_text(" " .. brightness_level .. "%")
- end,
- brightness_text
-)
+local update_widget = function(widget, stdout, stderr, exitreason, exitcode)
+ local brightness_level = tonumber(string.format("%.0f", stdout))
+ widget:set_text(" " .. brightness_level .. "%")
+end,
+
+brightness_widget:connect_signal("button::press", function(_,_,_,button)
+ if (button == 4) then spawn(INC_BRIGHTNESS_CMD, false)
+ elseif (button == 5) then spawn(DEC_BRIGHTNESS_CMD, false)
+ end
+
+ spawn.easy_async(GET_BRIGHTNESS_CMD, function(stdout, stderr, exitreason, exitcode)
+ update_widget(brightness_widget, stdout, stderr, exitreason, exitcode)
+ end)
+end)
+
+watch(GET_BRIGHTNESS_CMD, 1, update_widget, brightness_text)
return brightness_widget
diff --git a/cpu-widget/cpu-widget.lua b/cpu-widget/cpu-widget.lua
index f7fc2e4..455ff58 100644
--- a/cpu-widget/cpu-widget.lua
+++ b/cpu-widget/cpu-widget.lua
@@ -10,10 +10,10 @@
local watch = require("awful.widget.watch")
local wibox = require("wibox")
+local beautiful = require("beautiful")
local cpugraph_widget = wibox.widget {
max_value = 100,
- color = '#74aeab',
background_color = "#00000000",
forced_width = 50,
step_width = 2,
@@ -21,13 +21,13 @@ local cpugraph_widget = wibox.widget {
widget = wibox.widget.graph
}
--- mirros and pushs up a bit
+--- By default graph widget goes from left to right, so we mirror it and push up a bit
local cpu_widget = wibox.container.margin(wibox.container.mirror(cpugraph_widget, { horizontal = true }), 0, 0, 0, 2)
local total_prev = 0
local idle_prev = 0
-watch("cat /proc/stat | grep '^cpu '", 1,
+watch([[bash -c "cat /proc/stat | grep '^cpu '"]], 1,
function(widget, stdout, stderr, exitreason, exitcode)
local user, nice, system, idle, iowait, irq, softirq, steal, guest, guest_nice =
stdout:match('(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s(%d+)%s')
@@ -38,11 +38,8 @@ watch("cat /proc/stat | grep '^cpu '", 1,
local diff_total = total - total_prev
local diff_usage = (1000 * (diff_total - diff_idle) / diff_total + 5) / 10
- if diff_usage > 80 then
- widget:set_color('#ff4136')
- else
- widget:set_color('#74aeab')
- end
+ widget:set_color(diff_usage > 80 and beautiful.widget_red
+ or beautiful.widget_main_color)
widget:add_value(diff_usage)
diff --git a/mpdarc-widget/README.md b/mpdarc-widget/README.md
index 0a6ffa6..2192410 100644
--- a/mpdarc-widget/README.md
+++ b/mpdarc-widget/README.md
@@ -10,5 +10,17 @@ Install `mpd` (Music Player Daemon itself) and `mpc` (Music Player Client - prog
sudo apt-get install mpd mpc
```
-Set them up and then just follow the [installation](https://github.com/streetturtle/awesome-wm-widgets#installation) section of the repo.
+## Installation
+To use this widget clone repo under **~/.config/awesome/** and then add it in **rc.lua**:
+
+```lua
+local mpdarc_widget = require("awesome-wm-widgets.mpdarc-widget.mpdarc")
+...
+s.mytasklist, -- Middle widget
+ { -- Right widgets
+ layout = wibox.layout.fixed.horizontal,
+ ...
+ mpdarc_widget,
+ ...
+```
diff --git a/mpdarc-widget/mpdarc.lua b/mpdarc-widget/mpdarc.lua
index 56009ef..ca0f411 100644
--- a/mpdarc-widget/mpdarc.lua
+++ b/mpdarc-widget/mpdarc.lua
@@ -14,6 +14,7 @@ local wibox = require("wibox")
local naughty = require("naughty")
local GET_MPD_CMD = "mpc status"
+local TOGGLE_MPD_CMD = "mpc toggle"
local PAUSE_MPD_CMD = "mpc pause"
local STOP_MPD_CMD = "mpc stop"
local NEXT_MPD_CMD = "mpc next"
@@ -45,9 +46,15 @@ local mpdarc = wibox.widget {
widget = wibox.container.arcchart
}
-local mpdarc_widget = wibox.container.mirror(mpdarc, { horizontal = true })
+local mpdarc_icon_widget = wibox.container.mirror(mpdarc, { horizontal = true })
+local mpdarc_current_song_widget = wibox.widget {
+ id = 'current_song',
+ widget = wibox.widget.textbox,
+ font = 'Play 9'
+}
local update_graphic = function(widget, stdout, _, _, _)
+ local current_song = string.gmatch(stdout, "[^\r\n]+")()
stdout = string.gsub(stdout, "\n", "")
local mpdpercent = string.match(stdout, "(%d%d)%%")
local mpdstatus = string.match(stdout, "%[(%a+)%]")
@@ -55,18 +62,25 @@ local update_graphic = function(widget, stdout, _, _, _)
icon.image = PLAY_ICON_NAME
widget.colors = { beautiful.widget_main_color }
widget.value = tonumber((100-mpdpercent)/100)
- elseif mpdstatus == "paused" then
+ mpdarc_current_song_widget.markup = current_song
+ elseif mpdstatus == "paused" then
icon.image = PAUSE_ICON_NAME
widget.colors = { beautiful.widget_main_color }
widget.value = tonumber(mpdpercent/100)
+ mpdarc_current_song_widget.markup = current_song
else
icon.image = STOP_ICON_NAME
- widget.colors = { beautiful.widget_red }
+ if string.len(stdout) == 0 then -- MPD is not running
+ mpdarc_current_song_widget.markup = "MPD is not running"
+ else
+ widget.colors = { beautiful.widget_red }
+ mpdarc_current_song_widget.markup = ""
+ end
end
end
mpdarc:connect_signal("button::press", function(_, _, _, button)
- if (button == 1) then awful.spawn("mpc toggle", false) -- left click
+ if (button == 1) then awful.spawn(TOGGLE_MPD_CMD, false) -- left click
elseif (button == 2) then awful.spawn(STOP_MPD_CMD, false)
elseif (button == 3) then awful.spawn(PAUSE_MPD_CMD, false)
elseif (button == 4) then awful.spawn(NEXT_MPD_CMD, false) -- scroll up
@@ -97,4 +111,9 @@ mpdarc:connect_signal("mouse::leave", function() naughty.destroy(notification) e
watch(GET_MPD_CMD, 1, update_graphic, mpdarc)
+local mpdarc_widget = {
+ mpdarc_icon_widget,
+ mpdarc_current_song_widget,
+ layout = wibox.layout.align.horizontal,
+ }
return mpdarc_widget
diff --git a/pomodoroarc-widget/README.md b/pomodoroarc-widget/README.md
new file mode 100644
index 0000000..49b1b2c
--- /dev/null
+++ b/pomodoroarc-widget/README.md
@@ -0,0 +1,16 @@
+# Pomodoro Widget
+
+:construction: This widget is under construction :construction_worker:
+
+## Installation
+
+This widget is based on [@jsspencer](https://github.com/jsspencer)' [pomo](https://github.com/jsspencer/pomo) - a simple pomodoro timer.
+So first install/clone it anywhere you like, then either
+ - in widget's code provide path to the pomo.sh, or
+ - add pomo.sh to the PATH, or
+ - make a soft link in /usr/local/bin/ to it:
+ ```bash
+ sudo ln -sf /opt/pomodoro/pomo.sh /usr/local/bin/pomo
+ ```
+
+Note that by default widget's code expects third way and calls script by `pomo`. \ No newline at end of file
diff --git a/pomodoroarc-widget/pomodoroarc.lua b/pomodoroarc-widget/pomodoroarc.lua
new file mode 100644
index 0000000..dab8c3a
--- /dev/null
+++ b/pomodoroarc-widget/pomodoroarc.lua
@@ -0,0 +1,135 @@
+-------------------------------------------------
+-- Pomodoro Arc Widget for Awesome Window Manager
+-- Modelled after Pavel Makhov's work
+
+-- @author Raphaël Fournier-S'niehotta
+-- @copyright 2018 Raphaël Fournier-S'niehotta
+-------------------------------------------------
+
+local awful = require("awful")
+local beautiful = require("beautiful")
+local spawn = require("awful.spawn")
+local watch = require("awful.widget.watch")
+local wibox = require("wibox")
+local naughty = require("naughty")
+
+local GET_pomodoro_CMD = "pomo clock"
+local PAUSE_pomodoro_CMD = "pomo pause"
+local START_pomodoro_CMD = "pomo start"
+local STOP_pomodoro_CMD = "pomo stop"
+
+local text = wibox.widget {
+ id = "txt",
+ --font = "Play 12",
+font = "Inconsolata Medium 13",
+ widget = wibox.widget.textbox
+}
+-- mirror the text, because the whole widget will be mirrored after
+local mirrored_text = wibox.container.margin(wibox.container.mirror(text, { horizontal = true }))
+mirrored_text.right = 5 -- pour centrer le texte dans le rond
+--
+--local mirrored_text = wibox.container.mirror(text, { horizontal = true })
+
+-- mirrored text with background
+local mirrored_text_with_background = wibox.container.background(mirrored_text)
+
+local pomodoroarc = wibox.widget {
+ mirrored_text_with_background,
+ max_value = 1,
+ thickness = 2,
+ start_angle = 4.71238898, -- 2pi*3/4
+ forced_height = 32,
+ forced_width = 32,
+ rounded_edge = true,
+ bg = "#ffffff11",
+ paddings = 0,
+ widget = wibox.container.arcchart
+}
+
+local pomodoroarc_widget = wibox.container.mirror(pomodoroarc, { horizontal = true })
+
+local update_graphic = function(widget, stdout, _, _, _)
+ local pomostatus = string.match(stdout, " (%D?%D?):%D?%D?")
+ if pomostatus == "--" then
+text.font = "Inconsolata Medium 13"
+ widget.colors = { beautiful.widget_main_color }
+ text.text = "25"
+ widget.value = 1
+ else
+text.font = "Inconsolata Medium 13"
+ local pomomin = string.match(stdout, "[ P]?[BW](%d?%d?):%d?%d?")
+ local pomosec = string.match(stdout, "[ P]?[BW]%d?%d?:(%d?%d?)")
+ local pomodoro = pomomin * 60 + pomosec
+
+ local status = string.match(stdout, "([ P]?)[BW]%d?%d?:%d?%d?")
+ local workbreak = string.match(stdout, "[ P]?([BW])%d?%d?:%d?%d?")
+ text.text = pomomin
+
+-- Helps debugging
+ --naughty.notify {
+ --text = pomomin,
+ --title = "pomodoro debug",
+ --timeout = 5,
+ --hover_timeout = 0.5,
+ --width = 200,
+ --}
+
+ if status == " " then -- clock ticking
+ if workbreak == "W" then
+ widget.value = tonumber(pomodoro/(25*60))
+ if tonumber(pomomin) < 5 then -- last 5 min of pomo
+ widget.colors = { beautiful.widget_red }
+ else
+ widget.colors = { beautiful.widget_blue }
+ end
+ elseif workbreak == "B" then -- color during pause
+ widget.colors = { beautiful.widget_green }
+ widget.value = tonumber(pomodoro/(5*60))
+ end
+ elseif status == "P" then -- paused
+ if workbreak == "W" then
+ widget.colors = { beautiful.widget_yellow }
+ widget.value = tonumber(pomodoro/(25*60))
+text.font = "Inconsolata Medium 13"
+ text.text = "PW"
+ elseif workbreak == "B" then
+ widget.colors = { beautiful.widget_yellow }
+ widget.value = tonumber(pomodoro/(5*60))
+text.font = "Inconsolata Medium 13"
+ text.text = "PB"
+ end
+ end
+ end
+end
+
+pomodoroarc:connect_signal("button::press", function(_, _, _, button)
+ if (button == 2) then awful.spawn(PAUSE_pomodoro_CMD, false)
+ elseif (button == 1) then awful.spawn(START_pomodoro_CMD, false)
+ elseif (button == 3) then awful.spawn(STOP_pomodoro_CMD, false)
+ end
+
+ spawn.easy_async(GET_pomodoro_CMD, function(stdout, stderr, exitreason, exitcode)
+ update_graphic(pomodoroarc, stdout, stderr, exitreason, exitcode)
+ end)
+end)
+
+local notification
+function show_pomodoro_status()
+ spawn.easy_async(GET_pomodoro_CMD,
+ function(stdout, _, _, _)
+ notification = naughty.notify {
+ text = stdout,
+ title = "pomodoro status",
+ timeout = 5,
+ hover_timeout = 0.5,
+ width = 200,
+ }
+ end)
+end
+
+pomodoroarc:connect_signal("mouse::enter", function() show_pomodoro_status() end)
+pomodoroarc:connect_signal("mouse::leave", function() naughty.destroy(notification) end)
+
+watch(GET_pomodoro_CMD, 1, update_graphic, pomodoroarc)
+
+return pomodoroarc_widget
diff --git a/ram-widget/ram-widget.lua b/ram-widget/ram-widget.lua
index d352bd7..3072068 100644
--- a/ram-widget/ram-widget.lua
+++ b/ram-widget/ram-widget.lua
@@ -18,7 +18,6 @@ local w = wibox {
height = 200,
width = 400,
ontop = true,
- screen = mouse.screen,
expand = true,
bg = '#1e252c',
max_widget_size = 500
@@ -64,7 +63,7 @@ watch('bash -c "free | grep -z Mem.*Swap.*"', 1,
ramgraph_widget:buttons(
awful.util.table.join(
awful.button({}, 1, function()
- awful.placement.top_right(w, { margins = {top = 25, right = 10}})
+ awful.placement.top_right(w, { margins = {top = 25, right = 10}, parent = awful.screen.focused() })
w.pie.data_list = {
{'used ' .. getPercentage(used + used_swap), used + used_swap},
{'free ' .. getPercentage(free + free_swap), free + free_swap},
diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua
new file mode 100644
index 0000000..e46d5a9
--- /dev/null
+++ b/run-shell/run-shell.lua
@@ -0,0 +1,91 @@
+-------------------------------------------------
+-- Run Shell for Awesome Window Manager
+-- More details could be found here:
+-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/run-shell
+
+-- @author Pavel Makhov
+-- @copyright 2018 Pavel Makhov
+-------------------------------------------------
+
+local awful = require("awful")
+local gfs = require("gears.filesystem")
+local wibox = require("wibox")
+local gears = require("gears")
+local naughty = require("naughty")
+local completion = require("awful.completion")
+
+local run_shell = awful.widget.prompt()
+
+local w = wibox {
+ visible = false,
+ ontop = true,
+ height = 1060,
+ width = 1920
+}
+
+w:setup {
+ {
+ {
+ {
+ {
+ text = '',
+ font = 'Play 18',
+ widget = wibox.widget.textbox,
+ },
+ id = 'icon',
+ top = 9,
+ left = 10,
+ layout = wibox.container.margin
+ },
+ {
+ run_shell,
+ left = 10,
+ layout = wibox.container.margin,
+ },
+ id = 'left',
+ layout = wibox.layout.fixed.horizontal
+ },
+ widget = wibox.container.background,
+ bg = '#333333',
+ shape = function(cr, width, height)
+ gears.shape.rounded_rect(cr, width, height, 3)
+ end,
+ shape_border_color = '#74aeab',
+ shape_border_width = 1,
+ forced_width = 200,
+ forced_height = 50
+ },
+ layout = wibox.container.place
+}
+
+local function launch(s)
+ awful.spawn.with_line_callback(os.getenv("HOME") .. "/.config/awesome/awesome-wm-widgets/run-shell/scratch_6.sh " .. tostring(awful.screen.focused().geometry.x), {
+ stdout = function(line)
+ w.visible = true
+ w.bgimage = '/tmp/i3lock-' .. line .. '.png'
+ awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() })
+ awful.prompt.run {
+ prompt = "<b>Run</b>: ",
+ bg_cursor = '#74aeab',
+ textbox = run_shell.widget,
+ completion_callback = completion.shell,
+ exe_callback = function(...)
+ run_shell:spawn_and_handle_error(...)
+ end,
+ history_path = gfs.get_cache_dir() .. "/history",
+ done_callback = function()
+ -- w.bgimage=''
+ w.visible = false
+ awful.spawn([[bash -c 'rm -f /tmp/i3lock*']])
+ end
+ }
+ end,
+ stderr = function(line)
+ naughty.notify { text = "ERR:" .. line }
+ end,
+ })
+end
+
+return {
+ launch = launch
+}
diff --git a/run-shell/scratch_6.sh b/run-shell/scratch_6.sh
new file mode 100755
index 0000000..1504a60
--- /dev/null
+++ b/run-shell/scratch_6.sh
@@ -0,0 +1,40 @@
+#!/usr/bin/env bash
+
+#IMAGE=/tmp/i3lock.png
+#SCREENSHOT="scrot -u $IMAGE" # 0.46s
+#
+## Alternate screenshot method with imagemagick. NOTE: it is much slower
+## SCREENSHOT="import -window root $IMAGE" # 1.35s
+#
+## Here are some imagemagick blur types
+## Uncomment one to use, if you have multiple, the last one will be used
+#
+## All options are here: http://www.imagemagick.org/Usage/blur/#blur_args
+##BLURTYPE="0x5" # 7.52s
+##BLURTYPE="0x2" # 4.39s
+##BLURTYPE="5x2" # 3.80s
+#BLURTYPE="2x8" # 2.90s
+##BLURTYPE="2x3" # 2.92s
+#
+## Get the screenshot, add the blur and lock the screen with it
+#$SCREENSHOT
+#convert $IMAGE -blur $BLURTYPE $IMAGE
+#echo 'done'
+
+
+# --------------------------
+
+#RES=$(xrandr --current | grep '*' | uniq | awk '{print $1}')
+RNDM=$(uuidgen)
+IMAGE="/tmp/i3lock-$RNDM.png"
+
+
+#ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -y -i :0.0+0,20 -filter_complex "boxblur=9" -vframes 1 $IMAGE
+#ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -y -i :0.0+0,20 -vf frei0r=pixeliz0r -vframes 1 $IMAGE
+ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -y -i :0.0+$1,20 -vf frei0r=pixeliz0r -vframes 1 $IMAGE
+#ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -y -i :0.0+0,20 -filter_complex "boxblur=9" -vframes 1 "/tmp/i3lock$(uuidgen).png"
+
+echo $RNDM
+
+#lock screen
+#ffmpeg -loglevel panic -f x11grab -video_size $(xdpyinfo | grep dimensions | sed -r 's/^[^0-9]*([0-9]+x[0-9]+).*$/\1/') -y -i :0.0+$1,20 -vf frei0r=pixeliz0r -vframes 1 /tmp/test.png ; i3lock -i /tmp/test.png
diff --git a/spotify-shell/spotify-shell.lua b/spotify-shell/spotify-shell.lua
index e981e06..0611e66 100644
--- a/spotify-shell/spotify-shell.lua
+++ b/spotify-shell/spotify-shell.lua
@@ -23,7 +23,6 @@ local w = wibox {
border_color = '#84bd00',
max_widget_size = 500,
ontop = true,
- screen = mouse.screen,
height = 50,
width = 250,
shape = function(cr, width, height)
@@ -55,7 +54,7 @@ w:setup {
local function launch()
w.visible = true
- awful.placement.top(w, { margins = {top = 40}})
+ awful.placement.top(w, { margins = {top = 40}, parent = awful.screen.focused()})
awful.prompt.run{
prompt = "<b>Spotify Shell</b>: ",
bg_cursor = '#84bd00',
diff --git a/spotify-widget/spotify.lua b/spotify-widget/spotify.lua
index ee5217b..c6f2188 100644
--- a/spotify-widget/spotify.lua
+++ b/spotify-widget/spotify.lua
@@ -28,11 +28,9 @@ local spotify_widget = wibox.widget {
},
layout = wibox.layout.align.horizontal,
set_status = function(self, is_playing)
- if (is_playing) then
- self.icon.image = PATH_TO_ICONS .. "/actions/24/player_play.png"
- else
- self.icon.image = PATH_TO_ICONS .. "/actions/24/player_pause.png"
- end
+ self.icon.image = PATH_TO_ICONS ..
+ (is_playing and "/actions/24/player_play.png"
+ or "/actions/24/player_pause.png")
end,
set_text = function(self, path)
self.current_song.markup = path
@@ -41,11 +39,7 @@ local spotify_widget = wibox.widget {
local update_widget_icon = function(widget, stdout, _, _, _)
stdout = string.gsub(stdout, "\n", "")
- if (stdout == 'Playing') then
- widget:set_status(true)
- else
- widget:set_status(false)
- end
+ widget:set_status(stdout == 'Playing' and true or false)
end
local update_widget_text = function(widget, stdout, _, _, _)
diff --git a/translate-widget/translate.lua b/translate-widget/translate.lua
index e046604..fe242b4 100644
--- a/translate-widget/translate.lua
+++ b/translate-widget/translate.lua
@@ -13,6 +13,7 @@ local json = require("json")
local naughty = require("naughty")
local wibox = require("wibox")
local gears = require("gears")
+local gfs = require("gears.filesystem")
local API_KEY = '<your api key>'
local BASE_URL = 'https://translate.yandex.net/api/v1.5/tr.json/translate'
@@ -45,7 +46,6 @@ local w = wibox {
border_width = 1,
border_color = '#66ccff',
ontop = true,
- screen = mouse.screen,
expand = true,
bg = '#1e252c',
max_widget_size = 500,
@@ -163,13 +163,14 @@ input_widget:setup {
}
local function show_translate_prompt()
- awful.placement.top(input_widget, { margins = {top = 40}})
+ awful.placement.top(input_widget, { margins = {top = 40}, parent = awful.screen.focused()})
input_widget.height = 40
input_widget.visible = true
awful.prompt.run {
prompt = "<b>Translate</b>: ",
textbox = prompt.widget,
+ history_path = gfs.get_dir('cache') .. '/translate_history',
bg_cursor = '#66ccff',
exe_callback = function(text)
if not text or #text == 0 then return end
diff --git a/volume-widget/README.md b/volume-widget/README.md
index 19946a2..118abc6 100644
--- a/volume-widget/README.md
+++ b/volume-widget/README.md
@@ -38,7 +38,7 @@ To mute/unmute click on the widget. To increase/decrease volume scroll up or dow
If you want to control volume level by keyboard shortcuts add following lines in shortcut section of the **rc.lua** (the commands could be slightly different depending on your PC configuration):
```lua
-awful.key({ modkey}, "[", function () awful.spawn("amixer -D pulse sset Master 5%-") end, {description = "increase volume", group = "custom"}),
-awful.key({ modkey}, "]", function () awful.spawn("amixer -D pulse sset Master 5%+") end, {description = "decrease volume", group = "custom"}),
+awful.key({ modkey}, "[", function () awful.spawn("amixer -D pulse sset Master 5%+") end, {description = "increase volume", group = "custom"}),
+awful.key({ modkey}, "]", function () awful.spawn("amixer -D pulse sset Master 5%-") end, {description = "decrease volume", group = "custom"}),
awful.key({ modkey}, "\", function () awful.spawn("amixer -D pulse set Master +1 toggle") end, {description = "mute volume", group = "custom"}),
```
diff --git a/volume-widget/audio-volume-muted-symbolic_new.svg b/volume-widget/audio-volume-muted-symbolic_new.svg
new file mode 100644
index 0000000..504c146
--- /dev/null
+++ b/volume-widget/audio-volume-muted-symbolic_new.svg
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://creativecommons.org/ns#"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="16"
+ viewBox="0 0 16 16"
+ height="16"
+ id="svg2"
+ version="1.1"
+ inkscape:version="0.92.2 2405546, 2018-03-11"
+ sodipodi:docname="audio-volume-muted-symbolic-shan.svg">
+ <metadata
+ id="metadata30">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ <dc:title></dc:title>
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <sodipodi:namedview
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1"
+ objecttolerance="10"
+ gridtolerance="10"
+ guidetolerance="10"
+ inkscape:pageopacity="0"
+ inkscape:pageshadow="2"
+ inkscape:window-width="1438"
+ inkscape:window-height="858"
+ id="namedview28"
+ showgrid="true"
+ inkscape:zoom="38.125"
+ inkscape:cx="3.4229508"
+ inkscape:cy="7.947541"
+ inkscape:window-x="0"
+ inkscape:window-y="20"
+ inkscape:window-maximized="1"
+ inkscape:current-layer="svg2"
+ showguides="true"
+ inkscape:snap-intersection-paths="false"
+ inkscape:object-paths="false">
+ <inkscape:grid
+ type="xygrid"
+ id="grid4158" />
+ </sodipodi:namedview>
+ <defs
+ id="defs4" />
+ <path
+ style="opacity:0.3;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 13.140638,1 11.726417,2.413582 C 12.808349,3.4955144 13.990412,5.4467621 14,8 c 0,2.551493 -1.192916,4.505751 -2.273583,5.586418 L 13.140638,15 C 14.595711,13.544927 16.019176,11 16,8 16.035061,5 14.595117,2.4544787 13.140638,1 Z"
+ id="path4508"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ style="opacity:0.3;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 11,3.1156678 9.5897193,4.5261118 C 10.372347,5.3087395 11,6.5690611 11,8 11,9.4309388 10.372767,10.690952 9.5897193,11.474 L 11,12.884 C 12.275645,11.608355 13,9.854095 13,8 13,6.1543677 12.273068,4.3887355 11,3.1156678 Z"
+ id="path4529"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccccccc" />
+ <path
+ style="opacity:0.3;fill:#bebebe;fill-opacity:1;fill-rule:evenodd;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 8.629,5 7.2094668,6.4096296 C 8,7.05621 8,7.805653 8,8 8,8.1932576 7.982199,8.9408674 7.209,9.59 L 8.6289063,11 C 9.8466375,9.952694 10,8.5984701 10,8 10,7.400497 9.854476,6.062891 8.629,5 Z"
+ id="path4569"
+ inkscape:connector-curvature="0"
+ sodipodi:nodetypes="ccscccc" />
+ <path
+ style="opacity:0.3;fill:#bebebe;fill-opacity:1;stroke-width:0.02622951"
+ d="M 4.5036936,12.482983 3.0218135,11.000927 2.1430379,11.000775 C 1.6597113,11.000691 1.1955581,10.989371 1.1115864,10.975618 0.56198086,10.885606 0.24352693,10.462909 0.07812436,9.603862 0.03708101,9.390696 0.03147539,9.196108 0.03147539,7.984533 c 0,-1.217172 0.0054766,-1.405527 0.04717053,-1.622335 0.132109,-0.686963 0.3489491,-1.058742 0.7259726,-1.244702 L 0.97448297,5.033716 1.9849464,5.026316 2.9954098,5.018916 4.4970492,3.518184 5.9986885,2.0174522 V 4.5094289 7.001406 l 0.4983672,0.497849 0.498367,0.497849 -0.4982329,0.498725 -0.498233,0.498725 -0.00669,2.485223 -0.00669,2.485223 z"
+ id="path819"
+ inkscape:connector-curvature="0" />
+</svg>
diff --git a/volume-widget/volume.lua b/volume-widget/volume.lua
index 31a66e4..8124bcf 100644
--- a/volume-widget/volume.lua
+++ b/volume-widget/volume.lua
@@ -5,7 +5,7 @@
-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/volume-widget
-- @author Pavel Makhov
--- @copyright 2017 Pavel Makhov
+-- @copyright 2018 Pavel Makhov
-------------------------------------------------
local awful = require("awful")
@@ -14,7 +14,11 @@ local watch = require("awful.widget.watch")
local spawn = require("awful.spawn")
local path_to_icons = "/usr/share/icons/Arc/status/symbolic/"
-local request_command = 'amixer -D pulse sget Master'
+
+local GET_VOLUME_CMD = 'amixer -D pulse sget Master'
+local INC_VOLUME_CMD = 'amixer -D pulse sset Master 5%+'
+local DEC_VOLUME_CMD = 'amixer -D pulse sset Master 5%-'
+local TOG_VOLUME_CMD = 'amixer -D pulse sset Master toggle'
local volume_widget = wibox.widget {
{
@@ -48,16 +52,16 @@ end
- scrolling when cursor is over the widget
]]
volume_widget:connect_signal("button::press", function(_,_,_,button)
- if (button == 4) then awful.spawn("amixer -D pulse sset Master 5%+", false)
- elseif (button == 5) then awful.spawn("amixer -D pulse sset Master 5%-", false)
- elseif (button == 1) then awful.spawn("amixer -D pulse sset Master toggle", false)
+ if (button == 4) then awful.spawn(INC_VOLUME_CMD, false)
+ elseif (button == 5) then awful.spawn(DEC_VOLUME_CMD, false)
+ elseif (button == 1) then awful.spawn(TOG_VOLUME_CMD, false)
end
- spawn.easy_async(request_command, function(stdout, stderr, exitreason, exitcode)
+ spawn.easy_async(GET_VOLUME_CMD, function(stdout, stderr, exitreason, exitcode)
update_graphic(volume_widget, stdout, stderr, exitreason, exitcode)
end)
end)
-watch(request_command, 1, update_graphic, volume_widget)
+watch(GET_VOLUME_CMD, 1, update_graphic, volume_widget)
return volume_widget \ No newline at end of file
diff --git a/volumearc-widget/volumearc.lua b/volumearc-widget/volumearc.lua
index c2c0af9..9cd7865 100644
--- a/volumearc-widget/volumearc.lua
+++ b/volumearc-widget/volumearc.lua
@@ -5,7 +5,7 @@
-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/volumearc-widget
-- @author Pavel Makhov
--- @copyright 2017 Pavel Makhov
+-- @copyright 2018 Pavel Makhov
-------------------------------------------------
local awful = require("awful")
@@ -38,11 +38,9 @@ local update_graphic = function(widget, stdout, _, _, _)
volume = tonumber(string.format("% 3d", volume))
widget.value = volume / 100;
- if mute == "off" then
- widget.colors = { beautiful.widget_red }
- else
- widget.colors = { beautiful.widget_main_color }
- end
+ widget.colors = mute == 'off' and { beautiful.widget_red }
+ or { beautiful.widget_main_color }
+
end
volumearc:connect_signal("button::press", function(_, _, _, button)
diff --git a/volumebar-widget/volumebar.lua b/volumebar-widget/volumebar.lua
index 545313a..9fd6a99 100644
--- a/volumebar-widget/volumebar.lua
+++ b/volumebar-widget/volumebar.lua
@@ -5,7 +5,7 @@
-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/volumebar-widget
-- @author Pavel Makhov
--- @copyright 2017 Pavel Makhov
+-- @copyright 2018 Pavel Makhov
-------------------------------------------------
local awful = require("awful")
@@ -14,7 +14,10 @@ local spawn = require("awful.spawn")
local watch = require("awful.widget.watch")
local wibox = require("wibox")
-local request_command = 'amixer -D pulse sget Master'
+local GET_VOLUME_CMD = 'amixer -D pulse sget Master'
+local INC_VOLUME_CMD = 'amixer -D pulse sset Master 5%+'
+local DEC_VOLUME_CMD = 'amixer -D pulse sset Master 5%-'
+local TOG_VOLUME_CMD = 'amixer -D pulse sset Master toggle'
local bar_color = "#74aeab"
local mute_color = "#ff0000"
@@ -41,26 +44,23 @@ local update_graphic = function(widget, stdout, _, _, _)
local volume = string.match(stdout, "(%d?%d?%d)%%")
volume = tonumber(string.format("% 3d", volume))
- if mute == "off" then
- widget.color = mute_color
- widget.value = volume / 100;
- else
- widget.color = bar_color
- widget.value = volume / 100;
- end
+ widget.value = volume / 100;
+ widget.color = mute == "off" and mute_color
+ or bar_color
+
end
volumebar_widget:connect_signal("button::press", function(_,_,_,button)
- if (button == 4) then awful.spawn("amixer -D pulse sset Master 5%+", false)
- elseif (button == 5) then awful.spawn("amixer -D pulse sset Master 5%-", false)
- elseif (button == 1) then awful.spawn("amixer -D pulse sset Master toggle", false)
+ if (button == 4) then awful.spawn(INC_VOLUME_CMD)
+ elseif (button == 5) then awful.spawn(DEC_VOLUME_CMD)
+ elseif (button == 1) then awful.spawn(TOG_VOLUME_CMD)
end
- spawn.easy_async(request_command, function(stdout, stderr, exitreason, exitcode)
+ spawn.easy_async(GET_VOLUME_CMD, function(stdout, stderr, exitreason, exitcode)
update_graphic(volumebar_widget, stdout, stderr, exitreason, exitcode)
end)
end)
-watch(request_command, 1, update_graphic, volumebar_widget)
+watch(GET_VOLUME_CMD, 1, update_graphic, volumebar_widget)
return volumebar_widget \ No newline at end of file
diff --git a/weather-widget/weather.lua b/weather-widget/weather.lua
index 08883b9..88d3658 100644
--- a/weather-widget/weather.lua
+++ b/weather-widget/weather.lua
@@ -21,7 +21,7 @@ local icon_widget = wibox.widget {
resize = false,
widget = wibox.widget.imagebox,
},
- layout = wibox.container.margin(brightness_icon, 0, 0, 3),
+ layout = wibox.container.margin(_ , 0, 0, 3),
set_image = function(self, path)
self.icon.image = path
end,
@@ -38,7 +38,7 @@ local weather_widget = wibox.widget {
layout = wibox.layout.fixed.horizontal,
}
--- helps to map openWeatherMap icons to Arc icons
+--- Maps openWeatherMap icons to Arc icons
local icon_map = {
["01d"] = "weather-clear-symbolic.svg",
["02d"] = "weather-few-clouds-symbolic.svg",
@@ -60,12 +60,12 @@ local icon_map = {
["50n"] = "weather-fog-symbolic.svg"
}
--- handy function to convert temperature from Kelvin to Celcius
+--- handy function to convert temperature from Kelvin to Celcius
function to_celcius(kelvin)
return math.floor(tonumber(kelvin) - 273.15)
end
--- Return wind direction as a string.
+--- Return wind direction as a string.
function to_direction(degrees)
-- Ref: https://www.campbellsci.eu/blog/convert-wind-directions
if degrees == nil then
@@ -107,7 +107,7 @@ end)
weather_timer:start()
weather_timer:emit_signal("timeout")
--- Notification with weather information. Popups when mouse hovers over the icon
+--- Notification with weather information. Popups when mouse hovers over the icon
local notification
weather_widget:connect_signal("mouse::enter", function()
notification = naughty.notify{
@@ -124,6 +124,7 @@ weather_widget:connect_signal("mouse::enter", function()
width = 200
}
end)
+
weather_widget:connect_signal("mouse::leave", function()
naughty.destroy(notification)
end)