Add TV to configurations

This commit is contained in:
John Mertz 2022-04-19 00:25:29 -04:00
parent 3802db3c96
commit 492f7c30ea
1 changed files with 50 additions and 5 deletions

View File

@ -57,7 +57,8 @@ my %outputs = (
#'3CQ4342S6W' => 'HP-1', #'3CQ4342S6W' => 'HP-1',
'0x00000101' => 'HP-1', '0x00000101' => 'HP-1',
'3CQ3310Q1Q' => 'HP-2', '3CQ3310Q1Q' => 'HP-2',
'0x00000000' => 'LVDS' '0x00000000' => 'LVDS',
'0x00000101' => 'TV',
); );
######################################################################## ########################################################################
@ -68,6 +69,38 @@ my %outputs = (
# Second-level keys are the display friendly-names, above # Second-level keys are the display friendly-names, above
# Third-level are the actual settings for that display # Third-level are the actual settings for that display
my %configs = ( my %configs = (
'TV' => {
'HP-1' => {
'on' => 0
},
'HP-2' => {
'on' => 0
},
'Sam' => {
'on' => 0
},
'TV' => {
'on' => 1,
'width' => 3840,
'height' => 2160,
'x' => 0,
'y' => 0,
'rotate' => 0,
'scale' => 1.333333333,
'waybar' => 'top',
'fallback' => '#000000'
},
'eDP-1' => {
'on' => 1,
'width' => 1920,
'height' => 1080,
'x' => 3079,
'y' => 0,
'rotate' => 0,
'waybar' => 'bottom',
'fallback' => '#000000'
}
},
'detached' => { 'detached' => {
'HP-1' => { 'HP-1' => {
'on' => 0 'on' => 0
@ -78,6 +111,9 @@ my %configs = (
'Sam' => { 'Sam' => {
'on' => 0 'on' => 0
}, },
'TV' => {
'on' => 0
},
'eDP-1' => { 'eDP-1' => {
'on' => 1, 'on' => 1,
'width' => 1920, 'width' => 1920,
@ -113,6 +149,9 @@ my %configs = (
'HP-2' => { 'HP-2' => {
'on' => 0 'on' => 0
}, },
'TV' => {
'on' => 0
},
'eDP-1' => { 'eDP-1' => {
'on' => 1, 'on' => 1,
'width' => 1920, 'width' => 1920,
@ -155,6 +194,9 @@ my %configs = (
'waybar' => 'top', 'waybar' => 'top',
'fallback' => '#000000' 'fallback' => '#000000'
}, },
'TV' => {
'on' => 0
},
'eDP-1' => { 'eDP-1' => {
'on' => 0 'on' => 0
} }
@ -190,7 +232,10 @@ my %configs = (
'waybar' => 'top', 'waybar' => 'top',
'fallback' => '#000000' 'fallback' => '#000000'
}, },
'LVDS' => { 'TV' => {
'on' => 0
},
'eDP-1' => {
'on' => 0, 'on' => 0,
} }
} }
@ -447,14 +492,14 @@ foreach my $out (keys %$on) {
$waybar .= $template; $waybar .= $template;
# Replace basic preferences # Replace basic preferences
$waybar =~ s/__OUTPUT__/"$on->{$out}->{output}"/; $waybar =~ s/__OUTPUT__/"$on->{$out}->{output}"/gg;
$waybar =~ s/__POSITION__/"$on->{$out}->{waybar}"/; $waybar =~ s/__POSITION__/"$on->{$out}->{waybar}"/gg;
if (defined $on->{$out}->{width}) { if (defined $on->{$out}->{width}) {
my $x = $on->{$out}->{width}; my $x = $on->{$out}->{width};
if (defined $on->{$out}->{scale}) { if (defined $on->{$out}->{scale}) {
$x = sprintf("%.0d", $x / $on->{$out}->{scale}); $x = sprintf("%.0d", $x / $on->{$out}->{scale});
} }
$waybar =~ s/__WIDTH__/$x/; $waybar =~ s/__WIDTH__/$x/gg;
# If width is not set, comment that line out to use default # If width is not set, comment that line out to use default
} else { } else {
$waybar =~ s/([^\s]*\s*)__WIDTH__/\/\/ $1__WIDTH__/gg; $waybar =~ s/([^\s]*\s*)__WIDTH__/\/\/ $1__WIDTH__/gg;