get rid of script usage

This commit is contained in:
Pavel Makhov 2018-12-24 10:05:15 -05:00
parent 9012468e8f
commit 627a6888a2
1 changed files with 11 additions and 11 deletions

View File

@ -25,9 +25,10 @@ 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()
local w = wibox { local w = wibox {
visible = false, visible = false,
@ -41,8 +42,7 @@ function widget.new()
{ {
{ {
{ {
text = 'a', markup = '<span font="awesomewm-font 14" color="#ffffff">a</span>',
font = 'awesomewm-font 13',
widget = wibox.widget.textbox, widget = wibox.widget.textbox,
}, },
id = 'icon', id = 'icon',
@ -75,7 +75,7 @@ function widget.new()
function widget_instance:launch(s, c) function widget_instance:launch(s, c)
c = c or capi.client.focus c = c or capi.client.focus
s = s or (c and c.screen or awful.screen.focused()) s = s or (c and c.screen or mouse.screen)
naughty.notify { text = 'screen ' .. s.index } 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] = {}
@ -86,10 +86,11 @@ function widget.new()
naughty.notify { text = 'nope' } naughty.notify { text = 'nope' }
end end
local w = self._cached_wiboxes[s][1] local w = self._cached_wiboxes[s][1]
awful.spawn.with_line_callback(os.getenv("HOME") .. "/.config/awesome/awesome-wm-widgets/run-shell/scratch_6.sh " .. tostring(awful.screen.focused().geometry.x), { local rnd = math.random()
awful.spawn.with_line_callback(string.format(self._cmd_pixelate, tostring(awful.screen.focused().geometry.x), rnd), {
stdout = function(line) stdout = function(line)
w.visible = true w.visible = true
w.bgimage = '/tmp/i3lock-' .. line .. '.png' w.bgimage = '/tmp/i3lock-' .. rnd ..'.png'
awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() }) awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() })
awful.prompt.run { awful.prompt.run {
prompt = 'Run: ', prompt = 'Run: ',
@ -128,5 +129,4 @@ function widget.launch(...)
return get_default_widget():launch(...) return get_default_widget():launch(...)
end end
return widget return widget