Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
T
tuner-displays
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Ximper Linux
tuner-displays
Commits
0da3ae6a
Verified
Commit
0da3ae6a
authored
May 31, 2026
by
Kirill Unitsaev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ui: use backend capabilities
parent
80e814c3
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
144 additions
and
92 deletions
+144
-92
display-backend.vala
src/backends/display-backend.vala
+18
-0
gnome-backend.vala
src/backends/gnome-backend.vala
+8
-0
hyprland-backend.vala
src/backends/hyprland-backend.vala
+6
-0
niri-backend.vala
src/backends/niri-backend.vala
+4
-0
plugin.vala
src/plugin.vala
+1
-1
displays-view.vala
src/ui/displays-view.vala
+8
-8
monitor-row.vala
src/ui/monitor-row.vala
+4
-4
monitor-settings-content.vala
src/ui/monitor-settings-content.vala
+95
-79
No files found.
src/backends/display-backend.vala
View file @
0da3ae6a
...
...
@@ -11,6 +11,24 @@ namespace TunerDisplays {
public
abstract
string
id
{
get
;
}
public
abstract
string
title
{
owned
get
;
}
public
abstract
bool
can_apply
{
get
;
}
public
virtual
bool
requires_connected_layout
{
get
{
return
false
;
}
}
public
virtual
bool
preserves_disabled_monitor_position
{
get
{
return
true
;
}
}
public
virtual
bool
supports_monitor_change_events
{
get
{
return
false
;
}
}
public
virtual
bool
supports_global_mirroring
{
get
{
return
false
;
}
}
public
virtual
bool
supports_primary_display
{
get
{
return
false
;
}
}
public
virtual
bool
uses_separate_refresh_rate_controls
{
get
{
return
false
;
}
}
public
virtual
bool
supports_output_mirroring
{
get
{
return
false
;
}
}
public
virtual
bool
supports_description_identifier
{
get
{
return
false
;
}
}
public
virtual
bool
supports_bit_depth
{
get
{
return
false
;
}
}
public
virtual
bool
supports_vrr_modes
{
get
{
return
false
;
}
}
public
virtual
bool
supports_adaptive_sync
{
get
{
return
false
;
}
}
public
virtual
bool
supports_color_management
{
get
{
return
false
;
}
}
public
virtual
bool
supports_hdr_metadata
{
get
{
return
false
;
}
}
public
virtual
bool
supports_focus_at_startup
{
get
{
return
false
;
}
}
public
virtual
bool
supports_backdrop_color
{
get
{
return
false
;
}
}
public
virtual
bool
supports_hot_corners
{
get
{
return
false
;
}
}
public
virtual
bool
supports_underscanning
{
get
{
return
false
;
}
}
public
virtual
bool
supports_hdr_toggle
{
get
{
return
false
;
}
}
public
abstract
Gee
.
ArrayList
<
MonitorConfig
>
load
()
throws
Error
;
public
abstract
void
apply
(
Gee
.
ArrayList
<
MonitorConfig
>
monitors
)
throws
Error
;
...
...
src/backends/gnome-backend.vala
View file @
0da3ae6a
...
...
@@ -13,6 +13,14 @@ namespace TunerDisplays {
public
override
string
id
{
get
{
return
"gnome"
;
}
}
public
override
string
title
{
owned
get
{
return
"GNOME"
;
}
}
public
override
bool
can_apply
{
get
{
return
true
;
}
}
public
override
bool
requires_connected_layout
{
get
{
return
true
;
}
}
public
override
bool
preserves_disabled_monitor_position
{
get
{
return
false
;
}
}
public
override
bool
supports_monitor_change_events
{
get
{
return
true
;
}
}
public
override
bool
supports_global_mirroring
{
get
{
return
true
;
}
}
public
override
bool
supports_primary_display
{
get
{
return
true
;
}
}
public
override
bool
uses_separate_refresh_rate_controls
{
get
{
return
true
;
}
}
public
override
bool
supports_underscanning
{
get
{
return
true
;
}
}
public
override
bool
supports_hdr_toggle
{
get
{
return
true
;
}
}
public
override
Gee
.
ArrayList
<
MonitorConfig
>
load
()
throws
Error
{
var
state
=
call_display_config
(
"GetCurrentState"
,
null
,
null
);
...
...
src/backends/hyprland-backend.vala
View file @
0da3ae6a
...
...
@@ -22,6 +22,12 @@ namespace TunerDisplays {
public
override
string
id
{
get
{
return
"hyprland"
;
}
}
public
override
string
title
{
owned
get
{
return
"Hyprland"
;
}
}
public
override
bool
can_apply
{
get
{
return
true
;
}
}
public
override
bool
supports_output_mirroring
{
get
{
return
true
;
}
}
public
override
bool
supports_description_identifier
{
get
{
return
true
;
}
}
public
override
bool
supports_bit_depth
{
get
{
return
true
;
}
}
public
override
bool
supports_vrr_modes
{
get
{
return
true
;
}
}
public
override
bool
supports_color_management
{
get
{
return
true
;
}
}
public
override
bool
supports_hdr_metadata
{
get
{
return
true
;
}
}
public
override
Gee
.
ArrayList
<
MonitorConfig
>
load
()
throws
Error
{
var
monitors
=
new
Gee
.
ArrayList
<
MonitorConfig
>();
...
...
src/backends/niri-backend.vala
View file @
0da3ae6a
...
...
@@ -30,6 +30,10 @@ namespace TunerDisplays {
public
override
string
id
{
get
{
return
"niri"
;
}
}
public
override
string
title
{
owned
get
{
return
"niri"
;
}
}
public
override
bool
can_apply
{
get
{
return
true
;
}
}
public
override
bool
supports_adaptive_sync
{
get
{
return
true
;
}
}
public
override
bool
supports_focus_at_startup
{
get
{
return
true
;
}
}
public
override
bool
supports_backdrop_color
{
get
{
return
true
;
}
}
public
override
bool
supports_hot_corners
{
get
{
return
true
;
}
}
public
override
Gee
.
ArrayList
<
MonitorConfig
>
load
()
throws
Error
{
var
monitors
=
new
Gee
.
ArrayList
<
MonitorConfig
>();
...
...
src/plugin.vala
View file @
0da3ae6a
...
...
@@ -79,7 +79,7 @@ namespace TunerDisplays {
}
private
MonitorSettingsContent
create_monitor_page_content
(
MonitorConfig
monitor
)
{
var
content
=
new
MonitorSettingsContent
(
monitor
,
view
.
backend_i
d
,
view
.
monitor_configs
);
var
content
=
new
MonitorSettingsContent
(
monitor
,
view
.
display_backen
d
,
view
.
monitor_configs
);
content
.
monitor_changed
.
connect
(
view
.
refresh_from_monitors
);
return
content
;
}
...
...
src/ui/displays-view.vala
View file @
0da3ae6a
...
...
@@ -18,7 +18,7 @@ namespace TunerDisplays {
[
GtkChild
]
private
unowned
Adw
.
PreferencesGroup
status_group
;
public
bool
can_apply
{
get
{
return
backend
.
can_apply
;
}
}
public
Gee
.
ArrayList
<
MonitorConfig
>
monitor_configs
{
get
{
return
monitors
;
}
}
public
string
backend_id
{
owned
get
{
return
backend
.
i
d
;
}
}
public
DisplayBackend
display_backend
{
get
{
return
backen
d
;
}
}
public
signal
void
monitor_settings_requested
(
MonitorConfig
monitor
);
construct
{
...
...
@@ -33,7 +33,7 @@ namespace TunerDisplays {
layout
=
new
MonitorLayout
()
{
height_request
=
320
,
hexpand
=
true
,
require_connected
=
backend
.
id
==
"gnome"
,
require_connected
=
backend
.
requires_connected_layout
,
can_focus
=
false
,
focusable
=
false
};
...
...
@@ -145,7 +145,7 @@ namespace TunerDisplays {
}
else
{
add_gnome_primary_row
();
foreach
(
var
monitor
in
monitors
)
{
var
row
=
new
MonitorRow
(
monitor
,
monitor_settings_page_id
(),
monitors
,
backend
.
id
);
var
row
=
new
MonitorRow
(
monitor
,
monitor_settings_page_id
(),
monitors
,
backend
);
row
.
monitor_selected
.
connect
(
monitor
=>
monitor_settings_requested
(
monitor
));
row
.
monitor_changed
.
connect
(()
=>
layout
.
recenter
());
monitors_group
.
add
(
row
);
...
...
@@ -164,7 +164,7 @@ namespace TunerDisplays {
}
private
void
add_gnome_mirror_row
()
{
if
(
backend
.
id
!=
"gnome"
||
monitors
.
size
<=
1
)
if
(
!
backend
.
supports_global_mirroring
||
monitors
.
size
<=
1
)
return
;
var
row
=
new
Adw
.
SwitchRow
()
{
...
...
@@ -193,7 +193,7 @@ namespace TunerDisplays {
if
(
monitors
.
size
!=
1
)
return
;
single_monitor_content
=
new
MonitorSettingsContent
(
monitors
[
0
],
backend
.
id
,
monitors
,
false
);
single_monitor_content
=
new
MonitorSettingsContent
(
monitors
[
0
],
backend
,
monitors
,
false
);
single_monitor_content
.
monitor_changed
.
connect
(
refresh_from_monitors
);
while
(
single_monitor_content
.
get_group
(
0
)
!=
null
)
{
...
...
@@ -312,7 +312,7 @@ namespace TunerDisplays {
}
private
void
add_gnome_primary_row
()
{
if
(
backend
.
id
!=
"gnome"
||
monitors
.
size
<=
1
)
if
(
!
backend
.
supports_primary_display
||
monitors
.
size
<=
1
)
return
;
var
model
=
new
Gtk
.
StringList
(
null
);
...
...
@@ -358,7 +358,7 @@ namespace TunerDisplays {
}
private
bool
gnome_mirror_enabled
()
{
return
backend
.
id
==
"gnome"
&&
monitors
.
size
>
0
&&
monitors
[
0
].
mirrored
;
return
backend
.
supports_global_mirroring
&&
monitors
.
size
>
0
&&
monitors
[
0
].
mirrored
;
}
private
bool
single_monitor_mode
()
{
...
...
@@ -366,7 +366,7 @@ namespace TunerDisplays {
}
private
void
subscribe_monitor_changes
()
{
if
(
backend
.
id
!=
"gnome"
)
if
(
!
backend
.
supports_monitor_change_events
)
return
;
try
{
...
...
src/ui/monitor-row.vala
View file @
0da3ae6a
...
...
@@ -4,13 +4,13 @@ namespace TunerDisplays {
private
MonitorConfig
monitor
;
private
Gee
.
ArrayList
<
MonitorConfig
>
all_monitors
;
private
string
page_id
;
private
string
backend_i
d
;
private
DisplayBackend
backen
d
;
private
Gtk
.
Switch
enabled_switch
;
public
signal
void
monitor_changed
();
public
signal
void
monitor_selected
(
MonitorConfig
monitor
);
public
MonitorRow
(
MonitorConfig
monitor
,
string
page_id
,
Gee
.
ArrayList
<
MonitorConfig
>
all_monitors
,
string
backend_i
d
)
{
public
MonitorRow
(
MonitorConfig
monitor
,
string
page_id
,
Gee
.
ArrayList
<
MonitorConfig
>
all_monitors
,
DisplayBackend
backen
d
)
{
Object
(
title
:
monitor
.
title
,
subtitle
:
"%dx%d@%.2f scale %.2f %dx%d"
.
printf
(
...
...
@@ -20,7 +20,7 @@ namespace TunerDisplays {
this
.
monitor
=
monitor
;
this
.
all_monitors
=
all_monitors
;
this
.
page_id
=
page_id
;
this
.
backend
_id
=
backend_i
d
;
this
.
backend
=
backen
d
;
build
();
}
...
...
@@ -38,7 +38,7 @@ namespace TunerDisplays {
can_focus
=
true
};
enabled_switch
.
notify
[
"active"
].
connect
(()
=>
{
if
(
enabled_switch
.
active
!=
monitor
.
enabled
&&
backend_id
==
"gnome"
)
if
(
enabled_switch
.
active
!=
monitor
.
enabled
&&
!
backend
.
preserves_disabled_monitor_position
)
place_monitor_after_active
(
monitor
,
all_monitors
);
monitor
.
enabled
=
enabled_switch
.
active
;
monitor_changed
();
...
...
src/ui/monitor-settings-content.vala
View file @
0da3ae6a
...
...
@@ -4,7 +4,7 @@ namespace TunerDisplays {
public
class
MonitorSettingsContent
:
Adw
.
PreferencesPage
{
private
MonitorConfig
monitor
;
private
Gee
.
ArrayList
<
MonitorConfig
>
all_monitors
;
private
string
backend_i
d
;
private
DisplayBackend
backen
d
;
private
bool
show_enabled
;
[
GtkChild
]
private
unowned
Adw
.
SwitchRow
enabled_row
;
private
Adw
.
ExpanderRow
?
gnome_refresh_expander_row
;
...
...
@@ -19,10 +19,10 @@ namespace TunerDisplays {
public
signal
void
monitor_changed
();
public
MonitorSettingsContent
(
MonitorConfig
monitor
,
string
backend_i
d
,
Gee
.
ArrayList
<
MonitorConfig
>
all_monitors
,
bool
show_enabled
=
true
)
{
public
MonitorSettingsContent
(
MonitorConfig
monitor
,
DisplayBackend
backen
d
,
Gee
.
ArrayList
<
MonitorConfig
>
all_monitors
,
bool
show_enabled
=
true
)
{
Object
(
title
:
monitor
.
title
);
this
.
monitor
=
monitor
;
this
.
backend
_id
=
backend_i
d
;
this
.
backend
=
backen
d
;
this
.
all_monitors
=
all_monitors
;
this
.
show_enabled
=
show_enabled
;
build_preferences
();
...
...
@@ -32,14 +32,14 @@ namespace TunerDisplays {
enabled_row
.
visible
=
show_enabled
;
enabled_row
.
active
=
monitor
.
enabled
;
enabled_row
.
notify
[
"active"
].
connect
(()
=>
{
if
(
enabled_row
.
active
!=
monitor
.
enabled
&&
backend_id
==
"gnome"
)
if
(
enabled_row
.
active
!=
monitor
.
enabled
&&
!
backend
.
preserves_disabled_monitor_position
)
place_monitor_after_active
(
monitor
,
all_monitors
);
monitor
.
enabled
=
enabled_row
.
active
;
emit_changed
();
});
monitor
.
notify
[
"enabled"
].
connect
(
sync_from_monitor
);
if
(
backend
_id
==
"gnome"
)
{
if
(
backend
.
uses_separate_refresh_rate_controls
)
{
add_gnome_resolution_row
(
basic_group
);
add_gnome_refresh_rate_row
(
basic_group
);
add_gnome_scale_row
(
basic_group
);
...
...
@@ -50,20 +50,18 @@ namespace TunerDisplays {
add_transform_row
(
basic_group
);
add_mirror_row
(
basic_group
);
if
(
backend_id
==
"hyprland"
)
{
if
(
backend
.
supports_description_identifier
||
backend
.
supports_bit_depth
||
backend
.
supports_vrr_modes
||
backend
.
supports_color_management
||
backend
.
supports_hdr_metadata
)
{
add_hyprland_rows
();
}
else
if
(
backend_id
==
"niri"
)
{
add_niri_rows
(
basic_group
);
hyprland_group
.
visible
=
false
;
hdr_group
.
visible
=
false
;
}
else
if
(
backend_id
==
"gnome"
)
{
add_gnome_rows
(
basic_group
);
hyprland_group
.
visible
=
false
;
hdr_group
.
visible
=
false
;
}
else
{
hyprland_group
.
visible
=
false
;
hdr_group
.
visible
=
false
;
}
add_niri_rows
(
basic_group
);
add_gnome_rows
(
basic_group
);
hyprland_group
.
visible
=
hyprland_group
.
get_first_child
()
!=
null
;
hdr_group
.
visible
=
hdr_group
.
get_first_child
()
!=
null
;
}
private
void
add_mode_row
(
Adw
.
PreferencesGroup
group
)
{
...
...
@@ -98,7 +96,7 @@ namespace TunerDisplays {
monitor
.
width
=
mode
.
width
;
monitor
.
height
=
mode
.
height
;
monitor
.
refresh
=
mode
.
refresh
;
if
(
backend
_id
==
"gnome"
&&
!
mode
.
supports_scale
(
monitor
.
scale
))
if
(
backend
.
uses_separate_refresh_rate_controls
&&
!
mode
.
supports_scale
(
monitor
.
scale
))
monitor
.
scale
=
mode
.
preferred_scale
;
emit_changed
();
}
...
...
@@ -326,7 +324,7 @@ namespace TunerDisplays {
}
private
void
add_mirror_row
(
Adw
.
PreferencesGroup
group
)
{
if
(
backend_id
!=
"hyprland"
)
if
(
!
backend
.
supports_output_mirroring
)
return
;
if
(
all_monitors
.
size
<=
1
)
...
...
@@ -364,66 +362,79 @@ namespace TunerDisplays {
}
private
void
add_hyprland_rows
()
{
var
use_description
=
new
Adw
.
SwitchRow
()
{
title
=
_
(
"Use description"
),
active
=
monitor
.
use_description
};
use_description
.
notify
[
"active"
].
connect
(()
=>
{
monitor
.
use_description
=
use_description
.
active
;
emit_changed
();
});
hyprland_group
.
add
(
use_description
);
add_int_combo
(
hyprland_group
,
_
(
"Bit depth"
),
new
string
[]
{
"8"
,
"10"
},
new
int
[]
{
8
,
10
},
monitor
.
bitdepth
,
value
=>
monitor
.
bitdepth
=
value
);
add_int_combo
(
hyprland_group
,
_
(
"VRR"
),
new
string
[]
{
_
(
"Off"
),
_
(
"On"
),
_
(
"Fullscreen"
),
_
(
"Fullscreen video/game"
)
},
new
int
[]
{
0
,
1
,
2
,
3
},
monitor
.
vrr
,
value
=>
monitor
.
vrr
=
value
);
add_string_combo
(
hyprland_group
,
_
(
"Color management"
),
new
string
[]
{
"auto"
,
"srgb"
,
"dcip3"
,
"dp3"
,
"adobe"
,
"wide"
,
"edid"
,
"hdr"
,
"hdredid"
},
monitor
.
color_management_preset
,
value
=>
monitor
.
color_management_preset
=
value
);
add_string_combo
(
hyprland_group
,
_
(
"SDR EOTF"
),
new
string
[]
{
"default"
,
"gamma22"
,
"srgb"
},
monitor
.
sdr_eotf
,
value
=>
monitor
.
sdr_eotf
=
value
);
hyprland_group
.
add
(
create_spin_row
(
_
(
"SDR brightness"
),
monitor
.
sdr_brightness
,
0.1
,
4.0
,
0.05
,
2
,
value
=>
monitor
.
sdr_brightness
=
value
));
hyprland_group
.
add
(
create_spin_row
(
_
(
"SDR saturation"
),
monitor
.
sdr_saturation
,
0.1
,
4.0
,
0.05
,
2
,
value
=>
monitor
.
sdr_saturation
=
value
));
add_int_combo
(
hdr_group
,
_
(
"Force wide color"
),
new
string
[]
{
_
(
"Auto"
),
_
(
"Off"
),
_
(
"On"
)
},
new
int
[]
{
0
,
-
1
,
1
},
monitor
.
supports_wide_color
,
value
=>
monitor
.
supports_wide_color
=
value
);
add_int_combo
(
hdr_group
,
_
(
"Force HDR"
),
new
string
[]
{
_
(
"Auto"
),
_
(
"Off"
),
_
(
"On"
)
},
new
int
[]
{
0
,
-
1
,
1
},
monitor
.
supports_hdr
,
value
=>
monitor
.
supports_hdr
=
value
);
hdr_group
.
add
(
create_spin_row
(
_
(
"SDR min luminance"
),
monitor
.
sdr_min_luminance
,
0.0
,
10.0
,
0.01
,
2
,
value
=>
monitor
.
sdr_min_luminance
=
value
));
hdr_group
.
add
(
create_spin_row
(
_
(
"SDR max luminance"
),
monitor
.
sdr_max_luminance
,
1
,
1000
,
1
,
0
,
value
=>
monitor
.
sdr_max_luminance
=
(
int
)
value
));
hdr_group
.
add
(
create_spin_row
(
_
(
"Min luminance"
),
monitor
.
min_luminance
,
-
1
,
10.0
,
0.01
,
2
,
value
=>
monitor
.
min_luminance
=
value
));
hdr_group
.
add
(
create_spin_row
(
_
(
"Max luminance"
),
monitor
.
max_luminance
,
-
1
,
10000
,
1
,
0
,
value
=>
monitor
.
max_luminance
=
(
int
)
value
));
hdr_group
.
add
(
create_spin_row
(
_
(
"Max average luminance"
),
monitor
.
max_avg_luminance
,
-
1
,
10000
,
1
,
0
,
value
=>
monitor
.
max_avg_luminance
=
(
int
)
value
));
var
icc
=
new
Adw
.
EntryRow
()
{
title
=
_
(
"ICC profile"
)
};
icc
.
text
=
monitor
.
icc
;
icc
.
notify
[
"text"
].
connect
(()
=>
{
monitor
.
icc
=
icc
.
text
;
emit_changed
();
});
hdr_group
.
add
(
icc
);
if
(
backend
.
supports_description_identifier
)
{
var
use_description
=
new
Adw
.
SwitchRow
()
{
title
=
_
(
"Use description"
),
active
=
monitor
.
use_description
};
use_description
.
notify
[
"active"
].
connect
(()
=>
{
monitor
.
use_description
=
use_description
.
active
;
emit_changed
();
});
hyprland_group
.
add
(
use_description
);
}
if
(
backend
.
supports_bit_depth
)
add_int_combo
(
hyprland_group
,
_
(
"Bit depth"
),
new
string
[]
{
"8"
,
"10"
},
new
int
[]
{
8
,
10
},
monitor
.
bitdepth
,
value
=>
monitor
.
bitdepth
=
value
);
if
(
backend
.
supports_vrr_modes
)
add_int_combo
(
hyprland_group
,
_
(
"VRR"
),
new
string
[]
{
_
(
"Off"
),
_
(
"On"
),
_
(
"Fullscreen"
),
_
(
"Fullscreen video/game"
)
},
new
int
[]
{
0
,
1
,
2
,
3
},
monitor
.
vrr
,
value
=>
monitor
.
vrr
=
value
);
if
(
backend
.
supports_color_management
)
{
add_string_combo
(
hyprland_group
,
_
(
"Color management"
),
new
string
[]
{
"auto"
,
"srgb"
,
"dcip3"
,
"dp3"
,
"adobe"
,
"wide"
,
"edid"
,
"hdr"
,
"hdredid"
},
monitor
.
color_management_preset
,
value
=>
monitor
.
color_management_preset
=
value
);
add_string_combo
(
hyprland_group
,
_
(
"SDR EOTF"
),
new
string
[]
{
"default"
,
"gamma22"
,
"srgb"
},
monitor
.
sdr_eotf
,
value
=>
monitor
.
sdr_eotf
=
value
);
hyprland_group
.
add
(
create_spin_row
(
_
(
"SDR brightness"
),
monitor
.
sdr_brightness
,
0.1
,
4.0
,
0.05
,
2
,
value
=>
monitor
.
sdr_brightness
=
value
));
hyprland_group
.
add
(
create_spin_row
(
_
(
"SDR saturation"
),
monitor
.
sdr_saturation
,
0.1
,
4.0
,
0.05
,
2
,
value
=>
monitor
.
sdr_saturation
=
value
));
}
if
(
backend
.
supports_hdr_metadata
)
{
add_int_combo
(
hdr_group
,
_
(
"Force wide color"
),
new
string
[]
{
_
(
"Auto"
),
_
(
"Off"
),
_
(
"On"
)
},
new
int
[]
{
0
,
-
1
,
1
},
monitor
.
supports_wide_color
,
value
=>
monitor
.
supports_wide_color
=
value
);
add_int_combo
(
hdr_group
,
_
(
"Force HDR"
),
new
string
[]
{
_
(
"Auto"
),
_
(
"Off"
),
_
(
"On"
)
},
new
int
[]
{
0
,
-
1
,
1
},
monitor
.
supports_hdr
,
value
=>
monitor
.
supports_hdr
=
value
);
hdr_group
.
add
(
create_spin_row
(
_
(
"SDR min luminance"
),
monitor
.
sdr_min_luminance
,
0.0
,
10.0
,
0.01
,
2
,
value
=>
monitor
.
sdr_min_luminance
=
value
));
hdr_group
.
add
(
create_spin_row
(
_
(
"SDR max luminance"
),
monitor
.
sdr_max_luminance
,
1
,
1000
,
1
,
0
,
value
=>
monitor
.
sdr_max_luminance
=
(
int
)
value
));
hdr_group
.
add
(
create_spin_row
(
_
(
"Min luminance"
),
monitor
.
min_luminance
,
-
1
,
10.0
,
0.01
,
2
,
value
=>
monitor
.
min_luminance
=
value
));
hdr_group
.
add
(
create_spin_row
(
_
(
"Max luminance"
),
monitor
.
max_luminance
,
-
1
,
10000
,
1
,
0
,
value
=>
monitor
.
max_luminance
=
(
int
)
value
));
hdr_group
.
add
(
create_spin_row
(
_
(
"Max average luminance"
),
monitor
.
max_avg_luminance
,
-
1
,
10000
,
1
,
0
,
value
=>
monitor
.
max_avg_luminance
=
(
int
)
value
));
var
icc
=
new
Adw
.
EntryRow
()
{
title
=
_
(
"ICC profile"
)
};
icc
.
text
=
monitor
.
icc
;
icc
.
notify
[
"text"
].
connect
(()
=>
{
monitor
.
icc
=
icc
.
text
;
emit_changed
();
});
hdr_group
.
add
(
icc
);
}
}
private
void
add_niri_rows
(
Adw
.
PreferencesGroup
group
)
{
if
(
monitor
.
supports_variable_refresh_rate
)
{
if
(
backend
.
supports_adaptive_sync
&&
monitor
.
supports_variable_refresh_rate
)
{
add_int_combo
(
group
,
_
(
"Variable Refresh Rate"
),
new
string
[]
{
_
(
"Off"
),
_
(
"On"
),
_
(
"On demand"
)
},
new
int
[]
{
0
,
1
,
2
},
monitor
.
vrr
,
value
=>
monitor
.
vrr
=
value
);
}
var
focus
=
new
Adw
.
SwitchRow
()
{
title
=
_
(
"Focus at startup"
),
active
=
monitor
.
niri_focus_at_startup
};
focus
.
notify
[
"active"
].
connect
(()
=>
{
monitor
.
niri_focus_at_startup
=
focus
.
active
;
emit_changed
();
});
group
.
add
(
focus
);
if
(
backend
.
supports_focus_at_startup
)
{
var
focus
=
new
Adw
.
SwitchRow
()
{
title
=
_
(
"Focus at startup"
),
active
=
monitor
.
niri_focus_at_startup
};
focus
.
notify
[
"active"
].
connect
(()
=>
{
monitor
.
niri_focus_at_startup
=
focus
.
active
;
emit_changed
();
});
group
.
add
(
focus
);
}
add_niri_backdrop_color_row
(
group
);
if
(
backend
.
supports_backdrop_color
)
add_niri_backdrop_color_row
(
group
);
add_string_combo_with_labels
(
group
,
_
(
"Hot corners"
),
new
string
[]
{
_
(
"Default"
),
_
(
"Off"
),
_
(
"All"
),
_
(
"Top left"
),
_
(
"Top right"
),
_
(
"Bottom left"
),
_
(
"Bottom right"
)
},
new
string
[]
{
""
,
"off"
,
"all"
,
"top-left"
,
"top-right"
,
"bottom-left"
,
"bottom-right"
},
monitor
.
niri_hot_corners
,
value
=>
monitor
.
niri_hot_corners
=
value
);
if
(
backend
.
supports_hot_corners
)
{
add_string_combo_with_labels
(
group
,
_
(
"Hot corners"
),
new
string
[]
{
_
(
"Default"
),
_
(
"Off"
),
_
(
"All"
),
_
(
"Top left"
),
_
(
"Top right"
),
_
(
"Bottom left"
),
_
(
"Bottom right"
)
},
new
string
[]
{
""
,
"off"
,
"all"
,
"top-left"
,
"top-right"
,
"bottom-left"
,
"bottom-right"
},
monitor
.
niri_hot_corners
,
value
=>
monitor
.
niri_hot_corners
=
value
);
}
}
private
void
add_niri_backdrop_color_row
(
Adw
.
PreferencesGroup
group
)
{
...
...
@@ -467,17 +478,22 @@ namespace TunerDisplays {
}
private
void
add_gnome_rows
(
Adw
.
PreferencesGroup
group
)
{
var
underscanning
=
new
Adw
.
SwitchRow
()
{
title
=
_
(
"Underscanning"
),
active
=
monitor
.
underscanning
};
underscanning
.
notify
[
"active"
].
connect
(()
=>
{
monitor
.
underscanning
=
underscanning
.
active
;
emit_changed
();
});
group
.
add
(
underscanning
);
if
(!
backend
.
supports_underscanning
&&
!
backend
.
supports_hdr_toggle
)
return
;
if
(
backend
.
supports_underscanning
)
{
var
underscanning
=
new
Adw
.
SwitchRow
()
{
title
=
_
(
"Underscanning"
),
active
=
monitor
.
underscanning
};
underscanning
.
notify
[
"active"
].
connect
(()
=>
{
monitor
.
underscanning
=
underscanning
.
active
;
emit_changed
();
});
group
.
add
(
underscanning
);
}
if
(
monitor
.
supported_color_modes
.
contains
(
1
))
{
if
(
backend
.
supports_hdr_toggle
&&
monitor
.
supported_color_modes
.
contains
(
1
))
{
var
hdr
=
new
Adw
.
SwitchRow
()
{
title
=
_
(
"HDR"
),
active
=
monitor
.
color_mode
==
1
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment