-
-
Notifications
You must be signed in to change notification settings - Fork 703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated sway-hide work to the latest master #1241
Closed
Closed
Changes from 15 commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
013bfb9
Add suppport for displaying Waybar as an overlay layer
nyyManni 0840184
Add module sway/hide for swaybar integration
nyyManni 0e32cff
Use layer shell version 2
somini 4ecb22b
(does not build) try to use barconfig_update
xPMo 4ec1718
fix: thanks nyyManni
xPMo 551973a
Define bar setVisible method
somini 2253f3e
Include mutext on Hide::onEvent
somini f1cd85f
Improve debug logs
somini af0b182
Remove support for "overlay" layer
somini d427a5b
Hide the bar on creation, in "hide" mode
somini 3b15645
Use logging module
somini 979a478
Don't auto-hide the bar on start
somini 92fb316
Merge remote-tracking branch 'alexays/master' into HEAD
emirror-de e2590fc
Removed unnecessary functions and methods.
emirror-de 13fbf81
Bugfix, set_opacity statements lead to address boundary SIGSEGV.
emirror-de 1c7133c
Updated layer settings.
emirror-de 564e231
Exclusive zone is now removed on intialization of the hide module.
emirror-de 2e28531
sway/hide: Enable exclusive zone on {"mode":"dock"}
xPMo 208351c
sway/hide: Print at debug level when receiving visible_by_modifier
xPMo 24a8e85
Reset unnecessary change of function declaration.
emirror-de 11337dc
Fixed wl_surface_commit call.
emirror-de 00ca332
Merge remote-tracking branch 'xPMo/sway-hide' into sway-hide-updated
emirror-de 0aecb78
Restored implementation of setVisible (to master branch state).
emirror-de 6c3b7e4
Replaced enable-/removeExclusiveZone by setExclusive.
emirror-de c11aecd
Modifier key now sends the bar to TOP or BOTTOM layer, hidden class g…
emirror-de 73de008
The sway/hide module is now limited to the bar passed by the construc…
emirror-de 09da1f0
The mode value is now overridden to "hide" on construction of modules…
emirror-de 8549996
Merge branch 'Alexays:master' into sway-hide-updated
emirror-de 55ff12a
Changed how mutex is locked.
emirror-de e276e61
Merge branch 'sway-hide-updated' of github.com:emirror-de/Waybar into…
emirror-de c502e25
Merge branch 'master' into sway-hide-updated
emirror-de cf2312f
Added config parameter to hide the bar on startup.
emirror-de 48f1a8f
Merge branch 'master' into sway-hide-updated
emirror-de d9de7c4
Refactoring sway/hide module, added hide-to-bottom-layer option
emirror-de 0cee530
Config option hide-to-bottom-layer is now queried separately
emirror-de 3e21eb8
Replaced worker method by a call to ipc_.setWorker.
emirror-de File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#pragma once | ||
|
||
#include <fmt/format.h> | ||
#include <tuple> | ||
#include <mutex> | ||
#include "ALabel.hpp" | ||
#include "bar.hpp" | ||
#include "client.hpp" | ||
#include "modules/sway/ipc/client.hpp" | ||
#include "util/json.hpp" | ||
#include "util/sleeper_thread.hpp" | ||
|
||
namespace waybar::modules::sway { | ||
|
||
class Hide : public ALabel, public sigc::trackable { | ||
public: | ||
Hide(const std::string&, const waybar::Bar&, const Json::Value&); | ||
~Hide() = default; | ||
auto update() -> void; | ||
|
||
private: | ||
void onEvent(const struct Ipc::ipc_response&); | ||
void worker(); | ||
|
||
std::string current_mode_; | ||
bool visible_by_modifier_; | ||
const Bar& bar_; | ||
std::string window_; | ||
int windowId_; | ||
util::JsonParser parser_; | ||
|
||
util::SleeperThread thread_; | ||
std::mutex mutex_; | ||
Ipc ipc_; | ||
}; | ||
|
||
} // namespace waybar::modules::sway |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#include "modules/sway/hide.hpp" | ||
#include <spdlog/spdlog.h> | ||
#include "client.hpp" | ||
#include "wlr-layer-shell-unstable-v1-client-protocol.h" | ||
|
||
namespace waybar::modules::sway { | ||
|
||
Hide::Hide(const std::string& id, const Bar& bar, const Json::Value& config) | ||
: ALabel(config, "hide", id, "{}", 0, true), bar_(bar), windowId_(-1) { | ||
ipc_.subscribe(R"(["bar_state_update","barconfig_update"])"); | ||
ipc_.signal_event.connect(sigc::mem_fun(*this, &Hide::onEvent)); | ||
// Launch worker | ||
worker(); | ||
} | ||
|
||
void Hide::onEvent(const struct Ipc::ipc_response& res) { | ||
auto payload = parser_.parse(res.payload); | ||
std::lock_guard<std::mutex> lock(mutex_); | ||
if (payload.isMember("mode")) { | ||
// barconfig_update: get mode | ||
auto mode = payload["mode"].asString(); | ||
if (mode == "hide") { | ||
// Hide the bars when configuring the "hide" bar | ||
for (auto& bar : waybar::Client::inst()->bars) { | ||
bar->setVisible(false); | ||
} | ||
} | ||
emirror-de marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} else if (payload.isMember("visible_by_modifier")) { | ||
// bar_state_update: get visible_by_modifier | ||
visible_by_modifier_ = payload["visible_by_modifier"].asBool(); | ||
spdlog::info("WayBar Shown: {}", visible_by_modifier_); | ||
emirror-de marked this conversation as resolved.
Show resolved
Hide resolved
|
||
for (auto& bar : waybar::Client::inst()->bars) { | ||
bar->setVisible(visible_by_modifier_); | ||
} | ||
} | ||
} | ||
|
||
void Hide::worker() { | ||
thread_ = [this] { | ||
try { | ||
ipc_.handleEvent(); | ||
} catch (const std::exception& e) { | ||
spdlog::error("Hide: {}", e.what()); | ||
} | ||
}; | ||
} | ||
|
||
auto Hide::update() -> void { | ||
} | ||
} // namespace waybar::modules::sway |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extraneous
wl_surface_commit
is known to be able to crash Gtk in certain cases (as found and fixed in gtk-layer-shell). Also, surface can be unset you call that on an unmapped window.That's why the code in master branch is calling
surface_impl_->commit()
which is noop for the most cases.