summaryrefslogtreecommitdiff
path: root/.local/bin/dropdowntoggle
blob: f4a4705fcd0568564068f1a38156b5f17283fa23 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#!/bin/sh

# Toggle dropdown terminal windows.
# The first argument is the title of the window.
# The rest of it is the program/command to be run
# in the dropdown window.

name="$1"
class="dropdown"
title="dropdown_$name"
active="$(xdotool search --name $title | wc -l)"
shift


case "$active" in
	0) $TERMINAL --class "dropdown" --title "$title" --command "$@" & ;;
	*) kill -9 `xdotool search --name "$class" getwindowpid` ;;
esac