From 8868575217c487ec3916c761f9ce41e550ce1eb4 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 8 Mar 2023 22:42:59 +0100 Subject: src/rotation-lock.cpp: Replace gclue_simple_new_with_thresholds functions --- src/rotation-lock.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/rotation-lock.cpp b/src/rotation-lock.cpp index 9864744..1a8c98d 100644 --- a/src/rotation-lock.cpp +++ b/src/rotation-lock.cpp @@ -127,7 +127,7 @@ public: if (sTest == NULL || !g_str_equal (sTest, "rotation-lock-test")) { - gclue_simple_new_with_thresholds ("ayatana-indicator-display", GCLUE_ACCURACY_LEVEL_CITY, 0, 0, NULL, onGeoClueLoaded, this); + gclue_simple_new ("ayatana-indicator-display", GCLUE_ACCURACY_LEVEL_CITY, NULL, onGeoClueLoaded, this); } GVariant *pProfile = g_settings_get_value (this->m_settings, "color-temp-profile"); @@ -224,7 +224,7 @@ private: { RotationLockIndicator::Impl *pImpl = (RotationLockIndicator::Impl*) pData; GError *pError = NULL; - GClueSimple *pSimple = gclue_simple_new_with_thresholds_finish (pResult, &pError); + GClueSimple *pSimple = gclue_simple_new_finish (pResult, &pError); if (pError != NULL) { -- cgit v1.2.3 From ea15f0a3320491a6ff269240dbe9b238edf18e89 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 8 Mar 2023 20:28:11 +0100 Subject: Add brightness icons --- data/CMakeLists.txt | 2 + .../ayatana-indicator-display-brightness-high.svg | 303 +++++++++++++++++++++ .../ayatana-indicator-display-brightness-low.svg | 280 +++++++++++++++++++ 3 files changed, 585 insertions(+) create mode 100644 data/icons/ayatana-indicator-display-brightness-high.svg create mode 100644 data/icons/ayatana-indicator-display-brightness-low.svg diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 1159064..81b13f4 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -60,5 +60,7 @@ install (FILES "${AYATANA_INDICATOR_FILE}" # ayatana-indicator-display-colortemp-off.svg # ayatana-indicator-display-colortemp-on.svg +# ayatana-indicator-display-brightness-low +# ayatana-indicator-display-brightness-high install (DIRECTORY "icons/" DESTINATION "${CMAKE_INSTALL_FULL_DATADIR}/icons/hicolor/scalable/status" FILES_MATCHING PATTERN "*.svg") diff --git a/data/icons/ayatana-indicator-display-brightness-high.svg b/data/icons/ayatana-indicator-display-brightness-high.svg new file mode 100644 index 0000000..e2fd1aa --- /dev/null +++ b/data/icons/ayatana-indicator-display-brightness-high.svg @@ -0,0 +1,303 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/icons/ayatana-indicator-display-brightness-low.svg b/data/icons/ayatana-indicator-display-brightness-low.svg new file mode 100644 index 0000000..47a366d --- /dev/null +++ b/data/icons/ayatana-indicator-display-brightness-low.svg @@ -0,0 +1,280 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + image/svg+xml + + + + + Frank Solensky + + + + + weather + clear + night + moon + 190 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + -- cgit v1.2.3 From 13d89c6789855f96cf5e0465c1fe894d63fec8ea Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 8 Mar 2023 20:29:02 +0100 Subject: data/org.ayatana.indicator.display.gschema.xml: Store current brightness --- data/org.ayatana.indicator.display.gschema.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/data/org.ayatana.indicator.display.gschema.xml b/data/org.ayatana.indicator.display.gschema.xml index 3483d06..3a0c89b 100644 --- a/data/org.ayatana.indicator.display.gschema.xml +++ b/data/org.ayatana.indicator.display.gschema.xml @@ -31,5 +31,11 @@ Color temperature profile The current color temperature profile being used by the indicator. + + + 1.0 + Screen brightness + Stores the current brightness value of your screen. + -- cgit v1.2.3 From 6b17e30fdca2a6aa772b2af1c8b648970f1ae362 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 8 Mar 2023 20:30:52 +0100 Subject: src/rotation-lock.cpp: Add brightness action, slider and handlers fixes https://github.com/AyatanaIndicators/ayatana-indicator-display/issues/72 --- src/rotation-lock.cpp | 36 +++++++++++++++++++++++++++++++++--- 1 file changed, 33 insertions(+), 3 deletions(-) diff --git a/src/rotation-lock.cpp b/src/rotation-lock.cpp index 1a8c98d..9523358 100644 --- a/src/rotation-lock.cpp +++ b/src/rotation-lock.cpp @@ -172,6 +172,8 @@ private: guint nTemperature = 6500; GVariant *pProfile = g_settings_get_value (pImpl->m_settings, "color-temp-profile"); guint nProfile = g_variant_get_uint16 (pProfile); + GVariant *pBrightness = g_settings_get_value (pImpl->m_settings, "brightness"); + gdouble fBrightness = g_variant_get_double (pBrightness); if (nProfile == 0) { @@ -206,7 +208,7 @@ private: g_action_change_state (pAction, pTemperature); GError *pError = NULL; - gchar *sCommand = g_strdup_printf ("xsct %u", nTemperature); + gchar *sCommand = g_strdup_printf ("xsct %u %f", nTemperature, fBrightness); gboolean bSuccess = g_spawn_command_line_sync (sCommand, NULL, NULL, NULL, &pError); if (!bSuccess) @@ -248,6 +250,11 @@ private: updateColorTemp (pData); } + static void onBrightnessSettings (GSettings *pSettings, const gchar *sKey, gpointer pData) + { + updateColorTemp (pData); + } + static void onColorTempProfile (GSettings *pSettings, const gchar *sKey, gpointer pData) { RotationLockIndicator::Impl *pImpl = (RotationLockIndicator::Impl*) pData; @@ -374,6 +381,14 @@ private: g_action_map_add_action(G_ACTION_MAP(group), G_ACTION(action)); g_object_unref(G_OBJECT(action)); g_signal_connect (m_settings, "changed::color-temp-profile", G_CALLBACK (onColorTempProfile), this); + + pVariantType = g_variant_type_new("d"); + action = g_simple_action_new_stateful ("brightness", pVariantType, g_variant_new_double (0)); + g_variant_type_free(pVariantType); + g_settings_bind_with_mapping (m_settings, "brightness", action, "state", G_SETTINGS_BIND_DEFAULT, settings_to_action_state, action_state_to_settings, NULL, NULL); + g_action_map_add_action (G_ACTION_MAP (group), G_ACTION (action)); + g_object_unref (G_OBJECT (action)); + g_signal_connect (m_settings, "changed::brightness", G_CALLBACK (onBrightnessSettings), this); } #endif @@ -450,10 +465,25 @@ private: { #ifdef COLOR_TEMP_ENABLED section = g_menu_new (); - GIcon *pIconMin = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-colortemp-on"); - GIcon *pIconMax = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-colortemp-off"); + + GIcon *pIconMin = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-brightness-low"); + GIcon *pIconMax = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-brightness-high"); GVariant *pIconMinSerialised = g_icon_serialize (pIconMin); GVariant *pIconMaxSerialised = g_icon_serialize (pIconMax); + menu_item = g_menu_item_new (_("Brightness"), "indicator.brightness"); + g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); + g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); + g_menu_item_set_attribute_value (menu_item, "min-icon", pIconMinSerialised); + g_menu_item_set_attribute_value (menu_item, "max-icon", pIconMaxSerialised); + g_menu_item_set_attribute (menu_item, "min-value", "d", 0.5); + g_menu_item_set_attribute (menu_item, "max-value", "d", 1.0); + g_menu_item_set_attribute (menu_item, "step", "d", 0.005); + g_menu_append_item (section, menu_item); + + pIconMin = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-colortemp-on"); + pIconMax = g_themed_icon_new_with_default_fallbacks ("ayatana-indicator-display-colortemp-off"); + pIconMinSerialised = g_icon_serialize (pIconMin); + pIconMaxSerialised = g_icon_serialize (pIconMax); menu_item = g_menu_item_new (_("Color temperature"), "indicator.color-temp"); g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); g_menu_item_set_attribute (menu_item, "x-ayatana-type", "s", "org.ayatana.indicator.slider"); -- cgit v1.2.3 From bd6769f3b5831d4cd96c2dc46e25c82f04c08695 Mon Sep 17 00:00:00 2001 From: Robert Tari Date: Wed, 8 Mar 2023 20:36:57 +0100 Subject: debian/control: Require xsct 1.9 or higher --- debian/control | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/debian/control b/debian/control index df5c26c..2bf8004 100644 --- a/debian/control +++ b/debian/control @@ -40,7 +40,7 @@ Depends: ${shlibs:Depends}, ayatana-indicator-common, libglib2.0-bin, libgeoclue-2-0, - xsct, + xsct (>= 1.9), Description: Ayatana Indicator for Display configuration This Ayatana Indicator is designed to be placed on the right side of a panel and give the user easy control for changing their display settings. -- cgit v1.2.3