「Conky」の版間の差分
細 (→インストールと設定) |
|||
| 16行目: | 16行目: | ||
設定ファイルの編集時、ファイルを保存すればすぐに変更が適用されます。X セッションをログアウト・ログインする必要はありません。なので、一つ一つ、全てのオプションを試してみて、設定ファイルを保存して conky ウィンドウがどう変化したか見て、望むようになるまで修正するのが良いでしょう。 |
設定ファイルの編集時、ファイルを保存すればすぐに変更が適用されます。X セッションをログアウト・ログインする必要はありません。なので、一つ一つ、全てのオプションを試してみて、設定ファイルを保存して conky ウィンドウがどう変化したか見て、望むようになるまで修正するのが良いでしょう。 |
||
* また、{{ic|/etc/conky/conky.conf}} のデフォルト設定を使うこともできます: |
* また、{{ic|/etc/conky/conky.conf}} のデフォルト設定を使うこともできます: |
||
| − | $ |
+ | $ conky -C > ~/.config/conky/conky.conf |
ローカルの {{ic|~/.conkyrc}} 設定ファイルを使うのがベストです。多くのアプリと同じように、conky もまず最初にローカルの {{ic|.conkyrc}} ファイルがあるか確認します。ファイルが存在しない場合、{{ic|/etc/conky}} にあるデフォルトの設定ファイルが次に読み込まれます。 |
ローカルの {{ic|~/.conkyrc}} 設定ファイルを使うのがベストです。多くのアプリと同じように、conky もまず最初にローカルの {{ic|.conkyrc}} ファイルがあるか確認します。ファイルが存在しない場合、{{ic|/etc/conky}} にあるデフォルトの設定ファイルが次に読み込まれます。 |
||
2015年8月8日 (土) 01:50時点における版
Conky は X Windows System 向けのシステム監視ソフトウェアです。GNU/Linux と FreeBSD で利用することができます。GPL ライセンスでリリースされているフリーソフトウェアになります。CPU, メモリー, スワップ, ディスク容量, 温度, top, アップロード, ダウンロード, システムメッセージなど、様々なシステムの情報を Conky はモニターすることが可能です。色々と設定することができますが、設定は少々わかりにくいかもしれません。Conky は torsmo のフォークです。
目次
- 1 インストールと設定
- 2 AUR パッケージ
- 3 Tips and tricks
- 3.1 KDE4 や Xfce4 で完全透過を有効にする
- 3.2 Xfce4 で自動起動
- 3.3 ちらつきを防止する
- 3.4 カスタムカラー
- 3.5 デュアルスクリーン
- 3.6 デスクトップの表示で最小化させない
- 3.7 Gnome 3 との統合
- 3.8 KDE との統合
- 3.9 Razor-qt との統合
- 3.10 パッケージの更新情報を表示
- 3.11 天気予報を表示
- 3.12 RSS フィードを表示
- 3.13 Distrowatch の Arch Linux のランキングを表示
- 3.14 rTorrent の統計を表示
- 3.15 WordPress ブログの統計を表示
- 3.16 新規メールの数を表示 (Gmail)
- 3.17 新規メールを表示 (IMAP + SSL)
- 3.18 UTF-8 マルチバイト文字のスクロールの修正
- 4 ユーザーによる設定例
- 5 記号フォントに関する注意
- 6 本来よりフォントが小さく表示される
- 7 完全透過を有効にする万能の方法
- 8 参照
インストールと設定
- homeproject-screenshot のサンプル設定ファイルを使って
~/.conkyrc設定ファイルを編集。
設定ファイルの編集時、ファイルを保存すればすぐに変更が適用されます。X セッションをログアウト・ログインする必要はありません。なので、一つ一つ、全てのオプションを試してみて、設定ファイルを保存して conky ウィンドウがどう変化したか見て、望むようになるまで修正するのが良いでしょう。
- また、
/etc/conky/conky.confのデフォルト設定を使うこともできます:
$ conky -C > ~/.config/conky/conky.conf
ローカルの ~/.conkyrc 設定ファイルを使うのがベストです。多くのアプリと同じように、conky もまず最初にローカルの .conkyrc ファイルがあるか確認します。ファイルが存在しない場合、/etc/conky にあるデフォルトの設定ファイルが次に読み込まれます。
設定をローカル (例: ホームディレクトリ) に保存した場合、変更を行うまでログファイルを読めなくなります。conky の素晴らしい機能の一つとしてデスクトップに /var/log/ のファイルをパイプしてあらゆるログメッセージを読めるようにすることができます。これらのファイルのほとんどは root しか読むことができないため、sudo で conky を実行する必要がありますが conky を root で起動するのはあまり推奨されません、以下の変更を行いましょう:
# usermod -aG log username
username を log グループに追加します。これで username はログファイルを読むことができるようになり、conky でログメッセージをデスクトップにリダイレクトすることが可能です。
~/.conkyrcにした変更が conky に適用されない場合 -- 例: minimum_size --/etc/conky/conky.confを削除するか関連するセクションをコメントアウトして下さい。conky は/etc/conky/のファイルを読み込み続け Xorg のエラーメッセージが表示されることがあります、/etc/conky/のファイルは削除すると良いでしょう。
AUR パッケージ
基本の conky パッケージに加えて、追加のコンパイルオプションを有効にした AUR のパッケージがいくつか存在します:
- conky-cli — X11 依存を取り除いた Conky
- || conky-cliAUR
- conky-lua — Lua サポートが付いた Conky
- || conky-luaAUR
- conky-lua-nv — Lua と Nvidia サポートが付いた Conky
- || conky-lua-nvAUR
- conky-nvidia — Nvidia サポートが付いた Conky
- || conky-nvidiaAUR
Tips and tricks
KDE4 や Xfce4 で完全透過を有効にする
バージョン 1.8.0 から、Conky は完全透過をサポートしています。有効にするには次の行を ~/.conkyrc に追加して下さい:
own_window_transparent yes
上のオプションは OWN_WINDOW_ARGB_VISUAL yes オプションと一緒に使うのは望ましくありません。下で説明している feh の方法を置き換えます。
Xfce4 で自動起動
.conkyrc ファイルで:
background yes
この変数は Conky をバックグラウンドにフォークします。ウィンドウをデスクトップ上に常に表示させ、全てのワークスペースに張り付かせてタスクバーには表示したくない場合、以下の引数を追加してください:
own_window yes own_window_type override
override オプションはウィンドウがウィンドウマネージャの制御下から外れるようにします。
~/.config/autostart/conky.desktop を追加:
[Desktop Entry] Encoding=UTF-8 Version=0.9.4 Type=Application Name=conky Comment= Exec=conky -d StartupNotify=false Terminal=false Hidden=false
ちらつきを防止する
Conky はちらつきを防止するために X サーバーの Double Buffer Extension (DBE) サポートを必要とします。これがないとウィンドウを高速に更新することができません。/etc/X11/xorg.conf で "Module" セクションに Load "dbe" 行を追加することで有効にできます。(1.8.x パッチ以上では) xorg.conf ファイルは個別の設定ファイルが入っている /etc/X11/xorg.conf.d で置き換えられています。DBE は自動でロードされます。
ダブルバッファリングを有効にするには ~/.conkyrc に double_buffer yes オプションを追加してください。
カスタムカラー
クラシックなプリセットカラーの他に (white, black, yellow...)、カラーネームコードを使ってカスタムカラーを設定することができます。色のコードを確認するには、色選択アプリを使って下さい。公式リポジトリに入っている gcolor2 パッケージが色の名前を教えてくれます。カラーコードは6桁の16進数からなります (0-9, A-F)。カスタムカラーを使うには設定ファイルに以下の行を追加してください:
color1 Colorname1 color2 Colorname2
そして、TEXT セクションを編集するときに、事前に定義したカスタムカラー番号を使って下さい。
デュアルスクリーン
デュアルスクリーン設定を使う場合は、conky のウィンドウを配置するための2つのオプションをいじる必要があります。例えば 1680X1050 ピクセルの解像度を使っていて、左モニターの中央上にウィンドウを置きたい場合、以下を使います:
alignment top_left gap_X 840
alignment オプションはそのままの意味で、gap_X オプションは画面の左端からの距離をピクセルで表します。
デスクトップの表示で最小化させない
Compiz を使っている場合: 'デスクトップを表示' ボタンやキーバインドで、他のウィンドウと一緒に Conky も最小化されてしまう場合、Compiz の設定マネージャを起動して、"General Options" を開いて "Hide Skip Taskbar Windows" オプションのチェックを外して下さい。
Compiz を使っていない場合は、~/.conkyrc を編集して以下の行を追加または修正してください:
own_window_type override
もしくは
own_window_type desktop
詳しい違いについては conky の man ページを参照。ただし後者のオプションでは Openbos などでリサイズのキーバインドを使ってウィンドウを conky の縁に調整することができます。前者は出来ません。
Gnome 3 との統合
Gnome 3 で Conky を表示したときに問題が生じる場合。
- 以下の行を
~/.conkyrcに追加:
own_window yes own_window_type conky own_window_transparent yes own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
透過に問題が起こる場合、以下の行を追加してみてください:
own_window_argb_visual yes own_window_argb_value 255
KDE との統合
スクリーンショット設定の Conky ではアイコンの視覚化に問題を生じさせます。以下の手順に従って下さい。
- 以下の行を
~/.conkyrcに追加:
own_window yes own_window_type normal own_window_transparent yes own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
- 次の設定がオンになっている場合、コメントアウトするか行を削除する:
minimum_size
- Conky の起動を自動にするために、次のシンボリックリンクを作成:
- KDE4:
$ ln -s /usr/bin/conky ~/.kde4/Autostart/conkylink - KDE3:
$ ln -s /usr/bin/conky ~/.kde/share/autostart/conkylink
- KDE4:
- 公式リポジトリから入手できる feh パッケージをインストール。
- スクリプトを作成してデスクトップで透過ができるようにする。
KDE4 では ~/.kde4/Autostart/fehconky を編集:
#!/bin/bash feh --bg-scale "$(sed -n 's/wallpaper=//p' ~/.kde4/share/config/plasma-desktop-appletsrc)"
KDE3 では ~/.kde/share/autostart/fehconky を編集:
#!/bin/bash feh --bg-scale $(dcop kdesktop KBackgroundIface currentWallpaper 1)
壁紙を中央に表示したい場合は --bg-center を使う。
- 実行可能属性を付与:
- KDE4:
$ chmod +x ~/.kde4/Autostart/fehconky - KDE3:
$ chmod +x ~/.kde/share/autostart/fehconky
- KDE4:
- スクリプトを使うかわりに、
~/.conkyrcの一番下に同じ内容の行を追加することもできます。- KDE4 の場合
${exec feh --bg-scale "$(sed -n 's/wallpaper=//p' ~/.kde4/share/config/plasma-desktop-appletsrc)"} - KDE3 の場合
${exec feh --bg-scale $(dcop kdesktop KBackgroundIface currentWallpaper 1)}
- KDE4 の場合
Razor-qt との統合
Conky のデフォルト設定では、後ろをクリックするとデスクトップからウィンドウが消えることがあります。以下の行を追加してください:
~/.conkyrc
own_window yes own_window_class Conky own_window_type normal own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager own_window_transparent yes
パッケージの更新情報を表示
- Pacman には
checkupdatesという公式リポジトリのパッケージアップデートを表示する自前のスクリプトが入っています。${execpi 3600 checkupdates | wc -l}でパッケージの合計が表示されます。 - Paconky - ユーザー定義形式でパッケージのアップデート情報を表示します。
${execpi}コマンドを使うことでこのプログラムの出力は conky に含めることができます。 - Scrolling Notifications - スクロールするアップデート通知を表示。Paconky と作者が同じ。
- Perl Script - Paconky の作者によるシンプルで簡単なスクリプト。アップデートが必要なパッケージの数だけを表示。
- Python Script - Python で書かれたアップデート通知プログラム。
- Bash Script - ShowSize を有効にしたユーザーのための Bash スクリプト。
天気予報を表示
このスレッドを参照。
RSS フィードを表示
外部のスクリプトを実行したり Conky に出力したりすることなく、RSS フィードをネイティブに表示する機能が Conky には備わっています。例えば、Planet Arch の最新の記事のタイトル10件を表示して一分ごとにフィードを更新したい場合、以下を ~/.conkyrc の TEXT セクションに挿入します:
${rss https://planet.archlinux.org/rss20.xml 1 item_titles 10 }
Arch フォーラムの rss フィードを表示したい場合、次の行を追加します:
${rss https://bbs.archlinux.org/extern.php?action=feed&type=rss 1 item_titles 4}
1 は更新間隔で (15分がデフォルト)、4 は表示するアイテムの数です。
Distrowatch の Arch Linux のランキングを表示
このスレッドを参照。
rTorrent の統計を表示
このスレッドを参照。
WordPress ブログの統計を表示
python で書かれた ConkyPress という名前の拡張を使うことで表示できます。
新規メールの数を表示 (Gmail)
どこかに gmail.py という名前のファイルを作って (ここでは ~/.scripts/ を使用) 以下の Python コードを入力してください:
gmail.py
#!/usr/bin/env python
from urllib.request import FancyURLopener
email = 'your email' # @gmail.com can be left out
password = 'your password'
url = 'https://%s:%s@mail.google.com/mail/feed/atom' % (email, password)
opener = FancyURLopener()
page = opener.open(url)
contents = page.read().decode('utf-8')
ifrom = contents.index('<fullcount>') + 11
ito = contents.index('</fullcount>')
fullcount = contents[ifrom:ito]
print(fullcount + ' new')
以下のように Python の urllib を使うこともできます。
gmail.py
#! /usr/bin/env python
import urllib.request
from xml.etree import ElementTree as etree
# Enter your username and password below within quotes below, in place of ****.
# Set up authentication for gmail
auth_handler = urllib.request.HTTPBasicAuthHandler()
auth_handler.add_password(realm='New mail feed',
uri='https://mail.google.com/',
user= '****',
passwd= '****')
opener = urllib.request.build_opener(auth_handler)
# ...and install it globally so it can be used with urlopen.
urllib.request.install_opener(opener)
gmail = 'https://mail.google.com/gmail/feed/atom'
NS = '{http://purl.org/atom/ns#}'
with urllib.request.urlopen(gmail) as source:
tree = etree.parse(source)
fullcount = tree.find(NS + 'fullcount').text
print(fullcount + ' new')
次の行を ~/.conkyrc に追加すれば、5分 (300秒) ごとに新しいメールがないか Gmail アカウントをチェックして表示するようになります:
${execpi 300 python ~/.scripts/gmail.py}
他の方法
同じやり方で curl, grep, sed を使う方法:
$ curl -s -u '''email''':'''password''' https://mail.google.com/mail/feed/atom | grep fullcount | sed 's/<[^0-9]*>//g'
email と password はあなたのデータに置き換えて下さい。
また、stunnel パッケージの stunnel を使うこともできます。
以下の設定は Conky の FAQ から引用しています。
以下のように /etc/stunnel/stunnel.conf を編集して、stunnel デーモンを起動:
# Service-level configuration for TLS server [imap] client = yes accept = 143 connect = imap.gmail.com:143 protocol = imap sslVersion = TLSv1 # Service-level configuration for SSL server [imaps] client = yes accept = 993 connect = imap.gmail.com:993
後は~/.conkyrc だけです:
imap localhost username * -i 120 -p 993
TEXT
Inbox: ${imap_unseen}/${imap_messages}
Here I used * as the password for conky to ask for it at start, but you do not have to do it.
新規メールを表示 (IMAP + SSL)
Conky には IMAP アカウントのサポートが組み込まれていますが SSL はサポートしていません。このフォーラムへの投稿 にあるスクリプトを使うことで利用することができます。perl-mail-imapclientAUR と perl-io-socket-ssl パッケージの Perl/CPAN Modules Mail::IMAPClient と IO::Socket::SSL が必要です。
Conky に読み込ませる場所に imap.pl という名前のファイルを作成してください。このファイルには、以下の内容を記述します (必要なところは書き換えて下さい):
#!/usr/bin/perl
# gimap.pl by gxmsgx
# description: get the count of unread messages on imap
use strict;
use Mail::IMAPClient;
use IO::Socket::SSL;
my $username = 'example.username';
my $password = 'password123';
my $socket = IO::Socket::SSL->new(
PeerAddr => 'imap.server',
PeerPort => 993
)
or die "socket(): $@";
my $client = Mail::IMAPClient->new(
Socket => $socket,
User => $username,
Password => $password,
)
or die "new(): $@";
if ($client->IsAuthenticated()) {
my $msgct;
$client->select("INBOX");
$msgct = $client->unseen_count||'0';
print "$msgct\n";
}
$client->logout();
~/.conkyrc に次を追加:
${execpi 300 ~/.conky/imap.pl}
ファイルの位置は適宜変更してください。
Gmail を使う場合、アプリパスワードを 生成 する必要があります。
もしくは、上に書かれているように stunnel を使うこともできます: #他の方法
UTF-8 マルチバイト文字のスクロールの修正
現在のバージョンの conky (1.9.0) には文字列ではなくバイト数によってスクロールするテキストが増えるというバグが存在し (http://sourceforge.net/p/conky/bugs/341/)、結果としてマルチバイト文字を含むテキストでスクロールが消えたり現れたりするということが起こります。このバグを修正するパッチをあてたパッケージが AUR に存在します: conky-utfscrollAUR。
ユーザーによる設定例
Graysky
[Here] it is - modify to fit your system. Optimized for a quad core chip w/ several hdds (although one of them is not connected for this screenshot) and an nvidia graphics card. You can easily modify this to a dual or single core system with one or whatever number of hdds.
nvidia サポートのサンプルリングスクリプト
# -- Conky settings -- #
background no
update_interval 1
cpu_avg_samples 2
net_avg_samples 2
override_utf8_locale yes
double_buffer yes
no_buffers yes
text_buffer_size 2048
imlib_cache_size 0
# -- Window specifications -- #
own_window yes
own_window_type normal
own_window_transparent yes
own_window_hints undecorate,sticky,skip_taskbar,skip_pager,below
border_inner_margin 0
border_outer_margin 0
minimum_size 320 800
maximum_width 320
alignment bottom_right
gap_x 0
gap_y 0
# -- Graphics settings -- #
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
# -- Text settings -- #
use_xft yes
xftfont MaiandraGD:size=24
xftalpha 0.4
uppercase no
default_color 888888
# -- Lua Load -- #
lua_load ~/conky/lua/lua.lua
lua_draw_hook_pre ring_stats
TEXT
${alignr}${voffset 53}${goto 90}${font MaiandraGD:size=11}${time %A, %d %B %Y}
${voffset 5}${goto 164}${font MaiandraGD:size=16}${time %H:%M}
${voffset -40}${goto 100}${font MaiandraGD:size=9}Kernel:${offset 70}Uptime:
${goto 90}${font MaiandraGD:size=9}$kernel${offset 40}$uptime
${voffset 57}${goto 117}${font snap:size=8}${cpu cpu0}%
${goto 117}${cpu cpu1}%
${goto 117}CPU
${voffset 19}${goto 145}${memperc}%
${goto 145}$swapperc%
${goto 145}MEM
${voffset 25}${goto 170}${nvidia gpufreq}
${goto 170}${nvidia memfreq}
${goto 170}GPU
${voffset 27}${goto 198}${totaldown ppp0}
${goto 198}${totalup ppp0}
${goto 205}NET
${voffset 21}
${goto 222}${fs_used /home}
${goto 230}DISK
And the required lua.lua script:
--[[
Ring Meters by londonali1010 (2009)
This script draws percentage meters as rings. It is fully customisable; all options are described in the script.
IMPORTANT: if you are using the 'cpu' function, it will cause a segmentation fault if it tries to draw a ring straight away. The if statement on line 145 uses a delay to make sure that this does not happen. It calculates the length of the delay by the number of updates since Conky started. Generally, a value of 5s is long enough, so if you update Conky every 1s, use update_num > 5 in that if statement (the default). If you only update Conky every 2s, you should change it to update_num > 3; conversely if you update Conky every 0.5s, you should use update_num > 10. ALSO, if you change your Conky, is it best to use "killall conky; conky" to update it, otherwise the update_num will not be reset and you will get an error.
To call this script in Conky, use the following (assuming that you save this script to ~/scripts/rings.lua):
lua_load ~/scripts/rings-v1.2.1.lua
lua_draw_hook_pre ring_stats
Changelog:
+ v1.2.1 -- Fixed minor bug that caused script to crash if conky_parse() returns a nil value (20.10.2009)
+ v1.2 -- Added option for the ending angle of the rings (07.10.2009)
+ v1.1 -- Added options for the starting angle of the rings, and added the "max" variable, to allow for variables that output a numerical value rather than a percentage (29.09.2009)
+ v1.0 -- Original release (28.09.2009)
]]
settings_table = {
{
-- Edit this table to customise your rings.
-- You can create more rings simply by adding more elements to settings_table.
-- "name" is the type of stat to display; you can choose from 'cpu', 'memperc', 'fs_used_perc', 'battery_used_perc'.
name='time',
-- "arg" is the argument to the stat type, e.g. if in Conky you would write ${cpu cpu0}, 'cpu0' would be the argument. If you would not use an argument in the Conky variable, use ''.
arg='%I.%M',
-- "max" is the maximum value of the ring. If the Conky variable outputs a percentage, use 100.
max=12,
-- "bg_colour" is the colour of the base ring.
bg_colour=0x888888,
-- "bg_alpha" is the alpha value of the base ring.
bg_alpha=0.3,
-- "fg_colour" is the colour of the indicator part of the ring.
fg_colour=0x888888,
-- "fg_alpha" is the alpha value of the indicator part of the ring.
fg_alpha=0.5,
-- "x" and "y" are the x and y coordinates of the centre of the ring, relative to the top left corner of the Conky window.
x=191, y=145,
-- "radius" is the radius of the ring.
radius=32,
-- "thickness" is the thickness of the ring, centred around the radius.
thickness=4,
-- "start_angle" is the starting angle of the ring, in degrees, clockwise from top. Value can be either positive or negative.
start_angle=0,
-- "end_angle" is the ending angle of the ring, in degrees, clockwise from top. Value can be either positive or negative, but must be larger (e.g. more clockwise) than start_angle.
end_angle=360
},
{
name='time',
arg='%M.%S',
max=60,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=191, y=145,
radius=37,
thickness=4,
start_angle=0,
end_angle=360
},
{
name='time',
arg='%S',
max=60,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=191, y=145,
radius=42,
thickness=4,
start_angle=0,
end_angle=360
},
{
name='cpu',
arg='cpu0',
max=100,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=140, y=300,
radius=26,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='cpu',
arg='cpu1',
max=100,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=140, y=300,
radius=20,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='memperc',
arg='',
max=100,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=170, y=350,
radius=26,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='swapperc',
arg='',
max=100,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=170, y=350,
radius=20,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='time',
arg='%d',
max=31,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=191, y=145,
radius=50,
thickness=5,
start_angle=-140,
end_angle=-30
},
{
name='time',
arg='%m',
max=12,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=191, y=145,
radius=50,
thickness=5,
start_angle=30,
end_angle=140
},
-- {
-- name='fs_used_perc',
-- arg='/',
-- max=100,
-- bg_colour=0x888888,
-- bg_alpha=0.3,
-- fg_colour=0x888888,
-- fg_alpha=0.5,
-- x=260, y=503,
-- radius=26,
-- thickness=5,
-- start_angle=-90,
-- end_angle=180
-- },
{
name='fs_used_perc',
arg='/home',
max=100,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=260, y=503,
radius=20,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='totalup',
arg='ppp0',
max=2,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=230, y=452,
radius=20,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='totaldown',
arg='ppp0',
max=2,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=230, y=452,
radius=26,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='nvidia',
arg='gpufreq',
max=475,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=200, y=401,
radius=26,
thickness=5,
start_angle=-90,
end_angle=180
},
{
name='nvidia',
arg='memfreq',
max=700,
bg_colour=0x888888,
bg_alpha=0.3,
fg_colour=0x888888,
fg_alpha=0.5,
x=200, y=401,
radius=20,
thickness=5,
start_angle=-90,
end_angle=180
},
}
require 'cairo'
function rgb_to_r_g_b(colour,alpha)
return ((colour / 0x10000) % 0x100) / 255., ((colour / 0x100) % 0x100) / 255., (colour % 0x100) / 255., alpha
end
function draw_ring(cr,t,pt)
local w,h=conky_window.width,conky_window.height
local xc,yc,ring_r,ring_w,sa,ea=pt['x'],pt['y'],pt['radius'],pt['thickness'],pt['start_angle'],pt['end_angle']
local bgc, bga, fgc, fga=pt['bg_colour'], pt['bg_alpha'], pt['fg_colour'], pt['fg_alpha']
local angle_0=sa*(2*math.pi/360)-math.pi/2
local angle_f=ea*(2*math.pi/360)-math.pi/2
local t_arc=t*(angle_f-angle_0)
-- Draw background ring
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_f)
cairo_set_source_rgba(cr,rgb_to_r_g_b(bgc,bga))
cairo_set_line_width(cr,ring_w)
cairo_stroke(cr)
-- Draw indicator ring
cairo_arc(cr,xc,yc,ring_r,angle_0,angle_0+t_arc)
cairo_set_source_rgba(cr,rgb_to_r_g_b(fgc,fga))
cairo_stroke(cr)
end
function conky_ring_stats()
local function setup_rings(cr,pt)
local str=''
local value=0
str=string.format('${%s %s}',pt['name'],pt['arg'])
str=conky_parse(str)
value=tonumber(str)
if value == nil then value = 0 end
pct=value/pt['max']
draw_ring(cr,pct,pt)
end
if conky_window==nil then return end
local cs=cairo_xlib_surface_create(conky_window.display,conky_window.drawable,conky_window.visual, conky_window.width,conky_window.height)
local cr=cairo_create(cs)
local updates=conky_parse('${updates}')
update_num=tonumber(updates)
if update_num>5 then
for i in pairs(settings_table) do
setup_rings(cr,settings_table[i])
end
end
end
記号フォントに関する注意
装飾がある .conkyrc では大抵 PizzaDude Bullets と Pie Charts for Maps フォントを使っています。これらのフォントはそれぞれ ttf-pizzadude-bulletsAUR と ttf-piechartsformapsAUR として AUR からインストールすることができ、もしくはフォントの記事に書かれている方法を使って手動でインストールすることもできます。
本来よりフォントが小さく表示される
conky のフォントがやけに小さく表示されたり、ちゃんと並ばない場合、infinality の freetype2 パッチのデフォルト設定が原因かもしれません。この設定は 96 DPI ではなく 72 DPI でフォントを表示するプログラムに問題を生じさせます。たとえシステムを 96 DPI に設定していても関係ありません。この問題を修正するには /etc/fonts/infinality/infinality.conf を開いて DPI のセクションを探して 72 から 96 に変更してください。
完全透過を有効にする万能の方法
透過は conky における KAIJU ですが、xcompmgr と transset-df を使ってどんな環境やウィンドウマネージャでも完全透過を適用する方法が存在します。xcompmgr と transset-df をインストールしてください。
xcompmgr のドキュメントを確認してどのコンポジットオプションを有効にすべきか決めて下さい。以下は標準的なコマンドになります。
$ xcompmgr -c -t-5 -l-5 -r4.2 -o.55 &
conky & で conky が実行中か確認してください。transset-df を使って Conky ウィンドウの透過を有効にします。'.5' は 0 - 1 の好きな値に設定してください。
$ transset-df .5 -n Conky
これで conky のウィンドウが完全透過します。No Window matching Conky exists! のようなエラーが表示される場合、conky が動作しているか確認してから、xprop を使って conky のウィンドウをクリックして、transset-df に指定するべき名前を確認してください。
$ xprop | grep WM_NAME
WM_NAME(STRING) = "Conky (ArchitectLinux)"
上記の場合、conky で合っていますが、別の文字列が出力された場合は、それに合わせて指定するようにしてください。~/.conkyrc で own_window_type オプションを panel に設定していた場合、xprop を実行しても何も出力されないことがあります。その場合は dock, normal, override, desktop などを使うようにしてみてください。
~/.xinitrc に以下を記述することで X の起動後に conky に透過を適用することができます:
xcompmgr -c -t-5 -l-5 -r4.2 -o.55 & conky -d; sleep 1 && transset-df .5 -n Conky
参照
- Official Conky variables for configuration
- Conky Configs on arch forums
- 公式ウェブサイト
- Conky on Freshmeat
- Conky on SourceForge
- #conky IRC chat channel on freenode
- FAQ