#Requires -Version 5.1 <# .SYNOPSIS Installs rmux (Rust terminal multiplexer) on Windows. .DESCRIPTION Installs rmux natively by invoking the official install.ps1 script. This is a modern, fast Rust-based alternative to tmux. Official Guide: https://rmux.io/docs/get-started/#/installation .EXAMPLE .\install-rmux.ps1 # One-liner install from remote (works on Windows 10+): powershell -ExecutionPolicy Bypass -c "[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12; $t=\"$env:TEMP\install-rmux.ps1\"; iwr -useb 'https://gl.isitsoft.kr/publicproj/install-sh/-/raw/main/install-rmux.ps1' -OutFile $t; & $t" .NOTES If execution policy error occurs: Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser #> [CmdletBinding()] param() # 최신 윈도우 환경 및 에러 발생 시 즉시 중단 설정 Set-StrictMode -Version Latest $ErrorActionPreference = 'Stop' # HTTPS 다운로드를 위한 TLS 1.2 강제 (PowerShell 5.1 호환성 보장) [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 # ──────────────────────────────────────────── # 유틸리티 함수 정의 (모든 안내 문구는 영문으로 작성) # ──────────────────────────────────────────── function Write-Info { param([string]$msg) Write-Host "[INFO] $msg" -ForegroundColor Cyan } # 정보 출력 function Write-Warn { param([string]$msg) Write-Host "[WARN] $msg" -ForegroundColor Yellow } # 경고 출력 function Write-Success { param([string]$msg) Write-Host "[OK] $msg" -ForegroundColor Green } # 성공 출력 function Write-Err { param([string]$msg) Write-Host "[ERROR] $msg" -ForegroundColor Red; exit 1 } # 에러 출력 및 스크립트 강제 종료 # ──────────────────────────────────────────── # 메인 설치 프로세스 # ──────────────────────────────────────────── function Main { Write-Info "===== rmux CLI install script (Windows PowerShell) =====" Write-Info "Installing rmux CLI (Rust terminal multiplexer) natively..." # 이미 설치되어 있는지 확인 $rmuxCmd = Get-Command rmux -ErrorAction SilentlyContinue if ($rmuxCmd) { $currentVer = & rmux --version 2>$null if (-not $currentVer) { $currentVer = "unknown" } Write-Info "rmux is already installed ($currentVer). Skipping installation." } else { try { Write-Info "Fetching and executing official installer from: https://rmux.io/install.ps1" # 공식 설치 ps1 스크립트를 다운로드 및 메모리 상에서 직접 호출 가동 $installerScript = Invoke-RestMethod -Uri "https://rmux.io/install.ps1" -UseBasicParsing Invoke-Expression $installerScript Write-Success "rmux has been successfully installed!" } catch { Write-Err "Failed to install rmux CLI: $_" } } # 2) Deploy .rmux.conf $confFile = Join-Path $env:USERPROFILE '.rmux.conf' if (Test-Path $confFile) { Write-Warn "Existing .rmux.conf found at $confFile" $backup = "${confFile}.bak.$(Get-Date -Format 'yyyyMMddHHmmss')" Copy-Item -Path $confFile -Destination $backup -Force Write-Info "Backup saved to $backup" } Write-Info "Deploying .rmux.conf..." $confContent = @' # .rmux.conf 샘플 # Prefix key 변경 (기본은 Ctrl-b) set -g prefix C-a unbind C-b bind C-a send-prefix # 창 분할 단축키 변경 bind | split-window -h -c "#{pane_current_path}" bind - split-window -v -c "#{pane_current_path}" unbind '"' unbind % # 창 이동 단축키 (vim 스타일) bind h select-pane -L bind j select-pane -D bind k select-pane -U bind l select-pane -R # 창 전환 단축키 bind -r C-h previous-window bind -r C-l next-window # 창 재정렬 bind Space next-layout # 창 회전 bind o rotate-window # 창 이름 변경 bind , command-prompt "rename-window %%" # 창 닫기 bind & kill-window # 세션 재시작 bind r source-file ~/.rmux.conf \; display "Reloaded!" # 상태 표시줄 설정 (색상 설정 비활성화) #set -g status-bg colour235 #set -g status-fg colour136 set -g status-left-length 40 set -g status-right-length 40 set -g status-interval 5 set -g history-limit 10000 # 상태 표시줄 왼쪽 내용 (색상 설정 비활성화) #set -g status-left '#[fg=green]#S #[fg=yellow]#H' # 상태 표시줄 오른쪽 내용 (색상 설정 비활성화) #set -g status-right '#[fg=cyan]%Y-%m-%d #[fg=green]%H:%M:%S' # 패널 테두리 색상 (색상 설정 비활성화) #set-option -g pane-border-style 'fg=colour244' #set-option -g pane-active-border-style 'fg=colour77' # 복사 모드에서 vi 키 바인딩 사용 setw -g mode-keys vi # 마우스 지원 활성화 set -g mouse on # 256색 지원 (비활성화) #set -g default-terminal "screen-256color" # for pi set -g extended-keys on '@ try { $confContent | Out-File -FilePath $confFile -Encoding utf8 -Force Write-Success ".rmux.conf deployed successfully." } catch { Write-Warn "Failed to deploy .rmux.conf: $_" } # 최종 가용성 검증 $rmuxCmd = Get-Command rmux -ErrorAction SilentlyContinue if ($rmuxCmd) { Write-Success "rmux is available: $($rmuxCmd.Source)" Write-Info "Run command: rmux" } else { Write-Warn "rmux was not found in PATH after installation. You may need to restart your terminal window or refresh your PATH environment variable." } } # 예기치 못한 전체 프로세스 에러 감지를 위한 Trap 설정 trap { Write-Err "An unexpected error occurred during installation: $_" } Main