Gnome에서 스냅 창 간의 왼쪽/오른쪽 분할 기본 위치 변경

Gnome에서 스냅 창 간의 왼쪽/오른쪽 분할 기본 위치 변경

우분투 18.04의 그놈 3.28에서

SUPER+← snaps a window to the left
SUPER+→ snaps a window to the right

이러한 작업을 설정의 Gnome 키보드 단축키 목록에서 "왼쪽 보기 분할" 또는 "오른쪽 보기 분할"이라고 합니다. 창이 맞춰지면 분할 위치(기본적으로 중앙)를 왼쪽이나 오른쪽으로 끌어서 한 창에 더 많은 공간을 제공하고 다른 창에는 더 적은 공간을 제공할 수 있습니다. 이후에 맞춰진 창은 이 새로운 분할 위치를 따릅니다. 제 생각에는 이것은 아름답고 세련된 구현입니다.

내 질문은 기본 분할 위치를 중앙에서 멀리 이동하는 방법입니다. 나는 오른쪽에 80자 너비의 터미널 창을 두고(16:9 화면 너비의 절반도 안되는 크기) 왼쪽에 있는 브라우저 창을 위해 더 넓은 남은 공간을 남겨 두는 것을 좋아합니다. 기본적으로 다시 시작한 후 왼쪽/오른쪽 스냅 경계를 수동으로 드래그하는 것을 피하고 싶습니다. 다음은 내가 선호하는 테두리 위치가 포함된 분할 창의 스크린샷입니다.

스크린샷

캡처된 창에는 더 이상 둥근 모서리가 없지만 대신 분할 양쪽의 전체 직사각형 영역을 차지합니다.

마우스 드래그로 분할 위치를 변경할 수 있으므로 시작 시 이 변수를 프로그래밍 방식으로 설정할 수 있을까요? 그러나 초기 창 스냅에서 변수가 재설정되고 이를 강제로 적용할 수 있는 방법이 없을 수도 있습니다. dwm xD와 같은 타일링 wm으로 전환해야 할 수도 있지만 gnome은 괜찮습니다.

답변1

또는 원하는 작업을 수행하는 스크립트를 만들고 여기에 바로가기를 매핑할 수 있습니다. 다음 bash 스크립트는 화면의 1/3 또는 2/3로 설정합니다.

screenWidth=$(xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1)
windowWidth=$(xwininfo -id $(xprop -root _NET_ACTIVE_WINDOW | cut -d ' ' -f 5) | grep Width | cut -d ' ' -f 4)

numberRegex='^[0-9]+$'

if  ! [[ $windowWidth =~ $numberRegex ]] ; then
   echo "error: windowWith not a number: '$windowWidth'" >> tile-plus.log; exit 1
fi


if  ! [[ $screenWidth =~ $numberRegex ]] ; then
   echo "error: screenWidth not a number: '$screenWidth'" >> tile-plus.log; exit 1
fi

doubleWidth=$((2*windowWidth))

parameter=$1

echo "Comparing screenWidth $screenWidth and double of width $doubleWidth" >> tile-plus.log
if [[ doubleWidth -gt screenWidth ]] ; then
   echo "Detected big size" >> tile-plus.log
   nextWidth=$((screenWidth / 3))
else
   echo "Detected small size" >> tile-plus.log
   nextWidth=$((screenWidth * 2 / 3))
fi

case $parameter in
right)
   echo "Received right parameter" >> tile-plus.log
   nextOffset=$((screenWidth - nextWidth))
   ;;
*)
  echo "Received $parameter defaulting to left" >> tile-plus.log
  parameter="left"
  nextOffset=0
esac


echo Width will be set to $nextWidth and offset to $nextOffset >> tile-plus.log

wmctrl -r :ACTIVE: -b add,maximized_vert
wmctrl -r :ACTIVE: -e 1,$nextOffset,0,$nextWidth,600

"~/.keyboard-shortcuts/tile-plus.h"에 저장하면 <Super><Alt>Right해당 실행에 대한 바인딩 bash .keyboard-shortcuts/tile-plus.h right<Super><Alt>Left해당 실행에 대한 바로가기를 생성할 수 있습니다 bash .keyboard-shortcuts/tile-plus.h left.

관련 정보