update run shell
This commit is contained in:
parent
8ad5c0a460
commit
5bae3ab424
|
@ -15,7 +15,6 @@ local awful = require("awful")
|
||||||
local gfs = require("gears.filesystem")
|
local gfs = require("gears.filesystem")
|
||||||
local wibox = require("wibox")
|
local wibox = require("wibox")
|
||||||
local gears = require("gears")
|
local gears = require("gears")
|
||||||
local naughty = require("naughty")
|
|
||||||
local completion = require("awful.completion")
|
local completion = require("awful.completion")
|
||||||
|
|
||||||
local run_shell = awful.widget.prompt()
|
local run_shell = awful.widget.prompt()
|
||||||
|
@ -24,9 +23,7 @@ local widget = {}
|
||||||
|
|
||||||
function widget.new()
|
function widget.new()
|
||||||
local widget_instance = {
|
local widget_instance = {
|
||||||
_cached_wiboxes = {},
|
_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']]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function widget_instance:_create_wibox()
|
function widget_instance:_create_wibox()
|
||||||
|
@ -34,7 +31,7 @@ function widget.new()
|
||||||
visible = false,
|
visible = false,
|
||||||
ontop = true,
|
ontop = true,
|
||||||
height = 1060,
|
height = 1060,
|
||||||
width = 1920
|
width = 1920,
|
||||||
}
|
}
|
||||||
|
|
||||||
w:setup {
|
w:setup {
|
||||||
|
@ -73,46 +70,28 @@ function widget.new()
|
||||||
return w
|
return w
|
||||||
end
|
end
|
||||||
|
|
||||||
function widget_instance:launch(s, c)
|
function widget_instance:launch()
|
||||||
c = c or capi.client.focus
|
local s = mouse.screen
|
||||||
s = mouse.screen
|
|
||||||
-- naughty.notify { text = 'screen ' .. s.index }
|
|
||||||
if not self._cached_wiboxes[s] then
|
if not self._cached_wiboxes[s] then
|
||||||
self._cached_wiboxes[s] = {}
|
self._cached_wiboxes[s] = {}
|
||||||
-- naughty.notify { text = 'nope' }
|
|
||||||
end
|
end
|
||||||
if not self._cached_wiboxes[s][1] then
|
if not self._cached_wiboxes[s][1] then
|
||||||
self._cached_wiboxes[s][1] = self:_create_wibox()
|
self._cached_wiboxes[s][1] = self:_create_wibox()
|
||||||
-- naughty.notify { text = 'nope' }
|
|
||||||
end
|
end
|
||||||
local w = self._cached_wiboxes[s][1]
|
local w = self._cached_wiboxes[s][1]
|
||||||
local rnd = math.random()
|
w.visible = true
|
||||||
awful.spawn.with_line_callback(string.format(self._cmd_blur, tostring(awful.screen.focused().geometry.x), rnd), {
|
awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() })
|
||||||
stdout = function(line)
|
awful.prompt.run {
|
||||||
w.visible = true
|
prompt = 'Run: ',
|
||||||
w.bgimage = '/tmp/i3lock-' .. rnd ..'.png'
|
bg_cursor = '#74aeab',
|
||||||
awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() })
|
textbox = run_shell.widget,
|
||||||
awful.prompt.run {
|
completion_callback = completion.shell,
|
||||||
prompt = 'Run: ',
|
exe_callback = function(...)
|
||||||
bg_cursor = '#74aeab',
|
run_shell:spawn_and_handle_error(...)
|
||||||
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
|
|
||||||
}
|
|
||||||
end,
|
end,
|
||||||
stderr = function(line)
|
history_path = gfs.get_cache_dir() .. "/history",
|
||||||
naughty.notify { text = "ERR:" .. line }
|
done_callback = function() w.visible = false end
|
||||||
end,
|
}
|
||||||
})
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
return widget_instance
|
return widget_instance
|
||||||
|
|
Loading…
Reference in New Issue