Now, to make this appear when right-clicking. Any idea how I can achieve that?
No offense, but why Java?
Because that’s what I learned from Uni, didn’t want that skill to go to waste. I was thinking about how it would be easier to make the apps (plain applications that use executables and shell to run) .desktop file without any hassle (for new Linux users).
Also, Python was two semesters ago, so I forgot all about it.
Learn Kotlin, it’s adjacent and better.
deleted by creator
Why do you need cross platform availability, if .desktop files are (mostly) Linux only?
deleted by creator
Alright, but maybe take a look into something like Zenity. The task done by your tool doesn’t really justify installing a huge JRE, when a simple bash script would suffice.
deleted by creator
Because despite the popular bandwagon belief, there’s nothing wrong with using Java. It’s just a tool, like so many others.
This is like saying, “Why that Philips head screwdriver? Why not this other Philips head screwdriver?”
Why language-as-it’s-own-OS for displaying a dialogue?
Write with what you know
Because it works, does not have any drawbacks that I could see, and is universal, but not from Microsoft, and does not require you to install pip or npm to run.
Don’t you need the JRE to run Java code?
Yes, it’s only compiled to bytecode, which still needs an interpreter.
Don’t most desktop environments already have this?
If you want to include this as an option when right clicking the desktop, you will probably need to patch this into the DE of your choice, however I think at least KDE has an option for custom right click actions.
Don’t most desktop environments already have this?
An environment agnostic tool isn’t a bad thing though, it already exists as PinApp, though I’m guessing OP is doing this more as a learning project
Damn, i didn’t know this existed. Welp, at least I know how to manipulate the system from code.
Don’t be discouraged, doing something from scratch is always a great learning opportunity and even if this isn’t the first iteration of such a tool there is room improvement, for instance, I don’t think any of the tools that allow creation .desktop shortcuts interface with any context menu as yours would do in the future, so that could be a cool feature to show off!
Yep, all desktop environments have this - whatever text editor is handy. :-)
I see, I didn’t know KDE had that, does KDE allow java apps to be used as the right click action? As for GNOME, I’m still trying to figure it out.
Until then, I will post the link to the app in the future. It needs some beautification, and quality of life changes so you and the others can use it as you use sudo apt update and upgrade to update your PCs.
For KDE right click menus, you need to use service menus: https://develop.kde.org/docs/apps/dolphin/service-menus/
These are used by Plasma and most KDE apps that deal with files.
Krusader has a more powerful system for this called UserActions, but they’re exclusive to Krusader and afaik Krusader is also compatible with service menus, so these are much less portable: https://docs.kde.org/trunk5/en/krusader/krusader/useractions.html
Yes, it works with any command.
A window manager is enough with any customizable drop menu, can open a file manager of choice, create a folder or file, no desktop is needed.
worker ~/.Desktop
or whatever filemanager one is using
Btw:
# convince Java-Apps to use desktop theme and nice font rendering export _JAVA_OPTIONS="$_JAVA_OPTIONS \ -Dawt.useSystemAAFontSettings=on \ -Dswing.aatext=true \ -Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel \ -Dswing.crossplatformlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel"
They use JavaFX, not swing, and AFAIK JavaFX doesn’t even have a bundled Windows look. Never knew Swing had a GTK look though, that’s nice.
deleted by creator
Does it allow java applications to be used as an ‘action’?
deleted by creator
Great! This is going to be my first time doing this, hopefully this comes to everybody’s machine as default.
I’d recommend converting to Kotlin, which saves a lot on bureaucracy and IntelliJ can easily do
https://askubuntu.com/questions/431703/how-to-add-open-with-custom-command-option-in-right-click-menu-of-nautilus might have what you want
Also, how’d you get the IntelliJ titlebar to work properly? In the new theme, I get two title bars on my machine.
I’d recommend converting to Kotlin, which saves a lot on bureaucracy and IntelliJ can easily do
I’d love to, but my mind, time, and energy is being spent on other studies.
https://askubuntu.com/questions/431703/how-to-add-open-with-custom-command-option-in-right-click-menu-of-nautilus might have what you want
Didn’t work, no new option appears after following the steps.
Also, how’d you get the IntelliJ titlebar to work properly? In the new theme, I get two title bars on my machine.
Easy, I made a .desktop file for IntelliJ and boom, no double title bars.
Hmm, why the bold?
Maybe try https://stackoverflow.com/questions/47235022/add-a-custom-option-in-nautilus-right-click-menu ?
What did you put in the .desktop file?
Hmm, why the bold?
to distinguish the quote from my reply
Maybe try https://stackoverflow.com/questions/47235022/add-a-custom-option-in-nautilus-right-click-menu ?
Will do, i’ll reply if it’ll work or not.
What did you put in the .desktop file?
I put the following:-
[Desktop Entry] Name=IntelliJ Idea Comment=IDE Exec=/home/user/Programs/IntelliJ\ Idea/bin/idea.sh Icon=/home/user/Programs/IntelliJ Idea/bin/idea.svg Type=Application Categories=Development;
basically
[Desktop Entry] Name=<Name that will be seen in the start menu for whatever DE> Comment=<Just write anything here> Exec=<Your executable or shell application location goes here> Icon=<Any icon you want to use> Type=Application <this is default, no change here> Categories=Development; <There are many categories, they go here>
For ‘Exec’ and ‘Icon’, type the absolute path for both em like the example. As for categories, here they are below:
- Audio
- Video
- Development
- Education
- Game
- Graphics
- Network
- Office
- Science
- Settings
- System
- Utility
- Other
I already have a normal desktop file like yours. I don’t see how replacing it with yours would provide any benefit as the execution arguments are all the same. I guess you won’t be able to help me then.
That sample text file, you can save it in the “Template” folder in your home folder, and then you can create a new file from that template with the right click menu > new entry :)
That’s quite useful i guess
That’s neat
make this appear when right-clicking. Any idea how I can achieve that?
Right clicking where exactly? If you mean the desktop, then I imagine you’ll likely need a GNOME Shell or Nautilus extension
An application and programs that use shell as their application, for example, IntelliJ IDEA use ‘idea.sh’ to run the IDE, so it would be useful for people to right-click and just create the ‘.desktop’ file right away.
Yes, but on what environment are you going going to right click in? The desktop? The file manager?
That’s what I’m askingFile managers, because that’s where the applications are. As for desktop, I will give the option for that one or more users who do that.
I see, then yes, as others have suggested the Nautilus extension is what you’re looking for
How do I integrate gtk and qt, so both GNOME and KDE users can use this?
If you’re using swing, you can’t, unless you’re willing to use something called SwingWT from twelve years ago.
Actually, Swing has a GTK3 style, so it can integrate decently well. JavaFX however does not.
Im using JavaFX, i forgot to type that in the title.
If it still doesn’t work, i may have to just CSS or show the devs my work and they’ll implement my work in their own way.
Well, JavaFX has even worse support. There aren’t even bundled themes to mimic Windows and macOS style, and you’ll indeed have to port the CSS.
the devs
who?
the Java devs, OP’s thinking they can make a JEP and pull request when they have time
Here is an alternative Piped link(s):
https://piped.video/watch?v=cYIY6XMixfc
Piped is a privacy-respecting open-source alternative frontend to YouTube.
I’m open-source; check me out at GitHub.