Skip to content

Commit 1eb046e

Browse files
AKArientrigg
authored andcommitted
panel : brightness : add option to name monitors by their connector
certain monitors can have names that are difficult to interpret, or certain users just prefer to get the connector name, since it includes the type of connection and might be more helpful label just prefer to see
1 parent 9ae6100 commit 1eb046e

4 files changed

Lines changed: 30 additions & 2 deletions

File tree

‎metadata/panel.xml‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -507,6 +507,19 @@
507507
<default>300</default>
508508
<min>1</min>
509509
</option>
510+
<option name="brightness_monitor_label" type="string">
511+
<_short>Monitor naming</_short>
512+
<_long>Type of name to use for the brightness controls of monitors</_long>
513+
<default>model</default>
514+
<desc>
515+
<value>model</value>
516+
<_name>Model name</_name>
517+
</desc>
518+
<desc>
519+
<value>connector</value>
520+
<_name>Connector</_name>
521+
</desc>
522+
</option>
510523
<option name="brightness_scroll_sensitivity" type="double">
511524
<_short>Scroll sensitivity</_short>
512525
<default>1</default>

‎src/panel/widgets/brightness/brightness.hpp‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ class WfLightControl : public Gtk::Box
3030
void update_parent_icon();
3131

3232
WfOption<int> slider_length{"panel/brightness_slider_length"};
33+
WfOption<std::string> label_pref{"panel/brightness_monitor_label"};
3334

3435
public:
3536
WfLightControl(WayfireBrightness *parent);

‎src/panel/widgets/brightness/ddcutil.cpp‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,14 @@ class WfLightDdcaControl : public WfLightControl
5757
ddca_close_display(handle);
5858
scale.set_target_value(get_brightness());
5959
update_parent_icon();
60-
label.set_text(get_name());
60+
61+
if (label_pref.value() == "connector")
62+
{
63+
label.set_text(connector);
64+
} else // "model"
65+
{
66+
label.set_text(get_name());
67+
}
6168

6269
// MCCS doesn’t have anything to track changes to feature codes, so we
6370
// read the current value and adjust the visual when mapped. New thread

‎src/panel/widgets/brightness/sysfs.cpp‎

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,14 @@ class WfLightSysfsControl : public WfLightControl
5050
connector_name = connector_name.substr(0, connector_name.find("/"));
5151

5252
scale.set_target_value(get_brightness());
53-
label.set_text(get_name());
53+
54+
if (label_pref.value() == "connector")
55+
{
56+
label.set_text(connector_name);
57+
} else // "model"
58+
{
59+
label.set_text(get_name());
60+
}
5461
}
5562

5663
std::string get_connector()

0 commit comments

Comments
 (0)