moved to personal fennel config for awesome and added qutebrowser

This commit is contained in:
Chris Cochrun 2020-10-13 17:35:26 -05:00
parent 403cb92b7d
commit 688748f8a6
502 changed files with 8576 additions and 9597 deletions

View file

@ -0,0 +1,141 @@
local wibox = require('wibox')
local gears = require('gears')
local awful = require('awful')
local beautiful = require('beautiful')
local dpi = beautiful.xresources.apply_dpi
local start_up = true
local icons = require('theme.icons')
local slider = wibox.widget {
nil,
{
id = 'blur_strength_slider',
bar_shape = gears.shape.rounded_rect,
bar_height = dpi(2),
bar_color = '#ffffff20',
bar_active_color = '#f2f2f2EE',
handle_color = '#ffffff',
handle_shape = gears.shape.circle,
handle_width = dpi(15),
handle_border_color = '#00000012',
handle_border_width = dpi(1),
maximum = 100,
widget = wibox.widget.slider,
},
nil,
expand = 'none',
layout = wibox.layout.align.vertical
}
local blur_slider = slider.blur_strength_slider
local update_slider_value = function()
awful.spawn.easy_async_with_shell(
[[bash -c "
grep -F 'strength =' $HOME/.config/awesome/configuration/picom.conf |
awk 'NR==1 {print $3}' | tr -d ';'
"]],
function(stdout, stderr)
local strength = stdout:match('%d+')
blur_strength = tonumber(strength) / 20 * 100
blur_slider:set_value(tonumber(blur_strength))
start_up = false
end
)
end
update_slider_value()
local adjust_blur = function(power)
awful.spawn.with_shell(
[[bash -c "
sed -i 's/.*strength = .*/ strength = ]] .. power .. [[;/g' \
$HOME/.config/awesome/configuration/picom.conf
"]]
)
end
blur_slider:connect_signal(
'property::value',
function()
if not start_up then
strength = blur_slider:get_value() / 50 * 10
adjust_blur(strength)
end
end
)
-- Adjust slider value to change blur strength
awesome.connect_signal(
'widget::blur:increase',
function()
-- On startup, the slider.value returns nil so...
if blur_slider:get_value() == nil then
return
end
local blur_value = blur_slider:get_value() + 10
-- No more than 100!
if blur_value > 100 then
blur_slider:set_value(100)
return
end
blur_slider:set_value(blur_value)
end
)
-- Decrease blur
awesome.connect_signal(
'widget::blur:decrease',
function()
-- On startup, the slider.value returns nil so...
if blur_slider:get_value() == nil then
return
end
local blur_value = blur_slider:get_value() - 10
-- No negatives!
if blur_value < 0 then
blur_slider:set_value(0)
return
end
blur_slider:set_value(blur_value)
end
)
local blur_slider_setting = wibox.widget {
{
{
{
image = icons.effects,
resize = true,
widget = wibox.widget.imagebox
},
top = dpi(12),
bottom = dpi(12),
widget = wibox.container.margin
},
slider,
spacing = dpi(24),
layout = wibox.layout.fixed.horizontal
},
left = dpi(24),
right = dpi(24),
forced_height = dpi(48),
widget = wibox.container.margin
}
return blur_slider_setting

View file

@ -0,0 +1,144 @@
local awful = require('awful')
local wibox = require('wibox')
local gears = require('gears')
local clickable_container = require('widget.window-effects.clickable-container')
local dpi = require('beautiful').xresources.apply_dpi
local filesystem = gears.filesystem
local config_dir = filesystem.get_configuration_dir()
local icons = require('theme.icons')
local apps = require('configuration.apps')
local frame_status = nil
local action_name = wibox.widget {
text = 'Blur Effects',
font = 'SF Pro Text Regular 11',
align = 'left',
widget = wibox.widget.textbox
}
local button_widget = wibox.widget {
{
id = 'icon',
image = icons.toggled_off,
widget = wibox.widget.imagebox,
resize = true
},
layout = wibox.layout.align.horizontal
}
local widget_button = wibox.widget {
{
button_widget,
top = dpi(7),
bottom = dpi(7),
widget = wibox.container.margin
},
widget = clickable_container
}
local update_imagebox = function()
if action_status then
button_widget.icon:set_image(icons.toggled_on)
else
button_widget.icon:set_image(icons.toggled_off)
end
end
local check_blur_status = function()
awful.spawn.easy_async_with_shell(
[[bash -c "
grep -F 'method = \"none\";' ]] .. config_dir .. [[/configuration/picom.conf | tr -d '[\"\;\=\ ]'
"]],
function(stdout, stderr)
if stdout:match('methodnone') then
action_status = false
else
action_status = true
end
update_imagebox()
end
)
end
check_blur_status()
local toggle_blur = function(togglemode)
local toggle_blur_script = [[bash -c "
# Check picom if it's not running then start it
if [ -z $(pgrep picom) ]; then
picom -b --experimental-backends --dbus --config ]] .. config_dir .. [[configuration/picom.conf
fi
case ]] .. togglemode .. [[ in
'enable')
sed -i -e 's/method = \"none\"/method = \"dual_kawase\"/g' \"]] .. config_dir .. [[configuration/picom.conf\"
;;
'disable')
sed -i -e 's/method = \"dual_kawase\"/method = \"none\"/g' \"]] .. config_dir .. [[configuration/picom.conf\"
;;
esac
"]]
-- Run the script
awful.spawn.with_shell(toggle_blur_script)
end
local toggle_blur_fx = function()
local state = nil
if action_status then
action_status = false
state = 'disable'
else
action_status = true
state = 'enable'
end
toggle_blur(state)
update_imagebox()
end
widget_button:buttons(
gears.table.join(
awful.button(
{},
1,
nil,
function()
toggle_blur_fx()
end
)
)
)
local action_widget = wibox.widget {
{
action_name,
nil,
{
widget_button,
layout = wibox.layout.fixed.horizontal,
},
layout = wibox.layout.align.horizontal,
},
left = dpi(24),
right = dpi(24),
forced_height = dpi(48),
widget = wibox.container.margin
}
awesome.connect_signal(
'widget::blur:toggle',
function()
toggle_blur_fx()
end
)
return action_widget

View file

@ -0,0 +1,35 @@
local wibox = require('wibox')
function build(widget)
local container =
wibox.widget {
widget,
widget = wibox.container.background,
}
local old_cursor, old_wibox
container:connect_signal(
'mouse::enter',
function()
-- Hm, no idea how to get the wibox from this signal's arguments...
local w = mouse.current_wibox
if w then
old_cursor, old_wibox = w.cursor, w
w.cursor = 'hand1'
end
end
)
container:connect_signal(
'mouse::leave',
function()
if old_wibox then
old_wibox.cursor = old_cursor
old_wibox = nil
end
end
)
return container
end
return build