diff options
Diffstat (limited to 'herbstluftwm/.local/bin/scratchpad.sh')
| -rwxr-xr-x | herbstluftwm/.local/bin/scratchpad.sh | 26 |
1 files changed, 17 insertions, 9 deletions
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 |
