Skip to content

Commit

Permalink
feat: add shortcut to open common folders
Browse files Browse the repository at this point in the history
  • Loading branch information
rgomezcasas committed Jul 24, 2023
1 parent 90a426b commit 31391e4
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
14 changes: 14 additions & 0 deletions os/mac/karabiner-elements/karabiner.json
Original file line number Diff line number Diff line change
Expand Up @@ -457,6 +457,20 @@
} ],
"type" : "basic"
} ]
}, {
"description" : "[script] Open common folders",
"manipulators" : [ {
"from" : {
"key_code" : "grave_accent_and_tilde",
"modifiers" : {
"mandatory" : [ "left_command", "left_control" ]
}
},
"to" : [ {
"shell_command" : "$HOME/.dotfiles/bin/sdot utils open_common_folder"
} ],
"type" : "basic"
} ]
}, {
"description" : "[chrome] Show recent tabs",
"manipulators" : [ {
Expand Down
3 changes: 3 additions & 0 deletions os/mac/karabiner-goku/karabiner.edn
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@
{:des "[script] Show desktop folder"
:rules [[:!CTOd "open \"$HOME/Desktop\""]]}

{:des "[script] Open common folders"
:rules [[:!CTgrave_accent_and_tilde "$HOME/.dotfiles/bin/sdot utils open_common_folder"]]}

;; ------------ Application specific ------------
{:des "[chrome] Show recent tabs"
:rules [:Chrome [:show-recent :!CTO1]]}
Expand Down
29 changes: 29 additions & 0 deletions scripts/utils/open_common_folder
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/usr/bin/env bash

set -euo pipefail

source "$DOTLY_PATH/scripts/core/_main.sh"

##? Open one common folder
#?? 1.0.0
##?
##? Usage:
##? open_common_folder
docs::parse "$@"

declare -A folders

folders=(
["⬇️ Downloads"]="$HOME/Downloads"
["🌅 Thumbnails"]="$GOOGLE_DRIVE_PATH/Shared drives/👑 Contents/🔖 Pro/Design/Thumbnails Cursos"
)

folder=$(printf "%s\n" "${!folders[@]}" | choose)

if [[ -n ${folders[$folder]} ]]; then
# Remove the emoji and space only when needed
folder_action=${folder#*" "}
open "${folders[$folder]}"
else
echo "No folder selected"
fi
5 changes: 5 additions & 0 deletions shell/exports.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# ------------------------------------------------------------------------------
# Private exports
# ------------------------------------------------------------------------------
. "$DOTFILES_PATH/modules/private/shell/exports.sh"

# ------------------------------------------------------------------------------
# Codely theme config
# ------------------------------------------------------------------------------
Expand Down

0 comments on commit 31391e4

Please sign in to comment.