From 5461ac49d47c52817aab777f15dd26b304222083 Mon Sep 17 00:00:00 2001 From: Sakooooo <78461130+Sakooooo@users.noreply.github.com> Date: Sun, 13 Aug 2023 16:48:17 +0300 Subject: [PATCH] i stole this from someone else's dotfiles AGAIN --- config/awesome/rc.lua | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/config/awesome/rc.lua b/config/awesome/rc.lua index 301fc099..be055c61 100644 --- a/config/awesome/rc.lua +++ b/config/awesome/rc.lua @@ -589,6 +589,30 @@ local startupApps = { 'keepassxc', } -for i, app in ipairs(startupApps) do - awful.spawn.once(app) +local run_once = function(cmd) + local findme = cmd + local firstspace = cmd:find(' ') + if firstspace then + findme = cmd:sub(0, firstspace - 1) + end + awful.spawn.easy_async_with_shell( + string.format('pgrep -u $USER -x %s > /dev/null || (%s)', findme, cmd), + function(stdout, stderr) + -- Debugger + if not stderr or stderr == '' or not debug_mode then + return + end + naughty.notification({ + app_name = 'Start-up Applications', + title = 'Oof! Error detected when starting an application!', + message = stderr:gsub('%\n', ''), + timeout = 20, + icon = require('beautiful').awesome_icon + }) + end + ) +end + +for _, app in ipairs(startupApps) do + run_once(app) end