191 lines
6.4 KiB
Org Mode
191 lines
6.4 KiB
Org Mode
#+TITLE: dmenu/rofi scripts — README
|
||
#+AUTHOR: Tony
|
||
|
||
* YouTube Video Showcasing:
|
||
[[https://www.youtube.com/watch?v=1hPPTnYtAwU][YouTube Showcase]]
|
||
|
||
* Table Of Contents :toc:
|
||
- [[#youtube-video-showcasing][YouTube Video Showcasing:]]
|
||
- [[#intro][Intro]]
|
||
- [[#dependencies][Dependencies]]
|
||
- [[#setup--conventions][Setup & Conventions]]
|
||
- [[#find-repos][Find Repos]]
|
||
- [[#dmenu-repossh][dmenu-repos.sh]]
|
||
- [[#rofi-repossh][rofi-repos.sh]]
|
||
- [[#tmux-sessions][TMUX Sessions]]
|
||
- [[#dmenu-sessionssh][dmenu-sessions.sh]]
|
||
- [[#rofi-sessionssh][rofi-sessions.sh]]
|
||
- [[#bookmarks-workpersonal][Bookmarks (work/personal)]]
|
||
- [[#dmenu-bookmarkssh][dmenu-bookmarks.sh]]
|
||
- [[#rofi-bookmarkssh][rofi-bookmarks.sh]]
|
||
- [[#where-to-bind-these-dwm--qtile][Where to bind these (DWM / Qtile)]]
|
||
- [[#dwm][DWM]]
|
||
- [[#qtile][Qtile]]
|
||
- [[#tips--troubleshooting][Tips & Troubleshooting]]
|
||
- [[#support][Support]]
|
||
|
||
* 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
|
||
:PROPERTIES:
|
||
:ID: deps
|
||
:END:
|
||
- ~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
|
||
:PROPERTIES:
|
||
:ID: setup
|
||
:END:
|
||
- 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~.
|
||
|
||
#+begin_src sh
|
||
chmod +x dmenu-*.sh rofi-*.sh
|
||
# or keep them in this repo and call with absolute paths
|
||
#+end_src
|
||
|
||
* 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
|
||
:PROPERTIES:
|
||
:ID: dmenu-repos
|
||
:END:
|
||
#+begin_src 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}"
|
||
#+end_src
|
||
|
||
** rofi-repos.sh
|
||
#+begin_src sh
|
||
# --- config ---
|
||
terminal="${TERMINAL:-st}"
|
||
rofi_flags='-dmenu -i -p "Projects:" -matching fuzzy -no-custom'
|
||
repos_dir="${REPOS_DIR:-$HOME/repos}"
|
||
#+end_src
|
||
|
||
* TMUX Sessions
|
||
List existing tmux sessions, attach to one, or create a new named session on the fly.
|
||
|
||
** dmenu-sessions.sh
|
||
#+begin_src sh
|
||
# --- config ---
|
||
terminal="${TERMINAL:-st}"
|
||
dmenu_flags='-i -c -l 15 -p "tmux:"'
|
||
#+end_src
|
||
|
||
** rofi-sessions.sh
|
||
#+begin_src sh
|
||
# --- config ---
|
||
terminal="${TERMINAL:-st}"
|
||
rofi_flags='-dmenu -i -p "tmux:" -matching fuzzy -no-custom'
|
||
#+end_src
|
||
|
||
* 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
|
||
#+begin_src 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}"
|
||
#+end_src
|
||
|
||
** rofi-bookmarks.sh
|
||
#+begin_src 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}"
|
||
#+end_src
|
||
|
||
* Where to bind these (DWM / Qtile)
|
||
:PROPERTIES:
|
||
:ID: binds
|
||
:END:
|
||
** DWM
|
||
#+begin_src c
|
||
// 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") },
|
||
#+end_src
|
||
|
||
** Qtile
|
||
#+begin_src python
|
||
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"),
|
||
]
|
||
#+end_src
|
||
|
||
* 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:
|
||
|
||
[[https://ko-fi.com/tonybtw][ko-fi.com/tonybtw]]
|
||
|
||
Or check out my website: [[https://www.tonybtw.com][tonybtw]]
|