diff options
| author | Peter Son Struschka <me@peter-struschka.com> | 2020-10-11 12:15:08 +0800 |
|---|---|---|
| committer | Peter Son Struschka <me@peter-struschka.com> | 2020-10-11 20:22:03 +0800 |
| commit | e5209aad576fe44d3965fcb94d6709348b0a93bf (patch) | |
| tree | 3f8c4388d5b2511d78debf5e2d9b1357c3187b38 /herbstluftwm/.local/bin/scratchpad.sh | |
| parent | 37dd411698bd6eae8365260dde39b8ae9c7cbd36 (diff) | |
| download | dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.tar.gz dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.tar.bz2 dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.tar.lz dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.tar.xz dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.tar.zst dotfiles-e5209aad576fe44d3965fcb94d6709348b0a93bf.zip | |
all: overhaul
all: Remove old symlinks
herbstluftwm: use polybar instead of dzen2
polybar: update config
doom-emacs: update repository
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 |
