summaryrefslogtreecommitdiffstats
path: root/.local/bin/dmsearch
blob: f13189d5625d62c339d0fd6edbaa9e751663c099 (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/bin/env 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__