├── images ├── example1-1.png └── example2-1.png ├── examples ├── sh_kawaiifaces ├── sh_printscreen ├── empty ├── printscreen └── kawaiifaces ├── rofigen └── README.md /images/example1-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/losoliveirasilva/rofigen/HEAD/images/example1-1.png -------------------------------------------------------------------------------- /images/example2-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/losoliveirasilva/rofigen/HEAD/images/example2-1.png -------------------------------------------------------------------------------- /examples/sh_kawaiifaces: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | case "$1" in 3 | 1) face='¯\_(ツ)_/¯' 4 | ;; 5 | 2) face='( ͡° ͜ʖ ͡°)' 6 | ;; 7 | 3) face='ಠ_ಠ' 8 | ;; 9 | 4) face='◕‿◕' 10 | ;; 11 | 5) face='(╯°□°)╯︵ ┻━┻' 12 | ;; 13 | esac 14 | 15 | echo -n $face | xclip 16 | echo -n $face | xclip -selection clipboard 17 | -------------------------------------------------------------------------------- /examples/sh_printscreen: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | case "$1" in 3 | 1) sleep 1 && maim -m 1 ~/Pictures/Screenshots/$(date +"%Y-%m-%d_%H:%M:%S").png 4 | ;; 5 | 2) sleep 1 && maim -m 1 --format=png /dev/stdout | xclip -selection clipboard -t image/png -i 6 | ;; 7 | 3) maim -m 1 --hidecursor -s ~/Pictures/Screenshots/$(date +"%Y-%m-%d_%H:%M:%S").png 8 | ;; 9 | 4) maim -m 1 --hidecursor --format=png -s /dev/stdout | xclip -selection clipboard -t image/png -i 10 | esac 11 | -------------------------------------------------------------------------------- /examples/empty: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | title="title" 4 | widthpercent=number 5 | 6 | typeset -A menu 7 | menu=( 8 | [option 1]="command to execute 1" 9 | [option 2]="command to execute 2" 10 | ) 11 | menu_nrows=${#menu[@]} 12 | 13 | typeset -A colors 14 | colors=( 15 | [-color-window]="#000000, #ffffff, #ffffff" 16 | [-color-normal]="#ffffff, #000000, #eee8d5, #272727, #ffffff" 17 | [-color-active]="#fdf6e3, #268bd2, #eee8d5, #268bd2, #fdf6e3" 18 | [-color-urgent]="#fdf6e3, #dc322f, #eee8d5, #dc322f, #fdf6e3" 19 | ) 20 | -------------------------------------------------------------------------------- /examples/printscreen: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | title="Printscreen:" 4 | widthpercent=15 5 | 6 | typeset -A menu 7 | menu=( 8 | [4 Selection | clipboard]="~/sh_printscreen 4" 9 | [3 Selection | folder]="~/sh_printscreen 3" 10 | [2 Fullscreen | clipboard]="~/sh_printscreen 2" 11 | [1 Fullscreen | folder]="~/sh_printscreen 1" 12 | ) 13 | 14 | typeset -A colors 15 | colors=( 16 | [-color-window]="#000000, #ffffff, #ffffff" 17 | [-color-normal]="#ffffff, #000000, #eee8d5, #272727, #ffffff" 18 | [-color-active]="#fdf6e3, #268bd2, #eee8d5, #268bd2, #fdf6e3" 19 | [-color-urgent]="#fdf6e3, #dc322f, #eee8d5, #dc322f, #fdf6e3" 20 | ) 21 | -------------------------------------------------------------------------------- /examples/kawaiifaces: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | title="Kawaii faces:" 4 | widthpercent=13 5 | 6 | typeset -A menu 7 | menu=( 8 | ["1 ¯\_(ツ)_/¯"]="~/sh_kawaiifaces 1" 9 | [2 ( ͡° ͜ʖ ͡°)]="~/sh_kawaiifaces 2" 10 | [3 ಠ_ಠ]="~/sh_kawaiifaces 3" 11 | [4 ◕‿◕]="~/sh_kawaiifaces 4" 12 | [5 (╯°□°)╯︵ ┻━┻]="~/sh_kawaiifaces 5" 13 | ) 14 | 15 | typeset -A colors 16 | colors=( 17 | [-color-window]="#0000ff, #ffffff, #ffffff" 18 | [-color-normal]="#ffffff, #000000, #eee8d5, #000473, #ffffff" 19 | [-color-active]="#fdf6e3, #268bd2, #eee8d5, #268bd2, #fdf6e3" 20 | [-color-urgent]="#fdf6e3, #dc322f, #eee8d5, #dc322f, #fdf6e3" 21 | ) 22 | -------------------------------------------------------------------------------- /rofigen: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | source "$1" 4 | 5 | # Window title 6 | ROFI_TEXT=$title 7 | 8 | # Optional window size 9 | if [ -z ${widthpercent+x} ]; then 10 | ROFI_OPTIONS=(-location 0 -hide-scrollbar -bw 2) 11 | else 12 | ROFI_OPTIONS=(-width $widthpercent -location 0 -hide-scrollbar -bw 2) 13 | fi 14 | 15 | # Optional window color 16 | if ((${#colors[@]})); then 17 | for i in "${!colors[@]}"; do 18 | ROFI_COLORS+=($i "${colors[$i]}") 19 | done 20 | else 21 | ROFI_COLORS=() 22 | fi 23 | 24 | launcher_options=(-dmenu -i -lines "${#menu[@]}" -p "${ROFI_TEXT}" \ 25 | "${ROFI_COLORS[@]}" "${ROFI_OPTIONS[@]}") 26 | 27 | launcher=(rofi "${launcher_options[@]}") 28 | 29 | selection="$(printf '%s\n' "${!menu[@]}" | sort | "${launcher[@]}")" 30 | 31 | if [[ -n $selection ]] 32 | then 33 | exec ${menu[${selection}]} 34 | fi 35 | 36 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # rofigen - Generates Rofi menu 2 | 3 | `rofigen` is a framework to easily create personal [Rofi](https://github.com/DaveDavenport/rofi) menus. 4 | 5 | ## Getting Started 6 | 7 | `rofigen` requires [Rofi](https://github.com/DaveDavenport/rofi). 8 | 9 | To run `rofigen` you must pass a script, like `./rofigen ~/kawaiifaces`. 10 | 11 | You can bindsym your [i3wm](https://i3wm.org/), e. g., `bindsym $mod+Ctrl+l exec rofigen ~/kawaiifaces`. 12 | 13 | ### Example #0 - Empty file 14 | 15 | ```bash 16 | #!/bin/bash 17 | 18 | title="title" 19 | widthpercent=number 20 | 21 | typeset -A menu 22 | menu=( 23 | [option 1]="command to execute 1" 24 | [option 2]="command to execute 2" 25 | ) 26 | 27 | typeset -A colors 28 | colors=( 29 | [color-flag]="#color" 30 | ) 31 | ``` 32 | 33 | 34 | ### Example #1 - Kawaii Faces 35 | 36 | ```bash 37 | #!/bin/bash 38 | 39 | title="Kawaii faces:" 40 | widthpercent=13 41 | 42 | typeset -A menu 43 | menu=( 44 | ["1 ¯\_(ツ)_/¯"]="~/sh_kawaiifaces 1" 45 | [2 ( ͡° ͜ʖ ͡°)]="~/sh_kawaiifaces 2" 46 | [3 ಠ_ಠ]="~/sh_kawaiifaces 3" 47 | [4 ◕‿◕]="~/sh_kawaiifaces 4" 48 | [5 (╯°□°)╯︵ ┻━┻]="~/sh_kawaiifaces 5" 49 | ) 50 | 51 | typeset -A colors 52 | colors=( 53 | [-color-window]="#000000, #ffffff, #ffffff" 54 | [-color-normal]="#ffffff, #000000, #eee8d5, #272727, #ffffff" 55 | [-color-active]="#fdf6e3, #268bd2, #eee8d5, #268bd2, #fdf6e3" 56 | [-color-urgent]="#fdf6e3, #dc322f, #eee8d5, #dc322f, #fdf6e3" 57 | ) 58 | ``` 59 | 60 | #### Output 61 | 62 | ![Menu-kawaii](images/example1-1.png) 63 | 64 | ### Example #2 - Printscreen 65 | 66 | ```bash 67 | #!/bin/bash 68 | 69 | title="Printscreen:" 70 | widthpercent=15 71 | 72 | typeset -A menu 73 | menu=( 74 | [4 Selection | clipboard]="~/sh_printscreen 4" 75 | [3 Selection | folder]="~/sh_printscreen 3" 76 | [2 Fullscreen | clipboard]="~/sh_printscreen 2" 77 | [1 Fullscreen | folder]="~/sh_printscreen 1" 78 | ) 79 | 80 | typeset -A colors 81 | colors=( 82 | [-color-window]="#000000, #ffffff, #ffffff" 83 | [-color-normal]="#ffffff, #000000, #eee8d5, #272727, #ffffff" 84 | [-color-active]="#fdf6e3, #268bd2, #eee8d5, #268bd2, #fdf6e3" 85 | [-color-urgent]="#fdf6e3, #dc322f, #eee8d5, #dc322f, #fdf6e3" 86 | ) 87 | ``` 88 | 89 | #### Output 90 | 91 | ![Menu-print](images/example2-1.png) 92 | 93 | ## Configuring 94 | 95 | To create a new menu, your script must contain these: 96 | 97 | - `title` title displayed 98 | - `widthpercent` set width of menu, is specified in percentage (optional) 99 | - `menu` menu items: [text]="command_to_execute" 100 | - `colors` Rofi colors. You can use the [theme generator](https://davedavenport.github.io/rofi/p11-Generator.html) (optional) 101 | --------------------------------------------------------------------------------