https://wiki.archlinux.org/api.php?action=feedcontributions&user=Mike4ca&feedformat=atomArchWiki - User contributions [en]2024-03-29T12:13:26ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Openbox&diff=247254Openbox2013-02-14T03:13:57Z<p>Mike4ca: Changed to non-binary version of obmenugen in AUR per package maintainer comment.</p>
<hr />
<div>[[Category:Stacking WMs]]<br />
[[cs:Openbox]]<br />
[[de:Openbox]]<br />
[[es:Openbox]]<br />
[[fr:Openbox]]<br />
[[it:Openbox]]<br />
[[ko:Openbox]]<br />
[[lt:Openbox]]<br />
[[nl:Openbox]]<br />
[[pl:Openbox]]<br />
[[ru:Openbox]]<br />
[[sk:Openbox]]<br />
[[sr:Openbox]]<br />
[[tr:Openbox]]<br />
[[zh-CN:Openbox]]<br />
[[zh-TW:Openbox]]<br />
{{Article summary start}}<br />
{{Article summary text|A comprehensive guide on the installation and use of the Openbox window manager.}}<br />
{{Article summary heading|Overview}}<br />
{{Article summary text|{{Graphical user interface overview}}}}<br />
{{Article summary end}}<br />
<br />
Openbox is a lightweight and highly configurable [[Window Manager|window manager]] with extensive standards support. Its features are documented at the [http://openbox.org/ official website]. This article pertains to installing Openbox under Arch Linux.<br />
<br />
== Installation ==<br />
<br />
Install {{Pkg|openbox}}, available in the [[Official Repositories]]. After installation, you should copy the default configuration files {{ic|rc.xml}}, {{ic|menu.xml}}, {{ic|autostart}}, and {{ic|environment}} to {{ic|~/.config/openbox}}:<br />
<br />
{{Note | Do this as a regular user, not as root.}}<br />
<br />
$ mkdir -p ~/.config/openbox<br />
$ cp /etc/xdg/openbox/{rc.xml,menu.xml,autostart,environment} ~/.config/openbox<br />
<br />
These four files form the basis of your openbox configuration. Each file addresses a unique aspect of your configuration and the role of each file is as follows:<br />
<br />
; {{ic|rc.xml}}: This is the main configuration file. It defines keyboard shortcuts, themes, virtual desktops, and more.<br />
<br />
;{{ic|menu.xml}}: This file defines the content of the right-click menu. It defines launchers for applications and other shortcuts. See the [[#Menus]] section.<br />
<br />
;{{ic|autostart}}: This file is read by openbox-session at startup. It contains the programs that are run at startup. It is typically used to set environment variables, launch panels/docks, set background image or execute other startup scripts. See the [http://openbox.org/wiki/Help:Autostart Openbox Wiki].<br />
<br />
;{{ic|environment}}: This file is sourced by openbox-session at startup. It contains environment variables to be set in Openbox's context. Any variables you set here will be visible to Openbox itself and anything you start from its menus.<br />
<br />
== Upgrading to Openbox 3.5 ==<br />
<br />
If you are upgrading to Openbox 3.5 or later from an earlier release, be aware of these changes:<br />
<br />
* There is a new config file called {{ic|environment}} that you should copy from {{ic|/etc/xdg/openbox}} to {{ic|~/.config/openbox}}.<br />
* The config file previously called {{ic|autostart.sh}} is now just called {{ic|autostart}}. You should rename yours to remove the {{ic|.sh}} from the end of the name.<br />
* Some of the configuration grammar in {{ic|rc.xml}} has changed. While Openbox appears to understand the old options, it would be wise to compare your configuration to the one in {{ic|/etc/xdg/openbox}} and look for changes that affect you.<br />
<br />
== Openbox as a stand-alone WM ==<br />
<br />
Openbox can be used as a stand-alone window manager (WM). This is usually simpler to install and configure than using Openbox with desktop environments. Running openbox alone may reduce your system's CPU and memory load.<br />
<br />
To run Openbox as a stand-alone window manager, append the following to {{ic|~/.xinitrc}}:<br />
exec openbox-session<br />
<br />
See [[xinitrc]] for details, such as preserving the logind (and/or consolekit) session.<br />
<br />
If you used another window manager previously (such as Xfwm) and now Openbox will not start after logging out of X, try moving the autostart folder:<br />
mv ~/.config/autostart ~/.config/autostart.bak<br />
<br />
{{Note | {{pkg|python2-xdg}} is required for Openbox's xdg-autostart}}<br />
<br />
== Openbox as a WM for desktop environments ==<br />
<br />
Openbox can be used as a replacement window manager for full-fledged desktop environments. The method for deploying Openbox depends on the desktop environment.<br />
<br />
=== GNOME 2.24 and 2.26 ===<br />
Create {{ic|/usr/share/applications/openbox.desktop}} with the following lines:<br />
[Desktop Entry]<br />
Type=Application<br />
Encoding=UTF-8<br />
Name=OpenBox<br />
Exec=openbox<br />
NoDisplay=true<br />
# name of loadable control center module<br />
X-GNOME-WMSettingsModule=openbox<br />
# name we put on the WM spec check window<br />
X-GNOME-WMName=OpenBox<br />
In gconf, set {{ic|/desktop/gnome/session/required_components/windowmanager}} to {{ic|openbox}}:<br />
$ gconftool-2 -s -t string /desktop/gnome/session/required_components/windowmanager openbox<br />
Finally, choose the {{ic|GNOME}} session from the GDM sessions menu.<br />
<br />
=== GNOME 2.26 redux ===<br />
'''''If the previous guide for GNOME 2.24 fails:'''''<br />
<br />
If, when attempting to log into a "Gnome/Openbox" session -- and it consistently fails to start, try the following. This is one way of achieving your goal of using Openbox as the WM anytime you open a Gnome session:<br />
<br />
#Log into your Gnome-only session (it should still be using Metacity as its window manager).<br />
#Install Openbox if you have not done so already<br />
#Navigate your menus to ''System &rarr; Preferences &rarr; Startup Applications'' (possibly named 'Session' in older Gnome versions)<br />
#Open Startup Application, select '+ Add' and enter the text shown below. Omit the text after #.<br />
#Click the 'Add' button for the data entry window. Make sure the checkbox beside your new entry is selected.<br />
#Log out from your Gnome session and log back in<br />
#You should now be running openbox as your window manager.<br />
<br />
Name: Openbox Windox Manager # Can be changed<br />
Command: openbox --replace # Text should not be removed from this line, but possibly added to it<br />
Comment: Replaces metacity with openbox # Can be changed<br />
<br />
This creates a startup list entry which is executed by Gnome each time the user's session is started.<br />
<br />
=== KDE ===<br />
# If you use KDM, select the "KDE/Openbox" login option.<br />
# Open System Settings > Default Applications (in the Workspace Appearance and Behaviour section), and change the default window manager to Openbox (this will also avoid having to log out and log back in again).<br />
# If you use startx, add {{ic|exec openbox-kde-session}} to {{ic|~/.xinitrc}}<br />
# From the shell:<br />
$ xinit /usr/bin/openbox-kde-session<br />
<br />
=== Xfce4 ===<br />
Log into a normal Xfce4 session. From your terminal, type:<br />
$ killall xfwm4 ; openbox & exit<br />
<br />
This kills xfwm4, runs Openbox, and closes the terminal. Log out, being sure to check the ''"Save session for future logins"'' box. On your next login, Xfce4 should use '''Openbox''' as its window manager.<br />
<br />
Alternatively, you can chooose ''Settings'' -> ''Session and Startup'' from menu, go to the ''Application Autostart'' tab and add {{ic|openbox --replace}} to the list of automatically started applications.<br />
<br />
To enable exiting from a session using ''xfce4-session'', edit {{ic|~/.config/openbox/menu.xml}}. If the file is not there, copy it from {{ic|/etc/xdg/openbox/}}. Look for the following entry:<br />
<item label="Exit Openbox"><br />
<action name="Exit"><br />
<prompt>yes</prompt><br />
</action><br />
</item><br />
<br />
Change it to:<br />
<item label="Exit Openbox"><br />
<action name="Execute"><br />
<prompt>yes</prompt><br />
<command>xfce4-session-logout</command><br />
</action><br />
</item><br />
<br />
Otherwise, choosing "Exit" from the root-menu causes Openbox to terminate its execution, leaving you with no window manager.<br />
<br />
If you have a problem changing virtual desktops with the mouse wheel skipping over desktops, edit {{ic|~/.config/openbox/rc.xml}}. Move the ''mouse binds with...'' actions "DesktopPrevious" and "DesktopNext" from context ''Desktop'' to the context ''Root''. Note that you may need to create a definition for the ''Root'' context as well.<br />
<br />
When using the Openbox root-menu instead of Xfce's menu, you may exit the Xfdesktop with this terminal command:<br />
$ xfdesktop --quit<br />
Xfdesktop manages the wallpaper and desktop icons, requiring you to use other utilities such as ROX for these functions.<br />
<br />
(When terminating Xfdesktop, the above issue with the virtual desktops is no longer a problem.)<br />
<br />
If you want have rc.xml separated than your default openbox session rc.xml<br />
<br />
Edit the ~/.config/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml or (to make the change for all XFCE users) /etc/xdg/xfce4/xfconf/xfce-perchannel-xml/xfce4-session.xml:<br />
Replace the xfwm startup command,<br />
<property name="Client0_Command" type="array"><br />
<value type="string" value="xfwm4"/><br />
</property><br />
with the following:<br />
<property name="Client0_Command" type="array"><br />
<value type="string" value="openbox"/><br />
<value type="string" value="--config-file"/><br />
<value type="string" value="~/.config/xfce4/openbox/rc.xml"/><br />
</property><br />
<br />
and also the menu, you can set the separated menu ex: xfce4-menu.xml , change it to your custom xfce4 rc.xml , but notice that the menu must be place at ~/.config/openbox/<br />
<br />
== Openbox for multihead users ==<br />
<br />
While Openbox provides better than average multihead support on its own, the {{AUR|openbox-multihead-git}} package from the [[AUR]] provides a development branch called '''Openbox Multihead''' that gives multihead users per-monitor desktops. This model is not commonly found in floating window managers, but exists mainly in tiling window managers. It is explained well on the [http://xmonad.org/tour.html#workspace Xmonad web site]. Also, please see [https://github.com/BurntSushi/openbox-multihead/blob/multihead/README.MULTIHEAD README.MULTIHEAD] for a more comprehensive description of the new features and configuration options found in Openbox Multihead.<br />
<br />
Openbox Multihead will function like normal Openbox when only a single head is available.<br />
<br />
A downside to using Openbox Multihead is that it breaks the EWMH assumption that one and only one desktop is visible at any time. Thus, existing pagers will not work well with it. To remedy this, {{AUR|pager-multihead-git}} can be found in the [[AUR]] and is compatible with Openbox Multihead. [http://imgur.com/a/cnZeq#y04nk Screenshots].<br />
<br />
Finally, a new version of [[PyTyle]] that will work with Openbox Multihead can also be found in the [[AUR]]: {{AUR|pytyle3-git}}.<br />
<br />
Both ''pytyle3'' and ''pager-multihead-git'' will work without Openbox Multihead if only one monitor is active.<br />
<br />
== Configuration ==<br />
<br />
There are several options for configuring Openbox settings:<br />
<br />
=== Manual configuration ===<br />
To configure Openbox manually, edit the {{ic|~/.config/openbox/rc.xml}} file with a text editor. The file has explanatory comments throughout, for more details about editing it see the [http://openbox.org/wiki/Help:Configuration Openbox wiki].<br />
<br />
=== ObConf ===<br />
[http://openbox.org/wiki/ObConf:About ObConf] is an Openbox configuration tool. It is used to set most common preferences such as themes, virtual desktops, window properties, and desktop margins. It can be installed with the {{Pkg|obconf}} package, available in the [[official repositories]].<br />
<br />
ObConf cannot configure keyboard shortcuts and certain other features. For these features edit {{ic|rc.xml}} manually. Alternatively, you can try {{AUR|obkey}} from the [[AUR]].<br />
<br />
=== Application customization ===<br />
<br />
Openbox allows per-application customizations. This lets you define rules for a given program. For example:<br />
* Start your web browser on a specific virtual desktop.<br />
* Open your terminal program with no window decorations (window chrome).<br />
* Make your bit-torrent client open at a given screen position.<br />
<br />
Per-application settings are defined in {{ic|~/.config/openbox/rc.xml}}. Instructions are in the file's comments. More details are found in the [http://openbox.org/wiki/Help:Applications Openbox wiki].<br />
<br />
== Menus ==<br />
<br />
The default Openbox menu includes a variety of menu items to get you started. Many of these items launch applications you do not want, have not installed yet, or never intend to install. You will surely want to customize '''{{ic|menu.xml}}''' at some point. There are a number of ways to do so.<br />
<br />
=== Manual configuration of menus ===<br />
<br />
You can edit {{ic|~/.config/openbox/menu.xml}} with a text editor. Many of the settings are self-explanatory. The article [http://openbox.org/wiki/Help:Menus Help:Menus] in the Openbox wiki has extensive details.<br />
<br />
=== Icons in the menu ===<br />
<br />
Since version 3.5.0 you can have icons next to your menu entries. To do that :<br />
# add <showIcons>yes</showIcons> in the <menu> section of the {{ic|rc.xml}} file<br />
# edit the menu entries in {{ic|menu.xml}} and add icons="<path>" like this :<br />
<menu id="apps-menu" label="SomeApp" icon="/home/user/.icons/application.png"><br />
<br />
then {{ic|openbox --reconfigure}} or {{ic|openbox --restart}} if the menus do not update properly.<br />
<br />
=== MenuMaker ===<br />
<br />
[http://menumaker.sourceforge.net/ MenuMaker] creates XML menus for several window managers including Openbox. MenuMaker searchs your computer for executable programs and creates a menu file from the result. It can be configured to exclude certain application types (GNOME, KDE, etc) if you desire. It can be installed with the {{Pkg|menumaker}} package available in the official repositories.<br />
<br />
Once installed, generate a menu file (named {{ic|menu.xml}}) by running the program.<br />
$ mmaker -v OpenBox3 # Will not overwrite an existing menu file.<br />
$ mmaker -vf OpenBox3 # Force option permits overwriting the menu file.<br />
$ mmaker --help # See the full set of options for MenuMaker.<br />
<br />
MenuMaker creates a comprehensive {{ic|menu.xml}}. You may edit this file by hand or regenerate it after installing software.<br />
<br />
=== Obmenu ===<br />
<br />
Obmenu is a menu editor for Openbox. This GUI application is the best choice for those who dislike editing XML code. Obmenu can be installed with the package {{Pkg|obmenu}}, available in the official repositories.<br />
<br />
Once installed, run {{ic|obmenu}} then add and remove applications as desired.<br />
<br />
<br />
==== Obm-xdg ====<br />
<br />
{{ic|obm-xdg}} is a command-line tool that comes with Obmenu. It generates a categorized sub-menu of installed GTK/GNOME applications.<br />
<br />
To use obm-xdg with other menus, add the following line to {{ic|~/.config/openbox/menu.xml}}:<br />
<menu execute="obm-xdg" id="xdg-menu" label="xdg"/><br />
<br />
Then add the following line under your ''root-menu'' entry where you want to have the menu appear:<br />
<menu id="xdg-menu"/><br />
<br />
Then run {{ic|openbox --reconfigure}} to refresh the Openbox menu. You should now see a sub-menu labeled '''xdg''' in your menu.<br />
<br />
To use obm-xdg by itself, create {{ic|~/.config/openbox/menu.xml}} and add these lines:<br />
<openbox_menu><br />
<menu execute="obm-xdg" id="root-menu" label="apps"/><br />
</openbox_menu><br />
<br />
{{Note|If you do not have GNOME installed, you need to install the package {{pkg|gnome-menus}} for obm-xdg.}}<br />
<br />
=== XDG-menu ===<br />
The {{Pkg|archlinux-xdg-menu}} package in [[official repositories]] can automatically generate a menu for Openbox from XDG files. For a guide on using XDG-menu, see the [[Xdg-menu#OpenBox]] article.<br />
<br />
=== openbox-menu ===<br />
<br />
[http://mimasgpc.free.fr/openbox-menu_en.html Openbox-menu] uses [http://sourceforge.net/projects/lxde/files/menu-cache/ menu-cache] from the LXDE Project to create dynamic menus for Openbox.<br />
<br />
If you get an error while trying to open this menu try [[#Icons_in_the_menu|adding icons]] to the Openbox menu.<br />
<br />
It can be installed with the package {{AUR|openbox-menu}}, available in the [[AUR]].<br />
<br />
=== Python-based xdg menu script ===<br />
<br />
This script is found in Fedora's Openbox package. You have only to put the script somewhere and create a menu entry. The latest version of the script can be found [http://pkgs.fedoraproject.org/cgit/openbox.git/tree/xdg-menu here].<br />
<br />
Download the script from the above repository and Place int into any directory you want.<br />
<br />
Open {{ic|menu.xml}} with your text editor and add the following entry. Of course, you can modify the label as you see fit.<br />
<menu id="apps-menu" label="xdg-menu" execute="python2 /path/to/xdg-menu"/><br />
<br />
Save the file and run {{ic|openbox --reconfigure}}.<br />
<br />
{{Note|If you do not have GNOME installed, you need to install the package {{pkg|gnome-menus}} for xdg-menu.}}<br />
<br />
=== Openbox menu generator ===<br />
<br />
The Openbox menu generator can be installed with the package {{AUR|obmenugen}}, available in the AUR. creates the menu file from {{ic|.desktop}} files. Obmenugen provides a text file which filters (hides) menu items using basic regular expressions.<br />
$ obmenugen # Create a menu file<br />
$ openbox --reconfigure # To see the menu you generated<br />
<br />
=== Pipe menus ===<br />
<br />
Like other window managers, Openbox allows for scripts to dynamically build menus (menus on-the-fly). Examples are system monitors, media player controls, or weather monitors. Pipe menu script examples are found in the [http://openbox.org/wiki/Openbox:Pipemenus Openbox:Pipemenus] page at Openbox's site.<br />
<br />
Some interesting pipe menus provided by Openbox users:<br />
* {{App|obfilebrowser|A pipe menu file browser.|http://xyne.archlinux.ca/projects/obfilebrowser/|{{AUR|obfilebrowser}}}}<br />
* {{App|wifi-pipe|A pipe menu for scanning and connecting to wireless hot spots using netcfg.|https://github.com/pbrisbin/wifi-pipe|{{AUR?|wifi-pipe}}}}<br />
* {{App|obdevicemenu|A pipe menu for managing removable devices using Udisks.|https://bbs.archlinux.org/viewtopic.php?id&#61;114702|{{AUR|obdevicemenu}}}}<br />
<br />
== Startup programs ==<br />
<br />
Openbox supports running programs at startup. This is provided by command '''openbox-session'''.<br />
<br />
=== Enabling autostart ===<br />
<br />
There are two ways to enable autostart:<br />
# When using startx or xinit to begin a session, edit {{ic|~/.xinitrc}}. Change the line that executes '''''openbox''''' to '''openbox-session'''.<br />
# When using GDM or KDM, selecting an ''Openbox'' session automatically runs the autostart script.<br />
<br />
=== Autostart script ===<br />
<br />
Openbox provides a system-wide startup script which applies to all users and is located at {{ic|/etc/xdg/openbox/autostart}}. A user may also create his own startup script to be executed after the system-wide script by creating the file {{ic|~/.config/openbox/autostart}}. This file is not provided by default and must be created by the user.<br />
<br />
Further instructions are available in the [http://openbox.org/wiki/Help:Autostart Help:Autostart] article at the official Openbox site.<br />
<br />
{{Note|The autostart files used to be named autostart.sh prior to OpenBox 3.5.0. While these scripts will presently still work, users who are upgrading are advised to drop the .sh extension.}}<br />
{{Note|All the programs in the autostart file should be run as daemons or run in the background,otherwise the items in {{ic|/etc/xdg/autostart/}} won't be started!}}<br />
<br />
=== Autostart directory ===<br />
<br />
Openbox also starts any *.desktop files in {{ic|/etc/xdg/autostart}} - this happens regardless of whether a user startup script is present. {{ic|nm-applet}}, for example, installs a file at this location, and may cause it to run twice for users with the usual {{ic|(sleep 3 && /usr/bin/nm-applet --sm-disable) &}} in their startup script. There is a discussion on managing the effects of this at [https://bbs.archlinux.org/viewtopic.php?pid=993738].<br />
<br />
== Themes and appearance ==<br />
<br />
{{Box||See the main article: [[Openbox Themes and Apps#Themes and appearance]]|#E5E5FF|#FCFCFC}}<br />
<br />
=== Openbox themes ===<br />
<br />
Themes control the appearance of windows, titlebars, and buttons. They also control menu appearance and on-screen display (OSD). Some Openbox themes can be installed with the package {{Pkg|openbox-themes}}, available in the [[official repositories]].<br />
<br />
=== Cursors, icons, wallpapers ===<br />
<br />
Xcursor themes can be installed with the package {{Pkg|xcursor-themes}}, available in the official repositories, or with other packages from such as {{Pkg|xcursor-bluecurve}}, {{Pkg|xcursor-vanilla-dmz}} or {{Pkg|xcursor-pinux}}. Many other themes can be found in the official repositories or the [[AUR]].<br />
<br />
Icon themes are also available in the repositories, for example {{Pkg|lxde-icon-theme}}, {{Pkg|tangerine-icon-theme}} or {{Pkg|gnome-icon-theme}} can be found in the official repositories with many more in the [[AUR]].<br />
<br />
Wallpapers are easily set with utilities such as [[Nitrogen]], [[Feh]] or {{ic|hsetroot}}.<br />
<br />
Please see [[Openbox Themes and Apps]] for information on these GUI customizations.<br />
<br />
== Recommended programs ==<br />
<br />
{{Box||See the main article: [[Openbox Themes and Apps#Recommended programs]]|#E5E5FF|#FCFCFC}}<br />
<br />
== Tips and tricks ==<br />
<br />
===Window snap behaviour===<br />
Windows 7 and other VMs supports a window behaviour to snap windows when they are moved to the edge of the screen. This effect can also be achieved through an Openbox keybinding. <!--More information [http://ubuntuforums.org/showthread.php?t=1796793 here].--> Openbox supports specifying percentages, and [http://openbox.org/wiki/Help:Actions actions]. To simulate Aero Snap:<br />
<br />
{{hc|~/.config/openbox/rc.xml|<nowiki><br />
<keybind key="W-Left"><br />
<action name="UnmaximizeFull"/><br />
<action name="MaximizeVert"/><br />
<action name="MoveResizeTo"><br />
<width>50%</width><br />
</action><br />
<action name="MoveToEdge"><direction>west</direction></action><br />
</keybind><br />
<keybind key="W-Right"><br />
<action name="UnmaximizeFull"/><br />
<action name="MaximizeVert"/><br />
<action name="MoveResizeTo"><br />
<width>50%</width><br />
</action><br />
<action name="MoveToEdge"><direction>east</direction></action><br />
</keybind><br />
</nowiki>}}<br />
<br />
The only issue with any methods around, is that once maximized to an edge - it stays full (vertically) until you maximize and restore. So you can add the next few lines to simulate the other windows behaviors (maximize, restore). That will speed up pulling a window from a screen edge as well.<br />
<br />
{{hc|~/.config/openbox/rc.xml|<nowiki><br />
<keybind key="W-Down"><br />
<action name="Unmaximize"/><br />
</keybind><br />
<keybind key="W-Up"><br />
<action name="Maximize"/><br />
</keybind><br />
</nowiki>}}<br />
<br />
Then reconfigure Openbox and try it.<br />
<br />
{{ic|openbox --reconfigure}}<br />
<br />
<br />
As an alternative/extension you can use [https://github.com/lawl/opensnap opensnap]. It provides Aero Snap like functionality and resizes windows if you drag them to an edge of the screen. It does not provide keyboard shortcuts however.<br />
<br />
=== File associations ===<br />
Because Openbox and the applications you use with it are not well-integrated you might run into the issues with your browser. Your browser may not know which program it is supposed to use for certain types of files.<br />
<br />
A package in the AUR called {{AUR|gnome-defaults-list}} contains a list of file-types and programs specific to the Gnome desktop. The list is installed to {{ic|/etc/gnome/defaults.list}}.<br />
<br />
Open this file with your text editor. Here you can replace a given application with the name of the program of your choosing. For example, replace '''totem''' with '''vlc''' or '''eog''' with '''mirage'''. Save the file to {{ic|~/.local/share/applications/defaults.list}}.<br />
<br />
Another way of setting file associations is to install package {{Pkg|perl-file-mimeinfo}} from the official repositories and invoke '''mimeopen''' like this:<br />
mimeopen -d /path/to/file<br />
You are asked which application to use when opening {{ic|/path/to/file}}:<br />
Please choose a default application for files of type text/plain<br />
1) notepad (wine-extension-txt)<br />
2) Leafpad (leafpad)<br />
3) OpenOffice.org Writer (writer)<br />
4) gVim (gvim)<br />
5) Other...<br />
Your answer becomes the default handler for that type of file. Mimeopen is installed as {{ic|/usr/bin/perlbin/vendor/mimetype}}.<br />
<br />
=== Copy and paste ===<br />
<br />
From a terminal {{Keypress|Ctrl+Ins}} for copy and {{keypress|Shift+Ins}} for paste.<br />
<br />
Also {{keypress|Ctrl+Shift+c}} for copy and '''mouse middle-click''' for paste (in terminals).<br />
<br />
Other applications most likely use the conventional keyboard shortcuts for copy and paste.<br />
<br />
=== Window transparency ===<br />
<br />
The program {{Pkg|transset-df}} is available in the official repositories. With ''transset-df'' you can enable window transparency on-the-fly.<br />
<br />
For instance by placing the following in the ''<mouse>'' section you can have your mouse adjust window transparency by scrolling while hovering over the title bar:<br />
{{hc|~/.config/openbox/rc.xml|<nowiki><br />
<context name="Titlebar"><br />
. . .<br />
<mousebind button="Up" action="Click"><br />
<action name= "Execute" ><br />
<execute>transset-df -p .2 --inc </execute><br />
</action><br />
</mousebind><br />
<mousebind button="Down" action="Click"><br />
<action name= "Execute" ><br />
<execute>transset-df -p .2 --dec </execute><br />
</action><br />
</mousebind><br />
. . .<br />
</context><br />
</nowiki>}}<br />
{{Warning|It appears to work only when no additional actions are defined within the action group.}}<br />
<br />
=== Xprop values for applications ===<br />
Xprop can be installed with the package {{Pkg|xorg-xprop}}, available in the official repositories. <br />
<br />
If you use per-application settings frequently, you might find this bash alias handy:<br />
<br />
alias xp='xprop | grep "WM_WINDOW_ROLE\|WM_CLASS" && echo "WM_CLASS(STRING) = \"NAME\", \"CLASS\""'<br />
<br />
To use, run {{ic|xp}} and click on the running program that you would like to define with per-app settings. The result displays only the info that Openbox requires, namely the {{ic|WM_WINDOW_ROLE}} and {{ic|WM_CLASS}} (name and class) values:<br />
$ xp<br />
WM_WINDOW_ROLE(STRING) = "roster"<br />
WM_CLASS(STRING) = "gajim.py", "Gajim.py"<br />
WM_CLASS(STRING) = "NAME", "CLASS"<br />
<br />
==== Xprop for Firefox ====<br />
<br />
For whatever reason, Firefox and like-minded equivalents ignore application rules (e.g. ''<desktop>'') unless {{ic|class&#61;"Firefox*"}} is used. This applies irrespective of whatever values {{ic|xprop}} may report for the program's {{ic|WM_CLASS}}.<br />
<br />
=== Linking the menu to a button ===<br />
<br />
Some people want to link the Openbox menu (or any menu) to an object. This is useful for creating a panel button to pop up a menu. Although Openbox does not provide this, a program called {{Pkg|xdotool}} simulates a keypress. Openbox can be configured to bind that keypress to the ''ShowMenu'' action.<br />
<br />
After installing ''xdotool'', add the following to the ''<keyboard>'' section:<br />
{{hc|~/.config/openbox/rc.xml|<nowiki><br />
<keybind key="A-C-q"><br />
<action name="ShowMenu"><br />
<menu>root-menu</menu><br />
</action><br />
</keybind><br />
</nowiki>}}<br />
Then execute {{ic|openbox --reconfigure}} or {{ic|openbox --restart}} to use the new configuration. The following command summons a menu at your cursor position. The command may given as-is, linked to an object, or placed in a script.<br />
$ xdotool key ctrl+alt+q<br />
<br />
Of course, change the key shortcut to your liking. Here is a snippet from a [[Tint2]] configuration file which pops up a menu when the clock area is clicked. Each key combination is set to open a menu within Openbox's {{ic|rc.xml}} configuration file. The right‑click menu is different from the left‑click menu:<br />
clock_rclick_command = xdotool key --clearmodifiers "ctrl+XF86PowerOff"<br />
clock_lclick_command = xdotool key --clearmodifiers "alt+XF86PowerOff"<br />
<br />
=== Urxvt in the background ===<br />
<br />
With Openbox, running a terminal as desktop background is easy. You will not need [[Wikipedia:Devil's Pie (software)|devilspie]] here.<br />
<br />
First you must enable transparency, open your {{ic|~/.Xdefaults}} file (if it does not exist yet, create it).<br />
URxvt*transparent:true<br />
URxvt*scrollBar:false<br />
URxvt*geometry:124x24 #I do not use the whole screen, if you want a full screen term do not bother with this and see below.<br />
URxvt*borderLess:true<br />
URxvt*foreground:Black #Font color. My wallpaper is White, you may wish to change this to White.<br />
<br />
Then add the following to the ''<applications>'' section:<br />
{{hc|~/.config/openbox/rc.xml|<nowiki><br />
<application name="urxvt"><br />
<decor>no</decor><br />
<focus>yes</focus><br />
<position><br />
<x>center</x><br />
<y>20</y><br />
</position><br />
<layer>below</layer><br />
<desktop>all</desktop><br />
<maximized>true</maximized> #Only if you want a full size terminal.<br />
</application><br />
</nowiki>}}<br />
The ''magic'' comes from the '''<layer>below</layer>''' line, which place the application under all others. Here [[Rxvt-unicode|urxvt]] is displayed on all desktops, change it to your convenience.<br />
<br />
{{Tip|Instead of using ''<application name&#61;"urxvt">'', you can use another name ("urxvt-bg" for example), and use the {{ic|-name}} option when starting uxrvt. That way, only the urxvt terminals which you choose to name {{ic|urxvt-bg}} would be captured and modified by the application rule in {{ic|rc.xml}}. For example:<br />
$ urxvt -name urxvt-bg<br />
}}<br />
====ToggleShowDesktop exception====<br />
<br />
If you use '''ToggleShowDesktop''' to minimize all your application and show the desktop it will also minimize the urxvt window. Several methods are available to bypass this, but none works properly:<br />
* one method is explained in this [https://bbs.archlinux.org/viewtopic.php?pid=865844#p865844 forum post]. This involves editing Urxvt's source code.<br />
{{Warning|This method seems to have been broken in a recent update, now leading to a memory leak when the patched Urxvt is run.}}<br />
* the best method is outlined [https://bbs.archlinux.org/viewtopic.php?pid=929792#p929792 here]. It still has a big disadvantage: it makes ''ToggleShowDesktop'' a one-way action, not restoring the other desktop applications when ''ToggleShowDesktop'' is run for a second time. It does create the opportunity to use a different terminal emulator than Urxvt, however.<br />
<br />
=== Switching between keyboard layouts ===<br />
If you don't want to use a separate program for managing keyboard layouts, you can manually configure X to switch layouts on certain key combinations. See [[Xorg#Switching_between_keyboard_layouts]] for instructions.<br />
<br />
=== Keyboard volume control ===<br />
====ALSA====<br />
If you use [[ALSA]] for sound, you can use the {{ic|amixer}} program (part of the {{Pkg|alsa-utils}} package) to adjust the sound volume. You can use Openbox's keybindings to map different shortcuts to actions. If you want to use the multimedia keys, but do not know their names, you could look at the [[Multimedia Keys]] page to find out.<br />
<br />
For example, add the following in the ''<keyboard>'' section:<br />
{{hc|~/.config/openbox/rc.xml|<nowiki><br />
<keybind key="W-Up"><br />
<action name="Execute"><br />
<command>amixer set Master 5%+</command><br />
</action><br />
</keybind><br />
</nowiki>}}<br />
This binds {{Keypress|Super+&uarr;}} to increase your master ALSA volume by 5%. Corresponding binding for volume down:<br />
{{hc|~/.config/openbox/rc.xml|<nowiki><br />
<keybind key="W-Down"><br />
<action name="Execute"><br />
<command>amixer set Master 5%-</command><br />
</action><br />
</keybind><br />
</nowiki>}}<br />
As another example you can also use the {{ic|XF86Audio*}} keybindings:<br />
{{hc|~/.config/openbox/rc.xml|<nowiki><br />
<keybind key="XF86AudioRaiseVolume"><br />
<action name="Execute"><br />
<command>amixer set Master 5%+ unmute</command><br />
</action><br />
</keybind><br />
<keybind key="XF86AudioLowerVolume"><br />
<action name="Execute"><br />
<command>amixer set Master 5%- unmute</command><br />
</action><br />
</keybind><br />
<keybind key="XF86AudioMute"><br />
<action name="Execute"><br />
<command>amixer set Master toggle</command><br />
</action><br />
</keybind><br />
</nowiki>}}<br />
The above example should work for the majority of multimedia keyboards. It should enable to raise, lower and mute the Master control of your audio device by using the respective multimedia keyboard keys. Notice also that in this example:<br />
<br />
* The "Mute" key should unmute the Master control if it is already in mute mode.<br />
* The "Raise" and "Lower" keys should unmute the Master control if it is in mute mode.<br />
<br />
====Pulseaudio====<br />
If you are using [[PulseAudio]] with ALSA as a backend the above keybinding are slightly different as {{ic|amixer}} must be told to use PulseAudio. As always, add the following to the ''<keyboard>'' section to get the proper behaviour:<br />
{{hc|~/.config/openbox/rc.xml|<nowiki><br />
<keybind key="XF86AudioRaiseVolume"><br />
<action name="Execute"><br />
<command>amixer -D pulse set Master 5%+ unmute</command><br />
</action><br />
</keybind><br />
<keybind key="XF86AudioLowerVolume"><br />
<action name="Execute"><br />
<command>amixer -D pulse set Master 5%- unmute</command><br />
</action><br />
</keybind><br />
<keybind key="XF86AudioMute"><br />
<action name="Execute"><br />
<command>amixer set Master toggle</command><br />
</action><br />
</keybind><br />
</nowiki>}}<br />
This keybindings should work for most of the systems. Other examples can be found [http://ubuntuforums.org/showthread.php?t=987149 here].<br />
<br />
== Troubleshooting Openbox 3.5 ==<br />
=== X server crashes ===<br />
Problems have been detected after upgrade to version 3.5, that the X server might crash in attempt to start Openbox, ending with this error message:<br />
(metacity:25137): GLib-WARNING **: In call to g_spawn_sync(), exit status of a child process \<br />
was requested but SIGCHLD action was set to SIG_IGN and ECHILD was received by waitpid(), so exit \<br />
status can't be returned. This is a bug in the program calling g_spawn_sync(); either do not request \<br />
the exit status, or do not set the SIGCHLD action.<br />
xinit: connection to X server lost<br />
waiting for X server to shut down<br />
In this particular case, some problem with '''metacity''' package has been identified as the cause of the X server crash issue. To solve the problem reinstall the {{Pkg|metacity}} and {{Pkg|compiz-decorator-gtk}} packages. If that does not solve the problem, try removing them.<br />
<br />
Also, plenty of similar cases have been found on the Internet, that not only metacity package might be causing the X server to crash.<br />
Thus, whatever else instead of metacity you get in the error output message, try to reinstall it (or remove if necessary) in an attempt to get rid of this X server crash.<br />
<br />
=== Autostarting unwanted applications in 3.5 ===<br />
If unwanted applications start with your Openbox session even though they are not listed in your {{ic|~/.config/openbox/autostart}}, check the {{ic|~/.config/autostart/}} directory, it might contain the residues from your previously used desktop environment (GNOME, KDE, etc.), and remove unwanted files.<br />
<br />
=== SSH agent no longer starting ===<br />
Whereas Openbox 3.4.x allowed launching an SSH agent from {{ic|~/.config/openbox/autostart}}, with 3.5 that no longer seems to work. You need to put the following code in {{ic|~/.config/openbox/environment}}:<br />
<br />
{{bc|<nowiki><br />
SSHAGENT="/usr/bin/ssh-agent"<br />
SSHAGENTARGS="-s"<br />
if [ -z "$SSH_AUTH_SOCK" -a -x "$SSHAGENT" ]; then<br />
eval `$SSHAGENT $SSHAGENTARGS`<br />
trap "kill $SSH_AGENT_PID" 0<br />
fi<br />
</nowiki>}}<br />
<br />
=== Openbox not registering with D-Bus ===<br />
Just like with SSH agent, lots of people used to have D-Bus code in {{ic|~/.config/openbox/autostart}} - which no longer works (e.g. Thunar does not see any removable devices anymore).<br />
<br />
==See also==<br />
* [http://openbox.org/ Openbox Website] &ndash; The official website<br />
* [http://planetob.openmonkey.com/ Planet Openbox] &ndash; Openbox news portal<br />
* [http://www.box-look.org/ Box-Look.org] &ndash; A good resource for themes and related artwork<br />
* [https://bbs.archlinux.org/viewtopic.php?id=93126 Openbox Hacks and Configs Thread] @ Arch Linux Forums<br />
* [https://bbs.archlinux.org/viewtopic.php?id=45692 Openbox Screenshots Thread] @ Arch Linux Forums<br />
* [http://snott.net/linux/using-gnome3-with-openbox/ Using GNOME 3 with Openbox Tutorial]</div>Mike4cahttps://wiki.archlinux.org/index.php?title=Advanced_Linux_Sound_Architecture&diff=243068Advanced Linux Sound Architecture2013-01-05T21:08:57Z<p>Mike4ca: Previous fix would go away every time pm-utils was updated. Added a more permanent solution.</p>
<hr />
<div>[[Category:Sound]]<br />
[[Category:Audio/Video]]<br />
[[cs:Advanced Linux Sound Architecture]]<br />
[[de:Alsa]]<br />
[[es:Advanced Linux Sound Architecture]]<br />
[[fa:ALSA]]<br />
[[fr:Alsa]]<br />
[[he:Advanced Linux Sound Architecture]]<br />
[[it:Advanced Linux Sound Architecture]]<br />
[[nl:Advanced Linux Sound Architecture]]<br />
[[pt:Advanced Linux Sound Architecture]]<br />
[[ru:Advanced Linux Sound Architecture]]<br />
[[sk:Advanced Linux Sound Architecture]]<br />
[[th:Advanced Linux Sound Architecture]]<br />
[[tr:Gelişmiş_ses_mimarisi_(ALSA)]]<br />
[[zh-CN:Advanced Linux Sound Architecture]]<br />
The [[Wikipedia:Advanced Linux Sound Architecture|Advanced Linux Sound Architecture]] ('''ALSA''') is a Linux kernel component which replaced the original Open Sound System (OSSv3) for providing device drivers for sound cards. Besides the sound device drivers, '''ALSA''' also bundles a user space library for application developers who want to use driver features with a higher level API than direct interaction with the kernel drivers.<br />
<br />
{{Note|For an alternative sound environment, see the [[Open Sound System]] page.}}<br />
<br />
{{Article summary start}}<br />
{{Article summary text|Using, configuring and troubleshooting ALSA.}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Sound}}<br />
{{Article summary wiki|Disable PC Speaker Beep}}<br />
{{Article summary end}}<br />
<br />
==Installation==<br />
ALSA is included in the default Arch kernel as a set of modules, so installing it is not necessary.<br />
<br />
[[udev]] will automatically probe your hardware at boot, loading the corresponding kernel module for your audio card. Therefore, your sound should already be working, but upstream sources mute all channels by default.<br />
<br />
Users with a local login (at a virtual terminal or a display manager) have permission to play audio and change mixer levels. To allow this for a remote login, the user has to be [[Users and Groups#Group management|added]] to the {{ic|audio}} group. Membership in the {{ic|audio}} group also allows direct access to devices, which can lead to applications grabbing exclusive output (breaking software mixing) and breaks fast-user-switching, and multiseat.<br />
<br />
===User-space utilities===<br />
From [[Official Repositories|official repositories]]:<br />
* [[pacman|Install]] the {{Pkg|alsa-utils}} package which contains the {{ic|alsamixer}} user-space tool, which allows for configuration of the sound device from the console or terminal.<br />
* Install the {{Pkg|alsa-oss}} package if you want OSS applications to work with dmix (software mixing).<br />
{{Note|1=Since [[udev]] >= 171, the OSS emulation modules ({{ic|snd_seq_oss}}, {{ic|snd_pcm_oss}}, {{ic|snd_mixer_oss}}) are not automatically loaded by default.}}<br />
*Install the {{Pkg|alsa-plugins}} package if you want [[#High quality resampling|high quality resampling]], [[#Upmixing/Downmixing|upmixing/downmixing]] and other advanced features.<br />
<br />
==Unmuting the channels==<br />
The current version of ALSA installs with all channels '''muted by default'''. You will need to unmute the channels manually.<br />
<br />
It is easiest to use {{ic|alsamixer}} ncurses UI to accomplish this:<br />
<br />
$ alsamixer<br />
<br />
Alternatively, use {{ic|amixer}} from the command-line:<br />
<br />
$ amixer sset Master unmute<br />
<br />
The label {{ic|MM}} below a channel indicates that the channel is muted, and {{ic|00}} indicates that it is open.<br />
<br />
Scroll to the {{ic|Master}} and {{ic|PCM}} channels with the {{keypress|←}} and {{keypress|→}} keys and unmute them by pressing the {{keypress|m}} key. Use the {{keypress|↑}} key to increase the volume and obtain a value of {{ic|0}} dB gain. The gain can be found in the upper left next to the {{ic|Item:}} field. Higher values of gain will produce distorted sound.<br />
<br />
To get full 5.1 or 7.1 surround sound you likely need to unmute other channels such as Front, Surround, Center, LFE (subwoofer) and Side (these are the names of the channels with Intel HD Audio, they may vary with different hardware). Please take note that this will not automatically upmix stereo sources (like most music). In order to accomplish that, see [[#Upmixing/Downmixing]].<br />
<br />
Leave alsamixer by pressing {{Keypress|Esc}}.<br />
<br />
{{Note|<br />
* Some cards need to have digital output muted/turned off in order to hear analog sound. For the Soundblaster Audigy LS mute the IEC958 channel.<br />
* Some machines, (like the Thinkpad T61), have a Speaker channel which must be unmuted and adjusted as well.<br />
* Some machines, (like Dell E6400) may also require the {{ic|Front}} and {{ic|Headphone}} channels to be unmuted and adjusted.}}<br />
<br />
Next, test to see if sound works:<br />
<br />
$ speaker-test -c 2<br />
<br />
Change -c to fit your speaker setup. Use -c 8 for 7.1, for instance:<br />
<br />
$ speaker-test -c 8<br />
<br />
If it does not work, proceed to [[#Configuration]] and then [[#Troubleshooting]] to solve your issues.<br />
<br />
The {{pkg|alsa-utils}} package includes {{ic|alsa-restore.service}} and {{ic|alsa-store.service}}, which are preconfigured to run at boot and shutdown respectively.<br />
<br />
==Configuration==<br />
===No sound in virtualbox===<br />
If you experience problems with virtualbox, the following command might be helpful:<br />
<br />
{{hc|$ alsactl init|2=<nowiki><br />
<br />
Found hardware: "ICH" "SigmaTel STAC9700,83,84" "AC97a:83847600" "0x8086" "0x0000"<br />
Hardware is initialized using a generic method<br />
</nowiki><br />
}}<br />
<br />
You might need to activate the ALSA output in your audio software as well.<br />
<br />
===Set the default sound card===<br />
<br />
If your sound card order changes on boot, you can specify their order in any file ending with {{ic|.conf}} in {{ic|/etc/modprobe.d}} ({{ic|/etc/modprobe.d/alsa-base.conf}} is suggested).<br />
For example, if you want your mia sound card to be #0:<br />
<br />
{{hc|/etc/modprobe.d/alsa-base.conf|2=<nowiki><br />
options snd slots=snd_mia,snd_hda_intel<br />
options snd_mia index=0<br />
options snd_hda_intel index=1<br />
</nowiki>}}<br />
<br />
snd_mia and snd_hda_intel are the modules used by the respective cards. This configuration assumes you have one mia sound card and one card using snd_hda_intel (e.g. onboard).<br />
<br />
You can also provide an index of -2 to instruct ALSA to never use a card as the primary one. Distributions such as Linux Mint and Ubuntu use the following settings to avoid USB and other "abnormal" drivers from getting index 0:<br />
<br />
{{hc|/etc/modprobe.d/alsa-base.conf|2=<nowiki><br />
options bt87x index=-2<br />
options cx88_alsa index=-2<br />
options saa7134-alsa index=-2<br />
options snd-atiixp-modem index=-2<br />
options snd-intel8x0m index=-2<br />
options snd-via82xx-modem index=-2<br />
options snd-usb-audio index=-2<br />
options snd-usb-caiaq index=-2<br />
options snd-usb-ua101 index=-2<br />
options snd-usb-us122l index=-2<br />
options snd-usb-usx2y index=-2<br />
# Keep snd-pcsp from being loaded as first soundcard<br />
options snd-pcsp index=-2<br />
# Keep snd-usb-audio from beeing loaded as first soundcard<br />
options snd-usb-audio index=-2<br />
</nowiki>}}<br />
<br />
These changes require a system reboot.<br />
<br />
{{Out of date|{{ic|/etc/asound.conf}} does not exist on a default setup, and these instructions may not work.}}<br />
<br />
First you will have to find out the card and device id that you want to set as the default by running {{ic|aplay -l}}:<br />
<br />
{{hc|$ aplay -l|2=<nowiki><br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: Intel [HDA Intel], device 0: CONEXANT Analog [CONEXANT Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: Intel [HDA Intel], device 1: Conexant Digital [Conexant Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 1: JamLab [JamLab], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 2: Audio [Altec Lansing XT1 - USB Audio], device 0: USB Audio [USB Audio]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
</nowiki>}}<br />
<br />
For example, the last entry in this list has the card ID 2 and the device ID 0. To set this card as the default, you can either use the system-wide file {{ic|/etc/asound.conf}} or the user-specific file {{ic|~/.asoundrc}}. You may have to create the file if it does not exist. Then insert the following options with the corresponding card and device id.<br />
{{hc|~/.asoundrc|2=<nowiki><br />
defaults.pcm.card 2<br />
defaults.pcm.device 0<br />
defaults.ctl.card 2<br />
</nowiki>}}<br />
The 'pcm' options affect which card and device will be used for audio playback while the 'ctl' option affects which card is used by control utilities like alsamixer .<br />
<br />
The changes should take effect as soon as you (re-)start an application (mplayer etc.).<br />
<br />
===Making sure the sound modules are loaded===<br />
You can assume that udev will autodetect your sound properly. You can check this with the command<br />
<br />
{{hc|<nowiki>$ lsmod | grep '^snd' | column -t</nowiki>|<nowiki><br />
snd_hda_codec_hdmi 22378 4<br />
snd_hda_codec_realtek 294191 1<br />
snd_hda_intel 21738 1<br />
snd_hda_codec 73739 3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel<br />
snd_hwdep 6134 1 snd_hda_codec<br />
snd_pcm 71032 3 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec<br />
snd_timer 18992 1 snd_pcm<br />
snd 55132 9 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_timer<br />
snd_page_alloc 7017 2 snd_hda_intel,snd_pcm<br />
</nowiki>}}<br />
<br />
If the output looks similar, your sound drivers have been successfully autodetected.<br />
{{Note|Since {{ic|udev>&#61;171}}, the OSS emulation modules ({{ic|snd_seq_oss, snd_pcm_oss, snd_mixer_oss}}) are not loaded by default: [[kernel modules#Loading|Load them manually]] if they are needed.}}<br />
<br />
You might also want to check the directory {{ic|/dev/snd/}} for the right device files:<br />
<br />
{{hc|$ ls -l /dev/snd|2=<nowiki><br />
total 0<br />
crw-rw---- 1 root audio 116, 0 Apr 8 14:17 controlC0<br />
crw-rw---- 1 root audio 116, 32 Apr 8 14:17 controlC1<br />
crw-rw---- 1 root audio 116, 24 Apr 8 14:17 pcmC0D0c<br />
crw-rw---- 1 root audio 116, 16 Apr 8 14:17 pcmC0D0p<br />
crw-rw---- 1 root audio 116, 25 Apr 8 14:17 pcmC0D1c<br />
crw-rw---- 1 root audio 116, 56 Apr 8 14:17 pcmC1D0c<br />
crw-rw---- 1 root audio 116, 48 Apr 8 14:17 pcmC1D0p<br />
crw-rw---- 1 root audio 116, 1 Apr 8 14:17 seq<br />
crw-rw---- 1 root audio 116, 33 Apr 8 14:17 timer<br />
</nowiki>}}<br />
<br />
{{Note|If requesting help on IRC or the forums, please post the output of the above commands.}}<br />
<br />
If you have at least the devices '''controlC0''' and '''pcmC0D0p''' or similar, then your sound modules have been detected and loaded properly.<br />
<br />
If this is not the case, your sound modules have not been detected properly. To solve this, you can try loading the modules manually:<br />
<br />
* Locate the module for your sound card: [http://www.alsa-project.org/main/index.php/Matrix:Main ALSA Soundcard Matrix] The module will be prefixed with 'snd-' (for example: {{ic|snd-via82xx}}).<br />
* [[Kernel modules#Loading|Load the module]].<br />
* Check for the device files in {{ic|/dev/snd}} (see above) and/or try if {{ic|alsamixer}} or {{ic|amixer}} have reasonable output.<br />
* Configure {{ic|snd-NAME-OF-MODULE}} and {{ic|snd-pcm-oss}} to [[Kernel modules#Loading|load at boot]].<br />
<br />
===Getting SPDIF Output===<br />
(from gralves from the Gentoo forums)<br />
* In GNOME Volume Control, under the Options tab, change the IEC958 to PCM. This option can be enabled in the preferences.<br />
* If you do not have GNOME Volume Control installed,<br />
** Edit {{ic|/var/lib/alsa/asound.state}}. This file is where alsasound stores your mixer settings.<br />
** Find a line that says: 'IEC958 Playback Switch'. Near it you will find a line saying {{ic|value:false}}. Change it to {{ic|value:true}}.<br />
** Now find this line: 'IEC958 Playback AC97-SPSA'. Change its value to 0.<br />
** Restart ALSA.<br />
<br />
Alternative way to enable SPDIF output automatically on login (tested on SoundBlaster Audigy):<br />
<br />
* add following lines to {{ic|/etc/rc.local}}:<br />
# Use COAX-digital output<br />
amixer set 'IEC958 Optical' 100 unmute<br />
amixer set 'Audigy Analog/Digital Output Jack' on<br />
<br />
You can see the name of your card's digital output with:<br />
$ amixer scontrols<br />
<br />
===System-Wide Equalizer===<br />
====Using AlsaEqual (provides UI)====<br />
Install {{AUR|alsaequal}} from the [[AUR]].<br />
<br />
{{Note | If you have a x86_64-system and are using a 32bit-flashplugin the sound in flash will not work. Either you have to disable alsaequal or build alsaequal for 32bit.}}<br />
<br />
After installing the package, insert the following into your ALSA configuration file ({{ic|~/.asoundrc}} or {{ic|/etc/asound.conf}}):<br />
<br />
ctl.equal {<br />
type equal;<br />
}<br />
<br />
pcm.plugequal {<br />
type equal;<br />
# Modify the line below if you do not<br />
# want to use sound card 0.<br />
#slave.pcm "plughw:0,0";<br />
#by default we want to play from more sources at time:<br />
slave.pcm "plug:dmix";<br />
}<br />
#pcm.equal {<br />
# If you don't want the equalizer to be your<br />
# default soundcard comment the following<br />
# line and uncomment the above line. (You can<br />
# choose it as the output device by addressing<br />
# it with specific apps,eg mpg123 -a equal 06.Back_In_Black.mp3)<br />
pcm.!default {<br />
type plug;<br />
slave.pcm plugequal;<br />
}<br />
<br />
And you are ready to change your equalizer using command<br />
$ alsamixer -D equal<br />
<br />
Note that configuration file is different for each user (until not specified else) it is saved in {{ic|~/.alsaequal.bin}}.<br />
so if you want to use AlsaEqual with [[mpd]] or another software running under different user, you can configure it using<br />
# su mpd -c 'alsamixer -D equal'<br />
or for example, you can make a symlink to your {{ic|.alsaequal.bin}} in his home...<br />
<br />
=====Managing AlsaEqual States=====<br />
Install [http://xyne.archlinux.ca/projects/alsaequal-mgr/ alsaequal-mgr] from [http://xyne.archlinux.ca/repos/ Xyne's repos] or the [https://aur.archlinux.org/packages.php?ID=62420 AUR].<br />
<br />
Configure the equalizer as usual with <br />
$alsamixer -D equal<br />
<br />
When you are satisfied with the state, you may give it a name ("foo" in this example) and save it:<br />
$alsaequal-mgr save foo<br />
<br />
The state "foo" can then be restored at a later time with<br />
$alsaequal-mgr load foo<br />
<br />
You can thus create different equalizer states for games, movies, music genres, VoIP apps, etc. and reload them as necessary.<br />
<br />
See the [http://xyne.archlinux.ca/projects/alsaequal-mgr/ project page] and the help message for more options.<br />
<br />
====Using mbeq====<br />
{{Note | This method requires the use of a ladspa plugin which might use quite a bit of CPU when sound plays. In addition, this was made with stereophonic sound (e.g. headphones) in mind.}}<br />
<br />
Install the {{Pkg|alsa-plugins}}, {{Pkg|ladspa}} and {{Pkg|swh-plugins}} packages if you do not already have them.<br />
<br />
* If you have not already created either an {{ic|~/.asoundrc}} or a {{ic|/etc/asound.conf}} file, then create either one and insert the following:<br />
<br />
{{hc|/etc/asound.conf|2=<nowiki>pcm.eq {<br />
type ladspa<br />
<br />
# The output from the EQ can either go direct to a hardware device<br />
# (if you have a hardware mixer, e.g. SBLive/Audigy) or it can go<br />
# to the software mixer shown here.<br />
#slave.pcm "plughw:0,0"<br />
slave.pcm "plug:dmix"<br />
<br />
# Sometimes you may need to specify the path to the plugins,<br />
# especially if you have just installed them. Once you have logged<br />
# out/restarted this should not be necessary, but if you get errors<br />
# about being unable to find plugins, try uncommenting this.<br />
#path "/usr/lib/ladspa"<br />
<br />
plugins [<br />
{<br />
label mbeq<br />
id 1197<br />
input {<br />
#this setting is here by example, edit to your own taste<br />
#bands: 50hz, 100hz, 156hz, 220hz, 311hz, 440hz, 622hz, 880hz, 1250hz, 1750hz, 25000hz,<br />
#50000hz, 10000hz, 20000hz<br />
controls [ -5 -5 -5 -5 -5 -10 -20 -15 -10 -10 -10 -10 -10 -3 -2 ]<br />
}<br />
}<br />
]<br />
}<br />
<br />
# Redirect the default device to go via the EQ - you may want to do<br />
# this last, once you're sure everything is working. Otherwise all<br />
# your audio programs will break/crash if something has gone wrong.<br />
<br />
pcm.!default {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
<br />
# Redirect the OSS emulation through the EQ too (when programs are running through "aoss")<br />
<br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "eq"<br />
}<br />
</nowiki>}}<br />
<br />
* You should be good to go (if not, ask in the forum).<br />
<br />
==High quality resampling==<br />
When software mixing is enabled, ALSA is forced to resample everything to the same frequency (48000 by default when supported). dmix uses a poor resampling algorithm which produces noticeable sound quality loss.<br />
<br />
Install {{pkg|alsa-plugins}} and {{pkg|libsamplerate}}.<br />
<br />
Change the default rate converter to libsamplerate:<br />
<br />
{{hc|/etc/asound.conf|defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
or<br />
<br />
{{hc|~/.asoundrc|defaults.pcm.rate_converter "samplerate_best"}}<br />
<br />
'''samplerate_best''' offers the best sound quality, but you need a decent CPU to be able to use it as it requires a lot of CPU cycles for real-time resampling. There are other algorithms available ('''samplerate''', etc.) but they may not provide much of an improvement over the default resampler.<br />
<br />
{{Warning|On some systems, enabling samplerate_best may cause an issue where you get no sound from flashplayer.}}<br />
<br />
==Upmixing/Downmixing==<br />
===Upmixing===<br />
In order for stereo sources like music to be able to saturate a 5.1 or 7.1 sound system, you need to use upmixing. In darker days this used to be tricky and error prone but nowadays plugins exist to easily take care of this task. Thus, install {{Pkg|alsa-plugins}}.<br />
<br />
Then add the following to your ALSA configuration file of choice (either {{ic|/etc/asound.conf}} or {{ic|~/.asoundrc}}):<br />
pcm.upmix71 {<br />
type upmix<br />
slave.pcm "surround71"<br />
delay 15<br />
channels 8<br />
}<br />
<br />
You can easily change this example for 7.1 upmixing to 5.1 or 4.0.<br />
<br />
This adds a new pcm that you can use for upmixing. If you want all sound sources to go through this pcm, add it as a default below the previous definition like so:<br />
<br />
pcm.!default "plug:upmix71"<br />
<br />
The plugin automatically allows multiple sources to play through it without problems so setting is as a default is actually a safe choice. <br />
If this is not working, you have to setup your own dmixer for the upmixing PCM like this: <br />
pcm.dmix6 {<br />
type asym<br />
playback.pcm {<br />
type dmix<br />
ipc_key 567829<br />
slave {<br />
pcm "hw:0,0"<br />
channels 6<br />
}<br />
}<br />
}<br />
<br />
and use "dmix6" instead of "surround71". <br />
If you experience skipping or distorted sound, consider increasing the buffer_size (to 32768, for example) or use a [[#High quality resampling|high quality resampler]].<br />
<br />
===Downmixing===<br />
If you want to downmix sources to stereo because you, for instance, want to watch a movie with 5.1 sound on a stereo system, you need to use the vdownmix plugin that alsa provides in the same package.<br />
<br />
Again, in your configuration file, add this:<br />
<br />
pcm.!surround51 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
pcm.!surround40 {<br />
type vdownmix<br />
slave.pcm "default"<br />
}<br />
<br />
==Mixing==<br />
===Software mixing (dmix)===<br />
<br />
{{Note|For ALSA 1.0.9rc2 and higher on analog sound outputs you do not need to setup dmix. Dmix is enabled as default for soundcards which do not support hardware mixing.}}<br />
<br />
If that does not work however, it is a matter of simply creating a .asoundrc file in your home folder with the following contents.<br />
<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
<br />
This should enable software mixing and allows more than one application to make use of the soundcard. <br />
<br />
For a digital sound output such as S/PDIF, the ALSA package still does not enable dmix by default. Thus, the dmix configuration above can be used to enable dmix for S/PDIF devices.<br />
<br />
See [[#Troubleshooting]] for common problems and solutions.<br />
<br />
===Hardware mixing===<br />
====Support====<br />
If you have an audio chipset that supports mixing in hardware, then no configuration is necessary. Almost every onboard audio chipset does not support hardware mixing, and requires mixing to be done in software (see above). Many sound cards do support hardware mixing, and the ones best supported on Linux are listed below:<br />
<br />
* Creative SoundBlaster Live! (5.1 model)<br />
* Creative SoundBlaster Audigy (some models)<br />
* Creative SoundBlaster Audidy 2 (ZS models)<br />
* Creative SoundBlaster Audigy 4 (Pro models)<br />
<br />
{{Note|The low end variants of above cards, (Audigy SE, Audigy 2 NX, SoundBlaster Live! 24bit and SoundBlaster Live! 7.1) '''do not''' support hardware mixing as they use other chips.}}<br />
<br />
{{Note|The onboard VIA8237 chip supports 4-stream hardware mixing, however, it does only 3 for some motherboards (the 4th makes no sound) or is just broken. Even if it works, the quality is not good compared to other solutions.}}<br />
<br />
====Fixes====<br />
If you are using 64-bit Arch and the Intel Corporation 82801I (ICH9 Family) HD Audio Controller (rev 02), you can get sound working for Enemy Territory with the following:<br />
echo "et.x86 0 0 direct" > /proc/asound/card0/pcm0p/oss<br />
echo "et.x86 0 0 disable" > /proc/asound/card0/pcm0c/oss<br />
<br />
==Troubleshooting==<br />
===Sound Skipping While Using Dynamic Frequency Scaling===<br />
Some combinations of ALSA drivers and chipsets may cause audio from all sources to skip when used in combination with a dynamic frequency scaling governor such as {{ic|ondemand}} or {{ic|conservative}}. Currently, the solution is to switch back to the {{ic|performance}} governor.<br />
<br />
Refer to the [[CPU Frequency Scaling]] for more information.<br />
<br />
===Problems with Availability to Only One User at a Time===<br />
You might find that only one user can use the dmixer at a time. This is probably ok for most, but for those who run [[mpd]] as a separate user this poses a problem. When mpd is playing a normal user cannot play sounds though the dmixer. While it's quite possible to just run mpd under a user's login account, another solution has been found. Adding the line {{ic|ipc_key_add_uid 0}} to the {{ic|pcm.dmixer}} block disables this locking. The following is a snippet of the {{ic|asound.conf}}, the rest is the same as above.<br />
...<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
slave {<br />
...<br />
<br />
<br />
===Simultaneous Playback Issues===<br />
<br />
<br />
If you are having simultaneous playback issues, and if [[PulseAudio]] is installed (i.e. by [[GNOME]]), its default configuration is set to "hijack" the soundcard. Some users of ALSA may not want to use [[PulseAudio]] and are quite content with their current ALSA settings. One fix is to edit {{ic|/etc/asound.conf}} and comment out the following lines:<br />
# Use PulseAudio by default<br />
#pcm.!default {<br />
# type pulse<br />
# fallback "sysdefault"<br />
# hint {<br />
# show on<br />
# description "Default ALSA Output (currently PulseAudio Sound Server)"<br />
# }<br />
#}<br />
<br />
Commenting the following out also may help:<br />
#ctl.!default {<br />
# type pulse<br />
# fallback "sysdefault"<br />
#}<br />
<br />
This may be a much simpler solution than completely uninstalling [[PulseAudio]].<br />
<br />
Effectively, here is an example of a working {{ic|/etc/asound.conf}}:<br />
{{bc|<nowiki>pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
ipc_key_add_uid 0<br />
ipc_perm 0660<br />
}<br />
pcm.dsp {<br />
type plug<br />
slave.pcm "dmix"<br />
}</nowiki><br />
}}<br />
<br />
{{note|This {{ic|/etc/asound.conf}} file was intended for and used successfully with a global [[MPD]] configuration. See [[Alsa#Problems_with_Availability_to_Only_One_User_at_a_Time|this section]] on multiple users}}<br />
<br />
===Random Lack of Sound on Startup===<br />
If you randomly have no sound on startup, it may be because your system has multiple sound cards, and their order may sometimes change on startup. If this is the case, try [[#Set the default sound card|setting the default sound card]].<br />
<br />
If you use mpd and the configuration tips above do not work for you, try [http://mpd.wikia.com/wiki/Configuration#ALSA_MPD_software_volume_control reading this] instead.<br />
<br />
===Specific Program Problems===<br />
For other programs who insist on their own audio setup, eg, XMMS or Mplayer, you would need to set their specific options.<br />
<br />
For mplayer, open up {{ic|~/.mplayer/config}} (or {{ic|/etc/mplayer/mplayer.conf}} for global setting) and add the following line:<br />
ao=alsa<br />
<br />
For XMMS/Beep Media Player, go into their options and make sure the sound driver is set to Alsa, not oss.<br />
<br />
To do this in XMMS:<br />
* Open XMMS<br />
** Options -> preferences.<br />
** Choose the Alsa output plugin.<br />
<br />
For applications which do not provide a ALSA output, you can use aoss from the alsa-oss package. To use aoss, when you run the program, prefix it with {{ic|aoss}}, eg:<br />
aoss realplay<br />
<br />
pcm.!default{ ... } doesnt work for me anymore. but this does:<br />
pcm.default pcm.dmixer<br />
<br />
===Model Settings===<br />
Although Alsa detects your soundcard through the BIOS at times Alsa may not be able to recognize your [http://www.kernel.org/doc/Documentation/sound/alsa/HD-Audio-Models.txt model type]. The soundcard chip can be found in {{ic|alsamixer}} (e.g. ALC662) and the model can be set in {{ic|/etc/modprobe.d/modprobe.conf}} or {{ic|/etc/modprobe.d/sound.conf}}. For example:<br />
<br />
options snd-hda-intel model=MODEL<br />
<br />
There are other model settings too. For most cases Alsa defaults will do. If you want to look at more specific settings for your soundcard take a look at the [http://bugtrack.alsa-project.org/main/index.php/Matrix:Main Alsa Soundcard List] find your model, then Details, then look at the "Setting up modprobe..." section. Enter these values in {{ic|/etc/modprobe.d/modprobe.conf}}. For example, for an Intel AC97 audio:<br />
<br />
{{bc|# ALSA portion<br />
alias char-major-116 snd<br />
alias snd-card-0 snd-intel8x0<br />
# module options should go here<br />
<br />
# OSS/Free portion<br />
alias char-major-14 soundcore<br />
alias sound-slot-0 snd-card-0<br />
<br />
# card #1<br />
alias sound-service-0-0 snd-mixer-oss<br />
alias sound-service-0-1 snd-seq-oss<br />
alias sound-service-0-3 snd-pcm-oss<br />
alias sound-service-0-8 snd-seq-oss<br />
alias sound-service-0-12 snd-pcm-oss}}<br />
<br />
===Conflicting PC Speaker===<br />
If you're sure nothing is muted, that your drivers are installed correctly, and that your volume is right, but you still do not hear anything, then try adding the following line to {{ic|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-NAME-OF-MODULE ac97_quirk=0<br />
<br />
The above fix has been observed to work with {{ic|via82xx}}<br />
options snd-NAME-OF-MODULE ac97_quirk=1<br />
The above fix has been reported to work with {{ic|snd_intel8x0}}<br />
<br />
===No Microphone Input===<br />
In alsamixer, make sure that all the volume levels are up under recording, and that CAPTURE is toggled active on the microphone (e.g. Mic, Internal Mic) and/or on Capture (in alsamixer, select these items and press space). Try making positive Mic Boost and raising Capture and Digital levels higher; this make make static or distortion, but then you can adjust them back down once you're hearing ''something'' when you record<br />
<br />
As the pulseaudio wrapper is shown as "default" in alsamixer, you may have to press F6 to select your actual soundcard first. You may also need to enable and increase the volume of Line-in in the Playback section.<br />
<br />
To test the microphone, run these commands (see arecord's man page for further information):<br />
arecord -d 5 test-mic.wav<br />
aplay test-mic.wav<br />
<br />
If all fails, you may want to eliminate hardware failure by testing the microphone with a different device.<br />
<br />
For at least some computers, muting a microphone (MM) simply means its input doesn't go immediately to the speakers. It still receives input.<br />
<br />
Many Dell laptops need "-dmic" to be appended to the model name in {{ic|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-hda-intel model=dell-m6-dmic<br />
<br />
Some programs use try to use OSS as the main input software. Add the following lines to {{ic|/etc/modprobe.d/modprobe.conf}} to prevent OSS modules from being loaded:<br />
<br />
{{Note|The OSS modules are no longer autoloaded anyway.}}<br />
<br />
blacklist snd_pcm_oss<br />
blacklist snd_mixer_oss<br />
blacklist snd_seq_oss<br />
<br />
See also:<br />
* http://www.alsa-project.org/main/index.php/SoundcardTesting<br />
* http://alsa.opensrc.org/Record_from_mic<br />
<br />
===Setting the default Microphone/Capture Device===<br />
Some applications (Pidgin, Adobe Flash) do not provide an option to change the capture device. It becomes an issue if your microphone is on a separate device (e.g. USB webcam or microphone) than your internal sound card. To change only the default capture device, leaving the default playback device as is, you can modify your {{ic|~/.asoundrc}} file to include the following:<br />
<br />
pcm.usb<br />
{<br />
type hw<br />
card U0x46d0x81d<br />
}<br />
<br />
pcm.!default<br />
{<br />
type asym<br />
playback.pcm<br />
{<br />
type plug<br />
slave.pcm "dmix"<br />
}<br />
capture.pcm<br />
{<br />
type plug<br />
slave.pcm "usb"<br />
}<br />
}<br />
<br />
Replace "U0x46d0x81d" with your capture device's card name in ALSA. You can use {{ic|arecord -L}} to list all the capture devices detected by ALSA.<br />
<br />
===Internal Microphone not working===<br />
First make sure all the volume levels are up under recording in alsamixer. In my case adding the following option to /etc/sound.conf and reloading the snd-* module produced a new volume setting called Capture which was capturing for the internal mic. For eg, for snd-hda-intel add<br />
<br />
options snd-hda-intel enable_msi=1<br />
<br />
Then reload the module (as below), up the recording volume of Capture and then test.<br />
<br />
{{bc|# rmmod snd-hda-intel && modprobe snd-hda-intel}}<br />
<br />
===No Sound with Onboard Intel Sound Card===<br />
There may be an issue with two conflicting modules loaded, namely {{ic|snd_intel8x0}} and {{ic|snd_intel8x0m}}. In this case, blacklist snd_intel8x0m:<br />
<br />
{{hc|/etc/modprobe.d/modprobe.conf|blacklist snd_intel8x0m}}<br />
<br />
''Muting'' the "External Amplifier" in {{ic|alsamixer}} or {{ic|amixer}} may also help. See [http://alsa.opensrc.org/Intel8x0#Dell_Inspiron_8600_.28and_probably_others.29 the ALSA wiki].<br />
<br />
===No Headphone Sound with Onboard Intel Sound Card===<br />
With '''Intel Corporation 82801 I (ICH9 Family) HD Audio Controller''' on laptop, you may need to add this line to modprobe or sound.conf:<br />
<br />
options snd-hda-intel model=$model<br />
<br />
Where $model is any one of the following (in order of possibility to work, but not merit):<br />
<br />
* dell-vostro<br />
* olpc-xo-1_5<br />
* laptop<br />
* dell-m6<br />
* laptop-hpsense<br />
<br />
Note: It may be necessary to put this "options" line below (after) any "alias" lines about your card.<br />
<br />
You can see all the available models in the kernel documentation. For example [http://git.kernel.org/?p=linux/kernel/git/stable/linux-2.6.35.y.git;a=blob;f=Documentation/sound/alsa/HD-Audio-Models.txt;h=dc25bb84b83b49665a7ed850e7bf5423d50cd3ba;hb=HEAD here], but check that it is the correct version of that document for your kernel version.<br />
<br />
A list of available models is also available [http://www.mjmwired.net/kernel/Documentation/sound/alsa/HD-Audio-Models.txt here]. To know your chip name type the following command (with * being corrected to match your files). Note that some chips could have been renamed and don't directly match the available ones in the file.<br />
<br />
cat /proc/asound/card*/codec* | grep Codec<br />
<br />
Note that there is a high chance none of the input devices (all internal and external mics) will work if you choose to do this, so it is either your headphones or your mic. Please report to ALSA if you are affected by this bug.<br />
<br />
And also, if you have problems getting beeps to work (pcspkr):<br />
<br />
options snd-hda-intel model=$model enable=1 index=0<br />
<br />
===No sound when S/PDIF video card is installed===<br />
Discover available modules and their order:<br />
$ cat /proc/asound/modules<br />
0 snd_hda_intel<br />
1 snd_ca0106<br />
<br />
Disable the undesired video card audio codec in {{ic|/etc/modprobe.d/modprobe.conf}}:<br />
# /etc/modprobe.d/modprobe.conf<br />
#<br />
install snd_hda_intel /bin/false<br />
<br />
If both devices use the same module, it might be possible to disable one of them in the BIOS.<br />
<br />
===Poor sound quality or clipping===<br />
If you experience poor sound quality, try setting the PCM volume (in alsamixer) to a level such that gain is 0.<br />
<br />
If snd-usb-audio driver has been loaded, you could try to enable {{ic|softvol}} in '''/etc/asound.conf''' file. Example configuration for the first audio device:<br />
pcm.!default {<br />
type plug<br />
slave.pcm "softvol"<br />
}<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024<br />
slave {<br />
pcm "hw:0"<br />
period_time 0<br />
period_size 4096<br />
buffer_size 131072<br />
rate 50000<br />
}<br />
bindings {<br />
0 0<br />
1 1<br />
}<br />
}<br />
pcm.dsnooper {<br />
type dsnoop<br />
ipc_key 1024<br />
slave {<br />
pcm "hw:0"<br />
channels 2<br />
period_time 0<br />
period_size 4096<br />
buffer_size 131072<br />
rate 50000<br />
}<br />
bindings {<br />
0 0<br />
1 1<br />
}<br />
}<br />
pcm.softvol {<br />
type softvol<br />
slave { pcm "dmixer" }<br />
control {<br />
name "Master"<br />
card 0<br />
}<br />
}<br />
ctl.!default {<br />
type hw<br />
card 0<br />
}<br />
ctl.softvol {<br />
type hw<br />
card 0<br />
}<br />
ctl.dmixer {<br />
type hw<br />
card 0<br />
}<br />
<br />
===Pops When Starting and Stopping Playback===<br />
Some modules (e.g. snd_ac97_codec and snd_hda_intel) can power off your sound card when not in use. This can make an audible noise (like a crack/pop/scratch) when turning on/off your sound card. Sometimes even when move the slider volume, or open and close windows (KDE4). If you find this annoying try {{ic|modinfo snd_MY_MODULE}}, and look for a module option that adjusts or disables this feature.<br />
<br />
Example: to disable the power saving mode and solve cracking sound trough speakers issue, using snd_hda_intel add in {{ic|/etc/modprobe.d/modprobe.conf}}<br />
options snd_hda_intel power_save=0<br />
or<br />
options snd_hda_intel power_save=0 power_save_controller=N<br />
<br />
You can also try it with {{ic|1=modprobe snd_hda_intel power_save=0}} before.<br />
<br />
You may also have to unmute the 'Line' ALSA channel for this to work. Any value will do (other than '0' or something too high).<br />
<br />
''Example:'' on an onboard VIA VT1708S (using the snd_hda_intel module) these cracks occured even though 'power_save' was set to 0. Unmuting the 'Line' channel and setting a value of '1' solved the issue.<br />
<br />
Source: https://www.kernel.org/doc/Documentation/sound/alsa/powersave.txt<br />
<br />
If you use a laptop, pm-utils will change {{ic|power_save}} back to 1 when you go onto battery power even if you disable power saving in {{ic|/etc/modprobe.d}}. Disable this for pm-utils by disabling the script that makes the change (see [https://wiki.archlinux.org/index.php/Pm-utils#Disabling_a_hook Disabling a hook] for more information):<br />
# touch /etc/pm/power.d/intel-audio-powersave<br />
<br />
===S/PDIF Output Does Not Work===<br />
<br />
If the optical/coaxial digital output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try running<br />
# iecset audio on<br />
<br />
as root.<br />
<br />
You can also put this command in {{Ic|rc.local}} as it sometimes it may stop working after a reboot.<br />
<br />
===HDMI Output Does Not Work===<br />
If the HDMI output of your motherboard/sound card is not working or stopped working, and have already enabled and unmuted it in alsamixer, try the following.<br />
<br />
Query for Playback Devices:<br />
<br />
$ aplay -l<br />
**** List of PLAYBACK Hardware Devices ****<br />
card 0: NVidia [HDA NVidia], device 0: ALC1200 Analog [ALC1200 Analog]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 1: ALC1200 Digital [ALC1200 Digital]<br />
Subdevices: 1/1<br />
Subdevice #0: subdevice #0<br />
card 0: NVidia [HDA NVidia], device 3: NVIDIA HDMI [NVIDIA HDMI]<br />
Subdevices: 0/1<br />
Subdevice #0: subdevice #0<br />
<br />
Now that we have the info for the HDMI device, try a test, In the example below, 0 is the card number and 3 is the device number.<br />
<br />
$ aplay -D plughw:0,3 /usr/share/sounds/alsa/Front_Center.wav<br />
<br />
If aplay does not output any errors, but still no sound is heared, "reboot" the receiver, monitor or tv set. Since the HDMI interface executes a handshake on connection, it might have noticed before that there was no audio stream embedded, and disabled audio decoding. In particular, if you are using a standalone window manager (don’t know about Gnome or KDE), you may need to have some sound playing ''while'' plugging in the HDMI cable.<br />
<br />
{{Note|If you're using an ATI card and linux 3.0, check your kernel/grub settings, you most likely need to use the ''''radeon.audio'''<nowiki>=</nowiki>'''1'''' boot parameter, or alternatively set up the option in your modprobe configuration files.}}<br />
<br />
If the test is successful, create or edit your ~/.asoundrc file to set HDMI as the default audio device.<br />
<br />
{{hc|~/.asoundrc|<br />
pcm.!default {<br />
type hw<br />
card 0<br />
device 3<br />
}<br />
}}<br />
<br />
Or you above config does not work try:<br />
{{hc|~/.asoundrc|<br />
defaults.pcm.card 0<br />
defaults.pcm.device 3<br />
defaults.ctl.card 0<br />
}}<br />
<br />
<br />
<br />
====Using udev to automatically turn HDMI audio on or off====<br />
<br />
{{Out of date| /var/run/ConsoleKit/database doesn't exist anymore and the hdmi-switch script doesn't seem to work }}<br />
<br />
{{Note|This will only work if the driver supports udev; NVIDIA's proprietary one, for instance, does not.}}<br />
<br />
The previous steps in this section are good for testing, or if you don't need to hotplug your HDMI cable often. We now consider the situation where you have a laptop and want HDMI audio only when you have the HDMI cable plugged in.<br />
<br />
The code in this section comes from [https://bbs.archlinux.org/viewtopic.php?id=132641 The Arch Linux Forums].<br />
<br />
We create a udev rule (for processing the cable connect/disconnect events), two different ALSA configuration files, and a script that switches between these configurations.<br />
<br />
First create {{ic|/etc/alsa/}} if it doesn't exist yet; it will house the configuration files and the switcher script:<br />
<br />
{{bc|<nowiki>[[ -d /etc/alsa/ ]] || sudo mkdir -v /etc/alsa</nowiki>}}<br />
<br />
Place inside this directory the following files (which you may wish to tweak as you see fit):<br />
<br />
{{hc|/etc/alsa/hdmi-switch|2=<br />
<nowiki><br />
#! /bin/bash<br />
set -x<br />
export DISPLAY=:0<br />
hdmi_status="$(cat /sys/class/drm/card0-HDMI-A-1/status)"<br />
USERID="$(cat /var/run/ConsoleKit/database | grep -B 6 is_active=true | grep uid= | cut -f 2 -d '=')"<br />
USER="$(grep $USERID /etc/passwd | cut -f 1 -d ':')"<br />
<br />
if [[ $hdmi_status == "disconnected" ]]; then<br />
[[ $(pgrep X) > 0 ]] && su $USER -c "xrandr --output HDMI-1 --off"<br />
else<br />
[[ $(pgrep X) > 0 ]] && su $USER -c "xrandr --output LVDS-1 --mode 1920x1080 --auto --output HDMI-1 --auto --right-of LVDS-1"<br />
fi<br />
<br />
ln -sf "/etc/alsa/asound.hdmi-$hdmi_status" /etc/asound.conf<br />
systemctl restart alsa-restore<br />
<br />
exit 0<br />
</nowiki><br />
}}<br />
<br />
{{hc|/etc/alsa/asound.hdmi-connected|2=<br />
pcm.!default {<br />
type plug<br />
slave.pcm "dmixer"<br />
}<br />
<br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "dmixer"<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 <br />
ipc_key_add_uid 0<br />
ipc_perm 0666 <br />
slave {<br />
pcm "hw:0,3" # HDMI CARD AND DEVICE<br />
period_time 0<br />
period_size 1024<br />
buffer_size 8192<br />
rate 48000 #or 44100<br />
} <br />
}<br />
<br />
ctl.dmixer {<br />
type hw<br />
card 0<br />
}<br />
}}<br />
<br />
{{hc|/etc/alsa/asound.hdmi-disconnected|2=<br />
pcm.!default {<br />
type plug<br />
slave.pcm "dmixer"<br />
}<br />
<br />
pcm.dsp0 {<br />
type plug<br />
slave.pcm "dmixer"<br />
}<br />
<br />
pcm.dmixer {<br />
type dmix<br />
ipc_key 1024 <br />
ipc_key_add_uid 0<br />
ipc_perm 0666 <br />
slave {<br />
pcm "hw:0,0" # LOCAL CARD AND DEVICE<br />
period_time 0<br />
period_size 1024<br />
buffer_size 8192<br />
rate 48000 #or 44100<br />
}<br />
}<br />
<br />
ctl.dmixer {<br />
type hw<br />
card 0<br />
}<br />
<br />
}}<br />
<br />
The two asound.conf versions include dmix settings and allow merging of user permissions so that, for example, the mpd user and your regular user can access it at the same time.<br />
<br />
You may now test that the switcher script works by running,<br />
<br />
# chmod +x /etc/alsa/hdmi-switch<br />
# /etc/alsa/hdmi-switch<br />
<br />
You should find that you can successfully obtain HDMI audio output when you run the script while the cable is plugged in. You should be able to restore your default audio output by unplugging the cable and manually running the script again.<br />
<br />
Once you have that working, we automate the process by adding the udev rule:<br />
<br />
{{hc|/etc/udev/rules.d/hdmi.rules|2=<br />
SUBSYSTEM=="drm", ACTION=="change", RUN+="/bin/bash /etc/alsa/hdmi-switch"<br />
}}<br />
<br />
To make udev incorporate the new rule immediately, reload all rules:<br />
<br />
# udevadm control --reload-rules<br />
<br />
===HDMI Multi-channel PCM output does not work (Intel) ===<br />
As of Linux 3.1 multi-channel PCM output through HDMI with a Intel card (Intel Eaglelake, IbexPeak/Ironlake,SandyBridge/CougarPoint and IvyBridge/PantherPoint) is not yet supported. Support for it has been recently added and expected to be available in Linux 3.2. To make it work in Linux 3.1 you need to apply the following patches:<br />
<br />
* [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=patch;h=76adaa34db407f174dd06370cb60f6029c33b465 drm: support routines for HDMI/DP ELD]<br />
* [http://git.kernel.org/?p=linux/kernel/git/torvalds/linux.git;a=patch;h=e0dac65ed45e72fe34cc7ccc76de0ba220bd38bb drm/i915: pass ELD to HDMI/DP audio driver]<br />
<br />
===HP TX2500===<br />
Add these 2 lines into {{ic|/etc/modprobe.d/modprobe.conf}}:<br />
options snd-cmipci mpu_port=0x330 fm_port=0x388<br />
options snd-hda-intel index=0 model=toshiba position_fix=1<br />
<br />
options snd-hda-intel model=hp (works for tx2000cto)<br />
<br />
===Skipping Sound When Playing MP3===<br />
If you have sound skipping when playing MP3 files and you have more then 2 speakers attached to your computer (i.e. > 2 speaker system), run alsamixer and disable the channels for the speakers that you '''DO NOT''' have (i.e. do not enable the sound for the center speaker if you do not have a center speaker.<br />
<br />
===Using a USB Headset and External USB Sound Cards===<br />
If you are using a USB headset with ALSA you can try using {{AUR|asoundconf}} (currently only available from the [[AUR]]) to set the headset as the primary sound output. Before running make sure you have usb audio module enabled ({{ic|modprobe snd-usb-audio}}).<br />
<br />
# asoundconf is-active<br />
# asoundconf list<br />
# asoundconf set-default-card <chosen soundcard><br />
<br />
==== Crackling sound with USB devices ====<br />
If you experience crackling sound on USB devices, you can try tuning the snd-usb-audio for minimal latency.<br />
<br />
Add this to your {{ic|/etc/modprobe.d/modprobe.conf}}:<br />
<br />
options snd-usb-audio nrpacks=1<br />
<br />
source: http://alsa.opensrc.org/Usb-audio#Tuning_USB_devices_for_minimal_latencies<br />
<br />
==== Hot-plugging a USB Sound Card ====<br />
In order to automatically make a USB Sound Card the primary output device, when the card is plugged in, you can use the following udev rules (e.g. add the following two lines to {{ic|/etc/udev/rules.d/00-local.rules}} and reboot).<br />
<br />
{{bc|1=KERNEL=="pcmC[D0-9cp]*", ACTION=="add", PROGRAM="/bin/sh -c 'K=%k; K=$${K#pcmC}; K=$${K%%D*}; echo defaults.ctl.card $$K > /etc/asound.conf; echo defaults.pcm.card $$K >>/etc/asound.conf'"<br />
KERNEL=="pcmC[D0-9cp]*", ACTION=="remove", PROGRAM="/bin/sh -c 'echo defaults.ctl.card 0 > /etc/asound.conf; echo defaults.pcm.card 0 >>/etc/asound.conf'"}}<br />
<br />
===Error 'Unknown hardware' Appears After a Kernel Update===<br />
The following messages may be displayed during the start-up ALSA after the kernel update:<br />
Unknown hardware "foo" "bar" ...<br />
Hardware is initialized using a guess method<br />
/usr/sbin/alsactl: set_control:nnnn:failed to obtain info for control #mm (No such file or directory)<br />
<br />
or<br />
Found hardware: "HDA-Intel" "VIA VT1705" "HDA:11064397,18490397,00100000" "0x1849" "0x0397"<br />
Hardware is initialized using a generic method<br />
/usr/sbin/alsactl: set_control:1328: failed to obtain info for control #1 (No such file or directory)<br />
/usr/sbin/alsactl: set_control:1328: failed to obtain info for control #2 (No such file or directory)<br />
/usr/sbin/alsactl: set_control:1328: failed to obtain info for control #25 (No such file or directory)<br />
/usr/sbin/alsactl: set_control:1328: failed to obtain info for control #26 (No such file or directory)<br />
<br />
Simply store ALSA mixer settings again (as root):<br />
# alsactl -f /var/lib/alsa/asound.state store<br />
<br />
It may be necessary configure ALSA again with alsamixer<br />
<br />
===HDA Analyzer===<br />
If the mappings to your audio pins(plugs) do not correspond but ALSA works fine, you could try HDA Analyzer -- a pyGTK2 GUI for HD-audio control can be found [http://www.alsa-project.org/main/index.php/HDA_Analyzer at the ALSA wiki].<br />
Try tweaking the Widget Control section of the PIN nodes, to make microphones IN and headphone jacks OUT. Referring to the Config Defaults heading is a good idea.<br />
<br />
NOTE: the script is done by such way that it is incompatible with python3 (which is now shipped with ArchLinux) but tries to use it.<br />
The workaround is: open "run.py", find all occurences of "python" (2 occurences - one on the first line, and the second on the last line) and replace them all by "python2".<br />
<br />
NOTE2: the script requires root acces, but running it via su/sudo is bogus. Run it via {{ic|kdesu}} or {{ic|gksu}}.<br />
<br />
===ALSA with SDL===<br />
If you get no sound via SDL and ALSA cannot be chosen from the application. Try setting the environmental variable SDL_AUDIODRIVER to alsa.<br />
# export SDL_AUDIODRIVER=alsa<br />
<br />
===Low Sound Workaround===<br />
<br />
If you are facing low sound even after maxing out your speakers/headphones, you can give the softvol plugin a try. Add the following to {{ic|/etc/asound.conf}}.<br />
{{bc|<nowiki><br />
pcm.!default {<br />
type plug<br />
slave.pcm "softvol"<br />
}<br />
<br />
pcm.softvol {<br />
type softvol<br />
slave {<br />
pcm "dmix"<br />
}<br />
control {<br />
name "Pre-Amp"<br />
card 0<br />
}<br />
min_dB -5.0<br />
max_dB 20.0<br />
resolution 6<br />
}<br />
</nowiki>}}<br />
{{note| You'll probably have to restart the computer, as restarting the alsa daemon didn't load the new configuration for me. Also, if the configuration doesn't work even after restarting, try changing {{ic|plug}} with {{ic|hw}} in the above configuration.}}<br />
<br />
After the changes are loaded successfully, you will see a {{ic|Pre-Amp}} section in alsamixer. You can adjust the levels there.<br />
{{note|Setting a high value for {{ic|Pre-Amp}} can cause sound distortion, so adjust it according to the level that suits you.}}<br />
<br />
===Popping sound after resuming from suspension===<br />
You might hear a popping sound after resuming the computer from suspension. This can be fixed by editing {{ic|/etc/pm/sleep.d/90alsa}} and removing the line that says {{ic|aplay -d 1 /dev/zero}}<br />
<br />
==Example configurations==<br />
See [[Advanced Linux Sound Architecture/Example Configurations]].<br />
<br />
==See also==<br />
* [http://www.mjmwired.net/kernel/Documentation/sound/alsa/ALSA-Configuration.txt Advanced ALSA module configuration]<br />
* [http://alsa.opensrc.org/Main_Page Unofficial ALSA Wiki]<br />
* [https://bbs.archlinux.org/viewtopic.php?id=36815 HOWTO: Compile driver from svn]</div>Mike4cahttps://wiki.archlinux.org/index.php?title=Nano&diff=237443Nano2012-11-30T01:03:59Z<p>Mike4ca: Added "add to pacman IgnorePkg" part.</p>
<hr />
<div>[[Category:Text editors]]<br />
[[de:Nano]]<br />
[[it:Nano]]<br />
{{Lowercase title}}<br />
<br />
[http://www.nano-editor.org/ GNU nano] (or nano) is a text editor which aims to introduce a simple interface and intuitive command options to console based text editing. nano is the default console editor in distributions such as Ubuntu and supports features including colorized syntax highlighting, DOS/Mac file type conversions, spellchecking and [[Wikipedia:UTF-8|UTF-8]] encoding. nano opened with an empty buffer typically occupies under 1.5 MB of resident memory. [http://i275.photobucket.com/albums/jj281/adamchrista/Arch%20Linux/Wiki%20Examples/nano-man.png nano Screenshot].<br />
<br />
== Package Installation ==<br />
{{Pkg|nano}} is part of the [[Official Repositories|Arch Linux [core] repository]], usually installed by default by AIF.<br />
<br />
== Configuration ==<br />
=== Creating ~/.nanorc ===<br />
The look, feel and function of nano is typically controlled by way of either command-line arguments, or configuration commands within the file {{Ic|~/.nanorc}}.<br><br />
A sample configuration file is installed upon program installation and is located at {{Ic|/etc/nanorc}}.The file {{Ic|~/.nanorc}} must be first created by the user:<br />
<br />
$ cd ~<br />
$ touch .nanorc<br />
or<br />
$ cp /etc/nanorc ~/.nanorc<br />
<br />
Proceed to establish the nano console environment by setting and/or unsetting commands within {{Ic|.nanorc}} file.<br />
{{Tip|[http://www.nano-editor.org/dist/v2.1/nanorc.5.html NANORC] details the complete list configuration commands available for nano.|}}<br />
{{Note|Command-line arguments override and take precedence over the configuration commands established in .nanorc|}}<br />
<br />
==== Nano syntax highlight for PKGBUILD ====<br />
This new version highlights like the ArchLinux [http://projects.archlinux.org/svntogit/packages.git/tree "svntogit-server"].<br />
# Arch PKGBUILD files<br />
#<br />
syntax "pkgbuild" "^.*PKGBUILD*"<br />
# commands<br />
color red "\<(cd|echo|enable|exec|export|kill|popd|pushd|read|source|touch|type)\>"<br />
color brightblack "\<(case|cat|chmod|chown|cp|diff|do|done|elif|else|esac|exit|fi|find|for|ftp|function|grep|gzip|if|in)\>"<br />
color brightblack "\<(install|ln|local|make|mv|patch|return|rm|sed|select|shift|sleep|tar|then|time|until|while|yes)\>"<br />
# ${*}<br />
icolor blue "\$\{?[0-9A-Z_!@#$*?-]+\}?"<br />
# numerics<br />
color blue "\ [0-9]*"<br />
color blue "\.[0-9]*"<br />
color blue "\-[0-9]*"<br />
color blue "=[0-9]"<br />
# spaces<br />
color ,green "<nowiki>[[:space:]]</nowiki>+$"<br />
# strings; multilines are not supported<br />
color brightred ""(\\.|[^"])*"" "'(\\.|[^'])*'"<br />
# comments<br />
color brightblack "#.*$"<br />
<br />
This is another version from this [http://bbs.archlinux.org/viewtopic.php?pid=565476 forumthread].<br />
<br />
## Arch PKGBUILD files<br />
##<br />
syntax "pkgbuild" "^.*PKGBUILD$"<br />
color green start="^." end="$"<br />
color cyan "^.*(pkgbase|pkgname|pkgver|pkgrel|pkgdesc|arch|url|license).*=.*$"<br />
color brightcyan "\<(pkgbase|pkgname|pkgver|pkgrel|pkgdesc|arch|url|license)\>"<br />
color brightcyan "(\$|\$\{|\$\()(pkgbase|pkgname|pkgver|pkgrel|pkgdesc|arch|url|license)(|\}|\))"<br />
color cyan "^.*(depends|makedepends|optdepends|conflicts|provides|replaces).*=.*$"<br />
color brightcyan "\<(depends|makedepends|optdepends|conflicts|provides|replaces)\>"<br />
color brightcyan "(\$|\$\{|\$\()(depends|makedepends|optdepends|conflicts|provides|replaces)(|\}|\))"<br />
color cyan "^.*(groups|backup|noextract|options).*=.*$"<br />
color brightcyan "\<(groups|backup|noextract|options)\>"<br />
color brightcyan "(\$|\$\{|\$\()(groups|backup|noextract|options)(|\}|\))"<br />
color cyan "^.*(install|source|md5sums|sha1sums|sha256sums|sha384sums|sha512sums).*=.*$"<br />
color brightcyan "\<(install|source|md5sums|sha1sums|sha256sums|sha384sums|sha512sums)\>"<br />
color brightcyan "(\$|\$\{|\$\()(install|source|md5sums|sha1sums|sha256sums|sha384sums|sha512sums)(|\}|\))"<br />
color brightcyan "\<(startdir|srcdir|pkgdir)\>"<br />
color cyan "\.install"<br />
color brightwhite "=" "'" "\(" "\)" "\"" "#.*$" "\," "\{" "\}"<br />
color brightred "build\(\)"<br />
color brightred "package_.*.*$"<br />
color brightred "\<(configure|make|cmake|scons)\>"<br />
color red "\<(DESTDIR|PREFIX|prefix|sysconfdir|datadir|libdir|includedir|mandir|infodir)\>"<br />
<br />
To use, save as /usr/share/nano/pkgbuild.nanorc and add:<br />
include "/usr/share/nano/pkgbuild.nanorc"<br />
to your {{Ic|~/.nanorc}}<br />
<br />
or to {{Ic|/etc/nanorc}}.<br />
<br />
=== Suggested Configuration ===<br />
==== Suspension ====<br />
Unlike most interactive programs, suspension is not enabled by default. To change this, uncomment the 'set suspend' line in {{Ic|/etc/nanorc}}. This will allow you to use the keys {{Keypress|Ctrl+z}} to send nano to the background.<br />
<br />
==== Do not wrap text ====<br />
If you are coming from another distribution, you might wonder about nano's strange behaviour, so just edit /etc/nanorc like this:<br />
<br />
## Do not wrap text at all.<br />
set nowrap<br />
<br />
== nano Usage ==<br />
=== Special Functions ===<br />
* {{Keypress|Ctrl}} key modified shortcuts ({{Ic|^}}) representing commonly used functions are listed along the bottom two lines of the nano screen.<br />
* Additional functions can be interactively toggled by way of {{Ic|Meta}} (typically {{Keypress|Alt}}) and/or {{Keypress|Esc}} key modified sequences. <br />
<br />
==== Shortcut Lists Overview ====<br />
* {{Ic|^G Get Help}} ({{Keypress|F1}})<br />
: Displays the online help files within the session window. A suggested read for nano users of all levels<br />
* {{Ic|^O WriteOut}} ({{Keypress|F3}})<br />
: Save the contents of the current file buffer to a file on the disk<br />
* {{Ic|^R Read File}} ({{Keypress|F5}})<br />
: Inserts another file into the current one at the cursor location<br />
* {{Ic|^Y Prev Page}} ({{Keypress|F7}})<br />
: Display the previous buffered screen<br />
* {{Ic|^K Cut Text}} ({{Keypress|F9}})<br />
: Cut and store the current line from the beginning of the line to the end of the line <br />
* {{Ic|^C Cur Pos}} ({{Keypress|F11}})<br />
: Display line, column and character position information at the current location of the cursor <br />
* {{Ic|^X Exit}} ({{Keypress|F2}})<br />
: Close and exit nano <br />
* {{Ic|^J Justify}} ({{Keypress|F4}})<br />
: Aligns text according to the geometry of the console window<br />
* {{Ic|^W Where}} ({{Keypress|F6}})<br />
: Perform a case-insensitive string, or regular expression search<br />
* {{Ic|^V Next Page}} ({{Keypress|F8}})<br />
: Display the next buffered screen<br />
* {{Ic|^U UnCut Text}} ({{Keypress|F10}})<br />
: Paste the contents of the cut buffer to the current cursor location<br />
* {{Ic|^T To Spell}} ({{Keypress|F12}})<br />
: Spellcheck the contents of the buffer with the built-in {{Ic|spell}}, if available<br />
<br />
{{Tip|See the nano online help files via {{Keypress|Ctrl+g}} within nano and the [http://www.nano-editor.org/dist/v2.1/nano.html nano Command Manual] for complete descriptions and additional support.|}}<br />
<br />
==== Selected Toggle Functions ====<br />
* {{Ic|Meta+c}} (or {{Keypress|Esc+c}})<br />
: Toggles support for line, column and character position information.<br />
<br />
* {{Ic|Meta+i}} (or {{Keypress|Esc+i}})<br />
: Toggles support for the auto indentation of lines<br />
<br />
* {{Ic|Meta+k}} (or {{Keypress|Esc+k}})<br />
: Toggles support for cutting text from the current cursor position to the end of the line<br />
<br />
* {{Ic|Meta+m}} (or {{Keypress|Esc+m}})<br />
: Toggles mouse support for cursor placement, marking and shortcut execution<br />
<br />
* {{Ic|Meta+x}} (or {{Keypress|Esc+x}})<br />
: Toggles the display of the shortcut list at the bottom of the nano screen for additional screen space <br />
<br />
{{Tip|[http://www.nano-editor.org/dist/v2.1/nano.html#Feature-Toggles Feature Toggles] lists the global toggles available for nano.|}}<br />
<br />
== Tips & Tricks ==<br />
=== Replacing vi with nano ===<br />
Casual users may prefer the use of {{Ic|nano}} over {{Ic|vi}} for its simplicity and ease of use and may opt to replace vi with nano as the default text editor for commands such as '''visudo'''.<br />
<br />
==== Method One ====<br />
{{Warning|From {{Ic|man 8 visudo}}: ''Note that this can be a security hole since it allows the user to execute any program they wish simply by setting VISUAL or EDITOR.''}}<br />
<br />
[[Sudo|sudo]] from the core repository is compiled with {{Ic|--with-env-editor}} by default and honors the use of the {{Ic|VISUAL}} and {{Ic|EDITOR}} variables. To establish nano as the '''visudo''' editor for the duration of the current shell session, set and export the {{Ic|EDITOR}} variable before calling '''visudo'''.<br />
<br />
export EDITOR=nano <br />
<br />
===== Example Usage =====<br />
export EDITOR=nano && sudo visudo<br />
<br />
==== Method Two ====<br />
{{Warning|From {{Ic|man 8 visudo}}: ''Note that this can be a security hole since it allows the user to execute any program they wish simply by setting VISUAL or EDITOR.''}}<br />
<br />
The EDITOR variable can also be set within the following files for persistent use:<br />
<br />
* ~/[http://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files .bash_profile] (login shell)<br />
* ~/.bashrc (interactive, non-login shell)<br />
* [http://www.gnu.org/software/bash/manual/bashref.html#Bash-Startup-Files /etc/profile] (global settings for all system users except {{Ic|root}})<br />
<br />
===== Example .bash_profile =====<br />
{{Bc|. $HOME/.bashrc|<br />
<br />
export EDITOR=nano<br />
export GREP_COLOR="1;33"<br />
<br />
if [[ -z "$DISPLAY" ]] && [[ $(tty) = /dev/vc/1 ]]; then<br />
startx<br />
logout<br />
fi<br />
}}<br />
<br />
==== Method Three ====<br />
{{Note|This method can be considered draconian and may not be suitable for all users. Nonetheless, the following procedure exists as a viable example solution.}}<br />
<br />
===== Symbolic Linking =====<br />
As root, or with {{Ic|su -}}<br />
<br />
Rename the {{Ic|vi}} executable to {{Ic|vi.old}} for ease of restoration:<br />
# mv /usr/bin/vi /usr/bin/vi.old<br />
<br />
Create a symbolic link from {{Ic|/usr/bin/nano}} to {{Ic|/usr/bin/vi}}<br />
# ln -s /usr/bin/nano /usr/bin/vi<br />
<br />
Assuming sudo is installed and properly configured. You will need to add {{Ic|vi}} to the {{ic|IgnorePkg}} list in {{ic|pacman.conf}} to make this permanent. Otherwise it will revert back to {{Ic|vi}} the next time it is updated.<br />
<br />
===== Restoration of vi =====<br />
Remove the {{Ic|/usr/bin/vi}} symbolic link:<br />
unlink /usr/bin/vi<br />
<br />
Rename the {{Ic|vi.old}} executable back to {{Ic|vi}}:<br />
mv /usr/bin/vi.old /usr/bin/vi<br />
<br />
==== Method Four ====<br />
{{Note|This method can be considered draconian and may not be suitable for all users. Nonetheless, the following procedure exists as a viable example solution.}}<br />
<br />
===== Removal & Symbolic Linking =====<br />
Use [[Pacman|pacman]] to remove the {{Ic|vi}} package, its configuration, and all unneeded dependencies:<br />
pacman -Rns vi<br />
<br />
Create a symbolic link from {{Ic|/usr/bin/nano}} to {{Ic|/usr/bin/vi}}:<br />
ln -s /usr/bin/nano /usr/bin/vi<br />
<br />
===== Restoration of vi =====<br />
Remove the {{Ic|/usr/bin/vi}} symbolic link:<br />
unlink /usr/bin/vi<br />
<br />
Use pacman to install the previously deinstallled {{Ic|vi}} package:<br />
pacman -S vi<br />
<br />
{{Box Note|Do not clean {{Ic|-c}} or refresh {{Ic|-y}} the package database if you wish to retain the previously installed version of the {{Ic|vi}} package.<br>If this case, subsequent updates will also require the judicious use of the {{Ic|--ignore vi}} switch (and optionally {{Ic|--ignore glibc ncurses coreutils}}).|}}<br />
<br />
== Additional Resources == <br />
* [http://en.wikipedia.org/wiki/Nano_(text_editor) nano (text editor)] - Wikipedia Entry<br />
* [http://www.nano-editor.org/ GNU nano Homepage] - Official Site<br />
* [https://savannah.gnu.org/bugs/?group=nano GNU nano Bugs] Bug Reporting<br />
* [https://github.com/craigbarnes/nanorc Better syntax highlighting definitions]</div>Mike4cahttps://wiki.archlinux.org/index.php?title=MAC_address_spoofing&diff=222862MAC address spoofing2012-09-13T01:26:40Z<p>Mike4ca: /* Links and References */ fixed SMAC link</p>
<hr />
<div>[[cs:MAC Address Spoofing]]<br />
[[es:MAC Address Spoofing]]<br />
[[ru:MAC Address Spoofing]]<br />
[[zh-CN:MAC Address Spoofing]]<br />
[[Category:Networking]]<br />
[[Category:Security]]<br />
<br />
There are two methods for spoofing a Media Access Control (MAC) address on Arch. Both of them are outlined below.<br />
<br />
{{Warning|Changing network options usually requires special privileges. As such, you will need to be root to do this.}}<br />
__TOC__<br />
<br />
== Method 1: macchanger ==<br />
The first method uses [http://www.alobbs.com/macchanger macchanger] (a.k.a., the GNU MAC Changer), written by Alvaro Lopez Ortega. It provides a variety of features such as changing the address to match a certain vendor or completely randomizing it. The first step is to download it from [extra]:<br />
# pacman -S macchanger<br />
<br />
After this, the MAC can be spoofed with a random address. The syntax is ''macchanger -r <device>''. Standard names for devices are eth0 (for Ethernet) and wlan0 (for wireless), if only one device of each type is connected. For a secondary device, it would be eth1 or wlan1. <br />
<br />
Here is an example command for spoofing the MAC address of a device named eth0.<br />
# macchanger -r eth0<br />
<br />
To randomize all of the address except for the vendor bytes (that is, so that if the MAC address was checked it would still register as being from the same vendor), you would run the command:<br />
# macchanger -e eth0<br />
<br />
Finally, to change the MAC address to a specific value, you would run:<br />
# macchanger --mac=XX:XX:XX:XX:XX:XX<br />
<br />
Where 'XX:XX:XX:XX:XX:XX' is the MAC you wish to change to.<br />
<br />
{{Note|A device cannot be in use (connected in any way or with its interface up) while the MAC address is being changed.}}<br />
<br />
== Method 2: Manual ==<br />
<br />
This method also assumes that your device name is eth0. For clarification, read the second paragraph of Method 1.<br />
<br />
First, you can check your current MAC address with the command:<br />
$ ip link show eth0<br />
<br />
The section that interests us at the moment is the one that has "link/ether" followed by a 6-byte number. It will probably look something like this:<br />
link/ether 00:1d:98:5a:d1:3a<br />
<br />
The first step to spoofing the MAC address is to bring the network interface down. You must be logged in as root to do this. It can be accomplished with the command:<br />
$ ip link set dev eth0 down<br />
<br />
Next, we actually spoof our MAC. Any hexadecimal value will do, but some networks may be configured to refuse to assign IP addresses to a client whose MAC does not match up with a vendor. Therefore, unless you control the network(s) you are connecting to, it is a good idea to test this out with a known good MAC rather than randomizing it right away.<br />
<br />
To change the MAC, we need to run the command:<br />
$ ip link set dev eth0 address XX:XX:XX:XX:XX:XX<br />
<br />
Where any 6-byte value will suffice for 'XX:XX:XX:XX:XX:XX'.<br />
<br />
The final step is to bring the network interface back up. This can be accomplished by running the command:<br />
$ ip link set dev eth0 up<br />
<br />
If you want to verify that your MAC has been spoofed, simply run 'ip link show eth0' again and check the value for 'link/ether'. If it worked, 'link/ether' should be whatever address you decided to change it to.<br />
<br />
== Spoofing MAC with netcfg ==<br />
Put the following line in your netcfg profile to have it spoof your MAC address when its started<br />
PRE_UP='macchanger -e wlan0'<br />
You may have to replace wlan0 with your interface name.<br />
<br />
== Spoofing MAC On Boot ==<br />
You will notice with the above methods that upon reboot, your MAC will return to its initial default value. To set your MAC on boot, create the file {{ic|/etc/rc.d/functions.d/macspoof}} with the following content:<br />
<br />
<pre><br />
spoof_mac() {<br />
ip link set dev eth0 address XX:XX:XX:XX:XX:XX<br />
}<br />
<br />
add_hook sysinit_end spoof_mac<br />
</pre><br />
<br />
== Links and References ==<br />
* [http://www.alobbs.com/macchanger macchanger] project page.<br />
* [http://www.debianadmin.com/change-your-network-card-mac-media-access-control-address.html Article on DebianAdmin] with more macchanger options.<br />
* [http://wiki.gotux.net/downloads/smac SMAC] Arch Linux MAC Address Spoofer</div>Mike4cahttps://wiki.archlinux.org/index.php?title=AbiWord&diff=199523AbiWord2012-04-28T02:31:27Z<p>Mike4ca: /* Installation */</p>
<hr />
<div>[[Category:Office]]<br />
[[tr:Abiword]]<br />
{{i18n|Abiword}}<br />
<br />
[http://www.abisource.com/ Abiword] is a word processor that provides a lighter alternative for [[LibreOffice]] Writer, while at the same time providing great functionality. Abiword supports many standard document types, such as ODF documents, Microsoft Word documents, WordPerfect documents, Rich Text Format documents and HTML web pages.<br />
<br />
== Installation ==<br />
Before you install, you will want to install dictionaries if you want spell check, which can be provided by the {{Pkg|aspell-en}} package.<br />
<br />
[[pacman|Install]] the {{Pkg|abiword}} package from the [[Official Repositories|official repositories]].<br />
<br />
For additional plugins, install the {{Pkg|abiword-plugins}} package.<br />
<br />
To fix tiny cursor and misaligned text issues, install either {{Pkg|ttf-liberation}} from the official repositories or {{AUR|ttf-ms-fonts}} from the [[Arch User Repository|AUR]] and {{Pkg|ttf-freefont}} from the official repositories.<br />
<br />
== Fix for Print dialog crash ==<br />
{{Note|This bug has been reported as non-existent for version 2.8.1 or higher. However, this section will remain for legacy versions or if it crops up again,}}<br />
For some reason, the current versions of Abiword and libgnomeprint are not playing nice together. The .abw default template causes the program to crash when the user attempts to print. The solution is to force abiword to work with the .rtf format instead. By following the steps below, you will set the default save format to .rtf and trick Abiword into using a .rtf file as its default template.<br />
<br />
Open {{ic|~/.AbiSuite/AbiWord.Profile}} and insert the following line into the second <scheme> section.<br />
DefaultSaveFormat=".rtf"<br />
It should look similar to the following<br />
<Scheme<br />
name="_custom_"<br />
ZoomPercentage="64"<br />
DefaultSaveFormat=".rtf"<br />
/><br />
It is then neccessary to change the default template. You must follow these steps exactly.<br />
<br />
1) open Abiword and save a blank document titled {{ic|normal.rtf}} in {{ic|~/.AbiSuite/templates/}}. If the directory does not exist, create it.<br />
<br />
2) Rename the file to {{ic|normal.awt}} <br />
<br />
Do not just save a blank .awt file!! You must trick Abiword into using a .rtf template in order for this to work.<br />
<br />
As soon as the conflict between Abiword and libgnomeprint is resovled, these instructions will no longer be neccessary and should be removed.<br />
<br />
== Change Keybindings ==<br />
See [http://www.abisource.com/wiki/Keyboard_bindings this wiki post] on how to change the default key bindings in Abiword.<br />
<br />
== LaTeX Fonts ==<br />
The package {{Pkg|abiword-plugins}} comes with a function which allows user to insert LaTeX codes in a document. To display mathematics symbols properly, one needs to download [http://movementarian.org/latex-xft-fonts-0.1.tar.gz latex-xft-fonts] and save it to the directory {{ic|/usr/share/fonts}}. To install the font, extract the tarball and then run the following:<br />
# fc-cache -fv<br />
<br />
== Build fails with GCC 4.6 ==<br />
[http://bugzilla.abisource.com/show_bug.cgi?id=13066 The bug] has been reported and fixed upstream in a patch that is not yet (as of Abiword 2.8.6-4) available in Arch. If you experience this problem, you have to apply the patch to the [[PKGBUILD]] yourself.<br />
<br />
== External links ==<br />
*[http://www.abisource.com/ Official homepage]</div>Mike4ca