Jump to content


Photo

BrowserTabs (Chrome/Safari) - close tabs to the left/right, switch between tabs with keyboard

chrome safari tabs tab close switch

  • Please log in to reply
19 replies to this topic

#1 MacGeeky

MacGeeky

    Member

  • Member
  • PipPip
  • 67 posts
  • LocationTrondheim, Norway

Posted 03 June 2013 - 06:49 PM

BrowserTabs Features

 

  • Close background windows in browser (Chrome/Safari)
  • Close all tabs to the right or left of the active tab in Safari and Google Chrome with a keyboard shortcut
  • Move to the next (right) / previous (left) tab with keyboard shortcuts
  • Move to the first or last tab in the Safari/Chrome window with keyboard shortcuts  

Install the workflow, add your own shortcuts for each command.

 

Skjermbilde%202013-06-04%20kl.%2015.19.1

Help for the keyboard shortcut setup:

 

  • closeLeftTabs - closes all tabs to the left
  • closeRightTabs - closes all tabs to the right

     

  • nextTab - switches to the next tab (to the right)
  • previousTab - switches to the previous tab (to the left)

     

  • lastTab - activates the first tab, to the left
  • firstTab - activates the last tab, to the right

 

  • closeBackgroundWindows - closes all background windows in Safari/Chrome
  • CloseOtherTabs - New feature (Google Chrome only): Close all other tabs with a keyboard shortcut

 

  • copyURL - copy the URL of the frontmost tab in Safari/Chrome to the clipboard
  • CopyURLandTitle - copy the URL and title of the frontmost tab in Safari/Chrome to the clipboard

Download BrowserTabs

 

Download BrowserTabs 1.22

 

Download BrowserTabs 1.23

 

(Optional: Download BrowserTabs 1.23.1 - additional shortcuts available for choosing tab 1 through 9 by individually shortcuts. Examples: cmd+option+1 for tab 1, cmd+option+2 for tab 2, etc)


Edited by MacGeeky, 08 July 2013 - 01:12 PM.

  • twinpeaks likes this

#2 vdesabou

vdesabou

    Advanced Member

  • Member
  • PipPipPip
  • 434 posts
  • LocationParis

Posted 04 June 2013 - 07:53 AM

Very cool! Thanks



#3 MacGeeky

MacGeeky

    Member

  • Member
  • PipPip
  • 67 posts
  • LocationTrondheim, Norway

Posted 26 June 2013 - 08:21 PM

New version (1.22): 

 

New feature - close all other tabs in Google Chrome (with a keyboard shortcut)

 

Download



#4 MacGeeky

MacGeeky

    Member

  • Member
  • PipPip
  • 67 posts
  • LocationTrondheim, Norway

Posted 27 June 2013 - 01:19 AM

New version (1.23):

 

New features

 

  • copy the URL of the frontmost tab of Safari/Chrome to the cliplboard
  • copy the URL and title of the frontmost tab of Safari/Chrome to the clipboard

Download



#5 myrison

myrison

    Newbie

  • Member
  • Pip
  • 5 posts

Posted 05 July 2013 - 03:41 PM

MacGeeky - this is awesome, thank you for creating it.

 

One suggestion/request for you would be to create additional shortcut options so that tabs 2-9 can be directly selected via keyboard shortcut as well (like Chrome/Firefox does it, and Safari does not).  I'm not savvy enough to edit your 'firstTab' shortcut to do the others, but if you could add them I'd be quite grateful.  

 

Just in case that's not clear, what I'm talking about is:

 

FirstTab = Command-1 (or whatever custom shortcut a user wants)

SecondTab = Command-2 (or custom)

etc..

Thanks again for posting.  It's a really useful workflow.



#6 MacGeeky

MacGeeky

    Member

  • Member
  • PipPip
  • 67 posts
  • LocationTrondheim, Norway

Posted 08 July 2013 - 12:16 PM

myrison - I could make a version for you with these options, but I don't think I'll implement it in the official version because the setup would be too cluttered in my opinion.

 

I'll make a special version for you, and post it when it finished :)

 

Here's a new version with support for choosing between the first 9 tabs in Chrome/Safari with a shortcut.

 

Download BrowserTabs (with support for choosing tabs by number)


Edited by MacGeeky, 08 July 2013 - 03:20 PM.

  • myrison likes this

#7 myrison

myrison

    Newbie

  • Member
  • Pip
  • 5 posts

Posted 08 July 2013 - 01:27 PM

Thanks a ton.  This is hugely useful for me (and hopefully a few other people as well).  

 

Hopefully future googlers are able to find their way here.  I know from searching for a solution before coming here that there are at least a few people looking for this same implementation. 

 

I'll post links where I can to provide more exposure to Alfred and your script MacGeeky.  Let me know if I can buy you a beer. :)


  • MacGeeky likes this

#8 MacGeeky

MacGeeky

    Member

  • Member
  • PipPip
  • 67 posts
  • LocationTrondheim, Norway

Posted 14 July 2013 - 12:14 AM

Added support for Alleyoop updates!

 

Download and install the Alleyoop workflow to search for new updates in this workflow, and other workflows supporting it.



#9 mshucker

mshucker

    Newbie

  • New Member
  • Pip
  • 1 posts

Posted 21 December 2013 - 11:42 PM

This is exactly what I have been looking for!  Wanting command-tab# is the only reason I haven't been using Safari.  Thanks!



#10 kieropipas

kieropipas

    Newbie

  • Member
  • Pip
  • 1 posts

Posted 27 May 2014 - 06:51 AM

Hmm, it doesn't work for me... No action I set does really do anything in Safari for me (MBP 2009, Mavericks).

Did something change or is it still working for you guys?



#11 enigma2k

enigma2k

    Newbie

  • Member
  • Pip
  • 10 posts

Posted 27 May 2014 - 10:32 AM

Is it possible to add the feature to switch between the last active tab and your current tab?



#12 twinpeaks

twinpeaks

    Member

  • Member
  • PipPip
  • 175 posts

Posted 27 May 2014 - 02:09 PM

This script is great but way too hotkey intensive for me to use as much as I'd like.

 

- Anyway to get a scriptfilter set to optional? Start typing and you filter down the list to the command your looking for but in this way not necessary to remember the variables or the hotkeys as they are listed automatically in alfred's menu...

 

That would make this so much more useful for me. I will play around some more and see if I can get it working off the example of another workflow but I tried before and got discouraged so I'll let you know but 1+ days you can be sure I have threw in the towel. Cheers!


 


#13 politicus

politicus

    Advanced Member

  • Member
  • PipPipPip
  • 407 posts

Posted 18 August 2014 - 06:23 AM

@MacGeeky Excellent workflow! I was looking for that workflow for a long time.

 

Two features requests:

- A "the last active tab / your current tab" switcher would be awesome

- A close the tab right/left to the current tab would be awesome too. 



#14 politicus

politicus

    Advanced Member

  • Member
  • PipPipPip
  • 407 posts

Posted 16 September 2014 - 05:48 AM

If you want a "last active tab / your current tab" switcher. There is a little Google Chrome extension called "Recent Tabs".

 

HTH.



#15 MacGeeky

MacGeeky

    Member

  • Member
  • PipPip
  • 67 posts
  • LocationTrondheim, Norway

Posted 12 October 2014 - 08:47 PM

Hmm, it doesn't work for me... No action I set does really do anything in Safari for me (MBP 2009, Mavericks).

Did something change or is it still working for you guys?

 

I haven't updated the extension for 10.9 yet, but I'm (only) assuming it's related to the change in security and Accessability Preferences - you have to manually accept each application that uses GUI scripting (this extension does) in Preferences => Accessability. Here's Apples support page for this solution: http://support.apple.com/kb/HT6026


Edited by MacGeeky, 29 October 2014 - 11:44 PM.


#16 sesweitzer

sesweitzer

    Newbie

  • New Member
  • Pip
  • 4 posts

Posted 14 August 2016 - 05:18 PM

Greetings,

I have a new Mac and I'm trying to use a workflow with Alfred 3 called Browsertabs that, among other things, closes all Safari tabs to the left or to the right. This workflow works fine on two of my Macs (all running El Capitan). I Exported it from a working version of Alfred 3 and then Imported it to the new Mac by double clicking on it.

 

After I add a shortcut key combination, I get this error:

Starting debug for 'BrowserTabs'

 

[2016-08-14 11:45:25][trigger.hotkey] Processing output of 'action.applescript' with arg 'closeRightTabs'

[2016-08-14 11:45:25][ERROR: action.applescript] {

    NSAppleScriptErrorBriefMessage = "Expected end of line, etc. but found property.";

    NSAppleScriptErrorMessage = "Expected end of line, etc. but found property.";

    NSAppleScriptErrorNumber = "-2741";

    NSAppleScriptErrorRange = "NSRange: {2239, 3}";

 

Any suggestion?

Steve



#17 deanishe

deanishe

    Advanced Member

  • Member
  • PipPipPip
  • 2,231 posts
  • LocationEssen

Posted 14 August 2016 - 06:02 PM

If you're having a problem with a workflow, you should ask in that workflow's thread (if there is one).

 

In any case, please post a link to the workflow. Can't tell you what's wrong without it.



#18 sesweitzer

sesweitzer

    Newbie

  • New Member
  • Pip
  • 4 posts

Posted 15 August 2016 - 12:40 PM

This is the link http://www.alfredfor...-with-keyboard/

 

The first time I ran it with Safari open I got a window asking where Chrome was located. I don't have Chrome on this Mac.

 

This is the AppleScript

on alfred_script(q)

 
-- find front app
tell application "System Events"
set frontApp to name of the first process whose frontmost is true
 
end tell
 
 
if frontApp is "Safari" then
 
if q is "tab1" then
tell first window of application "Safari" to set current tab to tab 1
else if q is "tab2" then
tell first window of application "Safari" to set current tab to tab 2
else if q is "tab3" then
tell first window of application "Safari" to set current tab to tab 3
else if q is "tab4" then
tell first window of application "Safari" to set current tab to tab 4
else if q is "tab5" then
tell first window of application "Safari" to set current tab to tab 5
else if q is "tab6" then
tell first window of application "Safari" to set current tab to tab 6
else if q is "tab7" then
tell first window of application "Safari" to set current tab to tab 7
else if q is "tab8" then
tell first window of application "Safari" to set current tab to tab 8
else if q is "tab9" then
tell first window of application "Safari" to set current tab to tab 9
end if
 
else if frontApp is "Google Chrome" then
 
if q is "tab1" then
tell application "Google Chrome" to set active tab index of first window to 1
else if q is "tab2" then
tell application "Google Chrome" to set active tab index of first window to 2
else if q is "tab3" then
tell application "Google Chrome" to set active tab index of first window to 3
else if q is "tab4" then
tell application "Google Chrome" to set active tab index of first window to 4
else if q is "tab5" then
tell application "Google Chrome" to set active tab index of first window to 5
else if q is "tab6" then
tell application "Google Chrome" to set active tab index of first window to 6
else if q is "tab7" then
tell application "Google Chrome" to set active tab index of first window to 7
else if q is "tab8" then
tell application "Google Chrome" to set active tab index of first window to 8
else if q is "tab9" then
tell application "Google Chrome" to set active tab index of first window to 9
end if
end if
end alfred_script


#19 deanishe

deanishe

    Advanced Member

  • Member
  • PipPipPip
  • 2,231 posts
  • LocationEssen

Posted 15 August 2016 - 01:00 PM

Merged sesweitzer's thread with this one.

Edited by deanishe, 15 August 2016 - 01:01 PM.


#20 deanishe

deanishe

    Advanced Member

  • Member
  • PipPipPip
  • 2,231 posts
  • LocationEssen

Posted 15 August 2016 - 01:03 PM

The first time I ran it with Safari open I got a window asking where Chrome was located. I don't have Chrome on this Mac.


I think that breaks the workflow. AppleScript chokes if there's a "tell" clause whose target application isn't installed. Unless someone has a better idea, you could try installing Chrome or removing the parts of the workflow that refer to it.



Also tagged with one or more of these keywords: chrome, safari, tabs, tab, close, switch

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users