Skip to content

Commit

Permalink
Add command to assign application to all desktops
Browse files Browse the repository at this point in the history
  • Loading branch information
norm committed Sep 14, 2021
1 parent c1042db commit c944209
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
4 changes: 4 additions & 0 deletions documentation/kitfile.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,10 @@ Available commands are:

Creates a symbolic link at _DESTINATION_ that points to _SOURCE_.

* assign\_all _APPLICATION_

Sets _APPLICATION_ to be available on all desktops.

* start _APPLICATION_

Starts _APPLICATION_ in the background to stop it from stealing focus
Expand Down
14 changes: 14 additions & 0 deletions kitout.sh
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ function process_kitfile {
symlink) symlink $argument ;;
start) start "$argument" ;;
remind) remind "$argument" ;;
assign_all) assign_all $argument ;;
brew_update) brew_update ;;

cron_entry) add_to_crontab "$argument" ;;
Expand Down Expand Up @@ -313,6 +314,19 @@ function start {
open -g -a "$*"
}

function assign_all {
action "assigning '$*' to all Desktops"
osascript << EOF >/dev/null
tell application "System Events"
tell UI element "$*" of list 1 of process "Dock"
perform action "AXShowMenu"
click menu item "Options" of menu 1
click menu item "All Desktops" of menu 1 of menu item "Options" of menu 1
end tell
end tell
EOF
}

function brew_update {
action 'updating homebrew'
brew update
Expand Down

0 comments on commit c944209

Please sign in to comment.