
.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 バーを両方の画面に表示するのではなく、常に内部 LVDS 画面のみに制限したいと思います。
conky に常に LVDS を維持するように指示することは可能ですか?
答え1
はい。conky
一番左/右に表示するように設定する必要があります。詳細は、ラップトップの画面が右側にあるか左側にあるかによって異なります。たとえば、私のセットアップでは、ラップトップが左側にあり、VGA 画面が右側にあります ( +1600
VGA のエントリの に注意してください)。
$ 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
接続した画面の数に関係なく、常に同じ場所に表示されます。
ラップトップの位置を変更できる場合は、より高度なものが必要になります。たとえば、画面が 2 つあるかどうかを確認し、ラップトップが左側にあるか右側にあるかを確認し、それ.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>" を使用して特定の出力を指定できます。
私は、外部モニターをメインモニターにして、左側にラップトップを置いているので、外部モニターが接続されているときに、conky をラップトップ パネルに強制的に表示するためにこれを使用する必要がありました。そのため、モニターの x 位置は +1920 ですが、xinerama_head オプションなしでも conky はモニター上に表示されます。