1
0
forked from extern/nix-config
donovanglover-nix-config/sxhkd/.config/sxhkd/dropdown.sh
Donovan Glover a33c3b0f7b
Revert "Remove sxhkd"
Similar to the other revert commits, keeping my sxhkd config is useful
if I want to use bspwm in the future, since I won't have to re-create
it later.
2021-05-14 10:18:03 -04:00

25 lines
848 B
Bash
Executable File

#!/bin/sh
# New Start: A modern Arch workflow built with an emphasis on functionality.
# Copyright (C) 2018 Donovan Glover
DROPDOWN_DPI=$(xrdb -query | grep Xft.dpi | cut -f 2)
DROPDOWN_SCALE=$(($DROPDOWN_DPI / 96))
c='kitty' # Class
i='dropdown' # Instance
x='kitty --name' # Executable
# Note: This solution will not work with termite since it registers two ids.
# See https://github.com/thestinger/termite/issues/634 for more information.
id=$(xdo id -n $i)
rectangle=$((1700 * $DROPDOWN_SCALE))x$((600 * $DROPDOWN_SCALE))
offset=+$((110 * $DROPDOWN_SCALE))+$((100 * $DROPDOWN_SCALE))
bspc rule -r $c:$i
bspc rule -a $c:$i sticky=on state=floating rectangle=$rectangle$offset
([ -z "$id" ]) && ($x $i) ||
([[ $(xprop -id "$id" | awk '/window state: / {print $3}') == 'Withdrawn' ]] &&
xdo show -n $i || xdo hide -n $i)