macOS Ventura Comment créer un raccourci clavier pour activer la fonction "fn" ?

  • Créateur du sujet Membre supprimé 1198363
  • Date de début
M

Membre supprimé 1198363

Invité
Bonjour,

Est-ce qu'il et possible de créer un raccourci clavier pour activer la fonction "fn" ?

Merci d'avance.

a+
 

Fichiers joints

  • Capture d’écran 2023-03-03 à 15.35.01.png
    Capture d’écran 2023-03-03 à 15.35.01.png
    412,3 KB · Affichages: 49
Si vous voulez que cela soit permanent, activez l'option qu'on voit sur la capture.
Sinon, pour usage ponctuel, il suffit d'appuyer sur la touche "fn", non ?
 
  • J’aime
Réactions: Gerapp38
Tu as ce lien
Raccourcis clavier. Tu peux modifier le comportement en changeant l’affectation de tes touches
 
Si vous voulez que cela soit permanent, activez l'option qu'on voit sur la capture.
Sinon, pour usage ponctuel, il suffit d'appuyer sur la touche "fn", non ?
Je voudrais bien un raccourci pour l'activer ou le désactiver par le clavier sans allée à chaque fois dans les options :)
 
Tu as ce lien
Raccourcis clavier. Tu peux modifier le comportement en changeant l’affectation de tes touches
Merci pour le lien ;)

Mais Je voudrais bien un raccourci pour l'activer ou le désactiver par le clavier sans allée à chaque fois dans les options :)
 
Il n'y a pas besoin d'aller dans les options, il suffit d'appuyer sur la touche "fn" du clavier. Ou bien j'ai mal compris ta demande.
 
Je crois qu'il cherche un raccourci pour activer/désactiver la fonction sans aller dans les paramètres.
Une sorte de capslock de la touche fn.
 
Soit tu affectes une fonction à ta touche soit pas.
Dans tous les cas si tu fais un raccourci il ne sera activé que si tu tapes la commande du raccourci. Revient au même non ?

Question
créer un raccourci clavier pour activer la fonction "fn" ?
Quelle est cette fonction exactement ? Dit en plus. Je comprends que ta question est pas claire
 
Soit tu affectes une fonction à ta touche soit pas.
Dans tous les cas si tu fais un raccourci il ne sera activé que si tu tapes la commande du raccourci. Revient au même non ?

Question

Quelle est cette fonction exactement ? Dit en plus. Je comprends que ta question est pas claire
Ma question n'est pas claire ? pour tant @Karmalolo a bien compris ma question :)
Soit, tu affectes une fonction à ta touche, soit pas. Oui, mais comment on peut faire ça ?
Non cela ne revient pas au même, c'est simplement avoir un raccourci pour activer ou désactiver la fonction.
 
Rdv sur google. Ce genre de post hautain j’ai du mal.
 
  • J’aime
Réactions: LS Zaitsev
tu trouves un script qui permet de faire le toggle ici : https://www.reddit.com/r/shortcuts/...atic_fn_toggle_shortcut_for_mac_os_x_ventura/
Cependant je ne sais pas si tu peux associer une automation à un raccourci clavier.
Si ce n'est pas possible il faut passer par l'Editeur de Scripts

AppleScript:
tell application "System Events"
    tell application process "System Settings"
        get properties
        click menu item "Keyboard" of menu "View" of menu bar item "View" of menu bar 1
        
        get properties
        
        # Troubleshooting:
        # Problem: Can’t get window "Keyboard" of application process "System Preferences"
        # Solution: tweak the delay to a higher value
        delay 0.5
        
        set theCheckbox to checkbox "Use F1, F2, etc. keys as standard function keys" of group 2 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Keyboard"
        
        # Troubleshoot
        # Problem: Can’t get window "Keyboard" of application process "System Preferences"
        # Solution: fix the "click checkbox" using the exact text found in System Preferences -> Keyboard -> Keyboard (tab) for you MacOS version
        click theCheckbox
        
        tell theCheckbox
            if (its value as boolean) then
                return "FN Locked (special function keys activated)"
            else
                return "Using standard F1, F2, F3, F4, ..."
            end if
        end tell
    end tell
end tell
 
Rdv sur google. Ce genre de post hautain j’ai du mal.
Étant le seul à avoir mentionné Google, je le prends pour moi et présente mes excuses à Ledyvic si tant est qu’il se soit senti pris de haut. Il n’empêche qu’après une recherche et une question sur le présent forum, une recherche sur Google peut aussi s’avérer profitable… la preuve : je l’ai faite et lui ai proposé une solution que j’y ai trouvée !
 
tu trouves un script qui permet de faire le toggle ici : https://www.reddit.com/r/shortcuts/...atic_fn_toggle_shortcut_for_mac_os_x_ventura/
Cependant je ne sais pas si tu peux associer une automation à un raccourci clavier.
Si ce n'est pas possible il faut passer par l'Editeur de Scripts

AppleScript:
tell application "System Events"
    tell application process "System Settings"
        get properties
        click menu item "Keyboard" of menu "View" of menu bar item "View" of menu bar 1
       
        get properties
       
        # Troubleshooting:
        # Problem: Can’t get window "Keyboard" of application process "System Preferences"
        # Solution: tweak the delay to a higher value
        delay 0.5
       
        set theCheckbox to checkbox "Use F1, F2, etc. keys as standard function keys" of group 2 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Keyboard"
       
        # Troubleshoot
        # Problem: Can’t get window "Keyboard" of application process "System Preferences"
        # Solution: fix the "click checkbox" using the exact text found in System Preferences -> Keyboard -> Keyboard (tab) for you MacOS version
        click theCheckbox
       
        tell theCheckbox
            if (its value as boolean) then
                return "FN Locked (special function keys activated)"
            else
                return "Using standard F1, F2, F3, F4, ..."
            end if
        end tell
    end tell
end tell
Super merci pour ces deux :)
Si non pour le Script, il ce lance comment exactement ?
 
Avant de le lancer, j’ai l’impression qu’il faut l’adapter car dans Ventura le chemin pour récupérer l’état actuel de la fonction n’est pas aussi direct (j’ai l’impression que le script ne fait qu’ouvrir la fenêtre Clavier, alors que maintenant il y a une sous-fenêtre Raccourci clavier, puis une sorte d’onglet Touches de fonction…), et cela fait par ailleurs référence à une case à cliquer, alors que c’est un curseur qui est à modifier.
Mais ce n’est qu’une impression, et comme quand on arrive à déchiffrer quelques mots dans une langue étrangère, ce n’est pas pour autant que l’on peut parler ladite langue, je serais bien en peine de te donner les modifications à apporter. Il faut un spécialiste du Script qui connaisse de plus les menus de Ventura.
 
Avant de le lancer, j’ai l’impression qu’il faut l’adapter car dans Ventura le chemin pour récupérer l’état actuel de la fonction n’est pas aussi direct (j’ai l’impression que le script ne fait qu’ouvrir la fenêtre Clavier, alors que maintenant il y a une sous-fenêtre Raccourci clavier, puis une sorte d’onglet Touches de fonction…), et cela fait par ailleurs référence à une case à cliquer, alors que c’est un curseur qui est à modifier.
Mais ce n’est qu’une impression, et comme quand on arrive à déchiffrer quelques mots dans une langue étrangère, ce n’est pas pour autant que l’on peut parler ladite langue, je serais bien en peine de te donner les modifications à apporter. Il faut un spécialiste du Script qui connaisse de plus les menus de Ventura.
D'accord très bien merci ne m'avoir conseillé ;)
 
Bonjour,

Le script ci-dessus ne devrait fonctionner qu’avec l’OS Ventura. (je n’ai pas pu tester je ne possède pas ventura.)

-Créer le script
Ouvrir Editeur de script qui se trouve dans Application—>Utilitaires
Clic sur le bouton “Nouveau document” en bas à gauche
Dans la fenêtre qui s’ouvre faire un copier coller du script.
Faire “enregistrer sous” le nom, par exemple “Basculer FN”, format de fichier “Application”

cette nouvelle application se lance comme n’importe qu’ele application par un double clic.
Tu pourras la glisser dans ton dock et la lancer par un simple clic.

Lors du premier lancement, le système va te demander d'autoriser l'application dans les préférences sécurité et confidentialité.

sinon il y a celui là qui est donné pour fonctionner sur ventura et monterey (je n'ai pas testé)
Bloc de code:
-- Apple Script (i.e. Use in Apple's Script Editor Application) to Toggle Function Keys / Media keys on/off
-- Tested on MacOS Monterey (12.6.2) Dec 2022, MacOS Ventura (13.0.1) Dec 2022
-- Project Path: https://github.com/MrSimonC/Toggle-Mac-Function-Keys

set osver to system version of (system info)

if osver > 13.0 then
    open location "x-apple.systempreferences:com.apple.Keyboard-Settings.extension"
  
    tell application "System Events" to tell process "System Settings"
        # example window title: "Keyboard – 86%", so "begins with" is needed
        repeat until window begins with "Keyboard" exists
        end repeat
      
        # wait until Keyboard window is the main window of the application and is accessible
        repeat until exists of (1st window whose value of attribute "AXMain" is true)
        end repeat
      
        # wait until the group is displayed (needed else fails on Apple M2 Pro)
        repeat until exists group 1 of group 2 of splitter group 1 of group 1 of window 1
        end repeat
      
        # "Keyboard Shortcuts..." Button
        click button 1 of group 2 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window 1
      
        repeat until sheet 1 of window 1 exists
        end repeat
      
        # Click Function Keys
        keystroke "f"
      
        repeat until checkbox "Use F1, F2, etc. keys as standard function keys" of group 1 of scroll area 1 of group 2 of splitter group 1 of group 1 of sheet 1 of window 1 exists
        end repeat
      
        click checkbox "Use F1, F2, etc. keys as standard function keys" of group 1 of scroll area 1 of group 2 of splitter group 1 of group 1 of sheet 1 of window 1
      
        # "Done" Button - Close the sheet so the application can quit
        click button 1 of group 2 of splitter group 1 of group 1 of sheet 1 of window 1
      
        # Attempting to check the sheet at a certain point while closing will throw an error
        # In that case, the outer repeat will try again
        repeat
            try
                repeat while sheet 1 of window 1 exists
                end repeat
                exit repeat
            end try
        end repeat
    end tell
  
    tell application "System Settings" to quit
else
    -- Below for MacOS Monterey and below
    tell application "System Preferences"
        set current pane to pane "com.apple.preference.keyboard"
    end tell
  
    tell application "System Events"
        if UI elements enabled then
            tell application process "System Preferences"
                repeat until exists tab group 1 of window "Keyboard"
                    delay 0.5
                end repeat
                click radio button "Keyboard" of tab group 1 of window "Keyboard"
                try
                    click checkbox "Use F1, F2, etc. keys as standard function keys on external keyboards" of tab group 1 of window "Keyboard"
                end try
                try
                    click checkbox "Use F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard"
                end try
            end tell
            tell application "System Preferences" to quit
        else
            -- GUI scripting not enabled.  Display an alert
            tell application "System Preferences"
                activate
                set current pane to pane "com.apple.preference.security"
                display dialog "UI element scripting is not enabled. Please activate this app under Privacy -> Accessibility so it can access the settings it needs."
            end tell
        end if
    end tell
end if
 
Bonjour,

Le script ci-dessus ne devrait fonctionner qu’avec l’OS Ventura. (je n’ai pas pu tester je ne possède pas ventura.)

-Créer le script
Ouvrir Editeur de script qui se trouve dans Application—>Utilitaires
Clic sur le bouton “Nouveau document” en bas à gauche
Dans la fenêtre qui s’ouvre faire un copier coller du script.
Faire “enregistrer sous” le nom, par exemple “Basculer FN”, format de fichier “Application”

cette nouvelle application se lance comme n’importe qu’ele application par un double clic.
Tu pourra la glisser dans ton dock et la lancer par un simple clic.

Lors du premier lancement, le système va te demander d'autoriser l'application dans les préférences sécurité et confidentialité.

sinon il y a celui là qui est donné pour fonctionner sur ventura et monterey (je n'ai pas testé)
Bloc de code:
-- Apple Script (i.e. Use in Apple's Script Editor Application) to Toggle Function Keys / Media keys on/off
-- Tested on MacOS Monterey (12.6.2) Dec 2022, MacOS Ventura (13.0.1) Dec 2022
-- Project Path: https://github.com/MrSimonC/Toggle-Mac-Function-Keys

set osver to system version of (system info)

if osver > 13.0 then
    open location "x-apple.systempreferences:com.apple.Keyboard-Settings.extension"
  
    tell application "System Events" to tell process "System Settings"
        # example window title: "Keyboard – 86%", so "begins with" is needed
        repeat until window begins with "Keyboard" exists
        end repeat
      
        # wait until Keyboard window is the main window of the application and is accessible
        repeat until exists of (1st window whose value of attribute "AXMain" is true)
        end repeat
      
        # wait until the group is displayed (needed else fails on Apple M2 Pro)
        repeat until exists group 1 of group 2 of splitter group 1 of group 1 of window 1
        end repeat
      
        # "Keyboard Shortcuts..." Button
        click button 1 of group 2 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window 1
      
        repeat until sheet 1 of window 1 exists
        end repeat
      
        # Click Function Keys
        keystroke "f"
      
        repeat until checkbox "Use F1, F2, etc. keys as standard function keys" of group 1 of scroll area 1 of group 2 of splitter group 1 of group 1 of sheet 1 of window 1 exists
        end repeat
      
        click checkbox "Use F1, F2, etc. keys as standard function keys" of group 1 of scroll area 1 of group 2 of splitter group 1 of group 1 of sheet 1 of window 1
      
        # "Done" Button - Close the sheet so the application can quit
        click button 1 of group 2 of splitter group 1 of group 1 of sheet 1 of window 1
      
        # Attempting to check the sheet at a certain point while closing will throw an error
        # In that case, the outer repeat will try again
        repeat
            try
                repeat while sheet 1 of window 1 exists
                end repeat
                exit repeat
            end try
        end repeat
    end tell
  
    tell application "System Settings" to quit
else
    -- Below for MacOS Monterey and below
    tell application "System Preferences"
        set current pane to pane "com.apple.preference.keyboard"
    end tell
  
    tell application "System Events"
        if UI elements enabled then
            tell application process "System Preferences"
                repeat until exists tab group 1 of window "Keyboard"
                    delay 0.5
                end repeat
                click radio button "Keyboard" of tab group 1 of window "Keyboard"
                try
                    click checkbox "Use F1, F2, etc. keys as standard function keys on external keyboards" of tab group 1 of window "Keyboard"
                end try
                try
                    click checkbox "Use F1, F2, etc. keys as standard function keys" of tab group 1 of window "Keyboard"
                end try
            end tell
            tell application "System Preferences" to quit
        else
            -- GUI scripting not enabled.  Display an alert
            tell application "System Preferences"
                activate
                set current pane to pane "com.apple.preference.security"
                display dialog "UI element scripting is not enabled. Please activate this app under Privacy -> Accessibility so it can access the settings it needs."
            end tell
        end if
    end tell
end if
Merci pour ces infos ;)