#!/usr/bin/env perl use strict; use warnings; use Sys::Hostname; use constant { BROWSER => '/bin/firefox', HOSTNAME => (split /\./, hostname()) }; use constant LIST => [ ['grafana', 'https://grafana.nuabee.fr/'], ['graf', 'http://graf.joe.town/'], ['hedgedoc', 'http://hedgedoc.int.ysosecure.com/'], ['zammad', 'https://support.nuabee.fr/'], [], ]; sub main { my $choice; my $url; my $pid; my $prefix; my $list; $prefix = '/usr'; if (HOSTNAME eq "mars") { $prefix += '/local'; } for (@{+LIST}) { $list .= $_ . "\n"; } $choice = `printf "" | dmenu -i -m 0 -l 100`; if (not $choice) { return; } $choice =~ s/ /+/g; $url = . $choice; $pid = fork(); if (not $pid) { exec($prefix . BROWSER, $url); } return; } main(); __END__