#!/usr/bin/env perl use strict; use warnings; use Sys::Hostname; use constant { BROWSER => '/bin/firefox', HOSTNAME => (split /\./, hostname()) }; sub main { my $choice; my $url; my $pid; my $prefix; $prefix = '/usr'; if (HOSTNAME eq "mars") { $prefix += '/local'; } $choice = `printf "" | dmenu -i -p 'search:'`; if (not $choice) { return; } $choice =~ s/ /+/g; $url = 'https://www.startpage.com/sp/search?q=' . $choice; $pid = fork(); if (not $pid) { exec($prefix . BROWSER, $url); } return; } main(); __END__