
나는 2개의 모니터(오른쪽 모니터는 픽셀 및 물리적 측정 단위에서 왼쪽 모니터보다 작음)를 사용하고 종종 자동 숨김 기능이 있는 실행기의 오른쪽 모니터에서 무언가를 열고 싶어합니다. (디스플레이 설정에서는 가장자리 고정이 꺼져 있으므로 화면 사이에서 커서를 움직이는 것이 더 자연스럽게 느껴집니다.) 이렇게 하려면 커서를 오른쪽 모니터의 왼쪽 가장자리로 천천히 이동해야 합니다. 평소처럼 빠르게 움직이면 커서가 움직이기 때문입니다. 왼쪽 모니터에
커서를 아래쪽 가장자리로 이동하여 런처에서 페이드 인할 수 있으면 좋겠습니다. 그러나 나는 그렇게 할 만한 칭찬을 찾지 못했습니다.
런처를 페이드 인하는 명령이나 이를 수행하는 다른 방법이 있으면 알려주십시오.
답변1
마우스가 "트리거" 영역에 들어갈 때 실행 프로그램 표시
아래 스크립트는 마우스 포인터가 특정 영역(활성화 영역이미지에서).
일일이 그려야 하는 게 불편하기 때문에정확히 직선타겟 런처 아이콘을 향해 런처가 활성화된 후 (오른쪽) 화면 왼쪽에 200px 영역을 생성했는데, 이 영역에서는 다시 런처를 숨기지 않고 자유롭게 이동할 수 있습니다.지역을 이동하다).
사용하는 방법
스크립트는
xdotool
마우스 위치를 가져오는 데 사용됩니다.sudo apt-get install xdotool
스크립트를 빈 파일에 복사하고 다른 이름으로 저장하세요.
trigger_launcher.py
스크립트의 헤드 섹션에서 화면 조합에 적합하고 상단 정렬되도록 값을 설정했습니다. 그러나 다른 화면(크기)과 함께 스크립트를 사용하거나 (트리거) 마지를 변경하려는 경우 스크립트 헤드에서 변경할 수 있습니다.
# the script assumes the two screens are top-alligned (!) #-- set the area to trigger the launcher (from left bottom of second screen) below: vert_marge = 50 hor_marge = 200 #-- set the width of the left screen below: width_screen1 = 1680 #-- set the height of the right screen below: height_screen2 = 900 #---
다음 명령을 사용하여 스크립트를 테스트해 보세요.
python3 /path/to/trigger_launcher.py
모든 것이 제대로 작동하면 시작 응용 프로그램에 추가하십시오(Dash > 시작 응용 프로그램 > 추가). 다음 명령을 추가합니다.
/bin/bash -c "sleep 15&&python3 /path/to/trigger_launcher.py"
스크립트
#!/usr/bin/env python3
import subprocess
import time
# the script assumes the two screens are top-alligned (!)
#-- set the area to trigger the launcher (from left bottom of second screen) below:
vert_marge = 50
hor_marge = 200
#-- set the with of the left screen below:
width_screen1 = 1680
#-- set the height of the right screen below:
height_screen2 = 900
#--
vert_line = height_screen2-vert_marge
hor_line2 = width_screen1+hor_marge
k = [" org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ ",
"gsettings set ", "launcher-hide-mode 1", "launcher-hide-mode 0"]
hide = k[1]+k[0]+k[2]; show = k[1]+k[0]+k[3]
def set_launcher(command):
subprocess.Popen(["/bin/bash", "-c", command])
def get_mousepos():
curr = subprocess.check_output(["xdotool", "getmouselocation"]).decode("utf-8")
return [int(it.split(":")[1]) for it in curr.split()[:2]]
current1 = get_mousepos()
while True:
time.sleep(0.3)
current2 = get_mousepos()
if not current1 == current2:
test1 = [int(current1[1]) > vert_line, width_screen1 < int(current1[0]) < hor_line2]
test2 = [int(current2[1]) > vert_line, width_screen1 < int(current2[0]) < hor_line2]
test3 = any([int(current2[0]) > hor_line2, int(current2[0]) < width_screen1])
if (all(test1), all(test2)) == (False, True):
set_launcher(show)
elif test3 == True:
set_launcher(hide)
current1 = current2
편집하다
댓글에서 언급한 것처럼 "영역 이동" 대신 3초의 시간 간격이 있는 버전 아래입니다.
#!/usr/bin/env python3
import subprocess
import time
# the script assumes the two screens are top-alligned (!)
#-- set the area to trigger the launcher (from left bottom of second screen) below:
vert_marge = 50
hor_marge = 200
#-- set the with of the left screen below:
width_screen1 = 1680
#-- set the height of the right screen below:
height_screen2 = 900
#--
vert_line = height_screen2-vert_marge
hor_line2 = width_screen1+hor_marge
k = [" org.compiz.unityshell:/org/compiz/profiles/unity/plugins/unityshell/ ",
"gsettings set ", "launcher-hide-mode 1", "launcher-hide-mode 0"]
hide = k[1]+k[0]+k[2]; show = k[1]+k[0]+k[3]
def set_launcher(command):
subprocess.Popen(["/bin/bash", "-c", command])
def get_mousepos():
curr = subprocess.check_output(["xdotool", "getmouselocation"]).decode("utf-8")
return [int(it.split(":")[1]) for it in curr.split()[:2]]
current1 = get_mousepos()
while True:
time.sleep(0.3)
current2 = get_mousepos()
if not current1 == current2:
test1 = [int(current1[1]) > vert_line, width_screen1 < int(current1[0]) < hor_line2]
test2 = [int(current2[1]) > vert_line, width_screen1 < int(current2[0]) < hor_line2]
if (all(test1), all(test2)) == (False, True):
set_launcher(show)
time.sleep(3)
set_launcher(hide)
current1 = current2