From 19689bd4b3c06f079f30c8c37ce339acdac507a4 Mon Sep 17 00:00:00 2001 From: Rasmus Steinke Date: Sat, 6 Jun 2015 11:50:31 +0200 Subject: [PATCH] set title detection in config file --- config.example | 23 ++++++++++++++++++----- rofi-pass | 13 +++---------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/config.example b/config.example index 7061692..373abb8 100644 --- a/config.example +++ b/config.example @@ -16,8 +16,21 @@ BROWSER='chromium' help_color="#0C73C2" -## rofi expects a root directory in your basedir -## underneath this directory all your password groups -## are stored inside directories. -## if you don't want to separate roots, enable this setting -#root=. +# get active URL from browser +# Chose the one for your browser or create your own. + +# chromium - needs url in title extension +# https://chrome.google.com/webstore/detail/url-in-title/ignpacbgnbnkaiooknalneoeladjnfgb +# set string to "{protocol}://{hostname}{port}/{path}/{args}" +domain () { + wmctrl -l | grep Chromium | awk '{print $(NF-2)}' +} + +# firefox - needs Add URL to Window Title extension +# https://addons.mozilla.org/en-US/firefox/addon/add-url-to-window-title/ +# set delimiter to "::" + +# domain () { +# wmctrl -l | grep Firefox | grep "::" | awk '{print $(NF-3)}' +# } + diff --git a/rofi-pass b/rofi-pass index 03c003c..47d3090 100755 --- a/rofi-pass +++ b/rofi-pass @@ -215,16 +215,9 @@ insertPass2 () { elif [[ $menu == "2 URL"* ]]; then HELP="Enter Domain Name or chose one of the Options below" - domain=$(echo -e "< Return\n---\nGet URL from active Chromium Tab\nGet URL from active Firefox Tab" | rofi -dmenu -mesg "${HELP}" -p "URL > ") - if [[ $domain == "Get URL from active Chromium Tab" ]]; then - # use url in title chrome extension with format: "{protocol}://{hostname}{port}/{path}/{args}" - # https://chrome.google.com/webstore/detail/url-in-title/ignpacbgnbnkaiooknalneoeladjnfgb?utm_source=chrome-app-launcher-info-dialog - domain=$(wmctrl -l | grep Chromium | awk '{print $(NF-2)}') - insertPass2 - elif [[ $domain == "Get URL from active Firefox Tab" ]]; then - # https://addons.mozilla.org/en-uS/firefox/addon/add-url-to-window-title/ - # set "Show full URL" in preferences and separator to "::" - domain=$(wmctrl -l | grep Firefox | grep "::" | awk '{print $(NF-3)}') + domain=$(echo -e "< Return\n---\nGet URL from active Browser Tab" | rofi -dmenu -mesg "${HELP}" -p "URL > ") + if [[ $domain == "Get URL from active Browser Tab" ]]; then + domain=$(domain) insertPass2 elif [[ $domain == "< Return" ]]; then insertPass2