Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add various options #433

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 34 additions & 2 deletions tdrop
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ options:
-A always show/activate the window if it is not focused
-r save geometry when hiding, restore geometry when showing
-N same as -x '' -y '' -w '' -h '' (do not use with those options)
-q same as --sticky --no-titlebar --skip-taskbar --above
--wm set the window manager name to mimic another window manager
(for use with -a)
--class name manually specify the class of the window (can be obtained with xprop)
Expand All @@ -76,6 +77,10 @@ options:
--timeout set the timeout (in seconds) that tdrop will wait for a window
to appear before giving up in case the program fails to start
(default: 10)
--sticky always show window on the visible workspace
--no-titlebar remove titlebar from window
--skip-taskbar do not show window on the window manager's taskbar
--above set window to be always on top
--debug print debugging information to /tmp/tdrop_<user>/log
--help print help

Expand Down Expand Up @@ -145,7 +150,11 @@ class=
name=
timeout=10
remember_geometry=false
while getopts :h:w:x:y:s:n:c:C:l:L:p:P:u:U:d:S:i:f:-:aAmNtr opt
sticky=false
above=false
no_titlebar=false
skip_taskbar=false
while getopts :h:w:x:y:s:n:c:C:l:L:p:P:u:U:d:S:i:f:-:aAmNtrq opt
do
case $opt in
h) height=$OPTARG;;
Expand Down Expand Up @@ -175,8 +184,12 @@ do
yoff=
width=
height=;;
q) sticky=true
above=true
no_titlebar=true
skip_taskbar=true;;
-)
if [[ $OPTARG =~ ^(auto-detect-wm|monitor-aware|pointer-monitor-detection|clear|no-cancel|debug|remember|no-manage|help)$ ]] || \
if [[ $OPTARG =~ ^(auto-detect-wm|monitor-aware|pointer-monitor-detection|clear|no-cancel|debug|remember|no-manage|sticky|above|no-titlebar|skip-taskbar|help)$ ]] || \
[[ $OPTARG == *=* ]]; then
OPTION=${OPTARG%%=*}
OPTARG=${OPTARG#*=}
Expand Down Expand Up @@ -223,6 +236,10 @@ do
yoff=
width=
height=;;
no-titlebar) no_titlebar=true;;
sticky) sticky=true;;
above) above=true;;
skip-taskbar) skip_taskbar=true;;
help) print_help; exit;;
*) error "Unknown option --$OPTION." \
"Use --help to see available flags.";;
Expand Down Expand Up @@ -438,6 +455,18 @@ update_geometry_settings_for_monitor() {
}

map_and_reset_geometry() {
if $no_titlebar; then
xprop -id "$wid" -format _MOTIF_WM_HINTS 32c -set _MOTIF_WM_HINTS "2, 0, 2, 0, 0"
fi
if $skip_taskbar; then
wmctrl -i -r "$wid" -b add,skip_taskbar
fi
if $above; then
wmctrl -i -r "$wid" -b add,above
fi
if $sticky; then
wmctrl -i -r "$wid" -b add,sticky
fi
if [[ -n $width ]] && [[ -n $height ]] && [[ -n $xoff ]] \
&& [[ -n $yoff ]]; then
xdotool windowmap --sync "$wid" windowmove "$wid" "$xoff" "$yoff" \
Expand Down Expand Up @@ -942,6 +971,9 @@ program_start() {
# note: regular console works with or without quotes, but trinity's
# konsole only works without quotes
if [[ $program =~ ^(urxvt|alacritty|xiatec|st|lxterminal|qterminal|cool-retro-term|lilyterm|konsole$) ]]; then
if [[ $no_titlebar && $program == "alacritty" ]]; then
program_command+=(-o window.decorations=none)
fi
program_command+=(-e bash -c "$tmux_command")
elif [[ $program == kitty ]]; then
program_command+=(bash -c "$tmux_command")
Expand Down
19 changes: 19 additions & 0 deletions tdrop.1
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ Use mouse pointer location for detecting which monitor is the current one so ter
\fB-A\fR, \fB --activate\fR
Always activate/show the dropdown if it is not currently focused. Only hide the dropdown if it is currently focused.
.TP
\fB-q\fR
Same as \fB--sticky\fR \fB--no-titlebar\fR \fB--skip-taskbar\fR \fB--above\fR.
.TP
\fB--monitor=NAME\fR
Specify the monitor to base geometry calculations on when using -m / --monitor-aware instead of detecting the monitor by the actively focused window or mouse pointer.
.TP
Expand All @@ -127,6 +130,22 @@ Specifies that manually re-showing an auto-hidden window with tdrop should not c
\fB --timeout\fR
Specifies the timeout in to wait for a window to appear when starting a program before giving up. This prevents a tdrop process from sticking around forever if a program fails to start. (default: 10)
.TP
.B
\fB--sticky\fR
Always show window on the visible workspace.
.TP
.B
\fB--no-titlebar\fR
Remove titlebar from window.
.TP
.B
\fB--skip-taskbar\fR
Do not show window on the window manager's taskbar.
.TP
.B
\fB--above\fR
Set window to be always on top.
.TP
\fB --debug\fR
Print information for debugging to stdout and to /tmp/tdrop_<user>/log. Takes no argument. (default: false)
.TP
Expand Down