quality: Begin to fix luacheck warnings
This commit is contained in:
parent
6244ed7c26
commit
2d0a957506
9
bar.lua
9
bar.lua
|
@ -34,7 +34,8 @@ local function setup_drawable(data)
|
|||
--Getters
|
||||
data.get_visible = function() return true end
|
||||
data.get_margins = common.get_margins
|
||||
function data:get_widget()
|
||||
|
||||
function data.get_widget()
|
||||
return internal.widget
|
||||
end
|
||||
|
||||
|
@ -48,7 +49,7 @@ local function setup_drawable(data)
|
|||
end
|
||||
|
||||
local function new(args)
|
||||
local args = args or {}
|
||||
args = args or {}
|
||||
args.border_width = args.border_width or 0
|
||||
args.internal = args.internal or {}
|
||||
args.internal.setup_drawable = args.internal.setup_drawable or setup_drawable
|
||||
|
@ -63,14 +64,12 @@ local function new(args)
|
|||
end
|
||||
|
||||
function module.flex(args)
|
||||
local args = args or {}
|
||||
args = args or {}
|
||||
args.internal = args.internal or {}
|
||||
args.internal.layout_func = wibox.layout.flex.horizontal()
|
||||
|
||||
local data = new(args)
|
||||
|
||||
function data._internal.text_fit(self,width,height) return width,height end
|
||||
|
||||
return data,data._internal.margin
|
||||
end
|
||||
|
||||
|
|
35
base.lua
35
base.lua
|
@ -1,13 +1,10 @@
|
|||
local setmetatable = setmetatable
|
||||
local pairs,ipairs = pairs, ipairs
|
||||
local type,string = type,string
|
||||
local print,unpack = print, unpack
|
||||
local table = table
|
||||
local beautiful = require( "beautiful" )
|
||||
local util = require( "awful.util" )
|
||||
local aw_key = require( "awful.key" )
|
||||
local object = require( "radical.object" )
|
||||
local vertical = require( "radical.layout.vertical" )
|
||||
local theme = require( "radical.theme" )
|
||||
local item_mod = require( "radical.item" )
|
||||
local common = require( "radical.common" )
|
||||
|
@ -121,16 +118,15 @@ end
|
|||
------------------------------------KEYBOARD HANDLING-----------------------------------
|
||||
local function activateKeyboard(data)
|
||||
if not data then return end
|
||||
if not data or grabKeyboard == true then return end
|
||||
|
||||
if (not (data._internal.private_data.enable_keyboard == false)) and data.visible == true then
|
||||
capi.keygrabber.run(function(mod, key, event)
|
||||
for k,v in pairs(data._internal.filter_hooks or {}) do --TODO modkeys
|
||||
if (k.key == "Mod4" or k.key == "Mod1") and (key == "End" or key == "Super_L" or key == "Alt_L") then
|
||||
local found = false
|
||||
for k3,v3 in ipairs(mod) do
|
||||
for k4,v4 in ipairs({"Mod4","Mod1"})do
|
||||
for _,v3 in ipairs(mod) do
|
||||
for _,v4 in ipairs({"Mod4","Mod1"})do
|
||||
if v3 == v4 and event == k.event then
|
||||
local retval,self = v(data,mod)
|
||||
local _,self = v(data,mod)
|
||||
if self and type(self) == "table" then
|
||||
data = self
|
||||
end
|
||||
|
@ -260,7 +256,7 @@ local function add_widget(data,widget,args)
|
|||
end
|
||||
|
||||
local function add_widgets(data,widgets)
|
||||
for k,item in ipairs(widgets) do
|
||||
for _,item in ipairs(widgets) do
|
||||
data:add_widget(item)
|
||||
end
|
||||
end
|
||||
|
@ -277,7 +273,7 @@ end
|
|||
local function get_widget_fit_sum(data)
|
||||
local h,w = 0,0
|
||||
-- TODO query this from the layout itself
|
||||
for k,v in ipairs(data._internal.widgets) do
|
||||
for _,v in ipairs(data._internal.widgets) do
|
||||
local fw,fh = v.widget:get_preferred_size()
|
||||
w,h = w + fw,h + fh
|
||||
end
|
||||
|
@ -286,7 +282,7 @@ end
|
|||
|
||||
local function get_widget_fit_height_sum(data)
|
||||
-- TODO query this from the layout itself
|
||||
local w,h = get_widget_fit_sum(data)
|
||||
local _,h = get_widget_fit_sum(data)
|
||||
return h
|
||||
end
|
||||
|
||||
|
@ -308,7 +304,7 @@ end
|
|||
|
||||
---------------------------------MENU HANDLING----------------------------------
|
||||
local function new(args)
|
||||
local args = args or {}
|
||||
args = args or {}
|
||||
local internal = args.internal or {}
|
||||
if not internal.items then internal.items = {} end
|
||||
if not internal.widgets then internal.widgets = {} end
|
||||
|
@ -398,7 +394,7 @@ local function new(args)
|
|||
|
||||
-- Getters
|
||||
data.get_is_menu = function(_) return true end
|
||||
data.get_margin = function(_) return {left=0,bottom=0,right=0,left=0} end
|
||||
data.get_margin = function(_) return {top=0,bottom=0,right=0,left=0} end
|
||||
data.get_items = function(_) return internal.items end
|
||||
data.get_rowcount = function(_) return #internal.items end
|
||||
data.get_visible_row_count = get_visible_row_count
|
||||
|
@ -437,7 +433,7 @@ local function new(args)
|
|||
end
|
||||
end
|
||||
|
||||
data.add_colors_group = function(data,section)
|
||||
data.add_colors_group = function(_,section)
|
||||
theme.add_section(data,section,args)
|
||||
end
|
||||
|
||||
|
@ -481,11 +477,9 @@ local function new(args)
|
|||
end
|
||||
|
||||
--Repaint when appearance properties change
|
||||
for k,v in ipairs({"bg","fg","border_color","border_width","item_height","width","arrow_type"}) do
|
||||
for _,v in ipairs({"bg","fg","border_color","border_width","item_height","width","arrow_type"}) do
|
||||
data:connect_signal(v.."::changed",function()
|
||||
if data.visible and data.style then
|
||||
-- data.style(data)
|
||||
else
|
||||
if not (data.visible and data.style) then
|
||||
data.has_changed = true
|
||||
end
|
||||
end)
|
||||
|
@ -629,11 +623,6 @@ local function new(args)
|
|||
end
|
||||
end
|
||||
|
||||
if private_data.layout then
|
||||
local f = private_data.layout.setup_key_hooks or common.setup_key_hooks
|
||||
f(value, data)
|
||||
end
|
||||
|
||||
data._internal.setup_drawable(data)
|
||||
|
||||
return data
|
||||
|
|
2
box.lua
2
box.lua
|
@ -5,7 +5,7 @@ local shape = require( "gears.shape" )
|
|||
local placement = require( "awful.placement" )
|
||||
|
||||
local function new(args)
|
||||
local args = args or {}
|
||||
args = args or {}
|
||||
args.internal = args.internal or {}
|
||||
args.arrow_type = base.arrow_type.NONE
|
||||
|
||||
|
|
|
@ -156,10 +156,6 @@ function module.setup_item_move_events(data)
|
|||
data._internal.suf_l:add(widget)
|
||||
end)
|
||||
|
||||
data._internal.text_fit = function(self, context, width, height)
|
||||
return width,height
|
||||
end
|
||||
|
||||
data:connect_signal("clear::menu",function(_,vis)
|
||||
l:reset()
|
||||
end)
|
||||
|
|
|
@ -58,7 +58,7 @@ local function setup_drawable(data)
|
|||
end
|
||||
|
||||
local function new(args)
|
||||
local args = args or {}
|
||||
args = args or {}
|
||||
args.internal = args.internal or {}
|
||||
args.internal.setup_drawable = args.internal.setup_drawable or setup_drawable
|
||||
args.internal.setup_item = args.internal.setup_item or common.setup_item
|
||||
|
|
14
dock.lua
14
dock.lua
|
@ -13,6 +13,7 @@ local shape = require( "gears.shape" )
|
|||
local common = require( "radical.common" )
|
||||
local smart_wibox = require( "radical.smart_wibox" )
|
||||
local aplace = require( "awful.placement" )
|
||||
local timer = require( "gears.timer" )
|
||||
|
||||
local default_radius = 10
|
||||
local rad = beautiful.dock_corner_radius or default_radius
|
||||
|
@ -25,17 +26,14 @@ local max_size = {height={},width={}}
|
|||
local function get_max_size(data,screen)
|
||||
local dir = "left"
|
||||
local w_or_h = ((dir == "left" or dir == "right") and "height" or "width")
|
||||
local x_or_y = w_or_h == "height" and "y" or "x"
|
||||
local res = max_size[w_or_h][screen]
|
||||
|
||||
if not res then
|
||||
local full,wa = capi.screen[screen].geometry[w_or_h],capi.screen[screen].workarea
|
||||
local top,bottom = wa[x_or_y],full-(wa.y+wa[w_or_h])
|
||||
local biggest = top > bottom and top or bottom
|
||||
--res = full - biggest*2 - 52 -- 26px margins
|
||||
local margin = beautiful.dock_margin or 52
|
||||
res = wa[w_or_h] - margin
|
||||
res = capi.screen[screen].workarea[w_or_h] - margin
|
||||
max_size[w_or_h][screen] = res
|
||||
end
|
||||
|
||||
return res
|
||||
end
|
||||
|
||||
|
@ -125,7 +123,7 @@ local function setup_drawable(data)
|
|||
end
|
||||
|
||||
local function new(args)
|
||||
local args = args or {}
|
||||
args = args or {}
|
||||
local orientation = (not args.position or args.position == "left" or args.position == "right") and "vertical" or "horizontal"
|
||||
local length_inv = orientation == "vertical" and "width" or "height"
|
||||
|
||||
|
@ -142,7 +140,7 @@ local function new(args)
|
|||
args.internal = args.internal or {}
|
||||
args.internal.layout_func = orientation == "vertical" and vertical or horizontal
|
||||
args.layout = args.layout or args.internal.layout_func
|
||||
args.item_style = args.item_style or item.style
|
||||
args.item_style = args.item_style
|
||||
args.item_layout = args.item_layout or item_layout
|
||||
args[length_inv] = args[length_inv] or 40
|
||||
|
||||
|
|
|
@ -33,7 +33,7 @@ local function setup_drawable(data)
|
|||
end
|
||||
|
||||
local function new(args)
|
||||
local args = args or {}
|
||||
args = args or {}
|
||||
args.internal = args.internal or {}
|
||||
args.internal.setup_drawable = args.internal.setup_drawable or setup_drawable
|
||||
args.internal.setup_item = args.internal.setup_item or common.setup_item
|
||||
|
|
|
@ -39,7 +39,7 @@ local function mouse_leave(w)
|
|||
end
|
||||
|
||||
local function create_hot_corner(corner, s)
|
||||
local s = s or 1
|
||||
s = s or 1
|
||||
|
||||
local size = corners_geo[corner] (
|
||||
capi.screen[s].geometry,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
local setmetatable,type = setmetatable, type
|
||||
local setmetatable = setmetatable
|
||||
local ipairs, pairs = ipairs, pairs
|
||||
local button = require( "awful.button" )
|
||||
local beautiful = require( "beautiful" )
|
||||
|
@ -149,7 +149,7 @@ local function new(args)
|
|||
local pref_bg = wibox.container.background()
|
||||
local pref_l = wibox.layout.align.horizontal()
|
||||
pref_bg.fit = function(s,c,w,h)
|
||||
local w2,h2 = wibox.container.background.fit(s,c,w,h)
|
||||
local w2 = wibox.container.background.fit(s,c,w,h)
|
||||
return w2,currentMenu.item_height
|
||||
end
|
||||
pref_bg:set_bg(currentMenu.bg_alternate)
|
||||
|
@ -223,7 +223,6 @@ local function new(args)
|
|||
checkable = (not auto_release) and v.screen == scr,
|
||||
checked = v.screen == scr and (not auto_release and is_in_tag(t,v)) or nil,
|
||||
button1 = function(a,b,c,d,no_hide)
|
||||
local t = focusTag[v] or v:tags()[1]
|
||||
if t and t.selected == false and not util.table.hasitem(v:tags(),capi.screen[v.screen].selected_tag) then
|
||||
lock_history = true
|
||||
tag.viewonly(t)
|
||||
|
|
|
@ -7,7 +7,6 @@ local capi = { client = client, mouse = mouse, screen = screen}
|
|||
local module = {}
|
||||
|
||||
local function is_checked(m,i)
|
||||
local t = i._tag
|
||||
return true
|
||||
end
|
||||
|
||||
|
@ -23,9 +22,9 @@ local function toggle_tag(i,m)
|
|||
end
|
||||
|
||||
local function new(args)
|
||||
local args = args or {}
|
||||
args = args or {}
|
||||
|
||||
local t,auto_release = tag.selected(capi.client.focus and capi.client.focus.screen or capi.mouse.screen),args.auto_release
|
||||
local auto_release = args.auto_release
|
||||
local currentMenu = radical.box({filter = true, show_filter=not auto_release, autodiscard = true,
|
||||
disable_markup=true,fkeys_prefix=not auto_release,width=(((capi.screen[capi.client.focus and capi.client.focus.screen or capi.mouse.screen]).geometry.width)/2),
|
||||
icon_transformation = beautiful.alttab_icon_transformation,filter_underlay="Use [Shift] and [Control] to toggle clients",filter_underlay_color=beautiful.menu_bg_normal,
|
||||
|
|
|
@ -1,61 +1,51 @@
|
|||
local radical = require("radical")
|
||||
local capi = { screen = screen, }
|
||||
local type,math = type,math
|
||||
local awful = require( "awful" )
|
||||
local type = type
|
||||
local cairo = require( "lgi" ).cairo
|
||||
local surface = require("gears.surface")
|
||||
local shape = require("gears.shape")
|
||||
local util = require("awful.util")
|
||||
local module = {}
|
||||
|
||||
local function createTagList(aScreen)
|
||||
local tagList = radical.context {}
|
||||
for _, v in ipairs(capi.screen[aScreen].tags) do
|
||||
tagList:add_item({text = v.name,icon=v.icon})
|
||||
end
|
||||
return tagList
|
||||
end
|
||||
|
||||
local sigMenu = nil
|
||||
function module.signals()
|
||||
if sigMenu then
|
||||
return sigMenu
|
||||
end
|
||||
sigMenu = radical.context{max_items=10}
|
||||
sigterm = sigMenu:add_item({text="SIGTERM" , button1 = function() util.spawn("kill -s TERM "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="15"}}})
|
||||
sigkill = sigMenu:add_item({text="SIGKILL" , button1 = function() util.spawn("kill -s KILL "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="9"}}})
|
||||
sigint = sigMenu:add_item({text="SIGINT" , button1 = function() util.spawn("kill -s INT "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="2"}}})
|
||||
sigquit = sigMenu:add_item({text="SIGQUIT" , button1 = function() util.spawn("kill -s QUIT "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="3"}}})
|
||||
sigMenu:add_item({text="SIGTERM" , button1 = function() util.spawn("kill -s TERM "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="15"}}})
|
||||
sigMenu:add_item({text="SIGKILL" , button1 = function() util.spawn("kill -s KILL "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="9"}}})
|
||||
sigMenu:add_item({text="SIGINT" , button1 = function() util.spawn("kill -s INT "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="2"}}})
|
||||
sigMenu:add_item({text="SIGQUIT" , button1 = function() util.spawn("kill -s QUIT "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="3"}}})
|
||||
-- sigMenu:add_widget(radical.widgets.separator())
|
||||
sig0 = sigMenu:add_item({text="SIG0" , button1 = function() util.spawn("kill -s 0 "..module.client.pid);mainMenu.visible = false end,infoshapes = { }})
|
||||
sigalrm = sigMenu:add_item({text="SIGALRM" , button1 = function() util.spawn("kill -s ALRM "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="14"}}})
|
||||
sighup = sigMenu:add_item({text="SIGHUP" , button1 = function() util.spawn("kill -s HUP "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="1"}},tooltip="sdfsdfsdf"})
|
||||
sigpipe = sigMenu:add_item({text="SIGPIPE" , button1 = function() util.spawn("kill -s PIPE "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="13"}}})
|
||||
sigpoll = sigMenu:add_item({text="SIGPOLL" , button1 = function() util.spawn("kill -s POLL "..module.client.pid);mainMenu.visible = false end,infoshapes = {}})
|
||||
sigprof = sigMenu:add_item({text="SIGPROF" , button1 = function() util.spawn("kill -s PROF "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="27"}}})
|
||||
sigusr1 = sigMenu:add_item({text="SIGUSR1" , button1 = function() util.spawn("kill -s USR1 "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="10"}}})
|
||||
sigusr2 = sigMenu:add_item({text="SIGUSR2" , button1 = function() util.spawn("kill -s USR2 "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="12"}}})
|
||||
sigsigvtalrm = sigMenu:add_item({text="SIGVTALRM" , button1 = function() util.spawn("kill -s VTALRM "..module.client.pid);mainMenu.visible = false end,infoshapes = {}})
|
||||
sigstkflt = sigMenu:add_item({text="SIGSTKFLT" , button1 = function() util.spawn("kill -s STKFLT "..module.client.pid);mainMenu.visible = false end,infoshapes = {}})
|
||||
sigpwr = sigMenu:add_item({text="SIGPWR" , button1 = function() util.spawn("kill -s PWR "..module.client.pid);mainMenu.visible = false end,infoshapes = {}})
|
||||
sigwinch = sigMenu:add_item({text="SIGWINCH" , button1 = function() util.spawn("kill -s WINCH "..module.client.pid);mainMenu.visible = false end,infoshapes = {}})
|
||||
sigchld = sigMenu:add_item({text="SIGCHLD" , button1 = function() util.spawn("kill -s CHLD "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="17"}}})
|
||||
sigurg = sigMenu:add_item({text="SIGURG" , button1 = function() util.spawn("kill -s URG "..module.client.pid);mainMenu.visible = false end,infoshapes = {}})
|
||||
sigtstp = sigMenu:add_item({text="SIGTSTP" , button1 = function() util.spawn("kill -s TSTP "..module.client.pid);mainMenu.visible = false end,infoshapes = {}})
|
||||
sigttin = sigMenu:add_item({text="SIGTTIN" , button1 = function() util.spawn("kill -s TTIN "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="21"}}})
|
||||
sigttou = sigMenu:add_item({text="SIGTTOU" , button1 = function() util.spawn("kill -s TTOU "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="22"}}})
|
||||
sigstop = sigMenu:add_item({text="SIGSTOP" , button1 = function() util.spawn("kill -s STOP "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="17"}}})
|
||||
sigcont = sigMenu:add_item({text="SIGCONT" , button1 = function() util.spawn("kill -s CONT "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="18"}}})
|
||||
sigabrt = sigMenu:add_item({text="SIGABRT" , button1 = function() util.spawn("kill -s ABRT "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="6"}}})
|
||||
sigfpe = sigMenu:add_item({text="SIGFPE" , button1 = function() util.spawn("kill -s FPE "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="8"}}})
|
||||
sigill = sigMenu:add_item({text="SIGILL" , button1 = function() util.spawn("kill -s ILL "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="4"}}})
|
||||
sigsegv = sigMenu:add_item({text="SIGSEGV" , button1 = function() util.spawn("kill -s SEGV "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="11"}}})
|
||||
sigtrap = sigMenu:add_item({text="SIGTRAP" , button1 = function() util.spawn("kill -s TRAP "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="5"}}})
|
||||
sigsys = sigMenu:add_item({text="SIGSYS" , button1 = function() util.spawn("kill -s SYS "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="12"}}})
|
||||
sigemt = sigMenu:add_item({text="SIGEMT" , button1 = function() util.spawn("kill -s EMT "..module.client.pid);mainMenu.visible = false end,infoshapes = {}})
|
||||
sigbus = sigMenu:add_item({text="SIGBUS" , button1 = function() util.spawn("kill -s BUS "..module.client.pid);mainMenu.visible = false end,infoshapes = {{text="7"}}})
|
||||
sigxcpu = sigMenu:add_item({text="SIGXCPU" , button1 = function() util.spawn("kill -s XCPU "..module.client.pid);mainMenu.visible = false end,infoshapes = {}})
|
||||
sigxfsz = sigMenu:add_item({text="SIGXFSZ" , button1 = function() util.spawn("kill -s XFSZ "..module.client.pid);mainMenu.visible = false end,infoshapes = {}})
|
||||
sigMenu:add_item({text="SIG0" , button1 = function() util.spawn("kill -s 0 "..module.client.pid);sigMenu.visible = false end,infoshapes = { }})
|
||||
sigMenu:add_item({text="SIGALRM" , button1 = function() util.spawn("kill -s ALRM "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="14"}}})
|
||||
sigMenu:add_item({text="SIGHUP" , button1 = function() util.spawn("kill -s HUP "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="1"}},tooltip="sdfsdfsdf"})
|
||||
sigMenu:add_item({text="SIGPIPE" , button1 = function() util.spawn("kill -s PIPE "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="13"}}})
|
||||
sigMenu:add_item({text="SIGPOLL" , button1 = function() util.spawn("kill -s POLL "..module.client.pid);sigMenu.visible = false end,infoshapes = {}})
|
||||
sigMenu:add_item({text="SIGPROF" , button1 = function() util.spawn("kill -s PROF "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="27"}}})
|
||||
sigMenu:add_item({text="SIGUSR1" , button1 = function() util.spawn("kill -s USR1 "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="10"}}})
|
||||
sigMenu:add_item({text="SIGUSR2" , button1 = function() util.spawn("kill -s USR2 "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="12"}}})
|
||||
sigMenu:add_item({text="SIGVTALRM" , button1 = function() util.spawn("kill -s VTALRM "..module.client.pid);sigMenu.visible = false end,infoshapes = {}})
|
||||
sigMenu:add_item({text="SIGSTKFLT" , button1 = function() util.spawn("kill -s STKFLT "..module.client.pid);sigMenu.visible = false end,infoshapes = {}})
|
||||
sigMenu:add_item({text="SIGPWR" , button1 = function() util.spawn("kill -s PWR "..module.client.pid);sigMenu.visible = false end,infoshapes = {}})
|
||||
sigMenu:add_item({text="SIGWINCH" , button1 = function() util.spawn("kill -s WINCH "..module.client.pid);sigMenu.visible = false end,infoshapes = {}})
|
||||
sigMenu:add_item({text="SIGCHLD" , button1 = function() util.spawn("kill -s CHLD "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="17"}}})
|
||||
sigMenu:add_item({text="SIGURG" , button1 = function() util.spawn("kill -s URG "..module.client.pid);sigMenu.visible = false end,infoshapes = {}})
|
||||
sigMenu:add_item({text="SIGTSTP" , button1 = function() util.spawn("kill -s TSTP "..module.client.pid);sigMenu.visible = false end,infoshapes = {}})
|
||||
sigMenu:add_item({text="SIGTTIN" , button1 = function() util.spawn("kill -s TTIN "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="21"}}})
|
||||
sigMenu:add_item({text="SIGTTOU" , button1 = function() util.spawn("kill -s TTOU "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="22"}}})
|
||||
sigMenu:add_item({text="SIGSTOP" , button1 = function() util.spawn("kill -s STOP "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="17"}}})
|
||||
sigMenu:add_item({text="SIGCONT" , button1 = function() util.spawn("kill -s CONT "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="18"}}})
|
||||
sigMenu:add_item({text="SIGABRT" , button1 = function() util.spawn("kill -s ABRT "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="6"}}})
|
||||
sigMenu:add_item({text="SIGFPE" , button1 = function() util.spawn("kill -s FPE "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="8"}}})
|
||||
sigMenu:add_item({text="SIGILL" , button1 = function() util.spawn("kill -s ILL "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="4"}}})
|
||||
sigMenu:add_item({text="SIGSEGV" , button1 = function() util.spawn("kill -s SEGV "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="11"}}})
|
||||
sigMenu:add_item({text="SIGTRAP" , button1 = function() util.spawn("kill -s TRAP "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="5"}}})
|
||||
sigMenu:add_item({text="SIGSYS" , button1 = function() util.spawn("kill -s SYS "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="12"}}})
|
||||
sigMenu:add_item({text="SIGEMT" , button1 = function() util.spawn("kill -s EMT "..module.client.pid);sigMenu.visible = false end,infoshapes = {}})
|
||||
sigMenu:add_item({text="SIGBUS" , button1 = function() util.spawn("kill -s BUS "..module.client.pid);sigMenu.visible = false end,infoshapes = {{text="7"}}})
|
||||
sigMenu:add_item({text="SIGXCPU" , button1 = function() util.spawn("kill -s XCPU "..module.client.pid);sigMenu.visible = false end,infoshapes = {}})
|
||||
sigMenu:add_item({text="SIGXFSZ" , button1 = function() util.spawn("kill -s XFSZ "..module.client.pid);sigMenu.visible = false end,infoshapes = {}})
|
||||
return sigMenu
|
||||
end
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@ local radical = require("radical")
|
|||
local capi = { screen = screen, client=client}
|
||||
local awful = require( "awful" )
|
||||
local beautiful = require("beautiful")
|
||||
local suits = require("awful.layout.suit")
|
||||
local wibox = require("wibox")
|
||||
local tag_list = nil
|
||||
|
||||
local module = {}
|
||||
|
@ -32,7 +30,7 @@ local function createTagList(aScreen,args)
|
|||
end
|
||||
|
||||
function module.listTags(args, menu)
|
||||
local args = args or {}
|
||||
args = args or {}
|
||||
if capi.screen.count() == 1 or args.screen then
|
||||
return createTagList(args.screen or 1,args or {})
|
||||
else
|
||||
|
@ -48,7 +46,8 @@ function module.layouts(menu,layouts)
|
|||
local cur = awful.layout.get(capi.client.focus and capi.client.focus.screen)
|
||||
local screenSelect = menu or radical.context {}
|
||||
|
||||
local layouts = layouts or awful.layout.layouts
|
||||
layouts = layouts or awful.layout.layouts
|
||||
|
||||
for i, layout_real in ipairs(layouts) do
|
||||
local layout2 = awful.layout.getname(layout_real)
|
||||
local is_current = cur and ((layout_real == cur) or (layout_real.name == cur.name))
|
||||
|
@ -68,8 +67,7 @@ end
|
|||
|
||||
-- Widget to replace the default awesome layoutbox
|
||||
function module.layout_item(menu,args)
|
||||
local args = args or {}
|
||||
local ib = wibox.widget.imagebox()
|
||||
args = args or {}
|
||||
local screen = args.screen or 1
|
||||
local sub_menu = nil
|
||||
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
-- This file provide extensions
|
||||
|
||||
local capi = { screen = screen, client=client}
|
||||
local setmetatable = setmetatable
|
||||
local ipairs,pairs = ipairs,pairs
|
||||
local type = type
|
||||
local radical = require( "radical" )
|
||||
local beautiful = require( "beautiful" )
|
||||
local awful = require( "awful" )
|
||||
local util = require( "awful.util" )
|
||||
local wibox = require( "wibox" )
|
||||
local taglist = nil
|
||||
|
||||
local module = {}
|
||||
|
@ -116,5 +110,5 @@ function module.add(name,f)
|
|||
end
|
||||
end
|
||||
|
||||
return setmetatable(module, { __call = function(_, ...) return new(...) end })
|
||||
return module
|
||||
-- kate: space-indent on; indent-width 2; replace-tabs on;
|
|
@ -11,7 +11,6 @@ local radical = require( "radical" )
|
|||
local tag = require( "awful.tag" )
|
||||
local beautiful = require( "beautiful" )
|
||||
local color = require( "gears.color" )
|
||||
local client = require( "awful.client" )
|
||||
local wibox = require( "wibox" )
|
||||
local awful = require( "awful" )
|
||||
local theme = require( "radical.theme")
|
||||
|
@ -39,10 +38,10 @@ local cache = setmetatable({}, { __mode = 'k' })
|
|||
module.buttons = { [1] = function(t) t:view_only() end,
|
||||
[2] = awful.tag.viewtoggle,
|
||||
[3] = function(t,menu,item,button_id,mod,geo)
|
||||
local menu = tag_menu(t)
|
||||
menu.parent_geometry = geo
|
||||
menu.visible = true
|
||||
menu._internal.w:move_by_parent(geo, "cursor")
|
||||
local m = tag_menu(t)
|
||||
m.parent_geometry = geo
|
||||
m.visible = true
|
||||
m._internal.w:move_by_parent(geo, "cursor")
|
||||
end,
|
||||
[4] = function(t) awful.tag.viewnext(t.screen) end,
|
||||
[5] = function(t) awful.tag.viewprev(t.screen) end,
|
||||
|
@ -111,7 +110,6 @@ local function create_item(t,s)
|
|||
end)
|
||||
end
|
||||
|
||||
|
||||
item.tw = tw
|
||||
|
||||
if tag.getproperty(t,"clone_of") then
|
||||
|
@ -119,7 +117,7 @@ local function create_item(t,s)
|
|||
end
|
||||
-- menu:move(item,index)
|
||||
|
||||
menu:connect_signal("button::press",function(menu,item,button_id,mod,geo)
|
||||
menu:connect_signal("button::press",function(_,_,button_id,mod,geo)
|
||||
if module.buttons and module.buttons[button_id] then
|
||||
if item.tag[1] then
|
||||
assert(type(item.tag[1]) == "tag")
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
local setmetatable = setmetatable
|
||||
local io = io
|
||||
local ipairs = ipairs
|
||||
local tag = require( "awful.tag" )
|
||||
local menu = require( "radical.context" )
|
||||
local beautiful = require( "beautiful" )
|
||||
local com_tag = require( "radical.impl.common.tag" )
|
||||
local awful = require("awful")
|
||||
local radical = require("radical")
|
||||
local extensions = require("radical.impl.taglist.extensions")
|
||||
local capi = { screen = screen }
|
||||
|
@ -38,24 +35,24 @@ local function gen_icon(col,height)
|
|||
return img
|
||||
end
|
||||
|
||||
local function set_color(aTag,col)
|
||||
local function set_color(t,col)
|
||||
local pat = col
|
||||
if beautiful.taglist_custom_color then
|
||||
pat = beautiful.taglist_custom_color(pat)
|
||||
end
|
||||
local idx,name = tag_list.register_color(pat)
|
||||
local item = tag_list.item(aTag)
|
||||
local item = tag_list.item(t)
|
||||
item["bg_"..name] = pat
|
||||
item.state[idx] = true
|
||||
end
|
||||
|
||||
local function color_menu(aTag)
|
||||
local function color_menu(t)
|
||||
if not tag_list then
|
||||
tag_list = require("radical.impl.taglist")
|
||||
end
|
||||
local m = radical.context {layout=radical.layout.grid,column=6}
|
||||
m:add_item{icon=gen_icon("#ff0000",m.item_height-4), item_layout = radical.item.layout.icon, button1 = function() set_color(aTag,"#ff0000") end}
|
||||
m:add_item{icon=gen_icon("#00ff00",m.item_height-4), item_layout = radical.item.layout.icon, button1 = function() set_color(aTag,"#00ff00") end}
|
||||
m:add_item{icon=gen_icon("#ff0000",m.item_height-4), item_layout = radical.item.layout.icon, button1 = function() set_color(t,"#ff0000") end}
|
||||
m:add_item{icon=gen_icon("#00ff00",m.item_height-4), item_layout = radical.item.layout.icon, button1 = function() set_color(t,"#00ff00") end}
|
||||
m:add_item{icon=gen_icon("#0000ff",m.item_height-4), item_layout = radical.item.layout.icon}
|
||||
m:add_item{icon=gen_icon("#ff00ff",m.item_height-4), item_layout = radical.item.layout.icon}
|
||||
m:add_item{icon=gen_icon("#ffff00",m.item_height-4), item_layout = radical.item.layout.icon}
|
||||
|
@ -89,7 +86,6 @@ local function new(t)
|
|||
for i=1, #aTag:clients() do
|
||||
aTag:clients()[i]:kill()
|
||||
end
|
||||
-- shifty.del(aTag)
|
||||
end})
|
||||
|
||||
if capi.screen.count() > 1 then
|
||||
|
@ -97,24 +93,12 @@ local function new(t)
|
|||
aTagMenu:add_item({text = "Screen",sub_menu = screenMenu})
|
||||
|
||||
for i=1,capi.screen.count() do
|
||||
screenMenu:add_item({text = "Screen "..i, checked = aTag.screen == i,button1 = function() tag_to_screen(aTag,i) end})
|
||||
screenMenu:add_item({text = "Screen "..i, checked = aTag.screen == i,button1 = function() --[[tag_to_screen(aTag,i)]] end})
|
||||
end
|
||||
end
|
||||
|
||||
aTagMenu:add_item({text = "Set color", sub_menu = function() return color_menu(aTag) end})
|
||||
|
||||
aTagMenu:add_item({text = "Merge With", sub_menu = function() return com_tag.listTags() end})
|
||||
|
||||
function createTagList(aScreen)
|
||||
local tagList = menu()
|
||||
local count = 0
|
||||
for _, v in ipairs(capi.screen[aScreen].tags) do
|
||||
tagList:add_item({text = v.name})
|
||||
count = count + 1
|
||||
end
|
||||
return tagList
|
||||
end
|
||||
|
||||
aTagMenu:add_item({text = "<b>Save settings</b>"})
|
||||
|
||||
local mainMenu2 = menu{layout=radical.layout.grid,column=6,}
|
||||
|
|
|
@ -1,16 +1,14 @@
|
|||
-- This module try to track tags relative index
|
||||
-- It will emit signals the widget can rely on
|
||||
local capi = {tag=tag,screen=screen}
|
||||
local tag = require( "awful.tag" )
|
||||
local object = require( "radical.object" )
|
||||
local awful = require("awful")
|
||||
|
||||
local cache = {}
|
||||
local init = false
|
||||
local screen_cache = setmetatable({}, { __mode = 'k' })--TODO this suck
|
||||
|
||||
local function reload(t,s)
|
||||
local s = s or t.screen or screen_cache[t]
|
||||
s = s or t.screen or screen_cache[t]
|
||||
local tracker = cache[s]
|
||||
|
||||
if not tracker then return end
|
||||
|
@ -51,9 +49,8 @@ end]]--
|
|||
local function new(s)
|
||||
if cache[s] then return cache[s] end
|
||||
|
||||
local tracker,private_data = object({
|
||||
local tracker = object({
|
||||
private_data = {
|
||||
widget = widget,
|
||||
selected = false,
|
||||
},
|
||||
autogen_getmap = true,
|
||||
|
|
|
@ -1,11 +1,7 @@
|
|||
local capi = { screen = screen, }
|
||||
local setmetatable = setmetatable
|
||||
local ipairs,pairs = ipairs,pairs
|
||||
local type = type
|
||||
local radical = require( "radical" )
|
||||
local beautiful = require( "beautiful" )
|
||||
local awful = require( "awful" )
|
||||
local util = require( "awful.util" )
|
||||
local wibox = require( "wibox" )
|
||||
local listTags = require( "radical.impl.common.tag" ).listTags
|
||||
local singalMenu = require( "radical.impl.common.client" ).signals
|
||||
|
@ -60,7 +56,7 @@ local function new(screen, args)
|
|||
return mainMenu
|
||||
end
|
||||
mainMenu = radical.context()
|
||||
local itemVisible,itemVSticky,itemVFloating,itemMaximized,itemMoveToTag,itemSendSignal,itemRenice,itemNewTag,itemLayer,itemClose
|
||||
local itemVisible,itemVSticky,itemVFloating,itemMaximized
|
||||
|
||||
itemVisible = mainMenu:add_item{
|
||||
text = "Visible",
|
||||
|
@ -94,23 +90,23 @@ local function new(screen, args)
|
|||
itemMaximized.checked = module.client.fullscreen
|
||||
end
|
||||
}
|
||||
itemMoveToTag = mainMenu:add_item{text="Move to tag" , sub_menu = function() return listTags() end,}
|
||||
itemSendSignal = mainMenu:add_item{text="Send Signal" , sub_menu = singalMenu() ,}
|
||||
itemRenice = mainMenu:add_item{text="Renice" , checked = true , button1 = function() end,}
|
||||
itemNewTag = mainMenu:add_item{text="Move to a new Tag" , button1 = function()
|
||||
mainMenu:add_item{text="Move to tag" , sub_menu = function() return listTags() end,}
|
||||
mainMenu:add_item{text="Send Signal" , sub_menu = singalMenu() ,}
|
||||
mainMenu:add_item{text="Renice" , checked = true , button1 = function() end,}
|
||||
mainMenu:add_item{text="Move to a new Tag" , button1 = function()
|
||||
local t = createNewTag()
|
||||
module.client:tags({t})
|
||||
awful.tag.viewonly(t)
|
||||
mainMenu.visible = false
|
||||
end}
|
||||
|
||||
itemLayer = mainMenu:add_item({text="Layer" , sub_menu=layerMenu(), button1 = function() end})
|
||||
mainMenu:add_item({text="Layer" , sub_menu=layerMenu(), button1 = function() end})
|
||||
mainMenu:add_item{text="Add widgets",sub_menu=function() return extensions.extensions_menu(module.client) end}
|
||||
mainMenu:add_widget(radical.widgets.separator())
|
||||
|
||||
local ib = wibox.widget.imagebox()
|
||||
ib:set_image(beautiful.titlebar_close_button_normal)
|
||||
itemClose = mainMenu:add_item({text="Close",suffix_widget = ib, button1 = function() if module.client ~= nil then module.client:kill();mainMenu.visible=false end end})
|
||||
mainMenu:add_item({text="Close",suffix_widget = ib, button1 = function() if module.client ~= nil then module.client:kill();mainMenu.visible=false end end})
|
||||
|
||||
return mainMenu
|
||||
end
|
||||
|
|
|
@ -1,14 +1,8 @@
|
|||
-- This file provide extensions
|
||||
|
||||
local capi = { screen = screen, client=client}
|
||||
local setmetatable = setmetatable
|
||||
local ipairs,pairs = ipairs,pairs
|
||||
local type = type
|
||||
local radical = require( "radical" )
|
||||
local beautiful = require( "beautiful" )
|
||||
local awful = require( "awful" )
|
||||
local util = require( "awful.util" )
|
||||
local wibox = require( "wibox" )
|
||||
local tasklist = nil
|
||||
|
||||
local module = {}
|
||||
|
@ -32,7 +26,7 @@ end
|
|||
|
||||
local per_m,per_glob,per_class,per_this = nil
|
||||
local function persistence_menu(ext,position)
|
||||
local position=position
|
||||
|
||||
if not tasklist then
|
||||
tasklist = require("radical.impl.tasklist")
|
||||
end
|
||||
|
@ -139,5 +133,5 @@ function module.add(name,f)
|
|||
end
|
||||
end
|
||||
|
||||
return setmetatable(module, { __call = function(_, ...) return new(...) end })
|
||||
return module
|
||||
-- kate: space-indent on; indent-width 2; replace-tabs on;
|
|
@ -7,7 +7,6 @@
|
|||
---------------------------------------------------------------------------
|
||||
|
||||
local capi = {client = client,tag=tag,screen=screen}
|
||||
local rawset = rawset
|
||||
local radical = require( "radical" )
|
||||
local tag = require( "awful.tag" )
|
||||
local beautiful = require( "beautiful" )
|
||||
|
@ -44,10 +43,10 @@ module.buttons = {
|
|||
end,
|
||||
[3] = function(c,menu,item,button_id,mod, geo)
|
||||
client_menu.client = c
|
||||
local menu = client_menu()
|
||||
local m = client_menu()
|
||||
-- menu.parent_geometry = geo
|
||||
menu.visible = not menu.visible
|
||||
menu._internal.w:move_by_parent(nil, "cursor")
|
||||
m.visible = not m.visible
|
||||
m._internal.w:move_by_parent(nil, "cursor")
|
||||
end,
|
||||
[4] = function(c,menu,item,button_id,mod, geo)
|
||||
client.focus.byidx(1)
|
||||
|
@ -60,10 +59,6 @@ module.buttons = {
|
|||
}
|
||||
|
||||
local function display_screenshot(c,geo,visible)
|
||||
if not visible and prev_menu then
|
||||
prev_menu.visible = false
|
||||
return
|
||||
end
|
||||
if not c then return end
|
||||
|
||||
local dgeo = geo.drawable.drawable:geometry()
|
||||
|
@ -85,7 +80,7 @@ local function sticky_callback(c)
|
|||
sticky[c] = val and true or nil
|
||||
local menu = instances[capi.screen[c.screen]].menu
|
||||
local is_in_tag = false
|
||||
for _,t in ipairs(tag.selectedlist(k)) do
|
||||
for _,t in ipairs(tag.selectedlist(c.screen)) do
|
||||
for k2,v2 in ipairs(c:tags()) do
|
||||
if v2 == t then
|
||||
is_in_tag = true
|
||||
|
@ -263,7 +258,6 @@ end
|
|||
-- Reload the tag
|
||||
local function tag_screen_changed(t)
|
||||
if not t.selected then return end
|
||||
local screen = t.screen
|
||||
load_clients(t)
|
||||
end
|
||||
|
||||
|
@ -340,7 +334,7 @@ local function new(screen)
|
|||
|
||||
load_clients(screen.selected_tag)
|
||||
|
||||
menu:connect_signal("button::press",function(menu,item,button_id,mod,geo)
|
||||
menu:connect_signal("button::press",function(_,item,button_id,mod,geo)
|
||||
if module.buttons and module.buttons[button_id] then
|
||||
module.buttons[button_id](item.client,menu,item,button_id,mod,geo)
|
||||
end
|
||||
|
@ -353,8 +347,8 @@ local function new(screen)
|
|||
return menu,menu._internal.widget
|
||||
end
|
||||
|
||||
function module.item(client)
|
||||
return _cache[client]
|
||||
function module.item(c)
|
||||
return _cache[c]
|
||||
end
|
||||
|
||||
-- Global callbacks
|
||||
|
|
13
init.lua
13
init.lua
|
@ -25,13 +25,14 @@ end
|
|||
-- @tparam[opt=widget] The position mode (see `radical.placement`)
|
||||
local function set_menu(self,menu, event, button_id, mode)
|
||||
if not menu then return end
|
||||
local event = event or "button::pressed"
|
||||
local button_id = button_id or 1
|
||||
|
||||
event = event or "button::pressed"
|
||||
button_id = button_id or 1
|
||||
mode = mode or "widget"
|
||||
|
||||
|
||||
local function trigger(_, geo)
|
||||
local geo = geo or _
|
||||
geo = geo or _
|
||||
local m = menu
|
||||
|
||||
if self._data and self._data.is_menu then
|
||||
|
@ -55,7 +56,7 @@ local function set_menu(self,menu, event, button_id, mode)
|
|||
end
|
||||
|
||||
if event == "button::pressed" then
|
||||
local current,bt = self:buttons(),aw_button({},b,trigger)
|
||||
local current,bt = self:buttons(),aw_button({},button_id,trigger)
|
||||
for k, v in pairs(bt) do
|
||||
current[type(k) == "number" and (#current+1) or k] = v
|
||||
end
|
||||
|
@ -63,11 +64,11 @@ local function set_menu(self,menu, event, button_id, mode)
|
|||
self:connect_signal(event, trigger)
|
||||
end
|
||||
self._menu = menu
|
||||
return bt
|
||||
return button_id
|
||||
end
|
||||
|
||||
local function get_preferred_size(self, context, width, height)
|
||||
local context = context or 1
|
||||
context = context or 1
|
||||
|
||||
if type(context) == "number" then
|
||||
context = {dpi=beautiful.xresources.get_dpi(context)}
|
||||
|
|
|
@ -35,7 +35,7 @@ function module.setup_fkey(item,data)
|
|||
item._internal.f_key = value
|
||||
data:remove_key_hook("F"..value)
|
||||
data:add_key_hook({}, "F"..value , "press", function()
|
||||
item.button1(data,menu)
|
||||
item.button1(data)
|
||||
data.visible = false
|
||||
end)
|
||||
end
|
||||
|
@ -48,13 +48,13 @@ end
|
|||
|
||||
-- Proxy all events to the parent
|
||||
function module.setup_event(data,item,widget)
|
||||
local widget = widget or item.widget
|
||||
widget = widget or item.widget
|
||||
|
||||
-- Setup data signals
|
||||
widget:connect_signal("button::press",function(_,__,___,id,mod,geo)
|
||||
local mods_invert = {}
|
||||
for k,v in ipairs(mod) do
|
||||
mods_invert[v] = i
|
||||
mods_invert[v] = k
|
||||
end
|
||||
|
||||
item.state[4] = true
|
||||
|
@ -64,7 +64,7 @@ function module.setup_event(data,item,widget)
|
|||
widget:connect_signal("button::release",function(wdg,__,___,id,mod,geo)
|
||||
local mods_invert = {}
|
||||
for k,v in ipairs(mod) do
|
||||
mods_invert[v] = i
|
||||
mods_invert[v] = k
|
||||
end
|
||||
item.state[4] = nil
|
||||
data:emit_signal("button::release",item,id,mods_invert,geo)
|
||||
|
|
|
@ -1,7 +1,4 @@
|
|||
local setmetatable = setmetatable
|
||||
local print = print
|
||||
local color = require( "gears.color" )
|
||||
local cairo = require( "lgi" ).cairo
|
||||
local wibox = require( "wibox" )
|
||||
local util = require( "awful.util" )
|
||||
local button = require( "awful.button" )
|
||||
|
@ -9,7 +6,6 @@ local beautiful = require( "beautiful" )
|
|||
local shape = require( "gears.shape" )
|
||||
local surface = require( "gears.surface" )
|
||||
local theme = require( "radical.theme" )
|
||||
local rad_item = require( "radical.item" )
|
||||
|
||||
local module = {}
|
||||
|
||||
|
@ -32,54 +28,59 @@ local function init()
|
|||
end
|
||||
|
||||
function module.up()
|
||||
if not isinit then
|
||||
init()
|
||||
end
|
||||
return arr_up
|
||||
end
|
||||
|
||||
function module.down()
|
||||
if not isinit then
|
||||
init()
|
||||
end
|
||||
return arr_down
|
||||
end
|
||||
|
||||
local function new(data)
|
||||
if not isinit then
|
||||
init()
|
||||
end
|
||||
|
||||
local scroll_w = {}
|
||||
scroll_w.visible = false
|
||||
for k,v in ipairs({"up","down"}) do
|
||||
for k,v in ipairs {"up","down"} do
|
||||
local ib = wibox.widget.imagebox()
|
||||
ib:set_image(module[v]())
|
||||
ib.fit = function(tb,context,width,height)
|
||||
ib.fit = function(tb,context,width,height) --TODO if the align container ever get upstream, use it
|
||||
if scroll_w.visible == false then
|
||||
return 0,0
|
||||
end
|
||||
|
||||
return width,data.item_height
|
||||
end
|
||||
|
||||
ib.draw = function(self, context, cr, width, height)
|
||||
if width > 0 and height > 0 then
|
||||
cr:set_source_surface(self._private.image, width/2 - self._private.image:get_width()/2, 0)
|
||||
cr:set_source_surface(
|
||||
self._private.image, width/2 - self._private.image:get_width()/2, 0
|
||||
)
|
||||
end
|
||||
cr:paint()
|
||||
end
|
||||
|
||||
scroll_w[v] = wibox.container.background()
|
||||
scroll_w[v]:set_widget(ib)
|
||||
scroll_w[v].visible = true
|
||||
data.item_style({widget=scroll_w[v]},{color=data.bg_highlight})
|
||||
|
||||
scroll_w[v]:connect_signal("mouse::enter",function()
|
||||
--FIXME once the theme use a metatable chain, this should start working again
|
||||
theme.update_colors({widget=scroll_w[v]},rad_item.item_flags.HOVER)
|
||||
scroll_w[v]:set_bg(data.bg_focus)
|
||||
end)
|
||||
|
||||
scroll_w[v]:connect_signal("mouse::leave",function()
|
||||
theme.update_colors({widget=scroll_w[v]},rad_item.item_flags.NONE)
|
||||
scroll_w[v]:set_bg(data.bg_highlight)
|
||||
end)
|
||||
|
||||
scroll_w[v]:buttons( util.table.join( button({ }, 1, function()
|
||||
data["scroll_"..v](data)
|
||||
end) ))
|
||||
|
||||
scroll_w[v]:set_bg(data.bg_highlight)
|
||||
end
|
||||
return scroll_w
|
||||
end
|
||||
|
||||
return setmetatable(module, { __call = function(_, ...) return new(...) end })
|
||||
-- kate: space-indent on; indent-width 2; replace-tabs on;
|
||||
-- kate: space-indent on; indent-width 4; replace-tabs on;
|
||||
|
|
Loading…
Reference in New Issue