X-Git-Url: https://git.rmz.io/dotfiles.git/blobdiff_plain/800d8089ce276ae1b2a3f9875a370b7e00a763db..a427a09b741cecbef21644e1b10c97bd9a074c02:/awesome/utils.lua diff --git a/awesome/utils.lua b/awesome/utils.lua index 4042241..1385633 100644 --- a/awesome/utils.lua +++ b/awesome/utils.lua @@ -13,15 +13,35 @@ function utils.is_dir(path) return os.execute(('[ -d "%s" ]'):format(path)) end -function utils.spawn_terminal(prg, cprop, cb) +local function terminal_cmd(prg, name) local join = require("gears.table").join local term_cmd = {terminal} - if cprop and cprop.instance then - if terminal:match("rxvt") then - term_cmd = join(term_cmd, {"-name", cprop.instance}) + if terminal:match("rxvt") then + if name then + term_cmd = join(term_cmd, {"-name", name}) + end + elseif terminal:match("wezterm") then + term_cmd = join(term_cmd, {"start"}) + if name then + term_cmd = join(term_cmd, {"--class", name}) end + else + term_cmd = join(term_cmd, {"-e"}) + end + return join(term_cmd, {prg}) +end + +function utils.spawn_terminal(prg, cprop, cb) + if not cprop then + cprop = {} end - awful.spawn(join(term_cmd, {"-e", prg}), cprop, cb) + local name = cprop.instance + awful.spawn(terminal_cmd(prg, name), cprop, cb) +end + +function utils.spawn_terminal_once(prg, rules, matcher, unique_id, cb) + local name = rules.instance + awful.spawn.once(terminal_cmd(prg, name), rules, matcher, unique_id, cb) end function utils.run_or_kill(prg, cprop, screen) @@ -79,7 +99,7 @@ function utils.run_once(prg,arg_string,pname,screen) end function utils.get_default_sink() - local f = io.popen('ponymix defaults --short') + local f = io.popen('pactl get-default-sink') line = f:read('*l') f:close() return string.match(line, "^sink%s*%d*%s*(.-)%s")