Home > Back-end >  Making a menu in rofi from which to sellect files
Making a menu in rofi from which to sellect files

Time:07-11

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?

CodePudding user response:

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

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