From dc4d385013468ac3b59a7cde1923529b9c590edd Mon Sep 17 00:00:00 2001 From: Ivan Malison Date: Fri, 20 Aug 2021 19:56:26 -0600 Subject: [PATCH] Add start_chrome_for which starts chrome profile for the provided email --- dotfiles/lib/functions/get_chrome_folder_from_address | 8 ++++++++ dotfiles/lib/functions/start_chrome_for | 9 +++++++++ 2 files changed, 17 insertions(+) create mode 100755 dotfiles/lib/functions/get_chrome_folder_from_address create mode 100755 dotfiles/lib/functions/start_chrome_for diff --git a/dotfiles/lib/functions/get_chrome_folder_from_address b/dotfiles/lib/functions/get_chrome_folder_from_address new file mode 100755 index 00000000..8065296e --- /dev/null +++ b/dotfiles/lib/functions/get_chrome_folder_from_address @@ -0,0 +1,8 @@ +#!/usr/bin/env sh + +function get_chrome_folder_from_address { + cat ~/.config/google-chrome/Local\ State | + jq -r ".profile.info_cache | to_entries | .[] | select(.value.user_name == \"$1\") | .key" +} + +get_chrome_folder_from_address "$@" diff --git a/dotfiles/lib/functions/start_chrome_for b/dotfiles/lib/functions/start_chrome_for new file mode 100755 index 00000000..31a78f62 --- /dev/null +++ b/dotfiles/lib/functions/start_chrome_for @@ -0,0 +1,9 @@ +#!/usr/bin/env sh + +function start_chrome_for { + email=$1 + shift + google-chrome-stable --profile-directory="$(get_chrome_folder_from_address "$email")" "$@" +} + +start_chrome_for "$@"