You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
tdrop-xtoolwait/tdrop.groff

179 lines
13 KiB
Plaintext

10 years ago
.\" Manpage for tdrop.
.\" Please make an issue on the online repository if you find errors or typos.
10 years ago
.TH TDROP 1 "11 February 2015" "tdrop 0.1" "tdrop man page"
.SH NAME
Tdrop - make dropdown terminals and windows
10 years ago
.SH SYNOPSIS
tdrop [\fIOPTIONS\fR] [program name or cmd]
.SH DESCRIPTION
Tdrop is used for hiding/unhiding programs to acheive quake/dropdown functionality. It can create a dropdown window if one does not already exist or turn the current window into a dropdown on the fly. It provides options to control the intial size and position of dropdowns, for example to leave panels visible or to deal with window borders. When used with a terminal, it provides an option to specify the name of a tmuxinator or tmux session to automatically start. It also allows the user to specify arbitrary options/flags to be used when starting programs. It uses window IDs as opposed to class names, so it can be used with multiple windows of the same program.
10 years ago
It also has the ability to automatically hide and automatically show dropdowns. For example, it can be used to automatically hide a terminal when opening something from it, e.g. an image viewer, video player, etc. Tdrop can then automatically bring back the terminal whenever the image view, video player, etc. is closed. See the Examples section for more information.
10 years ago
.SH Commands
Tdrop expects the name of a program or 'current' (to use the current window) as the last argument to create a dropdown. Alternatively, it can take one of auto_show, auto_hide, or toggle_auto_hide. Neither functionality is particularly useful called directly from the command line; the former should be bound to a key, and the latter is better used in shell functions/aliases or with a file opener (e.g. in the rifle.conf).
10 years ago
.SH OPTIONS
.br
E.g.
.br
$ tdrop -y 15 termite
.br
10 years ago
$ tdrop --y-offset=15 termite
.br
$ tdrop --y-offset 15 termite
.TP
Note that all hook and command related options can make use of any tdrop variables (such as $width, $height, $xoff, $yoff, $wid, etc.).
10 years ago
.TP
\fB-w\fR, \fB --width\fR
Specify a width for a created window as a number or percentage. A negative number is allowed (e.g. '-w -4') in which case the width will be that many pixels less than 100% of the screen size (or monitor size if '-m' is being used). This fixes the problem where 100% width may actually go over the screen due to window borders/decoration. The other other geometry options also accept negative values ('-h', '-x', and '-y'). (default: 100%)
.TP
\fB-h\fR, \fB --height\fR
10 years ago
Specify a height for a created window as a number or percentage. (default: 45%)
.TP
\fB-x\fR, \fB --x-offset\fR
10 years ago
Specify the x position for a created window as a number or percentage. (default: 0)
.TP
\fB-y\fR, \fB --y-offset\fR
Specify the y position for a created window as a number or percentage. (default: 1, see BUGS)
10 years ago
.TP
\fB-s\fR, \fB --session\fR
Specify a tmuxinator or tmux session name to start. An existing tmux session has highest precedence and will be connected to with '-d', detaching other attached clients. If a there is no tmuxinator session of the given name, a normal tmux session with the name will be created. If this option is not given, tmux will not be used. Note that this option requires that the program be a supported terminal. (default: none)
10 years ago
.TP
\fB-n\fR, \fB --number\fR
Specify a number (or any extra text) to differentiate between dropdowns of the same program (this is only needed when using multiple dropdowns of the same program). This flag can also be used for creating multiple different dropdowns on the fly ('current'). Note that it is not necessary to use this to deal with multi-user systems as tdrop stores dropdown information separately for each user. (default: none)
10 years ago
.TP
\fB-c\fR, \fB --pre-create-hook\fR
Specify a command to execute before first creating or initializing a dropdown (before mapping a normal dropdown or before unmapping the 'current' window). This flag has no effect for the auto_(hide|show) commands. (default: none)
10 years ago
.TP
\fB-C\fR, \fB --pre-create-hook\fR
Specify a command to execute after first creating or initializing a dropdown (after mapping a normal dropdown or after unmapping the 'current' window). This flag has no effect for the auto_(hide|show) commands. (default: none)
10 years ago
.TP
\fB-p\fR, \fB --pre-map-hook\fR
Specify a command to execute before showing/mapping a dropdown. Note that this will run when showing a dropdown for the first time even when --pre-create-hook is used. (default: none)
.TP
\fB-P\fR, \fB --post-map-hook\fR
Specify a command to execute after showing/mapping a dropdown. Note that this will run when hiding a dropdown for the first time even when --post-create-hook is used. (default: none)
10 years ago
.TP
\fB-l\fR, \fB --pre-map-float-command\fR
Specify a command execute before showing/mapping a dropdown in order to float the dropdown (e.g. a bspwm oneshot rule). This may be useful if you don't want to float all windows of a given program and tdrop doesn't automatically support this for your window manager with the -a flag. This will override any default floating command when used with -a.
.TP
\fB-L\fR, \fB --post-map-float-command\fR
Specify a command execute after showing/mapping a dropdown in order to float the dropdown. This may be useful if you don't want to float all windows of a given program and tdrop doesn't automatically support this for your window manager with the -a flag. This can be used if your window manager does not support floating rules at all; for example, it can be used to fake a key combination (e.g. using xdotool) that will float the current window. This will override any default floating command when used with -a.
.TP
\fB-u\fR, \fB --pre-unmap-hook\fR
Specify a command to execute before hiding/unmapping a dropdown. (default: none)
.TP
\fB-U\fR, \fB --post-unmap-hook\fR
Specify a command to execute after hiding/unmapping a dropdown. (default: none)
.TP
\fB-d\fR, \fB --decoration-fix\fR
Specify a window decoration/border size in the form <x decoration size>x<y decoration size> to be taken into account when saving window position. This should not be necessary for most window managers and is only used with 'auto_show', e.g. 'tdrop -d 1x22 auto_show' for blackbox. (default: none)
.TP
\fB-S\fR, \fB --no-subtract-when-same\fR
This option is a more complicated companion to -d that is also unlikely to be needed. This is used to determine how to calculate the X and Y position of a window using xwininfo when 'auto_hide' is used (if the absolute and relative X or Y values are reported as the same, this option determines the behavior). If you are sure you have the decoration size correct, but windows are still being restored in an incorrect position with 'auto_show', you may want to try using this. Takes no argument. (default: false)
.TP
\fB-i\fR, \fB --is-floating\fR
Specify a command that will determine whether the current window is floating ($wid can be used in the command instead). Only used for the auto_hide command. This will be used to save whether the current window is floating or not. When restoring the window, if there is a float command and the window was previously floating, it will be floated. (default: none)
.TP
\fB-f\fR, \fB --program-flags\fR
Specify flags/options that the terminal or program should be called with. For example, to set the title of the terminal, something like '-f "--title mytitle"' can be used. Caution: If there is a tmux/tmuxinator session specified (with -s), the option to execute a program (usually -e for terminal programs) is implicitly added by tdrop! (default: none)
.TP
\fB-a\fR, \fB --auto-detect-wm\fR
If there are available settings for the detected window manager for the -l, -L, -d, and/or -i options, automatically set them. Takes no argument. Manually specified settings take precedence. This can be used both for dropdowns and the auto_(hide|show) commands. Takes no argument. (default: false)
.TP
\fB-m\fR, \fB --monitor-aware\fR
This option only applies for dropdowns (not auto-hiding and auto-showing). Specify that geometry values should be relative to the current monitor. For example, if the width is a percentage or negative value, the pixel width will be calculated as a percentage of the current monitor's width (instead of the combined width of all monitors). If the monitor changes, this option will cause a dropdown to be resized to fit the given percentages. Note that this option assumes xrandr is being used and requires xrandr to work. (default: false)
.TP
\fB --clear\fR
Used to clear a saved window id for the given program or 'current' instead of creating a dropdown. Takes no argument.
10 years ago
.TP
\fB --no-cancel\fR
Specifies that manually re-showing an auto-hidden window with tdrop should not cancel an auto_show. Takes no argument. See the examples.
10 years ago
.TP
\fB --help\fR
Print basic help information. Takes no argument.
10 years ago
.SH EXAMPLES
.SS Making Dropdowns
Use a key binding program such as sxhkd to bind keys to these commands.
The simplest example to make a dropdown for an xterm:
10 years ago
.br
$ tdrop xterm
When using a tiling window manager like bspwm, dropdowns like guake will by default be tiled instead of floated. One can create a rule to float every instance of guake or another dropdown. However, one may not want to float every instance of a terminal used with tdrop. Tdrop allows the user to run their own commands at various points during execution, for example before mapping the window:
10 years ago
.br
$ tdrop -p "bspc rule -a xterm -o floating=on" xterm
Tdrop also provides tested settings for certain window managers. One can use the '-a' flag if settings exist for the current window manager. For example, if bspwm is the window manager, the following command is the same as the above command and will work for whatever terminal/program is specified and will also work with 'tdrop auto_show'. For a list of window managers with tested settings see the readme or the script itself.
10 years ago
.br
$ tdrop -a xterm
10 years ago
Tdrop supports controlling the initial size and placement of a terminal. The border of a window may need to be taken into an account. For example, I use a border size of 2, so I use 4 less than my screen size. I also use a y-offset of 14 so that the dropdown doesn't hide my panel:
.br
$ tdrop -a -w 1362 -y 14 xterm
10 years ago
Tdrop can also create a tmux or tmuxinator session if it does not exist:
.br
$ tdrop -a -w 1362 -y 14 -s dropdown xterm
10 years ago
Tdrop allows for having multiple dropdowns of the same type:
.br
$ tdrop xterm
.br
$ tdrop -n 1 xterm
.br
$ tdrop -n 2 xterm
.br
...
Tdrop works with normal windows (with some potential visual annoyance, see BUGS):
.br
$ tdrop zathura
.br
# the current window
.br
$ tdrop current
10 years ago
Once a window is turned into a dropdown, the key bound to 'tdrop ... current' will continue to toggle that window until it is closed. Then the key can be used to create a new dropdown. '-n' can also be used to have multiple 'current' keys. If an active window is accidentally turned into a dropdown, it can be cleared:
.br
$ tdrop --clear current
.br
# clear a specific number
.br
$ tdrop -n 1 --clear current
10 years ago
.SS Auto-hiding/showing
These example will work even for non-dropdown terminals.
Tdrop provides the functionality to get programs/terminals out of the way when opening other programs. For example, when opening an image viewer from a normal floating dropdown, the dropdown will be over the image viewer. This requires an extra hotkey press to hide the dropdown. If one wants to return to the dropdown after looking at images, the hotkey must be once again invoked. Tdrop allows for this process to be automated.
For example, this could be added to a shell's config/startup file:
10 years ago
.br
hide_on_open() { tdrop -a auto_hide; "$@" && tdrop -a auto_show }
10 years ago
To use it in an alias when writing a commit message in an graphical $EDITOR started from a terminal:
10 years ago
.br
alias gc='hide_on_open git commit'
This will hide the terminal window when opening the commit editor and then reshow the terminal once the editor is closed. It should also maintain the window's position and size when showing it. If the window moves down and to the right every time it is auto-hidden and then shown again, the user may need to specify a -d value. Alternatively, if one already exists for the user's window manager, -a can be used to automatically set it. The -l and -L options are also used with auto_show and can be set automatically with -a if default settings exist for the current window manager.
Note that for tiling window managers that support 'tdrop -a auto_show', reshowing a window will always float the window (even if it was orignally tiled) if -i is not specified. To prevent this, also use 'tdrop -a auto_hide' if your window manager is supported. Otherwise, -i must be manually specified with auto_hide.
10 years ago
This functionality might lead to some unwanted "re-shows" of dropdown. Consider a situation in which one opens an image viewer from a dropdown and leaves it open for a while, resuming normal use of the dropdown. When the image viewer is closed, the dropdown appears, unwanted. Tdrop is smart about this and won't "re-show" a dropdown if it has been manually toggled since an auto-hide. If you don't want this check to happen, use '--no-cancel' in your dropdown key binding.
10 years ago
Auto-hiding functionality is particularly nice to use with a file opener like rifle:
.br
mime ^image, has sxiv, X, flag f = tdrop auto_hide ; sxiv -a -- "$@" && tdrop -a auto_show
10 years ago
.SH BUGS
If -y is set to 0, a window may be subsequently moved to the middle when showing/mapping it with xdotool. This may have to do with the window border.
10 years ago
.SH AUTHOR
Fox Kiester <noct@openmailbox\&.org>
10 years ago
.br
Source: https://github.com/noct/tdrop
.SH SEE ALSO
xdotool(1), sxhkd(1), xprop(1), xwininfo(1), tmux(1)