From 07224674954a8740322206a8d30981dd017ae3e3 Mon Sep 17 00:00:00 2001 From: tdro Date: Thu, 17 Mar 2022 23:10:42 -0400 Subject: .config/nixpkgs/packages/dmenu: Use my source and patches --- .config/X11/Xresources | 14 +++++++----- .config/nixpkgs/packages/dmenu/default.nix | 35 ++++++++++-------------------- .config/ranger/rc.conf | 2 +- .config/rofi/config.rasi | 4 ---- .config/spacefm/session | 2 +- .local/bin/dmenu_run_history | 13 ++++++++--- .local/bin/internet-search | 2 +- .local/bin/manpdf | 9 ++++++-- .local/bin/pass-menu | 2 +- .local/bin/plumber | 18 +++++++-------- .local/bin/plumber-dmenu | 20 ++++++++--------- .local/bin/window-switcher | 26 +++++++++++++++++++--- 12 files changed, 84 insertions(+), 63 deletions(-) diff --git a/.config/X11/Xresources b/.config/X11/Xresources index 11b6455..40ca082 100644 --- a/.config/X11/Xresources +++ b/.config/X11/Xresources @@ -84,11 +84,15 @@ Xft.lcdfilter: lcddefault ! DMENU Settings ! ----------------- -dmenu.font: xft:Sans:size=9:style=bold -dmenu.background: #000000 -dmenu.foreground: #ffffff -dmenu.selforeground: #000000 -dmenu.selbackground: #42aaf0 +dmenu.font: xft:Sans:size=10:style=bold +dmenu.foreground: #80c6ff +dmenu.selforeground: #75c277 +dmenu.selhiforeground: #ffffff +dmenu.normhiforeground: #75c277 +dmenu.background: #111111 +dmenu.selbackground: #111111 +dmenu.selhibackground: #111111 +dmenu.normhibackground: #111111 ! ----------------- ! X Settings diff --git a/.config/nixpkgs/packages/dmenu/default.nix b/.config/nixpkgs/packages/dmenu/default.nix index 53dbf28..496929f 100644 --- a/.config/nixpkgs/packages/dmenu/default.nix +++ b/.config/nixpkgs/packages/dmenu/default.nix @@ -1,28 +1,17 @@ -{ lib, stdenv, fetchurl, fetchpatch, libX11, libXinerama, libXft, zlib }: +{ lib, stdenv, fetchgit, libX11, libXinerama, libXft, zlib }: stdenv.mkDerivation rec { - name = "dmenu-5.0"; + name = "dmenu"; + version = "9b0be7712e2aae65b459f758a080c56983056021"; - src = fetchurl { - url = "https://dl.suckless.org/tools/${name}.tar.gz"; - sha256 = "1lvfxzg3chsgcqbc2vr0zic7vimijgmbvnspayx73kyvqi1f267y"; + src = fetchgit { + rev = version; + url = "https://www.thedroneely.com/git/thedroneely/dmenu/"; + sha256 = "0sbwwxbm5bcn0m4s1y2gl90wc224kf6755d1xdr23bz5ihy3jzg2"; }; buildInputs = [ libX11 libXinerama zlib libXft ]; - patches = [ - (fetchpatch { - name = "dmenu-xresources-4.9.patch"; - url = "https://tools.suckless.org/dmenu/patches/xresources/dmenu-xresources-4.9.diff"; - sha256 = "0clczp17zwkxy1qhy0inqjplxpq4mgaf4vvfvn063hk733r4i7rn"; - }) - (fetchpatch { - name = "dmenu-fuzzymatch-4.9.patch"; - url = "https://tools.suckless.org/dmenu/patches/fuzzymatch/dmenu-fuzzymatch-4.9.diff"; - sha256 = "000fkg4dcr2vrpd442f2v6ycmmxdml781ziblzx5rxvvyclsryfd"; - }) - ]; - postPatch = '' sed -ri -e 's!\<(dmenu|dmenu_path|stest)\>!'"$out/bin"'/&!g' dmenu_run sed -ri -e 's!\!'"$out/bin"'/&!g' dmenu_path @@ -34,11 +23,11 @@ stdenv.mkDerivation rec { makeFlags = [ "CC:=$(CC)" ]; - meta = with lib; { - description = "A generic, highly customizable, and efficient menu for the X Window System"; + meta = { + license = lib.licenses.mit; + platforms = lib.platforms.all; homepage = "https://tools.suckless.org/dmenu"; - license = licenses.mit; - maintainers = with maintainers; [ pSub globin ]; - platforms = platforms.all; + maintainers = with lib.maintainers; [ pSub globin ]; + description = "A generic, highly customizable, and efficient menu for the X Window System"; }; } diff --git a/.config/ranger/rc.conf b/.config/ranger/rc.conf index 763df21..0270531 100644 --- a/.config/ranger/rc.conf +++ b/.config/ranger/rc.conf @@ -13,7 +13,7 @@ map cw eval fm.execute_console("bulkrename") if fm.thisdir.marked_items else fm. map / console scout -ftsea%space # Open with dmenu -map ru shell compgen -c | dmenu -f -i -b -p 'Open With' | xargs -I{} -r bash -c "{} %s &> /dev/null" & +map ru shell compgen -c | dmenu -f -i -b -p ⠀:::⠀open⠀::: | xargs -I{} -r /bin/sh -c "{} %s > /dev/null 2>&1" & # Sort by last modified set sort=ctime diff --git a/.config/rofi/config.rasi b/.config/rofi/config.rasi index b4b8fea..af15d51 100644 --- a/.config/rofi/config.rasi +++ b/.config/rofi/config.rasi @@ -1,10 +1,6 @@ configuration { - bw: 0; kb-remove-to-eol: ""; - hide-scrollbar: true; disable-history: false; - fake-transparency: false; - separator-style: "none"; kb-row-up: "Up,Control+k"; kb-row-down: "Down,Control+j"; kb-accept-entry: "Control+m,Return,KP_Enter"; diff --git a/.config/spacefm/session b/.config/spacefm/session index 07cec65..f99e196 100644 --- a/.config/spacefm/session +++ b/.config/spacefm/session @@ -569,7 +569,7 @@ cstm_298bc815-key=111 cstm_298bc815-keymod=4 cstm_298bc815-label=Open with... cstm_298bc815-prev=con_open -cstm_298bc815-line=bash -c 'compgen -c' | dmenu -f -i -b -p 'Open With' | xargs -I{} -r bash -c "{} '${fm_files[@]}'" +cstm_298bc815-line=bash -c 'compgen -c' | dmenu -f -i -b -p '⠀:::⠀open⠀:::' | xargs -I{} -r bash -c "{} '${fm_files[@]}'" cstm_298bc815-task_err=1 cstm_298bc815-task_out=1 cstm_36fddd7b-y= diff --git a/.local/bin/dmenu_run_history b/.local/bin/dmenu_run_history index 72127fe..ba9b2af 100755 --- a/.local/bin/dmenu_run_history +++ b/.local/bin/dmenu_run_history @@ -2,8 +2,15 @@ # https://tools.suckless.org/dmenu/scripts/ -[ "$1" = "privilege" ] && export cmd_prefix='rofi-askpass ' && export dmenu_args='-p Privilege -sb red' && shift 1; -[ "$1" = "terminal" ] && export cmd_prefix='urxvt -hold -e ' && export dmenu_args='-p Terminal -sb gray' && shift 1; +[ "$1" = "privilege" ] && + export cmd_prefix='rofi-askpass ' && + export dmenu_args='-nhf #ff7070 -sf #ff7070 -p ⠀:::⠀privilege⠀:::' && + shift 1 + +[ "$1" = "terminal" ] && + export cmd_prefix='urxvt -hold -e ' && + export dmenu_args='-nhf #9e9e9e -sf #9e9e9e -p ⠀:::⠀terminal⠀:::' && + shift 1 cachedir=${XDG_CACHE_HOME:-"$HOME/.cache"} cache=$cachedir/dmenu_run @@ -26,7 +33,7 @@ awk -v histfile="$historyfile" ' x[$0]=1 } } !x[$0]++ ' "$cache" \ - | dmenu -i -b ${dmenu_args:--p Launch} "$@" \ + | dmenu -i -b ${dmenu_args:--p ⠀:::⠀execute⠀:::} "$@" \ | awk -v histfile="$historyfile" ' BEGIN { FS=OFS="\t" diff --git a/.local/bin/internet-search b/.local/bin/internet-search index 096c4ee..0a3d0cd 100755 --- a/.local/bin/internet-search +++ b/.local/bin/internet-search @@ -1,2 +1,2 @@ #!/bin/sh -eu -rofi -dmenu -show run -font "ubuntu 16" -padding 10 -lines 0 -p " " | xargs -r surfraw duckduckgo +rofi -dmenu -i -font "ubuntu 16" -theme-str 'listview { lines: 0; }' -p " " | xargs -r surfraw duckduckgo diff --git a/.local/bin/manpdf b/.local/bin/manpdf index 349f9b4..6fefd44 100755 --- a/.local/bin/manpdf +++ b/.local/bin/manpdf @@ -1,2 +1,7 @@ -#!/bin/sh -man -k . | dmenu -b | awk '{ print $1 }' | xargs -r man -Tpdf | zathura - +#!/bin/sh -eu + +man -k . | + rofi -font "ubuntu 12" -matching regex -padding 20 -dmenu -i -p 'Manuals' | + awk '{ print $1 }' | + xargs -r man -Tpdf | + zathura - diff --git a/.local/bin/pass-menu b/.local/bin/pass-menu index 3d49d2f..7f0a306 100755 --- a/.local/bin/pass-menu +++ b/.local/bin/pass-menu @@ -8,7 +8,7 @@ shopt -s nullglob globstar printf "\n" | $copy copy='xsel --input --primary' -menu='dmenu -f -i -b -p Password' +menu='dmenu -f -i -b -nhf #ffeb3b -sf #ffeb3b -p ⠀:::⠀passwords⠀:::' _paste () { xdotool type "$(xsel --output --primary)"; } prefix=${PASSWORD_STORE_DIR-~/.password-store} diff --git a/.local/bin/plumber b/.local/bin/plumber index b129563..3d4ebdc 100755 --- a/.local/bin/plumber +++ b/.local/bin/plumber @@ -13,15 +13,15 @@ defmodule ArgParser do |> OptionParser.parse!(strict: [option: :string, text: :string]) options = [ - first_letter: "First Letter Word", - single_line: "Single Line", - slug_text: "Slug", - title_case: "Title Case", - lower_case: "Lower Case", - lorem_title: "Lorem Title", - lorem_paragraph: "Lorem Paragraph", - thesaurus: "Thesaurus", - kjv_lookup: "KJV Verse Lookup" + first_letter: "first letter word", + single_line: "single line", + slug_text: "slug", + title_case: "title case", + lower_case: "lower case", + lorem_title: "lorem title", + lorem_paragraph: "lorem paragraph", + thesaurus: "thesaurus", + kjv_lookup: "kjv verse lookup" ] cond do diff --git a/.local/bin/plumber-dmenu b/.local/bin/plumber-dmenu index 31e200d..9779223 100755 --- a/.local/bin/plumber-dmenu +++ b/.local/bin/plumber-dmenu @@ -1,17 +1,17 @@ #!/bin/sh -eu options="\ -First Letter Word -Single Line -Slug -Title Case -Lower Case -Lorem Title -Lorem Paragraph -Thesaurus -KJV Verse Lookup +first letter word +single line +slug +title case +lower case +lorem title +lorem paragraph +thesaurus +kjv verse lookup " printf "%s" "$options" \ - | dmenu -i -b -p Plumb \ + | dmenu -i -b -p ⠀:::⠀plumber⠀::: \ | while read -r option do text=$(plumber --option "$option" --text "$(xsel -o)") diff --git a/.local/bin/window-switcher b/.local/bin/window-switcher index b19de68..9daf156 100755 --- a/.local/bin/window-switcher +++ b/.local/bin/window-switcher @@ -1,3 +1,23 @@ -#!/bin/sh -eu -wmctrl -l | dmenu -f -i -b -p 'Switch' | awk '{ print $1 }' | xargs wmctrl -ia -#rofi -no-disable-history -show window -theme-str '#prompt { enabled: false; }' -window-format {t} -font "ubuntu 12" -padding 15 -lines 1 +#!/bin/sh -u +# https://git.suckless.org/sites/file/tools.suckless.org/dmenu/scripts/switch.html + +windows=$(wmctrl -xl | + tr --squeeze-repeats '[:blank:]' | + tr '[:upper:]' '[:lower:]' | + cut --delimiter ' ' --fields 3-3,5- | + sed 's/^[a-zA-Z0-9-]*\.//' | + sort | + uniq) + +windows=$(printf "%s" "$windows" | + awk --assign list="$windows" \ + '{cur=length($1); printf $1; for(i=0; i < list - cur + 1; i++) printf " "; $1 = ""; printf "%s\n", $0}' 2> /dev/null) + +selection=$( + printf "%s" "$windows" | dmenu -nhf '#e68a00' -sf '#e68a00' -f -i -b -p ⠀:::⠀windows⠀::: + [ "$?" = 127 ] && kill -15 "$$" && "$0" +) + +target=$(printf "%s" "$selection" | tr --squeeze-repeats '[:blank:]' | cut --delimiter ' ' --fields 2-) + +[ -n "$target" ] && wmctrl -a "$target" -- cgit v1.2.3