From a89e2fe76a2134cd473e98c94973267c59567771 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Mon, 5 Nov 2018 17:04:47 -0500 Subject: draft of the run shell --- run-shell/run-shell.lua | 110 ++++++++++++++++++++++++++++++++++++++++++++++++ run-shell/scratch_6.sh | 37 ++++++++++++++++ run-shell/scratch_7.sh | 2 + 3 files changed, 149 insertions(+) create mode 100644 run-shell/run-shell.lua create mode 100755 run-shell/scratch_6.sh create mode 100755 run-shell/scratch_7.sh (limited to 'run-shell') diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua new file mode 100644 index 0000000..7d5eb41 --- /dev/null +++ b/run-shell/run-shell.lua @@ -0,0 +1,110 @@ +------------------------------------------------- +-- Spotify Shell for Awesome Window Manager +-- Simplifies interaction with Spotify for Linux +-- More details could be found here: +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/spotify-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 spotify_shell = awful.widget.prompt() + +local w = wibox{ + -- bg = '#1e252c55', + -- bgimage = '/home/pmakhov/.config/awesome/themes/awesome-darkspace/somecity.jpg', + visible = false, + border_width = 1, + border_color = '#333333', + max_widget_size = 500, + ontop = true, + -- height = 50, + -- width = 250, + height = 1060, + width = 1920, + shape = function(cr, width, height) + gears.shape.rounded_rect(cr, width, height, 3) + end +} + +w:setup { + { + { + text = '', + font = 'Play 20', + widget = wibox.widget.textbox, + }, + id = 'icon', + top = 9, + left = 10, + layout = wibox.container.margin + }, + { + -- { + layout = wibox.container.margin, + left = 10, + spotify_shell, + }, + id = 'left', + layout = wibox.layout.fixed.horizontal +} + +local function launch(s) + + awful.spawn.with_line_callback(os.getenv("HOME") .. "/.config/awesome/awesome-wm-widgets/run-shell/scratch_6.sh", { + stdout = function(line) + w.visible = true +-- naughty.notify { text = "LINE:" .. line } + w.bgimage = '/tmp/i3lock' .. line.. '.png' + awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() }) + awful.prompt.run { + prompt = "Run: ", + bg_cursor = '#74aeab', + textbox = spotify_shell.widget, + completion_callback = completion.shell, + exe_callback = function(...) + spotify_shell:spawn_and_handle_error(...) + end, + history_path = gfs.get_cache_dir() .. "/history", + done_callback = function() + w.bgimage='' + w.visible = false + awful.spawn(os.getenv("HOME") .. '/.IntelliJIdea2018.2/config/scratches/scratch_7.sh') + end + } + end, + stderr = function(line) + naughty.notify { text = "ERR:" .. line } + end, + }) + + -- w.bgimage = '/home/pmakhov/.config/awesome/themes/awesome-darkspace/somecity.jpg' + -- w.bg = '#333333', + + -- w.visible = true + -- awful.placement.top(w, { margins = { top = 400 }, parent = awful.screen.focused() }) + -- awful.prompt.run { + -- prompt = "Run: ", + -- bg_cursor = '#74aeab', + -- textbox = spotify_shell.widget, + -- completion_callback = completion.shell, + -- exe_callback = function(...) + -- spotify_shell:spawn_and_handle_error(...) + -- end, + -- history_path = gfs.get_cache_dir() .. "/history", + -- done_callback = function() + -- w.visible = false + -- 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..f3935a7 --- /dev/null +++ b/run-shell/scratch_6.sh @@ -0,0 +1,37 @@ +#!/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" + +if [[ $1 != "" ]]; then + TEXT=$1 +fi + +ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i $DISPLAY -filter_complex "boxblur=5" -vframes 1 $IMAGE + +echo $RNDM diff --git a/run-shell/scratch_7.sh b/run-shell/scratch_7.sh new file mode 100755 index 0000000..165c24d --- /dev/null +++ b/run-shell/scratch_7.sh @@ -0,0 +1,2 @@ +#!/usr/bin/env bash +rm -f /tmp/i3lock* \ No newline at end of file -- cgit v1.2.3 From 8dfc439d75eef94e503249b4c9b123bee1b97bf8 Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Tue, 6 Nov 2018 16:35:29 -0500 Subject: improvements for run shell --- run-shell/run-shell.lua | 78 +++++++++++++++++++++++-------------------------- run-shell/scratch_6.sh | 6 ++-- 2 files changed, 38 insertions(+), 46 deletions(-) (limited to 'run-shell') diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua index 7d5eb41..626be3c 100644 --- a/run-shell/run-shell.lua +++ b/run-shell/run-shell.lua @@ -15,9 +15,9 @@ local gears = require("gears") local naughty = require("naughty") local completion = require("awful.completion") -local spotify_shell = awful.widget.prompt() +local run_shell = awful.widget.prompt() -local w = wibox{ +local w = wibox { -- bg = '#1e252c55', -- bgimage = '/home/pmakhov/.config/awesome/themes/awesome-darkspace/somecity.jpg', visible = false, @@ -37,23 +37,37 @@ local w = wibox{ w:setup { { { - text = '', - font = 'Play 20', - widget = wibox.widget.textbox, + { + { + text = '', + font = 'Play 18', + widget = wibox.widget.textbox, + }, + id = 'icon', + top = 9, + left = 10, + layout = wibox.container.margin + }, + { + -- { + layout = wibox.container.margin, + left = 10, + run_shell, + }, + id = 'left', + layout = wibox.layout.fixed.horizontal }, - id = 'icon', - top = 9, - left = 10, - layout = wibox.container.margin - }, - { - -- { - layout = wibox.container.margin, - left = 10, - spotify_shell, + 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 }, - id = 'left', - layout = wibox.layout.fixed.horizontal + layout = wibox.container.place } local function launch(s) @@ -61,22 +75,21 @@ local function launch(s) awful.spawn.with_line_callback(os.getenv("HOME") .. "/.config/awesome/awesome-wm-widgets/run-shell/scratch_6.sh", { stdout = function(line) w.visible = true --- naughty.notify { text = "LINE:" .. line } - w.bgimage = '/tmp/i3lock' .. line.. '.png' + w.bgimage = '/tmp/i3lock' .. line .. '.png' awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() }) awful.prompt.run { prompt = "Run: ", bg_cursor = '#74aeab', - textbox = spotify_shell.widget, + textbox = run_shell.widget, completion_callback = completion.shell, exe_callback = function(...) - spotify_shell:spawn_and_handle_error(...) + run_shell:spawn_and_handle_error(...) end, history_path = gfs.get_cache_dir() .. "/history", done_callback = function() - w.bgimage='' + -- w.bgimage='' w.visible = false - awful.spawn(os.getenv("HOME") .. '/.IntelliJIdea2018.2/config/scratches/scratch_7.sh') + awful.spawn([[bash -c 'rm -f /tmp/i3lock*']]) end } end, @@ -84,25 +97,6 @@ local function launch(s) naughty.notify { text = "ERR:" .. line } end, }) - - -- w.bgimage = '/home/pmakhov/.config/awesome/themes/awesome-darkspace/somecity.jpg' - -- w.bg = '#333333', - - -- w.visible = true - -- awful.placement.top(w, { margins = { top = 400 }, parent = awful.screen.focused() }) - -- awful.prompt.run { - -- prompt = "Run: ", - -- bg_cursor = '#74aeab', - -- textbox = spotify_shell.widget, - -- completion_callback = completion.shell, - -- exe_callback = function(...) - -- spotify_shell:spawn_and_handle_error(...) - -- end, - -- history_path = gfs.get_cache_dir() .. "/history", - -- done_callback = function() - -- w.visible = false - -- end - -- } end return { diff --git a/run-shell/scratch_6.sh b/run-shell/scratch_6.sh index f3935a7..be30061 100755 --- a/run-shell/scratch_6.sh +++ b/run-shell/scratch_6.sh @@ -28,10 +28,8 @@ RES=$(xrandr --current | grep '*' | uniq | awk '{print $1}') RNDM=$(uuidgen) IMAGE="/tmp/i3lock$RNDM.png" -if [[ $1 != "" ]]; then - TEXT=$1 -fi -ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i $DISPLAY -filter_complex "boxblur=5" -vframes 1 $IMAGE +ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i :0.0+0,20 -filter_complex "boxblur=9" -vframes 1 $IMAGE +#ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i :0.0+0,20 -filter_complex "boxblur=9" -vframes 1 "/tmp/i3lock$(uuidgen).png" echo $RNDM -- cgit v1.2.3 From 1eefac87faefa22b0d3941a9fd4c76010688f59e Mon Sep 17 00:00:00 2001 From: Pavel Makhov Date: Fri, 9 Nov 2018 11:29:35 -0500 Subject: improvements for run shell --- run-shell/run-shell.lua | 27 +++++++-------------------- run-shell/scratch_6.sh | 13 +++++++++---- run-shell/scratch_7.sh | 2 -- 3 files changed, 16 insertions(+), 26 deletions(-) delete mode 100755 run-shell/scratch_7.sh (limited to 'run-shell') diff --git a/run-shell/run-shell.lua b/run-shell/run-shell.lua index 626be3c..e46d5a9 100644 --- a/run-shell/run-shell.lua +++ b/run-shell/run-shell.lua @@ -1,8 +1,7 @@ ------------------------------------------------- --- Spotify Shell for Awesome Window Manager --- Simplifies interaction with Spotify for Linux +-- Run Shell for Awesome Window Manager -- More details could be found here: --- https://github.com/streetturtle/awesome-wm-widgets/tree/master/spotify-shell +-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/run-shell -- @author Pavel Makhov -- @copyright 2018 Pavel Makhov @@ -18,20 +17,10 @@ local completion = require("awful.completion") local run_shell = awful.widget.prompt() local w = wibox { - -- bg = '#1e252c55', - -- bgimage = '/home/pmakhov/.config/awesome/themes/awesome-darkspace/somecity.jpg', visible = false, - border_width = 1, - border_color = '#333333', - max_widget_size = 500, ontop = true, - -- height = 50, - -- width = 250, height = 1060, - width = 1920, - shape = function(cr, width, height) - gears.shape.rounded_rect(cr, width, height, 3) - end + width = 1920 } w:setup { @@ -49,10 +38,9 @@ w:setup { layout = wibox.container.margin }, { - -- { - layout = wibox.container.margin, - left = 10, run_shell, + left = 10, + layout = wibox.container.margin, }, id = 'left', layout = wibox.layout.fixed.horizontal @@ -71,11 +59,10 @@ w:setup { } local function launch(s) - - awful.spawn.with_line_callback(os.getenv("HOME") .. "/.config/awesome/awesome-wm-widgets/run-shell/scratch_6.sh", { + 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' + w.bgimage = '/tmp/i3lock-' .. line .. '.png' awful.placement.top(w, { margins = { top = 20 }, parent = awful.screen.focused() }) awful.prompt.run { prompt = "Run: ", diff --git a/run-shell/scratch_6.sh b/run-shell/scratch_6.sh index be30061..1504a60 100755 --- a/run-shell/scratch_6.sh +++ b/run-shell/scratch_6.sh @@ -24,12 +24,17 @@ # -------------------------- -RES=$(xrandr --current | grep '*' | uniq | awk '{print $1}') +#RES=$(xrandr --current | grep '*' | uniq | awk '{print $1}') RNDM=$(uuidgen) -IMAGE="/tmp/i3lock$RNDM.png" +IMAGE="/tmp/i3lock-$RNDM.png" -ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i :0.0+0,20 -filter_complex "boxblur=9" -vframes 1 $IMAGE -#ffmpeg -loglevel panic -f x11grab -video_size 1920x1060 -grab_y 20 -y -i :0.0+0,20 -filter_complex "boxblur=9" -vframes 1 "/tmp/i3lock$(uuidgen).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 diff --git a/run-shell/scratch_7.sh b/run-shell/scratch_7.sh deleted file mode 100755 index 165c24d..0000000 --- a/run-shell/scratch_7.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/usr/bin/env bash -rm -f /tmp/i3lock* \ No newline at end of file -- cgit v1.2.3