I have spent a LOT of time (probably a waste) trying to ensure that Chameleon samples the correct background image. I typically use 1 or 2 screens. My wallpaper for 2 screens is a single image that is stitched together to cover the entire backgrouind. So Chameleon needs a CROPX value to ensure it is sampling the RIGHT part of the image, if in fact the widget is on the right monitor.
I have come up with this LUA which determines how many monitors, which monitor you are on, and is your primrary monitor on the LEFT or RIGHT. For me my widget I want Chameleon to sample is always on the primary monitor.
Perhaps others would find this helpful so I decided to share it. If you send Chameleon the MonitorXOffset - with 2 monitors (I don't have a third monitor to test) it should either be 0 or (width of monitor to the left). This should get you the correct start of the background for Chameleon.
I am passing the other variables for troubleshooting.
I have come up with this LUA which determines how many monitors, which monitor you are on, and is your primrary monitor on the LEFT or RIGHT. For me my widget I want Chameleon to sample is always on the primary monitor.
Perhaps others would find this helpful so I decided to share it. If you send Chameleon the MonitorXOffset - with 2 monitors (I don't have a third monitor to test) it should either be 0 or (width of monitor to the left). This should get you the correct start of the background for Chameleon.
I am passing the other variables for troubleshooting.
Code:
-- CurrentMonitor.luafunction Initialize() mNumMonitors = SKIN:GetMeasure('MeasureNumMonitors')endfunction Update() local num = mNumMonitors:GetValue() local mon = 1 local skinX = tonumber(SKIN:GetVariable('CURRENTCONFIGX')) -- figure out which monitor the skin is on for i = 1, num do local left = tonumber(SKIN:GetVariable('SCREENAREAX@'..i)) or 0 local width = tonumber(SKIN:GetVariable('SCREENAREAWIDTH@'..i)) or 0 if skinX >= left and skinX < (left + width) then mon = i break end end -- publish monitor info SKIN:Bang('!SetVariable', 'CurrentMonitorNum', num) SKIN:Bang('!SetVariable', 'CurrentMonitor', mon) -- only care when the skin is on the *primary* monitor local offset = 0 if mon == 1 and num > 1 then local secX = tonumber(SKIN:GetVariable('SCREENAREAX@2')) or 0 if secX < 0 then -- secondary is left of primary ⇒ primary/widget sits on the right half offset = -secX else -- secondary is right of primary ⇒ primary/widget sits on the left half offset = 0 end end -- publish the pixel‐offset for Chameleon SKIN:Bang('!SetVariable','MonitorXOffset',offset) -- derive Left/Right/Single for your widget local widgetLR if num == 1 then widgetLR = "Single" else widgetLR = (offset > 0) and "Right" or "Left" end SKIN:Bang('!SetVariable','WidgetLeftRight',widgetLR)end
Statistics: Posted by ms310 — Today, 4:32 am — Replies 1 — Views 85