this post was submitted on 25 Jan 2024
69 points (88.8% liked)

Linux

48212 readers
2024 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Now, to make this appear when right-clicking. Any idea how I can achieve that?

top 47 comments
sorted by: hot top controversial new old
[–] Cwilliams@beehaw.org 27 points 9 months ago (5 children)
[–] MrOzwaldMan@lemmy.ml 18 points 9 months ago* (last edited 9 months ago) (1 children)

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.

[–] isVeryLoud@lemmy.ca 5 points 9 months ago

Learn Kotlin, it's adjacent and better.

[–] ulkesh@beehaw.org 15 points 9 months ago (1 children)

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?”

[–] MonkderZweite@feddit.ch 4 points 9 months ago

Why language-as-it's-own-OS for displaying a dialogue?

[–] skullgiver@popplesburger.hilciferous.nl 15 points 9 months ago (1 children)

Easy to make, cross platform GUI toolkit.

I dislike the look of standard Java applications myself, but it still makes a lot of sense for a quick form based application like this.

[–] vredez@discuss.tchncs.de 15 points 9 months ago (1 children)

Why do you need cross platform availability, if .desktop files are (mostly) Linux only?

I believe some BSDs use it too, and WSL2 will make Linux applications automatically appear on Windows, so editing desktop files may be useful there too. Plus, you don't need to deal with different architectures (aarch vs amd64).

[–] Blaiz0r@lemmy.ml 9 points 9 months ago

Write with what you know

[–] 30p87@feddit.de 4 points 9 months ago (1 children)

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.

[–] ch8zer@lemmy.ca 15 points 9 months ago (1 children)

Don’t you need the JRE to run Java code?

[–] backhdlp@iusearchlinux.fyi 4 points 9 months ago

Yes, it's only compiled to bytecode, which still needs an interpreter.

[–] toothbrush@lemmy.blahaj.zone 11 points 9 months ago (4 children)

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.

[–] QuazarOmega@lemy.lol 10 points 9 months ago (1 children)

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

[–] MrOzwaldMan@lemmy.ml 4 points 9 months ago (1 children)

Damn, i didn't know this existed. Welp, at least I know how to manipulate the system from code.

[–] QuazarOmega@lemy.lol 5 points 9 months ago

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!

[–] ScottE@lemm.ee 7 points 9 months ago

Yep, all desktop environments have this - whatever text editor is handy. :⁠-⁠)

[–] MrOzwaldMan@lemmy.ml 4 points 9 months ago* (last edited 9 months ago) (2 children)

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.

[–] leopold@lemmy.kde.social 3 points 9 months ago* (last edited 9 months ago)

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

[–] toothbrush@lemmy.blahaj.zone 2 points 9 months ago

Yes, it works with any command.

[–] yianiris@kafeneio.social 3 points 9 months ago

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

@toothbrush @MrOzwaldMan

[–] MonkderZweite@feddit.ch 9 points 9 months ago* (last edited 9 months ago) (1 children)

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"
[–] Aatube@kbin.social 6 points 9 months ago* (last edited 9 months ago)

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.

[–] skullgiver@popplesburger.hilciferous.nl 6 points 9 months ago (1 children)

I believe this tool will allow you to register an action in nautilus for your desktop file.

[–] MrOzwaldMan@lemmy.ml 2 points 9 months ago (1 children)

Does it allow java applications to be used as an 'action'?

[–] skullgiver@popplesburger.hilciferous.nl 7 points 9 months ago (1 children)

I don't see why not. The example config file has a whole bunch of complex commands, far more than just the java --jar you need to run a Java application.

[–] MrOzwaldMan@lemmy.ml 1 points 9 months ago

Great! This is going to be my first time doing this, hopefully this comes to everybody's machine as default.

[–] iuselinux@lemmy.world 4 points 9 months ago

That's quite useful i guess

[–] Aatube@kbin.social 4 points 9 months ago (1 children)

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.

[–] MrOzwaldMan@lemmy.ml 5 points 9 months ago (1 children)

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.

[–] Aatube@kbin.social 4 points 9 months ago (1 children)
[–] MrOzwaldMan@lemmy.ml 2 points 9 months ago (2 children)

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
[–] simonced@lemmy.one 2 points 9 months ago

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 :)

[–] Aatube@kbin.social 2 points 9 months ago

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.

[–] QuazarOmega@lemy.lol 2 points 9 months ago (1 children)

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

[–] MrOzwaldMan@lemmy.ml 1 points 9 months ago (1 children)

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.

[–] QuazarOmega@lemy.lol 2 points 9 months ago (1 children)

Yes, but on what environment are you going going to right click in? The desktop? The file manager?
That's what I'm asking

[–] MrOzwaldMan@lemmy.ml 2 points 9 months ago (1 children)

File 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.

[–] QuazarOmega@lemy.lol 1 points 9 months ago

I see, then yes, as others have suggested the Nautilus extension is what you're looking for

[–] PipedLinkBot@feddit.rocks 1 points 9 months ago

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.

[–] MrOzwaldMan@lemmy.ml 1 points 9 months ago (1 children)

How do I integrate gtk and qt, so both GNOME and KDE users can use this?

[–] Aatube@kbin.social 1 points 9 months ago (2 children)

If you’re using swing, you can’t, unless you’re willing to use something called SwingWT from twelve years ago.

[–] MrOzwaldMan@lemmy.ml 1 points 9 months ago (2 children)

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.

[–] Aatube@kbin.social 4 points 9 months ago

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.

[–] backhdlp@iusearchlinux.fyi 2 points 9 months ago* (last edited 9 months ago) (1 children)
[–] Aatube@kbin.social 2 points 9 months ago* (last edited 9 months ago)

the Java devs, OP's thinking they can make a JEP and pull request when they have time

[–] leopold@lemmy.kde.social 1 points 9 months ago

Actually, Swing has a GTK3 style, so it can integrate decently well. JavaFX however does not.