GithubHelp home page GithubHelp logo

tdrop's Introduction

https://github.com/noctuid/tdrop/workflows/lint/badge.svg

Demos

This is a basic demo where tdrop is used to hide and show a terminal emulator on different desktops/workspaces:

http://noctuid.github.io/tdrop/assets/termite.gif

This is a basic demo where tdrop is used to turn the current window (emacs) into a dropdown and then hide and show it on different desktops/workspaces:

http://noctuid.github.io/tdrop/assets/current.gif

Advantages Over Other Dropdown Terminals

  • Supports essentially any terminal or other program of your choice
  • Supports many window managers
  • Supports turning any window into a dropdown on the fly
  • Supports enforcing dropdown sizing and placement (e.g. to prevent panels from being hidden)
  • Supports tiled and floating dropdowns
  • Supports floating dropdown instances without requiring the user to create a rule to float all program instances (for some window managers that support both tiling and floating)
  • Supports using multiple dropdowns of the same program (see -n)
  • Supports automatically hiding a dropdown when opening a new window from it and then optionally re-showing the dropdown when the window is closed (this is somewhat comparable to “swallowing”, e.g. in dwm)
  • Supports automatically starting programs and tmux, tmuxinator, tmuxifier or tmuxp sessions
  • Supports automatically resizing dropdowns based on the current monitor’s size
  • Has hooks for executing user commands

Requirements

  • bash
  • basic utilities (probably already installed on linux)
    • GNU coreutils (for install, tee, cat, mkdir, head, etc.)
    • gawk
    • GNU grep
    • procps-ng (for pgrep)
  • xprop
  • xwininfo
  • xdotool

Optional:

  • xrandr (required for -m)
  • tmux (required for -s)
  • tmuxinator (optional for -s)
  • tmuxifier (optional for -s)
  • tmuxp (optional for -s)

Installation and Usage

Installation

Tdrop is in the AUR as tdrop-git and is packaged for Void Linux as tdrop. It can also be installed by cloning this repo and running sudo make install. One can then bind a key to it (e.g. with sxhkd).

Basic Sxhkd Example

# negative -w arg to account for a border width (default: 100%)
alt + s
    tdrop -ma -w -4 -y "$PANEL_HEIGHT" -s dropdown kitty

The positional argument should be the name of a program in $PATH (as opposed to the full path to a program). It should always come after any tdrop flags. Flags for the program can come after it (e.g. tdrop urxvt -title foo).

Basic Flags

For a full list of flags and documentation, see the manpage.

-w / --width, -h / --height, -x / --xoff, and -y / --yoff can be used to set the window size/position. The argument to any of these can be a number (e.g. -w 800) or a percentage (e.g. -w 100% or -w 33.3%) or empty (e.g. -w "" -h ""= to prevent altering the window's size). Negative numbers correspond to that many pixels less than 100% of the screen width (e.g. =-w -4). To unmanage all geometry settings, you can specify -N / --no-manage. This is the same as =-w “” -h “” -x “” -y “”= and should not be used with any other geometry flags.

If you want to be able to resize the dropdown after creating it, you can use the -r / --remember flag to store/restore the dropdown geometry when hiding/showing.

By default, tdrop will hide the dropdown if it is shown anywhere. -A / --activate can be used to always activate/show the dropdown if it is not focused.

-s / --session should only be used for supported terminals and if the user wants to start/attach to a tmux, tmuxinator, tmuxifier or tmxup session. Note that you do not need to use -s to start tmux. You can always pass arguments/flags to the program that tdrop runs, e.g. tdrop kitty tmux.

Tdrop has basic checks to print errors for malformed commands (e.g. to require one positional argument). If a tdrop command does not work, please run it in a terminal or check /tmp/tdrop/log for error messages and consult the manpage before making an issue. For more information, see the Troubleshooting section.

Changes

Long options can now be used with whitespace instead of requiring a = (i.e. --long-opt value and --long-opt=value are both fine).

Old users please note that -W|--normal-window, -z|--sleep-terminal, and -Z|--sleep-window are no longer necessary and have been removed. Similarly, the old hook flags (-p, -P, -M, and -O as well as --create-hook and --map-hook) have been replaced with more specific and useful versions.

Automatic Window Manager Detection (-a)

-a / --auto-detect-wm can be specified to automatically set certain options (-l, -L, -d, and/or -i) based on the current window manager. These flags (whether automatically or manually set) may be necessary for tdrop to behave correctly (e.g. they are required for -w, -h, -x, and -y to work correctly for tiling window managers with floating support). See the manpage for further details about these flags.

Note that if you’ve used wmname to change your window manager’s name, tdrop will use any settings for that name instead. In this case, you will generally need to specify the real name of your window manager using the --wm flag in order for -a to work correctly (e.g. if you are using bspwm and have run wmname LG3D, you will need to specify --wm bspwm).

Monitor Awareness (-m)

-m / --monitor-aware can be specified to automatically resize the dropdown based on the current monitor’s size when percentages are used for -w and/or -h. This may be helpful for users of multiple monitors who don’t want dropdowns spanning across monitors.

This is particularly useful when using a percentage or negative value with -w, -h, -x, and/or -y. For example, -w -4 normally corresponds to a width 4 pixels less than 100% of the screen width (potentially the combined width of multiple monitors). With -m, the pixel values are calculated using the dimensions of the current monitor alone. Negative values may be useful when the window manager (possibly due to window decorations) causes a dropdown with -w 100% to go over the edge of the screen. The -m option will also automatically resize and/or reposition the dropdown when opening it on a different monitor when one or more of the geometry arguments are negative or percentages.

Some window managers allow querying what the current monitor is or directly for its geometry (e.g. bspwm, i3, and herbstluftwm), but for other window managers, tdrop determines the current monitor based on the position of the active window. For these window managers, if the desktop is empty, tdrop must wait for the dropdown to be created or mapped before getting the monitor info. This may cause a slight delay before the dropdown is properly resized. If -m does not work at all or there is a specific way to query for the current monitor in your window manager, please make an issue.

See the manpage for more information.

Wayland support

Tdrop does not support programs that use Wayland directly, but it does work under Wayland if the program uses XWayland. If your program defaults to using Wayland, you can generally force it to use XWayland by setting the environment variable WAYLAND_DISPLAY=no.

Also note that certain tdrop features don’t work under Wayland due to limitations of xdotool. For instance, -m / --monitor-aware only works when combined with -t / --pointer-monitor-detection.

Example:

WAYLAND_DISPLAY=no tdrop -mta alacritty

If you are using Hyprland then hdrop can emulate the main feature of tdrop, namely running, showing and hiding a given program depending on its current state.

Flatpak

As Flatpak jails applications, the PID cannot be used to find the attached window. A class name has to be given in order to find it, with --class.

As Flatpak is considered by tdrop as the program to run, tdrop cannot differentiate 2 different flatpak applications. Use the -n option for this purpose.

Example:

tdrop -ma -n signal --class=signal flatpak run org.signal.Signal
tdrop -ma -n firefox --class=firefox flatpak run org.mozilla.firefox

Flicker

For some window managers that require a window to be repositioned after re-mapping it, some flicker may be noticeable. This flicker has been mostly fixed for some window managers (e.g. in the Gnome Shell and Cinnamon DEs) and improved for others. It is usually worse on tiling managers where the window must be re-floated every time it is mapped. The way around this is to use rules to either always have the class or name (see --name) floated or one-time rules to only float the next instance of a class. For example, since bspwm has oneshot rules and generally doesn’t alter the size/position of a window, there isn’t any movement flicker.

A more consistent workaround to improve visual flickering regardless of the window manager is to enable fade-in for the compositor. For picom this can be done by setting fading = true; and adjusting the fade-delta in the ~/.config/picom.conf accordingly.

Hooks

Tdrop provides hook flags that the user can specify to run commands at various stages during execution. These commands can make use of any global, internal tdrop variable, such as $width, $height, $xoff, $yoff, $class, and $wid (to prevent evaluation of these variables, the user can specify the hook command in single quotes). For example, to set a dropdown as always on top, the user could specify =-P ‘wmctrl -i -r $wid -b add,above’=.

Note that for --pre-map-hook and --pre-map-float-command, the window id is not guarunteed to be known (since the window may not have yet been created), so any script that makes use of these flags should first check if $wid is defined. The window id will not be defined for --pre-create-hook (even for current; I can change this if there is a use case for it).

Pre Create

-c / --pre-create-hook

Program The command will run once before the program is started.

Current The command will run once before unmapping the current window.

Hide and Show No effect.

Post Create

-C / --post-create-hook

Program The command will run once after the program is started and its window is active.

Current The command will run once after unmapping the current window.

Hide and Show No effect.

Pre Map

-p / --pre-map-hook

Program / Current / Show The command will run before creating the window and before subsequently mapping the window.

Hide No effect.

Post Map

-P / --post-map-hook

Program / Current / Show The command will run after creating the window and after subsequently mapping the window. Note that unlike the pre-map hook, this will always run when showing the window, even if it was not previously unmapped (e.g. it is just being activated if -A is specified, or it is just being moved from another desktop). If you need different behavior (e.g. you need newly added distinct --(pre|post)-show-hook flags), please comment on this issue.

Hide No effect.

Pre Unmap

-u / --pre-unmap-hook

Program / Current / Hide The command will run before unmapping the window.

Show No effect.

Post Unmap

-U / --post-unmap-hook

Program / Current / Hide The command will run after unmapping the window.

Show No effect.

Pre Float

-l / --pre-map-float-command

A command specifically meant to float the window. Note that if you specify this, it will override any defaults from -a.

Program / Current The command will run before mapping the window.

Hide No effect.

Show The command will run before mapping the window only if it was previously floating.

Post Float

-L / --post-map-float-command

A command specifically meant to float the window. Note that if you specify this, it will override any defaults from -a.

Program / Current The command will run after mapping the window.

Hide No effect.

Show The command will run after mapping the window only if it was previously floating.

Auto-hiding

In addition to creating dropdowns, tdrop can automatically hide a window and later un-hide it. For example, if gvim is opened to write a git commit message from the terminal, tdrop can automatically hide the terminal (dropdown or not) and restore it after the user is finished writing the commit message:

hide_on_open() {
    tdrop -a auto_hide && "$@" && tdrop -a auto_show
}
alias gc='hide_on_open git commit'

The most useful application of this functionality is probably when opening videos, images, etc. in an external program from a file manager like ranger. For example, in the rifle.conf:

mime ^video, has mpv, X, flag f = tdrop -a auto_hide && mpv -- "$@" && tdrop -a auto_show

Other Commands

If hide_all is given instead of a program name, tdrop will hide all visible dropdowns.

If foreach is specified, tdrop will evaluate the following command for each dropdown. Here are some example commands:

# same as hide_all 
tdrop foreach 'unmap $wid'

# hide only floating dropdowns on herbstluftwm
tdrop foreach 'herbstclient compare clients.$(printf 0x%x $wid).floating = on && unmap $wid'

Tested With

Terminals

These terminals have been tested with tdrop and support the -s and -a flags unless otherwise specified:

  • Alacritty
  • cool-retro-term
  • GNOME terminal (GNOME, Unity, Cinnamon, etc.)
  • kitty
  • Konsole (KDE)
  • LilyTerm (requires confirm_to_execute_command 0 in config for -s or =-f ‘-e…’=)
  • LXTerminal (LXDE)
  • MATE terminal (MATE)
  • QTerminal (LXDE)
  • Roxterm
  • Sakura
  • Terminology (Enlightenment)
  • Termite
  • Tilix (previously terminix)
  • tinyterm/minyterm
  • URxvt (including urxvtd)
  • Wezterm
  • Xfce4-terminal (XFCE)
  • xiate
  • XTerm

If your terminal doesn’t work with tdrop, feel free to make an issue. Please follow the steps in the Troubleshooting section.

Other Programs

  • Chrome/chromium
  • Firefox
  • Brave
  • Emacs and emacsclient
  • Discord
  • Tabbed
  • Todoist
  • Postman
  • Spotify
  • Clementine and Strawberry
  • etc.

Window Managers

The primary goal of tdrop is to “just work” with any window manager. The primary differences between how tdrop deals with different window managers is the strategy it takes for floating only the dropdown (as opposed to all instances of the class that the dropdown is). There are three types of window managers as far as tdrop is concerned:

Tiling without Floating Support

If your window manager does not support floating, there’s nothing to worry about. Binding a key to tdrop <flags> terminal should work. Options for resizing and movement that work only with floating window managers are not supported. One can, however, add post-map and post-unmap commands to do something like change the layout to fullscreen when showing a dropdown then revert the layout when hiding the dropdown. Previously (-a) would automatically do this for herbstluftwm, but it now supports floating.

Floating/Stacking

For floating window managers, tdrop should also generally “just work”, but you may need to add the -a option for auto-showing to correctly restore the previous geometry.

That said, these are the floating window managers that currently have been tested:

  • mutter (gnome shell)
  • muffin (cinnamon)
  • xfwm4 (xfce)
  • metacity (gnome 2)
  • marco (mate)
  • kwin (kde)
  • openbox (lxde)
  • compiz (unity)
  • pekwm
  • fluxbox
  • blackbox
  • fvwm
  • sawfish
  • goomwwm

If your dropdown moves out of place when being shown, make an issue, and I will add settings for it.

Tiling with Floating Support

These window managers currently will work with -a for a floating (instead of tiled) dropdown:

  • bspwm (support for versions prior to 0.9.1 was dropped on 2016/09/22)
  • herbstluftwm (v0.8.0 or higher)
  • i3
  • awesome

Awesome support may be buggy; if you encounter problems, please report them.

Why Not Use wmctrl?

Necessary features don’t work on many window managers, including mine.

Why Not Use wmutils?

Maybe in the future. The only advantage I can see over xdotool is that it can toggle mapping (mapw -t), but this wouldn’t be used in this script anyway since different code is executed depending on whether or not the window is mapped or unmapped. Also the command names are somewhat cryptic.

Similar

Troubleshooting

You can specify the --debug flag to have tdrop print more verbose debugging output. Tdrop will automatically also save this output in /tmp/tdrop_"$USER"_"$DISPLAY"/log. If tdrop does not appear at all, or there is some error, you can add the --debug flag and examine the log file or run the tdrop command in a terminal to see if the issue is obvious (e.g. tdrop will error if you do not have the required dependencies installed).

Tdrop does not work with some terminal/program

Please make an issue. Including the following information would help resolve the problem more quickly.

Basic:

  • The incorrect behavior: Does the window appear at all? Is the problem that it is not floated correctly in a supported wm? Or is it a feature request for -a support?
  • Whether things work as expected with a basic tdrop <terminal> (no flags) or whether the issue occurs with a specific flag (probably -s)

Additional helpful information:

  • If the problem only occurs with the -s flag, the issue is likely due to the fact that not all terminals have compatible -e flags. It would be helpful if information on how the terminal’s flag for executing a command works. Is it something other than -e? Are quotations required or incorrect (“-e ‘command -flags …’” vs “-e command flags”)?
  • If the issue is with the dropdown behavior (e.g. tdrop keeps opening new windows for the program), does the program share a PID across all instances (e.g. open several windows and provide the output of pgrep -l <program>)? Does the program have a daemon and client?

tdrop's People

Contributors

adrianlzt avatar allemangd avatar aruhier avatar dakes avatar danmou avatar gamekyuubi avatar ksoltysik avatar mysy00 avatar noctuid avatar pbui avatar peskovdev avatar priezz avatar schoettl avatar schweber avatar shadowkyogre avatar tuxicc avatar vagr9k avatar vapniks avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

tdrop's Issues

urxvt + "tabbed" plugin doesn't work with tdrop

How to reproduce:

  • Have URxvt*perl-ext: tabbed in your ~/.Xresources.
  • Invoke pkill -f urxvt ; xrdb ~/.Xresources && tdrop -h 30% -f '--borderLess' -m -P 'wmctrl -i -r $wid -b add,above,skip_taskbar' urxvt. Removing -P from here doesn't seem relevant in any way.

Current result:
urxvt appears in small window in the middle of screen. It's borderless, but no wmctrl options seem to be in effect.

Expected result:
urxvt shows in on top area of the screen with no border. It doesn't show on taskbar and is stacked above other windows.

Additional info:
tabbed plugin is one of urxvt must-haves, especially along with dropdown terminal machinery. tabbed seem to be developed at https://github.com/gryf/tabbed. A code seems to have some hacks related to fake window resizing.

AUR version of tdrop (tdrop-git) updated 2016-03-23 16:11 was initially used but I reproduced it also with latest upstream commit.

query: built-in method of using emacsclient?

I understand that something like emacs(client) can be tdrop'ed by doing tdrop current inside of the emacs frame, but I wonder if there is a way of having tdrop apply to it directly, e.g. tdrop -ma -w -4 -y "$PANEL_HEIGHT" -s emacsclient -c or the like? As far as I can tell, this approach doesn't work.

The reason I ask is because I'd like to use an emacsclient frame running eshell as a drop-down terminal. I can manage this manually via tdrop, but it'd be nice to have it set-up automatically on boot. I've been trying to devise an emacs-internal solution which does this via having eshell execute a shell command (tdrop current), but what I have isn't working very well yet and is becoming increasing Rube Goldbergesque so I thought I'd check to see if there is an easier way of accomplishing this which I'm missing.

xdotool causes infinite loop after shutting down bspwm

hi @noctuid,

this problem just hit me. I'm using tdrop with xst-git and it's all fine. But when I hit ctrl+super+esc, to shutdown bspwm gracefully, I enter an infinite loop with xdotool complaining that it can't create a display. My only way out is to push the shutdown button on my computer.

I find tdrop to be way slower than i3's scatchpad, could speed be improved?

How I conclude this:

Case scratchpad

  1. The terminal used is Terminology.

  2. Put this in your i3 config file:
    bindsym $mod+z [instance="__scratchpad$"] scratchpad show
    exec_always --no-startup-id terminology --name "__scratchpad"

  3. Reload i3

  4. Now press and hold $mod+z

  5. On my PC, CPU goes max 25%-30%

Case tdrop

  1. The terminal here is also Terminology

  2. I put this in my i3 config:
    bindsym $mod+z exec tdrop -ma -f '--name mydropdown' terminology
    # for floating
    for_window [instance="mydropdown"] fullscreen disable, floating enable border normal 1

  3. Reload i3

  4. Now, if I do the same, holding $mod+z, the CPU goes 60% and up to 80%, and I see it has a small delay when I toggle it regularly compared to scratchpad.

NOTE: I also tested the tdrop case with xterm, and it is nearly same.

EDIT: This is my PC configuration(screenfetch):

OS: Ubuntu 16.04 xenial
Shell: bash 4.3.48
Resolution: 1366x768
WM: i3
CPU: Intel Celeron CPU G540 @ 2.5GHz
GPU: GeForce 210
RAM: 840MiB / 3914MiB

FreeBSD support

Seems like this won't work under FreeBSD, comes up with various errors because of different awk versions and such.

[Enhancement] Add option to hide on lost focus

Would you consider adding a 'hide on lost focus' option, like the way the Guake/Tilda terminals unmap themselves when they lose focus?

Looks like it might be possible with something like xdotool behave $wid blur exec xdotool windowunmap $wid

x/y percentage not working (goal: centering dropdown window)

Manual says:
-x, --x-offset
Specify the x position for a created window as a number or per‐
centage. (default: 0)

But setting this to a percentage don't seem to work at all. It's parsed as an absolute number anyway. My goal would be to centre the dropdown window on the monitor. An option for that would be swell : )

Argument parsing accepts wrong usage in special cases

I noticed a little bug that I made a little bit worse with my last patch to be honest.

When a user calls tdrop in a wrong way it's behavor can be unpredictable. Example: tdrop --width termite ( -> long option that requires an argument and no argument is given)

In this case the problem with the current code is that $OPTARG == $OPTION. So the default value for width will be overridden by the value "width". It would be better to have an error message.

To don't override the default value for width with this non-sense string, the patch below can be applied.

But there is still a problem when the default value for width is not the empty string, but e.g. a number.

I don't know... we can also keep the code as is and so the user just has to use the program in the correct way.


diff --git a/tdrop b/tdrop
index 4827d68..44964ed 100755
--- a/tdrop
+++ b/tdrop
@@ -91,8 +91,16 @@ do
    a) auto_detect_wm=true;;
    m) monitor_aware=true;;
    -)
-       OPTION=${OPTARG%%=*}
-       OPTARG=${OPTARG#*=}
+       if [[ $OPTARG == *=* ]]; then
+           # long-option with argument
+           OPTION=${OPTARG%%=*}
+           OPTARG=${OPTARG#*=}
+       else
+           # long-option without argument
+           # set OPTARG to "", though it's still invalid for numbers
+           OPTION=$OPTARG
+           OPTARG=""
+       fi
        case $OPTION in
        height) height=$OPTARG;;
        width) width=$OPTARG;;

Window manager name not detected correctly for -a after use of wmname

Reported in #39.

-a is working correctly for me with bspwm-git (EDIT: and with the release version 0.9.3) and kitty. Since you say that floating command works for you, I'm wondering if the window manager is not being detected properly. Does it work if you add --wm bspwm to the command? What is the output if you run the following command?

xprop -notype -id "$(xprop -root -notype | \
	awk '$1=="_NET_SUPPORTING_WM_CHECK:"{print $5}')" \
	-f _NET_WM_NAME 8u | awk -F "\"" '/WM_NAME/ {print $2}' | head -n 1

X Error of failed request: BadWindow (invalid Window parameter)

I want to use hot key to invoke emacs, so I set short key for emacs: trop emacs, but then emacs start in gui window with console mode.

emacs only start console mode in terminal when emacs -nw

➜ tdrop emacs                

(emacs:3390940): Gtk-WARNING **: 19:08:36.408: Theme parsing error: gtk.css:123:146: Expected a valid selector

(emacs:3390940): Gtk-WARNING **: 19:08:36.415: Theme parsing error: gtk.css:9319:2: '/*' in comment block

(emacs:3390940): Gtk-WARNING **: 19:08:36.415: Theme parsing error: gtk.css:9320:20: Expected semicolon

(emacs:3390940): Gtk-WARNING **: 19:08:36.418: Theme parsing error: gtk.css:13298:18: Invalid name of pseudo-class
X Error of failed request:  BadWindow (invalid Window parameter)
  Major opcode of failed request:  15 (X_QueryTree)
  Resource id in failed request:  0xb92d1e
  Serial number of failed request:  1356
  Current serial number in output stream:  1356

emacs should start as :
image

but tdrop emacs cause this:
image

image

Using absolute path in command

Seems like tdrop only accepts a command that doesn't contain / and uses command name for some purposes.

Is it possible to avoid using command for some identification purposes and specify some X property instead?

Allow '--option value' Syntax for Long Options

Using the '-)' hack with getopts is limited in that it requires the --option=value syntax. Maybe there is a way to access the next argument and then shift over, but that would be even uglier and would still require manually differentiating arguments that take values from those that don't (instead of using getopts' ":"). It may be better to do something like what is done in the article mentioned in #8.

Improper sizing on initial call of tdrop (bspwm, alacritty, tmux, tmuxinator)

Running arch with bspwm/sxhkd/compton with alacritty as a terminal and tmux with tmuxinator.

Keybinding from sxhkdrc looks like:

super + p
    tdrop -a -y 32 -s bspwm alacritty

Upon a recent update (suspect alacritty, had another sizing problem with it contemporaneous with this problem), tdrop will not properly size the window: instead of full width / half height, I get a square-ish window (full height x full height).

Yoffset seems to work and after toggling tdrop the sizing becomes correct.

Disconnecting from the tmux session in tdrop, and then calling tdrop again produces the same sizing problem.

Adding -m doesn't solve the problem, although it does make the sizing consistently wrong, toggling doesn't fix it.

Automatic hiding/showing without configuration

Currently automatic-hiding/showing requires manual configuration everywhere (e.g. in the rifle.conf). Generic automatic hiding would require xdotool's blur to work correctly (see #18). Automatic showing would require some sane way to determine the window that gets focus when the dropdown is unfocused and to be notified when that window is closed. I'm guessing this functionality won't be added to xdotool and may be difficult or impossible to implement in a generic way, but it may be worth looking into.

If blur is ever fixed, add a disclaimer that it can be used for automatic-hiding instead of tdrop's mechanism to the readme.

Create new release

HI. I'd like to package tdrop for Void Linux

To do that I need new release/tagged commit since last release was in 2015 (in general Void does not allow commit=version packages)

I'd be grateful for marking stable commit as release.

Hotkey is not always showing terminal on top of other windows

I'm using tdrop with termite, I have an hotkey that fire this command: tdrop -ma -w -4 -s dropdown termite, my system is Manjaro 17.
Tdrop is working most of the time, but sometimes my terminal appears behind other windows.
So if I have a fullscreen window I just can't see the terminal.
Then if I launch the terminal again it eventually reappears on top of other windows.

Add support for alacritty

Serial number of failed request: 1084 Current serial number in output stream: 1084 X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 15 (X_QueryTree) Resource id in failed request: 0x5200001 Serial number of failed request: 1084 Current serial number in output stream: 1084 X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 15 (X_QueryTree) Resource id in failed request: 0x5200001 Serial number of failed request: 1084 Current serial number in output stream: 1084 X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 15 (X_QueryTree) Resource id in failed request: 0x5200001 Serial number of failed request: 1084 Current serial number in output stream: 1084 X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 15 (X_QueryTree) Resource id in failed request: 0x5200001 Serial number of failed request: 1084 Current serial number in output stream: 1084 X Error of failed request: BadWindow (invalid Window parameter) Major opcode of failed request: 15 (X_QueryTree) Resource id in failed request: 0x5200001 Serial number of failed request: 1084 Current serial number in output stream: 1084

Terminal is alacritty and using the sxhdrc config from the project description.
A window flashes and disappears before it can load

gnome-terminal not getting resized

Hi,

I discovered that launching gnome-terminal with tdrop does not work properly. The window does not get resized.

The loop of line 515 is infinite since wids=$(xdotool search --pid "$pid") does not find anything.

EDIT: Fixed line number

Problems with multiple monitors and -m

I'm trying to use -m on i3 like so:

tdrop -m -a -w 1000 -h 800 -x 0 -y -840 -n ranger -f "-name floating -e ranger" urxvt

When I run this from a window on my laptop, it works. Ranger pops up bottom left. When I run this from a window on my external monitor (positioned to the right of my laptop), I get the following error:

/usr/bin/tdrop: line 237: 1080
1080: syntax error in expression (error token is "1080")

My xrandr output (with irrelevant parts omitted):

Screen 0: minimum 8 x 8, current 3840 x 1080, maximum 32767 x 32767
eDP1 connected primary 1920x1080+0+0 (normal left inverted right x axis y axis) 310mm x 170mm
   1920x1080     60.05*+  59.93  
... 
DP1 connected 1920x1080+1920+0 (normal left inverted right x axis y axis) 530mm x 300mm
   1920x1080     60.00*+
...
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

Add Sleep Time Options... and Hopefully Remove Them

I've noticed that for just a couple window managers (e.g. fluxbox and mutter), the default low sleep time to wait for a terminal to be created before getting it's wid is not long enough. A temporary solution is to increase the sleep time for these known window managers and provide an option for users to alter the sleep times if necessary.

I don't really like the idea of having to depend on sleeping at all (even though it works reliably in most cases). Using something like xtoolwait, which starts a program and returns its window id (if dlitz/xtoolwait#1 is ever merged) would be preferable.

Question: future and Wayland

Hello,

tdrop is a great application, but as it depends on xprop, xwininfo and xdotool, I was wondering what will happen on Wayland as those are X11 related only?

Would there be a more generic way to do the same thing?

The command raises regular expression error for awk

tdrop command raises the following error when I executed.

awk: line 0: regular expression compile failed (missing operand)
x|+
awk: line 1: syntax error at or near )

I tried to fix syntax as following.

- #total_height=$(echo "$total_geo" | awk -F 'x|+' '{print $2}')
+ #total_height=$(echo "$total_geo" | awk -F '[x|+]' '{print $2}')

My env is

  • dist: Ubuntu 18.04
  • wm: GNOME shell
  • shell: fish

Cinnamon, window position

Hi, very good job. I hope to not get wrong.
I'm using arch/cinnamon.
When mapping then unmapping, the window go always at the center of the screen (except first time, when the window is created).

I use these commands:
tdrop urxvt and tdrop current
I have also tried tdrop -a
Can the Muffin window manager be added to the supported window managers?

Passing arguments to programs

In order to eliminate flickering on an i3wm setup as well as having the tdrop window 'follow' the user across workspaces one would need to be able to label the terminal with a class or title.

For example, for urxvt I'd like to pass a specific title to it (using -title "tdrop") to be able to specify particular rules to it.

I think I'm missing something because the following fails on me:
tdrop -a -h 33% -y 18 -m -s desktop -n dropdown 'urxvt -title "this"'

Am I missing something obvious or is this not possible in the current state?

[Feature Request] Tmuxifier support

Hi, support for tmuxifier would be great!

I am now using

tdrop -a -f "-e tmuxifier load-session Drop-Down" alacritty

as alternative.

But the dropdown window would shrink to 80x24 the first time executing it.

Can't set y-offset to be above the screen

I would like to set tdrop to spawn a terminal with a y-offset of -800 or so (my screen is 768 pixels high) so that the titlebar is hidden. Is this possible?
Currently, if I specify a negative y-offset greater than the height of my screen it just goes to the very top instead of beyond that.
GNOME is a pain about starting applications without decorations, so this would be a lot simpler.

Move visible drop to other workspace

I'm on mate/marco. When a tdrop:ed window is mapped on another workspace and I call tdrop while on another workspace, I would ideally have the window remapped to this current workspace. This does not happen. Neither does calling tdrop two times achieve this behaviour. Is this intended? The comment in the readme regarding awesome wm makes me think that this functionality should perhaps already be present...

Feature request: Hide dropdown window on first startup

Is it easy to implement a feature that will start dropdown window in background so we can add it to autostart with some window manager?

For example:
In ~/.config/openbox/autostart

tdrop -ma -w -4 -y "$PANEL_HEIGHT" -hide termite

Or in i3 config file:

exec --no-startup-id tdrop -ma -w -4 -y "$PANEL_HEIGHT" -hide termite

Can I show/hide multiple windows with the same bind?

When I use a program like qjackctl I'll often need both the main window and one
two more windows. The workflow of this program lends itself well to have it
floating, showing it when needed and hiding it when not.

I made this bind

super + q
    tdrop -ma -n qjackctl -w 440 -h 100 qjackctl

but this only applies to the main window and not whichever other qjack window I
might open afterwards.

Is there a way to make tdrop "grab" this new window and hide/show it
simoultaneously with the main window?

If not I think I can make something work with bspwm itself.

unable to turn a chromium-browser window into a dropdown

hiya

i'm running bspwm 0.9.1-82. tdrop -a chromium-browser successfully creates a new floating chromium-browser window, but it cannot resize the window or move it to a center location afterwards.

that's because in function create_win_return_wid, it enters a never-ending loop using xdotool to look for the window id given the PID

++++ xdotool search --pid 10445
+++ wids=
+++ [[ -n '' ]]
+++ false
+++ sleep 0.01
+++ :

i don't think this approach (for finding the window id) works for chromium-browser, and i don't know what else can.

have you been able to create a dropdown with a chromium instance?

cheers,
b.

Sway compatibility?

I was wondering if there are any plans or a way to implement tdrop for sway. I already noted that generic wayland support is not in the works right now (from #13) but I was wondering if sway might be supported since it already has a scatchpad mechanism (but no way to bind them to keys like tdrop can with shxkd).

Infact, perhaps I am misunderstanding wlroots but it seems like an abstraction to enable tdrop's feature-set...

Trouble with -f flags

Bug Report

As per the manual, I have the following in my sxhdrc:

F1
 tdrop -p "bspc rule -a kitty -o state=floating" -ma -w 70% -h 70% -x 15% -y 15% -n 1 -s mainWindow kitty '-f "--config $USER/.config/kitty/kittyMain.conf"'

However this is not respected by the program (kitty).

I can confirm that it runs as expected from the terminal (without -f of course).

Is there something I'm missing?
Any further information I could provide?

Basic info

# Version
aur/tdrop-git 0.1.r23.g682ec14-1 [installed: 0.1.r142.g8808dff-1]

Multiple scratchpads doesn't work

I'm trying to use two scratchpadstdrop -a -w 1880 -y 14 -x 20 -f '--name=term-scratchpad' termite and tdrop -a -w 1880 -y 14 -x 20 -f '--name=ranger-scratchpad -e ranger' termite.
Both commands will show only the first created scratchpad.

Unity support

Could you please add Unity settings to tdrop? I'm trying tdrop with Terminix under Unity and the terminal window moves each time it's shown.

Add Qutebrowser support

Hi, when I use tdrop with qutebrowser instead of hiding the window it opens a new instance, I solved this by adding the qutebrowser class. Can you fix this?
Thanks!

Reduce Flicker on Some Window Managers

Combining windowmove and windowmap into one command seems to eliminate flicker for window managers that do not maintain window position when remapping. This should be a relatively easy fix.

zsh icons don't appear on termite when used with tdrop

I have been trying to set up tdrop for a couple of days now and am using termite as a terminal dropdown. I am also using Powerlevel 9k for zsh on the terminal. While using termite normally, there are no issues with the icons but when I open termite using tdrop, the icons seem to fail to load.

This is a screenshot of termite opened normally:
Screenshot from 2019-04-09 17-52-11

This is a screenshot of tdrop:

Screenshot from 2019-04-09 17-53-09

Can you suggest why this is happening?

Monitor Awareness not working

Hi,

me again. This time I'd like to report a quirk I encountered when using the -m switch.
It seems like the output of xrandr does not get parsed correctly. This is a hard thing to do right, I know I tried.

Output when running bash -x tdrop -m -w '100%' -h '30%' -a gnome-terminal:

++ echo '
xwininfo: Window id: 0xe00006 "tmux:4 zsh"

  Absolute upper-left X:  3840
  Absolute upper-left Y:  28
  Relative upper-left X:  1
  Relative upper-left Y:  29
  Width: 1920
  Height: 1172
  Depth: 24
  Visual: 0xb6
  Visual Class: TrueColor
  Border width: 0
  Class: InputOutput
  Colormap: 0xe00005 (not installed)
  Bit Gravity State: NorthWestGravity
  Window Gravity State: NorthWestGravity
  Backing Store State: NotUseful
  Save Under State: no
  Map State: IsViewable
  Override Redirect State: no
  Corners:  +3840+28  -0+28  -0-34  +3840-34
  -geometry 213x63--1+-1'
+ window_y=28
++ xrandr --query
++ awk '/ connected/ {gsub("primary ",""); print}'
+ monitors_info='eDP1 connected (normal left inverted right x axis y axis)
DP1-1 connected 1920x1200+1920+0 (normal left inverted right x axis y axis) 520mm x 320mm
DP1-2 connected 1920x1200+3840+0 (normal left inverted right x axis y axis) 520mm x 320mm
DP1-3 connected 1920x1200+0+34 (normal left inverted right x axis y axis) 520mm x 320mm'
+ read -r monitor
++ echo 'eDP1 connected (normal left inverted right x axis y axis)'
++ awk '{print $3}'
+ monitor_geo='(normal'
++ awk -F + '{print $2}'
++ echo '(normal'
+ x_begin=
++ echo '(normal'
++ awk -F + '{print $3}'
+ y_begin=
++ echo '(normal'
++ awk -F x '{print $1}'
+ x_width='(normal'
++ awk -F 'x|+' '{print $2}'
++ echo '(normal'
+ y_height=
/usr/bin/tdrop: line 251: (normal: missing `)' (error token is "normal")

xrandr output:

Screen 0: minimum 8 x 8, current 5760 x 1234, maximum 32767 x 32767
eDP1 connected (normal left inverted right x axis y axis)
   3200x1800     59.98 +  48.00    40.00  
   2560x1440     60.00  
   2048x1536     60.00  
   1920x1440     60.00  
   1856x1392     60.01  
   1792x1344     60.01  
   2048x1152     60.00  
   1920x1080     60.00  
   1600x1200     60.00  
   1400x1050     59.98  
   1600x900      60.00  
   1280x1024     60.02  
   1280x960      60.00  
   1368x768      60.00  
   1280x720      60.00  
   1024x768      60.00  
   1024x576      60.00  
   960x540       60.00  
   800x600       60.32    56.25  
   864x486       60.00  
   640x480       59.94  
   720x405       60.00  
   640x360       60.00  
DP1 disconnected (normal left inverted right x axis y axis)
DP1-1 connected primary 1920x1200+1920+0 (normal left inverted right x axis y axis) 520mm x 320mm
   1920x1200     59.95*+
   1920x1080     60.00  
   1600x1200     60.00  
   1680x1050     59.88  
   1280x1024     60.02  
   1440x900      59.90  
   1280x960      60.00  
   1024x768      60.00  
   800x600       60.32  
   640x480       59.94  
DP1-2 connected 1920x1200+3840+0 (normal left inverted right x axis y axis) 520mm x 320mm
   1920x1200     59.95*+
   1920x1080     60.00  
   1600x1200     60.00  
   1680x1050     59.88  
   1280x1024     60.02  
   1440x900      59.90  
   1280x960      60.00  
   1024x768      60.00  
   800x600       60.32  
   640x480       59.94  
DP1-3 connected 1920x1200+0+34 (normal left inverted right x axis y axis) 520mm x 320mm
   1920x1200     59.88*+
   1920x1080     60.00  
   1600x1200     60.00  
   1680x1050     59.95  
   1280x1024     60.02  
   1440x900      59.89  
   1280x960      60.00  
   1024x768      60.00  
   800x600       60.32  
   640x480       59.94  
HDMI1 disconnected (normal left inverted right x axis y axis)
HDMI2 disconnected (normal left inverted right x axis y axis)
VIRTUAL1 disconnected (normal left inverted right x axis y axis)

Add support for st / xst?

Hi, is it possible to add support for st (simple terminal) from suckless.org?
Should be pretty simple, according to the manpage (-g argument, X11 Geometry style)

Thanks!

Konsole throws out error

When I bind Konsole and open it using the bound shortcut, it throws out this error and can't be used:

Konsole is unable to open a PTY (pseudo teletype). It is likely that this is due to an incorrect configuration of the PTY devices. Konsole needs to have read/write access to the PTY devices.

How do I fix that? Opening Konsole directly (i.e. without tdrop) works fine.

doesnt work under i3

the specified terminal wont even open with tdrop, im kind of confused.

this is the output when i press the key.
/usr/bin/tdrop: line 207: type: map_pre: not found
/usr/bin/tdrop: line 220: type: map_post_oneshot: not found
[{"success":true}]
/usr/bin/tdrop: line 238: /tmp/tdrop/auto_hidden/wid: No such file or directory

Dual monitor layout

First of all, thank you for this tool. It's been the best dropdown-terminal replacement I've come across.

I have the following xrandrd layout:
a

Using i3wm, when I invoke:
tdrop -a -y 33% -y 18 -s desktop -n dropdown urxvt

I get a terminal that spanning across two screens, similiar to the red rectangle drawn below:
a

Artifacting on Xorg

I am using Xorg with i3 as a window manager. When I execute tdrop it momentarily shift the background image (implemented with feh) and quick artifacting of current windows in new places on the screen (and sometimes even windows from other work spaces appears on screen). Then everything goes back to normal. I would use scratchpad but i really like tdrop for lanching ranger and the like.

I tried to use scrot to take a screen shot of the artifacting with a scrip that calls tdrop but this is the best i got (first is what it looks like after terminal is called):
save
save2

xoffset=5
#xinterval=8
yoffset=30
width=1910
height=450
terminal=urxvt

#added to keep background from shifting
$HOME/.fehbg &&
tdrop -ma -x $xoffset -y $yoffset -w 1910 -h $height $terminal
scrot ~/save.png

Inconsistent support on BSPWM

I'm using tdrop with bspwm; about 50% of the time, the binding opens a terminal in the default floating state (middle of the screen and a small window) rather than the drop-down behavior I'd like.

Here's the binding I'm using:
alt + v
tdrop -a -w 100% -h 50% urxvt

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.