Skip to content
This repository has been archived by the owner on Apr 23, 2022. It is now read-only.

DAFF0D11/dmenu-suite

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

This repository has been moved to https://github.com/DAFF0D11/dafmenu and updated to dmenu 5.1+

Dmenu-Suite

Dmenu-suite is a custom build of dmenu-5.0 and collection of scripts utilizing its features.

Installation

Install dmenu-suite just as you would install dmenu from source.

git clone https://gitlab.com/DAFF0D11/dmenu-suite.git
cd dmenu-suite
make install

Scripts in the /scripts directory are not currently installed globally, you will have to add them to your path manually or directly call them.

General Keybindings

Some default dmenu keybindings have been remapped.

ctrl-j select item below
ctrl-k select item above
ctrl-p select previous history
ctrl-n select next history
ctrl-v paste

Patches

  • dmenu-center-20200111-8cd37e1.diff
  • dmenu-fuzzymatch-4.9.diff
  • dmenu-instant-4.7.diff
  • dmenu-mousesupporthoverbgcol-5.0.diff
  • dmenu-navhistory-5.0.diff
  • dmenu-preselect-20200513-db6093f.diff
  • dmenu-rejectnomatch-4.7.diff
  • dmenu-scroll-20180607-a314412.diff
  • dmenu-tsv-20201101-1a13d04.diff
  • expect.diff
  • expect-multi-selection.diff

The only patches not available from suckless.org are the 'expect' patches.

The Expect patches are a port of the FZF --expect functionality limited to ctrl-[a-z] keys.
This allows you to supply your dmenu-suite scripts with ad hoc keybindings to perform different actions on selections.

For example:

ls | dmenu-suite -ex "ctrl-r"

You can now utilize the ctrl-r command to return your selected item(s) prefixed with the key used.
This results in a string containing the key used followed by a tab character followed by the selected item.

ctrl-r    config.def.h

This allows you to easily handle different expected keys with just a case statement.

#!/bin/sh

DMENU_CHOICE=$(ls | dmenu-suite -ex 'ctrl-r,ctrl-t,ctrl-y' -c -l 10)

case "$DMENU_CHOICE" in
    ctrl-r*) echo "$DMENU_CHOICE";;
    ctrl-t*) echo "$DMENU_CHOICE";;
    ctrl-y*) echo "$DMENU_CHOICE";;
          *) echo "$DMENU_CHOICE";;
esac

Warning: passing -ex a key that is normally used by dmenu will override dmenu, and make it behave as expected

Scripts

While these scripts exist and work separately, you could easily combine them with little work.

For example, combining Dmenu-chromium with Dmenu-emacs to show all browser tabs and Emacs buffers in the same list.

Control your chromium browser through dmenu.

Dependencies: xclip, jq, sqlite3, a chromium based browser (only brave-browser and chromium tested)

Features

  • Visit tabs
  • Close tabs
  • Bookmarks
  • History
  • Search for keywords
  • Search with search engine
  • Search Incognito
  • Search URL
  • Copy URL
  • Open Local Files

Setup

You must start your browser with the debugging flag: chromium --remote-debugging-port=9222

Keybindings

ctrl-t Show list of tabs (initial)
ctrl-h Show list of history
ctrl-m Show list of bookmarks
ctrl-d close selected tab (or multiple)
ctrl-p Previous search query
ctrl-n Next search query
ctrl-y Copy url of selection to clipboard
ctrl-enter Select multiple
shift-enter Search keywords

Search

Just start typing keywords and hit shift+enter to search in the default engine.
Technically you don't need to hold shift as long as no items are selected in dmenu.

Search Engines

You can also specify search engines by prefixing your search with one of the included engines.

dd Duckduckgo
ddl Duckduckgo lite
ddi Duckduckgo images
gg Google
ggi Google image
nx Nix package manager packages
wfa Wolframalpha
rd Reddit
yt Youtube
az Amazon
eb Ebay
wd Merriam Webster

To use a search engine prefix, you should format your search with a prefix followed by a space followed by your keywords.
ddi puppies in flowers

To search for a URL or local file.
// https://suckless.org

You can also prefix any prefix with i to perform a search incognito.
idd teaching crabs how to read

Warning

Running your browser with the remote debugging flag could open up security vulnerabilities.
Read more about the remote debugging protocol and its security implications here: https://chromedevtools.github.io/devtools-protocol/

A simple music shuffler using MPV back end.

Most music players are far too complicated for my needs.
I like to listen to a single directory of songs on shuffle and choose a 'set' of them to play next.

Its highly recommended to set up playerctl with mpv-mpris to control the mpv instance.

Dependencies: mpv
Recommended: mpv-mpris playerctl

Features

  • Choose directory of music
  • Play all songs in directory on shuffle
  • Choose one ore more songs to play next
  • Fuzzy search songs in directory

Setup

  • Change $MUSIC to point at your music directory
  • Start the mpv instance dmenu-mpv-music-shuffler -i

Keybindings

ctrl-l List playlist
ctrl-h Choose song(s)
ctrl-enter Multi select songs to play next

Inspired by and borrowed from: slakkenhuis/scripts/dmenu-mpv

Control tmux with dmenu.

Dependencies: tmux

Recommended: wmctrl

Features

  • Switch to (pane,window,session)
  • Close (panes,windows,sessions)
  • Swap (panes,windows)
  • Grab (panes,windows)

Setup

Using wmctrl to focus a Tmux window automatically on switch, you need to set its title in your .tmux.conf, and in the script.

In .tmux.conf

set-option -g set-titles-string 'TMUX' 

In dmenu-suite/scripts/dmenu-tmux.

TMUX_TITLE="TMUX"

Keybindings

ctrl-p List all panes(initial)
ctrl-w List all windows
ctrl-s List all sessions
ctrl-g Grab panes/windows
ctrl-x Swap pane/window
ctrl-d Close panes/windows/sessions

Control Emacs with dmenu.

Dependencies: emacs
Recommended: wmctrl

Features

  • Switch to buffer
  • close buffer(s)
  • View buffers
  • View file buffers
  • View hidden buffers
  • View log buffers
  • View magit buffers

Setup

Emacs must be run in daemon mode.

emacs --daemon=MAIN

Connect to the Emacs server with your preferred client

Launch GUI Emacs emacsclient -c --socket-name=MAIN
Terminal emacs emacsclient -nw --socket-name=MAIN

To automatically switch to your Emacs window on selection, you must set its title in the script, as well as your Emacs configuration.
EMACS_TITLE="EMACS"
(setq-default frame-title-format "EMACS")

Keybindings

ctrl-a show all buffers (initial)
ctrl-f show file buffers
ctrl-g show magit buffers
ctrl-l show log buffers
ctrl-o show hidden buffers
ctrl-x close buffer(s)
enter switch to buffer

Warning

I do not know Emacs or Elisp very well.
The naming/grouping of buffers may be incorrect, and the Elisp may be unreliable.

Control desktop windows with dmenu.

Dependencies: wmctrl

Features

  • Switch to windows
  • Grab windows from other workspaces and bring them to your current workspace
  • Close windows

Keybindings

enter Switch to window
ctrl-g Grab window(s)
ctrl-x Close window(s)

Warning

If you are using DWM, be aware that the 'grab' functionality will not work due to the way DWM handles workspaces by default.

A crude replica of the Emacs which-key package.

Unlike the emacs package, this script must be crafted by you to define the commands in the list. Some commands have been provided as examples to help you craft your own 'which-key' menus.

Some sample commands rely on $TERMINAL and $BROWSER variables

Features

  • Nest many commands behind a single keybind
  • Incremental command menus
  • Choose commands through key-chords

Warning

When creating your own menus, you must use uppercase letters for the labels, and lowercase for the trigger keys(or vice versa). This is because we are abusing dmenu's case sensitive nature to label and trigger keys.

Manage Todo list and Notes

Recommended: ripgrep

Features

  • Create Todo items and Notes
  • Preview Todo items and Notes
  • Open Todo/Notes in editor, at point
  • Search contents of Todo/Notes

Setup

This script assumes your Notes are a single directory filled with only Note files, and your Todo list is a single file.
New notes use the .md file extension

Set the TODO_LOCATION variable with the location of your Todo file $HOME/Documents/notes/todo
Set the NOTES_LOCATION variable with the location of your Notes directory $HOME/Documents/notes

To search for keywords in files ( ctrl-g ) the supplemental script dmenu-todo-notes-ripgrep is required to be accessible, either in your path or directly called in dmenu-todo-notes

Keybindings

ctrl-d Show DONE
ctrl-n Show NEXT
ctrl-t Show TODO
ctrl-f Search for Notes
ctrl-g Search keywords in Notes ( Requires ripgrep and dmenu-todo-notes-ripgrep script )
ctrl-i Create Note
ctrl-l Preview Note/Todo item
ctrl-x Promote item, TODO -> NEXT -> DONE
shift-enter Create Todo item

Tips

  • When creating new Todo items, you may just start typing your todo item and and hit enter instead of shift-enter as long as no items are currently selected.

  • To create multi-line Todo items you should use the ; character in place of \n to create newlines.

    This is a new todo item heading;This is the second line;This is the third line
    
  • When previewing Notes/Todo items, you can just hit escape once to go back to the main list instead of restarting the script.

  • To promote a Todo item, you must be in the same mode as the item you wish to promote. For instance, in ctrl-t todo mode, you use ctrl-x to promote an item to NEXT, and then change to ctrl-n next mode to promote that same item to DONE.