summaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
authorBenjamin Chausse <benjamin@chausse.xyz>2024-08-14 13:53:40 -0400
committerBenjamin Chausse <benjamin@chausse.xyz>2024-08-14 13:53:40 -0400
commitc11902297e26f44a75f090d127138082bdca55f0 (patch)
tree33d67c8240f5b22c8aeb29b55fe54e13a39ea67f /.local/bin
parentf9a00a7961bc1ea850a21ebe70363da86a6aebdb (diff)
Auto-Generate gtk file manager shortcuts
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/shortcutgen16
1 files changed, 13 insertions, 3 deletions
diff --git a/.local/bin/shortcutgen b/.local/bin/shortcutgen
index 3f26e99..297eb5c 100755
--- a/.local/bin/shortcutgen
+++ b/.local/bin/shortcutgen
@@ -5,9 +5,10 @@
# If you do not want to create a specific file, replace it's variable with /dev/null
awk -v lf_filepath="${XDG_CONFIG_HOME:-$HOME/.config}/lf/shortcuts" \
- -v zsh_filepath="${XDG_CACHE_HOME:-$HOME/.cache}/zsh-shortcuts" \
- -v env_filepath="${XDG_CACHE_HOME:-$HOME/.cache}/env-shortcuts" \
-'
+ -v gtk_filepath="${XDG_CONFIG_HOME:-$HOME/.config}/gtk-3.0/bookmarks" \
+ -v zsh_filepath="${XDG_CACHE_HOME:-$HOME/.cache}/zsh-shortcuts" \
+ -v env_filepath="${XDG_CACHE_HOME:-$HOME/.cache}/env-shortcuts" \
+ '
BEGIN {
FS=","
OFS=","
@@ -19,6 +20,12 @@ function remove_whitespace(str) {
return str
}
+# Function to expand ~ into full path (ex: /home/...)
+function fullpath(str) {
+ gsub(/~\//, ENVIRON["HOME"] "/", str)
+ return str
+}
+
{
# Remove comments
gsub(/#.*/, "")
@@ -50,6 +57,9 @@ function remove_whitespace(str) {
# Write to $XDG_CACHE_HOME/env-shortcuts
print "export G" uc_col2 "=" $3 "" > env_filepath
+
+ # Write to $XDG_CONFIG_HOME/gtk-3.0/bookmarks
+ print "file://" fullpath($3) > gtk_filepath
}
}
' "$src"