From 0cbcbcd52d23acd096afac3e9b1309a897129d87 Mon Sep 17 00:00:00 2001 From: zachir Date: Sat, 25 Mar 2023 20:35:50 -0500 Subject: add bling for window swallowing (plus eventually scratchpads!) --- .gitmodules | 3 +++ awesome/bling | 1 + awesome/rc.lua | 55 +++++++++++++++++++++++++++++++++++++++++++++++-------- 3 files changed, 51 insertions(+), 8 deletions(-) create mode 160000 awesome/bling diff --git a/.gitmodules b/.gitmodules index 5c2ba09..80e6b9d 100644 --- a/.gitmodules +++ b/.gitmodules @@ -13,3 +13,6 @@ [submodule "awesome/awesome-scratch"] path = awesome/awesome-scratch url = https://github.com/notnew/awesome-scratch +[submodule "awesome/bling"] + path = awesome/bling + url = https://github.com/BlingCorp/bling.git diff --git a/awesome/bling b/awesome/bling new file mode 160000 index 0000000..6779170 --- /dev/null +++ b/awesome/bling @@ -0,0 +1 @@ +Subproject commit 677917056d118d02feaa5c21ecf5a50375ef123d diff --git a/awesome/rc.lua b/awesome/rc.lua index 56c59ff..9a65cc7 100644 --- a/awesome/rc.lua +++ b/awesome/rc.lua @@ -17,6 +17,7 @@ local naughty = require("naughty") package.loaded["naughty.dbus"] = {} local menubar = require("menubar") local hotkeys_popup = require("awful.hotkeys_popup") +local bling = require("bling") -- Enable hotkeys help widget for VIM and other apps -- when client with a matching name is opened: require("awful.hotkeys_popup.keys") @@ -828,12 +829,23 @@ awful.rules.rules = { } -- }}} --- {{{ Window Swallowing functions ----[[ +--{{{ bling window swallowing +bling.module.window_swallowing.start() +theme.parent_filter_list = { "firefox", "Gimp" } -- class names list of parents that should not be swallowed +theme.child_filter_list = { "Dragon" } -- class names list that should not swallow their parents +theme.swallowing_filter = true -- whether the filters above should be active +--}}} + +-- {{{ Window Swallowing functions OLD/DEPRECATED +--[[ function is_terminal(c) return (c.class and (c.class:match("St") or c.class:match("Alacritty"))) and true or false end +function is_noswallow(c) + return false +end + function copy_size(c, parent_client) if not c or not parent_client then return @@ -857,7 +869,7 @@ function get_parent_pid(child_ppid, callback) awful.spawn.easy_async(ppid_cmd, function(stdout, stderr, reason, exit_code) -- primitive error checking if stderr and stderr ~= "" then - callback(nil, false) + callback(err, false) return end local ppid = stdout:gsub(" ", ""):gsub("\n", "") @@ -871,34 +883,61 @@ function if_client_and_parent(c1, c2, cl) end end +--]] +--[[ FULLY UNTESTED, UNVERIFIED. PLEASE DO NOT RUN. +function incall(err, ppid, cl) + if err then + return + end + if ppid and cl and cl.pid and (ppid:find('^' .. cl.pid)) then + return true + end + if ppid ~= 1 then + get_parent_pid(ppid, incall) + else + end +end + +function get_id_or_recurse(pid, err) + if pid == 1 then + return 1 + else + end +end +--]] +--[[ client.connect_signal("property::size", check_resize_client) client.connect_signal("property::position", check_resize_client) client.connect_signal("manage", function(c) - if is_terminal(c) then + if is_terminal(c) or is_noswallow(c) then return + end + local procid = 0 + while (procid ~= 1) do + end local parent_client=awful.client.focus.history.get(c.screen, 1) get_parent_pid(c.pid, function(err, ppid) if err then - error(err) + --error(err) return end parent_pid = ppid or false get_parent_pid(parent_pid, function(err, gppid) if err then - error(err) + --error(err) return end grand_parent_pid = gppid or false get_parent_pid(grand_parent_pid, function(err, ggppid) if err then - error(err) + --error(err) return end great_grand_parent_pid = ggppid or false get_parent_pid(great_grand_parent_pid, function(err, gggppid) if err then - error(err) + --error(err) return end great_great_grand_parent_pid = gggppid or false -- cgit v1.2.3