Commit Graph

246 Commits

Author SHA1 Message Date
Uli Schlachter d2dc428e56
Fix _NET_CURRENT_DESKTOP ClientMessage handling (#3237)
This was broken in commit c5202a4870 by adding an extra string
to the Lua stack. Hence, the offset -1 now referred to the string and
not the tag.

Fixes: https://github.com/awesomeWM/awesome/issues/3236
Signed-off-by: Uli Schlachter <psychon@znc.in>
2021-04-25 15:33:39 -07:00
Emmanuel Lepage Vallee e77dd01e5a Add more TOVOv5 for unfixable APIs.
Another pull request at some point will add proper API levels,
it will then become possible to fix these without breaking
the API for everybody. However right now there is no way around
the problems.
2020-01-11 15:43:31 -08:00
Emmanuel Lepage Vallee c5202a4870 tag: Add a context to request::select. 2020-01-11 15:43:31 -08:00
Emmanuel Lepage Vallee 067bcaca60 client: Rename the `manage` and `unmanage` signals.
They currently fit the general concept of a `request::` in the sense
that they are not property related and have "request handlers".

The commit also add deprecation for signals.

The reason for this fits within the larger standardization project.
Non-namespaced signals will eventually be renamed. This has started
a long time ago.

What is old is new again. Once upon a time, there was a `startup`
parameter to the `manage` signal. It is now back in the form of
a context.

Finally, this commit removes the `manage` section of `rc.lua`. It no
longer did anything worthy of being in the config. Each of its
important parts have been moved out over the years and the last
remaining bit is always required anyway. The code has been moved
to `client.lua`.
2020-01-11 14:43:56 -08:00
Uli Schlachter b909068430 Set _NET_WM_DESKTOP for sticky windows specially (#2653)
Today I learnt that _NET_WM_STATE_STICKY means something else than I
previously thought.

ICCCM and EWMH support virtual desktops that are larger than the actual
screen. The idea is that one can scroll through this virtual desktop,
which means that e.g. all windows move to the left, so one can see the
windows that are further to the right.

_NET_WM_STATE_STICKY indicates that a window is sticky. This means that
it does not scroll with the virtual desktop, but instead sticks to its
current position.

In AwesomeWM, we use a different definition. A sticky window is always
visible, even when it is not tagged with any of the currently selected
tags. This behaviour is indicated in EWMH with a special value of
_NET_WM_DESKTOP. This commit updates the code to actually set this
special value.

This fixes attaching tabs in Google Chrome when the "target window" is
sticky (in the AwesomeWM sense).

Fixes: https://github.com/awesomeWM/awesome/issues/2652
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-16 13:51:29 -05:00
Emmanuel Lepage Vallee b570e6d347 client: Add request::geometry for client maximization
This way the correct logic can be implented in Lua
2017-05-23 22:33:26 +02:00
Emmanuel Lepage Vallee 951386ec5c client: Handle maximize differently at startup
This way max_h+max_h wont happen by accident. This isn't pretty
but it will get the job done.

Fix #1599 #1559
Close #1715 #1712
2017-05-23 22:33:26 +02:00
Uli Schlachter f2cb8d8eb9 C code: save all instead of just one client icons
Clients can provide various icons in their _NET_WM_ICON property. Up to
now we only saved a single one, now we save all of them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-03-07 22:45:49 +01:00
Emmanuel Lepage Vallee d5b681502a maximize: Stop mixing horizontal, vertical and both.
Before this commit, do this:

    c.maximize_hoizontal = true
    c.maximize = true
    c.maximize = false
    assert(c.maximize_hoizontal)

Would not work because the states were not preserved individually.
This commit fixes that. Awesome wont be confused about it's own
state anymore.

This may seem pointless, but when it come to undoing these
maximizations, it was ambiguous.
2017-02-07 11:12:42 -05:00
Uli Schlachter b4b007796c Initialise Lua later
This moves Lua initialisation to the latest possible point, just before
loading the configuration file. This requires to also move screen
initialisation and parts of EWMH initialisation to a later point.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-25 14:55:27 +01:00
Uli Schlachter 329a302164 Remove the executable bit from ewmh.c and awesomerc.lua
These files do not need to be executable and the commits which made
these executable apparently only did so accidentally (Commits
37684abe33 and bfc6065ad9).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-12-14 11:44:59 +01:00
Uli Schlachter a569487ba2 Merge branch 'dev_fix_desktop' of https://github.com/schmellow/awesome 2016-06-04 16:01:17 +02:00
Mikhail Schemelev 0befee6dfa Attempt at better handling of NET_CURRENT_DESKTOP property.
NET_CURRENT_DESKTOP is now being set to the index of the tag with currently focused client.
In case of no focused clients present, first selected tag index is taken, with fallback value being 0.
Current desktop is updated on next client signals: focus, unfocus, tagged, untagged.
Current desktop is also updated on tag property::selected signal.

This should fix drag and drop issues with chrome-based applications on multihead setups
2016-06-04 16:42:54 +03:00
Uli Schlachter cbdf403637 Fix fallback for the window type
EWMH specifies that

   If _NET_WM_WINDOW_TYPE is not set, then managed windows with WM_TRANSIENT_FOR
   set MUST be taken as [_NET_WM_WINDOW_TYPE_DIALOG].

We implement this by forcing a window's type to be "dialog" when it has a
WM_TRANSIENT_FOR property. For windows that have a _NET_WM_WINDOW_TYPE property,
this type change is then later undone. However, when a window changes its
WM_TRANSIENT_FOR property during runtime, then we would set its type to "dialog"
unconditionally.

This commit fixes this by explicitly tracking if we found a _NET_WM_WINDOW_TYPE
property on the window and only applying the fallback if we did not find such a
property.

Fixes-one-of-the-sub-issues-from: https://github.com/awesomeWM/awesome/issues/889
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-14 14:10:27 +02:00
Emmanuel Lepage Vallee 299e155acc client: Extend request::tag instead of awful.tag.withcurrent
There was a regression when refactoring the API. It was no longer
possible to disable the automatic tag selection.

Due to recent changes, it was no longer possible to disable the
default tag selection handler. This commit extend the already
existing request::tag mechanism to let handlers select the tags.
2016-04-20 00:11:04 -04:00
Uli Schlachter b2be471faf Fix icons
Since commit ea94f7f7e6, the code has a preferred icon size and it tries to
find the closest matching icon. However, the default size of 0 and thus this
never returned any icon at all (no icon matches better than an icon of size
0x0).

Fix this by saying "every icon is better than no icon at all".

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-23 14:19:18 +01:00
Uli Schlachter daff5cd58b Refactor _NET_WM_ICON parsing
This shouldn't change the logic here, but hopefully makes it easier to
understand.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-12-23 14:16:24 +01:00
Lukáš Hrázký ea94f7f7e6 add an option to set the preferred client icon size
_NET_WM_ICON contains a list of icons and until now, the first one was
picked without regard to it's size. This adds a global option to set
the preferred icon size. When getting the client icon, the best size
match is picked. The size can be set via
awesome.set_preferred_icon_size() and the default is 0, which will pick
the smallest non-zero size icon available.

Signed-off-by: Lukáš Hrázký <lukkash@email.cz>
2015-12-07 22:59:32 +01:00
Uli Schlachter 6ca85af53b Set WM_CLASS and WM_NAME on all our windows (#551)
The only exception is the window for _NET_SUPPORTING_WM_CHECK. That window
already had a _NET_WM_NAME property before and doesn't get a WM_NAME property in
this commit. I just decided for myself that it doesn't need one. :-)

Right after startup with the default config we now have the following situation:

$ xwininfo -root -tree

xwininfo: Window id: 0x2d7 (the root window) (has no name)

  Root window id: 0x2d7 (the root window) (has no name)
  Parent window id: 0x0 (none)
     7 children:
     0x200011 "Awesome drawin": ("awesome" "awesome")  1500x20+0+0  +0+0
     0x200010 "Awesome drawin": ("awesome" "awesome")  1x1+0+0  +0+0
     0x20000d "Awesome drawin": ("awesome" "awesome")  100x30+0+0  +0+0
     0x20000a "Awesome no input window": ("awesome" "awesome")  1x1+-1+-1  +-1+-1
     0x200009 "Awesome systray window": ("awesome" "awesome")  1x1+-1+-1  +-1+-1
     0x200008 "awesome": ("awesome" "awesome")  1x1+-1+-1  +-1+-1
     0x200007 "Awesome WM_Sn selection owner window": ("awesome" "awesome")  1x1+-1+-1  +-1+-1

One of those drawin is the awful.wibox. Another drawin is created by awful.menu.
I guess that the third one is created by awful.tooltip, but I'm not sure. Wow,
so many windows...

Closes https://github.com/awesomeWM/awesome/pull/556.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-11-19 22:23:25 +01:00
Uli Schlachter 4a094fa482 Add support for _NET_FRAME_EXTENTS
Support for this property is required since EWMH version 1.3.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-07-05 14:45:51 +02:00
Daniel Hahler cb7f4b06eb Use `hints` table argument with `request::activate` signal 2015-06-25 06:47:39 +02:00
Daniel Hahler ed09d8ed4f Use request::activate with raise=false instead
Ref: https://github.com/awesomeWM/awesome/pull/224#issuecomment-101790416
2015-06-25 06:47:39 +02:00
Daniel Hahler 72659a5ebb Merge pull request #122 from blueyed/fix-ldoc-doxygen-warnings
doc: fix doxygen settings / warnings
2015-02-15 11:49:50 +01:00
Daniel Hahler 8919faa7b3 doc: fix warnings from doxygen 2015-02-14 20:17:13 +01:00
Emmanuel Lepage Vallee d688ebe6cd Add new request::urgent signal
This fix two things:

(1) Clients asking to be urgent while focussed, this have been reported
a few time for urxvt and I usually link a patch that fix this. This may
not be considered a bug by some, but I think it is.

(2) Add the ability to stop noisy clients from setting the urgent state
themselves.
2015-02-10 19:27:46 +00:00
Uli Schlachter e5120e1bec Hide globalconf.L
Everything that needs the lua_State should create a local variable like this:

  lua_State *L = globalconf_get_lua_State();

This ensures that the compiler warns if there are two variables with name "L" in
scope. The idea here is that it should become harder to accidentally use the
global lua state instead of the state of the current state.

While writing this commit, I found another place that gets its wrong: Reading
client.focus from a coroutine was broken, since it was returning the result on
the main thread instead of the current one.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 11:56:58 +01:00
Emmanuel Lepage Vallee 37684abe33 Add context to request::activate signal 2014-10-25 23:31:23 -04:00
Uli Schlachter d2b1e92f9e Clean up header includes
Every .c file has to include the corresponding .h file first to make sure the
headers are self-contained. Additionally, this moves some unneeded includes
around.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 20:07:48 +02:00
Uli Schlachter d8b73de739 screen.[ch]: Move into objects/
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 15:12:47 +02:00
Uli Schlachter 873358a0b8 EWMH: Handle _NET_WM_DESKTOP in lua
We now handle all "important" EWMH messages in lua and lua can decide to do
different things than the current obvious one.

Consistency!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-17 16:15:20 +01:00
Uli Schlachter 9e4270f2e7 ewmh: Use client_set_sticky() for making clients sticky
We can't just directly assign c->sticky directly, because we should emit the
right signals and unban the client if it is currently ban. All of that gets
handled by client_set_sticky().

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-17 15:38:20 +01:00
Uli Schlachter a9e0d258b7 EWMH: Ignore invalid _NET_WM_DESKTOP
Commit e291c0398 already made awesome ignore invalid values for _NET_WM_DESKTOP.
That commit just made it tag clients with the first tag if they used an invalid
value for this property.

This commit reverts 90% of that change. What is still left is the range
validation. Previously, awesome would untag a client completely when it got such
a _NET_WM_DESKTOP property / message. Now, such messages are just silently
ignored.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-17 15:34:44 +01:00
Uli Schlachter 61fdd8cd40 ewmh: Factor out common code into a helper function
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-17 15:33:28 +01:00
Uli Schlachter 2ac95b4ae8 Fix handling of _NET_CURRENT_DESKTOP messages (FS#1219,FS#1217)
Instead of having the C code mess with which tags are selected, we now emit a
signal on the tag that says that something requested it to be selected. Lua can
then handle this by only switching tags on the correct monitor and by updating
the focus history correctly.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-08 15:33:34 +01:00
Uli Schlachter 04dee81d13 client: Add request::activate signal (FS#848)
When we receive a _NET_ACTIVE_WINDOW request on the root window, we used to just
focus and raise the window. This didn't do much for clients which are on
non-selected tags.

Thus, this commit makes awesome emit request::activate on the client instead.
This is used in awful.ewmh to implement the old behavior again, but with
additionally marking the client as urgent if it isn't visible.

People who don't like this behavior can use client.disconnect_signal to disable
this behavior again. To make this really possible, awful.ewmh becomes a
"non-nil" module.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-06 17:47:55 +01:00
Uli Schlachter 1703801728 ewmh: remove _NET_DESKTOP_GEOMETRY support
Our tag concept doesn't really fit into ewmh. Thus, we were setting this
property to a way too small value anyway (just the size of the first screen in
case of multiple screens).

Since this property is optional in ewmh, let's just drop it.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-09-27 23:01:49 +02:00
Stefan Haller ca73777017 Raise the window on EWMH request.
Additionally to handing over the focus to the window this commit raises
the window too. Otherwise a window which is hidden below other windows can
request the focus and because the window is not fully exposed, the user is
unaware which window has the input focus and is actually receiving the
keystrokes.

Signed-off-by: Stefan Haller <haliner@googlemail.com>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-02-20 13:04:15 +01:00
Uli Schlachter 8348d44444 Tags: Remove screen property
A tag's screen is now implemented purely in lua and it is no longer C's
business.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-23 10:05:34 +02:00
Uli Schlachter e57af377bb Don't pass cairo surfaces around on the lua stack
Now that the C code uses lightuserdata for passing around cairo surfaces, they
are no longer automatically garbage collected. To avoid memleaks, this commit
compares the C code to use cairo_surface_t pointers instead of the lua stack.

This also fixes a memleak were a client's icon was leaked.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-28 09:29:47 +02:00
Gregor Best c2ea920ca0 remove encoding=utf-8 from modelines
This option is no longer valid in modelines, so it has been removed from
all modelines using the following shellscript:

    #!/bin/ksh

    git ls-tree -r HEAD | cut -f2 | while read f; do
        egrep -e '^(//|--) vim: .*encoding=' $f >/dev/null || continue
        sed -E -e '/^(\/\/|--) vim:/s/:encoding=utf-8//' $f > /tmp/foo
        mv /tmp/foo $f
    done

Signed-off-by: Gregor Best <gbe@ring0.de>
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-09-11 17:34:09 +02:00
Uli Schlachter f931af7ce1 Rename globalconf.client_focus to focus.client
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-10 14:46:56 +02:00
Uli Schlachter 5f5787d97b Wibox: Rename to drawin
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 13:36:02 +02:00
Uli Schlachter d213f19c5f Widgets: Remove
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 13:27:21 +02:00
Uli Schlachter 146a5dd67c Convert a client's icon to a cairo surface
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 13:18:35 +02:00
Uli Schlachter b6fa779972 Wibox type: Make this work correctly
The last commit caused some lua errors and reading a wibox' type property
didn't work. This should all be fixed now.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-28 13:07:31 +02:00
Uli Schlachter b0f125a664 ewmh: Use the libxcb define
WINDOW is a deprecated define which will be removed. We should be using
XCB_ATOM_WINDOW instead.

This is a follow-up to 5d0a81c8bf.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-15 21:25:54 +02:00
Uli Schlachter 32d389bb48 ewmh: Stop using the "new" signal in C
As with the previous commit, signals on objects will also be emitted on the
appropriate class. This can be used for out ewmh stuff, too.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 18:36:24 +02:00
Julien Danjou 6d332f07a0 lua{class,object}: rename signals functions
I knew this was wrong at the beginning, f*ck.

Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-25 20:28:20 +02:00
Julien Danjou f523b37e1d lua{class,object}: {add,remove}_signal() take lua_CFunction as arg
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-25 20:14:55 +02:00
Julien Danjou 548e5441b1 ewmh: use client signals to call ewmh_update_net_client_list
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-08-18 10:38:17 +02:00