Hello small people stuck inside my computer.
I'm currently having an annoying problem with Sway's scale factor, I can't use a bind to toggle it. After not finding anything useful on the internet, I have decided to counter this problem by keybinding a Lua script that changes my scale factor between 1 and 1.5 with increments of 0.25.
local handle = io.popen("swaymsg -rt get_outputs | jq -r '.[0].scale'")
if handle ~= nil then
local scale = tonumber(handle:read("*a"))
handle:close()
if scale ~= nil then
scale = scale + 0.25;
if scale > 1.5 then
scale = 1;
end
os.execute("swaymsg output '*' scale " .. scale);
end
end
Feel free to copy and modify.
This is really handy for XWayland apps being a blurry or pixelated mess (such as Steam games, for example) or for the times you need extra space on screen.