From 97a5fc27e011c024393c3b1610f044f3c751bd91 Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 18 Oct 2026 11:44:56 +0200 Subject: feat(rofi): shared wallpaper header for the searchable layouts The ssh menu's banner, title plate and plated search bar move into header.rasi, which ssh.rasi, list.rasi and grid.rasi import, so every searchable menu gets the same header with its -p as the title. The banner's @WPAPER@ now lives in header.rasi, so that file is generated and ssh.rasi is linked again. Co-Authored-By: Claude Opus 5.5 --- bin/blackpearl-sshmenu.sh | 28 -------------- bin/qar-scrotmenu.sh | 22 ----------- bin/udt-launcher.sh | 22 ----------- bin/udt-powermenu.sh | 96 ----------------------------------------------- rofi/udt/grid.rasi | 11 +++++- rofi/udt/header.rasi | 52 +++++++++++++++++++++++++ rofi/udt/list.rasi | 11 +++++- rofi/udt/ssh.rasi | 41 +------------------- 8 files changed, 73 insertions(+), 210 deletions(-) delete mode 100755 bin/blackpearl-sshmenu.sh delete mode 100755 bin/qar-scrotmenu.sh delete mode 100755 bin/udt-launcher.sh delete mode 100755 bin/udt-powermenu.sh create mode 100644 rofi/udt/header.rasi diff --git a/bin/blackpearl-sshmenu.sh b/bin/blackpearl-sshmenu.sh deleted file mode 100755 index a94217e..0000000 --- a/bin/blackpearl-sshmenu.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -# SSH menu: the hosts in ~/.ssh/config as cards, rofi themed by udt. -# Copyright (C) 2026 Danilo M. -# Licensed under the GNU General Public License v2 only. - -# 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/qar-scrotmenu.sh b/bin/qar-scrotmenu.sh deleted file mode 100755 index 0f1da97..0000000 --- a/bin/qar-scrotmenu.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash -# Screenshot menu, rofi themed by udt. -# Copyright (C) 2026 Danilo M. -# Licensed under the GNU General Public License v2 only. - -rofi_command=(rofi -theme ~/.config/rofi/udt/screenshot.rasi) - -### Options ### -screen="" -area="" -# Variable passed to rofi -options="$screen\n$area" - -chosen="$(echo -e "$options" | "${rofi_command[@]}" -dmenu -selected-row 1 -p '󰄀 Screenshot:')" -case $chosen in - $screen) - grimblast -w 3 -n -t png copysave active - ;; - $area) - grimblast -n -t png copysave area - ;; -esac diff --git a/bin/udt-launcher.sh b/bin/udt-launcher.sh deleted file mode 100755 index d0a8013..0000000 --- a/bin/udt-launcher.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/env bash - -## Author : Aditya Shakya (adi1090x) -## Github : @adi1090x -## Derived from adi1090x/rofi, GPL-3.0 like upstream. Modifications -## Copyright (C) 2026 Danilo M. -# -## Rofi : Launcher (Modi Drun, Run, File Browser, Window) -# -## Available Styles -# -## style-1 style-2 style-3 style-4 style-5 -## style-6 style-7 style-8 style-9 style-10 -## style-11 style-12 style-13 style-14 style-15 - -dir="$HOME/.config/rofi/udt" -theme='launcher' - -## Run -rofi \ - -show drun \ - -theme ${dir}/${theme}.rasi diff --git a/bin/udt-powermenu.sh b/bin/udt-powermenu.sh deleted file mode 100755 index 6d8fb84..0000000 --- a/bin/udt-powermenu.sh +++ /dev/null @@ -1,96 +0,0 @@ -#!/usr/bin/env bash - -## Author : Aditya Shakya (adi1090x) -## Github : @adi1090x -## Derived from adi1090x/rofi, GPL-3.0 like upstream. Modifications -## Copyright (C) 2026 Danilo M. -# -## Rofi : Power Menu -# -## Available Styles -# -## style-1 style-2 style-3 style-4 style-5 - -# Current Theme -dir="$HOME/.config/rofi/udt" -theme='powermenu' - -# CMDs -uptime="`uptime -p | sed -e 's/up //g'`" -host=`hostname` - -# Options -shutdown='' -reboot='' -logout='' -sleep='󰤄' -yes='󰗠' -no='󰅙' - -# Rofi CMD -rofi_cmd() { - rofi -dmenu \ - -p "'ndi vidimu ${USER}" \ - -mesg "Uptime: $uptime" \ - -theme ${dir}/${theme}.rasi -} - -# Confirmation CMD -confirm_cmd() { - rofi -dmenu \ - -p 'Confirmation' \ - -selected-row 1 \ - -mesg 'Simu Sicuri?' \ - -theme "$HOME/.config/rofi/udt/confirm.rasi" -} - -# Ask for confirmation -confirm_exit() { - echo -e "$yes\n$no" | confirm_cmd -} - -# Pass variables to rofi dmenu -run_rofi() { - echo -e "$shutdown\n$reboot\n$sleep\n$logout" | rofi_cmd -} - -# Execute Command -run_cmd() { - selected="$(confirm_exit)" - if [[ "$selected" == "$yes" ]]; then - if [[ $1 == '--shutdown' ]]; then - notify-send 'system shutdown' 'the system is going to shutdown now' - sleep 1 - /usr/bin/loginctl poweroff - elif [[ $1 == '--reboot' ]]; then - notify-send 'system reboot' 'the system is going to reboot now' - sleep 1 - /usr/bin/loginctl reboot - elif [[ $1 == '--sleep' ]]; then - notify-send 'suspend to ram' 'the system is going to sleep now' - sleep 1 - /usr/bin/loginctl suspend - elif [[ $1 == '--logout' ]]; then - hyprctl dispatch 'hl.dsp.exit()' - fi - else - exit 0 - fi -} - -# Actions -chosen="$(run_rofi)" -case ${chosen} in - $shutdown) - run_cmd --shutdown - ;; - $reboot) - run_cmd --reboot - ;; - $sleep) - run_cmd --sleep - ;; - $logout) - run_cmd --logout - ;; -esac diff --git a/rofi/udt/grid.rasi b/rofi/udt/grid.rasi index b610a16..931aae7 100644 --- a/rofi/udt/grid.rasi +++ b/rofi/udt/grid.rasi @@ -6,15 +6,23 @@ */ @import "common.rasi" +@import "header.rasi" window { width: 1500px; anchor: center; location: center; + padding: 0; } mainbox { - children: [ inputbar, message, listview ]; + children: [ header, message, listview ]; + spacing: 0; +} + +/* The window has no padding, for the banner, so the body is inset here. */ +message { + margin: 12px 16px 0; } listview { @@ -22,6 +30,7 @@ listview { lines: 10; spacing: 6px; fixed-height: false; + padding: 12px 16px 16px; } /* Three wide columns rather than five narrow ones: each row is a glyph plus diff --git a/rofi/udt/header.rasi b/rofi/udt/header.rasi new file mode 100644 index 0000000..921e104 --- /dev/null +++ b/rofi/udt/header.rasi @@ -0,0 +1,52 @@ +/* + * udt header: the wallpaper banner over the searchable layouts. + * Copyright (C) 2026 Danilo M. + * Licensed under the GNU General Public License v2 only. + * + * A layout lists `header` in mainbox and sets window padding to 0, so the + * banner runs to the window's edges. The script's -p is the title, an icon + * glyph and a name, lifted out of the inputbar to sit above it. + * + * @WPAPER@ is rewritten by the installer, which is why this file is + * generated rather than linked. rofi does not expand `~` inside a url(). + */ + +header { + expand: false; + orientation: vertical; + children: [ headrow, inputbar ]; + spacing: 12px; + padding: 2.5em 2em; + background-image: url("@WPAPER@", width); + background-color: @mantle; +} + +/* The spacer keeps the title's plate to its own width. */ +headrow { + expand: false; + orientation: horizontal; + children: [ prompt, dummy ]; +} + +dummy { + expand: true; +} + +/* Both sit on plates so they stay legible over any wallpaper. */ +prompt { + font: "Noto Sans Bold 15"; + text-color: @text; + background-color: @base; + border-radius: 6px; + padding: 6px 12px; +} + +inputbar { + background-color: @base; + border: 1px; + border-color: @accent; +} + +entry { + placeholder: "Search"; +} diff --git a/rofi/udt/list.rasi b/rofi/udt/list.rasi index 6812571..f9d3173 100644 --- a/rofi/udt/list.rasi +++ b/rofi/udt/list.rasi @@ -6,11 +6,13 @@ */ @import "common.rasi" +@import "header.rasi" window { width: 680px; anchor: center; location: center; + padding: 0; } /* `message` must be listed, or a `-mesg` passed by a script is silently @@ -18,11 +20,18 @@ window { * costs nothing when unused. rofipass relies on this for its keybinding * cheatsheet. */ mainbox { - children: [ inputbar, message, listview ]; + children: [ header, message, listview ]; + spacing: 0; +} + +/* The window has no padding, for the banner, so the body is inset here. */ +message { + margin: 12px 16px 0; } listview { columns: 1; lines: 12; fixed-height: false; + padding: 12px 16px 16px; } diff --git a/rofi/udt/ssh.rasi b/rofi/udt/ssh.rasi index c40ac05..52899f1 100644 --- a/rofi/udt/ssh.rasi +++ b/rofi/udt/ssh.rasi @@ -9,6 +9,7 @@ */ @import "common.rasi" +@import "header.rasi" window { width: 1100px; @@ -22,46 +23,6 @@ mainbox { spacing: 0; } -/* The wallpaper banner, as in launcher.rasi: the header and the search bar - * share it. @WPAPER@ is rewritten by the installer, which is why this file - * is generated rather than linked. */ -header { - expand: false; - orientation: vertical; - children: [ headrow, inputbar ]; - spacing: 12px; - padding: 2.5em 2em; - background-image: url("@WPAPER@", width); - background-color: @mantle; -} - -/* The prompt is lifted out of the inputbar to sit above it, and kept to its - * own width by the spacer so its plate does not span the banner. */ -headrow { - expand: false; - orientation: horizontal; - children: [ prompt, dummy ]; -} - -dummy { - expand: true; -} - -/* Both sit on plates so they stay legible over any wallpaper. */ -prompt { - font: "Noto Sans Bold 15"; - text-color: @text; - background-color: @base; - border-radius: 6px; - padding: 6px 12px; -} - -inputbar { - background-color: @base; - border: 1px; - border-color: @accent; -} - entry { placeholder: "Search hosts, users, addresses"; } -- cgit v1.2.3