From 54326f88be7c230cf61e79d781ee74bfefe4e3c1 Mon Sep 17 00:00:00 2001 From: Daniel Napora Date: Sat, 8 Feb 2020 09:36:18 +0100 Subject: [PATCH] jgbrowser 30 times faster directory listing in places panel --- bin/jgbrowser | 34 ++++++++++++++++++++++++++++++++++ bin/mb-jgtools | 44 ++++++++++++++++++++++++++------------------ bin/places | 39 --------------------------------------- 3 files changed, 60 insertions(+), 57 deletions(-) create mode 100755 bin/jgbrowser delete mode 100755 bin/places diff --git a/bin/jgbrowser b/bin/jgbrowser new file mode 100755 index 0000000..72bff36 --- /dev/null +++ b/bin/jgbrowser @@ -0,0 +1,34 @@ +#!/usr/bin/env bash + +# Read a directory to an array and sort it directories first. + +: ${JGMENU_RESOURCE_OPENER=xdg-open} + + DIRECTORY=${1:-$HOME} + + # If '$PWD' is '/', unset it to avoid '//'. + [[ $DIRECTORY == / ]] && DIRECTORY= + + for item in "$DIRECTORY"/*; do + if [[ -d $item ]]; then + dirs+=("${item##*/},^pipe(jgbrowser \"$DIRECTORY/${item##*/}\")") + #((item_index++)) + + # Find the position of the child directory in the + # parent directory list. + #[[ $item == "$OLDPWD" ]] && + # ((previous_index=item_index)) + else + files+=("${item##*/},xdg-open \"$DIRECTORY/${item##*/}\"") + fi + done + +printf "%b\n" "^sep(${DIRECTORY})" +printf "%b\n" "  Otwórz w menadżerze plików,${JGMENU_RESOURCE_OPENER} \"${DIRECTORY:-/}\"" +printf "%b\n" "  Otwórz w termianlu,terminator --working-directory=\"${DIRECTORY:-/}\"" +printf "%b\n" "^sep()" +printf "%b\n" "^sep(Katalogi)" +printf '%s\n' "${dirs[@]}" +printf "%b\n" "^sep(Pliki)" +printf '%s\n' "${files[@]}" + #list=("${dirs[@]}" "${files[@]}") diff --git a/bin/mb-jgtools b/bin/mb-jgtools index a9644c6..7738bc7 100755 --- a/bin/mb-jgtools +++ b/bin/mb-jgtools @@ -3,7 +3,7 @@ # Get colors from config file #. $HOME/.config/mb-jgtools/mb-jgtools.colorrc -JGWIDTH="322" +JGWIDTH="300" [ $(pidof picom) ] && RADIUS="12" @@ -90,6 +90,14 @@ CONFIG_FILE=$(mktemp) MENU_ITEMS=$(mktemp) trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT +## WAŻNE +#monitor = integer (default 0) +#Specify a particular monitor as an index starting from 1. +#If 0, the menu will be launched on the monitor where the mouse is. + + + + #Liczba onitorów #xrandr --listmonitors | grep Monitors |awk '{print $2}' if [ $(xrandr --listmonitors | grep Monitors |awk '{print $2}') -gt "1" ] @@ -120,13 +128,13 @@ MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2) mkconfigfile cat < ${MENU_ITEMS} -@icon,,270,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/distributor-logo-mabox.png -@text,,10,10,200,20,4,left,top,#EEEEEE,#111111,$OSNAME $OSVERSION $OSCODE -@text,,10,30,200,20,4,left,top,#666666,#444444,Jądro: $KERNEL $HOSTTYPE -@text,,10,50,200,20,4,left,top,#666666,#444444,$USER@$HOSTNAME +@icon,,245,10,48,48,4,left,top,,,/usr/share/icons/hicolor/48x48/apps/distributor-logo-mabox.png +@text,,20,10,200,20,4,left,top,#EEEEEE,#111111,$OSNAME $OSVERSION $OSCODE +@text,,20,30,200,20,4,left,top,#666666,#444444,Jądro: $KERNEL $HOSTTYPE +@text,,20,50,200,20,4,left,top,#666666,#444444,$USER@$HOSTNAME #@rect,,40,70,262,20,0,left,top,#666666,#262626, -@text,,14,70,20,20,0,left,top,auto,#222222, -@search,,30,70,292,20,4,left,top,auto,#262626,""" pisz, aby wyszukać""" +@text,,74,70,20,20,0,left,top,auto,#222222, +@search,,90,70,292,20,4,left,top,auto,#262626,""" pisz, aby wyszukać""" . $HOME/.config/mabox/right-prepend.csv @@ -243,7 +251,7 @@ MENU_ITEMS=$(mktemp) trap "rm -f ${CONFIG_FILE} ${MENU_ITEMS}" EXIT MENU_HEIGHT_MIN=$(xdpyinfo | awk '/^ +dimensions/ {print $2}' | cut -d 'x' -f2) - +JGWIDTH=280 mkconfigfile cat < ${MENU_ITEMS} @@ -255,17 +263,17 @@ cat < ${MENU_ITEMS} . $HOME/.config/mabox/places-prepend.csv ^sep(Szybka nawigacja) - Katalog główny,^pipe(places "/") - Katalog domowy,^pipe(places) + Katalog główny,^pipe(jgbrowser /) + Katalog domowy,^pipe(jgbrowser) -  $(basename $(xdg-user-dir DESKTOP)),^pipe(places $(xdg-user-dir DESKTOP)) -  $(basename $(xdg-user-dir DOWNLOAD)),^pipe(places $(xdg-user-dir DOWNLOAD)) -#  $(basename $(xdg-user-dir TEMPLATES)),^pipe(places $(xdg-user-dir TEMPLATES)) -#  $(basename $(xdg-user-dir PUBLICSHARE)),^pipe(places $(xdg-user-dir PUBLICSHARE)) -  $(basename $(xdg-user-dir DOCUMENTS)),^pipe(places $(xdg-user-dir DOCUMENTS)) -  $(basename $(xdg-user-dir MUSIC)),^pipe(places $(xdg-user-dir MUSIC)) -  $(basename $(xdg-user-dir PICTURES)),^pipe(places $(xdg-user-dir PICTURES)) -  $(basename $(xdg-user-dir VIDEOS)),^pipe(places $(xdg-user-dir VIDEOS)) +  $(basename $(xdg-user-dir DESKTOP)),^pipe(jgbrowser $(xdg-user-dir DESKTOP)) +  $(basename $(xdg-user-dir DOWNLOAD)),^pipe(jgbrowser $(xdg-user-dir DOWNLOAD)) +#  $(basename $(xdg-user-dir TEMPLATES)),^pipe(jgbrowser $(xdg-user-dir TEMPLATES)) +#  $(basename $(xdg-user-dir PUBLICSHARE)),^pipe(jgbrowser $(xdg-user-dir PUBLICSHARE)) +  $(basename $(xdg-user-dir DOCUMENTS)),^pipe(jgbrowser $(xdg-user-dir DOCUMENTS)) +  $(basename $(xdg-user-dir MUSIC)),^pipe(jgbrowser $(xdg-user-dir MUSIC)) +  $(basename $(xdg-user-dir PICTURES)),^pipe(jgbrowser $(xdg-user-dir PICTURES)) +  $(basename $(xdg-user-dir VIDEOS)),^pipe(jgbrowser $(xdg-user-dir VIDEOS)) #^sep(Zakładki) ^sep() Wyszukiwarka plików, fsearch diff --git a/bin/places b/bin/places deleted file mode 100755 index ba1e4bf..0000000 --- a/bin/places +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/sh -# -# Inspired by the {a,b}l-places-pipemenu scripts found in -# ArchLabs and BunsenLabs -# - -: ${JGMENU_RESOURCE_OPENER=xdg-open} - -path=${1:-$HOME} -[ $path != "/" ] && path=${path%/} - -test -d "$path" || { echo "$0: '$path' is not a directory" >&2 ; exit 1 ; } - -for i in "$path"/* -do - test -e "$i" || continue - shortname=${i##*/} - if test -d "$i" - then - directories_menu="${directories_menu} -${shortname},^pipe(places \"${path}/${shortname}\")" - else - files_menu="$files_menu -${shortname},${JGMENU_RESOURCE_OPENER} \"${path}/${shortname}\"" - fi -done -printf "%b\n" "^sep(${path})" -printf "%b\n" "  Otwórz w menadżerze plików,${JGMENU_RESOURCE_OPENER} \"${path}\"" -printf "%b\n" "  Otwórz w termianlu,terminator --working-directory=\"${path}\"" -printf "%b\n" "^sep()" -#printf "%b\n" "^sep(Katalogi)" -printf "%b\n" "${directories_menu}" -#printf "%b\n" "^sep(Pliki)" -printf "%b\n" "${files_menu}" - -if test -z "${directories_menu}" && test -z "${files_menu}" -then - printf "%b\n" '' -fi