Revert "BREAKING: remove rofi, revert to my custom dmenu"

This reverts commit 5edd5b3cd1.
This commit is contained in:
Protesilaos Stavrou 2023-12-28 09:25:20 +02:00
parent ed7513535f
commit 8d0ae97228
No known key found for this signature in database
GPG key ID: 99BD6459CD5CA3EA
9 changed files with 334 additions and 109 deletions

View file

@ -87,7 +87,7 @@ _dynamic_menu() {
# use printf to output array items on a new line
rofi -dmenu -i -no-custom -p 'Power options'
elif _checkdep dmenu; then
my_dmenu -p 'Power options'
dmenu -i -p 'Power options'
else
echo "Missing rofi or dmenu dependency." && exit 1
fi

View file

@ -0,0 +1,113 @@
configuration {
modi: "run,drun,window";
font: "Monospace 10";
location: 0; /* Centre of the screen. See the themes for width, borders, etc. */
fixed-num-lines: true;
show-icons: true;
terminal: "uxterm";
/* run-command: "{cmd}";*/
/* run-list-command: "";*/
/* run-shell-command: "{terminal} -e {cmd}";*/
/* window-command: "xkill -id {window}";*/
window-match-fields: "all";
drun-match-fields: "name,exec";
case-sensitive: true;
cycle: true;
sidebar-mode: false;
/* eh: 1;*/
auto-select: false;
combi-modi: "window,drun";
matching: "regex";
/* tokenize: true;*/
/* m: "-5";*/
/* filter: ;*/
/* dpi: -1;*/
threads: 0;
/* scroll-method: 0;*/
window-format: "{w:0} {n:0} {t:0}";
click-to-exit: true;
max-history-size: 25;
combi-hide-mode-prefix: true;
/* pid: "/run/user/1000/rofi.pid";*/
display-window: "Windows";
/* display-windowcd: ;*/
display-run: "Executables";
/* display-ssh: ;*/
display-drun: "Applications";
display-combi: "Combined";
/* display-keys: ;*/
kb-primary-paste: "Control+Y";
kb-secondary-paste: "Control+y";
kb-clear-line: "Control+Shift+BackSpace";
kb-move-front: "Control+a";
kb-move-end: "Control+e";
kb-move-word-back: "Alt+b";
kb-move-word-forward: "Alt+f";
kb-move-char-back: "Left,Control+b";
kb-move-char-forward: "Right,Control+f";
kb-remove-word-back: "Control+BackSpace";
kb-remove-word-forward: "Alt+d";
kb-remove-char-forward: "Delete,Control+d";
kb-remove-char-back: "BackSpace";
kb-remove-to-eol: "Control+k";
kb-remove-to-sol: "Control+K";
kb-accept-entry: "Control+j,Control+m,Return,KP_Enter";
/* kb-accept-custom: "Control+Return";*/
/* kb-accept-alt: "Shift+Return";*/
/* kb-delete-entry: "Shift+Delete";*/
/* kb-mode-next: "Shift+Right,Control+Tab";*/
/* kb-mode-previous: "Shift+Left,Control+ISO_Left_Tab";*/
/* kb-row-left: "Control+Page_Up";*/
/* kb-row-right: "Control+Page_Down";*/
/* kb-row-up: "Up,Control+p,ISO_Left_Tab";*/
/* kb-row-down: "Down,Control+n";*/
/* kb-row-tab: "Tab";*/
kb-page-prev: "Alt+v,Page_Up";
kb-page-next: "Control+v,Page_Down";
kb-row-first: "Alt+less,Home,KP_Home";
kb-row-last: "Alt+greater,End,KP_End";
/* kb-row-select: "Control+space";*/
/* kb-screenshot: "Alt+S";*/
/* kb-toggle-case-sensitivity: "grave,dead_grave";*/
/* kb-toggle-sort: "Alt+grave";*/
/* kb-cancel: "Escape,Control+g,Control+bracketleft";*/
/* kb-custom-1: "Alt+1";*/
/* kb-custom-2: "Alt+2";*/
/* kb-custom-3: "Alt+3";*/
/* kb-custom-4: "Alt+4";*/
/* kb-custom-5: "Alt+5";*/
/* kb-custom-6: "Alt+6";*/
/* kb-custom-7: "Alt+7";*/
/* kb-custom-8: "Alt+8";*/
/* kb-custom-9: "Alt+9";*/
/* kb-custom-10: "Alt+0";*/
/* kb-custom-11: "Alt+exclam";*/
/* kb-custom-12: "Alt+at";*/
/* kb-custom-13: "Alt+numbersign";*/
/* kb-custom-14: "Alt+dollar";*/
/* kb-custom-15: "Alt+percent";*/
/* kb-custom-16: "Alt+dead_circumflex";*/
/* kb-custom-17: "Alt+ampersand";*/
/* kb-custom-18: "Alt+asterisk";*/
/* kb-custom-19: "Alt+parenleft";*/
/* kb-select-1: "Super+1";*/
/* kb-select-2: "Super+2";*/
/* kb-select-3: "Super+3";*/
/* kb-select-4: "Super+4";*/
/* kb-select-5: "Super+5";*/
/* kb-select-6: "Super+6";*/
/* kb-select-7: "Super+7";*/
/* kb-select-8: "Super+8";*/
/* kb-select-9: "Super+9";*/
/* kb-select-10: "Super+0";*/
/* ml-row-left: "ScrollLeft";*/
/* ml-row-right: "ScrollRight";*/
/* ml-row-up: "ScrollUp";*/
/* ml-row-down: "ScrollDown";*/
/* me-select-entry: "MousePrimary";*/
/* me-accept-entry: "MouseDPrimary";*/
/* me-accept-custom: "Control+MouseDPrimary";*/
}
/* Rofi version 1.7.2 */
@theme "~/.config/rofi/themes/modus-themes-active.rasi"

View file

@ -0,0 +1,34 @@
/**
* rofi -dump-theme output.
* Rofi version: 1.6.1
* User: Protesilaos Stavrou
* Copyright: Protesilaos Stavrou --- Released under the GNU GPLv3
* Comment: Simple port of the Modus Operandi theme for Emacs (https://protesilaos.com/modus-themes)
**/
* {
/* Custom colours */
bg-alt: #e0e0e0ff;
bg-main: #ffffffff;
fg-alt: #595959ff;
fg-main: #000000ff;
red: #a60000ff;
green: #006800ff;
yellow: #6f5500ff;
blue: #0031a9ff;
magenta: #721045ff;
cyan: #005e8bff;
red-bright: #b60000ff;
green-bright: #008900ff;
yellow-bright: #808000ff;
blue-bright: #0000ffff;
magenta-bright: #dd22ddff;
cyan-bright: #008899ff;
selection-bg: #c0deffff;
/* Global properties */
background-color: rgba (0,0,0, 0%);
highlight: bold underline #1f1fce;
}
@import "modus-themes-common.rasi"

View file

@ -0,0 +1 @@
@import "modus-operandi.rasi"

View file

@ -0,0 +1,147 @@
/**
* rofi -dump-theme output.
* Rofi version: 1.6.1
* User: Protesilaos Stavrou
* Copyright: Protesilaos Stavrou --- Released under the GNU GPLv3
* Comment: Simple port of the Modus themes for Emacs (https://protesilaos.com/modus-themes)
**/
window {
background-color: @bg-main;
border: 5px;
border-color: @bg-alt;
padding: 10px;
width: 25%;
height: 15%;
/* max-height: 25%; */
}
mainbox {
border: 0;
padding: 0;
}
message {
border: 2px solid 0px 0px;
border-color: @fg-alt;
padding: 1px ;
}
textbox {
text-color: @fg-main;
}
listview {
fixed-height: 0;
border: 2px solid 0px 0px;
border-color: @bg-alt;
spacing: 4px;
scrollbar: true;
padding: 2px 0px 0px;
}
element {
border: 0;
padding: 1px;
}
element.normal.normal {
background-color: @bg-main;
text-color: @fg-main;
}
element.normal.urgent {
background-color: @red;
text-color: @bg-alt;
}
element.normal.active {
background-color: @bg-alt;
text-color: @fg-alt;
}
element.selected.normal {
background-color: @selection-bg;
text-color: @fg-main;
}
element.selected.urgent {
background-color: @red-bright;
text-color: @bg-main;
}
element.selected.active {
background-color: @blue;
text-color: @bg-main;
}
element.alternate.normal {
background-color: @bg-main;
text-color: @fg-main;
}
element.alternate.urgent {
background-color: @red-bright;
text-color: @bg-alt;
}
element alternate.active {
background-color: @cyan-bright;
text-color: @bg-alt;
}
mode-switcher {
border: 2px solid 0px 0px ;
border-color: @bg-alt;
}
scrollbar {
/* width: 4px; */
width: 0;
border: 0;
handle-color: @fg-alt;
/* handle-width: 8px; */
handle-width: 0;
padding: 0;
}
sidebar {
border: 2px solid 0px 0px;
border-color: @fg-alt;
}
button {
spacing: 0;
background-color: @bg-main;
text-color: @fg-alt;
padding: 5px;
horizontal-align: 0.5;
}
button.selected {
background-color: @bg-alt;
text-color: @fg-main;
}
inputbar {
spacing: 10;
padding: 1px;
text-color: @fg-main;
children: [ prompt,entry ];
}
prompt {
spacing: 0;
text-color: @cyan;
}
entry {
spacing: 0;
text-color: @fg-main;
}
element-text {
background-color: inherit;
text-color: inherit;
}

View file

@ -0,0 +1,34 @@
/**
* rofi -dump-theme output.
* Rofi version: 1.6.1
* User: Protesilaos Stavrou
* Copyright: Protesilaos Stavrou --- Released under the GNU GPLv3
* Comment: Simple port of the Modus Operandi theme for Emacs (https://protesilaos.com/modus-themes)
**/
* {
/* Custom colours */
bg-alt: #303030ff;
bg-main: #000000ff;
fg-alt: #989898ff;
fg-main: #ffffffff;
red: #ff5f59ff;
green: #44bc44ff;
yellow: #d0bc00ff;
blue: #2fafffff;
magenta: #feacd0ff;
cyan: #00d3d0ff;
red-bright: #ff5f5fff;
green-bright: #44df44ff;
yellow-bright: #efef00ff;
blue-bright: #338fffff;
magenta-bright: #ff66ffff;
cyan-bright: #00eff0ff;
selection-bg: #2f447fff;
/* Global properties */
background-color: rgba (0,0,0, 0%);
highlight: bold underline #4fafff;
}
@import "modus-themes-common.rasi"

View file

@ -63,9 +63,10 @@ mod4 + Delete
mod4 + {_, shift +,ctrl + shift + } Return
{uxterm,emacsclient -w 2 -a "" -e "(prot-window-shell)",emacsclient -w 2 -a "" -e "(prot-window-coach)"}
# Custom dmenu app launcher script
mod4 + d
my_dmenu_run_history
# Show the desired rofi views for "buffers" (windows) and desktop
# applications.
mod4 + {b,d}
rofi -show {window,drun}
#### Miscellaneous tools and media keys

View file

@ -1,40 +0,0 @@
#!/bin/bash
# my_dmenu --- Call to dmenu with Xresources colors and other options
#
# Copyright (c) 2023 Protesilaos Stavrou <info@protesilaos.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or (at
# your option) any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
### Commentary:
#
# Part of my dotfiles: <https://git.sr.ht/~protesilaos/dotfiles>.
#
### Code:
xresources="$(xrdb -query -all | sed '/*color\|foreground\|background*/!d')"
[ -n "$xresources" ] || { echo "ERROR: no xrdb query output."; exit 1; }
_get_xresource() {
echo "$xresources" | grep -w "$1" | sed 's,.*\(#[a-zA-Z0-9]*\),\1,'
}
x_background="$(_get_xresource 'background')"
x_foreground="$(_get_xresource 'foreground')"
x_selection="$(_get_xresource 'color4')"
dmenu -nb "$x_background" -nf "$x_foreground" \
-sb "$x_selection" -sf "$x_background" \
-b -i "$@"

View file

@ -1,65 +0,0 @@
#!/bin/sh
# Source of the original: <https://tools.suckless.org/dmenu/scripts/dmenu_run_with_command_history/>.
# Further modifications by me, as part of my dotfiles: <https://git.sr.ht/~protesilaos/dotfiles>.
xresources="$(xrdb -query -all | sed '/*color\|foreground\|background*/!d')"
[ -n "$xresources" ] || { echo "ERROR: no xrdb query output."; exit 1; }
_get_xresource() {
echo "$xresources" | grep -w "$1" | sed 's,.*\(#[a-zA-Z0-9]*\),\1,'
}
x_background="$(_get_xresource 'background')"
x_foreground="$(_get_xresource 'foreground')"
x_selection="$(_get_xresource 'color4')"
cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"}
if [ -d "$cachedir" ]; then
cache=$cachedir/dmenu_run
historyfile=$cachedir/dmenu_history
else # if no xdg dir, fall back to dotfiles in ~
cache=$HOME/.dmenu_cache
historyfile=$HOME/.dmenu_history
fi
IFS=:
if stest -dqr -n "$cache" $PATH; then
stest -flx $PATH | sort -u > "$cache"
fi
unset IFS
awk -v histfile=$historyfile '
BEGIN {
while( (getline < histfile) > 0 ) {
sub("^[0-9]+\t","")
print
x[$0]=1
}
} !x[$0]++ ' "$cache" \
| my_dmenu -p 'Launch app' "$@" \
| awk -v histfile=$historyfile '
BEGIN {
FS=OFS="\t"
while ( (getline < histfile) > 0 ) {
count=$1
sub("^[0-9]+\t","")
fname=$0
history[fname]=count
}
close(histfile)
}
{
history[$0]++
print
}
END {
if(!NR) exit
for (f in history)
print history[f],f | "sort -t '\t' -k1rn >" histfile
}
' \
| while read cmd; do ${SHELL:-"/bin/sh"} -c "$cmd" & done