From 423cc1720fe9f9dbf71dff877768b69014c17e9c Mon Sep 17 00:00:00 2001 From: Mathis Weber <83180705+Zaphoood@users.noreply.github.com> Date: Mon, 2 May 2022 12:54:03 +0200 Subject: [PATCH] fs: fallback if no mountpoints specified (#2705) Ref #2572 --- CHANGELOG.md | 3 +++ src/modules/fs.cpp | 6 +++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b67c749e..fd6313a4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Added experimental support for positioning the tray like a module - `internal/backlight`: `scroll-interval` option ([`#2696`](https://github.com/polybar/polybar/issues/2696), [`#2700`](https://github.com/polybar/polybar/pull/2700)) +### Changed +- `internal/fs`: Use `/` as a fallback if no mountpoints are specified ([`#2572`](https://github.com/polybar/polybar/issues/2572), [`#2705`](https://github.com/polybar/polybar/pull/2705)) + ### Fixed - Waiting for double click interval on modules that don't have a double click action ([`#2663`](https://github.com/polybar/polybar/issues/2663), [`#2695`](https://github.com/polybar/polybar/pull/2695)) diff --git a/src/modules/fs.cpp b/src/modules/fs.cpp index e13ef443..ad1ac250 100644 --- a/src/modules/fs.cpp +++ b/src/modules/fs.cpp @@ -27,7 +27,11 @@ namespace modules { * setting up required components */ fs_module::fs_module(const bar_settings& bar, string name_) : timer_module(bar, move(name_)) { - m_mountpoints = m_conf.get_list(name(), "mount"); + m_mountpoints = m_conf.get_list(name(), "mount", {}); + if (m_mountpoints.empty()) { + m_log.info("%s: No mountpoints specified, using fallback \"/\"", name()); + m_mountpoints.emplace_back("/"); + } m_remove_unmounted = m_conf.get(name(), "remove-unmounted", m_remove_unmounted); m_perc_used_warn = m_conf.get(name(), "warn-percentage", 90); m_fixed = m_conf.get(name(), "fixed-values", m_fixed);