Skip to content

Commit

Permalink
fix: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexays committed Jul 4, 2023
1 parent 31e4c90 commit fc632f5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
17 changes: 8 additions & 9 deletions src/modules/mpris/mpris.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@ Mpris::Mpris(const std::string& id, const Json::Value& config)
// "dynamic-priority" has been kept for backward compatibility
if (config_["dynamic-importance-order"].isArray() || config_["dynamic-priority"].isArray()) {
dynamic_prio_.clear();
const auto& dynamic_priority = config_["dynamic-importance-order"].isArray() ? config_["dynamic-importance-order"] : config_["dynamic-priority"];
const auto& dynamic_priority = config_["dynamic-importance-order"].isArray()
? config_["dynamic-importance-order"]
: config_["dynamic-priority"];
for (const auto& value : dynamic_priority) {
if (value.isString()) {
dynamic_prio_.push_back(value.asString());
Expand Down Expand Up @@ -299,9 +301,9 @@ auto Mpris::getDynamicStr(const PlayerInfo& info, bool truncated, bool html) ->
"position") != dynamic_order_.end());

if (truncated && dynamic_len_ >= 0) {
//Since the first element doesn't present a separator and we don't know a priori which one
//it will be, we add a "virtual separatorLen" to the dynamicLen, since we are adding the
//separatorLen to all the other lengths.
// Since the first element doesn't present a separator and we don't know a priori which one
// it will be, we add a "virtual separatorLen" to the dynamicLen, since we are adding the
// separatorLen to all the other lengths.
size_t separatorLen = utf8_width(dynamic_separator_);
size_t dynamicLen = dynamic_len_ + separatorLen;
if (showArtist) artistLen += separatorLen;
Expand Down Expand Up @@ -361,12 +363,9 @@ auto Mpris::getDynamicStr(const PlayerInfo& info, bool truncated, bool html) ->
std::string previousOrder = "";

for (const std::string& order : dynamic_order_) {
if ((order == "artist" && showArtist) ||
(order == "album" && showAlbum) ||
if ((order == "artist" && showArtist) || (order == "album" && showAlbum) ||
(order == "title" && showTitle)) {
if (previousShown &&
previousOrder != "length" &&
previousOrder != "position") {
if (previousShown && previousOrder != "length" && previousOrder != "position") {
dynamic << dynamic_separator_;
}

Expand Down
4 changes: 2 additions & 2 deletions src/modules/sway/workspaces.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -328,15 +328,15 @@ bool Workspaces::handleScroll(GdkEventScroll *e) {
}
}
if (!config_["warp-on-scroll"].asBool()) {
ipc_.sendCmd(IPC_COMMAND, fmt::format("mouse_warping none"));
ipc_.sendCmd(IPC_COMMAND, fmt::format("mouse_warping none"));
}
try {
ipc_.sendCmd(IPC_COMMAND, fmt::format(workspace_switch_cmd_, "--no-auto-back-and-forth", name));
} catch (const std::exception &e) {
spdlog::error("Workspaces: {}", e.what());
}
if (!config_["warp-on-scroll"].asBool()) {
ipc_.sendCmd(IPC_COMMAND, fmt::format("mouse_warping container"));
ipc_.sendCmd(IPC_COMMAND, fmt::format("mouse_warping container"));
}
return true;
}
Expand Down

0 comments on commit fc632f5

Please sign in to comment.