From 385572ec643ea6d35483b652a17e74b01229b267 Mon Sep 17 00:00:00 2001 From: Michael Carlberg Date: Fri, 13 Jan 2017 03:52:56 +0100 Subject: [PATCH] feat(xrandr): Support for monitors Refs #280 --- cmake/build/options.cmake | 4 +++ cmake/build/summary.cmake | 1 + doc/CMakeLists.txt | 4 +-- doc/config.cmake | 7 +++- doc/zsh/_polybar | 3 +- include/modules/meta/factory.hpp | 4 +-- include/modules/unsupported.hpp | 4 +-- include/settings.hpp.cmake | 22 ++++++++++++ include/x11/extensions/randr.hpp | 4 ++- man/polybar.1 | 15 ++++---- src/adapters/net.cpp | 1 - src/components/bar.cpp | 4 +-- src/components/screen.cpp | 3 +- src/main.cpp | 25 +++++++++----- src/modules/xbacklight.cpp | 3 +- src/x11/extensions/randr.cpp | 59 +++++++++++++++++++++++++------- 16 files changed, 122 insertions(+), 41 deletions(-) diff --git a/cmake/build/options.cmake b/cmake/build/options.cmake index d7a65b6a..fe711913 100644 --- a/cmake/build/options.cmake +++ b/cmake/build/options.cmake @@ -68,6 +68,10 @@ option(WITH_XSYNC "XSYNC support" OFF) option(WITH_XCOMPOSITE "XCOMPOSITE support" OFF) option(WITH_XKB "XKB support" ON) +if(NOT DEFINED ENABLE_XRANDR_MONITORS) + set(ENABLE_XRANDR_MONITORS OFF CACHE STRING "Enable XRandR monitor feature (requires version 1.5+)") +endif() + # }}} # Set cache vars {{{ diff --git a/cmake/build/summary.cmake b/cmake/build/summary.cmake index ebca0682..a46cbb9d 100644 --- a/cmake/build/summary.cmake +++ b/cmake/build/summary.cmake @@ -67,6 +67,7 @@ colored_option(STATUS " Enable mpd ${ENABLE_MPD}" ENABLE_MPD "32;1" "3 colored_option(STATUS " Enable network ${ENABLE_NETWORK}" ENABLE_NETWORK "32;1" "37;2") message(STATUS "--------------------------") colored_option(STATUS " XRANDR support ${WITH_XRANDR}" WITH_XRANDR "32;1" "37;2") +colored_option(STATUS " + XRandR monitors ${ENABLE_XRANDR_MONITORS}" ENABLE_XRANDR_MONITORS "32;1" "37;2") colored_option(STATUS " XRENDER support ${WITH_XRENDER}" WITH_XRENDER "32;1" "37;2") colored_option(STATUS " XDAMAGE support ${WITH_XDAMAGE}" WITH_XDAMAGE "32;1" "37;2") colored_option(STATUS " XSYNC support ${WITH_XSYNC}" WITH_XSYNC "32;1" "37;2") diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 02864e16..a2967021 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -6,7 +6,7 @@ add_subdirectory(zsh) set(MODULES_LEFT "bspwm i3 xwindow") set(MODULES_CENTER "") -set(MODULES_RIGHT "backlight volume xkeyboard memory cpu wlan eth battery temperature date powermenu") +set(MODULES_RIGHT "xbacklight volume xkeyboard memory cpu wlan eth battery temperature date powermenu") # Strip disabled modules {{{ @@ -20,7 +20,7 @@ if(NOT ENABLE_NETWORK) string(REPLACE " wlan eth" "" MODULES_RIGHT ${MODULES_RIGHT}) endif() if(NOT WITH_XRANDR) - string(REPLACE "backlight " "" MODULES_RIGHT ${MODULES_RIGHT}) + string(REPLACE "xbacklight " "backlight-acpi " MODULES_RIGHT ${MODULES_RIGHT}) endif() if(NOT WITH_XKB) string(REPLACE "xkeyboard " "" MODULES_RIGHT ${MODULES_RIGHT}) diff --git a/doc/config.cmake b/doc/config.cmake index 697f7fa0..f61faa24 100644 --- a/doc/config.cmake +++ b/doc/config.cmake @@ -164,7 +164,7 @@ icon-repeat =  toggle-on-foreground = ${colors.primary} toggle-off-foreground = #66 -[module/backlight] +[module/xbacklight] type = internal/xbacklight format =