From b34232d2992b4a269a0386e208b00c63fb80c27c Mon Sep 17 00:00:00 2001 From: noctuid Date: Thu, 14 Sep 2017 19:11:49 -0400 Subject: [PATCH] Add --name flag Closes #33. --- tdrop | 11 ++++++++++- tdrop.1 | 3 +++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/tdrop b/tdrop index 818ad61..f30c075 100755 --- a/tdrop +++ b/tdrop @@ -45,7 +45,8 @@ options: the monitor changes (default: false) --wm set the window manager name to mimic another window manager (for use with -a) - --class manually specify the class of the window (can be obtained with xprop) + --class name manually specify the class of the window (can be obtained with xprop) + --name name set a new name for the dropdown window --clear clear saved window id; useful after accidentally make a window a dropdown (e.g. '$ tdrop --clear current') --no-cancel don't cancel auto-showing (default is to prevent this when @@ -92,6 +93,7 @@ monitor_aware=false wm= user_set_wm=false class= +name= while getopts :h:w:x:y:s:n:c:C:l:L:p:P:u:U:d:f:-:am opt do case $opt in @@ -150,6 +152,7 @@ do wm) wm=$OPTARG user_set_wm=true;; class) class=$OPTARG;; + name) name=$OPTARG;; clear) clearwid=true;; no-cancel) cancel_auto_show=false;; help) print_help;; @@ -564,6 +567,9 @@ program_start() { fi fi wid=$(create_win_return_wid "$program_command") + if [[ -n "$name" ]]; then + xdotool set_window --name "$name" "$wid" + fi echo "$wid" > "$MUTDROP_PATH/$program$num" echo -n "$wid" } @@ -574,6 +580,9 @@ current_create() { wid=$(xdotool getactivewindow) echo "$wid" > "$MUTDROP_PATH"/current"$num" get_class_name "$wid" > "$MUTDROP_PATH"/current"$num"_class + if [[ -n "$name" ]]; then + xdotool set_window --name "$name" "$wid" + fi echo -n "$wid" } diff --git a/tdrop.1 b/tdrop.1 index f16f2d1..1a81716 100644 --- a/tdrop.1 +++ b/tdrop.1 @@ -91,6 +91,9 @@ Providing this option lets tdrop know what the class (or classname) of the windo Both the class and classname of a window can be obtained using xprop (see WM_CLASS). As for the difference, generally the class starts with an uppercase letter and the classname starts with a lowercase letter. The xprop output may only list one for some programs (e.g. urxvt only has "urxvt"). Currently this option is only useful for bspwm, and it does not matter whether the class or classname (which bspwm calls an instance name) is provided, so the user does not really need to worry about the distinction. .TP +\fB --name\fR +This option only applies for dropdowns (not auto-hiding and auto-showing). Set a new name for the dropdown window (see _NET_WM_NAME and WM_NAME in xprop output). This option may be useful if you want to add specific rules just for dropdowns with a program like compton by giving them a common title. (default: none) +.TP \fB --clear\fR Used to clear a saved window id for the given program or 'current' instead of creating a dropdown. Takes no argument. .TP