Conky
Conky 資訊欄左右對齊
我想使用 conky 建構一個簡單的資訊欄。舉個例子:
dropbox zotero
應該左對齊。
SSID: Hier Volume...
應該向右對齊。目前我正在使用
{offset 800}
將第二個輸出向右移動。但是,當正確的輸出發生變化時,這是非常不靈活的。有時它超出了我的螢幕。
.conkyrc
:background yes use_xft yes xftfont Noto Sans:size=10 xftalpha 1 update_interval 1 total_run_times 0 # Run in own window own_window yes own_window_transparent yes own_window_type desktop # Don't show in window lists and on all desktops own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager own_window_colour white double_buffer yes draw_shades no draw_outline no draw_borders no draw_graph_borders no default_color black alignment tl maximum_width 1280 minimum_size 1280 gap_x 0 gap_y 2 no_buffers yes uppercase no cpu_avg_samples 2 override_utf8_locale no ############################################## # Output ############################################## TEXT ${exec basename $(ps -efa | grep dropbox |grep -v 'grep ' | awk '{print $NF}')} \ ${exec basename $(ps -efa | grep zotero |grep -v 'grep ' | awk '{print $NF}')} \ ${offset 800} ${battery BAT0} \ SSID: ${wireless_essid wls1} \ Volume: ${exec amixer -c 0 get Master | grep Mono: | awk '{print $(NF-2)}'} ${exec amixer -c 0 get Master | grep Mono: | awk '{print $NF}'} \ Keyboard: ${exec setxkbmap -print | awk -F"+" '/xkb_symbols/ {print $2}'} \ ${time %H:%M} \ ${time %a %d %b %Y}
正如 Ash 在評論中所說,這樣做的方法是
$alignr
/$alignl
。就像是:TEXT ${exec basename $(ps -efa | grep dropbox |grep -v 'grep ' | awk '{print $NF}')} \ ${exec basename $(ps -efa | grep firefox |grep -v 'grep ' | awk '{print $NF}')} \ $alignr ${battery BAT0} SSID: ${wireless_essid wlan0} Volume: ${exec amixer -c 0 get Master | grep Mono: | awk '{print $(NF-2)}'} ${exec amixer -c 0 get Master | grep Mono: | awk '{print $NF}'} \ Keyboard: ${exec setxkbmap -print | awk -F"+" '/xkb_symbols/ {print $2}'} \ ${time %H:%M} \ ${time %a %d %b %Y}