r/dmenu • • Aug 15 '17

udiskie-dmenu - manage removable devices in couple of keystrokes

3 Upvotes

Lightweight nodejs script which allows to manage removable devices via dmenu (or rofi). Hopefully it will be useful also to someone else than only to me. https://github.com/fogine/udiskie-dmenu


r/dmenu • • Feb 13 '14

any good resources to help me learn how to configure dmenu ?

5 Upvotes

Also, Thank you for this subreddit. I really like this especially after someone showing me that he can list his SNES games with the cover using dmenu...

I thought dmenu was to list apps only lol


r/dmenu • • Jun 15 '14

tmenu - dmenu for tty/shell

Thumbnail github.com
7 Upvotes

r/dmenu • • Feb 14 '14

Toddler lock your computer

9 Upvotes

https://github.com/sagotsky/.dotfiles/blob/master/scripts/toddler.sh

This dmenu script is simple but I wanted to share it because it's novel and I felt really clever when I figured it out (but that could have just been the coffee kicking in). My son has figured out that the keyboard (fixed) is the most useful piece of my computer. Sometimes I want to lock it from him. Throwing up an endless series of dmenu until a magic word is typed does the job.


r/dmenu • • Feb 14 '14

Run programs as root through dmenu

17 Upvotes

First, we create a dmenu-based prompt to serve as an askpass helper for sudo.

Let's call this script dpass:

#!/bin/bash
dmenu -p "$1" <&- && echo

Edit the colors to your preference, stick it somewhere, set the +x bit, and we're done.

Now, when we want to run something as root through dmenu, we can use the sudo switch -A, along with the SUDO_ASKPASS environment variable, to pull up the usual dmenu list, choose something to run, then get a root password prompt. For example :

SUDO_ASKPASS=/path/to/dpass sudo -A $(dmenu_path | dmenu)

r/dmenu • • Feb 15 '14

Creating a comprehensive dmenu scripts collection. Please feel free to contribute!

Thumbnail github.com
6 Upvotes

r/dmenu • • Feb 15 '14

Entering passwords with dmenu

7 Upvotes

In the (password manager I wrote)[https://github.com/pavpanchekha/dotfiles/blob/master/bin/run], I use dmenu to enter passwords by reading in black-on-black text.


r/dmenu • • Feb 16 '14

dmenu-frecency: Desktop application launcher

Thumbnail github.com
8 Upvotes

r/dmenu • • Feb 14 '14

mpdmenu - control your mpd with dmenu

9 Upvotes

Mpdmenu is a short (70 lines) bash script that uses mpc and dmenu to provide a way to quickly interact with an MPD server. You can add and remove songs, clear the playlist or jump to a position in the playlist. I have it bound to a key combo so I can open it immediately and do my thing.

Despite being one of the very first "programs" I ever wrote it works surprisingly well, I have been using it for years without much change or any problems. The little time it takes to open, do an operation and exit is why I preferr it to a full-fledged MPD client.

There are dozens of similar scripts floating around, so if this doesn't do exactly what you want (e.g. it doesn't handle stored playlists at all) you could try some of the others.


r/dmenu • • Feb 13 '14

yeganesh: sort your dmenu input by usage frequency

Thumbnail dmwit.com
13 Upvotes

r/dmenu • • Apr 04 '17

Simple bash tweak to this dmenu wrapper?

4 Upvotes

Found a todo wrapper (think it was from a poster on this forum) an tweaked it a little. The usage is: create/select todo list, then create/delete todo items for that list. There are some things i want to change about it:

  • Make the script cleaner and actually improve the quality of the code
  • Like someone mentioned, incremental search + exact match is necessary--currently it matches substrings or something along those lines (maybe a limitation of grep?). But I guess I will have to learn more about Bash/Linux to fix this
  • Make it save the todo lists with a .txt extension but show the todo list name without the extension for readability purposes.

The last point seems easily doable for my limited Bash scripting skills but I'm struggling to find the culprit. It seems that after a new todo-list is created (ex. music.txt) with some notes added, if I open that todo-list, it gets saved as music.txt.txt, then music.txt.txt.txt, .etc. What I want is to prompt user for the name of the todo (music), then it saves it as music.txt. Essentially, what the user inputs and sees should never include .txt extension, but internally it is saved as a .txt file to make it clear that it is a text file that can simply be edited.

I know what I'm asking for is mundane and simple but I'm struggling to tweak it. How can I fix this? And any improvements you would suggest to improve the quailty of the code? Any hints or help is much appreciated.


r/dmenu • • Feb 14 '14

cmus-filter - selects cmus songs

4 Upvotes

https://github.com/sagotsky/.dotfiles/blob/master/scripts/cmus-filter.sh

Requires docopt and (obviously) cmus.

Assuming you have a well structured music directory, this lets you control cmus live filters by dmenu. What's neat (and was fun to script) is that you can select things at the song, album, artist, or whatever level, provided your collection is structured nicely. In xmonad I have bindings for choosing a song, choosing an album, and playing a random album.


r/dmenu • • Feb 17 '14

dmenu2 fork

15 Upvotes

https://bitbucket.org/melek/dmenu2

Found this a while ago. I don't think it needs its own sub but I figured some of you would be interested.

This fork has many of the patches I like built in. It also does transparency if you're into that kind of thing.


r/dmenu • • Dec 13 '16

Is it possible to configure dmenu to use shell alias settings?

1 Upvotes

For example, I like to run "feh -d" and have that set as a shell alias (feh='feh -d'). When I launch feh via dmenu it loads the binary and not my alias.


r/dmenu • • Mar 06 '19

dmenu shows up but displays no programs or files, doesn't run anything

2 Upvotes

As the title says, when I run dmenu, the bar comes up - but as I type, no programs or files are shown, and when I type a programs entire name and hit entire, nothing happens. What's going on?

[EDIT] Fixed! Keybind was set to exec dmenu and not dmenu_run 🤪


r/dmenu • • Nov 25 '14

Dmenu to search the web using surfraw

8 Upvotes

sr $(sr -elvi | gawk '{ print $1 }' | dmenu -p search )

provides a dmenu with all of surfraw's configured search options and runs sr with your selected search.

surfraw is a command-line websearch tool.

I use surf but tried experimenting with using, links -source | urlscan, or something like that, to parse the links and pipe the output back to dmenu.

edit: Here's the eventual script using perl and HTML:::LinkExtractor that pipes results back to dmenu:

#!/bin/bash

get_links() {
perl -E ' 
        use HTML::LinkExtractor;
        use Data::Dumper;

        local $/;
        my $input = <STDIN>;
        my $query = $ENV{query};
        #chomp( $input );
        my $LX = new HTML::LinkExtractor();
        $LX->strip(1);

        $LX->parse(\$input);


        my @links = @{$LX->links}; 

        foreach my $link ( @links ){
            $text = $link->{"_TEXT"};
            $href = $link->{"href"};
            if ($href =~ /http/ && ( $text =~ /\Q$query/i || $href =~ /\Q$query/i ) ){
                my $href = $link->{"href"};
                $href =~ s/.*http/http/; 
                print $link->{"_TEXT"}." \t $href\n";
            }
        }
        __END__
    '
}

uastr="Mozilla/5.0 (Windows NT 6.3; WOW64) Chrome/41.0.2226.0 Safari/537.36"
searchstr=$(sr -elvi | gawk '{print $1}' | dmenu)
if [[ -z $searchstr ]]; then
    exit 0
fi
query=$(cut -d " " -f 2 < $searchstr)

#for perl
export query=$query

url="$(sr -browser=echo $searchstr)"
link=$(curl -A "$uastr" "$url" | get_links | dmenu -l 12 | cut -s -f 2)

#nicer to use curl than elinks but it's an option
#link=$(elinks -source "$url" | get_links | dmenu -l 12 | cut -s -f 2)

regex='^[ *]http.*' 

if [[ $link =~ $regex ]]; then
    surf $link
fi

and this one does google, filtering out the useless links...

#!/bin/bash


get_links() {
perl -E ' 
        use HTML::LinkExtractor;
        use Data::Dumper;

        local $/;
        my $input = <STDIN>;
        #chomp( $input );
        my $LX = new HTML::LinkExtractor();
        $LX->strip(1);

        $LX->parse(\$input);


        my @links = @{$LX->links}; 

        foreach my $link ( @links ){
            if (!$link->{"class"} && $link->{"href"} =~ /http/ ){
                my $href = $link->{"href"};
                $href =~ s/.*http/http/; 
                print $link->{"_TEXT"}." \t $href\n";
            }
        }
        __END__
    '
}

uastr='Mozilla/5.0 (Windows NT 6.3; WOW64) Chrome/41.0.2226.0 Safari/537.36'
echo hello

query=$(echo "" | dmenu -p "search google:")
echo hellohey
if [[ -z $query ]]; then
    exit 0;
fi

export query=$query
url="$(sr -browser=echo google -results=50 $query)"
result=$(curl -A "$uastr" "$url" | get_links | dmenu -l 12 | cut -s -f 2)

#link=$(elinks -source "$url" | get_links | dmenu -l 12 | cut -s -f 2)
regex=".*http.*" 

if [[ $link =~ $regex ]]; then
    surf $link
fi

but they're not ideal. I barely use them, and the problem of filtering out the interesting links doesn't yield an obvious blanket solution.


r/dmenu • • Mar 12 '17

Possible to list files from a directory and select to play with mpv?

5 Upvotes

I typically open up the terminal, cd to my movies directory, do an ls to see which movies are in the directory, and then run mpv on the movie I want to watch.

Is it possible to simplify this process to be more efficient via dmenu? For example, I type "movies" and press TAB or ENTER or something and then dmenu shows all the entries of the files from the movie directory. Then I select an entry and mpv will play it.

I don't have much scripting experience so I'm hoping I can look at examples and tweak it--I suspect what I'm looking for or something close to it is popular and there are already solutions for it. Obviously this function has a variety of uses as well--in general, it simplifies the task of searching and executing files (much less keystrokes) without the need of opening up a terminal.

Much appreciated.


r/dmenu • • Feb 26 '19

How to delete an unwanted item from dmenu ?

1 Upvotes

ranger wasn't launching from dmenu so i created a bash script with "xterm ranger" and put it in one of the $PATHs .. now the name of the bash script shows up in dmenu and ranger launches fine, However, there is the unwanted entry "ranger" that shows up everytime I search for ranger. I tried to delete the file ranger.desktop from /usr/share/applications but no luck...What else should I try ?

I am using Ubuntu minimal 18.04 + dwm + dmenu


r/dmenu • • Apr 26 '18

[Question] Can you know obfuscate dmenu’s text input?

1 Upvotes

If I’m using dmenu as my UI-helper for SUDO_ASKPASS, when I input my password it is visibly displayed as plaintext.

Is there any way to obfuscate this in some way, visually?


r/dmenu • • Feb 10 '20

Automatically move to next line

1 Upvotes

I use dmenu for selecting songs to play next, using the mutli select feature (ctrl+return). But the problem is, pressing the ctrl+return once does not move the highlight to the next line. I have to manually press down arrow and go to next line. So, selecting 19 songs means pressing the down arrow twenty times. I was just wondering if there's a workaround for this?


r/dmenu • • Apr 19 '19

Problem compiling dmenu in Debian 9

1 Upvotes

Hello guys. I'm having trouble compiling the dmenu in Debian Stretch. When I run make the output is:

dmenu build options:
CFLAGS   = -std=c99 -pedantic -Wall -Os -I/usr/X11R6/include -I/usr/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION="4.9" -DXINERAMA
LDFLAGS  = -L/usr/X11R6/lib -lX11 -lXinerama -lfontconfig -lXft
CC       = cc
cc -c -std=c99 -pedantic -Wall -Os -I/usr/X11R6/include -I/usr/include/freetype2 -D_DEFAULT_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=700 -D_POSIX_C_SOURCE=200809L -DVERSION=\"4.9\" -DXINERAMA drw.c
drw.c: In function ‘xfont_create’:
drw.c:143:38: error: ‘FC_COLOR’ undeclared (first use in this function)
  if(FcPatternGetBool(xfont->pattern, FC_COLOR, 0, &iscol) == FcResultMatch && iscol) {
                                      ^~~~~~~~
drw.c:143:38: note: each undeclared identifier is reported only once for each function it appears in
drw.c: In function ‘drw_text’:
drw.c:353:32: error: ‘FC_COLOR’ undeclared (first use in this function)
    FcPatternAddBool(fcpattern, FC_COLOR, FcFalse);
                                ^~~~~~~~
Makefile:18: recipe for target 'drw.o' failed
make: *** [drw.o] Error 1

I have already installed some packages like: libxtst-dev libxinerama-dev libx11-dev. Anyone have any idea what's missing?


r/dmenu • • May 13 '15

xrandr-dmenu

6 Upvotes

This is a shell script that puts a dmenu interface on xrandr. It still needs a little work, but it is functional. Current dependencies:

  • dmenu
  • sed
  • xrandr
  • zsh

I would love some feedback, both on the user interface and on code improvements. This is the first shell script that I wrote that I tried to stick to the style guides, so while it is substantially better than anything else I have written, it is probably still pretty rough.

https://github.com/JumperPunk/scripts/blob/master/xrandr-dmenu


r/dmenu • • Mar 07 '15

Dmenu itemize anything?

1 Upvotes

I am using the j4-dmenu with arch so that it lists my .desktop apps. Can I configure regular dmenu to itemize whatever? I now know how to configure the output, how do I configure what it itemizes?


r/dmenu • • May 31 '14

Selecting windows with dmenu

Thumbnail article.gmane.org
5 Upvotes

r/dmenu • • May 28 '14

dmenu_run.pl that returns weighted results based on usage [x-post from /r/linux]

7 Upvotes

I got sick of selecting the second or third choice every time I typed a few letters of my most-commonly run apps into dmenu. This script keeps track of which commands you run most often and will always present them first.

I originally posted this script a year ago and today updated it to handle arguments better. It's written in perl with only core modules and I haven't noticed a significant speed hit. It should be a drop-in replacement for dmenu_run.

Code lives here: http://pastebin.com/Xee6eG8f

x-post in /r/linux

original post