Skip to content

surgiie/wintoggle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

wintoggle

CI License

A bash cli that toggles a window in or out of the current active monitor.

Dependencies

  • xdotool
  • xprop
  • pgrep
  • bc

Install

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"

Usage:

# 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.

Centering Window at Cursor

You can use the --center-at-cursor flag to display the window centered on the cursor position:

wintoggle --name "firefox" --center-at-cursor

Hooks

If 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"

Unmapping Windows

You can use the --unmap flag to remove the window from the window list when hiding (instead of just minimizing):

wintoggle --name "firefox" --unmap

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

This project is licensed under the MIT License - see the LICENSE.md file for details.

About

A bash cli that toggles a window in or out of the current active monitor.

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published

Languages