# Display the commands on wofi selection=cat .zhistory | wofi -p "Commands history" --show dmenu -i # Then copy the selection to the clipboard wl-copy "$selection"