Added new funtionality to flash_focus
- flash_focus now accepts a table so that each window can have its own ending opacity
This commit is contained in:
parent
677917056d
commit
8543dd1a3c
|
@ -2,10 +2,26 @@ local gears = require("gears")
|
||||||
local beautiful = require("beautiful")
|
local beautiful = require("beautiful")
|
||||||
|
|
||||||
local op = beautiful.flash_focus_start_opacity or 0.6
|
local op = beautiful.flash_focus_start_opacity or 0.6
|
||||||
local stp = beautiful.flash_focus_step or 0.01
|
local stp = beautiful.flash_focus_step or 0.02
|
||||||
|
local transparency_rules = beautiful.flash_focus_transparency_rules or {}
|
||||||
|
|
||||||
|
local function search_rules(c)
|
||||||
|
local found = false
|
||||||
|
local num = 0
|
||||||
|
for _, v in pairs(transparency_rules) do
|
||||||
|
if string.match(v, c.class) or string.match(v, c.name) or string.match(v, c.type) then
|
||||||
|
found = true
|
||||||
|
num = v:match("%d+")
|
||||||
|
break
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return found, num
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
local flashfocus = function(c)
|
local flashfocus = function(c)
|
||||||
if c and #c.screen.clients > 1 then
|
if c and #c.screen.clients > 1 then
|
||||||
|
local found, num = search_rules(c)
|
||||||
c.opacity = op
|
c.opacity = op
|
||||||
local q = op
|
local q = op
|
||||||
local g = gears.timer({
|
local g = gears.timer({
|
||||||
|
@ -18,12 +34,22 @@ local flashfocus = function(c)
|
||||||
if not c.valid then
|
if not c.valid then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
if q >= 1 then
|
if found then
|
||||||
c.opacity = 1
|
if q >= (tonumber(num)/100) then
|
||||||
g:stop()
|
c.opacity = (tonumber(num)/100)
|
||||||
|
g:stop()
|
||||||
|
else
|
||||||
|
c.opacity = q
|
||||||
|
q = q + stp
|
||||||
|
end
|
||||||
else
|
else
|
||||||
c.opacity = q
|
if q >= 1 then
|
||||||
q = q + stp
|
c.opacity = 1
|
||||||
|
g:stop()
|
||||||
|
else
|
||||||
|
c.opacity = q
|
||||||
|
q = q + stp
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end)
|
end)
|
||||||
end
|
end
|
||||||
|
|
|
@ -13,6 +13,7 @@ theme.dont_swallow_filter_activated = true -- whether the filter above should be
|
||||||
-- flash focus
|
-- flash focus
|
||||||
theme.flash_focus_start_opacity = 0.6 -- the starting opacity
|
theme.flash_focus_start_opacity = 0.6 -- the starting opacity
|
||||||
theme.flash_focus_step = 0.01 -- the step of animation
|
theme.flash_focus_step = 0.01 -- the step of animation
|
||||||
|
theme.flash_focus_transparency_rules = {"Code:70", "Alacrity:80"} -- a list of opacity rules for flash focus to use
|
||||||
|
|
||||||
-- playerctl signal
|
-- playerctl signal
|
||||||
theme.playerctl_backend = "playerctl_cli" -- backend to use
|
theme.playerctl_backend = "playerctl_cli" -- backend to use
|
||||||
|
|
Loading…
Reference in New Issue