From 21fa486da1b07131518eb9fa742dd29f3ab1320c Mon Sep 17 00:00:00 2001 From: "Danilo M." Date: Sun, 18 Oct 2026 12:00:12 +0200 Subject: feat: fullscreen launcher with Apps, Run and Folders tabs udt-launcher.sh is rewritten: drun, run and the new udt-folders script mode as tabs, icons with names below, always on DP-1. udt-folders lists home, the GTK bookmarks and the folders in ~ with XDG icons, and opens the pick in pcmanfm-qt. The launcher no longer derives from adi1090x, so the license exceptions shrink to rofipass and udt-powermenu.sh. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 9 ++++++-- README.md | 7 ++++--- bin/udt-folders | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++++ bin/udt-launcher.sh | 41 +++++++++++++++++++++---------------- 4 files changed, 93 insertions(+), 23 deletions(-) create mode 100755 bin/udt-folders diff --git a/AGENTS.md b/AGENTS.md index 4b44a10..28f33f4 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -37,6 +37,11 @@ much of the older Private Use Area and draws a blank instead. - **Glyph-only elements need `children: [ element-text ]`** in their layout, or the hidden icon slot pushes the glyph off centre. - Do not judge a menu by exit code: rofi exits non-zero on Escape. +- **`-show drun` ignores `-kb-custom-*`**, so drun cannot be refiltered from + a button and relaunched; only dmenu and script modes exit on them. That is + why the launcher has no category tabs: typing a category filters instead. +- **A script mode's tab label is its `-modi` name**; `-display-` is + ignored for it, so the glyph goes in the name (`"󰉋 Folders:udt-folders"`). ## Conventions @@ -57,7 +62,7 @@ visual, open the menu in the session, screenshot and look: - License: GPLv2 only (`LICENSE`, header in each source file), except `bin/rofipass` (derived from MIT-licensed upstream, notice kept in the file) - and `bin/udt-powermenu.sh`, `bin/udt-launcher.sh` (derived from adi1090x/rofi, - GPL-3.0 like upstream). + and `bin/udt-powermenu.sh` (derived from adi1090x/rofi, GPL-3.0 like + upstream). - `origin` is the personal git server (cgit section "Linux"). - Work directly on master. diff --git a/README.md b/README.md index 4eae4d9..c3cf9e2 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ must be installed for them to look right. - unified-desktop-theme's rofi layouts in `~/.config/rofi/udt/` - a Nerd Font (Inconsolata Nerd Font Mono) for the menu glyphs - per menu: `pass` (rofipass), `grimblast` (screenshots), `notifyctl` - (notification actions), `sd-server` (sd-webui), `hyprctl`, `jq` + (notification actions), `pcmanfm-qt` (launcher folders), `sd-server` (sd-webui), `hyprctl`, `jq` ## Install @@ -27,7 +27,8 @@ replacing any file of the same name. Bind them to keys in your window manager. | Script | What it opens | | --- | --- | | `udt-powermenu.sh` | shutdown, reboot, sleep, logout, with a confirmation step | -| `udt-launcher.sh` | application launcher | +| `udt-launcher.sh` | fullscreen launcher: Apps, Run and Folders tabs, icons with names below | +| `udt-folders` | the launcher's Folders tab: home and bookmarked folders, opened in pcmanfm-qt | | `qar-scrotmenu.sh` | whole screen or area screenshot | | `blackpearl-sshmenu.sh` | hosts from `~/.ssh/config` as cards, opens `ssh` in a terminal | | `rofipass` | password store browser: copy, add, edit, delete, OTP | @@ -43,7 +44,7 @@ Copyright (C) 2026 Danilo M. GPLv2 only. See [LICENSE](LICENSE) for the full text. Exceptions, noted in each file: `rofipass` derives from [aocoronel/rofipass](https://github.com/aocoronel/rofipass) (MIT), and -`udt-powermenu.sh` and `udt-launcher.sh` derive from +`udt-powermenu.sh` derives from [adi1090x/rofi](https://github.com/adi1090x/rofi) (GPL-3.0). ## Development Approach diff --git a/bin/udt-folders b/bin/udt-folders new file mode 100755 index 0000000..ed8a6d3 --- /dev/null +++ b/bin/udt-folders @@ -0,0 +1,59 @@ +#!/bin/bash +# udt-folders - rofi script mode: bookmarked and home folders, opened in pcmanfm-qt +# 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. + +# Run by rofi as a mode, "-modi 'Folders:udt-folders'". Without an argument it +# lists the folders; called again with the pick, it opens that folder and +# prints nothing, which closes rofi. The path travels in the entry's info +# field (ROFI_INFO), so labels can repeat or differ from the directory name. + +if [[ -n ${ROFI_INFO:-} ]]; then + setsid -f pcmanfm-qt "$ROFI_INFO" >/dev/null 2>&1 + exit 0 +fi + +declare -A seen +entry() { # label path + [[ -d $2 && -z ${seen[$2]:-} ]] || return + seen[$2]=1 + local icon=folder + case $2 in + "$HOME") icon=user-home ;; + "$HOME/Desktop") icon=user-desktop ;; + "$HOME/Documents") icon=folder-documents ;; + "$HOME/Downloads") icon=folder-download ;; + "$HOME/Music") icon=folder-music ;; + "$HOME/Pictures") icon=folder-pictures ;; + "$HOME/Videos") icon=folder-videos ;; + "$HOME/Templates") icon=folder-templates ;; + "$HOME/Public") icon=folder-publicshare ;; + esac + printf '%s\0icon\x1f%s\x1finfo\x1f%s\n' "$1" "$icon" "$2" +} + +entry Home "$HOME" +# GTK bookmarks, which pcmanfm-qt shares: "file:///path label", %-encoded. +# ponytail: local file:// bookmarks only; sftp:// and the like are skipped. +while read -r uri label; do + [[ $uri == file://* ]] || continue + path=${uri#file://} + path=$(printf '%b' "${path//%/\\x}") + entry "${label:-${path##*/}}" "$path" +done < "${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/bookmarks" +for d in "$HOME"/*/; do + d=${d%/} + entry "${d##*/}" "$d" +done diff --git a/bin/udt-launcher.sh b/bin/udt-launcher.sh index d0a8013..34dc556 100755 --- a/bin/udt-launcher.sh +++ b/bin/udt-launcher.sh @@ -1,22 +1,27 @@ -#!/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. +#!/bin/bash +# udt-launcher.sh - fullscreen app launcher: apps, executables, folders +# Copyright (C) 2026 Danilo M. # -## Rofi : Launcher (Modi Drun, Run, File Browser, Window) +# 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. # -## Available Styles +# 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. # -## 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' +# 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. -## Run -rofi \ - -show drun \ - -theme ${dir}/${theme}.rasi +# Three tabs, switched with Shift+Left/Right or a click: rofi's own drun +# (sorted by use), run over $PATH, and udt-folders. Typing a category name +# ("graphics") filters Apps too, since drun matches on categories. +# Always on DP-1, the wide monitor the 10x5 grid is sized for, whichever +# monitor has focus. +exec rofi -show drun -m DP-1 \ + -modi "drun,run,󰉋 Folders:udt-folders" \ + -display-drun '󰀻 Apps' -display-run '󰆍 Run' \ + -show-icons -drun-display-format '{name}' \ + -theme ~/.config/rofi/udt/launcher.rasi -- cgit v1.2.3