顯示具有 Linux 標籤的文章。 顯示所有文章
顯示具有 Linux 標籤的文章。 顯示所有文章

2016年9月13日 星期二

volume icon on systray - linux

試用了以下幾個可以在 linux systray 顯示音量 icon 的小程式:
  • volti 
  • volicon
  • volumeicon 
  • alsa-tray 
  • volwheel 
  • pnmixer

最後決定用 alsa-tray,原因是佔用的記憶體最少,而且操作模式不會很奇怪。
再寫個小小的 service,用 systemd 啟動就大功告成了。
[Unit]
Description=show volume icon on systray

[Service]
Type=simple

ExecStart=/usr/bin/alsa-tray
ExecReload=/bin/kill -HUP $MAINPID

[Install]
WantedBy=default.target

2013年6月5日 星期三

ffmpeg 使用心得







使用了一陣子的 FFMpeg 處理影片,越用越喜歡這套軟體。
一開始,為了要將影片轉成 ipod touch 3代,可用的格式,特別學習
ffmpeg,試了好幾天,終於找出來滿意的方法,特此記錄下來,免得忘了。

轉檔時的指令

ffmpeg -i $1 -s 720x406 -vpre ipod -ac 2 -sn -y -vf subtitles=$1.srt $1.m4v
其中
-i \$1 是要轉檔的檔名
-s 720x406 是轉檔後的解析度,406 = 720 * 720 /
1280,(原始檔的解析度為
1280x720)。這個一定要去計算,不然,在電視上看,畫面比例會不對,字幕可能出不來。
-vpre ipod 是為了 ipod 特別找出來的 preset,設定如後。
--ac 2 是轉成立體聲,不然 ipod touch 沒辦法播放。
--sn 不顯示原始檔中的字幕。因為,我要用另外的字幕檔。
--vf subtitles 為 srt 字幕檔。

preset設定

preset 可以放在 \~/.ffmpeg,檔名為 arg.ffpreset。
例如,我設定了一個專門轉到 ipod touch 的 preset 檔,命名為
ipod.ffpreset。 :
strict=-2

vcodec=libx264
vprofile=main
level=30
maxrate=10000000
bufsize=10000000

preset=fast
#preset=slower

crf=20
#bf=0
#refs=1

#ab=192k

字幕

參考 How to burn subtitles into the
video

原檔中已有圖片格式的字幕時,可直接燒錄:

-filter_complex '[0:v][0:s:1]overlay[v]' -map [v] -map 0:a
此處 -map 一定要下,不然會有錯誤訊息。 其中 -map 0:a
是指所有的音軌,也可以直接指定音軌 -map 0:1
出現的訊息如下:
Stream mapping:
  Stream #0:0 (h264) -> overlay:main (graph 0)
  Stream #0:4 (pgssub) -> overlay:overlay (graph 0)
  overlay (graph 0) -> Stream #0:0 (libx264)

加入外部字幕檔

1. 自行編輯字幕檔

這個很少用到,在 linux 中,就找到 aegisub
是可用的,那就拿來用了,沒有什麼特別的考慮。

2. 提取 mkv 內 srt 或 ass 字幕

提取 mkv 內的文字字幕,用 :
ffmpeg -i $1.mkv -vn -an -scodec copy $1.ssa
或:
ffmpeg -i \$1.mkv -vn -an -scodec copy \$1.srt
有時會出現下列的錯誤訊息,內嵌的應該就是圖片格式字幕。 :
Could not write header for output file #0 (incorrect codec parameters ?): Operation not permitted
爲了能改變字型大小,使用 ass 格式。

3. srt

先轉成 ssa 檔,
ffmpeg -i s.srt s.ssa
s.ssa 中加上
; 同步字幕
Synch Point:0
; PlayResX/Y 影片解析度
PlayResX:720
PlayResY:480
; 調整字幕速度
Timer:100.0000
作出 ssa 檔後,可以用文字編輯器開啓,修改一下 fontname 和
fontsize,讓字型美一點。 各參數用法見 ASS
字幕格式

如果不想控制字幕格式,就不須轉成 ass 格式,就用下列指令燒錄到影片。
-vf subtitles=sub.srt

4. 字幕轉成繁體

可以再用 opencc 把字幕轉成繁體:
opencc -i $1.ssa -o o.ssa

5. ass

用 -vf 燒錄到影片中。
-vf ass=s.ssa
或直接加入影片中,不是燒錄上去。
ffmpeg -i video.avi -i sub.ass -map 0:0 -map 0:2 -map 1 -c:a copy -c:v copy -c:s copy video.mkv
其中 video.avi 有一個視頻軌、兩個音頻軌,取其中的視頻軌 (mpa 0:0)
和第二個音頻軌 (map 0:2) 加 sub.ass (map 1) 做成 video.mkv
而不重新編碼。
重點注意: -i sub.ass -map 1 -c:s copy。 此處的 sub.ass 也可以是
sub.srt。

合併多個影片

參考 How to concatenate (join, merge) media
files

mpeg:
ffmpeg -i "concat:input1.mpg|input2.mpg|input3.mpg" -c copy output.mpg
not mpeg:
This is easiest to explain using an example::

    ffmpeg -i input1.mp4 -i input2.webm \
    -filter_complex '[0:0] [0:1] [1:0] [1:1] concat=n=2:v=1:a=1 [v] [a]' \
    -map '[v]' -map '[a]' <encoding options> output.mkv

On the -filter_complex line, the following:

'[0:0] [0:1] [1:0] [1:1]
tells ffmpeg what streams to send to the concat filter;
in this case, streams 0 and 1 from input 0 (input1.mp4 in this example),
and streams 0 and 1 from input 1 (input2.webm).

concat=n=2:v=1:a=1 [v] [a]'
This is the concat filter itself. n=2 is telling the filter that there are two input files;
v=1 is telling it that there will be one video stream;
a=1 is telling it that there will be one audio stream.
[v] and [a] are names for the output streams, to allow the rest of the ffmpeg line to use the output of the concat filter.

Note that the single quotes ' ' around the whole filter section are required.

-map '[v]' -map '[a]'
This tells ffmpeg to use the results of the concat filter rather than
the streams directly from the input files.

catflv

寫了個小小的 script,用來合併 flv,並轉成 ipod可用的 mp4。 :
#!/bin/bash

icnt=0

for file in $@
do
    filenames="$filenames -i $file "
    scat="$scat[$icnt:0][$icnt:1]"

    #echo $filenames, [$icnt], $scat
    icnt=$(($icnt+1))

done

scmd="ffmpeg $filenames -filter_complex '$scat concat=n=$#:v=1:a=1 [v] [a]' -map '[v]' -map '[a]' -vpre ipod -ab 132k out.mp4"
echo $scmd
eval $scmd

DVD備份

DVD to ISO

爲了保存有價值的影片,儘量用比較高品質的壓縮方法。
​1. 參考:Encoding DVD into HQ flash video using
ffmpeg

將 DVD copy 成 ISO 檔,並掛上: :
$ dd if=/dev/cdrom of=dvd.iso
$ mkdir mnt
$ sudo mount dvd.iso mnt -o loop
$ ls -al mnt/
total 10
dr-xr-xr-x 4 4294967295 4294967295  136 2009-09-30 20:45 .
drwxr-xr-x 5 dpavlin    dpavlin    4096 2009-10-15 22:01 ..
dr-xr-xr-x 2 4294967295 4294967295   40 2009-09-30 17:25 AUDIO_TS
dr-xr-xr-x 2 4294967295 4294967295  560 2009-09-30 18:45 VIDEO_TS
​2. 或使用 dvdbackup,就不必再 mount dvd.iso,而且可以用 libdvdcss
解除保護。
yaourt -S dvdbackup libdvdcss
dvdbackup -i /dev/cdrom -M -o ~/dvd_backup

DVD to MKV

先將 ISO 轉成 MKV :
cat VTS_01_[1234].VOB | ffmpeg -i - -probesize 214748000 -analyzeduration 214748000 \
-map 0:0 -map 0:1 -map 0:2 \
-crf 18 -preset veryslow -tune help\
-filter:v yadif \
-c:a copy -c:s copy -y a.mkv
-probesize 214748000 -analyzeduration 214748000
有時會因爲音軌或字幕軌太晚出現,ffmpeg
會偵測不到,這時就加長偵測的時間和大小。
-map 0:0 -map 0:1 -map 0:2 是要封裝到 mkv 的軌道。
-crf 18 -preset veryslow
用這個參數大概就好了,眼睛看不出來與原始有何差異。 有必要時可以再加上
-tune。
-filter:v yadif 就是 deinterlace。
-c:a copy -c:s copy 音軌和字幕軌都不重新編碼。
如果沒有字幕,可以先取得字幕檔,再保存到 mkv 中,如下: :
$ cat VTS_01_[1234].VOB | ffmpeg -i - -i a.ssa \
-map 0:0 -map 0:2 -map 1 \
-crf 18 -preset veryslow -tune zerolatency \
-filter:v yadif \
-c:a copy -c:s copy \
-y a.mkv
重點是 -i a.ssa -map 1 -c:s copy

MKV 轉成 mp4

如果要在 ipod 或智慧型手機上看,那就不需要太考慮品質,能用就好。
就用上面轉好的 mkv 檔,再轉一次。 如此,既可以用 mkv
保存高品質的影片,再轉成 mp4 的速度也比較快。
這是要注意字幕是圖片格式或是 srt/ass 文字式。

字幕是圖片格式

用 -filter_complex 直接燒錄 :
$ ffmpeg -i a.mkv \
-filter_complex '[0:v][0:s:1]overlay[v]' -map [v] -map 0:a \
-vpre ipod -ac 2 -ab 192k \
-y a.mp4

字幕是 srt 或 ass


  1. 先處理字幕檔 (前述)

  2. 用 -vf subtiles=a.srt 或 -vf ass=a.ass 把字幕燒進 mp4 中。 :
    $ ffmpeg -i a.mkv \
    -vpre ipod -ac 2 -ab 192k \
    -vf subtitles=a.srt \
    -y a.mp4
    

metadata

參考 ffmpeg
-metadata[:metadata_specifier] key=value (output,per-metadata) Set a
metadata key/value pair.
An optional metadata_specifier may be given to set metadata on streams
or chapters. See -map_metadata documentation for details.
This option overrides metadata set with -map_metadata. It is also
possible to delete metadata by using an empty value.
For example, for setting the title in the output file :
ffmpeg -i in.avi -metadata title="my title" out.flv
To set the language of the first audio stream :
ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT
例子: :
-metadata:s:1 title="日語" -metadata:s:2 title="國語" -metadata:s:3 title="中文"

參考資料


  1. FFmpeg wiki:
    x264EncodingGuide

  2. 直接看 help :
    $ ffmpeg --help
    $ x264 --fullhelp
    

2013年4月10日 星期三

Tile windows 平鋪式視窗 - Pytyle 3

Tile windows 平鋪式視窗

有的時候,開了很多的視窗,想要看到所有視窗的內容,這個時候,「平鋪式視窗」就很有用了。

因為我用的是 archlinux + lxde,所以就找與 openbox 配合度好的 Pytyle 3 來試試看。

安裝

很簡單,下個指令就裝好了:

yaourt -S pytyle3-git

裝好之後,記得把配置檔 copy 到 ~/.config/pytyle3:

mkdir ~/.config/pytyle3

cp /etc/xdg/pytyle3/*py ~/.config/pytyle3

也就只有 keybind.py 和 config.py 這 2 個檔,可以開起來看看。

執行

在終端機中輸入:

pytyle3

預設的啟動鍵是 A-a,我試著想把它改成 W-a,但沒有成功。查看 ~/.config/pytyle3/keybind.py,可以知道有那些快速鍵,表列如下:

'A-a':       啟動平鋪(tile)
'A-u':       不再平鋪(untile)
'A-h':       減小主視窗 (decrease_master)
'A-l':       加大主視窗 (increase_master)
'A-j':       tile.cmd(prev_client)
'A-k':       tile.cmd(next_client)
'A-Shift-j': tile.cmd(switch_prev_client)
'A-Shift-k': (switch_next_client)
'A-comma':   (remove_master)
'A-period':  增加當前視窗為主視窗(add_master)
'A-Return':  設定當前視窗為主視窗(make_master)
'A-m':       切換到主視窗(focus_master),
'A-z':       切換水平或垂直排列(cycle),

'A-q':       除錯 (debug_state)
'A-Shift-q': 離開,

很好玩的「平鋪式視窗」。不想用的時候,就把 pytyle 關掉,如此就不必裝 dwm, awesome 之類的視窗管理器。

參考文件:

Pytyle on arch wiki

2013年3月22日 星期五

ffmpeg 使用心得

ffmpeg 使用心得

為了要將影片轉成 ipod touch 3代,可用的格式,特別學習 ffmpeg,試了好幾天,終於找出來滿意的方法,特此記錄下來,免得忘了。

轉檔時的指令

ffmpeg -i $1 -s 720x406 -vpre ipod -ac 2 -sn -y -vf subtitles=$1.srt $1.m4v

其中

-i $1 是要轉檔的檔名

-s 720x406 是轉檔後的解析度,406 = 720 * 720 / 1280,(原始檔的解析度為 1280x720)。這個一定要去計算,不然,在電視上看,畫面比例會不對,字幕可能出不來。

-vpre ipod 是為了 ipod 特別找出來的 preset,設定如後。

--ac 2 是轉成立體聲,不然 ipod touch 沒辦法播放。

--sn 不顯示原始檔中的字幕。因為,我要用另外的字幕檔。

--vf subtitles 為字幕檔。

preset設定

preset 可以放在 ~/.ffmpeg,檔名為 arg.ffpreset,例如,我設定了一個專門轉到 ipod touch 的 preset 檔,命名為 ipod.ffpreset。

strict=-2

vcodec=libx264
vprofile=baseline
level=30
maxrate=10000000
bufsize=10000000

#preset=fast
preset=slower

crf=19
bf=0
refs=1

ab=192k

調整字幕時間

這個很少用到,在 linux 中,就找到 aegisub 是可用的,那就拿來用了,沒有什麼特別的考慮。

提取 mkv 內嵌字幕

為了要把 mkv 中的字幕,轉成繁體。使用以下三道指令即可:

ffmpeg -i $1.mkv -vn -an -scodec copy $1.ssa
opencc -i $1.ssa -o o.ssa
ffmpeg -i $1 -s 720x406 -vpre ipod -ac 2 -sn -y -vf ass=$1.ssa $1.m4v

參考資料

ffmpeg help

Hyper fast Audio and Video encoder
usage: ffmpeg [options] [[infile options] -i infile]... {[outfile options] outfile}...

Getting help:
    -h      -- print basic options
    -h long -- print more options
    -h full -- print all options (including all format and codec specific options, very long)
    See man ffmpeg for detailed description of the options.

Print help / information / capabilities:
-L                  show license
-h topic            show help
-? topic            show help
-help topic         show help
--help topic        show help
-version            show version
-formats            show available formats
-codecs             show available codecs
-decoders           show available decoders
-encoders           show available encoders
-bsfs               show available bit stream filters
-protocols          show available protocols
-filters            show available filters
-pix_fmts           show available pixel formats
-layouts            show standard channel layouts
-sample_fmts        show available audio sample formats

Global options (affect whole program instead of just one file:
-loglevel loglevel  set libav* logging level
-v loglevel         set libav* logging level
-report             generate a report
-max_alloc bytes    set maximum size of a single allocated block
-y                  overwrite output files
-n                  do not overwrite output files
-stats              print progress report during encoding
-bits_per_raw_sample number  set the number of bits per raw sample
-croptop size       Removed, use the crop filter instead
-cropbottom size    Removed, use the crop filter instead
-cropleft size      Removed, use the crop filter instead
-cropright size     Removed, use the crop filter instead
-padtop size        Removed, use the pad filter instead
-padbottom size     Removed, use the pad filter instead
-padleft size       Removed, use the pad filter instead
-padright size      Removed, use the pad filter instead
-padcolor color     Removed, use the pad filter instead
-vol volume         change audio volume (256=normal)

Per-file main options:
-f fmt              force format
-c codec            codec name
-codec codec        codec name
-pre preset         preset name
-map_metadata outfile[,metadata]:infile[,metadata]  set metadata information of outfile from infile
-t duration         record or transcode "duration" seconds of audio/video
-fs limit_size      set the limit file size in bytes
-ss time_off        set the start time offset
-timestamp time     set the recording timestamp ('now' to set the current time)
-metadata string=string  add metadata
-target type        specify target file type ("vcd", "svcd", "dvd", "dv", "dv50", "pal-vcd", "ntsc-svcd", ...)
-frames number      set the number of frames to record
-filter filter_list  set stream filterchain
-reinit_filter      reinit filtergraph on input parameter changes

Video options:
-vframes number     set the number of video frames to record
-r rate             set frame rate (Hz value, fraction or abbreviation)
-s size             set frame size (WxH or abbreviation)
-aspect aspect      set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)
-bits_per_raw_sample number  set the number of bits per raw sample
-croptop size       Removed, use the crop filter instead
-cropbottom size    Removed, use the crop filter instead
-cropleft size      Removed, use the crop filter instead
-cropright size     Removed, use the crop filter instead
-padtop size        Removed, use the pad filter instead
-padbottom size     Removed, use the pad filter instead
-padleft size       Removed, use the pad filter instead
-padright size      Removed, use the pad filter instead
-padcolor color     Removed, use the pad filter instead
-vn                 disable video
-vcodec codec       force video codec ('copy' to copy stream)
-timecode hh:mm:ss[:;.]ff  set initial TimeCode value.
-pass n             select the pass number (1 to 3)
-vf filter list     video filters
-b bitrate          video bitrate (please use -b:v)
-dn                 disable data

Audio options:
-aframes number     set the number of audio frames to record
-aq quality         set audio quality (codec-specific)
-ar rate            set audio sampling rate (in Hz)
-ac channels        set number of audio channels
-an                 disable audio
-acodec codec       force audio codec ('copy' to copy stream)
-vol volume         change audio volume (256=normal)
-af filter list     audio filters

Subtitle options:
-s size             set frame size (WxH or abbreviation)
-sn                 disable subtitle
-scodec codec       force subtitle codec ('copy' to copy stream)
-stag fourcc/tag    force subtitle tag/fourcc
-fix_sub_duration   fix subtitles duration
-spre preset        set the subtitle options to the indicated preset

參考指令

假設video.avi有一個視頻軌、兩個音頻軌,取其中的視頻軌和第二個音頻軌加sub.ass做成video.mkv而不重新編碼:

ffmpeg -i video.avi -i sub.ass -map 0:0 -map 0:2 -map 1 -c:a copy -c:v copy -c:s copy video.mkv

如果要重新編碼(字幕合成到視頻圖像):

ffmpeg -i video.avi -map 0:0 -map 0:2 -c:a copy -c:v <視頻編碼庫,比如libx264> -vf ass=sub.ass video.mkv

2013年1月21日 星期一

conky 與 conkywx 配置

conky 主要的功能是在桌面上顯示系統資訊,當然也可以顯示其他有趣的資訊。先安裝吧:

$ yaourt -S conky conkywx

說明文件在這裡。

安裝後,就要設定配置檔。google 一下,滿坑滿谷的 screenshot 和 config,只要有想象力,時間,在加上一些耐性,一定可以作出符合自己需要的桌面。

預設的配置檔是放在 $HOME/.conkyrc。在 /etc/conky/conky.conf 這裡有個範例,不過,應該不會有人不改就套用吧。

我是把配置檔放在 ~/.conkyrc,方便未來備份。配置檔很長,放在本文的最後。

conkywx是用來顯示天氣狀況。至少需要兩個檔案:

  • ~/.config/conkywx/conkywx.conf
  • ~/.config/conkywx/template.sh

在 .conkyrc 中用下面的方法連接過去。

template0 "/usr/bin/conkywx"
template1 "/home/mario/.config/conkywx/conkywx.conf"
template2 "/home/mario/.config/conkywx/wx-wu-font-slim-template.sh"

${execpi 7200 ${template0} -c ${template1} -t ${template2}}

conkywx.conf 中設定以下 2 個參數

  • use_xml=0
  • Location=46696

就可以看到松山機場的天氣狀況。其他的地方如下:

conkywx station id

TAIWAN 27-DEC-01
TAIPEI TAOYUAN RCTP 46686 25 04N 121 13E 33 X T 6 TW

MAZU RCFG 46689 26 10N 119 55E 91 X T 7 TW

SUNGSHAN/TAIPEI RCSS 46696 25 04N 121 32E 6 X T 6 TW

TAOYUAN AB RCGM 46697 25 04N 121 13E 45 X 7 TW

DONGSHI RCNO 46730 23 16N 119 40E 45 X 7 TW

MAKUNG AB RCQC 46734 23 34N 119 37E 31 X 7 TW

CHINMEM/SHATOU RCBS 46736 24 25N 118 22E 9 X T 6 TW

PA KUEI/BAKUAI RCUK 46738 24 55N 121 17E 141 X 7 TW

KAOHSIUNG INTL RCKH 46740 22 34N 120 20E 9 X T 6 TW

TAINAN TW-AFB RCNN 46743 22 56N 120 12E 19 X 7 TW

KANGSHAN TW-AFB RCAY 46745 22 46N 120 16E 10 X 7 TW

CHIAYI TW-AFB RCKU 46746 23 28N 120 22E 25 X 7 TW

DONGGANG RCMJ 46747 22 28N 120 25E 8 X 7 TW

PINGTUNG SOUTH RCDC 46750 22 40N 120 28E 24 X 7 TW

TAICHUNG TW-AFB RCLG 46751 24 10N 120 39E 112 X 7 TW

HENGCHUN RCKW 46752 21 55N 120 49E 13 X T 7 TW

HSINCHU TW-AFB RCPO 46756 24 49N 120 55E 8 X 7 TW

PINGTUNG N AFB RCSQ 46758 22 41N 120 28E 29 X 7 TW

CHIHHANG TW-AFB RCQS 46760 22 48N 121 10E 37 X 7 TW

LAN YU RCLY 46762 22 01N 121 32E 325 X T 6 TW

HUALIEN AB RCYU 46763 24 01N 121 37E 16 X 7 TW

ILAN RCMS 46764 24 45N 121 46E 9 X 7 TW

WUCHIA OBSERVATO RCMQ 46770 24 16N 120 37E 5 X 7 TW

CHIA TUNG RCFS 46772 22 25N 120 32E 20 X 7 TW

DONGSHA/PRATAS RCLM 46810 20 40N 116 43E 6 X 7 TW

以下是我的 template 檔,和 .conkyrc 的寫法很接近,只是多了一些新的變數:

${voffset 10}${font DroidSans:bold:size=14}天氣  ${font}${alignc}[SN]  [LU]  ${hr 2}${font}
${voffset 15}${goto 35}${font ConkyWeather:size=64}[PIF]${font}
${voffset -70}${goto 120}${font DejaVu Sans Mono:style=Bold:size=20}[PT]${font}
${goto 120}[CT]
${goto 120}Feels like: [FL]
${goto 120}${color3}UV: [UV] - [UVT]
${voffset 5}${goto 25}[D2D]${goto 75}[D3D]${goto 125}[D4D]${goto 175}[D5D]
${voffset 1}${goto 25}${font ConkyWeather:size=30}[D2F]${goto 75}[D3F]${goto 120}[D4F]${goto 175}[D5F]${font}
${voffset 3}${goto 25}[D2T]${goto 75}[D3T]${goto 125}[D4T]${goto 175}[D5T]${font}
${voffset 3}${goto 35}[D2P]${goto 85}[D3P]${goto 135}[D4P]${goto 185}[D5P]${font}${color}

上面的 [SN]、[LU]、[PT] 等等,就要看這個說明。

以下是我的 .conkyrc 檔:

# .conkyrc by fabsh <fabsh@lamerk.org>
# Based on ideas and code from the CunchBang Linux forums at http://crunchbanglinux.org
# v. 1.0

# Use Xft?
use_xft yes
xftfont DroidSans:size=12
#xftfont DejaVu Sans:size=12
xftalpha 0.8
text_buffer_size 2048

# Update interval in seconds
update_interval 1

# This is the number of times Conky will update before quitting.
# Set to zero to run forever.
total_run_times 0

own_window yes
#own_window_transparent yes
#own_window_type override
#own_window_type desktop
#own_window_type normal #use this if you want a nice shadow to appear around conky

# If own_window is yes, these window manager hints may be used #設置conky為沒有邊框等等。
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager

##################################
# 半透明
# yaourt -S compton-git
##################################
#own_window_class Conky
own_window yes
#設置conky的窗口屬性 desktop/NORMAL
own_window_type normal      #use this if you want a nice shadow to appear around conky
#設置conky的默認背景色
own_window_colour 222222
#很重要,只有啟用argb才能透明,但是如果窗口屬性如果設置為override,可能無法生效
own_window_argb_visual yes
#設置透明的alpha值0-255,0為透明,255不透明
own_window_argb_value 10
#如果啟用own_window_transparent,窗口完全透明,alpha值不起作用
own_window_transparent no   #yes
##################################

# Use double buffering (reduces flicker, may not work for everyone)
double_buffer yes

# Minimum size of text area
#minimum_size 180 0     # 重啟才有效
maximum_width 200

# Draw shades?
draw_shades no

# Draw outlines?
draw_outline no

# Draw borders around text
draw_borders no

# Stippled borders?
stippled_borders 0

# border margins
border_margin 5

# border width
border_width 0

# Default colors and also border colors
default_color white
#default_shade_color black
#default_outline_color grey
#own_window_colour grey
#color red,green,yellow,blue,magenta,cyan,black,white.
color1 FA9E10

# 相對於螢幕,Text alignment, other possible values are commented
alignment top_right
#alignment top_left
#alignment top_middle
#alignment bottom_left
#alignment bottom_right

# Gap between borders of screen and text
# same thing as passing -x at command line
border_inner_margin 15
gap_x 30
gap_y 30

# Subtract file system buffers from used memory?
no_buffers yes

# set to yes if you want all text to be in uppercase
uppercase no

# number of cpu samples to average
# set to 1 to disable averaging
cpu_avg_samples 2

# number of net samples to average
# set to 1 to disable averaging
net_avg_samples 1

# Force UTF8? note that UTF8 support required XFT
override_utf8_locale yes

# Add spaces to keep things from moving about? This only affects certain objects.
use_spacer none

short_units yes

#########################
# 天氣: conkywx 要用的設定檔
#########################
template0 "/usr/bin/conkywx"
template1 "/home/mario/.config/conkywx/conkywx.conf"
template2 "/home/mario/.config/conkywx/wx-wu-font-slim-template.sh"

TEXT
###################################
# SYSTEM
###################################
${font DroidSans:bold:size=16}${color1}SYSTEM ${hr 2}${font}${color}
#${alignc 24}${font Arial Black:size=14}${nodename}${font}
#${alignc -8}HP Pavilion dv2500nr
#${voffset 2}${font Arial Black:style=Bold:size=12}#!${font} CrunchBang Linux ${alignr}08.10.01
${font OpenLogos:size=14}u${font} Kernel: ${alignr}${kernel}
${font StyleBats:size=14}q${font} Uptime: ${alignr}${uptime}
#${font StyleBats:size=14}A${font} CPU : ${font} ${alignr}${cpubar cpu0 8,60}

${font DroidSans:bold:size=16}CPU: ${font}${hwmon 0 temp 1}°C $alignr${freq_g 1}GHz   ${cpugraph cpu0 8,60}
${font StyleBats:size=14}A${font} CPU1: ${cpu cpu1}% ${alignr}${cpubar cpu1 8,80}
${font StyleBats:size=14}A${font} CPU2: ${cpu cpu2}% ${alignr}${cpubar cpu2 8,80}
${font StyleBats:size=14}A${font} CPU3: ${cpu cpu3}% ${alignr}${cpubar cpu3 8,80}
${font StyleBats:size=14}A${font} CPU4: ${cpu cpu4}% ${alignr}${cpubar cpu4 8,80}
${font StyleBats:size=14}g${font} RAM: $mem/$memmax ${alignr}$memperc% ${membar 8,40}
${font StyleBats:size=14}j${font} SWAP: $swapperc% ${alignr}${swapbar 8,80}

${font DroidSans:bold:size=14}NAME          ${goto 100}CPU%            ${goto 150}${alignr}MEM%${font}
${top name 1} ${goto 100}${top cpu 1}    ${goto 160}${alignr}${top mem 1}
${top name 2} ${goto 100}${top cpu 2}    ${goto 160}${alignr}${top mem 2}
${top name 3} ${goto 100}${top cpu 3}    ${goto 160}${alignr}${top mem 3}
${top name 4} ${goto 100}${top cpu 4}    ${goto 160}${alignr}${top mem 4}
${top name 5} ${goto 100}${top cpu 5}    ${goto 160}${alignr}${top mem 5}
#${font Webdings:size=14}~${font} Battery: ${battery_percent BAT0}% ${alignr}${battery_bar 8,60 BAT0}

##################################
# DATE
##################################
${font DroidSans:bold:size=16}${color1}DATE ${hr 2}${font}${color}
${voffset 3}${font DroidSans:size=18}${alignc}${time %A, %d %B %Y}${font}
${voffset 10}${font DroidSans:bold:size=24}${alignc}${time %H:%M}${font}
##################################
#WEATHER ${hr 2}
##################################
${execpi 7200 ${template0} -c ${template1} -t ${template2}}

##################################
# HD
##################################
${voffset -4}${font DroidSans:bold:size=16}${color1}HD ${hr 2}${font}${color}
${voffset 4}${font Pie charts for maps:size=14}7${font}Root: ${alignr}${fs_used /}/${fs_size /}   ${fs_bar 8,60 /}

##################################
# NETWORK
##################################
${font DroidSans:bold:size=16}${color1}NETWORK ${font}${alignr}${addrs ppp0}${color}
${voffset 0}${font PizzaDude Bullets:size=14}O${font} Up: ${upspeed eth0}${alignr}${upspeedgraph eth0 8,60 black black}
${voffset 4}${font PizzaDude Bullets:size=14}U${font} Down: ${downspeed eth0}${alignr}${downspeedgraph eth0 8,60 black black}
${voffset 4}${font PizzaDude Bullets:size=14}N${font} Upload: ${alignr}${totalup eth0}
${voffset 4}${font PizzaDude Bullets:size=14}T${font} Download: ${alignr}${totaldown eth0}
##################################
# MPD
##################################
${if_mpd_playing}
${font DroidSans:bold:size=16}${color1}MPD${font} ${alignr}${mpd_vol}  ${mpd_bar 2,100}  ${mpd_length}${color}
${voffset 4}${mpd_album}
${voffset 4}${mpd_artist}
${voffset 4}${mpd_title}
${endif}

顏色有 red,green,yellow,blue,magenta,cyan,black,white。

也可以設定數值,如下

# 夢幻的橘色
color1 FA9E10

2013年1月19日 星期六

k10temp: unreliable CPU thermal sensor

boot 時,發現 k10temp 的錯誤訊息:

$ dmesg | grep k10temp
k10temp 0000:00:18.3: unreliable CPU thermal sensor; monitoring disabled

查到 Archlinux Wiki 提到:

K10Temp Module

Some K10 processors have issues with their temperature sensor. From the kernel documentation (linux-/Documentation/hwmon/k10temp):

All these processors have a sensor, but on those for Socket F or AM2+, the sensor may return inconsistent values (erratum 319). The driver will refuse to load on these revisions unless you specify the force=1 module parameter.

Due to technical reasons, the driver can detect only the mainboard's socket type, not the processor's actual capabilities. Therefore, if you are using an AM3 processor on an AM2+ mainboard, you can safely use the force=1 parameter.

On affected machines the module will report "unreliable CPU thermal sensor; monitoring disabled". If you still want to use the module you can:

  # rmmod k10temp

  # modprobe k10temp force=1

Confirm with Lm_sensors#Testing your lm_sensors that the sensor is in fact valid and reliable. If it is, you can edit /etc/modprobe.d/k10temp.conf and add:

  options k10temp force=1

This will allow the module to load at boot.

修改/新增 /etc/modprobe.d/k10temp.conf,重開機後,執行

$ sensors

會多看到以下的結果:

k10temp-pci-00c3
Adapter: PCI adapter
temp1:        +26.2°C  (high = +70.0°C)
                      (crit = +90.0°C, hyst = +88.0°C)

這樣算是 OK 吧。

2013年1月16日 星期三

終於把 wine picasa 3.9 裝上了

終於把 wine picasa 3.9 裝上了

參考How would I install Picasa 3.9

$ sudo pacman -S wine winetricks
$ cd ~/ && wget http://dl.google.com/picasa/picasa39-setup.exe
$ wine ~/picasa39-setup

Wine 會去安裝 Mono、Gecko,前者是為了.NET,後者是為了 html。
然後就開始安裝 picasa,把該裝的包都裝上。

接下來裝 Internet Explorer 6,這是為了能將照片上傳到 google+:

$ env WINEARCH=win32 WINEPREFIX=~/.tmp winetricks ie6

結果還是無法啟動 picasa 3.9,真讓人洩氣。安裝到最後,總是出現錯誤訊息。

google 了許久,終於找到這篇,
就試著把 lib32-lcms 也裝上:

$ pacman -S lib32-lcms

哈哈哈,竟然就成功了,而且也可以把圖片上傳到 google+。

目前的問題是:picasa可以正常開啟,但是,無法顯示目錄名稱。不過,我相信一定可以找到方法解決的。

$ sudo pacman -S lib32-libpng

err:ntdll:RtlpWaitForCriticalSection