Skip to content

Commit

Permalink
Update the README
Browse files Browse the repository at this point in the history
  • Loading branch information
Dlurak committed Sep 22, 2024
1 parent 79dae9e commit f89ca3f
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 0 deletions.
68 changes: 68 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,74 @@ Projects combine directories and templates. You can specify a template to use wi

Moxide is licensed under the GPL.

## Scripting

It is easy and recommended to use moxide in shell scripts.
Here is the one I recommend:

```sh
#!/bin/bash

project_emoji="🚀"
template_emoji="🛠️"
directory_emoji="📁"

if [ "$1" == "rofi" ]; then
selection_tool="rofi"
else
selection_tool="fzf"
fi

fzf_colors="--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 \
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
--color=marker:#b4befe,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8 \
--color=selected-bg:#45475a"

list=$(moxide list \
--format-project "$project_emoji {}"\
--format-template "$template_emoji {}"\
--format-directory "$directory_emoji {}"
)

case "$selection_tool" in
"rofi")
value=$(echo "$list" | rofi -dmenu -p " Tmux");
;;
*)
value=$(echo "$list" | \
fzf \
--no-sort \
--layout reverse \
--border rounded \
--border-label "Moxide Sessions" \
--no-scrollbar \
--prompt "" \
--pointer "👉" \
$fzf_colors
)
;;
esac

emoji="${value:0:1}"
name="${value:2}"

case "$emoji" in
$project_emoji)
moxide project start "$name"
;;
$template_emoji)
moxide template start "$name"
;;
$directory_emoji)
moxide dir start "$name"
;;
esac
```
Then you can bind that into a tmux popup:
```tmux
bind-key s display-popup -B -E -w 40% -h 12 "~/Dotfiles/scripts/shell/moxide.sh"
```

## Similar Projects

If you are exploring alternatives, you might find these similar tools useful:
Expand Down
15 changes: 15 additions & 0 deletions src/cli/init.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
use clap::Parser;

#[derive(Parser, Debug)]
pub struct InitCli {
#[arg(long, alias = "gen-config", default_value_t = false)]
pub config: bool,
#[arg(
long,
alias = "gen-completion",
alias = "gen-comp",
alias = "gen-complete",
default_value_t = false
)]
pub completion: bool,
}

0 comments on commit f89ca3f

Please sign in to comment.