Commit Graph

244 Commits

Author SHA1 Message Date
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
Uli Schlachter 7ed29196bb Make awesome.quit() during startup work
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-10-10 22:25:56 +02:00
Uli Schlachter 5f6bbdfc63 Add and use luaA_tolstring()
This is a version of luaL_tolstring() that also works with Lua 5.1.

Closes https://github.com/awesomeWM/awesome/issues/471.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-09-29 00:28:26 +02:00
Daniel Hahler 5c446c9c09 luaA_dofunction_on_error: call luaL_tolstring on error
This prevents a follow-up error through lua_concat, in case the error is
not a string.

Ref: https://github.com/awesomeWM/awesome/issues/301
2015-08-01 18:23:52 +02:00
actionless cec04b2684 Add DPI support and 'xresources' theme
This makes awesome respect DPI settings, and adds a new theme based on
xrdb and xsettingsd color settings ("xresources").

Closes https://github.com/awesomeWM/awesome/pull/229
2015-06-25 06:40:38 +02:00
Julian Wollrath 26f15a13f3 Document C API directly in the C source code
v2: Add available signals to the docs.

Signed-off-by: Julian Wollrath <jwollrath@web.de>
2015-06-19 23:13:31 +02:00
Aleksey Fedotov 996f6785a8 xkb: implementation of keyboard layout switched
This patch provides functions to get/set current keyboard layout.

Current implementation doesn't support any configuration of layout,
it's a merely a layout indicator and switcher, however layout
configuration can be set by tools like setxkbmap or by any third-party
tools.
2015-03-03 00:33:16 +03:00
Uli Schlachter 006b43cb6f awesome: Add startup signal
Signed-off-by: Uli Schlachter <psychon@znc.in>
2015-02-14 15:41:11 +01:00
Uli Schlachter 94e61ec94b timer: Move from C to lua as gears.timer
No API-change (besides the obvious no-longer-a-global-object) intended.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-12-06 16:44:04 +01: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
Uli Schlachter a7cdbf468b Only include awesome-version-internal.h in one place
This means we have one less file which gets recompiled every time the result
from "git describe" changes.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-13 17:48:03 +02: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 271f084735 screen: Turn into proper lua object
This makes the screen objects use our existing infrastructure for implementing
classes and objects with lua instead of hand-rolling an own version.

This results in some small API change: Screen objects no longer have an
add_signal() function and instead this function exists on the parent screen
class.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 16:37:19 +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 e39ed59797 awesome.startup_errors: Never emit debug::index::miss
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 19:29:04 +01:00
Uli Schlachter 88facb7f57 Make debug::index::miss and newindex work on classes and all objects
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 19:27:06 +01:00
Uli Schlachter a6fb932bbc awesome: Add get_* and set_xproperty
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 18:23:34 +01:00
Uli Schlachter 02cb961edf luaa: Remove lots of unused code
Most of these are unused since the drawing code was moved to lua. For example,
the old wibox code needed the metatable entries __next, __ipairs and __pairs so
that w.widgets worked correctly and could pretend to be a regular lua table.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-18 16:28:42 +01:00
Uli Schlachter 4d35f430dc Add awesome.startup
This boolean describes if we are still in startup or if our main loop is already
running.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-16 20:09:43 +01:00
Uli Schlachter 62e2dee4ba Add awesome.register_xproperty (FS#1212)
This commits adds awesome.register_xproperty(). This allows lua code to register
arbitrary X11 properties with awesome which will then watch these properties.
Whenever such a property is changed on a client or drawin, we will emit the
xproperty::name signal.

This also adds window:get_xproperty(name) and window:set_xproperty(name, value)
which allows to mess with properties.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-07 16:17:40 +01:00
Uli Schlachter 4717e89984 Update fields for capi.awesome in C comment
This should have been part of commit 2f39986, sorry!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-07 10:44:48 +01:00
Uli Schlachter 360e1a5f92 Add awesome.composite_manager_running
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-02-23 12:14:50 +01:00
Uli Schlachter 0c62831eea lua: Print traceback on startup errors
We do some special magic so that we can have tracebacks on errors messages.
However, the code for parsing the rc.lua called it without this magic and thus
errors didn't have tracebacks.

This is bad, because if something goes wrong in e.g. wibox.widget.textbox, you
don't really have any clue where this error is coming from.

Fix this by adding our "print traceback on error"-magic here, too.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2013-06-08 13:21:14 +02:00
Uli Schlachter ea30119410 Use glib instead of libev
This commit ports awesome from libev to the glib main loop. This means that
awesome has fewer dependencies, because we were already depending on glib before
and now no longer need glib.

However, the main reason for this change is that, thanks to lgi, we have glib
bindings for lua. This means that lua code can add all kinds of event sources to
the main loop (timeouts, fd watchers, SIGCHLD watchers, ....). Yay

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-11-21 21:01:12 +01:00
Uli Schlachter f0512eeaab Introduce drawables
A drawable is something that you can draw to, just like a drawin. However, a
drawable isn't necessarily its own windows. This will later on be used to
implement titlebars where the titlebars are drawables.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-10-14 17:30:54 +02:00
Arvydas Sidorenko f41590e19c Wrapped luaL_register
Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2012-06-12 13:32:40 +02:00
Arvydas Sidorenko db0d23606d Portable way to replace standards Lua funcs
Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 11:03:26 +02:00
Arvydas Sidorenko d61cdb86c9 Renamed luaL_reg to luaL_Reg
The original struct name is luaL_Reg, but Lua v5.1 had a
`typedef luaL_reg luaL_Reg`, which in v5.2 was removed
and as a result breaking the build in Awesome which uses luaL_reg
version exclusively.

Signed-off-by: Arvydas Sidorenko <asido4@gmail.com>
2012-06-12 10:52:10 +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
Uli Schlachter 4f30dfd198 Switch from oocairo to lgi.cairo
Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-05-27 19:20:34 +02:00
Uli Schlachter 2bd29f2ab4 Add a wallpaper_changed signal
This signal fires whenever the, well, wallpaper changes. Who would have guessed?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-04-07 21:52:24 +02:00
Uli Schlachter 9451fec6f1 Add awesome.load_image()
This uses imlib2 for loading the image and thus supports more image formats than
just PNG.

Almost fixes: FS#958

Signed-off-by: Uli Schlachter <psychon@znc.in>
2012-01-29 14:08:57 +01:00
Majic ba7c7eafff Re-add missing debug::deprecation signal
Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-12-05 20:43:14 +01:00
Majic 0e8fc995bb Minor readability fixes, STREQ()-like macros added
Signed-off-by: Julien Danjou <julien@danjou.info>
2011-11-18 17:56:21 +01:00
Uli Schlachter 2354c6a623 Signal config errors via a naughty popup
If loading of any config file fails, awesome will now remember the error message
and make it available to lua. The default config is modified to open a naughty
popup on errors.

This should help all those people who modify their config and then wonder why
there change is ignored, not noticing awesome's error message on stderr.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-10-23 17:36:19 +02:00
Julien Danjou bf56ae79dd Set the conffile value before executing the code
Signed-off-by: Julien Danjou <julien@danjou.info>
2011-09-17 17:23:59 +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
Chris Newton 471babcc70 Added a flag to the exit signal
This boolean can be used to differentiate between restarts and exits.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2011-03-21 07:41:41 +01:00
Uli Schlachter ab3674ec13 luaa: Add "refresh" signal
This signal is emitted whenever awesome finishes the current event loop run.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-15 18:48:07 +02:00
Uli Schlachter 9deafe68c8 Font: Remove, oopango took over the job
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 20:09:17 +02:00
Uli Schlachter 6826e5dfc4 Remove globalconf.colors
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 20:01:44 +02:00
Uli Schlachter 742c0dead0 Systray: Fix
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-10-06 15:38:44 +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 db3b1fe431 Image: Remove
Everything now uses oocairo instead.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-29 19:36:58 +02:00
Uli Schlachter 44f64eee58 Automatically load oocairo and oopango on startup
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-09 16:54:50 +02:00
Uli Schlachter f2e9767434 luaa: Stop using a_tokenize()
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-09-02 19:08:08 +02:00
Uli Schlachter 932e0bfcd0 Add two more missing signals
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-27 21:42:14 +02:00
Uli Schlachter e0774377ca Sort all signal lists alphabetically
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-26 17:46:17 +02:00
Uli Schlachter ab4c151ed8 Add signals before using them
This commit makes it an error if an unknown signal is connected, disconnected or
emitted. All signals have to be added before they can be used.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-25 23:00:36 +02:00
Uli Schlachter 948f960b7e Also rename the signal_* C function
Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-25 20:48:42 +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
Uli Schlachter 1d95153286 Remove all uses of attribute "unused"
Awesome is built with -Wno-unused-parameter which means there is no point in
explicitly marking arguments as unused.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-08-08 18:19:15 +02:00
Uli Schlachter e5de0abfb4 Fix an unbalanced lua stack operation
luaA_init() left the global "package" table on the stack.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-23 16:18:14 +02:00
Uli Schlachter 11084c774c Handle errors in the config better
luaA_loadrc() now returns a failure when executing the config file causes an
error.
Previously it returned a success which meant the next config file wasn't tried.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2010-07-15 19:21:02 +02:00
Julien Danjou 220d072164 window: import class
Signed-off-by: Julien Danjou <julien@danjou.info>
2010-05-28 13:27:42 +02:00
Julien Danjou 8966715b26 luaa: dump backtrace on panic
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-16 11:26:32 +01:00
Julien Danjou e3ba851692 spawn: disable signalfd in libev
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-14 09:55:29 +01:00
Julien Danjou c036ea5f3e globalconf: move conffile out
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-10 10:48:58 +01:00
Julien Danjou 2a73f6dd9d luaa: luaA_next is static
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-11-09 21:28:37 +01:00
Julien Danjou 31552f2122 font: remove draw_ prefix in names
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-27 12:16:22 +01:00
Julien Danjou 3ce7638e0f window: rename to xwindow
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:05 +02:00
Julien Danjou 371ee3e8cc titlebar: remove
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:05 +02:00
Julien Danjou e204473dfc client: move into objects
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:05 +02:00
Julien Danjou 104e28778b tag: move into objects
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:04 +02:00
Julien Danjou 86127a9f49 timer: move into objects
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:04 +02:00
Julien Danjou 4c178d5441 hooks: remove
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-10-20 20:42:04 +02:00
Julien Danjou b2297fda46 globalconf: remove config.h include
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-07 17:28:55 +02:00
Stephen Sugden b6a066b040 Put homedir before /usr/share in lua search path
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-09-07 10:40:56 +02:00
Brian Gianforcaro 3145e3145e Grammar/spelling corrections in comments and docs.
Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-31 10:39:36 +02:00
Julien Danjou b83766b4c9 luaa: emit signal on runtime error
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-27 17:55:47 +02:00
Julien Danjou 3739aabda1 lualib: allow to replace error handling function
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-27 17:53:51 +02:00
Julien Danjou 0b3b13ba19 luaa: restart awesome on Lua PANIC
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-27 16:04:40 +02:00
Julien Danjou a6c4459a3a luaa: replace os.execute()
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-27 12:08:02 +02:00
Julien Danjou 4d0a025f51 luaclass: add handling of {new,}index of missing properties (FS#584)
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:48 +02:00
Julien Danjou 3105663933 global signals use signal_object_emit
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:48 +02:00
Julien Danjou a02d026f77 client: port to new object system
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:47 +02:00
Julien Danjou 84839d456d wibox: port to new object system
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:47 +02:00
Julien Danjou a916f2cd55 image: port to new class system
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:47 +02:00
Julien Danjou dc61d258f0 luaclass: optimize type handling
We use lua_class_t pointer as key in the registry to store metatable we
will compare.
lauxlib uses a string, which sucks, because it forces to do a
pushliteral() each time you want to get a metatable from the registry,
which is slower.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:47 +02:00
Julien Danjou 99b75bf486 tag: port to new object system
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:47 +02:00
Julien Danjou 59c991ace0 widget: port to new object system
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:47 +02:00
Julien Danjou 27fd05320e button: use new object system
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:46 +02:00
Julien Danjou 04e55739fe key: port to new object system
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-21 15:30:46 +02:00
Julien Danjou 432f4229be timer: import
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-17 17:49:06 +02:00
Julien Danjou 84182466e0 spawn: move sn hooks to signals
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-17 17:47:55 +02:00
Julien Danjou ada6056c89 color: do not take pointer to push
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-08-17 17:46:35 +02:00
Julien Danjou 073e0377dd Revert "key, button: use as simple table"
This reverts commit d7454f4307.

Conflicts:

	button.h
	key.h
	lib/awful/titlebar.lua.in
	lib/naughty.lua.in
	wibox.c
	wibox.h
	widget.c
2009-08-14 16:48:52 +02:00
Julien Danjou 299bc00286 dbus: move to signal
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-29 16:10:29 +02:00
Julien Danjou 284338532b luaobject: add type recognition
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-29 15:48:19 +02:00
Julien Danjou 706d545076 luaclass: register class in an array
That should permit class identification.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-29 15:48:19 +02:00
Julien Danjou eed9864ab0 luaobject: add signals
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-29 15:48:18 +02:00
Julien Danjou d7454f4307 key, button: use as simple table
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-28 10:44:54 +02:00
Julien Danjou a1b113901c luaobject: change global refering method
We now store elements in registry:
registry.pointer = userdata

And count references.

Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-28 10:40:51 +02:00
Brian Gianforcaro 404ec8eb24 Fix doxygen generation warnings.
Signed-off-by: Brian Gianforcaro <b.gianfo@gmail.com>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-07-27 11:18:43 +02:00
Julien Danjou df20e95f82 color: move push color function to color.c
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-19 17:01:01 +02:00
Uli Schlachter 55524ece8d Use a libev prepare watcher for calling awesome_refresh()
Before this, awesome_refresh() could be called multiple times per mainloop and
one had to make sure to add awesome_refresh() calls in the right places.

Now, the prepare handler is invoked just before libev puts the process to sleep
(e.g. by calling select()) and awesome_refresh() does its thing.

All redundant calls to awesome_refresh() are removed, but the one in
selection.c has to stay because this function blocks in xcb_wait_for_event()
without using libev.

Signed-off-by: Uli Schlachter <psychon@znc.in>
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-19 09:34:42 +02:00
Julien Danjou e4acb74a5a luaa: split dofunction()
Signed-off-by: Julien Danjou <julien@danjou.info>
2009-06-10 11:44:29 +02:00