#display #configuration #automatic #xrandr #command-line-tool #cli #generate

bin+lib quickrandr

一个用于保存和恢复xrandr显示配置的命令行工具

3个版本

使用旧的Rust 2015

0.3.2 2017年11月24日
0.3.1 2017年11月24日
0.3.0 2017年11月24日

#xrandr中排名第3

MIT许可证

26KB
525 代码行

quickrandr

一个用于保存和恢复xrandr显示配置的命令行工具。

它通过解析xrandr的输出,并为其生成命令来工作。

注意:由于技术原因,该工具目前完全忽略了xrandr的VIRTUAL*输出。

CLI接口

USAGE:
    quickrandr [FLAGS] [OPTIONS]

FLAGS:
    -a, --auto            Automatically configures the displays according to the config file.
    -n, --create-empty    Creates an empty config file.
        --debug           Does verbose printing, and only simulates calls to xrandr.
    -h, --help            Prints help information
    -i, --info            Prints the contents of the config file and the current connected hardware in an abbreviated
                          form.
    -s, --save            Stores the current display configuration to the config file for a later automatic display
                          configuration.
    -V, --version         Prints version information

OPTIONS:
    -c, --config <FILE>                Sets a custom config file. If not given, it stores it in the users config file
                                       directory.
    -d, --default-profile <PROFILE>    Selects a profile to apply in case --auto does not recognize the current system
                                       config.
    -p, --profile <PROFILE>            Applies the given profile.

示例配置文件

  • autoprofiles下的条目由--save选项自动生成,代表所有已知显示配置的数据库。
  • profiles下的条目是可选的,由用户指定的显示配置,可以用作自动配置的备用,或者强制应用不同的显示配置,而不管连接的显示器。
{
    "autoprofiles": [
        {
            "LVDS1": {
                "edid": "00ffffffffffff0030e435030000000000150103801f1178ead1059558578f2920505400000001010101010101010101010101010101121b5668500012302020350036ae10000019000000000000000000000000000000000000000000fe004c4720446973706c61790a2020000000fe004c503134305748322d544c463100d5",
                "geometry": {
                    "width": 1366,
                    "height": 768,
                    "x_offset": 0,
                    "y_offset": 0,
                    "orientation": "Normal",
                    "is_primary": true
                }
            }
        },
        {
            "LVDS1": {
                "edid": "00ffffffffffff0030e435030000000000150103801f1178ead1059558578f2920505400000001010101010101010101010101010101121b5668500012302020350036ae10000019000000000000000000000000000000000000000000fe004c4720446973706c61790a2020000000fe004c503134305748322d544c463100d5",
                "geometry": {
                    "width": 1366,
                    "height": 768,
                    "x_offset": 0,
                    "y_offset": 0,
                    "orientation": "Normal",
                    "is_primary": true
                }
            },
            "HDMI1": {
                "edid": "00ffffffffffff001ab3e807a89301002715010380331d782afe25a85337ae24115054a54b00a940b300950081008180010101010101023a801871382d40582c9600fd1e11000018000000fd00314c0f5211000a202020202020000000fc00503233542d36204950530a2020000000ff00595633513130333333360a2020006f",
                "geometry": {
                    "width": 1920,
                    "height": 1080,
                    "x_offset": 1366,
                    "y_offset": 0,
                    "orientation": "Normal",
                    "is_primary": false
                }
            }
        }
    ],
    "profiles": {
        "default": {
            "outputs": {
                "LVDS1": "--auto --primary"
            },
            "other_outputs": "--auto --right-of LVDS1"
        },
        "only-lvds": {
            "outputs": {
                "LVDS1": "--auto --primary"
            },
            "other_outputs": "--off"
        }
    }
}

依赖项

~1.3–2.2MB
~39K SLoC