From 1e4d2b4be7ad20dd108503fb65c264673ca6457b Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Tue, 29 Sep 2026 09:55:45 +0200 Subject: feat(install): track rofi scripts, wire nvim and hypr-theme, merge qt/gtk keys The rofi menus' launch scripts lived loose in ~/bin, so the themes were tracked and the only things that open them were not. They now live in bin/ and are symlinked under the names hypr-theme's keybindings call. neovim gets a generated colorscheme: catppuccin/nvim with all 26 palette colours overridden from the active scheme, selected by rewriting only the colorscheme line of init.vim. hypr-theme is linked as the whole of ~/.config/hypr, leaving a real directory there alone. The qt-gtk templates were reference copies nothing installed. They now hold theme keys only and ini_merge writes them into the live qt5ct, qt6ct and gtk3 files key by key, keeping every other line; tests/ini-merge.sh checks it. The stale kvantum.kvconfig template is gone, install.sh writes that file. Fresh-machine fixes: settings.ini and ~/.config/gtk-4.0 are created when missing instead of aborting under set -e, and conky is found as a sibling checkout and skipped when absent, in udt-palette as well as install.sh. Co-Authored-By: Claude Opus 5.5 --- bin/udt-powermenu.sh | 108 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100755 bin/udt-powermenu.sh (limited to 'bin/udt-powermenu.sh') diff --git a/bin/udt-powermenu.sh b/bin/udt-powermenu.sh new file mode 100755 index 0000000..a8524b4 --- /dev/null +++ b/bin/udt-powermenu.sh @@ -0,0 +1,108 @@ +#!/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 glyph size follows the focused monitor, as in +# qar-scrotmenu.sh: a quarter of the smaller of half-width and height, with +# 90/270 degree rotations (odd transforms) swapping width and height. +confirm_size() { + hyprctl monitors -j | jq -r '.[] | select(.focused) | .scale as $s + | (if .transform % 2 == 1 then [.height, .width] else [.width, .height] end) + | [.[0] / 2, .[1]] | min / $s / 4 | floor' 2>/dev/null +} + +# Confirmation CMD +confirm_cmd() { + local size + size=$(confirm_size) + rofi -dmenu \ + -p 'Confirmation' \ + -selected-row 1 \ + -mesg 'Simu Sicuri?' \ + -theme "$HOME/.config/rofi/udt/confirm.rasi" \ + -theme-str "element-text { font: \"Inconsolata Nerd Font Mono ${size:-135}\"; }" +} + +# 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 -- cgit v1.2.3