Conflit avec un script DualFinder

marlouis

Membre junior
18 Mars 2018
24
1
31
Bonjour à tous et meilleurs vœux pour cette nouvelle année.

je cherchais une solution simple pour afficher deux onglets côte à côte dans le Finder sur mon Macbook Pro 15' 2019 Big Sur 11.1, lorsque je suis tombé là dessus : https://github.com/sjackwu/DualFinder

Il n'y avait pas vraiment d'indication pour l'installation, c'est pourquoi j'ai (bêtement) lancé les scripts un à un (j'ai inséré au bas du message les scripts qui, selon moi, sont succeptibles d'être à la source du problème).
Aujourd'hui je suis toutefois bien embêté car, en plus d'avoir échoué à afficher deux onglets dans le Finder, je me retrouve avec des raccourcis qui semblent être en conflit...

En effet, dans le Finder à présent :

  • La touche Tab fait basculer d'un onglet à un autre
  • Le raccourci Cmd+Tab pour basculer d'une application à l'autre est par conséquent bien plus difficile à déclencher (il me faut maintenir Cmd une seconde avant d'appuyer sur Tab)
  • Lorsque j'utilise Cmd+Tab pour revenir sur le Finder, une bascule automatique d'onglet a lieu au moment où le Finder apparaît.

Cela peut sembler peu de choses mais c'est en réalité très handicapant.
L'un d'entre vous aurait-il quelques conseils à m'apporter à ce sujet ?

Bonne journée,
Joseph
 
Dernière édition:

marlouis

Membre junior
18 Mars 2018
24
1
31
Tab--jump to the other Finder window.scpt

Bloc de code:
tell application "Finder" to select the last Finder window

Alt-=--make the other window = current one.scpt

Bloc de code:
tell application "Finder"
    
    -- get number of open finder windows
    set NumberofFinders to count every Finder window
    
    -- if number of finder window is not 2, stop
    if NumberofFinders is not 2 then
        display notification "Please make sure only 2 Finder Windows are opened side-by-side."
        return
    end if
    
    -- get location of the 2 finder windows   
    try
        tell Finder window 1
            set firstLocation to target
        end tell
    end try
    
    -- make the exchange happen
    set the target of Finder window 2 to firstLocation
end tell

Alt-Left--make Window L = Window R.scpt


Bloc de code:
-- Need the localized version of the string "folder"
-- set folderString to "檔案夾"

tell application "Finder"
    -- get number of open finder windows
    set NumberofFinders to count every Finder window
    
    -- if number of finder window is not 2, stop
    if NumberofFinders is not 2 then
        display notification "Please make sure only 2 Finder Windows are opened side-by-side."
        return
    end if
    
    -- begin determine the left finder window
    
    -- get 1st finder window
    set firstWindowPosition to (get the position of the first window)
    
    -- get ID of 2 finder windows
    set firstWindowID to (get the id of the first window)
    set secondWindowID to (get the id of the second window)
    
    -- determine if 1st finder window is the window on the left
    if item 1 of firstWindowPosition = 0 then
        set leftWindowID to firstWindowID
        set rightWindowID to secondWindowID
    else
        set leftWindowID to secondWindowID
        set rightWindowID to firstWindowID
    end if
    -- end determine the left finder window
    
    -- get the target
    try
        set theRightContainer to target of Finder window id rightWindowID
        my changeFolder(leftWindowID, rightWindowID, theRightContainer)
    on error
        set theSelectedItem to the selection as alias
        my changeFolder(leftWindowID, rightWindowID, theSelectedItem)
    end try
end tell

on changeFolder(windowToBeChangedID, windowWithTargetID, targetFolder)
    tell application "Finder"
        tell Finder window id windowWithTargetID to set tempLocation to targetFolder
        
        -- make the change happen
        set the target of Finder window id windowToBeChangedID to tempLocation
    end tell
end changeFolder

Alt-Right--make Window R = Window L.scpt

Bloc de code:
-- Need the localized version of the string "folder"
--set folderString to "檔案夾"

tell application "Finder"
    -- get number of open finder windows
    set NumberofFinders to count every Finder window
    
    -- if number of finder window is not 2, stop
    if NumberofFinders is not 2 then
        display notification "Please make sure only 2 Finder Windows are opened side-by-side."
        return
    end if
    
    -- begin determine the left finder window
    
    -- get 1st finder window
    set firstWindowPosition to (get the position of the first window)
    
    -- get ID of 2 finder windows
    set firstWindowID to (get the id of the first window)
    set secondWindowID to (get the id of the second window)
    
    -- determine if 1st finder window is the window on the left
    if item 1 of firstWindowPosition = 0 then
        set leftWindowID to firstWindowID
        set rightWindowID to secondWindowID
    else
        set leftWindowID to secondWindowID
        set rightWindowID to firstWindowID
    end if
    -- end determine the left finder window
    
    -- get the target
    try
        set theleftContainer to target of Finder window id leftWindowID
        my changeFolder(rightWindowID, leftWindowID, theleftContainer)
    on error
        set theSelectedItem to the selection as alias
        my changeFolder(rightWindowID, leftWindowID, theSelectedItem)
    end try
end tell

on changeFolder(windowToBeChangedID, windowWithTargetID, targetFolder)
    tell application "Finder"
        tell Finder window id windowWithTargetID to set tempLocation to targetFolder
        
        -- make the change happen
        set the target of Finder window id windowToBeChangedID to tempLocation
    end tell
end changeFolder

Alt-U--swap.scpt

Bloc de code:
tell application "Finder"
    
    -- get number of open finder windows
    set NumberofFinders to count every Finder window
    
    -- close all finders except the frontmost one
    if NumberofFinders is not 2 then
        display notification "Please make sure only 2 Finder Windows are opened side-by-side."
        return
    end if
    
    -- get location of the 2 finder windows   
    try
        tell Finder window 1
            set firstLocation to target
        end tell
        tell Finder window 2
            set secondLocation to target
        end tell
    end try
    
    -- make the exchange happen
    set the target of Finder window 1 to secondLocation
    set the target of Finder window 2 to firstLocation
end tell

Hyper-F--DualFinder.scpt

Bloc de code:
tell application id "sevs" to if not (UI elements enabled) is true then set UI elements enabled to true

tell application "Finder"
    
    -- get number of open finder windows
    set NumberofFinders to count every Finder window
    
    -- close all finders except the frontmost two
    if NumberofFinders is 0 then
        make Finder window
        make Finder window
        set the target of Finder window 1 to home
        set the target of Finder window 2 to home
    else if NumberofFinders is 1 then
        make Finder window
        set t to target of Finder window 2
        set the target of Finder window 1 to t
    else if NumberofFinders is greater than 2 then
        repeat NumberofFinders - 2 times
            close last Finder window
        end repeat
    end if
    
    -- get/set screen info
    set screenWidth to 1400
    set screenHeight to 900
    
    -- move finder and set the size & column view
    set the position of the front Finder window to {0, 0}
    set the bounds of the front Finder window to {0, 0, screenWidth * 0.5, screenHeight * 0.9}
    set the current view of front Finder window to column view
    set the sidebar width of front Finder window to 150
    
    -- position second finder & column view
    set the position of second Finder window to {screenWidth * 0.5, 0}
    set the bounds of second Finder window to {screenWidth * 0.5, 0, screenWidth, screenHeight * 0.9}
    set the current view of second Finder window to column view
    set the sidebar width of second Finder window to 100
    -- bring the finders to the front
    activate
    
end tell