Code Monkey home page Code Monkey logo

Comments (6)

gautrr avatar gautrr commented on September 28, 2024

I just ran into the same "problem" and trying to figure it out. I've also been looking for alternatives to j4-dmenu-desktop that could print available programs from .desktop to standard output, but to no avail so far.

from j4-dmenu-desktop.

enkore avatar enkore commented on September 28, 2024

There is a command line utility to introspect .desktop files written in Python by an Arch Linux guy, hosted on Github. Don't remember the name, though, but you may be able to find it.

from j4-dmenu-desktop.

enkore avatar enkore commented on September 28, 2024

While I took a stab at #51, I remembered this.

This should work, mostly:

#!/bin/sh
CURPID=$$
STDOUT=$(readlink -f /proc/$CURPID/fd/1)
j4-dmenu-desktop --dmenu="(cat > $STDOUT) | (cat << EOF)" &> /dev/null

It relies on some conventions, i.e. readlink -f resolving symlinks, /proc/$PID, and that FD 1 of a shell process is the active standard output. You'll need to put this in a script and run that.

The other way around is possible, too

j4-dmenu-desktop --dmenu="(cat &> /dev/null) | (echo '$*')"

($* = all arguments passed to the shell script, but really, any variable works)

With this it should be quite possible to integrate j4-dmenu-desktop with practically any kind of menu. #48

from j4-dmenu-desktop.

roomcays avatar roomcays commented on September 28, 2024

Wow, I have not expected this 👍
I have tried your script and it nicely prints out list of application names to the console, but when combined with rofi it - strangely - does not work :(
Something is telling me that it might be the case of output redirection, but I am not able to prove it...

from j4-dmenu-desktop.

enkore avatar enkore commented on September 28, 2024

Hm, this should be transparent if the shell script is run like a shell script in a separate shell process. I don't know Rofi, maybe it documents somewhere how exactly it implements these modis.

Edit: Rofi appears to be a C program, so I'd expect it uses a proper shell process to execute scripts handed to it.

from j4-dmenu-desktop.

roomcays avatar roomcays commented on September 28, 2024

I will report this issue to Rofi's developer, he might be interested.

from j4-dmenu-desktop.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.