https://wiki.archlinux.org/api.php?action=feedcontributions&user=GaugeDerivative&feedformat=atomArchWiki - User contributions [en]2024-03-29T05:11:27ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Isync&diff=694819Isync2021-09-07T07:44:31Z<p>GaugeDerivative: Without "Expunge Both" the near and far mailboxes don't really stay in sync</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Mail retrieval agents]]<br />
[[ja:Isync]]<br />
[http://isync.sourceforge.net/ isync] is a command line application to synchronize mailboxes; it supports Maildir and IMAP4 mailboxes. New messages, message deletions and flag changes can be propagated both ways.<br />
<br />
Synchronization is based on unique message identifiers (UIDs), so no identification conflicts can occur (as opposed to some other mail synchronizers).<br />
Synchronization state is kept in one local text file per mailbox pair; multiple replicas of a mailbox can be maintained.<br />
{{note|isync is the name of the project, mbsync is the name of the executable}}<br />
<br />
== Installing ==<br />
<br />
[[Install]] the {{Pkg|isync}} package.<br />
<br />
== Configuring ==<br />
<br />
{{Note| Google appears to block isync from downloading emails by default. If you have 2-step authentication enabled, you need to [https://myaccount.google.com/apppasswords set up an app password] and use that with isync, otherwise you need to go to [https://myaccount.google.com/security Google's Security Page] and toggle "Allow less secure apps" to "on".}}<br />
<br />
{{Note|'''Subfolders''' setting in MaildirStore now seems to be required to be set: [http://isync.sourceforge.net/mbsync.html iSync Config SubFolders] '''SubFolders Legacy''' worked as previous unset - Oct 2017}}<br />
<br />
First create and customize the main configuration file using this example {{ic|~/.mbsyncrc}}:<br />
{{hc|~/.mbsyncrc|2=<br />
<nowiki><br />
IMAPAccount gmail<br />
# Address to connect to<br />
Host imap.gmail.com<br />
User username@gmail.com<br />
Pass ***************<br />
# To store the password in an encrypted file use PassCmd instead of Pass<br />
# PassCmd "gpg2 -q --for-your-eyes-only --no-tty -d ~/.mailpass.gpg"<br />
#<br />
# Use SSL<br />
SSLType IMAPS<br />
# The following line should work. If you get certificate errors, uncomment the two following lines and read the "Troubleshooting" section.<br />
CertificateFile /etc/ssl/certs/ca-certificates.crt<br />
#CertificateFile ~/.cert/imap.gmail.com.pem<br />
#CertificateFile ~/.cert/Equifax_Secure_CA.pem<br />
<br />
IMAPStore gmail-remote<br />
Account gmail<br />
<br />
MaildirStore gmail-local<br />
SubFolders Verbatim<br />
# The trailing "/" is important<br />
Path ~/.mail/gmail/<br />
Inbox ~/.mail/gmail/Inbox<br />
<br />
Channel gmail<br />
Far :gmail-remote:<br />
Near :gmail-local:<br />
# Exclude everything under the internal [Gmail] folder, except the interesting folders<br />
Patterns * ![Gmail]* "[Gmail]/Sent Mail" "[Gmail]/Starred" "[Gmail]/All Mail"<br />
# Or include everything<br />
#Patterns *<br />
# Automatically create missing mailboxes, both locally and on the server<br />
Create Both<br />
# Sync the movement of messages between folders and deletions, add after making sure the sync works<br />
Expunge Both<br />
# Save the synchronization state files in the relevant directory<br />
SyncState *<br />
</nowiki><br />
}}<br />
<br />
To get rid of the [Gmail]-Stuff (or [Google Mail] as in my case) in each mailbox name, it's possible to use separate Channels for each directory, and later merge them to a group:<br />
{{hc|~/.mbsyncrc|2=<br />
<nowiki><br />
Channel sync-googlemail-default<br />
Far :gmail-remote:<br />
Near :gmail-local:<br />
# Select some mailboxes to sync<br />
Patterns "INBOX" "arch"<br />
<br />
Channel sync-googlemail-sent<br />
Far :gmail-remote:"[Google Mail]/Gesendet"<br />
Near :gmail-local:sent<br />
Create Near<br />
<br />
Channel sync-googlemail-trash<br />
Far :gmail-remote:"[Google Mail]/Papierkorb"<br />
Near :gmail-local:trash<br />
Create Near<br />
<br />
# Get all the channels together into a group.<br />
Group googlemail<br />
Channel sync-googlemail-default<br />
Channel sync-googlemail-sent<br />
Channel sync-googlemail-trash<br />
</nowiki><br />
}}<br />
As you can see, name-translations are possible this way, as well.<br />
<br />
== Usage ==<br />
<br />
First make any folders that were specified as Maildirs.<br />
$ mkdir -p ~/.mail/gmail<br />
Then to retrieve the mail for a specific channel run:<br />
$ mbsync gmail<br />
or to retrive the mail for all channels:<br />
$ mbsync -a<br />
<br />
== Tips and tricks ==<br />
<br />
=== Using Path and/or Inbox on NTFS partitions ===<br />
<br />
Since ntfs partitions will not accept ; in a filename, you need to change your InfoDelimiter and your FieldDelimiter to something else, you can achieve this by globaly (outside any store or channel configuration) changing the later, like below:<br />
<br />
{{hc|~/.mbsyncrc|2=<br />
FieldDelimiter -<br />
}}<br />
<br />
=== Calling mbsync automatically ===<br />
<br />
==== With a timer ====<br />
<br />
If you want to automatically synchronize your mailboxes, isync can be started automatically with a [[systemd/User]] unit. The following service file can start the {{ic|mbsync}} command:<br />
<br />
{{hc|~/.config/systemd/user/mbsync.service|2=<br />
[Unit]<br />
Description=Mailbox synchronization service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/bin/mbsync -Va<br />
}}<br />
<br />
The following timer configures {{ic|mbsync}} to be started 2 minutes after boot, and then every 5 minutes:<br />
<br />
{{hc|~/.config/systemd/user/mbsync.timer|2=<br />
[Unit]<br />
Description=Mailbox synchronization timer<br />
<br />
[Timer]<br />
OnBootSec=2m<br />
OnUnitActiveSec=5m<br />
Unit=mbsync.service<br />
<br />
[Install]<br />
WantedBy=timers.target<br />
}}<br />
<br />
Once those two files are created, [[reload]] systemd, then [[enable]] and [[start]] {{ic|mbsync.timer}}, adding the {{ic|--user}} flag to {{ic|systemctl}}.<br />
<br />
{{Tip|The mbsync service now only runs after login. It's also possible to launch the systemd-user instances after boot if you configure [[Systemd/User#Automatic start-up of systemd user instances]].<br />
}}<br />
<br />
===== Integration with notmuch or mu4e =====<br />
<br />
If you want to run [[notmuch]] or mu/mu4e after automatically synchronizing your mails, it is preferable to modify the above {{ic|mbsync.service}} by adding a post-start hook, like below:<br />
<br />
{{hc|~/.config/systemd/user/mbsync.service|2=<br />
[Unit]<br />
Description=Mailbox synchronization service<br />
<br />
[Service]<br />
Type=oneshot<br />
ExecStart=/usr/bin/mbsync -Va<br />
ExecStartPost=/usr/bin/notmuch new<br />
}}<br />
<br />
You can also index {{ic|mu}} by changing the {{ic|ExecStartPost}} line to {{ic|1=ExecStartPost=/usr/bin/mu index}}, or to {{ic|1=ExecStartPost=/usr/bin/emacsclient -e '(mu4e-update-index)'}} if you are running emacsclient and would like to index {{ic|mu4e}}.<br />
<br />
This modification assumes that you have already setup notmuch or mu/mu4e for your user. If the ExecStart command does not execute successfully, the ExecStartPost command will not execute, so be aware of this!<br />
<br />
==== With imapnotify ====<br />
<br />
[[Wikipedia:IMAP IDLE|IMAP IDLE]] is a way to get [[Wikipedia:Push Technology|push notifications]] to download new email, rather than polling the server intermittently. This has the advantage of saving bandwidth and delivering your mail as soon as it's available. Isync does not have native IDLE suport, but we can use a program like [https://www.npmjs.com/package/imapnotify imapnotify] to call mbsync when you receive new email. For this example we will use the {{Pkg|goimapnotify}} package which is reported to work better with frequent network interruptions. <br />
<br />
Install {{Pkg|goimapnotify}} and create a config file for each mail server you want to poll. Note that the file name format, including the ".conf", is necessary if you want to use the provided systemd service:<br />
{{hc|~/.config/imapnotify/gmail.conf|<br />
<nowiki><br />
{<br />
"host": "imap.gmail.com",<br />
"port": 993,<br />
"tls": true,<br />
"tlsOptions": {<br />
"rejectUnauthorized": false<br />
},<br />
"username": "username@gmail.com",<br />
"password": "",<br />
"passwordCmd": "pass gmail | head -n1",<br />
"onNewMail": "mbsync gmail",<br />
"onNewMailPost": "",<br />
"boxes": [ "INBOX" ]<br />
}<br />
</nowiki>}}<br />
(You can view the full configuration options in the project's [https://gitlab.com/shackra/goimapnotify README].)<br />
<br />
Start and enable the service with {{ic|$ systemctl --user enable --now goimapnotify@gmail.service}}.<br />
<br />
Note that IMAP IDLE only triggers when new mail arrives, not when there is undownloaded mail on the server. For example, if you receive 100 emails with your computer powered off, then turn on your computer, imapnotify will still not download new mail until you receive another email. For this reason you may want to run mbsync [[Autostarting|once when you log in]].<br />
<br />
=== Using XOAUTH2 ===<br />
<br />
Install an XOAUTH2 SASL plugin, like {{AUR|cyrus-sasl-xoauth2-git}}.<br />
<br />
Then install {{AUR|oauth2token}} and follow its [https://pypi.org/project/oauth2token/ README] to configure the account. It will be responsible for getting the current XOAUTH2 token using the account credentials every time mbsync needs to authenticate.<br />
<br />
Finally add {{ic|AuthMechs XOAUTH2}} and {{ic|PassCmd "oauth2get <provider> <account>"}}, substituting {{ic|<provider>}} and {{ic|<account>}} with the values you used for {{ic|oauth2create}}, to the {{ic|IMAPAccount}} section in the {{ic|.mbsyncrc}}.<br />
<br />
== Troubleshooting ==<br />
<br />
=== SSL error ===<br />
<br />
If you get the following error:<br />
{{bc|<br />
<nowiki><br />
SSL error connecting imap.gmail.com (108.177.125.109:993): self signed certificate<br />
</nowiki><br />
}}<br />
<br />
Since google enforce SNI when you use TLS 1.3, ensure to run at least isync v1.3.0<br />
See https://sourceforge.net/p/isync/isync/merge-requests/2/ for more details<br />
<br />
If you get certificate related errors like<br />
{{bc|<br />
<nowiki><br />
SSL error connecting pop.mail.com (193.222.111.111:143): error:00000012:lib(0):func(0):reason(18) <br />
</nowiki><br />
}}<br />
<br />
you may need to retrieve the server's certificates manually in order for mbsync to correctly verify it.<br />
<br />
==== Step #1: Get the certificates ====<br />
<br />
{{Accuracy|This may not always be needed, e.g. for gmail {{ic|CertificateFile /etc/ssl/certs/ca-certificates.crt}} in the config file may be suffcient|section=Step #1: Get the certificates}}<br />
<br />
{{bc|<br />
<nowiki><br />
$ mkdir ~/.cert<br />
$ openssl s_client -connect some.imap.server:port -showcerts 2>&1 < /dev/null | sed -ne '/-BEGIN CERTIFICATE-/,/-END CERTIFICATE-/p' | sed -ne '1,/-END CERTIFICATE-/p' > ~/.cert/some.imap.server.pem<br />
</nowiki><br />
}}<br />
<br />
This will create a certificate file called {{ic|~/.cert/some.imap.server.pem}} (e.g. {{ic|~/.cert/imap.gmail.com.pem}}). Alternatively one can download [https://gist.githubusercontent.com/petRUShka/af96ae25ce8280729b9ea049b929f31d/raw/a79471ce8aee3f6d04049039adf870a53a524f7f/get_certs.sh get_certs.sh] and run it:<br />
<br />
{{bc|<br />
<nowiki><br />
$ mkdir ~/.cert<br />
$ wget https://gist.githubusercontent.com/petRUShka/af96ae25ce8280729b9ea049b929f31d/raw/a79471ce8aee3f6d04049039adf870a53a524f7f/get_certs.sh<br />
$ sh get_certs.sh some.imap.server port ~/.cert/<br />
</nowiki><br />
}}<br />
<br />
If you wish to do this manually, you may enter:<br />
<br />
{{bc|<br />
<nowiki><br />
$ openssl s_client -connect some.imap.server:port -showcerts<br />
</nowiki><br />
}}<br />
<br />
and it will display output something like:<br />
<br />
{{bc|<br />
<nowiki><br />
CONNECTED(00000003)<br />
depth=1 C = US, O = Google Inc, CN = Google Internet Authority<br />
verify error:num=20:unable to get local issuer certificate<br />
verify return:0<br />
---<br />
Certificate chain<br />
0 s:/C=US/ST=California/L=Mountain View/O=Google Inc/CN=imap.gmail.com<br />
i:/C=US/O=Google Inc/CN=Google Internet Authority<br />
-----BEGIN CERTIFICATE-----<br />
MIIDgDCCAumgAwIBAgIKO3MmiwAAAABopTANBgkqhkiG9w0BAQUFADBGMQswCQYD<br />
VQQGEwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzEiMCAGA1UEAxMZR29vZ2xlIElu<br />
dGVybmV0IEF1dGhvcml0eTAeFw0xMjA5MTIxMTU1NDlaFw0xMzA2MDcxOTQzMjda<br />
MGgxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1N<br />
b3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMRcwFQYDVQQDEw5pbWFw<br />
LmdtYWlsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA2OmU9DjI+DFQ<br />
ThqIN4vL6EqZbzH0ejLKcc+zhxsq9BU5hXohSJ1sS5FUU2vReDKk8fd+ZR3cWtpf<br />
CTYAUSvdnz1ZFjESSzyUBmGRqByhoc0yqdfb61NosA4CDaO+z7DtAgKyecqnAJad<br />
TPYYf9aLk/UgJuc6GseitjzFYonXi6ECAwEAAaOCAVEwggFNMB0GA1UdJQQWMBQG<br />
CCsGAQUFBwMBBggrBgEFBQcDAjAdBgNVHQ4EFgQUFuLyTg2NcsyaEESytZbLbQan<br />
YIowHwYDVR0jBBgwFoAUv8Aw6/VDET5nup6R+/xq2uNrEiQwWwYDVR0fBFQwUjBQ<br />
oE6gTIZKaHR0cDovL3d3dy5nc3RhdGljLmNvbS9Hb29nbGVJbnRlcm5ldEF1dGhv<br />
cml0eS9Hb29nbGVJbnRlcm5ldEF1dGhvcml0eS5jcmwwZgYIKwYBBQUHAQEEWjBY<br />
MFYGCCsGAQUFBzAChkpodHRwOi8vd3d3LmdzdGF0aWMuY29tL0dvb2dsZUludGVy<br />
bmV0QXV0aG9yaXR5L0dvb2dsZUludGVybmV0QXV0aG9yaXR5LmNydDAMBgNVHRMB<br />
Af8EAjAAMBkGA1UdEQQSMBCCDmltYXAuZ21haWwuY29tMA0GCSqGSIb3DQEBBQUA<br />
A4GBAC1LV7tM6pcyVJLcwdPml4DomtowsjTrqvy5ZFa3SMKANK0iZBgFu74O0THX<br />
8SxP/vn4eAs0yRQxcT1ZuoishLGQl5NoimLaQ4BGQnzFQHDJendfaVKDl21GenJp<br />
is72sIrAeprsVU8PbNsllUamWsIjKr3DH5xQdH54hDtzQojY<br />
-----END CERTIFICATE-----<br />
1 s:/C=US/O=Google Inc/CN=Google Internet Authority<br />
i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority<br />
-----BEGIN CERTIFICATE-----<br />
MIICsDCCAhmgAwIBAgIDC2dxMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT<br />
MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0<br />
aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDkwNjA4MjA0MzI3WhcNMTMwNjA3MTk0MzI3<br />
WjBGMQswCQYDVQQGEwJVUzETMBEGA1UEChMKR29vZ2xlIEluYzEiMCAGA1UEAxMZ<br />
R29vZ2xlIEludGVybmV0IEF1dGhvcml0eTCBnzANBgkqhkiG9w0BAQEFAAOBjQAw<br />
gYkCgYEAye23pIucV+eEPkB9hPSP0XFjU5nneXQUr0SZMyCSjXvlKAy6rWxJfoNf<br />
NFlOCnowzdDXxFdF7dWq1nMmzq0yE7jXDx07393cCDaob1FEm8rWIFJztyaHNWrb<br />
qeXUWaUr/GcZOfqTGBhs3t0lig4zFEfC7wFQeeT9adGnwKziV28CAwEAAaOBozCB<br />
oDAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFL/AMOv1QxE+Z7qekfv8atrjaxIk<br />
MB8GA1UdIwQYMBaAFEjmaPkr0rKV10fYIyAQTzOYkJ/UMBIGA1UdEwEB/wQIMAYB<br />
Af8CAQAwOgYDVR0fBDMwMTAvoC2gK4YpaHR0cDovL2NybC5nZW90cnVzdC5jb20v<br />
Y3Jscy9zZWN1cmVjYS5jcmwwDQYJKoZIhvcNAQEFBQADgYEAuIojxkiWsRF8YHde<br />
BZqrocb6ghwYB8TrgbCoZutJqOkM0ymt9e8kTP3kS8p/XmOrmSfLnzYhLLkQYGfN<br />
0rTw8Ktx5YtaiScRhKqOv5nwnQkhClIZmloJ0pC3+gz4fniisIWvXEyZ2VxVKfml<br />
UUIuOss4jHg7y/j7lYe8vJD5UDI=<br />
-----END CERTIFICATE-----<br />
---<br />
Server certificate<br />
subject=/C=US/ST=California/L=Mountain View/O=Google Inc/CN=imap.gmail.com<br />
issuer=/C=US/O=Google Inc/CN=Google Internet Authority<br />
---<br />
No client certificate CA names sent<br />
---<br />
SSL handshake has read 2108 bytes and written 350 bytes<br />
---<br />
New, TLSv1/SSLv3, Cipher is ECDHE-RSA-RC4-SHA<br />
Server public key is 1024 bit<br />
Secure Renegotiation IS supported<br />
Compression: NONE<br />
Expansion: NONE<br />
SSL-Session:<br />
Protocol : TLSv1.1<br />
Cipher : ECDHE-RSA-RC4-SHA<br />
Session-ID: 77136647F42633D82DEDFBB9EB62AB516547A3697D83BD1884726034613C1C09<br />
Session-ID-ctx: <br />
Master-Key: 635957FBA0762B10694560488905F73BDD2DB674C41970542ED079446F27234E2CA51CF26938B8CA56DF5BBC71E429A7<br />
Key-Arg : None<br />
PSK identity: None<br />
PSK identity hint: None<br />
SRP username: None<br />
TLS session ticket lifetime hint: 100800 (seconds)<br />
TLS session ticket:<br />
0000 - d6 5b a0 a7 10 0e 64 04-72 93 7c 9f 94 fa 07 57 .[....d.r.|....W<br />
0010 - f1 8b 9d 24 8b 9d 1b f3-a8 b1 4d 2c a9 00 e1 82 ...$......M,....<br />
0020 - 00 83 1e 3f e5 f2 b2 2c-d2 a8 87 83 16 02 0d 1e ...?...,........<br />
0030 - bf b6 c1 d6 75 21 04 e6-63 6b ab 5b ed 94 7a 30 ....u!..ck.[..z0<br />
0040 - 1a d0 aa 44 c2 04 9b 10-06 28 b5 7b a0 43 a6 0d ...D.....(.{.C..<br />
0050 - 3b 4a 85 1f 2e 07 0a e1-32 9b bd 5d 65 41 4c e2 ;J......2..]eAL.<br />
0060 - 7c d7 43 ec c4 18 77 53-b5 d4 84 b4 c9 bd 51 d6 |.C...wS......Q.<br />
0070 - 2d 4f 2e 10 a6 ed 38 c5-8e 9d f8 8b 8a 63 3f 7b -O....8......c?{<br />
0080 - ee e6 b8 bf 7a f8 b8 e8-47 92 84 f1 9b 0c 63 30 ....z...G.....c0<br />
0090 - 76 d8 e1 44 v..D<br />
<br />
Start Time: 1352632558<br />
Timeout : 300 (sec)<br />
Verify return code: 20 (unable to get local issuer certificate)<br />
---<br />
* OK Gimap ready for requests from 108.78.162.240 o67if11168976yhc.67<br />
</nowiki><br />
}}<br />
<br />
Simply copy the first block that begins with {{ic|-----BEGIN CERTIFICATE-----}} and ends with {{ic|-----END CERTIFICATE-----}}, paste into a file, and save with a .pem extension (this is necessary for the next step). Older instructions state that, with Gmail, both certificate blocks must be saved but on testing this was found to be unnecessary.<br />
<br />
Now, copy the root issuer certificate to your local certificate folder. In this example (Gmail), the root issuer is Equifax Secure Certificate Authority. This certificate is included in the {{pkg|ca-certificates}} package.<br />
<br />
{{bc|<br />
<nowiki><br />
cp /usr/share/ca-certificates/mozilla/Equifax_Secure_CA.crt ~/.cert/Equifax_Secure_CA.pem<br />
</nowiki><br />
}}<br />
<br />
==== Step #2: Setup mbsync ====<br />
<br />
Configure mbsync to use that certificate:<br />
<br />
{{hc|~/.mbsyncrc|2=<br />
<nowiki><br />
IMAPAccount gmail<br />
Host imap.gmail.com<br />
# ...<br />
CertificateFile ~/.cert/imap.gmail.com.pem<br />
<br />
</nowiki><br />
}}<br />
<br />
=== BAD Command with Exchange 2003 ===<br />
<br />
When connecting to an MS Exchange 2003 server, there could be problems when using pipelining (i.e. executing multiple imap commands concurrently). Such an issue could look as follows:<br />
{{bc|sample output of `mbsync -V exchange'<br />
<nowiki><br />
>>> 9 SELECT "arch"^M<br />
* 250 EXISTS<br />
* 0 RECENT<br />
* FLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)<br />
* OK [PERMANENTFLAGS (\Seen \Answered \Flagged \Deleted \Draft $MDNSent)] Permanent flags<br />
* OK [UNSEEN 241] Is the first unseen message<br />
* OK [UIDVALIDITY 4352] UIDVALIDITY value<br />
9 OK [READ-WRITE] SELECT completed.<br />
>>> 10 UID FETCH 1:1000000000 (UID FLAGS)^M<br />
* 1 FETCH (UID 1 FLAGS (\Seen \Answered))<br />
* 2 FETCH (UID 2 FLAGS (\Seen \Answered))<br />
...<br />
* 249 FETCH (UID 696 FLAGS ())<br />
* 250 FETCH (UID 697 FLAGS (\Seen))<br />
10 OK FETCH completed.<br />
>>> 11 APPEND "arch" (\Seen) {4878+}^M<br />
(1 in progress) >>> 12 UID FETCH 697 (BODY.PEEK[])^M<br />
(2 in progress) >>> 13 UID STORE 696 +FLAGS.SILENT (\Deleted)^M<br />
12 BAD Command is not valid in this state.<br />
</nowiki><br />
}}<br />
So command 9 is to select a new folder, command 10 checks the mail and commands 11, 12 and 13 run in parallel, writing/getting/flagging a mail. In this case, the Exchange server would terminate the connection after the BAD return value and go on to the next channel. (And if all went well in this channel, mbsync would return with 0.) After setting<br />
PipelineDepth 1<br />
in the IMAPStore config part of the Exchange, this problem did not occur any more.<br />
<br />
=== Emails on remote server have the wrong date ===<br />
<br />
This fix works when syncing with fastmail, but it likely applies to other services as well.<br />
<br />
If you move an email to a new folder using an email client, and mbsync causes the email to appear with the wrong date on<br />
the server, add this to your configuration file:<br />
CopyArrivalDate yes<br />
For example, without this setting, moving an old email from Inbox to Archive using mu4e and then<br />
syncing to fastmail with mbsync will cause the email to appear in Archive but with the date of<br />
the sync.<br />
<br />
mbsync uses mtime of email message when uploading from maildir to imap server. You can use [https://gist.github.com/artizirk/877ce9d30159323aac037e2a2af74509 fix_maildir_mail_mtime.py] script to set mtime from email header.<br />
<br />
== External links ==<br />
<br />
*[http://isync.sourceforge.net/ Home page]<br />
*[https://sourceforge.net/projects/isync/ Sourceforge page]<br />
*[https://kevin.deldycke.com/2012/08/gmail-backup-mbsync/ backing up gmail with mbsync]<br />
*[https://www.cyberciti.biz/faq/test-ssl-certificates-diagnosis-ssl-certificate/ How To Verify SSL Certificate From A Shell Prompt]</div>GaugeDerivativehttps://wiki.archlinux.org/index.php?title=Fcitx&diff=557783Fcitx2018-11-29T20:03:51Z<p>GaugeDerivative: /* Tips and tricks */ added the existence of fcitx-remote, and an explanation for how to find <imname>, which doesn't seem to be documented anywhere.</p>
<hr />
<div>[[Category:Input methods]]<br />
[[ja:Fcitx]]<br />
[[zh-hans:Fcitx]]<br />
[[Wikipedia:Fcitx|Fcitx]] is a lightweight [[input method]] framework aimed at providing environment independent language support for Linux. It supports a lot of different languages and also provides many useful non-CJK features.<br />
<br />
==Installation==<br />
[[Install]] the {{Pkg|fcitx}} package.<br />
<br />
=== Input method engines ===<br />
<br />
Fcitx provides built-in input methods for Chinese [[wikipedia:Pinyin|Pinyin]] and table-based input (for example [[wikipedia:Wubi method|Wubi]]).<br />
<br />
Depending on the language you wish to type, other input method engines are available:<br />
<br />
==== Chinese ====<br />
<br />
* {{Pkg|fcitx-sunpinyin}}, based on {{Pkg|sunpinyin}}. It strikes a good balance between speed and accuracy.<br />
* {{Pkg|fcitx-libpinyin}}, based on {{Pkg|libpinyin}}. It has a better algorithm than {{Pkg|fcitx-sunpinyin}}.<br />
* {{Pkg|fcitx-rime}}, based on schemas from the [[Rime IME]] project.<br />
* {{Pkg|fcitx-googlepinyin}}, the Google pinyin IME for Android.<br />
* {{AUR|fcitx-sogoupinyin}}, [http://pinyin.sogou.com/linux/ Sogou input method] supporting Jianpin, fuzzy sound, cloud input, English input, and mixed skin.<br />
* {{Pkg|fcitx-cloudpinyin}} uses internet sources to provide input candidates. The selected cloud result will be added to local dictionary. It support all fcitx pinyin input method except {{Pkg|fcitx-rime}}. <br />
* {{Pkg|fcitx-chewing}} is a popular Zhuyin input engine for Traditional Chinese based on {{Pkg|libchewing}}.<br />
* {{Pkg|fcitx-table-extra}} adds [[wikipedia:Cangjie_input_method|Cangjie]], [[wikipedia:Zhengma_method|Zhengma]], [[wikipedia:Boshiamy_method|Boshiamy]] support.<br />
<br />
==== Japanese ====<br />
<br />
* {{Pkg|fcitx-mozc}}, based on [[Mozc]], the Open Source Edition of Google Japanese Input.<br />
* {{Pkg|fcitx-kkc}}, a Japanese Kana Kanji input engine, based on {{Pkg|libkkc}}.<br />
* {{Pkg|fcitx-anthy}}, a popular Japanese input engine. However, it is not actively developed anymore.<br />
<br />
==== Other languages ====<br />
<br />
* {{Pkg|fcitx-hangul}}, for typing Korean hangul, based on {{Pkg|libhangul}}.<br />
* {{Pkg|fcitx-unikey}}, for typing Vietnamese characters.<br />
* {{Pkg|fcitx-sayura}}, for typing Sinhalese.<br />
* {{Pkg|fcitx-m17n}}, for other languages provided by [http://www.nongnu.org/m17n/ M17n].<br />
<br />
=== Input method module ===<br />
<br />
To obtain a better experience in Gtk+ and Qt programs, install the {{Pkg|fcitx-gtk2}}, {{Pkg|fcitx-gtk3}}, {{Pkg|fcitx-qt4}} and {{Pkg|fcitx-qt5}} input method modules as your need, or the {{Grp|fcitx-im}} group to install all of them. Without those modules, the input method may work on most applications but you may experience input method hang up, preview window screen location error or no preview error. <br />
<br />
Applications below do not use Gtk+/Qt input module: <br />
<br />
* Applications use Tk, motif or xlib<br />
* Emacs, Opera, OpenOffice, LibreOffice, Skype, Wine, Java, Xterm, urxvt, WPS<br />
<br />
=== Others ===<br />
<br />
* {{Pkg|fcitx-ui-light}}, light UI for fcitx.<br />
* {{Pkg|fcitx-table-extra}}, extra table.<br />
* {{Pkg|fcitx-table-other}}, tables for Latex, Emoji and others. <br />
* [[#GUI configuration tools]]<br />
<br />
Others packages (including git version) are also available in the [[AUR]]. All components of fcitx will requires fcitx to restart after install.<br />
<br />
== Usage ==<br />
{{Note|You need to have [[Fonts#Chinese, Japanese, Korean, Vietnamese|Chinese, Japanese, Korean or Vietnamese font]] installed to be able to enter the corresponding characters.}}<br />
<br />
=== Desktop Environment ===<br />
If you are using any XDG compatible desktop environment such as [[KDE]], [[GNOME]], [[Xfce]], [[LXDE]], after you re-login, the autostart should work out of box. If not run the ''fcitx'' executable. To see if fcitx is working correctly, open an application and press {{ic|Ctrl+Space}} (the default shortcut for switching the input method) to invoke fcitx and input some words.<br />
<br />
If fcitx failed to start with your desktop automatically or if you want to change the parameters to start fcitx, configure [[Autostarting#On_Xorg_startup|autostart]] or edit the {{ic|fcitx-autostart.desktop}} file in your {{ic|~/.config/autostart/}} directory (copy it from {{ic|/etc/xdg/autostart/}} if it doesn't exist yet).<br />
<br />
When other input methods with xim support are also running, fcitx may fail to start due to an xim error. Ensure that no other input methods are running before you start fcitx.<br />
<br />
=== Non desktop environment ===<br />
<br />
[[Define]] the environment variables to register the input method modules and support xim programs.<br />
<br />
{{hc|~/.pam_environment|<nowiki><br />
GTK_IM_MODULE=fcitx<br />
QT_IM_MODULE=fcitx<br />
XMODIFIERS=@im=fcitx</nowiki><br />
}}<br />
<br />
Re-login or reboot to make these environment changes effective.<br />
<br />
If ''fcitx'' process does not start automatically, you might need to add {{ic|fcitx &}} in your {{ic|~/.xinitrc}}.<br />
<br />
{{Note|<br />
* Avoid {{ic|.bashrc}} for this, see [[GregsWiki:DotFiles]].<br />
* If all Qt apps have problem with fcitx, run ''qtconfig'' (''qtconfig-qt4''), and go to the third tab, make sure ''fcitx'' is in the ''Default Input Method'' combo-box.<br />
}}<br />
<br />
=== XIM ===<br />
<br />
Optionally, you can use the [[Wikipedia:X Input Method|X Input Method]] (XIM) in your GTK+ and/or Qt programs without installing the above modules in which case you need to change the corresponding lines above as following:<br />
<br />
GTK_IM_MODULE=xim<br />
QT_IM_MODULE=xim<br />
<br />
{{Warning| Using XIM can sometimes cause problems including not being able to input, no cursor following, word selection window issue, application freeze on input method restart. For these XIM related problems, Fcitx cannot provide any fix or support. This is the same with any other input method framework, so please use the GTK+ and Qt input method modules instead of xim whenever possible}}<br />
<br />
{{Note|Gtk2 uses {{ic|/usr/lib/gtk-2.0/2.10.0/immodules.cache}} as immodule cache file since 2.24.20. If you have set {{ic|GTM_IM_MODULE_FILE}} environment variable or do not use install script of official packages to update the cache, please change/clear the environment variable and use {{ic|/usr/bin/gtk-query-immodules-2.0 --update-cache}} to update immodule cache.}}<br />
<br />
==Configuration==<br />
<br />
=== GUI configuration tools ===<br />
<br />
fcitx provides a [[KDE]] configuration module ({{Pkg|kcm-fcitx}}) and a GTK3 configuration tool ({{Pkg|fcitx-configtool}}).<br />
<br />
Run ''fcitx-config-gtk3'' after {{Pkg|fcitx-configtool}} is installed. Unset ''Only Show Current Language'' if you want to enable an input method for a different language.<br />
<br />
Stop fcitx manually before changing configuration, or the change may be lost. <br />
<br />
In order to enable spell checking, press {{ic|Ctrl+Alt+h}} when fcitx is on an input method provided by fcitx-keyboard.<br />
<br />
=== Input methods configuration ===<br />
<br />
You can add/remove input methods in the GUI tools. Note that the search is case sensitive.<br />
<br />
The first set input method is the inactive state, while all the rest will be active states. You generally want the inactive state to be one of the Keyboard options (e.g. "Keyboard - English (US)"). These options just input based on the keyboard layout in the name.<br />
<br />
Under Global Config, the "Trigger Input Method" shortcut will only switch between the inactive and last used active state. The "Scroll between Input Methods" will by default only scroll between different active states, but can also be set to include the inactive state in the advanced settings. Furthermore, the "Scroll between Input Methods" shortcut has to be pressed in order, e.g. "ALT_SHIFT" will only activate if alt is pressed before shift.<br />
<br />
Configuration settings for IME's can be found by by setting the keyboard to the desired IME and right-clicking the tray icon.<br />
<br />
=== Change default UI ===<br />
<br />
Fcitx support kimpanel protocol to provide better desktop integration.<br />
<br />
* Gnome-Shell: You can install kimpanel from extensions.gnome.org or {{AUR|gnome-shell-extension-kimpanel-git}}, which provides a similar user experience as ibus-gjs.<br />
* KDE: {{Pkg|kimtoy}} could use skin from Sogou and fcitx.<br />
<br />
=== Extend pinyin dictionary ===<br />
<br />
Pinyin dictionary is located at {{ic|~/.config/fcitx/pinyin}}. File {{ic|pybase.mb}} is for single characters and file {{ic|pyphrase.mb}} defines pinyin phrases. To extend them, put your file into {{ic|/usr/share/fcitx/pinyin}} and restart fcitx.<br />
<br />
=== Skins ===<br />
<br />
You can download skins and extract them to one of the following directories, you can create the directory if it doesn't exist:<br />
<br />
/usr/share/fcitx/skin #Global settings<br />
~/.config/fcitx/skin #User settings<br />
<br />
=== Cloud Pinyin configuration ===<br />
After installing the {{Pkg|fcitx-cloudpinyin}} input method, restart fcitx. If you could not find it in configuration GUI, enable advanced settings. The cloud query result will be added to current input method dictionary automatically. <br />
<br />
If your network prevents you from accessing Google, change Cloud Pinyin source to Baidu.<br />
<br />
The query result from cloud will list as secondary candidate by default and it is configurable. If the result already exists, only one item is shown. <br />
<br />
{{Note|Set query result as first candidate is not recommend because the dictionary order will be changed if query returns an empty result}}<br />
<br />
== Tips and tricks ==<br />
===Clipboard Access===<br />
You can use fcitx to input text in you clipboard (as well as a short clipboard history and primary selection). The default trigger key is {{ic|Ctrl-;}}. You can change the trigger key as well as other options in the Clipboard addon configure page.<br />
<br />
{{Note|This is NOT a clipboard manager, it doesn't hold the selection or change its content as what a clipboard manager is supposed to do. It can only be used to input from the clipboard.}}<br />
<br />
{{Warning| Some clients do not support multi-line input, so you may see the multi-line clipboard content pasted as a single line using fcitx-clipboard. This is either a bug or feature of the program being used and it is not something fcitx is able to help with.}}<br />
<br />
===fcitx-remote===<br />
{{ic|fcitx-remote}} is a commandline tool that can be used to control the fcitx state. It is installed with the {{ic|fcitx}} package.<br />
<br />
One option worth elaborating upon here is {{ic|fcitx-remote -s <imname>}}, which switches to the input method identified by {{ic|<imname>}}. The correct {{ic|<imname>}} for an in use input method can be found by running {{ic|fcitx-diagnose}}, and looking under {{ic|## Input Methods:}}.<br />
<br />
==Troubleshooting==<br />
<br />
=== Disable or change ''Extra key for trigger input method'' [sic] ===<br />
This setting is under the ''Global Config'' tab and defaults to ''SHIFT Both'', meaning that pressing ''either'' shift key will immediately change input methods. Although it should only apply when a shift key is pressed individually, it tends to randomly interrupt typing capital letters, selecting text with the keyboard, etc. while using standard keyboard input.<br />
<br />
In addition, this setting may revert to default without warning at any time. To ensure fcitx's config cannot be modified, you must make fcitx's config file immutable: {{ic|# chattr +i ~/.config/fcitx/config}}.<br />
<br />
=== Diagnose the problem ===<br />
If you have problems using fcitx, eg. Ctrl+Space fail to work in all applications, then the first thing you should try is to diagnose using {{ic|fcitx-diagnose}}.<br />
The output of {{ic|fcitx-diagnose}} should contain the clue to most common problems.<br />
Providing the output of it will also help when you consult other people(eg. in IRC or forums).<br />
<br />
=== Emacs ===<br />
If your {{ic|LC_CTYPE}} is English, you may not be able to use input method in emacs due to an old emacs bug. You can set your {{ic|LC_CTYPE}} to something else such as {{ic|zh_CN.UTF-8}} before emacs starts to get rid of this problem. <br />
<br />
Note that the corresponding [[locale]] should be [[Locale#Generating locales|generated]] on your your system.<br />
<br />
The default fontset will use `-*-*-*-r-normal--14-*-*-*-*-*-*-*' as basefont (in {{ic|src/xfns.c}}), if you do not have one matched (like terminus or 75dpi things, you can look the output of `xlsfonts'), XIM can not be activated.<br />
<br />
==== Emacs Daemon ====<br />
<br />
If you are using [[Emacs#As_a_daemon|emacs daemon/client mode]], {{ic|LC_CTYPE}} should be set when starting the daemon. For example, by running emacs daemon with {{ic|1=LC_CTYPE=zh_CN.UTF-8 emacs --daemon}}.<br />
<br />
If starting emacs daemon from [[systemd]], [[Systemd#Editing provided_units|set]] {{ic|1=Environment="LC_CTYPE=zh_CN.UTF-8" "XMODIFIERS=@im=fcitx"}} in the unit file.<br />
<br />
({{ic|XMODIFIERS}} may need to be set explicitly here as systemd doesn't load {{ic|.xprofile}}. Check the {{ic|initial-environment}} variable in emacs to verify both variables are set correctly.)<br />
<br />
=== Firefox popup menu not work ===<br />
<br />
For [[Firefox]] above version 13, the popup menu may fail to work due to xim, make sure that {{pkg|fcitx-gtk3}} along with a latest version fcitx are installed.<br />
<br />
=== Ctrl+Space fail to work in GTK programs ===<br />
<br />
This problem sometimes happens especially when the locale is set as English. Please make sure your {{ic|GTK_IM_MODULE}} is set correctly.<br />
<br />
See also [http://fcitx-im.org/wiki/FAQ#When_use_Ctrl_.2B_Space.2C_Fcitx_cannot_be_triggered_on FAQ]<br />
<br />
If you have set the {{ic|*_IM_MODULE}} environment variables to fcitx but cannot activate fcitx, please check if you have installed the corresponding input method modules.<br />
<br />
Some programs can only use xim, if you are using these programs, please make sure your {{ic|XMODIFIERS}} is set properly and be aware of the problems you may have. These programs include all programs that are not using GTK or Qt (e.g. programs that use tk, motif, or xlib directly), emacs, opera, openoffice, libreoffice, skype.<br />
<br />
If you cannot enable fcitx in ''gnome-terminal'' under Gnome and the above way doesn't work, try:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/IMModule':<'fcitx'>}"<br />
<br />
=== Buildin Chinese Pinyin Default NOT ACTIVE ===<br />
<br />
If your locale is {{ic|en_US.UTF-8}}, fcitx did NOT enable the buildin Chinese Pinyin input method by default. There is only {{ic|fcitx-keyboard-us}} input method enabled. You can get a notice by {{ic|fcitx-diagnose}} command like this:<br />
<br />
## Input Methods:<br />
1. Found 1 enabled input methods:<br />
fcitx-keyboard-us<br />
2. Default input methods:<br />
**You only have one input method enabled, please add a keyboard input method as the first one and your main input method as the second one.**<br />
<br />
Then you should add {{ic|Pinyin}} or {{ic|Shuangpin}} input method to actived input methods by the GUI configure tool.<br />
<br />
=== fcitx and KDE ===<br />
<br />
For some reasons, [[KDE]] doesn't handle keyboard layouts properly. For example, if you switch from US (English) to LT (Lithuanian), all numbers on the keyboard should produce Lithuanian letters, but they still produce numbers as the output. This can be fixed by these steps:<br />
<br />
# Turn off ''fcitx'' if it is running in the background.<br />
# Disable stuff related to KDE:<br />
## At ''System settings > Input devices > Layouts (tab)'' make sure that ''Configure layouts'' is unchecked.<br />
## At ''System settings > Input devices > Advanced (tab)'' make sure that ''Configure keyboard options'' is unchecked.<br />
# Start ''fcitx'' to start it. You can close the terminal - ''fcitx'' will still be running in the background.<br />
# Set up your needed layouts (right click on the system tray icon, then ''Configure'').<br />
# Right click on the system tray icon, then ''Exit''<br />
<br />
At this point you should have working layouts, native KDE layouts switch icon should appear and you can switch them by mouse scroll or click on it.<br />
<br />
=== Input method switched to English unintentionally ===<br />
<br />
For instance, in XMind, when the user presses Enter to create a node, input method is always switched to English, and has to be switched back to Chinese manually.<br />
<br />
To fix this issue, open the fcitx GUI configuration tool (provided by {{Pkg|fcitx-configtool}}), switch to tab ''Global Config'', in dropdown menu ''Share State Among Window'', select ''PerProgram'' or ''All''.<br />
<br />
=== xmodmap settings being overwritten ===<br />
<br />
fcitx controls keyboard layout, so your [[xmodmap]] settings will be overwritten.<br />
Since 4.2.7, Fcitx will try to load {{ic|~/.Xmodmap}} if it exists.<br />
<br />
For more details on how you can save your xmodmap changes see [http://fcitx-im.org/wiki/FAQ#xmodmap_settings_being_overwritten FAQ]<br />
<br />
== See also ==<br />
<br />
* [https://gitlab.com/fcitx/fcitx Fcitx GitLab]<br />
* [http://fcitx-im.org/ Fcitx Wiki]</div>GaugeDerivativehttps://wiki.archlinux.org/index.php?title=Fcitx&diff=557782Fcitx2018-11-29T19:51:04Z<p>GaugeDerivative: /* Input methods configuration */ Added more detailed explanations for input method configuration.</p>
<hr />
<div>[[Category:Input methods]]<br />
[[ja:Fcitx]]<br />
[[zh-hans:Fcitx]]<br />
[[Wikipedia:Fcitx|Fcitx]] is a lightweight [[input method]] framework aimed at providing environment independent language support for Linux. It supports a lot of different languages and also provides many useful non-CJK features.<br />
<br />
==Installation==<br />
[[Install]] the {{Pkg|fcitx}} package.<br />
<br />
=== Input method engines ===<br />
<br />
Fcitx provides built-in input methods for Chinese [[wikipedia:Pinyin|Pinyin]] and table-based input (for example [[wikipedia:Wubi method|Wubi]]).<br />
<br />
Depending on the language you wish to type, other input method engines are available:<br />
<br />
==== Chinese ====<br />
<br />
* {{Pkg|fcitx-sunpinyin}}, based on {{Pkg|sunpinyin}}. It strikes a good balance between speed and accuracy.<br />
* {{Pkg|fcitx-libpinyin}}, based on {{Pkg|libpinyin}}. It has a better algorithm than {{Pkg|fcitx-sunpinyin}}.<br />
* {{Pkg|fcitx-rime}}, based on schemas from the [[Rime IME]] project.<br />
* {{Pkg|fcitx-googlepinyin}}, the Google pinyin IME for Android.<br />
* {{AUR|fcitx-sogoupinyin}}, [http://pinyin.sogou.com/linux/ Sogou input method] supporting Jianpin, fuzzy sound, cloud input, English input, and mixed skin.<br />
* {{Pkg|fcitx-cloudpinyin}} uses internet sources to provide input candidates. The selected cloud result will be added to local dictionary. It support all fcitx pinyin input method except {{Pkg|fcitx-rime}}. <br />
* {{Pkg|fcitx-chewing}} is a popular Zhuyin input engine for Traditional Chinese based on {{Pkg|libchewing}}.<br />
* {{Pkg|fcitx-table-extra}} adds [[wikipedia:Cangjie_input_method|Cangjie]], [[wikipedia:Zhengma_method|Zhengma]], [[wikipedia:Boshiamy_method|Boshiamy]] support.<br />
<br />
==== Japanese ====<br />
<br />
* {{Pkg|fcitx-mozc}}, based on [[Mozc]], the Open Source Edition of Google Japanese Input.<br />
* {{Pkg|fcitx-kkc}}, a Japanese Kana Kanji input engine, based on {{Pkg|libkkc}}.<br />
* {{Pkg|fcitx-anthy}}, a popular Japanese input engine. However, it is not actively developed anymore.<br />
<br />
==== Other languages ====<br />
<br />
* {{Pkg|fcitx-hangul}}, for typing Korean hangul, based on {{Pkg|libhangul}}.<br />
* {{Pkg|fcitx-unikey}}, for typing Vietnamese characters.<br />
* {{Pkg|fcitx-sayura}}, for typing Sinhalese.<br />
* {{Pkg|fcitx-m17n}}, for other languages provided by [http://www.nongnu.org/m17n/ M17n].<br />
<br />
=== Input method module ===<br />
<br />
To obtain a better experience in Gtk+ and Qt programs, install the {{Pkg|fcitx-gtk2}}, {{Pkg|fcitx-gtk3}}, {{Pkg|fcitx-qt4}} and {{Pkg|fcitx-qt5}} input method modules as your need, or the {{Grp|fcitx-im}} group to install all of them. Without those modules, the input method may work on most applications but you may experience input method hang up, preview window screen location error or no preview error. <br />
<br />
Applications below do not use Gtk+/Qt input module: <br />
<br />
* Applications use Tk, motif or xlib<br />
* Emacs, Opera, OpenOffice, LibreOffice, Skype, Wine, Java, Xterm, urxvt, WPS<br />
<br />
=== Others ===<br />
<br />
* {{Pkg|fcitx-ui-light}}, light UI for fcitx.<br />
* {{Pkg|fcitx-table-extra}}, extra table.<br />
* {{Pkg|fcitx-table-other}}, tables for Latex, Emoji and others. <br />
* [[#GUI configuration tools]]<br />
<br />
Others packages (including git version) are also available in the [[AUR]]. All components of fcitx will requires fcitx to restart after install.<br />
<br />
== Usage ==<br />
{{Note|You need to have [[Fonts#Chinese, Japanese, Korean, Vietnamese|Chinese, Japanese, Korean or Vietnamese font]] installed to be able to enter the corresponding characters.}}<br />
<br />
=== Desktop Environment ===<br />
If you are using any XDG compatible desktop environment such as [[KDE]], [[GNOME]], [[Xfce]], [[LXDE]], after you re-login, the autostart should work out of box. If not run the ''fcitx'' executable. To see if fcitx is working correctly, open an application and press {{ic|Ctrl+Space}} (the default shortcut for switching the input method) to invoke fcitx and input some words.<br />
<br />
If fcitx failed to start with your desktop automatically or if you want to change the parameters to start fcitx, configure [[Autostarting#On_Xorg_startup|autostart]] or edit the {{ic|fcitx-autostart.desktop}} file in your {{ic|~/.config/autostart/}} directory (copy it from {{ic|/etc/xdg/autostart/}} if it doesn't exist yet).<br />
<br />
When other input methods with xim support are also running, fcitx may fail to start due to an xim error. Ensure that no other input methods are running before you start fcitx.<br />
<br />
=== Non desktop environment ===<br />
<br />
[[Define]] the environment variables to register the input method modules and support xim programs.<br />
<br />
{{hc|~/.pam_environment|<nowiki><br />
GTK_IM_MODULE=fcitx<br />
QT_IM_MODULE=fcitx<br />
XMODIFIERS=@im=fcitx</nowiki><br />
}}<br />
<br />
Re-login or reboot to make these environment changes effective.<br />
<br />
If ''fcitx'' process does not start automatically, you might need to add {{ic|fcitx &}} in your {{ic|~/.xinitrc}}.<br />
<br />
{{Note|<br />
* Avoid {{ic|.bashrc}} for this, see [[GregsWiki:DotFiles]].<br />
* If all Qt apps have problem with fcitx, run ''qtconfig'' (''qtconfig-qt4''), and go to the third tab, make sure ''fcitx'' is in the ''Default Input Method'' combo-box.<br />
}}<br />
<br />
=== XIM ===<br />
<br />
Optionally, you can use the [[Wikipedia:X Input Method|X Input Method]] (XIM) in your GTK+ and/or Qt programs without installing the above modules in which case you need to change the corresponding lines above as following:<br />
<br />
GTK_IM_MODULE=xim<br />
QT_IM_MODULE=xim<br />
<br />
{{Warning| Using XIM can sometimes cause problems including not being able to input, no cursor following, word selection window issue, application freeze on input method restart. For these XIM related problems, Fcitx cannot provide any fix or support. This is the same with any other input method framework, so please use the GTK+ and Qt input method modules instead of xim whenever possible}}<br />
<br />
{{Note|Gtk2 uses {{ic|/usr/lib/gtk-2.0/2.10.0/immodules.cache}} as immodule cache file since 2.24.20. If you have set {{ic|GTM_IM_MODULE_FILE}} environment variable or do not use install script of official packages to update the cache, please change/clear the environment variable and use {{ic|/usr/bin/gtk-query-immodules-2.0 --update-cache}} to update immodule cache.}}<br />
<br />
==Configuration==<br />
<br />
=== GUI configuration tools ===<br />
<br />
fcitx provides a [[KDE]] configuration module ({{Pkg|kcm-fcitx}}) and a GTK3 configuration tool ({{Pkg|fcitx-configtool}}).<br />
<br />
Run ''fcitx-config-gtk3'' after {{Pkg|fcitx-configtool}} is installed. Unset ''Only Show Current Language'' if you want to enable an input method for a different language.<br />
<br />
Stop fcitx manually before changing configuration, or the change may be lost. <br />
<br />
In order to enable spell checking, press {{ic|Ctrl+Alt+h}} when fcitx is on an input method provided by fcitx-keyboard.<br />
<br />
=== Input methods configuration ===<br />
<br />
You can add/remove input methods in the GUI tools. Note that the search is case sensitive.<br />
<br />
The first set input method is the inactive state, while all the rest will be active states. You generally want the inactive state to be one of the Keyboard options (e.g. "Keyboard - English (US)"). These options just input based on the keyboard layout in the name.<br />
<br />
Under Global Config, the "Trigger Input Method" shortcut will only switch between the inactive and last used active state. The "Scroll between Input Methods" will by default only scroll between different active states, but can also be set to include the inactive state in the advanced settings. Furthermore, the "Scroll between Input Methods" shortcut has to be pressed in order, e.g. "ALT_SHIFT" will only activate if alt is pressed before shift.<br />
<br />
Configuration settings for IME's can be found by by setting the keyboard to the desired IME and right-clicking the tray icon.<br />
<br />
=== Change default UI ===<br />
<br />
Fcitx support kimpanel protocol to provide better desktop integration.<br />
<br />
* Gnome-Shell: You can install kimpanel from extensions.gnome.org or {{AUR|gnome-shell-extension-kimpanel-git}}, which provides a similar user experience as ibus-gjs.<br />
* KDE: {{Pkg|kimtoy}} could use skin from Sogou and fcitx.<br />
<br />
=== Extend pinyin dictionary ===<br />
<br />
Pinyin dictionary is located at {{ic|~/.config/fcitx/pinyin}}. File {{ic|pybase.mb}} is for single characters and file {{ic|pyphrase.mb}} defines pinyin phrases. To extend them, put your file into {{ic|/usr/share/fcitx/pinyin}} and restart fcitx.<br />
<br />
=== Skins ===<br />
<br />
You can download skins and extract them to one of the following directories, you can create the directory if it doesn't exist:<br />
<br />
/usr/share/fcitx/skin #Global settings<br />
~/.config/fcitx/skin #User settings<br />
<br />
=== Cloud Pinyin configuration ===<br />
After installing the {{Pkg|fcitx-cloudpinyin}} input method, restart fcitx. If you could not find it in configuration GUI, enable advanced settings. The cloud query result will be added to current input method dictionary automatically. <br />
<br />
If your network prevents you from accessing Google, change Cloud Pinyin source to Baidu.<br />
<br />
The query result from cloud will list as secondary candidate by default and it is configurable. If the result already exists, only one item is shown. <br />
<br />
{{Note|Set query result as first candidate is not recommend because the dictionary order will be changed if query returns an empty result}}<br />
<br />
== Tips and tricks ==<br />
===Clipboard Access===<br />
You can use fcitx to input text in you clipboard (as well as a short clipboard history and primary selection). The default trigger key is {{ic|Ctrl-;}}. You can change the trigger key as well as other options in the Clipboard addon configure page.<br />
<br />
{{Note|This is NOT a clipboard manager, it doesn't hold the selection or change its content as what a clipboard manager is supposed to do. It can only be used to input from the clipboard.}}<br />
<br />
{{Warning| Some clients do not support multi-line input, so you may see the multi-line clipboard content pasted as a single line using fcitx-clipboard. This is either a bug or feature of the program being used and it is not something fcitx is able to help with.}}<br />
<br />
==Troubleshooting==<br />
<br />
=== Disable or change ''Extra key for trigger input method'' [sic] ===<br />
This setting is under the ''Global Config'' tab and defaults to ''SHIFT Both'', meaning that pressing ''either'' shift key will immediately change input methods. Although it should only apply when a shift key is pressed individually, it tends to randomly interrupt typing capital letters, selecting text with the keyboard, etc. while using standard keyboard input.<br />
<br />
In addition, this setting may revert to default without warning at any time. To ensure fcitx's config cannot be modified, you must make fcitx's config file immutable: {{ic|# chattr +i ~/.config/fcitx/config}}.<br />
<br />
=== Diagnose the problem ===<br />
If you have problems using fcitx, eg. Ctrl+Space fail to work in all applications, then the first thing you should try is to diagnose using {{ic|fcitx-diagnose}}.<br />
The output of {{ic|fcitx-diagnose}} should contain the clue to most common problems.<br />
Providing the output of it will also help when you consult other people(eg. in IRC or forums).<br />
<br />
=== Emacs ===<br />
If your {{ic|LC_CTYPE}} is English, you may not be able to use input method in emacs due to an old emacs bug. You can set your {{ic|LC_CTYPE}} to something else such as {{ic|zh_CN.UTF-8}} before emacs starts to get rid of this problem. <br />
<br />
Note that the corresponding [[locale]] should be [[Locale#Generating locales|generated]] on your your system.<br />
<br />
The default fontset will use `-*-*-*-r-normal--14-*-*-*-*-*-*-*' as basefont (in {{ic|src/xfns.c}}), if you do not have one matched (like terminus or 75dpi things, you can look the output of `xlsfonts'), XIM can not be activated.<br />
<br />
==== Emacs Daemon ====<br />
<br />
If you are using [[Emacs#As_a_daemon|emacs daemon/client mode]], {{ic|LC_CTYPE}} should be set when starting the daemon. For example, by running emacs daemon with {{ic|1=LC_CTYPE=zh_CN.UTF-8 emacs --daemon}}.<br />
<br />
If starting emacs daemon from [[systemd]], [[Systemd#Editing provided_units|set]] {{ic|1=Environment="LC_CTYPE=zh_CN.UTF-8" "XMODIFIERS=@im=fcitx"}} in the unit file.<br />
<br />
({{ic|XMODIFIERS}} may need to be set explicitly here as systemd doesn't load {{ic|.xprofile}}. Check the {{ic|initial-environment}} variable in emacs to verify both variables are set correctly.)<br />
<br />
=== Firefox popup menu not work ===<br />
<br />
For [[Firefox]] above version 13, the popup menu may fail to work due to xim, make sure that {{pkg|fcitx-gtk3}} along with a latest version fcitx are installed.<br />
<br />
=== Ctrl+Space fail to work in GTK programs ===<br />
<br />
This problem sometimes happens especially when the locale is set as English. Please make sure your {{ic|GTK_IM_MODULE}} is set correctly.<br />
<br />
See also [http://fcitx-im.org/wiki/FAQ#When_use_Ctrl_.2B_Space.2C_Fcitx_cannot_be_triggered_on FAQ]<br />
<br />
If you have set the {{ic|*_IM_MODULE}} environment variables to fcitx but cannot activate fcitx, please check if you have installed the corresponding input method modules.<br />
<br />
Some programs can only use xim, if you are using these programs, please make sure your {{ic|XMODIFIERS}} is set properly and be aware of the problems you may have. These programs include all programs that are not using GTK or Qt (e.g. programs that use tk, motif, or xlib directly), emacs, opera, openoffice, libreoffice, skype.<br />
<br />
If you cannot enable fcitx in ''gnome-terminal'' under Gnome and the above way doesn't work, try:<br />
<br />
$ gsettings set org.gnome.settings-daemon.plugins.xsettings overrides "{'Gtk/IMModule':<'fcitx'>}"<br />
<br />
=== Buildin Chinese Pinyin Default NOT ACTIVE ===<br />
<br />
If your locale is {{ic|en_US.UTF-8}}, fcitx did NOT enable the buildin Chinese Pinyin input method by default. There is only {{ic|fcitx-keyboard-us}} input method enabled. You can get a notice by {{ic|fcitx-diagnose}} command like this:<br />
<br />
## Input Methods:<br />
1. Found 1 enabled input methods:<br />
fcitx-keyboard-us<br />
2. Default input methods:<br />
**You only have one input method enabled, please add a keyboard input method as the first one and your main input method as the second one.**<br />
<br />
Then you should add {{ic|Pinyin}} or {{ic|Shuangpin}} input method to actived input methods by the GUI configure tool.<br />
<br />
=== fcitx and KDE ===<br />
<br />
For some reasons, [[KDE]] doesn't handle keyboard layouts properly. For example, if you switch from US (English) to LT (Lithuanian), all numbers on the keyboard should produce Lithuanian letters, but they still produce numbers as the output. This can be fixed by these steps:<br />
<br />
# Turn off ''fcitx'' if it is running in the background.<br />
# Disable stuff related to KDE:<br />
## At ''System settings > Input devices > Layouts (tab)'' make sure that ''Configure layouts'' is unchecked.<br />
## At ''System settings > Input devices > Advanced (tab)'' make sure that ''Configure keyboard options'' is unchecked.<br />
# Start ''fcitx'' to start it. You can close the terminal - ''fcitx'' will still be running in the background.<br />
# Set up your needed layouts (right click on the system tray icon, then ''Configure'').<br />
# Right click on the system tray icon, then ''Exit''<br />
<br />
At this point you should have working layouts, native KDE layouts switch icon should appear and you can switch them by mouse scroll or click on it.<br />
<br />
=== Input method switched to English unintentionally ===<br />
<br />
For instance, in XMind, when the user presses Enter to create a node, input method is always switched to English, and has to be switched back to Chinese manually.<br />
<br />
To fix this issue, open the fcitx GUI configuration tool (provided by {{Pkg|fcitx-configtool}}), switch to tab ''Global Config'', in dropdown menu ''Share State Among Window'', select ''PerProgram'' or ''All''.<br />
<br />
=== xmodmap settings being overwritten ===<br />
<br />
fcitx controls keyboard layout, so your [[xmodmap]] settings will be overwritten.<br />
Since 4.2.7, Fcitx will try to load {{ic|~/.Xmodmap}} if it exists.<br />
<br />
For more details on how you can save your xmodmap changes see [http://fcitx-im.org/wiki/FAQ#xmodmap_settings_being_overwritten FAQ]<br />
<br />
== See also ==<br />
<br />
* [https://gitlab.com/fcitx/fcitx Fcitx GitLab]<br />
* [http://fcitx-im.org/ Fcitx Wiki]</div>GaugeDerivativehttps://wiki.archlinux.org/index.php?title=Ncmpcpp&diff=554703Ncmpcpp2018-11-11T16:26:38Z<p>GaugeDerivative: The description for repeat mode was misleading.</p>
<hr />
<div>{{Lowercase title}}<br />
[[Category:Music]]<br />
[[Category:Console applications]]<br />
[[de:Ncmpcpp]]<br />
[[it:Ncmpcpp]]<br />
[[ja:Ncmpcpp]]<br />
[[pl:Ncmpcpp]]<br />
{{Related articles start}}<br />
{{Related|mpd}}<br />
{{Related articles end}}<br />
[http://rybczak.net/ncmpcpp Ncmpcpp] is an [[mpd]] client (compatible with [https://www.mopidy.com/ mopidy]) with a UI very similar to ''ncmpc'', but it provides new useful features such as support for regular expressions for library searches, extended song format, items filtering, the ability to sort playlists, and a local filesystem browser.<br />
<br />
To use it, a functional ''mpd'' must be present on the system since ''ncmpcpp''/''mpd'' work together in a client/server relationship.<br />
<br />
== Installation ==<br />
<br />
[[Install]] {{Pkg|ncmpcpp}} from the [[official repositories]].<br />
<br />
== Basic configuration ==<br />
<br />
The shell "GUI" for ''ncmpcpp'' is highly customizable. Edit {{ic|~/.ncmpcpp/config}} to your liking. If, after installation, {{ic|~/.ncmpcpp/config}} has not been created, simply copy the sample config, [[File_permissions_and_attributes#Changing_ownership|change owner]] and edit at the very least the following three configuration options:<br />
<br />
* '''mpd_host''' - Should point to the host on which ''mpd'' resides, can be "localhost", "127.0.0.1" or "::1" if on the same machine. To connect with a password, write "''password''@''host''"<br />
* '''mpd_port''' - The default of ''mpd'' should be "6600"<br />
* '''mpd_music_dir''' - The same directory value as specified in "music_directory" in {{ic|mpd.conf}}<br />
<br />
For inspiration, see the following resources:<br />
* Sample configuration file in {{ic|/usr/share/doc/ncmpcpp/config}}.<br />
* [https://bbs.archlinux.org/viewtopic.php?id=66488 Show your .ncmpcpp/config with screenshot forum thread]<br />
<br />
== Enabling visualization ==<br />
<br />
For visualization, add a few lines to {{ic|/etc/mpd.conf}} to enable the generation of the [[Wikipedia:Fast Fourier transform|fast Fourier transform]] data for the visualization:<br />
<br />
audio_output {<br />
type "fifo"<br />
name "my_fifo"<br />
path "/tmp/mpd.fifo"<br />
format "44100:16:2"<br />
}<br />
<br />
Additional lines need to be added to {{ic|~/.ncmpcpp/config}}<br />
<br />
visualizer_fifo_path = "/tmp/mpd.fifo"<br />
visualizer_output_name = "my_fifo"<br />
visualizer_sync_interval = "30" <br />
visualizer_in_stereo = "yes"<br />
visualizer_type = "spectrum"<br />
visualizer_look = "+|"<br />
<br />
* '''visualizer_sync_interval''' - Set the interval for synchronizing the visualizer with the audio output from ''mpd''. It should be set to greater than 10 to avoid trying to synchronize too frequently, which freezes the visualization. The recommended value is 30, but it can be reduced if the audio becomes desynced with the visualization. <br />
* '''visualizer_type''' - Set the visualization to either a {{ic|spectrum}}/{{ic|ellipse}} analyzer or {{ic|wave}}/{{ic|wave_filled}} form.<br />
* '''visualizer_look''' - Set the visualizer's look (string has to be exactly 2 characters long: first one is for wave and wave_filled whereas second for frequency spectrum and ellipse).<br />
<br />
== Basic usage ==<br />
<br />
{{Remove|Assuming that the internal F1 help also shows these shortcuts, they can be removed here.}}<br />
<br />
=== Loading ncmpcpp ===<br />
<br />
Load ncmpcpp in a shell:<br />
$ ncmpcpp<br />
<br />
=== Different views ===<br />
<br />
Partial list of views within ncmpcpp:<br />
*{{ic|1}} - Current playlist<br />
*{{ic|2}} - Filesystem browser<br />
*{{ic|3}} - DB search<br />
*{{ic|4}} - Library<br />
*{{ic|5}} - Playlist editor<br />
*{{ic|6}} - Tag editor (very powerful!)<br />
*{{ic|7}} - Output selector<br />
*{{ic|8}} - Music visualizer<br />
*{{ic|&#61;}} - Clock<br />
*{{ic|F1}} - Help<br />
<br />
=== Other UI keys ===<br />
<br />
*{{ic|q}} - Quit<br />
*{{ic|f}} - Seek forward<br />
*{{ic|b}} - Seek backward<br />
*{{ic|\}} - Switch between classic and alternative views<br />
*{{ic|#}} - Display bitrate of file<br />
*{{ic|i}} - Show song info<br />
*{{ic|I}} - Show artist info (saved in {{ic|~/.ncmpcpp/artists/ARTIST.txt}})<br />
*{{ic|L}} - Shuffle between available lyric databases<br />
*{{ic|l}} - Retrieve song lyrics for current song Show/hide lyrics<br />
*{{ic|>}} - Next track<br />
*{{ic|<}} - Previous track<br />
*{{ic|p}} - Play/Pause<br />
*{{ic|+}} - Increase volume 2%<br />
*{{ic|-}} - Decrease volume 2%<br />
<br />
=== Playback modes ===<br />
<br />
Notice the control panel in the upper right; shown in alternative mode:<br />
<br />
1:40/4:16 1082 kbps ──┤ Criminal ├── Vol: 98%<br />
[playing] Disturbed - Indestructible (2008) '''[-z-c--]'''<br />
<br />
And again in classic mode:<br />
─────────────────────────────────────────────────────────────────────────────────────────────────────────'''[zc]'''─<br />
<br />
This corresponds to the playback modes; ordered from left to right, they are:<br />
<br />
*{{ic|r}} - repeat mode '''[r-----]''' (Repeats the playlist after reaching the end.)<br />
*{{ic|z}} - random mode '''[-z----]'''<br />
*{{ic|y}} - single mode '''[--s---]''' (Only plays a single track and then stops.)<br />
*{{ic|R}} - consume mode '''[---c--]''' (Removes the current track from playlist after reaching the end.)<br />
*{{ic|x}} - crossfade mode '''[----x-]'''<br />
<br />
The final "-" is only active when the user forces an update to the datebase via {{ic|u}}.<br />
<br />
In order to loop a single track, turn on both single and repeat mode.<br />
== Tips and tricks ==<br />
<br />
=== Remapping keys ===<br />
<br />
A listing of key bindings and their respective functions is available from within npmpcpp itself via hitting {{ic|F1}}. Users may remap any of the default keys simply by copying {{ic|/usr/share/doc/ncmpcpp/bindings}} to {{ic|~/.ncmpcpp/}} and editing it.<br />
<br />
=== Autoset Tags from Filename and vice versa ===<br />
<br />
In the Tag Editor you can select a directory with music and then select the {{ic|Filename}} option in the middle section. This opens a little window with two options: {{ic|Get Tags from Filename}} and {{ic|Rename files}}.<br />
If you choose {{ic|Get Tags From Filename}}, a popup with two windows is shown. On the left side you can enter a pattern that extracts the selected information from the filenames. You can also hit {{ic|Preview}} to see what the result would look like. On the right side you can see the legend containing all the possible keywords to be used for extraction.<br />
<br />
A simple Example would be the pattern: {{ic|%a - %t}}. If your files are named according to this pattern (Artist - Title) then this pattern would extract this information and set the Tags for the File.<br />
<br />
The other option {{ic|Rename Files}} does the exact opposite. It takes the Tags from the audio files and creates a Filename from them.<br />
<br />
== See also ==<br />
<br />
[http://dotshare.it/category/mpd/ncmpcpp/ dotshare.it configurations]</div>GaugeDerivative