diff options
-rwxr-xr-x | bm | 41 | ||||
-rwxr-xr-x | bsc | 28 | ||||
-rwxr-xr-x | fdc | 28 | ||||
-rwxr-xr-x | ffc | 56 | ||||
-rwxr-xr-x | lwc | 39 | ||||
-rwxr-xr-x | qbc | 35 |
6 files changed, 212 insertions, 15 deletions
@@ -0,0 +1,41 @@ +#!/bin/sh + +#{{{ printhelp +printhelp () { + printf "bm: browser menu script; interface for browsers.\n" + printf " -b) basilisk interface\n" + printf " -d) firedragon interface\n" + printf " -f) firefox interface\n" + printf " -l) librewolf interface\n" + printf " -q) qutebrowser interface\n" + printf " -x) use X11 menu (dmenu)\n" + printf " -w) use Wayland menu (tofi)\n" + printf " -d ARG) provide menu args\n" + printf " -u ARG) provide URL to open\n" + exit +} +#}}} + +#{{{ getopts +unset ARG +while getopts "hbrflqxwd:u:" o; do case "${o}" in + b) BSC="y" ;; + r) FDC="y" ;; + f) FFC="y" ;; + l) LWC="y" ;; + q) QBC="y" ;; + x) ARG="$ARG-x " ;; + w) ARG="$ARG-w " ;; + d) ARG="$ARG-d $OPTARG ";; + u) ARG="$ARG-u $OPTARG " ;; + *) printhelp ;; +esac done +#}}} + +#{{{ main +[ -n "$BSC" ] && bsc $ARG +[ -n "$FDC" ] && fdc $ARG +[ -n "$FFC" ] && ffc $ARG +[ -n "$LWC" ] && lwc $ARG +[ -n "$QBC" ] && qbc $ARG +#}}} @@ -1,5 +1,29 @@ #!/bin/sh + +#{{{ printhelp +printhelp () { + printf "bsc: basilisk menu interface.\n" + printf " -u URL ) pass URL to browser\n" + printf " -d ARGS ) pass ARGS to menu command\n" + printf " -w ) use Wayland menu command (tofi)\n" + printf " -x ) use X11 menu command (dmenu)\n" + exit +} +#}}} + +#{{{ getopts +while getopts "hwxd:u:" o; do case "${o}" in + d) DMENU_ARGS="$OPTARG" ;; + u) URL="$OPTARG" ;; + w) DMENU="tofi" ;; + x) DMENU="dmenu" ;; + *) printhelp ;; +esac done +#}}} + +#{{{ Choose Profiles PROFILES=`grep 'Path=' ~/.moonchild\ productions/basilisk/profiles.ini | cut -d'.' -f2` -CHOSEN=`echo "$PROFILES" | barmenu -l 15` +CHOSEN=`echo "$PROFILES" | $DMENU $DMENU_ARGS` [ -z "$CHOSEN" ] && exit 2 -basilisk -P "$CHOSEN" +exec basilisk -P "$CHOSEN" $URL +#}}} @@ -1,5 +1,29 @@ #!/bin/sh + +#{{{ printhelp +printhelp () { + printf "fdc: firedragon menu interface.\n" + printf " -u URL ) pass URL to browser\n" + printf " -d ARGS ) pass ARGS to menu command\n" + printf " -w ) use Wayland menu command (tofi)\n" + printf " -x ) use X11 menu command (dmenu)\n" + exit +} +#}}} + +#{{{ getopts +while getopts "hwxd:u:" o; do case "${o}" in + d) DMENU_ARGS="$OPTARG" ;; + u) URL="$OPTARG" ;; + w) DMENU="tofi" ;; + x) DMENU="dmenu" ;; + *) printhelp ;; +esac done +#}}} + +#{{{ Choose Profiles PROFILES=`grep 'Path=' ~/.firedragon/profiles.ini | cut -d'.' -f2` -CHOSEN=`echo "$PROFILES" | barmenu -l 15` +CHOSEN=`echo "$PROFILES" | $DMENU $DMENU_ARGS` [ -z "$CHOSEN" ] && exit 2 -firedragon -P "$CHOSEN" +exec firedragon -P "$CHOSEN" $URL +#}}} @@ -1,5 +1,55 @@ #!/bin/sh -PROFILES=`grep 'Path=' ~/.mozilla/firefox/profiles.ini | cut -d'.' -f2` -CHOSEN=`echo "$PROFILES" | barmenu -l 15` + +#{{{ printhelp +printhelp () { + printf "ffc: firefox menu interface.\n" + printf " -u URL ) pass URL to browser\n" + printf " -d ARGS ) pass ARGS to menu command\n" + printf " -w ) use Wayland menu command (tofi)\n" + printf " -x ) use X11 menu command (dmenu)\n" + exit +} +#}}} + +#{{{ getopts +while getopts "hwxd:u:" o; do case "${o}" in + d) DMENU_ARGS="$OPTARG" ;; + u) URL="$OPTARG" ;; + w) DMENU="tofi" ;; + x) DMENU="dmenu" ;; + *) printhelp ;; +esac done +#}}} + +#{{{ Native Profiles +if [ -f ~/.mozilla/firefox/profiles.ini ]; then + NATIVE_PROFILES=`grep 'Path=' ~/.mozilla/firefox/profiles.ini | cut -d'.' -f2` +else + unset NATIVE_PROFILES +fi +#}}} + +#{{{ Flatpak Profiles +if [ -f ~/.var/app/org.mozilla.firefox/.mozilla/firefox/profiles.ini ]; then + FLATPAK_PROFILES=`grep 'Path=' ~/.var/app/org.mozilla.firefox/.mozilla/firefox/profiles.ini | cut -d'.' -f2 | sed 's/$/ F/g'` +else + unset FLATPAK_PROFILES +fi +#}}} + +#{{{ Add Profiles +if [ -n "$NATIVE_PROFILES" -a -n "$FLATPAK_PROFILES" ]; then + INT="\n" +fi +PROFILES="$NATIVE_PROFILES$INT$FLATPAK_PROFILES" +#}}} + +#{{{ Choose Profiles +CHOSEN=`printf "$PROFILES" | $DMENU $DMENU_ARGS` [ -z "$CHOSEN" ] && exit 2 -firefox -P "$CHOSEN" +if `echo "$CHOSEN" | grep -qE ' F$'`; then + exec flatpak run org.mozilla.Firefox -P `echo "$CHOSEN" | sed 's/ F$//'` $URL +else + exec firefox -P "$CHOSEN" $URL +fi +#}}} @@ -1,22 +1,55 @@ #!/bin/sh + +#{{{ printhelp +printhelp () { + printf "lwc: librewolf menu interface.\n" + printf " -u URL ) pass URL to browser\n" + printf " -d ARGS ) pass ARGS to menu command\n" + printf " -w ) use Wayland menu command (tofi)\n" + printf " -x ) use X11 menu command (dmenu)\n" + exit +} +#}}} + +#{{{ getopts +while getopts "hwxd:u:" o; do case "${o}" in + d) DMENU_ARGS="$OPTARG" ;; + u) URL="$OPTARG" ;; + w) DMENU="tofi" ;; + x) DMENU="dmenu" ;; + *) printhelp ;; +esac done +#}}} + +#{{{ Native Profiles if [ -f ~/.librewolf/profiles.ini ]; then NATIVE_PROFILES=`grep 'Path=' ~/.librewolf/profiles.ini | cut -d'.' -f2` else unset NATIVE_PROFILES fi +#}}} + +#{{{ Flatpak Profiles if [ -f ~/.var/app/io.gitlab.librewolf-community/.librewolf/profiles.ini ]; then FLATPAK_PROFILES=`grep 'Path=' ~/.var/app/io.gitlab.librewolf-community/.librewolf/profiles.ini | cut -d'.' -f2 | sed 's/$/ F/g'` else unset FLATPAK_PROFILES fi +#}}} + +#{{{ Add Profiles if [ -n "$NATIVE_PROFILES" -a -n "$FLATPAK_PROFILES" ]; then INT="\n" fi PROFILES="$NATIVE_PROFILES$INT$FLATPAK_PROFILES" -CHOSEN=`printf "$PROFILES" | dmenu -l 15` +#}}} + +#{{{ Choose Profiles +CHOSEN=`printf "$PROFILES" | $DMENU $DMENU_ARGS` [ -z "$CHOSEN" ] && exit 2 if `echo "$CHOSEN" | grep -qE ' F$'`; then - exec flatpak run io.gitlab.librewolf-community -P `echo "$CHOSEN" | sed 's/ F$//'` "$@" + exec flatpak run io.gitlab.librewolf-community -P `echo "$CHOSEN" | sed 's/ F$//'` $URL else - exec librewolf -P "$CHOSEN" "$@" + exec librewolf -P "$CHOSEN" $URL fi +#}}} @@ -1,18 +1,43 @@ #!/bin/sh +#{{{ printhelp +printhelp () { + printf "qbc: qutebrowser menu interface.\n" + printf " -u URL ) pass URL to browser\n" + printf " -d ARGS ) pass ARGS to menu command\n" + printf " -w ) use Wayland menu command (tofi)\n" + printf " -x ) use X11 menu command (dmenu)\n" + exit +} +#}}} + +#{{{ getopts +while getopts "hwxd:u:" o; do case "${o}" in + d) DMENU_ARGS="$OPTARG" ;; + u) URL="$OPTARG" ;; + w) DMENU="tofi" ;; + x) DMENU="dmenu" ;; + *) printhelp ;; +esac done +#}}} + +#{{{ Get Sessions SESSIONS=`qbpm list` -[ -z "$SESSIONS" ] && qutebrowser $@ -CHOSEN=`printf "default\n$SESSIONS" | barmenu -l 15` +[ -z "$SESSIONS" ] && qutebrowser $@ && exit +#}}} + +#{{{ Select Session +CHOSEN=`printf "default\n$SESSIONS" | $DMENU $DMENU_ARGS` [ -z "$CHOSEN" ] && exit 2 if [ -n "$CHOSEN" ]; then if [ "$CHOSEN" = "default" ]; then - qutebrowser $@ + qutebrowser $URL else if [ -z `echo "$SESSIONS" | grep "$CHOSEN"` ]; then qbpm new "$CHOSEN" fi - qbpm launch "$CHOSEN" $@ + qbpm launch "$CHOSEN" $URL #qutebrowser -B "$HOME/.local/share/$CHOSEN" fi fi - +#}}} |