Giter VIP home page Giter VIP logo

xrandr-gotoggle's Introduction

xrandr-gotoggle

xrandr-gotoggle is a small tool for saving and loading xrandr configurations.

The tool saves xrandr configurations in a configuration file and references them by calculating a sha256 sum over the ID's of all connected monitors, by using the following format:

<calculated sha256 from connected monitors>: ["<xrandr commandline args>"]
5a11328e98459635a78587a4f8b39dbe5f6618932f5247634fce60fe60a19921: ["--screen", "0", "--output", "eDP-1", "--mode", "1920x1080", "--pos", "0x0", "--primary"

Usage

The tool provides the following commands:

Command Function
xrandr-gotoggle apply Tries to apply the saved configuration if available.
xrandr-gotoggle config view Prints the current configuration from the configuration file.
xrandr-gotoggle config print-current-config Prints the current configuration, which could be added to the configuration file, and the corresponding xrandr command.
xrandr-gotoggle config set-current-config Adds or overwrites the current configuration to the configuration file.
xrandr-gotoggle print-checksum Calculates and prints the screen checksum.

Build

To build the binary you need go installed on your system and run the following command.

go build .

Integration

To automatically apply a configuration on boot the tool should get run once after starting the window manager.

E.g. for i3 the following line could be added to the configuration at ~/.config/i3/config:

exec --no-startup-id /usr/local/bin/xrandr-gotoggle apply

To automatically apply a configuration on changes to the currently connected displays, an udev-rule could get added (make sure to set the appropriate DISPLAY und user):

SUBSYSTEM=="drm", ACTION=="change", ENV{DISPLAY}=":1", RUN+="/bin/su - user -c '/usr/local/bin/xrandr-gotoggle apply'"

xrandr-gotoggle's People

Contributors

chrischdi avatar tobiasgiese avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Forkers

tobiasgiese

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.