Skip to content

Commit 533e7dd

Browse files
Issue 1399: Restore app_id style behaviour
The man page says that app_id should only be set as a class when it is the only window in the workspace. This commit restores this behaviour.
1 parent 179739f commit 533e7dd

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/modules/sway/window.cpp

+8-4
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,6 @@ void Window::updateAppIcon() {
9393
}
9494

9595
auto Window::update() -> void {
96-
if (!old_app_id_.empty()) {
97-
bar_.window.get_style_context()->remove_class(old_app_id_);
98-
}
9996
spdlog::trace("workspace layout {}, tiled count {}, floating count {}", layout_, app_nb_, floating_count_ );
10097

10198
int mode = 0;
@@ -121,14 +118,21 @@ auto Window::update() -> void {
121118
}
122119
}
123120

121+
if (!old_app_id_.empty() && ((mode &2) == 0 || old_app_id_ != app_id_) && bar_.window.get_style_context()->has_class(old_app_id_)) {
122+
spdlog::trace("Removing app_id class: {}", old_app_id_);
123+
bar_.window.get_style_context()->remove_class(old_app_id_);
124+
old_app_id_="";
125+
}
126+
124127
setClass("empty", ((mode &1) > 0));
125128
setClass("solo", ((mode &2) > 0));
126129
setClass("floating", ((mode &4) > 0));
127130
setClass("tabbed", ((mode &8) > 0));
128131
setClass("stacked", ((mode &16) > 0));
129132
setClass("tiled", ((mode &32) > 0));
130133

131-
if (!app_id_.empty() && !bar_.window.get_style_context()->has_class(app_id_)) {
134+
if ((mode &2) > 0 && !app_id_.empty() && !bar_.window.get_style_context()->has_class(app_id_)) {
135+
spdlog::trace("Adding app_id class: {}", app_id_);
132136
bar_.window.get_style_context()->add_class(app_id_);
133137
old_app_id_ = app_id_;
134138
}

0 commit comments

Comments
 (0)