Reduce flicker and improve Muffin (Cinnamon) support

Fixes #2 and fixes #4
long-opts
angelic-sedition 9 years ago
parent b1e6977914
commit a777ea85e1

@ -32,7 +32,8 @@ alt + s
### Basic Flags ### Basic Flags
### Flicker ### Flicker
For window managers that will require a window to be repositioned after re-mapping it, some flicker may be noticeable. 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 floated or one-time rules to only float the next instance of a class. Since bspwm has oneshot rules and won't alter the size/position of a window, there isn't any flicker for it, and you don't you can still use tiled windows of the same class as your dropdown. For some window managers that require a window to be repositioned after re-mapping it, some flicker may be noticeable. With a recent change, this flicker is pretty much gone for some window managers (e.g. in the Gnome Shell and Cinnamon DEs) and slightly better than before in other
s. 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 floated or one-time rules to only float the next instance of a class. For example, since bspwm has oneshot rules and won't alter the size/position of a window, this flicker is not a problem.
However, the consistent way to eliminate visual flickering due to moving/resizing for any window manager is to enable fade-in for the compositor. For compton this can be done by setting `fading = true;` and adjusting the `fade-delta` in the .compton.conf accordingly. However, the consistent way to eliminate visual flickering due to moving/resizing for any window manager is to enable fade-in for the compositor. For compton this can be done by setting `fading = true;` and adjusting the `fade-delta` in the .compton.conf accordingly.
@ -77,6 +78,7 @@ For floating window managers, tdrop should also generally "just work", but you w
That said, these are the floating window managers that currently have '-a' settings: That said, these are the floating window managers that currently have '-a' settings:
- mutter (gnome shell) - mutter (gnome shell)
- muffin (cinnamon)
- xfwm4 - xfwm4
- metacity - metacity
- openbox - openbox

61
tdrop

@ -117,6 +117,10 @@ done
# necessary to account for differences in geometry/positioning output from xwininfo # necessary to account for differences in geometry/positioning output from xwininfo
# for different WMs (matters when a window is in a corner or on the side) # for different WMs (matters when a window is in a corner or on the side)
subtract_when_same=true subtract_when_same=true
# will be set to true to eliminate or reduce flicker for WMs that alter window
# position when remapping; when true, windowmap and windowmove are combined, so that
# the window is correctly positioned earlier
combine_map_post=false
# #
# WM Detection and Settings # WM Detection and Settings
@ -171,7 +175,7 @@ wm_autoset_for_all() {
} }
# floating WMs that need extra sleep time to wait for dropdown to spawn initially # floating WMs that need extra sleep time to wait for dropdown to spawn initially
elif [[ $wm =~ ^(Fluxbox|Mutter|GNOME Shell)$ ]]; then elif [[ $wm =~ ^(Fluxbox|Mutter|GNOME Shell|Mutter \(Muffin\))$ ]]; then
if ! $sleep_term_user_set; then if ! $sleep_term_user_set; then
sleep_term_time=0.05 sleep_term_time=0.05
fi fi
@ -201,13 +205,21 @@ wm_autoset_for_hide_show() {
elif [[ $wm =~ ^(Mutter|GNOME Shell)$ ]]; then elif [[ $wm =~ ^(Mutter|GNOME Shell)$ ]]; then
dec_fix_auto="-10x-8" dec_fix_auto="-10x-8"
subtract_when_same=false subtract_when_same=false
elif [[ $wm =~ ^(Mutter \(Muffin\))$ ]]; then
dec_fix_auto="-9x-8"
# NOTE: # NOTE:
# pekwm, xfwm4, sawfish, openbox need subtract_when_same to be true (default) # pekwm, xfwm4, sawfish, openbox need subtract_when_same to be true (default)
# for fluxbox, blackbox, fvwm, and metacity, the value does not matter # for fluxbox, blackbox, fvwm, and metacity, the value does not matter
elif [[ $wm == GoomwW ]]; then elif [[ $wm == GoomwW ]]; then
subtract_when_same=false subtract_when_same=false
fi
if [[ $wm =~ ^(pekwm|Fluxbox|Blackbox|xfwm4|Metacity|FVWM|Sawfish|GoomwW|Mutter|GNOME Shell|Mutter \(Muffin\))$ ]]; then
combine_map_post=true
map_post() {
xdotool windowmap "$1" windowmove "$1" "$2" "$3"
}
fi fi
} }
@ -223,14 +235,14 @@ wm_autoset_for_dropdown() {
herbstclient fullscreen off herbstclient fullscreen off
} }
# stacking/floating wms: settings for maintaining geometry after mapping
# floating window managers that may both move and resize a window after unmapping then mapping it # floating window managers that may both move and resize a window after unmapping then mapping it
elif [[ $wm == Openbox ]]; then elif [[ $wm == Openbox ]]; then
# openbox will resize window to be slightly less than the width of the screen when mapping # openbox will resize window to be slightly less than the width of the screen when mapping
# this is necessary when want width to be 100% # this is necessary when want width to be 100%
combine_map_post=true
map_post() { map_post() {
xdotool windowmove "$1" "$xoff" "$yoff" windowsize "$1" "$width" "$height" xdotool windowmap "$1" windowmove "$1" "$xoff" "$yoff" \
windowsize "$1" "$width" "$height"
} }
# floating window managers that may move a window after unmapping then mapping it # floating window managers that may move a window after unmapping then mapping it
elif [[ $wm =~ ^(pekwm|Fluxbox|Blackbox|xfwm4|Metacity|FVWM|Sawfish|GoomwW|Mutter|GNOME Shell|Mutter \(Muffin\))$ ]]; then elif [[ $wm =~ ^(pekwm|Fluxbox|Blackbox|xfwm4|Metacity|FVWM|Sawfish|GoomwW|Mutter|GNOME Shell|Mutter \(Muffin\))$ ]]; then
@ -238,8 +250,9 @@ wm_autoset_for_dropdown() {
# mutter/gnome shell will move to top centerish (just below panel on gnome shell) # mutter/gnome shell will move to top centerish (just below panel on gnome shell)
# xfwm4 will normally move to top left; metacity will move close to top left # xfwm4 will normally move to top left; metacity will move close to top left
# sawfish just moves all over the place # sawfish just moves all over the place
combine_map_post=true
map_post() { map_post() {
xdotool windowmove "$1" "$xoff" "$yoff" xdotool windowmap "$1" windowmove "$1" "$xoff" "$yoff"
} }
fi fi
} }
@ -279,7 +292,7 @@ map_post_command() {
elif [[ -n $map_post ]]; then elif [[ -n $map_post ]]; then
eval "$map_post" eval "$map_post"
elif [[ -n $(type map_post 2> /dev/null) ]]; then elif [[ -n $(type map_post 2> /dev/null) ]]; then
map_post "$1" map_post "$@"
fi fi
} }
@ -373,8 +386,13 @@ wid_toggle() {
else else
map_pre_command "$term" map_pre_command "$term"
fi fi
xdotool windowmap "$wid" if ! $combine_map_post; then
map_post_command "$wid" xdotool windowmap "$wid"
map_post_command "$wid"
else
# combine mapping with resizing/moving when possible to reduce flicker
map_post_command "$wid"
fi
maybe_cancel_auto_show "$wid" maybe_cancel_auto_show "$wid"
else else
xdotool windowunmap "$wid" xdotool windowunmap "$wid"
@ -437,7 +455,7 @@ get_geometry() {
fi fi
} }
set_geometry() { give_geometry() {
eval "$(< /tmp/tdrop/auto_hidden/geometry)" eval "$(< /tmp/tdrop/auto_hidden/geometry)"
if [[ -n $dec_fix ]]; then if [[ -n $dec_fix ]]; then
x_fix=$(echo "$dec_fix" | awk -F "x" '{print $1}') x_fix=$(echo "$dec_fix" | awk -F "x" '{print $1}')
@ -450,7 +468,11 @@ set_geometry() {
X=$((X-x_fix)) X=$((X-x_fix))
Y=$((Y-y_fix)) Y=$((Y-y_fix))
fi fi
xdotool windowmove "$1" "$X" "$Y" echo "$X $Y"
}
set_geometry() {
xdotool windowmove "$1" "$(give_geometry)"
} }
toggle_auto_hide() { toggle_auto_hide() {
@ -488,10 +510,21 @@ auto_show() {
if [[ $was_floating != false ]]; then if [[ $was_floating != false ]]; then
map_pre_command "$class" map_pre_command "$class"
fi fi
xdotool windowmap "$wid" if ! $combine_map_post; then
xdotool windowmap "$wid"
fi
if [[ $was_floating != false ]]; then if [[ $was_floating != false ]]; then
map_post_command "$wid" if $combine_map_post; then
set_geometry "$wid" XY=$(give_geometry "$wid")
X=$(echo "$XY" | awk '{print $1}')
Y=$(echo "$XY" | awk '{print $2}')
map_post_command "$wid" "$X" "$Y"
else
map_post_command "$wid"
set_geometry "$wid"
fi
else
xdotool windowmap "$wid"
fi fi
fi fi
} }

Loading…
Cancel
Save