如何在Awesome WM配置中使用屏幕旋转?


9

我正在使用xrandr脚本来设置屏幕尺寸和旋转角度。在这种情况下,一个屏幕处于横向模式,另一个屏幕旋转。如何在Awesome WM配置中检测到这种旋转?

目标是设置标签布局,以便沿屏幕的短轴划分窗口。即,awful.layout.suit.tile在横向模式下使用的标签将awful.layout.suit.tile.bottom在纵向模式下使用。也就是说,而不是这样:

在此处输入图片说明

我要这个:

在此处输入图片说明

Answers:


4

今天,这相当容易。假设您在以下布局中定义了以下布局rc.lua

awful.layout.layouts = {
    awful.layout.suit.tile,
    awful.layout.suit.tile.bottom,
}

使用,awful.screen.connect_for_each_screen(func)您可以为每个现有的和将来创建的屏幕调用一个函数。您很有可能已经打过电话rc.lua了(例如设置墙纸或创建标签)。根据您的配置,您需要以下内容:

awful.screen.connect_for_each_screen(function(s)
    if s.geometry.width >= s.geometry.height then
      awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }, s, awful.layout.layouts[1])
    else
      awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9", "0" }, s, awful.layout.layouts[2])
    end
  end)

非常感谢您回答一个有五年历史的问题!是的,这一直困扰着我,是的,您的解决方案有效。实际执行情况
-l0b0
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.