From 1d527c4e47514540541abf57aa1adb6a14ae5b54 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 18 Oct 2026 11:42:52 +0200 Subject: Initial commit: rofi-scripts, the scripts behind the rofi menus Power menu, launcher, screenshot picker, SSH host cards, pass browser, emoji picker, Firefox profile picker, notification actions and an sd-server model picker. install.sh symlinks them into ~/bin; their layouts come from unified-desktop-theme. Co-Authored-By: Claude Opus 5.5 --- bin/blackpearl-emoji.sh | 19 +++ bin/blackpearl-sshmenu.sh | 40 ++++++ bin/firefox-profile | 48 +++++++ bin/notify-actions.sh | 41 ++++++ bin/qar-scrotmenu.sh | 34 +++++ bin/rofipass | 351 ++++++++++++++++++++++++++++++++++++++++++++++ bin/sd-webui | 86 ++++++++++++ bin/udt-launcher.sh | 22 +++ bin/udt-powermenu.sh | 96 +++++++++++++ 9 files changed, 737 insertions(+) create mode 100755 bin/blackpearl-emoji.sh create mode 100755 bin/blackpearl-sshmenu.sh create mode 100755 bin/firefox-profile create mode 100755 bin/notify-actions.sh create mode 100755 bin/qar-scrotmenu.sh create mode 100755 bin/rofipass create mode 100755 bin/sd-webui create mode 100755 bin/udt-launcher.sh create mode 100755 bin/udt-powermenu.sh (limited to 'bin') diff --git a/bin/blackpearl-emoji.sh b/bin/blackpearl-emoji.sh new file mode 100755 index 0000000..3969c43 --- /dev/null +++ b/bin/blackpearl-emoji.sh @@ -0,0 +1,19 @@ +#!/bin/sh +# blackpearl-emoji.sh - emoji picker, rofi themed by udt +# Copyright (C) 2026 Danilo M. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +rofi -no-lazy-grab -modi emoji -show emoji -display-emoji '󰞅 Emoji:' -theme ~/.config/rofi/udt/grid.rasi + diff --git a/bin/blackpearl-sshmenu.sh b/bin/blackpearl-sshmenu.sh new file mode 100755 index 0000000..b0a0fc1 --- /dev/null +++ b/bin/blackpearl-sshmenu.sh @@ -0,0 +1,40 @@ +#!/bin/bash +# blackpearl-sshmenu.sh - the hosts in ~/.ssh/config as rofi cards +# Copyright (C) 2026 Danilo M. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# rofi's own ssh mode shows the alias only, so the config is read here. +# ponytail: plain "Keyword value" lines in ~/.ssh/config only; Include and +# Match are not followed, wildcard Host patterns are skipped. +mapfile -t hosts < <(awk ' + function flush() { if (name != "") print name "\t" user "\t" addr } + tolower($1) == "host" { flush(); name = ($2 ~ /[*?]/) ? "" : $2; user = ""; addr = $2 } + tolower($1) == "hostname" { addr = $2 } + tolower($1) == "user" { user = $2 } + END { flush() }' ~/.ssh/config) + +# Two lines a card: the alias, then "user · address" with the user only where +# the config sets one. Entries are joined on "|" so each can hold a newline. +entries=() +for h in "${hosts[@]}"; do + IFS=$'\t' read -r name user addr <<< "$h" + entries+=("$name +${user:+$user · }$addr") +done + +i=$(IFS='|'; printf '%s' "${entries[*]}" | rofi -dmenu -i -markup-rows \ + -sep '|' -eh 2 -format i -p '󰆍 SSH:' -theme ~/.config/rofi/udt/ssh.rasi) || exit +name=${hosts[i]%%$'\t'*} +exec rofi-sensible-terminal -e ssh "$name" diff --git a/bin/firefox-profile b/bin/firefox-profile new file mode 100755 index 0000000..3920e09 --- /dev/null +++ b/bin/firefox-profile @@ -0,0 +1,48 @@ +#!/bin/bash +# firefox-profile - pick a Firefox profile with rofi, one behind a password +# Copyright (C) 2026 Danilo M. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +# Pick a Firefox profile with rofi; one profile requires a password. +# Hash file: printf '%s' 'secret' | sha256sum | cut -d' ' -f1 > ~/.config/firefox-profile.hash +# ponytail: wrapper gate only, `firefox -P ` bypasses it. Encrypt the profile dir if that matters. + +PROTECTED="danix" +HASHFILE="$HOME/.config/firefox-profile.hash" +INI="$HOME/.mozilla/firefox/profiles.ini" + +# Opening a link with exactly one profile running: hand it to that instance, +# no picker. The protected profile was already unlocked to get it running. +if [ $# -gt 0 ]; then + running=$(pgrep -af '^/usr/lib64/firefox/firefox(-bin)? (.* )?-P ' | sed -n 's/.* -P \([^ ]*\).*/\1/p' | sort -u) + [ -n "$running" ] && [ "$(wc -l <<<"$running")" -eq 1 ] && exec firefox -P "$running" "$@" +fi + +profile=$(sed -n 's/^Name=//p' "$INI" | rofi -dmenu -theme ~/.config/rofi/udt/list.rasi -i -p '󰈹 Firefox:') || exit 0 +[ -n "$profile" ] || exit 0 + +if [ "$profile" = "$PROTECTED" ]; then + pass=$(rofi -dmenu -theme ~/.config/rofi/udt/list.rasi -password -l 0 \ + -mesg "Unlock Firefox profile: $profile" \ + -theme-str 'mainbox { children: [ message, inputbar ]; padding: 16px; spacing: 8px; } message { background-color: transparent; padding: 0 0 4px 2px; } textbox { font: "Noto Sans Bold 13"; }' \ + -theme-str 'entry { placeholder: "Password"; }' /dev/null)" ]; then + notify-send "Firefox" "Wrong password" 2>/dev/null + exit 1 + fi +fi + +exec firefox -P "$profile" "$@" diff --git a/bin/notify-actions.sh b/bin/notify-actions.sh new file mode 100755 index 0000000..0c49c6b --- /dev/null +++ b/bin/notify-actions.sh @@ -0,0 +1,41 @@ +#!/bin/bash +# +# Copyright (C) 2026 Danilo M. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License version 2 as +# published by the Free Software Foundation. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# Pick one of a notification's actions with rofi and invoke it. The renderer +# passes the labels and keys as arguments, so nothing here parses JSON. +# +# notify-actions.sh