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

Feature request: right click options #1

Open
dgutson opened this issue Jul 30, 2023 · 12 comments
Open

Feature request: right click options #1

dgutson opened this issue Jul 30, 2023 · 12 comments

Comments

@dgutson
Copy link

dgutson commented Jul 30, 2023

Proposal: enable a context menu with actions on the boxes, for example:

  • open containing folder
  • delete
@salihgerdan
Copy link
Owner

Hello there,

I originally intended to implement this feature right from the start. As it didn't seem to me that anyone other than me is using the project, I slacked off on the development.

The ground work is already there, as I needed to detect the node from the mouse position for the tooltip that shows the file name. The implementation should be easy, we would store the current node under the cursor when the right click happened, and generate a PopoverMenu with the actions for the node.

It's great motivation for me that someone wishes for this feature. I will get to it when I have time.

@dgutson
Copy link
Author

dgutson commented Jul 30, 2023

You failed to promote this project 😉 but maybe I can help.
It's very useful!

CC @arieltorti

@salihgerdan
Copy link
Owner

Haha, indeed I have. I was hoping the AUR entry might help a little but it didn't. Couldn't bother with reddit or flatpak stores etc.
Glad you found it useful.

@salihgerdan
Copy link
Owner

I have made the commit de2a032 to implement this. It's available in the 0.1.1-beta1 pre-release. (However, the Windows build seems to need some adjustments to work)
Right now it contains "Open" and "Show directory" options. I did not implement "Delete" yet as it seemed a bit more capricious, I might do that later.

@dgutson
Copy link
Author

dgutson commented Aug 1, 2023

Great! LMK once I can test the Windows version.

"Command prompt from here"?

(Or you may want to accept "plug-ins" for the actions and leave it extensible, youbmay have windows and linus plugins)

@dgutson
Copy link
Author

dgutson commented Aug 1, 2023

Or, a confirguration file with pairs [text, command]
where Text is the caption in the menu, and command what to execute in the directory.
Eg

---
actions:
  - delete:
    - windows: del
    - linux: "rm -rf"

@dgutson dgutson closed this as completed Aug 1, 2023
@dgutson dgutson reopened this Aug 1, 2023
@salihgerdan
Copy link
Owner

salihgerdan commented Aug 1, 2023

If this is only for a delete action, implementing a delete option is much simpler than making it that customizable with commands. Is there really a need for that much customization?
As for "Command prompt from here", I adore the idea but it can be accomplished with a file manager usually (i.e. windows explorer shift+right click). GTK understands and handles file managers on all platforms for me, as well as deleting files through the GIO interface, but it would be somewhat more work to make the command prompt cross-platform, so I am hesitant.

I will update this issue when I have fixed the windows build problem.
Thanks for your interest and suggestions, I appreciate it. This has been a great usability upgrade so far.

@dgutson
Copy link
Author

dgutson commented Aug 1, 2023

I think that the yaml configuration file will save you a lot of work, by allowing users to add arbitrary commands.
Now we have open, delete, then suppose I have my command to open a terminal (which terminal? Xterm, gnome's?) so commands may vary per user.
Then you may want to compress a directory because it's too big, and...what compressor? zip? 7z? winrar? :) You see?
Or you still may want to upload that big directory to google drive, so there's the google drive CLI...

All that, solved with a yaml file :)

@salihgerdan
Copy link
Owner

salihgerdan commented Aug 2, 2023

Good news everyone!
The Windows build is complete and seems to work on my system.
You can now test it.
(I am wondering if the functionality works on MacOS, will need to test that later, don't have an Apple device rn)

As for the configurable actions... I'll think about it, but I think it's a bit overkill. I intended this to be a minimally configured, works-out-of-the-box type app (see: there's currently nothing you can configure). Also, it functions as a single executable on platforms other than Windows, so it was meant to be very portable. (Unfortunately I couldn't make this work the same on Windows so it's a bunch of dll files in a folder, due to the limitations of GTK.)
You can accomplish those actions after opening up the file manager, not sure if it's worth embedding all those actions into this tool. Maybe...

I will definitely get to implementing the Delete action later, however. That one clearly should be there. I just need to implement a little more for that, confirmation boxes and whatnot.

@dgutson
Copy link
Author

dgutson commented Aug 2, 2023

Good news everyone!
The Windows build is complete and seems to work on my system.
You can now test it.

Great! I will test it tonight.

I will definitely get to implementing the Delete action later, however. That one clearly should be there. I just need to implement a little more for that, confirmation boxes and whatnot.

Well, if the user calls a script that he/she configured in the config file, I assume the person is responsible of what is doing.
I think you can ship the tool without any config at all and it will just work (maybe only one predefined action: open the file manager, which, BTW, which one on linux? Because it depends on the distro, nautilus, etc.). You could even go further by providing a dialog to edit de actions (just a list of pair [description, action] and maybe one more field: ask_confirmation). The tool would create the config file the first time it is run, so no need to ship it.
Regarding my sample config file, I overcomplicated it by adding the OS, there should be a single file for each OS installation (Linux Windows Mac).

@dgutson
Copy link
Author

dgutson commented Aug 13, 2023

Tried and worked. Comments:

  • opening a directory should also show the open containing directory option, since you usually open something to delete it. This option is the equivalent to the right-clicking on a file you implemented: it opens the directory.
  • any chance to add the delete option? :) Maybe "send to trash bin" and "delete forever"
  • I still think that a yaml config file containing a list of tuples "label", "command" would be useful, letting Spaceman to generate a default one the first time it runs (or whenever the file is not found). This way you follow the "single self-contained file" principle

@salihgerdan
Copy link
Owner

Just added "Move to Trash" functionality with commit b717b59. Will be included along with an option to permanently delete in a coming release.

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