I want a script to switch to a particular tab that is already open tab in Google Chrome or launch that tab if it were not already open in Google Chromey

3,197 views
Skip to first unread message

Yekutiel ben Heshel

unread,
Jan 30, 2020, 1:46:00 AM1/30/20
to autokey-users
I use the following to launch Google Chrome if it is unopen or switch to Google Chrome if it is open
 
import subprocess
command = 'wmctrl -l'
output = system.exec_command(command, getOutput=True)
 
if " Google Chrome" in output:
    window.activate(" Google Chrome",switchDesktop=True)
 
else:
    subprocess.Popen(["/usr/bin/google-chrome-stable"])
 
How could I do something similar for particular tabs I want to view in Google Chrome?
 
Here’s a use case...  
 
Let's say that I wanted to see my Google Calendar in a tab in Google Chrome. If Google Calendar were already open in a tab in Google Chrome then I would want AutoKey to bring that tab to "into focus" (to the foreground). 
 
On the other hand, if my Google Calendar were closed (in other words, if my Google Calendar were not already open in a tab in Google Chrome) then I would want AutoKey to first launch a new tab in Google Chrome, then open my Google Calendar in that tab, and then finally bring the tab with my Google Calendar to into focus (to the foreground).

Thanks,

Yekutiel

jack

unread,
Jan 30, 2020, 2:40:26 AM1/30/20
to autoke...@googlegroups.com, Yekutiel ben Heshel

hi yekutiel

there is a similar discussion here:

    https://stackoverflow.com/questions/46416852/get-urls-of-all-open-tabs-using-python

extracting what is in that discussion and adding a quick internet search gives me:


# some info about webdriver:
# https://selenium-python.readthedocs.io/api.html

driver=webdriver.Chrome()
driver.current_url


for handle in driver.window_handles[0]:
    driver.switch_to.window(handle)
    print(driver.current_url)


i have not tested any of that. and i don't use chrome.


that is going to look messy because the code will have to cycle through every tab to find out whether the one you want is already open. it would be easier and look much neater just to open the tab you want and ignore duplicates.



jack
1234567891 is prime
--
You received this message because you are subscribed to the Google Groups "autokey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autokey-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autokey-users/188c9974-55e6-4333-a463-fa3fefcf7c94%40googlegroups.com.

Joe

unread,
Jan 30, 2020, 8:27:16 PM1/30/20
to autoke...@googlegroups.com
A method based on Jack's comments (if it works) will probably be faster
than my idea, but the following *might* be simpler to code.

AutoKey has Xautomation integration. What that means is that, if you can
visually identify the required tab (independent of AutoKey), you can
manually take a screenshot of that unique, small part of the screen,
save it, and then search the screen for it in your script. If you find
it, then clicking on it (using the screen coordinates returned by
Xautomation) should bring it into focus. If you fail to find it, then
you can open a new tab and start it.

I'm told that using Xautomation is a bit slow (around a second). I have
tested Xautomation standalone, but have never used it within AutoKey.

We have never received any questions about Xautomation, so you may have
to experiment with it to get it to do what you want, but we'll help in
any way we can. I know Thomas has tested it enough to know it works.

I'd love to have some examples to add to our wiki. :)

Joe
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> <https://groups.google.com/d/msgid/autokey-users/188c9974-55e6-4333-a463-fa3fefcf7c94%40googlegroups.com?utm_medium=email&utm_source=footer>.

Yekutiel ben Heshel

unread,
Jan 30, 2020, 9:33:29 PM1/30/20
to autokey-users

Jack,


Thanks for the information I appreciate it. 


Which web browser do you use? Maybe you could test it in your web browser. If you get it working then I could install the same web browser you use and test it myself.


Thanks,


Yekutiel

Yekutiel ben Heshel

unread,
Jan 30, 2020, 9:36:01 PM1/30/20
to autokey-users
Hi Joe,

Xautomation sounds promising but unfortunately I am not a developer. Therefore, I don't know how to write a script to do what you outlined.

If you have a script for me to test out, I'd be glad to test it out.

Thanks,

Yekutiel

Le mercredi 29 janvier 2020 22:46:00 UTC-8, Yekutiel ben Heshel a écrit :

Yekutiel ben Heshel

unread,
Jan 30, 2020, 11:48:10 PM1/30/20
to autokey-users
Joe,

If I have my Google Calendar open in a separate instance of Google Chrome (not merely a separate tab, but also a separate window) then running the following script will bring my Google Calendar to the foreground (which is the behavior I desire)...
# Start an instance of Chrome running Google Calendar if it is unopen or switch to an instance of Chrome running Google Calendar if it is open
    
import subprocess
command = 'wmctrl -a agenda'
output = system.exec_command(command, getOutput=True)
if "agenda" in output:
    window.activate("agenda",switchDesktop=True)
else:
    subprocess.Popen(["/usr/bin/google-chrome-stable"])

The word "agenda" at the end of command = 'wmctrl -a agenda' is part of the name of the tab (part of the string) that is open in the Google Chrome window (Google Chrome instance) that is running my Google Calendar. In other words, the word "agenda" is a unique string that, of course, is programmatically identifiable.

However, in addition, the script above also launches a new Google Chrome window, which is undesirable behavior (behavior I do not want). Rather, I want a new Google Chrome window to open with my Google Calendar to open only if my Google Calendar were not already open and had not already been brought to the foreground.

By the way, in a terminal if I run...

google-chrome-stable https://calendar.google.com/calendar/r/day

then Google Chrome opens in a new window with Google Calendar open in that new window as the only tab. However, I don't want to have multiple instances of Google Calendar running nor do I want to have to remember to quit Google Calendar every time I'm done looking at it.

Also, when I run the following command in a terminal, it brings my Google Calendar to the foreground

xdotool windowactivate `xdotool search --onlyvisible --class agenda`

Again, the word "agenda" at the end of the command is part of the name of the tab (part of the string) that is open in the Google Chrome window (Google Chrome instance) that is running my Google Calendar.

Thanks,

Yekutiel


Le mercredi 29 janvier 2020 22:46:00 UTC-8, Yekutiel ben Heshel a écrit :

Joe

unread,
Jan 31, 2020, 2:57:13 AM1/31/20
to autoke...@googlegroups.com
It would be a fun project, but, best case, it would take me the better
part of a day to get working (and things don't turn out best case that
often), so I can't do it now.

Joe
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/e3aa2b2e-1501-4ada-a472-1e4fb907bdb1%40googlegroups.com
> <https://groups.google.com/d/msgid/autokey-users/e3aa2b2e-1501-4ada-a472-1e4fb907bdb1%40googlegroups.com?utm_medium=email&utm_source=footer>.

jack

unread,
Jan 31, 2020, 3:01:41 AM1/31/20
to autoke...@googlegroups.com, Yekutiel ben Heshel

i use firefox, pale moon, chromium, sometimes opera.

i'll try it on firefox when i have a bit of time... but don't hold your breath. if it doesn't work immediately i'm not going to spend a long time on it.


jack
Trying to find a temporal workaround
--
You received this message because you are subscribed to the Google Groups "autokey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autokey-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autokey-users/08b3bcfa-c237-4645-ac42-e38a98fd69dc%40googlegroups.com.

Joe

unread,
Jan 31, 2020, 4:19:01 AM1/31/20
to autoke...@googlegroups.com
On 1/30/20 11:48 PM, Yekutiel ben Heshel wrote:
> Joe,
>
> If I have my Google Calendar open in a separate instance of Google
> Chrome (not merely a separate tab, but also a separate window) then
> running the following script will bring my Google Calendar to the
> foreground (which is the behavior I desire)...
>
> # Start an instance of Chrome running Google Calendar if it is
> unopen or switch to an instance of Chrome running Google Calendar
> if it is open
>     
> import subprocess
> command = 'wmctrl -a agenda'
> output = system.exec_command(command, getOutput=True)
> if "agenda" in output:
>     window.activate("agenda",switchDesktop=True)
> else:
>     subprocess.Popen(["/usr/bin/google-chrome-stable"])
>
>
> The word "agenda" at the end of command = 'wmctrl -a agenda' is part
> of the name of the tab (part of the string) that is open in the Google
> Chrome window (Google Chrome instance) that is running my Google
> Calendar. In other words, the word "agenda" is a unique string that,
> of course, is programmatically identifiable.
>
> However, in addition, the script above also launches a new Google
> Chrome window, which is undesirable behavior (behavior I do *_not_*
> want). Rather, I want a new Google Chrome window to open with my
> Google Calendar to open *_only if_* my Google Calendar were not
> already open and had not already been brought to the foreground.
>
> By the way, in a terminal if I run...
>
> google-chrome-stable https://calendar.google.com/calendar/r/day
>
>
> then Google Chrome opens in a new window with Google Calendar open in
> that new window as the only tab. However, I don't want to have
> multiple instances of Google Calendar running nor do I want to have to
> remember to quit Google Calendar every time I'm done looking at it.
>
> Also, when I run the following command in a terminal, it brings my
> Google Calendar to the foreground
>
> xdotool windowactivate `xdotool search --onlyvisible --class agenda`
>
I was about to mention xdotool. You can run xdotool from within an
AutoKey script. It knows how to do a bunch of things that AutoKey doesn't.

You just need to call it so it returns its exit code to you. If you get
a non-zero code, then it didn't find your window.

BTW, xdotool allows chaining of commands, so, theoretically (untested),
you should be able to simplify the above command to something like:

xdotool search --onlyvisible --class agenda windowactivate

But that's for a window. I have no idea how any of that works in a tab
in a window.

This totally untested :) code should do approximately what you want -
with windows - not tabs. I'm a total Python newbie, so no guarantees.

The lines below the if statement need to be indented by four spaces or a
tab (and your email client will probably mangle the code.) In Python,
indentation is what creates a block of code. It's not optional and all
code in the same block needs to be indented the same amount. Do not mix
tabs and spaces - you'll get Python programmers mad - if it even works.
There are two religions - one that uses just spaces and one that uses
just tabs.

The command you want to run gets stored in a list (inside []) with the
command itself as the first argument and each of its arguments following
as comma separated elements. Each element here is a constant string
surrounded by quotes, but it could also be a variable (without quotes)
if your code needs to set something (such as the name of the window to
look for) dynamically.

status = subprocess.call(["xdotool", "search", "--onlyvisible",
"--class", "agenda", "windowactivate"], stderr=subprocess.DEVNULL)

if status != 0:
        ## didn't find and activate window
        subprocess.popen(["google-chrome-stable",
"https://calendar.google.com/calendar/r/day"])

Joe
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/0a5a5580-3439-4e1d-a8a6-4fbcc3712f83%40googlegroups.com
> <https://groups.google.com/d/msgid/autokey-users/0a5a5580-3439-4e1d-a8a6-4fbcc3712f83%40googlegroups.com?utm_medium=email&utm_source=footer>.

jack

unread,
Jan 31, 2020, 6:46:05 AM1/31/20
to autoke...@googlegroups.com, Yekutiel ben Heshel
i tried the selenium thing briefly....

after getting the prereqs i tried a bit of code from their documentation and added a bit of my own.

unless there is something i'm unaware of, this is not going to work. the problem is that the selenium wants to control the whole browser... it starts firefox, then does whatever it does in that instance of firefox. since you would already have your own browser with 50 tabs open that would be no good for you.

another thought... keeping it simple... why not work like this:

  • always have google calendar as the first tab in your browser.
  • write a script to jump to (or start) your browser  and go to the first tab.
  • add another key definition that opens your calendar. when you are at the first tab, use that key to open a calendar, if necessary.

you may want to tweak that a little, but it's a simple process and you could implement it quickly.


jack

We are certainly moving with alacrity to the future






On 31/01/2020 02:33, Yekutiel ben Heshel wrote:
--
You received this message because you are subscribed to the Google Groups "autokey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autokey-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autokey-users/08b3bcfa-c237-4645-ac42-e38a98fd69dc%40googlegroups.com.

Yekutiel ben Heshel

unread,
Jan 31, 2020, 3:19:30 PM1/31/20
to autokey-users
Jack,

i tried the selenium thing briefly....

Thanks. I appreciate that.

unless there is something i'm unaware of, this is not going to work. the problem is that the selenium wants to control the whole browser


I see.
 

always have google calendar as the first tab in your browser.

That would be a hassle for me because I don't want to keep Google Calendar open all of the time. Therefore, after I closed it and then reopened it I would need to manually move it to the first tab.

Thanks,

Yekutiel

Le mercredi 29 janvier 2020 22:46:00 UTC-8, Yekutiel ben Heshel a écrit :

Yekutiel ben Heshel

unread,
Jan 31, 2020, 3:25:29 PM1/31/20
to autokey-users
Joe,

I ran...

status = subprocess.call(["xdotool", "search", "--onlyvisible",
"--class", "agenda", "windowactivate"], stderr=subprocess.DEVNULL)
if status != 0:
        ## didn't find and activate window
        subprocess.popen(["google-chrome-stable",
"https://calendar.google.com/calendar/r/day"])

I received an error message.

Does it work when you use it with your browser?

Thanks,

Yekutiel

Le mercredi 29 janvier 2020 22:46:00 UTC-8, Yekutiel ben Heshel a écrit :

jack

unread,
Jan 31, 2020, 3:47:58 PM1/31/20
to autoke...@googlegroups.com, Yekutiel ben Heshel
hi yekutiel

as i said, you might want to tweak the solution....

how about you have a browser that is dedicated to your calendar? you never open anything else in it.

then you have a script that pops to you dedicated browser, if it exists, otherwise the script starts up the browser and opens the calendar.

yes, that means you have to find another browser that works well with google calendar... dunno, i don't use calendar...but chromium might be ok.


jack
The English may not always be the best writers in the world, but they are incomparably the best dull writers
--
You received this message because you are subscribed to the Google Groups "autokey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autokey-user...@googlegroups.com.

Yekutiel ben Heshel

unread,
Jan 31, 2020, 5:00:54 PM1/31/20
to autokey-users
Jack,

Thanks. I had previously considered that solution. It's not bad but I disregarded it because I actually have three different web apps I want to do this with: Google Calendar, Gmail, and Google Drive.

I'll keep trying to find someone with the proper knowledge to help me solve a presumably soluble problem.

Thanks,

Yekutiel


Le mercredi 29 janvier 2020 22:46:00 UTC-8, Yekutiel ben Heshel a écrit :

jack

unread,
Jan 31, 2020, 5:08:30 PM1/31/20
to autoke...@googlegroups.com, Yekutiel ben Heshel
ok, the bottle of wine is almost empty, so be gentle...

  • have one browser instance for google calendar
  • one for google drive
  • one for google gmail

change the title of each browser window to match its contents. so, the title of the google calendar window would be 'google calendar' or some such. and so on.


or, you could use thunderbird for mail and something like google-drive-ocamlfuse for google drive...which gives you access from your normal file manager or command line... and then you don't need a browser for mail or google drive.

 


jack

Are you sure it isn't time for a colourful metaphor?

--
You received this message because you are subscribed to the Google Groups "autokey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autokey-user...@googlegroups.com.

Yekutiel ben Heshel

unread,
Jan 31, 2020, 5:10:57 PM1/31/20
to autokey-users


Le mercredi 29 janvier 2020 22:46:00 UTC-8, Yekutiel ben Heshel a écrit :

Yekutiel ben Heshel

unread,
Jan 31, 2020, 5:20:20 PM1/31/20
to autokey-users
Jack,

The following is something I had also considered...

  • have one browser instance for google calendar
  • one for google drive
  • one for google gmail

However, I often use Alt+Tab to cycle through my open applications. I don't want to cycle through more applications when I press Alt+Tab than necessary.

Although it's probably impractical, ideally I'd rather not even see google calendar, google drive, google gmail at all—even in tabs in a browser—unless I were to "call them" with a shortcut key. Of course, I assume I will need to at least see them in tabs in a browser.

I don't want to install the following application because I don't like "wonky solutions" that claim to work but then cause all sorts of "mysterious problems" but the following is the sort of solution I'm trying to, kind-of, sort-of emulate...


A solution presumably can be created to accomplish what I initially posted in this issue. I need to find a person who is knowledgeable in this area.

Thanks,

Yekutiel

Le mercredi 29 janvier 2020 22:46:00 UTC-8, Yekutiel ben Heshel a écrit :

jack

unread,
Jan 31, 2020, 5:29:59 PM1/31/20
to autoke...@googlegroups.com, Yekutiel ben Heshel
then have keys to go specifically to the one you want.... which seems  to be exactly what you are trying to do.

perhaps you should put each one in a different workspace and then flip between workspaces.

i'm afraid i didn't understand your 'wonky solution', if that refers to google-drive-ocamlfuse. i use it frequently and have never had any problems. it's just like a mapped drive...google drive appears as another directory.

but if you want icce-ssb, why not install that?


jack
A tomorrow's world of domestic appliances
--
You received this message because you are subscribed to the Google Groups "autokey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autokey-user...@googlegroups.com.

Yekutiel ben Heshel

unread,
Jan 31, 2020, 7:32:46 PM1/31/20
to autokey-users
Jack,
 
perhaps you should put each one in a different workspace and then flip between workspaces.
 
I think you and I are on the same wavelength. 

See, shortly after I sent you the previous message I thought of the same solution. I agree that would probably be a good solution for me.
 
 
then have keys to go specifically to the one you want.... which seems  to be exactly what you are trying to do.
 
Right. Yes. 

  1. I think I will probably end up assigning one hotkey to switch to what I am tentatively thinking of as my "Google Chrome Workspace” and then bring Google Chrome window running only Google Calendar to the foreground and...
  2. A second hotkey to switch to my my Google Chrome Workspace and then bring Google Chrome window running only Gmail to the foreground and...
  3. A third hotkey to switch to my Google Chrome Workspace and then bring Google Chrome window running only Google Drive to the foreground.
I appreciate your thoughtful suggestions and for helping to guide me to an elegant solution.

It took me a while to realize that once I use hotkeys (or text shortcuts) to launch web applications I commonly use (namely, Google Calendar, Gmail, and Google Drive) that the tabs within Google Chrome vis-a-vis said web applications become an unnecessary GUI approach to switching to said web applications.

Generally I prefer using a GUI except for the hundred or so things (such as cut, copy, paste, launch Firefox, launch Google Chrome, etc) that I do repetitiously. For those things I do repetitiously I prefer using keyboard shortcuts or text shortcuts.

GUI was a huge benefit over command line, particularly for newbies, when it became widely used on microcomputers in the 1980s. But the chasm between GUI and a Terminal need not exist. At some point I expect software designers will begin to focus on making it easy to enable users to gently and easily switch from GUI to keyboard shortcuts or text shortcuts or voice shortcuts for those things users do repetitiously.

Until then, I'll suppose continue to use tools like xbindkeys, xmodmap, xdotool, and of course, AutoKey to automate all sorts of things that really, in 2020, should probably be "built-in options."
 
Thanks,
 
Yekutiel


Le mercredi 29 janvier 2020 22:46:00 UTC-8, Yekutiel ben Heshel a écrit :

Little Girl

unread,
Feb 1, 2020, 12:56:28 AM2/1/20
to autoke...@googlegroups.com
Hey there,

Yekutiel ben Heshel wrote:

Before I begin, these pages may be of some use for what you'all have
already been working on:

https://stackoverflow.com/questions/7537832/list-of-open-browser-tabs-programmatically

https://stackoverflow.com/questions/50628481/opening-chromium-from-script

https://stackoverflow.com/questions/26114930/opening-tabs-using-webbrowser-module-in-python

>Although it's probably impractical, ideally I'd rather not even see
>google calendar, google drive, google gmail at all—even in tabs in a
>browser—unless I were to "call them" with a shortcut key. Of course,
>I assume I will need to at least see them in tabs in a browser.

A possible solution would be to not have them open at all and to use
one of the methods below to open them on demand:

1) Create an AutoKey script with these contents, replacing the Google
URL with the URL to Google Calendar or Google Drive or Gmail:

import webbrowser
webbrowser.get("chromium-browser").open("https://google.com")

2) Assign it an abbreviation or hotkey and you can open it in Chrome
or Chromium any time you like.

...or...

1) Turn each of them into shortcuts by following these instructions:

https://support.google.com/chrome_webstore/answer/3060053?hl=en

2) Right-click one of the shortcuts on your desktop and copy its
command.

3) Make an AutoKey script with these contents, replacing EXAMPLE
with the command you copied:

output = system.exec_command('EXAMPLE')
keyboard.send_keys(output)

4) Assign it an abbreviation or hotkey and you can open it in Chrome
or Chromium any time you like.

Note to Joe: I know you're not a fan of single quotes in commands,
but they're used here since the command Yekutiel will be copying will
contain double quotes.

--
Little Girl

There is no spoon.

Keith Bainbridge

unread,
Feb 1, 2020, 1:29:00 AM2/1/20
to autoke...@googlegroups.com
Please see below

Keith Bainbridge

keith.bain...@gmail.com
0447 667 468

On 1/2/20 9:08 am, jack wrote:
> ok, the bottle of wine is almost empty, so be gentle...
>
> * have one browser instance for google calendar
> * one for google drive
> * one for google gmail

Extending this suggestion a little. This came from a long time ago, but
I just checked in chromium, so should work in the other version:

Go to the web page you want to open immediately
go to Customise - 3 dots near top-right corner
more options
create shortcut

a new box opens - give your page a name And tick the box 'open as
window' - to reduce the temptation to use this instance as your normal
browser.


It is now in your menu - search for the name you just applied.

When you open the shortcut, you get a dedicated page for that site. You
can add windows from links in the original sites, etc but n add tabs
button. Close the window and you main browser is still there. (Now
thinking, would this be better than pinning tabs?)


Seems easier than trying to program a totally separate app to do the job
- unless you MUST have only one browser window open



--
Keith Bainbridge

keith.bain...@gmail.com
0447 667 468

Keith Bainbridge

unread,
Feb 1, 2020, 1:39:19 AM2/1/20
to autoke...@googlegroups.com
I see this process creates a shortcut on your desktop as well. If your
menu opens with keyboard, just delete icon from desktop

Keith Bainbridge

keith.bain...@gmail.com
0447 667 468

Joe

unread,
Feb 1, 2020, 2:28:38 AM2/1/20
to autoke...@googlegroups.com

On 1/31/20 5:08 PM, jack wrote:
> ok, the bottle of wine is almost empty, so be gentle...
>
> * have one browser instance for google calendar
> * one for google drive
> * one for google gmail
>
> change the title of each browser window to match its contents. so, the
> title of the google calendar window would be 'google calendar' or some
> such. and so on.
>
>
> or, you could use thunderbird for mail and something like
> google-drive-ocamlfuse for google drive...which gives you access from
> your normal file manager or command line... and then you don't need a
> browser for mail or google drive.
>
>  
>
I have google-drive-ocamlfuse installed. It works pretty well, but I
haven't done much with it.
>> <mailto:autokey-user...@googlegroups.com>.
>> <https://groups.google.com/d/msgid/autokey-users/837c48e1-53bd-4f9e-8a00-e65f20b3c2ed%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/85a85e5d-043b-96e9-9b16-55f2e6c12ee6%40gmail.com
> <https://groups.google.com/d/msgid/autokey-users/85a85e5d-043b-96e9-9b16-55f2e6c12ee6%40gmail.com?utm_medium=email&utm_source=footer>.

jack

unread,
Feb 1, 2020, 2:41:19 AM2/1/20
to autoke...@googlegroups.com, Yekutiel ben Heshel


"GUI was a huge benefit over command line, particularly for newbies, when it became widely used on microcomputers in the 1980s."

minor point, fwiw. i think you probably mean 1990s. windows 3.1 was when a GUI environment took off and that was released in 1992. in the 80s there was windows 2 and nobody used that.


jack
occasionally bouncing off the walls of sanity
--
You received this message because you are subscribed to the Google Groups "autokey-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to autokey-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/autokey-users/ed8f2bde-2acb-4274-9e15-beda1d49ce73%40googlegroups.com.

Joe

unread,
Feb 1, 2020, 2:42:44 AM2/1/20
to autoke...@googlegroups.com
Single quotes are fine. I don't know enough Python to know what
difference they make in general, but for this use case, they are
definitely necessary.

Joe

unread,
Feb 1, 2020, 2:54:52 AM2/1/20
to autoke...@googlegroups.com
The problem with the code is that the email client reformatted it -
which makes Python very unhappy.

I repaired it and attached it as a file so it won't get altered. You
still need to put it into Python yourself - it's a code fragment, not a
complete program.

Joe
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/c6d8886b-9967-4e7d-b217-bdd346bf8e27%40googlegroups.com
> <https://groups.google.com/d/msgid/autokey-users/c6d8886b-9967-4e7d-b217-bdd346bf8e27%40googlegroups.com?utm_medium=email&utm_source=footer>.
YbH_1.py

Joe

unread,
Feb 1, 2020, 3:29:21 AM2/1/20
to autoke...@googlegroups.com
Several paths:

1) Get the Xautomation approach to work: This might do exactly what you
want, but I'm not sure when I can get to it.

2) Put the special apps in one or more browser windows on a virtual
desktop which is just for them. Then, all you have to do is switch
desktops and select the appropriate window (all of which xdotool will do
nicely and I have experience with it.)

3) If you use KDE or would consider using it, it has a really cool meta
feature called activities. The desktop environment you have now (and all
the associated virtual desktops) is equivalent to one KDE activity. When
you switch to another activity you get a whole new set of everything -
even wallpaper. That way, when you switch from one activity to another,
you only see what you need for what you want to do now, but everything
else is just a few clicks away in one or more other activities.

The advantage of this is that you can build and use the whole thing
without any programming - not even AutoKey, although that might still
make it smoother to use.

It's like going from your office to your kitchen. Everything in the
office is still there the way you left it, but it's completely out of
sight and mind while you're in the kitchen and you have all your kitchen
stuff ready at hand.

So, you could have these other apps open in one or more other activities
and they would be completely out of the way and invisible until you
switch to them.

Andy Lavarre <alav...@gmail.com> is our local expert on activities. He
gets down into manipulating them at a lower level.

IMO, the simplest approach  still looks like (1), but the others are
worth considering.

Joe

On 1/31/20 7:32 PM, Yekutiel ben Heshel wrote:
> Jack,
>  
>
> perhaps you should put each one in a different workspace and then
> flip between workspaces.
>
>  
> I think you and I are on the same wavelength. 
>
> See, shortly after I sent you the previous message I thought of the
> same solution. I agree that would probably be a good solution for me.
>  
>  
>
> then have keys to go specifically to the one you want.... which
> seems  to be exactly what you are trying to do.
>
>  
> Right. Yes. 
>
> 1. I think I will probably end up assigning one hotkey to switch to
> what I am tentatively thinking of as my "Google Chrome Workspace”
> and then bring Google Chrome window running only *_Google
> Calendar_* to the foreground and...
> 2. A second hotkey to switch to my my Google Chrome Workspace and
> then bring Google Chrome window running only *_Gmail_* to the
> foreground and...
> 3. A third hotkey to switch to my Google Chrome Workspace and then
> bring Google Chrome window running only *_Google Drive_* to the
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/ed8f2bde-2acb-4274-9e15-beda1d49ce73%40googlegroups.com
> <https://groups.google.com/d/msgid/autokey-users/ed8f2bde-2acb-4274-9e15-beda1d49ce73%40googlegroups.com?utm_medium=email&utm_source=footer>.

Joe

unread,
Feb 1, 2020, 3:54:00 AM2/1/20
to autoke...@googlegroups.com

On 2/1/20 2:41 AM, jack wrote:
>
>
> "GUI was a huge benefit over command line, particularly for newbies,
> when it became widely used on microcomputers in the 1980s."
>
> minor point, fwiw. i think you probably mean 1990s. windows 3.1 was
> when a GUI environment took off and that was released in 1992. in the
> 80s there was windows 2 and nobody used that.
>
I saw Windows 2 briefly. Nobody used it because it didn't do anything
except screw up the market in MS's favor. Before that, the only place
GUIs existed was at Xerox PARC where they were invented. Even Windows
3.0 was mostly useless.
>
> jack
> occasionally bouncing off the walls of sanity
>
>
>
>
> On 01/02/2020 00:32, Yekutiel ben Heshel wrote:
>> Jack,
>>  
>>
>> perhaps you should put each one in a different workspace and then
>> flip between workspaces.
>>
>>  
>> I think you and I are on the same wavelength. 
>>
>> See, shortly after I sent you the previous message I thought of the
>> same solution. I agree that would probably be a good solution for me.
>>  
>>  
>>
>> then have keys to go specifically to the one you want.... which
>> seems  to be exactly what you are trying to do.
>>
>>  
>> Right. Yes. 
>>
>> 1. I think I will probably end up assigning one hotkey to switch to
>> what I am tentatively thinking of as my "Google Chrome Workspace”
>> and then bring Google Chrome window running only *_Google
>> Calendar_* to the foreground and...
>> 2. A second hotkey to switch to my my Google Chrome Workspace and
>> then bring Google Chrome window running only *_Gmail_* to the
>> foreground and...
>> 3. A third hotkey to switch to my Google Chrome Workspace and then
>> bring Google Chrome window running only *_Google Drive_* to the
>> <mailto:autokey-user...@googlegroups.com>.
>> <https://groups.google.com/d/msgid/autokey-users/ed8f2bde-2acb-4274-9e15-beda1d49ce73%40googlegroups.com?utm_medium=email&utm_source=footer>.
>
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/5b02d6cf-277f-3e7b-cc9d-446fbda4ab63%40gmail.com
> <https://groups.google.com/d/msgid/autokey-users/5b02d6cf-277f-3e7b-cc9d-446fbda4ab63%40gmail.com?utm_medium=email&utm_source=footer>.

Little Girl

unread,
Feb 1, 2020, 6:51:37 PM2/1/20
to autoke...@googlegroups.com
Hey there,

Joe wrote:
>Little Girl wrote:

>> output = system.exec_command('EXAMPLE')
>> keyboard.send_keys(output)

>> Note to Joe: I know you're not a fan of single quotes in commands,
>> but they're used here since the command Yekutiel will be copying
>> will contain double quotes.

>Single quotes are fine. I don't know enough Python to know what
>difference they make in general, but for this use case, they are
>definitely necessary.

Yeah, I just didn't want to give the impression that that's typical
for me. In real life, I usually use double quotes, adding single
quotes only when necessary.

Yekutiel ben Heshel

unread,
Feb 2, 2020, 12:16:18 AM2/2/20
to autokey-users
Little Girl,

Thanks. I reviewed the webpages you linked to.



> Although it's probably impractical, ideally I'd rather not even see
>google calendar, google drive, google gmail at all—even in tabs in a
>browser—unless I were to "call them" with a shortcut key. Of course,
>I assume I will need to at least see them in tabs in a browser.

A possible solution would be to not have them open at all and to use one of the methods below to open them on demand:

Thanks but I don't want "open on demand."
 
Why not? Because if, say, Gmail were already open I would want Gmail to come to the foreground. Why? Because that method is faster for webpages that are already open, particularly Gmail, Google Calendar, and Google Drive which tend to load slowly.

1) Create an AutoKey script with these contents, replacing the Google
URL with the URL to Google Calendar or Google Drive or Gmail:
        import webbrowser
        webbrowser.get("chromium-browser").open("https://google.com")

Interestingly, running that script resulted in an error message (in other words, it didn't work for me). Did it work for you?

However the following works for me...

subprocess.Popen(["/usr/bin/google-chrome-stable"])

Does it work for you?

Yekutiel ben Heshel

unread,
Feb 2, 2020, 12:50:13 AM2/2/20
to autokey-users
Keith,

I am delighted about being able to reduce the tendency to inadvertently use Google Chrome instances running my web apps as normal browser instances for "regular web browsing." Thank you!

I ticked the box 'open as window' as you suggested and then went to my desktop (which I normally don't use at all). I then right clicked on the icon on my desktop for the shortcut I had just made to my Google Calendar. Then I chose "Edit Launcher" which listed the following... 

/opt/google/chrome/google-chrome --profile-directory=Default --app-id=kjbdgfilnfhdoflbpgamdcdgpehopbep

I then copied and pasted that link into a terminal and was able to launch my Google Calendar in a "dedicated window" (that is, a window that does not allow tabs to be created in which one could open additional web pages).

Keith Bainbridge

unread,
Feb 2, 2020, 1:01:39 AM2/2/20
to autoke...@googlegroups.com
Yekutiel

Depending on your desktop, the short cut should be in your menu as well.
If you have a start menu that opens a list of ALL apps in the initial
listing and you can search the app name (dare I say like windows start
menu - wash out your mouth, Keith) you can open the calendar this way.
I find it easier to set a keyboard shortcut to open the menu. One key,
then start typing the search query. Generally 3 letters at most.


I can't be more specific without knowing your desktop. Gnome, kde, mate,
cinnamon, xfce?

By the bye, I just tried opening one of my new shortcuts, twice, and it
opened 2 instances of the tab. Shouldn't really matter with Calendar,
gmail type sites, but it may with more interactive sites. Only did this
as you wanted to go to an open instance if possible.



I hate having to go to the desktop as well. I figure something to do
with how horrible Win3/3.11 was.


Keith Bainbridge

keith.bain...@gmail.com
0447 667 468

Yekutiel ben Heshel

unread,
Feb 2, 2020, 1:03:02 AM2/2/20
to autokey-users
Keith,

I see this process creates a shortcut on your desktop as well. If your menu opens with keyboard, just delete icon from desktop


Thanks for the information.

Actually the only place I found the shortcut was on my desktop. I did not understand which "menu" you were referring to in your previous message when you indicated I could find the shortcut under my menu.

Yekutiel ben Heshel

unread,
Feb 2, 2020, 1:33:40 AM2/2/20
to autokey-users
Keith,

Depending on your desktop, the short cut should be in your menu as well.

Ah. Yes. Ok. I found it under the Whisker Menu in XFCE.


If you have a start menu that opens a list of ALL apps in the initial
listing and you can search the app name (dare I say like windows start menu - wash out your mouth, Keith)  you can open the calendar this way.

I despise Bill Gates and Microsoft, yet that doesn't stop me from appreciating the Windows menu. I'm studying the Talmud (Daf Yomi). The rabbis of the Talmud considered the Persians to be wicked. But the rabbis in the Talmud admired Persian toilets.


I find it easier to set a keyboard shortcut to open the menu.

I used AutoKey to set the number "5" on my extended keyboard's number pad to open the Whisker Menu.

One key, then start typing the search query. Generally 3 letters at most.

Yup. That's what I do for applications I don't use very frequently. For applications I use very frequently such as Google Chrome, Firefox, Mousepad, Kitty, Audacious, and YouTube dl gui I launch them with keyboard shortcuts that either launch the application or switch to the application if it is already open using the following...

# Start Chrome if it is unopen or switch to Chrome if it is open

import subprocess
command = 'wmctrl -l'
output = system.exec_command(command, getOutput=True)

if " Google Chrome" in output:
    window.activate(" Google Chrome",switchDesktop=True)

else:
    subprocess.Popen(["/usr/bin/google-chrome-stable"])

I didn't write that script; rather I found it on the web. I'm not a coder but merely a power user.


By the bye, I just tried opening one of my new shortcuts, twice, and it opened 2 instances of the tab. Shouldn't really matter with Calendar, gmail type sites, but it may with more interactive sites.  Only did this as you wanted to go to an open instance if possible.

I suppose I will probably soon tackle the problem... "Start web app X if it is unopen or switch to web app X if it is open"



I hate having to go to the desktop as well. I figure something to do with how horrible Win3/3.11 was.

Actually, I don't hate the desktop at all.

I very rarely use the desktop because it's a metaphor akin training wheels on a bicycle: it helps ordinary users more easily switch from a real desk with files on it, to a using a computer to deal with files. These days I can ride a bike more easily without training wheels than with training wheels.

For the last five years or so I've been using SpaceFM as my file manager. It's weird UI can be quickly and easily modified to look normal. I like the fact that I can easily bind shortcut keys the commands I use frequently in SpaceFM. I like using a GUI therefore unsurprisingly I prefer SpaceFM to Ranger.

Although I am Jewish, when it comes to technology I'm essentially an atheist. Whatever tool works well for me, I use. I don't have any interest in the zealous pseudo-religious wars that many techies get into over technology A vs technology B. I don't even like the word "technology." I prefer the word "tool." All of these computer programs (software applications) are simply tools to me. As such, I have no emotional attachment to them whatsoever.

After using Gallium OS (based on Ubuntu) for a few years, I just switched to Manjaro XFCE (based on Arch Linux) about a month or two ago because I wanted rolling releases. I expect I'll switch to some new operating system within another few years. 

Frankly, I'm tired of waiting for "headset computers" to replace "regular computers" (laptops and desktop machines). Back during the first dot com boom (around 2000) I predicted headset computers would be commonplace by 2010 or at the latest 2015. I don't like sitting or standing and looking at a monitor.

Thanks,

Yekutiel


Le mercredi 29 janvier 2020 22:46:00 UTC-8, Yekutiel ben Heshel a écrit :
Screenshot at 22-09 on Saturday 1 Feb 2020.png

Keith Bainbridge

unread,
Feb 2, 2020, 1:41:44 AM2/2/20
to autoke...@googlegroups.com
OK, so I'm back on list. I like the story about the Persians, and the
rest of Yekutiel's response to my off-list digression.

Yes a single key to open it, then type away. But you are taking it way
past my ability. Good for you.



Keith Bainbridge

keith.bain...@gmail.com
0447 667 468

> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/70e6ebcb-bda2-4bbc-90c8-bcc1de46dc78%40googlegroups.com
> <https://groups.google.com/d/msgid/autokey-users/70e6ebcb-bda2-4bbc-90c8-bcc1de46dc78%40googlegroups.com?utm_medium=email&utm_source=footer>.

Yekutiel ben Heshel

unread,
Feb 2, 2020, 1:59:30 AM2/2/20
to autokey-users
Jack,

"GUI was a huge benefit over command line, particularly for newbies, when it became widely used on microcomputers in the 1980s."

minor point, fwiw. i think you probably mean 1990s. windows 3.1 was when a GUI environment took off and that was released in 1992. in the 80s there was windows 2 and nobody used that.

Actually, I meant the 1980's.

"In 1987, Apple sold one million Macs and suddenly played in the IBM league again"

I would guess that in 1988 and 1989 Apple probably sold at least another one or two million computers. In the mid to late 1980s the Apple Macintosh "sold like hotcakes" yet was "as cool as the other side of the pillow."

Here are a couple of fun facts...

First,

Microsoft crushed and nearly bankrupted Apple Computer (now called Apple Inc) when it licensed the Windows operating system starting in 1990.

Second,

Fearing the Department of Justice's Antitrust Division, in 1997 Microsoft kept Apple solvent (in business) with a $150 million investment (which was essentially a loan).

In my opinion, Steve Jobs made a terrible and reckless business decision when he decided to keep Apple in a "walled garden" in the 1980's and 1990's because Apple was far too small, and far too weak to "go it alone" at that time. By the early 1990s I figured Apple was going to go the way of Wang, DEC, and other once "high flying" computer makers.

The only reason Apple stayed in business was the the unstoppable juggernaut known as Microsoft which was about to conquer the entire world (well, maybe I'm exaggerating a little) was on the brink of becoming the sole company that produced operating systems for mass-marketed microcomputers (that is, a monopoly) and as such was on the cusp of being federally regulated.

No. I didn't mean the 1990's. I meant the 1980's.

Thanks,

jack horsfield

unread,
Feb 2, 2020, 2:14:57 AM2/2/20
to autoke...@googlegroups.com


hi yekutiel

well, we must agree to differ. i contend that a million is not
exactly 'widely used'.

wikipedia tell me:
Early Macintosh models were expensive,[3] hindering its
competitiveness in a market dominated by the Commodore 64 for
consumers, as well as the IBM Personal Computer and its
accompanying clone market for businesses.

in my own experience (i worked for DEC from 84 to 94) i saw lots
of IBM PCs (although 99% of my work was on a VAX). possibly saw
one or two macs, but that was it.

wikipedia also tell me that the Commodore 64 'It has been listed
in the Guinness World Records as the highest-selling single
computer model of all time,[5] with independent estimates placing
the number sold between 10 and 17 million units.[2] Volume
production started in early 1982,'


jack
stabbed fluffier magnolias



Yekutiel ben Heshel <unsecur...@gmail.com> writes:

> Jack,
>
> "GUI was a huge benefit over command line, particularly for
> newbies, when
> it became widely used on microcomputers in the 1980s."
>
> minor point, fwiw. i think you probably mean 1990s. windows 3.1
> was when a
>> GUI environment took off and that was released in 1992. in the
>> 80s there
>> was windows 2 and nobody used that.
>
>
> Actually, I meant the 1980's.
>
> The History of the Apple Macintosh
> <https://www.mac-history.net/top/2011-01-24/the-history-of-the-apple-macintosh>
> "*In 1987, Apple sold one million Macs* and suddenly played in

Yekutiel ben Heshel

unread,
Feb 2, 2020, 2:21:11 AM2/2/20
to autokey-users
Joe,

The problem with the code is that the email client reformatted it - which makes Python very unhappy. 

WEINBERG'S SECOND LAW: If builders built buildings the way programmers wrote programs, then the first woodpecker that came along would destroy civilization

 
I repaired it and attached it as a file so it won't get altered. 

Thanks for repairing it and attaching it as, "YbH_1.py." 

If I recall correctly this code was to be used to switch to an open tab in Google Chrome. Right? If that is correct then at this point I think I don't this code  because I think I'm going to open each web app in Google Chrome "in its own window" in a workspace I have named "My Google Chrome Workspace" instead of using tabs.

You still need to put it into Python yourself - it's a code fragment, not a complete program.

Even if I were to still need the code fragment you included in the attachment, I would have no idea how to put it into Python because I'm merely a power user; I am not a developer.

Yekutiel ben Heshel

unread,
Feb 2, 2020, 3:39:45 AM2/2/20
to autokey-users
Jack,

I sincerely appreciate your assistance and the assistance of others in this Google Group.

I didn't have an ax to grind when I originally opined about GUIs. Rather I was trying shed some light on the problem by introducing historical perspective to explain how perplexed I was that the gulf between the command line and GUIs in particular (and, by implication, computer automation generally for myriad computer users) has only—kind of, sort of, and, frankly, generally poorly—been bridged by tools like AutoKey, xbindkeys, xmodmap, xdotool, and the like.

That being said, I'm trying, with my limited non-technical ability, to use those tools (and tools like them) so that I can solve or circumvent some of the seemingly unnecessary dozen or so niggling problems I have associated with using my little laptop computer.

I don't mean to seem blunt, but... I don't intend to argue with you over the definition of widespread. It's a vague term that can be interpreted to refer to relative percentages and/or geographic dispersion. 

I suppose you might have been thinking of the former: for example, Microsoft had around 90% market share in microcomputer operating systems in the late 1980's whereas Apple only had around 10% market share. I was thinking of the later, that is, "spread over a wide area" as in, Apple Macintosh computers were used all across the USA presumably by at least four or five million people in the 1980s. (Personal computers weren't that personal in the 1980s. Due to their high cost, they were generally shared by two or more people).

However, you were wrong when you opined, "i think you probably mean 1990s." That is not what I meant. Not at all. I meant the 1980's.

GUI's became widespread in the 1980's (spread all over the USA). During the next decade, during the 1990s, GUIs became the de facto standard by which the overwhelming majority of microcomputer users interacted with computers. 

GUIs are still the de facto standard by which the overwhelming majority of microcomputer and "pocketcomputer" (Android and iPhone) users interact with computers.

I look forward to switching from the GUI to what I think of as an Immersive User Interface (IUI) which would be the user interface for a optical head-mounted display.

I'm not at all surprised to learn you worked at DEC from 1984 to 1994. I suppose many guys working for minicomputer companies in places such as along Massachusetts' Route 128, who were put out of work, in part, by a company making "fruity toy computers", tend to revile and denigrate Apple products to this very day. I remember how Microsoft and Apple used the disruptive innovation to push minicomputer makers out of the mainstream computer business.

Personally I despise Apple even more than I do Microsoft. Bill Gates built a classic American monopoly (like Carnegie, Morgan, and Rockefeller); Steve Jobs built a cult based on consumerism, elitism, ignorance, and stupidity. After he made his fortune, Bill Gates became a humanitarian, whereas Steve Jobs was a greedy, merciless, and cruel slave driver who became "the richest man in the graveyard." I felt not sadness (nor joy) when Steve Jobs died. 

Steve Jobs effectively sent Apple into a nosedive in the late 1980s and 1990s with his foolish decision not to license Apple's operating system just like his company's one, and really only significant competitor, Microsoft. I remember, as an Apple user, thinking that Apple was going to go bankrupt because of Steve Jobs' obviously bad business decision. I was disgusted because I didn't want to be stuck with one, and only, one "real choice" for a computer operating system: Microsoft.

Nonetheless, I believe that Steve Jobs and Apple deserve much praise for bringing high quality "user friendly" computers into the mass marketplace. DEC (which you indicated was your former employer) was vanquished by the duopoly of Microsoft and Apple. I suppose, perhaps, you remember it all too well. 

I was not trying to rekindle an "ideological holy war" that millions of engineers fought valiantly and stridently over. It's not a war that ever mattered much to me one way or another. I'm not an engineer. I neither like engineering nor science. I'm merely a power user trying to elegantly use my computer. That's all.

Joe

unread,
Feb 2, 2020, 4:04:57 AM2/2/20
to autoke...@googlegroups.com
There is a very promising headset that (of all places) Radio Shack is
starting to sell. It does full 3D images and motion, but it relies on a
5G Cellular signal, so it's not widely available yet. So, if the 5G
doesn't make everybody ill, you shouldn't have to wait much longer for
your headset (except for the price to come down.)

Joe

Joe

unread,
Feb 2, 2020, 4:12:49 AM2/2/20
to autoke...@googlegroups.com

On 2/2/20 1:59 AM, Yekutiel ben Heshel wrote:
> Jack,
>
> "GUI was a huge benefit over command line, particularly for newbies,
> when it became widely used on microcomputers in the 1980s."
>
> minor point, fwiw. i think you probably mean 1990s. windows 3.1
> was when a GUI environment took off and that was released in 1992.
> in the 80s there was windows 2 and nobody used that.
>
>
> Actually, I meant the 1980's.
>
> The History of the Apple Macintosh
> <https://www.mac-history.net/top/2011-01-24/the-history-of-the-apple-macintosh>
> "*_In 1987, Apple sold one million Macs_* and suddenly played in the
> IBM league again"
>
> I would guess that in 1988 and 1989 Apple probably sold at least
> another one or two million computers. In the mid to late 1980s the
> Apple Macintosh "sold like hotcakes" yet was "as cool as the other
> side of the pillow."
>
> Here are a couple of fun facts...
>
> First,
>
> Microsoft crushed and nearly bankrupted Apple Computer (now called
> Apple Inc) when it licensed the Windows operating system starting in 1990.
>
> Second,
>
> Fearing the Department of Justice's Antitrust Division, in 1997
> Microsoft kept Apple solvent (in business) with a $150 million
> investment (which was essentially a loan).
>
> In my opinion, Steve Jobs made a terrible and reckless business
> decision when he decided to keep Apple in a "walled garden" in the
> 1980's and 1990's because Apple was far too small, and far too weak to
> "go it alone" at that time. By the early 1990s I figured Apple was
> going to go the way of Wang, DEC, and other once "high flying"
> computer makers.

It's funny how that worked out. Even geniuses make big mistakes. He also
sold most of his Apple stock when it was very low and he probably
figured the same as you did.

It's hard to predict what comes "Next".

Joe
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/a090e2e8-ad24-4fff-8dd0-072e5f74c3df%40googlegroups.com
> <https://groups.google.com/d/msgid/autokey-users/a090e2e8-ad24-4fff-8dd0-072e5f74c3df%40googlegroups.com?utm_medium=email&utm_source=footer>.

Joe

unread,
Feb 2, 2020, 4:38:44 AM2/2/20
to autoke...@googlegroups.com

On 2/2/20 2:21 AM, Yekutiel ben Heshel wrote:
> Joe,
>
> The problem with the code is that the email client reformatted it
> - which makes Python very unhappy. 
>
>
> WEINBERG'S SECOND LAW: If builders built buildings the way programmers
> wrote programs, then the first woodpecker that came along would
> destroy civilization
>
That is actually finally being addressed. Aside from improved design
methodologies in general, there is a relatively new branch of languages
called functional programming languages (Haskell is one of these).
Programs in these languages are more like formal designs/specifications
rather that step by step instructions (procedural languages) and can
actually be proven to be correct (bug free). The Cardano cryptocurrency
project is actively using this to build the next release of their
blockchain and I have heard about missile systems which had critical
parts of their systems coded using these languages. White hat hackers
were given access to some of the missile's less critical systems and
were still unable to break into the critical parts.

Joe

>  
>
> I repaired it and attached it as a file so it won't get altered. 
>
>
> Thanks for repairing it and attaching it as, "YbH_1.py." 
>
> If I recall correctly this code was to be used to *_switch to an open
> tab_* in Google Chrome. Right? If that is correct then at this point I
> think I don't this code  because I think I'm going to open each web
> app in Google Chrome "in its own window" in a workspace I have named
> "My Google Chrome Workspace" instead of using tabs.
>
> You still need to put it into Python yourself - it's a code
> fragment, not a complete program.
>
>
> Even if I were to still need the code fragment you included in the
> attachment, I would have no idea how to put it into Python because I'm
> merely a power user; I am not a developer.

No. I don't know how to just access a tab although I'm sure Python has
ways to do it. As for trying it out, you just put it in one of your
AutoKey scripts as is and it might work. No magic or deep incantations
required. The only thing you might need is to add an "import subprocess"
statement in front of it.

I'm glad the path you are currently pursuing is working for you.

Joe
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/5f84f917-a0f1-40ef-9d72-147f1785cade%40googlegroups.com
> <https://groups.google.com/d/msgid/autokey-users/5f84f917-a0f1-40ef-9d72-147f1785cade%40googlegroups.com?utm_medium=email&utm_source=footer>.

Yekutiel ben Heshel

unread,
Feb 2, 2020, 4:49:29 AM2/2/20
to autokey-users
Jack,

There is a very promising headset that (of all places) Radio Shack is starting to sell. 

Radio Shack as we used to know it no longer exists. These days Radio Shack is merely a brand. A quick check on Wikipedia of Radio Shack suggests that this headset will fail quickly and completely because without massive financing, how would it be able to successfully compete with, for example, Facebook's headset? 

Facebook, Apple, Google, Microsoft, Amazon, and Samsung will each presumably spend tens if not hundreds of millions of dollars trying to gain first mover advantage in what promises to be a huge market. Those six companies all also have legions of engineering talent.


It does full 3D images and motion, but it relies on a 5G Cellular signal, so it's not widely available yet. So, if the 5G
doesn't make everybody ill, you shouldn't have to wait much longer for your headset (except for the price to come down.)

Thanks but I don't have the slightest interest. 

I want to be able to put on a headset to elegantly compose emails, documents, and "surf the web"... in an immersive environment. I want to, for example, cut, paste, and resize text with simple gestures. I also want to put my "cuttings" on the wall in front of me, or beside me and easily organize them. I don't really do much else other than that on my computer. But trying to organize my thoughts on an two dimensional small, computer monitor is a limitation that I would like to move past. 

I imagine putting on a headset and perceiving a "virtual wall" that is, say, ten feet by ten feet in front of me, as well as another behind me, and one on either side of me. Text everywhere! Words, words, and more words! That's what I want to be able to see. Then I'll be able to avoid all this scrolling and switching screens that I find somewhat disorienting. It's hard for me to keep my thoughts straight when I'm "running all over the place" manipulating words.

1G, 2G, 8G or 58G make no difference to me whatsoever. I rarely speak on the phone and rarely power on my mobile phone (which is a Samsung Galaxy 5 that I enjoy watching, collecting dust). For me, mobile phones are like CD ROMS: technology that is barely worth using. This Radio Shack product you mentioned, which I doubt many people will be talking about 12 months from now, reminds me of those technologies.

Yekutiel ben Heshel

unread,
Feb 2, 2020, 5:43:29 AM2/2/20
to autokey-users
Jack,

It's funny how that worked out. Even geniuses make big mistakes.

Steve Jobs was an extremely successful CEO. But Steve Jobs was not a genius. Not hardly. 

He was a CEO who was excellent at marketing in a business sector with CEOs who were notoriously poor at marketing. Steve Jobs grasped from the outset that the computers he was selling were essentially consumer electronics that needed to be sold based on style and fashion ("sell the sizzle, not the steak") not merely substance.

Steve Jobs reminds me of PT Barnum: both were hucksters. On the other hand, Bill Gates reminds me of Henry Ford, who infamously allowed buyers of the Model-T to chose any color they wanted for their car, as long as that color happened to be black. I never understood why Microsoft didn't simply mimic Apple's marketing strategy.
 

He also sold most of his Apple stock when it was very low

I didn't know that.

 
and he probably figured the same as you did.

Perhaps. 


It's hard to predict what comes "Next".

Next was a business based on a silly idea: let's make a really good computer that is more expensive than the Macintosh and IBM compatibles. The whole trend in computers was well understood at the time: they were getting smaller and smaller as well as cheaper and cheaper. Not just in the 1980s, but in the 1950s, 1960s, and 1970s.

Even in 1985 Macs and PCs were actually remarkably useful computers because they could run word-processors, spreadsheets, and databases that dramatically and obviously increased productivity.

At Next, if Steve Jobs had gone about making a computer that was essentially a cheaper version of the Macintosh that was just as good, or, conversely, a computer that was essentially a better version of the Macintosh that was just as cheap then I suppose Next would have had a much better chance of succeeding.

By 1988 (when Next launched) Macs and PCs were so powerful and useful (by the standards of the time) that the Next computer seemed unnecessarily expensive. I remember when Next computers launched. I could not figure out who would buy these expensive computers that had less software and less hardware than Macs and PCs. 

Next computers were like Segway's original personal vehicles: there were technically advanced products that were too expensive and not very useful. They were classic "cool engineering solutions" that were very difficult to sell.

Also, the two-sided market phenomena meant that third party software and hardware makers needed a very compelling argument to make a second or third version of their software or hardware (in addition to their Microsoft DOS and/or Apple Macintosh) versions.

Finally back in 1988 I was amazed that Microsoft hadn't copied Apple and made a computer that looked and worked just like the Macintosh. In 1985 when the Macintosh was changing the computer world, I figured Bill Gates would bring in a team with his top engineers at Microsoft and tell them: "See this Macintosh computer? You have 18 months to build me something just as good or better than this, that we can sell for no more than Apple is selling the Macintosh."

Instead Microsoft built the awful software known as Windows 2, then the not very good Windows 3.1.1 and a whole slew of better but still remarkably unreliable Windows versions after that. I still don't understand what went wrong at Microsoft. But I sure am glad that I no longer use the Windows operating system.

Yekutiel ben Heshel

unread,
Feb 2, 2020, 5:50:08 AM2/2/20
to autokey-users
Joe,

Thanks for your suggestions. I am merely a novice in this area in particular and non-technical generally. Therefore, my technical opinions on this are unlearned and therefore concomitantly tentative and pliable. With that wordy disclaimer in mind, I have opined below.


1) Get the Xautomation approach to work: This might do exactly what you want, but I'm not sure when I can get to it.

I'm unsure. It seems like it might be too daunting for me.


2) Put the special apps in one or more browser windows on a virtual desktop which is just for them. Then, all you have to do is switch desktops and select the appropriate window (all of which xdotool will do nicely and I have experience with it.)

That approach seems feasible for me.

By creating, "My Google Chrome Workspace" which would contain each "web app" (by which I mean Google Calendar, Gmail, and Google Drive) in its own window (not tab, but rather window) I think, with your help and the help of others, I can create keyboard shortcuts and/or text shortcuts to switch desktops and select the appropriate windows.


3) If you use KDE or would consider using it, it has a really cool meta feature called activities. The desktop environment you have now (and all the associated virtual desktops) is equivalent to one KDE activity. When you switch to another activity you get a whole new set of everything - even wallpaper. That way, when you switch from one activity to another, you only see what you need for what you want to do now, but everything else is just a few clicks away in one or more other activities.


For my needs, this approach seems like it might be unsuitable.

I don't like to "sole source" (be dependent on one desktop environment). 

Although I am currently "all in" with Google (Google Chrome, Gmail, Google Calendar, and Google Drive) I try to avoid sole-sourcing. For me, the Google products I listed have been powerful, reliable and, of course free. Therefore, I have stuck with Google for the last twelve or so. I have generally been consistently delighted with then except for a few features I think would be nice to have but certainly are not essential.

For example, I look at Nextcloud Hub with a wary eye. Do I want to spin up a Linux server on my Vultr or Hetzner account and deal with all of the problems I've read that people have encountered? No. I don't want that sort of grief and aggravation. I'm not a Linux sys admin. Not hardly. Playing with computers is not a hobby of mine. I am a power user; I am not an engineer. I don't want find myself having to comb through a bunch of web pages trying to figure out how to fix some weird problem I expect I'd run into with Nextcloud Hub. Frankly, Google and the NSA are welcome to my data. It's theirs for the taking.

I use XFCE. I'd rather not switch to KDE because, based on my research, XFCE is still a little bit lighter-weight than KDE. I barely use the features of my desktop environment. For example, my desktop is usually completely empty (no files, no folders, no trashcan, "no nuthin'") except for the wallpaper. I don't even have a key to "hide all windows" because I very rarely ever explicitly go to the desktop. Therefore, any "regular GUI desktop environment" would probably be fine for me.

The advantage of this is that you can build and use the whole thing without any programming - not even AutoKey, although that might still make it smoother to use.

I think I'd probably actually prefer to use AutoKey because the smoothness you are suggesting seems like it would come at what I perceive to be a high cost: sole sourcing with KDE. AutoKey is portable. I can take it from one desktop environment to another. Sure. I'm sole sourcing with AutoKey. But the less I sole source, the better.

It's like going from your office to your kitchen. Everything in the
office is still there the way you left it, but it's completely out of
sight and mind while you're in the kitchen and you have all your kitchen stuff ready at hand.

So, you could have these other apps open in one or more other activities and they would be completely out of the way and invisible until you switch to them.

I like that metaphor. You clearly understand what I am trying to accomplish. Thanks for taking the time to understand my goal.


Andy Lavarre <alav...@gmail.com> is our local expert on activities. He gets down into manipulating them at a lower level.
 
Thanks for giving me Andy's name and email address.


IMO, the simplest approach  still looks like (1), but the others are worth considering.

Hmmm. I'm not sure. I suppose that your second suggestion seems like it might easier for me to accomplish. But, maybe I'm mistaken. Again, I'm a novice in this area.
Message has been deleted

Joe

unread,
Feb 2, 2020, 7:11:11 AM2/2/20
to autoke...@googlegroups.com
This was me, Joe.
I've heard of a "wall of words" before, but it wasn't like this. ;)

Switching back and forth is quite annoying. If I had a desktop computer
that I kept in one place, I'd definitely get a 4K ultra-wide monitor so
I could at least have two full-sized windows side by side.

> 1G, 2G, 8G or 58G make no difference to me whatsoever. I rarely speak
> on the phone and rarely power on my mobile phone (which is a Samsung
> Galaxy 5 that I enjoy watching, collecting dust). For me, mobile
> phones are like CD ROMS: technology that is barely worth using. This
> Radio Shack product you mentioned, which I doubt many people will be
> talking about 12 months from now, reminds me of those technologies.

This new technology is moving so fast that all the first products will
have a very short life.

You will need the higher speed networks because everything will assume
they're there and overwhelm slower networks. It would be like trying to
use a 56K dial-up modem today. Just running repository updates - before
even downloading normal software updates - would be quite challenging -
if not impossible - and that's before actually trying to get any work
done. The display of huge virtual screens in front of you will require
the bandwidth too.

Joe
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/1f41475c-05dc-433e-bcff-6737fee14ab8%40googlegroups.com
> <https://groups.google.com/d/msgid/autokey-users/1f41475c-05dc-433e-bcff-6737fee14ab8%40googlegroups.com?utm_medium=email&utm_source=footer>.

Joe

unread,
Feb 2, 2020, 7:49:12 AM2/2/20
to autoke...@googlegroups.com
Well, see how far you get on your current course. It may be quite
sufficient. If it's not, then we can look at Xautomation. So far, I
haven't seen anyone actually use it and it would be fun to see if we
could get it to do something useful. I would do the coding. You would
probably have to make the tiny screenshots for the target tabs, etc.

As for approach 2, I have had a running battle with KDE's session
restore for some years. I now have a startup script that looks at what
windows were restored on which desktops and then moves them where they
belong and starts them if necessary. That's all in bash using xdotool,
so I know how to get it to do simple things.

In general, it is (as you have noted) quite surprising that something
like AutoKey only even more comprehensive isn't built into every modern
desktop environment by default. You should be able to just drag and drop
things and methods and have the system configured in short order. I
think we don't because so any Linux users are super technical and use
terminals to get most of their work done with the GUI just there for
"unimportant" things. Their idea of fancy is using screen and tmux to
manage multiple terminals attached to multiple machines on one display.

Since you seem to know about Apple, they have a couple of tools -
Automater and Maestro - which supposedly do desktop automation, but I
have never seen them.

I do have a fairly recent Macbook here that my partner bought, but it
mainly gathers dust.

Joe

On 2/2/20 5:50 AM, Yekutiel ben Heshel wrote:
> Joe,
>
> Thanks for your suggestions. I am merely a novice in this area in
> particular and non-technical generally. Therefore, my technical
> opinions on this are unlearned and therefore concomitantly tentative
> and pliable. With that wordy disclaimer in mind, I have opined below.
>
>
> 1) Get the Xautomation approach to work: This might do exactly
> what you want, but I'm not sure when I can get to it.
>
>
> I'm unsure. It seems like it might be too daunting for me.
>
>
> 2) Put the special apps in one or more browser windows on a
> virtual desktop which is just for them. Then, all you have to do
> is switch desktops and select the appropriate window (all of which
> xdotool will do nicely and I have experience with it.)
>
>
> That approach seems feasible for me.
>
> By creating, "My Google Chrome Workspace" which would contain each
> "web app" (by which I mean Google Calendar, Gmail, and Google Drive)
> in its *own window* (not *_tab_*, but rather *_window_*) I think, with
> --
> You received this message because you are subscribed to the Google
> Groups "autokey-users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to autokey-user...@googlegroups.com
> <mailto:autokey-user...@googlegroups.com>.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/autokey-users/346dacea-cf11-4734-a2b6-9fee31efb67a%40googlegroups.com
> <https://groups.google.com/d/msgid/autokey-users/346dacea-cf11-4734-a2b6-9fee31efb67a%40googlegroups.com?utm_medium=email&utm_source=footer>.

Little Girl

unread,
Feb 2, 2020, 8:44:54 AM2/2/20
to autoke...@googlegroups.com
Hey there,

Yekutiel ben Heshel wrote:
>Little Girl wrote:
>>Yekutiel ben Heshel wrote:

>>> Although it's probably impractical, ideally I'd rather not even
>>> see google calendar, google drive, google gmail at all—even in
>>> tabs in a browser—unless I were to "call them" with a shortcut
>>> key. Of course, I assume I will need to at least see them in tabs
>>> in a browser.
>
>>A possible solution would be to not have them open at all and to
>>use one of the methods below to open them on demand:
>
>Thanks but I don't want "open on demand."

Yep, but you had written the comment above, so I figured you might be
open to an alternative suggestion. No worries.

>Why not? Because if, say, Gmail were already open I would want Gmail
>to come to the foreground. Why? Because that method is faster for
>webpages that are already open, particularly Gmail, Google Calendar,
>and Google Drive which tend to load slowly.

I understand. I've looked around quite a bit now and it's looking
more and more like Selenium is going to be your best method of
getting at a specific tab in an already-open instance of Chrome.

>1) Create an AutoKey script with these contents, replacing the Google
>> URL with the URL to Google Calendar or Google Drive or Gmail:
>> import webbrowser
>> webbrowser.get("chromium-browser").open("https://google.com")
>
>Interestingly, running that script resulted in an error message (in
>other words, it didn't work for me). Did it work for you?

Sorry about that. There are two possible reasons, each or both of
which may be to blame. First of all, I indented those and shouldn't
have. Second of all, it looks like you're using google-chrome-stable
and I'm using chromium-browser. What you would want it this:

import webbrowser
webbrowser.get("google-chrome-stable").open("https://google.com")

>However the following works for me...
>
>subprocess.Popen(["/usr/bin/google-chrome-stable"])
>
>Does it work for you?

Yep, but I've got Chromium, so I had to alter it slightly and this
works for me:

subprocess.Popen(["chromium-browser"])

Note that you probably don't need the /usr/bin/ part in yours since
it's most likely already in your default path.
Message has been deleted

Yekutiel ben Heshel

unread,
Feb 2, 2020, 8:04:32 PM2/2/20
to autokey-users
Joe,

Well, see how far you get on your current course. It may be quite
sufficient. If it's not, then we can look at Xautomation.

That seems like a good idea.



So far, I haven't seen anyone actually use it and it would be fun to see if we
could get it to do something useful. I would do the coding. You would
probably have to make the tiny screenshots for the target tabs, etc.

I am not an engineer, therefore this seems like it would be the oposite of fun for me.




As for approach 2, I have had a running battle with KDE's session
restore for some years. I now have a startup script that looks at what
windows were restored on which desktops and then moves them where they
belong and starts them if necessary. That's all in bash using xdotool,
so I know how to get it to do simple things.

I'm uninterested in heading down that learning curve at this time.



In general, it is (as you have noted) quite surprising that something
like AutoKey only even more comprehensive isn't built into every modern
desktop environment by default. 

Yes. It perplexes me.



You should be able to just drag and drop
things and methods and have the system configured in short order.

Sure. Apple's Hypercard (which was sort of like the web, except inside of Apple's walled garden) and Microsoft's Visual Basic are a couple examples of software applications that kind of, sort of, promised to do this but generally failed to do so.


think we don't because so any Linux users are super technical and use
terminals to get most of their work done with the GUI just there for
"unimportant" things. 

I concur. Adept Linux users tend to be "command line junkies."



Their idea of fancy is using screen and tmux to
manage multiple terminals attached to multiple machines on one display.

Or a tiling window manager such as i3. That's fine for "techies" but not for "normals." See, Techies and normals.



Since you seem to know about Apple, they have a couple of tools -
Automater and Maestro - which supposedly do desktop automation, but I
have never seen them.

I have not seriously used a Macintosh in nearly 20 years. Once Windows 2000 came out I switched from Mac to Windows to save money on hardware. 

I've been using Linux for about 5 years. Linux is the least bad operating system I've used thus far.

But that's not saying much when the competition has been MS-DOS, Macintosh, and Windows.


I do have a fairly recent Macbook here that my partner bought, but it
mainly gathers dust.

Why not run Linux on it? I'm running Manjaro XFCE on a Chromebook. Macs are generally, although not always, high quality machines. However, like Rolex watches, they tend to be overpriced.

Little Girl

unread,
Feb 6, 2020, 11:10:56 AM2/6/20
to autoke...@googlegroups.com
Hey there,

jack wrote:

>there is a similar discussion here:

>https://stackoverflow.com/questions/46416852/get-urls-of-all-open-tabs-using-python

Yep, that's Selenium, which seems to be the best way of doing what
Yekutiel would like to do.

>extracting what is in that discussion and adding a quick internet
>search gives me:

[SNIP]

>that is going to look messy because the code will have to cycle
>through every tab to find out whether the one you want is already
>open. it would be easier and look much neater just to open the tab
>you want and ignore duplicates.

The only method I've seen so far actively cycles through the tabs
like that, but there may be other ways of doing it. You can see the
cycling demonstrated in this video (in which the author, SDET, refers
to tabs as windows):

https://www.youtube.com/watch?v=GwTqzwz7I5M

The same author put out a video with a full course on using Selenium
with Python here:

https://www.youtube.com/watch?v=o3tYiyE_OXE

I haven't watched it (because it's over eight hours long), but we can
click around in the video time-line to find specific subtopics. He's
a very good teacher and does a great job of explaining things.

Little Girl

unread,
Feb 6, 2020, 5:32:57 PM2/6/20
to autoke...@googlegroups.com
Hey there,

Yekutiel ben Heshel wrote:
>Little Girl wrote:

>>and it's looking more and more like Selenium is going to be your
>>best method of getting at a specific tab in an already-open
>>instance of Chrome.
>
>Perhaps. I don't know much about Selenium.

Jack had sent a small sample script that works using Selenium and I
replied to that earlier today with a couple of links to a guy on
YouTube who made some videos that show how to use it. You might want
to check those out, although one of them is really long.

>I think I will *abandon the tab idea* (that is, one Google Chrome
>window with three tabs: one tab for Google Calendar, a second tab
>for Gmail, and a third tab for Google Drive) in favor of a three
>separate windows: one window for Google Calendar, a second window
>for Gmail, and a third window for Google Drive because I can put
>those three windows in a distinct workspace (which I am calling, "My
>Google Chrome Workspace") to avoid cluttering my screen when I press
>*Alt+Tab* to cycle through my open applications while circumventing
>the apparently onerous process of switching between tabs.

Okay. Whatever works best for your work-flow will be the way to go.

>As I mentioned in another message on this subject in this Google
>Group...
>
>*By creating, "My Google Chrome Workspace" which would contain each
>"web app" (by which I mean Google Calendar, Gmail, and Google Drive)
>in its own window (not tab, but rather window) I think, with your
>help and the help of others, I can create keyboard shortcuts and/or
>text shortcuts to switch desktops and select the appropriate
>windows.*

Yep. As long as you know the commands or key combinations to get to
them, it can be automated in AutoKey.

If you can launch or access programs in some way with key
combinations, you can send those from AutoKey with something like one
of these, which either use just special keys or combinations of
special keys and regular keys:

keyboard.send_keys("<shift><ctrl><page_up>")

keyboard.send_keys("<shift><ctrl>w")

keyboard.send_keys("<delete>")

keyboard.send_keys("<alt>1")

Note that that last one would probably be of extra interest to
you since it will navigate you to the first tab of the current
program. If you had a specific URL pinned to the first tab, you'd
always be able to get to it with that key combination.

You can find a list of special keys listed here:

https://github.com/autokey/autokey/wiki/Special-Keys

>However, subsequently I read that Google is finally killing off
>Chrome apps, which nobody really used anyhow
><https://www.theverge.com/2020/1/15/21067907/google-chrome-apps-end-support-lune-windows-macos-linux>.

I wasn't aware of that. Thanks for the heads-up.

>Therefore, I think I will use an ordinary URL in an ordinary yet
>separate Google Chrome window for my Google Calendar, Gmail, and
>Google Drive.

Good idea.

>Thus far I have the following script working...
>
># Switches to my Gmail if it is open
>
>import subprocess
>
>command = 'wmctrl -a "- Gmail"'
>output = system.exec_command(command, getOutput=True)
>if "inbox" in output:
> window.activate("'- Gmail'",switchDesktop=True)

Ah, that's using Bash. Maybe this would be of some use:

https://unix.stackexchange.com/questions/237626/is-there-a-way-to-activate-a-particular-tab-of-chrome-via-bash

Also, in case this helps any, this gives me the title of the
currently active tab in Chromium:

```

wmctrl -l | grep Chromium | grep -v grep | cut -f5- -d' ' | cut -f1 -d'-' | sed -r 's/( )+//g';

```

Since you use Chrome, this version of it should work for you:

```

wmctrl -l | grep Chrome | grep -v grep | cut -f5- -d' ' | cut -f1 -d'-' | sed -r 's/( )+//g';

```

Note that it returns nothing if Chromium (or, in your case, Chrome)
isn't open.

You could write a script in AutoKey using that command to query
Chrome and, if the title isn't the one you're looking for (like
Gmail), send the <ctrl><page_up> keys to navigate to the next tab or
send the <ctrl><page_dn> keys to navigate to the previous tab and
then repeat the query until the proper title is found. Then you can
have the script exit once the proper title is found and that will be
the focused tab. It's kind of a hacked and inelegant way of doing it,
but it should work.

It occurs to me that you might need a wildcard in the title query
since the title might change depending on where, in Gmail, you happen
to be at any given moment.

>By the way, I intentionally switched the order of the quotation
>marks in the script above to from single quotation marks surrounding
>double quotation marks to double quotation marks surrounding single
>quotation marks to remind myself that, at least in this instance,
>the order seems to be irrelevant.

Yep. A quick search on Google shows that quote type doesn't seem to
matter in Python. I think it's common convention to use double-quotes
for strings, though, because some strings contain apostrophes, which
you'd have to watch out for otherwise.

>In my testing of the script I indicated above, it will switch to the
>most recently opened instance of Gmail I have open regardless of the
>workspace(s) the instance(s) of Gmail is/are in. Normally, I plan to
>use an AutoKey hotkey to either open Gmail in Google Chrome (in its
>own window) if it is not already open, or if Gmail is already open
>in a Google Chrome window, then bring Gmail to the foreground.
>Therefore, I doubt I'd have a problem with multiple instances of
>Gmail being open.

Okay.

>I need to figure out how add the following functionality to the
>script above...
>
>Either open Gmail in Google Chrome if it is not already open, or if
>Gmail is already open in a Google Chrome window, then bring Gmail to
>the foreground.

The steps above should bring it to the foreground.

>The following script is missing the specific URL and it also opens
>Google Chrome immediately after opening my Gmail window.
>
>import subprocess
>
>command = 'wmctrl -a "- Gmail"'
>output = system.exec_command(command, getOutput=True)
>if "inbox" in output:
> window.activate("'- Gmail'",switchDesktop=True)
>
>else:
> subprocess.Popen(["/usr/bin/google-chrome-stable"])

Isn't that opening Gmail for you if it's not already open?

>Thanks but I failed to make it work even after I removed the
>indenting and replacing "chromium-browser" with
>"google-chrome-stable". Please see... https://i.imgur.com/2o9QGVM.png

Interesting. You might need to add the format specifier (%s) to get it
to work:

```

import webbrowser
webbrowser.get("google-chrome-stable %s").open("https://www.google.com")

```

Or you might need to leave -stable off of it entirely to get it to
work:

```
import webbrowser
webbrowser.get("google-chrome").open("https://www.google.com")

```

Yekutiel ben Heshel

unread,
Feb 6, 2020, 10:10:57 PM2/6/20
to autokey-users
Little Girl,
 
>> Yep, that's Selenium, which seems to be the best way of doing what Yekutiel would like to do.
 
I decided to use a separate browser window for each separate web page (such as my Gmail or Google Calendar) instead of a separate tab for each web page.  Therefore perhaps I do not need to use Selenium to accomplish my goal.
 
Thanks,
 
Yekutiel



Le mercredi 29 janvier 2020 22:46:00 UTC-8, Yekutiel ben Heshel a écrit :
I use the following to launch Google Chrome if it is unopen or switch to Google Chrome if it is open
 
import subprocess
command = 'wmctrl -l'
output = system.exec_command(command, getOutput=True)
 

if " Google Chrome" in output:
    window.activate(" Google Chrome",switchDesktop=True)
 
else:
    subprocess.Popen(["/usr/bin/google-chrome-stable"])
 

Little Girl

unread,
Feb 7, 2020, 11:22:48 PM2/7/20
to autoke...@googlegroups.com
Hey there,

Yekutiel ben Heshel wrote:
>>Little Girl wrote:

>> Yep, that's Selenium, which seems to be the best way of doing what
>> Yekutiel would like to do.

>I decided to use a separate *browser window* for each separate web
>page (such as my Gmail or Google Calendar) instead of a separate tab
>for each web page. Therefore perhaps I do not need to use Selenium
>to accomplish my goal.

You absolutely don't need to. It can be done in several different
ways. It sounds like you're well on your way to getting it finished.
Reply all
Reply to author
Forward
0 new messages