1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-10-27 05:23:39 -04:00
polybar/include/drawtypes/iconset.hpp
Ron0Studios 303015244e
feat: longest match ws-icon fuzzy matching (#2831)
* better fuzzy matching

Improved fuzzy matching so that it finds the longest matching icon instead of the first possible match

* Update CHANGELOG.md

* removed debug output

* added tests and improved fuzzy finder

- added return statements to the fuzzy finder
- added tests to check whether the fuzzy finder works.

* minor style changes

* minor change to iconset.cpp

* Delete tasks.json
2022-10-05 23:05:44 +02:00

26 lines
532 B
C++

#pragma once
#include <map>
#include "common.hpp"
#include "drawtypes/label.hpp"
#include "utils/mixins.hpp"
POLYBAR_NS
namespace drawtypes {
class iconset : public non_copyable_mixin {
public:
void add(string id, label_t&& icon);
bool has(const string& id);
label_t get(const string& id, const string& fallback_id = "", bool fuzzy_match = false);
operator bool();
protected:
std::map<string, label_t> m_icons;
};
using iconset_t = shared_ptr<iconset>;
} // namespace drawtypes
POLYBAR_NS_END