LVDS 화면에만 conky를 항상 표시합니다.

LVDS 화면에만 conky를 항상 표시합니다.

.conkyrc내 노트북 ​​화면(LVDS)에 상단 표시줄을 표시하려면 다음 설정을 사용합니다 .

background yes
update_interval 60
total_run_times 0
# Show umlauts
override_utf8_locale yes

# Font settings
use_xft yes
xftfont Noto Sans:style=normal:size=10
xftalpha 1

# Run in own window
own_window yes
own_window_class conky
own_window_type desktop

# Semi-transparent background
# http://th0th.me/log/conky-and-semi-transparency/
own_window_transparent no
own_window_argb_visual yes
own_window_argb_value 140

# Don't show in window lists and on all desktops
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
own_window_colour bcbcbc
double_buffer yes
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders no
default_color 000000
alignment tl
maximum_width 1265
minimum_size 1265
#gap_x 10
gap_y 3
no_buffers yes
uppercase no
cpu_avg_samples 2

내 화면 상단에 다음과 같이 표시됩니다.

여기에 이미지 설명을 입력하세요

이제 외부 모니터를 연결할 때 conky bar를 두 화면에 모두 표시하는 대신 항상 내부 LVDS 화면으로 제한하고 싶습니다.

conky에게 항상 LVDS를 유지하라고 지시할 수 있나요?

답변1

예. conky가장 왼쪽/오른쪽에 표시되도록 설정해야 합니다 . 세부 사항은 노트북 화면이 오른쪽에 있는지 왼쪽에 있는지에 따라 달라집니다. 예를 들어, 내 설정에서는 왼쪽에 노트북이 있고 오른쪽에 VGA 화면이 있습니다( +1600VGA 항목 참조).

$ xrandr | grep -w connected
VGA-0 connected primary 1440x900+1600+0 (normal left inverted right x axis y axis) 408mm x 255mm
DP-3 connected 1600x900+0+0 (normal left inverted right x axis y axis) 344mm x 194mm

conky내 노트북 ​​화면의 오른쪽 가장자리에 항상 표시되기를 원합니다 . 따라서 나는 .conkyrc다음과 같이 설정했습니다 .

gap_x 1365
gap_y 40

매개 gap_x변수는 화면의 가장 왼쪽 가장자리로부터의 픽셀 수입니다. 그러므로 conky나의 화면은 몇 개를 붙여도 항상 같은 자리에 나타난다.


노트북의 위치가 바뀔 수 있다면 좀 더 정교한 장치가 필요할 것입니다. 예를 들어 화면이 두 개 있는지 확인한 다음 노트북이 왼쪽이나 오른쪽에 있는지 확인하고 .conkyrc그에 따라 편집한 다음 을(를) 실행할 수 있습니다 .conky. 다음과 같은 것 :

#!/usr/bin/env bash

## Get the number of screens
screens=$(xrandr | grep -cw connected);

## If there's only one screen
if [ "$screens" -eq 1 ]
then
    ## Set the gap_x to ten pixels from the left.
    sed -i.bak 's/gap_x .*/gap_x 110/' ~/.conkyrc

## If there are more than one screens
else
    ## Get the offset of the laptop's screen
    pos=$(xrandr | grep LVDS1 | cut -d ' ' -f 4 | cut -d+ -f 2)
    ## Is the laptop on the left?
    if [ "$pos" -eq 0 ]
    then
        ## Set the gap_x to ten pixels from the left.
        sed -i.bak 's/gap_x .*/gap_x 10/' ~/.conkyrc
    else
        ## Use the offset to set conky's position accordingly.
        offset=$((pos+10));
        sed -i.bak "s/gap_x .*/gap_x $offset/" ~/.conkyrc

    fi
fi

killall -9 conky
conky &

해당 스크립트를 사용하기 시작하면 conky현재 설정에 따라 스크립트의 위치가 올바르게 지정되어야 합니다. 특정 사례에 맞게 약간의 조정이 필요할 수 있습니다. 도움이 필요하면 알려주십시오.

답변2

버전 1.10부터 conky.config에서 "xinerama_head = <nr>"을 사용하여 특정 출력을 지정할 수 있습니다.

외부 모니터가 연결되어 있을 때 노트북 패널을 왼쪽에 놓고 메인 모니터로 만들기 위해 이것을 사용하여 노트북 패널에 강제로 연결해야 했습니다. 따라서 모니터의 x 위치가 +1920이지만 xinerama_head 옵션 없이 conky가 표시됩니다.

관련 정보