A bash cli that toggles a window in or out of the current active monitor.
xdotoolxproppgrepbc
Download script to machine where $PATH is available:
version="main" # or specify a tag/branch
install_dir="$HOME/.local/bin" # customize as needed, must be in your PATH
curl -o "$install_dir/wintoggle" "https://raw.githubusercontent.com/surgiie/wintoggle/$version/wintoggle"
chmod +x "$install_dir/wintoggle"# searches for a process with "firefox" in its name (the more characters here the better as its a "contains" search) and toggles it in or out of the current active monitor
wintoggle --name "firefox"
# when the application is not running, start it with the the same --name value, if the executabable differs from this value, use the --cmd flag, for example
# firefox is searchable in pgrep with "firefox-bin" but the executable is "firefox"
wintoggle --name "firefox-bin" --cmd "firefox"
Note The application window will be focused to the monitor where the mouse is.
You can use the --center-at-cursor flag to display the window centered on the cursor position:
wintoggle --name "firefox" --center-at-cursorIf you'd like to execute some scripts or commands during activate and minimize events, you can use the --on-activate and --on-minimize flags. For example, if you wanted
to play some sounds during these events, here's how you could go about it:
wintoggle --name "firefox" --on-activate "ffplay -nodisp -autoexit $HOME/sounds/activate.mp3" --on-minimize "ffplay -nodisp -autoexit $HOME/sounds/minimize.mp3"You can use the --unmap flag to remove the window from the window list when hiding (instead of just minimizing):
wintoggle --name "firefox" --unmapContributions are welcome! Please see CONTRIBUTING.md for guidelines.
This project is licensed under the MIT License - see the LICENSE.md file for details.