1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2025-02-04 13:08:31 +00:00

Show warnings when not running in X and vars like desktop or monitor are used

This commit is contained in:
Nikolas Garofil 2009-07-16 00:31:22 +02:00
parent 4ec308ef12
commit 63a8c677b3
3 changed files with 34 additions and 10 deletions

View File

@ -656,6 +656,7 @@
</command>
</term>
<listitem>Number of the desktop on which conky is running
or the message "Not running in X" if this is the case.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -665,6 +666,7 @@
</command>
</term>
<listitem>Name of the desktop on which conky is running
or the message "Not running in X" if this is the case.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -673,7 +675,8 @@
<option>desktop_number</option>
</command>
</term>
<listitem>Number of desktops
<listitem>Number of desktops or the message "Not running
in X" if this is the case.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -2149,6 +2152,7 @@
</command>
</term>
<listitem>Number of the monitor on which conky is running
or the message "Not running in X" if this is the case.
<para /></listitem>
</varlistentry>
<varlistentry>
@ -2157,7 +2161,8 @@
<option>monitor_number</option>
</command>
</term>
<listitem>Number of monitors
<listitem>Number of monitors or the message "Not running
in X" if this is the case.
<para /></listitem>
</varlistentry>
<varlistentry>

View File

@ -453,7 +453,7 @@ void update_stuff(void)
}
#ifdef X11
if (NEED(INFO_X11)) {
if (NEED(INFO_X11) && x_initialised == YES) {
update_x11info();
}
#endif

View File

@ -4923,22 +4923,41 @@ static void generate_text_internal(char *p, int p_max_size,
}
}
#ifdef X11
#define NOT_IN_X "Not running in X"
OBJ(monitor) {
snprintf(p, p_max_size, "%d", cur->x11.monitor.current);
if(x_initialised != YES) {
strncpy(p, NOT_IN_X, p_max_size);
}else{
snprintf(p, p_max_size, "%d", cur->x11.monitor.current);
}
}
OBJ(monitor_number) {
snprintf(p, p_max_size, "%d", cur->x11.monitor.number);
if(x_initialised != YES) {
strncpy(p, NOT_IN_X, p_max_size);
}else{
snprintf(p, p_max_size, "%d", cur->x11.monitor.number);
}
}
OBJ(desktop) {
snprintf(p, p_max_size, "%d", cur->x11.desktop.current);
if(x_initialised != YES) {
strncpy(p, NOT_IN_X, p_max_size);
}else{
snprintf(p, p_max_size, "%d", cur->x11.desktop.current);
}
}
OBJ(desktop_number) {
snprintf(p, p_max_size, "%d", cur->x11.desktop.number);
if(x_initialised != YES) {
strncpy(p, NOT_IN_X, p_max_size);
}else{
snprintf(p, p_max_size, "%d", cur->x11.desktop.number);
}
}
OBJ(desktop_name) {
if(cur->x11.desktop.name != NULL) {
strncpy(p, cur->x11.desktop.name, p_max_size);
}
if(x_initialised != YES) {
strncpy(p, NOT_IN_X, p_max_size);
}else if(cur->x11.desktop.name != NULL) {
strncpy(p, cur->x11.desktop.name, p_max_size);
}
}
#endif /* X11 */