Commit Graph

174 Commits

Author SHA1 Message Date
Jérôme BOULMIER
529843b6ba
Remove undefined behaviors and clean code (#1769)
* fix: avoid memory leaks in case of exceptions.

* fix(fs): remove undefined behavior when removing mounts in m_mounts

* cleanup: remove double checks

* fix: remove memory leaks

* cleanup(xresources): capture exception by reference

Co-authored-by: Patrick Ziegler <p.ziegler96@gmail.com>
2021-02-15 23:32:56 +01:00
Patrick Ziegler
d5be8cad97
Add compiler warning for missing override specifier (#2341)
* build: Add -Wsuggest-override

We should always use the override specifier when overriding virtual
functions. This helps prevent errors when a subclass tries to create a
function with the same name as a virtual function in a super-class but
with a different purpose.

* clang-format

* Upload logs on failure

* Add override to unsupported.hpp

* cmake: Make -Wsuggest-override flag conditional
2021-01-04 10:38:43 +01:00
Jérôme BOULMIER
bb5cf0113e fix(x11): Don't include composite when disabled 2020-12-22 00:37:07 +01:00
Nolan Prochnau
0d2838fcd5
feat(xkeyboard): Add variant support to layout label (#2163)
* Add variant support to xkeyboard layout label

Solves #316

* Run style checks, I guess?

* Add comment

* Return nothing if there is no variant

* Update CHANGELOG
2020-12-19 18:22:27 +01:00
patrick96
3655106a14 Adapt the renderer side to always use rgba 2020-11-27 22:08:03 +01:00
patrick96
7658c1b9f1 fix(xworkspaces): Assign desktops to correct viewport
Before the module would just try to evenly distribute desktops
(workspaces) among the viewports.

But since `_NET_DESKTOP_VIEWPORT` actually maps desktops to viewports,
we can use that information to assign workspaces to the right viewport.

Fixes #1849
Fixes #1764
2020-05-01 18:46:02 +02:00
patrick96
ecbe77bbda fix(monitor): Reload when any monitor changes
Before it would only reload if the size changed and even that was
reliable since the method relied on the order of the monitor list.

Now if the monitor list differs in any way (pos, dimension, primary,
output, name) a reload is issued
2020-04-21 23:59:01 +02:00
patrick96
33b68ec7cb fix(randr): Undefined behavior when removing clones
Because of how monitors are removed inside the loop and depending on the
monitor order a cloned monitor may be assigned a width of 0 but is never
actually removed resulting in polybar saying the bar is out of bounds

Fixes #1794
2020-04-21 23:59:01 +02:00
patrick96
cc36350849 xrandr: Allow not to purge cloned monitors 2020-04-21 23:59:01 +02:00
patrick96
b5e7078d93 fix(monitor): Remove realloc from get_monitors
Premature optimization that tried to cache monitors but the cache did
not take into account the parameter values.

The call `get_monitors(..., ..., false, true);` would get all connected
and unconncected monitors a subsequent call
`get_monitors(..., ..., true, false);` would get back the same list of
monitors even though it requested only connected monitors.

Additionally `get_monitors` is never called periodically so the
optimization really didn't help much.
2020-04-21 23:59:01 +02:00
patrick96
a3e2e51ac9 build: remove xdamage extension
Unused

Ref: #1730
2019-06-03 00:46:12 +02:00
patrick96
38af08d29a build: remove xsync extension
Unused

Ref: #1730
2019-06-03 00:46:12 +02:00
patrick96
6ff2b2b37f build: remove xrender extension
Some build recipes (exherbo, sourcemage) for some reason enable this
even though it doesn't do anything any only causes compilation issues.

Ref: #1730
2019-06-03 00:46:12 +02:00
Jérôme BOULMIER
fca4151f36 fix(window): remove useless operator= and add default copy cstr (#1729)
Fixes compilation under GCC 9

The default copy constructor implicit generation is deprecated by C++ standard.

The window& operator=(const xcb_window_t win); operator seems to be useless.

Fixes #1728
Ref jaagr/xpp#16
2019-04-07 17:32:55 +02:00
Jérôme BOULMIER
25ef0299cb fix(tray_client): remove copy ctor & assignment operator (#1675)
tray_client class contains a reference so copy assignment operator is implicitly deleted.
the dtor unembed the window so copying the class could lead to bug so the copy ctor is also deleted.

Fixes #1674
2019-03-06 09:00:11 +01:00
Gilad Naaman
db9a83a83b feat(xkeyboard): Customizable indicators and layouts (#1559)
* `layout-icon-*` list that maps layouts to icons.
* `indicator-icon-*` list that maps indicators to off and on icons
* `label-indicator-off`
* `label-indicator-on` which replaces the now deprecated `label-indicator`
* `label-indicator-[on|off]-*` for each indicator. Overrides `label-indicator-on` and `label-indicator-off` 

Fixes #1558 
Closes #1048

* add icon support for xkeyboard layouts

* removed unneeded #include

* add sperate %icon% token that can be used in <label-layout>

* removed unneeded #include

* added caps lock indicator (was mentioned in wiki, but not actually implememnted) and support for indicator icons

* a few more fixes to make sure existing user configs are not broken

* ready to go

* Added an option to replace xkb indicator names

* Added labels for each indicator state

* Removed print left on accident

* Fixed review comments

* Update src/modules/xkeyboard.cpp

Co-Authored-By: Gilnaa <gilad@naaman.io>
2019-02-24 22:35:39 +01:00
striker.sh
ca4426a962 fix(xworkspace): Fully support _NET_DESKTOP_NAMES spec (#1579)
Ref https://specifications.freedesktop.org/wm-spec/wm-spec-latest.html#idm140200472706208

Fixes #1491
Fixes #248
Closes #904
2019-02-08 13:32:31 +01:00
NBonaparte
1145681cf5
feat(monitor): use primary monitor as default (#1426)
If the monitor option isn't set, the primary monitor (if connected) is chosen as the default display.
2019-01-20 11:20:30 -08:00
Benno Fünfstück
f74c524fff fix(renderer): Handling of missing root pixmap (#1608)
Polybar had issues when there is no background set or set by a tool like imagemagick which doesn't add the root pixmap to the root window properties.

There's not much we can do about it, but at least polybar doesn't crash anymore.

Fixes #1582 
Fixes #1585 

* fix(tray_manager): only enable transparency if neccessary

Previously, we always enabled transparency

* fix(background_manager): avoid needless fetching

* fix(renderer): move logging message to correct place

* fix(background_manager): handle dummy pixmap (_XSETROOT_ID) right

* fix(background_manager): more initialization + don't free on error

Freeing on error is incorrect, since we could still be called again later in
which case we still need the resources.

* fix(background_manager): add more infos to trace logs

* fix(background): correct typo (XROOTMAP -> XROOTPMAP)

* fix(background_manager): do not report "no background" as error

* style(background_manager): use braces for if

Co-Authored-By: bennofs <benno.fuenfstueck@gmail.com>

* fix(background_manager): better error message for dummy pixmap

Co-Authored-By: bennofs <benno.fuenfstueck@gmail.com>

* style(background): some more style fixes

* fix(connection): initialize pixmap in all cases in root_pixmap()

* style(connection): improve readability using early return
2019-01-17 14:22:48 +01:00
patrick96
e793082008 randr: Add separate key for exact monitor matching
This adds `monitor-exact = true` in the bar section

This also properly does best-match instead of first-match if multiple
matches exists. For example if there are two monitors HDMI2 and HDMI-2
and we try to match HDMI-2 with monitor-exact = false, until now HDMI2
would be matched. Now exact matches are always preferred.

Fixes #1532
2019-01-08 17:23:28 +01:00
Benno Fünfstück
7256366112 fix(tray): correctly handle transparency when using offset (#1571)
This patch adds support for observing multiple slices of the desktop background.
This is used for the tray so that it doesn't have to rely on the bar's rect to
get the desktop background. In particular, it now handles the case where the
tray is not contained fully within the bar's outer rect (for example, when using tray-offset-{x,y})

Co-Authored-By: bennofs <benno.fuenfstueck@gmail.com>
2019-01-05 01:08:18 +01:00
NBonaparte
35c0c4a343 fix(xcb): check for composite extension (#1430)
* fix(xcb): check for composite extension

* fix(travis): add xcb-composite to deps

* fix(xcb): always include composite when building
2018-12-02 16:39:14 +01:00
patrick96
6ca4f06785 doc: Convert @ to \ doxygen commands
Ref #1377
2018-11-04 19:28:27 -08:00
Benno Fünfstück
15b84dda07 docs(background_manager): add comments 2018-10-04 15:52:03 +02:00
Benno Fünfstück
35aca5b368 fix(tray): correctly compute background for tray if bar pos != (0,0)
We need to use positions relative to the position of the bar for indexing into
the background image slice, but the code used absolute ones.

This worked fine as long as absolute positions are the same as relative
positions (this is the case for a bar located at (0,0), so if bottom = false).
But for bottom bars (where the bar position is not (0,0)) this was wrong which
caused the tray background to be black (out of bounds for the background slice).
2018-10-04 15:52:03 +02:00
Benno Fünfstück
eacf5ce5ba fix(tray): fix transparency after background manager changes
The systray only supports pseudo transparency (real transparency would require
much larger changes) so the real transparency should only be used for the bar itself.
2018-10-04 15:52:03 +02:00
Benno Fünfstück
061fe83b2f feat(background_manager): option to disable pseudo-transparency
This adds a new config option to select between pseudo transparency and real transparency.
2018-10-04 15:52:03 +02:00
Benno Fünfstück
e4b0a5445f style(background_manager): use brace initialization 2018-10-04 15:52:03 +02:00
Benno Fünfstück
51d58e7518 fix(render): support stacked bars
We now take the bar position that the window manager gives us instead of trying
to calculate it ourselves. This is more correct when multiple bars are attached
to the same edge, as the window manager may move some of them in that
case (assuming override redirect is not enabled)
2018-10-04 15:52:03 +02:00
Benno Fünfstück
3de914abca feat(render): support pseudo-transparency
This adds pseudo-transparency for the background of the bar and the
background of the systray.
2018-10-04 15:52:03 +02:00
Yukio Siraichi
0ae4de7d1e fix(compiling): map variable without namespace. (#1395)
If polybar is compiled with `-xkb +xcursor`, `cursor.hpp` doesn't include `using std::map`, which is located in `xkb.hpp`
2018-08-24 13:37:45 +02:00
NBonaparte
e612fe1624 refactor(cursor): use map for cursor list 2017-09-16 15:31:24 -07:00
NBonaparte
b7f1960a0a fix(cursor): change arrow_names to default_names 2017-09-16 15:31:24 -07:00
NBonaparte
1dc111c0fa fix: make xcb-cursor optional for now 2017-09-16 15:31:24 -07:00
NBonaparte
65edba3321 feat: add cursor change 2017-09-16 15:31:24 -07:00
NBonaparte
44f12c6065 feat(xworkspaces): add urgent desktop detection 2017-02-23 13:20:26 +01:00
Michael Carlberg
8146f65286 fix(xrender): Add header declarations #406 2017-02-04 19:13:08 +01:00
Michael Carlberg
09808e99f9 refactor(tray): Cleanup 2017-01-25 23:37:16 +01:00
Michael Carlberg
1a25be374f refactor(xworkspaces): Cleanup 2017-01-25 04:35:56 +01:00
Michael Carlberg
31cde9014a fix(x11): Add missing header 2017-01-24 12:09:09 +01:00
Michael Carlberg
6692b4a8da refactor(x11): Cleanup 2017-01-24 10:49:14 +01:00
Michael Carlberg
a5d6670121 refactor(clang-tidy): Apply fixes 2017-01-24 08:01:04 +01:00
Michael Carlberg
452afcdc68 refactor: Integral types 2017-01-24 07:11:14 +01:00
Michael Carlberg
5e1886a312 wip(refactor): Cairo drawing 2017-01-24 07:11:14 +01:00
Daniel Lublin
b6661825ce fix(xrm): res_class==nullptr to properly get the resource (#368)
Not sure what "String" was supposed to do, my tests with xcb-xrm gives that
res_class==nullptr properly gets the resource value, =="String" does not.
2017-01-23 17:54:20 +01:00
Michael Carlberg
e1483c3f65 refactor(xresources): Use xcb-util-xrm
Drop the Xlib version and handle X resource
lookups using xcb-util-xrm

Refs #356
2017-01-20 02:26:01 +01:00
Michael Carlberg
100c64a20c refactor: Make xresource_manager a singleton
Refs #356
2017-01-19 21:27:01 +01:00
Michael Carlberg
385572ec64 feat(xrandr): Support for monitors
Refs #280
2017-01-13 03:52:57 +01:00
Michael Carlberg
568837d06a fix(x11): Preload the _NET_WM_WINDOW_OPACITY atom 2017-01-11 05:00:23 +01:00
Michael Carlberg
5c9bfc147c fix(xbacklight): Lower inc/dec value to 5 and fix flooring 2017-01-11 04:40:10 +01:00
Michael Carlberg
8cc885c316 refactor: Cleanup 2017-01-11 03:07:28 +01:00
Michael Carlberg
e0688307f3 wip(systray): Add module base 2017-01-01 21:28:28 +01:00
Michael Carlberg
6341c7ab25 refactor(config): Defer xrm initialization 2017-01-01 21:12:38 +01:00
Michael Carlberg
210695d377 refactor(x11): Merge xlib/xutils with connection 2016-12-31 10:02:32 +01:00
Michael Carlberg
a59d892d0b fix(connection): Address sanitizer patch 2016-12-31 01:28:48 +01:00
Michael Carlberg
8d1ff28589 fix(connection): Include cstdlib for std::free 2016-12-30 21:14:22 +01:00
Michael Carlberg
18cf9df86c refactor: Cleanup 2016-12-27 04:58:41 +01:00
Michael Carlberg
00ac4bea63 refactor(x11): Header cleanup 2016-12-26 10:27:30 +01:00
Michael Carlberg
11aabac227 refactor(connection: Use custom base 2016-12-26 09:46:48 +01:00
Michael Carlberg
debb3534c7 concurrency_ytil: Thread id 2016-12-23 05:18:58 +01:00
Michael Carlberg
fa0d77f267 refactor(file_descriptor): Use unique_ptr 2016-12-23 01:07:00 +01:00
Michael Carlberg
bc9b9f0d12 refactor: Cleanup 2016-12-21 23:22:02 +01:00
Michael Carlberg
185363056a refactor(x11): Cleanup 2016-12-21 15:04:16 +01:00
Michael Carlberg
c14c46b998 refactor: Font index cleanup 2016-12-20 15:09:11 +01:00
Michael Carlberg
a89c4ef2dd refactor: Move all event handling to the controller 2016-12-20 05:16:04 +01:00
Michael Carlberg
519172b6ec feat(xkeyboard): Switch layout group on click
When serveral layout groups are defined for the keyboard
they can be cycled when clicking on the module.

   For example:

   $ setxkbmap -layout us,sv,fr

Ref #84
2016-12-16 11:31:08 +01:00
Michael Carlberg
697638db2b fix(tray): Follow window fade 2016-12-16 07:10:45 +01:00
Michael Carlberg
a7005be82c feat: Fade if unfocused and handle double clicks 2016-12-16 06:44:55 +01:00
Michael Carlberg
faab627771 fix(tray): Ignore restack state 2016-12-15 21:00:17 +01:00
Michael Carlberg
b90856157b fix: Update font visual if depth changes 2016-12-15 18:22:34 +01:00
Michael Carlberg
b2e8428550 wip(refactor): Improve parsing and font glyph caching 2016-12-15 17:28:58 +01:00
Michael Carlberg
9f9f438fae refactor: Remove last usage of boost::optional
Since it's the only thing boost was used for at the moment
we drop it to be able to get rid of a dependency.
2016-12-15 17:13:16 +01:00
Michael Carlberg
a0d485f79d refactor: Initialize data 2016-12-15 09:30:31 +01:00
Michael Carlberg
f9062d031c refactor(clang-tidy): Apply fixes 2016-12-15 03:30:41 +01:00
Michael Carlberg
d3bc1f938f refactor(x11): Use shared_ptr for X pointers 2016-12-14 15:09:51 +01:00
Michael Carlberg
b11a662d81 fix(tray): Re-activation 2016-12-14 11:34:09 +01:00
Michael Carlberg
18597f8e1d fix(tray): Uninitialized value 2016-12-14 11:01:44 +01:00
Michael Carlberg
357e95335a fix(valgrind): Suppress Xrm warnings 2016-12-14 11:01:44 +01:00
Michael Carlberg
7d07812fa6 fix(font_manager): Memory leak 2016-12-14 11:01:44 +01:00
Michael Carlberg
a33c15b3ad fix(xresources): Deallocate memory 2016-12-14 11:01:44 +01:00
Michael Carlberg
83f7d2ce91 refactor: Cleanup 2016-12-14 11:01:44 +01:00
Michael Carlberg
4fca0c89b4 refactor: Object construction 2016-12-14 11:01:44 +01:00
Michael Carlberg
1a2a6e5fab refactor: Construction methods 2016-12-14 11:01:44 +01:00
Michael Carlberg
08be86fbe1 wip(refactor): Improve signal and event handling 2016-12-14 11:01:44 +01:00
Michael Carlberg
891ff6d80a fix(xkeyboard): Use current group number
Ref #230
2016-12-08 18:35:07 +01:00
Michael Carlberg
7f5117b7cc fix(tray): Improve pseudo-transparency handling
- Make sure previously drawn content is cleared
- Redraw tray clients on XCB_EXPOSE
- Prevent void parts of the root pixmap being copied

Ref #187
2016-12-05 03:56:04 +01:00
Michael Carlberg
44da14755d refactor(clang-tidy): Apply fixes 2016-12-04 04:11:47 +01:00
Michael Carlberg
d6a0c84e0b refactor(tray): Update using eventloop 2016-12-03 23:01:21 +01:00
Michael Carlberg
bb0cfcf033 fix(tray): Visibility change 2016-12-03 20:26:29 +01:00
Michael Carlberg
6b51234f23 fix(screen): Only reload if changed 2016-12-03 16:44:37 +01:00
Michael Carlberg
ef9b37447b fix(xcb): Deallocate using deleter 2016-12-03 16:44:08 +01:00
Michael Carlberg
0f91d3d8df fix(ewmh): Use deleter to deallocate atoms 2016-12-03 15:45:11 +01:00
Michael Carlberg
570c30337b fix(cmake): Add legacy pragma
Ref #208
2016-12-01 13:11:58 +01:00
Michael Carlberg
d67515d575 fix(xwindow): Look for unicode wm_name
Ref #205
2016-11-30 13:38:41 +01:00
Michael Carlberg
6aba583c3e refactor(build): Rename X extension flags 2016-11-30 12:48:13 +01:00
Michael Carlberg
2f3c2e952e fix(xkeyboard): Minor tweaks 2016-11-30 11:29:41 +01:00
Michael Carlberg
608519363d feat(xkeyboard): New module
New module that uses the X keyboard extension
to show keyboard layout and indicators.

Ref #84, #200
2016-11-30 10:08:44 +01:00
Michael Carlberg
4852f2817c feat: Reload on XCB_RANDR_SCREEN_CHANGE_NOTIFY 2016-11-27 01:14:02 +01:00
Michael Carlberg
4fb7c98455 build: Optional X extensions 2016-11-26 15:42:48 +01:00
Michael Carlberg
12ff82e913 feat(xworkspaces): Change current desktop 2016-11-26 10:33:32 +01:00