summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmsearch
blob: cfef937ee108348ad86fb6657a54a424b5e69b05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/local/bin/perl

use strict;
use warnings;
use constant BROWSER_PATH => '/usr/local/bin/iridium';

sub main
{
	my $choice;
	my $url;
	my $pid;

	$choice = `printf "" | dmenu -i -m 0 -p 'Search:'`;
	if (not $choice) {
		return;
	}
	$choice =~ s/ /+/g;
	$url = 'https://duckduckgo.com/?q=' . $choice;
	$pid = fork();
	if (not $pid) {
		exec(BROWSER_PATH, $url);
	}
	return;
}

main();

__END__