Commit Graph

241 Commits

Author SHA1 Message Date
Emmanuel Lepage Vallee b4ece0f053 doc: Use an explicit tag for all static functions.
This way their name doesn't get mangle by the broken magic. It will also
eventually allow to `error()` in the template when the implicit
`@function` is used.

This commit also fixes a large number of issues found while
proof-reading everything.
2019-06-08 18:14:13 -04:00
mergify[bot] 2d2dba0d80
Merge pull request #2643 from psychon/selection_ownership
Add API for setting clipboard contents
2019-02-26 19:57:05 +00:00
Uli Schlachter 2afa5b5fae Move setup of selection() to selection.c
The function selection() is now registered in the Lua global table from
selection.c instead of in luaa.c. This "feels cleaner" to me and is
preparatory for later changes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-16 15:44:42 +01:00
Uli Schlachter b979fb724a Start a selection transfer object
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:21:43 +01:00
Uli Schlachter 94d413345a Prepare a selection acquiring interface
No run-time behaviour is changed so far.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-11 09:01:21 +01:00
mergify[bot] ec47abb4bc
Merge pull request #2639 from psychon/selection_get
Add selection getter objects
2019-02-11 04:00:59 +00:00
Uli Schlachter e17912ec0c Prepare a selection getter interface
This prepares a new class for getting selection contents. No run-time
behaviour changes yet.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-07 15:16:48 +01:00
Uli Schlachter 0295df81c1 Prepare a selection watcher interface
This commit adds the necessary method calls to setup the class and also
so that xfixes selection notify events can be handled. Currently, these
are empty functions, but later commits will fill them.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-02-06 09:30:16 +01:00
Emmanuel Lepage Vallee 5e6b02274e luaa: Add a way to query the currently pressed modifiers.
This will make awful.key.execute less unreliable
2019-01-21 03:13:26 -05:00
Uli Schlachter 6f2b7435c3 Remove unused Xlib Display* from luaA_get_modifiers
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-21 01:08:48 -05:00
Uli Schlachter 333f92098a Use existing keymap to map codes to symbols
This also ports the code from libX11 to using xkbcommon for the job.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-21 01:08:48 -05:00
Uli Schlachter 33cd091d02 Use existing xkbcommon functionality instead of XKeysymToString
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-21 01:08:48 -05:00
Uli Schlachter 56db19fbef luaA_get_modifiers: XCBify XGetModifierMapping
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-21 01:08:48 -05:00
Uli Schlachter 5b7edf0574 get_modifier_name: Use XCB defines instead of Xlib's
Signed-off-by: Uli Schlachter <psychon@znc.in>
2019-01-21 01:08:48 -05:00
Emmanuel Lepage Vallee 44c5ca41d9 awesome: Add a `modifiers` field. 2019-01-20 22:39:43 -05:00
Daniel Hahler 6f2ab576b8 awesome.kill: use luaL_checknumber
Fixes https://github.com/awesomeWM/awesome/issues/2534.
2019-01-03 13:43:09 +01:00
Daniel Hahler b3311674d2 awesome.kill: allow negative PIDs (and 0) to support process groups
From `kill(3p)`:

> If pid is greater than 0, sig shall be sent to the process whose
> process ID is equal to pid.

> If pid is 0, sig shall be sent to all processes (excluding an
> unspecified set of system processes) whose process group ID is equal to
> the process group ID of the sender, and for which the process has
> permission to send a signal.

> If pid is −1, sig shall be sent to all processes (excluding an
> unspecified set of system processes) for which the process has
> permission to send that signal.

> If  pid  is  negative,  but not −1, sig shall be sent to all processes
> (excluding an unspecified set of system processes) whose process group
> ID is equal to the absolute value of pid, and for which the process has
> permission to send a signal.
2018-07-04 14:55:51 +02:00
Emmanuel Lepage Vallee 45135b28b1 shims: Use cairo PNG support instead of GDK
It is inferior, but at least doesn't print warnings on Travis due
to the lack of X server.
2018-02-25 18:01:08 -05:00
Uli Schlachter c5badcbe37 Add awesome.pixbuf_to_surface
This function takes a GdkPixbuf, copies it to a cairo image surface and
returns the image surface.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2018-01-18 18:10:35 +01:00
Daniel Hahler cc68ac9292
doc: fix wallpaper_changed signal, SETUP_SIGNAL comment (#2141) 2017-12-20 01:26:06 +01:00
Emmanuel Lepage Vallée 1f8b07d475 debug: Add a signal for deprecation warnings (#1832)
Fixes #1612.
2017-06-21 02:06:32 +02:00
Uli Schlachter d8412cb51d Re-add documentation of xproperty API (#1843)
The documentation for awesome.register_xproperty, awesome.get_xproperty
and awesome.set_xproperty were lost in commit 26f15a13f3. This
commit adds them back.

Fixes: https://github.com/awesomeWM/awesome/issues/1817
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-06-13 21:29:20 +02:00
Holger Schurig bf2c1993db doc: fix signals (#1455)
- rule reordering was mentioned twice in the NEWS
- fix all shown luadoc errors
- add missing descriptions for signals in module "awesome"
2017-01-28 15:03:56 +01:00
Uli Schlachter de4715cacd Merge branch 'find-fallback-config' of https://github.com/psychon/awesome 2017-01-27 17:39:30 +01:00
Uli Schlachter df8346ceae Merge branch 'export-paths' of https://github.com/psychon/awesome 2017-01-27 17:36:55 +01:00
Uli Schlachter 9922c3c8e9 Explicitly try the default configuration
Up to now we assumed that the default config is in a path where
xdgConfigFind() finds it. However, evidently this is not always the
case, so make this explicitly try the default configuration file.

Fixes: https://github.com/awesomeWM/awesome/issues/1346
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-26 15:18:37 +01:00
Uli Schlachter 95b1305613 Refactor config fallback
Before this, there was a function which attempted to load different
configuration files in the right order. There was a boolean argument
that decided if we are actually loading it or just checking for syntax
error (for the --check argument of awesome). This lead to some
not-so-nice code since we do not want to fall-back to another config
when checking for syntax errors.

Refactor this so that there is now a function which calls a callback
function with the different paths that should be tried. This function
returns as soon as the callback function returns true.

Since just checking if the config syntax is ok does not depend on any
Lua state, an empty Lua state is now used for this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-25 14:10:19 +01:00
Uli Schlachter 89202529ea Move some code from luaa.c to awesome.c
It makes more sense to append the xdg config dirs to our list of
searchpath in awesome.c than in luaa.c. Plus, it simplifies some of the
following work.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-25 13:50:52 +01:00
Uli Schlachter 288e44596f Export build-time paths as entries on awesome
This removes some @EXPANSIONS@ from Lua files and removes a hack that
was needed. All is better now! :-)

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-25 09:41:11 +01:00
Holger Schurig 249f5461bf doc: fix documentation of two signals (#1441)
Previously ldoc stopped after the "e.g." when generating the signals
overview.
2017-01-23 22:28:26 +01:00
Renato Botelho 86fb767d77 Fix build on FreeBSD (missing SIGPOLL) (#1379) 2017-01-10 15:51:11 +01:00
Uli Schlachter c96987909e Modify package.cpath (#1371)
* luaa.c: Remove useless stack operation

We get package.loaded and immediately throw away the result. That's
pointless, so remove this.

Signed-off-by: Uli Schlachter <psychon@znc.in>

* Refactor modification of package.path

Awesome adds various entries to package.path during startup. This commit
moves that into a helper function. No functional changes intended. The
only change I did to the code was changing a call to lua_type(L, 2) into
lua_type(L, -1);.

Signed-off-by: Uli Schlachter <psychon@znc.in>

* Modify package.cpath just like package.path

This adds, for example, paths specified via the --search argument also
to package.cpath.

Fixes: https://github.com/awesomeWM/awesome/issues/1248
Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-09 01:03:16 +01:00
Uli Schlachter 54dd973e3f Add awesome.sync()
This function should only be necessary for the test suite. It makes sure
that the X11 server received and handled all previous requests that
awesome sent. This will be needed, for example, in tests that use
root.fake_input().

After a call to awesome.sync(), we are sure that "faking input" has been
done and the next main loop iteration will handle the input event.
Without the sync, it could happen that the X11 server did not yet fake
the input in the next iteration.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2017-01-02 19:34:41 +01:00
Uli Schlachter d71bb665d1 awesome.quit(): Add exit code argument (#1192)
Fixes: https://github.com/awesomeWM/awesome/issues/1184
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-27 10:40:53 +02:00
Uli Schlachter 0b17e5dac3 Fix unbalanced Lua stack operation (#1162)
Add a single "do" to the beginning of the config. This causes a parsing
error ("'end' expected") and then another warning saying "something was
left on the Lua stack.

Fix this by popping the error message where we need to do so.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-22 10:44:54 +02:00
Uli Schlachter 259c4f716f Remove @release @AWESOME_VERSION@ everywhere (#1157)
It does not provide much value. The version number is already known to
ldoc globally in the "description" variable.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-10-09 22:36:20 +02:00
Emmanuel Lepage Vallee 979d2289fc doc: Port the Awesome (global API) to the ldoc 2016-09-26 00:40:20 -04:00
Uli Schlachter 24bb38969d Add an option to add a path to $LUA_PATH
The same effect could be achieved by modifying $LUA_PATH or with symlinks, but
having a special option to do this seems easier.

Note that the man page translations were generated via Google translate. I'm
looking forward to people submitting correct translations...

Inspired-by: https://github.com/awesomeWM/awesome/pull/485
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-08-20 16:04:11 +02:00
Uli Schlachter 6f1df7a3ad Fix disconnecting not connected signals (#950)
When a function is disconnected from a signal ("disconnect_signal") that is not
actually connected to the function, two things happened:

1. The attempt to remove the function from the signal array didn't do anything
2. Unreferencing the function noticed that the function wasn't referenced

The second step printed a big, fat scary warning.

Actually, this has the possibility of causing errors. For example, in the
following code, awesome would wrongly unreference the function at the
disconnect_signal() call and might later still try to call it when the
"refresh" signal is emitted:

do
    local function f() end
    awesome.connect_signal("refresh", f)
    awesome.disconnect_signal("debug::error", f)
end

Fix this by making signal_disconnect() return a boolean value indicating if it
actually did something. All callers are fixed to use this value and only update
the reference counts if something was actually disconnected.

Fixes: https://github.com/awesomeWM/awesome/issues/814
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-09 00:03:08 +02:00
Uli Schlachter 231436d9e3 C: Remove unneeded calls to signal_add()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-04 17:57:08 +02:00
Uli Schlachter e5f9ec4723 C code: Move docs for signals away from signal_add()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-06-04 17:39:14 +02:00
Uli Schlachter badf338542 Add awesome.hostname
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-27 19:22:42 +02:00
Uli Schlachter 2d35886a76 Add awesome.{kill,unix_signal}
kill is a wrapper around the POSIX kill() function and unix_signal is a table
that maps signal numbers to their names and signal names to their numeric value.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-05-27 19:22:41 +02:00
Uli Schlachter d46e11f5e1 Add range-checking to lots of arguments in the C code
This change catches things like c:geometry { width = -42 }.

Helps-a-bit-with: https://github.com/awesomeWM/awesome/pull/820 (fixes X errors)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-04-18 04:20:22 -04:00
Daniel Hahler 89b2ea6c08 Add exclamation mark with error in luaA_dofunction_on_error
This makes it more obvious/visible in the log / output.
2016-03-06 14:46:45 +01:00
Uli Schlachter 2209f58e5d Balance the stack in luaA_loadrc()
In various conditions, luaA_loadrc() left luaA_dofunction_on_error and an error
message on the Lua stack. Also, it used LUA_MULTRET without looking at the
return values. Fix all of this and reorder the code a bit to make it easier to
follow.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-17 19:03:48 +01:00
Uli Schlachter 051d0de85f Replace many pushnumber calls with pushinteger
The only remaining calls are for a window's opacity and in the DBus type
handling. Everything else wants integers, not something with a comma.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-02-06 13:46:46 +01:00
Cory Burgett 5d27aa812c Add signal emission for monitor connect/disconnect 2016-01-30 12:22:03 -05:00
Uli Schlachter 2e58a9c6eb awesome.load_image(): Return errors instead of "throwing" them
Signed-off-by: Uli Schlachter <psychon@znc.in>
2016-01-15 18:38:51 +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