Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Fedora Resources > Guides & Solutions (No Questions)
FedoraForum Search

Forgot Password? Join Us!

Guides & Solutions (No Questions) Post your guides here (No links to Blogs accepted). You can also append your comments/questions to a guide, but don't start a new thread to ask a question. Use another forum for that.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 11th September 2010, 05:19 PM
bonedome Offline
Registered User
 
Join Date: Apr 2010
Location: uk
Posts: 727
linuxfirefox
How to fluxbox window manager

Hello
many of you may have heard of fluxbox and maybe even used it, if you did you will have noticed a very quick but extremely sparse window manager and probably decided it wasn't for you due to lack of features.
I'll show you how to quickly and easily give fluxbox all the features of your desktop.
To install fluxbox
Code:
yum install fluxbox
It's installed size is just 3.1Mb.
the default menu in fluxbox is almost non existent (about 3 entries) so before you try it you'll want a more useful menu, so open your file manager and click on view > view hidden files there should be a file .fluxbox if not just create one
Code:
mkdir .fluxbox
in it create a file called menu
Code:
gedit .fluxbox/menu
copy and paste this into it
Code:
[begin] (Fluxbox)
   [exec] (Firefox) {firefox}
   [exec] (Terminal) {gnome-terminal}
   [exec] (Thunar) {thunar}
   [exec] (Nautilus) {nautilus --no-desktop --browser}
   [exec] (Calculator) {/usr/bin/gcalctool}
   [exec] (Rhythmbox) {/usr/bin/rhythmbox}
   [exec] (Updates) {gpk-update-viewer}
   [exec] (Pidgin) {pidgin}
   [exec] (VLC) {/usr/bin/vlc}
   [exec] (Totem) {totem}
   [exec] (Software) {/usr/bin/gpk-application}
   [separator]
   [submenu] (Apps) {}
      [submenu] (Editors) {}
         [exec] (AbiWord) {/usr/bin/abiword}
         [exec] (Evince) {evince}
         [exec] (Gedit) {/usr/bin/gedit}
         [exec] (Nano) {gnome-terminal -e nano}
         [exec] (Vim) {gnome-terminal -e vi}
#         [exec] (OpenOffice Writer) {/usr/bin/oowriter}
      [end]
      [submenu] (Graphics) {}
         [exec] (Gnome Screenshot Tool) {/usr/bin/gnome-panel-screenshot}
#         [exec] (The GIMP) {/usr/bin/gimp}
         [exec] (Gthumb Image Viewer) {gthumb}
#         [exec] (xsane) {/usr/bin/xsane}
      [end]
      [submenu] (Sound & Video) {}
         [exec] (Gnome Baker) {/usr/bin/gnomebaker}
         [exec] (Brasero) {/usr/bin/brasero}
         [exec] (Totem) {/usr/bin/totem}
         [exec] (Devede) {/usr/bin/devede}
         [exec] (Avidemux) {avidemux2_qt4}
         [exec] (Dvdisaster) {dvdisaster}
         [exec] (Gnome Mplayer) {/usr/bin/gnome-mplayer}
         [exec] (Rhythmbox) {/usr/bin/rhythmbox}
         [exec] (Audio converter) {/usr/bin/audio-convert-mod}
         [exec] (DVD::Rip) {/usr/bin/dvdrip}
         [exec] (VLC) {/usr/bin/vlc}
         [exec] (Xfburn) {/usr/bin/xfburn}
         [exec] (Handbrake) {ghb}
         [exec] (CD Extractor) {/usr/bin/sound-juicer}
         [exec] (Record Audio) {gnome-sound-recorder}
         [exec] (Pulse EQ) {pulseaudio-equalizer-gtk}
      [end]
#      [submenu] (Maths) {}
#         [exec] (Calculator) {/usr/bin/gcalctool}
#         [exec] (OpenOffice.org Calc) {/usr/bin/oocalc}
#         [exec] (OpenOffice.org Math) {/usr/bin/oomath}
      [end]
      [submenu] (Net) {}
         [exec] (Wireshark) {wireshark}
         [exec] (Mediatomb) {gnome-terminal -e mediatomb}
         [exec] (Google Chrome) {google-chrome}
         [exec] (Firefox) {firefox}
         [exec] (Pidgin) {pidgin}
         [exec] (Skype) {/usr/bin/skype}
         [exec] (ps3-MediaServer) {~/src/ps3-mediaserver/pms-linux-1.10.5/PMS.sh}
         [exec] (Transmission) {transmission}
         [exec] (Ekiga) {usr/bin/ekiga}
     [end]
      [submenu] (Development) {}
         [exec] (Devhelp) {/usr/bin/devhelp}
         [exec] (Qt4) {designer-qt4}
      [end]
      [submenu] (Shells) {}
         [exec] (Eterm) {Eterm} <>
         [exec] (Gnome Terminal) {/usr/bin/gnome-terminal}
#         [exec] (rxvt Terminal) {/usr/bin/rxvt)
#         [exec] (rxvt-unicode) {/usr/bin/urxvt}
         [exec] (XTerm) {xterm} <>
#         [exec] (Bash) { x-terminal-emulator -T "Bash" -e /bin/bash --login} <>
#         [exec] (Dash) { x-terminal-emulator -T "Dash" -e /bin/dash -i} <>
#         [exec] (Sh) { x-terminal-emulator -T "Sh" -e /bin/sh --login} <>
      [end]
      [submenu] (System) {}
         [exec] (Gnome Control Center) {gnome-control-center}
         [exec] (Live usb Creator) {liveusb-creator}
         [exec] (Unetbootin) {/usr/bin/unetbootin}
         [exec] (Mediatomb) {gnome-terminal -e mediatomb}
         [exec] (Avast) {avastgui}
         [exec] (System Monitor) {/usr/bin/gnome-system-monitor} 
         [exec] (Gstreamer) {gstreamer-properties}
         [exec] (Display) {/usr/bin/display}
         [exec] (Dictionary) {gnome-dictionary} 
         [exec] (conky) {conky}
         [exec] (top) {gnome-terminal -e top}
         [exec] (Package Manager) {gpk-application}
         [exec] (Updates) {gpk-update-viewer}
         [exec] (Services) {system-config-services}
         [exec] (Users) {system-config-users}
         [exec] (Network) {system-config-network}
         [exec] (Firewall) {system-config-firewall}
         [exec] (LVM) {system-config-lvm}
         [exec] (Gparted) {gparted}
         [exec] (Bluetooth Wizard) {bluetooth-wizard}
         [exec] (Bluetooth) {bluetooth-properties}
         [exec] (Hard Disc Check) {/usr/bin/palimpsest} 
         [exec] (Data Recovery) {gnome-terminal -e testdisk} 
         [exec] (Printer) {system-config-printer}
         [exec] (Vinagre) {vinagre}
         [exec] (Archiver) {file-roller}
         [exec] (Xarchiver) {xarchiver}
         [exec] (ABRT) {abrt-gui}
         [exec] (Screensaver) {gnome-screensaver-preferences)
      [end]
      [submenu] (Text) {}
         [exec] (Dictionary) {/usr/bin/gnome-dictionary}
         [exec] (Characters) {gucharmap}
         [exec] (Notebook) {gnote}
      [end]
      [submenu] (Viewers) {}
         [exec] (Evince) {/usr/bin/evince}
         [exec] (Abiword) {abiword}
         [exec] (GThumb Image Viewer) {/usr/bin/gthumb}
         [exec] (Gnome Image Viewer) {/usr/bin/eog}
         [exec] (Screenshot) {gnome-screenshot}
         [exec] (Shotwell) {shotwell}
         [exec] (Fotoxx) {fotoxx}
         [exec] (ImageMagick) {gnome-terminal -e display}
[end]
   [end]
   [submenu] (Games) {}
     [exec] (connect 4) {gnect}
     [exec] (Shippy) {/usr/bin/shippy-sdl}
     [exec] (Solitare) {/usr/bin/sol}
     [exec] (Glaxium) {/usr/bin/glaxium}
     [exec] (Mines) {/usr/bin/gnomine}
     [exec] (Blackjack) {blackjack}
     [exec] (5 or More) {glines}
     [exec] (Astromenace) {astromenace}
     [exec] (Space Sim) {celestia}
   [end]
   [submenu] (Fluxbox)
   [config] (Configuration)
   [submenu] (Styles) {}
      [stylesdir] (/usr/share/fluxbox/styles)
#      [stylesdir] (~/.fluxbox/styles)
   [end]
   [submenu] (Backgrounds)
      [submenu] (Wallpaper)
      [wallpapers] (~/Wallpaper)
     [end]
   [end]
   [workspaces] (Workspaces)
   [exec] (Fbrun) {/usr/bin/fbrun}
   [restart] (Restart)
   [end] 
#   [reconfig] (Reconfigure)
   [exec] (Lock Screen) {xlock -mode blank}
   [exec] (Reboot) {/usr/bin/reboot}
   [exec] (Shutdown) {poweroff}
   [exit] (Logout)
[end]
One of fluxox's biggest assets is the menu is completely configurable, so don't worry if there's stuff in here that you don't have or missing entries, you will now need to logout, when you log back in there will be a panel at the bottom of the gdm with sessions just click on fluxbox.
Notice how quick it started
fluxbox uses a right click menu, so give it a try and scroll down to fluxbox > styles and choose one you like.
You'll notice this line in the menu [wallpapers] (~/Wallpaper) you can set this to whatever directory you want

I think fluxbox is great for laptops running on battery power, only problem is an xorg update broke mousepad tapping and scrolling, if this doesn't work for you copy and paste this into your .fluxbox/startup file
Code:
# fluxbox startup-script:
#
# Lines starting with a '#' are ignored.

# You can set your favourite wallpaper here if you don't want
# to do it from your style.
#
# fbsetbg -f ~/pictures/wallpaper.png
#
# This sets a black background

/usr/bin/fbsetroot -solid black

# This shows the fluxbox-splash-screen
# fbsetbg -C /usr/share/fluxbox/splash.jpg

# Other examples. Check man xset for details.
#
# Turn off beeps:
# xset -b
#
# Increase the keyboard repeat-rate:
# xset r rate 195 35
#
# Your own fonts-dir:
# xset +fp "~/.fonts"
#
# Your favourite mouse cursor:
# xsetroot -cursor_name right_ptr
#
# Change your keymap:
# xmodmap "~/.Xmodmap"



# Applications you want to run with fluxbox.
# MAKE SURE THAT APPS THAT KEEP RUNNING HAVE AN ''&'' AT THE END.
#
# unclutter -idle 2 &
# wmnd &
# wmsmixer -w &
# idesk &

# And last but not least we start fluxbox.
# Because it is the last app you have to run it with ''exec'' before it.

conky & gnome-volume-control-applet & nm-applet & gnome-power-manager &  synclient TapButton1=1 & synclient VertEdgeScroll=1 & /usr/libexec/polkit-gnome-authentication-agent-1 & exec /usr/bin/fluxbox
# or if you want to keep a log:
# exec /usr/bin/fluxbox -log "~/.fluxbox/log"
you'll notice at the bottom I have conky, volume control, battery monitor and network manager running at start up, anything you don't want just delete.
As there's a limit to post sizes I'll continue in another post
__________________
fedora 14 fluxbox and gnome2 hp compaq nx9030 laptop 2Gb ram, helicopter landing pad, jacuzzi, mini fridge, gateway to alternative dimension

Last edited by bonedome; 25th June 2011 at 10:40 AM.
Reply With Quote
  #2  
Old 11th September 2010, 05:39 PM
bonedome Offline
Registered User
 
Join Date: Apr 2010
Location: uk
Posts: 727
linuxfirefox
Re: How to fluxbox window manager

As I said before fluxbox is totally configurable, this includes keyboard shortcuts, here's mine, it goes in .fluxbox/keys
Code:
!mouse actions added by fluxbox-update_configs
OnTitlebar Mouse2 :StartTabbing

!mouse actions added by fluxbox-update_configs
OnTitlebar Double Mouse1 :MaximizeWindow
OnTitlebar Mouse3 :WindowMenu

!mouse actions added by fluxbox-update_configs
OnWindow Mod1 Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}
OnWindow Mod1 Mouse3 :MacroCmd {Raise} {Focus} {StartResizing BottomRight}

!mouse actions added by fluxbox-update_configs
OnToolbar Mouse5 :NextWorkspace
OnToolbar Mouse4 :PrevWorkspace

!mouse actions added by fluxbox-update_configs
OnDesktop Mouse1 :hideMenus
OnDesktop Mouse2 :workspaceMenu
OnDesktop Mouse3 :rootMenu
#OnDesktop Mouse4 :nextWorkspace
#OnDesktop Mouse5 :prevWorkspace

Mod1 Tab :NextWindow
Mod1 Shift Tab :PrevWindow
Mod1 F1 :Exec firefox
Mod1 F2 :Exec gnome-terminal
Mod1 F3 :Exec thunar
Mod1 F4 :Exec nautilus --no-desktop --browser
Mod1 F5 :Exec gcalctool
Mod1 F6 :Exec audio-convert-mod
Mod1 F7 :Exec conky
Mod1 F8 :exit Exit
Mod1 F9 :Workspace 1
Mod1 F10 :Workspace 2
Mod1 F11 :Workspace 3
Mod1 F12 :Exec poweroff 
Mod1 Up :NextWorkspace
Mod1 Down :PrevWorkspace
#Mod1 Up :RootMenu
#Mod1 Down :ShowDesktop
Mod1 Control Down :Minimize
Print :Exec gnome-screenshot
Mod4 f :Exec firefox
Mod4 t :Exec thunar
Mod4 g :Exec gnome-terminal
Mod4 s :Exec sol
Mod4 w :Exec gdesklets
Mod4 e :exit Exit
Mod4 c :Close
Mod4 u :Exec gpk-update-viewer
Mod4 v :Exec vlc
Mod4 n :Exec nautilus --no-desktop --browser
Mod4 r :Restart
Mod4 m :MaximizeWindow
Mod4 Mod1 s :Exec poweroff
Mod4 Mod1 r :reboot
Mod4 Mod1 c :CloseAllWindows
Mod4 Mod1 Down :MoveDown 25
Mod4 Mod1 Up :MoveUp 25 
Mod4 Mod1 Left :MoveLeft 50
Mod4 Mod1 Right :MoveRight 50
Mod4 a :Exec gpk-application
Menu :ToggleCmd {RootMenu} {hideMenus}
Mod4 Right :NextWorkspace
Mod4 Left :PrevWorkspace
Sometimes it's hard to find some background to right click on for a menu so I have set the menu button (funnily enough) for that, It's the one next to alt gr
For reference Mod4 is the windows button Mod1 is alt, to find the names of keyboard buttons type xev then the key you want

If you have a problem with font sizes or background, paste this into .fluxbox/overlay
Code:
! The following line will prevent styles from setting the background.
 background: none
menu.frame.font:
menu.title.font: Bitstream Vera Sans-12
toolbar.clock.font: Bitstream Vera Sans-12
toolbar.workspace.font: Bitstream Vera Sans-12
toolbar.iconbar.focused.font: Bitstream Vera Sans-12
toolbar.iconbar.unfocused.font: Bitstream Vera Sans-12
window.font: Bitstream Vera Sans-12
you shouldn't need it but here's my .fluxbox/init
Code:
session.screen0.window.focus.alpha:	255
session.screen0.window.unfocus.alpha:	255
session.screen0.titlebar.left:	Stick 
session.screen0.titlebar.right:	Minimize Maximize Close 
session.screen0.iconbar.deiconifyMode:	Follow
session.screen0.iconbar.mode:	Workspace
session.screen0.iconbar.wheelMode:	Screen
session.screen0.iconbar.usePixmap:	true
session.screen0.iconbar.iconWidth:	70
session.screen0.iconbar.alignment:	Relative
session.screen0.iconbar.iconTextPadding:	10l
session.screen0.clientMenu.usePixmap:	true
session.screen0.tabs.intitlebar:	true
session.screen0.tabs.maxOver:	false
session.screen0.tabs.usePixmap:	true
session.screen0.overlay.lineWidth:	1
session.screen0.overlay.lineStyle:	LineSolid
session.screen0.overlay.joinStyle:	JoinMiter
session.screen0.overlay.capStyle:	CapNotLast
session.screen0.menu.alpha:	255
session.screen0.tab.width:	64
session.screen0.tab.height:	16
session.screen0.tab.alignment:	Left
session.screen0.tab.rotatevertical:	True
session.screen0.tab.placement:	TopLeft
session.screen0.toolbar.onhead:	0
session.screen0.toolbar.tools:	workspacename, iconbar, systemtray, clock
session.screen0.toolbar.onTop:	False
session.screen0.toolbar.widthPercent:	90
session.screen0.toolbar.visible:	true
session.screen0.toolbar.height:	0
session.screen0.toolbar.autoHide:	false
session.screen0.toolbar.alpha:	255
session.screen0.toolbar.maxOver:	false
session.screen0.toolbar.layer:	Normal
session.screen0.toolbar.placement:	BottomCenter
session.screen0.slit.onhead:	0
session.screen0.slit.direction:	Vertical
session.screen0.slit.onTop:	False
session.screen0.slit.acceptKdeDockapps:	true
session.screen0.slit.autoHide:	false
session.screen0.slit.layer:	Dock
session.screen0.slit.placement:	BottomRight
session.screen0.slit.alpha:	255
session.screen0.slit.maxOver:	false
session.screen0.showwindowposition:	true
session.screen0.focusModel:	ClickFocus
session.screen0.demandsAttentionTimeout:	500
session.screen0.rootCommand:	/usr/bin/fbsetbg -l   
session.screen0.decorateTransient:	false
session.screen0.allowRemoteActions:	false
session.screen0.menuMode:	Delay
session.screen0.edgeSnapThreshold:	0
session.screen0.windowMenu:	
session.screen0.tabFocusModel:	ClickToTabFocus
session.screen0.rowPlacementDirection:	LeftToRight
session.screen0.workspacewarping:	true
session.screen0.strftimeFormat:	%b %d %k:%M
session.screen0.windowScrollReverse:	false
session.screen0.autoRaise:	false
session.screen0.maxDisableMove:	false
session.screen0.menuDelayClose:	0
session.screen0.windowScrollAction:	
session.screen0.focusNewWindows:	true
session.screen0.clickRaises:	true
session.screen0.colPlacementDirection:	TopToBottom
session.screen0.menuDelay:	0
session.screen0.userFollowModel:	Follow
session.screen0.noFocusWhileTypingDelay:	0l
session.screen0.desktopwheeling:	true
session.screen0.resizeMode:	Bottom
session.screen0.workspaces:	4
session.screen0.defaultDeco:	NORMAL
session.screen0.windowPlacement:	RowSmartPlacement
session.screen0.antialias:	true
session.screen0.workspaceNames:	one,two,three,four,
session.screen0.maxDisableResize:	false
session.screen0.followModel:	Ignore
session.screen0.tooltipDelay:	500
session.screen0.maxIgnoreIncrement:	true
session.screen0.focusLastWindow:	true
session.screen0.imageDither:	false
session.screen0.opaqueMove:	true
session.screen0.fullMaximization:	false
session.screen0.reversewheeling:	false
session.groupFile:	~/.fluxbox/groups
session.modKey:	Mod1
session.tabPadding:	0
session.configVersion:	10
session.ignoreBorder:	false
session.styleFile:	~/.fluxbox/styles/zimek_darkblue
session.tabsAttachArea:	Window
session.styleOverlay:	~/.fluxbox/overlay
session.cacheMax:	200l
session.appsFile:	~/.fluxbox/apps
session.numLayers:	13
session.autoRaiseDelay:	250
session.forcePseudoTransparency:	false
session.tabs:	true
session.colorsPerChannel:	4
session.cacheLife:	5l
session.opaqueMove:	False
session.doubleClickInterval:	250
session.imageDither:	True
session.keyFile:	~/.fluxbox/keys
session.focusTabMinWidth:	0
session.slitlistFile:	~/.fluxbox/slitlist
session.menuFile:	~/.fluxbox/menu
note this line session.styleFile: ~/.fluxbox/styles/zimek_darkblue have this point to the style you're using.

Other tips, sometimes applications have a name completely different to their executable, so when looking to add a menu entry I run gnome then top in a terminal, execute the program from the menu and press q the top process is usually the one you're looking for, there is also no real need to have the full path unless you have 2 of something i.e /usr/local/bin/avidemux
If you like to have menus, terminal etc transparent you'll need to install feh and in fluxbox > configuration > transparency > force pseudo transparency
If you have any questions or problems feel free to start a new topic quoting this guide, I'll do my best to help
__________________
fedora 14 fluxbox and gnome2 hp compaq nx9030 laptop 2Gb ram, helicopter landing pad, jacuzzi, mini fridge, gateway to alternative dimension

Last edited by bonedome; 29th June 2012 at 06:30 PM.
Reply With Quote
  #3  
Old 11th September 2010, 10:37 PM
smr54 Offline
Registered User
 
Join Date: Jan 2010
Posts: 5,514
linuxopera
Re: How to fluxbox window manager

This is nice--it would be nice if more people used it. I've had my default keyboard shortcuts for years--firefox is still Mod4 p, because, long ago, firefox was called phoenix.

Hopefully, it will get a few people interested in trying fluxbox.
Reply With Quote
  #4  
Old 24th October 2010, 02:38 AM
leigh123linux
Guest
 
Posts: n/a
linuxfedorafirefox
Re: How to fluxbox window manager

You could use fme to generate a menu


http://code.google.com/p/fluxbox-menu-editor/
Reply With Quote
  #5  
Old 9th November 2010, 06:35 AM
hellork Offline
Registered User
 
Join Date: Dec 2007
Posts: 244
linuxfedorafirefox
Re: How to fluxbox window manager

I tried fluxbox for a while, but I missed the gnome nautilus features, such as gvfs, right-click mounting of drives and mounting + bookmarking of ftp:// and ssh:// shares. But I suppose I could run fluxbox as the window manager for gnome http://www.batushkas.com/desktop-tip...ith-gnome.html and have it both ways.
Reply With Quote
  #6  
Old 9th November 2010, 01:03 PM
smr54 Offline
Registered User
 
Join Date: Jan 2010
Posts: 5,514
linuxopera
Re: How to fluxbox window manager

Such things can be done. Once, more because of Because I Can rather than any other reason, I ran LXDE using flux, rather than open, as the window manager.

Some folks like/need the increased features of a Desktop Environment (that is, something like Gnome, KDE, XFCE, any of the ones that include their own tools for file management, printing, etc.). For myself, I find that I can actually work more quickly using the smaller Window Environments (e.g., fluxbox, evilwm, and the like). You *might* (and might not) find LXDE a reasonable compromise (it uses OpenBox as window manager, but has most of the features of a desktop environment--don't know what file manager it uses, if it's comparable to Nautilus, nor do I know if it has the other features you needed.)
Reply With Quote
  #7  
Old 9th November 2010, 05:48 PM
DavidMcCann Offline
Registered User
 
Join Date: Jul 2008
Location: London
Posts: 459
linuxopera
Re: How to fluxbox window manager

Quote:
Originally Posted by bonedome View Post
I think fluxbox is great for laptops running on battery power
This is interesting:
http://www.carstenboysenjensen.com/e...tery-test.html

For the impatient, it showed the battery life for Fedora (extrapolated from a 30m test) was
KDE 6h 18m (7h 7m with battery saving features enabled!)
Gnome 5h 33m
Xfce 6h 18m
Fluxbox 6h 18m

This is not what I expected! There were also differences between distros. Suse was best for Gnome, Fedora for KDE, and Xubuntu and Arch for Xfce. Fluxbox was only tested on Fedora. Again, not what one would expect.
Reply With Quote
  #8  
Old 28th December 2010, 08:32 AM
Mariusz W Offline
Registered User
 
Join Date: Nov 2007
Location: Berkeley, California
Posts: 690
linuxgaleon
Re: How to fluxbox window manager

Thanks to bonedome and this thread, I got enough motivation to try fluxbox one more time: several times in the past I made half-hearted attempts to familiarize myself with it which never lasted more than a few logins. I wanted to like it because I generally like the underlying philosophy, yet I never made any serious effort to use fluxbox, openbox, etc.

I remember that the thing that put me off right away was the default style -- it is so ugly! As if somebody in the fluxbox camp tries, and successfully at that, to ward off anybody who possesses minimal aesthetical sensitivity and even slightly developed tastes.

This applies also to the majority of alternative preinstalled styles, with just one or two exceptions. They seem to reflect the state of desktop environment 20 years ago. Is this done on purpose? Several hours of internet scouting yielded nevertheless a dozen of styles that could be considered quite good.

Now, my contribution to this thread is of different nature, however.

Instead of complaining, I would like to further extend, and in one case possibly improve on the excellent tutorial prepared by bonedome. What is presented below is the result of my own investigations and experiments. Fluxbox comes with manual pages that are a model of comprehensiveness and clarity, by the way.

Part I. Keyboard shortcuts for mounting/unmounting

Mounting/unmounting partitions on the system internal drive (significantly updated: February 15, 2011)

First, I would like to present a group of keyboard shortcut definitions for mounting/unmounting partitions located on the internal disk -- just copy and paste into your ~/.fluxbox/keys file, and after reading what follows make the corresponding adjustments reflecting your system.

The following is an example of what I did on one of my laptops. Besides three Fedora partitions there is one NTFS partition where Windows Vista is installed, three FAT32 partitions that in the past were used for experimentation with various Linux and BSD distros, and a hidden system restore partition that came with the computer.

At the moment the three FAT partitions are "idle", they are used only for storing data. On Windows they appear as drives F:, G:, H:, and the Vista system partition appears predictably as drive C:.

Code:
# mount drive C:
Mod4 d c :Exec udisks --mount /dev/sda1
# unmount drive C:
Shift Mod4 d c :Exec udisks --unmount /dev/sda1

# mount F:
Mod4 d f :Exec udisks --mount /dev/sda7
# unmount drive F:
Shift Mod4 d f :Exec udisks --unmount /dev/sda7

# mount G:
Mod4 d g :Exec udisks --mount /dev/sda6
# unmount drive G:
Shift Mod4 d g :Exec udisks --unmount /dev/sda6

# mount H:
Mod4 d h :Exec udisks --mount /dev/sda5
# unmount drive H:
Shift Mod4 d h :Exec udisks --unmount /dev/sda5
To mount, say, the partition known to Vista as drive F:, you press

Windows key + d

and, after releasing these keys, press f.

To unmount (an equivalent of Safely remove, I suppose) you press

Left Shift + Windows key + d

and, after releasing the keys, press f.

For drives C:, G:, D:, you do the same, replacing f with the letter corresponding to the drive.

None of the above partitions initially possessed labels. When a partition without a label is mounted by udisks, it is mounted at /media/<UUID> which is not very transparent, especially when you have several such partitions simultaneously mounted. For this reason I decided to add labels to two of the FAT partitions (I did that in Vista), that makes distinguishing between them easier when they are all mounted in Fedora.


In order for these keyboard shortcuts to work, you must do one more step: remove authorization when mounting an internal disk partition as a non-root: follow the instructions in the guide How to mount a non-Fedora partition on an internal disk without authorization. If you fail to do that, the shortcuts will not work. Read also Note 4 below.


Mounting/unmounting USB drives

If you were using, e.g., GNOME, then any USB drive or flash drive would have been auto-mounted for you right after you connected it. Not the case with fluxbox. You probably need to mount and unmount them manually. This is the purpose of the second group of keyboard shortcuts to be added to your ~/.fluxbox/keys file.

Code:
# mount USB devices:
Mod4 u b :Exec udisks --mount /dev/sdb1
Mod4 u c :Exec udisks --mount /dev/sdc1
Mod4 u d :Exec udisks --mount /dev/sdd1
Mod4 u e :Exec udisks --mount /dev/sde1
Mod4 u f :Exec udisks --mount /dev/sdf1
# unmount USB devices:
Shift Mod4 u b :Exec udisks --unmount /dev/sdb1
Shift Mod4 u c :Exec udisks --unmount /dev/sdc1
Shift Mod4 u d :Exec udisks --unmount /dev/sdd1
Shift Mod4 u e :Exec udisks --unmount /dev/sde1
Shift Mod4 u f :Exec udisks --unmount /dev/sdf1
I made provisions for mounting for up to 5 different USB devices.

Generally, if your internal disk appears as /dev/sda, then the first plugged-in USB disk will appear as /dev/sdb, the second one as /dev/sdc, etc, ... My keyboard shortcuts follow exactly this logic. To mount the first partition on the first USB disk you plugged in, just press:

Windows key + u

and after releasing the keys, press b. To unmount it, press

Left Shift + Windows key + u

and after releasing the keys, press b.

In exact analogy to mounting internal disk partitions. Letters d and u are mnemonics for drive and USB, respectively.


Notes (or, rather, caveats)

1) If for whatever reason one or more USB disks or flash drives are plugged in (and turned on) before you boot into Fedora, then the correspondence between the disks and device files in /dev directory will reflect the boot device order set in your BIOS (!). I configured my BIOS so that USB devices take precedence over the internal disk. So, if I turn on computer with two USB disks already connected and turned on, one of them will likely be revealed to fdisk -l as /dev/sda, the other one as /dev/sdb, and the internal drive will appear as /dev/sdc.

2) If the USB disk has more than one partition, the above shortcuts will not be sufficient for mounting the second, the third, and so on, partitions -- only the first one on each disk.

My advice is to mount such partitions by hand from the command line:

udisks --mount /dev/sdxn

where x is the disk letter and n is the partition number, and to unmount with:

udisks --unmount /dev/sdxn

It is worth to create the corresponding shortcuts only when you encounter such situation frequently. In that case, I suggest, discard the two groups of shortcuts presented above and replace by something like

Mod4 a 1 :Exec udisks --mount /dev/sda1
Mod4 a 2 :Exec udisks --mount /dev/sda2
...
Mod4 b 1 :Exec udisks --mount /dev/sdb1
Mod4 b 2 :Exec udisks --mount /dev/sdb2
...


for mounting, and

Shift Mod4 a 1 :Exec udisks --mount /dev/sda1
Shift Mod4 a 2 :Exec udisks --mount /dev/sda2
...
Shift Mod4 b 1 :Exec udisks --mount /dev/sdb1
Shift Mod4 b 2 :Exec udisks --mount /dev/sdb2
...


for unmounting.

Honestly, if you indeed deal a lot with such situations, I would rather use a shell function, or a shell script that would do mounting/unmounting for me.

3) You can mount/unmount partitions on the internal and on USB drives much the same way as you do in GNOME or KDE, if you fire up a capable window manager, like Nautilus or PacManFM (the pcmanfm package in the Fedora default repo).

4) When the udisks package gets updated, the keyboard shortcuts for mounting partitions on the internal disk will most likely stop to work: this is due to the fact that an update to the udisks package overwrites the file /usr/share/polkit-1/actions/org.freedesktop.udisks.policy that you had to modify in order to remove authorization when mounting a partition (this is what I experienced today, February 15, 2011). You must modify this file again, as described in the guide How to mount a non-Fedora partition on an internal disk without authorization.

Last edited by Mariusz W; 16th February 2011 at 07:00 AM.
Reply With Quote
  #9  
Old 29th December 2010, 11:24 AM
Mariusz W Offline
Registered User
 
Join Date: Nov 2007
Location: Berkeley, California
Posts: 690
linuxfedoragaleon
Re: How to fluxbox window manager

Part II. Managing keymaps

As a matter of introduction, let me say that I daily write in a number of different languages: to English and several other Western European languages add my vernacular Polish, add also Russian -- and you will get a partial list of the languages I most commonly use. I consider being able to write and edit anything from emails to filenames in a number of languages to be an important component of using computers.

And for this, I need to use appropriate keymaps.


In a modern desktop environment like GNOME, keymap management is made easy with the aid of GUI applications like gnome-keyboard-properties. In GNOME you can also add the keymap indicator applet to the GNOME panel. I am sure there are equivalent applications in KDE.

You still can use such programs in fluxbox, of course, if GNOME is already installed on your computer.

Sometimes this is not as convenient as when they are run natively in GNOME. For example, I haven't found yet a satisfactory way of placing the GNOME key indicator applet on the fluxbox Toolbar. In fact, the only way I found was to place the following line

Code:
gnome-keyboard-properties --init-session-settings &
in the ~/.fluxbox/.startup file. If you choose to do this, remember that always the last (uncommented) line in your ~/.fluxbox/startup script must be either

Code:
exec fluxbox
or

Code:
exec fluxbox -log "/home/<your login name>/.fluxbox/log"
Unfortunately, I don't know any flags that would start that application minimized to the Toolbar. So, after the fluxbox session starts you will be greeted by a gnome-keyboard-properties window. Just close it unless you intend to make some changes to your keymap layouts setup. Not very elegant but works.

This way you get the keymap indicator on the fluxbox Toolbar. You can use it the same way as you would in GNOME, e.g., clicking on the indicator switches a keymap in the active window, while right-clicking opens up a menu that allows you to open the gnome-keyboard-properties window to make some changes to your keymap layouts setup.

Only once so far I experienced that the GNOME keymap indicator applet did not behave properly when started from the ~/.fluxbox/startup script, and that may have had something to do with the fluxbox style I was then using. So, if you encounter such aberrant behavior, test it with other fluxbox styles.

An important caveat:

I noticed that starting fluxbox with gnome-keyboard-properties makes one native fluxbox application, fbrun (Run program dialog), totally unusable: the dialog window pops-up but it is not possible to enter any text into it. I have confirmed that this behavior is directly dependent on whether gnome-keyboard-properties was or was not executed by the fluxbox startup script. If I find other conflicts between gnome-keyboard-properties and fluxbox I will write here about them.



Below I would like to present an entirely different solution to the task of managing and conveniently switching keymaps.

It is entirely independent of any particular desktop, thus can be used in any, or even without, as long as the X server is running. It doesn't bring the overhead that running, say, an application like gnome-keyboard-properties in fluxbox does. Yet it is as effective -- if not more, and as convenient in use. As far as I know it causes no conflicts with how fluxbox operates.


I placed the following three aliases in my ~/.bashrc:

Code:
## Keyboard layouts & Alt_L+Shift cycling through the layouts
#       English/Russian
alias ER="setxkbmap -layout 'us,ru' -variant 'altgr-intl,phonetic' -option grp:alt_shift_toggle"
#       English/Russian/Polish
alias ERP="setxkbmap -layout 'us,pl,ru' -variant 'altgr-intl,,phonetic' -option grp:alt_shift_toggle"
#       English/Russian/Polish/Greek
alias ERPG="setxkbmap -layout 'us,gr,pl,ru' -variant 'altgr-intl,polytonic,,phonetic' -option grp:alt_shift_toggle"
Executing, e.g., the last one, ERPG, in any shell terminal window, makes the US International, Russian yawerty, Polish programmers, and Greek polutonico keymaps instantly available to all applications, including the ones already running. This remains in force until I either execute another setxkbmap command or a setxkbmap based alias, or log out.

Simultaneously pressing the following two keys


Left Shift + Left Alt


makes, in a currently active window, a switch to the next keymap in the following cyclic order:

US -> Russian -> Polish -> Greek -> US

Note: this is the reverse of the cyclic order in which the keymaps appear in the alias (!) [I consider this behavior to be a bug, not a feature, by the way].

Thus, I can use that shortcut to switch keymaps in a web browser, a text editor, or a shell command line terminal window.

The above keymap-switching shortcut is not specific to any particular desktop, but if you plan to use this in fluxbox, then make sure that there are no keybord shortcuts in your ~/.fluxbox/keys file that contain the combination of Shift and Mod1 modifiers -- that would lead to conflicts and unpredictable behavior.


If at some point during my fluxbox session I decide that from now on I am going to use only US International and Russian keymaps, I can execute instead another alias defined in my ~/.bashrc file, namely ER.


If you want to have, say US International, Russian, and Polish keymaps available by default when you start each fluxbox session, place the following command in your ~/.fluxbox/startup file:

Code:
setxkbmap -layout 'us,pl,ru' -variant 'altgr-intl,,phonetic' -option grp:alt_shift_toggle
No need to terminate the line with the ampersound (&) character.


You can modify the above examples to set up your own 'keymap schemes' as aliases in ~/.bashrc . I leave to you to decide whether you would also like to make any such scheme a default by placing the corresponding command in your ~/.fluxbox/startup file.

In conclusion, I would like to state once again that you can use what I described above in any desktop environment, not only in fluxbox. If you wish to have any such keymap scheme by default each time you log in, then you need, of course, to replace ~/.fluxbox/startup by a suitable startup file.

Last edited by Mariusz W; 29th December 2010 at 03:21 PM.
Reply With Quote
  #10  
Old 8th January 2011, 06:23 PM
Mariusz W Offline
Registered User
 
Join Date: Nov 2007
Location: Berkeley, California
Posts: 690
linuxfedoragaleon
Re: How to fluxbox window manager

Part III. Sound: controlling volume (significantly updated, Jan 11, 2011)

I consider being able to control sound volume to be one of the essential functions in any modern desktop environment.

Looking for the best ways to control volume in fluxbox proved to be initially a rather frustrating experience. None of the shortcuts I found on the internet did do their supposed job on my Fedora 14.

Actually, when after your first fluxbox session, you will find your newly created directory ~/.fluxbox populated by various default configuration files. If you open the default ~/.fluxbox/keys file, you will find there the following lines:

Code:
# volume settings, using common keycodes
# if these don't work, use xev to find out your real keycodes
176 :Exec amixer sset Master,0 1+
174 :Exec amixer sset Master,0 1-
160 :Exec amixer sset Master,0 toggle
First comment: it would be a lot more useful in my opinion, if with these volume controlling commands were associated not the keycodes (176, 174, 160), which vary from computer to computer, but the names by which X server knows the Audio control keys, namely:

XF86AudioRaiseVolume, XF86AudioLowerVolume, and XF86AudioMute .

It took me quite some time to find out that on a standard full HP Compaq Presario laptop keyboard, there is no way to send keycode 176 to the X server.

Aside from that, the syntax of two out of three of these commands is not correct even if it may have been correct in the past. Here are the corrected entries:

Code:
# volume settings, using common keycodes
# if these don't work, use xev to find out your real keycodes
176 :Exec amixer -c 0 sset Master,0 1+
174 :Exec amixer -c 0 sset Master,0 1-
160 :Exec amixer sset Master,0 toggle

I propose a different way to implement the three volume control functions. First, comment out the default entries, i.e place # at the beginning of each line to be commented:

Code:
# volume settings, using common keycodes
# if these don't work, use xev to find out your real keycodes
# 176 :Exec amixer sset Master,0 1+
# 174 :Exec amixer sset Master,0 1-
# 160 :Exec amixer sset Master,0 toggle
Next, copy and paste the following lines into your ~/.fluxbox/keys file:

Code:
# Fn+Home
XF86AudioMute        :ToggleCmd {Exec amixer -c 0 -- sset Master playback mute} {Exec amixer -c 0 -- sset Master playback unmute}

# Fn+PageUp
XF86AudioRaiseVolume :Exec amixer -c 0 -- sset Master playback 2dB+

# Fn+PageDown
XF86AudioLowerVolume :Exec amixer -c 0 -- sset Master playback 1dB-
This defines three shortcuts:

Pressing Fn + Home keys toggles between muting and unmuting sound

Pressing Fn + PageUp keys raises the volume by 2dB

Pressing Fn + PageDown keys lowers the volume by 1dB

While holding the Fn key depressed keep pressing (or just hold) the PageDown key and the volume will gradually decrease to any level you like. Keep pressing the PageUp key and the volume will gradually increase.


A few words of explanation

On many laptops, the Home, PageUp and PageDown keys are adorned with tiny icons representing the loudspeaker. This signals that by pressing, say, the Home key while holding depressed the Fn key, you are in fact sending a single keystroke to the Operating System that is supposed to toggle between Mute and Unmute.

The X server reads this as a single key whose X name is: XF86AudioMute. To verify that this is so on your keyboard, type in a terminal window:

Code:
xev | grep keysym
then move the mouse over the small square window that pop ups and press Fn + Home keys and see what is being output into the terminal where you started xev program. You can try other keys, or combinations of a key with a modifier -- to learn how the X server is seeing them. When you are done, just press Ctrl+C to interrupt xev (you must first make the window where you executed it -- active.


When you press Fn + Home, the X server reads this as a XF86AudioMute key pressing event and transmits this information to the desktop management. It is up to the latter to take action. In GNOME, and perhaps also in KDE, there is indeed an action associated with this event: predictably, it toggles between muting and unmuting sound output.

In fluxbox and likely to be true in other minimalist desktop environments, no action is associated with this key pressing event. It is left to you to decide whether any action should be associated with it, and to decide which action.

By placing the above shortcut definitions in your ~/.fluxbox/keys file, you are making such associations. Next time you log into your fluxbox session, the three volume control keys should function as they do in GNOME even though I haven't used any GNOME specific program to control sound volume.

More than that: the commands associated with the above shortcuts can be used to control volume also in the Linux console. X server is used only to process the corresponding key pressing events, while fluxbox is used only to associate with those events the corresponding commands.


If GNOME is already preinstalled on your computer, you can, in fact, consider adding the following line to your ~/.fluxbox/startup file

Code:
gnome-volume-control-applet &
Next time you log in, you will be greeted by a loudspeaker icon in the fluxbox system tray. The overhead of running this applet in the background during your fluxbox session seems to be minimal (I haven't however performed any detailed tests, just took a note of which programs are running when I start fluxbox with the gnome-volume-control-applet running.


I would like to request from whoever may be reading this part of the fluxbox tutorial, to test that the above keyboard shortcuts indeed produce the effect they are supposed to produce.

I have performed numerous tests -- both with and without the gnome-volume-control-applet started, and with every possible player, and the effect was always the one that was desired. I also checked that usr/bin/pulseaudio was running in the backround.

Last edited by Mariusz W; 11th January 2011 at 02:28 PM.
Reply With Quote
  #11  
Old 9th January 2011, 03:40 PM
Mariusz W Offline
Registered User
 
Join Date: Nov 2007
Location: Berkeley, California
Posts: 690
linuxfedorafirefox
Re: How to fluxbox window manager

Part IV. Managing without a file manager

Fluxbox is a window manager. A fluxbox session starts without any file manager running, unless you started one in the ~/.fluxbox/startup script.

Not being a point-and-click type of a computer user, I perform most of operations on files and directories from a command line. Linux offers several excellent terminal emulators (gnome-terminal, konsole, ROXTerm, LilyTerm, Sakura, Termit; venerable xterm, as well as rxvt and rxvt-unicode may need some configuration work involving font selection, font size and colors before they become pleasant in use; I have been using them heavily in the past, nowadays, however I use them rarely, there are so many better and easier to use terminals, with intelligent font substitution and preconfigured excellent fonts).

Up-to-date versions of any of these programs you can find in Fedora repositories.

Download the ones you haven't previously installed on your computer, and start using all of them, learning alongside their capabilities.

Select the one or two that you want to use most often and place the suitable keyboard shortcuts in your ~/.fluxbox/keys file. The following is an example of what you can do.

Code:
Mod4 t :Exec gnome-terminal
Now, pressing Left Alt + t will open a gnome-terminal window.


Many among the terminal emulators listed above possess multi-tab capability: in one window you manage several terminal sessions Can be very convenient and neat. Like keeping various documents on your desk orderly squared, and accessible at an instant without having to deal with clutter.

To speed-up various operations practically every terminal emulator comes with its own, usually user-configurable set of shortcuts. That's a good news, yet sometimes also a bad news. Be prepared for clashes with the desktop own set of shortcuts.

One of the teminal emulators I tested, Termit, comes with a mortal flaw of too literally copying some Firefox shortcuts, which leads to the imminent danger of the following instant catastrophe:

you hit Ctrl-W in the middle of editing something and ... the tab is wiped out with everything you typed into the window.... I contacted the author. Hopefully he will respond and remove this "Russian roulette" from the otherwise very promising terminal program.

Using a single window for multiple terminal sessions eases navigation and saves your desktop from clutter. Apparently, it also uses less RAM.


It would be hard to deny that there are tasks where most of us happily resort to a file manager, for example to preview images contained in a given directory. You can achieve this however, maybe even quicker, by executing a command like

Code:
eog <directory>
in the terminal window. Here <directory> stands for either the name of a subdirectory of the current directory, or the full pathname to the directory. So, if you would like to start a slide show of all the images in the current directory, just execute

Code:
eog -s .
Suppose, you would like to view all the images in the current directory and all of its subdirectories. Then, execute

Code:
find . -type d -print0 | xargs -0 eog
I find this command so useful that I made an alias

Code:
alias V="find . -type d -print0 | xargs -0 eog"
and put it in my ~/.bashrc file. Then, to view all images in the current directory and its subdirectories jut type V at the command line prompt. That simple. And certainly simpler and faster than trying to achieve the same with any file manager.

If you would like to view all images in any directory, just place the following function definition in your ~/.bashrc

Code:
VD(){
  find "$1" -type d -print0 | xargs -0 eog
}
To view the images, type:

Code:
VD <directory>

Almost all of us have our favorite programs for various tasks: for playing music, for watching videos, for editing texts, etc. Starting them from the command line with files or directories as their arguments gives us a lot more control over how such programs are started. Typing long commands may be tedious but you can always save them as aliases, shell functions, or shell scripts.

And you can always start in fluxbox any file manager that is installed on your system. If you have GNOME installed, then GNOME's file manager is installed as well. Copy and paste the following to your ~/.fluxbox/keys file


Code:
Mod4 n :Exec nautilus --no-desktop --browser
# Shift Alt n	closes all running instances of Nautilus
Shift Mod4 n :Exec nautilus --quit
To start Nautilus press Left Alt + n keys

To kill all the running Nautilus windows press

Left Shift + Left Alt + n


There is a very capable yet small file manager, called PC Man File Manager (PCManFM). It is a default file manager in LXDE, yet is so small and independent of the rest of LXDE that you should consider installing it even if you have other file managers already installed.

Add the following line to ~/.fluxbox/keys
Code:
Mod4 p :Exec pcmanfm
Press Left Alt + p keys when you want to start it, and just close the PCManFM window to close it.

Last edited by Mariusz W; 10th January 2011 at 07:29 PM.
Reply With Quote
  #12  
Old 11th January 2011, 05:21 PM
Mariusz W Offline
Registered User
 
Join Date: Nov 2007
Location: Berkeley, California
Posts: 690
linuxfedorafirefox
Re: How to fluxbox window manager

Part V. Controlling players (updated: January 13, 2011, to include also totem)

We often listen to music while sitting at the keyboard. Many of us regularly use more than one player, the rationale being that different players have differing capabilities. I found it a necessity to rely on more than player.

Audacious, for example, which has been regarded as "the audiophiles player" in the Linux community at large, sufferred for a long time from some highly annoying shortcomings, like inability to play files with higher ASCII in their paths. This by the way seems to have been recently rectified. Its support for CUE sheets is now also quite good. In 2008-2009 a serious competitor to Audacious emerged, with very unfortunately chosen name, DeaDBeeF (the intended pun seems to be misplaced). DeadBeeF set out to address shortcomings of other Linux audio players, and quickly garnered attention of serious audiophiles.


Below I will show how to control basic functions of the currently running player using fluxbox shortcuts mechanism.

By pressing Fn key and the Audio Control Keys (on my keyboard function keys F9 through F12 bear small icons that you see on many audio players, indicating Play, Stop, Previous (track) and Next (track) functions) you will be able to send the corresponding signal to the player. Finally, by pressing the Pause key, you will be able to pause the player.

This is very quick, it is also very convenient:

1) You won't need to remember which player is playing, and which controlling flags does it accept.

2) None of these simple key-press operations will remove focus from the window you are currently working with, so you may pause, stop, resume the player, skip to the next, replay the current, or return to the previous track right in the middle of typing -- without affecting typing (!). For example, the cursor of your mouse will stay in absolutely the same position.



Let us start by preparing a suitable program that will be called evocatively, ControlPlayer. The first step is to decide which players we want to be able to control. Let us call this group the 'preselected players'.

For illustration, my set of preselected players will consist of audacious, deadbeef, and totem.

ControlPlayer is a shell script. Carefully copy


Code:
#!/bin/sh
# The purpose of this script is to send to the player
# controlling commands

# The script first checks which player is running.
# It assumes that *only* one player matching
# a predfined list is running; if this assumption
# is not met, e.g., when two players are running
# but one is in an idle state (for example, paused)
# then unpredictable behavior may ensue

# check whether a control flag has been given
# as a parameter to $0, and whether it is valid
# exit if these conditions are not met
if [ "$1" != --pause -a "$1" != --prev -a "$1" != --next -a "$1" != --stop -a "$1" != --play ]
then
   echo "
Program  $0  needs a control flag to be given on the command line
Valid flags are:
	--pause, --prev, --next, --stop, --play"
   exit 1
fi


ps -ef|grep -v grep|grep -q audacious
if [ $? -eq 0 ]
then
  if [ "$1" = --prev ]
  then
    # audacious uses a different flag
    audacious --rew
  elif  [ "$1" = --next ]
  then
    # audacious uses a different flag
    audacious --fwd
  else
    audacious "$1"
  fi
else
  ps -ef|grep -v grep|grep -q deadbeef
  if [ $? -eq 0 ]
  then
    deadbeef "$1"
  else
    ps -ef|grep -v grep|grep -q totem
    if [ $? -eq 0 ]
    then
      if [ "$1" = --pause ]
      then
        totem --play-pause
        # totem uses a different flag
      elif [ "$1" = --prev ]
      then
        # totem uses a different flag
        totem --previous
      elif [ "$1" = --stop ]
      then
        # totem does not accept the 'stop' signal
        # send instead the 'quit' signal
        totem --quit
      else
        totem "$1"
      fi
    else
      echo "None of the preselected players running"
      exit 2
    fi
  fi
fi
exit 0
and paste into a text editor, and save in the file named ControlPlayer. After saving the file execute the following command

Code:
chmod 755 ControlPlayer && mkdir -p ~/bin && mv ControlPlayer ~/bin
I wrote this shell script on purpose as transparently as possible, so that even a total beginner in shell programming will be able to see what the program is doing, and how to modify it to accommodate other players, or functions.

The program needs one argument: in order to be valid that argument must be one of the following five flags

--pause, --prev, --next, --stop, or --play

Their names are self-explanatory: Pause, Previous (track), Next (track), Stop, Play.

The script first checks the presence of an argument and validates it. Then, it checks which player is currently running. Then, depending on the result sends to the player the correct control flag.

I am exploiting here the fact that all three players: audacious, deadbeef, and totem, can be sent controlling flags from the command line, or from a shell script. You can easily modify or extend the ControlPlayer script by replacing or adding another player to the list of players the ControlPlayer script knows about, as long as the behavior of that player can be controlled from command line.

Use manual pages, or any other means (including instructions you can find online, to learn which signals, if any, can be sent to the player you are interested in.


Now, let us produce the corresponding keyboard shortcut definitions to be used in fluxbox. Copy and paste the following lines to your ~/.fluxbox/keys file


Code:
# For controlling the currently running player
# look inside of $HOME/bin/ControlPlayer for more details

None Pause         :Exec $HOME/bin/ControlPlayer --pause

# Fn+F9
None XF86AudioPlay :Exec $HOME/bin/ControlPlayer --play

# Fn+F10
None XF86AudioStop :Exec $HOME/bin/ControlPlayer --stop

# Fn+F11
None XF86AudioPrev :Exec $HOME/bin/ControlPlayer --prev

# Fn+F12
None XF86AudioNext :Exec $HOME/bin/ControlPlayer --next
The comment above the shortcut gives the key combination which yields on my HP Compaq Presario laptop the desired keysym; on your keyboard, the corresponding key combination may be different. Write them in: it will come handy when you forget how to input the corresponding keysym.

Actually, on some netbooks you may not even be able to input some of these keysyms. If this happens, you need to assign a different keysym.

In any case, you must make sure that none of the above keysyms has been previously associated by fluxbox with another action.

For example, if your ~/.fluxbox/keys file is a result of modifications introduced in the default ~/.fluxbox/keys file, then you may need to comment out some predefined association. I had to do this: on my HP Compaq Presario, keycode 174 translates as XF86AudioStop. In the default ~/.fluxbox/keys file, there was already the line:

Code:
174 :Exec amixer sset Master,0 1-
The associated command had incorrect syntax anyway, thus was useless, yet the prior association of some action with keycode 174 would have prevented my own shortcut for stopping the player from functioning.

In Part III, I advised to comment out the whole group of predefined shortcut definitions to which the above definition belongs:

Code:
# volume settings, using common keycodes
# if these don't work, use xev to find out your real keycodes
# 176 :Exec amixer sset Master,0 1+
# 174 :Exec amixer sset Master,0 1-
# 160 :Exec amixer sset Master,0 toggle
(what you have to add is in red).


Notes

1) If, say, audacious and deadbeef are simultaneously running (which is a distinct possibility since when a player finishes playing it does not automatically exit; you may forget that one player has been idling in the backround and start another player). In that case the script will send the corresponding signal to audacious even if you meant deadbeef. The outcome reflects the order in which the preselected players apper in the ControlPlayer script.

I could address this rather infrequent condition if I knew how to check from the command line whether the player is idling or actively playing (I can think, however, of a hack based on checking the actual CPU usage; that would make the script significantly more complex, and after performing several experiments I haven't yet found a completely reliable way of determining from the CPU usage whether a given player is idle or playing).

2) audacious can be found in standard repositories; install it with the command (as root)

Code:
yum install audacious audacious-plugins audacious-plugins-freeworld\*
(you need to have rmpfusion-free repository enabled)

deadbeef hasn't made yet into Fedora repositories. You can locate the most recent RPM deadbeef package by searching internet for example for: deadbeef player Fedora 14

When you find the link to the RPM package you install the package using yum (yum will resolve any dependencies, and install needed libraries)

Code:
yum install <URL of the deadbeef RPM package>
currently that would be:

Code:
yum install ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/d/project/de/deadbeef/fedora/0.4.4/deadbeef-0.4.4-1.fc14.i686.rpm
totem, of course, is a standard GNOME player. With additional plugins is quite capable of playing a significant subset of audio formats.

Last edited by Mariusz W; 13th January 2011 at 11:25 PM.
Reply With Quote
  #13  
Old 13th January 2011, 03:43 PM
Mariusz W Offline
Registered User
 
Join Date: Nov 2007
Location: Berkeley, California
Posts: 690
linuxfedorafirefox
Re: How to fluxbox window manager

Part VI. Controlling brightness of the screen (updated: February 9, 2011)

Being able to easily control brightness of the screen is a highly desirable feature in the age of 'mobile computing'. It is more than likely that the keyboard of your laptop or netbook has icons on two buttons signalling that by holding down the Fn key and pressing the corresponding button you either decrease or increase the level of brightness of the screen. The keysyms that the X server reads when you do that are most likely XF86MonBrightnessDown and XF86MonBrightnessUp, respectively.

In desktop environments like GNOME the power-management module associates with the above two keysyms the corresponding action of dimming the screen, or making it brighter. In minimalist dektop environments like fluxbox, no action is associated, so it is up to us to do that.


Below I show how to perform this task in the case of fluxbox. For other window managers only the last step, namely defining the corresponding keyboard shortcuts, will need to be modified. The main work is to prepare a program that will control the screen brightness.


To achieve its goal the program 'talks' to the acpi kernel module. The solution I am offering here is the best I was able to come up with. I confirm that it works well in Fedora 14 (both 32 and 64 bit), on a run-of-the-mill HP Compaq Presario laptop and on a Toshiba NB205 netbook. I spent a considerable amount of time studying various proposed 'solutions' one can find on the internet, and several do not work on my laptop (e.g., the one which utilizes setpci -s command) in spite of all my efforts.


Two essential considerations guided me when looking for a solution:

1) it must have fast execution since the user, by holding depressed the corresponding keyboard buttons, will be starting lots of processes, thus each process must have very fast initiation and execution

2) it should require only a minimal intervention into the system


Here are the detailed instructions.

Step 1. Determine the exact path to the file in the /proc directory which holds the current value of screen brightness: type

Code:
ls /proc/acpi/video/*/LCD/brightness
On my HP Compaq Presario the output of the above command is

Code:
/proc/acpi/video/UVGA/LCD/brightness
On my Toshiba NB205 it is

Code:
/proc/acpi/video/GFX0/LCD/brightness
On your computer it should look like

Code:
/proc/acpi/video/<the type of your display>/LCD/brightness
The part of path dependent on your computer architecture is in red.


Step 2. Now we prepare a program changing the brightness levels of the display. It is a simple shell script. Carefully copy, and replace the part in red by what you found in Step 1,


Code:
#!/bin/sh

# USAGE: $0 <n>
# the meaning: change the screen brightness
# by <n> levels
#
# the obligatory argument <n> is an integer
# examples of acceptable formats: 1, +3, -2


brightness_file=/proc/acpi/video/<the type of your display>/LCD/brightness
# this file in the /proc directory holds the valid
# values of the level of brightness (1st line),
# and the current value (2nd line)
#
# we will be talking to the acpi module by echoing
# to this file a valid value (i.e., belonging to
# the levels list)
#
# the `echo' command must have flag `-n'
#
# an attemtpt to edit the file in a text editor
# (even in a binary mode) will result in an error
# when trying to save it:
#
#   E667: Fsync failed
#   WARNING: Original file may be lost or damaged
#   don't quit the editor until the file is successfully written!
#


# read the first line of the `brightness_file'
# into an array named `level'
#
# level[0] should be the string `levels:'
# level[1] should be the lowest value of brightness
# level[2] should be the next bigger value of brightness
# ....
# level[${#level[@]}] should be the maximal value of brightness
#
# only these values are valid, no other value
# will be accepted by the acpi module
read -a level < "$brightness_file"

# retrieve the current value of screen brightness
current_value=`sed -n '2s/current:[ 	]*//p' "$brightness_file"`

### for debugging purposes
# echo $current_value


# retrieve the index of the `current_value'
# in the `level' array and add to this index
# the argument to $0 : this is the index
# of your intended new value (of screen brightness)
# target
#
# To optimize the `for' loop, we start from
# the maximal level of brightness and go down
# until we match its value with the `current_value'
#
for ((index=${#level[@]}; index>0; index--))
do 
  if [ "${level[$index]}" = "$current_value" ]
  then
    target_index=$(($index+($1)))
  fi
done

### for debugging purposes
# echo $target_index


# if the value of the `target_index'
# falls outside the valid range
# which is between 1 and ${#level[@]}
# then we reset it to either the maximal
# index (namely, ${#level[@]}), or to
# the minimal index (namely, 1)
if [ $target_index -ge ${#level[@]} ]
then
  target_index=$((${#level[@]}-1))
elif [ $target_index -lt 1 ]
then
  target_index=1
fi

### for debugging purposes
# echo $target_index


# check the permissions of the `brightness_file'
# file and change them only if necessary
#
# for this to work you should have a line like
# %<username> ALL = NOPASSWD: /bin/chmod 666 <path to the brightness file>
# in /etc/sudoers
#
# (add this line using `visudo' as root)

if [ `stat -c %a "$brightness_file"` != 666 ]
then
   sudo /bin/chmod 666 "$brightness_file"
fi

# finally, we are ready to send a new value
# of brightness to the acpi module 
echo -n ${level[$target_index]} > "$brightness_file"
into a text editor and save it into a file named: ControlBrightness. Then execute in the directory where you saved the file

Code:
chmod 755 ControlBrightness && mkdir -f ~/bin && mv ControlBrightness ~/bin

Step 3. As root type

Code:
visudo
and then add the following 2 lines as the last lines in the file

Code:
Defaults:%<username>   !requiretty
%<username> ALL = NOPASSWD: /bin/chmod 666 /proc/acpi/video/<the type of your display>/LCD/brightness
<username> is your login name.

I insist that you use visudo, since if you make any mistake, visudo will alert you and will make it hard to save the corresponding file with erroneous syntax. You need to know at least two-three things about using vim, like that vim has two main modes of operation (the command mode, and the insert mode) pressing i in the command mode takes you the insert mode, pressing Esc takes you back into the command mode. You save your changes and exit the editor from the command mode by typing

Code:
:wq

Note:

Fedora 14's /etc/sudoers file by default requires sudo to use a tty — this prevents using sudo in a fluxbox shortcut, or in the ~/.fluxbox/startup file — note the presence of the uncommented line:

Code:
Defaults    requiretty
in /etc/sudoers thus, the line

Code:
Defaults:%<username>   !requiretty
undoes the effect of that line for the group <username>.


Now do some testing. Type

Code:
~/bin/ControlBrightness -4
and you should observe dimming of the screen by 4 levels of brightness, next type

Code:
~/bin/ControlBrightness 4
and you should observe an increase in brightness by 4 levels.


Step 4. Now we are ready to define appropriate keyboard shortcuts. Copy and paste the following lines into your ~/.fluxbox/keys file


Code:
# decreases screen brightness by one level
None XF86MonBrightnessDown	:Exec $HOME/bin/ControlBrightness -1

# increases screen brightness by one level
None XF86MonBrightnessUp	:Exec $HOME/bin/ControlBrightness 1

# to find the levels valid for your computer, type:
# cat /proc/acpi/video/*/LCD/brightness
Reload the fluxbox configuration, or log out and log in. Pressing Fn + <the button with the screen dimming icon> should result in dimming the screen, pressing Fn + <the button with the icon representing increase of brightness> should result in the screen becoming brighter.

If you already reached the maximal brightness, the latter operation will have no effect. Similarly, if you reached the minimal brightness (note that it is not the same as 'blank screen'), then the former operation will have no effect. But one of the two should lead to an immediate change of brightness.

Last edited by Mariusz W; 10th February 2011 at 07:57 AM.
Reply With Quote
  #14  
Old 13th January 2011, 11:44 PM
Mariusz W Offline
Registered User
 
Join Date: Nov 2007
Location: Berkeley, California
Posts: 690
linuxfedorafirefox
Re: How to fluxbox window manager

Part VI. Controlling brightness of the screen (continued)

Notes

1) If you have GNOME installed, then you can change the display brightness by executing

Code:
gnome-power-preferences &
this will start gnome-power-manager and put its icon in the fluxbox system tray, and will pop up the window with Power Management Preferences. In the On AC Power tab there is a slider you can use to adjust the brightness level.

If you would like to always have access via gnome-power-manager to a GUI displaying the state of the battery, and some of the most basic power management functions, then you should add the following line to your ~/.fluxbox/startup file

Code:
gnome-power-manager &

2) Some fluxbox pages tell to use xbacklight for decreasing/increasing brightness. I did install the current xbacklight package on my laptop. I wasn't able to make any use of it. It always exits with the following error message:

Code:
No outputs have backlight property
Searching internet reveals that lots of people are experiencing this. I wasn't able to find anybody who would explain how to make xbacklight usable. I am afraid xbacklight due to lack of support in the current acpi kernel modules joined the list of useless packages.


3) As I mentioned above, I wasn't able to get anything from setpci -s either. This may or may not be related to the fact that on my laptop the only video device revealed by lspci:

Code:
00:05.0 VGA compatible controller: nVidia Corporation C51 [GeForce Go 6100] (rev a2)
has the function number (in red) zero. On that HP Compaq Presario laptop there is no PCI video device with the function number 1; setpci may have worked if the number was 1. Unfortunately, with PCI devices having the function number 0, setpci -s does not seem to work.

This may be a bug in setpci.

Last edited by Mariusz W; 14th January 2011 at 12:51 AM.
Reply With Quote
  #15  
Old 13th January 2012, 10:02 PM
pseudovector Offline
Registered User
 
Join Date: Jan 2007
Posts: 43
linuxchrome
Re: How to fluxbox window manager

I have fedora 16 and nowhere can I find gnome-power-manager, yet I know there is some applet displaying battery status when I run the gnome shell. What is the power manager applet called?
Reply With Quote
Reply

Tags
fluxbox, manager, window

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Window manager Keldorn Using Fedora 6 20th February 2010 08:25 AM
Can I run a Display Manager and Window Manager without running X? Lister Using Fedora 0 21st September 2006 09:43 AM
best window manager zylr Fedora Focus 24 19th September 2004 12:03 AM
How to make Fluxbox default windows manager [emblym] Using Fedora 12 9th August 2004 09:17 AM


Current GMT-time: 09:40 (Thursday, 18-09-2014)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat