diff options
Diffstat (limited to 'run-shell')
-rw-r--r-- | run-shell/README_old.md (renamed from run-shell/README.md) | 0 | ||||
-rw-r--r-- | run-shell/run-shell.lua | 55 |
2 files changed, 18 insertions, 37 deletions
diff --git a/run-shell/README.md b/run-shell/README_old.md index 039a23c..039a23c 100644 --- a/run-shell/README.md +++ b/run-shell/README_old.md diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua index f661e53..31d17aa 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,9 @@ function widget.new() visible = false, ontop = true, height = 1060, - width = 1920 + width = 1920, + opacity = 0.6, + bg = '#000002' } w:setup { @@ -73,46 +72,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 |