Browse Source

Initial commit.

master
Mathieu Laparie 1 year ago
parent
commit
0dca17430d
8 changed files with 120399 additions and 10 deletions
  1. 30
    9
      README.md
  2. 428
    0
      config.example
  3. BIN
      rofiemoji-rofiunicode1.png
  4. BIN
      rofiemoji-rofiunicode2.png
  5. 3
    1
      rofiemoji.sh
  6. 23
    0
      rofiunicode.sh
  7. 116
    0
      sidetab-adapta.rasi
  8. 119799
    0
      unicode.txt

+ 30
- 9
README.md View File

@@ -1,23 +1,44 @@
# Rofiemoji
# rofiemoji-rofiunicode

Inspired by https://github.com/fdw/rofimoji but written as rofi-script instead of starting a separate rofi.
Inspired by [fdw/rofimoji](https://github.com/fdw/rofimoji) and its script version by [nkoehring/rofiemoji](https://github.com/nkoehring/rofiemoji), **rofiemoji-rofiunicode** is the combination of two rofi scripts to search emojis or unicode characters directly in rofi, instead of a separate rofi instance like the original [rofimoji by fdw](https://github.com/fdw/rofimoji). Unicode and Emojis modis show up as separate tabs when rofi is invoked:

It automatically downloads the list of emojis when used for the first time. To avoid that, simply place `emoji.txt` from this repository in `$HOME/.cache/` yourself. But don't worry too much, the download is pretty quick (~350kb text file).
![rofiemoji-rofiunicode1](.//rofiemoji-rofiunicode1.png)

![rofiemoji-rofiunicode2](.//rofiemoji-rofiunicode2.png)

`rofiemoji.sh` and `rofiunicode.sh` will try to download the lists of emoji and unicode characters when used the first time, unless the full repository has already been cloned using:

```bash
cd ~/.config
git clone https://github.com/Kabouik/rofiemoji.git
```

The list of unicode characters was originally created by [/u/fe80c0ffee](https://www.reddit.com/r/unixporn/comments/7zqkov/oc_i_mad_a_rofi_emoji_picker_and_i_feel_bad_about/duqls53?utm_source=share&utm_medium=web2x).

## Prerequisites

* An emoji capable font, for example [Noto Emoji](https://www.google.com/get/noto/#emoji-zsye) or [Noto Color Emoji](https://www.google.com/get/noto/#emoji-zsye-color).
* xsel to copy the selection to the clipboard. You should find it in your package manager.
* `xsel` to copy the selection to the clipboard. You should find it in your package manager.

## Usage Example
## Usage example
Add a custom keybinding in your system for the following command:
```sh
rofi -modi 'run,drun,emoji:/path/to/rofimoji/rofimoji.sh' -show emoji
rofi -show windowcd -theme-str '#window{width: 30%;}' # See the rofi documentation for details
```
Navigate through roji tabs using `Ctrl+Tab` (default) and search emojis or unicode characters by keyword. Pressing `Return` will copy the highlighted character to the clipboard.

`Enter` copies the selected emoji into the clipboard. Requires [xsel](https://linux.die.net/man/1/xsel) to work.
## Recommended configuration
For rofi to look like the above screenshots, use the supplied `config` file and `sidetab-adapta.rasi` theme (originally taken from the [rofi-themes](https://raw.githubusercontent.com/davatorium/rofi-themes/master/User%20Themes/sidetab-adapta.rasi) collection):

## Screenshot
```bash
mv $HOME/.config/rofi/config $HOME/.config/rofi/config.back
cp $HOME/.config/rofiemoji/config.example $HOME/.config/rofi/config
cp $HOME/.config/rofiemoji/sidetab-adapta.rasi $HOME/.local/share/rofi/themes/
```
The `config` file is customized to my own system and preferences. It is assumed that rofi and rofiemoji folders are located in `~/.config/`. Make sure you reviewed the few uncommented lines to check whether my custom preferences will work on your system. For instance, this `config` file is adapted to `gnome-terminal`.

![screenshot](https://raw.githubusercontent.com/nkoehring/rofiemoji/master/rofiemoji.jpg)
## Alternative

An alternative based on [rofimoji by fdw](https://github.com/fdw/rofimoji) instead of rofi-scripts, but still with the addition of unicode characters from [/u/fe80c0ffee](https://www.reddit.com/r/unixporn/comments/7zqkov/oc_i_mad_a_rofi_emoji_picker_and_i_feel_bad_about/duqls53?utm_source=share&utm_medium=web2x) is available here: [Kabouik/rofimoji](https://github.com/Kabouik/rofimoji). It allows multiple selection of emojis or unicode characters, but the window customisation is not as flexible.

![Kabouik/rofimoji](https://reho.st/medium/https://github.com/Kabouik/rofimoji/raw/master/screenshot-fork.png?raw=true)

+ 428
- 0
config.example View File

@@ -0,0 +1,428 @@
! "Enabled modi" Set from: File
rofi.modi: windowcd,drun,run,ssh,unicode:~/.config/rofiemoji/rofiunicode.sh,emoji:~/.config/rofiemoji/rofiemoji.sh

! "Window width" Set from: Default
! rofi.width: 30

! "Number of lines" Set from: Default
! rofi.lines: 15

! "Number of columns" Set from: Default
rofi.columns: 2

! "Font to use" Set from: Default
rofi.font: Fira Code 11

! "Border width" Set from: Default
rofi.bw: 0

! "Location on screen" Set from: Default
! rofi.location: 0

! "Padding" Set from: Default
! rofi.padding: 5

! "Y-offset relative to location" Set from: Default
! rofi.yoffset: 0

! "X-offset relative to location" Set from: Default
! rofi.xoffset: 0

! "Always show number of lines" Set from: Default
! rofi.fixed-num-lines: true

! "Whether to load and show icons" Set from: Rasi File
rofi.show-icons: true

! "Terminal to use" Set from: File
rofi.terminal: gnome-terminal

! "Ssh client to use" Set from: Default
! rofi.ssh-client: ssh

! "Ssh command to execute" Set from: File
rofi.ssh-command: {terminal} -- {ssh-client} {host}

! "Run command to execute" Set from: File
rofi.run-command: {cmd}

! "Command to get extra run targets" Set from: Default
! rofi.run-list-command:

! "Run command to execute that runs in shell" Set from: File
rofi.run-shell-command: {terminal} -- bash -c "{cmd}; bash"

! "Command executed on accep-entry-custom for window modus" Set from: Default
! rofi.window-command: wmctrl -i -R {window}

! "Window fields to match in window mode" Set from: Default
! rofi.window-match-fields: all

! "Theme to use to look for icons" Set from: Default
! rofi.icon-theme:

! "Desktop entry fields to match in drun" Set from: Default
! rofi.drun-match-fields: name,generic,exec,categories

! "Desktop entry show actions." Set from: Default
! rofi.drun-show-actions: false

! "DRUN format string. (Supports: generic,name,comment,exec,categories)" Set from: Default
! rofi.drun-display-format: {name} [<span weight='light' size='small'><i>({generic})</i></span>]

! "Disable history in run/ssh" Set from: Default
! rofi.disable-history: false

! "Programs ignored for history" Set from: Default
! rofi.ignored-prefixes:

! "Use sorting" Set from: Default
! rofi.sort: false

! "Choose the strategy used for sorting: normal (levenshtein) or fzf." Set from: Default
! rofi.sorting-method:

! "Set case-sensitivity" Set from: Default
! rofi.case-sensitive: false

! "Cycle through the results list" Set from: Default
! rofi.cycle: true

! "Enable sidebar-mode" Set from: Rasi File
rofi.sidebar-mode: true

! "Row height (in chars)" Set from: Default
! rofi.eh: 1

! "Enable auto select mode" Set from: Default
! rofi.auto-select: false

! "Parse hosts file for ssh mode" Set from: Default
! rofi.parse-hosts: false

! "Parse known_hosts file for ssh mode" Set from: Default
! rofi.parse-known-hosts: true

! "Set the modi to combine in combi mode" Set from: Default
rofi.combi-modi: windowcd,drun,run,ssh,unicode:~/.config/rofiemoji/rofiunicode.sh,emoji:~/.config/rofiemoji/rofiemoji.sh

! "Set the matching algorithm. (normal, regex, glob, fuzzy)" Set from: Default
! rofi.matching: normal

! "Tokenize input string" Set from: Default
! rofi.tokenize: true

! "Monitor id to show on" Set from: File
rofi.m: 1

! "Margin between rows *DEPRECATED*" Set from: Default
! rofi.line-margin: 2

! "Padding within rows *DEPRECATED*" Set from: Default
! rofi.line-padding: 1

! "Pre-set filter" Set from: Default
! rofi.filter:

! "Separator style (none, dash, solid) *DEPRECATED*" Set from: Default
! rofi.separator-style: dash

! "Hide scroll-bar *DEPRECATED*" Set from: Default
! rofi.hide-scrollbar: false

! "Fullscreen" Set from: File
rofi.fullscreen: false

! "Fake transparency *DEPRECATED*" Set from: Default
! rofi.fake-transparency: false

! "DPI" Set from: Default
! rofi.dpi: -1

! "Threads to use for string matching" Set from: Default
! rofi.threads: 0

! "Scrollbar width *DEPRECATED*" Set from: Default
! rofi.scrollbar-width: 8

! "Scrolling method. (0: Page, 1: Centered)" Set from: Default
! rofi.scroll-method: 0

! "Background to use for fake transparency. (background or screenshot) *DEPRECATED*" Set from: Default
! rofi.fake-background: screenshot

! "Window Format. w (desktop name), t (title), n (name), r (role), c (class)" Set from: Default
rofi.window-format: {c} {w} {t}

! "Click outside the window to exit" Set from: Default
! rofi.click-to-exit: true

! "Indicate how it match by underlining it." Set from: Default
! rofi.show-match: true

! "New style theme file" Set from: File

! "Color scheme for normal row" Set from: Default
! rofi.color-normal:

! "Color scheme for urgent row" Set from: Default
! rofi.color-urgent:

! "Color scheme for active row" Set from: Default
! rofi.color-active:

! "Color scheme window" Set from: Default
! rofi.color-window:

! "Max history size (WARNING: can cause slowdowns when set to high)." Set from: Default
! rofi.max-history-size: 5

! "Hide the prefix mode prefix on the combi view." Set from: Default
! rofi.combi-hide-mode-prefix: false

! "Set the character used to negate the matching. ('\0' to disable)" Set from: Default
! rofi.matching-negate-char: -

! "Directory where history and temporary files are stored." Set from: Default
! rofi.cache-dir:

! "Pidfile location" Set from: Default
! rofi.pid: /run/user/1000/rofi.pid

! "The display name of this browser" Set from: Default
! rofi.display-window:

! "The display name of this browser" Set from: Default
! rofi.display-windowcd:

! "The display name of this browser" Set from: Default
! rofi.display-run:

! "The display name of this browser" Set from: Default
! rofi.display-ssh:

! "The display name of this browser" Set from: Default
! rofi.display-drun:

! "The display name of this browser" Set from: Default
! rofi.display-combi:

! "The display name of this browser" Set from: Default
! rofi.display-keys:

! "Paste primary selection" Set from: Default
! rofi.kb-primary-paste: Control+V,Shift+Insert

! "Paste clipboard" Set from: Default
! rofi.kb-secondary-paste: Control+v,Insert

! "Clear input line" Set from: Default
! rofi.kb-clear-line: Control+w

! "Beginning of line" Set from: Default
! rofi.kb-move-front: Control+a

! "End of line" Set from: Default
! rofi.kb-move-end: Control+e

! "Move back one word" Set from: Default
! rofi.kb-move-word-back: Alt+b,Control+Left

! "Move forward one word" Set from: Default
! rofi.kb-move-word-forward: Alt+f,Control+Right

! "Move back one char" Set from: Default
! rofi.kb-move-char-back: Left,Control+b

! "Move forward one char" Set from: Default
! rofi.kb-move-char-forward: Right,Control+f

! "Delete previous word" Set from: Default
! rofi.kb-remove-word-back: Control+Alt+h,Control+BackSpace

! "Delete next word" Set from: Default
! rofi.kb-remove-word-forward: Control+Alt+d

! "Delete next char" Set from: Default
! rofi.kb-remove-char-forward: Delete,Control+d

! "Delete previous char" Set from: Default
! rofi.kb-remove-char-back: BackSpace,Shift+BackSpace,Control+h

! "Delete till the end of line" Set from: Default
! rofi.kb-remove-to-eol: Control+k

! "Delete till the start of line" Set from: Default
! rofi.kb-remove-to-sol: Control+u

! "Accept entry" Set from: Default
! rofi.kb-accept-entry: Control+j,Control+m,Return,KP_Enter

! "Use entered text as command (in ssh/run modi)" Set from: Default
! rofi.kb-accept-custom: Control+Return

! "Use alternate accept command." Set from: Default
! rofi.kb-accept-alt: Shift+Return

! "Delete entry from history" Set from: Default
! rofi.kb-delete-entry: Shift+Delete

! "Switch to the next mode." Set from: Default
! rofi.kb-mode-next: Shift+Right,Control+Tab

! "Switch to the previous mode." Set from: Default
! rofi.kb-mode-previous: Shift+Left,Control+ISO_Left_Tab

! "Go to the previous column" Set from: Default
! rofi.kb-row-left: Control+Page_Up

! "Go to the next column" Set from: Default
! rofi.kb-row-right: Control+Page_Down

! "Select previous entry" Set from: Default
! rofi.kb-row-up: Up,Control+p,ISO_Left_Tab

! "Select next entry" Set from: Default
! rofi.kb-row-down: Down,Control+n

! "Go to next row, if one left, accept it, if no left next mode." Set from: Default
! rofi.kb-row-tab: Tab

! "Go to the previous page" Set from: Default
! rofi.kb-page-prev: Page_Up

! "Go to the next page" Set from: Default
! rofi.kb-page-next: Page_Down

! "Go to the first entry" Set from: Default
! rofi.kb-row-first: Home,KP_Home

! "Go to the last entry" Set from: Default
! rofi.kb-row-last: End,KP_End

! "Set selected item as input text" Set from: Default
! rofi.kb-row-select: Control+space

! "Take a screenshot of the rofi window" Set from: Default
! rofi.kb-screenshot: Alt+S

! "Toggle between ellipsize modes for displayed data" Set from: Default
! rofi.kb-ellipsize: Alt+period

! "Toggle case sensitivity" Set from: Default
! rofi.kb-toggle-case-sensitivity: grave,dead_grave

! "Toggle sort" Set from: Default
! rofi.kb-toggle-sort: Alt+grave

! "Quit rofi" Set from: File
rofi.kb-cancel: Escape

! "Custom keybinding 1" Set from: Default
! rofi.kb-custom-1: Alt+1

! "Custom keybinding 2" Set from: Default
! rofi.kb-custom-2: Alt+2

! "Custom keybinding 3" Set from: Default
! rofi.kb-custom-3: Alt+3

! "Custom keybinding 4" Set from: Default
! rofi.kb-custom-4: Alt+4

! "Custom Keybinding 5" Set from: Default
! rofi.kb-custom-5: Alt+5

! "Custom keybinding 6" Set from: Default
! rofi.kb-custom-6: Alt+6

! "Custom Keybinding 7" Set from: Default
! rofi.kb-custom-7: Alt+7

! "Custom keybinding 8" Set from: Default
! rofi.kb-custom-8: Alt+8

! "Custom keybinding 9" Set from: Default
! rofi.kb-custom-9: Alt+9

! "Custom keybinding 10" Set from: Default
! rofi.kb-custom-10: Alt+0

! "Custom keybinding 11" Set from: Default
! rofi.kb-custom-11: Alt+exclam

! "Custom keybinding 12" Set from: Default
! rofi.kb-custom-12: Alt+at

! "Csutom keybinding 13" Set from: Default
! rofi.kb-custom-13: Alt+numbersign

! "Custom keybinding 14" Set from: Default
! rofi.kb-custom-14: Alt+dollar

! "Custom keybinding 15" Set from: Default
! rofi.kb-custom-15: Alt+percent

! "Custom keybinding 16" Set from: Default
! rofi.kb-custom-16: Alt+dead_circumflex

! "Custom keybinding 17" Set from: Default
! rofi.kb-custom-17: Alt+ampersand

! "Custom keybinding 18" Set from: Default
! rofi.kb-custom-18: Alt+asterisk

! "Custom Keybinding 19" Set from: Default
! rofi.kb-custom-19: Alt+parenleft

! "Select row 1" Set from: Default
! rofi.kb-select-1: Super+1

! "Select row 2" Set from: Default
! rofi.kb-select-2: Super+2

! "Select row 3" Set from: Default
! rofi.kb-select-3: Super+3

! "Select row 4" Set from: Default
! rofi.kb-select-4: Super+4

! "Select row 5" Set from: Default
! rofi.kb-select-5: Super+5

! "Select row 6" Set from: Default
! rofi.kb-select-6: Super+6

! "Select row 7" Set from: Default
! rofi.kb-select-7: Super+7

! "Select row 8" Set from: Default
! rofi.kb-select-8: Super+8

! "Select row 9" Set from: Default
! rofi.kb-select-9: Super+9

! "Select row 10" Set from: Default
! rofi.kb-select-10: Super+0

! "Go to the previous column" Set from: Default
! rofi.ml-row-left: ScrollLeft

! "Go to the next column" Set from: Default
! rofi.ml-row-right: ScrollRight

! "Select previous entry" Set from: Default
! rofi.ml-row-up: ScrollUp

! "Select next entry" Set from: Default
! rofi.ml-row-down: ScrollDown

! "Select hovered row" Set from: Default
! rofi.me-select-entry: MousePrimary

! "Accept hovered row" Set from: Default
! rofi.me-accept-entry: MouseDPrimary

! "Accept hovered row with custom action" Set from: Default
! rofi.me-accept-custom: Control+MouseDPrimary
rofi.theme: ~/.local/share/rofi/themes/sidetab-adapta.rasi

BIN
rofiemoji-rofiunicode1.png View File


BIN
rofiemoji-rofiunicode2.png View File


+ 3
- 1
rofiemoji.sh View File

@@ -1,8 +1,10 @@
#!/bin/sh

DIR="$HOME/.config/rofiemoji"
# URL="https://github.com/Kabouik/rofiemoji/raw/master/unicode.txt"
# FILE="$DIR/unicode.txt"
VER='11.0'
URL="https://www.unicode.org/Public/emoji/${VER}/emoji-test.txt"
DIR="$HOME/.cache"
FILE="$DIR/emojis.txt"

if [ ! -r $FILE ]

+ 23
- 0
rofiunicode.sh View File

@@ -0,0 +1,23 @@
#!/bin/sh

DIR="$HOME/.config/rofiemoji"
URL="https://github.com/Kabouik/rofiemoji/raw/master/unicode.txt"
FILE="$DIR/unicode.txt"
# VER='11.0'
# URL="https://www.unicode.org/Public/emoji/${VER}/emoji-test.txt"
# FILE="$DIR/emojis.txt"

if [ ! -r $FILE ]
then
if [ ! -d $DIR ]; then mkdir $DIR; fi
curl $URL | grep -v '^#' | grep ' ; fully-qualified ' | cut -d'#' -f2 > $FILE
fi

if [ "$@" ]
then
smiley=$(echo $@ | cut -d' ' -f1)
echo -n "$smiley" | xsel -bi
exit 0
fi

cat $FILE

+ 116
- 0
sidetab-adapta.rasi View File

@@ -0,0 +1,116 @@
/*
* sidetab-adapta theme,
* based on sidetab theme by deadguy.
*
* This theme has been dedicated to the public domain.
*
*/

configuration {
show-icons: true;
sidebar-mode: true;
}

* {
background-color: #222d32;
text-color: #ffffff;

accent-color: #00bcd4;
accent2-color: #4db6ac;
hover-color: #39454b;
urgent-color: #ff5252;
window-color: #ffffff;

selected-normal-foreground: @window-color;
normal-foreground: @text-color;
selected-normal-background: @hover-color;
normal-background: @background-color;

selected-urgent-foreground: @background-color;
urgent-foreground: @text-color;
selected-urgent-background: @urgent-color;
urgent-background: @background-color;

selected-active-foreground: @window-color;
active-foreground: @text-color;
selected-active-background: @hover-color;
active-background: @accent-color;
}

#window {
anchor: west;
location: west;
width: 384px;
height: 100%;
}

#mainbox {
children: [ entry, listview, mode-switcher ];
}

entry {
expand: false;
margin: 8px;
}

element {
padding: 8px;
}

element normal.normal {
background-color: @normal-background;
text-color: @normal-foreground;
}

element normal.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}

element normal.active {
background-color: @active-background;
text-color: @active-foreground;
}

element selected.normal {
background-color: @selected-normal-background;
text-color: @selected-normal-foreground;
border: 0 4px solid 0 0;
border-color: @accent2-color;
}

element selected.urgent {
background-color: @selected-urgent-background;
text-color: @selected-urgent-foreground;
}

element selected.active {
background-color: @selected-active-background;
text-color: @selected-active-foreground;
}

element alternate.normal {
background-color: @normal-background;
text-color: @normal-foreground;
}

element alternate.urgent {
background-color: @urgent-background;
text-color: @urgent-foreground;
}

element alternate.active {
background-color: @active-background;
text-color: @active-foreground;
}

button {
padding: 8px;
}

button selected {
background-color: @active-background;
text-color: @background-color;
}

/* vim: ft=css

+ 119799
- 0
unicode.txt
File diff suppressed because it is too large
View File


Loading…
Cancel
Save