From 856232e616a7d7bc4413677f7d08741c47be2c79 Mon Sep 17 00:00:00 2001 From: Raphaël Fournier-S'niehotta Date: Fri, 13 Apr 2018 13:39:23 +0200 Subject: first commit of the pomodoroarc widget --- pomodoroarc-widget/pomodoroarc.lua | 134 +++++++++++++++++++++++++++++++++++++ 1 file changed, 134 insertions(+) create mode 100644 pomodoroarc-widget/pomodoroarc.lua diff --git a/pomodoroarc-widget/pomodoroarc.lua b/pomodoroarc-widget/pomodoroarc.lua new file mode 100644 index 0000000..5158570 --- /dev/null +++ b/pomodoroarc-widget/pomodoroarc.lua @@ -0,0 +1,134 @@ +------------------------------------------------- +-- 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 = "/home/raph/scripts/pomo/pomo.sh clock" +local PAUSE_pomodoro_CMD = "/home/raph/scripts/pomo/pomo.sh pause" +local START_pomodoro_CMD = "/home/raph/scripts/pomo/pomo.sh start" +local STOP_pomodoro_CMD = "/home/raph/scripts/pomo/pomo.sh 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 + + --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 -- cgit v1.2.3 From 33a424ed6af8ec383e7937ab5c4080cecd1f37f3 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Fri, 29 Jun 2018 08:49:17 -0400 Subject: Update README.md --- README.md | 2 ++ 1 file changed, 2 insertions(+) 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) -- cgit v1.2.3 From 325a6551ded91b6ffe6a2f8467443361d134c0dc Mon Sep 17 00:00:00 2001 From: Paul Cochrane Date: Wed, 11 Jul 2018 12:36:35 +0200 Subject: Fix batteryarc_widget require statement While trying out the widget set I noticed that the installation docs for this widget weren't correct. The `require` statement now works as expected and it matches the pattern used in other installation docs mentioned in the repo. Hope this helps! --- batteryarc-widget/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 -- cgit v1.2.3 From 8c3f67920be60d3e8f9e55dd9d5cc919de844061 Mon Sep 17 00:00:00 2001 From: Klimov Nikolay Date: Thu, 20 Sep 2018 19:20:27 +0300 Subject: Calling bash in watch command --- cpu-widget/cpu-widget.lua | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cpu-widget/cpu-widget.lua b/cpu-widget/cpu-widget.lua index f7fc2e4..f466d09 100644 --- a/cpu-widget/cpu-widget.lua +++ b/cpu-widget/cpu-widget.lua @@ -27,7 +27,7 @@ local cpu_widget = wibox.container.margin(wibox.container.mirror(cpugraph_widget 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') -- cgit v1.2.3 From 9c181c5c7002947c61f0632f8d8d395ac48afa58 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Sat, 22 Sep 2018 19:47:43 -0400 Subject: small changes to pomo widget --- pomodoroarc-widget/README.md | 16 ++++++++++++++++ pomodoroarc-widget/pomodoroarc.lua | 9 +++++---- 2 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 pomodoroarc-widget/README.md 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 index 5158570..dab8c3a 100644 --- a/pomodoroarc-widget/pomodoroarc.lua +++ b/pomodoroarc-widget/pomodoroarc.lua @@ -13,10 +13,10 @@ local watch = require("awful.widget.watch") local wibox = require("wibox") local naughty = require("naughty") -local GET_pomodoro_CMD = "/home/raph/scripts/pomo/pomo.sh clock" -local PAUSE_pomodoro_CMD = "/home/raph/scripts/pomo/pomo.sh pause" -local START_pomodoro_CMD = "/home/raph/scripts/pomo/pomo.sh start" -local STOP_pomodoro_CMD = "/home/raph/scripts/pomo/pomo.sh stop" +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", @@ -65,6 +65,7 @@ text.font = "Inconsolata Medium 13" local workbreak = string.match(stdout, "[ P]?([BW])%d?%d?:%d?%d?") text.text = pomomin +-- Helps debugging --naughty.notify { --text = pomomin, --title = "pomodoro debug", -- cgit v1.2.3 From e55a3ae77a8a3aeac8562ccae558048d81ed6e11 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Tue, 25 Sep 2018 17:36:09 -0400 Subject: changed '//' to '/' - seems like it was a typo --- battery-widget/battery.lua | 2 +- batteryarc-widget/batteryarc.lua | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/battery-widget/battery.lua b/battery-widget/battery.lua index 4cbc314..54a1399 100644 --- a/battery-widget/battery.lua +++ b/battery-widget/battery.lua @@ -89,7 +89,7 @@ watch("acpi", 10, charge = charge + batt.charge end - charge = charge // #battery_info -- use average charge for battery icon + charge = charge / #battery_info -- use average charge for battery icon if (charge >= 0 and charge < 15) then batteryType = "battery-empty%s-symbolic" diff --git a/batteryarc-widget/batteryarc.lua b/batteryarc-widget/batteryarc.lua index 48233f3..54b4cf2 100644 --- a/batteryarc-widget/batteryarc.lua +++ b/batteryarc-widget/batteryarc.lua @@ -60,7 +60,7 @@ watch("acpi", 10, charge = charge + batt.charge end - charge = charge // #battery_info -- use average charge for battery icon + charge = charge / #battery_info -- use average charge for battery icon widget.value = charge / 100 if status == 'Charging' then -- cgit v1.2.3 From 46541730ebd93eb90e006da832c3ba4bdecfe699 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Thu, 4 Oct 2018 10:26:27 -0400 Subject: refactor volumebar/arc widgets --- volumearc-widget/volumearc.lua | 10 ++++------ volumebar-widget/volumebar.lua | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 20 deletions(-) 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 -- cgit v1.2.3 From d185af3b87c17d9afd5602930e3128ba22ab6835 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Fri, 5 Oct 2018 11:02:05 -0400 Subject: refactor volume widget --- volume-widget/volume.lua | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) 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 -- cgit v1.2.3 From 5e522350b61453a11a37fc83314948c35a2cdeee Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Fri, 5 Oct 2018 11:21:57 -0400 Subject: small refactoring --- spotify-widget/spotify.lua | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) 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, _, _, _) -- cgit v1.2.3 From b401c41a257769d8bd89e021e03ddb7989d6715f Mon Sep 17 00:00:00 2001 From: streetturtle Date: Mon, 8 Oct 2018 11:07:28 -0400 Subject: add mouse controls to brightness widget --- brightness-widget/brightness.lua | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) 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 -- cgit v1.2.3 From 150b950cc31fef9540546210881f9a7ea1587b6a Mon Sep 17 00:00:00 2001 From: streetturtle Date: Mon, 8 Oct 2018 11:20:59 -0400 Subject: refactor cpu widget --- cpu-widget/cpu-widget.lua | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/cpu-widget/cpu-widget.lua b/cpu-widget/cpu-widget.lua index f466d09..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,7 +21,7 @@ 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 @@ -38,11 +38,8 @@ watch([[bash -c "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) -- cgit v1.2.3 From 472d03be0ed8edce149dc5e5cfbec595ddaa9b37 Mon Sep 17 00:00:00 2001 From: streetturtle Date: Mon, 8 Oct 2018 11:48:48 -0400 Subject: small refactoring --- weather-widget/weather.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) 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) -- cgit v1.2.3 From d66f91a19f825446b5f7618d5de941a6878e0624 Mon Sep 17 00:00:00 2001 From: tchoutchawn Date: Wed, 17 Oct 2018 22:40:08 -0400 Subject: Created a new muted speaker icon --- volume-widget/audio-volume-muted-symbolic_new.svg | 81 +++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 volume-widget/audio-volume-muted-symbolic_new.svg 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 @@ + + + + + + image/svg+xml + + + + + + + + + + + + + + -- cgit v1.2.3 From e3362639c2b6a91d95a488de3dab57649116aa21 Mon Sep 17 00:00:00 2001 From: Andrew Hill Date: Wed, 31 Oct 2018 19:53:49 -0500 Subject: Fix flipped volume commands The reduce and increase volume commands were flipped --- volume-widget/README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/volume-widget/README.md b/volume-widget/README.md index 19946a2..1fcc456 100644 --- a/volume-widget/README.md +++ b/volume-widget/README.md @@ -36,9 +36,8 @@ s.mytasklist, -- Middle widget To mute/unmute click on the widget. To increase/decrease volume scroll up or down when mouse cursor is over the widget. 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"}), ``` -- cgit v1.2.3 From 22d3efe071b30bb098cb7257970e10b58b938db3 Mon Sep 17 00:00:00 2001 From: Andrew Hill Date: Wed, 31 Oct 2018 19:54:48 -0500 Subject: Add back accidentally removed newline --- volume-widget/README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/volume-widget/README.md b/volume-widget/README.md index 1fcc456..118abc6 100644 --- a/volume-widget/README.md +++ b/volume-widget/README.md @@ -36,6 +36,7 @@ s.mytasklist, -- Middle widget To mute/unmute click on the widget. To increase/decrease volume scroll up or down when mouse cursor is over the widget. 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"}), -- cgit v1.2.3 From 4614f1cee5e301bc99775424636f55e673e8c346 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Fri, 2 Nov 2018 17:52:55 +0100 Subject: Define TOGGLE_MPD_CMD and use it for mpdarc-widget. Signed-off-by: Hasan Ramezani --- mpdarc-widget/mpdarc.lua | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mpdarc-widget/mpdarc.lua b/mpdarc-widget/mpdarc.lua index 56009ef..7b8aea3 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" @@ -66,7 +67,7 @@ local update_graphic = function(widget, stdout, _, _, _) 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 -- cgit v1.2.3 From d9cfaeecd3f28080d57c4e8a39035b7586346dd1 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Fri, 2 Nov 2018 22:56:55 +0100 Subject: Add Installation section to mpdarc-widget/README.md --- mpdarc-widget/README.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) 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, + ... +``` -- cgit v1.2.3 From be68535271043437d339d2992498deabffd5ab9e Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Mon, 5 Nov 2018 11:54:50 +0100 Subject: Add current song text box to mpdarc-widget. --- mpdarc-widget/mpdarc.lua | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/mpdarc-widget/mpdarc.lua b/mpdarc-widget/mpdarc.lua index 7b8aea3..da596f6 100644 --- a/mpdarc-widget/mpdarc.lua +++ b/mpdarc-widget/mpdarc.lua @@ -46,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+)%]") @@ -56,13 +62,16 @@ 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 } + mpdarc_current_song_widget.markup = "" end end @@ -98,4 +107,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 -- cgit v1.2.3 From 7b07eeed8fcf813bab048a54deafadf688a0fd41 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Mon, 5 Nov 2018 11:18:12 -0500 Subject: show widget on focused screen --- ram-widget/ram-widget.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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}, -- cgit v1.2.3 From a1827a1ab0aff25192fb1ec2bf5d29d524ea1fa8 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Mon, 5 Nov 2018 17:02:37 -0500 Subject: show shell on focused screen --- spotify-shell/spotify-shell.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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 = "Spotify Shell: ", bg_cursor = '#84bd00', -- cgit v1.2.3 From 90d1836ec99138f8bdc657fefdb29c776318e16f Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Mon, 5 Nov 2018 17:03:11 -0500 Subject: show shell on focused screen and enable history --- translate-widget/translate.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) 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 = '' 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 = "Translate: ", 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 -- cgit v1.2.3 From a89e2fe76a2134cd473e98c94973267c59567771 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Mon, 5 Nov 2018 17:04:47 -0500 Subject: draft of the run shell --- run-shell/run-shell.lua | 110 ++++++++++++++++++++++++++++++++++++++++++++++++ run-shell/scratch_6.sh | 37 ++++++++++++++++ run-shell/scratch_7.sh | 2 + 3 files changed, 149 insertions(+) create mode 100644 run-shell/run-shell.lua create mode 100755 run-shell/scratch_6.sh create mode 100755 run-shell/scratch_7.sh diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua new file mode 100644 index 0000000..7d5eb41 --- /dev/null +++ b/run-shell/run-shell.lua @@ -0,0 +1,110 @@ +------------------------------------------------- +-- Spotify Shell for Awesome Window Manager +-- Simplifies interaction with Spotify for Linux +-- More details could be found here: +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/spotify-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 spotify_shell = awful.widget.prompt() + +local w = wibox{ + -- bg = '#1e252c55', + -- bgimage = '/home/pmakhov/.config/awesome/themes/awesome-darkspace/somecity.jpg', + visible = false, + border_width = 1, + border_color = '#333333', + max_widget_size = 500, + ontop = true, + -- height = 50, + -- width = 250, + height = 1060, + width = 1920, + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 3) + end +} + +w:setup { + { + { + text = '', + font = 'Play 20', + widget = wibox.widget.textbox, + }, + id = 'icon', + top = 9, + left = 10, + layout = wibox.container.margin + }, + { + -- { + layout = wibox.container.margin, + left = 10, + spotify_shell, + }, + id = 'left', + layout = wibox.layout.fixed.horizontal +} + +local function launch(s) + + awful.spawn.with_line_callback(os.getenv("HOME") .. "/.config/awesome/awesome-wm-widgets/run-shell/scratch_6.sh", { + stdout = function(line) + w.visible = true +-- naughty.notify { text = "LINE:" .. line } + w.bgimage = '/tmp/i3lock' .. line.. '.png' + awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() }) + awful.prompt.run { + prompt = "Run: ", + bg_cursor = '#74aeab', + textbox = spotify_shell.widget, + completion_callback = completion.shell, + exe_callback = function(...) + spotify_shell:spawn_and_handle_error(...) + end, + history_path = gfs.get_cache_dir() .. "/history", + done_callback = function() + w.bgimage='' + w.visible = false + awful.spawn(os.getenv("HOME") .. '/.IntelliJIdea2018.2/config/scratches/scratch_7.sh') + end + } + end, + stderr = function(line) + naughty.notify { text = "ERR:" .. line } + end, + }) + + -- w.bgimage = '/home/pmakhov/.config/awesome/themes/awesome-darkspace/somecity.jpg' + -- w.bg = '#333333', + + -- w.visible = true + -- awful.placement.top(w, { margins = { top = 400 }, parent = awful.screen.focused() }) + -- awful.prompt.run { + -- prompt = "Run: ", + -- bg_cursor = '#74aeab', + -- textbox = spotify_shell.widget, + -- completion_callback = completion.shell, + -- exe_callback = function(...) + -- spotify_shell:spawn_and_handle_error(...) + -- end, + -- history_path = gfs.get_cache_dir() .. "/history", + -- done_callback = function() + -- w.visible = false + -- 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..f3935a7 --- /dev/null +++ b/run-shell/scratch_6.sh @@ -0,0 +1,37 @@ +#!/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" + +if [[ $1 != "" ]]; then + TEXT=$1 +fi + +ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i $DISPLAY -filter_complex "boxblur=5" -vframes 1 $IMAGE + +echo $RNDM diff --git a/run-shell/scratch_7.sh b/run-shell/scratch_7.sh new file mode 100755 index 0000000..165c24d --- /dev/null +++ b/run-shell/scratch_7.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +rm -f /tmp/i3lock* \ No newline at end of file -- cgit v1.2.3 From 944c00201a89dfaaa10632b9e3603ebecd174a30 Mon Sep 17 00:00:00 2001 From: Hasan Ramezani Date: Tue, 6 Nov 2018 21:42:27 +0100 Subject: Set `MPD is not running` in mpdarc-widget current song when MPD is not running. --- mpdarc-widget/mpdarc.lua | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/mpdarc-widget/mpdarc.lua b/mpdarc-widget/mpdarc.lua index da596f6..ca0f411 100644 --- a/mpdarc-widget/mpdarc.lua +++ b/mpdarc-widget/mpdarc.lua @@ -70,8 +70,12 @@ local update_graphic = function(widget, stdout, _, _, _) mpdarc_current_song_widget.markup = current_song else icon.image = STOP_ICON_NAME - widget.colors = { beautiful.widget_red } - mpdarc_current_song_widget.markup = "" + 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 -- cgit v1.2.3 From 8dfc439d75eef94e503249b4c9b123bee1b97bf8 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Tue, 6 Nov 2018 16:35:29 -0500 Subject: improvements for run shell --- run-shell/run-shell.lua | 78 +++++++++++++++++++++++-------------------------- run-shell/scratch_6.sh | 6 ++-- 2 files changed, 38 insertions(+), 46 deletions(-) diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua index 7d5eb41..626be3c 100644 --- a/run-shell/run-shell.lua +++ b/run-shell/run-shell.lua @@ -15,9 +15,9 @@ local gears = require("gears") local naughty = require("naughty") local completion = require("awful.completion") -local spotify_shell = awful.widget.prompt() +local run_shell = awful.widget.prompt() -local w = wibox{ +local w = wibox { -- bg = '#1e252c55', -- bgimage = '/home/pmakhov/.config/awesome/themes/awesome-darkspace/somecity.jpg', visible = false, @@ -37,23 +37,37 @@ local w = wibox{ w:setup { { { - text = '', - font = 'Play 20', - widget = wibox.widget.textbox, + { + { + text = '', + font = 'Play 18', + widget = wibox.widget.textbox, + }, + id = 'icon', + top = 9, + left = 10, + layout = wibox.container.margin + }, + { + -- { + layout = wibox.container.margin, + left = 10, + run_shell, + }, + id = 'left', + layout = wibox.layout.fixed.horizontal }, - id = 'icon', - top = 9, - left = 10, - layout = wibox.container.margin - }, - { - -- { - layout = wibox.container.margin, - left = 10, - spotify_shell, + 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 }, - id = 'left', - layout = wibox.layout.fixed.horizontal + layout = wibox.container.place } local function launch(s) @@ -61,22 +75,21 @@ local function launch(s) awful.spawn.with_line_callback(os.getenv("HOME") .. "/.config/awesome/awesome-wm-widgets/run-shell/scratch_6.sh", { stdout = function(line) w.visible = true --- naughty.notify { text = "LINE:" .. line } - w.bgimage = '/tmp/i3lock' .. line.. '.png' + w.bgimage = '/tmp/i3lock' .. line .. '.png' awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() }) awful.prompt.run { prompt = "Run: ", bg_cursor = '#74aeab', - textbox = spotify_shell.widget, + textbox = run_shell.widget, completion_callback = completion.shell, exe_callback = function(...) - spotify_shell:spawn_and_handle_error(...) + run_shell:spawn_and_handle_error(...) end, history_path = gfs.get_cache_dir() .. "/history", done_callback = function() - w.bgimage='' + -- w.bgimage='' w.visible = false - awful.spawn(os.getenv("HOME") .. '/.IntelliJIdea2018.2/config/scratches/scratch_7.sh') + awful.spawn([[bash -c 'rm -f /tmp/i3lock*']]) end } end, @@ -84,25 +97,6 @@ local function launch(s) naughty.notify { text = "ERR:" .. line } end, }) - - -- w.bgimage = '/home/pmakhov/.config/awesome/themes/awesome-darkspace/somecity.jpg' - -- w.bg = '#333333', - - -- w.visible = true - -- awful.placement.top(w, { margins = { top = 400 }, parent = awful.screen.focused() }) - -- awful.prompt.run { - -- prompt = "Run: ", - -- bg_cursor = '#74aeab', - -- textbox = spotify_shell.widget, - -- completion_callback = completion.shell, - -- exe_callback = function(...) - -- spotify_shell:spawn_and_handle_error(...) - -- end, - -- history_path = gfs.get_cache_dir() .. "/history", - -- done_callback = function() - -- w.visible = false - -- end - -- } end return { diff --git a/run-shell/scratch_6.sh b/run-shell/scratch_6.sh index f3935a7..be30061 100755 --- a/run-shell/scratch_6.sh +++ b/run-shell/scratch_6.sh @@ -28,10 +28,8 @@ RES=$(xrandr --current | grep '*' | uniq | awk '{print $1}') RNDM=$(uuidgen) IMAGE="/tmp/i3lock$RNDM.png" -if [[ $1 != "" ]]; then - TEXT=$1 -fi -ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i $DISPLAY -filter_complex "boxblur=5" -vframes 1 $IMAGE +ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i :0.0+0,20 -filter_complex "boxblur=9" -vframes 1 $IMAGE +#ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i :0.0+0,20 -filter_complex "boxblur=9" -vframes 1 "/tmp/i3lock$(uuidgen).png" echo $RNDM -- cgit v1.2.3 From 1eefac87faefa22b0d3941a9fd4c76010688f59e Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Fri, 9 Nov 2018 11:29:35 -0500 Subject: improvements for run shell --- run-shell/run-shell.lua | 27 +++++++-------------------- run-shell/scratch_6.sh | 13 +++++++++---- run-shell/scratch_7.sh | 2 -- 3 files changed, 16 insertions(+), 26 deletions(-) delete mode 100755 run-shell/scratch_7.sh diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua index 626be3c..e46d5a9 100644 --- a/run-shell/run-shell.lua +++ b/run-shell/run-shell.lua @@ -1,8 +1,7 @@ ------------------------------------------------- --- Spotify Shell for Awesome Window Manager --- Simplifies interaction with Spotify for Linux +-- Run Shell for Awesome Window Manager -- More details could be found here: --- https://github.com/streetturtle/awesome-wm-widgets/tree/master/spotify-shell +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/run-shell -- @author Pavel Makhov -- @copyright 2018 Pavel Makhov @@ -18,20 +17,10 @@ local completion = require("awful.completion") local run_shell = awful.widget.prompt() local w = wibox { - -- bg = '#1e252c55', - -- bgimage = '/home/pmakhov/.config/awesome/themes/awesome-darkspace/somecity.jpg', visible = false, - border_width = 1, - border_color = '#333333', - max_widget_size = 500, ontop = true, - -- height = 50, - -- width = 250, height = 1060, - width = 1920, - shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 3) - end + width = 1920 } w:setup { @@ -49,10 +38,9 @@ w:setup { layout = wibox.container.margin }, { - -- { - layout = wibox.container.margin, - left = 10, run_shell, + left = 10, + layout = wibox.container.margin, }, id = 'left', layout = wibox.layout.fixed.horizontal @@ -71,11 +59,10 @@ w:setup { } local function launch(s) - - awful.spawn.with_line_callback(os.getenv("HOME") .. "/.config/awesome/awesome-wm-widgets/run-shell/scratch_6.sh", { + 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' + w.bgimage = '/tmp/i3lock-' .. line .. '.png' awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() }) awful.prompt.run { prompt = "Run: ", diff --git a/run-shell/scratch_6.sh b/run-shell/scratch_6.sh index be30061..1504a60 100755 --- a/run-shell/scratch_6.sh +++ b/run-shell/scratch_6.sh @@ -24,12 +24,17 @@ # -------------------------- -RES=$(xrandr --current | grep '*' | uniq | awk '{print $1}') +#RES=$(xrandr --current | grep '*' | uniq | awk '{print $1}') RNDM=$(uuidgen) -IMAGE="/tmp/i3lock$RNDM.png" +IMAGE="/tmp/i3lock-$RNDM.png" -ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i :0.0+0,20 -filter_complex "boxblur=9" -vframes 1 $IMAGE -#ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i :0.0+0,20 -filter_complex "boxblur=9" -vframes 1 "/tmp/i3lock$(uuidgen).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/run-shell/scratch_7.sh b/run-shell/scratch_7.sh deleted file mode 100755 index 165c24d..0000000 --- a/run-shell/scratch_7.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -rm -f /tmp/i3lock* \ No newline at end of file -- cgit v1.2.3