From 9846097e52eddfc99f8100da734b5a7922f33e24 Mon Sep 17 00:00:00 2001 From: Joe Date: Fri, 27 Dec 2024 09:29:30 +0100 Subject: bookmarks --- .local/bin/dmbookm | 36 +++++++++++++++++++++++------------- .local/bin/dmlog | 2 +- 2 files changed, 24 insertions(+), 14 deletions(-) diff --git a/.local/bin/dmbookm b/.local/bin/dmbookm index 4b1332e..0fcd023 100755 --- a/.local/bin/dmbookm +++ b/.local/bin/dmbookm @@ -4,18 +4,29 @@ use strict; use warnings; use Sys::Hostname; +# debug +use Data::Dumper; + use constant { BROWSER => '/bin/firefox', - HOSTNAME => (split /\./, hostname()) + HOSTNAME => (split /\./, hostname())[0] }; -use constant LIST => [ - ['grafana', 'https://grafana.nuabee.fr/'], - ['graf', 'http://graf.joe.town/'], - ['hedgedoc', 'http://hedgedoc.int.ysosecure.com/'], - ['zammad', 'https://support.nuabee.fr/'], - [], - ]; +use constant LIST => { + graf => 'http://graf.joe.town/', + zhinu => 'https://zhinu.jozan.org/', + nua_grafana => 'https://grafana.nuabee.fr/', + nua_gr_linux_servers => 'https://grafana.nuabee.fr/d/xfpJB9FGz/linux-servers', + nua_gr_restops => 'https://grafana.nuabee.fr/d/Mz11bd07k/vue-d-ensemble-machines-atelier', + nua_git => 'https://gitlab.int.ysosecure.com/', + nua_mbs => 'https://mbs.nuabee.com/', + nua_hedgedoc => 'http://hedgedoc.int.ysosecure.com/', + nua_doc => 'https://doc.int.ysosecure.com/', + nua_kb => 'https://kb.int.ysosecure.com/', + nua_zammad => 'https://support.nuabee.fr/', + nua_atlas => 'https://atlas.nuabee.fr/', + nua_share => 'https://share.nuabee.fr/', +}; sub main { @@ -29,18 +40,17 @@ sub main if (HOSTNAME eq "mars") { $prefix += '/local'; } - for (@{+LIST}) { + for (keys %{LIST()}) { $list .= $_ . "\n"; } - $choice = `printf "" | dmenu -i -m 0 -l 100`; + $choice = `printf "$list" | dmenu -i -m 0 -l 100`; if (not $choice) { return; } - $choice =~ s/ /+/g; - $url = . $choice; + chomp $choice; $pid = fork(); if (not $pid) { - exec($prefix . BROWSER, $url); + exec($prefix . BROWSER, LIST->{$choice}); } return; } diff --git a/.local/bin/dmlog b/.local/bin/dmlog index acf373c..6410007 100755 --- a/.local/bin/dmlog +++ b/.local/bin/dmlog @@ -13,7 +13,7 @@ use constant { SHUTDOWN_PATH => '/sbin/shutdown', LOGINCTL_PATH => '/usr/bin/loginctl', NOTIF_PATH => 'notify-send', - HOSTNAME => (split /\./, hostname()) + HOSTNAME => (split /\./, hostname())[0] }; use constant LIST => [ 'lock screen', -- cgit v1.2.3