https://wiki.archlinux.org/api.php?action=feedcontributions&user=Anaveragehuman&feedformat=atomArchWiki - User contributions [en]2024-03-29T14:45:50ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=User:Anaveragehuman&diff=540423User:Anaveragehuman2018-09-08T17:04:20Z<p>Anaveragehuman: Anaveragehuman moved page User:Anaveragehuman to User:..x</p>
<hr />
<div></div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=User_talk:Anaveragehuman&diff=540421User talk:Anaveragehuman2018-09-08T17:03:49Z<p>Anaveragehuman: Anaveragehuman moved page User talk:Anaveragehuman to User talk:..x</p>
<hr />
<div></div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=Desktop_entries&diff=438944Desktop entries2016-06-24T18:10:43Z<p>Anaveragehuman: /* Obtaining icons */</p>
<hr />
<div>[[Category:Package development]]<br />
[[ja:デスクトップエントリ]]<br />
[[zh-CN:Desktop entries]]<br />
The freedesktop [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html Desktop Entry specification] provides a standard for applications to integrate into a [[desktop environment]]. Desktop entries are the configuration files that describe how an application is launched and which data it can handle. They also configure how an application appears in a menu with an icon, which is subject to the related [https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html menu specification] standard. <br />
<br />
The most common desktop entries are the {{ic|.desktop}} and {{ic|.directory}} files. This article explains briefly how to create useful and standard compliant desktop entries. It is mainly intended for package contributors and maintainers, but may also be useful for software developers and others.<br />
<br />
There are roughly three types of desktop entries:<br />
<br />
; Application : a shortcut to an application<br />
; Link : a shortcut to a web link.<br />
; Directory : a container of meta data of a menu entry<br />
<br />
The following sections will roughly explain how these are created and validated. <br />
<br />
Related to this content, and also defined in {{ic|.desktop}} files, are MIME-type associations for data files. [[Default applications]] describes how these are configured. <br />
<br />
== Application entry ==<br />
<br />
Desktop entries for applications, or {{ic|.desktop}} files, are generally a combination of meta information resources and a shortcut of an application. These files usually reside in {{ic|/usr/share/applications}} or {{ic|/usr/local/share/applications}} for applications installed system-wide, or {{ic|~/.local/share/applications}} for user-specific applications. User entries take precedence over system entries.<br />
<br />
=== File example ===<br />
<br />
Following is an example of its structure with additional comments. The example is only meant to give a quick impression, and does not show how to utilize all possible entry keys. The complete list of keys can be found in the [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys freedesktop.org specification].<br />
<br />
[Desktop Entry]<br />
<br />
# The type as listed above<br />
Type=Application<br />
<br />
# The version of the desktop entry specification to which this file complies<br />
Version=1.0<br />
<br />
# The name of the application<br />
Name=jMemorize<br />
<br />
# A comment which can/will be used as a tooltip<br />
Comment=Flash card based learning tool<br />
<br />
# The path to the folder in which the executable is run<br />
Path=/opt/jmemorise<br />
<br />
# The executable of the application.<br />
Exec=jmemorize<br />
<br />
# The name of the icon that will be used to display this entry<br />
Icon=jmemorize<br />
<br />
# Describes whether this application needs to be run in a terminal or not<br />
Terminal=false<br />
<br />
# Describes the categories in which this entry should be shown<br />
Categories=Education;Languages;Java;<br />
<br />
=== Key definition ===<br />
<br />
All Desktop recognized desktop entries can be found on the [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys freedesktop.org] site.<br />
For example, the {{Ic|Type}} key defines three types of desktop entries: Application (type 1), Link (type 2) and Directory (type 3).<br />
<br />
* {{Ic|Version}} key does not stand for the version of the application, but for the version of the desktop entry specification to which this file complies.<br />
<br />
* {{Ic|Name}}, {{Ic|GenericName}} and {{Ic|Comment}} often contain redundant values in the form of combinations of them, like:<br />
<br />
Name=Pidgin Internet Messenger<br />
GenericName=Internet Messenger<br />
or<br />
Name=NoteCase notes manager<br />
Comment=Notes Manager<br />
<br />
This should be avoided, as it will only be confusing to users. The {{Ic|Name}} key should only contain the name, or maybe an abbreviation/acronym if available.<br />
<br />
* {{Ic|GenericName}} should state what you would generally call an application that does what this specific application offers (i.e. Firefox is a "Web Browser").<br />
* {{Ic|Comment}} is intended to contain any usefull additional information.<br />
<br />
==== Deprecation ====<br />
<br />
There are quite some keys that have become deprecated over time as the standard has matured. The best/simplest way is to use the tool {{Ic|desktop-file-validate}} which is part of the package {{Pkg|desktop-file-utils}}. To validate, run<br />
$ desktop-file-validate <your desktop file><br />
This will give you very verbose and useful warnings and error messages.<br />
<br />
== Icons ==<br />
<br />
See also the [https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html Icon Theme Specification].<br />
<br />
=== Common image formats ===<br />
<br />
Here is a short overview of image formats commonly used for icons.<br />
<br />
{| class="wikitable" align="center"<br />
|+ Support for image formats for icons as specified by the freedesktop.org standard.<br />
! Extension<br />
! Full Name and/or Description<br />
! Graphics Type<br />
! Container Format<br />
! Supported<br />
|-<br />
!align="left" | .[[wikipedia:Portable Network Graphics|png]]<br />
| Portable Network Graphics<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| {{No}}<br />
| {{Yes}}<br />
|-<br />
!align="left" | .[[wikipedia:Scalable Vector Graphics|svg(z)]]<br />
| Scalable Vector Graphics<br />
| [[wikipedia:Vector graphics|Vector]]<br />
| {{No}}<br />
| {{G|Yes (optional)}}<br />
|-<br />
!align="left" | .[[wikipedia:X PixMap|xpm]]<br />
| X PixMap<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| {{No}}<br />
| {{Y|Yes (deprecated)}}<br />
|-<br />
!align="left" | .[[wikipedia:Graphics Interchange Format|gif]]<br />
| Graphics Interchange Format<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| {{No}}<br />
| {{No}}<br />
|-<br />
!align="left" | .[[wikipedia:ICO (icon image file format)|ico]]<br />
| MS Windows Icon Format<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| {{Yes}}<br />
| {{No}}<br />
|-<br />
!align="left" | .[[wikipedia:Apple Icon Image|icns]]<br />
| Apple Icon Image<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| {{Yes}}<br />
| {{No}}<br />
|-<br />
|}<br />
<br />
=== Converting icons ===<br />
<br />
If you stumble across an icon which is in a format that is not supported by the freedesktop.org standard (like {{ic|gif}} or {{ic|ico}}), you can use the ''convert'' tool (which is part of the {{Pkg|imagemagick}} package) to convert it to a supported/recommended format, e.g.:<br />
<br />
$ convert <icon name>.gif <icon name>.png<br />
<br />
If you convert from a container format like {{ic|ico}}, you will get all images that were encapsulated in the {{ic|ico}} file in the form {{ic|<icon name>-<number>.png}}. If you want to know the size of the image, or the number of images in a container file like {{ic|ico}} you can use the ''identify'' tool (also part of the {{Pkg|imagemagick}} package):<br />
<br />
{{hc|$ identify /usr/share/vlc/vlc48x48.ico|<br />
/usr/share/vlc/vlc48x48.ico[0] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[1] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[2] ICO 128x128 128x128+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[3] ICO 48x48 48x48+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[4] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[5] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb<br />
}}<br />
<br />
As you can see, the example ''ico'' file, although its name might suggest a single image of size 48x48, contains no less than 6 different sizes, of which one is even greater than 48x48, namely 128x128.<br />
<br />
Alternatively, you can use ''icotool'' (from {{Pkg|icoutils}}) to extract png images from ico container:<br />
$ icotool -x <icon name>.ico<br />
<br />
For extracting images from .icns container, you can use ''icns2png'' (provided by {{Aur|libicns}}):<br />
$ icns2png -x <icon name>.icns<br />
<br />
=== Obtaining icons ===<br />
<br />
Although packages that already ship with a .desktop-file most certainly contain an icon or a set of icons, there is sometimes the case when a developer has not created a .desktop-file, but may ship icons, nonetheless. So a good start is to look for icons in the source package.<br />
You can i.e. first filter for the extension with '''find''' and then use '''grep''' to filter further for certain buzzwords like the package name, "icon", "logo", etc, if there are quite a lot of images in the source package.<br />
$ find /path/to/source/package -regex ".*\.\(svg\|png\|xpm\|gif\|ico\)$"<br />
If the developers of an application do not include icons in their source packages, the next step would be to search on their web sites.<br />
Some projects, like i.e. ''tvbrowser'' have an [http://enwiki.tvbrowser.org/index.php/Banners,_Logos_and_other_Promotion_Material artwork/logo page] where additional icons may be found. If a project is multi-platform, there may be the case that even if the linux/unix package does not come with an icon, the Windows package might provide one. If the project uses a [[wikipedia:Version control system|Version control system]] like CVS/SVN/etc. and you have some experience with it, you also might consider browsing it for icons.<br />
If everything fails, the project might simply have no icon/logo yet.<br />
<br />
== Tools ==<br />
<br />
=== gendesk ===<br />
{{Pkg|gendesk}} started as an Arch Linux-specific tool for generating .desktop files by fetching the needed information directly from PKGBUILD files. Now it is a general tool that takes command-line arguments.<br />
<br />
Icons can be automatically downloaded from [http://openiconlibrary.sourceforge.net/ openiconlibrary], if available. (The source for icons can easily be changed in the future).<br />
<br />
==== How to use ====<br />
<br />
* Add {{Ic|gendesk}} to makedepends<br />
<br />
* Start the {{Ic|prepare()}} function with:<br />
<br />
{{bc|gendesk --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}<br />
<br />
* Alternatively, if an icon is already provided ($pkgname.png, for instance). The {{Ic|-n}} flag is for not downloading an icon or using the default icon. Example:<br />
<br />
{{bc|gendesk -n --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}<br />
<br />
* {{Ic|$srcdir/$pkgname.desktop}}&nbsp;will be created and can be installed in the {{Ic|package()}} function with:<br />
<br />
{{bc|install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"}}<br />
<br />
* The icon can be installed with:<br />
<br />
{{bc|install -Dm644 "$pkgname.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"}}<br />
<br />
* Use {{Ic|1=--name='Program Name'}} for choosing a name for the menu entry.<br />
<br />
* Use {{Ic|1=--exec='/opt/some_app/elf --with-ponies'}} for setting the exec field.<br />
<br />
* See the [https://github.com/xyproto/gendesk gendesk project] for more information.<br />
<br />
=== List or search in .desktop files ===<br />
<br />
The {{AUR|lsdesktopf}} script is listing available ''.desktop'' files or searching in their content.<br />
<br />
Examples<br />
# lsdesktopf<br />
# lsdesktopf --less<br />
# lsdesktopf --less gtk zh_TW,zh_CN,en_GB<br />
<br />
List MIME-types or parts of MIME-types found in ''.desktop'', and which desktop files shares same MIME-type, output is equal as in [[Default applications#Configuration of the mimeapps.list file|mimeapps.list]] for section {{ic|[Added Associations]}}. <br />
<br />
# lsdesktopf --gm<br />
# lsdesktopf --gm [options]<br />
<br />
For more options use {{ic|lsdesktopf --help}}.<br />
<br />
=== fbrokendesktop ===<br />
<br />
The {{AUR|fbrokendesktop}} bash script using command ''which'' to detect broken {{ic|Exec}} that points to not existing path. Without any parameters it uses preset folders in {{ic|DskPath}} array. It shows only broken ''.desktop'' with full path and filename that is missing.<br />
<br />
Examples<br />
<br />
# fbrokendesktop<br />
# fbrokendesktop /usr<br />
# fbrokendesktop /usr/share/apps/kdm/sessions/icewm.desktop<br />
<br />
== Tips and tricks ==<br />
<br />
=== Hide desktop entries ===<br />
<br />
{{Tip|Desktop entries can be hidden by creating a symbolic link to {{ic|/dev/null}}. For example:<br />
$ ln -s /dev/null ~/.local/share/applications/''foo''.desktop<br />
}}<br />
<br />
Firstly, copy the desktop entry file in question to {{ic|~/.local/share/applications}} to avoid your changes being overwritten.<br />
<br />
Then, to hide the entry in all environments, open the desktop entry file in a text editor and add the following line: {{ic|NoDisplay&#61;true}}.<br />
<br />
To hide the entry in a specific desktop, add the following line to the desktop entry file: {{ic|NotShowIn&#61;''desktop-name''}}<br />
<br />
where ''desktop-name'' can be option such as ''GNOME'', ''Xfce'', ''KDE'' etc. A desktop entry can be hidden in more than desktop at once - simply separate the desktop names with a semi-colon.<br />
<br />
=== Autostart ===<br />
<br />
If you use an XDG-compliant desktop environment, such as GNOME or KDE, the desktop environment will automatically start [[Desktop entries|*.desktop]] files found in the following directories:<br />
<br />
* System-wide: {{ic|$XDG_CONFIG_DIRS/autostart/}} ({{ic|/etc/xdg/autostart/}} by default)<br />
:* GNOME also starts files found in {{ic|/usr/share/gnome/autostart/}}<br />
* User-specific: {{ic|$XDG_CONFIG_HOME/autostart/}} ({{ic|~/.config/autostart/}} by default)<br />
<br />
Users can override system-wide {{ic|*.desktop}} files by copying them into the user-specific {{ic|~/.config/autostart/}} folder.<br />
<br />
For a more specific description of directories used, [http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html Desktop Application Autostart Specification]. <br />
<br />
{{Note|This method is supported only by XDG-compliant desktop environments. Tools like {{AUR|dapper}}, {{pkg|dex}}, or {{AUR|fbautostart}} can be used to offer XDG autostart in unsupported desktop environments as long as some other autostart mechanism exists. Use the existing mechanism to start the xdg compliant autostart tool.}}<br />
<br />
=== Modify environment variables ===<br />
<br />
Edit the {{ic|Exec}} command by appending {{ic|env}}, for example:<br />
<br />
{{hc|~/.local/share/applications/abiword.desktop|2=<br />
Exec=env LANG=he_IL.UTF-8 abiword %U<br />
}}<br />
<br />
== See also ==<br />
<br />
* [[DeveloperWiki:Removal of desktop files]]<br />
* [[Wikipedia:.desktop|desktop wikipedia article]]<br />
* [http://freedesktop.org/wiki/Howto_desktop_files information for developers]</div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=Desktop_entries&diff=438943Desktop entries2016-06-24T18:07:46Z<p>Anaveragehuman: /* Converting icons */</p>
<hr />
<div>[[Category:Package development]]<br />
[[ja:デスクトップエントリ]]<br />
[[zh-CN:Desktop entries]]<br />
The freedesktop [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html Desktop Entry specification] provides a standard for applications to integrate into a [[desktop environment]]. Desktop entries are the configuration files that describe how an application is launched and which data it can handle. They also configure how an application appears in a menu with an icon, which is subject to the related [https://specifications.freedesktop.org/menu-spec/menu-spec-latest.html menu specification] standard. <br />
<br />
The most common desktop entries are the {{ic|.desktop}} and {{ic|.directory}} files. This article explains briefly how to create useful and standard compliant desktop entries. It is mainly intended for package contributors and maintainers, but may also be useful for software developers and others.<br />
<br />
There are roughly three types of desktop entries:<br />
<br />
; Application : a shortcut to an application<br />
; Link : a shortcut to a web link.<br />
; Directory : a container of meta data of a menu entry<br />
<br />
The following sections will roughly explain how these are created and validated. <br />
<br />
Related to this content, and also defined in {{ic|.desktop}} files, are MIME-type associations for data files. [[Default applications]] describes how these are configured. <br />
<br />
== Application entry ==<br />
<br />
Desktop entries for applications, or {{ic|.desktop}} files, are generally a combination of meta information resources and a shortcut of an application. These files usually reside in {{ic|/usr/share/applications}} or {{ic|/usr/local/share/applications}} for applications installed system-wide, or {{ic|~/.local/share/applications}} for user-specific applications. User entries take precedence over system entries.<br />
<br />
=== File example ===<br />
<br />
Following is an example of its structure with additional comments. The example is only meant to give a quick impression, and does not show how to utilize all possible entry keys. The complete list of keys can be found in the [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys freedesktop.org specification].<br />
<br />
[Desktop Entry]<br />
<br />
# The type as listed above<br />
Type=Application<br />
<br />
# The version of the desktop entry specification to which this file complies<br />
Version=1.0<br />
<br />
# The name of the application<br />
Name=jMemorize<br />
<br />
# A comment which can/will be used as a tooltip<br />
Comment=Flash card based learning tool<br />
<br />
# The path to the folder in which the executable is run<br />
Path=/opt/jmemorise<br />
<br />
# The executable of the application.<br />
Exec=jmemorize<br />
<br />
# The name of the icon that will be used to display this entry<br />
Icon=jmemorize<br />
<br />
# Describes whether this application needs to be run in a terminal or not<br />
Terminal=false<br />
<br />
# Describes the categories in which this entry should be shown<br />
Categories=Education;Languages;Java;<br />
<br />
=== Key definition ===<br />
<br />
All Desktop recognized desktop entries can be found on the [https://specifications.freedesktop.org/desktop-entry-spec/desktop-entry-spec-latest.html#recognized-keys freedesktop.org] site.<br />
For example, the {{Ic|Type}} key defines three types of desktop entries: Application (type 1), Link (type 2) and Directory (type 3).<br />
<br />
* {{Ic|Version}} key does not stand for the version of the application, but for the version of the desktop entry specification to which this file complies.<br />
<br />
* {{Ic|Name}}, {{Ic|GenericName}} and {{Ic|Comment}} often contain redundant values in the form of combinations of them, like:<br />
<br />
Name=Pidgin Internet Messenger<br />
GenericName=Internet Messenger<br />
or<br />
Name=NoteCase notes manager<br />
Comment=Notes Manager<br />
<br />
This should be avoided, as it will only be confusing to users. The {{Ic|Name}} key should only contain the name, or maybe an abbreviation/acronym if available.<br />
<br />
* {{Ic|GenericName}} should state what you would generally call an application that does what this specific application offers (i.e. Firefox is a "Web Browser").<br />
* {{Ic|Comment}} is intended to contain any usefull additional information.<br />
<br />
==== Deprecation ====<br />
<br />
There are quite some keys that have become deprecated over time as the standard has matured. The best/simplest way is to use the tool {{Ic|desktop-file-validate}} which is part of the package {{Pkg|desktop-file-utils}}. To validate, run<br />
$ desktop-file-validate <your desktop file><br />
This will give you very verbose and useful warnings and error messages.<br />
<br />
== Icons ==<br />
<br />
See also the [https://specifications.freedesktop.org/icon-theme-spec/icon-theme-spec-latest.html Icon Theme Specification].<br />
<br />
=== Common image formats ===<br />
<br />
Here is a short overview of image formats commonly used for icons.<br />
<br />
{| class="wikitable" align="center"<br />
|+ Support for image formats for icons as specified by the freedesktop.org standard.<br />
! Extension<br />
! Full Name and/or Description<br />
! Graphics Type<br />
! Container Format<br />
! Supported<br />
|-<br />
!align="left" | .[[wikipedia:Portable Network Graphics|png]]<br />
| Portable Network Graphics<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| {{No}}<br />
| {{Yes}}<br />
|-<br />
!align="left" | .[[wikipedia:Scalable Vector Graphics|svg(z)]]<br />
| Scalable Vector Graphics<br />
| [[wikipedia:Vector graphics|Vector]]<br />
| {{No}}<br />
| {{G|Yes (optional)}}<br />
|-<br />
!align="left" | .[[wikipedia:X PixMap|xpm]]<br />
| X PixMap<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| {{No}}<br />
| {{Y|Yes (deprecated)}}<br />
|-<br />
!align="left" | .[[wikipedia:Graphics Interchange Format|gif]]<br />
| Graphics Interchange Format<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| {{No}}<br />
| {{No}}<br />
|-<br />
!align="left" | .[[wikipedia:ICO (icon image file format)|ico]]<br />
| MS Windows Icon Format<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| {{Yes}}<br />
| {{No}}<br />
|-<br />
!align="left" | .[[wikipedia:Apple Icon Image|icns]]<br />
| Apple Icon Image<br />
| [[wikipedia:Raster graphics|Raster]]<br />
| {{Yes}}<br />
| {{No}}<br />
|-<br />
|}<br />
<br />
=== Converting icons ===<br />
<br />
If you stumble across an icon which is in a format that is not supported by the freedesktop.org standard (like {{ic|gif}} or {{ic|ico}}), you can use the ''convert'' tool (which is part of the {{Pkg|imagemagick}} package) to convert it to a supported/recommended format, e.g.:<br />
<br />
$ convert <icon name>.gif <icon name>.png<br />
<br />
If you convert from a container format like {{ic|ico}}, you will get all images that were encapsulated in the {{ic|ico}} file in the form {{ic|<icon name>-<number>.png}}. If you want to know the size of the image, or the number of images in a container file like {{ic|ico}} you can use the ''identify'' tool (also part of the {{Pkg|imagemagick}} package):<br />
<br />
{{hc|$ identify /usr/share/vlc/vlc48x48.ico|<br />
/usr/share/vlc/vlc48x48.ico[0] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[1] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[2] ICO 128x128 128x128+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[3] ICO 48x48 48x48+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[4] ICO 32x32 32x32+0+0 8-bit DirectClass 84.3kb<br />
/usr/share/vlc/vlc48x48.ico[5] ICO 16x16 16x16+0+0 8-bit DirectClass 84.3kb<br />
}}<br />
<br />
As you can see, the example ''ico'' file, although its name might suggest a single image of size 48x48, contains no less than 6 different sizes, of which one is even greater than 48x48, namely 128x128.<br />
<br />
Alternatively, you can use ''icotool'' (from {{Pkg|icoutils}}) to extract png images from ico container:<br />
$ icotool -x <icon name>.ico<br />
<br />
For extracting images from .icns container, you can use ''icns2png'' (provided by {{Aur|libicns}}):<br />
$ icns2png -x <icon name>.icns<br />
<br />
=== Obtaining icons ===<br />
<br />
Although packages that already ship with a .desktop-file most certainly contain an icon or a set of icons, there is sometimes the case when a developer has not created a .desktop-file, but may ship icons, nonetheless. So a good start is to look for icons in the source package.<br />
You can i.e. first filter for the extension with '''find''' and then use '''grep''' to filter further for certain buzzwords like the package name, "icon", "logo", etc, if there are quite a lot of images in the source package.<br />
$ find /path/to/source/package -regex ".*\.\(svg\|png\|xpm\|gif\|ico\)$"<br />
If the developers of an application do not include icons in their source packages, the next step would be to search on their web sites.<br />
Some projects, like i.e. ''tvbrowser'' have an [http://enwiki.tvbrowser.org/index.php/Banners,_Logos_and_other_Promotion_Material artwork/logo page] where additional icons may be found. If a project is multi-platform, there may be the case that even if the linux/unix package does not come with an icon, the Windows package might provide one. If the project uses a [[wikipedia:Version control system|Version control system]] like CVS/SVN/etc. and you have some experience with it, you also might consider browsing it for icons.<br />
If everything fails, the project might simple have no icon/logo yet.<br />
<br />
== Tools ==<br />
<br />
=== gendesk ===<br />
{{Pkg|gendesk}} started as an Arch Linux-specific tool for generating .desktop files by fetching the needed information directly from PKGBUILD files. Now it is a general tool that takes command-line arguments.<br />
<br />
Icons can be automatically downloaded from [http://openiconlibrary.sourceforge.net/ openiconlibrary], if available. (The source for icons can easily be changed in the future).<br />
<br />
==== How to use ====<br />
<br />
* Add {{Ic|gendesk}} to makedepends<br />
<br />
* Start the {{Ic|prepare()}} function with:<br />
<br />
{{bc|gendesk --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}<br />
<br />
* Alternatively, if an icon is already provided ($pkgname.png, for instance). The {{Ic|-n}} flag is for not downloading an icon or using the default icon. Example:<br />
<br />
{{bc|gendesk -n --pkgname "$pkgname" --pkgdesc "$pkgdesc"}}<br />
<br />
* {{Ic|$srcdir/$pkgname.desktop}}&nbsp;will be created and can be installed in the {{Ic|package()}} function with:<br />
<br />
{{bc|install -Dm644 "$pkgname.desktop" "$pkgdir/usr/share/applications/$pkgname.desktop"}}<br />
<br />
* The icon can be installed with:<br />
<br />
{{bc|install -Dm644 "$pkgname.png" "$pkgdir/usr/share/pixmaps/$pkgname.png"}}<br />
<br />
* Use {{Ic|1=--name='Program Name'}} for choosing a name for the menu entry.<br />
<br />
* Use {{Ic|1=--exec='/opt/some_app/elf --with-ponies'}} for setting the exec field.<br />
<br />
* See the [https://github.com/xyproto/gendesk gendesk project] for more information.<br />
<br />
=== List or search in .desktop files ===<br />
<br />
The {{AUR|lsdesktopf}} script is listing available ''.desktop'' files or searching in their content.<br />
<br />
Examples<br />
# lsdesktopf<br />
# lsdesktopf --less<br />
# lsdesktopf --less gtk zh_TW,zh_CN,en_GB<br />
<br />
List MIME-types or parts of MIME-types found in ''.desktop'', and which desktop files shares same MIME-type, output is equal as in [[Default applications#Configuration of the mimeapps.list file|mimeapps.list]] for section {{ic|[Added Associations]}}. <br />
<br />
# lsdesktopf --gm<br />
# lsdesktopf --gm [options]<br />
<br />
For more options use {{ic|lsdesktopf --help}}.<br />
<br />
=== fbrokendesktop ===<br />
<br />
The {{AUR|fbrokendesktop}} bash script using command ''which'' to detect broken {{ic|Exec}} that points to not existing path. Without any parameters it uses preset folders in {{ic|DskPath}} array. It shows only broken ''.desktop'' with full path and filename that is missing.<br />
<br />
Examples<br />
<br />
# fbrokendesktop<br />
# fbrokendesktop /usr<br />
# fbrokendesktop /usr/share/apps/kdm/sessions/icewm.desktop<br />
<br />
== Tips and tricks ==<br />
<br />
=== Hide desktop entries ===<br />
<br />
{{Tip|Desktop entries can be hidden by creating a symbolic link to {{ic|/dev/null}}. For example:<br />
$ ln -s /dev/null ~/.local/share/applications/''foo''.desktop<br />
}}<br />
<br />
Firstly, copy the desktop entry file in question to {{ic|~/.local/share/applications}} to avoid your changes being overwritten.<br />
<br />
Then, to hide the entry in all environments, open the desktop entry file in a text editor and add the following line: {{ic|NoDisplay&#61;true}}.<br />
<br />
To hide the entry in a specific desktop, add the following line to the desktop entry file: {{ic|NotShowIn&#61;''desktop-name''}}<br />
<br />
where ''desktop-name'' can be option such as ''GNOME'', ''Xfce'', ''KDE'' etc. A desktop entry can be hidden in more than desktop at once - simply separate the desktop names with a semi-colon.<br />
<br />
=== Autostart ===<br />
<br />
If you use an XDG-compliant desktop environment, such as GNOME or KDE, the desktop environment will automatically start [[Desktop entries|*.desktop]] files found in the following directories:<br />
<br />
* System-wide: {{ic|$XDG_CONFIG_DIRS/autostart/}} ({{ic|/etc/xdg/autostart/}} by default)<br />
:* GNOME also starts files found in {{ic|/usr/share/gnome/autostart/}}<br />
* User-specific: {{ic|$XDG_CONFIG_HOME/autostart/}} ({{ic|~/.config/autostart/}} by default)<br />
<br />
Users can override system-wide {{ic|*.desktop}} files by copying them into the user-specific {{ic|~/.config/autostart/}} folder.<br />
<br />
For a more specific description of directories used, [http://standards.freedesktop.org/autostart-spec/autostart-spec-latest.html Desktop Application Autostart Specification]. <br />
<br />
{{Note|This method is supported only by XDG-compliant desktop environments. Tools like {{AUR|dapper}}, {{pkg|dex}}, or {{AUR|fbautostart}} can be used to offer XDG autostart in unsupported desktop environments as long as some other autostart mechanism exists. Use the existing mechanism to start the xdg compliant autostart tool.}}<br />
<br />
=== Modify environment variables ===<br />
<br />
Edit the {{ic|Exec}} command by appending {{ic|env}}, for example:<br />
<br />
{{hc|~/.local/share/applications/abiword.desktop|2=<br />
Exec=env LANG=he_IL.UTF-8 abiword %U<br />
}}<br />
<br />
== See also ==<br />
<br />
* [[DeveloperWiki:Removal of desktop files]]<br />
* [[Wikipedia:.desktop|desktop wikipedia article]]<br />
* [http://freedesktop.org/wiki/Howto_desktop_files information for developers]</div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=Systemd-timesyncd&diff=425665Systemd-timesyncd2016-03-13T18:24:09Z<p>Anaveragehuman: set ntp takes 0/1, true/false doesn't seem to work</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Networking]]<br />
[[ja:Systemd-timesyncd]]<br />
[[pl:Systemd-timesyncd]]<br />
[[ru:Systemd-timesyncd]]<br />
[[zh-CN:Systemd-timesyncd]]<br />
{{Related articles start}}<br />
{{Related|Time}}<br />
{{Related|Network Time Protocol daemon}}<br />
{{Related|OpenNTPD}}<br />
{{Related|Chrony}}<br />
{{Related|systemd-networkd}}<br />
{{Related|systemd}}<br />
{{Related articles end}}<br />
<br />
From the [http://lists.freedesktop.org/archives/systemd-devel/2014-May/019537.html systemd mailing list]:<br />
<br />
:''systemd-timesyncd'' is a daemon that has been added for synchronizing the system clock across the network. It implements an SNTP client. In contrast to NTP implementations such as chrony or the NTP reference server this only implements a client side, and does not bother with the full NTP complexity, focusing only on querying time from one remote server and synchronizing the local clock to it. Unless you intend to serve NTP to networked clients or want to connect to local hardware clocks this simple NTP client should be more than appropriate for most installations. The daemon runs with minimal privileges, and has been hooked up with networkd to only operate when network connectivity is available. The daemon saves the current clock to disk every time a new NTP sync has been acquired, and uses this to possibly correct the system clock early at bootup, in order to accommodate for systems that lack an RTC such as the Raspberry Pi and embedded devices, and make sure that time monotonically progresses on these systems, even if it is not always correct. To make use of this daemon a new system user and group "systemd-timesync" needs to be created on installation of systemd.<br />
<br />
== Installation ==<br />
<br />
The ''systemd-timesyncd'' service is available with {{Pkg|systemd}} >= 213. To start and enable it, simply run: <br />
# timedatectl set-ntp 1<br />
<br />
To check the service status, use {{ic|timedatectl status}}:<br />
<br />
{{hc|$ timedatectl status|<br />
Local time: Thu 2015-07-09 18:21:33 CEST<br />
Universal time: Thu 2015-07-09 16:21:33 UTC<br />
RTC time: Thu 2015-07-09 16:21:33<br />
Time zone: Europe/Amsterdam (CEST, +0200)<br />
Network time on: yes<br />
NTP synchronized: yes<br />
RTC in local TZ: no}}<br />
<br />
{{Tip|Before systemd 216 ''systemd-timesyncd'' required [[systemd-networkd]] to be started (without further configuration) for notification of network up-/down events. This is reportedly not universally the case anymore, for example it now receives the events from [[dhcpcd]] and [[NetworkManager]] as well, but may still be required depending on network configuration or used network management tool.}}<br />
<br />
== Configuration ==<br />
<br />
When starting, ''systemd-timesyncd'' will read the configuration file from {{ic|/etc/systemd/timesyncd.conf}}. As of [[systemd]] 217 it looks like this:<br />
{{hc|/etc/systemd/timesyncd.conf|2=<br />
[Time]<br />
#NTP=<br />
#FallbackNTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org<br />
}}<br />
<br />
To add [[Network Time Protocol daemon#Connection to NTP servers|time servers]] or change the provided ones, uncomment the relevant line and list their host name or IP separated by a space. For example, you can use any servers provided by [http://www.pool.ntp.org/ the NTP pool project] or use [https://projects.archlinux.org/svntogit/packages.git/commit/trunk?h=packages/ntp&id=1b485f87c9e1384eaf069d031e415515e8ead92d the default Arch ones] (also provided by the NTP pool project):<br />
{{hc|/etc/systemd/timesyncd.conf|2=<br />
[Time]<br />
NTP=0.arch.pool.ntp.org 1.arch.pool.ntp.org 2.arch.pool.ntp.org 3.arch.pool.ntp.org<br />
FallbackNTP=0.pool.ntp.org 1.pool.ntp.org 0.fr.pool.ntp.org<br />
}}<br />
<br />
Further to the daemon configuration, NTP servers may also be provided via a [[Systemd-networkd#.5BNetwork.5D_section|systemd-networkd]] configuration with a {{ic|1=NTP=}} option or, dynamically, via a DHCP server (since ''systemd'' 216). <br />
<br />
The NTP server to be used will be determined using the following rules:<br />
* Any per-interface NTP servers obtained from {{ic|systemd-networkd.service(8)}} configuration or via DHCP take precedence.<br />
* The NTP servers defined in {{ic|/etc/systemd/timesyncd.conf}} will be appended to the per-interface list at runtime and the daemon will contact the servers in turn until one is found that responds.<br />
* If no NTP server information is acquired after completing those steps, the NTP server host names or IP addresses defined in {{ic|1=FallbackNTP=}} will be used.<br />
<br />
{{Warning|The service writes to a local file /var/lib/systemd/clock with every syncronization, this location is hard-coded and cannot be changed. This may be problematic for running off read-only root partition or trying to minimize writes to an SD card.}}<br />
<br />
== See also ==<br />
<br />
* [https://bbs.archlinux.org/viewtopic.php?id=182600 Forum: systemd-timesyncd is not syncing time]<br />
* [https://bbs.archlinux.org/viewtopic.php?id=182172 Forum: Using systemd-timesync instead of NTP]</div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=Beginners%27_guide&diff=425663Beginners' guide2016-03-13T18:23:10Z<p>Anaveragehuman: set-ntp takes 1 or 0; true/false doesn't seem to work</p>
<hr />
<div>[[Category:Getting and installing Arch]]<br />
[[ar:Beginners' guide]]<br />
[[bg:Beginners' guide]]<br />
[[cs:Beginners' guide]]<br />
[[da:Beginners' guide]]<br />
[[de:Anleitung für Einsteiger]]<br />
[[el:Beginners' guide]]<br />
[[es:Beginners' guide]]<br />
[[fa:راهنمای_تازهکاران]]<br />
[[fr:Installation]]<br />
[[he:Beginners' guide]]<br />
[[hr:Beginners' guide]]<br />
[[hu:Beginners' guide]]<br />
[[id:Beginners' guide]]<br />
[[it:Beginners' guide]]<br />
[[ja:ビギナーズガイド]]<br />
[[ko:Beginners' guide]]<br />
[[lt:Beginners' guide]]<br />
[[nl:Beginners' guide]]<br />
[[pl:Beginners' guide]]<br />
[[pt:Beginners' guide]]<br />
[[ro:Ghidul începătorilor]]<br />
[[ru:Beginners' guide]]<br />
[[sk:Beginners' guide]]<br />
[[sr:Beginners' guide]]<br />
[[sv:Nybörjarguiden]]<br />
[[tr:Yeni başlayanlar rehberi]]<br />
[[uk:Beginners' guide]]<br />
[[zh-cn:Beginners' guide]]<br />
[[zh-tw:Beginners' guide]]<br />
{{Related articles start}}<br />
{{Related|:Category:Accessibility}}<br />
{{Related|Help:Reading}}<br />
{{Related|Installation guide}}<br />
{{Related|General recommendations}}<br />
{{Related|General troubleshooting}}<br />
{{Related articles end}}<br />
This document will guide you through the process of installing [[Arch Linux]] using the [https://projects.archlinux.org/arch-install-scripts.git/ Arch Install Scripts]. Before installing, you are advised to skim over the [[FAQ]].<br />
<br />
The community-maintained [[Main page|ArchWiki]] is the primary resource that should be consulted if issues arise. The [[IRC channel]] (irc://irc.freenode.net/#archlinux) and the [https://bbs.archlinux.org/ forums] are also excellent resources if an answer cannot be found elsewhere. In accordance with [[the Arch Way]], you are encouraged to type {{ic|man ''command''}} to read the [[man page]] of any command you are unfamiliar with.<br />
<br />
== Preparation ==<br />
<br />
Arch Linux should run on any [[Wikipedia:P6 (microarchitecture)|i686]] compatible machine with a minimum of 256 MB RAM. A basic installation with all packages from the {{Grp|base}} group should take less than 800 MB of disk space.<br />
<br />
See [[:Category:Getting and installing Arch]] for instructions on downloading the installation medium, and methods for booting it to the target machine(s). This guide assumes you use the latest available version.<br />
<br />
== Boot the installation medium ==<br />
<br />
Point the current boot device to the drive containing the Arch installation media. This is typically achieved by pressing a key during the [[Wikipedia:Power-on self test|POST]] phase, as indicated on the splash screen. Refer to your motherboard's manual for details.<br />
<br />
When the Arch menu appears, select ''Boot Arch Linux'' and press {{ic|Enter}} to enter the installation environment. See [https://projects.archlinux.org/archiso.git/tree/docs/README.bootparams README.bootparams] for a list of [[Kernel parameters#Configuration|boot parameters]].<br />
<br />
You will be logged in as the root user and presented with a [[Zsh]] shell prompt. ''Zsh'' provides advanced [http://zsh.sourceforge.net/Guide/zshguide06.html tab completion] and other features as part of the [http://grml.org/zsh/ grml config]. For modifying or creating configuration files, typically in {{ic|/etc}}, [[nano#Usage|nano]] and [[vim#Usage|vim]] are suggested.<br />
<br />
=== UEFI mode ===<br />
<br />
In case you have a [[UEFI]] motherboard with UEFI mode enabled, the CD/USB will automatically launch Arch Linux via [http://www.freedesktop.org/wiki/Software/systemd/systemd-boot/ systemd-boot].<br />
<br />
To verify you are booted in UEFI mode, check that the following directory is populated:<br />
<br />
# ls /sys/firmware/efi/efivars<br />
<br />
See [[UEFI#UEFI Variables]] for details.<br />
<br />
=== Set the keyboard layout ===<br />
<br />
The default [[Keyboard_configuration_in_console|console keymap]] is set to [[Wikipedia:File:KB United States-NoAltGr.svg|us]]. Available choices can be listed with {{ic|localectl list-keymaps}}. <br />
<br />
{{Note|{{ic|localectl list-keymaps}} will not work with any ISO released after September 2015, due to a bug in [[Overlay_filesystem|Overlayfs]] ({{Bug|46725}}). Available layouts are located inside the {{ic|/usr/share/kbd/keymaps}} folder.}}<br />
<br />
For example, to change the layout to {{ic|de-latin1}}, run:<br />
<br />
# loadkeys ''de-latin1''<br />
<br />
If certain characters appear as white squares or other symbols, change the [[Console fonts|console font]]. For example:<br />
<br />
# setfont ''lat9w-16''<br />
<br />
=== Connect to the Internet ===<br />
<br />
; Wired<br />
<br />
The [[dhcpcd]] daemon is enabled on boot for wired devices, and will attempt to start a connection. To access captive portal login forms, use the [[ELinks]] browser. <br />
<br />
Verify a connection was established, for example with ''ping''. If none is available, proceed to [[Network configuration|configure the network]]; the examples below use [[netctl]] to this purpose. To prevent conflicts, [[stop]] the ''dhcpcd'' service (replacing {{ic|enp0s25}} with the correct wired interface):<br />
<br />
# systemctl stop dhcpcd@''enp0s25''.service<br />
<br />
[[Network configuration#Device names|Interfaces]] can be listed using {{ic|ip link}}, or {{ic|iw dev}} for wireless devices. They are prefixed with {{ic|en}} (ethernet), {{ic|wl}} (WLAN), or {{ic|ww}} (WWAN).<br />
<br />
; Wireless<br />
<br />
List [[Wireless_network_configuration#Getting_some_useful_information|available networks]], and make a connection for a specified interface:<br />
<br />
# wifi-menu -o ''wlp2s0''<br />
<br />
The resulting configuration file is stored in {{ic|/etc/netctl}}. For networks which require both a username and password, see [[WPA2 Enterprise#netctl]].<br />
<br />
; Other<br />
<br />
Several example profiles, such as for configuring a [[Network configuration#Static IP address|static IP address]], are available. Copy the required one to {{ic|/etc/netctl}}, for example {{ic|ethernet-static}}:<br />
<br />
# cp /etc/netctl/examples/''ethernet-static'' /etc/netctl<br />
<br />
Adjust the copy as needed, and enable it:<br />
<br />
# netctl start ''ethernet-static''<br />
<br />
=== Update the system clock ===<br />
<br />
Use [[systemd-timesyncd]] to ensure that your system clock is accurate. To start it:<br />
<br />
# timedatectl set-ntp 1<br />
<br />
To check the service status, use {{ic|timedatectl status}}.<br />
<br />
== Prepare the storage devices ==<br />
<br />
{{Warning|<br />
* In general, partitioning or formatting will make existing data inaccessible and subject to being overwritten, i.e. destroyed, by subsequent operations. For this reason, all data that needs to be preserved must be backed up before proceeding.<br />
* If dual-booting with an existing installation of Windows on a UEFI/GPT system, avoid reformatting the UEFI partition, as this includes the Windows ''.efi'' file required to boot it. Furthermore, Arch must follow the same firmware boot mode and partitioning combination as Windows. See [[Dual boot with Windows#Important information]].}}<br />
<br />
In this step, the storage devices that will be used by the new system will be prepared. Read [[Partitioning]] for a more general overview.<br />
<br />
Users intending to create stacked block devices for [[LVM]], [[disk encryption]] or [[RAID]], should keep those instructions in mind when preparing the partitions. If intending to install to a USB flash key, see [[Installing Arch Linux on a USB key]].<br />
<br />
=== Identify the devices ===<br />
<br />
The first step is to identify the devices where the new system will be installed. The following command will show all the available devices:<br />
<br />
# lsblk<br />
<br />
This will list all devices connected to your system along with their partition schemes, including that used to host and boot live Arch installation media (e.g. a USB drive). Not all devices listed will therefore be viable or appropriate mediums for installation. Results ending in {{ic|rom}}, {{ic|loop}} or {{ic|airoot}} can be ignored.<br />
<br />
Devices (e.g. hard disks) will be listed as {{ic|sd''x''}}, where {{ic|''x''}} is a lower-case letter starting from {{ic|a}} for the first device ({{ic|sda}}), {{ic|b}} for the second device ({{ic|sdb}}), and so on. Existing partitions on those devices will be listed as {{ic|sd''xY''}}, where {{ic|''Y''}} is a number starting from {{ic|1}} for the first partition, {{ic|2}} for the second, and so on. In the example below, only one device is available ({{ic|sda}}), and that device has only one partition ({{ic|sda1}}):<br />
<br />
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT<br />
sda 8:0 0 80G 0 disk<br />
└─sda1 8:1 0 80G 0 part<br />
<br />
The {{ic|sd''xY''}} convention will be used in the examples provided below for partition tables, partitions, and file systems. As they are just examples, it is important to ensure that any necessary changes to device names, partition numbers, and/or partition sizes (etc.) are made. Do not just blindly copy and paste the commands.<br />
<br />
If the existing partition scheme does not need to be changed, skip to [[#Format the file systems and enable swap]], otherwise continue reading the following section.<br />
<br />
=== Partition table types ===<br />
<br />
If you are installing alongside an existing installation (i.e. dual-booting), a partition table will already be in use. If the devices are not partitioned, or the current partitions table or scheme needs to be changed, you will first have to determine the partition tables (one for each device) in use or to be used.<br />
<br />
There are two types of partition table:<br />
<br />
* [[GPT]]<br />
* [[MBR]]<br />
<br />
Any existing partition table can be identified with the following command for each device:<br />
<br />
# parted /dev/sd''x'' print<br />
<br />
=== Partitioning tools ===<br />
<br />
{{Warning|Using a partitioning tool that is incompatible with your partition table type will likely result in the destruction of that table, along with any existing partitions/data.}}<br />
<br />
For each device to be partitioned, a proper tool must be chosen according to the partition table to be used. Several partitioning tools are provided by the Arch installation medium, including:<br />
<br />
* [[parted]]: GPT and MBR<br />
* [[fdisk#Fdisk usage summary|fdisk]], '''cfdisk''', '''sfdisk''': GPT and MBR<br />
* [[gdisk#Gdisk usage summary|gdisk]], '''cgdisk''', '''sgdisk''': GPT<br />
<br />
Devices may also be partitioned before booting the installation media, for example through tools such as [[GParted]] (also provided as a [http://gparted.sourceforge.net/livecd.php live CD]).<br />
<br />
==== Using parted in interactive mode ====<br />
<br />
All the examples provided below make use of ''parted'', as it can be used for both UEFI/GPT and BIOS/MBR. It will be launched in ''interactive mode'', which simplifies the partitioning process and reduces unnecessary repetition by automatically applying all partitioning commands to the specified device.<br />
<br />
In order to start operating on a device, execute:<br />
<br />
# parted /dev/sd''x''<br />
<br />
You will notice that the command-line prompt changes from a hash ({{ic|#}}) to {{ic|(parted)}}: this also means that the new prompt is not a command to be manually entered when running the commands in the examples.<br />
<br />
To see a list of the available commands, enter:<br />
<br />
(parted) help<br />
<br />
When finished, or if wishing to implement a partition table or scheme for another device, exit from parted with:<br />
<br />
(parted) quit<br />
<br />
After exiting, the command-line prompt will change back to {{ic|#}}.<br />
<br />
=== Create new partition table ===<br />
<br />
You need to (re)create the partition table of a device when it has never been partitioned before, or when you want to change the type of its partition table. Recreating the partition table of a device is also useful when the partition scheme needs to be restructured from scratch.<br />
<br />
Open each device whose partition table must be (re)created with:<br />
<br />
# parted /dev/sd''x''<br />
<br />
To then create a new GPT partition table for UEFI systems, use the following command:<br />
<br />
(parted) mklabel gpt<br />
<br />
To create a new MBR/msdos partition table for BIOS systems instead, use:<br />
<br />
(parted) mklabel msdos<br />
<br />
=== Partition schemes ===<br />
<br />
You can decide the number and size of the partitions the devices should be split into, and which directories will be used to mount the partitions in the installed system (also known as ''mount points''). The mapping from partitions to directories is the [[Partitioning#Partition scheme|partition scheme]], which must comply with the following requirements:<br />
<br />
* At least a partition for the {{ic|/}} (''root'') directory '''must''' be created.<br />
* When using a UEFI motherboard, one [[Unified Extensible Firmware Interface#EFI System Partition|EFI System Partition]] '''must''' be created.<br />
<br />
In the examples below it is assumed that a new and contiguous partitioning scheme is applied to a single device. Some optional partitions will also be created for the {{ic|/boot}} and {{ic|/home}} directories which otherwise would simply be contained in the {{ic|/}} partition. See the [[Arch filesystem hierarchy]] for an explanation of the purpose of the various directories. Also the creation of an optional partiton for [[swap space]] will be illustrated.<br />
<br />
If not already open in a ''parted'' interactive session, open each device to be partitioned with:<br />
<br />
# parted /dev/sd''x''<br />
<br />
The following command will be used to create partitions:<br />
<br />
(parted) mkpart ''part-type'' ''fs-type'' ''start'' ''end''<br />
<br />
* {{ic|''part-type''}} is one of {{ic|primary}}, {{ic|extended}} or {{ic|logical}}, and is meaningful only for MBR partition tables.<br />
* {{ic|''fs-type''}} is an identifier chosen among those listed by entering {{ic|help mkpart}} as the closest match to the file system that you will use in [[#Format the file systems and enable swap]]. The ''mkpart'' command does not actually create the file system: the {{ic|''fs-type''}} parameter will simply be used by ''parted'' to set a 1-byte code that is used by boot loaders to "preview" what kind of data is found in the partition, and act accordingly if necessary. See also [[Wikipedia:Disk partitioning#PC partition types]].<br />
: {{Tip|Most [[Wikipedia:File_system#Linux|Linux native file systems]] map to the same partition code ([[Wikipedia:Partition type#PID_83h|0x83]]), so it is perfectly safe to e.g. use {{ic|ext2}} for an ''ext4''-formatted partition.}}<br />
* {{ic|''start''}} is the beginning of the partition from the start of the device. It consists of a number followed by a [http://www.gnu.org/software/parted/manual/parted.html#unit unit], for example {{ic|1M}} means start at 1MiB.<br />
* {{ic|''end''}} is the end of the partition from the start of the device (''not'' from the {{ic|''start''}} value). It has the same syntax as {{ic|''start''}}, for example {{ic|100%}} means end at the end of the device (use all the remaining space).<br />
<br />
{{Warning|It is important that the partitions do not overlap each other: if you do not want to leave unused space in the device, make sure that each partition starts where the previous one ends.}}<br />
<br />
{{Note|''parted'' may issue a warning like:<br />
<br />
Warning: The resulting partition is not properly aligned for best performance.<br />
Ignore/Cancel?<br />
<br />
In this case, read [[Partitioning#Partition alignment]] and follow [[GNU Parted#Alignment]] to fix it.}}<br />
<br />
The following command will be used to flag the partition that contains the {{ic|/boot}} directory as bootable:<br />
<br />
(parted) set ''partition'' boot on<br />
<br />
* {{ic|''partition''}} is the number of the partition to be flagged (see the output of the {{ic|print}} command).<br />
<br />
==== UEFI/GPT examples ====<br />
<br />
In every instance, a special bootable [[Unified Extensible Firmware Interface#EFI System Partition|EFI System Partition]] is required.<br />
<br />
If creating a new EFI System Partition, use the following commands (a size of 512MiB is suggested):<br />
<br />
(parted) mkpart ESP fat32 1MiB 513MiB<br />
(parted) set 1 boot on<br />
<br />
The remaining partition scheme is entirely up to you. For one other partition using 100% of remaining space:<br />
<br />
(parted) mkpart primary ext4 513MiB 100%<br />
<br />
For separate {{ic|/}} (20GiB) and {{ic|/home}} (all remaining space) partitions:<br />
<br />
(parted) mkpart primary ext4 513MiB 20.5GiB<br />
(parted) mkpart primary ext4 20.5GiB 100%<br />
<br />
And for separate {{ic|/}} (20GiB), swap (4GiB), and {{ic|/home}} (all remaining space) partitions:<br />
<br />
(parted) mkpart primary ext4 513MiB 20.5GiB<br />
(parted) mkpart primary linux-swap 20.5GiB 24.5GiB<br />
(parted) mkpart primary ext4 24.5GiB 100%<br />
<br />
==== BIOS/MBR examples ====<br />
<br />
For a minimum single primary partition using all available disk space, the following command would be used:<br />
<br />
(parted) mkpart primary ext4 1MiB 100%<br />
(parted) set 1 boot on<br />
<br />
In the following instance, a 20GiB {{ic|/}} partition will be created, followed by a {{ic|/home}} partition using all the remaining space:<br />
<br />
(parted) mkpart primary ext4 1MiB 20GiB<br />
(parted) set 1 boot on<br />
(parted) mkpart primary ext4 20GiB 100%<br />
<br />
In the final example below, separate {{ic|/boot}} (100MiB), {{ic|/}} (20GiB), swap (4GiB), and {{ic|/home}} (all remaining space) partitions will be created:<br />
<br />
(parted) mkpart primary ext4 1MiB 100MiB<br />
(parted) set 1 boot on<br />
(parted) mkpart primary ext4 100MiB 20GiB<br />
(parted) mkpart primary linux-swap 20GiB 24GiB<br />
(parted) mkpart primary ext4 24GiB 100%<br />
<br />
=== Format the file systems and enable swap ===<br />
<br />
Once the partitions have been created, each '''must''' be formatted with an appropriate [[file system]], ''except'' for swap partitions. All available partitions on the intended installation device can be listed with the following command:<br />
<br />
# lsblk /dev/sd''x''<br />
<br />
With the exceptions noted below, it is recommended to use the {{ic|ext4}} file system:<br />
<br />
# mkfs.ext4 /dev/sd''xY''<br />
<br />
''If'' a new UEFI system partition has been created on a UEFI/GPT system, it '''must''' be formatted with a {{ic|fat32}} file system:<br />
<br />
# mkfs.fat -F32 /dev/sd''xY''<br />
<br />
''If'' a swap partition has been created, it must be set up and activated with:<br />
<br />
# mkswap /dev/sd''xY''<br />
# swapon /dev/sd''xY''<br />
<br />
Mount the root partition to the {{ic|/mnt}} directory of the live system:<br />
<br />
# mount /dev/sd''xY'' /mnt<br />
<br />
Remaining [[Partitioning#Partition_scheme|partitions]] (except ''swap'') may be mounted in any order, after creating the respective mount points. For example, when using a {{ic|/boot}} partition:<br />
<br />
# mkdir -p /mnt/boot<br />
# mount /dev/sd''xZ'' /mnt/boot<br />
<br />
{{ic|/boot}} is also recommended for mounting the EFI System Partition on a UEFI/GPT system. See [[EFISTUB]] and related articles for alternatives.<br />
<br />
== Installation ==<br />
<br />
=== Select the mirrors ===<br />
<br />
Packages to be installed must be downloaded from mirror servers, which are defined in {{ic|/etc/pacman.d/mirrorlist}}. On the live system, all mirrors are enabled, and sorted by their synchronization status and speed at the time the installation image was created.<br />
<br />
The higher a mirror is placed in the list, the more priority it is given when downloading a package. You may want to edit the file accordingly, and move the geographically closest mirrors to the top of the list, although other criteria should be taken into account. See [[Mirrors]] for details.<br />
<br />
''pacstrap'' will also install a copy of this file to the new system, so it is worth getting right.<br />
<br />
=== Install the base packages ===<br />
<br />
The ''pacstrap'' script installs the base system. To build packages from the [[AUR]] or with [[ABS]], the {{Grp|base-devel}} group is also required.<br />
<br />
Not all tools from the live installation (see [https://projects.archlinux.org/archiso.git/tree/configs/releng/packages.both packages.both]) are part of the base group. Packages can later be [[install]]ed with ''pacman'', or by appending their names to the ''pacstrap'' command.<br />
<br />
# pacstrap -i /mnt base base-devel<br />
<br />
The {{ic|-i}} switch ensures prompting before package installation.<br />
<br />
== Configuration ==<br />
<br />
=== fstab ===<br />
<br />
Generate an [[fstab]] file. The {{ic|-U}} option indicates UUIDs: see [[Persistent block device naming]]. Labels can be used instead through the {{ic|-L}} option.<br />
<br />
# genfstab -U /mnt >> /mnt/etc/fstab<br />
<br />
Check the resulting file in {{ic|/mnt/etc/fstab}} afterwards, and edit it in case of errors.<br />
<br />
=== Change root ===<br />
<br />
Copy any other configuration files to the new system in {{ic|/mnt}} (such as netctl profiles in {{ic|/etc/netctl}}), then [[chroot]] to it:<br />
<br />
# arch-chroot /mnt /bin/bash<br />
<br />
=== Locale ===<br />
<br />
The [[Locale]] defines which language the system uses, and other regional considerations such as currency denomination, numerology, and character sets.<br />
<br />
Possible values are listed in {{ic|/etc/locale.gen}}. Uncomment {{ic|en_US.UTF-8 UTF-8}}, as well as other needed localisations. Save the file, and generate the new locales:<br />
<br />
# locale-gen<br />
<br />
Create {{ic|/etc/locale.conf}}, where {{ic|LANG}} refers to the ''first column'' of an uncommented entry in {{ic|/etc/locale.gen}}:<br />
<br />
{{hc|1=/etc/locale.conf|2=<br />
LANG=''en_US.UTF-8''<br />
}}<br />
<br />
If you [[#Set the keyboard layout|set the keyboard layout]], make the changes persistent in {{ic|/etc/vconsole.conf}}. For example, if {{ic|de-latin1}} was set with ''loadkeys'', and {{ic|lat9w-16}} with ''setfont'', assign the {{ic|KEYMAP}} and {{ic|FONT}} variables accordingly:<br />
<br />
{{hc|1=/etc/vconsole.conf|2=<br />
KEYMAP=''de-latin1''<br />
FONT=''lat9w-16''<br />
}}<br />
<br />
=== Time ===<br />
<br />
Select a [[time zone]]:<br />
<br />
# tzselect<br />
<br />
Create the symbolic link {{ic|/etc/localtime}}, where {{ic|Zone/Subzone}} is the {{ic|TZ}} value from ''tzselect'':<br />
<br />
# ln -s /usr/share/zoneinfo/''Zone''/''SubZone'' /etc/localtime<br />
<br />
It is recommended to adjust the time skew, and set the time standard to UTC:<br />
<br />
# hwclock --systohc --utc<br />
<br />
If other operating systems are installed on the machine, they must be configured accordingly. See [[Time]] for details.<br />
<br />
=== Initramfs ===<br />
<br />
As [[mkinitcpio]] was run on installation of {{Pkg|linux}} with ''pacstrap'', most users can use the defaults provided in {{ic|mkinitcpio.conf}}.<br />
<br />
For special configurations, set the correct [[Mkinitcpio#HOOKS|hooks]] in {{ic|/etc/mkinitcpio.conf}} and [[Mkinitcpio#Image_creation_and_activation|re-generate]] the initramfs image:<br />
<br />
# mkinitcpio -p linux<br />
<br />
=== Install a boot loader ===<br />
<br />
See [[Boot loaders]] for available choices and configurations. If you have an Intel CPU, install the {{Pkg|intel-ucode}} package, and [[Microcode#Enabling_Intel_microcode_updates|enable microcode updates]].<br />
<br />
==== UEFI/GPT ====<br />
<br />
Here, the installation drive is assumed to be GPT-partioned, and have the [[Unified Extensible Firmware Interface#EFI System Partition|EFI System Partition]] (gdisk type {{ic|EF00}}, formatted with FAT32) mounted at {{ic|/boot}}.<br />
<br />
Install [[systemd-boot]] to the EFI system partition:<br />
<br />
# bootctl install<br />
<br />
When successful, create a boot entry as described in [[systemd-boot#Configuration]] (replacing {{ic|$esp}} with {{ic|/boot}}), or adapt the examples in {{ic|/usr/share/systemd/bootctl/}}.<br />
<br />
==== BIOS/MBR ====<br />
<br />
Install the {{Pkg|grub}} package. To search for other operating systems, also install {{Pkg|os-prober}}:<br />
<br />
# pacman -S grub os-prober<br />
<br />
Install the bootloader to the ''drive'' Arch was installed to:<br />
<br />
# grub-install ''/dev/sda''<br />
<br />
Generate {{ic|grub.cfg}}:<br />
<br />
# grub-mkconfig -o /boot/grub/grub.cfg<br />
<br />
See [[GRUB]] for more information.<br />
<br />
=== Configure the network ===<br />
<br />
The procedure is similar to [[#Connect to the Internet]], except made persistent for subsequent boots. Select '''one''' daemon to handle the network.<br />
<br />
==== Hostname ====<br />
<br />
Set the [[hostname]] to your liking:<br />
<br />
{{hc|1=/etc/hostname|2=<br />
''myhostname''<br />
}}<br />
<br />
It is recommended to append the same hostname to {{ic|localhost}} entries in {{ic|/etc/hosts}}. See [[Network configuration#Set the hostname]] for details.<br />
<br />
==== Wired ====<br />
<br />
When only requiring a single wired connection, [[enable]] the [[dhcpcd]] service:<br />
<br />
# systemctl enable dhcpcd@''interface''.service<br />
<br />
Where {{ic|''interface''}} is an ethernet [[Network_configuration#Device_names|device name]].<br />
<br />
See [[Network configuration#Configure the IP address]] for other available methods.<br />
<br />
==== Wireless ====<br />
<br />
Install {{Pkg|iw}}, {{Pkg|wpa_supplicant}}, and (for ''wifi-menu'') {{Pkg|dialog}}:<br />
<br />
# pacman -S iw wpa_supplicant dialog<br />
<br />
Additional [[Wireless#Installing driver/firmware|firmware packages]] may also be required.<br />
<br />
If you used ''wifi-menu'' priorly, repeat the steps '''after''' finishing the rest of this installation and rebooting, to prevent conflicts with the existing processes.<br />
<br />
See [[Netctl]] and [[Wireless#Wireless management]] for more information.<br />
<br />
== Unmount the partitions and reboot ==<br />
<br />
Set the root [[password]] with:<br />
<br />
# passwd<br />
<br />
Exit from the chroot environment by running {{ic|exit}} or pressing {{ic|Ctrl+D}}. <br />
<br />
Partitions will be unmounted automatically by ''systemd'' on shutdown. You may however unmount manually as a safety measure:<br />
<br />
# umount -R /mnt<br />
<br />
If the partition is "busy", you can find the cause with [[fuser]]. Reboot the computer. <br />
<br />
# reboot<br />
<br />
Remove the installation media, or you may boot back into it. You can log into your new installation as ''root'', using the password you specified with ''passwd''.<br />
<br />
== Post-installation ==<br />
<br />
Your new Arch Linux base system is now a functional GNU/Linux environment ready to be built into whatever you wish or require for your purposes. You are now ''strongly'' advised to read the [[General recommendations]] article, especially the first two sections. Its other sections provide links to post-installation tutorials like setting up a graphical user interface, sound or a touchpad.<br />
<br />
For a list of applications that may be of interest, see [[List of applications]].</div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=Xterm&diff=420721Xterm2016-02-14T15:39:54Z<p>Anaveragehuman: Grammar fixes</p>
<hr />
<div>[[Category:Terminal emulators]]<br />
[[de:Xterm]]<br />
[[fr:Xterm]]<br />
[[ja:Xterm]]<br />
[[ru:Xterm]]<br />
'''xterm''' is the standard [[Wikipedia:Terminal emulator|terminal emulator]] for the [[X Window System]]. It is highly configurable and has many useful and some unusual features.<br />
<br />
==Basics==<br />
=== Resource file settings ===<br />
<br />
There are several options you can set in your [[X resources]] files that may make this terminal emulator much easier to use. See {{ic|man xterm}} for a complete list.<br />
<br />
==== TERM Environmental Variable ====<br />
<br />
Allow xterm to report the '''TERM '''variable correctly. '''Do not '''set the TERM variable from your ''~/.bashrc'' or ''~/.bash_profile'' or similar file. The terminal itself should report the correct TERM to the system so that the proper ''terminfo'' file will be used. Two usable terminfo files are ''xterm, ''and ''xterm-256color.''<br />
<br />
Without setting TERM explicitly, xterm should report {{ic|$TERM}} as {{ic|xterm}}. You can check this from within xterm using either of these commands:<br />
<br />
$ echo $TERM<br />
$ tset -q<br />
<br />
When TERM is not set explicitly, color schemes for some programs, such as ''vim, ''may not appear until a key is pressed or some other input occurs. This can be remedied with this resource setting:<br />
<br />
xterm*termName: xterm-256color<br />
<br />
==== UTF-8 ====<br />
<br />
Make certain your locale settings are correct for UTF-8. Adding the following line to your resource file will then make xterm interpret all incoming data as UTF-8 encoded:<br />
<br />
XTerm*locale: true<br />
<br />
==== Fix the 'Alt' key ====<br />
<br />
If you use the {{ic|Alt}} key for keyboard shortcuts, you will need this in your resource file:<br />
<br />
XTerm*metaSendsEscape: true<br />
<br />
=== Scrolling ===<br />
As new lines are written to the bottom of the xterm window, older lines disappear from the top. To scroll up and down through the off-screen lines one can use the mouse wheel, the key combinations {{ic|Shift+PageUp}} and {{ic|Shift+PageDown}}, or the scrollbar.<br />
<br />
By default, 1024 lines are saved. You can change the number of saved lines with the {{ic|saveLines}} resource,<br />
Xterm*saveLines: 4096<br />
<br />
Other X resources that affect scrolling are {{ic|jumpScroll}}, set to {{ic|true}} by default, and {{ic|multiScroll}} and {{ic|fastScroll}}, both of which default to {{ic|false}}. To scroll inside an [[#VT_Options_menu|alternate screen]], set {{ic|alternateScroll}} to {{ic|true}}.<br />
<br />
==== The Scrollbar ====<br />
The scrollbar is not shown by default. It can be made visible by a menu selection, by command line options, or by setting resource values. It can be made to appear to the left or right of the window and its visual appearance can be modified through resource settings.<br />
<br />
The scrollbar operates differently from what you may be accustomed to using.<br />
*To scroll down:<br />
:– Click on the scrollbar with the left mouse button.<br />
:– Click on the scrollbar below the ''thumb'' with the middle mouse button.<br />
*To scroll up:<br />
:– Click on the scrollbar with the right mouse button.<br />
:– Click on the scrollbar above the ''thumb'' with the middle mouse button.<br />
*To position text, moving in either direction:<br />
:– Grab the ''thumb'' and use "click-and-drag" with the middle mouse button.<br />
<br />
===Menus===<br />
The Archlinux version of xterm is compiled with the ''toolbar, ''or ''menubar, ''disabled. The menus are still available as ''popups ''when you press {{ic|Ctrl+MouseButton}} within the xterm window. The actions invoked by the menu items can often be accomplished using command line options or by setting resource values.<br />
<br />
{{Tip|If the popup menu windows show only as small boxes, it is probably because you have a line similar to this, {{ic|xterm*geometry: 80x32}}, in your resources file. This ''does ''start xterm in an 80 column by 32 row main window, but it also forces the menu windows to be 80 pixels by 32 pixels! Replace the incorrect line with this:<br />
{{bc|xterm*VT100.geometry: 80x32}}}}<br />
<br />
Some of the menu options are discussed below.<br />
<br />
====Main Options menu====<br />
'''''Ctrl + LeftMouse'''''<br />
<br />
*{{ic|Secure Keyboard}} attempts to ensure only the xterm window, and no other application, receives your keystrokes. The display changes to reverse video when it is invoked. If the display is not in reverse video, the ''Secure Keyboard ''mode is not in effect. Please read the "SECURITY" section of the xterm man page for this option's limitations.<br />
<br />
*{{ic|Allow SendEvents}} allows other processes to send keypress and mouse events to the xterm window. Because of the security risk, do not enable this unless you are very sure you know what you are doing.<br />
<br />
*{{ic|Log to File}} – The log file will be named {{ic|Xterm.log.hostname.yyyy.mm.dd.hh.mm.ss.XXXXXX}}. This file will contain all the printed output ''and all cursor movements. ''Logging may be a security risk.<br />
<br />
*The six {{ic|Send *** Signal}} menu items are not often useful, except when your keyboard fails. {{ic|HUP}}, {{ic|TERM}} and {{ic|KILL}} will close the xterm window. {{ic|KILL}} should be avoided, as it does not allow any cleanup code to run.<br />
<br />
*The {{ic|Quit}} menu item will also close the xterm window – it is the same as sending a {{ic|HUP}} signal. Most users will use the keyboard combination {{ic|Ctrl+d}} or will type {{ic|exit}} to close an xterm instance.<br />
====VT Options menu====<br />
'''''Ctrl + MiddleMouse'''''<br />
*{{ic|Select to Clipboard}} – Normally, selected text is stored in PRIMARY, to be pasted with {{ic|Shift+Insert}} or by using the middle mouse button. By toggling this option to ''on, ''selected text will use CLIPBOARD, allowing you to paste the text selected in an xterm window into a GUI application using {{ic|Ctrl+v}}. The corresponding XTerm resource is {{ic|selectToClipboard}}.<br />
<br />
*{{ic|Show Alternate Screen}} – When you use an a terminal application such as ''vim, ''or ''less, ''the alternate screen is opened. The main VT window, now hidden, remains in memory. You can view this main window, but not issue any commands in it, by toggling this menu option. You are able to select and copy text from this main window.<br />
<br />
{{Tip|Suspending the process running in the Alternate Screen and then resuming it provides more functionality than using {{ic|Show Alternate Screen}}. With a ''bash'' shell, pressing {{ic|Ctrl+z}} suspends the process; issuing the command {{ic|fg}} then resumes it.}}<br />
<br />
*{{ic|Show Tek Window}} and {{ic|Switch to Tek Mode}} – The [[Wikipedia:Tektronix 4010|Tektronix 4014]] was a graphics terminal from the 1970s used for CAD and plotting applications. The command line program {{ic|graph}}, from {{Pkg|plotutils}}, and the application {{Pkg|gnuplot}} can be made to use xterm's Tek emulation; most people will prefer more modern display options for charting data. See the [[#Tek 4014 demonstration]], below.<br />
<br />
====VT Fonts menu====<br />
'''''Ctrl + RightMouse'''''<br />
<br />
*When using XLFD fonts, the first seven menu items will change the font face and the font size used in the current xterm window. If you are using an Xft font, only the font size will change, the font face will not change with the different selections, .<br />
<br />
{{Tip|{{ic|Unreadable}} and {{ic|Tiny}} are useful if you wish to keep an eye on a process but do not want to devote a large amount of screen space to the terminal window. An example use might be a lengthy compilation process when you only want to see that the operation completes.}}<br />
<br />
*{{ic|Selection}}, when using XLFD font names, allows you to switch to the font name stored in the PRIMARY selection (or CLIPBOARD).<br />
<br />
====Tek Options menu==== <br />
From the '''Tek Window,''' '''''Ctrl + MiddleMouse'''''<br />
<br />
The first section's options allow you to change the Tek window font size. The second set of options are used to move the focus between the Tek emulation window and the main, or ''VT, ''window and to close or hide the Tek window.<br />
<br />
===Copy and paste===<br />
First, highlighting text using the mouse in an xterm (or alternatively another application) will select the text to copy, then clicking the mouse middle-button will paste that highlighted text. Also the key combination {{ic|Shift+Insert}} will paste highlighted text, but only within an xterm.<br />
<br />
====PRIMARY or CLIPBOARD====<br />
<br />
{{Expansion|Separate shortcuts for CLIPBOARD can be defined instead of using ''Select to clipboard'', similar to VTE-like terminals. See e.g [https://github.com/AladW/arch-i3/blob/master/.Xresources#L17]}}<br />
<br />
By default, xterm, and many other applications running under X, copy highlighted text into a buffer called the PRIMARY selection. The PRIMARY selection is short-lived; the text is immediately replaced by a new PRIMARY selection as soon as another piece of text is highlighted. Some applications will allow you to paste PRIMARY selections by using the middle-mouse, but not {{ic|Shift+Insert}}, and some other applications may not allow pasting from PRIMARY entirely.<br />
<br />
There is another buffer used for copied text called the CLIPBOARD selection. The text in the CLIPBOARD is long-lived, remaining available until a user actively overwrites it. Applications that use {{ic|Ctrl+c}} and {{ic|Ctrl+x}} for text copying and cutting operations, and {{ic|Ctrl+v}} for pasting, are using the CLIPBOARD.<br />
<br />
The fleeting nature of the PRIMARY selection, where copied text is lost as soon as another selection is highlighted, annoys some users. Xterm allows the user to switch between the use of PRIMARY and CLIPBOARD using {{ic|Select to Clipboard}} on the [[#VT Options menu]] or with the {{ic|selectToClipboard}} resource.<br />
<br />
====PRIMARY and CLIPBOARD====<br />
<br />
With the above setting you can select if you want to use PRIMARY or CLIPBOARD, but to use both you need a 'hack'. For example, put this in your .Xresources:<br />
<br />
XTerm*VT100.translations: #override <Btn1Up>: select-end(PRIMARY, CLIPBOARD, CUT_BUFFER0)<br />
<br />
====Selecting text====<br />
The new user usually discovers that text may be selected using a "click-and-drag" with the left mouse button. Double-clicking will select a word, where a word is defined as consecutive alphabetic characters plus the underscore, or the Basic Regular Expression (BRE) {{ic|[A-Za-z_]}}. Triple-clicking selects a line, with a "tab" character usually copied as multiple "space" characters.<br />
<br />
Another way of selecting text, especially useful when copying more than one full screen, is:<br />
#Left-click at the start of the intended selection.<br />
#Scroll to where the end of the selection is visible.<br />
#Right-click at the end of the selection.<br />
You do not have to be precise immediately with the right-click – any highlighted selection may be extended or shortened by using a right-click.<br />
<br />
You can clear any selected text by left-clicking once, anywhere within the xterm window.<br />
<br />
==Colors==<br />
Xterm defaults to black text, the ''foreground'' color, on a white ''background.'' The foreground and background colors can be reversed using the [[#VT Options menu|VT Options menu]] or with the {{ic|-rv}} command line option.<br />
$ xterm -rv<br />
<br />
Alternatively, the same thing can be accomplished with the following [[X_resources|X resources parameter]] (do not forget to [[X_resources#Parsing_.Xresources|reread the new resource afterwards]]!):<br />
XTerm*reverseVideo: on<br />
<br />
Xterm's foreground color (the text color) and the background color may be set from the command line, using the options {{ic|-fg}} and {{ic|-bg}} respectively.<br />
xterm -fg PapayaWhip -bg "rgb:00/00/80"<br />
<br />
The first sixteen terminal colors, as well as the foreground and background colors, may be set from an [[X resources]] file:<br />
{{bc|XTerm*foreground: rgb:b2/b2/b2<br />
XTerm*background: rgb:08/08/08<br />
XTerm*color0: rgb:28/28/28<br />
<br />
! ...Lines omitted...<br />
<br />
XTerm*color15: rgb:e4/e4/e4}}<br />
{{Note|Colors for applications that use the X libraries may be specified in many different ways.<br />
<br />
Some colors can be specified by assigned names. If {{Pkg|emacs}} or {{Pkg|vim}} has been installed, you can examine {{ic|/usr/share/emacs/*/etc/rgb.txt}} or {{ic|/usr/share/vim/*/rgb.txt}} to view the list of color names with their decimal RGB values. Colors may also be specified using hexadecimal RGB values with the format {{ic|rgb:RR/GG/BB}}, or the older and not encouraged syntax {{ic|#RRGGBB}}.<br />
<br />
The color {{ic|PapayaWhip}} is the same as {{ic|rgb:ff/ef/d5}}, which is the same as {{ic|#ffefd5}}.<br />
<br />
See '''man(7) X, '''from {{Pkg|xorg-docs}}, for a more complete description of color syntax.}}<br />
Many suggestions for color schemes can be viewed in the forum thread, [https://bbs.archlinux.org/viewtopic.php?id=51818&p=1 Terminal Colour Scheme Screenshots].<br />
{{Tip|Many people specify colors in their X resources files without specifying an application class or application instance:<br />
{{bc|*foreground: rgb:b2/b2/b2<br />
*background: rgb:08/08/08}}<br />
The above example sets the foreground and background color values for all ''Xlib'' applications (xclock, xfontsel, and others) that use these resources. This is a nice, easy way to achieve a unified color scheme.}}<br />
<br />
==Fonts==<br />
===Default fonts===<br />
Xterm's default font is the bitmap font named by the [[X Logical Font Description]] alias {{ic|fixed}}, often resolving to<br />
-misc-fixed-medium-r-semicondensed--13-120-75-75-c-60-iso8859-?<br />
This font, also aliased to the name {{ic|6x13}}, has remakably wide coverage for unicode glyphs. The default "TrueType" font is the 14‑point font matched by the name {{ic|mono}}. The ''FreeType ''font that will be used can be found with this command:<br />
$ fc-match mono<br />
<br />
Fonts can be specified from the command line, with the options {{ic|-fn}} for bitmap font names and {{ic|-fa}} for Xft names. The example below allows you to alternate between the two fonts by toggling {{ic|TrueType Fonts}} from the [[#VT Fonts menu]].<br />
{{bc|<nowiki>$ xterm -fn 7x13 -fa "Liberation Mono:size=10:antialias=false"</nowiki>}}<br />
For a more permanent change, the default fonts may be set in an [[X resources]] file:<br />
{{bc|<nowiki>xterm*faceName: Liberation Mono:size=10:antialias=false</nowiki><br />
xterm*font: 7x13}}<br />
<br />
{{Note|There is a long-standing bug in xterm that prevents the command line option {{ic|-fn}} working correctly when {{ic|faceName}} has been set in a resource file. One solution is to set the resource {{ic|renderFont}} to {{ic|false}} on the command line.<br />
{{bc|$ xterm -fn 8x13 # If this command does not set the font,<br />
$ xterm -fn 8x13 -xrm "*renderFont:false" # set the 'renderFont' resource to 'false'.}}<br />
Perhaps easier, you can just toggle {{ic|TrueType Fonts}} from the [[#VT Fonts menu]] in the terminal window.}}<br />
<br />
===Bold and underlined fonts===<br />
Italic fonts are shown as underlined characters when using XLFD names in xterm. TrueType fonts should use an oblique typeface.<br />
<br />
If you do not specify a bold font at the command line, {{ic|-fb}}, or through the {{ic|boldFont}} resource, xterm will attempt to find a bold font matching the normal font. If a matching font is not found, the bold font will be created by "overstriking" the normal font.<br />
<br />
===CJK Fonts===<br />
Many fonts do not contain glyphs for the double width Chinese, Japanese and Korean languages. Other terminal emulators such as [[urxvt]] may be better suited if you frequently work with these languages.<br />
<br />
Using bitmapped XLFD fonts with CJK has many pitfalls in xterm. It is much easier to use TrueType fonts for CJK display, using the {{ic|faceNameDoublesize}} resource. This example uses ''DejaVu Sans Mono'' as the normal font and ''WenQuanYi Bitmap Song'' as the double width font:<br />
{{bc|<nowiki>xterm*faceName: DejaVu Sans Mono:style=Book:antialias=false</nowiki><br />
xterm*faceNameDoublesize: WenQuanYi Bitmap Song<br />
xterm*faceSize: 8}}<br />
<br />
==Tips and tricks==<br />
===Automatic transparency===<br />
Install the package {{pkg|transset-df}} and a [[Wikipedia:Compositing window manager|composite manager]] such as [[Xcompmgr]]. Then add the following line to your {{ic|~/.bashrc}}:<br />
[ -n "$XTERM_VERSION" ] && transset-df -a >/dev/null<br />
<br />
Now, each time you launch a shell in an xterm and a composite manager is running, the xterm window will be transparent.<br />
The test in front of {{ic|transset-df}} keeps transet from executing if {{ic|XTERM_VERSION}} is not defined. Note that your terminal will not be transparent if you launch a program other than a shell this way. It is probably possible to work around this if you want the functionality.<br />
<br />
Also see [[Per-application transparency]].<br />
<br />
===Enable bell urgency===<br />
Add the following line to your {{ic|~/.Xresources}} file:<br />
<br />
xterm*bellIsUrgent: true<br />
<br />
===Font tips===<br />
<br />
====Use color in place of bold and italics====<br />
When using small font sizes, bold or italic characters may be difficult to read. One solution is to turn off bolding and underlining or italics and use color instead. This example does just that:<br />
{{bc|! Forbid bold font faces; bold type is light blue.<br />
XTerm*colorBDMode: true<br />
XTerm*colorBD: rgb:82/a4/d3<br />
! Do not underscore text, underlined text is white.<br />
XTerm*colorULMode: true<br />
XTerm*colorUL: rgb:e4/e4/e4}}<br />
<br />
====Adjust line spacing====<br />
Lines of text can sometimes be too close together, or they may appear to be too widely spaced. For one example, using ''DejaVu Sans Mono, ''the low underscore glyph may butt against CJK glyphs or the cursor block in the line below. Line spacing, called ''leading ''by typographers, can be adjusted using the {{ic|scaleHeight}} resource. Here, the line spacing is widened:<br />
XTerm*scaleHeight: 1.01<br />
Valid values for {{ic|scaleHeight}} range from {{ic|0.9}} to {{ic|1.5}}, with {{ic|1.0}} being the default.<br />
===Remove black border===<br />
Xterm has a black border in some cases, you can disable this by adding the following line to your {{ic|~/.Xresources}} file.<br />
<br />
xterm*borderWidth: 0<br />
<br />
===Tek 4014 demonstration===<br />
If you have {{Pkg|plotutils}} installed, you can use xterm's Tektronix 4014 emulation to view some of the plotutils package's test files. Open the Tek window from the [[#VT Options menu]] menu item {{ic|Switch to Tek Mode}} or start a new xterm instance using this command:<br />
$ xterm -t -tn tek4014<br />
Your PS1 prompt will not render correctly, if it appears at all. In the new window, enter the command,<br />
cat /usr/share/tek2plot/dmerc.tek<br />
A world map will appear in the Tek window. You can also view other {{ic|*.tek}} files from that same directory. To close the Tek window, one can use the xterm menus.<br />
<br />
== Troubleshooting ==<br />
<br />
=== Flickering on scroll ===<br />
<br />
{{Warning|Double buffering may cause non-bitmap fonts to render incorrectly.}}<br />
<br />
Rebuild xterm using [[ABS]] and include the {{ic|--enable-double-buffer}} flag:<br />
<br />
./configure --prefix=/usr \<br />
...<br />
--with-utempter \<br />
--enable-double-buffer<br />
<br />
See [https://bbs.archlinux.org/viewtopic.php?id=146023 Xterm modifications] for details.<br />
<br />
== See also ==<br />
<br />
* [http://lukas.zapletalovi.com/2013/07/hidden-gems-of-xterm.html Hidden gems of Xterm]<br />
* [http://www.in-ulm.de/~mascheck/X11/XTerm Commented XTerm resources]</div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=Zsh&diff=418615Zsh2016-02-01T03:05:07Z<p>Anaveragehuman: </p>
<hr />
<div>[[Category:Command shells]]<br />
[[cs:Zsh]]<br />
[[de:Zsh]]<br />
[[es:Zsh]]<br />
[[fr:Zsh]]<br />
[[ja:Zsh]]<br />
[[ru:Zsh]]<br />
[[zh-CN:Zsh]]<br />
[http://zsh.sourceforge.net/Intro/intro_1.html Zsh] is a powerful shell that operates as both an interactive shell and as a scripting language interpreter. While being compatible with [[Bash]] (not by default, only if issuing {{ic|emulate sh}}), it offers many advantages such as:<br />
<br />
* Efficiency<br />
* Improved tab completion<br />
* Improved globbing<br />
* Improved array handling<br />
* Full customisability<br />
<br />
The [http://zsh.sourceforge.net/FAQ/zshfaq01.html#l4 Zsh FAQ] offers more reasons to use Zsh.<br />
<br />
== Installation ==<br />
<br />
Before starting users may want to see what shell is currently being used:<br />
<br />
$ echo $SHELL<br />
<br />
[[Install]] the {{Pkg|zsh}} package. For additional completion definitions, install the {{pkg|zsh-completions}} package as well.<br />
<br />
=== Initial configuration ===<br />
<br />
Make sure that Zsh has been installed correctly by running the following in a terminal:<br />
<br />
$ zsh<br />
<br />
You should now see ''zsh-newuser-install'', which will walk you through some basic configuration. If you want to skip this, press {{ic|q}}. If you did not see it, you can invoke it manually with<br />
<br />
$ zsh /usr/share/zsh/functions/Newuser/zsh-newuser-install -f<br />
<br />
=== Making Zsh your default shell ===<br />
<br />
See [[Command-line shell#Changing your default shell]].<br />
<br />
{{Tip|If replacing {{Pkg|bash}}, users may want to move some code from {{ic|~/.bashrc}} to {{ic|~/.zshrc}} (e.g. the prompt and the [[Bash#Aliases|aliases]]) and from {{ic|~/.bash_profile}} to {{ic|~/.zprofile}} (e.g. [[xinitrc#Autostart X at login|the code that starts the X Window System]]).}}<br />
<br />
== Configuration files ==<br />
<br />
When starting Zsh, it'll source the following files in this order by default:<br />
;{{ic|/etc/zsh/zshenv}}:This file should contain commands to set the global [[#Configuring $PATH|command search path]] and other system-wide [[environment variables]]; it should not contain commands that produce output or assume the shell is attached to a tty.<br />
;{{ic|~/.zshenv}}:Similar to {{ic|/etc/zsh/zshenv}} but for per-user configuration. Generally used for setting some useful environment variables.<br />
;{{ic|/etc/zsh/zprofile}}:This is a global configuration file, it'll be sourced at login. Usually used for executing some general commands at login. Please note that on Arch Linux, by default it contains [https://projects.archlinux.org/svntogit/packages.git/tree/trunk/zprofile?h=packages/zsh one line] which source the {{ic|/etc/profile}}, see [[#Global configuration files]] for details.<br />
;{{ic|/etc/profile}}:This file should be sourced by all Bourne-compatible shells upon login: it sets up an environment upon login and application-specific ({{ic|/etc/profile.d/*.sh}}) settings. Note that on Arch Linux, Zsh will also source this by default.<br />
;{{ic|~/.zprofile}}:This file is generally used for automatic execution of user's scripts at login.<br />
;{{ic|/etc/zsh/zshrc}}:Global configuration file, will be sourced when starting as a interactive shell.<br />
;{{ic|~/.zshrc}}:Main user configuration file, will be sourced when starting as a interactive shell.<br />
;{{ic|/etc/zsh/zlogin}}:A global configuration file, will be sourced at the ending of initial progress when starting as a login shell.<br />
;{{ic|~/.zlogin}}:Same as {{ic|/etc/zsh/zlogin}} but for per-user configuration.<br />
;{{ic|/etc/zsh/zlogout}}:A global configuration file, will be sourced when a login shell exits.<br />
;{{ic|~/.zlogout}}:Same as {{ic|/etc/zsh/zlogout}} but for per-user configuration.<br />
<br />
{{Note|<br />
* The paths used in Arch's {{Pkg|zsh}} package are different from the default ones used in the [[man page]]s<br />
* {{ic|/etc/profile}} is not a part of the regular list of startup files run for Zsh, but is sourced from {{ic|/etc/zsh/zprofile}} in the {{Pkg|zsh}} package. Users should take note that {{ic|/etc/profile}} sets the {{ic|$PATH}} variable which will overwrite any {{ic|$PATH}} variable set in {{ic|~/.zshenv}}. To prevent this, please set the {{ic|$PATH}} variable in {{ic|~/.zshrc}} (it is not recommended to replace the default [https://projects.archlinux.org/svntogit/packages.git/tree/trunk/zprofile?h&#61;packages/zsh one line] in {{ic|/etc/zsh/zprofile}} with something other, it'll break the integrality of other packages which provide some scripts in {{ic|/etc/profile.d}})<br />
}}<br />
<br />
=== Global configuration files ===<br />
<br />
Occasionally users might want to have some settings applied globally to all Zsh users. The zsh(1) said that there are some global configuration files, for example {{ic|/etc/zshrc}}. This however is slightly different on Arch, since it has been compiled with flags specifically to target[https://projects.archlinux.org/svntogit/packages.git/tree/trunk/PKGBUILD?h=packages/zsh#n34] {{ic|/etc/zsh/}} instead.<br />
<br />
So, for global configuration use {{ic|/etc/zsh/zshrc}}, not {{ic|/etc/zshrc}}. The same goes for {{ic|/etc/zsh/zshenv}}, {{ic|/etc/zsh/zlogin}} and {{ic|/etc/zsh/zlogout}}. Note that these files are not installed by default, so create them if desired.<br />
<br />
The only exception is {{ic|zprofile}}, use {{ic|/etc/profile}} instead.<br />
<br />
== Configure Zsh ==<br />
<br />
Although Zsh is usable out of the box, it is almost certainly not set up the way most users would like to use it, but due to the sheer amount of customization available in Zsh, configuring Zsh can be a daunting and time-consuming experience.<br />
<br />
=== Simple .zshrc ===<br />
<br />
Included below is a sample configuration file, it provides a decent set of default options as well as giving examples of many ways that Zsh can be customized. In order to use this configuration save it as a file named {{ic|.zshrc}}.<br />
<br />
{{Tip|Apply the changes without needing to logout and then back in by running {{ic|source ~/.zshrc}}}}<br />
<br />
Here is a simple {{ic|.zshrc}}:<br />
<br />
{{hc|~/.zshrc|<br />
autoload -U compinit promptinit<br />
compinit<br />
promptinit<br />
<br />
# This will set the default prompt to the walters theme<br />
prompt walters}}<br />
<br />
=== Configuring $PATH ===<br />
<br />
In short, put the following in {{ic|~/.zshenv}}:<br />
{{hc|~/.zshenv|<br />
typeset -U path<br />
path&#61;(~/bin /other/things/in/path $path[@])}}<br />
<br />
See also [http://zsh.sourceforge.net/Guide/zshguide02.html#l24 A User's Guide to the Z-Shell] and the note in [[#Configuration files]].<br />
<br />
=== Command completion ===<br />
<br />
Perhaps the most compelling feature of Zsh is its advanced autocompletion abilities. At the very least, enable autocompletion in {{ic|.zshrc}}. To enable autocompletion, add the following to your {{ic|~/.zshrc}}:<br />
<br />
{{hc|~/.zshrc|<br />
autoload -U compinit<br />
compinit<br />
}}<br />
<br />
The above configuration includes ssh/scp/sftp hostnames completion but in order for this feature to work, users need to prevent ssh from hashing hosts names in {{ic|~/.ssh/known_hosts}}.<br />
{{Warning|This makes the computer vulnerable to [http://blog.rootshell.be/2010/11/03/bruteforcing-ssh-known_hosts-files/ "Island-hopping" attacks]. In that intention, comment the following line or set the value to {{ıc|no}}:<br />
{{hc|/etc/ssh/ssh_config|<br />
#HashKnownHosts yes}}<br />
And move {{ic|~/.ssh/known_hosts}} somewhere else so that ssh creates a new one with un-hashed hostnames (previously known hosts will thus be lost). For more information, see the SSH readme for [http://nms.lcs.mit.edu/projects/ssh/README.hashed-hosts hashed-hosts].<br />
}}<br />
<br />
For autocompletion with an arrow-key driven interface, add the following to:<br />
{{hc|~/.zshrc|<br />
zstyle ':completion:*' menu select}}<br />
:''To activate the menu, press tab twice.''<br />
<br />
For autocompletion of command line switches for aliases, add the following to:<br />
{{hc|~/.zshrc|<br />
setopt completealiases}}<br />
<br />
=== The "command not found" hook ===<br />
<br />
See [[Pkgfile#Command not found]].<br />
<br />
=== Preventing duplicate lines in the history ===<br />
<br />
To ignore duplicate lines in the history, use the following:<br />
<br />
{{hc|~/.zshrc|<br />
setopt HIST_IGNORE_DUPS}}<br />
<br />
To free the history from already created duplicates, run:<br />
<br />
$ sort -t ";" -k 2 -u ~/.zsh_history | sort -o ~/.zsh_history<br />
<br />
=== The ttyctl command ===<br />
<br />
[http://zsh.sourceforge.net/Doc/Release/Shell-Builtin-Commands.html#index-tty_002c-freezing] describes the {{ic|ttyctl}} command in Zsh.<br />
This may be used to "freeze/unfreeze" the terminal.<br />
Many programs change the terminal state, and often do not restore terminal settings on exiting abnormally.<br />
To avoid the need to manually reset the terminal, use the following:<br />
<br />
{{hc|~/.zshrc|<br />
ttyctl -f}}<br />
<br />
=== Key bindings ===<br />
<br />
Zsh does not use readline, instead it uses its own and more powerful zle. It does not read {{ic|/etc/inputrc}} or {{ic|~/.inputrc}}.<br />
Zle has an [[emacs]] mode and a [[vi]] mode. By default, it tries to guess whether emacs or vi keys from the {{ic|$EDITOR}} environment variable are desired. If it is empty, it will default to emacs. Change this with {{ic|bindkey -e}} or {{ic|bindkey -v}} respectively for emacs mode or vi mode.<br />
<br />
See also [http://zshwiki.org/home/zle/bindkeys zshwiki: bindkeys].<br />
<br />
==== Bind key to ncurses application ====<br />
<br />
Bind a ncurses application to a keystoke, but it will not accept interaction. Use {{ic|BUFFER}} variable to make it work. The following example lets users open ncmpcpp using {{ic|Alt+\}}:<br />
{{hc|~/.zshrc|2=<br />
ncmpcppShow() { BUFFER="ncmpcpp"; zle accept-line; }<br />
zle -N ncmpcppShow<br />
bindkey '^[\' ncmpcppShow<br />
}}<br />
<br />
==== Alternate way to bind ncurses application ====<br />
<br />
This method will keep everything you entered in the line before calling application<br />
{{hc|~/.zshrc|2=<br />
ncmpcppShow() { ncmpcpp <$TTY; zle redisplay; }<br />
zle -N ncmpcppShow<br />
bindkey '^[\' ncmpcppShow<br />
}}<br />
<br />
==== File manager key binds ====<br />
<br />
Key binds like those used in graphic file managers may come handy. The first comes back in directory history ({{ic|Alt+Left}}), the second let the user go to the parent directory ({{ic|Alt+Up}}). They also display the directory content.<br />
<br />
{{hc|~/.zshrc|<nowiki><br />
cdUndoKey() {<br />
popd > /dev/null<br />
zle reset-prompt<br />
echo<br />
ls<br />
echo<br />
}<br />
<br />
cdParentKey() {<br />
pushd .. > /dev/null<br />
zle reset-prompt<br />
echo<br />
ls<br />
echo<br />
}<br />
<br />
zle -N cdParentKey<br />
zle -N cdUndoKey<br />
bindkey '^[[1;3A' cdParentKey<br />
bindkey '^[[1;3D' cdUndoKey<br />
</nowiki>}}<br />
<br />
=== History search ===<br />
<br />
Add these lines to .zshrc<br />
<br />
{{hc|~/.zshrc|<nowiki><br />
[[ -n "${key[PageUp]}" ]] && bindkey "${key[PageUp]}" history-beginning-search-backward<br />
[[ -n "${key[PageDown]}" ]] && bindkey "${key[PageDown]}" history-beginning-search-forward<br />
</nowiki>}}<br />
<br />
Doing this, only past commands beginning with the current input would have been shown.<br />
<br />
=== Prompts ===<br />
<br />
There is a quick and easy way to set up a colored prompt in Zsh. Make sure that prompt is set to autoload in {{ic|.zshrc}}. This can be done by adding these lines to:<br />
<br />
{{hc|~/.zshrc|<br />
autoload -U promptinit<br />
promptinit<br />
}}<br />
<br />
Available prompts are listed by running the command:<br />
<br />
$ prompt -l<br />
<br />
For example, to use the prompt {{ic|walters}}, enter:<br />
<br />
$ prompt walters<br />
<br />
To preview all available themes, use this command:<br />
<br />
$ prompt -p<br />
<br />
=== Customizing the prompt ===<br />
<br />
For users who are dissatisfied with the prompts mentioned above (or want to expand their usefulness), Zsh offers the possibility to build a custom prompt. Zsh supports a left- and right-sided prompt additional to the single, left-sided prompt that is common to all shells. Customize it by using {{ic|1=PROMPT=}} with the following variables:<br />
<br />
See [http://zsh.sourceforge.net/Doc/Release/Prompt-Expansion.html Prompt Expansion] for a list of prompt variables and conditional substrings.<br />
<br />
==== Colors ====<br />
<br />
Zsh sets colors differently than [[Color_Bash_Prompt|Bash]]. Add {{ic|autoload -U colors && colors}} before {{ic|1=PROMPT=}} in {{ic|.zshrc}} to use them. Usually you will want to put these inside {{ic|%{ [...] %} }} so the cursor does not move.<br />
<br />
{{ic|$fg[color]}} will set the text color (red, green, blue, etc. - defaults to whatever format set prior to text)<br />
<br />
{| class="wikitable"<br />
! Command || Description<br />
|-<br />
| {{ic|%F{color} [...] %f}} || effectively the same as the previous, but with less typing. Can also prefix F with a number instead.<br />
|-<br />
| {{ic|$fg_no_bold[color]}}|| will set text to non-bold and set the text color<br />
|-<br />
| {{ic|$fg_bold[color]}}|| will set the text to bold and set the text color<br />
|-<br />
| {{ic|$reset_color}}|| will reset the text color to the default color. Does not reset bold. use {{ic|%b}} to reset bold. Saves typing if it's just {{ic|%f}} though. ||<br />
|-<br />
| {{ic|%K{color} [...] %k}} || will set the background color. Same color as non-bold text color. Prefixing with any single-digit number makes the bg black.<br />
|}<br />
<br />
{| class="wikitable"<br />
|-<br />
! colspan="2" | Possible color values<br />
|-<br />
| {{ic|black}} or {{ic|0}} || {{ic|red}} or {{ic|1}}<br />
|-<br />
| {{ic|green}} or {{ic|2}} || {{ic|yellow}} or {{ic|3}}<br />
|-<br />
| {{ic|blue}} or {{ic|4}} || {{ic|magenta}} or {{ic|5}}<br />
|-<br />
| {{ic|cyan}} or {{ic|6}} || {{ic|white}} or {{ic|7}}<br />
|}<br />
<br />
{{Note| Bold text does not necessarily use the same colors as normal text. For example, {{ic|$fg['yellow']}} looks brown or a very dark yellow, while {{ic|$fg_bold['yellow']}} looks like bright or regular yellow.}}<br />
<br />
==== Example ====<br />
<br />
This is an example of a two-sided prompt:<br />
<br />
PROMPT="%{$fg[red]%}%n%{$reset_color%}@%{$fg[blue]%}%m %{$fg_no_bold[yellow]%}%1~ %{$reset_color%}%#"<br />
RPROMPT="[%{$fg_no_bold[yellow]%}%?%{$reset_color%}]"<br />
<br />
And here's how it will be displayed:<br />
<br />
username@host ~ % [0]<br />
<br />
=== Dirstack ===<br />
<br />
Zsh can be configured to remember the DIRSTACKSIZE last visited folders. This can then be used to ''cd'' them very quickly. You need to add some lines to your configuration file:<br />
<br />
{{hc|.zshrc|<nowiki><br />
DIRSTACKFILE="$HOME/.cache/zsh/dirs"<br />
if [[ -f $DIRSTACKFILE ]] && [[ $#dirstack -eq 0 ]]; then<br />
dirstack=( ${(f)"$(< $DIRSTACKFILE)"} )<br />
[[ -d $dirstack[1] ]] && cd $dirstack[1]<br />
fi<br />
chpwd() {<br />
print -l $PWD ${(u)dirstack} >$DIRSTACKFILE<br />
}<br />
<br />
DIRSTACKSIZE=20<br />
<br />
setopt autopushd pushdsilent pushdtohome<br />
<br />
## Remove duplicate entries<br />
setopt pushdignoredups<br />
<br />
## This reverts the +/- operators.<br />
setopt pushdminus<br />
</nowiki>}}<br />
<br />
Now use<br />
dirs -v<br />
to print the dirstack. Use {{ic|cd -<NUM>}} to go back to a visited folder. Use autocompletion after the dash. This proves very handy if using the autocompletion menu.<br />
<br />
{{Note|This will not work if you have more than one ''zsh'' session open, and attempt to {{ic|cd}}, due to a conflict in both sessions writing to the same file.}}<br />
<br />
=== Help command ===<br />
Unlike [[bash]], ''zsh'' does not enable a built in {{ic|help}} command. To use {{ic|help}} in zsh, add following to your {{ic|zshrc}}:<br />
<br />
{{bc|1=<br />
autoload -U run-help<br />
autoload run-help-git<br />
autoload run-help-svn<br />
autoload run-help-svk<br />
unalias run-help<br />
alias help=run-help<br />
}}<br />
<br />
=== Fish-like syntax highlighting ===<br />
<br />
[[Fish]] provides a very powerful shell syntax highlighting. To use this in zsh, you can install {{pkg|zsh-syntax-highlighting}} from offical repository and add following to your zshrc:<br />
{{bc|<br />
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh<br />
}}<br />
<br />
=== Sample .zshrc files ===<br />
<br />
* A package in offical repository named {{Pkg|grml-zsh-config}} comes from http://grml.org/zsh and provides a zshrc file that includes many tweaks for Zshell. This is the default configuration for the [https://www.archlinux.org/download/ monthly ISO releases].<br />
* Basic setup, with dynamic prompt and window title/hardinfo => http://github.com/MrElendig/dotfiles-alice/blob/master/.zshrc;<br />
* https://github.com/slashbeast/things/blob/master/configs/DOTzshrc - zshrc with multiple features, be sure to check out comments into it. Notable features: confirm function to ensure that user want to run poweroff, reboot or hibernate, support for GIT in prompt (done without vcsinfo), tab completion with menu, printing current executed command into window's title bar and more.<br />
<br />
=== Configuration Frameworks ===<br />
<br />
* [https://github.com/robbyrussell/oh-my-zsh oh-my-zsh] is a popular, community-driven framework for managing your Zsh configuration. It comes bundled with a ton of helpful functions, helpers, plugins, themes.<br />
* [https://github.com/sorin-ionescu/prezto Prezto - Instantly Awesome Zsh] (available as {{AUR|prezto-git}}) is a configuration framework for Zsh. It comes with modules, enriching the command line interface environment with sane defaults, aliases, functions, auto completion, and prompt themes.<br />
* [https://github.com/zsh-users/antigen Antigen] (available as {{AUR|antigen-git}}) - A plugin manager for zsh, inspired by oh-my-zsh and vundle.<br />
<br />
=== Autostarting applications ===<br />
<br />
{{note|{{ic|$ZDOTDIR}} defaults to {{ic|$HOME}}}}<br />
<br />
Zsh always executes {{ic|/etc/zsh/zshenv}} and {{ic|$ZDOTDIR/.zshenv}} so do not bloat these files.<br />
<br />
If the shell is a login shell, commands are read from {{ic|/etc/profile}} and then {{ic|$ZDOTDIR/.zprofile}}. Then, if the shell is interactive, commands are read from {{ic|/etc/zsh/zshrc}} and then {{ic|$ZDOTDIR/.zshrc}}. Finally, if the shell is a login shell, {{ic|/etc/zsh/zlogin}} and {{ic|$ZDOTDIR/.zlogin}} are read.<br />
<br />
See also the ''STARTUP/SHUTDOWN FILES'' section of {{ic|man zsh}}.<br />
<br />
=== Persistent rehash ===<br />
<br />
Typically, compinit will not automatically find new executables in the $PATH. For example, after you install a new package, the files in /usr/bin would not be immediately or automatically included in the completion. Thus, to have these new exectuables included, one would run:<br />
$ rehash<br />
<br />
This 'rehash' can be set to happen automatically. Simply include the following in your {{ic|zshrc}}:<br />
<br />
{{hc|~/.zshrc|zstyle ':completion:*' rehash true}}<br />
<br />
{{Note|This hack has been found in a PR for Oh My Zsh [https://github.com/robbyrussell/oh-my-zsh/issues/3440]}}<br />
<br />
== Uninstallation ==<br />
<br />
Change the default shell before removing the {{Pkg|zsh}} package.<br />
<br />
{{Warning|Failure to follow the below procedure may result in users no longer having access to a working shell.}}<br />
<br />
Run following command:<br />
<br />
$ chsh -s /bin/bash ''user''<br />
<br />
Use it for every user with ''zsh'' set as their login shell (including root if needed). When completed, the {{Pkg|zsh}} package can be removed.<br />
<br />
Alternatively, change the default shell back to Bash by editing {{ic|/etc/passwd}} as root.<br />
<br />
{{Warning|It is strongly recommended to use {{ic|vipw}} when editing {{ic|/etc/passwd}} as it helps prevent invalid entries and/or syntax errors.}}<br />
<br />
For example, change the following:<br />
<br />
''username'':x:1000:1000:''Full Name'',,,:/home/''username'':/bin/zsh<br />
<br />
To this:<br />
<br />
''username'':x:1000:1000:''Full Name'',,,:/home/''username'':/bin/bash<br />
<br />
== See also ==<br />
<br />
*[http://zsh.sourceforge.net/Guide/zshguide.html A User's Guide to ZSH]<br />
*[http://zsh.sourceforge.net/Doc/Release/index-frame.html The Z Shell Manual] (different format available [http://zsh.sourceforge.net/Doc/ here])<br />
*[http://zsh.sourceforge.net/FAQ/zshfaq01.html Zsh FAQ]<br />
*[http://grml.org/zsh/zsh-lovers.html zsh-lovers(1)] (this is also available as {{pkg|zsh-lovers}} in offical repository)<br />
*[http://zshwiki.org/home/ Zsh Wiki]<br />
*[https://wiki.gentoo.org/wiki/Zsh/HOWTO Gentoo Wiki: Zsh/HOWTO]<br />
*[http://www.bash2zsh.com/zsh_refcard/refcard.pdf Bash2Zsh Reference Card]</div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=User_talk:Anaveragehuman&diff=414352User talk:Anaveragehuman2016-01-04T01:36:41Z<p>Anaveragehuman: Created blank page</p>
<hr />
<div></div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=User:Anaveragehuman&diff=414351User:Anaveragehuman2016-01-04T01:36:26Z<p>Anaveragehuman: Created blank page</p>
<hr />
<div></div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=Atom_(text_editor)&diff=414350Atom (text editor)2016-01-04T01:34:50Z<p>Anaveragehuman: /* Installation */</p>
<hr />
<div>[[Category:Development]]<br />
[[Category:Text editors]]<br />
[https://atom.io/ Atom] is an open-source text editor developed by GitHub.<br />
<br />
== Installation ==<br />
<br />
The following packages provide Atom:<br />
<br />
* {{AUR|atom-editor}}<br />
* {{AUR|atom-editor-git}}<br />
* {{AUR|atom-editor-bin}}<br />
* {{AUR|atom-editor-beta-bin}}<br />
* '''atom''' from the unofficial [[Unofficial user repositories#atom|atom]] repository. {{Note|Bugs regarding binary packages from the ''atom'' repository can be reported on [https://github.com/tensor5/arch-atom/issues Github]. Bugs regarding Atom itself should be reported upstream.}}</div>Anaveragehumanhttps://wiki.archlinux.org/index.php?title=NTFS-3G&diff=391547NTFS-3G2015-08-17T22:10:56Z<p>Anaveragehuman: /* Allowing user to mount */</p>
<hr />
<div>[[Category:File systems]]<br />
[[es:NTFS-3G]]<br />
[[he:NTFS-3G]]<br />
[[it:NTFS-3G]]<br />
[[ja:NTFS-3G]]<br />
[[ru:NTFS-3G]]<br />
[[zh-CN:NTFS-3G]]<br />
[[zh-TW:NTFS-3G]]<br />
{{Related articles start}}<br />
{{Related|File systems}}<br />
{{Related|Mount}}<br />
{{Related articles end}}<br />
<br />
[http://www.tuxera.com/community/ntfs-3g-download/ NTFS-3G] is an open source implementation of Microsoft's NTFS file system that includes read and write support. NTFS-3G developers use the FUSE file system to facilitate development and to help with portability.<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|ntfs-3g}} package.<br />
<br />
== Manual mounting ==<br />
<br />
Two options exist for manually mounting NTFS partitions. The traditional:<br />
<br />
# mount -t ntfs-3g /dev/''your_NTFS_partition'' ''/mount/point''<br />
<br />
Mount type {{ic|ntfs-3g}} does not need to be explicitly specified in Arch. The ''mount'' command by default will use {{ic|/usr/bin/mount.ntfs}} which is symlinked to {{ic|/usr/bin/ntfs-3g}} after the ntfs-3g package is installed.<br />
<br />
The second option is to call {{ic|ntfs-3g}} directly:<br />
<br />
# ntfs-3g /dev/''your_NTFS_partition'' ''/mount/point''<br />
<br />
== Configuring ==<br />
<br />
Your NTFS partition(s) can be setup to mount automatically, or pre-configured to be able to mount in a certain way when you would like them to be mounted. This configuration can be done in the static filesystem configuration ([[fstab]]) or by the use of udev rules.<br />
<br />
=== Default settings ===<br />
<br />
Using the default settings will mount the NTFS partition(s) at boot. With this method, '''if''' the parent folder that it is mounted upon has the proper user or group [[Users and groups|permissions]], then that user or group will be able to read and write on that partition(s).<br />
<br />
Put this in {{ic|/etc/fstab}}:<br />
<br />
# <file system> <dir> <type> <options> <dump> <pass><br />
/dev/''NTFS-part'' /mnt/windows ntfs-3g defaults 0 0<br />
<br />
=== Linux compatible permissions ===<br />
<br />
Permissions on a Linux system are normally set to 755 for folders and 644 for files. It is recommended to keep these permissions in use for the NTFS partition as well if you use the partition on a regular basis. The following example assigns the above permissions to a normal user:<br />
<br />
# Mount internal Windows partition with linux compatible permissions, i.e. 755 for directories (dmask=022) and 644 for files (fmask=133)<br />
UUID=01CD2ABB65E17DE0 /run/media/user1/Windows ntfs-3g uid=user1,gid=users,dmask=022,fmask=133 0 0<br />
<br />
=== Allowing group/user ===<br />
<br />
In {{ic|/etc/fstab}} you can also specify other options like those who are allowed to access (read) the partition. For example, for you to allow people in the {{ic|users}} group to have access:<br />
<br />
/dev/''NTFS-partition'' /mnt/windows ntfs-3g gid=users,umask=0022 0 0<br />
<br />
By default, the above line will enable write support for root only. To enable user writing, you have to specify the user who should be granted write permissions. Use the {{ic|uid}} parameter together with your username to enable user writing:<br />
<br />
/dev/''NTFS-partition'' /mnt/windows ntfs-3g uid=''username'',gid=users,umask=0022 0 0<br />
<br />
If you are running on a single user machine, you may like to own the file system yourself and grant all possible permissions:<br />
/dev/''NTFS-partition'' /mnt/windows ntfs-3g uid=''username'',gid=users 0 0<br />
<br />
=== Basic NTFS-3G options ===<br />
<br />
For most, the above settings should suffice. Here are a few other options that are general common options for various Linux filesystems. For a complete list, see [http://www.tuxera.com/community/ntfs-3g-manual/#6 this]<br />
<br />
;[[umask]]: umask is a built-in shell command which automatically sets file permissions on newly created files. For Arch Linux, the default umask for root and user is 0022. With 0022 new folders have the directory permissions of 755 and new files have permissions of 644. You can read more about umask permissions [http://www.cyberciti.biz/tips/understanding-linux-unix-umask-value-usage.html here].<br />
;noauto: If {{ic|noauto}} is set, NTFS entries in {{ic|/etc/fstab}} do not get mounted automatically at boot.<br />
;uid: The user id number. This allows a specific user to have full access to the partition. Your uid can be found with the {{ic|id}} command.<br />
;fmask and dmask: Like {{ic|umask}} but defining file and directory respectively individually.<br />
<br />
=== Allowing user to mount ===<br />
<br />
By default, ''ntfs-3g'' requires root rights to mount the filesystem, even with the "user" option in {{ic|/etc/fstab}}, the reason why can be found [http://www.tuxera.com/community/ntfs-3g-faq/#unprivileged here]. The user option in the fstab is still required. To be able to mount as user, a few tweaks need to be made:<br />
<br />
First, check that you have access to the mount block you want to use, the easiest way to do that is to be in the disk groups with the following command:<br />
<br />
# gpasswd -a username disk<br />
<br />
{{Note|Groups rights sometimes requires rebooting to kick in.}}<br />
<br />
You also need access to the mountpoint you want to use. Since we're going to mount something as user on this mountpoint, we might as well own it:<br />
# chown ''user'' /mnt/''mountpoint''<br />
<br />
Second, you need a NTFS-3G driver compiled with integrated FUSE support. The ntfs-3g package from the official repositories does not have this support, but {{AUR|ntfs-3g-fuse}} does.<br />
<br />
You should now be able to mount your NTFS partition without root rights.<br />
<br />
{{Note|There seems to be an issue with unmounting rights, so you will still need root rights if you need to unmount the filesystem. You can also use {{ic|fusermount -u /mnt/''mountpoint''}} to unmount the filesystem without root rights. Also, if you use the {{ic|''users''}} option (plural) in {{ic|/etc/fstab}} instead of the {{ic|user}} option, you will be able to both mount and unmount the filesystem using the {{ic|mount}} and {{ic|umount}} commands.}}<br />
<br />
=== ntfs-config ===<br />
<br />
{{Aur|ntfs-config}} is a program that may be able to help configure your NTFS partition(s) if other methods do not work.<br />
<br />
== Resizing NTFS partition ==<br />
<br />
{{Note|Please ensure you have a backup before attempting this if your data is important!}}<br />
<br />
Most systems that are purchased already have [[Wikipedia:Windows|Windows]] installed on it, and some people would prefer not wipe it off completely when doing an Arch Linux installation. For this reason, among others, it is useful to resize the existing Windows partition to make room for a Linux partition or two. This is often accomplished with a [[Wikipedia:Live CD|Live CD]] or bootable USB thumb drive.<br />
<br />
For Live CDs the typical procedure is to download an ISO file, burn it to a CD, and then boot from it. [http://infrarecorder.org/ InfraRecorder] is a free (as in GPL3) CD/DVD burning application for Windows which fits the bill nicely. If you would rather use a bootable USB media instead, see [[USB flash installation media]] for methods to create bootable USB stick.<br />
<br />
There are a number of bootable CD/USB images avaliable. This list is not exhaustive, but is a good place to start:<br />
<br />
* {{App|[[Wikipedia:GParted|GParted]]|Small bootable GNU/Linux distribution for x86 based computers. It enables you to use all the features of the latest versions of the GParted application. Does not include additional packages System Rescue CD may incorporate, and disk encryption schemes may not be supported.|http://gparted.sourceforge.net/|}}<br />
* {{App|[[Wikipedia:Parted Magic|Parted Magic]]|Very good complete hard disk management solution. With the Partition Editor you can re-size, copy, and move partitions. You can grow or shrink your C: drive. Create space for new operating systems. Attempt data rescue from lost partitions.|http://partedmagic.com/|}}<br />
* {{App|[[Wikipedia:SystemRescueCD|SystemRescueCD]]|Good tool to have, and works seamlessly in most cases. Once booted, run GParted and the rest should be fairly obvious.|http://www.sysresccd.org/|}}<br />
<br />
Note that the important programs for resizing NTFS partitions include ntfs-3g and a utility like (G)parted or fdisk, provided by the {{Pkg|util-linux}} package. Unless you are an "advanced" user it is advisable to use a tool like GParted to perform any resize operations to minimize the chance of data loss due to user error.<br />
<br />
If you already have Arch Linux installed on your system and simply want to resize an existing NTFS partition, you can use the parted and ntfs-3g packages to do it. Optionally, you can use the GParted GUI after installing the [[GParted]] package.<br />
<br />
== Troubleshooting ==<br />
<br />
=== Damaged NTFS filesystems ===<br />
<br />
If an NTFS filesystem has errors on it, NTFS-3G will mount it as read-only. To fix an NTFS filesystem, load Windows and run its disk checking program, chkdsk.<br />
Take in account that ntfsfix can only repair some errors. If it fails, chkdsk will probably succeed.<br />
<br />
To fix the NTFS file system, the device must already be unmounted. For example, to fix an NTFS partition residing in {{ic|/dev/sda2}}:<br />
<br />
# umount /dev/sda2<br />
# ntfsfix /dev/sda2<br />
Mounting volume... OK<br />
Processing of $MFT and $MFTMirr completed successfully.<br />
NTFS volume version is 3.1.<br />
NTFS partition /dev/sda2 was processed successfully.<br />
# mount /dev/sda2<br />
<br />
If all went well, the volume will now be writable.<br />
<br />
=== Metadata kept in Windows cache, refused to mount ===<br />
<br />
When dual booting with Windows 8 or 10, trying to mount a partition that is visible to Windows may yield the following error:<br />
<br />
The disk contains an unclean file system (0, 0).<br />
Metadata kept in Windows cache, refused to mount.<br />
Failed to mount '/dev/sdc1': Operation not permitted<br />
The NTFS partition is in an unsafe state. Please resume and shutdown<br />
Windows fully (no hibernation or fast restarting), or mount the volume<br />
read-only with the 'ro' mount option.<br />
<br />
The problem is due to a feature introduced in Windows 8 called "fast startup". When fast startup is enabled, part of the metadata of all mounted partitions are restored to the state they were at the previous closing down. As a consequence, changes made on Linux may be lost. This can happen to any NTFS partition when selecting "Shut down" or "Hibernate" under Windows 8 or 10. Leaving Windows by selecting "Restart", however, is apparently safe.<br />
<br />
To enable writing to the partitions on other operating systems, be sure fast restart is disabled. This can be achieved by issuing as an administrator the command:<br />
<br />
powercfg /h off<br />
<br />
You can check the current settings on ''Control Panel > Hardware and Sound > Power Options > System Setting > Choose what the power buttons do''. The box ''Turn on fast startup'' should either be disabled or missing.<br />
<br />
=== Mount failure ===<br />
<br />
If you cannot mount your NTFS partition even when following this guide, try using the [[UUID]] instead of device name in {{ic|/etc/fstab}} for all NTFS partitions. Here's an fstab [[Fstab#UUIDs|example]].<br />
<br />
=== Format NTFS ===<br />
<br />
{{Warning|As always, double check the device path.}}<br />
<br />
# mkfs.ntfs -L myCoolDiskName /dev/sdc1<br />
<br />
If you do not want this to take ages on modern harddrives use:<br />
<br />
# mkfs.ntfs -Q -L myCoolDiskName /dev/sdc1<br />
<br />
{{Note|Manual page on {{ic|-Q}}: Perform quick (fast) format. This will skip both zeroing of the volume and bad sector checking.}}<br />
<br />
=== Created files do not respect umask ===<br />
<br />
With the {{ic|permissions}} option set in {{ic|/etc/fstab}}, NTFS-3G volumes can handle regular Linux permissions. However, created files [http://tuxera.com/forum/viewtopic.php?p=38385&sid=33a8f1830c44d26a8d53090b1bec1d82#p38385 do not respect the user's umask] for versions up to 2014.2.15-1.<br />
<br />
As a workaround, use the [[ABS]] to recompile NTFS-3G without ACL support (--enable-posix-acls):<br />
{{hc|PKGBUILD|<nowiki><br />
build() {<br />
cd "${srcdir}/${_pkgname}-${pkgver}"<br />
./configure \<br />
--prefix=/usr \<br />
--sbin=/usr/bin \<br />
--mandir=/usr/share/man \<br />
--disable-ldconfig \<br />
--disable-static \<br />
--with-fuse=external \<br />
--enable-extras \<br />
<br />
make<br />
}</nowiki>}}<br />
<br />
== See also ==<br />
<br />
* [http://www.tuxera.com/community/ntfs-3g-manual/ Official NTFS-3G manual]</div>Anaveragehuman