Commit Graph

5938 Commits

Author SHA1 Message Date
Evžen 7a812fe28d fix(lib.awful.taglist): multiple tag selection
multiple tag selection wasn't highlighting properly when *_occupied is set in theme table
2014-08-24 13:31:07 +02:00
Jason Yan 3c5a1d44e2 Fix check against clients in taglist. 2014-08-24 13:30:59 +02:00
Uli Schlachter e211190234 systray: Only register/unregister when needed
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-24 13:30:16 +02:00
Uli Schlachter 9846a3274a systray: Only intern the atom once
Let's just save the systray atom and keep it around. Why should we redo this
every time this atom is needed?

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-24 13:30:12 +02:00
memeplex aec8e2944a Fix for FS#1293
FS#1293 - Systray won't show with margin layout

https://awesome.naquadah.org/bugs/index.php?do=details&task_id=1293&project=1&order=dateopened&sort=desc
2014-08-24 13:30:00 +02:00
Uli Schlachter 19252f87fe wbox: Make :find_widgets() easily accessible
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-08-24 13:29:58 +02:00
Sindre Føring Devik a74b3fccaa FS#1278 - Menubar should check all standard directories
Added local desktop directory to list of directories parsed by menubar
by using the XDG specification
2014-08-24 13:29:32 +02:00
Uli Schlachter 4073f8d886 Call AllowEvents after grabbed events on a drawin
When we get an event due to a previous GrabButtons call, we have to continue
normal event processing again, because the server froze the input device for us.
Without this, everything appears to freeze.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-21 10:42:23 +02:00
Uli Schlachter 160eba9384 change codename again
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-11 11:07:10 +02:00
Uli Schlachter dbfe624f67 awful.tag.setscreen: Check if old_screen == new_screen
Setting a tag's screen to what it already is shouldn't have any bad effects.
However, this code messed up the tag order and selection status.

Fix this by returning early if the tag already has the right screen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-09 22:05:48 +02:00
Uli Schlachter ca92846bb2 awful.tag.move: Fix tag index setting
Since commit 9c69e857ed, awful.tag.setscreen() unsets a tag's index to make
sure things end up in a sane order on the new screen. Thus, the call to
setscreen() removed the "index" property that tag.move just set.

Fix this by setting the index after the screen.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-09 22:05:47 +02:00
Uli Schlachter 7ec72862d6 gears.surface: Handle the cache more intelligently
It doesn't make sense for surface.load_uncached() to load a file without
inserting into the cache. The next "cached" load will have to load it again.

So move cache insertion into surface.load_uncached() and the only thing that
surface.load() does differently is checking if we have a suitable cache entry
before calling load_uncached().

So load_uncached() does the cache insertion and load() reads from the cache.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-09 21:57:30 +02:00
Uli Schlachter 76ab008b3e naughty: Don't use the cache when loading icons (FS#1253)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-09 21:50:12 +02:00
Emmanuel Lepage Vallee c2fff5396d Make sure gears.color.create_png_pattern are being repeated 2014-04-08 22:58:16 +02:00
Emmanuel Lepage Vallee 9b872f4bce Move 'surface_size' to gears.surface and make it public 2014-04-08 22:54:09 +02:00
Tin Benjamin Matuka b22ea59812 Allow reversing the icon order in systray
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-06 10:44:51 +02:00
Uli Schlachter 927c92bdfb gears.color: Handle nil arguments correctly again
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-03 20:28:05 +02:00
Uli Schlachter 1e442c97c8 imagebox: Don't try to scale by infinite (FS#1248)
When an imagebox was drawn with width or height zero, it tried to calculate the
needed scale factor for making the image fit. Sadly, this would be a division by
zero aka infinite in this case.

Fix this by just not drawing anything if there is no space available.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-02 22:50:13 +02:00
Uli Schlachter 2f7d58afce change codename
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-02 09:59:27 +02:00
Uli Schlachter 85ffd0fc9a wibox.drawable: Assert that no cairo error occurred
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-04-01 16:21:37 +02:00
Uli Schlachter 7709d66b38 Revert "root: Make sure cairo doesn't cache our temporary connection" (FS#1245)
This reverts commit c1cb7883b5.

The cairo surface used for uploading the wallpaper doesn't use a temporary
connection but is on our main connection since commit 5024843e9. Thus, the above
commit broke all of our cairo drawing instead of just making cairo not touch our
temporary connection.
2014-04-01 16:21:28 +02:00
Uli Schlachter 837958447a systray: Don't set WM_STATE on embedded windows (FS#1246)
Apparently there is no spec which requires doing this and other systray
implementations do not do this.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-31 17:42:14 +02:00
Uli Schlachter afdc14c931 awful.tooltip: Add (and use) :set_markup() function
Since commit 5b4666432f, we use set_text() instead of set_markup()
on the tooltip's textbox. This means it is no longer possible to use pango
markup in the tooltip which was not intended.

Fix this (properly) by introducing a :set_markup() function on tooltips (and use
it in the timer function to restore the old behavior).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 23:39:38 +02:00
Uli Schlachter ab182dacc1 awful.tooltip: Small reorganization
This inlines the set_defaults() function into its only caller and makes us less
stupid with the font property.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-30 23:39:36 +02:00
Uli Schlachter 9967ae6533 gears.color: Add a pattern cache
This makes gears.color() cache patterns in a weak table and returns that cached
pattern when we get called with the same argument again.

To benchmark this change, the following code was used:

local time = require("socket").gettime

function benchmark(func)
   local begin = time()
   local iter = 0
   while time() - begin < 1 do
      func()
      iter = iter + 1
   end
   return iter
end

for _, arg in pairs({
   "#00aa00",
   "solid:#00aa00",
   "radial:50,50,10:55,55,30:0,#ff0000:0.5,#00ff00:1,#0000ff",
   "linear:1,2:3,4:0,#000000:1,#ffffff",
   "png:/home/psychon/Wallpaper/Bars.png",
   { type = "solid", color = "#00aa00" },
   { type = "radial", from = { 50, 50, 10 }, to = { 55, 55, 30 }, stops = { { 0, "#ff0000" }, { 0.5, "#00ff00" }, { 1, "#0000ff" } } },
   { type = "linear", from = { 1, 2 }, to = { 3, 4 }, stops = { { 0, "#000000" }, { 1, "#ffffff" } } },
   { type = "png", file = "/home/psychon/Wallpaper/Bars.png" },
}) do
   collectgarbage("collect")
   print(benchmark(function() gears.color.create_pattern(arg) end), arg)
end

Before this change (larger numbers are better, this measures how many times we
can create the given pattern per second):

29525   #00aa00
29344   solid:#00aa00
3446    radial:50,50,10:55,55,30:0,#ff0000:0.5,#00ff00:1,#0000ff
4845    linear:1,2:3,4:0,#000000:1,#ffffff
32855   png:/home/psychon/Wallpaper/Bars.png
29883   table: 0x1bb67e0
3868    table: 0x1bb6830
5339    table: 0x1bb6c60
32772   table: 0x1bb6fe0

After this change:

126188  #00aa00
125962  solid:#00aa00
125125  radial:50,50,10:55,55,30:0,#ff0000:0.5,#00ff00:1,#0000ff
125213  linear:1,2:3,4:0,#000000:1,#ffffff
113659  png:/home/psychon/Wallpaper/Bars.png
125586  table: 0x1232680
125249  table: 0x12326d0
125468  table: 0x1232b00
113711  table: 0x1232e80

As you see, this makes some cases about 35 times faster (although I have to
admit that something like this can be expected from such a synthetic benchmark).

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-29 23:01:17 +01:00
Uli Schlachter 2d8c21af85 gears.surface: Cache files from disk
Instead of loading files from disk every time we need them, add a cache to
gears.surface as a weak table that maps strings to cairo surfaces.

If this cache should be avoided, there is a new gears.surface.load_uncached()
function which works just like gears.surface.load() worked before.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-29 23:01:08 +01:00
Uli Schlachter 2321b0b6c5 change codename
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-29 18:17:20 +01:00
Daniel Hahler cea6b92aea Fix the call to tag.history.restore from tag.delete
By default, tag.history.restore switches between the previous history
states, which is not what should get done when deleting a tag.

Without this, deleting multiple tags in a row, will jump back to the
first/fallback tag, instead of the older history entries.
2014-03-29 18:13:06 +01:00
Daniel Hahler 51f1308ebb Add and improve some comments to awesomerc.lua 2014-03-29 18:09:50 +01:00
Uli Schlachter f12ba8fec0 Ignore enter/leave events when unmanaging a window (FS#1239)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-28 13:32:04 +01:00
Emmanuel Lepage Vallee 9c69e857ed Fix tag screen switching
The bugs this fix are:

 * Invalid request using nil as screen
 * Stop messing indexes in the old screen
 * Prevent c.screen <-> t.screen mismatch
 * Prevent no tags being selected in the old screen
2014-03-26 23:14:23 +01:00
Uli Schlachter 7852bfb22d awful.tag.withcurrent: Try harder at finding a tag (FS#1196)
When a screen doesn't have any tags selected, then just tag the new client with
all of the screen's tags. That way, we don't lose clients.

Also, if we failed at coming up with tags for a client, don't completely untag
it. This means that it can keep its old tags if it had any.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-26 14:30:31 +01:00
Uli Schlachter 0b5fa183d1 Revert "awful.client.movetoscreen: Don't untag clients completely (FS#1196)"
This reverts commit bbe86e4e25. That commit caused
unintuitive, special behavior. Instead, when someone wants us to set a screen,
we really should do so.
2014-03-26 14:30:30 +01:00
Daniel Hahler b5d6c4eb0d Set c.screen in ewmh.tag and before tags in rules.execute
The current premise is that c.screen should be the same as
awful.tag.getscreen(t).

The addition in `ewmh.tag` appears to be the important part here,
changing the order in awful.rules.execute is (maybe) only for
consistency across the codebase.
2014-03-24 22:24:14 +01:00
Daniel Hahler a39a38bf5f Drop focus:raise() in magnifier.arrange
This is a useful fix in general, but especially after commit 620732a
(Remove raise call from mouse.client.move).

Ref: https://github.com/awesomeWM/awesome/pull/9#issuecomment-37736135
2014-03-24 22:23:26 +01:00
Uli Schlachter d8909a947c Revert "Set c.screen in ewmh.tag and before tags in rules.execute"
This reverts commit 6280998306.
2014-03-24 09:49:44 +01:00
Daniel Hahler 812683e48c Expand '~' in the path for beautiful.init
This expands the tilde in the path to beautiful.init and changes the
expansion in theme values to only match '^~/': tilde expansion is only
meant to be expanded at the beginning.

The latter is not really tested.
2014-03-24 09:40:11 +01:00
Daniel Hahler 6280998306 Set c.screen in ewmh.tag and before tags in rules.execute
The current premise is that c.screen should be the same as
awful.tag.getscreen(t).

The addition in `ewmh.tag` appears to be the important part here,
changing the order in awful.rules.execute is (maybe) only for
consistency across the codebase.
2014-03-24 09:40:04 +01:00
Uli Schlachter a73e6c2bd7 drawin: Correctly add property::shape_* signals
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 22:44:18 +01:00
Uli Schlachter 482efb8314 gears.color.create_opaque_pattern: Fix for SurfacePatterns (FS#1236)
Sorry!

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 22:44:12 +01:00
Uli Schlachter 8affa3bc02 beautiful: Don't use non-existant API
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 19:31:10 +01:00
Uli Schlachter 9d8d4775fd awesome.startup_errors: Never emit debug::index::miss
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 19:31:06 +01:00
Uli Schlachter 53c19edae6 Make debug::index::miss and newindex work on classes and all objects
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 19:30:59 +01:00
Uli Schlachter b47b0062f8 rc.lua: Raise all clients by default (regression, FS#1234)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 18:35:34 +01:00
Uli Schlachter c7e32429b8 xproperty: Emit on "awesome" for root window properties
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 18:24:56 +01:00
Uli Schlachter ec484b700a awesome: Add get_* and set_xproperty
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 18:24:49 +01:00
Uli Schlachter b57b19b831 window: Factor out helper functions for xproperties
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 18:24:37 +01:00
Uli Schlachter 7e21f85c3c wibox.layout.base.fit_widget: Enforce sane width and height
Previously, odd things could happen if a widget was getting fitted into a
negative width or, even worse, width being NaN (not a number)!

This can e.g. happen due to a margin layout which doesn't get enough space to
even draw the margin that it is supposed to add.

Fix this by enforcing a minimum value of 0 for the width and height that a
widget gets fitted into.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 17:50:15 +01:00
Uli Schlachter 8003156e62 imagebox: Avoid division by zero
Given an imagebox i with i.resize_forbidden = false and a valid image set, the
call t:fit(0, 0) would return two times "not a number".

This is because the code first does some calculations to get the input image
into the available space and then tried to do some calculations needed for
scaling images up.

The first calculation already gave us h == 0 == w, the second calculation would
then calculate 0/0. This results in NaNs.

This was only noticed because NaN is not a valid table index in lua.

Fix this by returning 0,0 if we have an image of width or height 0 after the
first calculation. Since 0x0 images are valid in cairo, this also fixes the same
bug with such images.

Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 17:50:10 +01:00
Uli Schlachter 23432cfaeb awful.client: Add marked and unmarked signals (FS#1227)
Signed-off-by: Uli Schlachter <psychon@znc.in>
2014-03-23 16:37:48 +01:00