1
0
forked from extern/nix-config

sxhkd: Add variable DPI support to dropdown.sh

This makes the dropdown terminal render properly in both 96 and 192 DPI,
as well as any multiples thereof.
This commit is contained in:
Donovan Glover 2018-12-12 06:16:20 -05:00
parent bceec89b6a
commit bb5537c30a
No known key found for this signature in database
GPG Key ID: EA7408A77AE1BE65

View File

@ -2,6 +2,9 @@
# 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
@ -10,9 +13,11 @@ x='kitty --name' # Executable
# 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=3400x1200+220+200
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' ]] &&