From b0ec5cdafbcb8d0fb0341933f220fc5337f3ce7e Mon Sep 17 00:00:00 2001 From: John Mertz Date: Tue, 19 Apr 2022 00:25:29 -0400 Subject: [PATCH] Add TV to configurations --- sway/displays.pl | 55 +++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 50 insertions(+), 5 deletions(-) diff --git a/sway/displays.pl b/sway/displays.pl index 5ddf8d4..46a96a1 100755 --- a/sway/displays.pl +++ b/sway/displays.pl @@ -57,7 +57,8 @@ my %outputs = ( #'3CQ4342S6W' => 'HP-1', '0x00000101' => 'HP-1', '3CQ3310Q1Q' => 'HP-2', - '0x00000000' => 'LVDS' + '0x00000000' => 'LVDS', + '0x00000101' => 'TV', ); ######################################################################## @@ -68,6 +69,38 @@ my %outputs = ( # Second-level keys are the display friendly-names, above # Third-level are the actual settings for that display 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' => { 'HP-1' => { 'on' => 0 @@ -78,6 +111,9 @@ my %configs = ( 'Sam' => { 'on' => 0 }, + 'TV' => { + 'on' => 0 + }, 'eDP-1' => { 'on' => 1, 'width' => 1920, @@ -113,6 +149,9 @@ my %configs = ( 'HP-2' => { 'on' => 0 }, + 'TV' => { + 'on' => 0 + }, 'eDP-1' => { 'on' => 1, 'width' => 1920, @@ -155,6 +194,9 @@ my %configs = ( 'waybar' => 'top', 'fallback' => '#000000' }, + 'TV' => { + 'on' => 0 + }, 'eDP-1' => { 'on' => 0 } @@ -190,7 +232,10 @@ my %configs = ( 'waybar' => 'top', 'fallback' => '#000000' }, - 'LVDS' => { + 'TV' => { + 'on' => 0 + }, + 'eDP-1' => { 'on' => 0, } } @@ -447,14 +492,14 @@ foreach my $out (keys %$on) { $waybar .= $template; # Replace basic preferences - $waybar =~ s/__OUTPUT__/"$on->{$out}->{output}"/; - $waybar =~ s/__POSITION__/"$on->{$out}->{waybar}"/; + $waybar =~ s/__OUTPUT__/"$on->{$out}->{output}"/gg; + $waybar =~ s/__POSITION__/"$on->{$out}->{waybar}"/gg; if (defined $on->{$out}->{width}) { my $x = $on->{$out}->{width}; if (defined $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 } else { $waybar =~ s/([^\s]*\s*)__WIDTH__/\/\/ $1__WIDTH__/gg;