Created
January 17, 2024 11:49
-
-
Save sthalik/f1234fec4c2b83e34b0f057f0973c531 to your computer and use it in GitHub Desktop.
Element patch script to remove idiotic oversized padding in the UI
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env perl | |
use strict; | |
use warnings; | |
use POSIX; | |
use File::Find; | |
use File::Basename; | |
use v5.8; | |
our $fix = <<END; | |
/* start shei1rei7VidahPheu2iefeepoezaa3r */ | |
.mx_SpacePanel { | |
display: none !important; | |
} | |
.mx_RoomView_MessageList { | |
padding-left: 6px !important; | |
padding-right: 6px !important; | |
} | |
.mx_RoomView_MessageList .mx_EventTile_line { | |
margin-right: 0 !important; | |
} | |
.mx_EventTile_avatar { | |
display: none !important; | |
} | |
.mx_RightPanel .mx_EventTile_details, .mx_RightPanel .mx_EventTile_line { | |
margin-left: 0 !important; | |
padding: 0 !important; | |
} | |
.mx_EventTile[data-shape=Notification], .mx_EventTile[data-shape=ThreadsList] { | |
padding-right: 6px !important; | |
} | |
.mx_DisambiguatedProfile_displayName { | |
font-size: 1.5rem !important; | |
vertical-align: middle !important; | |
} | |
.mx_RoomView_MessageList .mx_EventTile .mx_DisambiguatedProfile { | |
margin-left: 0px !important; | |
} | |
.mx_RoomView_MessageList .mx_EventTile .mx_EventTile_line { | |
padding-left: 0px !important; | |
} | |
.mx_EventTile { | |
--EventTile_content-margin-inline-end: 30px; | |
} | |
.mx_RightPanel .mx_RoomView_MessageList .mx_DisambiguatedProfile { | |
margin-left: 0 !important; | |
} | |
.mx_RightPanel .mx_RoomView_MessageList .mx_EventTile_line { | |
padding-left: 0 !important; | |
} | |
.mx_ThreadView .mx_EventTile[data-layout="group"] .mx_MessageTimestamp { | |
position: absolute; | |
top: 2px; | |
right: 2px; | |
float: right; | |
left: unset; | |
text-align: center; | |
} | |
.mx_RoomView_MessageList .mx_EventTile .mx_DisambiguatedProfile { | |
margin-left: 0 !important; | |
} | |
.mx_EventTile[data-layout="group"] .mx_ThreadSummary, .mx_EventTile[data-layout="group"] .mx_ThreadSummary_icon { | |
margin-left: 0 !important; | |
padding-left: 0 !important; | |
} | |
.mx_EventTile[data-layout="group"] span.mx_MessageTimestamp { | |
position: absolute; | |
right: 2px !important; | |
top: 2px; | |
left: unset !important; | |
text-align: center; | |
float: right !important; | |
} | |
.mx_EventTile[data-layout="group"] .mx_ThreadSummary, .mx_EventTile[data-layout="group"] .mx_ThreadSummary_icon { | |
margin-left: 0 !important; | |
} | |
.mx_RoomView_MessageList .mx_EventTile div.mx_EventTile_line { | |
padding-left: 0 !important; | |
} | |
.mx_AccessibleButton.mx_ThreadSummary { | |
margin-left: 0 !important; | |
} | |
.mx_EventTile[data-layout="group"] div.mx_ThreadSummary, .mx_EventTile[data-layout="group"] div.mx_ThreadSummary_icon { | |
margin-left: 0 !important; | |
} | |
span.mx_MessageTimestamp { | |
position: absolute; | |
left: unset !important; | |
text-align: center; | |
float: right; | |
right: 2px; | |
} | |
.mx_EventTile[data-layout="group"] div.mx_ThreadSummary, .mx_EventTile[data-layout="group"] div.mx_ThreadSummary_icon { | |
margin-left: 0 !important; | |
} | |
span.mx_MessageTimestamp { | |
float: right !important; | |
left: unset !important; | |
right: 2px !important; | |
} | |
.mx_EventTile[data-layout="group"] div.mx_ReactionsRow { | |
margin: 4px 0px !important; | |
} | |
div.mx_EventTile_senderDetails { | |
padding-left: 0 !important; | |
} | |
.mx_RoomView_body.mx_MainSplit_timeline { | |
padding-left: calc(8px / 2) !important; | |
} | |
.mx_DisambiguatedProfile_displayName { | |
font-size: 1.05rem !important; | |
} | |
.mx_BaseCard_header { | |
margin-bottom: 0 !important; | |
} | |
.mx_BaseCard .mx_BaseCard_header .mx_BaseCard_close { | |
right: 12px !important; | |
padding: 0 !important; | |
margin: 3px -6px 0 0 !important; | |
} | |
.mx_BaseCard.mx_ThreadPanel .mx_BaseCard_back { | |
margin-top: 2px; | |
} | |
.mx_RightPanel_ResizeWrapper { | |
padding-top: 0 !important; | |
padding-left: 0 !important; | |
padding-right: 0 !important; | |
} | |
.mx_RightPanel { | |
padding-top: 0 !important; | |
} | |
.mx_BaseCard.mx_ThreadPanel { | |
padding-right: 4px; | |
} | |
.mx_SendMessageComposer .mx_BasicMessageComposer { | |
min-height: 40px; | |
} | |
.mx_LegacyRoomHeader_wrapper { | |
padding-top: 0 !important; | |
padding-bottom: 0 !important; | |
} | |
.mx_BaseCard_header { | |
padding-top: 0 !important; | |
padding-bottom: 0 !important; | |
height: auto !important; | |
} | |
/* eof */ | |
END | |
; | |
chdir"$ENV{HOME}/AppData/Local/element-desktop" || chdir dirname $0 or die "chdir $!"; | |
my @dirs = sort glob"app-[1-9]*.?*/" or die "glob $!"; | |
my $dir = $dirs[$#dirs]; | |
-d $dir or die "-d '$dir' $!"; | |
-f "$dir/resources/webapp.asar" or die "file '$dir/resources/webapp.asar' doesn't exist:: $!"; | |
chdir "$dir/resources" or die "chdir '$dir/resources' $!"; | |
warn "dir $dir"; | |
-f "webapp.asar" or die "no webapp.asar: $!"; | |
-e "webapp" and die "already extracted 'resources/webapp'"; | |
system qw[asar e webapp.asar webapp] and die "asasr e: $? $!"; | |
-d "webapp" or die "dir webapp not found: $!"; | |
chdir "webapp" or die "chdir webapp: $!"; | |
my @files; | |
find sub { $_ eq 'theme-light-high-contrast.css' and push @files, $File::Find::name }, "."; | |
@files or die "no .css file found"; | |
@files == 1 or die "too many files found"; | |
my $file = $files[0]; | |
warn "file $file"; | |
do { | |
open my $fd, "<", $file or die "open '$file' for reading: $!"; | |
local $/ = undef; # slurp mode turn on | |
my $str = <$fd>; | |
defined $str or die "read: $!"; | |
$str =~ /shei1rei7VidahPheu2iefeepoezaa3r/ and die "already patched!"; | |
}; | |
do { | |
open my $fd, ">>", $file or die "open '$file' for writing: $!"; | |
print $fd $fix or die "print: $!"; | |
}; | |
system qw[asar p . ../webapp.asar] and die "asar p $? $!"; | |
warn "job's done!"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment