20 lines
		
	
	
		
			549 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			20 lines
		
	
	
		
			549 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| shift
 | |
| query="$1"
 | |
| if [ -z "$query" ]; then
 | |
| 	query="$(echo "tui" | bemenu --prompt "qalc")"
 | |
| fi
 | |
| if [ "$query" = "tui" ]; then
 | |
| 	exec alacritty msg create-window --class="term_float" --working-directory="$HOME" --command "qalc"
 | |
| elif [ -n "$query" ]; then
 | |
| 	qalc_res="$(qalc --terse "$query")"
 | |
| 	menu_res="$(echo -e "$qalc_res\ntui" | bemenu --prompt "qalc")"
 | |
| 	if [ "$qalc_res" = "$menu_res" ]; then
 | |
| 		wl-copy "$qalc_res"
 | |
| 		notify-send "$qalc_res" -a calc "Result copied to clipboard"
 | |
| 	elif [ -n "$menu_res" ]; then
 | |
| 		"$0" _ "$menu_res"
 | |
| 	fi
 | |
| fi
 |