https://wiki.archlinux.org/api.php?action=feedcontributions&user=Mklein994&feedformat=atomArchWiki - User contributions [en]2024-03-29T07:37:24ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=CUPS/Printer-specific_problems&diff=644889CUPS/Printer-specific problems2020-12-12T21:56:28Z<p>Mklein994: Add Epson ET-4760 to list of printers supported by epson-inkjet-printer-escpr2</p>
<hr />
<div>[[Category:Printers]]<br />
[[ja:CUPS/プリンター別の問題]]<br />
[[ru:CUPS (Русский)/Printer-specific problems]]<br />
{{Related articles start}}<br />
{{Related|CUPS}}<br />
{{Related|CUPS/Troubleshooting}}<br />
{{Related articles end}}<br />
<br />
This article contains printer or manufacturer-specific instructions for [[CUPS]].<br />
See [http://www.openprinting.org/printers OpenPrinting] if your printer is not already listed here, or if none of the listed drivers work.<br />
<br />
{{Note|If you add a printer to this list, consider contributing your entry to [https://wiki.linuxfoundation.org/openprinting/database/databaseintro OpenPrinting] - that way users of other distributions will also benefit!}}<br />
<br />
== Brother ==<br />
<br />
{{Note|Some printer models can be found in several entries because there are several packages or drivers for them.}}<br />
<br />
Drivers for several models:<br />
<br />
{|class="wikitable"<br />
! Printers<br />
! Driver/filter<br />
! Notes<br />
|-<br />
| DCP-1510 series (DCP-1510, DCP-1510r, DCP-1511, DCP-1512, DCP-1512r, DCP-1518) || {{AUR|brother-dcp1510}} ||<br />
|-<br />
| DCP-7010, DCP-7020, DCP-7025, DCP-8060, DCP-8065DN, FAX-2820, FAX-2920, HL-2030, HL-2040, HL-2070N, HL-5240, HL-5250DN, HL-5270DN, HL-5280DW, MFC-7220, MFC-7225N, MFC-7420, MFC-7820N, MFC-8460N, MFC-8660DN, MFC-8860DN, MFC-8870DW || {{AUR|brother-cups-wrapper-laser}} ||<br />
|-<br />
| HL-4040CN, HL-4040CDN, HL-4050CDN, HL-4070CDW, MFC-9440CN, MFC-9450CDN, MFC-9840CDW, DCP-9040CN, DCP-9042CDN, DCP-9045CDN || {{AUR|brother-cups-wrapper-ac}} ||<br />
|-<br />
| DCP-1510 series, DCP-1600 series, DCP-7030, DCP-7040, DCP-7055, DCP-7055W, DCP-7060D, DCP-7065DN, DCP-7080, DCP-L2500D series, DCP-L2520D series, DCP-L2540DW series, HL-1110 series, HL-1200 series, HL-2030 series, HL-2140 series, HL-2220 series, HL-2270DW series, HL-5030 series, HL-L2300D series, HL-L2320D series, HL-L2340D series, HL-L2360D series, MFC-1910W, MFC-1919NW, MFC-7240, MFC-7360N, MFC-7365DN, MFC-7840W, Lenovo M7605D || {{AUR|brlaser}}<br />{{AUR|brlaser-git}} || Unofficial driver, may be compatible with more models<br />
|}<br />
<br />
Drivers for one model:<br />
<br />
{| class="wikitable"<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|-<br />
| DCP-135C || {{AUR|brother-dcp135c}} ||<br />
|-<br />
| DCP-150C || {{AUR|brother-dcp150c}} ||<br />
|-<br />
| DCP-L3550CDW || {{AUR|brother-dcpl3550cdw}} || Use IPP driver as described [https://aur.archlinux.org/packages/brother-dcpl3550cdw/#comment-728480 here] and [https://www.printerforums.net/threads/brother-dcp-l3550cdw.68978/ here].<br />
|-<br />
| DCP-7020 || [[foomatic]] || Or Brother's driver.<br />
|-<br />
| DCP-7030 || {{AUR|brother-dcp7030}} ||<br />
|-<br />
| DCP-7065DN || {{AUR|brother-dcp7065dn}} ||<br />
|-<br />
| DCP-J515W || {{AUR|brother-dcp-j515w}} ||<br />
|-<br />
| DCP-J4110DW || {{AUR|brother-dcpj4110dw}} ||<br />
|-<br />
| FAX-2820 || {{AUR|brother-cups-wrapper-laser}} ||<br />
|-<br />
| FAX-2840 || {{AUR|brother-fax2840}} || Or [[foomatic]] - works mostly with {{ic|hpijs-pcl5e.ppd}}. Same as the HL-2170W.<br />
|-<br />
| FAX-2940 || {{AUR|brother-fax2940}} ||<br />
|-<br />
| HL-2030 || [[foomatic]] || Or {{AUR|brother-hl2030}}<br />
|-<br />
| HL-2035 || [[foomatic]] || Should be compatible with any drivers for the HL-2030.<br />
|-<br />
| HL-2040 || [[foomatic]] || Or {{AUR|brother-hl2040}}<br />
|-<br />
| HL-2130 || [[foomatic]] (using the HL-2140 driver) || Or {{Pkg|hplip}}<br />
|-<br />
| HL-2135W || {{AUR|brother-brgenml1}} ||<br />
|-<br />
| HL-2140 || [[foomatic]] || Or {{AUR|brother-hl2140}}<br />
|-<br />
| HL-2170W || [[foomatic]] || Or Brother's driver. <br />
|-<br />
| HL-2230 || [[foomatic]] || Same as HL-2170W. Select HL-2170W as the driver in CUPS admin when adding a printer.<br />
|-<br />
| HL-2250DN || {{AUR|brother-brgenml1}} || {{AUR|brother-hl2250dn}} is broken?<br />
|-<br />
| HL-2270DW || {{AUR|brother-hl2270dw}} ||<br />
|-<br />
| HL-2280DW || {{AUR|brother-hl2280dw}} ||<br />
|-<br />
| HL-3045CN || Install Brother's driver or {{AUR|brother-hl3040cn}}.||<br />
|-<br />
| HL-3140CW || {{AUR|brother-hl3140cw}} || Use IPP and Brother's driver to avoid page-shrinking and endless blank printouts<br />
|-<br />
| HL-3150CDW || {{AUR|brother-hl3150cdw}} ||<br />
|-<br />
| HL-3170CDW || {{AUR|brother-hl3170cdw}} ||<br />
|-<br />
| HL-4150CDN || {{AUR|brother-hl4150cdn}} ||<br />
|-<br />
| HL-5140 || [[foomatic]] || Or Brother's driver.<br />
|-<br />
| HL-5340 || [[foomatic]] || Using the ''Generic PCL 6/PCL XL Printer - CUPS+Gutenprint'' ({{Pkg|gutenprint}} and {{Pkg|foomatic-db-gutenprint-ppds}}). Or Brother's driver, which may result in failed prints with postscript errors.<br />
|-<br />
| HL-L2300D || {{AUR|brother-hll2300d}} ||<br />
|-<br />
| HL-L2340DW || {{AUR|brother-hll2340dw}} ||<br />
|-<br />
| HL-L2350DW || {{AUR|brother-hll2350dw}} ||<br />
|-<br />
| HL-L2360DN || {{AUR|brother-hll2360d}} || Or {{AUR|brlaser-git}}<br />
|-<br />
| HL-L2360DW || {{AUR|brother-hll2360d}} || {{AUR|brlaser-git}} should works.<br />
|-<br />
| HL-L2365DW || {{AUR|brother-hll2360d}} || {{AUR|brlaser-git}} should works.<br />
|-<br />
| HL-L2380DW || {{AUR|brother-hll2380dw}} ||<br />
|-<br />
| HL-L2395DW || {{AUR|brother-hll2395dw}} || Use the {{ic|socket}} protocol as described in [[#Network printers]]<br />
|-<br />
| HL-L3230CDW || brother-hll3230cdw || See https://github.com/splitbrain/archlinux-brother-hll3230cdw ||<br />
|-<br />
| HL-L5100DN || HP LaserJet Foomatic driver || This model will emulate a HP LaserJet. Use the {{ic|lpd}} protocol as described in [[#Network printers]].<br />
|-<br />
| HL-L8360CDW || {{AUR|brother-hll8360cdw-cups-bin}} ||<br />
|-<br />
| MFC-420CN || {{AUR|brother-mfc-420cn}} ||<br />
|-<br />
| MFC-440CN || {{AUR|brother-mfc-440cn}} ||<br />
|-<br />
| MFC-7360N || {{AUR|brother-mfc7360n}} || Or {{AUR|brlaser-git}}<br />
|-<br />
| MFC-7460DN || [[Gutenprint]] || Use the ''Generic PCL 6 Printer wide margin - CUPS+Gutenprint'' driver, with address {{ic|ipp://hostname-or-ip/pcl_p1}}.<br />
|-<br />
| MFC-7840W || {{AUR|brother-mfc-7840w}} || Or {{AUR|brlaser-git}}<br />
|-<br />
| MFC-9320CW || Install Brother's driver. ||<br />
|-<br />
| MFC-9332CDW || {{AUR|brother-mfc-9332cdw}} ||<br />
|-<br />
| MFC-9840CDW || [[foomatic]] || Or Brother's driver. This printer also works with the generic PCL-6 driver from the {{Pkg|gutenprint}} package. Use '''pcl_p1''' for the printer's address when using the PCL-6 driver.<br />
|-<br />
| MFC-J1300DW || {{AUR|brother-mfc-j1300dw}} || Use the {{ic|ipp}} protocol as described in [[#Network printers]].<br />
|-<br />
| MFC-J470DW || {{AUR|brother-mfc-j470dw}} || Use the {{ic|ipp}} protocol as described in [[#Network printers]].<br />
|-<br />
| MFC-J4710DW || {{AUR|brother-mfc-j4710dw}} ||<br />
|-<br />
| MFC-J480DW || {{AUR|brother-mfc-j480dw}} || Use the {{ic|ipp}} protocol as described in [[#Network printers]].<br />
|-<br />
| MFC-J5520DW || {{AUR|brother-mfc-j5520dw}} ||<br />
|-<br />
| MFC-J5910DW || {{AUR|brother-mfc-j5910dw}} ||<br />
|-<br />
| MFC-J650DW || Install Brother's driver. ||<br />
|-<br />
| MFC-J885DW || {{AUR|brother-mfc-j885dw}} ||<br />
|-<br />
| MFC-J985DW || {{AUR|brother-mfc-j985dw}} ||<br />
|-<br />
| MFC-L2700DN || {{AUR|brother-mfc-l2700dn}} || Please look also at the comments section of the AUR package page. <br />
|-<br />
| MFC-L2700DW || {{AUR|brother-mfc-l2700dw}} || Please look also at the comments section of the AUR package page. <br />
|-<br />
| MFC-L2710DN || {{AUR|brother-mfc-l2700dn}} || Use the ipp protocol as described in [[#Network printers]].<br />
|-<br />
| MFC-L2720DW || {{AUR|brother-mfc-l2720dw}} || Please look also at the comments section of the AUR package page. <br />
|-<br />
| MFC-L2730DW || {{AUR|brother-mfc-l2730dw}} || Please look also at the comments section of the AUR package page. <br />
|-<br />
| MFC-L2740DW || {{AUR|brother-mfc-l2740dw}} || Please look also at the comments section of the AUR package page. <br />
|-<br />
| MFC-L8600CDW || {{AUR|brother-mfc-l8600cdw}} || Please follow the instructions on the AUR page.<br />
|-<br />
| QL-500 || {{AUR|brother-ql500}} ||<br />
|-<br />
| QL-570 || {{AUR|brother-ql570}} ||<br />
|-<br />
| QL-580N || {{AUR|brother-ql580n}} ||<br />
|-<br />
| QL-650TD || {{AUR|brother-ql650td}} ||<br />
|-<br />
| QL-700 || {{AUR|brother-ql700}} ||<br />
|-<br />
| QL-710W || {{AUR|brother-ql710w}} ||<br />
|-<br />
| QL-720NW || {{AUR|brother-ql720nw}} ||<br />
|-<br />
| QL-1050 || {{AUR|brother-ql1050}} || <br />
|-<br />
| QL-1050N || {{AUR|brother-ql1050n}} ||<br />
|-<br />
| QL-1060 || {{AUR|brother-ql1060n}} ||<br />
|-<br />
| TD-2020 || {{AUR|brother-td2020}} ||<br />
|-<br />
| TD-2120N || {{AUR|brother-td2120n}} ||<br />
|-<br />
| TD-2130N || {{AUR|brother-td2130n}} ||<br />
|-<br />
| TD-4000 || {{AUR|brother-td4000}} ||<br />
|-<br />
| TD-4100N || {{AUR|brother-td4100n}} ||<br />
|-<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|}<br />
<br />
=== Network printers ===<br />
<br />
For network printers, use {{ic|ipp://'''printer_ip'''/ipp/port1}} as printer address.<br />
For some older printers, this might not work. If not, try {{ic|lpd://'''printer_ip'''/BINARY_P1}} instead.<br />
<br />
Some printers use the socket protocol. For these printers, use {{ic|socket://'''printer_ip''':9100}}.<br />
For http, use {{ic|http://'''printer_ip'''/POSTSCRIPT_P1}}.<br />
<br />
=== Custom drivers ===<br />
<br />
Brother provides custom drivers on their website, either in source tarball, rpm, or deb form. [[Packaging Brother printer drivers]] covers creating [[PKGBUILD]]s from the existing RPM packages.<br />
<br />
{{Note|The source packages might be a better alternative to the rpm packages, provided they contain all the needed files.}}<br />
<br />
==== Manually installing from the RPM packages ====<br />
<br />
{{Warning|This should ideally be automated in a [[PKGBUILD]].}}<br />
<br />
[[Install]] the {{Pkg|rpmextract}} package, and extract both rpm packages using {{ic|rpmextract.sh}}. Extracting both files will create a var and a usr directory - move the contents of both directories into the corresponding root directories.<br />
<br />
Run the cups wrapper file in {{ic|/usr/local/Brother/cupswrapper}}. This should automatically install and configure your brother printer.<br />
<br />
For some of the drivers 32 bit libraries may need to be installed from [[multilib]].<br />
<br />
=== Updating the firmware ===<br />
<br />
[[Install]] {{Pkg|net-snmp}} and run:<br />
<br />
$ snmpwalk -c public $PRINTER_IP | grep -A 1 3.6.1.4.1.2435.2.4.3.99.3.1.6.1.2<br />
<br />
At this point, you will have the relevant data to get a valid firmware download link from Brother. The file should look similar to the one below:<br />
<br />
{{hc|request.xml|<br />
<REQUESTINFO><br />
<FIRMUPDATETOOLINFO><br />
<FIRMCATEGORY>MAIN</FIRMCATEGORY><br />
<OS>LINUX</OS><br />
<INSPECTMODE>1</INSPECTMODE><br />
</FIRMUPDATETOOLINFO><br />
<br />
<FIRMUPDATEINFO><br />
<MODELINFO><br />
<SELIALNO></SELIALNO><br />
<NAME>MFC-9330CDW</NAME><br />
<SPEC>0401</SPEC><br />
<DRIVER></DRIVER><br />
<FIRMINFO><br />
<FIRM><br />
<ID>MAIN</ID><br />
<VERSION>R1506121801:4504</VERSION><br />
</FIRM><br />
<FIRM><br />
<ID>SUB1</ID><br />
<VERSION>1.07</VERSION><br />
</FIRM><br />
<FIRM><br />
<ID>SUB2</ID><br />
<VERSION>L1505291600</VERSION><br />
</FIRM><br />
</FIRMINFO><br />
</MODELINFO><br />
<DRIVERCNT>1</DRIVERCNT><br />
<LOGNO>2</LOGNO><br />
<ERRBIT></ERRBIT><br />
<NEEDRESPONSE>1</NEEDRESPONSE><br />
</FIRMUPDATEINFO><br />
</REQUESTINFO><br />
}}<br />
<br />
Post this file to Brother:<br />
<br />
$ curl -X POST -d @request.xml https://firmverup.brother.co.jp/kne_bh7_update_nt_ssl/ifax2.asmx/fileUpdate -H "Content-Type:text/xml" > response.xml<br />
<br />
In {{ic|response.xml}} you will find a {{ic|<PATH>}} tag that contains the firmware download URL. Next, download the firmware, push it to the printer, and let the printer process it. Before that is done, change the Admin password to something known, it will be used as the user to log into the FTP site (VERY bad practice, do not do this). <br />
<br />
$ wget http://update-akamai.brother.co.jp/CS/LZ4266_W.djf<br />
$ ftp $PRINTER_IP|<br />
ftp> bin<br />
ftp> hash<br />
ftp> send LZ4266_W.djf<br />
ftp> bye<br />
<br />
With that, the printer will restart, and the latest firmware will be installed and (hopefully) your printing woes will be solved.<br />
<br />
== Canon ==<br />
<br />
There are many possible drivers for Canon printers. [http://gimp-print.sourceforge.net/p_Supported_Printers.php Many Canon printers] are supported by [[Gutenprint]] and {{pkg|foomatic-db-ppds}}. Some of Canon's LBP, iR, and MF printers use a driver supporting the UFR II/UFR II LT/LIPSLX protocols, [[#UFRII]] . Others use the [[#CARPS]], or [[#cnijfilter]] ({{AUR|cnijfilter2}} / {{AUR|cnijfilter2-bin}}), or [[Canon CAPT]] drivers.<br />
<br />
{| class="wikitable"<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|-<br />
| iP4300<br />
| [[Gutenprint]]<br />
| Or use the [http://www.turboprint.info/ TurboPrint] driver.<br />
|-<br />
| LBP810 || rowspan="34" | [[Canon CAPT]] ||<br />
|-<br />
| LBP1120 ||<br />
|-<br />
| LBP1210 ||<br />
|-<br />
| LBP2900 ||<br />
|-<br />
| LBP3000 ||<br />
|-<br />
| LBP3010 ||<br />
|-<br />
| LBP3018 ||<br />
|-<br />
| LBP3050 ||<br />
|-<br />
| LBP3100 ||<br />
|-<br />
| LBP3108 ||<br />
|-<br />
| LBP3150 ||<br />
|-<br />
| LBP3200 ||<br />
|-<br />
| LBP3210 ||<br />
|-<br />
| LBP3250 ||<br />
|-<br />
| LBP3300 ||<br />
|-<br />
| LBP3310 ||<br />
|-<br />
| LBP3500 ||<br />
|-<br />
| LBP5000 ||<br />
|-<br />
| LBP5050 series ||<br />
|-<br />
| LBP5100 ||<br />
|-<br />
| LBP5300 ||<br />
|-<br />
| LBP6000 ||<br />
|-<br />
| LBP6018 ||<br />
|-<br />
| LBP6020 ||<br />
|-<br />
| LBP6200 ||<br />
|-<br />
| LBP6300 ||<br />
|-<br />
| LBP6300n ||<br />
|-<br />
| LBP6310dn ||<br />
|-<br />
| LBP7010C ||<br />
|-<br />
| LBP7018C ||<br />
|-<br />
| LBP7200Cdn (network mode) ||<br />
|-<br />
| LBP7200C series ||<br />
|-<br />
| LBP7210Cdn ||<br />
|-<br />
| LBP9100C ||<br />
|-<br />
| MF216n (network over ldp) || rowspan="4" | {{AUR|cndrvcups-lb-bin}} ||<br />
|-<br />
| MF635Cx ||<br />
|-<br />
| MF4720w ||<br />
|-<br />
| MF4770n ||<br />
|-<br />
| MG4200 series || {{AUR|cnijfilter-mg4200}} || Avoid the [[CUPS#Web interface|web interface]] when adding the printer as it will not find the PPD file.<br />
|-<br />
| MX490 || rowspan="4" | {{AUR|cnijfilter2}}<br />{{AUR|cnijfilter2-bin}} ||<br />
|-<br />
| MX492 ||<br />
|-<br />
| TS202 ||<br />
|-<br />
| TS8050 || Without {{AUR|cnijfilter2}} printing will fail with a filter error or you might get "Rendering Completed" and nothing will print<br />
|-<br />
| TS9020 || {{AUR|canon-ts9020}} ||<br />
|-<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|}<br />
<br />
Some Canon printers will use a similar setup to the iP4500, so consider modifying the {{AUR|cnijfilter-ip4500}} package for other, similar printers.<br />
<br />
=== UFRII ===<br />
<br />
Many LBP, iR, and MF printers use a protocol that has had several names over the years : UFR II, UFR II LT, LIPSLX .<br />
There are multiple packages for these printers in AUR, and atleast the imageCLASS MF4570dn and i-sensys MF633C are reported to only work with the older v3.70 version.<br />
<br />
{{AUR|cnrdrvcups-lb}} v 5.00 - latest version built from source<br />
<br />
{{AUR|cndrvcups-lb}} 3.70 and {{AUR|cndrvcups-common-lb}} 4.10 : older version built from source<br />
<br />
{{AUR|cndrvcups-lb-bin}} v3.70 uses canon provided binaries with location/config adjustments to make them work on archlinux<br />
<br />
=== CARPS ===<br />
<br />
Some of Canon's printers use Canon's proprietary CARPS (''Canon Advanced Raster Printing System'') driver.<br />
[http://www.rainbow-software.org/2014/01/23/cups-driver-for-canon-carps-printers/ Rainbow Software] have managed to reverse engineer the CARPS data format and have successfully created a CARPS CUPS driver, which is available as {{AUR|carps-cups}}{{Broken package link|package not found}}.<br />
The project's [https://github.com/ondrej-zary/carps-cups GitHub] page includes a list of working printers.<br />
<br />
=== USB over IP (BJNP) ===<br />
<br />
Some Canon printers use Canon's proprietary USB over IP BJNP protocol to communicate over the network. There is a CUPS backend for this, which is available as {{AUR|cups-bjnp}}.<br />
<br />
=== cnijfilter ===<br />
<br />
Some printers using the cnijfilter drivers support the {{ic|cnijnet}} protocol. To find the [[CUPS#Printer URI|printer URI]] run<br />
<br />
$ cnijnetprn --search auto<br />
<br />
and use the {{ic|cnijnet:/}} URI in the output.<br />
<br />
{{Expansion|The URI appears to be of the form {{ic|cnijnet:/}} followed by the MAC address of the printer. If this is the case it would be good to mention it here.}}<br />
<br />
=== IPP Everywhere ===<br />
<br />
For recent Canon printers, like the G7000 series, it can be hard to find a valid driver. However, it is possible to use a driverless installation using IPP Everywhere.<br />
<br />
If you have installed avahi, CUPS should be able to detect your printer automatically.<br />
<br />
However, if it fails, you can always enter your printer settings manually. In CUPS web interface select {{ic|Internet Printing Protocol (ipp)}} and enter the IPP URL of the printer. Then at the driver selection screen select{{ic|Generic > {current_make_and_model} - IPP Everywhere ™}}.<br />
<br />
For the G7000 series the IPP URL is {{ic|ipp://<printer_ip>}} or {{ic|ipps://<printer_ip>}}.<br />
<br />
== Dell ==<br />
<br />
{| class="wikitable"<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|-<br />
| 1250C<br />
| {{AUR|foo2zjs-nightly}}<br />
| See http://cybercom.net/~dcoffin/hbpl{{Dead link|2020|03|28|status=404}}, the patch has been merged into upstream. The printer may also work with the [[#Phaser 6000B|Xerox Phaser 6000B driver]].<br />
|-<br />
| C1660NW<br />
| {{AUR|foo2zjs-nightly}}<br />
| The printer may also work with the [[#Phaser 6000B|Xerox Phaser 6000B driver]].<br />
|-<br />
| E515,<br />
E515dw<br />
| Install [http://downloads.dell.com/FOLDER03040853M/1/Printer_E515dw_Driver_Dell_A00_LINUX.zip Dell's driver].<br />
| Both ''e515dwcupswrapper-3.2.0-1.i386.deb'' and ''e515dwlpr-3.2.0-1.i386.deb'' need to be installed. You could either write a [[PKGBUILD]], use {{AUR|debtap}}, or use {{Pkg|dpkg}} (using dpkg is not recommended as the files will not be managed by [[pacman]]). The driver works on both the x86_64 and i386 platforms, but may require [[multilib]].<br />
|-<br />
| S1130n || rowspan="16" | {{aur|dell-unified-driver}} || rowspan="16" | Driver conflicts with samsung-unified-driver-printer (as the dell-unified-driver appears to be based on the Samsung one, and they create several of the same files)<br />
|-<br />
|1130 ||<br />
|-<br />
|1133 ||<br />
|-<br />
|1135n ||<br />
|-<br />
|1815 ||<br />
|-<br />
|2145cn ||<br />
|-<br />
|2335dn ||<br />
|-<br />
|2355dn ||<br />
|-<br />
|5330 ||<br />
|-<br />
|B1160 ||<br />
|-<br />
|B1160w ||<br />
|-<br />
|B1165nfw ||<br />
|-<br />
|B1260dn ||<br />
|-<br />
|B1265dfw ||<br />
|-<br />
|B1265dnf ||<br />
|-<br />
|B2365dnf ||<br />
|-<br />
<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|}<br />
<br />
== Epson ==<br />
<br />
{{AUR|epson-inkjet-printer-escpr}} and {{AUR|epson-inkjet-printer-escpr2}} are sets of drivers using the Epson Inkjet Printer Driver (ESC/P-R) for Linux.<br />
<br />
{| class="wikitable"<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|-<br />
| AcuLaser CX11(NF) || {{AUR|epson-alcx11-filter}} ||<br />
|-<br />
| AcuLaser C900 || || This printer uses Epson's driver, with a device URI of ''''usb://EPSON/AL-C900'''', and may need the pipsplus service to be running.<br />
|-<br />
| EP-50V || rowspan="3" | {{AUR|epson-inkjet-printer-escpr2}} ||<br />
|-<br />
| EP-879A ||<br />
|-<br />
| EP-880A ||<br />
|-<br />
| ET-2700 || rowspan="2" | {{AUR|epson-inkjet-printer-escpr}} ||<br />
|-<br />
| ET-2750 ||<br />
|-<br />
| ET-3700 || rowspan="5" | {{AUR|epson-inkjet-printer-escpr2}} ||<br />
|-<br />
| ET-3750 ||<br />
|-<br />
| ET-3760 ||<br />
|-<br />
| ET-4750 ||<br />
|-<br />
| ET-4760 ||<br />
|-<br />
| EW-M571T || {{AUR|epson-inkjet-printer-escpr}} ||<br />
|-<br />
| EW-M670FT || {{AUR|epson-inkjet-printer-escpr2}} ||<br />
|-<br />
| L380 || rowspan="2" | {{AUR|epson-inkjet-printer-201601w}} ||<br />
|-<br />
| L382 ||<br />
|-<br />
| L4150 || rowspan="2" | {{AUR|epson-inkjet-printer-escpr}} ||<br />
|-<br />
| L4160 ||<br />
|-<br />
| L6160 || rowspan="3" | {{AUR|epson-inkjet-printer-escpr2}} ||<br />
|-<br />
| L6170 ||<br />
|-<br />
| L6190 ||<br />
|-<br />
| LP-S5000 || || This printer requires a [[#Avasys|custom driver from Avasys]].<br />
|-<br />
| PM-520 || rowspan="11" | {{AUR|epson-inkjet-printer-escpr2}} ||<br />
|-<br />
| PX-M5080F ||<br />
|-<br />
| PX-M5081F ||<br />
|-<br />
| PX-M680F ||<br />
|-<br />
| PX-M7070FX ||<br />
|-<br />
| PX-M780F ||<br />
|-<br />
| PX-M781F ||<br />
|-<br />
| PX-M884F ||<br />
|-<br />
| PX-S5080 ||<br />
|-<br />
| PX-S7070X ||<br />
|-<br />
| PX-S884 ||<br />
|-<br />
| TX125 || {{AUR|epson-inkjet-printer-n10-nx127}} ||<br />
|-<br />
| WF-3620 || {{AUR|epson-inkjet-printer-escpr}} ||<br />
|-<br />
| WF-3720 || rowspan="8" | {{AUR|epson-inkjet-printer-escpr2}} ||<br />
|-<br />
| WF-4720 ||<br />
|-<br />
| WF-4730 ||<br />
|-<br />
| WF-4740 ||<br />
|-<br />
| WF-7210 ||<br />
|-<br />
| WF-7710 ||<br />
|-<br />
| WF-7720 ||<br />
|-<br />
| WF-C869R ||<br />
|-<br />
| XP-205 -207 || {{AUR|epson-inkjet-printer-escpr}} ||<br />
|-<br />
| XP-446 || rowspan="2" | {{AUR|epson-inkjet-printer-escpr}} ||<br />
|-<br />
| XP-630 Series<br />
|-<br />
| XP-5100 || rowspan="4" | {{AUR|epson-inkjet-printer-escpr2}} ||<br />
|-<br />
| XP-6000 ||<br />
|-<br />
| XP-8500 ||<br />
|-<br />
| XP-15000 ||<br />
|-<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|}<br />
<br />
=== Utilities ===<br />
<br />
==== escputil ====<br />
<br />
escputil is part of the {{Pkg|gutenprint}} package, and performs some utility functions on Epson printers such as nozzle cleaning.<br />
<br />
==== mtink ====<br />
<br />
This is a printer status monitor which enables to get the remaining ink quantity, to print test patterns, to reset printer and to clean nozzle. It use an intuitive graphical user interface.<br />
<br />
==== Stylus-toolbox ====<br />
<br />
This is a GUI using escputil and cups drivers. It supports nearly all USB printer of Epson and displays ink quantity, can clean and align print heads and print test patterns.<br />
<br />
===Custom drivers===<br />
<br />
==== Avasys ====<br />
<br />
{{Warning|This section involves installing packages without [[pacman]]. These directions should ideally be automated with a [[PKGBUILD]].}}<br />
"Source" code of the driver is available on the [http://www.avasys.jp avasys website], in Japanese, however it includes a 32 bit binary which will cause problem on 64 bit system.<br />
<br />
* [[Install]] the {{Pkg|psutils}}, {{Pkg|bc}}, {{Pkg|libstdc++5}} packages ({{AUR|lib32-libstdc++5}} on 64bit).<br />
* Download the source code of the driver.<br />
* Compile and install the driver. <br />
<br />
$ ./configure --prefix=/usr<br />
$ make<br />
# make install<br />
<br />
If you have any problems on a 64 system, some other lib32 libraries may be required. Please adjust this page if that is the case.<br />
<br />
=== Adding missing paper sizes ===<br />
<br />
Some of the PPD files in {{AUR|epson-inkjet-printer-escpr2}} are missing paper size definitions for media that is supported by the printers and the filter. It is relatively straightforward to add the missing media types to the PPD files.<br />
<br />
To begin, download the PKGBUILD for the {{AUR|epson-inkjet-printer-escpr2}} package, either with an AUR helper or from a snapshot tarball. Once in the directory with the PKGBUILD, download and extract the source of the package by running {{ic|makepkg --nobuild}}.<br />
<br />
Change directory to to {{ic|src/epson-inkjet-printer-escpr2-$PKGVER}}. Open the file {{ic|src/optBase.h}} in a text editor for reference.<br />
<br />
Identify the PPD used by your printer in the {{ic|ppd}} directory. For example, a Workforce 7710 printer uses {{ic|Epson-WF-7710_Series-epson-escpr2-en.ppd}}. Let us call it {{ic|your_ppd_filename}}. Convert the relevant PPD to a PPD compiler source file using the {{ic|ppdi}} utility from the {{Pkg|cups}} package.<br />
<br />
$ ppdi -o your_ppd_filename.drv ppd/your_ppd_filename.ppd<br />
<br />
Open the newly-created {{ic|your_ppd_filename.drv}} in a text editor. Identify the section of the file with a lot of lines starting with {{ic|CustomMedia}}. Duplicate one such line to modify. For example:<br />
<br />
CustomMedia "Legal/US Legal" 612.00 1008.00 8.40 8.40 8.40 8.40 "<</PageSize[612.00 1008.00]/ImagingBBox null>>setpagedevice" "<</PageRegion[612.00 1008.00]/ImagingBBox null>>setpagedevice"<br />
<br />
The pair of numbers {{ic|612.00 1008.00}} represents the width and height of the paper in inches, multiplied by 72. Replace all three instances of these numbers with the dimensions of the paper you want to add. For example to add 11"x17" paper, replace the numbers with {{ic|792.00 1224.00}}.<br />
<br />
The string {{ic|"Legal/US Legal"}} identifies the paper. On the left side of the slash, {{ic|Legal}} is a magic identifier that the filter uses to identify the paper size. Replace it with the one you want to use. Refer to the {{ic|mediaSizeData}} array in {{ic|optBase.h}} for a list of possible values. The string to the right of the slash can be set to any human-readable value.<br />
<br />
If you want to enable borderless printing for a paper size, prefix the magic identifier string you just found with the letter T. So {{ic|Letter}} would become {{ic|TLetter}}. Additionally, change the four numbers {{ic|8.40 8.40 8.40 8.40}} to {{ic|0.00 0.00 0.00 0.00}}.<br />
<br />
For example, I was able to add 11x17 paper to the PPD for a Workforce 7710 by adding the following lines:<br />
<br />
CustomMedia "USB/US B(11x17 in)" 792.00 1224.00 8.40 8.40 8.40 8.40 "<</PageSize[792.00 1224.00]/ImagingBBox null>>setpagedevice" "<</PageRegion[792.00 1224.00]/ImagingBBox null>>setpagedevice"<br />
CustomMedia "TUSB/US B(11x17 in) (Borderless)" 792.00 1224.00 0.00 0.00 0.00 0.00 "<</PageSize[792.00 1224.00]/ImagingBBox null>>setpagedevice" "<</PageRegion[792.00 1224.00]/ImagingBBox null>>setpagedevice"<br />
<br />
Once you have added your custom size, recompile {{ic|your_ppd_filename.drv}} into a PPD file with ppdc (also from {{Pkg|cups}}):<br />
<br />
$ ppdc your_ppd_filename.drv<br />
<br />
This will create a ppd file in the {{ic|ppd}} directory with a file name derived from the {{ic|PCFileName}} parameter in {{ic|your_ppd_filename.drv}}. You can test this file by uploading it to the CUPS web interface, or install it permanently by overwriting the original PPD file and making the package with {{ic|makepkg}}.<br />
<br />
== HP ==<br />
<br />
See also [[CUPS/Troubleshooting#HP issues]].<br />
<br />
Most HP printers will use {{Pkg|hplip}}, some may use {{AUR|hpoj}}, while for multifunction laser printers {{aur|hpuld}} might be required. Some laser printers are also supported by {{AUR|foo2zjs-nightly}}.<br />
<br />
{| class="wikitable"<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|-<br />
| DeskJet 710C || rowspan="8" | {{AUR|pnm2ppa}} ||<br />
|-<br />
| DeskJet 712C ||<br />
|-<br />
| DeskJet 720C ||<br />
|-<br />
| DeskJet 722C ||<br />
|-<br />
| DeskJet 820se ||<br />
|-<br />
| DeskJet 820Cxi ||<br />
|-<br />
| DeskJet 1000Cse ||<br />
|-<br />
| DeskJet 1000Cxi ||<br />
|-<br />
| Envy 7800 series || {{Pkg|hplip}} || Have not tried [[foomatic]] yet<br />
|-<br />
| LaserJet P1606dn || rowspan="2" | {{Pkg|hplip}} + {{aur|hplip-plugin}} || Or {{aur|foo2zjs-nightly}}, or [[CUPS#CUPS|AirPrint]].<br />
|-<br />
| LaserJet Pro MFP M126nw ||<br />
|-<br />
| LaserJet Pro MFP M281fdw || rowspan="2" | {{Pkg|hplip}} || No proprietary drivers as of 2019-04-18 <br />
|-<br />
| Photosmart 2575 || Or use the hpijs driver in [[foomatic]].<br />
|-<br />
| HP LaserJet MFP M43 || rowspan="7" | {{aur|hpuld}} ||<br />
|-<br />
| HP LaserJet MFP M436 ||<br />
|-<br />
| HP LaserJet MFP M72625 72630 ||<br />
|-<br />
| Laser 10x Series ||<br />
|-<br />
| Laser MFP 13x Series ||<br />
|-<br />
| Color Laser 15x Series ||<br />
|-<br />
| Color Laser MFP 17x Series ||<br />
|-<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|}<br />
<br />
=== HPLIP ===<br />
<br />
{{Note|As of hplip v3.17.11 hpijs is not longer available. If you have printers using hpijs they will fail to print. You must modify them and select the new hpcups driver instead.}}<br />
<br />
{{Pkg|hplip}} provides drivers for HP DeskJet, OfficeJet, Photosmart, Business Inkjet, and some LaserJet printers, and also provides an easy to use setup tool. See https://developers.hp.com/hp-linux-imaging-and-printing/supported_devices/index for the list of supported printers.<br />
<br />
To run the setup tool with the GUI qt frontend:<br />
<br />
$ hp-setup -u<br />
<br />
To run the setup tool with the command line frontend:<br />
<br />
$ hp-setup -i<br />
<br />
To set up directly the configuration of a network connected HP printer:<br />
<br />
$ hp-setup -i ''ip_address''<br />
<br />
To run systray spool manager:<br />
<br />
$ hp-systray<br />
<br />
To generate a URI for a given ip address:<br />
<br />
# hp-makeuri ''<ip address>''<br />
<br />
PPD files are in {{ic|/usr/share/ppd/HP/}}.<br />
<br />
If your printer is [https://developers.hp.com/hp-linux-imaging-and-printing/binary_plugin.html listed as requiring a binary plugin], install the {{AUR|hplip-plugin}} package from [[AUR]].<br />
If the binary plugin {{AUR|hplip-plugin}} is a requirement you will need to [[start]] the {{ic|org.cups.cupsd.service}} before the PPD is recognized by {{Pkg|hplip}}.<br />
<br />
{{Note|{{Pkg|hplip}} depends on {{Pkg|foomatic-db-engine}} which prevents the drivers list from appearing when a printer is added to CUPS via the web user interface (following error : "Unable to get list of printer drivers"). Possible workarounds:<br />
* '''Either:''' Install {{Pkg|hplip}} first, then retrieve the PPD file that matches your printer from {{ic|/usr/share/ppd/HP/}}. Next, remove {{Pkg|hplip}} entirely as well as any unnecessary dependencies. Finally, install the printer manually using the CUPS web UI, selecting the PPD file you retrieved, and then re-install {{Pkg|hplip}}. After a reboot, you should have a fully working printer.<br />
* '''Or:''' Remove {{Pkg|hplip}}, {{Pkg|foomatic-db}} and {{Pkg|foomatic-db-engine}} along with any unnecessary dependencies. Reinstall {{Pkg|hplip}} and restart CUPS. Install your printer using the CUPS web UI, which should now be able to find the drivers automatically. No reboot needed.}}<br />
<br />
=== HPULD ===<br />
<br />
See the [https://wiki.debian.org/CUPSPrintQueues#hpuld Debian wiki] for more information.<br />
<br />
The package {{AUR|hpuld}} collects the sparse "HP + ULD" packages into one single package.<br />
<br />
=== foo2zjs ===<br />
<br />
[http://foo2zjs.rkkda.com/ foo2zjs] supports some HP LaserJet printers. As of June 2018 the hplip package interferes with {{aur|foo2zjs-nightly}}, as described at [https://bbs.archlinux.org/viewtopic.php?pid=1662809 this forum post] and {{Bug|58815}}.<br />
<br />
== Kodak ==<br />
<br />
{{AUR|c2esp}} is free software. [https://sourceforge.net/projects/cupsdriverkodak/ Upstream notes] it is likely to work on all ESP and Hero printers/scanners.<br />
<br />
== Konica Minolta ==<br />
<br />
{| class="wikitable"<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|-<br />
| Minolta Magicolor 1600W || rowspan=7 | [[foomatic]] ||<br />
|-<br />
| Minolta Magicolor 1680MF ||<br />
|-<br />
| Minolta Magicolor 1690MF ||<br />
|-<br />
| Minolta Magicolor 2480MF ||<br />
|-<br />
| Minolta Magicolor 2490MF ||<br />
|-<br />
| Minolta Magicolor 2530DL ||<br />
|-<br />
| Minolta Magicolor 4690MF ||<br />
|-<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|}<br />
<br />
=== foo2zjs ===<br />
<br />
[[#foo2zjs]], mentioned above for supporting some HP printers, also support some Minolta printers.<br />
<br />
== Lexmark ==<br />
<br />
Note that most Lexmark printers are now supported by CUPS without needing further installation. See also [[SANE/Scanner-specific problems#Lexmark]] for Lexmark scanners issues.<br />
<br />
=== Utilities ===<br />
<br />
Lexmark provides a utility called ''lexijtools'' with the drivers.<br />
<br />
=== Custom drivers ===<br />
<br />
Lexmark does provide Linux drivers for all their hardware.<br />
The following packages are required:<br />
<br />
* {{Pkg|cups}}<br />
* {{Pkg|sane}}<br />
* {{Pkg|ncurses}}<br />
* {{Pkg|libusb}}<br />
* {{Pkg|libxext}}<br />
* {{Pkg|libxtst}}<br />
* {{Pkg|libxi}}<br />
* {{Pkg|libstdc++5}}<br />
* {{Pkg|krb5}}<br />
* {{Pkg|lua}} (for the automated installer)<br />
* [[Java]] (for the automated installer, and some of the Lexmark tools)<br />
<br />
The drivers will need to be [http://support.lexmark.com/index?page=driversdownloads downloaded] from Lexmark's website. Preferably, create a package (see [[Creating packages]]) and install it. Here is a basic [[PKGBUILD]] that still needs work but will give an idea of what is required.<br />
<br />
{{hc|PKGBUILD|<nowiki><br />
# Contributor: Todd Partridge (Gen2ly) toddrpartridge (at) yahoo<br />
<br />
pkgname=cups-lexmark-Z2300-2600<br />
pkgver=1<br />
pkgrel=1<br />
pkgdesc="Lexmark Z2300 and 2600 Series printer driver for cups"<br />
arch=('i686')<br />
url="http://www.lexmark.com/"<br />
license=('custom')<br />
depends=('cups' 'glibc' 'ncurses' 'libusb' 'libxext' 'libxtst' 'libxi' 'libstdc++5' 'krb5' 'lua' 'java-runtime')<br />
conflicts=('z600' 'cjlz35le-cups' 'cups-lexmark-700')<br />
source=(lexmark-inkjet-08-driver-1.0-1.i386.tar.gz.sh)<br />
md5sums=(3c37eb87e3dad4853bf29344f9695134)<br />
<br />
package() {<br />
# Extract installer<br />
sh lexmark-inkjet-08-driver-1.0-1.i386.tar.gz.sh --target Installer-Files<br />
cd Installer-Files<br />
mkdir Driver<br />
tar xvvf instarchive_all --lzma -C Driver/<br />
cd Driver<br />
tar xv lexmark-inkjet-08-driver-1.0-1.i386.tar.gz -C $pkgdir<br />
}<br />
</nowiki>}}<br />
<br />
Keep in mind you can use the automated installer but doing so will leave the resulting changes untracked. The PPD will be installed into {{ic|/usr/local/lexmark/lxk08/etc/}} or similar, depending on the printer model.<br />
<br />
== Oki ==<br />
<br />
{| class="wikitable"<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|-<br />
| C110|| [[foomatic]] ||<br />
|-<br />
| MC561|| [[CUPS#Foomatic|foomatic-db-nonfree]] ||<br />
|-<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|}<br />
<br />
== Ricoh ==<br />
<br />
Install {{AUR|openprinting-ppds-pxlmono-ricoh}} if your device is black and white, or {{AUR|openprinting-ppds-pxlcolor-ricoh}} if it is color. Note that Ricoh copiers are sometimes branded as Savin, Gestetner, Lanier, Rex-Rotary, Nashuatec, and/or IKON. So, if you have a device bearing one of these brands, it may be supported by these drivers as well.<br />
<br />
* [https://www.openprinting.org/driver/pxlmono-Ricoh List of supported black and white models]<br />
* [https://www.openprinting.org/driver/pxlcolor-Ricoh List of supported color models]<br />
<br />
For cheap [[Wikipedia:en:Graphics_Device_Interface#GDI printers|GDI-only winprinters]], which do not support PCL (Ricoh series SP100 and SP200) try out {{AUR|ricoh-sp100-git}}.<br />
<br />
{| class="wikitable"<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|-<br />
| SP 112 || {{AUR|ricoh-sp100-git}} ||<br />
|-<br />
| SP 201n || {{AUR|ricoh-sp100-git}} ||<br />
|-<br />
| 213W || ''Generic PCL Laser'' || Obtain a WPS code by holding down the wifi button for 2 seconds, then hitting the stop/start button.<br />
|-<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|}<br />
<br />
== Samsung ==<br />
<br />
Since 2016, or 2017, Samsung is no longer in the printers/scanners business. As of 2019, HP partially support some of Samsung printers/scanners. Before 2016, Samsung was a major player. Which is why there are still many Samsung machines around. In addition, Linux, and cups, keep evolving. The bottom line of all this is that supporting Samsung products is at a flux.<br />
<br />
A major site for information about Samsung printers/scanners is [https://www.bchemnet.com/suldr/ Samsung Unified Linux Driver Repository]. Despite its name, it is not affiliated by Samsung. Neither it is devoted only to {{AUR|samsung-unified-driver}}. {{ic|samsung-unified-driver}}, on the other hand, is close source by Samsung. It also encompass Windows and Mac. It might be the first stop to get a driver for a Samsung printer and scanner as it, or was, claim to support practically every one of these. Note that {{ic|samsung-unified-driver}} includes software that can stand on its own, not tied to cups. If you can not get the printer to work with cups, you might try this route.<br />
<br />
That said, there are more options. An overview is at [https://www.bchemnet.com/suldr/alternatives.html alternatives].<br />
<br />
* Out of CJX-XXX series, at least CJX-1000, CJX-1050W, and CJX-2000FW are reported to work with {{AUR|c2esp}}, even though {{ic|c2esp}} is supposedly for Kodak products. <br />
* For [http://www.undocprint.org/formats/page_description_languages/spl Samsung Printer Language], there is {{Pkg|splix}}. For a list of models that are supported, see its [http://splix.ap2c.org/ home page]. Other SPL Samsung printers, even tough not in that list, might work with {{ic|splix}}. <br />
* QPDL (Quick Page Description Language) printers, some of which are supported by {{ic|splix}}, are also supported by by {{ic|foo2qpdl}}, provided by the [[#foo2zjs]] package. A list of known to work models is [http://www.foo2qpdl.rkkda.com/ here].<br />
All of {{ic|c2esp}}, {{ic|splix}} and {{ic|foo2zjs}} are free software.<br />
<br />
You should also note that many Samsung printers support PostScript. Chances are that it will work with CUPS generic postscript printer, especially if it is only black & white and only printer, without a scanner added to it. Generic driver may be missing functionality or limited, for example in their support for duplex, color control, and resolution settings, and print quality may be lower.<br />
<br />
== Xerox or FujiXerox ==<br />
<br />
{| class="wikitable"<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|-<br />
| DocuPrint 203A || {{Pkg|hplip}} || Using the '''DocuPrint P8e(hpijs)''' driver, or the Brother driver on FujiXerox's website (see [[#Brother]] for more information on how to install custom Brother drivers).<br />
|-<br />
| Phaser 3100MFP || Install Xerox's driver || See [[#Phaser 3100MFP]] for more instructions.<br />
|-<br />
| Phaser 6115MFP || [[foomatic]] ||<br />
|-<br />
| Phaser 6121MFP || [[foomatic]] ||<br />
|-<br />
| Xerox Workcentre 3119 || {{Pkg|splix}} || Since Samsung SCX-4200 is the rebranded Xerox 3119, splix package works for both<br />
|-<br />
! Printer<br />
! Driver/filter<br />
! Notes<br />
|}<br />
<br />
=== Custom drivers ===<br />
<br />
==== Phaser 3100MFP ====<br />
<br />
{{Warning|This section involves installing packages without [[pacman]]. These directions should ideally be automated with a [[PKGBUILD]].}}<br />
<br />
Once you have downloaded the drivers, execute the driver installer and accept the licence:<br />
<br />
# cd printer<br />
# ./XeroxPhaser3100.install<br />
<br />
Note that the driver is 32 bit, so some 32 bit libraries will be required on an x86_64 system.<br />
<br />
For the scanner, create an {{ic|/etc/sane.d}} directory if it does not already exist, because it is needed by the installer:<br />
<br />
# mkdir -p /etc/sane.d<br />
<br />
Now install the driver:<br />
<br />
# cd scanner/<br />
# ./XeroxPhaser3100sc.install<br />
<br />
Again, on an x86_64 install, 32 bit libraries will be needed.<br />
<br />
==== Phaser 6000B ====<br />
<br />
[[Install]] the [https://github.com/aur-archive/xerox-phaser-6010 xerox-phaser-6010] package (archived from the AUR).<br />
The driver may require older versions of {{Pkg|nettle}} and {{Pkg|gnutls}} to be installed, since the binary blob linked against older versions of the shared libraries provided by those packages. The oldest known-good versions are {{ic|nettle-2.7.1-1}} and {{ic|gnutls-3.3.13-1}}.<br />
<br />
==== Phaser 6125N ====<br />
<br />
{{Warning|This section involves installing packages without [[pacman]]. These directions should ideally be automated with a [[PKGBUILD]].}}<br />
<br />
FujiXerox does not support Linux on this model. An old rpm [http://onlinesupport.fujixerox.com/tiles/common/hc_drivers_download.jsp?system=%27Linux%27&shortdesc=null&xcrealpath=http://www.fujixeroxprinters.com/downloads/uploaded/dpc525a_linux_.0.0.tar_81c2.zip is available] but does not seem to work.<br />
<br />
A slightly adapted [https://rickvanderzwet.nl/trac/personal/wiki/XeroxPhaser6125N custom driver] has been found to work out of the box.<br />
<br />
To install the tarball, run:<br />
<br />
# tar -C / --keep-newer-files -xvzf cups-xerox-phaser-6125n-1.0.0.tar.gz</div>Mklein994https://wiki.archlinux.org/index.php?title=Tmux&diff=437114Tmux2016-06-03T18:07:28Z<p>Mklein994: Add 24-bit color support and clarify section with subheadings</p>
<hr />
<div>[[Category:Terminal emulators]]<br />
[[es:Tmux]]<br />
[[ja:Tmux]]<br />
[[ru:Tmux]]<br />
[[tr:Tmux]]<br />
[[zh-CN:Tmux]]<br />
{{Related articles start}}<br />
{{Related|GNU Screen}}<br />
{{Related articles end}}<br />
<br />
[http://tmux.github.io/ Tmux] is a "terminal multiplexer: it enables a number of terminals (or windows), each running a separate program, to be created, accessed, and controlled from a single screen. tmux may be detached from a screen and continue running in the background, then later reattached." <br />
<br />
Tmux is a BSD-licensed alternative to [[GNU Screen]]. Although similar, there are many differences between the programs, as noted on the [https://raw.githubusercontent.com/tmux/tmux/master/FAQ tmux FAQ page].<br />
<br />
== Installation ==<br />
[[Install]] the {{Pkg|tmux}} package.<br />
<br />
== Configuration ==<br />
A user-specific configuration file should be located at {{ic|~/.tmux.conf}}, while a global configuration file should be located at {{ic|/etc/tmux.conf}}. Default configuration files can be found in {{Ic|/usr/share/tmux/}}. <br />
<br />
=== Key bindings ===<br />
<br />
By default, command key bindings are prefixed by {{Ic|Ctrl-b}}. For example, to vertically split a window type {{Ic|Ctrl-b+%}}.<br />
<br />
After splitting a window into multiple panes, a pane can be resized by the hitting prefix key (e.g. {{Ic|Ctrl-b}}) and, while continuing to hold Ctrl, press Left/Right/Up/Down. Swapping panes is achieved in the same manner, but by hitting ''o'' instead of a directional key.<br />
<br />
{{Tip|To mimic [[screen]] key bindings copy {{ic|/usr/share/tmux/screen-keys.conf}} to either of the configuration locations.}}<br />
<br />
Key bindings may be changed with the bind and unbind commands in {{ic|tmux.conf}}. For example, the default prefix binding of {{Ic|Ctrl-b}} can be changed to {{Ic|Ctrl-a}} by adding the following commands in your configuration file:<br />
<br />
{{bc|<br />
unbind C-b<br />
set -g prefix C-a<br />
bind C-a send-prefix<br />
}}<br />
<br />
{{Tip|Quote special characters to use them as prefix. You may also use {{ic|Alt}} (called Meta) instead of {{ic|Ctrl}}. For example: {{ic|set -g prefix m-'\'}}}}<br />
<br />
Additional ways to move between windows include the following:<br />
<br />
Ctrl-b l (Move to the previously selected window)<br />
Ctrl-b w (List all windows / window numbers)<br />
Ctrl-b <window number> (Move to the specified window number, the default bindings are from 0 – 9)<br />
Ctrl-b q (Show pane numbers, when the numbers show up type the key to goto that pane)<br />
<br />
Tmux has a find-window option & key binding to ease navigation of many windows:<br />
<br />
Ctrl-b f <window name> (Search for window name)<br />
Ctrl-b w (Select from interactive list of windows)<br />
<br />
==== Copy Mode ====<br />
<br />
A tmux window may be in one of several modes. The default permits direct access to the terminal attached to the window; the other is copy mode. Once in copy mode you can navigate the buffer including scrolling the history. Use vi or emacs-style key bindings in copy mode. The default is emacs, unless VISUAL or EDITOR contains ‘vi’<br />
<br />
To enter copy mode do the following:<br />
<br />
Ctrl-b [<br />
<br />
You can navigate the buffer as you would in your default editor.<br />
<br />
To quit copy mode, use one of the following keybindings:<br />
<br />
vi mode:<br />
q<br />
emacs mode:<br />
Esc<br />
<br />
=== Browsing URLs ===<br />
To browse URLs inside tmux you must have {{AUR|urlview}} installed and configured.<br />
<br />
Inside a new terminal:<br />
bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; run-shell "$TERMINAL -e urlview /tmp/tmux-buffer"<br />
<br />
Or inside a new tmux window (no new terminal needed):<br />
bind-key u capture-pane \; save-buffer /tmp/tmux-buffer \; new-window -n "urlview" '$SHELL -c "urlview < /tmp/tmux-buffer"'<br />
<br />
=== Setting the correct term ===<br />
==== 256 colors ====<br />
If you are using a 256 colour terminal, you will need to set the correct term in tmux. You can do this in {{ic|tmux.conf}}:<br />
<br />
set -g default-terminal "screen-256color" <br />
<br />
or:<br />
<br />
set -g default-terminal "xterm-256color"<br />
<br />
Also, if tmux messes up, you can force tmux to assume that the terminal support 256 colors, by adding this in your .bashrc:<br />
<br />
alias tmux="tmux -2"<br />
<br />
==== 24-bit color ====<br />
Tmux supports 24-bit color as of version 2.2 ([https://github.com/tmux/tmux/commit/427b8204268af5548d09b830e101c59daa095df9 427b820]). If your terminal supports 24-bit color (see this [https://gist.github.com/XVilka/8346728 gist]), add your terminal to the {{ic|terminal-overrides}} setting. For example, if you use [[Termite]], you would add:<br />
<br />
set -ga terminal-overrides ",xterm-termite:Tc"<br />
<br />
See the tmux(1) man page for details about the {{ic|Tc}} terminfo extension.<br />
<br />
==== xterm-keys ====<br />
To enable xterm-keys in your {{ic|tmux.conf}}, you have to add the following line<br />
<br />
set-option -g xterm-keys on<br />
<br />
If you enable xterm-keys in your {{ic|tmux.conf}}, then you need to build a custom terminfo to declare the new escape codes or applications will not know about them. Compile the following with {{ic|tic}} and you can use "xterm-screen-256color" as your TERM:<br />
<br />
# A screen- based TERMINFO that declares the escape sequences<br />
# enabled by the tmux config "set-window-option -g xterm-keys".<br />
#<br />
# Prefix the name with xterm- since some applications inspect<br />
# the TERM *name* in addition to the terminal capabilities advertised.<br />
xterm-screen-256color|GNU Screen with 256 colors bce and tmux xterm-keys,<br />
<br />
# As of Nov'11, the below keys are picked up by<br />
# .../tmux/blob/master/trunk/xterm-keys.c:<br />
kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H,<br />
kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~,<br />
kRIT=\E[1;2C,<br />
<br />
# Change this to screen-256color if the terminal you run tmux in<br />
# doesn't support bce:<br />
use=screen-256color-bce,<br />
<br />
=== Other Settings ===<br />
To limit the scrollback buffer to 10000 lines:<br />
set -g history-limit 10000<br />
<br />
Terminal emulator settings can be overridden with<br />
set -ga terminal-overrides ',xterm*:smcup@:rmcup@'<br />
set -ga terminal-override ',rxvt-uni*:XT:Ms=\E]52;%p1%s;%p2%s\007'<br />
<br />
Mouse can be toggled with<br />
bind-key m set-option -g mouse on \; display 'Mouse: ON'<br />
bind-key M set-option -g mouse off \; display 'Mouse: OFF'<br />
<br />
=== Autostart with systemd ===<br />
<br />
There are some notable advantages to starting a tmux server at startup.<br />
Notably, when you start a new tmux session, having the service already running reduces any delays in the startup.<br />
<br />
Furthermore, any customization attached to your tmux session will be retained and your tmux session can be made to persist even if you have never logged in, if you have some reason to do that (like a heavily scripted tmux configuration or shared user tmux sessions).<br />
<br />
The service below starts ''tmux'' for the specified user (i.e. start with {{ic|tmux@''username''.service}}):<br />
<br />
{{hc|/etc/systemd/system/tmux@.service|<nowiki><br />
[Unit]<br />
Description=Start tmux in detached session<br />
<br />
[Service]<br />
Type=forking<br />
User=%I<br />
ExecStart=/usr/bin/tmux new-session -s %u -d<br />
ExecStop=/usr/bin/tmux kill-session -t %u<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
{{Tip|You may want to add {{ic|1=WorkingDirectory=''custom_path''}} to customize working directory.}}<br />
<br />
Alternatively, you can place this file within your [[systemd/User]] directory (without {{ic|1=User=%I}}), for example {{ic|~/.config/systemd/user/tmux.service}}. This way the tmux service will start when you log in.<br />
<br />
== Session initialization ==<br />
You can have tmux open a session with preloaded windows by including those details in your {{ic|~/.tmux.conf}}:<br />
<br />
new -n WindowName Command<br />
neww -n WindowName Command<br />
neww -n WindowName Command<br />
<br />
To start a session with split windows (multiple panes), include the splitw command below the neww you would like to split; thus:<br />
<br />
new -s SessionName -n WindowName Command<br />
neww -n foo/bar foo<br />
splitw -v -p 50 -t 0 bar<br />
selectw -t 1 <br />
selectp -t 0<br />
<br />
would open 2 windows, the second of which would be named foo/bar and would be split vertically in half (50%) with foo running above bar. Focus would be in window 2 (foo/bar), top pane (foo).<br />
<br />
{{Note|Numbering for sessions, windows and panes starts at zero, unless you have specified a base-index of 1 in your {{ic|.conf}} }}<br />
<br />
To manage multiple sessions, source separate session files from your conf file:<br />
<br />
# initialize sessions<br />
bind F source-file ~/.tmux/foo<br />
bind B source-file ~/.tmux/bar<br />
<br />
== Troubleshooting ==<br />
<br />
=== Scrolling issues ===<br />
<br />
If you have issues scrolling with Shift-Page Up/Down in your terminal, the following will remove the smcup and rmcup capabilities for any term that reports itself as anything beginning with {{ic|xterm}}:<br />
<br />
set -ga terminal-overrides ',xterm*:smcup@:rmcup@'<br />
<br />
This tricks the terminal emulator into thinking Tmux is a full screen application like pico or mutt[http://superuser.com/questions/310251/use-terminal-scrollbar-with-tmux], which will make the scrollback be recorded properly. Beware however, it will get a bit messed up when switching between windows/panes. Consider using Tmux's native scrollback instead.<br />
<br />
=== Mouse scrolling ===<br />
<br />
{{Note|This interferes with selection buffer copying and pasting. To copy/paste to/from the selection buffer hold the shift key.}}<br />
<br />
If you want to scroll with your mouse wheel, ensure mode-mouse is on in .tmux.conf<br />
set -g mouse on<br />
<br />
You can set scroll History with:<br />
set -g history-limit 30000<br />
<br />
For mouse wheel scrolling as from tmux 2.1 try adding one or both of these to ~/.tmux.conf<br />
bind -T root WheelUpPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; copy-mode -e; send-keys -M"<br />
bind -T root WheelDownPane if-shell -F -t = "#{alternate_on}" "send-keys -M" "select-pane -t =; send-keys -M"<br />
<br />
Though the above will only scroll one line at a time, add this solution to scroll an entire page instead<br />
bind -t vi-copy WheelUpPane page-up<br />
bind -t vi-copy WheelDownPane page-down<br />
bind -t emacs-copy WheelUpPane page-up<br />
bind -t emacs-copy WheelDownPane page-down<br />
<br />
=== Terminal emulator does not support UTF-8 mouse events ===<br />
<br />
When the terminal emulator does not support the UTF-8 mouse events and the {{ic|mouse on}} tmux option is set, left-clicking inside the terminal window might paste strings like {{ic|[M#}} or {{ic|[Ma}} into the promt.<br />
<br />
To solve this issue set:<br />
<br />
set -g mouse-utf8 off<br />
<br />
=== Fix reverse-video/italic mode in urxvt ===<br />
<br />
If your reverse-video and italic modes are reversed, for example in vim when italics are replaced by highlighting, or in less when the search highlighting is replaced by italics. This is because the screen terminfo doesn't define italics, and the italics escape of urxvt happens to be the standout escape defined in the terminfo. <br />
<br />
This could be fixed by use the tmux or tmux-256color terminfo by putting the following line in your tmux.conf: <br />
set -g default-terminal "tmux-256color"<br />
<br />
=== Shift+F6 not working in Midnight Commander ===<br />
<br />
See [[Midnight Commander#Shift+F6 not working]].<br />
<br />
== X clipboard integration ==<br />
<br />
{{Tip|The tmux plugin [https://github.com/tmux-plugins/tmux-yank tmux-yank] provides similar functionality.}}<br />
<br />
It is possible to copy tmux selection to X clipboard (and to X primary/secondary selection) and in reverse direction. The following tmux config file snippet effectively integrates X clipboard/selection with the current tmux selection using the program {{Pkg|xsel}}:<br />
<br />
# Emacs style<br />
bind-key -t emacs-copy M-w copy-pipe "xsel -i -p -b"<br />
bind-key C-y run "xsel -o | tmux load-buffer - ; tmux paste-buffer"<br />
<br />
# Vim style<br />
bind-key -t vi-copy y copy-pipe "xsel -i -p -b"<br />
bind-key p run "xsel -o | tmux load-buffer - ; tmux paste-buffer"<br />
<br />
{{pkg|xclip}} could also be used for that purpose, unlike xsel it works better on printing raw bitstream that doesn't fit the current locale. Nevertheless, it is neater to use <code>xsel</code> instead of <code>xclip</code>, because xclip does not close STDOUT after it has read from tmux's buffer. As such, tmux doesn't know that the copy task has completed, and continues to wait for xclip's termination, thereby rendering tmux unresponsive. A workaround is to redirect <code>STDOUT</code> of <code>xclip</code> to <code>/dev/null</code>, like in the following:<br />
<br />
# Vim style<br />
bind-key -t vi-copy y copy-pipe "xclip -i -sel clip > /dev/null"<br />
bind-key p run "xclip -o -sel clip | tmux load-buffer -"<br />
<br />
=== Urxvt middle click ===<br />
<br />
{{Note|To use this, you need to enable mouse support}}<br />
<br />
There is an unofficial perl extension (mentioned in the official [http://sourceforge.net/p/tmux/tmux-code/ci/master/tree/FAQ FAQ]) to enable copying/pasting in and out of urxvt with tmux via Middle Mouse Clicking.<br />
<br />
First, you will need to download the perl script and place it into urxvts perl lib:<br />
<br />
{{bc|wget http://anti.teamidiot.de/static/nei/*/Code/urxvt/osc-xterm-clipboard<br />
mv osc-xterm-clipboard /usr/lib/urxvt/perl/|<br />
}}<br />
<br />
You will also need to enable that perl script in your .Xdefaults:<br />
<br />
{{hc|~/.Xdefaults|<br />
...<br />
*URxvt.perl-ext-common: osc-xterm-clipboard<br />
...<br />
}}<br />
<br />
Next, you want to tell tmux about the new function and enable mouse support (if you haven't already):<br />
<br />
{{hc|~/.tmux.conf|<br />
...<br />
set-option -ga terminal-override ',rxvt-uni*:XT:Ms<nowiki>=</nowiki>\E]52;%p1%s;%p2%s\007'<br />
set -g mouse on<br />
...<br />
}}<br />
<br />
That's it. Be sure to end all instances of tmux before trying the new MiddleClick functionality.<br />
<br />
While in tmux, Shift+MiddleMouseClick will paste the clipboard selection while just MiddleMouseClick will paste your tmux buffer.<br />
Outside of tmux, just use MiddleMouseClick to paste your tmux buffer and your standard Ctrl-c to copy.<br />
<br />
== Tips and tricks ==<br />
=== Start tmux with default session layout ===<br />
To setup your default Tmux session layout, you install {{AUR|tmuxinator}} from [[AUR]]. Test your installation with<br />
<br />
tmuxinator doctor<br />
<br />
==== Get the default layout values ====<br />
Start Tmux as usual and configure your windows and panes layout as you like. When finished, get the current layout values by executing (while you are still within the current Tmux session)<br />
<br />
tmux list-windows<br />
<br />
The output may look like this (two windows with 3 panes and 2 panes layout)<br />
<br />
0: default* (3 panes) [274x83] [layout 20a0,274x83,0,0{137x83,0,0,3,136x83,138,0[136x41,138,0,5,136x41,138,42,6]}] @2 (active)<br />
1: remote- (2 panes) [274x83] [layout e3d3,274x83,0,0[274x41,0,0,4,274x41,0,42,7]] @3 <br />
<br />
The Interesting part you need to copy for later use begins after '''[layout...''' and excludes '''... ] @2 (active)'''. For the first window layout you need to copy e.g. '''20a0,274x83,0,0{137x83,0,0,3,136x83,138,0[136x41,138,0,5,136x41,138,42,6]}'''<br />
<br />
==== Define the default tmux layout ====<br />
<br />
Knowing this, you can exit the current tmux session. Following this, you create your default Tmux session layout by editing Tmuxinator's config file (Don't copy the example, get your layout values as described above)<br />
<br />
{{hc|~/.tmuxinator/default.yml|<nowiki><br />
name: default<br />
root: ~/<br />
windows:<br />
- default:<br />
layout: 20a0,274x83,0,0{137x83,0,0,3,136x83,138,0[136x41,138,0,5,136x41,138,42,6]}<br />
panes:<br />
- clear<br />
- vim<br />
- clear && emacs -nw<br />
- remote:<br />
layout: 24ab,274x83,0,0{137x83,0,0,3,136x83,138,0,4}<br />
panes:<br />
- <br />
- <br />
</nowiki>}}<br />
<br />
The example defines two windows named "default" and "remote". With your determined layout values. For each pane you have to use at least one {{ic|-}} line. Within the first window panes you start the commandline "clear" in pane one, "vim" in pane two and "clear && emacs -nw" executes two commands in pane three on each Tmux start. The second window layout has two panes without defining any start commmands.<br />
<br />
Test the new default layout with (yes, it is "mux"):<br />
<br />
mux default<br />
<br />
==== Autostart tmux with default tmux layout ====<br />
<br />
If you like to start your terminal session with your default Tmux session layout edit<br />
{{hc|~/.bashrc|<nowiki><br />
if [ -z "$TMUX" ]; then<br />
mux default <br />
fi <br />
</nowiki>}}<br />
<br />
====Alternate approach for default session====<br />
Instead of using the above method, one can just write a bash script that when run, will create the default session and attach to it.<br />
Then you can execute it from a terminal to get the pre-designed configuration in that terminal<br />
<br />
#!/bin/bash<br />
tmux new-session -d -n WindowName Command<br />
tmux new-window -n NewWindowName<br />
tmux split-window -v<br />
tmux selectp -t 1<br />
tmux split-window -h<br />
tmux selectw -t 1<br />
tmux -2 attach-session -d<br />
<br />
===Start tmux in urxvt===<br />
Use this command to start urxvt with a started tmux session. I use this with the exec command from my .ratpoisonrc file.<br />
{{bc|<nowiki>urxvt -e bash -c "tmux -q has-session && exec tmux attach-session -d || exec tmux new-session -n$USER -s$USER@$HOSTNAME"</nowiki>}}<br />
<br />
=== Start tmux on every shell login ===<br />
<br />
==== Bash ====<br />
<br />
For bash, simply add the following line of bash code to your .bashrc before your aliases; the code for other shells is very similar:<br />
<br />
{{hc|~/.bashrc|<nowiki><br />
# If not running interactively, do not do anything<br />
[[ $- != *i* ]] && return<br />
[[ -z "$TMUX" ]] && exec tmux<br />
</nowiki>}}<br />
<br />
{{note|This snippet ensures that tmux is not launched inside of itself (something tmux usually already checks for anyway). tmux sets $TMUX to the socket it is using whenever it runs, so if $TMUX isn't set or is length 0, we know we aren't already running tmux.}}<br />
<br />
Add the following snippet to start only one session (unless you start some manually), on login, try attach at first, only create a session if no tmux is running.<br />
<br />
{{bc|<nowiki><br />
# TMUX<br />
if which tmux >/dev/null 2>&1; then<br />
#if not inside a tmux session, and if no session is started, start a new session<br />
test -z "$TMUX" && (tmux attach || tmux new-session)<br />
fi<br />
</nowiki>}}<br />
<br />
The following snippet does the same thing, but also checks tmux is installed before trying to launch it. It also tries to reattach you to an existing tmux session at logout, so that you can shut down every tmux session quickly from the same terminal at logout.<br />
{{bc|<nowiki><br />
# TMUX<br />
if which tmux >/dev/null 2>&1; then<br />
# if no session is started, start a new session<br />
test -z ${TMUX} && tmux<br />
<br />
# when quitting tmux, try to attach<br />
while test -z ${TMUX}; do<br />
tmux attach || break<br />
done<br />
fi<br />
</nowiki>}}<br />
<br />
Another possibility is to try to attach to existing deattached session or start a new session:<br />
<br />
{{bc|<nowiki><br />
if [[ -z "$TMUX" ]] ;then<br />
ID="`tmux ls | grep -vm1 attached | cut -d: -f1`" # get the id of a deattached session<br />
if [[ -z "$ID" ]] ;then # if not available create a new one<br />
tmux new-session<br />
else<br />
tmux attach-session -t "$ID" # if available attach to it<br />
fi<br />
fi<br />
</nowiki>}}<br />
<br />
==== Fish ====<br />
<br />
{{Move|Fish}}<br />
<br />
To start tmux on every shell login with fish, use the following:<br />
<br />
{{hc|~/.config/fish/config.fish|<nowiki><br />
# If not running interactively, do not do anything<br />
if status --is-interactive<br />
if test -z (echo $TMUX)<br />
tmux<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
Alternatively, to start only one tmux session, or try to attach to another session on launch:<br />
{{hc|~/.config/fish/config.fish|<nowiki><br />
if status --is-interactive<br />
if test -z (echo $TMUX)<br />
if not test (tmux attach)<br />
tmux new-session<br />
end<br />
end<br />
end<br />
</nowiki>}}<br />
<br />
{{note|Instead of using the shell config file, you can launch tmux when you start your terminal emulator. (i. e. urxvt -e tmux)}}<br />
<br />
=== Start a non-login shell ===<br />
<br />
Tmux starts a [http://unix.stackexchange.com/questions/38175 login shell] [http://comments.gmane.org/gmane.comp.terminal-emulators.tmux.user/5997 by default], which may result in multiple negative side effects:<br />
<br />
* Users of [[Wikipedia:fortune (Unix)|fortune]] may notice that quotes are printed when creating a new panel.<br />
* The configuration files for login shells such as {{ic|~/.profile}} are interpreted each time a new panel is created, so commands intended to be run on session initialization (e.g. setting audio level) are executed.<br />
<br />
To disable this behaviour, add to {{ic|~/.tmux.conf}}:<br />
<br />
set -g default-command "${SHELL}"<br />
<br />
=== Use tmux windows like tabs ===<br />
<br />
The following settings added to {{ic|~/.tmux.conf}} allow to use tmux windows like tabs, such as those provided by the reference of these hotkeys — [[rxvt-unicode#urxvtq_with_tabbing|urxvt's tabbing extensions]]. An advantage thereof is that these virtual “tabs” are independent of the terminal emulator.<br />
<br />
#urxvt tab like window switching (-n: no prior escape seq)<br />
bind -n S-down new-window<br />
bind -n S-left prev<br />
bind -n S-right next<br />
bind -n C-left swap-window -t -1<br />
bind -n C-right swap-window -t +1<br />
<br />
Of course, those should not overlap with other applications' hotkeys, such as the terminal's. Given that they substitute terminal tabbing that might as well be deactivated, though.<br />
<br />
It can also come handy to supplement the EOT hotkey {{ic|Ctrl+d}} with one for tmux's detach:<br />
<br />
bind-key -n C-j detach<br />
<br />
=== Clients simultaneously interacting with various windows of a session ===<br />
<br />
In [http://mutelight.org/articles/practical-tmux Practical Tmux], Brandur Leach writes:<br />
<br />
: Screen and tmux's behaviour for when multiple clients are attached to one session differs slightly. In Screen, each client can be connected to the session but view different windows within it, but in tmux, all clients connected to one session must view the same window.<br />
: This problem can be solved in tmux by spawning two separate sessions and synchronizing the second one to the windows of the first, then pointing a second new session to the first.<br />
<br />
The script “{{Ic|tmx}}” below implements this — the version here is slightly modified to execute “{{Ic|tmux new-window}}” if “1” is its second parameter. Invoked as {{Ic|tmx <base session name> [1]}} it launches the base session if necessary. Otherwise a new “client” session linked to the base, optionally add a new window and attach, setting it to kill itself once it turns “zombie”.<br />
<br />
{{hc|tmx|2=<nowiki><br />
#!/bin/bash<br />
<br />
#<br />
# Modified TMUX start script from:<br />
# http://forums.gentoo.org/viewtopic-t-836006-start-0.html<br />
#<br />
# Store it to `~/bin/tmx` and issue `chmod +x`.<br />
#<br />
<br />
# Works because bash automatically trims by assigning to variables and by <br />
# passing arguments<br />
trim() { echo $1; }<br />
<br />
if [[ -z "$1" ]]; then<br />
echo "Specify session name as the first argument"<br />
exit<br />
fi<br />
<br />
# Only because I often issue `ls` to this script by accident<br />
if [[ "$1" == "ls" ]]; then<br />
tmux ls<br />
exit<br />
fi<br />
<br />
base_session="$1"<br />
# This actually works without the trim() on all systems except OSX<br />
tmux_nb=$(trim `tmux ls | grep "^$base_session" | wc -l`)<br />
if [[ "$tmux_nb" == "0" ]]; then<br />
echo "Launching tmux base session $base_session ..."<br />
tmux new-session -s $base_session<br />
else<br />
# Make sure we are not already in a tmux session<br />
if [[ -z "$TMUX" ]]; then<br />
echo "Launching copy of base session $base_session ..."<br />
# Session id is date and time to prevent conflict<br />
session_id=`date +%Y%m%d%H%M%S`<br />
# Create a new session (without attaching it) and link to base session <br />
# to share windows<br />
tmux new-session -d -t $base_session -s $session_id<br />
if [[ "$2" == "1" ]]; then<br />
# Create a new window in that session<br />
tmux new-window<br />
fi<br />
# Attach to the new session & kill it once orphaned<br />
tmux attach-session -t $session_id \; set-option destroy-unattached<br />
fi<br />
fi<br />
</nowiki>}}<br />
<br />
A useful setting for this is<br />
<br />
setw -g aggressive-resize on<br />
<br />
added to {{ic|~/.tmux.conf}}. It causes tmux to resize a window based on the smallest client actually viewing it, not on the smallest one attached to the entire session.<br />
<br />
An alternative taken from [http://comments.gmane.org/gmane.comp.terminal-emulators.tmux.user/2632] is to put the following ~/.bashrc:<br />
<br />
{{hc|.bashrc|2=<nowiki><br />
function rsc() {<br />
CLIENTID=$1.`date +%S`<br />
tmux new-session -d -t $1 -s $CLIENTID \; set-option destroy-unattached \; attach-session -t $CLIENTID<br />
}<br />
<br />
function mksc() {<br />
tmux new-session -d -s $1<br />
rsc $1<br />
}<br />
</nowiki>}}<br />
<br />
Citing the author:<br />
<br />
: "mksc foo" creates a always detached permanent client named "foo". It also calls "rsc foo" to create a client to newly created session. "rsc foo" creates a new client grouped by "foo" name. It has destroy-unattached turned on so when I leave it, it kills client.<br />
: Therefore, when my computer looses network connectivity, all "foo.something" clients are killed while "foo" remains. I can then call "rsc foo" to continue work from where I stopped.<br />
<br />
=== Correct the TERM variable according to terminal type ===<br />
Instead of [[#Setting_the_correct_term|setting a fixed TERM variable in tmux]], it is possible to set the proper TERM (either {{ic|screen}} or {{ic|screen-256color}}) according to the type of your terminal emulator:<br />
<br />
{{hc|~/.tmux.conf|<br />
## set the default TERM<br />
set -g default-terminal screen<br />
<br />
## update the TERM variable of terminal emulator when creating a new session or attaching a existing session<br />
set -g update-environment 'DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY TERM'<br />
## determine if we should enable 256-colour support<br />
if "[[ ${TERM} =~ 256color || ${TERM} == fbterm ]]" 'set -g default-terminal screen-256color'<br />
}}<br />
<br />
{{hc|1=~/.zshrc|2=<br />
## workaround for handling TERM variable in multiple tmux sessions properly from http://sourceforge.net/p/tmux/mailman/message/32751663/ by Nicholas Marriott<br />
if [[ -n ${TMUX} && -n ${commands[tmux]} ]];then<br />
case $(tmux showenv TERM 2>/dev/null) in<br />
*256color) ;&<br />
TERM=fbterm)<br />
TERM=screen-256color ;;<br />
*)<br />
TERM=screen<br />
esac<br />
fi<br />
}}<br />
<br />
=== Reload an updated configuration without restarting tmux ===<br />
<br />
By default tmux reads {{ic|~/.tmux.conf}} only if it was not already running. To have tmux load a configuration file afterwards, execute:<br />
<br />
tmux source-file <path><br />
<br />
This can be added to {{ic|~/.tmux.conf}} as e. g.:<br />
<br />
bind r source-file <path><br />
<br />
You can also do ^: and type :<br />
source .tmux.conf<br />
<br />
===Template script to run program in new session resp. attach to existing one===<br />
<br />
This script checks for a program presumed to have been started by a previous run of itself. Unless found it creates a new tmux session and attaches to a window named after and running the program. If however the program was found it merely attaches to the session and selects the window.<br />
<br />
#!/bin/bash<br />
<br />
PID=$(pidof $1)<br />
<br />
if [ -z "$PID" ]; then<br />
tmux new-session -d -s main ;<br />
tmux new-window -t main -n $1 "$*" ;<br />
fi<br />
tmux attach-session -d -t main ;<br />
tmux select-window -t $1 ;<br />
exit 0<br />
<br />
A derived version to run ''irssi'' with the ''nicklist'' plugin can be found on [[Irssi#irssi_with_nicklist_in_tmux|its ArchWiki page]].<br />
<br />
=== Terminal emulator window titles ===<br />
If you SSH into a host in a tmux window, you'll notice the window title of your terminal emulator remains to be {{ic|user@localhost}} rather than {{ic|user@server}}. To allow the title bar to adapt to whatever host you connect to, set the following in {{ic|~/.tmux.conf}}<br />
<br />
set -g set-titles on<br />
set -g set-titles-string "#T"<br />
<br />
For {{ic|set-titles-string}}, {{ic|#T}} will display {{ic|user@host:~}} and change accordingly as you connect to different hosts.<br />
<br />
=== Automatic layouting ===<br />
When creating new splits or destroying older ones the currently selected layout isn't applied. To fix that, add following binds which will apply the currently selected layout to new or remaining panes:<br />
<br />
bind-key -n M-c kill-pane \; select-layout<br />
bind-key -n M-n split-window \; select-layout<br />
<br />
=== Vim friendly configuration ===<br />
<br />
See [https://gist.github.com/anonymous/6bebae3eb9f7b972e6f0] for a configuration friendly to [[vim]] users.<br />
<br />
== See also ==<br />
<br />
* [https://bbs.archlinux.org/viewtopic.php?id=84157&p=1 BBS topic]<br />
* [http://www.dayid.org/os/notes/tm.html Screen and tmux feature comparison]<br />
* [https://github.com/Lokaltog/powerline powerline], a dynamic statusbar for tmux<br />
* [https://github.com/tmux-plugins Plugins for tmux]<br />
<br />
'''Tutorials'''<br />
<br />
* [http://mutelight.org/articles/practical-tmux Practical Tmux]<br />
* [http://www.openbsd.org/faq/faq7.html#tmux Tmux FAQ (OpenBSD)]<br />
* [http://www.openbsd.org/cgi-bin/man.cgi?query=tmux man page (OpenBSD)]<br />
* [http://blog.hawkhost.com/2010/06/28/tmux-the-terminal-multiplexer/ Tmux tutorial Part 1] and [http://blog.hawkhost.com/2010/07/02/tmux-%E2%80%93-the-terminal-multiplexer-part-2 Part 2]</div>Mklein994https://wiki.archlinux.org/index.php?title=Conky&diff=424703Conky2016-03-08T23:34:33Z<p>Mklein994: bellow -> below</p>
<hr />
<div>[[Category:Status monitoring and notification]]<br />
[[de:Conky]]<br />
[[es:Conky]]<br />
[[fr:Conky]]<br />
[[it:Conky]]<br />
[[ja:Conky]]<br />
[[ru:Conky]]<br />
[[tr:Conky]]<br />
[[zh-CN:Conky]]<br />
{{Style|Lots of useless config dumps and unneeded complexity}}<br />
''Conky'' is a system monitor software for the X Window System. It is available for GNU/Linux and FreeBSD. It is free software released under the terms of the GPL license. Conky is able to monitor many system variables including CPU, memory, swap, disk space, temperature, top, upload, download, system messages, and much more. It is extremely configurable, however, the configuration can be a little hard to understand. ''Conky'' is a fork of torsmo.<br />
<br />
== Installation and configuration ==<br />
<br />
[[Install]] the {{Pkg|conky}} package. For alternative packages with more features, see [[#AUR packages]].<br />
<br />
Create a local configuration file:<br />
$ mkdir -p ~/.config/conky<br />
$ conky -C > ~/.config/conky/conky.conf<br />
<br />
Now you can edit {{ic|~/.config/conky/conky.conf}} to customize conky as you wish. For a few example configuration files, see [https://github.com/brndnmtthws/conky/wiki/User-Configs this page].<br />
<br />
When editing your config file, you will see immediately the effect of any change as soon as you save it. There is no need to log out/log in your X session. So best is to test all kind of options, one by one, save the configuration file and see the change on your ''conky'' window, and correct if your change is inappropriate.<br />
<br />
One of the nice features of ''conky'' is to pipe to your desktop some {{ic|/var/log/}} files to read all kinds of log messages. Most of these files can only be read by {{ic|root}}, but running ''conky'' as {{ic|root}} is not recommended, so you will need to add {{ic|''username''}} to the {{ic|log}} group:<br />
# usermod -aG log ''username''<br />
<br />
=== AUR packages ===<br />
<br />
In addition to the basic ''conky'' package, there are various [[AUR]] packages available with extra compile options enabled:<br />
<br />
* {{App|conky-cli|''Conky'' without X11 dependencies||{{AUR|conky-cli}}}}<br />
* {{App|conky-lua|''Conky'' with Lua support||{{AUR|conky-lua}}}}<br />
* {{App|conky-lua-nv|''Conky'' with both Lua and Nvidia support||{{AUR|conky-lua-nv}}}}<br />
* {{App|conky-nvidia|''Conky'' with Nvidia support||{{AUR|conky-nvidia}}}}<br />
<br />
== Tips and tricks ==<br />
<br />
=== Configuration notice ===<br />
<br />
Take note that settings below say something like setting_x yes | no.<br />
however, if you copy the default config from system folder, you will<br />
see that syntax there is different.<br />
<br />
Instead of writing setting_x y, do " setting_x = true | false | 'string' "<br />
<br />
For example: own_window_transparent = true.<br />
<br />
=== Enable real transparency in KDE4 and Xfce4 ===<br />
<br />
Since version 1.8.0 ''conky'' supports real transparency. To enable it add this line to {{ic|conky.conf}}:<br />
<br />
own_window_transparent yes<br />
<br />
The above option is not desired with the {{ic|OWN_WINDOW_ARGB_VISUAL yes}} option.<br />
This replaces the {{Pkg|feh}} method described below.<br />
<br />
{{Note|1=[[Xfce]] requires enabled compositing, see [https://forum.xfce.org/viewtopic.php?pid=25939].}}<br />
<br />
=== Autostart with Xfce4 ===<br />
<br />
In {{ic|conky.conf}} file:<br />
background yes<br />
<br />
This variable will fork ''conky'' to your background. If you want to make your window always visible on your desktop, sticky across all workspaces and not showing in your taskbar, add these arguments:<br />
own_window yes<br />
own_window_type override<br />
<br />
The {{ic|override}} option makes your window out of control of your window manager.<br />
<br />
Add a {{ic|~/.config/autostart/conky.desktop}}:<br />
[Desktop Entry]<br />
Encoding=UTF-8<br />
Version=0.9.4<br />
Type=Application<br />
Name=conky<br />
Comment=<br />
Exec=conky -d<br />
StartupNotify=false<br />
Terminal=false<br />
Hidden=false<br />
<br />
=== Prevent flickering ===<br />
<br />
''Conky'' needs Double Buffer Extension (DBE) support from the X server to prevent flickering because it cannot update the window fast enough without it. It can be enabled in {{ic|/etc/X11/xorg.conf}} with {{ic|Load "dbe"}} line in {{ic|"Module"}} section. The {{ic|xorg.conf}} file has been replaced (1.8.x patch upwards) by {{ic|/etc/X11/xorg.conf.d}} which contains the particular configuration files. ''DBE'' is loaded automatically.<br />
<br />
To enable double buffering add {{ic|double_buffer yes}} option to your {{ic|conky.conf}}.<br />
<br />
=== Custom colors ===<br />
<br />
Aside the classic preset colors (white, black, yellow...), you can set your own custom color using the color name code. To determine the code of a color, use a color selector app. The basic {{Pkg|gcolor2}} package in the [[official repositories]] will give you the color name. It is made of six hexadecimal digits (0-9, A-F).<br />
Add this line in your configuration file for a custom color:<br />
color1 Colorname1<br />
color2 Colorname2<br />
color3 C0CAF6<br />
Then, when editing the {{ic|TEXT}} section, use custom color number previously defined, for example {{ic|${color3} }}.<br />
<br />
=== Dual Screen ===<br />
<br />
When using a dual screen configuration, you will need to play with two options to place your ''conky'' window. Let's say you are running a 1680X1050 pixels resolution, and you want the window on middle top of your left monitor, you will use this:<br />
alignment top_left<br />
gap_X 840<br />
<br />
The {{ic|alignment}} option is trivial, and {{ic|gap_X}} option is the distance, in pixels, from the left border of your screen.<br />
<br />
=== Do not minimize on Show Desktop ===<br />
<br />
'''Using Compiz:''' If the 'Show Desktop' button or key-binding minimizes Conky along with all other windows, start the Compiz configuration settings manager, go to "General Options" and uncheck the "Hide Skip Taskbar Windows" option.<br />
<br />
If you do not use Compiz, try editing {{ic|conky.conf}} and adding/changing the following line:<br />
<br />
own_window_type override<br />
<br />
or<br />
<br />
own_window_type desktop<br />
<br />
Refer to ''conky''s man page for the exact differences. But the latter option enables you to snap windows to ''conky''s border using resize key-binds in e.g. Openbox, which the first one does not.<br />
<br />
=== Integrate with GNOME ===<br />
<br />
Some have experienced problems with ''conky'' showing up under [[GNOME]].<br />
<br />
* Add these lines to {{ic|conky.conf}}:<br />
<br />
own_window yes<br />
own_window_type conky<br />
own_window_transparent yes<br />
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager<br />
<br />
If you still experience problems with transparency. You could add these lines.<br />
own_window_argb_visual yes<br />
own_window_argb_value 255<br />
<br />
=== Integrate with KDE 4 ===<br />
<br />
''Conky'' with screenshot configuration generate problems with icons visualization. So there are some steps to follow:<br />
<br />
* Add these lines to {{ic|conky.conf}}:<br />
own_window yes<br />
own_window_type normal<br />
own_window_transparent yes<br />
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager<br />
<br />
* If this setting is on, comment it out or delete the line:<br />
minimum_size<br />
<br />
* To automatically start ''conky'', create this symlink:<br />
$ ln -s /usr/bin/conky ~/.kde4/Autostart/conkylink<br />
<br />
* Install the {{Pkg|feh}} package.<br />
<br />
* Make a script to allow transparency with the desktop:<br />
{{hc|~/.kde4/Autostart/fehconky|2=<br />
#!/bin/bash<br />
feh --bg-scale "$(sed -n 's/wallpaper=//p' ~/.kde4/share/config/plasma-desktop-appletsrc)"<br />
}}<br />
use {{ic|--bg-center}} if you use a centered wallpaper.<br />
<br />
* Make it executable:<br />
$ chmod +x ~/.kde4/Autostart/fehconky<br />
<br />
* Instead of using a script, you can add the corresponding line to the bottom of {{ic|conky.conf}}<br />
${exec feh --bg-scale "$(sed -n 's/wallpaper=//p' ~/.kde4/share/config/plasma-desktop-appletsrc)"}<br />
<br />
=== Integrate with Razor-qt ===<br />
<br />
With ''conky'''s default configuration, its window might disappear from the desktop when you click on the latter. Add these lines to: <br />
<br />
{{hc|conky.conf|own_window yes<br />
own_window_class Conky<br />
own_window_type normal<br />
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager<br />
own_window_transparent yes<br />
}}<br />
<br />
=== Display package update information ===<br />
<br />
* [[Pacman]] provides an own script called {{ic|checkupdates}} which displays package updates from the official repos. Use {{ic|<nowiki>${execpi 3600 checkupdates | wc -l}</nowiki>}} to display the total number of packages.<br />
* [https://bbs.archlinux.org/viewtopic.php?id=68104 Paconky] - Displays package update information in a user-defined format. The output of this program can be included in Conky with the {{ic|<nowiki>${execpi}</nowiki>}} command.<br />
* [https://bbs.archlinux.org/viewtopic.php?id=53761 Scrolling Notifications] - Prints scrolling update notifications. From the author of ''paconky''.<br />
* [https://bbs.archlinux.org/viewtopic.php?id=57291 Perl Script] - Simpler and earlier script from the author of ''paconky''. Prints only the number of packages needing an update.<br />
* [https://bbs.archlinux.org/viewtopic.php?id=37284 Python Script] - Fairly configurable update notification program in [[Python]].<br />
* [https://bbs.archlinux.org/viewtopic.php?pid=483742#p483742 Bash Script] - [[Bash]] script for users that have enabled ShowSize.<br />
<br />
=== Display weather forecast ===<br />
<br />
See [https://bbs.archlinux.org/viewtopic.php?id=37381 this thread].<br />
<br />
=== Display a countdown timer ===<br />
[https://github.com/orschiro/scriptlets/tree/master/ConkyTimer ConkyTimer] is a simple countdown timer that displays the remaining time of a defined task.<br />
<br />
Start the timer using {{ic|conkytimer "<task description>" <min>}}.<br />
<br />
=== Display RSS feeds ===<br />
<br />
''Conky'' has the ability to display RSS feeds natively without the need for an outside script to run and output into Conky. For example, to display the titles of the ten most recent Planet Arch updates and refresh the feed every minute, you would put this into your {{ic|conky.conf}} in the {{ic|TEXT}} section:<br />
<br />
${rss https://planet.archlinux.org/rss20.xml 1 item_titles 10 }<br />
If you want to display Arch Forum rss feed, add this line:<br />
${rss https://bbs.archlinux.org/extern.php?action=feed&type=rss 1 item_titles 4}<br />
where 1 is in minutes the refresh interval (15 mn is default),4 the number of items you wish to show.<br />
<br />
=== Display rTorrent stats ===<br />
<br />
See [https://bbs.archlinux.org/viewtopic.php?id=67304 this thread].<br />
<br />
=== Display your WordPress blog stats ===<br />
<br />
This can be achieved by using the in python written extension named [http://evilshit.wordpress.com/2013/04/20/conkypress-a-wordpress-stats-visualization-tool-for-your-desktop/ ConkyPress].<br />
<br />
=== Display number of new emails ===<br />
==== Gmail ====<br />
===== method 1 =====<br />
Create a file named {{ic|gmail.py}} in a convenient location (this example uses {{ic|~/.scripts/}}) with the following [[Python]] code:<br />
<br />
{{hc|gmail.py|<nowiki><br />
#!/usr/bin/env python<br />
<br />
from urllib.request import FancyURLopener<br />
<br />
email = 'your email' # @gmail.com can be left out<br />
password = 'your password'<br />
<br />
url = 'https://%s:%s@mail.google.com/mail/feed/atom' % (email, password)<br />
<br />
opener = FancyURLopener()<br />
page = opener.open(url)<br />
<br />
contents = page.read().decode('utf-8')<br />
<br />
ifrom = contents.index('<fullcount>') + 11<br />
ito = contents.index('</fullcount>')<br />
<br />
fullcount = contents[ifrom:ito]<br />
<br />
print(fullcount + ' new')<br />
</nowiki>}}<br />
<br />
===== method 2 =====<br />
The following script does less "by hand", and uses more of the capabilities of Python.<br />
<br />
{{hc|gmail.py|<nowiki><br />
#! /usr/bin/env python<br />
<br />
import urllib.request<br />
from xml.etree import ElementTree as etree<br />
<br />
# Enter your username and password below within quotes below, in place of ****.<br />
# Set up authentication for gmail<br />
auth_handler = urllib.request.HTTPBasicAuthHandler()<br />
auth_handler.add_password(realm='mail.google.com',<br />
uri='https://mail.google.com/',<br />
user= '****',<br />
passwd= '****')<br />
opener = urllib.request.build_opener(auth_handler)<br />
# ...and install it globally so it can be used with urlopen.<br />
urllib.request.install_opener(opener)<br />
<br />
gmail = 'https://mail.google.com/gmail/feed/atom'<br />
NS = '{http://purl.org/atom/ns#}'<br />
with urllib.request.urlopen(gmail) as source:<br />
tree = etree.parse(source)<br />
fullcount = tree.find(NS + 'fullcount').text<br />
<br />
print(fullcount + ' new')<br />
</nowiki>}}<br />
<br />
Add the following string to your {{ic|conky.conf}} in order the check your Gmail account for new email every five minutes (300 seconds) and display:<br />
${execpi 300 python ~/.scripts/gmail.py}<br />
<br />
===== method 3 =====<br />
<br />
The same way, but with using {{ic|curl}}, {{ic|grep}} and {{ic|sed}}:<br />
<br />
<nowiki>$ curl -s -u '''email''':'''password''' https://mail.google.com/mail/feed/atom | grep fullcount | sed 's/<[^0-9]*>//g'</nowiki><br />
<br />
replace ''email'' and ''password'' with your data.<br />
<br />
===== method 4 =====<br />
<br />
Alternatively, you can use [http://www.stunnel.org/ stunnel] which is provided by the {{Pkg|stunnel}} package.<br />
<br />
The following configuration is taken from [https://github.com/brndnmtthws/conky/wiki/FAQ Conky's FAQ]<br />
<br />
Modify {{ic|/etc/stunnel/stunnel.conf}} as follows, and then [[start]] {{ic|stunnel.service}}:<br />
# Service-level configuration for TLS server<br />
[imap]<br />
client = yes<br />
accept = 143<br />
connect = imap.gmail.com:143<br />
protocol = imap<br />
sslVersion = TLSv1<br />
# Service-level configuration for SSL server<br />
[imaps]<br />
client = yes<br />
accept = 993<br />
connect = imap.gmail.com:993<br />
<br />
The only thing left is our {{ic|conky.conf}}:<br />
imap localhost username * -i 120 -p 993<br />
TEXT<br />
Inbox: ${imap_unseen}/${imap_messages}<br />
<br />
Here I used {{ic|*}} as the password for ''conky'' to ask for it at start, but you do '''not''' have to do it.<br />
<br />
==== IMAP + SSL using Perl ====<br />
<br />
''Conky'' has built in support for IMAP accounts but does not support SSL. This can be provided using this script from [http://www.unix.com/shell-programming-scripting/115322-perl-conky-gmail-imap-unread-message-count.html this forum post]. This requires the Perl/CPAN Modules Mail::IMAPClient and IO::Socket::SSL which are in the {{AUR|perl-mail-imapclient}} and {{Pkg|perl-io-socket-ssl}} packages<br />
<br />
Create a file named {{ic|imap.pl}} in a location to be read by ''conky''. In this file, add (with the appropriate changes):<br />
#!/usr/bin/perl<br />
<br />
# gimap.pl by gxmsgx<br />
# description: get the count of unread messages on imap<br />
<br />
use strict;<br />
use Mail::IMAPClient;<br />
use IO::Socket::SSL;<br />
<br />
my $username = 'example.username'; <br />
my $password = 'password123'; <br />
<br />
my $socket = IO::Socket::SSL->new(<br />
PeerAddr => 'imap.server',<br />
PeerPort => 993<br />
)<br />
or die "socket(): $@";<br />
<br />
my $client = Mail::IMAPClient->new(<br />
Socket => $socket,<br />
User => $username,<br />
Password => $password,<br />
)<br />
or die "new(): $@";<br />
<br />
if ($client->IsAuthenticated()) {<br />
my $msgct;<br />
<br />
$client->select("INBOX");<br />
$msgct = $client->unseen_count||'0';<br />
print "$msgct\n";<br />
}<br />
<br />
$client->logout();<br />
<br />
Add to {{ic|conky.conf}}:<br />
${execpi 300 ~/.conky/imap.pl} <br />
or wherever you saved the file.<br />
<br />
If you use Gmail you might need to [http://www.google.com/accounts/IssuedAuthSubTokens?hide_authsub=1 generate] an application specific password.<br />
<br />
Alternatively, you can use stunnel as shown above: [[#Display number of new emails (Gmail)]]<br />
<br />
==== IMAP using PHP ====<br />
Another alternative using PHP. PHP needs to be installed and {{ic|1=extension=imap.so}} must be uncommented in {{ic|/etc/php/php.ini}}.<br />
<br />
Then create a file named {{ic|imap.php}} in a location to be read by ''conky''. Make the file executable:<br />
$ chmod +x imap.php<br />
<br />
In this file, add (with the appropriate changes):<br />
<br />
#!/usr/bin/php<br />
<?php<br />
// See http://php.net/manual/function.imap-open.php for more information about<br />
// the mailbox string in the first parameter of imap_open.<br />
// This example is ready to use with Office 365 Exchange Mails,<br />
// just replace your username (=email address) and the password.<br />
$mbox = imap_open("{outlook.office365.com:993/imap/ssl/novalidate-cert}", "username", "password");<br />
<br />
// Total number of emails<br />
$nrTotal = imap_num_msg($mbox);<br />
<br />
// Number of unseen emails. There are other ways using imap_status to count<br />
// unseen messages, but they don't work with Office 365 Exchange. This one does.<br />
$unseen = imap_search($mbox, 'UNSEEN');<br />
$nrUnseen = $unseen ? count($unseen) : 0;<br />
<br />
// Display the result, format as you like.<br />
echo $nrUnseen.'/'.$nrTotal;<br />
<br />
// Not needed, because the connection is closed after the script end.<br />
// For the sake of clean public available scripts, we are nice to<br />
// the imap server and close the connection manually.<br />
imap_close($mbox);<br />
<br />
Add to {{ic|conky.conf}}:<br />
<br />
${execpi 300 ~/.conky/imap.php} <br />
<br />
or wherever you saved the file.<br />
<br />
This script displays A/B where A is the number of unseen emails and B is the total number of mails in the mailbox. There are a lot of other informations available through a lot of PHP functions like with imap_Status (http://php.net/manual/function.imap-status.php). Just see the PHP docs about IMAP: http://php.net/manual/ref.imap.php.<br />
<br />
=== Show graphic of active network interface ===<br />
<br />
To test if a network inferface is currently active, you can use the test conky variable {{ic | if_existing}} on the {{ic | operstate}} of the interface. Here's an example for wlo1 :<br />
<br />
{{bc |draw_graph_borders yes <br />
${if_existing /sys/class/net/wlo1/operstate up}<br />
${color #0077ff}Net Down:$color ${downspeed wlo1} ${color #0077ff}Net Up:$color ${upspeed wlo1}<br />
${color #0077ff}${downspeedgraph wlo1 32,155 104E8B 0077ff} $alignr${color #0077ff}${upspeedgraph wlo1 32,155 104E8B 0077ff}<br />
${endif}<br />
}}<br />
<br />
This is the expected result :<br />
<br />
http://i.imgur.com/pQQbsP6.png<br />
<br />
=== Fix scrolling with UTF-8 multibyte characters ===<br />
<br />
The current version of ''conky'' (1.9.0) suffers from a [https://github.com/brndnmtthws/conky/issues/129 bug] where scrolling text increments by byte, not by character, resulting in text containing multibyte characters to disappear and reappear while scrolling. A package with a patch fixing this bug can be found in the AUR: {{AUR|conky-utfscroll}}<br />
<br />
== User-contributed configuration examples ==<br />
<br />
=== A sample rings script with nvidia support===<br />
<br />
See [https://gist.github.com/anonymous/85d052c0c23e58bc3666].<br />
<br />
== A note about symbolic fonts ==<br />
<br />
Many of the more decorated {{ic|conky.conf}}'s use the fonts PizzaDude Bullets and Pie Charts for Maps. They are available from the AUR as {{AUR|ttf-pizzadude-bullets}} and {{AUR|ttf-piechartsformaps}}{{Broken package link|{{aur-mirror|ttf-piechartsformaps}}}} respectively, or they can be found and downloaded with a quick search and manually installed using the instructions in [[Fonts]].<br />
<br />
== Fonts appear smaller than they should with Infinality ==<br />
<br />
If you notice that your ''conky'' fonts appear smaller than they should, or they do not align properly, it could be caused by a default setting in the infinality freetype2 patch. This setting can cause some programs to display fonts at 72 DPI instead of 96 even if the rest of your system is set to 96. If you notice a problem open {{ic|/etc/fonts/infinality/infinality.conf}} search for the section on DPI and change 72 to 96.<br />
<br />
== Universal method to enable true transparency ==<br />
<br />
Transparency is a strange beast in ''conky'', but there is a way to universally apply true transparency with any environment or window manager by using ''xcompmgr'' and ''transset-df''. [[Pacman#Installing specific packages|Install]] {{Pkg|xcompmgr}} and {{Pkg|transset-df}}.<br />
<br />
{{Note|This may conflict with any other compositing manager you are already using.}}<br />
<br />
Check ''xcompmgr'' documentation to help you decide which compositing options you would like to enable. The following is a common standard command.<br />
<br />
$ xcompmgr -c -t-5 -l-5 -r4.2 -o.55 &<br />
<br />
Make sure ''conky'' is running with {{ic|conky &}}. Use ''transset-df'' to enable transparency on the ''conky'' window. Set '.5' to any value in the range 0 - 1.<br />
<br />
$ transset-df .5 -n Conky<br />
<br />
This should give your ''conky'' window true transparency. If you get an error like:<br />
<br />
No Window matching Conky exists!<br />
<br />
verify that ''conky'' is running, and use ''xprop'' and click on the ''conky'' window to find the name you should pass to {{ic|transset-df}}.<br />
<br />
{{hc|$ xprop &#124; grep WM_NAME|2=WM_NAME(STRING) = "Conky (ArchitectLinux)"}}<br />
<br />
In this case, ''conky'' is right, but for you it may be different, so be sure to use your output instead. If {{ic|conky.conf}} has an option {{ic|own_window_type}} set to {{ic|panel}}, then this ''xprop'' invocation may show no output. Try using {{ic|dock}}, {{ic|normal}}, {{ic|override}} or {{ic|desktop}} instead.<br />
<br />
Use this in {{ic|~/.xinitrc}} to have transparent ''conky'' after [[X]] starts up:<br />
<br />
xcompmgr -c -t-5 -l-5 -r4.2 -o.55 &<br />
conky -d; sleep 1 && transset-df .5 -n Conky<br />
<br />
== See also ==<br />
<br />
* [https://github.com/brndnmtthws/conky Official website]<br />
* [http://conky.sourceforge.net/config_settings.html Official Conky variables for configuration]<br />
* [https://bbs.archlinux.org/viewtopic.php?id=39906 Conky Configs on arch forums]<br />
* [http://freshmeat.net/projects/conky/ Conky] on [[wikipedia:Freshmeat|Freshmeat]]<br />
* [irc://chat.freenode.org/conky #conky] IRC chat channel on [[wikipedia:Freenode|freenode]]<br />
* [http://novel.evilcoder.org/wiki/index.php?title=ConkyFAQ&oldid=12463 FAQ]</div>Mklein994https://wiki.archlinux.org/index.php?title=Android&diff=416722Android2016-01-22T21:08:31Z<p>Mklein994: /* Connect device */ typo: addittion -> addition</p>
<hr />
<div>[[Category:Development]]<br />
[[Category:Mobile devices]]<br />
[[it:Android]]<br />
[[ja:Android]]<br />
[[ru:Android]]<br />
[[zh-CN:Android]]<br />
{{Related articles start}}<br />
{{Related|Android notifier}}<br />
{{Related|Android tethering}}<br />
{{Related articles end}}<br />
<br />
== Exploring Android device ==<br />
<br />
There are few methods of exploring your device:<br />
<br />
*[[MTP]] over USB for files transferring.<br />
*[[#Alternative connection methods|Alternative methods]] (such as FTP, SSH).<br />
<br />
For more advanced usage, development, flashing and restore:<br />
*[[#Android Debug Bridge (ADB)|ADB]] mostly for development purposes.<br />
*[[#Restoring Android|Restoring Android]] for flashing and restoring Android firmwares (includes fastboot).<br />
<br />
== Android development ==<br />
<br />
There are 3 steps that need to be performed before you can develop Android applications on your Arch Linux box:<br />
<br />
# Install the Android SDK core component,<br />
# Install one or several Android SDK Platform packages,<br />
# Install one of the IDEs compatible with the Android SDK.<br />
<br />
=== Android SDK core components ===<br />
<br />
{{Note|First, if you are running a 64-bit system, make sure the [[multilib]] repository is enabled in [[Pacman#Repositories|pacman.conf]]. Otherwise errors of the type: "error: target not found: lib32-zlib" will plague your installation attempt.}}<br />
<br />
Before developing Android applications, you need to install the Android SDK, which is made of 3 distinct packages, all installable from [[AUR]]:<br />
<br />
# {{AUR|android-sdk}}<br />
# {{AUR|android-sdk-platform-tools}}<br />
# {{AUR|android-sdk-build-tools}}<br />
<br />
Android-sdk will be installed on {{ic|/opt/android-sdk}}. This folder has root permissions, so keep in mind to run sdk manager as root, otherwise you will not be able to modify anything in this directory. If you intend to use it as a regular user, create the Android sdk users group:<br />
# groupadd sdkusers<br />
<br />
Add your user into this group:<br />
# gpasswd -a <user> sdkusers<br />
<br />
Change folder's group.<br />
# chown -R :sdkusers /opt/android-sdk/<br />
<br />
Change permissions of the folder so the user that was just added to the group will be able to write in it:<br />
# chmod -R g+w /opt/android-sdk/<br />
<br />
Re-login or as <user> log your terminal in to the newly created group:<br />
<br />
$ newgrp sdkusers<br />
<br />
{{Note|As an alternative to a global install with the [[AUR]] packages, the SDK can be installed to a user's home directory via [https://developer.android.com/sdk/index.html the upstream instructions].}}<br />
<br />
=== Android SDK platform API ===<br />
<br />
Install the desired Android SDK Platform package from the [[AUR]]:<br />
<br />
* {{aur|android-platform}} (latest)<br />
* {{aur|android-platform-23}}<br />
* {{aur|android-platform-22}}<br />
* {{aur|android-platform-21}}<br />
* {{aur|android-platform-20}}<br />
* {{aur|android-platform-19}}{{Broken package link|{{aur-mirror|android-platform-19}}}}<br />
* {{aur|android-platform-18}}{{Broken package link|{{aur-mirror|android-platform-18}}}}<br />
* {{aur|android-platform-17}}{{Broken package link|{{aur-mirror|android-platform-17}}}}<br />
* {{aur|android-platform-16}}{{Broken package link|{{aur-mirror|android-platform-16}}}}<br />
* {{aur|android-platform-15}}{{Broken package link|{{aur-mirror|android-platform-15}}}}<br />
* {{aur|android-platform-14}}{{Broken package link|{{aur-mirror|android-platform-14}}}}<br />
* {{aur|android-platform-13}}{{Broken package link|{{aur-mirror|android-platform-13}}}}<br />
* {{aur|android-platform-12}}{{Broken package link|{{aur-mirror|android-platform-12}}}}<br />
* {{aur|android-platform-11}}{{Broken package link|{{aur-mirror|android-platform-11}}}}<br />
* {{aur|android-platform-10}}{{Broken package link|{{aur-mirror|android-platform-10}}}}<br />
* {{aur|android-platform-9}}{{Broken package link|{{aur-mirror|android-platform-9}}}}<br />
* {{aur|android-platform-8}}{{Broken package link|{{aur-mirror|android-platform-8}}}}<br />
* {{aur|android-platform-7}}{{Broken package link|{{aur-mirror|android-platform-7}}}}<br />
* {{aur|android-platform-6}}{{Broken package link|{{aur-mirror|android-platform-6}}}}<br />
* {{aur|android-platform-5}}{{Broken package link|{{aur-mirror|android-platform-5}}}}<br />
* {{aur|android-platform-4}}{{Broken package link|{{aur-mirror|android-platform-4}}}}<br />
* {{aur|android-platform-3}}{{Broken package link|{{aur-mirror|android-platform-3}}}}<br />
* {{aur|android-platform-2}}{{Broken package link|{{aur-mirror|android-platform-2}}}}<br />
<br />
=== Development environment ===<br />
<br />
Android Studio is the new official Android development environment based on IntelliJ IDEA. Alternatively, you can use [[Eclipse]] with the official but deprecated ADT plugin, or [[Netbeans]] with the NBAndroid plugin. All are described below.<br />
<br />
==== Android Studio ====<br />
<br />
[https://developer.android.com/sdk/index.html Android Studio] is the official Android development environment based on [https://www.jetbrains.com/idea/ IntelliJ Idea]. Android Studio replaces the older [https://developer.android.com/tools/help/adt.html Eclipse Android Developer Tools] and provides integrated Android developer tools for development and debugging.<br />
<br />
You can download and install it with the {{AUR|android-studio}} package from the [[AUR]]. If you get an error about a missing SDK, refer to the section Getting Android SDK platform API above.<br />
<br />
{{Note|1=If you are using a tiling window manager other than i3wm, you may need to apply one of the fixes mentioned in [https://code.google.com/p/android/issues/detail?id=57675 this] issue page.}}<br />
{{Note|1=Make sure you properly [[Java#Change_default_Java_environment|set the Java environment]] otherwise android-studio will not start.}}<br />
{{Note|1=Bad font rendering in Android Studio can be fixed by installing the [[Infinality#Installation_2|infinality-bundle]] and using infinality patched openJDK 7 ({{AUR|jdk7-openjdk-infinality}}) or openJDK 8 ({{AUR|jdk8-openjdk-infinality}}) from the AUR as mentioned in [https://youtrack.jetbrains.com/issue/IDEA-57233#comment=27-876236 this] issue page. Patched OpenJDK8 is also available from [[Unofficial user repositories#infinality-bundle|Infinality unofficial repository]]. }}<br />
<br />
Normally, apps are built through the Android Studio GUI. To build apps from the commandline (using e.g. {{ic|./gradlew assembleDebug}}), add the following to your {{ic|~/.bashrc}}:<br />
<br />
export ANDROID_HOME=/opt/android-sdk<br />
<br />
==== Eclipse ====<br />
<br />
{{Note|Since 2014-12-08, the ADT plugin is officially considered deprecated and Android Studio is now the official IDE.}}<br />
<br />
Most stuff required for Android development in Eclipse is already packaged in AUR:<br />
<br />
Official plugin by Google &ndash; [http://developer.android.com/sdk/eclipse-adt.html Eclipse ADT]:<br />
# {{AUR|eclipse-android}}<br />
<br />
Dependencies:<br />
# {{AUR|eclipse-emf}}<br />
# {{AUR|eclipse-gef}}<br />
# {{AUR|eclipse-wtp}}<br />
<br />
{{Note|<br />
* if you get a message about unresolvable dependencies, install [[Java]] manually and try again.<br />
* as an alternative, you can install the ADT via eclipse's built in "add new software" command (see instructions on ADT site).<br />
* if you are in real trouble, it is also possible to download Android SDK and use the bundled Eclipse. This usually works without problems.<br />
* if you need to install extra SDK plugins not found in the AUR, you must change the file ownership of /opt/android-sdk first. You can do this with {{ic|# chgrp -R users /opt/android-sdk ; chmod -R 0775 /opt/android-sdk}} (see [[File Permissions]] for more details).<br />
}}<br />
<br />
Enter the path to the Android SDK Location in<br />
<br />
Windows -> Preferences -> Android<br />
<br />
{{Note|<br />
If the plugins do not show up in Eclipse after the AUR package has been upgraded, then eclipse probably has out-of-date caches. Running {{ic|sudo eclipse -clean}} once should clear them. If the problem persists, uninstall eclipse and all the plugins, delete {{ic|/usr/share/eclipse}}, and reinstall everything.<br />
}}<br />
<br />
==== Netbeans ====<br />
<br />
If you prefer using [[Netbeans]] as your IDE and want to develop Android applications, download the [http://www.nbandroid.org NBAndroid] by going to:<br />
<br />
Tools -> Plugins -> Settings<br />
<br />
Add the following URL: http://nbandroid.org/release81/updates/updates.xml<br />
<br />
Then go to '''Available Plugins''' and install the '''Android''' and '''JUnit''' plugins. Once you have installed go to:<br />
<br />
Tools -> Options -> Miscellaneous -> Android<br />
<br />
and select the path where the SDK is installed (/opt/android-sdk by default). That is it, now you can create a new Android project and start developing using Netbeans.<br />
<br />
=== Android Debug Bridge (ADB) ===<br />
<br />
{{Tip|For some devices, you may have to enable MTP on the device, before ADB will work. Some other devices require enable PTP mode to work.}}<br />
==== Connect device ====<br />
To connect to a real device or phone via ADB under Arch, you must:<br />
<br />
# Install {{Pkg|android-tools}}. In addition, you might want to install {{Pkg|android-udev}} if you wish to connect the device to the proper {{ic|/dev/}} entries.<br />
# Enable USB Debugging on your phone or device:<br />
#* Jelly Bean (4.2) and newer: Go to {{ic|Settings --> About Phone}} tap “Build Number” until you get a popup that you have become a developer (7 times). Then go to {{ic|Settings --> Developer --> USB debugging}} and enable it.<br />
#* Older versions: This is usually done from {{ic|Settings --> Applications --> Development --> USB debugging}}. Reboot the phone after checking this option to make sure USB debugging is enabled.<br />
# Add yourself to the ''adbusers'' group:<br />
# gpasswd -a ''username'' adbusers<br />
<br />
If [[#Does it work?|ADB recognizes your device]] (it is visible and accessible in IDE), you are done. Otherwise see instructions below.<br />
<br />
==== Figure out device IDs ====<br />
<br />
Each Android device has a USB vendor/product ID. An example for HTC Evo is:<br />
<br />
vendor id: 0bb4<br />
product id: 0c8d<br />
<br />
Plug in your device and execute:<br />
<br />
$ lsusb<br />
<br />
It should come up something like this:<br />
<br />
Bus 002 Device 006: ID 0bb4:0c8d High Tech Computer Corp.<br />
<br />
==== Adding udev Rules ====<br />
<br />
Use the rules from [http://source.android.com/source/initializing.html#configuring-usb-access Android developer] or you can use the following template for your udev rules, just replace [VENDOR ID] and [PRODUCT ID] with yours. Copy these rules into {{ic|/etc/udev/rules.d/51-android.rules}}:<br />
<br />
{{hc|/etc/udev/rules.d/51-android.rules|2=<nowiki>SUBSYSTEM=="usb", ATTR{idVendor}=="[VENDOR ID]", MODE="0666", GROUP="adbusers"<br />
SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_adb"<br />
SUBSYSTEM=="usb",ATTR{idVendor}=="[VENDOR ID]",ATTR{idProduct}=="[PRODUCT ID]",SYMLINK+="android_fastboot"</nowiki>}}<br />
<br />
Then, to reload your new udev rules, execute:<br />
# udevadm control --reload-rules<br />
<br />
==== Configuring adb ====<br />
<br />
Instead of using udev rules, you may create/edit {{ic|~/.android/adb_usb.ini}} which contains a list of vendor IDs.<br />
<br />
$ cat ~/.android/adb_usb.ini <br />
0x27e8<br />
<br />
==== Detect the device ====<br />
<br />
After you have setup the udev rules, unplug your device and replug it.<br />
<br />
After running:<br />
<br />
$ adb devices<br />
<br />
you should see something like:<br />
<br />
List of devices attached <br />
HT07VHL00676 device<br />
<br />
==== General usage ====<br />
<br />
You can now use adb to transfer files between the device and your computer. To transfer files to the device, use<br />
$ adb push ''<what-to-copy>'' ''<where-to-place>''<br />
<br />
To transfer files from the device, use<br />
$ adb pull ''<what-to-pull>'' ''<where-to-place>''<br />
<br />
==== Notes & Troubleshooting ====<br />
<br />
* '''ADB''' can also be installed via [[#Android SDK platform API|platform tools]](usually available in {{Ic|/opt/android-sdk/platform-tools/}}), so it might not be necesarry to install {{Pkg|android-tools}} (available in {{Ic|/usr/bin/}}).<br />
<br />
* If you are getting an empty list (your device is not there), it may be because you have not enabled USB debugging on your device. You can do that by going to Settings => Applications => Development and enabling USB debugging. On Android 4.2 (Jelly Bean) the Development menu is hidden; to enable it go to Settings => About phone and tap Build number 7 times.<br />
<br />
* If there are still problems such as ''adb'' displaying {{ic|???????? no permissions}} under devices, try restarting the adb server as root.<br />
# adb kill-server<br />
# adb start-server<br />
<br />
=== NVIDIA Tegra platform ===<br />
<br />
If you target your application at NVIDIA Tegra platform, you might also want to install tools, samples and documentation provided by NVIDIA. In [http://developer.nvidia.com/category/zone/mobile-development NVIDIA Developer Zone for Mobile] there are two tools: <br />
<br />
# The [http://developer.nvidia.com/tegra-resources Tegra Android Development Pack] provides tools (NVIDIA Debug Manager) related to [http://developer.android.com/sdk/eclipse-adt.html Eclipse ADT] and their documentation. <br />
# The [http://developer.nvidia.com/tegra-resources Tegra Toolkit] provides tools (mostly CPU and GPU optimization related), samples and documentation. <br />
<br />
Both are currently not available in the [[AUR]] anymore, because NVIDIA requires a registration/login for the download.<br />
<br />
== Building Android ==<br />
<br />
Please note that these instructions are based on the [http://source.android.com/source/building.html official AOSP build instructions]. Other Android-derived systems such as CyanogenMod will often require extra steps.<br />
<br />
=== OS bitness ===<br />
<br />
Android 2.2.x (Froyo) and below are the only versions of Android that will build on a 32-bit system. For 2.3.x (Gingerbread) and above, you will need a 64-bit installation. <br />
<br />
=== Required packages ===<br />
<br />
To build any version of Android, you need to install these packages:<br />
<br />
* 32-bit and 64-bit systems: {{Pkg|gcc}} {{Pkg|git}} {{Pkg|gnupg}} {{Pkg|flex}} {{Pkg|bison}} {{Pkg|gperf}} {{Pkg|sdl}} {{Pkg|wxgtk}} {{Pkg|squashfs-tools}} {{Pkg|curl}} {{Pkg|ncurses}} {{Pkg|zlib}} {{Pkg|schedtool}} {{Pkg|perl-switch}} {{Pkg|zip}} {{Pkg|unzip}} {{Pkg|libxslt}} {{Pkg|python2-virtualenv}} {{Pkg|bc}}<br />
<br />
* 64-bit systems only: {{Pkg|gcc-multilib}} {{Pkg|lib32-zlib}} {{Pkg|lib32-ncurses}} {{Pkg|lib32-readline}}<br />
<br />
* AUR Packages: {{Aur|libtinfo}} {{Aur|ncurses5-compat-libs}}<br />
<br />
To build Android 6+, you need to install these additional packages:<br />
<br />
* 32-bit and 64-bit systems: {{Pkg|rsync}}<br />
<br />
{{Note|1=You must now also install {{Aur|lib32-ncurses5-compat-libs}} & {{Aur|ncurses5-compat-libs}} since ncurses was updated to ncurses6 and android's prebuilt clang still depends on ncurses5. You can check what libs are still needed:<br />
<br />
{{bc|ldd prebuilts/clang/linux-x86/host/3.6/bin/clang}}<br />
}}<br />
<br />
=== Java Development Kit ===<br />
<br />
Android 5 (Lollipop) can be built with {{Pkg|jdk7-openjdk}}.<br />
<br />
Older versions [http://source.android.com/source/initializing.html require] a working '''Oracle JDK''' installed on your build system. It '''will not''' work with OpenJDK.<br />
*For Gingerbread through KitKat (2.3 - 4.4), Java 6 is required, which is available as {{AUR|jdk6}} from the AUR. See [[Java]] if you want to use it besides another (newer) JDK version.<br />
*For Cupcake through Froyo (1.5 - 2.2), Java 5 is required, which is no longer available for Arch Linux.<br />
<br />
=== Setting up the build environment ===<br />
<br />
Download the {{ic|repo}} utility per [https://source.android.com/source/downloading.html Android Downloading the Source guide].<br />
<br />
$ mkdir ~/bin<br />
$ export PATH=~/bin:$PATH<br />
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo<br />
$ chmod a+x ~/bin/repo<br />
<br />
Create a directory to build.<br />
<br />
$ mkdir ~/android<br />
$ cd ~/android<br />
<br />
You will need to change the default Python from version 3 to version 2:<br />
<br />
$ virtualenv2 venv # Creates a directory, venv/, containing the Virtualenv<br />
<br />
{{Note|During build you may receive error pertaining to missing python modules. A quick and dirty fix is to symlink /usr/lib/python2.7/* to ~/android/venv/python2.7/ (Change ~/android to reflect your build directory if different than above).<br />
Example:<br />
$ ln -s /usr/lib/python2.7/* /Data/Android_Build/venv/lib/python2.7/<br />
}}<br />
Activate the Virtualenv, which will update $PATH to point at Python 2.<br />
<br />
{{Note|this activation is only active for the current terminal session.<br />
}}<br />
<br />
$ source venv/bin/activate<br />
<br />
=== Downloading the source code ===<br />
<br />
This will clone the repositories. You '''only''' need to do this the first time you build Android, or if you want to switch branches.<br />
<br />
* The {{ic|repo}} has a {{ic|-j}} switch that operates similarly to the one used with {{ic|make}}. Since it controls the number of simultaneous downloads, you should adjust the value depending on downstream network bandwidth.<br />
<br />
* You will need to specify a '''branch''' (release of Android) to check out with the {{ic|-b}} switch. If you leave the switch out, you will get the so-called '''master branch'''.<br />
<br />
$ repo init -u https://android.googlesource.com/platform/manifest -b master<br />
$ repo sync -j4<br />
<br />
{{Note|To further decrease sync times, you can utilize the -c switch with the repo command as such:<br />
$ repo sync -j8 -c<br />
The {{ic|-c}} switch will only sync the branch which is specified in the manifest, which in turn is determined by the branch specified with the {{ic|-b}} switch, or the default branch set by the repository maintainer.<br />
}}<br />
<br />
Wait a long time. Just the uncompiled source code, along with the {{ic|.repo}} and {{ic|.git}} directories that are used to keep track of it, are well over 10 GB.<br />
<br />
{{Note|If you want to update your local copy of the Android source, at a later time, simply enter the build directory, load the Virtualenv, and re-sync:<br />
$ repo sync<br />
}}<br />
<br />
=== Building the code ===<br />
<br />
This should do what you need for AOSP:<br />
<br />
$ source build/envsetup.sh<br />
$ lunch full-eng<br />
$ make -j4<br />
<br />
If you run '''lunch''' without arguments, it will ask what build you want to create. Use -j with a number between one and two times number of cores/threads.<br />
<br />
The build takes a very long time.<br />
<br />
{{Note|If {{ic|make}} fails with something like<br />
<br />
flex-2.5.39: loadlocale.c:131: _nl_intern_locale_data: Assertion `cnt < (sizeof (_nl_value_type_LC_COLLATE) / sizeof (_nl_value_type_LC_COLLATE[0]))' failed.<br />
<br />
try running {{ic|1=LANG=C make}} instead.<br />
<br />
}}<br />
<br />
{{Note|Make sure you have enough RAM.<br />
Android will use the /tmp directory heavily. By default the size of the partition the /tmp folder is mounted on is half the size of your RAM. If it fills up, the build will fail. 4GB of RAM or more is recommended.<br />
* Alternatively, you can get rid of the tmpfs from [[fstab]] all together. <br />
}}<br />
<br />
{{Note|From the [https://source.android.com/source/building-running.html#build-the-code Android Building and Running guide]:<br />
<br />
"GNU make can handle parallel tasks with a -jN argument, and it's common to use a number of tasks N that's between 1 and 2 times the number of hardware threads on the computer being used for the build. E.g. on a dual-E5520 machine (2 CPUs, 4 cores per CPU, 2 threads per core), the fastest builds are made with commands between make -j16 and make -j32."<br />
<br />
}}<br />
=== Testing the build ===<br />
<br />
When finished, run/test the final image(s).<br />
<br />
$ emulator<br />
<br />
=== Creating a Flashable Image ===<br />
To create an image that can be flashed it is necessary to:<br />
<br />
make -j8 updatepackage<br />
<br />
This will create a zip image under '''out/target/product/hammerhead''' (hammerhead being the device name) that can be flashed.<br />
<br />
== Restoring Android ==<br />
<br />
{{Expansion}}<br />
<br />
In some cases, you want to return to the stock Android after flashing custom ROMs to your Android mobile device. For flashing instructions of your device, please use [http://forum.xda-developers.com/ XDA forums].<br />
<br />
=== Fastboot ===<br />
<br />
Fastboot (as well as [[#Connecting_to_a_real_device_-_Android_Debug_Bridge_.28ADB.29|ADB]]) comes together with a package {{Pkg|android-tools}} from the [[official repositories]].<br />
<br />
{{Note|Restoring firmwares using {{ic|fastboot}} can be quite tricky, but you might want to browse [http://www.xda-developers.com/ XDA developers forums] for a stock firmware, which is mostly a {{ic|*.zip}} file, but inside of it, comes with the firmware files and {{ic|flash-all.sh}} script. For example, [https://developers.google.com/android/nexus/images Google Nexus] firmwares include {{ic|flash-all.sh}} script or another example could be for OnePlus One - [http://forum.xda-developers.com/oneplus-one/general/guide-return-opo-to-100-stock-t2826541 XDA thread], where you can find firmwares with included {{ic|flash-all.sh}} script.}}<br />
<br />
=== Samsung ===<br />
<br />
Samsung does not support fastboot in any way. Using Odin is safer, easier and more popular than Heimdall, but it is up to you.<br />
<br />
==== Heimdall ====<br />
<br />
[http://glassechidna.com.au/heimdall/ Heimdall] is a cross-platform open-source tool suite used to flash firmware (also known as ROMs) onto Samsung mobile devices and is also known as an alternative to [http://odindownload.com/ Odin]. It can be installed as {{Pkg|heimdall}} or {{AUR|heimdall-git}}.<br />
<br />
The flashing instructions can be found on Heimdall's [https://github.com/Benjamin-Dobell/Heimdall/tree/master/Linux GitHub page] or on [http://forum.xda-developers.com/showthread.php?t=1922461 XDA forums].<br />
<br />
==== Odin (Virtualbox) ====<br />
<br />
It is also possible to restore stock Android on the Samsung devices using [http://odindownload.com/ Odin], but inside the [[VirtualBox]]. For more information, see [http://forum.xda-developers.com/showthread.php?t=758634 XDA thread].<br />
<br />
Arch Linux related steps:<br />
# Install [[VirtualBox]] together with its [[VirtualBox#Extension_pack|extension pack]]. Optionally, install [[VirtualBox#Guest_additions_disc|guest additions]].<br />
# Install your preferred, but compatible with Odin, Windows operating system into a virtual hard drive using VirtualBox. Optionally, install guest additions to the Windows operating system.<br />
# Open VirtualBox settings of your Windows operating system, navigate to '''USB''', then tick (or make sure it is ticked) '''Enable USB 2.0 (EHCI) Controller'''.<br />
# At VirtualBox running Windows operating system, click in the menu bar '''Devices''', then '''USB Devices''', then click on your Samsung mobile device connected to your computer via USB.<br />
<br />
Windows related links:<br />
# Samsung drivers can be downloaded from [http://androidxda.com/download-samsung-usb-drivers here].<br />
# Odin can be downloaded from [https://www.androidfilehost.com/?fid=23501681358557126 here].<br />
# Samsung Android firmwares can be downloaded from [http://www.sammobile.com/firmwares/ here].<br />
<br />
If you want to make sure that everything is working and ready, connect your Samsung device turned on into a Download mode, and open Odin. The white box (a big one at the bottom-left) named '''Message''', should print a line similar to this:<br />
<ID:0/003> Added!!<br />
which means that your device is visible to Odin and is ready to be flashed.<br />
<br />
{{Note|There are no general instructions of restoring stock firmware on Samsung mobile devices. You have to use [https://www.google.com Google] and [http://www.xda-developers.com XDA developers forums] to find a flashing instructions for specific device. For example, this is how the [http://goo.gl/cZLyF8 thread] about the Samsung Galaxy S4 looks like}}<br />
<br />
== Alternative connection methods ==<br />
<br />
=== adb-sync ===<br />
<br />
[https://github.com/google/adb-sync adb-sync] (available in {{AUR|adb-sync-git}}) is a tool to synchronize files between a PC and an Android device using the ADB<br />
<br />
=== AirDroid ===<br />
<br />
[http://goo.gl/EZQ9GQ AirDroid] is an Android app to access files from your web browser.<br />
<br />
=== FTP ===<br />
<br />
You run a FTP server on Arch and connect to it from your phone, or the other way around: run a FTP server on your phone and connect to it from Arch.<br />
<br />
See [[List of applications/Internet#FTP]]. There are a lot of FTP clients/servers available for Android.<br />
<br />
=== SSH Server ===<br />
<br />
There are many SSH servers available for Android, it allows you to transfer files using {{ic|scp}} command. See also [[SSH]].<br />
<br />
=== Samba ===<br />
<br />
See [[Samba]].<br />
<br />
== Tips & Tricks ==<br />
<br />
=== During Debugging "Source not found" ===<br />
<br />
Most probably the debugger wants to step into the Java code. As the source code of Android does not come with the Android SDK, this leads to an error. The best solution is to use step filters to not jump into the Java source code. Step filters are not activated by default. To activate them: <br />
Window -> Preferences -> Java -> Debug -> Step Filtering<br />
Consider to select them all. If appropriate you can add the android.* package. See the forum post for more information: http://www.eclipsezone.com/eclipse/forums/t83338.rhtml<br />
<br />
=== Linux distribution on the sdcard ===<br />
<br />
You can install Debian like in this [http://forum.xda-developers.com/showthread.php?t=631389 thread]. Excellent guide to installing Arch in chroot (in parallel with Android) can be found on [http://archlinuxarm.org/forum/viewtopic.php?f=27&t=1361&start=40 archlinuxarm.org forum].<br />
<br />
== Troubleshooting ==<br />
<br />
=== Android Studio: Android Virtual Devices show 'failed to load'. ===<br />
Make sure you've exported the variable {{ic|ANDROID_HOME}} as explained in [[Android Studio]].<br />
<br />
=== aapt: No such file or directory ===<br />
<br />
The build tools include 32-bit binaries. For this reason they require 32-bit libraries. If you happened to install the SDK manually, you will additionally need to install<br />
'''multilib/lib32-libstdc++5''' and '''multilib/lib32-zlib'''.<br />
<br />
=== ValueError: unsupported pickle protocol ===<br />
<br />
One fix is to issue:<br />
<br />
rm ~/.repopickle_.gitconfig<br />
<br />
If that does not work, then try this:<br />
<br />
rm `find /path/to/android-root -name .repopickle_config`</div>Mklein994