From e5209aad576fe44d3965fcb94d6709348b0a93bf Mon Sep 17 00:00:00 2001 From: Peter Son Struschka Date: Sun, 11 Oct 2020 12:15:08 +0800 Subject: all: overhaul all: Remove old symlinks herbstluftwm: use polybar instead of dzen2 polybar: update config doom-emacs: update repository --- herbstluftwm/.local/bin/scratchpad.sh | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) (limited to 'herbstluftwm/.local/bin/scratchpad.sh') diff --git a/herbstluftwm/.local/bin/scratchpad.sh b/herbstluftwm/.local/bin/scratchpad.sh index d168ad7..3e550e4 100755 --- a/herbstluftwm/.local/bin/scratchpad.sh +++ b/herbstluftwm/.local/bin/scratchpad.sh @@ -18,17 +18,25 @@ hc() { "${herbstclient_command[@]:-herbstclient}" "$@" ;} scratchpad=(urxvt -title "$tag" -name "scratchpad") #scratchpad=(xterm -title "$tag" -name "scratchpad") -#mrect=( $(hc monitor_rect "") ) read -r -a mrect < <(hc monitor_rect "") -width=${mrect[2]} -height=${mrect[3]} +monitor_w=${mrect[2]} +monitor_h=${mrect[3]} +monitor_w_offset=${mrect[0]} +monitor_h_offset=${mrect[1]} + +scratchpad_scale_factor=0.75 + +scratch_w=$(printf "%d" "$(bc -l <<< "$monitor_w * $scratchpad_scale_factor")") +scratch_h=$(printf "%d" "$(bc -l <<< "$monitor_h * $scratchpad_scale_factor")") +scratch_w_offset=$(((monitor_w-scratch_w)/2)) +scratch_h_offset=$(((monitor_h-scratch_h)/2)) rect=( - $((width/2)) - $((height/2)) - $((mrect[0]+(width/4))) - $((mrect[1]+(height/4))) + "$scratch_w" + "$scratch_h" + $((monitor_w_offset+scratch_w_offset)) + $((monitor_h_offset+scratch_h_offset)) ) hc add "$tag" @@ -36,8 +44,8 @@ hc add "$tag" monitor=scratchpad exists=false -if ! hc add_monitor $(printf "%dx%d%+d%+d" "${rect[@]}") \ - "$tag" $monitor 2> /dev/null ; then +if ! hc add_monitor "$(printf "%dx%d%+d%+d" "${rect[@]}")" \ + "$tag" "$monitor" 2> /dev/null ; then exists=true else # remember which monitor was focused previously -- cgit v1.2.3