diff --git a/README.md b/README.md deleted file mode 100644 index dc5eafb..0000000 --- a/README.md +++ /dev/null @@ -1,101 +0,0 @@ -# tmux_popup - -`tmux_popup` is a command-line tool that allows you to open various programs inside floating popups in tmux. It supports opening tmux, lazygit, harlequin, and postings programs within a tmux session as popups. This tool helps streamline your workflow by launching and interacting with these tools directly in tmux, without leaving your terminal environment. - -## Features - -- Open tmux in a floating popup. -- Open lazygit, harlequin, and postings inside tmux popups. -- Check if the required dependencies are installed. -- Customizable popup width and height. - -## Installation - -Ensure you have the following tools installed: - -- `tmux` -- `lazygit` -- `harlequin` -- `posting` - -To install the `tmux_popup` CLI tool, you can build it from source or use pre-built binaries, if available. - -### Build from Source - -1. Clone the repository: - ```bash - git clone https://github.com/yourusername/tmux_popup.git - cd tmux_popup - -2. Build the application using Go: - -```bash -go build -o tmux_popup -```` -3. Add the binary to your system's PATH for easier access. - -## Usage -Once installed, you can use the tmux_popup tool from your terminal. The basic command syntax is: - -```bash -tmux_popup [options] -```` -### Commands -- tmux: Opens a tmux popup. - -```bash -tmux_popup tmux [--width=] [--height=] -```` -- lazygit: Opens lazygit in a tmux popup. - -```bash -tmux_popup lazygit [--width=] [--height=] -```` -- harlequin: Opens harlequin in a tmux popup. - -```bash -tmux_popup harlequin [--width=] [--height=] -```` -- postings: Opens postings in a tmux popup. - -```bash -tmux_popup postings [--width=] [--height=] -```` -- check: Checks if the required dependencies are installed. - -```bash -tmux_popup check -```` -### Options -- --width: The width of the popup (e.g., 80% or 100). -- --height: The height of the popup (e.g., 80% or 100). -If you don't specify these options, default values (80% for both width and height) will be used. - -Example Usage -Open a tmux session in a floating popup: - -```bash -tmux_popup tmux -```` - -Open lazygit in a floating popup with custom width and height: - -```bash -tmux_popup lazygit --width=100 --height=70 -```` - -Check if dependencies are correctly installed: - -``` bash -tmux_popup check -```` - -### Error Handling -If you run into issues with tmux_popup, check that: - -- You have tmux, lazygit, harlequin, and posting installed and accessible in your PATH. -- You have a running tmux session. - -## License -tmux_popup is released under the MIT License. - diff --git a/main.go b/main.go index c587f05..0bee623 100644 --- a/main.go +++ b/main.go @@ -2,7 +2,6 @@ package main import ( "fmt" - "log/slog" "os" "os/exec" "strings" @@ -92,10 +91,7 @@ func openPopup(sessionName, command string, width, height string) { } if strings.TrimSpace(string(currentSession)) == sessionName { - if err := exec.Command("tmux", "detach-client").Run(); err != nil { - slog.Error("Failed to execute tmux command", "error", err) - return - } + exec.Command("tmux", "detach-client").Run() } else { args := []string{"popup", "-d", "#{pane_current_path}", "-xC", "-yC", fmt.Sprintf("-w%s", width), fmt.Sprintf("-h%s", height), "-E"} if command == "" { @@ -103,10 +99,7 @@ func openPopup(sessionName, command string, width, height string) { } else { args = append(args, fmt.Sprintf("tmux attach -t %s || tmux new -s %s '%s'", sessionName, sessionName, command)) } - if err := exec.Command("tmux", args...).Run(); err != nil { - slog.Error("Failed to execute tmux command", "error", err) - return - } + exec.Command("tmux", args...).Run() } }