Add lan-mouse
This commit is contained in:
1 parent
1a9f2be31a
commit
aa5776af18
3 files changed
+77
No files matched your search
@@ -9,6 +9,9 @@ A scripted Neovim setup built around C/C++ development (CMake + clangd + codelld
|
||||
|
||||
Supports **Fedora, Ubuntu, Debian, and Arch Linux** (and their common derivatives — Pop!_OS, Linux Mint, Manjaro, EndeavourOS, etc. — via `/etc/os-release`'s `ID_LIKE`) — the script detects which one you're on and uses the right package manager and package names automatically.
|
||||
|
||||
## Lan Mouse
|
||||
lan-mouse shares your mouse and keyboard across multiple computers over your local network. Moving your cursor off the edge of one screen seamlessly switches control to the other machine, and syncs your clipboard so you can copy and paste text between them.
|
||||
|
||||
## SSH
|
||||
A lightweight Bash suite that automatically creates, configures, and safely removes completely isolated OpenSSH server instances on Linux.
|
||||
Perfect for providing dedicated SSH access to specific users, teams, or applications without modifying your primary server's SSH configuration.
|
||||
|
||||
@@ -0,0 +1,45 @@
|
||||
# 1. Variables and Paths
|
||||
$installPath = "$env:LOCALAPPDATA\LanMouse"
|
||||
$zipPath = "$env:TEMP\lan-mouse-windows.zip"
|
||||
$repoUrl = "https://api.github.com/repos/feschber/lan-mouse/releases/latest"
|
||||
|
||||
# 2. Fetch and Download the Latest Release
|
||||
Write-Host "Checking GitHub for the latest Lan Mouse release..." -ForegroundColor Cyan
|
||||
$release = Invoke-RestMethod -Uri $repoUrl
|
||||
$asset = $release.assets | Where-Object { $_.name -match "windows.*\.zip" }
|
||||
|
||||
if ($null -eq $asset) {
|
||||
Write-Error "Could not find a matching .zip release for Windows."
|
||||
Break
|
||||
}
|
||||
|
||||
Write-Host "Downloading $($asset.name)..." -ForegroundColor Cyan
|
||||
Invoke-WebRequest -Uri $asset.browser_download_url -OutFile $zipPath
|
||||
|
||||
# 3. Extract Files (Preserves directory structure and GTK DLLs)
|
||||
Write-Host "Extracting to $installPath..." -ForegroundColor Cyan
|
||||
if (Test-Path $installPath) { Remove-Item -Recurse -Force $installPath }
|
||||
New-Item -ItemType Directory -Force -Path $installPath | Out-Null
|
||||
Expand-Archive -Path $zipPath -DestinationPath $installPath -Force
|
||||
|
||||
# Identify the extracted executable
|
||||
$exePath = Get-ChildItem -Path $installPath -Filter "lan-mouse.exe" -Recurse | Select-Object -First 1 -ExpandProperty FullName
|
||||
|
||||
# 4. Configure Windows Defender Firewall (Ports and Executable)
|
||||
Write-Host "Configuring Windows Firewall rules (Port 4242 TCP/UDP)..." -ForegroundColor Cyan
|
||||
Remove-NetFirewallRule -DisplayName "Lan Mouse" -ErrorAction SilentlyContinue
|
||||
|
||||
New-NetFirewallRule -DisplayName "Lan Mouse" -Direction Inbound -Action Allow -Protocol TCP -LocalPort 4242 -Program $exePath | Out-Null
|
||||
New-NetFirewallRule -DisplayName "Lan Mouse" -Direction Inbound -Action Allow -Protocol UDP -LocalPort 4242 -Program $exePath | Out-Null
|
||||
|
||||
# 5. Create Desktop Shortcut
|
||||
Write-Host "Creating Desktop shortcut..." -ForegroundColor Cyan
|
||||
$WshShell = New-Object -comObject WScript.Shell
|
||||
$Shortcut = $WshShell.CreateShortcut("$env:USERPROFILE\Desktop\Lan Mouse.lnk")
|
||||
$Shortcut.TargetPath = $exePath
|
||||
$Shortcut.WorkingDirectory = Split-Path $exePath
|
||||
$Shortcut.Save()
|
||||
|
||||
# Cleanup
|
||||
Remove-Item $zipPath
|
||||
Write-Host "Setup complete! Launch Lan Mouse from your Desktop." -ForegroundColor Green
|
||||
@@ -0,0 +1,29 @@
|
||||
#!/bin/bash
|
||||
echo "=== Installing Lan Mouse ==="
|
||||
if command -v paru &> /dev/null; then
|
||||
paru -S --noconfirm lan-mouse
|
||||
elif command -v yay &> /dev/null; then
|
||||
yay -S --noconfirm lan-mouse
|
||||
else
|
||||
sudo pacman -S --noconfirm lan-mouse
|
||||
fi
|
||||
|
||||
echo -e "\n=== Configuring Firewall (Port 4242 TCP/UDP) ==="
|
||||
# Detect Firewalld
|
||||
if systemctl is-active --quiet firewalld; then
|
||||
echo "Firewalld detected. Applying permanent rules..."
|
||||
sudo firewall-cmd --zone=public --add-port=4242/tcp --permanent
|
||||
sudo firewall-cmd --zone=public --add-port=4242/udp --permanent
|
||||
sudo firewall-cmd --reload
|
||||
echo "Firewalld rules applied."
|
||||
# Detect UFW
|
||||
elif command -v ufw &> /dev/null && sudo ufw status | grep -q "Status: active"; then
|
||||
echo "UFW detected. Applying rules..."
|
||||
sudo ufw allow 4242/tcp
|
||||
sudo ufw allow 4242/udp
|
||||
echo "UFW rules applied."
|
||||
else
|
||||
echo "Neither UFW nor Firewalld was detected. Make sure to open port 4242 manually."
|
||||
fi
|
||||
|
||||
echo -e "\nLan Mouse setup complete!"
|
||||
Reference in new issue
Block a user