Here’s one thing I find really useful – being able to get presets onto the current X clipboard(s) via a hotkey, for stuff like the current timestamp in different formats.
What you’ll need is "xsel" – just install it through aptitude (or your favorite package manager).
Once installed, you can then make a script like this:
#!/bin/bash # Display a menu like: # a - 20080715T025257 # b - 2008-07-15 @ 02:52:57 # c - 2008-07-15 # # Selection: a echo "a - $(date "+%Y%m%dT%H%M%S") b - $(date "+%F @ %H:%M:%S") c - $(date "+%F")" read -p "Selection: " selection case $selection in "a") # 20080715T030047 text=$(date "+%Y%m%dT%H%M%S") ;; "b") # 2008-07-15 @ 03:00:47 text=$(date "+%F @ %H:%M:%S") ;; "c") # 2008-07-15 text=$(date "+%F") ;; *) # 20080715T030047 text=$(date "+%Y%m%dT%H%M%S") ;; esac echo -n "$text"|xsel -p echo -n "$text"|xsel -b
And assign it to a hotkey via a command like:
xfce4-terminal -x [fullPathToScript]/getClipboardPresets.sh
Now just press your hotkey, hit [Enter] and you now have the current time in ISO 8601 format on your clipboard!
Oh, and you can also use xsel to do other things – like copying a file’s name / full path from your favorite file-manager’s context menu. For example, in Xubuntu (with Thunar) (you set this in "Edit → Configure custom actions…"):
Name: Copy _Full path # The "_" is for the key accelerator. Command: xfce4-terminal -x [fullPathToScript]/copyParm.sh %f -------- And -------- Name: Copy file _name Command: xfce4-terminal -x [fullPathToScript]/copyParm.sh %n # Don't forget to set the "Appearance Conditions" (tab) for all files!
#!/bin/sh echo -n $1|xsel -b
You should now be able to copy the file’s full path from the context menu – I find it very useful for getting the full path of a file for file uploads.
Now, it’d be even cooler if we can extend this with the history of the X clipboards – if anyone have an idea how I can do this, please drop me a comment! – Or more precisely, how to collect the history of the X clipboards for use.