summaryrefslogtreecommitdiff
path: root/Rexfile
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2026-06-09 22:16:14 +0300
committerPaul Buetow <paul@buetow.org>2026-06-09 22:16:14 +0300
commit66816aa811e60f15894e3739a6ba3e4df7c58d91 (patch)
tree4bb5bf76dbc93d65efea158db6697f46881cfca8 /Rexfile
parent5397a1cd90faa5543d14e36c753566f812e688f8 (diff)
parenta38faabba51a98d712083930fcb76f6f9081c822 (diff)
Merge branch 'master' of ssh://r0:30022/repos/dotfiles
Diffstat (limited to 'Rexfile')
-rw-r--r--Rexfile26
1 files changed, 20 insertions, 6 deletions
diff --git a/Rexfile b/Rexfile
index 4bdb9f0..400a9f4 100644
--- a/Rexfile
+++ b/Rexfile
@@ -299,19 +299,33 @@ task 'home_tmux_rocky', sub {
my $hostname = `hostname 2>/dev/null` // '';
chomp $hostname;
if ( $hostname =~ /rocky/ ) {
- my $conf = "$HOME/.config/tmux/tmux.local.conf";
my $line = "source-file ~/.config/tmux/tmux.rocky.conf";
+ my $local_conf = "$HOME/.config/tmux/tmux.local.conf";
+ my $main_conf = "$HOME/.config/tmux/tmux.conf";
+
+ # Clean up stale reference from tmux.local.conf (moved to end of tmux.conf)
+ if ( -f $local_conf ) {
+ my $content = do { local $/; open my $fh, '<', $local_conf or die $!; <$fh> };
+ if ( $content =~ /\Q$line\E/ ) {
+ $content =~ s/\n*\Q$line\E\n*/\n/;
+ open my $fh, '>', $local_conf or die $!;
+ print $fh $content;
+ close $fh;
+ Rex::Logger::info("Removed stale tmux.rocky.conf source from $local_conf");
+ }
+ }
- if ( -f $conf ) {
- my $content = do { local $/; open my $fh, '<', $conf or die $!; <$fh> };
+ # Append to the END of tmux.conf so rocky colors override shared config
+ if ( -f $main_conf ) {
+ my $content = do { local $/; open my $fh, '<', $main_conf or die $!; <$fh> };
if ( $content !~ /\Q$line\E/ ) {
- Rex::Logger::info("Appending tmux.rocky.conf source to $conf");
- open my $fh, '>>', $conf or die $!;
+ Rex::Logger::info("Appending tmux.rocky.conf source to end of $main_conf");
+ open my $fh, '>>', $main_conf or die $!;
print $fh "\n$line\n";
close $fh;
}
else {
- Rex::Logger::info("tmux.rocky.conf already sourced in $conf");
+ Rex::Logger::info("tmux.rocky.conf already sourced in $main_conf");
}
}
}