From 7a3b146e400552e80df73ac6731c9485d9b596b1 Mon Sep 17 00:00:00 2001 From: Meutel Date: Tue, 31 Oct 2017 11:51:11 +0100 Subject: [PATCH] Upgrade rofi 1.4.1 --- _i3__abraracourcix/config | 7 +- _i3__abraracourcix/menu.sh | 19 +-- _i3__abraracourcix/menu_open.sh | 38 ----- _i3__abraracourcix/rofi-file-browser.sh | 98 ++++++++++++ _i3__abraracourcix/rofi.theme | 191 ++++++++++++++++++++++++ 5 files changed, 295 insertions(+), 58 deletions(-) delete mode 100755 _i3__abraracourcix/menu_open.sh create mode 100755 _i3__abraracourcix/rofi-file-browser.sh create mode 100644 _i3__abraracourcix/rofi.theme diff --git a/_i3__abraracourcix/config b/_i3__abraracourcix/config index 8282de8..1745fd4 100644 --- a/_i3__abraracourcix/config +++ b/_i3__abraracourcix/config @@ -29,6 +29,7 @@ set $base0C #97e0ff set $base0D #97bbf7 set $base0E #c0b7f9 set $base0F #fcc09e +set $theme ~/.i3/rofi.theme # Font for window titles. Will also be used by the bar unless a different font # is used in the bar {} block below. @@ -55,10 +56,10 @@ bindsym $mod+Return exec i3-sensible-terminal bindsym $mod+Shift+q kill # start dmenu (a program launcher) -bindsym $mod+u exec rofi -show ssh -lines 5 -eh 2 -width 100 -padding 300 -opacity "80" -bw 0 -bc "$base01" -bg "$base02" -fg "$base07" -hlbg "$base05" -columns 2 "Terminus 8" -hlfg "#9575cd" -ssh-command "{terminal} -e '{ssh-client} {host}'" +bindsym $mod+u exec rofi -theme $theme -show ssh -ssh-command "{terminal} -e '{ssh-client} {host}'" bindsym $mod+i exec ~/.i3/menu.sh -bindsym $mod+o exec ~/.i3/menu_open.sh -bindsym $mod+n exec rofi -show run -lines 5 -eh 2 -width 100 -padding 300 -opacity "80" -bw 0 -bc "$base01" -bg "$base02" -fg "$base07" -hlbg "$base05" -columns 2 "Terminus 8" -hlfg "#9575cd" +bindsym $mod+o exec rofi -modi "browser:~/.i3/rofi-file-browser.sh" -show browser -theme $theme +bindsym $mod+n exec rofi -show run -theme $theme # There also is the (new) i3-dmenu-desktop which only displays applications # shipping a .desktop file. It is a wrapper around dmenu, so you need that diff --git a/_i3__abraracourcix/menu.sh b/_i3__abraracourcix/menu.sh index a5b9bc3..0ef885d 100755 --- a/_i3__abraracourcix/menu.sh +++ b/_i3__abraracourcix/menu.sh @@ -1,20 +1,5 @@ #!/bin/sh -base00="#101218" -base01="#1f222d" -base02="#252936" -base03="#7780a1" -base04="#C0C5CE" -base05="#d1d4e0" -base06="#C9CCDB" -base07="#ffffff" -base08="#ee829f" -base09="#f99170" -base0A="#ffefcc" -base0B="#a5ffe1" -base0C="#97e0ff" -base0D="#97bbf7" -base0E="#c0b7f9" -base0F="#fcc09e" -cmd=$( cat ~/.i3/favs | rofi -dmenu -lines 5 -eh 2 -width 100 -padding 300 -opacity "80" -bw 0 -bc "$base01" -bg "$base02" -fg "$base07" -hlbg "$base05" -columns 2 "Terminus 8" -hlfg "#9575cd" ) +theme="~/.i3/rofi.theme" +cmd=$( cat ~/.i3/favs | rofi -dmenu -i -theme $theme ) exec $cmd diff --git a/_i3__abraracourcix/menu_open.sh b/_i3__abraracourcix/menu_open.sh deleted file mode 100755 index d1a376c..0000000 --- a/_i3__abraracourcix/menu_open.sh +++ /dev/null @@ -1,38 +0,0 @@ -#!/bin/sh - -base00="#101218" -base01="#1f222d" -base02="#252936" -base03="#7780a1" -base04="#C0C5CE" -base05="#d1d4e0" -base06="#C9CCDB" -base07="#ffffff" -base08="#ee829f" -base09="#f99170" -base0A="#ffefcc" -base0B="#a5ffe1" -base0C="#97e0ff" -base0D="#97bbf7" -base0E="#c0b7f9" -base0F="#fcc09e" - -DIR=$HOME -FILE= -while [ -z "$FILE" ] -do - sel=$( ls "$DIR" | rofi -dmenu -i -lines 5 -eh 2 -width 100 -padding 300 -opacity "80" -bw 0 -bc "$base01" -bg "$base02" -fg "$base07" -hlbg "$base05" -columns 2 "Terminus 8" -hlfg "#9575cd" ) - if [ -z "$sel" ] - then - exit 0 - elif [ -f "$DIR/$sel" ] - then - FILE="$sel" - elif [ -d "$DIR/$sel" ] - then - DIR="$DIR/$sel" - else - exit 1 - fi -done -exec xdg-open "$DIR/$FILE" diff --git a/_i3__abraracourcix/rofi-file-browser.sh b/_i3__abraracourcix/rofi-file-browser.sh new file mode 100755 index 0000000..8c1f4ad --- /dev/null +++ b/_i3__abraracourcix/rofi-file-browser.sh @@ -0,0 +1,98 @@ +#!/usr/bin/env bash + +# Various options for the file browser script: +ROFI_FB_GENERIC_FO="xdg-open" # command used for opening the selection +ROFI_FB_PREV_LOC_FILE=~/.local/share/rofi/rofi_fb_prevloc +ROFI_FB_HISTORY_FILE=~/.local/share/rofi/rofi_fb_history +ROFI_FB_HISTORY_MAXCOUNT=5 # maximum number of history entries +# Comment the next variable to always start in the last visited directory, +# otherwise rofi_fb will start in the specified directory: +ROFI_FB_START_DIR=$HOME # starting directory +# Uncomment the following line to disable history: +ROFI_FB_NO_HISTORY=1 + + +# Beginning of the script: +# Create the directory for the files of the script +if [ ! -d $(dirname "${ROFI_FB_PREV_LOC_FILE}") ] +then + mkdir -p "$(dirname "${ROFI_FB_PREV_LOC_FILE}")" +fi +if [ ! -d $(dirname "${ROFI_FB_HISTORY_FILE}") ] +then + mkdir -p "$(dirname "${ROFI_FB_HISTORY_FILE}")" +fi + +# Initialize $ROFI_FB_CUR_DIR +if [ -d "${ROFI_FB_START_DIR}" ] +then + ROFI_FB_CUR_DIR="${ROFI_FB_START_DIR}" +else + ROFI_FB_CUR_DIR="$PWD" +fi + +# Read last location, otherwise we default to $ROFI_FB_START_DIR or $PWD. +if [ -f "${ROFI_FB_PREV_LOC_FILE}" ] +then + ROFI_FB_CUR_DIR=$(cat "${ROFI_FB_PREV_LOC_FILE}") +fi + +# Handle argument. +if [ -n "$@" ] +then + if [[ "$@" == /* ]] + then + ROFI_FB_CUR_DIR="$@" + else + ROFI_FB_CUR_DIR="${ROFI_FB_CUR_DIR}/$@" + fi +fi + +# If argument is no directory. +if [ ! -d "${ROFI_FB_CUR_DIR}" ] +then + if [ -x "${ROFI_FB_CUR_DIR}" ] + then + coproc ( "${ROFI_FB_CUR_DIR}" > /dev/null 2>&1 ) + exec 1>&- + exit; + elif [ -f "${ROFI_FB_CUR_DIR}" ] + then + if [[ "${ROFI_FB_NO_HISTORY}" -ne 1 ]] + then + # Append selected entry to history and remove exceeding entries + sed -i "s|${ROFI_FB_CUR_DIR}|##deleted##|g" "${ROFI_FB_HISTORY_FILE}" + sed -i '/##deleted##/d' "${ROFI_FB_HISTORY_FILE}" + echo "${ROFI_FB_CUR_DIR}" >> "${ROFI_FB_HISTORY_FILE}" + if [ $(cat "${ROFI_FB_HISTORY_FILE}" | wc -l) -gt ${ROFI_FB_HISTORY_MAXCOUNT} ] + then + sed -i 1d "${ROFI_FB_HISTORY_FILE}" + fi + fi + # Open the selected entry with $ROFI_FB_GENERIC_FO + coproc ( "${ROFI_FB_GENERIC_FO}" "${ROFI_FB_CUR_DIR}" > /dev/null 2>&1 ) + if [ -d "${ROFI_FB_START_DIR}" ] + then + echo "${ROFI_FB_START_DIR}" > "${ROFI_FB_PREV_LOC_FILE}" + fi + exit; + fi + exit; +fi + +# Process current dir. +if [ -n "${ROFI_FB_CUR_DIR}" ] +then + ROFI_FB_CUR_DIR=$(readlink -f "${ROFI_FB_CUR_DIR}") + echo "${ROFI_FB_CUR_DIR}" > "${ROFI_FB_PREV_LOC_FILE}" + pushd "${ROFI_FB_CUR_DIR}" >/dev/null +fi + +# Output to rofi +if [[ "${ROFI_FB_NO_HISTORY}" -ne 1 ]] +then + tac "${ROFI_FB_HISTORY_FILE}" | grep "${ROFI_FB_CUR_DIR}" +fi +echo ".." +ls +# vim:sw=4:ts=4:et: diff --git a/_i3__abraracourcix/rofi.theme b/_i3__abraracourcix/rofi.theme new file mode 100644 index 0000000..c6eb550 --- /dev/null +++ b/_i3__abraracourcix/rofi.theme @@ -0,0 +1,191 @@ +/** + * ROFI Color theme + * User: Qball + * Copyright: Dave Davenport + */ + +configuration { + + // The display name of this browser + display-ssh: " "; + // The display name of this browser + display-run: ""; + // The display name of this browser + display-drun: ""; + // The display name of this browser + display-window: ""; + display-combi: ""; + show-icons: true; +} + + +/** + * User: Qball + * Copyright: Dave Davenport + */ +* { + // Custom colors (t prefix = transparent) + base00: #101218; + base01: #1f222d; + base02: #252936; + tbase02 :#252936CC; + base03: #7780a1; + base04: #C0C5CE; + base05: #d1d4e0; + base06: #C9CCDB; + base07: #ffffff; + base08: #ee829f; + base09: #f99170; + base0A: #ffefcc; + base0B: #a5ffe1; + base0C: #97e0ff; + base0D: #97bbf7; + base0E: #c0b7f9; + base0F: #fcc09e; + + transparent: rgba(0,0,0,0.8); + + bgrow: @tbase02; + bordercolor: @base01; + foreground: @base03; + selectedbg: @base05; + selectedfg: @base01; + urgentcolor: @base0F; + inputcolor: @base0E; + tlightblack: @base02; + magenta: @base08; + msgbg: @base05; + msgcolor: @base03; + lightblue: @base03; + backlight: @tbase02; + + background-color: transparent; + + // Bold, Italic, Underline (base0E) + highlight: underline bold #c0b7f9; + + font: "Sauce Code Powerline Medium 12"; +} +#window { + location: center; + anchor: center; + transparency: "screenshot"; + padding: 10px; + border: 0px; + border-radius: 10px; + color: @magenta; + background-color: @transparent; + spacing: 0; + children: [vertb, mainbox]; + orientation: horizontal; + width: 90%; +} + +#mainbox { + spacing: 0; + children: [ inputbar, message, listview ]; +} + +#message { + border-color: @bordercolor; + border: 0px 2px 2px 2px; + padding: 5; + background-color: @msgbg; +} +#message { + font: "Sauce Code Powerline ExtraLight 8"; + color: @msgcolor; +} + +#inputbar { + color: @inputcolor; + padding: 11px; + background-color: @tlightblack; + border: 2px 2px 2px 2px; + border-radius: 15px 15px 0px 0px; + border-color: @bordercolor; + font: "Sauce Code Pro 18"; +} +#entry,prompt,case-indicator { + text-font: inherit; + text-color:inherit; +} +#listview { + padding: 8px; + border-radius: 0px 0px 15px 15px; + border-color: @bordercolor; + border: 0px 2px 2px 2px; + background-color: @bgrow; + dynamic: false; + lines: 10; + columns: 2; +} +#element { + padding: 3px; + vertical-align: 0.5; + border-radius: 4px; + background-color: transparent; + color: @foreground; + font:inherit; +} +#element selected.normal { + background-color: @selectedbg; +} +#element normal active { + foreground: @lightblue; +} +#element normal urgent { + foreground: @urgentcolor; +} +#element alternate normal { +} +#element alternate active { + foreground: @lightblue; +} +#element alternate urgent { + foreground: @urgentcolor; +} +#element selected active { + background-color: @lightblue; + foreground: @selectedfg; +} +#element selected urgent { + background-color: @urgentcolor; + foreground: @selectedfg; +} +#element normal normal { + +} + +#vertb { + expand: false; + children: [ dummy0, sidebar, dummy1 ]; +} +#dummy0, dummy1 { + expand: true; +} + +#sidebar { + expand: false; + orientation: vertical; + spacing: 0px; + border: 0px 0px 0px 0px; +} +#button { + font: "FontAwesome 22"; + padding: 6px; + border: 2px 0px 2px 2px; + border-radius: 4px 0px 0px 4px; + background-color: @tlightblack; + border-color: @bordercolor; + color: @foreground; + horizontal-align: 0.5; +} +#button selected normal { + color: @selectedfg; + border: 2px 0px 2px 2px; + background-color: @backlight; + border-color: @bordercolor; +} + +