Skip to content

tonybanters/dmenu-scripts

Repository files navigation

dmenu/rofi scripts — README

YouTube Video Showcasing:

YouTube Showcase

Table Of Contents

Intro

This repo contains 3 scripts (with 2 variants each):

  1. repos — fuzzy-pick a repo and jump into a tmux session there
  2. sessions — list existing tmux sessions and attach/create
  3. bookmarks — pick from a personal or work bookmark list and open in the matching browser

All scripts have both dmenu and rofi variants (6 scripts total).

Dependencies

  • tmux (for repos / sessions)
  • One launcher: dmenu or rofi
  • A terminal (st by default; configurable)
  • xdg-open (only if you later want to open URLs via system handler)

Setup & Conventions

  • Terminal is configurable via terminal="st" (or honor $TERMINAL).
  • Default repos directory is $HOME/repos; change with repos_dir="$HOME/dev" or set $REPOS_DIR.
  • Bookmark files live at:
    • Personal: ~/.config/bookmarks/personal.txt
    • Work: ~/.config/bookmarks/work.txt

    Each file is one URL per line. (Optionally, lines may be label<tab>url; the script will use the URL part.)

  • Scripts are POSIX sh. Mark them executable and put on $PATH.
chmod +x dmenu-*.sh rofi-*.sh
# or keep them in this repo and call with absolute paths

Find Repos

This reads your repos from /$REPOS_DIR (default $HOME/repos), shows them in dmenu/rofi, and spawns a terminal that attaches to (or creates) a tmux session rooted at that repo.

Below are the relevant sections of each script and where to change the variables according to your terminal, flags, repos directory, etc.

dmenu-repos.sh

# --- config ---
terminal="${TERMINAL:-st}"
dmenu_flags='-i -c -bw 3 -W 600 -l 30 -h 40 -F -fn "JetBrainsMono Nerd Font:size=16" -p "Projects:"'
repos_dir="${REPOS_DIR:-$HOME/repos}"

rofi-repos.sh

# --- config ---
terminal="${TERMINAL:-st}"
rofi_flags='-dmenu -i -p "Projects:" -matching fuzzy -no-custom'
repos_dir="${REPOS_DIR:-$HOME/repos}"

TMUX Sessions

List existing tmux sessions, attach to one, or create a new named session on the fly.

dmenu-sessions.sh

# --- config ---
terminal="${TERMINAL:-st}"
dmenu_flags='-i -c -l 15 -p "tmux:"'

rofi-sessions.sh

# --- config ---
terminal="${TERMINAL:-st}"
rofi_flags='-dmenu -i -p "tmux:" -matching fuzzy -no-custom'

Bookmarks (work/personal)

Picks which list (Personal/Work), then shows bookmarks from the corresponding file and opens them in the matching browser.

  • Files:
    • Personal list: ~/.config/bookmarks/personal.txt
    • Work list: ~/.config/bookmarks/work.txt
  • Format: one URL per line. (Optional: label<tab>url; the script will extract the URL.)

dmenu-bookmarks.sh

# --- config ---
terminal="${TERMINAL:-st}"
dmenu_flags='-i -c -l 20 -p "Bookmarks:"'

# bookmark sources
personal_file="${BOOKMARKS_PERSONAL_FILE:-$HOME/.config/bookmarks/personal.txt}"
work_file="${BOOKMARKS_WORK_FILE:-$HOME/.config/bookmarks/work.txt}"

# which browsers to use for each list
personal_browser="${PERSONAL_BROWSER:-firefox}"
work_browser="${WORK_BROWSER:-brave}"

rofi-bookmarks.sh

# --- config ---
terminal="${TERMINAL:-st}"
rofi_flags='-dmenu -i -p "Bookmarks:" -matching fuzzy -no-custom'

# bookmark sources
personal_file="${BOOKMARKS_PERSONAL_FILE:-$HOME/.config/bookmarks/personal.txt}"
work_file="${BOOKMARKS_WORK_FILE:-$HOME/.config/bookmarks/work.txt}"

# which browsers to use for each list
personal_browser="${PERSONAL_BROWSER:-firefox}"
work_browser="${WORK_BROWSER:-chromium}"

Where to bind these (DWM / Qtile)

DWM

// With Keychord Patch:
&((Keychord){2, {{MODKEY, XK_f}, {0, XK_f}}, spawn, SHCMD("$HOME/.local/bin/dmenu-repos.sh")}),
&((Keychord){2, {{MODKEY, XK_f}, {0, XK_s}}, spawn, SHCMD("$HOME/.local/bin/dmenu-sessions.sh")}),
&((Keychord){2, {{MODKEY, XK_f}, {0, XK_b}}, spawn, SHCMD("$HOME/.local/bin/dmenu-bookmarks.sh")}),

// Without Keychord Patch:
{ MODKEY, XK_p, spawn, SHCMD("$HOME/.local/bin/dmenu-repos.sh") },
{ MODKEY, XK_s, spawn, SHCMD("$HOME/.local/bin/dmenu-sessions.sh") },
{ MODKEY, XK_b, spawn, SHCMD("$HOME/.local/bin/dmenu-bookmarks.sh") },

Qtile

from libqtile.config import Key, KeyChord
from libqtile.lazy import lazy
mod = "mod4"

keys = [
    # Single keys
    Key([mod], "p", lazy.spawn("dmenu-repos.sh"), desc="Repos (dmenu)"),
    Key([mod], "s", lazy.spawn("dmenu-sessions.sh"), desc="Sessions (dmenu)"),
    Key([mod], "b", lazy.spawn("dmenu-bookmarks.sh"), desc="Bookmarks (dmenu)"),

    # KeyChord leader on Mod+f
    KeyChord([mod], "f", [
        Key([], "f", lazy.spawn("dmenu-repos.sh"),      desc="Repos"),
        Key([], "s", lazy.spawn("dmenu-sessions.sh"),   desc="Sessions"),
        Key([], "b", lazy.spawn("dmenu-bookmarks.sh"),  desc="Bookmarks"),
    ], mode="DMENU"),
]

Tips & Troubleshooting

  • **Repos don’t show up:** check repos_dir and ensure directories exist one level deep.
  • **tmux attach fails:** make sure tmux is installed; scripts create the session if missing.
  • **Bookmarks open in wrong browser:** set PERSONAL_BROWSER / WORK_BROWSER or edit the variables at the top of the bookmarks scripts.
  • **Rofi/Dmenu theming:** append your theme flags to rofi_flags / dmenu_flags.

Support

If these scripts save you time, you can support my work on Ko-fi:

ko-fi.com/tonybtw

Or check out my website: tonybtw

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

Packages

No packages published

Languages