IloveMath
IloveMath

Reputation: 241

Making a menu in rofi from which to sellect files

Currently, I am using the following script for a search bar that opens my notes:

#! /bin/sh
cd ~/UniNotes

chosen=$(printf '%s\n' * | rofi -dmenu -i "Test" )

cd $chosen/Notes
alacritty -e vim $chosen.tex

This works because my notes follow the template

UniNotes/Subject1/Notes/Subject1.tex

This set up is quite primitive because it only allows for single tex files to be identified in each folder.

I would like to have a script that lists me all of the tex files from uninotes in rofi. Then I want to select a given tex file and open it with alacrity and vim.

My biggest issue seems to be to somehow preserve the location of a file when it is listed.

Could someone help me with the script?

Upvotes: 1

Views: 1799

Answers (1)

glenn jackman
glenn jackman

Reputation: 246837

Without knowing what rofi is, maybe you want find instead of printf?

chosen=$(find ~/UniNotes -name '*.tex' | rofi -dmenu -i "Test" )

Upvotes: 2

Related Questions