aboutsummaryrefslogtreecommitdiff
path: root/.config/i3/shellutils.lua
diff options
context:
space:
mode:
authorXander Swan <email>2025-12-03 10:00:41 -0500
committerXander Swan <email>2025-12-03 10:00:41 -0500
commit9c504cd8639c82d476c2af41796743185ffd706a (patch)
treedca0f9f7c5347b7f0798b13d99b1b0df4d9a4ef0 /.config/i3/shellutils.lua
parentceb1360704f390862eecbd405d3837f9c42f1baa (diff)
Add i3
Diffstat (limited to '.config/i3/shellutils.lua')
-rw-r--r--.config/i3/shellutils.lua16
1 files changed, 16 insertions, 0 deletions
diff --git a/.config/i3/shellutils.lua b/.config/i3/shellutils.lua
new file mode 100644
index 0000000..cb27943
--- /dev/null
+++ b/.config/i3/shellutils.lua
@@ -0,0 +1,16 @@
+local shell_utils = {}
+
+local temp_file_path = "/tmp/i3luacommandouput"
+
+function shell_utils.get_output(command)
+ os.execute(command .. " > " .. temp_file_path .. " 2> " .. temp_file_path)
+ local file = io.open(temp_file_path, "r")
+ if file == nil then
+ error("Can't read output.")
+ end
+ local output = file:read()
+ file:close()
+ return output or ""
+end
+
+return shell_utils \ No newline at end of file