#!/bin/sh # dash_places_menu.sh - a places openbox pipe menu # Copyright (C) 2010 John Crawley # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # version 2012/09/27 # NB The shell, not bash, is invoked in the hope that # dash will be used, as it is much faster. # Usage: add #
# to your .config/openbox/menu.xml # or, if you want the "recent files" menu incorporated at the top, use: # # make sure you have recently_opened_menu.sh somewhere, and enter its path below. # path to your "recent files" script, if you want to incorporate it: recent_script="$HOME"/scripts/recently_opened_menu.sh # Command to open folders at "Browse here..." - any file manager open_folder_cmd=thunar # Default command to open files with - others might be xdg-open, gnome-open, pcmanfm... default_open_cmd=exo-open # exo-open comes with thunar # Text editor of choice text_editor=geany # function to open files with default open command, or alternative command for certain files # - add other conditions to choice open_file() { [ -x "$1" ] && exec "$text_editor" "$1" # comment out this line if you don't want to edit executables instead of executing #[ -x "$1" ] && exec "terminator -e" "$1" # uncomment this and comment out previous line to run executables in terminal instead of editing [ "${1##*.}" = desktop ] && exec "$text_editor" "$1" # comment out this line if you don't want to edit .desktop files instead of executing exec "$default_open_cmd" "$1" # use default open command if above conditions not satisfied } # extra dotfiles to display in HOME folder (dotfiles are hidden by default) # edit the list (space separated, surrounded by single quotes) or comment this line out, to taste: shown_dotfiles='.config .local .Xdefaults .bash_aliases .bashrc .fonts.conf .gtkrc-2.0.mine .profile .xsession-errors' # By default, this script will display directories separately, before files. # To change this behaviour, see NOTE1, NOTE2 and NOTE3 below, near end of page. ####################################################################### case $1 in # if "--open" option is sent as $1, open file ($2) instead of generating menu --open) open_file "$2" echo "$0 : failed to open $2" >&2 exit;; # in case exec command fails # if "--recent" option is sent, incorporate "recent files" menu --recent) shift output='