summaryrefslogtreecommitdiff
path: root/run-shell
diff options
context:
space:
mode:
Diffstat (limited to 'run-shell')
-rw-r--r--run-shell/run-shell.lua91
-rwxr-xr-xrun-shell/scratch_6.sh40
2 files changed, 131 insertions, 0 deletions
diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua
new file mode 100644
index 0000000..e46d5a9
--- /dev/null
+++ b/run-shell/run-shell.lua
@@ -0,0 +1,91 @@
+-------------------------------------------------
+-- Run Shell for Awesome Window Manager
+-- More details could be found here:
+-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/run-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 run_shell = awful.widget.prompt()
+
+local w = wibox {
+ visible = false,
+ ontop = true,
+ height = 1060,
+ width = 1920
+}
+
+w:setup {
+ {
+ {
+ {
+ {
+ text = '',
+ font = 'Play 18',
+ widget = wibox.widget.textbox,
+ },
+ id = 'icon',
+ top = 9,
+ left = 10,
+ layout = wibox.container.margin
+ },
+ {
+ run_shell,
+ left = 10,
+ layout = wibox.container.margin,
+ },
+ id = 'left',
+ layout = wibox.layout.fixed.horizontal
+ },
+ 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
+ },
+ layout = wibox.container.place
+}
+
+local function launch(s)
+ 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'
+ awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() })
+ awful.prompt.run {
+ prompt = "<b>Run</b>: ",
+ 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.bgimage=''
+ w.visible = false
+ awful.spawn([[bash -c 'rm -f /tmp/i3lock*']])
+ end
+ }
+ end,
+ stderr = function(line)
+ naughty.notify { text = "ERR:" .. line }
+ 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..1504a60
--- /dev/null
+++ b/run-shell/scratch_6.sh
@@ -0,0 +1,40 @@
+#!/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"
+
+
+#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