From 7037fd5ff4060ae34ee3de5a72b1330f5ec61dc5 Mon Sep 17 00:00:00 2001 From: angelic-sedition Date: Sat, 9 May 2015 16:30:56 -0400 Subject: [PATCH] Add initial awesome support --- README.md | 5 ++++- tdrop | 18 +++++++++++++++--- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index ed7697a..c539642 100644 --- a/README.md +++ b/README.md @@ -70,9 +70,12 @@ That said, these are the floating window managers that currently have '-a' setti Usually, it is a simple matter to add new ones to this list. 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'. I will add a lot more. +These window managers currently will work with '-a' for a floating (instead of tiled) dropdown. - bspwm - i3 +- awesome + +Awesome support may be buggy; if you encounter problems, please report them. Unmapping behaviour is different on awesome for some reason, so tdrop will act different when the dropdown is open on another workspace/tag (first call will unmap it and the second will map it on the current tag). ## Why Not Use wmctrl? Necessary features don't work on many window managers, including mine. diff --git a/tdrop b/tdrop index 50d5261..d92141b 100755 --- a/tdrop +++ b/tdrop @@ -45,7 +45,7 @@ See man page for more details. width="100%" height="45%" xoff=0 -yoff=1 +yoff=2 map_pre="" map_post="" unmap_post="" @@ -118,6 +118,16 @@ wm_autoset_for_both() { map_pre() { bspc rule -a "$1" -o floating=on } + elif [[ $wm == awesome ]]; then + # awesome remembers size, but need to float and then set size first + map_post_oneshot() { + # need sleep time to wait for window be created or will float wrong one.. not sure if way to float by window id + sleep 0.1 && echo 'local awful = require("awful") ; awful.client.floating.set(c, true)' | awesome-client && \ + xdotool windowmove "$1" "$xoff" "$yoff" windowsize "$1" "$width" "$height" + } + map_post() { + echo 'local awful = require("awful") ; awful.client.floating.set(c, true)' | awesome-client + } # tilers that won't remember sizing elif [[ $wm == i3 ]]; then @@ -207,6 +217,8 @@ map_pre_command() { map_post_command() { if [[ -n $oneshot_post ]] && [[ $1 == oneshot ]]; then eval "$oneshot_post" + elif [[ -n $(type map_post_oneshot) ]] && [[ $1 == oneshot ]]; then + map_post_oneshot "$2" elif [[ -n $map_post ]]; then eval "$map_post" elif [[ -n $(type map_post) ]]; then @@ -283,7 +295,7 @@ wid_toggle() { else exists=false fi - if $exists && [[ $visibility != IsUnviewable ]]; then + if $exists; then if [[ $visibility == IsUnMapped ]]; then if [[ $term == current ]]; then map_pre_command "$(< /tmp/tdrop/current"$num"_type)" @@ -306,7 +318,7 @@ wid_toggle() { else term_create fi - map_post_command oneshot + map_post_command oneshot "$wid" fi }