diff options
| author | Danilo M. <danix@danix.xyz> | 2026-10-18 12:00:12 +0200 |
|---|---|---|
| committer | Danilo M. <danix@danix.xyz> | 2026-10-18 12:00:12 +0200 |
| commit | 21fa486da1b07131518eb9fa742dd29f3ab1320c (patch) | |
| tree | 27e7c9502b03fb81ba8d11b8c9b5a81852fe58f8 /bin/udt-folders | |
| parent | 1d527c4e47514540541abf57aa1adb6a14ae5b54 (diff) | |
| download | rofi-scripts-21fa486da1b07131518eb9fa742dd29f3ab1320c.tar.gz rofi-scripts-21fa486da1b07131518eb9fa742dd29f3ab1320c.zip | |
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 <noreply@anthropic.com>
Diffstat (limited to 'bin/udt-folders')
| -rwxr-xr-x | bin/udt-folders | 59 |
1 files changed, 59 insertions, 0 deletions
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. <danix@danix.xyz> +# +# 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 |
