rotate all relevant screens when requested, and parse the output of xrandr and xinput better

This commit is contained in:
Izaya 2022-09-11 22:13:17 +10:00
parent 257753ec99
commit 0103c4a93c
2 changed files with 10 additions and 7 deletions

View File

@ -25,12 +25,16 @@ local powermenu = {
fullscreen = function(self) fullscreen = function(self)
self.screen.navbar.visible = not self.screen.navbar.visible self.screen.navbar.visible = not self.screen.navbar.visible
end, end,
rotateLeft = function() rotateLeft = function(self)
awful.spawn(gears.filesystem.get_configuration_dir() .. "/awesome-powermenu/rotate.lua left") for k,v in pairs(self.screen.outputs) do
awful.spawn(gears.filesystem.get_configuration_dir() .. "/awesome-powermenu/rotate.lua left " .. tostring(k))
end
awesome.restart() awesome.restart()
end, end,
rotateRight = function() rotateRight = function(self)
awful.spawn(gears.filesystem.get_configuration_dir() .. "/awesome-powermenu/rotate.lua right") for k,v in pairs(self.screen.outputs) do
awful.spawn(gears.filesystem.get_configuration_dir() .. "/awesome-powermenu/rotate.lua right " .. tostring(k))
end
awesome.restart() awesome.restart()
end, end,
brightnessUp = function() brightnessUp = function()
@ -86,7 +90,6 @@ function powermenu.new(s)
} }
local powermenuPopup = awful.popup{ local powermenuPopup = awful.popup{
layout = wibox.layout.fixed.vertical, layout = wibox.layout.fixed.vertical,
-- widget = wibox.container.constraint(powermenuWidget, "min", 512, 512),
widget = powermenuWidget, widget = powermenuWidget,
border_color = beautiful.border_focus, border_color = beautiful.border_focus,
border_width = 2, border_width = 2,

View File

@ -56,13 +56,13 @@ c=f:read("*a")
f:close() f:close()
local line = (c:match("\n("..disp:gsub("%p","%%%1") .. ".-)\n")) local line = (c:match("\n("..disp:gsub("%p","%%%1") .. ".-)\n"))
print(line) print(line)
local orientation = line:match("%S+ %S+ %S+ %S+ (%S+) ") local orientation = line:match(".-(left) %(") or line:match(".-(right) %(") or line:match(".-(normal) %(") or line:match(".-(inverted) %(")
local f = io.popen("xinput --list","r") local f = io.popen("xinput --list","r")
local xin=f:read("*a"):lower() local xin=f:read("*a"):lower()
f:close() f:close()
--⎜ ↳ Elan Touchscreen id=6 [slave pointer (2)] --⎜ ↳ Elan Touchscreen id=6 [slave pointer (2)]
local touchscreen = (xin:match("touch.*screen%s-id=(%d+)")) local touchscreen = (xin:match("touch.*screen%s-id=(%d+)[^\n]-pointer"))
print(orientation) print(orientation)
print(nextLeft(orientation)) print(nextLeft(orientation))