From f8a8ca8083115849850e8f1da19a600f1f7d1ffa Mon Sep 17 00:00:00 2001 From: Meutel Date: Tue, 21 Nov 2017 18:51:47 +0100 Subject: [PATCH] oda: rofi --- _i3__oda.armorique.lan/config | 9 +- _i3__oda.armorique.lan/favs | 3 + _i3__oda.armorique.lan/i3status.conf | 6 +- _i3__oda.armorique.lan/menu.sh | 5 + _i3__oda.armorique.lan/rofi-file-browser.sh | 98 ++++++++++ _i3__oda.armorique.lan/rofi.theme | 191 ++++++++++++++++++++ 6 files changed, 307 insertions(+), 5 deletions(-) create mode 100644 _i3__oda.armorique.lan/favs create mode 100755 _i3__oda.armorique.lan/menu.sh create mode 100755 _i3__oda.armorique.lan/rofi-file-browser.sh create mode 100644 _i3__oda.armorique.lan/rofi.theme diff --git a/_i3__oda.armorique.lan/config b/_i3__oda.armorique.lan/config index 147a851..e20c238 100644 --- a/_i3__oda.armorique.lan/config +++ b/_i3__oda.armorique.lan/config @@ -28,6 +28,8 @@ 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. font pango:monospace 8 @@ -52,8 +54,11 @@ bindsym $mod+Return exec /usr/local/bin/roxterm # kill focused window bindsym $mod+Shift+q kill -# start dmenu (a program launcher) -bindsym $mod+d exec /usr/local/bin/dmenu_run +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 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 # installed. diff --git a/_i3__oda.armorique.lan/favs b/_i3__oda.armorique.lan/favs new file mode 100644 index 0000000..d5f622a --- /dev/null +++ b/_i3__oda.armorique.lan/favs @@ -0,0 +1,3 @@ +thunar +vlc +firefox diff --git a/_i3__oda.armorique.lan/i3status.conf b/_i3__oda.armorique.lan/i3status.conf index 53b064b..a87f207 100644 --- a/_i3__oda.armorique.lan/i3status.conf +++ b/_i3__oda.armorique.lan/i3status.conf @@ -24,12 +24,12 @@ order += "volume master" order += "tztime local" cpu_temperature acpitz0 { - format = " %degrees ⁰C" + format = " %degrees ⁰C" } wireless _first_ { - format_up = " (%essid) %ip" - format_down = " down" + format_up = " (%essid) %ip" + format_down = " down" } ethernet _first_ { diff --git a/_i3__oda.armorique.lan/menu.sh b/_i3__oda.armorique.lan/menu.sh new file mode 100755 index 0000000..0ef885d --- /dev/null +++ b/_i3__oda.armorique.lan/menu.sh @@ -0,0 +1,5 @@ +#!/bin/sh + +theme="~/.i3/rofi.theme" +cmd=$( cat ~/.i3/favs | rofi -dmenu -i -theme $theme ) +exec $cmd diff --git a/_i3__oda.armorique.lan/rofi-file-browser.sh b/_i3__oda.armorique.lan/rofi-file-browser.sh new file mode 100755 index 0000000..8c1f4ad --- /dev/null +++ b/_i3__oda.armorique.lan/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__oda.armorique.lan/rofi.theme b/_i3__oda.armorique.lan/rofi.theme new file mode 100644 index 0000000..06fb1c5 --- /dev/null +++ b/_i3__oda.armorique.lan/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 16"; +} +#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; +} + +