Skip to content

Commit

Permalink
Add open-{directory,text-file}
Browse files Browse the repository at this point in the history
  • Loading branch information
za3k committed Jun 18, 2024
1 parent 89dce3e commit a04f803
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 0 deletions.
14 changes: 14 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
INSTALL=/usr/bin
open-directory-install:
sudo cp open-directory ${INSTALL}/open-directory
sudo cp open-directory.desktop /usr/local/share/applications/open-directory.desktop
xdg-mime default open-directory.desktop inode/directory
xdg-mime default open-directory.desktop application/x-directory
sudo xdg-mime default open-directory.desktop inode/directory
sudo xdg-mime default open-directory.desktop application/x-directory
sudo update-desktop-database
open-text-file-install:
sudo cp open-text-file ${INSTALL}/open-text-file
sudo cp open-text-file.desktop /usr/local/share/applications/open-text-file.desktop
xdg-mime default open-text-file.desktop text/plain
sudo xdg-mime default open-text-file.desktop text/plain
update-desktop-database
install:
find -executable -type f | sudo xargs cp -t ${INSTALL}
3 changes: 3 additions & 0 deletions open-directory
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/sh
cd $1
exec xterm
18 changes: 18 additions & 0 deletions open-directory.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Install:
# sudo cp open-directory /bin/open/directory
# sudo cp open-directory.desktop /usr/local/share/applications/open-directory.desktop
# xdg-mime default open-directory.desktop inode/directory
# xdg-mime default open-directory.desktop application/x-directory
# sudo update-desktop-database
# Test current default:
# xdg-mime query default inode/directory
# Verify this file:
# desktop-file-validate open-directory.desktop

[Desktop Entry]
Type=Application
Name=open folder in terminal

Exec=open-directory %f
# Uncomment and modify if open-directory is NOT in the system path
# Exec=xterm -e /home/zachary/.projects/short-programs/open-directory %f
10 changes: 10 additions & 0 deletions open-text-file
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
if [ -z "${EDITOR}" ]; then
for option in nano vim emacs vi less more; do
if [ -e /bin/$option ]; then
EDITOR=$option
break
fi
done
fi
exec xterm -e $EDITOR "$@"
6 changes: 6 additions & 0 deletions open-text-file.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
[Desktop Entry]
Type=Application
Name=edit text file in terminal
Exec=open-text-file %f
# Uncomment and modify if open-file is NOT in the system path
# Exec=/home/zachary/.projects/short-programs/open-text-file %f

0 comments on commit a04f803

Please sign in to comment.