Skip to content

Commit 6062403

Browse files
committed
version 0.9
1 parent 666f767 commit 6062403

18 files changed

Lines changed: 2853 additions & 2 deletions

README.md

Lines changed: 144 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,144 @@
1-
# softdrink
2-
A directory launcher/shortcut system for gnome+nautilus
1+
# SoftDrink
2+
A directory launcher/shortcut system for Linux desktops with GNOME Files (Nautilus) file manager (Ubuntu, Fedora etc)
3+
4+
5+
6+
<p align="center">
7+
<img width="200" height="200" src="images/ic_softdrink_689x.png", alt= "softdrink folder icon"/>
8+
9+
</p>
10+
11+
12+
13+
## What's with the name?
14+
softdrink is a wordplay on softlink, or a soft (symbolic) link
15+
16+
## What does it do?
17+
In some way it mimics the shortcuts available on Windows machine. Allows you to create shortcuts to directories. You double-click on the shortcut and that directory is opened in a file browser. The location bar shows the original path to the directory.
18+
19+
## Where can I place these 'shortcuts'?
20+
Wherever you want, as many as you want.
21+
No restrictions on placing them on the desktop or in any other directory.
22+
23+
## Why would I need this?
24+
To easily access related places from a folder. They work not just as a launcher, but also as handy bookmarks.
25+
26+
## How is this different from creating a soft link to target directory?
27+
In a way, softdrink is a dumbed down version of soft link.
28+
29+
Value of softlinks to directories ( `ln -s /path/to/direcotry`) cannot be overstated, and a linux user's life without them will be impossible.
30+
31+
However, a softlink changes the context and makes the target look like a member of the host directory. From a GUI users perspective, if you double-click a softlink icon in file browser, the opened window does not show the location of the target dir. Same about 'open terminal here' option in the target directory.
32+
33+
This hides the real directory structure of the system. You might think you are working in a subdirectory and end up changing something 'miles' away.
34+
35+
A lot of this and you forget what is where. A lot of differently named soft links end up targetting the same location.
36+
37+
I have been looking for a system that opens the directory and shows its real location on the disk. and eventually ended up making this.
38+
39+
40+
41+
## How is this different from creating a .desktop launcher?
42+
There was a time when .desktop launchers worked from any folder on your system and were widely used for this purpose. But this capability was removed due to the security risk inherent in launching random programs with a click. You can no more use them in Nautilus( Gnome Files) windows other than the desktop.
43+
44+
## Then, is this safe?
45+
Softdrink does not allow you to launch anything other than a directory.
46+
47+
## How is this implemented?
48+
We have a program called softdrink which handles a custom mime type called `x-jump` .
49+
A file of mime type x-jump is a text file with the extension `.jump`
50+
User creates a .jump file and puts the address to target location in it.
51+
When the system invokes softdrink to process this file, softdrink reads the path mentioned in it and launches it in file browser.
52+
53+
# How do I use it?
54+
1. In the file browser, go to the directory where you want to create a shortcut.
55+
56+
2. Create a text file
57+
58+
3. Open this text file in text editor and type in it the path to your target directory, say *~/disk2/backups/2022* ( just one line, nothing else )
59+
60+
4. Rename this text file with a descriptive name and change the extension to .jump. Say, *backup_lastyear.jump*
61+
62+
5. Double click on backup_lastyear.jump, the directory *~/disk2/backups/2022* will be opened in a new window.
63+
64+
**Alternatively, create the .jump file from the terminal** with the command : `echo "/path/to/your/directory">somename.jump`
65+
66+
67+
### Optional : Adding to right-click menu
68+
69+
place the file `assets/make_jumpfile.sh` in Nautilus script folder. This folder is usually located at `~/.local/share/nautilus/scripts`
70+
71+
72+
73+
74+
# How to Install :
75+
76+
1. Download softdrink tarball from the `Latest Release` page, extract the archive.
77+
78+
2. **cd to the directory **containing Makefile.am and configure.ac
79+
80+
3. Make sure autoconf, libtool, automake are installed.
81+
If not , install them using following command
82+
83+
For Ubuntu/Debian:
84+
85+
sudo apt install autoconf libtool automake
86+
87+
For Redhat/Fedora:
88+
89+
$ sudo dnf install autoconf libtool automake
90+
91+
4. ** Run the following commands**:
92+
93+
# These two needed only if you've cloned the repo
94+
# autoreconf -i
95+
# automake --add-missing
96+
97+
# Commands for everyone
98+
99+
./configure
100+
make
101+
102+
103+
5. **Install the software **
104+
105+
sudo make install
106+
107+
6. Once installed, you can delete the downloaded material
108+
109+
110+
# How to Uninstall :
111+
112+
1. Follow steps 1 to 4 in installation
113+
2. **Uninstall the software**
114+
115+
sudo make uninstall
116+
117+
118+
119+
## Tested On
120+
121+
- Ubuntu 20.04
122+
- Ubuntu 23.04
123+
- Fedora Linux 35 (Workstation Edition)
124+
125+
## Limitations:
126+
1. Strictly GUI. Useless in terminal. Though you can still peek into them with a `cat`, which is quite useful as a bookmark.
127+
2. No drag and drop support
128+
129+
130+
## License :
131+
softdrink is released under the MIT License.
132+
133+
134+
--------------------
135+
136+
### Copyright : © Rahul Singh
137+
138+
139+
140+
141+
142+
143+
144+

images/ic_softdrink_689x.png

159 KB
Loading

softdrink_code/Makefile.am

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
2+
# ####################################################
3+
# Author : Rahul Singh
4+
# URL : https://github.com/codecliff/softdrink
5+
# License : MIT
6+
# email : codecliff@users.noreply.github.com
7+
# Disclaimer: No warranties, stated or implied.
8+
# Description :
9+
# This File is part of softdrink project
10+
# A personal attempt to create directory shortcuts
11+
# for Gnome and Nautilus file browser
12+
# (Acknowledgment: This project has heavily used LLMs
13+
# viz. Phind, Bard and ChatGPT )
14+
# #####################################################
15+
16+
# #####################################################
17+
# Start development build with this file
18+
# Not needed for install
19+
# Version number update to be done in configure.ac
20+
# #####################################################
21+
22+
23+
24+
# SHELL = /bin/bash
25+
SUBDIRS = src
26+
27+
EXTRA_DIST = assets
28+
29+
AUTOMAKE_OPTIONS = foreign
30+
31+
32+
# in if - else, use \ as make takes each line as separate command
33+
# indents are very important for scoping
34+
# use double $$ for shell variables
35+
# also, no comments inside the hook
36+
# target rah_os_dep_target is run conditional on os type
37+
38+
39+
###### Prepare different stuff for Ubuntu vs others #########
40+
# OS (Ubuntu / Fedora Linux etc)
41+
RAH_OS = $(shell grep -oP '^NAME.\"\K.*(?=\")' /etc/os-release)
42+
43+
# Demarcate diferent targets for different OSs
44+
rah_os_dep_target = $(if $(filter Ubuntu,$(RAH_OS)),rah_ubuntu_hook,rah_nonubuntu_hook)
45+
46+
47+
48+
# Define os-specific parts
49+
rah_ubuntu_hook:
50+
@echo "OS is Ubuntu"
51+
@echo "Installing custom mime for all users"
52+
sudo cp ./assets/application-x-jump_ubuntu.xml /usr/share/mime/packages/application-x-jump.xml
53+
sudo update-icon-caches /usr/share/icons
54+
sudo update-icon-caches /usr/share/icons/hicolor
55+
56+
rah_nonubuntu_hook:
57+
@echo "OS Not Ubuntu"
58+
sudo cp ./assets/application-x-jump_others.xml /usr/share/mime/packages/application-x-jump.xml
59+
@echo " Resorting to gtk-update-icon-cache \n"
60+
sudo gtk-update-icon-cache -tf /usr/share/icons
61+
sudo gtk-update-icon-cache -tf /usr/share/icons/hicolor
62+
63+
64+
# to call these parts, run this
65+
rah_conditional_hook: $(rah_os_dep_target)
66+
67+
################## Installation ########################
68+
install-exec-hook:
69+
@echo "Going to install custom mime and icons for all users"
70+
@echo "Installing .desktop file for all users"
71+
sudo cp ./assets/softdrink.desktop /usr/share/applications/
72+
sudo chmod 755 /usr/share/applications/softdrink.desktop
73+
74+
@echo "Installing icon for all users"
75+
sudo cp ./assets/softdrink.svg /usr/share/icons/softdrink.svg
76+
sudo chmod 644 /usr/share/icons/softdrink.svg
77+
sudo cp ./assets/softdrink.png /usr/share/icons/softdrink.png
78+
sudo chmod 644 /usr/share/icons/softdrink.png
79+
80+
sudo cp ./assets/softdrink.svg /usr/share/icons/hicolor/scalable/mimetypes/application-x-jump.svg
81+
sudo chmod 644 /usr/share/icons/hicolor/scalable/mimetypes/application-x-jump.svg
82+
83+
$(MAKE) rah_conditional_hook
84+
85+
@echo "Updating mime and desktop databases etc:"
86+
sudo update-mime-database /usr/share/mime
87+
sudo update-desktop-database /usr/share/applications
88+
89+
@echo "Done with install-exec-hook"
90+
91+
92+
93+
################## Unisntallation ########################
94+
uninstall-hook:
95+
96+
@echo "Removing custom mime for all users"
97+
98+
sudo rm -f /usr/share/mime/packages/application-x-jump.xml
99+
sudo rm -f /usr/share/mime/application/x-jump.xml
100+
101+
@echo "Removing softdrink.desktop file for all users"
102+
sudo rm -f /usr/share/applications/softdrink.desktop
103+
104+
@echo "Removing scalable icon for all users"
105+
sudo rm -f /usr/share/icons/softdrink.svg
106+
sudo rm -f /usr/share/icons/softdrink.png
107+
sudo rm -f /usr/share/icons/hicolor/scalable/mimetypes/application-x-jump.svg
108+
109+
@echo "Updating mime databases etc:"
110+
sudo update-mime-database /usr/share/mime
111+
sudo update-desktop-database /usr/share/applications
112+
113+
sudo update-icon-caches /usr/share/icons
114+
@if [ $$? -ne 0 ]; then \
115+
@echo " Resorting to gtk-update-icon-cache \n;" \
116+
sudo gtk-update-icon-cache -tf /usr/share/icons; \
117+
sudo gtk-update-icon-cache -tf /usr/share/icons/hicolor; \
118+
fi
119+
120+
@echo "Done with uninstall-hook"
121+
122+
123+
124+
125+
126+
127+
128+

0 commit comments

Comments
 (0)