summaryrefslogtreecommitdiff
path: root/func
diff options
context:
space:
mode:
authorTim Keller <tjkeller.xyz>2024-11-09 17:17:43 -0600
committerTim Keller <tjkeller.xyz>2024-11-09 17:17:43 -0600
commit42c09cc886ff24c237f87720056d267458c4a0f9 (patch)
treeb1c53d87b82efec0e81071d278c4df8310dd54d8 /func
parentfea2bd24e83c90c311f4e77ccf46f1464a6f5afb (diff)
downloadawesome-42c09cc886ff24c237f87720056d267458c4a0f9.tar.xz
awesome-42c09cc886ff24c237f87720056d267458c4a0f9.zip
fix sloppy focus raising issue and fix tagnames
Diffstat (limited to 'func')
-rw-r--r--func/sloppyfocus.lua2
-rw-r--r--func/tagnames.lua81
2 files changed, 40 insertions, 43 deletions
diff --git a/func/sloppyfocus.lua b/func/sloppyfocus.lua
index a616286..d044498 100644
--- a/func/sloppyfocus.lua
+++ b/func/sloppyfocus.lua
@@ -1,4 +1,4 @@
-- Enable sloppy focus, so that focus follows mouse.
client.connect_signal("mouse::enter", function(c)
- c:emit_signal("request::activate", "mouse_enter", { raise = false })
+ c:emit_signal("request::activate", "mouse_enter", { raise = true })
end)
diff --git a/func/tagnames.lua b/func/tagnames.lua
index fcd01a4..75284ed 100644
--- a/func/tagnames.lua
+++ b/func/tagnames.lua
@@ -1,51 +1,48 @@
---TODO find out why it doesnt work at start
---local awful = require("awful")
-
-function nametags(s)
- local tags = s.tags
- for _, tag in ipairs(tags) do
- -- set tag basename
- if tag.basename == nil then
- tag.basename = tag.name
- end
+local nametag_format = "%s: %s"
- -- check if tag has any clients. if not, use basename
- if next(tag:clients()) == nil then
- tag.name = tag.basename
- else
- -- loop over all screen clients (ordered top to bottom)
- local hastag = nil
- for _, c in ipairs(s.clients) do
- -- test if client in on the tag
- for _, ctag in ipairs(c:tags()) do
- if ctag == tag then
- hastag = c
- break
- end
- end
- -- if it does, this will be the tag name. so break
- if hastag ~= nil then
- break
- end
- end
- -- set tag name
- -- there should always be a tag since we checked above so if there isnt then there is clearly a problem
- --TODO remove this if statement
- if hastag then
- tag.name = tag.basename .. ": " .. hastag.class
+function nametag(t, name)
+ -- set tag basename
+ if t.basename == nil then
+ t.basename = t.name
+ end
+
+ if name == nil then
+ t.name = t.basename
+ return
+ end
+
+ t.name = string.format(nametag_format, t.basename, name)
+end
+
+function nametagc_t(t, c)
+ local cs = t.screen:get_all_clients(true)
+ if c then
+ table.insert(cs, c)
+ end
+
+ for _, c in ipairs(cs) do
+ for _, ct in ipairs(c:tags()) do
+ if ct == t then
+ nametag(t, c.class)
+ return
end
end
end
+ nametag(t)
end
-function nametagsc(c)
- nametags(c.screen)
+-- without client
+function nametagc_t_u(t)
+ nametagc_t(t)
end
-client.connect_signal("manage", nametagsc)
-client.connect_signal("swapped", nametagsc)
-client.connect_signal("tagged", nametagsc)
-client.connect_signal("unmanage", nametagsc)
-client.connect_signal("untagged", nametagsc)
+function nametagc_c(c)
+ for _, ct in ipairs(c:tags()) do
+ nametagc_t(ct, c)
+ end
+end
---awful.screen.connect_for_each_screen(nametags)
+tag.connect_signal("tagged", nametagc_t)
+tag.connect_signal("untagged", nametagc_t_u)
+client.connect_signal("raised", nametagc_c)
+client.connect_signal("property::class", nametagc_c)