From ca0c26b79e77bb3420423a411297e925f3fc49f2 Mon Sep 17 00:00:00 2001
From: ItsDrike <itsdrike@protonmail.com>
Date: Sat, 13 Aug 2022 13:46:20 +0200
Subject: [PATCH] Add script to quickly run arbitrary python code with dmenu

---
 home/.local/bin/scripts/gui/dmenu/pyrun | 8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100755 home/.local/bin/scripts/gui/dmenu/pyrun

diff --git a/home/.local/bin/scripts/gui/dmenu/pyrun b/home/.local/bin/scripts/gui/dmenu/pyrun
new file mode 100755
index 0000000..aced1a5
--- /dev/null
+++ b/home/.local/bin/scripts/gui/dmenu/pyrun
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# Simple wrapper to quickly execute a simple python command and have it printed out.
+# The output is then sent back via notification.
+#
+# This already has random imported, since that's a common use-case for this script.
+
+echo "" | dmenu -i -p "Python" | xargs -0 -I % python -c "import random;print(%)" | xargs -I % notify-send "Pyrun output:" "%"