diff options
| author | Paul Buetow <paul@buetow.org> | 2026-01-20 23:54:01 +0200 |
|---|---|---|
| committer | Paul Buetow <paul@buetow.org> | 2026-01-20 23:54:06 +0200 |
| commit | fb2964b28f417b3b208c9dd932a7bc60e864d286 (patch) | |
| tree | 55c629b8d71b4afac5a9fca7ef17054da2595afb | |
| parent | 12d175a73ce650016567839ec3c60d47f35691bc (diff) | |
Add home_quickedit target to manage ~/QuickEdit directory and symlinks
| -rw-r--r-- | dotfiles/Rexfile | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/dotfiles/Rexfile b/dotfiles/Rexfile index 520e47a..41df473 100644 --- a/dotfiles/Rexfile +++ b/dotfiles/Rexfile @@ -222,6 +222,51 @@ task 'home_pipewire', sub { '0600'; }; +desc 'Manage ~/QuickEdit directory and symlinks'; +task 'home_quickedit', sub { + if ( is_os('linux') || is_os('freebsd') ) { + Rex::Logger::info('Setting up ~/QuickEdit'); + + file "$HOME/QuickEdit", + ensure => 'directory', + mode => '0700'; + + my %symlinks = ( + 'data' => "$HOME/data/", + 'Documents' => "$HOME/Documents//", + 'dotfiles' => "$HOME/git/rexfiles/dotfiles/", + 'foo.zone-gemtext' => "$HOME/git/foo.zone-content/gemtext//", + 'Notes' => "$HOME/Notes/", + 'public-snippets' => "$HOME/git/conf/snippets//", + 'worktime' => "$HOME/git/worktime/", + ); + + for my $name ( keys %symlinks ) { + my $link_path = "$HOME/QuickEdit/$name"; + my $target = $symlinks{$name}; + + # Remove existing symlink if it points to a different target + if ( -l $link_path ) { + my $current_target = readlink($link_path); + if ( $current_target ne $target ) { + unlink $link_path or die "Could not remove $link_path: $!"; + symlink $target => $link_path or die "Could not create symlink $link_path: $!"; + } + } + elsif ( -e $link_path ) { + Rex::Logger::info("$link_path exists but is not a symlink, skipping", 'warn'); + } + else { + symlink $target => $link_path or die "Could not create symlink $link_path: $!"; + } + } + } + elsif ( is_os('darwin') ) { + Rex::Logger::info('QuickEdit placeholder for macOS (not yet implemented)'); + # TODO: Implement QuickEdit management for macOS + } +}; + desc 'Install all my ~ files'; task 'home', sub { require Rex::TaskList; |
