Giter VIP home page Giter VIP logo

xrandr-rs's Introduction

xrandr

Crates.io Crates.io

This crate aims to provide safe bindings to libxrandr, a library for communicating with monitors and displays using X11 on Linux.

This crate currently supports reading most monitor properties.

For the equivalent on Windows see monitor-control-win.

xrandr-rs's People

Contributors

rintse avatar dzfranklin avatar existency avatar jdonszelmann avatar ragnyll avatar stlkr avatar

Stargazers

Noel avatar Jérôme Lanteri avatar Abiria avatar Philipp Gesang avatar  avatar Sumeet Agarwal avatar

Watchers

 avatar  avatar

xrandr-rs's Issues

Clone trait

Can Monitor an ScreenResourses have clone trait?

List connected, but not activated(?) monitors?

Hey! Thanks for the crate :)
I know nothing about xrandr, but I'm looking to implement toy-project to automatically activate/deactivate my external monitors when I'm connecting/disconnecting them.
I noticed that when I'm just pluggin in the external monitor it appears in the xrandr output:

HDMI-1 connected (normal left inverted right x axis y axis)
   1680x1050     59.88 +
   1280x1024     75.02    60.02  
   1152x864      75.00  
   1024x768      75.03    60.00  
   800x600       75.00    60.32  
   640x480       75.00    59.94  
   720x400       70.08  

This shows even if monitor is not "switched off" by button. But it is not listed in the XHandle::open().unwrap().monitors(). Is it possible to list the monitors that are not "activated" somehow?

Reuse screenresources when creating Crtc and Output

I looked into the libxrandr source and found a mismatch in the structure of the objects.
There is a field of XRRScreenResources that is used in XRRGetCrtcInfo(): the timestamp.

This crate therefore should also make sure that this timestamp is properly passed to the XRRGetCrtcInfo() call.
The way to do this is not throw away the raw pointer ptr in the screenresources handle and pass it into the GetCrtcInfo call, rather than allocating a new handle like I do now.

Missing CI

Right now, the project doesn't have any sort of CI implemented.
This allowed at least one bug to pass unnoticed, which can be seen on #9, that completely broke an entire feature.

I propose the creation of a basic CI, where cargo-test, cargo-fmt and clippy are used to make sure no unwanted change goes through.

I have a semi working example of it on my fork of the repo.
Furthermore, I've found some issues while implementing this, which I'll list below, for further discussion on what should be done about this. If necessary, I'll open issues regarding each of them.

  • Available tests can't be used with github actions as we don't have a monitor.
  • Low test coverage.
  • No guidelines to format the code. (I'm using rustfmt in my example which reformatted nearly the entire project when ran)
  • Not checking whether features work before pushing them to main branch (I've used clippy both as a linter and to check whether the project's features work. Ideally this would be somewhere else, such as cargo test).

If these changes are deemed necessary by @Rintse I may continue working on my fork to at least fix the doctests then PR it here.

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.