draft of the run shell

This commit is contained in:
Pavel Makhov 2018-11-05 17:04:47 -05:00
parent 90d1836ec9
commit a89e2fe76a
3 changed files with 149 additions and 0 deletions

110
run-shell/run-shell.lua Normal file
View File

@ -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 = "<b>Run</b>: ",
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 = "<b>Run</b>: ",
-- 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
}

37
run-shell/scratch_6.sh Executable file
View File

@ -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

2
run-shell/scratch_7.sh Executable file
View File

@ -0,0 +1,2 @@
#!/usr/bin/env bash
rm -f /tmp/i3lock*