summaryrefslogtreecommitdiff
path: root/run-shell
diff options
context:
space:
mode:
authorPavel Makhov <pmakhov@touchtunes.com>2019-03-08 20:55:16 -0500
committerPavel Makhov <pmakhov@touchtunes.com>2019-03-08 20:55:16 -0500
commit5bae3ab4246c9af9d4db8c29faa2de765e940123 (patch)
treeb8f3c015cf4a7075b27d6ab42508c770fb898aa0 /run-shell
parent8ad5c0a46059a7a25cc2c3a464fc6e43c5ba2fbb (diff)
update run shell
Diffstat (limited to 'run-shell')
-rw-r--r--run-shell/run-shell.lua53
1 files changed, 16 insertions, 37 deletions
diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua
index f661e53..b00bfe4 100644
--- a/run-shell/run-shell.lua
+++ b/run-shell/run-shell.lua
@@ -15,7 +15,6 @@ 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()
@@ -24,9 +23,7 @@ local widget = {}
function widget.new()
local widget_instance = {
- _cached_wiboxes = {},
- _cmd_pixelate = [[bash -c 'ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -y -i :0.0+%s,20 -vf frei0r=pixeliz0r -vframes 1 /tmp/i3lock-%s.png ; echo done']],
- _cmd_blur = [[bash -c 'ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -y -i :0.0+%s,20 -filter_complex "boxblur=9" -vframes 1 /tmp/i3lock-%s.png ; echo done']]
+ _cached_wiboxes = {}
}
function widget_instance:_create_wibox()
@@ -34,7 +31,7 @@ function widget.new()
visible = false,
ontop = true,
height = 1060,
- width = 1920
+ width = 1920,
}
w:setup {
@@ -73,46 +70,28 @@ function widget.new()
return w
end
- function widget_instance:launch(s, c)
- c = c or capi.client.focus
- s = mouse.screen
--- naughty.notify { text = 'screen ' .. s.index }
+ function widget_instance:launch()
+ local s = mouse.screen
if not self._cached_wiboxes[s] then
self._cached_wiboxes[s] = {}
--- naughty.notify { text = 'nope' }
end
if not self._cached_wiboxes[s][1] then
self._cached_wiboxes[s][1] = self:_create_wibox()
--- naughty.notify { text = 'nope' }
end
local w = self._cached_wiboxes[s][1]
- local rnd = math.random()
- awful.spawn.with_line_callback(string.format(self._cmd_blur, tostring(awful.screen.focused().geometry.x), rnd), {
- stdout = function(line)
- w.visible = true
- w.bgimage = '/tmp/i3lock-' .. rnd ..'.png'
- awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() })
- awful.prompt.run {
- prompt = 'Run: ',
- 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.visible = false
- w.bgimage = ''
- awful.spawn([[bash -c 'rm -f /tmp/i3lock*']])
- end
- }
+ w.visible = true
+ awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() })
+ awful.prompt.run {
+ prompt = 'Run: ',
+ bg_cursor = '#74aeab',
+ textbox = run_shell.widget,
+ completion_callback = completion.shell,
+ exe_callback = function(...)
+ run_shell:spawn_and_handle_error(...)
end,
- stderr = function(line)
- naughty.notify { text = "ERR:" .. line }
- end,
- })
-
+ history_path = gfs.get_cache_dir() .. "/history",
+ done_callback = function() w.visible = false end
+ }
end
return widget_instance