Linux - DesktopThis forum is for the discussion of all Linux Software used in a desktop context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I can click pia icon in notification tray and a dialog will display external ip, location, and other options. Displaying ip is not a problem, but I have no idea how to capture the location so I can display it in Conky. Image below shows dialog. Its the location, in this case, Seattle, Im after. Anyone have ideas?
The included screenshot shows the dialog. What I want to place in conky, in this case is the location, US Seattle, or the whole string if that would be easier. Though I hope for it to be dynamic, and show what ever location that its connected to. My thoughts are that if it's in a menu then the info's in a table, or array somewhere. It;s just a matter of knowing how to get to it. Anyway, hear's the screenshot:
Im Linux newby. The extent of my script/programming skills start and end with TI Basic calculator.
I turned on logging, and I see that the string is there. Conky starts about 10 seconds after boot, so PIA is already connected, and entry would be in log. Here is last few lines of log file:
"notifications":{},"openvpn_status":{"single":"started"},"need_upgrade":{"value":false,"latest_versi on":81},"forwarded_port":{"single":null},"external_ip":{"single":"173.244.44.45"},"region":{"single" :"us_seattle"},"debug_log_result":{}}
[2018-11-13T06:30:26.456Z] <debug> |main| Updating model with regions
[2018-11-13T06:30:26.456Z] <info> |main| Regions are "US California", "US East", "US Chicago", "US Texas", "US Florida", "US Seattle", "US West", "US Silicon Valley", "US New York City", "US Washington DC", "US Atlanta", "US Las Vegas", "US Houston", "US Denver", "UK London", "UK Southampton", "UK Manchester", "CA Toronto", "CA Montreal", "CA Vancouver", "AU Sydney", "AU Melbourne", "DE Berlin", "DE Frankfurt", "New Zealand", "Netherlands", "Sweden", "Norway", "Denmark", "Finland", "Switzerland", "France", "Belgium", "Austria", "Czech Republic", "Luxembourg", "Ireland", "Italy", "Spain", "Romania", "Hungary", "Poland", "Turkey", "UAE", "Hong Kong", "Singapore", "Japan", "Israel", "Mexico", "Brazil", "India", "South Africa"
[2018-11-13T06:30:26.456Z] <debug> |main| Updating model with external ip
[2018-11-13T06:30:26.457Z] <info> |main| External ip is 173.244.44.45
[2018-11-13T06:30:26.458Z] <debug> |tray| External ip changed
[2018-11-13T06:30:26.458Z] <debug> |tray| Regions changed
[2018-11-13T06:30:26.458Z] <debug> |tray| Refreshing menu
[2018-11-13T06:30:26.458Z] <debug> |tray| Translated status is "You are connected (US Seattle)"
@ //////-Thx, but'm already displaying external ip with this command: "External IP:$alignr${execi 3600 curl ifconfig.me | tail }". It seems to work OK, and it's not too different from your command. At-any-rate, it's the location of the ip I want to display.
Its like nmcli doesn't even see pia. Ive tried several commands. I can see devices, connections, and get loads of info, but no mention of pia or its connection location. The command, "nmcli --show-secrets connection show "connection id""is interesting, and even shows my wifi password, but no command I try has any mention of pia. I ran commands with and without vpn connected and none of the info changed.
Although nmcli may be a more glamorous solution I think using log file will suffice for my goals. I already know that at any given time the last line of pia log provide me the location as a string. The log always ends with a line like this:
[2018-11-15T02:38:41.807Z] <debug> |tray| Translated status is "You are connected (Canada Vancouver)"
The only thing being different is the date and location. I was able to print this line in conky by using this:
Im not sure if cat is appropriate function to use, but considering Ive been a Windows monkey for so long Im actaully happy I was able to make that work What I really need is to display only the string part of the line. Part of the string changes from, "You are connected", to, "Connecting...", when I switch to another location, and considering that the charictor count of the location name is different for each location, I can't use something like a substring length, or position. The function needs to search for the quotes, and print whats within them in a dynamic fasion.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.