dotfiles/.local/bin/dmenu_hub
2024-04-27 16:24:27 +05:00

43 lines
1.4 KiB
Python
Executable File

#!/usr/bin/env python3
import subprocess
dmenu_command = "dmenu -i -l 16 -W 200 -Y 15 -X 1151 -bw 2"
apps = "dmenu_run -bw 2 -i -W 390 -X 961 -Y 15 -l 16 -g 3"
camera = (
"mpv --untimed --no-cache --no-osc "
"--no-input-default-bindings --profile=low-latency "
"--input-conf=/dev/null --title=webcam "
"$(ls /dev/video[0,2,4,6,8] | tail -n 1)"
)
bar_colors_toggle = '[ -e "$HOME/.cache/bar_color" ] && { rm "$HOME/.cache/bar_color"; renew-dwm; } || { touch "$HOME/.cache/bar_color"; renew-dwm; }'
options = {
f"󰀻 Apps": apps,
f"󰉦 Bar colors": bar_colors_toggle,
f" Edit Configs": "st -e confedit",
f" Web Search": "dmenu_web",
f"󰌹 Handler": "dmenuhandler",
f"󰌌 Keybinds": "keybinds",
f"󰋊 Mount": "mounter",
f"󱁌 Unmount": "unmounter",
f" Kill": "processkill",
f" Pick Color": "xcolor-pick",
f" Screenshot": "maimpick",
f" Record": "dmenurecord",
f"󰄄 Camera": camera,
f" NerdFont Icons": "dmenunerdsymbols",
}
option_list = list(options.keys())
try:
selected_option = (
subprocess.check_output(
dmenu_command.split(), input="\n".join(option_list).encode()
)
.decode()
.strip()
)
action = options[selected_option]
subprocess.run(action, shell=True)
except subprocess.CalledProcessError:
pass