diff --git a/doc/variables.xml b/doc/variables.xml
index b8336c5b..19b078ba 100644
--- a/doc/variables.xml
+++ b/doc/variables.xml
@@ -1094,7 +1094,8 @@
Bar that shows how much space is free on a file
system. height is the height in pixels. fs is any file on
- that file system.
+ that file system. This uses f_bfree (as per man 2 statfs)
+ if it's available, or f_bavail as a fallback.
@@ -1104,7 +1105,9 @@
- Free space on a file system available for users.
+ Free space on a file system. This uses f_bfree
+ (as per man 2 statfs) if it's available, or f_bavail as a
+ fallback.
@@ -1114,8 +1117,9 @@
- Free percentage of space on a file system
- available for users.
+ Free percentage of space on a file system. This
+ uses f_bfree (as per man 2 statfs) if it's available, or
+ f_bavail as a fallback.
@@ -1145,7 +1149,8 @@
- File system used space.
+ File system used space. This uses f_bfree (as per
+ man 2 statfs) if it's available, or f_bavail as a fallback.
@@ -1155,7 +1160,9 @@
- Percent of file system used space.
+ Percent of file system used space. This uses
+ f_bfree (as per man 2 statfs) if it's available, or
+ f_bavail as a fallback.
diff --git a/src/conky.c b/src/conky.c
index f498ae59..98492b66 100644
--- a/src/conky.c
+++ b/src/conky.c
@@ -4327,13 +4327,19 @@ static void generate_text_internal(char *p, int p_max_size,
#ifdef X11
if(output_methods & TO_X) {
new_bar(p, obj->data.fsbar.w, obj->data.fsbar.h,
- (int) (255 - obj->data.fsbar.fs->avail * 255 /
- obj->data.fs->size));
+ (int) (255 - (obj->data.fs->free ?
+ obj->data.fs->free :
+ obj->data.fsbar.fs->avail) * 255 /
+ obj->data.fs->size));
}else{
#endif /* X11 */
if(!obj->data.fsbar.w) obj->data.fsbar.w = DEFAULT_BAR_WIDTH_NO_X;
- new_bar_in_shell(p, p_max_size,
- (int) (100 - obj->data.fsbar.fs->avail * 100 / obj->data.fs->size), obj->data.fsbar.w);
+ new_bar_in_shell(p, p_max_size, (int) (100 -
+ (obj->data.fs->free ?
+ obj->data.fs->free :
+ obj->data.fsbar.fs->avail) * 100 /
+ obj->data.fs->size),
+ obj->data.fsbar.w);
#ifdef X11
}
#endif /* X11 */
@@ -4391,13 +4397,17 @@ static void generate_text_internal(char *p, int p_max_size,
#ifdef X11
if(output_methods & TO_X) {
new_bar(p, obj->data.fsbar.w, obj->data.fsbar.h,
- (int) (obj->data.fsbar.fs->avail * 255 /
- obj->data.fs->size));
+ (int) ((obj->data.fs->free ?
+ obj->data.fs->free :
+ obj->data.fsbar.fs->avail) * 255 /
+ obj->data.fs->size));
}else{
#endif /* X11 */
if(!obj->data.fsbar.w) obj->data.fsbar.w = DEFAULT_BAR_WIDTH_NO_X;
- new_bar_in_shell(p, p_max_size,
- (int) (obj->data.fsbar.fs->avail * 100 / obj->data.fs->size), obj->data.fsbar.w);
+ new_bar_in_shell(p, p_max_size, (int)
+ ((obj->data.fs->free ? obj->data.fs->free :
+ obj->data.fsbar.fs->avail) * 100 /
+ obj->data.fs->size), obj->data.fsbar.w);
#ifdef X11
}
#endif /* X11 */