Skip to content

Need help creating a new keymap #387

@svban

Description

@svban

I am on MacOs. I want to create a keymap, that on press

  1. If firefox not running -> open it.
  2. If firefox running, but not active -> activate it.
  3. If firefox running, and active -> cycle through all the open firefox windows.

I've tried implementing this with applescript, but it is not working with skhd for some reason. Only 1 and 2 is working, but 3 is not working for some reason.

skhdrc

alt - f : $HOME/firefox.sh

firefox.sh

osascript -e '
tell application "System Events" to set appList to name of processes
if "Firefox" is not in appList then
    do shell script "open -a Firefox"
else
    tell application "Firefox"
        if frontmost then
            tell application "System Events"
                keystroke "`" using {command down}
            end tell
        else
            activate
        end if
    end tell
end if'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions