LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Desktop (https://www.linuxquestions.org/questions/linux-desktop-74/)
-   -   Flubox keys tutorial (https://www.linuxquestions.org/questions/linux-desktop-74/flubox-keys-tutorial-880599/)

teckk 05-13-2011 03:39 PM

Flubox keys tutorial
 
If you are a fluxbox user, don't like automounting, like speeding up tasks, don't like giving users acces to devices or drives unless they are specified in sudoers.......

The ~/.fluxbox/keys allows you to map keyboard buttons to actions. Whether it's launcing applications, mounting drives, etc. That's up to you.

Here are some addtions to your ~/.fluxbox/keys config file that will make working with usb drives, opening applications, showing the desktop, getting the root menu without a mouse, restarting a moused after it dying after a sleep etc. that can be handy. Edit as you see fit. Use your own paths, interfaces, and devices.

Some users also are on older machines and don't want to run heavy DE's. Fluxbox is good for PII and PIII machines even. This will make Flux mount and open easily.

Some of these are FreeBSD specific. Use Linux sytax, device nodes, and paths if you use Linux. Xterm is in all ditros and BSD's.

Code:

# my additions
# Open rox
Mod4 r :Exec rox

# Open rox as Root
Control Mod4 r :Exec xterm +sb -T "Rox as Root" -g 40x10 -bg red -fg white -e sudo rox -n

# Open thunar
Mod4 e :Exec thunar

# Open thuar as Root
Control Mod4 e :Exec xterm +sb -T "Thunar as Root" -g 40x10 -bg red -fg white -e sudo thunar

# Open gedit -- use your own favorite editor
Mod4 g :Exec gedit

# Open gedit as Root
Control Mod4 g :Exec xterm +sb -T "Gedit as Root" -g 40x10 -bg red -fg white -e sudo gedit

# Open xterm  -- rxvt -- mrxvt -- aterm
Mod4 x :Exec xterm

# Put machine to sleep -- acpi has to working on your box
Mod4 s :Exec xterm +sb -T Sleep -g 40x10 -bg yellow -fg black -e sudo acpiconf -s3

# Shutdown -- see xrun.sh -- use BSD or Linux syntax
Mod4 o :Exec xterm +sb -T Shutdown -g 40x10 -bg red1 -fg white -e sudo /path/to/xrun.sh "shutdown -p now"

# Mount USB drive FAT -- Use Linux device nodes for Linux --mount -t vfat
Mod4 m :Exec xterm +sb -T "USB drive mount" -g 40x10 -bg blue -fg white -e sudo mount -t msdosfs /dev/da0s1 /home/username/usb

# Mount USB drive NTFS --requires ntfs-3g
Mod4 n :Exec xterm +sb -T "USB drive mount" -g 40x10 -bg blue -fg white -e sudo ntfs-3g /dev/da0s1 /home/username/usb

# Unmount USB drive -- unmount where you mounted it to
Mod4 u :Exec xterm +sb -T "USB drive UnMount" -g 40x10 -bg blue -fg white -e sudo umount /home/username/usb

# Open applications quickly
Mod4 t :Exec thunderbird
Mod4 f :Exec firefox3

# Minimizes all windows to panel -- do it again and they come back
Mod4 d :ShowDesktop

# Stop the network interface fast
Mod4 i :Exec xterm +sb -T "Network Down" -g 40x10 -bg blue -fg white -e sudo ifconfig dc0 down

# Bring it back up
Control Mod4 i :Exec xterm +sb -T "Network Up" -g 40x10 -bg blue -fg white -e sudo ifconfig dc0 up

# Restart the mouse demon --FreeBSD demon
Mod4 z :Exec xterm +sb -T "Restart Mouse" -g 40x10 -bg yellow -fg black -e sudo /etc/rc.d moused restart

# Opens the root menu -- navigate with arrow keys
Control Escape :RootMenu

xrun.sh -- don't forget to make it executable.

Code:

#!/bin/sh

$@
/bin/sh

I hope that this was of some use to someone.

PhoenixAndThor 05-13-2011 06:32 PM

Nice keybindings! The only thing that I'd need to adjust (in my opinion) is the keys for mounting drives and managing power states (shutdown, suspend, etc). I don't really use Fluxbox anymore, but the same keybindings could potentially be applied to nearly any other window manager that supports defining custom keybindings. I also agree that running a full DE could be problematic.

One my HP Mini, I use Xfce and Echinus (tiling WM, partially EWMH compliant), but this is only because I am in college and don't really have that much time to mess around with scripting my environment using dzen, conky, and whatever I can think of for a system tray.

frankbell 05-13-2011 09:54 PM

One of the features I've come to like most about Fluxbox is the keybindings.

I learned how to do them from a podcast by Klaatu. I think it was episode 5x03 at this link. It's a nice audio tutorial.


All times are GMT -5. The time now is 06:30 PM.