Xfce Wiki

Sub domains
 

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Next revisionBoth sides next revision
tips [2010/02/14 06:35] – aoMGAFKfolJlrxQ 85.233.93.114tips [2013/08/05 22:41] – [Other Unique Xfce Features] mike
Line 1: Line 1:
-gclXuS  <href="http://dtiphvnenusk.com/">dtiphvnenusk</a>, [url=http://iqhuufnfyxpw.com/]iqhuufnfyxpw[/url], [link=http://ohwbciijtekp.com/]ohwbciijtekp[/link], http://dkskhenbvqbj.com/+====== Tips & Tricks ====== 
 +This page contains various tips for the Xfce desktop environment. 
 + 
 + 
 +===== Customize the font in clock panel plugin ===== 
 + 
 +You can use [[http://library.gnome.org/devel/pango/unstable/PangoMarkupFormat.html|Pango markup format]] to customize the font in clock panel plugin. Switch to custom format (only available with digital layout) and use tags inside the format string. 
 + 
 +For example: 
 +  * ''<nowiki><span font_desc="URW Gothic L Book 18">%R</span></nowiki>'' 
 +  * ''<nowiki><span font_desc="bold 12">%R</span></nowiki>'' 
 + 
 +===== Performance Tips ===== 
 + 
 +Lets face it: one of the reasons for using Xfce is performance. It is lighter and more responsive than Gnome on almost all hardware, especially on machines with less memory and processor power. 
 +==== Fonts ==== 
 + 
 +Fonts play **huge** part in GUI performance. With all of the font smoothing, hinting and rendering turned on, you may notice significant latency when menus or dialog boxes appear. When you turn all of these off, menus and dialog boxes will appear **much** faster (snappy in fact). Scrolling will also improve in web browsers, text editors, and terminal emulators. 
 + 
 +The only problem with turning off hinting/antialising is ugly fonts. On a laptop LCD, I recommend the "Kochi Gothic" font from 9 points and larger. "Helvetica" at 9 points and "Luxi Sans" also gives a clean look. Also, using "Verdana" at 9+ points with **only** anti-aliasing turned on(no hinting or sub-pixel hinting) looks very slick, however it may appear a little bold. Other font recommendations are welcome! 
 + 
 +Using the Fixed font (12+) looks nice on a crt monitor works nicely for me. it is easy to read and i don't need to use anti-aliasing. it looks good and runs fast! 
 + 
 +==== Background Color ==== 
 + 
 +I regularly connect remotely using vncserver, and I always noticed very slow and sluggish response, especially whenever I closed an application window. For example, when closing Firefox, it would take 30 to 60 seconds for the window to close and the system would be completely unresponsive during that time. By changing my background to solid white, all programs (including Firefox) now close within 1 to 2 seconds. 
 + 
 +Right-click on the desktop and choose Settings then Desktop Settings. Make sure Show Image is UNchecked, and set the Color Style to Solid Color, and then set First Color to white (#FFFFFF). 
 + 
 +Another option, that may work for some, is to check the options of the program that you are using to connect remotely, and if it has a "Remove Wallpaper" option or a "Do Not Display Wallpaper" option, then enable that option. I use TightVNCviewer and it does not have a Remove Wallpaper option, therefore changing the background color to white is the only solution for me. 
 + 
 +===== How to use the alternative GNOME-menu ===== 
 + 
 +If you want to use the new menu from GNOME, with quick starters for favorites applications and such, you can use the [[http://goodies.xfce.org/projects/panel-plugins/xfce4-xfapplet-plugin|xfapplet panel plugin]] with the GNOME main menu applet.  The menu should be installed with your package system, look for **gnome-main-menu**.  [[http://wirelessimage4.pbwiki.com/f/Screenshot.png|Xfce screenshot]], [[http://www.novell.com/video/desktop/|video]]. 
 + 
 +Add new xfapplet item inside your paneland open its properties dialog to add the GNOME menu applet. 
 + 
 +If you don't like GNOME main menu, try Ubuntu System Panel, available in several distributions. 
 + 
 +See also: [[/howto/customize-menu|How to customize the Xfce 4.5+ menu]] 
 + 
 +===== Gtkrc files ===== 
 +  * A tutorial about the Gtkrc format can be found [[http://live.gnome.org/GnomeArt/Tutorials/GtkThemes|here]].  
 + 
 +  * Xfce has also a couple of custom gtkrc settings for some of the applications: [[http://svn.xfce.org/svn/xfce/xfdesktop/branches/xfce_4_4/README|xfdesktop]] and [[http://thunar.xfce.org/pwiki/documentation/advanced_settings|Thunar]] (see also [[http://thunar.xfce.org/pwiki/documentation/faq#how_do_i_assign_different_keyboard_shortcuts|editable shortcuts]]). 
 + 
 +  * You can not define a custom background for Thunar icon/ list views due to a [[http://bugzilla.gnome.org/show_bug.cgi?id=71926|bug in Gtk+]] itself. 
 + 
 +  * You can define a custom panel background with something like this: 
 + 
 +  # ~/.gtkrc-2.0 
 +  style "panel-background"
 +    bg_pixmap[NORMAL]        = "foo.bar" 
 +    bg_pixmap[PRELIGHT]      = "foo.bar" 
 +    bg_pixmap[ACTIVE]        = "foo.bar" 
 +    bg_pixmap[SELECTED]      = "foo.bar" 
 +    bg_pixmap[INSENSITIVE]   = "foo.bar" 
 +  } 
 +  style "panel-color"
 +    fg[NORMAL]               = "#222222" 
 +    fg[ACTIVE]               = "#111111" 
 +    bg[NORMAL]               = "#edeff2" 
 +    bg[PRELIGHT]             = "#3d6eab" 
 +    bg[ACTIVE]               = "#3d6eab" 
 +  } 
 +  widget_class "*Panel*" style "panel-background" 
 +  widget "*PanelWidget*" style "panel-color" 
 +  widget "*PanelApplet*" style "panel-color" 
 +  widget "*Panel*" style "panel-color" 
 +  widget_class "*Panel*" style "panel-color" 
 +  class "*Panel*" style "panel-color" 
 +  class "*Tray*" style "panel-color" 
 +  class "*tray*" style "panel-color" 
 + 
 +   * See also those threads in the forum : http://forum.xfce.org/viewtopic.php?id=6169 and http://forum.xfce.org/viewtopic.php?id=6196 
 + 
 +===== How to add or remove applications in the system menu ===== 
 + 
 +=== Add an application === 
 +You have to create a .desktop file (usually in ''/usr/share/applications'' for system wide or ''~/.local/share/applications'' for your user) for the application you want to add. 
 + 
 +In the following examplewe create an entry in the menu with the name "foo" in the submenu "Multimedia": 
 + 
 +  [Desktop Entry] 
 +  Encoding=UTF-8 
 +  Name=foo 
 +  GenericName=bar 
 +  Comment=Senseless program ever 
 +  Exec=foobar 
 +  Icon=/usr/share/pixmaps/foobar.xpm 
 +  Terminal=false 
 +  Type=Application 
 +  Categories=Multimedia; 
 + 
 +You can read more about .desktop files [[http://standards.freedesktop.org/desktop-entry-spec/latest/|here]]. 
 + 
 +The libexo provides several utils amongst one to handle desktop entry files in a GUI fashion: **exo-desktop-item-edit**.  With it you can create a new .desktop file, by running the command ''<nowiki>exo-desktop-item-edit --create-new</nowiki>'' ;-) 
 + 
 +=== Remove an application from the menu === 
 +You can do this in two ways: 
 +  * First way, and the easier one is to simply remove the .desktop file in the ''/usr/share/applications/'' folder, but you will lose mime data (file associations). 
 +  * The second way is to add this line to the .desktop file: 
 + 
 +  NoDisplay=true 
 + 
 +=====How to customize starting Xfce===== 
 + 
 +Like most UNIX terminal sessions, Xfce runs through user-customizable startup file when it starts up. You can edit this init file to run your own scripts, send environment variables to the GUI, etc. 
 + 
 +To add your own startup code, edit the xinitrc file like this: 
 + 
 +  * Copy the file /etc/xdg/xfce4/xinitrc to ~/.config/xfce4/ 
 +  * Add your own code to the file. For example, you could start the rxvt-unicode server: 
 +    * source $HOME/.bashrc 
 +    * # start rxvt-unicode server 
 +    * urxvtd -q -o -f 
 + 
 +You can read more about xinitrc at [[http://www.google.com.au/search?q=xinitrc&ie=utf-8&oe=utf-8&aq=t&rls=com.ubuntu:en-US:unofficial&client=firefox-a | various locations online]]. 
 + 
 +==== Starting with showing the Root Window ==== 
 +  - xfdesktop --quit 
 +  - save your session 
 + 
 + 
 +===== Use the desktop margin ===== 
 + 
 +To set the desktop margins, use the Settings Manager (**Settings Manager > Workspaces & Margins > Margins**). 
 + 
 +The desktop margins are used to limit the size of maximized windows. This may be useful to avoid switching workspaces by accidentally mousing off the side of the screen. 
 + 
 +The margins are also useful if you have only one Xfce panel: the margin area leaves a clear space to pull up application or workspace menus. By default, right click on the desktop (the margin) to show the Xfce menu, or middle (left+right) click to show the workspace menu. 
 + 
 +The size of the margins is in pixels, so, with a reasonably modern monitor, at a resolution of, say 1680 x 1050, a setting of '10' will give a margin of about 1/8 of an inch. Note that nothing will change on any open window until you minimize and re-maximize it again. Also note that these margins only apply to maximized windows -- you can manually resize any window right to the edge of the screen if you want to. 
 + 
 +===== Handle acpi event for power button, show Xfce logout options ===== 
 + 
 +If you would like the xfce logout menu to show up when you press your power button, and your machine has acpi support, then do the following: 
 + 
 +==== Solution 1 ==== 
 +   * ''/etc/acpi/events/powerbtn'' 
 +<file> 
 +# /etc/acpi/events/powerbtn 
 +# This is called when the user presses the power button and calls 
 +# /etc/acpi/powerbtn.sh for further processing. 
 +  
 +# Optionally you can specify the placeholder %e. It will pass 
 +# through the whole kernel event message to the program you've 
 +# specified. 
 +  
 +# We need to react on "button power.*" and "button/power.*" because 
 +# of kernel changes. 
 + 
 +event=button[ /]power 
 +action=/usr/local/sbin/xfce4-shutdown-as-user.sh 
 +</file> 
 + 
 +  * ''/usr/local/sbin/xfce4-shutdown-as-user.sh'' 
 +<file> 
 +#!/bin/sh  
 +# xfce4-shutdown-as-user.sh 
 +
 +# Check how many users are currently logged into X. 
 +# If only one user is logged inrun a script which sets 
 +# up the environment to call xfce4-session-logout. 
 + 
 +LOGGED_IN_USER=`ls -trl /tmp/.ICE-unix/ | tail -n -1 | cut -d' ' -f3` 
 +NUM_X_USERS=`echo $LOGGED_IN_USER | wc -l` 
 +   
 +if [ $NUM_X_USERS -eq 1 ]; then 
 +    sudo -H -u $LOGGED_IN_USER /usr/local/sbin/xfce4-user-session-shutdown.sh 
 +fi 
 +</file> 
 + 
 +  * ''/usr/local/sbin/xfce4-user-session-shutdown.sh'' 
 +  <file> 
 +#!/bin/sh 
 +# xfce4-user-session-shutdown.sh 
 +
 +# Set up the environment so that DISPLAY and 
 +# SESSION_MANAGER are valid, and xfce4-session-logout can run 
 + 
 +HOST=`hostname` 
 +SESSION_ID=`ls -t /tmp/.ICE-unix/ | head -n1` 
 +# Note that distros use different syntax for the SESSION_MANAGER variable (this script has Debian's format). 
 +# If this does not work, then try something like SESSION_MANAGER="local/$HOST:@/tmp/.ICE-unix/$SESSION_ID" 
 +# instead. You can always find the correct format for your distribution by looking at the 
 +# value of SESSION_MANAGER in a X session. 
 +DISPLAY=:0 SESSION_MANAGER="local/$HOST:/tmp/.ICE-unix/$SESSION_ID" /usr/bin/xfce4-session-logout 
 +  </file> 
 + 
 +   * Make those scripts executable : 
 +<code> 
 +chmod +x /usr/local/sbin/xfce4-user-session-shutdown.sh /usr/local/sbin/xfce4-shutdown-as-user.sh 
 +</code> 
 +==== Solution 2 ==== 
 +   * Open Settings Manager (or by command : xfce4-settings-manager ) 
 +   * Open Power Manager settings 
 +   * In General : set //When power button is pressed// to //Ask// 
 +   * Close Power Manager settings 
 +   * If you have ACPI scripts installed, deactivate or update the **power-button** script from **/etc/acpi/events/**, and change the //action// field to ///bin/true//: 
 +<file> 
 +# EXAMPLE 
 +event=button/power.* 
 +#action=/usr/lib/acpid/power_button 
 +action=/bin/true 
 +</file> 
 +===== Use mnemonics to create Thunar Custom Actions ===== 
 + 
 +When you create a [[http://thunar.xfce.org/pwiki/documentation/custom_actions|Thunar Custom Action]] you can set the name with an underscore "_" before a letter to use it as mnemonic.  When you right click in a Thunar view, you can type the letter to access your custom action. 
 + 
 +===== Accessing man pages through xfrun4 ===== 
 +Use '#' as a shortcut to open man pages using xfrun4. e.g. #man 
 + 
 +===== Do maths with xfrun4/appfinder ===== 
 +  * What you get: input simple mathematical expression, like 5+5 or (5+5)/3 or .5*10, in xfrun4/appfinder, and get the result as notification. 
 +  * Requirement: notify-send 
 +  * Save this script as bcme.sh, in your home directory: 
 + 
 +  #!/bin/sh 
 +   
 +  precision=2        # number of digit for floating value 
 +  notify_time=20000  # number of milisecond the notification show 
 +   
 +  res=`echo "scale=$precision;$@" | bc`   
 +  notify-send -t $notify_time "$res" "=$@" 
 + 
 +  *Add custom action to Application finder : 
 +    * Type : Regular Expression 
 +    * Pattern : ^([0-9]|\(|\.).* 
 +    * Command : /bin/sh ~/bcme.sh \0 
 +    *  (check) Save match in command history 
 + 
 + 
 +====== Xfconf ===== 
 + 
 +===== Toggle panel autohide ===== 
 + 
 +Short Bash script to toggle the autohide property of a panel, so you can bind for example a keyboard shortcut to quickly show and hide a panel. 
 + 
 +<code bash> 
 +#!/bin/sh 
 + 
 +test -z "$1" && echo missing panel id  && exit 1 
 +test ! -z "`echo $1 | sed s/[0-9]*//g`" && echo bad panel id  && exit 1 
 + 
 +CHANNEL=xfce4-panel 
 +PANELID=$1 
 +PROP=/panels/panel-$PANELID/autohide 
 + 
 +if `xfconf-query -c $CHANNEL -p $PROP >/dev/null 2>&1`; then 
 +    xfconf-query -c $CHANNEL -T -p $PROP 
 +else 
 +    xfconf-query -c $CHANNEL -n -p $PROP -t bool -s true 
 +fi 
 +</code>