{"id":23857592,"url":"https://github.com/merkksgit/tmux-live","last_synced_at":"2026-05-16T11:35:09.121Z","repository":{"id":270637041,"uuid":"910991135","full_name":"merkksgit/tmux-live","owner":"merkksgit","description":"Script to launch live-server in a tmux session with interactive directory selection and optional port customization.","archived":false,"fork":false,"pushed_at":"2025-01-20T22:46:08.000Z","size":4,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-20T23:26:56.204Z","etag":null,"topics":["bash-script","fzf","live-server","tmux"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/merkksgit.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-01-02T01:56:43.000Z","updated_at":"2025-01-20T22:46:11.000Z","dependencies_parsed_at":null,"dependency_job_id":"27c276c0-d2dc-4d5d-8e58-56c9ce9931eb","html_url":"https://github.com/merkksgit/tmux-live","commit_stats":null,"previous_names":["merkksgit/tmux-live"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merkksgit%2Ftmux-live","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merkksgit%2Ftmux-live/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merkksgit%2Ftmux-live/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/merkksgit%2Ftmux-live/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/merkksgit","download_url":"https://codeload.github.com/merkksgit/tmux-live/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240158456,"owners_count":19757167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bash-script","fzf","live-server","tmux"],"created_at":"2025-01-03T02:59:10.020Z","updated_at":"2026-05-16T11:35:04.096Z","avatar_url":"https://github.com/merkksgit.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# tmux-live\n\n[![Linux](https://img.shields.io/badge/Linux-%23.svg?logo=linux\u0026color=FCC624\u0026logoColor=black)](#)\n[![tmux](https://img.shields.io/badge/tmux-1BB91F?logo=tmux\u0026logoColor=fff)](#)\n[![Bash](https://img.shields.io/badge/Bash-4EAA25?logo=gnubash\u0026logoColor=fff)](#)\n\nA Bash script that creates a new tmux session and starts a live server in the selected directory. Perfect for web development workflows.\n\n\u003c!-- vim-markdown-toc GFM --\u003e\n\n* [Features](#features)\n* [Prerequisites](#prerequisites)\n* [Installation](#installation)\n* [WSL Setup](#wsl-setup)\n* [Tmux Key Binding Setup](#tmux-key-binding-setup)\n* [Usage](#usage)\n* [How It Works](#how-it-works)\n* [Configuration](#configuration)\n* [Troubleshooting](#troubleshooting)\n    * [Browser doesn't open (WSL)](#browser-doesnt-open-wsl)\n    * [Browser doesn't open (Linux)](#browser-doesnt-open-linux)\n* [Credits](#credits)\n\n\u003c!-- vim-markdown-toc --\u003e\n\n## Features\n\n- Creates a new tmux session with live-server running\n- Interactive directory selection with fzf\n- Supports custom ports\n- Automatically opens the server in your default browser\n- Can be triggered with tmux key binding\n- WSL compatible with proper browser integration\n\n## Prerequisites\n\nMake sure you have the following installed:\n\n- tmux\n- live-server (npm package)\n- fzf\n- xdg-utils (for `xdg-open` command)\n- For WSL users: wslu package (for `wslview` command)\n\n## Installation\n\n1. Clone this repository or download/copy the script\n2. Make the script executable:\n\n```bash\nchmod +x tmux-live.sh\n```\n\n3. Move the script to your preferred location, for example:\n\n```bash\nmv tmux-live.sh ~/.local/scripts/tmux-live.sh\n```\n\n## WSL Setup\n\nIf you're using Windows Subsystem for Linux (WSL), you need to configure the browser environment variable to properly open URLs in your Windows browser:\n\n1. Install wslu if not already installed: [Installation Guide](https://wslu.wedotstud.io/wslu/install.html)\n\n2. Add the following line to your `~/.bashrc` file:\n\n```bash\nexport BROWSER=wslview\n```\n\n3. Reload your bashrc:\n\n```bash\nsource ~/.bashrc\n```\n\nThis ensures that when the script tries to open the live server URL, it will use `wslview` to open it in your Windows default browser instead of trying to use a Linux browser.\n\n## Tmux Key Binding Setup\n\nAdd this line to your `~/.tmux.conf` (replace `ä` with desired keybind):\n\n```bash\nbind-key ä run-shell \"~/path/to/script\"\n```\n\nAfter adding the line:\n\n1. Either restart tmux\n2. Or reload the configuration by pressing `prefix + r`\n\n## Usage\n\nThere are several ways to use the script:\n\n1. Using tmux key binding:\n   - Press `prefix + ä` (default tmux prefix is ctrl+b)\n   - Select directory from the fzf popup\n   - Server starts on default port 5050\n2. Default mode - opens fzf directory picker and uses port 5050:\n\n```bash\n./tmux-live.sh\n```\n\n3. Custom port mode - specify port first, then select directory with fzf:\n\n```bash\n./tmux-live.sh 3000\n```\n\n4. Direct path mode - specify directory path and use default port 5050:\n\n```bash\n./tmux-live.sh /path/to/directory\n```\n\n## How It Works\n\n1. When executed, the script either:\n   - Shows an fzf popup to select a directory from predefined paths (~/school, ~/github_repositories, ~/projects)\n   - Uses the provided directory path\n2. Creates a new tmux session with the directory name\n3. Starts live-server in the session on the specified port (default: 5050)\n4. Opens your default browser to the live-server URL\n5. Attaches to or switches to the new tmux session\n\n## Configuration\n\nThe script looks for directories in these paths by default:\n\n- `~/school`\n- `~/github_repositories`\n- `~/projects`\n  To change these paths, modify the `find` command in the script.\n\n```bash\nselected=\"$(find ~/school ~/github_repositories/ ~/projects -mindepth 1 -maxdepth 1 -type d | fzf-tmux -p 50% --header='Open live server:')\"\n```\n\n## Troubleshooting\n\n### Browser doesn't open (WSL)\n\nIf you're using WSL and the browser doesn't open automatically when running the script:\n\n1. Verify that `wslview` is installed and working:\n\n```bash\nwslview --help\n```\n\n2. Check that the `BROWSER` environment variable is set:\n\n```bash\necho $BROWSER\n```\n\n3. If the variable isn't set, add it to your `~/.bashrc`:\n\n```bash\necho 'export BROWSER=wslview' \u003e\u003e ~/.bashrc\nsource ~/.bashrc\n```\n\n### Browser doesn't open (Linux)\n\nIf you're on a regular Linux system and the browser doesn't open:\n\n1. Verify that `xdg-open` is installed and working:\n\n```bash\nxdg-open --help\n```\n\n2. Test opening a URL manually:\n\n```bash\nxdg-open http://localhost:5050\n```\n\n## Credits\n\nThis script is heavily influenced by tmux-sessionizer, a script by [ThePrimeagen](https://github.com/ThePrimeagen/). The project adapts his session management approach while adding live-server functionality for web development.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerkksgit%2Ftmux-live","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmerkksgit%2Ftmux-live","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmerkksgit%2Ftmux-live/lists"}