aboutsummaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to 'bin')
-rwxr-xr-xbin/qar-scrotmenu.sh32
-rwxr-xr-xbin/udt-launcher.sh22
-rwxr-xr-xbin/udt-palette49
-rwxr-xr-xbin/udt-powermenu.sh108
4 files changed, 210 insertions, 1 deletions
diff --git a/bin/qar-scrotmenu.sh b/bin/qar-scrotmenu.sh
new file mode 100755
index 0000000..b60cbc8
--- /dev/null
+++ b/bin/qar-scrotmenu.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+# Screenshot menu, rofi themed by udt.
+# Copyright (C) 2026 Danilo M. <danix@danix.xyz>
+# Licensed under the GNU General Public License v2 only.
+
+# Glyph size follows the monitor rofi opens on (the focused one), in points,
+# since rofi cannot size a font by percentage. Each cell gets half the width,
+# so a quarter of the smaller of half-width and height fits both a wide and a
+# rotated portrait monitor. Odd transforms are 90/270 degree rotations, which
+# swap the reported width and height.
+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)
+size=${size:-135}
+rofi_command=(rofi -theme ~/.config/rofi/udt/screenshot.rasi
+ -theme-str "element-text { font: \"Inconsolata Nerd Font Mono $size\"; }")
+
+### Options ###
+screen=""
+area=""
+# Variable passed to rofi
+options="$screen\n$area"
+
+chosen="$(echo -e "$options" | "${rofi_command[@]}" -dmenu -selected-row 1)"
+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
new file mode 100755
index 0000000..d0a8013
--- /dev/null
+++ b/bin/udt-launcher.sh
@@ -0,0 +1,22 @@
+#!/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. <danix@danix.xyz>
+#
+## 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-palette b/bin/udt-palette
index 234d97a..6a15a52 100755
--- a/bin/udt-palette
+++ b/bin/udt-palette
@@ -28,7 +28,8 @@ SELECTOR = Path.home() / ".config" / "udt" / "roles.conf"
SELECTOR_SEED = PALETTE_DIR / "roles.conf.default"
# The Lua dashboard lives in its own repo; UDT only renders its colours.
-CONKY_REPO = Path("~/Programming/GIT/conky-theme-udt").expanduser()
+# A sibling checkout, like waybar-theme-udt; skipped when it is not cloned.
+CONKY_REPO = REPO.parent / "conky-theme-udt"
def parse_conf(path):
@@ -267,6 +268,47 @@ def gen_kitty(res, scheme, palette):
return "\n".join(lines) + "\n"
+# Catppuccin's 26 names, and the role that stands in for each when the scheme
+# does not define that name itself.
+NVIM_NAMES = [
+ ("rosewater", "cursor"), ("flamingo", "cursor"), ("pink", "magenta"),
+ ("mauve", "highlight"), ("red", "red"), ("maroon", "bright_red"),
+ ("peach", "peach"), ("yellow", "yellow"), ("green", "green"),
+ ("teal", "cyan"), ("sky", "bright_cyan"), ("sapphire", "bright_blue"),
+ ("blue", "blue"), ("lavender", "accent"),
+ ("text", "fg"), ("subtext1", "fg_bright"), ("subtext0", "fg_dim"),
+ ("overlay2", "mid_high"), ("overlay1", "mid_low"), ("overlay0", "fg_faint"),
+ ("surface2", "surface_high"), ("surface1", "surface_alt"),
+ ("surface0", "surface"),
+ ("base", "bg"), ("mantle", "bg_alt"), ("crust", "bg_deep"),
+]
+
+
+def gen_nvim(res, scheme, palette):
+ """neovim: a colorscheme that is catppuccin/nvim with every colour replaced.
+
+ catppuccin's highlight groups are written against its 26 palette names, so
+ overriding all of them re-skins the whole editor without restating a single
+ group. The Catppuccin schemes define those names and pass straight through;
+ the rest are filled from roles, so a few near-duplicate hues (maroon, sky,
+ sapphire, flamingo) collapse onto their neighbours there.
+ """
+ rows = "\n".join(
+ f' {name} = "{palette[name].lower() if name in palette else hex6(res[role])}",'
+ for name, role in NVIM_NAMES)
+ return (
+ f"-- {BANNER.format(scheme=scheme)}\n"
+ "-- Selected with `colorscheme udt`. Needs the catppuccin/nvim plugin.\n"
+ f"local colors = {{\n{rows}\n}}\n\n"
+ "require(\"catppuccin\").setup({\n"
+ " flavour = \"macchiato\",\n"
+ " color_overrides = { macchiato = colors },\n"
+ "})\n"
+ "vim.cmd.colorscheme(\"catppuccin-macchiato\")\n"
+ "vim.g.colors_name = \"udt\"\n"
+ )
+
+
def gen_hyprlock(res, scheme, palette):
"""hyprlock: the lock screen's scheme-level palette, as hyprlang variables.
@@ -743,6 +785,7 @@ TARGETS = [
("templates/waybar/theme.css", gen_waybar, None),
("templates/terminal/kitty-theme.conf", gen_kitty, None),
("templates/hyprlock/hyprlock-palette.conf", gen_hyprlock, None),
+ ("templates/nvim/udt.lua", gen_nvim, None),
(str(CONKY_REPO / "conky.conf"), gen_conky, str(CONKY_REPO / "conky.conf.in")),
("bin/udt_colors.py", gen_accent_py, None),
("templates/homepage/custom.css", gen_homepage, None),
@@ -774,6 +817,10 @@ def generate(roles_path, out_dir, scheme=None):
scheme, palette, res, snap_names = load(roles_path, scheme=scheme)
written = []
for target, fn, template in TARGETS:
+ # A sibling repo that is not cloned here is not an error: its
+ # template is missing too, and there is nothing to theme.
+ if Path(target).is_absolute() and not Path(target).parent.is_dir():
+ continue
# A target outside this repo (the conky dashboard) is an absolute path,
# and `out_dir / absolute` discards out_dir entirely. For the real
# render that is what we want, since the file genuinely belongs at that
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. <danix@danix.xyz>
+#
+## 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