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} 

答案1

正如 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} 

答案2

我刚刚注意到,要向左对齐,您只需从行中删除任何${alignr}and即可。${alignc}

相关内容