Commit Graph

82 Commits

Author SHA1 Message Date
Alex 3e1176e896 fix: lint 2023-07-18 08:35:46 +02:00
Alexis Rouillard 52a8b1d911
Merge pull request #2234 from kris7t/offscreen-app-id
sway/window: app_id on unfocused workspaces
2023-07-18 08:32:32 +02:00
MisterPine a8a1a4985f
Add removed secondary identifier
(class for xwayland under sway)
2023-07-10 23:48:18 +02:00
MisterPine 31683d9e2a
Implemented AAppIconLabel for sway/window 2023-07-10 22:55:46 +02:00
zjeffer 7ef80d563b Formatting fixes 2023-07-04 19:48:04 +02:00
André Aparício a1cd0acac5 Fix random segfault on GTK icon functions
The segfaults were happening on GTK icon theme functions, which are
called via the C++ interface functions such as Gtk::IconTheme::has_icon.

There are multiple modules and threads using this functions on the default
icon theme by calling Gtk::IconTheme::get_default(), which returns the same
object for all callers, and was causing concurrent access to the same internal
data structures on the GTK lib. Even a seemingly read-only function such as
has_icon can cause writes due to the internal icon cache being updated.

To avoid this issues, a program wide global mutex must be used to ensure
a single thread is accessing the default icon theme instance.

This commit implements wrappers for the existing IconTheme function calls,
ensuring the global lock is held while calling the underling GTK functions.
2023-07-03 22:32:24 +01:00
Kristóf Marussy 5bfdbf116d
sway/window: app_id on unfocused workspaces
If the unfocused workspace has a single window, use window-specific
styling when offscreen-css is enabled.
2023-06-13 01:52:13 +02:00
Rene D. Obermueller fff4509723 sway/window: fix appid style not cleared (#2227)
Probably a rebase error during development of #1419. The code block now
removed was not supposed to be there anymore.
2023-06-11 08:41:20 +02:00
TheRealLorenz f557697e92 Rewrite entire label in sway/window module
Closes #1742
2023-03-25 17:37:49 +01:00
TheRealLorenz 63525ec956 Rename function name 2023-03-25 17:33:01 +01:00
Aleksei Bavshin ea17a66dfc
fix: compilation errors with cpp_std=c++20
There were two main issues with fmtlib and C++20 mode:

 - `fmt::format` defaults to compile-time argument checking and requires
   using `fmt::runtime(format_string)` to bypass that.
 - `std::format` implementation introduces conflicting declarations and
   we have to specify the namespace for all `format`/`format_to` calls.
2023-01-20 22:50:02 -08:00
Rene D. Obermueller 328573332f sway-window, Issue 1399: new style classes
Provides CSS classes empty, floating, tabbed, tiled, solo, stacked and
app_id.

Adds offscreen-css bool option (default false), only effective when
"all-outputs" is true. This adds styles on outputs without focused
node, according to its focused workspaces window situation.

Adds an "offscreen-css-text" string option (default empty), only
effective when "all-outputs" and "offscreen-style" are set. This
is shown as a text on outputs without a focused node.

Adds a "show-focused-workspace" bool option (default false) to indicate
the workspace name if the whole workspace is focused when nodes are
also present. If not set, empty text is shown, but css classes
according to nodes in the workspace are still applied.

Limitation:
When the top level layout changes, there is no sway event so the
module cannot react. Perhaps in the future recurring polling can
be added to go around this limitation.
2023-01-12 05:53:59 +01:00
herlev e660a3634d Fix linter 2022-10-19 13:29:05 +02:00
herlev 54e04b5a30 Refactor rewriteTitle 2022-10-19 13:25:08 +02:00
Alex bcee4e15d3 fix: lint files 2022-08-18 15:22:25 +02:00
Alex b7bd06ad8f
Update window.cpp 2022-08-18 15:21:50 +02:00
TheRealLorenz 5b1cd65e20 Fix: better formatting 2022-08-10 10:41:18 +02:00
TheRealLorenz 99ed2bb7fa Feature: sway/window can show 'shell' parameter 2022-08-10 10:34:51 +02:00
Alex 4d1aeb7eb8
Merge pull request #1525 from FlexW/feature/icon-heuristics
sway/window: Add heuristics for finding icons
2022-05-23 13:42:26 +02:00
Felix Weilbach 3f123d9c4e sway/window: Add heuristics for finding icons
This adds heuristics for finding the applications icon.
2022-04-18 03:09:25 +02:00
Felix Weilbach fc6f5741b1 sway/window: Allow the user to change the size of the app icon
Fixes #1461
2022-04-17 23:57:57 +02:00
Felix Weilbach 45988b3dbb Sway/window: Only update icon from main thread
If Gtk objects get updated from other threads than the main thread GTK
can get confused. This is a regression of bcadf64031.

Fixes #1464, #1474
2022-04-17 22:55:58 +02:00
Alex f2fcadbf62 refactor: lint 2022-04-06 08:37:19 +02:00
Felix Weilbach bcadf64031 Show application icon when using sway window module
Signed-off-by: Felix Weilbach <felix.weilbach@t-online.de>
2022-01-24 17:37:51 +01:00
Rene D. Obermueller 9972384597 sway/window: include floating_nodes when considering window count for class 2021-10-02 18:35:38 +02:00
Patrick Hilhorst a03283d65f
rewriteTitle: allow multiple sequential rewrites 2021-04-26 20:26:43 +02:00
Matthias Richter af3c868a5b Catch exception on erroneous rules
std::regex and std::regex_replace may throw an std::regex_error if the
expression or replacement contain errors.

Log this error and carry on with the next rule, so that the title is
shown even if the config contains errors.
2021-04-21 12:24:47 +02:00
Matthias Richter b16c8972c7 Add option to rewrite sway/window title
Rewrites window title according to config option "rewrite".
"rewrite" is an object where keys are regular expressions and values are
rewrite rules if the expression matches. Rules may contain references to
captures of the expression. Regex and replacement follow ECMA-script
rules. If no regex matches, the title is left unchanged.

example:
"sway/window": {
  "rewrite": {
    "(.*) - Mozilla Firefox": " $1",
    "(.*) - zsh": " $1",
  }
}
2021-04-21 12:24:47 +02:00
Thomas Sarboni e19aa1d43a
[sway/window] Add app_id to usable fields in title 2021-01-30 01:41:45 +01:00
Harit Kapadia cb7baee045 Fixed compile error 2020-12-18 18:17:17 -05:00
Harit Kapadia 85ca5027f4 Fix Sway #waybar.solo CSS rule applying on split
This error occurs because of an incorrect assumption that the size of
the list of nodes that contains the focused window is the number of
windows in a workspace.

The windows in a workspace are stored as a tree by Sway, rather than a
list, so the number of windows has to be found by counting the leaves of
a workspace tree.
2020-12-18 18:14:14 -05:00
Alex 4a7dd400fe
Merge branch 'master' into on-update 2020-04-12 18:32:19 +02:00
Alex b40cdcb5bd refactor: call parent update 2020-04-12 18:30:21 +02:00
Aleksei Bavshin ae6ca36fa7
fix(sway): resolve destruction dependency between Ipc and SleeperThread
Ipc destructor closes socket and thus wakes up SleeperThread which was
waiting for socket data in Ipc::handleEvent.
Ipc::handleEvent then proceeds with sending signal to already destroyed
object, causing heap-use-after-free Address Sanitizer error.
2020-02-04 23:22:43 -08:00
Birger Schacht 66f2cbed51
Fix typo
ouput -> output
2019-08-31 17:50:56 +00:00
Alex a6980fca7f feat: ellipsize modules 2019-06-28 14:16:09 +02:00
Alex bd5146fdcf fix(Label): ELLIPSIZE all label modules 2019-06-28 13:49:04 +02:00
Alex ff9d598c16 fix: add proper mutex 2019-06-17 11:39:45 +02:00
Alex 340ec7be91 refactor: AModule 2019-06-15 14:57:52 +02:00
Alex dabe2bebbb feat(sway/window): handle floating nodes 2019-06-14 11:27:40 +02:00
Alex 486b5a5d38 fix(sway/window): check output recursively 2019-06-14 10:57:22 +02:00
Alex 3c9b533997 fix(window): avoid hexpand 2019-06-11 17:57:17 +02:00
Alex a37b4687ff Revert "refactor(window): we don't need to subscribe workspace events"
This reverts commit 648eecdd83.
2019-06-11 14:06:31 +02:00
Alex 648eecdd83 refactor(window): we don't need to subscribe workspace events 2019-06-07 15:08:33 +02:00
Alex 1962caf144 refactor(window): gtk stuff in update method 2019-06-04 17:34:00 +02:00
Alex d24d85bebf refactor: move label name and id to label contructor 2019-05-22 12:06:24 +02:00
Lucas Lazare 51be97f9aa Adding spdlog 2019-05-18 19:44:45 -04:00
Alex 0c3c548bc0 fix(Window): avoid concurrency 2019-05-13 14:35:45 +02:00
Alex 62f8af8a39 fix(Window): avoid multiple same classes 2019-05-13 10:56:48 +02:00
Adam Pioterek 7cdde05568
remove empty and solo classes when they do not apply 2019-05-11 20:36:10 +02:00