Commit Graph

240 Commits

Author SHA1 Message Date
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
Genesis 7eb2a6b709
Add a configuration entry to disable auto_back_and_forth on Sway workspaces 2021-02-02 21:58:26 +01: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
Aleksei Bavshin 68b6136989
fix(sway/workspaces): ignore emulated scroll events
GDK Wayland backend can emit two events for mouse scroll: one is a
GDK_SCROLL_SMOOTH and the other one is an emulated scroll event with
direction. We only receive emulated events on a window, thus it is not
possible to handle these in a module and stop propagation.

Ignoring emulated events should be safe since those are duplicates of
smooth scroll events anyways.

Fixes #386
2020-12-04 01:09:42 -08:00
Aleksei Bavshin ebdeb86703
feat(swaybar-ipc): handle visibility_by_modifier update 2020-10-19 19:35:55 -07:00
Aleksei Bavshin bc13453155
feat(swaybar-ipc): handle mode update 2021-09-15 22:39:51 +07:00
Aleksei Bavshin 23e5181cac
feat(swaybar-ipc): add swaybar IPC client 2020-10-19 19:34:48 -07:00
nikto_b 8349316fcd
Merge branch 'master' into sway-language-module 2020-10-12 13:31:39 +03:00
nikto_b cc3acf8102
feature: created sway language submodule; added styles & config part for a sway language submodule 2020-10-10 19:09:18 +03:00
lrhel 83d679bf72 Add format-icons for workspace's name entry 2020-09-26 23:06:12 +00:00
Pedro Côrte-Real 29fa74f621 Add IDs to sway workspace buttons for CSS styling
In case you want to style a specific workspace add IDs to the workspace
buttons. Styling is done by matching button#sway-workspace-${name}.
2020-08-13 11:36:19 +01:00
Pedro Côrte-Real 8f10c9056c Add option for no workspace switch on click
In sway/workspaces, just like disable-scroll turns on/off the ability to
change workspaces by scrolling the mouse add disable-click that turns
on/off the ability to change workspaces by clicking.
2020-08-12 11:38:48 +01:00
NotAFile 9ebfc54eb5
switch workspace on mouse-down to match swaybar
fixes #686
2020-08-06 16:04:30 +02:00
Michael Rodler 006850ea5e Changed helper function for workspace->num assignment to a static method of Workspaces class
and adapted comments/method name to be consistent with the rest
2020-07-27 10:56:49 +02:00
Michael Rodler 15fe73a252 duplicate the logic to assign numbers to workspaces from sway into waybar to handle perisstent workspaces 2020-07-22 16:13:24 +02:00
Tudor Brindus 0080feb9af sway/workspaces: make clicking on workspaces idempotent
Previously, clicking on the same workspace you were on would throw you
to another workspace if `workspace_auto_back_and_forth yes` was
specified in your sway config. This also fixes workspace output moving
misbehaving and doing the same.
2020-06-09 20:43:43 -04:00
Michael Rodler 6fe764540c sway/workspaces: sort by the "num" property provided by sway, configurable whether numeric workspace names come first
Sway provides the workspace "num" property which is an integer number of
the workspace, i.e., workspace "3" -> 3 and also "3dev" -> "3". This
commit uses this property to sort the workspaces, which makes sense when
persistent workspaces or all-output is specified. This commit also adds
a new configuration option, whether the numeric workspaces come in front
or after workspaces that have non-numeric name.
2020-05-05 09:15:20 +02:00
Michael Rodler c602d38c8e sway/workspaces added current_output CSS class to buttons.
All workspace buttons that are visible on the same output as the current waybar can be styled with the `current_output` css class.

This is really only useful in combination with the `"all-outputs":
true`. Then the workspaces that are on the current output can be styled
differently than the workspace on other outputs, while all are visible
in the waybar.
2020-05-04 16:16:09 +02: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
Alex 7c4ea39774 fix: add missing comma 2020-04-06 12:49:41 +02:00
Alex 27fbea2b5a refactor(workspaces): default value unstripped, fix man 2020-04-06 12:42:29 +02:00
Alex bb2c16386b feat: format-icon for persistent workspaces 2020-04-04 21:13:25 +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
Alex 7f7ebb5367 fix(workspaces): add int comparison 2019-10-19 16:19:35 +01:00
Alex 36fc8365ee
Merge pull request #446 from bschacht/fix-typo-persistant
Fix typo: persistant -> persistent
2019-08-31 21:13:31 +02:00
Birger Schacht 2646390e28 Fix typo: persistant -> persistent 2019-08-31 19:57:44 +02:00
Birger Schacht 66f2cbed51
Fix typo
ouput -> output
2019-08-31 17:50:56 +00:00
xPMo e38df047fd
sway/mode: enable pango markup on supported modes
IPC reports {"mode": "mode_string", "pango_markup": bool}.
Use this to conditionally enable pango markup.
2019-08-28 19:48:33 -05:00
sheenobu a6c0bc5a52 Fix deadlock on workspace scrolling
Make the mutex guard lifecycle finish before the send ipc command
by adding scope around the code.

Fixes #395 .
2019-07-05 20:47:44 -07: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 11bbc3b24d
Fix twitchy scrolling on touchpads (#381)
Fix twitchy scrolling on touchpads
2019-06-14 10:38:25 +02:00
Alex 028b184f7b fix(workspaces): persistant class with empty outputs 2019-06-12 09:50:33 +02:00
Patrick Hilhorst 396f7d4525
Workspaces: implement horizontal continuous scrolling 2019-06-11 18:44:54 +02:00
Alex 3c9b533997 fix(window): avoid hexpand 2019-06-11 17:57:17 +02:00
Patrick Hilhorst ed4521d113
Workspaces: fix twitchy scrolling on touchpads
Previously, any and all scroll events were interpreted as reason to switch
workspaces. This resulted in twitchy behaviour, where the scrolling was
practically unusable.

Now, we pool all scroll values, and only scroll if the value is larger than the
new config option "smooth-scrolling-threshold". If this option is not set, the
behaviour is unchanged.
2019-06-11 17:22:24 +02:00
Alex c2e9ed6091 feat(workspaces): add class to persistant workspaces 2019-06-11 14:08:48 +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 9b89fc6470 refactor: disable bar scroll by default 2019-05-28 16:11:33 +02:00
Alex d24d85bebf refactor: move label name and id to label contructor 2019-05-22 12:06:24 +02:00
Alex 12a251c3a4 fix(mode): escape text 2019-05-20 20:51:19 +02:00
Alex 4accdd4524 fix(Workspace): ordering 2019-05-20 20:46:59 +02:00
Alex e3879559a2
Merge pull request #330 from Organic-Code/master
Adding sway/workspaces:persistant_workspaces
2019-05-20 14:33:31 +02:00
Lucas Lazare 0ec8774a08 Fixing: missing argument for fmt, workspace order
Persistant workspaces would reorder upon their first creation
2019-05-20 08:23:42 -04:00
Alex 071b4928dc fix(workspaces): order 2019-05-20 13:31:02 +02:00
Alex 7c4d75d428 feat: create new workspace on the wanted output 2019-05-20 13:21:22 +02:00
Lucas Lazare 51be97f9aa Adding spdlog 2019-05-18 19:44:45 -04:00
Lucas Lazare a00f812cd1 Typo 2019-05-18 18:21:01 -04:00
Lucas Lazare 863e0babd8 Adding break when sorted_workspaces is filled 2019-05-18 12:09:30 -04:00
Lucas Lazare 8ba3052dd1 Adding comments & fixing code style 2019-05-18 12:04:09 -04:00
Lucas Lazare 1a76aa0c8c Improving ordering 2019-05-18 11:58:01 -04:00
Lucas Lazare 85f177a213 Adding sway/workspaces:persistant_workspaces in config file
c.f. https://github.com/Alexays/Waybar/issues/210
2019-05-18 10:58:55 -04:00
RX14 3e1c77d158
Add option to disable scroll wraparound on workspaces 2019-05-18 12:15:35 +01:00
Alex 43d724ebad
Merge pull request #326 from RX14/rename-bar-scroll
Rename the "disable-workspace-scroll" option to "disable-bar-scroll"
2019-05-17 20:24:15 +02:00
RX14 0d59f7b7d1
Rename the "disable-workspace-scroll" option to "disable-bar-scroll" 2019-05-17 17:42:11 +01:00
RX14 1e95f5d9b6
Fix workspace scroll wrapping off the end of the list 2019-05-17 17:37:24 +01:00
Alex 4d4cadb5ae refactor: simpler code 2019-05-17 09:59:37 +02:00
Alex 362c393b1d refactor: try/catch, sigc trackable 2019-05-13 15:15:50 +02: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
Alex 5bf0ca85ac refactor: try/catch around json parse 2019-05-09 10:30:54 +02:00
Alex 5a44c8c6de refactor: avoid unneeded json parsing 2019-05-07 13:43:48 +02:00
Alex 74137befba fix(window): title flickers 2019-05-07 13:31:41 +02:00
Alex b75e0bb0d0 refactor: remove useless bar param 2019-05-07 13:21:18 +02:00
Alex d027243a19 fix: json thread safe 2019-05-02 14:24:54 +02:00
Alex 717a07d584 refactor(Window): simpler conditions 2019-04-26 15:29:54 +02:00
Alex bb8ff5a99f feat(Bar): add class depend of window in the workspace 2019-04-25 16:47:51 +02:00
Alex 311c34ecbc feat(Bar): handle widget size changes 2019-04-24 12:37:24 +02:00
Alex 90d89fe974 refactor: kill custom modules scripts en destroy 2019-04-23 15:56:38 +02:00
Alex cccf60c30e fix(Workspaces): fix concurrence and move json parser to ipc client 2019-04-23 11:42:08 +02:00
Alex cbb6f2a307 refactor(Workspaces, IPC): no more mutex in the workspaces modules, moved to the IPC client for a proper handling 2019-04-19 16:48:02 +02:00
Alex e77c155ede fix(workspaces): avoid mutex block 2019-04-19 12:11:55 +02:00
Alex 42dc0c4c71 fix(ipc): typo 2019-04-19 11:10:48 +02:00
Alex bb1cf7570e refactor(IPC): use sigc signal 2019-04-19 11:09:06 +02:00
Alex 6ed8f94dab refactor: format code 2019-04-18 17:52:00 +02:00
Alex 807ef32357 refactor: format && better output management 2019-04-18 17:47:40 +02:00
Alex bc9a49787a feat: enable pango markup on sway workspaces 2019-04-15 10:55:44 +02:00
Alex 5144426f0e fix(workspace): scroll direction 2019-03-25 11:55:01 +01:00
Alex 47142a61ae feat: allow waybar to be positioned on left/right 2019-03-22 12:25:05 +01:00
Alex 22cddc5e26 refactor(workspaces): scroll output aware 2019-03-18 14:44:07 +01:00
Aleksei Bavshin 00176c9514 fix(sway): ipc client crash when compiled with -D_GLIBCXX_ASSERTIONS
reserve() does not change string size and any access beyond data() + size() is UB
2019-03-14 17:53:45 -07:00
John Doe 737da3615f resolves #205 2019-03-03 21:35:32 +11:00
Alex 0271e9bc1a Revert "fix: Escape user controlled input"
This reverts commit 7247360e29.
2019-02-28 19:30:27 +01:00
Robinhuett 7247360e29 fix: Escape user controlled input 2019-02-25 18:28:56 +01:00
Alex 83a6475510 feat: can disable tooltip 2019-02-22 11:35:47 +01:00
Alex 93173851d3 fix(Workspaces): index 2019-02-02 12:07:59 +01:00
Alex add9e925f4 fix(Workspaces): button order 2019-02-02 00:36:52 +01:00
Robinhuett 6d03d9f6a9 fix(window): Fix #154 2019-01-27 11:59:07 +01:00
Robinhuett ce6816737c fix(window): Ignore waybar
With this, the window title waybar will be ignored so it wont flicker as decribed in #148
2019-01-26 19:02:11 +01:00
Alexis f8116132a7 fix(Workspaces): check thread is running before parse response 2019-01-13 22:23:09 +01:00
Alexis 399f61df98 refactor: proper modules destruction 2019-01-13 22:22:22 +01:00
Caleb Bassi 8ea0659ee2 Remove ws index from sway ws names 2018-12-28 09:36:02 -08:00
Caleb Bassi b4d38294a7 Fix typo 2018-12-27 16:03:29 -08:00
Alexis b554094c7e feat: args && class id 2018-12-18 17:30:54 +01:00
Alexis c7b0639f32 fix(workspaces): check thread is running 2018-12-09 10:49:28 +01:00
Alexis 691fb88057 refactor(modules): const bar 2018-12-01 00:10:41 +01:00
Alexis 8e93fd3ae0 revert: Update to new Sway IPC protocol 2018-11-29 09:50:00 +01:00
Ryan Walklin 3a5a470d90 Update to new Sway IPC protocol 2018-11-28 22:27:06 +00:00
Alexis 391a7de94a fix(window): escape window name 2018-11-25 15:21:00 +01:00
Alexis bd62c4cbc5 feat(Label): use set_markup 2018-11-21 20:49:09 +01:00
Alexis b3559328f1 fix(window): ellipsize 2018-11-20 23:24:33 +01:00
David96 adcd956c24 Fix workspaces not being removed from bar when moved to another output 2018-11-05 20:59:28 +01:00
David96 168415440f Fix clicking and scrolling through workspaces
The way waybar used the workspace "num", clicking a workspace called "1:
something" resulted in going to a newly created workspace called "1",
because the workspace ipc command expects the workspace name, not its number.
2018-11-05 20:16:19 +01:00
Robinhuett a042eea384 Add module to show sway binding mode 2018-10-30 13:39:30 +01:00
Alexis c9a8a07976 fix(window): title on new workspace 2018-10-29 21:52:53 +01:00
Alexis 3f269ff463 fix: check json::value type 2018-10-26 09:27:16 +02:00
Alex 0e6147b644
Merge branch 'master' into tray-gdbus 2018-10-25 11:36:35 +02:00
Alexis c912d8c86a fix(workspaces): index 2018-10-25 10:22:11 +02:00
Alexis 5a6e05dcde feat: workspaces index 2018-10-22 10:41:52 +02:00
topisani 9a333088e5 Merge branch 'tray-gdbus' of github.com:topisani/Waybar into tray-gdbus 2018-10-04 18:47:06 +02:00
Alexis d5d620e72d
feat(Window): handle closed window 2018-09-18 21:16:35 +02:00
Alexis d914429194
feat(Workspaces): format 2018-09-18 20:58:11 +02:00
Alexis 20ff2cab9e
feat(Tray): handle item unregister 2018-09-15 19:01:28 +02:00
Alexis 7020af7653
feat(Workspaces): urgent, visible, focused icons 2018-09-05 00:16:56 +02:00
Alexis d0933ab50f
fix(thread): check before detach 2018-08-29 21:07:58 +02:00
Alexis 53956d9d18
feat(ALabel): Toggleable labels 2018-08-27 01:36:25 +02:00
Alex 49232eed8d
Clean (#31) 2018-08-20 14:50:45 +02:00
Alexis b7e3d10fb7 revert(workspaces): ipc command out of update func 2018-08-20 00:19:27 +02:00
Alexis 8ce33e0c64 fix(window): pick only con title 2018-08-19 20:37:33 +02:00
Alexis 52a4e761a8 fix(workspaces): avoid useless mutex lock 2018-08-19 13:43:00 +02:00
Alex 6705134034
Handle screens disconnection (#29) 2018-08-19 13:39:57 +02:00
Alexis 38ede5b3d5 refactor(ipc): clean 2018-08-18 16:01:56 +02:00
Alexis b1fd4d7b82 feat(modules): generic label module to allow max-length on all labels 2018-08-18 11:43:48 +02:00
Alex d280f5e8bd
Network detect (#26) 2018-08-17 14:24:00 +02:00
Alexis 8768183f3d fea(workspaces): add disable-scroll config 2018-08-16 17:12:45 +02:00
Alex 6635548d3e
Style code (#25) 2018-08-16 14:29:41 +02:00
Alexis 3fdc50163d feat(window): update when window title change 2018-08-16 00:02:57 +02:00
Alexis a9246a09eb feat(workspaces): add a option to show all workspaces from all outputs 2018-08-15 22:19:17 +02:00
Alexis f94598c138 feat(sway): add focused window name 2018-08-15 20:17:17 +02:00