Page 1 of 1

Recent files rofi script

Posted: Sat Feb 01, 2025 3:44 pm
by mg979
Hi, I made a script some time ago to open recent files with rofi. It's in two files, the main script and another script that finds the icons paths (they are cached in ~/.local/share/rofi-recent-icons-cache)
Image

The scripts are in the archive, they go into ~/.fluxbox/scripts

Code: Select all

Usage:		env ROFI_RECENT_MODE=files ROFI_ICONS_THEME=Papirus-Dark \
  			rofi -show recent -modi recent:path/to/rofi-recent-files \
  			-kb-custom-1 "Alt-space" -kb-custom-2 "Alt-Delete" \
  			-kb-custom-3 "Alt-r"
                                                                         
Alt-space is used to toggle between recent files and directories.
Alt-delete is used to remove an entry from the recent files.
Alt-r is used to refresh the icons cache (necessary when changing theme)
It's recommended to use this keybinding in ~/.fluxbox/keys

Code: Select all

Mod1 space :Exec env ROFI_RECENT_MODE=files ROFI_ICONS_THEME=Papirus-Dark rofi -show recent -modi recent:~/.fluxbox/scripts/rofi-recent-files -kb-custom-1 "Alt-space" -kb-custom-2 "Alt-Delete" -kb-custom-3 "Alt-r"
That is, Alt-space shows recent files, hit Alt-space again to show recent directories.

Re: Recent files rofi script

Posted: Sat Feb 01, 2025 3:53 pm
by Jerry3904
That sounds interesting, thanks.

Re: Recent files rofi script

Posted: Sat Feb 01, 2025 4:10 pm
by mg979
Note that I made some changes to the default rofi theme to make it look better

~/.config/rofi/themes/MX-comfort.rasi

Code: Select all

/**
 * ROFI Color theme by Melber & MX-Devs
 */

* {
    // MX-comfort
    // uses flag-for-font-awesome
    // mxrr template-comfort.rasi
    font: "Noto Sans 12";
}

* {
    // Title background
    color01: #1D2324;
    // Title text
    color02: #CACDD0;
    // Searchbar background
    color03: #29353B;
    // Searchbar text
    color04: #ffffff;
    // Inctive tab background
    color05: #29353B;
    // Inctive tab text
    color06: #CACDD0;
    // Active tab background
    color07: #1D2324;
    // Active tab text
    color08: #ffffff;
    // Active tab highlight
    color09: #0f56d9;
    // Selection background
    color10: #0f56d9;
    // Selection text
    color11: #ffffff;
}

window {
anchor: center;
location: center;
y-offset: 0;
x-offset: 0;
width: 30%;
}

mainbox {
    background-color: @color01;
    children: [ inputbar, wrapper-mode-switcher, listview ];
    spacing: 0px;
}

inputbar {
    background-color: @color01;
    text-color: @color02;
    padding: 10px;
    margin: 5px 0px 5px 0px;
    children: [textbox-prompt-colon, entry];
}

textbox-prompt-colon {
    background-color: @color01;
    expand: false;
    font: "FontAwesome 12";
    str:  "  ";
    vertical-align: 0.5;
    text-color: @color02;
}

entry {
    border-radius:  5px 5px 5px 5px;
    background-color: @color03;
    text-color: @color04;
    font: "Noto Sans Bold 12";
    vertical-align: 0.5;
    padding: 5px 15px;
}

wrapper-mode-switcher {
    orientation: horizontal;
    expand: false;
    spacing: 0;
    children: [ mode-switcher ];
}

mode-switcher {
    spacing: 0px;
    expand: true;
}

button {
    background-color: @color05;
    text-color: @color06;
    border: 4px 0px 0px 0px ;
    border-color: @color05;
}

button selected.normal {
    background-color: @color07;
    text-color: @color08;
    border: 4px 0px 0px 0px ;
    border-color: @color09;
}

listview {
    columns: 1;
lines: 12;
    background-color: @color07;
}

element {
    background-color: @color07;
    padding: 6;
    text-color: @color08;
}

element selected {
    background-color: @color10;
    text-color: @color11;
}

element-text {
    background-color: inherit;
    text-color: inherit;
    vertical-align: 0.5;
}

element-icon {
    size: 30;
    background-color: inherit;
    margin: 0px 10px 0px 0px;
}