mirror of
https://github.com/Llewellynvdm/conky.git
synced 2025-03-19 17:42:22 +00:00
Show warnings when not running in X and vars like desktop or monitor are used
This commit is contained in:
parent
4ec308ef12
commit
63a8c677b3
@ -656,6 +656,7 @@
|
|||||||
</command>
|
</command>
|
||||||
</term>
|
</term>
|
||||||
<listitem>Number of the desktop on which conky is running
|
<listitem>Number of the desktop on which conky is running
|
||||||
|
or the message "Not running in X" if this is the case.
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
@ -665,6 +666,7 @@
|
|||||||
</command>
|
</command>
|
||||||
</term>
|
</term>
|
||||||
<listitem>Name of the desktop on which conky is running
|
<listitem>Name of the desktop on which conky is running
|
||||||
|
or the message "Not running in X" if this is the case.
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
@ -673,7 +675,8 @@
|
|||||||
<option>desktop_number</option>
|
<option>desktop_number</option>
|
||||||
</command>
|
</command>
|
||||||
</term>
|
</term>
|
||||||
<listitem>Number of desktops
|
<listitem>Number of desktops or the message "Not running
|
||||||
|
in X" if this is the case.
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
@ -2149,6 +2152,7 @@
|
|||||||
</command>
|
</command>
|
||||||
</term>
|
</term>
|
||||||
<listitem>Number of the monitor on which conky is running
|
<listitem>Number of the monitor on which conky is running
|
||||||
|
or the message "Not running in X" if this is the case.
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
@ -2157,7 +2161,8 @@
|
|||||||
<option>monitor_number</option>
|
<option>monitor_number</option>
|
||||||
</command>
|
</command>
|
||||||
</term>
|
</term>
|
||||||
<listitem>Number of monitors
|
<listitem>Number of monitors or the message "Not running
|
||||||
|
in X" if this is the case.
|
||||||
<para /></listitem>
|
<para /></listitem>
|
||||||
</varlistentry>
|
</varlistentry>
|
||||||
<varlistentry>
|
<varlistentry>
|
||||||
|
@ -453,7 +453,7 @@ void update_stuff(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
if (NEED(INFO_X11)) {
|
if (NEED(INFO_X11) && x_initialised == YES) {
|
||||||
update_x11info();
|
update_x11info();
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
33
src/conky.c
33
src/conky.c
@ -4923,22 +4923,41 @@ static void generate_text_internal(char *p, int p_max_size,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#ifdef X11
|
#ifdef X11
|
||||||
|
#define NOT_IN_X "Not running in X"
|
||||||
OBJ(monitor) {
|
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) {
|
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) {
|
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) {
|
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) {
|
OBJ(desktop_name) {
|
||||||
if(cur->x11.desktop.name != NULL) {
|
if(x_initialised != YES) {
|
||||||
strncpy(p, cur->x11.desktop.name, p_max_size);
|
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 */
|
#endif /* X11 */
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user