improved bmark. add: bmark-add

This commit is contained in:
Lucas E M Moreira 2023-05-11 16:15:55 -03:00
parent cb0daceb1e
commit cbdfae1b11
4 changed files with 48 additions and 2 deletions

View file

@ -2,9 +2,31 @@
Organize your bookmarks easily!
## Dependencies
- ag
- rofi
## Files
- bmark
- bmark-add
## Usage
Simple script to access your bookmarks easily. Just run bmark!
Simple script to access your bookmarks easily. Just run bmark to access your bookmarks! To add, copy the content and run bmark-add
## Files
The bookmarks will be saven in the file `$HOME/.config/bmark/bookmark`. It may contain a "comment" that will be shown in the rofi menu. For instance:
```
an-interesting-content # name of the content
```
in the rofi menu, will be shown ` name of the content` and it will be copied `an-interesting-content`.
Enjoy!
## Install

10
bmark
View file

@ -1 +1,9 @@
cat ~/krig/bookmark | rofi -dmenu -l 10 | xsel -bi && test $NOTIFY && $NOTIFY "bookmark... ok"
#!/bin/sh
CONFIG_FILE="$HOME/.config/bmark/bookmark"
name=$(cat $CONFIG_FILE | sed s/.*#//g | sort | rofi -dmenu -i -l 10)
ag --nonumbers "$name" $CONFIG_FILE | sed s/\s*#.*//g | xsel -bi && test $NOTIFY && $NOTIFY "bookmark... ok"

12
bmark-add Normal file
View file

@ -0,0 +1,12 @@
#!/bin/sh
CONFIG_FILE="$HOME/.config/bmark/bookmark"
DATA=$(xsel -bo)
name=$(cat $HOME/.config/bmark/bookmark | sed s/.*#//g | sort | rofi -dmenu -i -l 10)
new_line="$DATA # $name"
echo $new_line >> ${CONFIG_FILE}
test $NOTIFY && $NOTIFY "added ${new_line}"

View file

@ -3,8 +3,12 @@
install:
mkdir -p ~/bin
mkdir -p ~/.config/bmark/
touch ~/.config/bmark/bookmark
cp -vf bmark ~/bin/
cp -vf bmark-add ~/bin/
chmod +x ~/bin/bmark
chmod +x ~/bin/bmark-add
uninstall:
rm -vf ~/bin/bmark