Commit Graph

135 Commits (b1ba3b612945ab2daba25bd5734ac8505e414e3f)

Author SHA1 Message Date
noctuid 40917af009 Send error messages to STDERR 9 years ago
noctuid f4f58b66e9 Escape tmux session name
This will, for example, allow session names to have whitespace (not that
that's a good idea, but if the session name is quoted like -s "a b",
then the expected behavior is to get a session named "a b" not for tdrop
to fail).
9 years ago
noctuid 702f047b6b Error in the case of multiple positional arguments 9 years ago
noctuid b472eda261 Use shift to simplify check for positional argument 9 years ago
noctuid 7442bf9b31 Deal with short options in positinal arg check 9 years ago
noctuid dadac198e2 Merge pull request #11 from schoettl/temp
Small enhancements
9 years ago
noctuid bf606ca510 Merge branch 'master' of https://github.com/noctuid/tdrop 9 years ago
noctuid 5a57a20aab Remove useless line 9 years ago
noctuid 3350752978 Add basic option validation
Exit with an error message if
- A long option that requires an arg is specified without =
- No positional argument is given (for the program name or auto commands)
- A negative width or height is given without -m
- Numeric options do not have a number value
9 years ago
Jakob Schöttl 651404c5e3 Minor changes 9 years ago
noctuid a7a317d2ca Don't output xwininfo's errors for nonexistent WIDs 9 years ago
Jakob Schöttl 1b189759b9 Fix in documentation 9 years ago
noctuid 783cfc627a Merge branch 'wait' 9 years ago
noctuid c7b8ab343f Add support for urxvtd and terminix
Programs with a shared pid for all windows need to be treated
differently.
9 years ago
noctuid e07d993262 Get rid of sleep options
Determine the WID of a created window by checking the WID(s) associated
with the PID until one is viewable. This allows tdrop to reliably
determine the WID of the programs it starts and prevents capturing the
wrong window.

- Combine wid_create and term_create into one (which removes the need
  for the -W option)
- Remove differing sleep settings for various window managers
- Get rid of a loop to check if the WID has been found
9 years ago
Jakob Schöttl 8cf2d6cc6a Avoid glob expansion on rhs and linter warning! 9 years ago
Jakob Schöttl 0c63e94588 Minor refactoring
Should have exactly the same effect now.

In case of no options: one white space after a shell command don't change
anything.
9 years ago
Jakob Schöttl 21e8aa2522 Fixed long-option argument parsing
Arguments of long-options (e.g. --program-flags='--foo=bar') may contain
equal sign characters (=). Before this fix, these kind of options were
split up into "program-flags" and "--foo" removing the last part of the
argument. This was because only the first two colums from `awk -F= ...`
were used.

Now these kind of options will be split up correctly using Bash parameter
expansion: "program-flags" and "--foo=bar".

See man bash > Parameter Expansion for details.

Tested with:
sudo cp tdrop /usr/bin/tdrop
tdrop -W --program-flags='-e tmux --role=tdropwindow'   termite
tdrop -W              -f '-e tmux --role=tdropwindow'   termite
tdrop --normal-window -f '-e tmux --role=tdropwindow'   termite

It also works for boolen long-option flags without argument. In this
case both OPTION and OPTARG are set to the long-option name. Boolean
options don't use the OPTARG so it doesn't matter.
9 years ago
noctuid 8505a7bd97 Rename $term to $program 9 years ago
noctuid ef9e436252 Add initial support for terminix 9 years ago
noctuid f5c81e6acd Don't keep WIDs for windows that have been closed
Fixes a bug where the wrong window id could be used after creating a new
dropdown in the map_post_command or for set_geometry_for_monitor
9 years ago
noctuid 93b5947029 Make -m work on empty desktops for all WMs
When there is no active window, open the dropdown and use it to
determine the current monitor. This can result in delay before the
dropdown is resized. Closes #3.
9 years ago
noctuid 6b099f93a4 Add documentation of -m option to README and rename long opt 9 years ago
noctuid a5bd168ce4 For -m, only get monitor info when creating and remapping
Previously, if the dropdown was unmapped from another monitor and then
remapped on that monitor, the dropdown would not be resized since the
unmapping would change the stored "last_monitor".
9 years ago
noctuid 0a222a6ce0 Update bspwm is_floating command for new syntax
Bspc's query --tree command now outputs json. Maintain compatability
with old syntax as well.
9 years ago
noctuid e547e6fcd6 Maintain compatability with old bspc rule syntax 9 years ago
noctuid c194780856 Update bspwm map_pre command for new bspc syntax 9 years ago
noctuid 777a7d41bb Use -n when "returning" from a function with echo 9 years ago
noctuid c23c30ef65 Split some longer lines 9 years ago
noctuid 5dfe993943 Differentiate local variables from global variables 9 years ago
noctuid 0d369bef73 Determine monitor in better way on bspwm and i3
Addresses #3

This ensures that -m will work even when the focused workspace on a
monitor is empty.
9 years ago
noctuid babc97500e Set wm var for automatic settings in single location
(wm_autoset_for_hide_show (but not wm_autoset_for_dropdown) was taking
advantage of the fact that wm had already been set in wm_autoset_for_all)
9 years ago
noctuid aefa230d63 Prevent monitor checking for auto_hide and auto_show (doesn't do
anything)
9 years ago
noctuid b21f9b8add Add -f option to specify options for the terminal or other program to
be created using

Addresses #6
9 years ago
noctuid 8eed440432 Add missing sleep flags to getopts 9 years ago
noctuid b7e786c440 Fix -m for WMs where xrandr will identify one monitor as "primary" 9 years ago
noctuid 14495af417 Update -m to also set xoff and yoff appropriately
This is apparently necessary for at least i3 when remapping a dropdown
and also for bspwm when first creating one (otherwise the dropdown will
be created at the absolute position xoff yoff even if it is not on the
current monitor).

Addresses #3
9 years ago
noctuid 6348276dbe Add multiple monitor support (automatic resizing and correct
width/height percentages)

Addresses #3
9 years ago
angelic-sedition b737354f22 Add support for Marco (MATE) 9 years ago
angelic-sedition 5cab6f4869 Add support for KWin (KDE) 9 years ago
angelic-sedition a777ea85e1 Reduce flicker and improve Muffin (Cinnamon) support
Fixes #2 and fixes #4
9 years ago
angelic-sedition b1e6977914 Add support for Mutter (Gnome Shell) 9 years ago
angelic-sedition 4cb2abd8bf Add options to set sleep time and fix fluxbox settings
Addresses #5
9 years ago
angelic-sedition 9c678fd203 Rename autoset functions for clarity 9 years ago
angelic-sedition c592541ad5 Fix auto_hide (and auto_show) bug that affected many WMs.
Further differentiate between how xwininfo behaves for different WMs.
This ensures that windows will be in the same position when
auto_showing.
9 years ago
angelic-sedition 867c3a97e2 Fix i3 auto_show bug
Previously would resize window when re-mapping; desired behaviour is to
keep previous size
9 years ago
angelic-sedition 271d991ce2 Add initial support for muffin (cinnamon)
Addresses #2
9 years ago
angelic-sedition aa0119bd2e Update documentation 10 years ago
angelic-sedition 1aa19c97fd Prevent irrelevant errors and info from appearing.
Addresses an issue mentioned in #1
10 years ago
angelic-sedition fc04c3c60a Improve i3 support; addresses issue mentioned in #1
- Use window id to float windows, so that the wrong window isn't ever
accidentally floated
- Sleep when first creating window to ensure it is mapped before
resizing/floating
10 years ago
angelic-sedition b584f00fd9 Fix bug where wasn't getting wid for newly created dropdowns
for potential use with a map_post_command. Also, don't use a
map_post_command when making the current window a dropdown and
instead unmap it.
10 years ago
angelic-sedition 07b526efed Accurately get correct window id for non-terminals
For some window managers, head -n 1 won't give the correct one
10 years ago
angelic-sedition 1b5a0c002e Fix case where xwininfo will detect wid even though it
it no longer exists (would prevent terminal from ever being created)
10 years ago
angelic-sedition 7037fd5ff4 Add initial awesome support 10 years ago
angelic-sedition b2edeab31f fix bspwm is_floating check to work with letters in wid
with case insensitive grep
10 years ago
angelic-sedition a1e0e8361e remove accidentally placed functions 10 years ago
angelic-sedition 76f91e5636 add support for more floating/stacking WMs:
xfwm4, metacity, fvwm, sawfish, and goomwwm
10 years ago
angelic-sedition 18eaffaa3a split/distinguish between automatic settings for auto show/hide, for a
window/term, and for both
10 years ago
angelic-sedition b0cbc61686 fix bspwm bug for auto hide/show (same as i3 one)
Before, using the -a option with bspwm would float any window after
auto-hiding then auto-showing it. This will prevent non-floating windows that are auto hidden from being
floated afterwards.
10 years ago
angelic-sedition 0a74e25f3a remove innacurate comment
had "exit" eval'd for one second before I changed how it was done
10 years ago
angelic-sedition 0544b563c7 add 'M' to getopts line (forgot to)
also, fire alarms are fun
10 years ago
angelic-sedition 975335ca0d add automatic settings for herbstluftwm to change the layout to
fullscreen for the dropdown
10 years ago
angelic-sedition 6f19422ab8 add a post-unmap command for specifying a command to be executed after
unmapping a dropdown
can be used, for example in a tiling wm, with -p or -P to toggle fullscreen on for just a
dropdown then off when unmapping the dropdown
10 years ago
angelic-sedition 1998ca514d rename post-map and pre-map commands for clarity 10 years ago
angelic-sedition 7c86196618 add support for gnome-terminal in combination with bspwm float pre
command
10 years ago
angelic-sedition 7b63ec6685 fix i3 auto-showing by detecting if window was tiled or floating before
hiding it
10 years ago
angelic-sedition e2d1e93d68 add initial support for i3 '-a'
currently working with dropdowns, but auto showing needs fixing
10 years ago
angelic-sedition f042bbf6de minor fixes, re-order, and add section headings 10 years ago
angelic-sedition c747573077 add back default y offset of 1
found that a y offset of 0 causes problems in more than just bspwm (e.g.
pekwm when auto-showing)
10 years ago
angelic-sedition 2a938d9adf add initial support for automatically detecting wm and setting options
accordingly
10 years ago
angelic-sedition 4759409950 add option to specify decoration size
used with auto_show to correct positioning; only have found necessary
with one window manager so far (blackbox)
10 years ago
angelic-sedition 7bddac6ae2 make get_class_name function take a wid as an arg 10 years ago
angelic-sedition 31c38dabbf fix typo 10 years ago
angelic-sedition fde1fffd6e change function order 10 years ago
angelic-sedition c684b55605 rename geometry setting function for consitency 10 years ago
angelic-sedition 7f287bfaae move geometry getting code into own function 10 years ago
angelic-sedition acd92160c3 make auto_show mantain previous window position
Originally tried parsing xwininfo's -geometry section output with awk, but signs (+/-) change depending on window position.
Instead, subtract relative from absolute if they are different.
On window managers with decorations/borders they will be different.
10 years ago
angelic-sedition fd8fca6913 add short name -P command for openbox 10 years ago
angelic-sedition 24efb86420 fix auto-show cancel 10 years ago
angelic-sedition e820a921e4 make wait time safer for -W
if too short will mess it up
10 years ago
angelic-sedition 87849d3f64 add --clear option 10 years ago
angelic-sedition b138d2c3b3 get rid of repetitive code for getting class name 10 years ago
angelic-sedition 355cd4eb00 add support for turning current win into dropdown 10 years ago
angelic-sedition 3c4de4f7c0 prevent need to click on initial term/win creation
if there is no saved window id, xwininfo -id will be run without an
argument and will wait for the user to click on a window; prevent this
from happening
10 years ago
angelic-sedition c2f94ff372 move hide_show script from dotfiles to own repo
initial script commit

- remove xdo dependency
- make tmux usage optional
- only toggle by wid (removed generic class toggle)
- generalize script to work with more than just terminals
- generalize script to not be tied to bspwm
- add -p and -P flags for window manager specific oneshot floating rules
or commands
- add a bspwm tested command for -p
- add work-around for urxvt's different -e option
- add long options
- make y-offset default to 1 so that windows aren't moved to center
- add -n flag to allow for multiple dropdowns of same terminal
- update help
10 years ago