Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] gui_filepicker: Show dialog on current file's directory #471

Open
hellium6 opened this issue Jul 31, 2024 · 2 comments
Open

[Request] gui_filepicker: Show dialog on current file's directory #471

hellium6 opened this issue Jul 31, 2024 · 2 comments

Comments

@hellium6
Copy link

Thanks to the author(s) for the plugin.

I have zenity. Currently when I press Ctrl+O, for example, it opens a "Recent" files section. It would be great if this could be opened in the same directory as the file opened in current tab. Because often I need to check and open adjacent files from the same directory. I haven't tested other dialogs, such as save or save as, but it could be useful for them too.

With zenity, I found --filename is an option.

       File selection options

       --filename=FILENAME
              Set the file or directory to be selected by default

Running below, opens the dialog in /usr/local. / at the end shown in the command seems to be important, otherwise, it just opens /usr and selects local dir.

$ zenity --file-selection --filename=/usr/local/

Haven't tested with kdialog. But found this which says "You have to specify a starting directory, and can optionally provide a filter", then has this example:

$ kdialog --getopenfilename /usr/share/sounds/ '*.ogg'

I have a feeling / at the end shown here is also important in kdialog.

@kemzops
Copy link
Contributor

kemzops commented Aug 3, 2024

local project_dir = core.project_dir
  if project_dir and project_dir ~= "" then
    project_dir = project_dir .. PATHSEP
  else
    project_dir = "~/"
end

this should do the trick #472

@kemzops
Copy link
Contributor

kemzops commented Aug 3, 2024

Keep in mind core.project_dir has some limitations, when you open two projects it will return double path's //, Kdialog and Zenity deal with that perfectly fine with no need to filter the path.

/home/kemzo/Desktop//home/kemzo/.config/lite-xl/init.lua The dialog will open in /home/kemzo/Desktop/.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants