https://wiki.archlinux.org/api.php?action=feedcontributions&user=I+magnific0&feedformat=atomArchWiki - User contributions [en]2024-03-19T08:03:09ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Firefox/Tweaks&diff=434721Firefox/Tweaks2016-05-12T09:19:08Z<p>I magnific0: /* Referer Header control */</p>
<hr />
<div>[[Category:Web browser]]<br />
[[ja:Firefox 設定]]<br />
[[tr:Firefox İpuçları]]<br />
{{Related articles start}}<br />
{{Related|Firefox}}<br />
{{Related|Browser plugins}}<br />
{{Related|Firefox on RAM}}<br />
{{Related|Firefox privacy}}<br />
{{Related articles end}}<br />
<br />
This page contains advanced Firefox configuration options and performance tweaks.<br />
<br />
== Performance ==<br />
<br />
Improving Firefox's performance is divided into parameters that can be inputted while running Firefox or otherwise modifying its configuration as intended by the developers, and advanced procedures that involve foreign programs or scripts.<br />
<br />
{{Note|Listed options may only be available for the latest version of Firefox.}}<br />
<br />
=== Advanced Firefox options ===<br />
This section contains advanced Firefox options for performance tweaking. For additional information see [http://kb.mozillazine.org/Category:Tweaking_preferences these Mozillazine forum posts].<br />
<br />
==== Enable OpenGL Off-Main-Thread Compositing (OMTC) ====<br />
<br />
{{Warning|If OpenGL OMTC is disabled for a specific hardware, it may be due to stability issues, high system resources consumption, driver bugs or a number of different variables. Proceed with force-enabling it at your own risk.}}<br />
{{Note|Since Firefox version 40 basic software OMTC is enabled by default.}}<br />
<br />
To check if OpenGL OMTC is enabled, go to {{ic|about:support}} and under the "Graphics" section look for "GPU Accelerated Windows". If it reports "0/1 Basic (OMTC)" (possibly 0/2), OpenGL OMTC is disabled; if it reports "1/1 OpenGL (OMTC)" (possibly 1/2 or 2/2) it is enabled.<br />
<br />
To enable OpenGL OMTC go to {{ic|about:config}} and set:<br />
* layers.acceleration.force-enabled true<br />
* layers.offmainthreadcomposition.enabled true (default)<br />
<br />
Restart Firefox for changes to take effect.<br />
If the above changes do not enable GPU acceleration, try setting the environment variable as follows: {{ic|1=export MOZ_USE_OMTC=1|2==}}. Then run Firefox [http://featherweightmusings.blogspot.se/2013/11/no-more-main-thread-opengl-in-firefox.html].<br />
<br />
For more information on OMTC in Firefox read here: https://wiki.mozilla.org/Platform/GFX/OffMainThreadCompositing<br />
<br />
==== Network settings ====<br />
<br />
Advanced network settings can be found on the {{ic|about:config}} page (try searching for ''network'').<br />
<br />
{| class="wikitable"<br />
|+ Suggested values<br />
! Key || Value || Description<br />
|-<br />
| network.http.pipelining || true || Enable [http://www-archive.mozilla.org/projects/netlib/http/pipelining-faq.html pipelining] for normal connections<br />
|-<br />
| network.http.proxy.pipelining || true || Enable pipelining for proxy connections<br />
|}<br />
<br />
==== Turn off anti-phishing ====<br />
{{Note|Deleting files from your profile folder is potentially dangerous, so it is recommended that you back it up first.}}<br />
<br />
The anti-phishing features of Firefox may cause Firefox to become slow to start or exit. The problem is that Firefox maintains an [[SQLite]] database that can grow quite big which makes reading and writing slower after repeated use. If you feel that you do not need Firefox to tell you which sites may be suspect you can disable this feature:<br />
<br />
* Turn off the following options under the security tab in preferences: ''"Block reported attack sites"'' and ''"Block reported web forgeries"''.<br />
<br />
* Delete all files beginning with {{ic|urlclassifier}} in your profile folder ({{ic|~/.mozilla/firefox/<profile_dir>/}}):<br />
$ rm -i ~/.mozilla/firefox/<profile_dir>/urlclassifier*<br />
<br />
:Some of these files might be recreated by Firefox, but they will not grow any larger than their initial size.<br />
<br />
==== Stop urlclassifier3.sqlite from being created again ====<br />
If you did remove all the {{ic|urlclassifier*}} files as mentioned above, you may find out that {{ic|urlclassifier3.sqlite}} keeps growing again after a certain time. Here is a simple solution to avoid it for now and ever.<br />
<br />
$ cd ~/.mozilla/firefox/<profile_dir><br />
$ echo "" > urlclassifier3.sqlite<br />
$ chmod 400 urlclassifier3.sqlite<br />
<br />
This effectively makes the file empty and then read-only so Firefox cannot write to it anymore.<br />
<br />
==== Turn off OCSP validation ====<br />
OCSP validation may cause Firefox [http://news.netcraft.com/archives/2013/04/16/certificate-revocation-and-the-performance-of-ocsp.html to become slower] for each (HTTPS) connection to a new server. This is worse, recently, where web gadgets are included in pages via HTTPS (e.g., "like" buttons of the social networks), resulting in many connections for a single URL.<br />
<br />
* Turn off the following option under Preferences -> Advanced -> Certificates -> ''"Requests: Use the Online Certificate Status Protocol (OCSP) to confirm the current validity of certificates"''.<br />
<br />
{{Warning|Disabling OCSP causes vulnerabilities to man-in-the-middle attacks. If you are using a potentially vulnerable connection such as Wi-Fi or VPN, it is strongly advised to leave OCSP on.}}<br />
<br />
==== Turn off the disk cache ====<br />
Every object loaded (html pages, jpeg images, css stylesheets, gif banners) is saved in the Firefox cache, to be loaded in the future without to download it again from the server, but only fraction of these objects will be really reused without download (usually the 30%). This because of too short expiration times for the objects, updates or simply the user behavior (to load new pages instead the ones already visited). The Firefox cache is divided in memory and disk cache and using the disk cache results to frequent disk writes, because every time an object loaded it is written to the disk and some older object is removed.<br />
<br />
* Turn on the following option under Preferences -> Advanced -> Network -> ''"Cached Web Content: Override automatic cache management"'' and specify zero in ''"Limit cache to"''.<br />
<br />
==== Longer interval to save session ====<br />
The Firefox session store automatically saves the current status (opened urls, cookies, history and bookmarks) to the disk every 15 seconds. It may be too frequent for the user needs, resulting in a frequent disk access. <br />
<br />
This setting can be found on the {{ic|about:config}} page (try searching for ''sessionstore'').<br />
<br />
* browser.sessionstore.interval 300000<br />
<br />
==== Immediate rendering of pages ====<br />
Mozilla applications render web pages incrementally - they display what has been received of a page before the entire page has been downloaded. Since the start of a web page normally does not have much useful information to display, Mozilla applications will wait a short interval before first rendering a page. This preference controls that interval. Note that if you are on slower connections (dial up) changing this setting might make web pages load for longer times even though the page appears faster.<br />
<br />
This setting can be created in the {{ic|about:config}} page as <br />
<br />
* nglayout.initialpaint.delay with a value of 0.<br />
<br />
=== Other modifications ===<br />
This section contains some other modifications that may increase Firefox's performance.<br />
<br />
==== Enable firefox optional tracking protection ====<br />
Firefox gained an option for [https://support.mozilla.org/en-US/kb/tracking-protection-firefox tracking protection]. It can be enabled by setting {{ic|about:config}}:<br />
<br />
* privacy.trackingprotection.enabled true<br />
<br />
Apart from privacy benefits, enabling [http://venturebeat.com/2015/05/24/firefoxs-optional-tracking-protection-reduces-load-time-for-top-news-sites-by-44/ tracking protection] may also reduce load time by 44%.<br />
<br />
==== Referer Header control ====<br />
Firefox as of version 28 has the ability to control how the HTTP Referer header is send. The options are hidden from the GUI configuration, but available through {{ic|about:config}}. There are [http://security.stackexchange.com/a/80194 four related keys]. The source post mentions recommended and default settings. A short description of the recommended setting is given in table, as well as the values to achieve a perfect score on [https://ip-check.info ip-check.info].<br />
<br />
{| class="wikitable"<br />
|+ Suggested values<br />
! Key || Recommended || [https://ip-check.info ip-check.info] || Default || Description<br />
|-<br />
| network.http.sendRefererHeader || 1 || 1 || 2 || Only for clicked links (0 disabled completely, 2 for all incl. images)<br />
|-<br />
| network.http.referer.XOriginPolicy || 1 || 1 || 0 || Only if base domains match (0 always send, 2 only if host matches)<br />
|-<br />
| network.http.referer.spoofSource || true || false || false || Send target URI instead <br />
|-<br />
| network.http.referer.trimmingPolicy || 2 || 0 || 0 || scheme, host and port (0 full; 1 scheme, host port and path)<br />
|}<br />
<br />
==== Defragment the profile's SQLite databases ====<br />
{{Warning|This procedure may damage the databases in such a way that sessions are not saved properly.}}<br />
<br />
In Firefox 3.0, bookmarks, history, passwords are kept in an SQLite databases. SQLite databases become fragmented over time and empty spaces appear all around. But, since there are no managing processes checking and optimizing the database, these factors eventually result in a performance hit. A good way to improve start-up and some other bookmarks and history related tasks is to defragment and trim unused space from these databases.<br />
<br />
{{AUR|profile-cleaner}} does just this.<br />
<br />
{| class="wikitable"<br />
|+ Sample size differences comparison<br />
! SQLite database || Size Before || Size After || % change<br />
|- <br />
|urlclassifier3.sqlite|| 37 M || 30 M || 19 %<br />
|-<br />
|places.sqlite || 16 M || 2.4 M || 85 %<br />
|-<br />
|}<br />
<br />
==== Cache the entire profile into RAM via tmpfs ====<br />
If the system has memory to spare, {{ic|tmpfs}} can be used to [[Firefox on RAM|cache the entire profile directory]], which might result in increased Firefox responsiveness.<br />
<br />
==== Turn off sponsored content and tiles ====<br />
In {{ic|about:config}}, set the string value to a blank for both of these: {{ic|browser.newtabpage.directory.source}} and {{ic|browser.newtabpage.directory.ping}}. Consider also disabling the tile feature from the tools on a new tab page. A [[Wireshark]] session demonstrates the level of chatter created by these features.<br />
<br />
== Appearance ==<br />
=== Fonts ===<br />
See the main article: [[Font configuration]]<br />
<br />
==== Configure the DPI value ====<br />
Modifying the following value can help improve the way fonts looks in Firefox if the system's DPI is below 96. Firefox, by default, uses 96 and only uses the system's DPI if it is a higher value. To force the system's DPI regardless of its value, type {{ic|about:config}} into the address bar and set {{ic|layout.css.dpi}} to '''0'''.<br />
<br />
Note that the above method only affects the Firefox user interface's DPI settings. Web page contents still use a DPI value of 96, which may look ugly or, in the case of high-resolution displays, may be rendered too small to read. A solution is to change {{ic|layout.css.devPixelsPerPx}} to system's DPI divided by 96. For example, if your system's DPI is 144, then the value to add is 144/96 = 1.5. Changing {{ic|layout.css.devPixelsPerPx}} to '''1.5''' makes web page contents use a DPI of 144, which looks much better.<br />
<br />
See also [[HiDPI#Firefox]] for information about HiDPI displays.<br />
<br />
==== Default font settings from Microsoft Windows ====<br />
Below are the default font preferences when Firefox is installed in Microsoft Windows. Many web sites use the Microsoft fonts.<br />
{{bc|<br />
Proportional: Serif Size (pixels): 16<br />
Serif: Times New Roman<br />
Sans-serif: Arial<br />
Monospace: Courier New Size (pixels): 13<br />
}}<br />
<br />
=== General user interface CSS settings ===<br />
Firefox's user interface can be modified by editing the {{ic|userChrome.css}} and {{ic|userContent.css}} files in {{ic|~/.mozilla/firefox/<profile_dir>/chrome/}} (''profile_dir'' is of the form ''hash.name'', where the ''hash'' is an 8 character, seemingly random string and the profile ''name'' is usually ''default'').<br />
<br />
{{Note|The {{ic|chrome/}} folder and {{ic|userChrome.css}}/{{ic|userContent.css}} files may not necessarily exist, so they may need to be created.}}<br />
<br />
This section only deals with the {{ic|userChrome.css}} file which modifies Firefox's user interface, and not web pages.<br />
<br />
==== Change the font ====<br />
The setting effectively overrides the global GTK+ font preferences, and does not affect webpages, only the user interface itself:<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<br />
* {<br />
font-family: "FONT_NAME";<br />
}<br />
}}<br />
<br />
==== Hide button icons ====<br />
Enables text-only buttons:<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<br />
.button-box .button-icon {<br />
display: none;<br />
}<br />
}}<br />
<br />
==== Hiding various tab buttons ====<br />
These settings hide the arrows that appear to the horizontal edges of the tab bar, the button that toggles the "all tabs" drop-down list, and the plus sign button that creates a new tab.<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<nowiki><br />
/* Tab bar */<br />
<br />
.tabbrowser-strip *[class^="scrollbutton"] {<br />
/* Hide tab scroll buttons */<br />
display: none;<br />
}<br />
<br />
.tabbrowser-strip *[class^="tabs-alltabs"] {<br />
/* Hide tab drop-down list */<br />
display: none;<br />
}<br />
<br />
.tabbrowser-strip *[class^="tabs-newtab-button"] {<br />
/* Hide new-tab button */<br />
display: none;<br />
}</nowiki><br />
}}<br />
<br />
==== Horizontal tabs ====<br />
To place the tab bar horizontally stacked along the sides of the browser window:<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<br />
/* Display the tabbar on the left */<br />
#content > tabbox {<br />
-moz-box-orient: horizontal;<br />
}<br />
<br />
.tabbrowser-strip {<br />
-moz-box-orient: vertical;<br />
/*<br />
* You can set this to -moz-scrollbars-vertical instead,<br />
* but then the scrollbar will *always* be visible. this way<br />
* there is never a scrollbar, so it behaves like the tab bar<br />
* normally does<br />
*/<br />
overflow: -moz-scrollbars-none;<br />
}<br />
<br />
.tabbrowser-tabs {<br />
-moz-box-orient: horizontal;<br />
min-width: 20ex; /* You may want to increase this value */<br />
-mox-box-pack: start;<br />
-moz-box-align: start;<br />
}<br />
<br />
.tabbrowser-tabs > hbox {<br />
-moz-box-orient: vertical;<br />
-moz-box-align: stretch;<br />
-moz-box-pack: start;<br />
}<br />
<br />
.tabbrowser-tabs > hbox > tab {<br />
-moz-box-align: start;<br />
-moz-box-orient: horizontal;<br />
}<br />
}}<br />
<br />
==== Hide window border and title bar ====<br />
Install the [https://addons.mozilla.org/en-US/firefox/addon/hide-caption-titlebar-plus-sma/ Hide Caption Titlebar Plus] extension and set the following settings (leaving other settings to default):<br />
{| class="wikitable"<br />
! Option<br />
! Value<br />
|-<br />
| Show Custom Caption/TitleBar<br />
| Never<br />
|-<br />
| Activate custom borders and corner resizers<br />
| Deactivate<br />
|-<br />
| Enable Customizable Buttons (min,max,close)<br />
| Using a Glass-like window background<br />
|-<br />
| Custom Minimize, Max, Close Buttons<br />
| Auto. Current theme's skin (fixed position)<br />
|-<br />
| Drag Fx window using Tab-bar background<br />
| Enable<br />
|-<br />
| Alternative hide-titlebar feature<br />
| Use<br />
|}<br />
<br />
The extension [https://addons.mozilla.org/nl/firefox/addon/classicthemerestorer/ Classic Theme Restorer] provides more tweaking options to get the best result (e.g. set tab height to 28px, enable/disable toolbars/buttons, etc.).<br />
<br />
==== Auto-hide Bookmarks Toolbar ====<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<br />
#PersonalToolbar {<br />
visibility: collapse !important;<br />
}<br />
<br />
#navigator-toolbox:hover > #PersonalToolbar {<br />
visibility: visible !important;<br />
}<br />
}}<br />
<br />
==== Remove sidebar width restrictions ====<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<br />
/* remove maximum/minimum width restriction of sidebar */<br />
#sidebar {<br />
max-width: none !important;<br />
min-width: 0px !important;<br />
}<br />
}}<br />
<br />
=== Web content CSS settings ===<br />
This section deals with the {{ic|userContent.css}} file in which you can add custom CSS rules for web content. Changes to this file will take effect once the browser is restarted.<br />
<br />
This file can be used for making small fixes or to apply personal styles to frequently visited websites. Custom stylesheets for popular websites are available from sources such as [http://userstyles.org/ userstyles.org]. You can install an add-on such as [https://addons.mozilla.org/en-US/firefox/addon/superusercontent/ superUserContent] to manage themes. This add-on creates the directory {{ic|chrome/userContent.css.d}} and applies changes to the CSS files therein when the page is refreshed.<br />
<br />
==== Import other CSS files ==== <br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userContent.css|<br />
@import url("./imports/some_file.css");<br />
}}<br />
<br />
==== Block certain parts of a domain ====<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userContent.css|<br />
@-moz-document domain(example.com) {<br />
div#header {<br />
background-image: none !important;<br />
} <br />
}<br />
}}<br />
<br />
==== Add [pdf] after links to PDF files ====<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userContent.css|<nowiki><br />
/* add '[pdf]' next to links to PDF files */<br />
a[href$=".pdf"]:after {<br />
font-size: smaller;<br />
content: " [pdf]";<br />
}</nowiki><br />
}}<br />
<br />
==== Firefox 4 New Menu Bar/Firefox Button ====<br />
To toggle between the new Firefox button and the classic menu bar:<br />
* if the button is active, check ''Preferences > Menu Bar'', or right click in the toolbar area and check ''Menu Bar''.<br />
* if the menu bar is active, uncheck ''View > Toolbars > Menu Bar'', or right click in the toolbar area and uncheck ''Menu Bar''.<br />
<br />
In GNU/Linux, you will just get a plain grey button instead of the new orange one from Windows. However you can change this to either a Firefox icon or the icon followed by the "Firefox" text.<br />
<br />
Adding the following to your {{ic|~/.mozilla/firefox/userprofile/chrome/userChrome.css}} file will place the icon before the text:<br />
{{bc|<br />
#appmenu-toolbar-button {<br />
list-style-image: url("chrome://branding/content/icon16.png");<br />
}<br />
}}<br />
<br />
Adding the following to the same file will ''remove'' the "Firefox" text:<br />
{{bc|<br />
#appmenu-toolbar-button > .toolbarbutton-text,<br />
#appmenu-toolbar-button > .toolbarbutton-menu-dropmarker {<br />
display: none !important;<br />
}<br />
}}<br />
<br />
This userChrome.css configuration copies the default Windows Firefox 4+ look and adds an orange background to the button, with a purple background in Private Browsing mode:<br />
{{bc|<br />
#main-window:not([privatebrowsingmode]) #appmenu-toolbar-button {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(34,85%,60%), hsl(26,72%,53%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
<br />
#main-window:not([privatebrowsingmode]) #appmenu-toolbar-button:hover:not(:active):not([open]) {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(26,72%,53%), hsl(34,85%,60%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
<br />
<br />
#main-window:not([privatebrowsingmode]) #appmenu-toolbar-button:hover:active,<br />
#main-window:not([privatebrowsingmode]) #appmenu-toolbar-button[open] {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(26,72%,53%), hsl(26,72%,53%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
<br />
#appmenu-toolbar-button {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(279,70%,46%), hsl(276,75%,38%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
<br />
<br />
#main-window #appmenu-toolbar-button:hover:not(:active):not([open]) {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(276,75%,38%), hsl(279,70%,46%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
<br />
<br />
#main-window #appmenu-toolbar-button:hover:active,<br />
#main-window #appmenu-toolbar-button[open] {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(276,75%,38%), hsl(276,75%,38%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
}}<br />
<br />
{{Note|You need to create both the {{ic|chrome}} directory and {{ic|userChrome.css}}, if they do not already exist.}}<br />
<br />
==== Block ads ====<br />
<br />
See [http://www.floppymoose.com floppymoose.com] for an example of how to use {{ic|userContent.css}} as a basic ad-blocker.<br />
<br />
== Miscellaneous ==<br />
<br />
Other tips and tweaks.<br />
<br />
=== Enable additional media codecs ===<br />
<br />
{{Expansion|This section is not completed, there are many other variables related to Media Codecs in firefox.}}<br />
<br />
Before continuing, remember there is a reason some of these variables are not enabled by default, e.g. stability, memory leaks, etc. Go to {{ic|about:config}} and check the following options:<br />
<br />
{| class="wikitable"<br />
|+ Suggested values<br />
! Key || Value || Description<br />
|-<br />
| media.mediasource.enabled || true (default) || Enable [[wikipedia:Media_Source_Extensions|Media Source Extensions]] (MSE)<br />
|-<br />
| media.mediasource.mp4.enabled || true (default) || Enable [[wikipedia:MPEG-4_Part_14|MP4]] MSE<br />
|-<br />
| media.mediasource.webm.enabled || true (default) || Enable [[wikipedia:WebM|WebM]] MSE. If you use Youtube see [[#WebM and Youtube|WebM and Youtube]].<br />
|-<br />
| media.fragmented-mp4.exposed || true || Enable fragmented MP4 segments<br />
|-<br />
| media.fragmented-mp4.ffmpeg.enabled || true || Enable fragmented MP4 ffmpeg<br />
|-<br />
| media.mediasource.ignore_codecs || true || Enable H.264 MSE, amongst other things (This boolean key has to be created!)<br />
|}<br />
<br />
==== WebM and Youtube ====<br />
<br />
If WebM MSE is enabled when Youtube is set to use the HTML5 player by default, Youtube will use [[wikipedia:VP9|VP9]] video by default to save bandwidth. However, hardware acceleration is not available for VP9, if you want to use hardware acceleration with youtube video especially if you have less capable hardware consider setting {{ic|media.mediasource.webm.enabled}} to false to make youtube stream H.264 video for which hardware acceleration is widely available.<br />
<br />
To verify if WebM (VP9) is enabled go to [https://youtube.com/html5 youtube.com/html5]. If "MSE & WebM VP9" is not supported, youtube will use H264.<br />
<br />
=== Mouse wheel scroll speed ===<br />
<br />
To modify the default values (i.e. speed-up) of the mouse wheel scroll speed, go to {{ic|about:config}} and search for {{ic|mousewheel.acceleration}}. This will show the available options, modifying the following:<br />
<br />
* Set {{ic|mousewheel.acceleration.start}} to '''-1'''.<br />
* Set {{ic|mousewheel.acceleration.factor}} to the desired number (10 to 20 are common values).<br />
<br />
Alternatively you can install the [http://smoothwheel.mozdev.org/ SmoothWheel add-on].<br />
<br />
=== Change the order of search engines in the Firefox Search Bar ===<br />
<br />
To change the order search engines are displayed in:<br />
* Open the drop-down list of search engines and click ''Manage Search Engines...'' entry.<br />
* Highlight the engine you want to move and use ''Move Up'' or ''Move Down'' to move it. Alternatively, you can use drag-and-drop.<br />
<br />
=== How to open a *.doc automatically with Abiword or LibreOffice Writer ===<br />
<br />
Go to ''Preferences > Applications'' and search for ''Word Document'' (or ''Word 2007 Document'' for {{ic|*.docx}}). After finding it, click the drop-down list and select ''Use other...''. From there you have to specify the exact path to the Abiword or Writer executable (i.e.{{ic|/usr/bin/abiword}} or {{ic|/usr/bin/lowriter}}).<br />
<br />
=== "I'm Feeling Lucky" mode ===<br />
<br />
Some search engines have a "feeling lucky" feature. For example, Google has "I'm Feeling Lucky", and DuckDuckGo has "I'm Feeling Ducky".<br />
<br />
To activate them:<br />
# Type {{ic|about:config}} in the address bar.<br />
# Search for the string {{ic|keyword.url}}.<br />
# Modify its value (if any) to the URL of the search engine. <br />
<br />
For Google, set it to:<br />
{{bc|<nowiki>https://www.google.com/search?btnI=I%27m+Feeling+Lucky&q=</nowiki>}}<br />
For DuckDuckGo, set it to:<br />
{{bc|<nowiki>https://duckduckgo.com/?q=\</nowiki>}}<br />
<br />
=== Secure DNS with DNSSEC validator ===<br />
<br />
You can enable [[DNSSEC]] support for safer browsing.<br />
<br />
=== Adding magnet protocol association ===<br />
<br />
In {{ic|about:config}} set {{ic|network.protocol-handler.expose.magnet}} to '''false'''.<br />
<br />
The next time you open a magnet link, you will be prompted with a {{ic|Launch Application}} dialogue. From there simply select your chosen torrent client. This technique can also be used with other protocols.<br />
<br />
=== Adding magnet protocol association for kTorrent (KDE4) ===<br />
<br />
Create a user copy of {{ic|/usr/share/applications/kde4/ktorrent.desktop}} to {{ic|~/.local/share/applications/kde4/}}, and append to {{ic|1=Mimetype=}}<br />
<br />
x-scheme-handler/magnet<br />
<br />
Modify {{ic|~/.config/mimeapps.list}} and append:<br />
<br />
x-scheme-handler/magnet=kde4-ktorrent.desktop<br />
<br />
See [http://superuser.com/questions/44072/how-do-i-associate-magnet-links-with-ktorrent-in-firefox]<br />
<br />
=== Prevent accidental closing ===<br />
<br />
The [https://addons.mozilla.org/en-us/firefox/addon/disable-ctrl-q-shortcut/ Disable Ctrl-Q Shortcut] extension can be installed to prevent unwanted closing of the browser.<br />
<br />
An alternative is to add a rule in your window manager configuration file. For example in openbox add:<br />
<keybind key="C-q"><br />
<action name="Execute"><br />
<execute>false</execute><br />
</action><br />
</keybind><br />
in the ''<keyboard>'' section of your {{ic|rc.xml}} file.<br />
{{Note|This will be effective for every application used under a graphic server.}}<br />
<br />
=== Plugins do not work with latest version ===<br />
<br />
Due to Arch's bleeding edge nature, there can be some compatibility issues with plugins not working with the latest Firefox install (e.g. [http://5digits.org/pentadactyl/index Pentadactyl]). If possible, try installing the nightly/beta builds available, or see [[Downgrading packages]].<br />
<br />
[https://addons.mozilla.org/en-us/firefox/addon/checkcompatibility/?src=userprofile Disable Add-on Compatibility Checks] plugin should take care of spurious compatibility issues when the plugins get disabled, even though they work just fine with the new version.<br />
<br />
=== Jerky or choppy scrolling ===<br />
<br />
Scrolling in Firefox can feel "jerky" or "choppy". A post on [http://forums.mozillazine.org/viewtopic.php?f=8&t=2749475/ MozillaZine] gives settings that work on Gentoo, but reportedly work on Arch Linux as well: <br />
<br />
# Set {{ic|mousewheel.min_line_scroll_amount}} to 40<br />
# Set {{ic|general.smoothScroll}} and {{ic|general.smoothScroll.pages}} to '''false'''<br />
# Set {{ic|image.mem.min_discard_timeout_ms}} to something really large such as 2100000000 but no more than 2140000000. Above that number Firefox will not accept your entry and complain with the error code: "The text you entered is not a number." <br />
# Set {{ic|image.mem.max_decoded_image_kb}} to at least 512K<br />
<br />
Now scrolling should flow smoothly.<br />
<br />
=== WebRTC exposes LAN IP address ===<br />
<br />
{{warning|This method disables WebRTC.}}<br />
To prevent websites from getting your local IP address via [https://en.wikipedia.org/wiki/WebRTC WebRTC]'s peer-to-peer (and JavaScript), open {{ic|about:config}} and set {{ic|media.peerconnection.enabled}} to '''false''' (or use this [https://addons.mozilla.org/en-US/firefox/addon/happy-bonobo-disable-webrtc/ addon]).<br />
<br />
=== Run Firefox inside an nspawn container ===<br />
<br />
{{Move|systemd-nspawn|This is potentially useful for any browser, so... move back?}}<br />
<br />
To run as PID 1<br />
<br />
# systemd-nspawn --setenv=DISPLAY=:0 \<br />
--setenv=XAUTHORITY=~/.Xauthority \<br />
--bind-ro=$HOME/.Xauthority:/root/.Xauthority \<br />
--bind=/tmp/.X11-unix \<br />
-D ~/containers/firefox \<br />
firefox<br />
<br />
Else rather boot the container, with systemd ideally setting up your networking with [[systemd-networkd]]:<br />
<br />
# systemd-nspawn --bind-ro=$HOME/.Xauthority:/root/.Xauthority \<br />
--bind=/tmp/.X11-unix \<br />
-D ~/containers/firefox \<br />
--network-veth -b<br />
<br />
Once your container is booted, run the Xorg binary like so:<br />
<br />
# systemd-run -M firefox --setenv=DISPLAY=:0 firefox<br />
<br />
===Disable 1024-bit Diffie-Hellman primes===<br />
Following [https://freedom-to-tinker.com/blog/haldermanheninger/how-is-nsa-breaking-so-much-crypto/ recent research] it is likely that the NSA has been breaking 1024-bit Diffie-Hellman for some time now. To disable these switch the [https://www.eff.org/deeplinks/2015/10/how-to-protect-yourself-from-nsa-attacks-1024-bit-DH following] settings to '''false''' in {{ic|about:config}}: <br />
<br />
security.ssl3.dhe_rsa_aes_128_sha<br />
security.ssl3.dhe_rsa_aes_256_sha<br />
<br />
Then consider checking your SSL configuration at https://www.howsmyssl.com/.<br />
<br />
=== Show search matches in scroll bar ===<br />
<br />
This chrome feature can be achieved via [https://addons.mozilla.org/en-US/firefox/addon/findbar-tweak/?src=hp-dl-featured FindBar Tweak] extension.<br />
<br />
== See also ==<br />
<br />
* [http://kb.mozillazine.org/Knowledge_Base MozillaZine Wiki]<br />
* [http://kb.mozillazine.org/About:config_entries about:config Entries Explained]<br />
* [http://linuxtidbits.wordpress.com/2009/08/01/better-fox-cat-and-weasel/ Firefox touch-ups that might be desired]</div>I magnific0https://wiki.archlinux.org/index.php?title=Firefox/Privacy&diff=434719Firefox/Privacy2016-05-12T08:52:31Z<p>I magnific0: /* RefControl */</p>
<hr />
<div>[[Category:Web browser]]<br />
[[ja:Firefox プライバシー]]<br />
{{Related articles start}}<br />
{{Related|Firefox}}<br />
{{Related|Tor}}<br />
{{Related|Browser Plugins}}<br />
{{Related|Firefox tweaks}}<br />
{{Related|Firefox on RAM}}<br />
{{Related articles end}}<br />
<br />
This article overviews some useful extensions which enhance security and privacy while using the [[Firefox]] web browser.<br />
<br />
==HTTPS Everywhere==<br />
<br />
[https://www.eff.org/https-everywhere HTTPS Everywhere] is an extension which encrypts your communication with a website. It forces a connection over HTTPS instead of HTTP wherever possible.<br />
<br />
HTTPS Everywhere will be automatically configured and enabled upon restarting Firefox. For information on how to set up your own rules for different websites please visit [https://www.eff.org/https-everywhere/rulesets the official website].<br />
<br />
{{Note|HTTPS Everywhere does not magically enable HTTPS for every site on the internet. The site needs to support HTTPS and HTTPS Everywhere should have a ruleset configured for that site.}}<br />
<br />
==uBlock==<br />
<br />
uBlock (previously μBlock) is a lightweight, efficient blocker which is easy on [https://github.com/gorhill/uBlock#performance memory and CPU]. It comes with several filter lists ready to use out-of-the-box (including EasyList, Peter Lowe's, several malware filter lists). <br />
<br />
The lead developer forked the project and created uBlock Origin. As of July 2015, most of the development is being done on uBlock Origin and the codebases are deviating substantially.<br />
<br />
uBlock Origin: [https://github.com/gorhill/uBlock Github]; [https://addons.mozilla.org/en-US/firefox/addon/ublock-origin/ Firefox Add-ons].<br />
<br />
uBlock: [https://github.com/chrisaljoudi/uBlock Github]; [https://addons.mozilla.org/en-US/firefox/addon/ublock/ Firefox Add-ons].<br />
<br />
==Adblock Plus==<br />
<br />
[https://adblockplus.org/en/ Adblock Plus] can be used to stop intrusive advertisements but it can also be configured to block websites from tracking you.<br />
<br />
Once installed visit the [https://easylist.adblockplus.org/en/ Easy List website] and add the EasyList and EasyPrivacy lists to your Adblock Plus filter subscriptions. This is done by simply clicking any of the "Add [filter] to Adblock Plus" on the webpage. This will bring up the add filter prompt. Review the details and click "Add Subscription".<br />
<br />
EasyList is the primary subscription that removes adverts from English webpages, including unwanted frames, images and objects.<br />
<br />
EasyPrivacy is a supplementary subscription for EasyList which removes all forms of tracking from the internet, including web bugs, tracking scripts and information collectors.<br />
<br />
== Privacy Badger ==<br />
<br />
[https://www.eff.org/privacybadger Privacy Badger] is an extension that monitors third-party trackers loaded with web content. It blocks trackers once they appear on different sites. It does not block advertisements in the first place, but since a lot of ads are served based on tracking information these are blocked as well. For more information on the mechanism, see its [https://www.eff.org/privacybadger#faq-How-is-Privacy-Badger-different-to-Disconnect,-Adblock-Plus,-Ghostery,-and-other-blocking-extensions? FAQ].<br />
<br />
==Disconnect==<br />
<br />
Disconnect is a open source project aimed at stopping 2,000 third-party sites from tracking a user. It encrypts data sent to popular sites and claims to loads web pages 27 percent faster. Disconnect shows its users, in real time, how many tracking attempts from Google, Twitter, Facebook, and more are stopped. It categorizes tracking attempts into advertising, analytical, social, and content, which makes it easy to monitor how one is being tracked.<br />
<br />
Disconnect can also stop side-jacking, which utilizes stolen cookies to steal personal data. It is easy to use and well supported. It can be added to Firefox at the [https://disconnect.me/ official website].<br />
<br />
{{Note|Firefox gained a feature based on the Disconnect list. See [[Firefox tweaks#Enable firefox optional tracking protection]].}}<br />
<br />
==Ghostery==<br />
<br />
[https://www.ghostery.com/ Ghostery] is similar to Disconnect, but is a proprietary project which employ the use of website trackers to track businesses. There is controversy due to Ghostery, Inc. being formerly known as The Better Advertising Project, and being in the business of online-advertising and market intelligence in addition to internet privacy. From the website:<br />
<br />
''Ghostery tracks over 1,000 trackers and gives you a roll-call of the ad networks, behavioural data providers, web publishers, and other companies interested in your activity.<br />
<br />
Ghostery can be installed from the Firefox add-on manager or from the [https://www.ghostery.com/download official website]. Once installed, Ghostery can be configured by selecting preferences from the Add-ons Manager in {{ic|Firefox}} which will bring you to the configuration page. It may also be configured from:<br />
<br />
https://extension.ghostery.com/settings<br />
<br />
Alternatively you can configure Ghostery through the included wizard:<br />
https://extension.ghostery.com/intro#start<br />
<br />
==NoScript==<br />
<br />
[http://noscript.net/ NoScript] is an extension which disables JavaScript, Java, Flash and other plugins on any website not specifically whitelisted by the user. This extension will protect you from exploitation of security vulnerabilities by not letting anything but trusted sites (e.g: your bank, webmail) serve you executable content.<br />
<br />
Once installed you can configure settings for NoScript by either clicking its icon on the toolbar or right clicking a page and navigating to NoScript. You will then have the option to enable/disable scripts for the current page, as well as any third party scripts that the page is linking to. Alternatively you can choose to enable scripts temporarily for that session only.<br />
<br />
For more detailed configuration see the [http://noscript.net/faq NoScript FAQ].<br />
<br />
==uMatrix==<br />
[https://addons.mozilla.org/de/firefox/addon/umatrix/ uMatrix] is forked and refactored from HTTP Switchboard. It allows you to selectively block Javascript, plugins or other resources and control third-party resources. It also features extensive privacy features like user-agent masquerading, referering blocking and so on. It effectively replaces NoScript and RequestPolicy. See the [https://github.com/gorhill/httpswitchboard/wiki/How-to-use-HTTP-Switchboard:-Two-opposing-views old HTTP Switchboard wiki] for different ways how to use it.<br />
<br />
For more Information visit the [https://github.com/gorhill/uMatrix project site].<br />
<br />
==Cookie Monster==<br />
<br />
[https://addons.mozilla.org/en-US/firefox/addon/cookie-monster/ Cookie Monster] is a similar extension to NoScript but will the goal of managing cookies.<br />
<br />
From the preferences for Cookie Monster select "Block All Cookies". Once this is done, just as with NoScript, you can enable the use of cookies for specific pages from either the Cookie Monster icon on the toolbar or by right clicking the page and navigating to Cookie Monster. You have the option to accept cookies from the website in question or alternatively to only temporarily allow cookies for the current session.<br />
<br />
==RefControl==<br />
<br />
[http://www.stardrifter.org/refcontrol/ RefControl] is an extension to control what gets sent as the HTTP Referer. Once installed RefControl can be configured so that no referer gets sent when navigating to a new webpage. This prevents the server from knowing which website you originated from.<br />
<br />
To do this open RefControl's preferences and change the setting for "Default for sites not listed:" to <Block>.<br />
<br />
{{Note|Firefox (as of version 28) has hidden controls for referer behaviour. Possibly replacing plugins such as RefControl and Smart Referer. See [[Firefox tweaks#Referer Header control]].}}<br />
<br />
== RequestPolicy ==<br />
<br />
[https://www.requestpolicy.com/ RequestPolicy] is an extension for Mozilla browsers which lets you have control over cross-site requests. The latest development version lets you blacklist or whitelist requests by default. Disabling unnecessary cross-site requests leads to better privacy, safety and faster browsing.<br />
<br />
For more information on cross-site requests and RequestPolicy visit [https://www.requestpolicy.com/faq.html here].<br />
<br />
== Configuration Tweaks ==<br />
<br />
The following are privacy-focused configuration tweaks to prevent [https://panopticlick.eff.org/ browser fingerprinting] and tracking.<br />
<br />
=== Enable Tracking Protection ===<br />
<br />
Mozilla's built-in tracking protection may be enabled in {{ic|about:config}} by setting the following preference to {{ic|true}}:<br />
<br />
privacy.trackingprotection.enabled<br />
<br />
Note that this is not a replacement for extensions such as UBlock Origin and it may or may not work with [[List of applications/Internet|Firefox forks]].<br />
<br />
=== Change browser time zone ===<br />
<br />
The time zone of your system can be used in browser fingerprinting. To set firefox's time zone to UTC launch it as:<br />
<br />
$ TZ=UTC firefox<br />
<br />
Or, set a script to launch the above (for example, at {{ic|/usr/local/bin/firefox}}).<br />
<br />
=== Change user agent and platform ===<br />
<br />
To change the user agent in firefox, add the following {{ic|string}} key in {{ic|about:config}}:<br />
<br />
general.useragent.override<br />
<br />
The value for the key is your browser's user agent. Select a known common one.<br />
<br />
{{Tip|The value {{ic|Mozilla/5.0 (Windows NT 6.1; rv:38.0) Gecko/20100101 Firefox/38.0}} is used as the user agent for the Tor browser, thus being very common.}}<br />
<br />
{{Warning|Changing the user agent without changing to a corresponding platform will make your browser nearly unique.}}<br />
<br />
To change the platform for firefox, add the following {{ic|string}} key in {{ic|about:config}}:<br />
<br />
general.platform.override<br />
<br />
Select a known common platform that corresponds with your user agent.<br />
<br />
{{Tip|The value {{ic|Win32}} is used as the platform for the Tor browser, corresponding with the user agent provided above.}}</div>I magnific0https://wiki.archlinux.org/index.php?title=Firefox/Tweaks&diff=434718Firefox/Tweaks2016-05-12T08:51:35Z<p>I magnific0: /* Other modifications */</p>
<hr />
<div>[[Category:Web browser]]<br />
[[ja:Firefox 設定]]<br />
[[tr:Firefox İpuçları]]<br />
{{Related articles start}}<br />
{{Related|Firefox}}<br />
{{Related|Browser plugins}}<br />
{{Related|Firefox on RAM}}<br />
{{Related|Firefox privacy}}<br />
{{Related articles end}}<br />
<br />
This page contains advanced Firefox configuration options and performance tweaks.<br />
<br />
== Performance ==<br />
<br />
Improving Firefox's performance is divided into parameters that can be inputted while running Firefox or otherwise modifying its configuration as intended by the developers, and advanced procedures that involve foreign programs or scripts.<br />
<br />
{{Note|Listed options may only be available for the latest version of Firefox.}}<br />
<br />
=== Advanced Firefox options ===<br />
This section contains advanced Firefox options for performance tweaking. For additional information see [http://kb.mozillazine.org/Category:Tweaking_preferences these Mozillazine forum posts].<br />
<br />
==== Enable OpenGL Off-Main-Thread Compositing (OMTC) ====<br />
<br />
{{Warning|If OpenGL OMTC is disabled for a specific hardware, it may be due to stability issues, high system resources consumption, driver bugs or a number of different variables. Proceed with force-enabling it at your own risk.}}<br />
{{Note|Since Firefox version 40 basic software OMTC is enabled by default.}}<br />
<br />
To check if OpenGL OMTC is enabled, go to {{ic|about:support}} and under the "Graphics" section look for "GPU Accelerated Windows". If it reports "0/1 Basic (OMTC)" (possibly 0/2), OpenGL OMTC is disabled; if it reports "1/1 OpenGL (OMTC)" (possibly 1/2 or 2/2) it is enabled.<br />
<br />
To enable OpenGL OMTC go to {{ic|about:config}} and set:<br />
* layers.acceleration.force-enabled true<br />
* layers.offmainthreadcomposition.enabled true (default)<br />
<br />
Restart Firefox for changes to take effect.<br />
If the above changes do not enable GPU acceleration, try setting the environment variable as follows: {{ic|1=export MOZ_USE_OMTC=1|2==}}. Then run Firefox [http://featherweightmusings.blogspot.se/2013/11/no-more-main-thread-opengl-in-firefox.html].<br />
<br />
For more information on OMTC in Firefox read here: https://wiki.mozilla.org/Platform/GFX/OffMainThreadCompositing<br />
<br />
==== Network settings ====<br />
<br />
Advanced network settings can be found on the {{ic|about:config}} page (try searching for ''network'').<br />
<br />
{| class="wikitable"<br />
|+ Suggested values<br />
! Key || Value || Description<br />
|-<br />
| network.http.pipelining || true || Enable [http://www-archive.mozilla.org/projects/netlib/http/pipelining-faq.html pipelining] for normal connections<br />
|-<br />
| network.http.proxy.pipelining || true || Enable pipelining for proxy connections<br />
|}<br />
<br />
==== Turn off anti-phishing ====<br />
{{Note|Deleting files from your profile folder is potentially dangerous, so it is recommended that you back it up first.}}<br />
<br />
The anti-phishing features of Firefox may cause Firefox to become slow to start or exit. The problem is that Firefox maintains an [[SQLite]] database that can grow quite big which makes reading and writing slower after repeated use. If you feel that you do not need Firefox to tell you which sites may be suspect you can disable this feature:<br />
<br />
* Turn off the following options under the security tab in preferences: ''"Block reported attack sites"'' and ''"Block reported web forgeries"''.<br />
<br />
* Delete all files beginning with {{ic|urlclassifier}} in your profile folder ({{ic|~/.mozilla/firefox/<profile_dir>/}}):<br />
$ rm -i ~/.mozilla/firefox/<profile_dir>/urlclassifier*<br />
<br />
:Some of these files might be recreated by Firefox, but they will not grow any larger than their initial size.<br />
<br />
==== Stop urlclassifier3.sqlite from being created again ====<br />
If you did remove all the {{ic|urlclassifier*}} files as mentioned above, you may find out that {{ic|urlclassifier3.sqlite}} keeps growing again after a certain time. Here is a simple solution to avoid it for now and ever.<br />
<br />
$ cd ~/.mozilla/firefox/<profile_dir><br />
$ echo "" > urlclassifier3.sqlite<br />
$ chmod 400 urlclassifier3.sqlite<br />
<br />
This effectively makes the file empty and then read-only so Firefox cannot write to it anymore.<br />
<br />
==== Turn off OCSP validation ====<br />
OCSP validation may cause Firefox [http://news.netcraft.com/archives/2013/04/16/certificate-revocation-and-the-performance-of-ocsp.html to become slower] for each (HTTPS) connection to a new server. This is worse, recently, where web gadgets are included in pages via HTTPS (e.g., "like" buttons of the social networks), resulting in many connections for a single URL.<br />
<br />
* Turn off the following option under Preferences -> Advanced -> Certificates -> ''"Requests: Use the Online Certificate Status Protocol (OCSP) to confirm the current validity of certificates"''.<br />
<br />
{{Warning|Disabling OCSP causes vulnerabilities to man-in-the-middle attacks. If you are using a potentially vulnerable connection such as Wi-Fi or VPN, it is strongly advised to leave OCSP on.}}<br />
<br />
==== Turn off the disk cache ====<br />
Every object loaded (html pages, jpeg images, css stylesheets, gif banners) is saved in the Firefox cache, to be loaded in the future without to download it again from the server, but only fraction of these objects will be really reused without download (usually the 30%). This because of too short expiration times for the objects, updates or simply the user behavior (to load new pages instead the ones already visited). The Firefox cache is divided in memory and disk cache and using the disk cache results to frequent disk writes, because every time an object loaded it is written to the disk and some older object is removed.<br />
<br />
* Turn on the following option under Preferences -> Advanced -> Network -> ''"Cached Web Content: Override automatic cache management"'' and specify zero in ''"Limit cache to"''.<br />
<br />
==== Longer interval to save session ====<br />
The Firefox session store automatically saves the current status (opened urls, cookies, history and bookmarks) to the disk every 15 seconds. It may be too frequent for the user needs, resulting in a frequent disk access. <br />
<br />
This setting can be found on the {{ic|about:config}} page (try searching for ''sessionstore'').<br />
<br />
* browser.sessionstore.interval 300000<br />
<br />
==== Immediate rendering of pages ====<br />
Mozilla applications render web pages incrementally - they display what has been received of a page before the entire page has been downloaded. Since the start of a web page normally does not have much useful information to display, Mozilla applications will wait a short interval before first rendering a page. This preference controls that interval. Note that if you are on slower connections (dial up) changing this setting might make web pages load for longer times even though the page appears faster.<br />
<br />
This setting can be created in the {{ic|about:config}} page as <br />
<br />
* nglayout.initialpaint.delay with a value of 0.<br />
<br />
=== Other modifications ===<br />
This section contains some other modifications that may increase Firefox's performance.<br />
<br />
==== Enable firefox optional tracking protection ====<br />
Firefox gained an option for [https://support.mozilla.org/en-US/kb/tracking-protection-firefox tracking protection]. It can be enabled by setting {{ic|about:config}}:<br />
<br />
* privacy.trackingprotection.enabled true<br />
<br />
Apart from privacy benefits, enabling [http://venturebeat.com/2015/05/24/firefoxs-optional-tracking-protection-reduces-load-time-for-top-news-sites-by-44/ tracking protection] may also reduce load time by 44%.<br />
<br />
==== Referer Header control ====<br />
Firefox as of version 28 has the ability to control how the HTTP Referer header is send. The options are hidden from the GUI configuration, but available through {{ic|about:config}}. There are [http://security.stackexchange.com/a/80194 four related keys]:<br />
<br />
{| class="wikitable"<br />
|+ Suggested values<br />
! Key || Value || Default || Description<br />
|-<br />
| network.http.sendRefererHeader || 1 || 2 || Only for clicked links (0 disabled completely, 2 for all incl. images)<br />
|-<br />
| network.http.referer.XOriginPolicy || 1 || 0 || Only if base domains match (0 always send, 2 only if host matches)<br />
|-<br />
| network.http.referer.spoofSource || true || false || Send target URI instead <br />
|-<br />
| network.http.referer.trimmingPolicy || 2 || 0 || scheme, host and port (0 full; 1 scheme, host port and path)<br />
|}<br />
<br />
==== Defragment the profile's SQLite databases ====<br />
{{Warning|This procedure may damage the databases in such a way that sessions are not saved properly.}}<br />
<br />
In Firefox 3.0, bookmarks, history, passwords are kept in an SQLite databases. SQLite databases become fragmented over time and empty spaces appear all around. But, since there are no managing processes checking and optimizing the database, these factors eventually result in a performance hit. A good way to improve start-up and some other bookmarks and history related tasks is to defragment and trim unused space from these databases.<br />
<br />
{{AUR|profile-cleaner}} does just this.<br />
<br />
{| class="wikitable"<br />
|+ Sample size differences comparison<br />
! SQLite database || Size Before || Size After || % change<br />
|- <br />
|urlclassifier3.sqlite|| 37 M || 30 M || 19 %<br />
|-<br />
|places.sqlite || 16 M || 2.4 M || 85 %<br />
|-<br />
|}<br />
<br />
==== Cache the entire profile into RAM via tmpfs ====<br />
If the system has memory to spare, {{ic|tmpfs}} can be used to [[Firefox on RAM|cache the entire profile directory]], which might result in increased Firefox responsiveness.<br />
<br />
==== Turn off sponsored content and tiles ====<br />
In {{ic|about:config}}, set the string value to a blank for both of these: {{ic|browser.newtabpage.directory.source}} and {{ic|browser.newtabpage.directory.ping}}. Consider also disabling the tile feature from the tools on a new tab page. A [[Wireshark]] session demonstrates the level of chatter created by these features.<br />
<br />
== Appearance ==<br />
=== Fonts ===<br />
See the main article: [[Font configuration]]<br />
<br />
==== Configure the DPI value ====<br />
Modifying the following value can help improve the way fonts looks in Firefox if the system's DPI is below 96. Firefox, by default, uses 96 and only uses the system's DPI if it is a higher value. To force the system's DPI regardless of its value, type {{ic|about:config}} into the address bar and set {{ic|layout.css.dpi}} to '''0'''.<br />
<br />
Note that the above method only affects the Firefox user interface's DPI settings. Web page contents still use a DPI value of 96, which may look ugly or, in the case of high-resolution displays, may be rendered too small to read. A solution is to change {{ic|layout.css.devPixelsPerPx}} to system's DPI divided by 96. For example, if your system's DPI is 144, then the value to add is 144/96 = 1.5. Changing {{ic|layout.css.devPixelsPerPx}} to '''1.5''' makes web page contents use a DPI of 144, which looks much better.<br />
<br />
See also [[HiDPI#Firefox]] for information about HiDPI displays.<br />
<br />
==== Default font settings from Microsoft Windows ====<br />
Below are the default font preferences when Firefox is installed in Microsoft Windows. Many web sites use the Microsoft fonts.<br />
{{bc|<br />
Proportional: Serif Size (pixels): 16<br />
Serif: Times New Roman<br />
Sans-serif: Arial<br />
Monospace: Courier New Size (pixels): 13<br />
}}<br />
<br />
=== General user interface CSS settings ===<br />
Firefox's user interface can be modified by editing the {{ic|userChrome.css}} and {{ic|userContent.css}} files in {{ic|~/.mozilla/firefox/<profile_dir>/chrome/}} (''profile_dir'' is of the form ''hash.name'', where the ''hash'' is an 8 character, seemingly random string and the profile ''name'' is usually ''default'').<br />
<br />
{{Note|The {{ic|chrome/}} folder and {{ic|userChrome.css}}/{{ic|userContent.css}} files may not necessarily exist, so they may need to be created.}}<br />
<br />
This section only deals with the {{ic|userChrome.css}} file which modifies Firefox's user interface, and not web pages.<br />
<br />
==== Change the font ====<br />
The setting effectively overrides the global GTK+ font preferences, and does not affect webpages, only the user interface itself:<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<br />
* {<br />
font-family: "FONT_NAME";<br />
}<br />
}}<br />
<br />
==== Hide button icons ====<br />
Enables text-only buttons:<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<br />
.button-box .button-icon {<br />
display: none;<br />
}<br />
}}<br />
<br />
==== Hiding various tab buttons ====<br />
These settings hide the arrows that appear to the horizontal edges of the tab bar, the button that toggles the "all tabs" drop-down list, and the plus sign button that creates a new tab.<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<nowiki><br />
/* Tab bar */<br />
<br />
.tabbrowser-strip *[class^="scrollbutton"] {<br />
/* Hide tab scroll buttons */<br />
display: none;<br />
}<br />
<br />
.tabbrowser-strip *[class^="tabs-alltabs"] {<br />
/* Hide tab drop-down list */<br />
display: none;<br />
}<br />
<br />
.tabbrowser-strip *[class^="tabs-newtab-button"] {<br />
/* Hide new-tab button */<br />
display: none;<br />
}</nowiki><br />
}}<br />
<br />
==== Horizontal tabs ====<br />
To place the tab bar horizontally stacked along the sides of the browser window:<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<br />
/* Display the tabbar on the left */<br />
#content > tabbox {<br />
-moz-box-orient: horizontal;<br />
}<br />
<br />
.tabbrowser-strip {<br />
-moz-box-orient: vertical;<br />
/*<br />
* You can set this to -moz-scrollbars-vertical instead,<br />
* but then the scrollbar will *always* be visible. this way<br />
* there is never a scrollbar, so it behaves like the tab bar<br />
* normally does<br />
*/<br />
overflow: -moz-scrollbars-none;<br />
}<br />
<br />
.tabbrowser-tabs {<br />
-moz-box-orient: horizontal;<br />
min-width: 20ex; /* You may want to increase this value */<br />
-mox-box-pack: start;<br />
-moz-box-align: start;<br />
}<br />
<br />
.tabbrowser-tabs > hbox {<br />
-moz-box-orient: vertical;<br />
-moz-box-align: stretch;<br />
-moz-box-pack: start;<br />
}<br />
<br />
.tabbrowser-tabs > hbox > tab {<br />
-moz-box-align: start;<br />
-moz-box-orient: horizontal;<br />
}<br />
}}<br />
<br />
==== Hide window border and title bar ====<br />
Install the [https://addons.mozilla.org/en-US/firefox/addon/hide-caption-titlebar-plus-sma/ Hide Caption Titlebar Plus] extension and set the following settings (leaving other settings to default):<br />
{| class="wikitable"<br />
! Option<br />
! Value<br />
|-<br />
| Show Custom Caption/TitleBar<br />
| Never<br />
|-<br />
| Activate custom borders and corner resizers<br />
| Deactivate<br />
|-<br />
| Enable Customizable Buttons (min,max,close)<br />
| Using a Glass-like window background<br />
|-<br />
| Custom Minimize, Max, Close Buttons<br />
| Auto. Current theme's skin (fixed position)<br />
|-<br />
| Drag Fx window using Tab-bar background<br />
| Enable<br />
|-<br />
| Alternative hide-titlebar feature<br />
| Use<br />
|}<br />
<br />
The extension [https://addons.mozilla.org/nl/firefox/addon/classicthemerestorer/ Classic Theme Restorer] provides more tweaking options to get the best result (e.g. set tab height to 28px, enable/disable toolbars/buttons, etc.).<br />
<br />
==== Auto-hide Bookmarks Toolbar ====<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<br />
#PersonalToolbar {<br />
visibility: collapse !important;<br />
}<br />
<br />
#navigator-toolbox:hover > #PersonalToolbar {<br />
visibility: visible !important;<br />
}<br />
}}<br />
<br />
==== Remove sidebar width restrictions ====<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userChrome.css|<br />
/* remove maximum/minimum width restriction of sidebar */<br />
#sidebar {<br />
max-width: none !important;<br />
min-width: 0px !important;<br />
}<br />
}}<br />
<br />
=== Web content CSS settings ===<br />
This section deals with the {{ic|userContent.css}} file in which you can add custom CSS rules for web content. Changes to this file will take effect once the browser is restarted.<br />
<br />
This file can be used for making small fixes or to apply personal styles to frequently visited websites. Custom stylesheets for popular websites are available from sources such as [http://userstyles.org/ userstyles.org]. You can install an add-on such as [https://addons.mozilla.org/en-US/firefox/addon/superusercontent/ superUserContent] to manage themes. This add-on creates the directory {{ic|chrome/userContent.css.d}} and applies changes to the CSS files therein when the page is refreshed.<br />
<br />
==== Import other CSS files ==== <br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userContent.css|<br />
@import url("./imports/some_file.css");<br />
}}<br />
<br />
==== Block certain parts of a domain ====<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userContent.css|<br />
@-moz-document domain(example.com) {<br />
div#header {<br />
background-image: none !important;<br />
} <br />
}<br />
}}<br />
<br />
==== Add [pdf] after links to PDF files ====<br />
{{hc|~/.mozilla/firefox/<profile_dir>/chrome/userContent.css|<nowiki><br />
/* add '[pdf]' next to links to PDF files */<br />
a[href$=".pdf"]:after {<br />
font-size: smaller;<br />
content: " [pdf]";<br />
}</nowiki><br />
}}<br />
<br />
==== Firefox 4 New Menu Bar/Firefox Button ====<br />
To toggle between the new Firefox button and the classic menu bar:<br />
* if the button is active, check ''Preferences > Menu Bar'', or right click in the toolbar area and check ''Menu Bar''.<br />
* if the menu bar is active, uncheck ''View > Toolbars > Menu Bar'', or right click in the toolbar area and uncheck ''Menu Bar''.<br />
<br />
In GNU/Linux, you will just get a plain grey button instead of the new orange one from Windows. However you can change this to either a Firefox icon or the icon followed by the "Firefox" text.<br />
<br />
Adding the following to your {{ic|~/.mozilla/firefox/userprofile/chrome/userChrome.css}} file will place the icon before the text:<br />
{{bc|<br />
#appmenu-toolbar-button {<br />
list-style-image: url("chrome://branding/content/icon16.png");<br />
}<br />
}}<br />
<br />
Adding the following to the same file will ''remove'' the "Firefox" text:<br />
{{bc|<br />
#appmenu-toolbar-button > .toolbarbutton-text,<br />
#appmenu-toolbar-button > .toolbarbutton-menu-dropmarker {<br />
display: none !important;<br />
}<br />
}}<br />
<br />
This userChrome.css configuration copies the default Windows Firefox 4+ look and adds an orange background to the button, with a purple background in Private Browsing mode:<br />
{{bc|<br />
#main-window:not([privatebrowsingmode]) #appmenu-toolbar-button {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(34,85%,60%), hsl(26,72%,53%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
<br />
#main-window:not([privatebrowsingmode]) #appmenu-toolbar-button:hover:not(:active):not([open]) {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(26,72%,53%), hsl(34,85%,60%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
<br />
<br />
#main-window:not([privatebrowsingmode]) #appmenu-toolbar-button:hover:active,<br />
#main-window:not([privatebrowsingmode]) #appmenu-toolbar-button[open] {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(26,72%,53%), hsl(26,72%,53%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
<br />
#appmenu-toolbar-button {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(279,70%,46%), hsl(276,75%,38%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
<br />
<br />
#main-window #appmenu-toolbar-button:hover:not(:active):not([open]) {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(276,75%,38%), hsl(279,70%,46%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
<br />
<br />
#main-window #appmenu-toolbar-button:hover:active,<br />
#main-window #appmenu-toolbar-button[open] {<br />
-moz-appearance: none !important;<br />
color: #FEEDFC !important;<br />
background: -moz-linear-gradient(hsl(276,75%,38%), hsl(276,75%,38%) 95%) !important;<br />
border: 1px solid #000000 !important;<br />
}<br />
}}<br />
<br />
{{Note|You need to create both the {{ic|chrome}} directory and {{ic|userChrome.css}}, if they do not already exist.}}<br />
<br />
==== Block ads ====<br />
<br />
See [http://www.floppymoose.com floppymoose.com] for an example of how to use {{ic|userContent.css}} as a basic ad-blocker.<br />
<br />
== Miscellaneous ==<br />
<br />
Other tips and tweaks.<br />
<br />
=== Enable additional media codecs ===<br />
<br />
{{Expansion|This section is not completed, there are many other variables related to Media Codecs in firefox.}}<br />
<br />
Before continuing, remember there is a reason some of these variables are not enabled by default, e.g. stability, memory leaks, etc. Go to {{ic|about:config}} and check the following options:<br />
<br />
{| class="wikitable"<br />
|+ Suggested values<br />
! Key || Value || Description<br />
|-<br />
| media.mediasource.enabled || true (default) || Enable [[wikipedia:Media_Source_Extensions|Media Source Extensions]] (MSE)<br />
|-<br />
| media.mediasource.mp4.enabled || true (default) || Enable [[wikipedia:MPEG-4_Part_14|MP4]] MSE<br />
|-<br />
| media.mediasource.webm.enabled || true (default) || Enable [[wikipedia:WebM|WebM]] MSE. If you use Youtube see [[#WebM and Youtube|WebM and Youtube]].<br />
|-<br />
| media.fragmented-mp4.exposed || true || Enable fragmented MP4 segments<br />
|-<br />
| media.fragmented-mp4.ffmpeg.enabled || true || Enable fragmented MP4 ffmpeg<br />
|-<br />
| media.mediasource.ignore_codecs || true || Enable H.264 MSE, amongst other things (This boolean key has to be created!)<br />
|}<br />
<br />
==== WebM and Youtube ====<br />
<br />
If WebM MSE is enabled when Youtube is set to use the HTML5 player by default, Youtube will use [[wikipedia:VP9|VP9]] video by default to save bandwidth. However, hardware acceleration is not available for VP9, if you want to use hardware acceleration with youtube video especially if you have less capable hardware consider setting {{ic|media.mediasource.webm.enabled}} to false to make youtube stream H.264 video for which hardware acceleration is widely available.<br />
<br />
To verify if WebM (VP9) is enabled go to [https://youtube.com/html5 youtube.com/html5]. If "MSE & WebM VP9" is not supported, youtube will use H264.<br />
<br />
=== Mouse wheel scroll speed ===<br />
<br />
To modify the default values (i.e. speed-up) of the mouse wheel scroll speed, go to {{ic|about:config}} and search for {{ic|mousewheel.acceleration}}. This will show the available options, modifying the following:<br />
<br />
* Set {{ic|mousewheel.acceleration.start}} to '''-1'''.<br />
* Set {{ic|mousewheel.acceleration.factor}} to the desired number (10 to 20 are common values).<br />
<br />
Alternatively you can install the [http://smoothwheel.mozdev.org/ SmoothWheel add-on].<br />
<br />
=== Change the order of search engines in the Firefox Search Bar ===<br />
<br />
To change the order search engines are displayed in:<br />
* Open the drop-down list of search engines and click ''Manage Search Engines...'' entry.<br />
* Highlight the engine you want to move and use ''Move Up'' or ''Move Down'' to move it. Alternatively, you can use drag-and-drop.<br />
<br />
=== How to open a *.doc automatically with Abiword or LibreOffice Writer ===<br />
<br />
Go to ''Preferences > Applications'' and search for ''Word Document'' (or ''Word 2007 Document'' for {{ic|*.docx}}). After finding it, click the drop-down list and select ''Use other...''. From there you have to specify the exact path to the Abiword or Writer executable (i.e.{{ic|/usr/bin/abiword}} or {{ic|/usr/bin/lowriter}}).<br />
<br />
=== "I'm Feeling Lucky" mode ===<br />
<br />
Some search engines have a "feeling lucky" feature. For example, Google has "I'm Feeling Lucky", and DuckDuckGo has "I'm Feeling Ducky".<br />
<br />
To activate them:<br />
# Type {{ic|about:config}} in the address bar.<br />
# Search for the string {{ic|keyword.url}}.<br />
# Modify its value (if any) to the URL of the search engine. <br />
<br />
For Google, set it to:<br />
{{bc|<nowiki>https://www.google.com/search?btnI=I%27m+Feeling+Lucky&q=</nowiki>}}<br />
For DuckDuckGo, set it to:<br />
{{bc|<nowiki>https://duckduckgo.com/?q=\</nowiki>}}<br />
<br />
=== Secure DNS with DNSSEC validator ===<br />
<br />
You can enable [[DNSSEC]] support for safer browsing.<br />
<br />
=== Adding magnet protocol association ===<br />
<br />
In {{ic|about:config}} set {{ic|network.protocol-handler.expose.magnet}} to '''false'''.<br />
<br />
The next time you open a magnet link, you will be prompted with a {{ic|Launch Application}} dialogue. From there simply select your chosen torrent client. This technique can also be used with other protocols.<br />
<br />
=== Adding magnet protocol association for kTorrent (KDE4) ===<br />
<br />
Create a user copy of {{ic|/usr/share/applications/kde4/ktorrent.desktop}} to {{ic|~/.local/share/applications/kde4/}}, and append to {{ic|1=Mimetype=}}<br />
<br />
x-scheme-handler/magnet<br />
<br />
Modify {{ic|~/.config/mimeapps.list}} and append:<br />
<br />
x-scheme-handler/magnet=kde4-ktorrent.desktop<br />
<br />
See [http://superuser.com/questions/44072/how-do-i-associate-magnet-links-with-ktorrent-in-firefox]<br />
<br />
=== Prevent accidental closing ===<br />
<br />
The [https://addons.mozilla.org/en-us/firefox/addon/disable-ctrl-q-shortcut/ Disable Ctrl-Q Shortcut] extension can be installed to prevent unwanted closing of the browser.<br />
<br />
An alternative is to add a rule in your window manager configuration file. For example in openbox add:<br />
<keybind key="C-q"><br />
<action name="Execute"><br />
<execute>false</execute><br />
</action><br />
</keybind><br />
in the ''<keyboard>'' section of your {{ic|rc.xml}} file.<br />
{{Note|This will be effective for every application used under a graphic server.}}<br />
<br />
=== Plugins do not work with latest version ===<br />
<br />
Due to Arch's bleeding edge nature, there can be some compatibility issues with plugins not working with the latest Firefox install (e.g. [http://5digits.org/pentadactyl/index Pentadactyl]). If possible, try installing the nightly/beta builds available, or see [[Downgrading packages]].<br />
<br />
[https://addons.mozilla.org/en-us/firefox/addon/checkcompatibility/?src=userprofile Disable Add-on Compatibility Checks] plugin should take care of spurious compatibility issues when the plugins get disabled, even though they work just fine with the new version.<br />
<br />
=== Jerky or choppy scrolling ===<br />
<br />
Scrolling in Firefox can feel "jerky" or "choppy". A post on [http://forums.mozillazine.org/viewtopic.php?f=8&t=2749475/ MozillaZine] gives settings that work on Gentoo, but reportedly work on Arch Linux as well: <br />
<br />
# Set {{ic|mousewheel.min_line_scroll_amount}} to 40<br />
# Set {{ic|general.smoothScroll}} and {{ic|general.smoothScroll.pages}} to '''false'''<br />
# Set {{ic|image.mem.min_discard_timeout_ms}} to something really large such as 2100000000 but no more than 2140000000. Above that number Firefox will not accept your entry and complain with the error code: "The text you entered is not a number." <br />
# Set {{ic|image.mem.max_decoded_image_kb}} to at least 512K<br />
<br />
Now scrolling should flow smoothly.<br />
<br />
=== WebRTC exposes LAN IP address ===<br />
<br />
{{warning|This method disables WebRTC.}}<br />
To prevent websites from getting your local IP address via [https://en.wikipedia.org/wiki/WebRTC WebRTC]'s peer-to-peer (and JavaScript), open {{ic|about:config}} and set {{ic|media.peerconnection.enabled}} to '''false''' (or use this [https://addons.mozilla.org/en-US/firefox/addon/happy-bonobo-disable-webrtc/ addon]).<br />
<br />
=== Run Firefox inside an nspawn container ===<br />
<br />
{{Move|systemd-nspawn|This is potentially useful for any browser, so... move back?}}<br />
<br />
To run as PID 1<br />
<br />
# systemd-nspawn --setenv=DISPLAY=:0 \<br />
--setenv=XAUTHORITY=~/.Xauthority \<br />
--bind-ro=$HOME/.Xauthority:/root/.Xauthority \<br />
--bind=/tmp/.X11-unix \<br />
-D ~/containers/firefox \<br />
firefox<br />
<br />
Else rather boot the container, with systemd ideally setting up your networking with [[systemd-networkd]]:<br />
<br />
# systemd-nspawn --bind-ro=$HOME/.Xauthority:/root/.Xauthority \<br />
--bind=/tmp/.X11-unix \<br />
-D ~/containers/firefox \<br />
--network-veth -b<br />
<br />
Once your container is booted, run the Xorg binary like so:<br />
<br />
# systemd-run -M firefox --setenv=DISPLAY=:0 firefox<br />
<br />
===Disable 1024-bit Diffie-Hellman primes===<br />
Following [https://freedom-to-tinker.com/blog/haldermanheninger/how-is-nsa-breaking-so-much-crypto/ recent research] it is likely that the NSA has been breaking 1024-bit Diffie-Hellman for some time now. To disable these switch the [https://www.eff.org/deeplinks/2015/10/how-to-protect-yourself-from-nsa-attacks-1024-bit-DH following] settings to '''false''' in {{ic|about:config}}: <br />
<br />
security.ssl3.dhe_rsa_aes_128_sha<br />
security.ssl3.dhe_rsa_aes_256_sha<br />
<br />
Then consider checking your SSL configuration at https://www.howsmyssl.com/.<br />
<br />
=== Show search matches in scroll bar ===<br />
<br />
This chrome feature can be achieved via [https://addons.mozilla.org/en-US/firefox/addon/findbar-tweak/?src=hp-dl-featured FindBar Tweak] extension.<br />
<br />
== See also ==<br />
<br />
* [http://kb.mozillazine.org/Knowledge_Base MozillaZine Wiki]<br />
* [http://kb.mozillazine.org/About:config_entries about:config Entries Explained]<br />
* [http://linuxtidbits.wordpress.com/2009/08/01/better-fox-cat-and-weasel/ Firefox touch-ups that might be desired]</div>I magnific0https://wiki.archlinux.org/index.php?title=Rxvt-unicode&diff=365118Rxvt-unicode2015-03-12T08:38:24Z<p>I magnific0: /* Scriptlets */ changed [$? -eq 2] to [ $? -eq 2 ], original gave urxvtc: line 4: [2: command not found</p>
<hr />
<div>[[Category:Terminal emulators]]<br />
{{DISPLAYTITLE:rxvt-unicode}}<br />
[[de:urxvt]]<br />
[[es:Rxvt-unicode]]<br />
[[fr:urxvt]]<br />
[[sr:Rxvt-unicode]]<br />
[http://software.schmorp.de/pkg/rxvt-unicode.html rxvt-unicode] is a highly customizable [[Wikipedia:Terminal emulator|terminal emulator]] forked from [[Wikipedia:Rxvt|rxvt]]. Commonly known as {{Ic|urxvt}}, rxvt-unicode can be [[daemon]]ized to run clients within a single [[Wikipedia:Process (computing)|process]] in order to minimize the use of system resources. Developed by Marc Lehmann, some of the more outstanding features of rxvt-unicode include international language support through [[Wikipedia:Unicode|Unicode]], the ability to display multiple font types and support for [[Wikipedia:Perl|Perl]] extensions.<br />
<br />
== Installation ==<br />
<br />
{{Pkg|rxvt-unicode}} is available in the [[official repositories]] and includes 256 color support.<br />
<br />
{{AUR|rxvt-unicode-patched}} is available in the [[AUR]] and includes a fix for the font width bug.<br />
<br />
== Configuration ==<br />
<br />
See the [http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.1.pod rxvt-unicode reference page] for the complete list of available setting and values.<br />
<br />
=== Creating ~/.Xresources ===<br />
<br />
The look, feel, and function of rxvt-unicode is controlled by command-line arguments and/or [[X resources]]. X resources can be set using {{ic|~/.Xresources}} and xrdb ({{Pkg|xorg-xrdb}}), see the [[X resources|wiki page]] for details.<br />
<br />
Append commented list of all rxvt resources to your {{ic|~/.Xresources}} file<br />
<br />
urxvt --help 2>&1| sed -n '/: /s/^ */! URxvt*/gp' >> ~/.Xresources<br />
<br />
Or for a commented list + helpful descriptions<br />
<br />
{{bc|<nowiki>TERM=rxvt-unicode-256color command man -Pcat urxvt | sed -n '/depth: b/,/^BA/p'|sed '$d'|sed '/^ [a-z]/s/^ */^/g'|sed -e :a -e 'N;s/\n/@@/g;ta;P;D'|sed 's,\^\([^@]\+\)@*[\t ]*\([^\^]\+\),! \2\n! URxvt*\1\n\n,g'|sed 's,@@\( \+\),\n\1,g'|sed 's,@*$,,g'|sed '/^[^!]/d'|tr -d "'\`" >> ~/.Xresources</nowiki>}}<br />
<br />
{{Note|Command-line arguments override, and take precedence over resource settings}}<br />
<br />
=== True transparency ===<br />
<br />
To use true transparency, you need to be using a [[window manager]] that supports compositing or a separate compositor.<br />
<br />
From the command-line:<br />
<br />
$ urxvt -depth 32 -bg rgba:3f00/3f00/3f00/dddd<br />
<br />
Using the configuration file:<br />
<br />
{{hc|~/.Xresources|<br />
URxvt.depth: 32<br />
URxvt.background: rgba:1111/1111/1111/dddd<br />
}}<br />
<br />
or<br />
<br />
{{hc|~/.Xresources|<br />
URxvt.depth: 32<br />
URxvt.background: [95]#000000<br />
}}<br />
<br />
where '95' is the opacity level in percentage and '#000000' is the background color.<br />
<br />
To use a color i.e. #302351 with the rgba:rrrr/gggg/bbbb/aaaa syntax it would be rgba:3000/2300/5100/ee00. "ee00" (the alpha value) to make it nicely transparent.<br />
<br />
{{Note|To make these settings universal for all forms of URxvt, you may add a wildcard. For example, {{ic|URxvt.depth}} would become {{ic|URxvt*.depth}}.}}<br />
<br />
=== Native transparency ===<br />
<br />
If there is no need for true transparency, or if compositing uses too many resources on your system, you can get transparency working in the following way:<br />
<br />
{{hc|~/.Xresources|<nowiki><br />
! Xresources file<br />
<br />
URxvt*.transparent: true<br />
! URxvt*.shading: 0 to 99 darkens, 101 to 200 lightens<br />
URxvt*.shading: 110<br />
</nowiki>}}<br />
<br />
Using the URxvt*background setting exemplified above instead of URxvt*.shading will also work.<br />
<br />
{{Note|Avoid using shading if you have a {{ic|URxvt.tintColor}} set. Use a different {{ic|tintColor}} instead.}}<br />
<br />
=== Scrollbar ===<br />
<br />
The look of the scrollbar can be chosen through this entry in {{ic|~/.Xresources}}:<br />
<br />
! scrollbar style - rxvt (default), plain (most compact), next, or xterm<br />
URxvt.scrollstyle: rxvt<br />
<br />
The scrollbar can also be completely deactivated like so:<br />
<br />
URxvt.scrollBar: false<br />
<br />
=== Scrollback position ===<br />
<br />
By default, when shell output appears the scrollback view will automatically jump to the bottom of the buffer to display new output. If in cases where you want to see previous output (e.g., compiler messages), set the following options in {{ic|~/.Xresources}}:<br />
<br />
! do not scroll with output<br />
URxvt*scrollTtyOutput: false<br />
<br />
! scroll in relation to buffer (with mouse scroll or Shift+Page Up)<br />
URxvt*scrollWithBuffer: true<br />
<br />
! scroll back to the bottom on keypress<br />
URxvt*scrollTtyKeypress: true<br />
<br />
=== Scrollback buffer in secondary screen ===<br />
<br />
When you scroll a pager in a ''secondary screen''(e.g. {{ic|less}} without the {{ic|'''-X'''}} option), it may be a good idea to disable the scrollback buffer to be able to scroll in the pager ''itself'', instead of the terminal's buffer: this is default and unchangeable behaviour in konsole and vte-based terminals.<br />
In urxvt, to disable the scrollback buffer for the ''secondary screen'':<br />
URxvt.secondaryScreen: 1<br />
URxvt.secondaryScroll: 0<br />
<br />
The above configuration works as expected except when scrolling with a mouse wheel. When you scroll a pager in the ''secondary screen'' with the mouse wheel - and there has been something in the scrollback buffer, instead of the pager itself - the scrollback buffer will be scrolled by the mouse wheel. To solve this issue, it is necessary to introduce a new option into rxvt-unicode[https://bbs.archlinux.org/viewtopic.php?id=132150]. A patched rxvt-unicode is available in AUR as {{aur|rxvt-unicode-better-wheel-scrolling}}. After installing it, add the following to the configuration file:<br />
URxvt.secondaryWheel: 1<br />
<br />
{{note|Please do not use this option with the [[#Scrollwheel_support|vtwheel]] perl extension, it will mess up.}}<br />
<br />
=== Font declaration methods ===<br />
<br />
URxvt.font: 9x15<br />
is the same as:<br />
URxvt.font: -misc-fixed-medium-r-normal--15-140-75-75-c-90-iso8859-1<br />
<br />
And, for the same font in bold:<br />
URxvt.font: 9x15bold<br />
is the same as:<br />
URxvt.font: -misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1<br />
<br />
The complete list of short names for X core fonts can be found in {{ic|/usr/share/fonts/misc/fonts.alias}} (there's also some fonts.alias files in some of the other subdirectories of {{ic|/usr/share/fonts/}}, but as they are packaged separately from the actual fonts, they may list fonts you do not actually have installed). It is worth noting that these short aliases select for ISO-8859-1 versions of the fonts rather than ISO-10646-1 (Unicode) versions, and 75 DPI rather than 100 DPI versions, so you're probably better off avoiding them and choosing fonts by their full long names instead.<br />
<br />
{{Note|The above paragraph is only for bitmap fonts. Other fonts can be used through Xft using the following format:}}<br />
URxvt.font: xft:monaco:size=10<br />
<br />
Or<br />
URxvt.font: xft:monaco:bold:size=10<br />
<br />
{{Note|If there is a hyphen(-) in an Xft font name, it must be escaped with backslash(\) twice. It's different from the usage of urxvt -fn option and the result that fc-list returns, where backslash present only once}}<br />
<br />
=== Set icon ===<br />
<br />
{{Note|Because of a bug report[https://bugs.archlinux.org/task/34862] complaining that the rxvt-unicode package had too many dependencies, you must now install the AUR package {{AUR|rxvt-unicode-pixbuf}} in order to use the icon option.}}<br />
<br />
By default URxvt does not feature a taskbar icon. However, this can be easily changed by adding the following line to {{ic|~/.Xresources}} and pointing to the desired icon:<br />
<br />
URxvt.iconFile: /usr/share/icons/Clarity/scalable/apps/terminal.svg<br />
<br />
=== Set as login shell ===<br />
<br />
This will cause the shell to be started as a login shell, like the option {{ic|-ls}}.<br />
URxvt*loginShell: true<br />
<br />
=== Use urxvt as application launcher ===<br />
<br />
urxvt can be used as a lightweight alternative to application launchers such as {{pkg|gmrun}}. Run urxvt with the following configuration to imitate look and behaviour of an application launcher or assign the command to a custom alias:<br />
<br />
$ urxvt -geometry 80x3 -name 'bashrun' -e sh -c "/bin/bash -i -t"<br />
<br />
=== Font spacing ===<br />
<br />
By default the distance between characters can feel too wide. It's controlled by this entry:<br />
<br />
{{hc|~/.Xresources|<nowiki><br />
URxvt.letterSpace: -1<br />
</nowiki>}}<br />
<br />
Here {{ic|-1}} decreases the spacing by one pixel, but can be adjusted as needed.<br />
<br />
== Perl extensions ==<br />
<br />
=== Clickable URLs ===<br />
<br />
You can make URLs in the terminal clickable using the matcher extension. For example, to open links in [[Firefox]] add the following to {{ic|.Xresources}}:<br />
<br />
URxvt.perl-ext-common: default,matcher<br />
URxvt.url-launcher: /usr/bin/firefox<br />
URxvt.matcher.button: 1<br />
<br />
Since rxvt-unicode 9.14, it's also possible to use matcher to open and list recent (currently limited to 10) URLs via keyboard:<br />
<br />
URxvt.keysym.C-Delete: perl:matcher:last<br />
URxvt.keysym.M-Delete: perl:matcher:list<br />
<br />
To color all matching text in a blue color for quickly finding links, use the following setting or any color in the form of #RRGGBB you like instead.<br />
<br />
URxvt.colorUL: #4682B4<br />
<br />
=== Yankable URLs (no mouse) ===<br />
In addition, you can select and open URLs in your web browser without using the mouse.<br />
Install the {{Pkg|urxvt-perls}} package from the [[official repositories]] and adjust your {{ic|.Xresources}} as necessary. An example is shown below:<br />
URxvt.perl-ext: default,url-select<br />
URxvt.keysym.M-u: perl:url-select:select_next<br />
URxvt.url-select.launcher: /usr/bin/xdg-open<br />
URxvt.url-select.underline: true<br />
<br />
{{Note|This extension replaces the Clickable URLs extension mentioned above, so {{Ic|matcher}} can be removed from the {{Ic|URxvt.perl-ext}} list.}}<br />
<br />
'''Key commands:'''<br />
{{Tip|To change {{ic|Alt+u}} to a more intuitive {{ic|Ctrl+i}}, replace {{ic|M-u}} by {{ic|C-i}} above.}}<br />
<br />
{| class="wikitable"<br />
! Key !! Description<br />
|-<br />
| Alt+u || Enter selection mode. The last URL on your screen will be selected. You can repeat {{ic|Alt+u}} to select the next upward URL.<br />
|-<br />
| k || Select next upward URL<br />
|-<br />
| j || Select next downward URL<br />
|-<br />
| Return || Open selected URL in browser and quit selection mode<br />
|-<br />
| o || Open selected URL in browser without quitting selection mode<br />
|-<br />
| y || Copy (yank) selected URL and quit selection mode<br />
|-<br />
| Esc || Cancel URL selection mode<br />
|}<br />
<br />
=== Simple tabs ===<br />
<br />
To add tabs to urxvt, add the following to your {{ic|~/.Xresources}}:<br />
URxvt.perl-ext-common: ...,tabbed,...<br />
<br />
To control tabs use:<br />
<br />
{| class="wikitable"<br />
! Key !! Description<br />
|-<br />
| Shift+Down || New tab<br />
|-<br />
| Shift+Left || Go to left tab<br />
|-<br />
| Shift+Right || Go to right tab<br />
|-<br />
| Ctrl+Left || Move tab to the left<br />
|-<br />
| Ctrl+Right || Move tab to the right<br />
|-<br />
| Ctrl+d || Close tab<br />
|}<br />
<br />
You can change the colors of tabs with the following:<br />
<br />
URxvt.tabbed.tabbar-fg: 2<br />
URxvt.tabbed.tabbar-bg: 0<br />
URxvt.tabbed.tab-fg: 3<br />
URxvt.tabbed.tab-bg: 0<br />
<br />
=== Advanced tab management ===<br />
<br />
Install the {{AUR|urxvt-tabbedex}} package from [[AUR]], then add the {{ic|tabbedex}} value to the {{ic|URxvt.perl-ext-common}} X resource in your {{ic|~/.Xresources}}:<br />
URxvt.perl-ext-common: ...,tabbedex,...<br />
<br />
{{Note|If you have previously used the {{ic|tabbed}} Perl extension and have defined the {{ic|tabbed}} value for the {{ic|URxvt.perl-ext-common}} X resource, please remove the {{ic|tabbed}} value first to avoid conflict with {{ic|tabbedex}}.}}<br />
<br />
By default, the "[NEW]" button (which is rarely used and usable only with the mouse) is disabled with tabbedex. You can reenable this feature by setting the {{ic|new-button}} to yes.<br />
URxvt.tabbed.new-button: true<br />
<br />
Tabs can be named with {{ic|Shift+ ↑}} ({{ic|Enter}} to confirm, {{ic|Escape}} to cancel).<br />
<br />
To automatically hide the tabs bar when only one tab is present, enable the following resource:<br />
URxvt.tabbed.autohide: true<br />
<br />
To prevent the last tab from closing Urxvt, enable the following resource:<br />
URXvt.tabbed.reopen-on-close: yes<br />
<br />
To start a new tab or cycle through tabs, use the following user commands: {{ic|<nowiki>tabbedex:(new|next|prev)_tab</nowiki>}}. Example of mappings:<br />
URxvt.keysym.Control-t: perl:tabbedex:new_tab<br />
URxvt.keysym.Control-Tab: perl:tabbedex:next_tab<br />
URxvt.keysym.Control-Shift-Tab: perl:tabbedex:prev_tab<br />
<br />
To define your own key bindings to rename a tab or move a tab to the right or to the left, use the following commands: {{ic|<nowiki>tabbedex:move_tab_(left|right)</nowiki>}} and {{ic|tabbedex:rename_tab}}. Example of mappings:<br />
URxvt.keysym.Control-Shift-Left: perl:tabbedex:move_tab_left<br />
URxvt.keysym.Control-Shift-Right: perl:tabbedex:move_tab_right<br />
URxvt.keysym.Control-Shift-R: perl:tabbedex:rename_tab<br />
<br />
{{Note|Redefining the keys used for the user commands will not disable the default mappings, you have to set the X resource {{ic|no-tabbedex-keys}} for that:<br />
URxvt.tabbed.no-tabbedex-keys: true<br />
}}<br />
<br />
=== Fullscreen ===<br />
<br />
You can install the [[AUR]] package {{AUR|urxvt-fullscreen}}, and then set a key binding to put urxvt fullscreen.<br />
<br />
{{hc|~/.Xresources|<br />
...<br />
URxvt.perl-ext-common: ..., fullscreen, ...<br />
URxvt.keysym.F11: perl:fullscreen:switch<br />
...<br />
}}<br />
<br />
=== Scrollwheel support ===<br />
<br />
Install {{AUR|urxvt-vtwheel}} from the [[AUR]] and add it to your Perl extensions within {{ic|~/.Xresources}}:<br />
<br />
URxvt.perl-ext-common: ...,vtwheel,...<br />
<br />
=== Changing font size on the fly ===<br />
<br />
Install {{AUR|urxvt-font-size-git}} from the [[AUR]], add it to your Perl extensions within {{ic|~/.Xresources}}<br />
<br />
URxvt.perl-ext-common: ...,font-size,...<br />
<br />
and add some key bindings, for example like this:<br />
<br />
URxvt.keysym.C-Up: perl:font-size:increase<br />
URxvt.keysym.C-Down: perl:font-size:decrease<br />
URxvt.keysym.C-S-Up: perl:font-size:incglobal<br />
URxvt.keysym.C-S-Down: perl:font-size:decglobal<br />
<br />
For the suggested Ctrl+Shift bindings to work, a default binding needs to be disabled (see discussion [http://wilmer.gaa.st/blog/archives/36-rxvt-unicode-and-ISO-14755-mode.html here]):<br />
<br />
URxvt.iso14755: false<br />
URxvt.iso14755_52: false<br />
<br />
=== Disabling Perl extensions ===<br />
<br />
If you do not use the Perl extension features, you can improve the security and speed by disabling Perl extensions completely.<br />
URxvt.perl-ext:<br />
URxvt.perl-ext-common:<br />
<br />
== Colors ==<br />
<br />
By default, rxvt-unicode is compiled with color support. In addition to the default foreground and background colors, rxvt can display up to 256 colors (plus high-intensity bold/blinking/underlined and any mix of these).<br />
The look, feel, and function of rxvt-unicode is controlled by command-line arguments called X resources.<br />
<br />
A sample ~/.Xresoures with for a urxvt terminal with default colors but white fonts on a black background would be written as follow:<br />
<br />
{{hc|~/.Xresources|2=<br />
! Background color<br />
URxvt*background: black<br />
<br />
! Font color<br />
URxvt*foreground: white<br />
<br />
! Other colors<br />
URxvt*color0: black<br />
URxvt*color1: red3<br />
URxvt*color2: green3<br />
URxvt*color3: yellow3<br />
URxvt*color4: blue2<br />
URxvt*color5: magenta3<br />
URxvt*color6: cyan3<br />
URxvt*color7: gray90<br />
URxvt*color8: grey50<br />
URxvt*color9: red<br />
URxvt*color10: green<br />
URxvt*color11: yellow<br />
URxvt*color12: blue<br />
URxvt*color13: magenta<br />
URxvt*color14: cyan<br />
URxvt*color15: white<br />
}}<br />
<br />
It is also possible to specify the color values of foreground, background, cursorColor, cursorColor2, colorBD, colorUL as a number 0-15, as a convenient shorthand to reference the color name of color0-color15. See [[#Creating ~/.Xresources|Creating ~/.Xresources]] to create a commented {{ic|~/.Xresources}} file for {{ic|urxvt}}<br />
<br />
==== Xterm-like colors ====<br />
<br />
By default {{ic|urxvt}} uses the same colors as {{ic|xterm}} use except one. Add the following line at the end of your {{ic|~/.Xresources}} for xterm-like colors:<br />
{{hc|~/.Xresources|2=<br />
...<br />
URxvt*color12: rgb:5c/5c/ff<br />
}}<br />
then merge it contents with your current X resources configuration with:<br />
xrdb -merge ~/.Xresources<br />
and finally restart {{ic|urxvt}}.<br />
<br />
== Improving performance ==<br />
<br />
* Avoid the use of Xft fonts. If Xft fonts must be used, append {{Ic|<nowiki>:antialias=false</nowiki>}} to the setting value.[http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod#Can_I_speed_up_Xft_rendering_somehow]<br />
* Build rxvt-unicode with disabled support for unnecessary features, {{Ic|--disable-xft}} and {{Ic|--disable-unicode3}} in particular.<sup>[http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod#Rxvt_unicode_uses_gobs_of_memory_how]<br />
* Limit the number of {{Ic|saveLines}} (option {{Ic|-sl}}) in the scrollback buffer to reduce memory usage. [http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod#Isn_t_rxvt_unicode_supposed_to_be_sm]<br />
** Use tmux for scrollback buffer and set saveLines to 0<br />
* [[#Disabling Perl extensions|Disable perl]]<br />
* Consider running {{Ic|urxvtd}} as a daemon accepting connections from {{Ic|urxvtc}} clients.<br />
<br />
=== Daemon-client ===<br />
<br />
==== Xinitrc ====<br />
<br />
See the ''Examples'' section in {{ic|man urxvtd}}. This is the preferred option.<br />
<br />
==== systemd ====<br />
<br />
{{Note|Regular users cannot execute systemctl power commands (reboot, poweroff, etc) when logged in to a urxvt client/daemon setup which is started through systemd, as the client is not part of the [[session]]. For this reason starting urxvt through systemd is discouraged.}}<br />
<br />
System service:<br />
<br />
{{hc|/etc/systemd/system/urxvtd@.service|<nowiki><br />
[Unit]<br />
Description=RXVT-Unicode Daemon<br />
<br />
[Service]<br />
User=%i<br />
ExecStart=/usr/bin/urxvtd -q -o<br />
<br />
[Install]<br />
WantedBy=multi-user.target<br />
</nowiki>}}<br />
<br />
Pass the username when [[Systemd#Units|starting the service]]:<br />
<br />
urxvtd@''username''.service<br />
<br />
For a [[systemd/User]] service, place the following unit files in {{ic|~/.config/systemd/user}}:<br />
<br />
{{hc|urxvtd.service|<nowiki><br />
[Unit]<br />
Description=Urxvt Terminal Daemon<br />
Requires=urxvtd.socket<br />
<br />
[Service]<br />
ExecStart=/usr/bin/urxvtd -o -q<br />
Environment=RXVT_SOCKET=%t/urxvtd-%H<br />
<br />
[Install]<br />
WantedBy=</nowiki>''MyTarget''.target<br />
}}<br />
<br />
{{hc|urxvtd.socket|<nowiki><br />
[Unit]<br />
Description=urxvt daemon (socket activation)<br />
Documentation=man:urxvtd(1) man:urxvt(1)<br />
<br />
[Socket]<br />
ListenStream=%t/urxvtd-%H<br />
<br />
[Install]<br />
WantedBy=sockets.target<br />
</nowiki>}}<br />
<br />
== Cut and paste ==<br />
<br />
{{Note|With the use of a VDT multiplexer, urxvt (or any VDT emulator) {{Ic|CLIPBOARD}} integration will not be effective, since it will not be possible to select all of the desired text in a straightforward fashion or at all, in some cases (e.g., when the active multiplexed terminal is changed to another one and then back to the original one, and one selects text beyond what is visible, which causes text from the other terminal to be displayed). Obviously this is due to the fact that the VDT emulator lacks the ability to distinguish between multiplexed terminals. Therefore, it would be effectively redundant for one who always uses a VDT multiplexer capable of maintaining a scrollback buffer and integrating with {{Ic|CLIPBOARD}} (e.g., [[tmux]] with [[tmux#ICCCM Selection Integration|customized key bindings]]) to integrate {{Ic|CLIPBOARD}} with urxvt.}}<br />
<br />
For users unfamiliar with [[Xorg]] data transfer methods, the exchange of information to and from rxvt-unicode can become a burden. Suffice to say that rxvt-unicode uses cut buffers which are typically loaded into the current {{Ic|PRIMARY}} selection by default. [http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.1.pod#THE_SELECTION_SELECTING_AND_PASTING_] Users are urged to review [[Wikipedia:X Window selection]] for additional information.<br />
<br />
==== Default key bindings ====<br />
<br />
Default X key bindings will still work for copying and pasting. After selecting the text Ctrl+Insert or Ctrl+Alt+C can be used to copy and Shift+Insert or Ctrl+Alt+V to paste.<br />
<br />
==== Custom key bindings ====<br />
<br />
{{Accuracy|This is misleading as it doesn't ''change'' the standard keybindings ({{ic|Ctrl+Alt+C/V}}), it merely ''adds'' new ones. Also no perl stuff is needed here.}}<br />
<br />
To enable copy/paste using Ctrl+Shift+c/Ctrl+Shift+v, or similar, you'll need to edit your .Xresources. First add the extension:<br />
{{bc|<br />
URxvt.perl-ext-common: default,clipboard<br />
}}<br />
<br />
Then disable iso14755:<br />
{{bc|<br />
URxvt.iso14755: False<br />
}}<br />
<br />
And bind the keys:<br />
{{bc|<br />
URxvt.keysym.Shift-Control-C: perl:clipboard:copy<br />
URxvt.keysym.Shift-Control-V: perl:clipboard:paste<br />
}}<br />
<br />
If using xsel (which is the default), use:<br />
{{bc|<br />
URxvt.clipboard.copycmd: xsel -ib<br />
URxvt.clipboard.pastecmd: xsel -ob<br />
}}<br />
<br />
These two settings can be changed for other clipboard managers such as xclip.<br />
<br />
==== Clipboard management ====<br />
<br />
See [[Clipboard#List of clipboard managers]]<br />
<br />
==== Automatic script management ====<br />
<br />
{{Note|Since version 9.20, {{Pkg|rxvt-unicode}} comes with a new {{ic|selection-to-clipboard}} extension that supersedes the scripts below. Enable it like any other extension.}}<br />
Skottish[https://bbs.archlinux.org/viewtopic.php?pid=506845#p506845] created a Perl script to automatically copy any selection in rxvt-unicode to the X clipboard. Save the following as {{ic|/usr/lib/urxvt/perl/clipboard}}:<br />
<br />
{{bc|<nowiki><br />
#! /usr/bin/perl<br />
<br />
sub on_sel_grab {<br />
my $query=quotemeta $_[0]->selection;<br />
$query=~ s/\n/\\n/g;<br />
$query=~ s/\r/\\r/g;<br />
system( "echo -en " . $query . " | xsel -i -b -p" );<br />
}<br />
</nowiki>}}<br />
<br />
Xyne has also created his own variation of Skottish's script named {{AUR|urxvt-clipboard}} which is available in the [[AUR]] that allows the user to paste the selection with {{ic|Ctrl+V}} instead of only with a middle mouse click:<br />
<br />
{{bc|<nowiki><br />
#! /usr/bin/perl<br />
<br />
sub on_sel_grab<br />
{<br />
my $query = $_[0]->selection;<br />
open (my $pipe,'|-','xsel -ib') or die;<br />
print $pipe $query;<br />
close $pipe;<br />
open (my $pipe,'|-','xsel -ip') or die;<br />
print $pipe $query;<br />
close $pipe;<br />
}<br />
</nowiki>}}<br />
<br />
It also requires {{Pkg|xsel}} and needs to be enabled in the {{Ic|*perl-ext-common}} or {{Ic|*perl-ext}} field in {{ic|~/.Xresources}}. For example:<br />
URxvt.perl-ext-common: default,clipboard<br />
<br />
The [[AUR]] package {{AUR|urxvt-perls-git}} is another option one can use. {{AUR|urxvt-perls-git}} includes the same functionality as {{AUR|urxvt-clipboard}}, in addition to the keyboard-select and url-select Perl extensions.<br />
<br />
== Improved Kuake-like behavior in Openbox ==<br />
<br />
This was originally posted on the forum by Xyne [https://bbs.archlinux.org/viewtopic.php?pid=550380], and it relies on the {{Pkg|xdotool}} found in the [[official repositories]].<br />
<br />
=== Scriptlets ===<br />
<br />
Save this scriptlet from the {{Ic|urxvtc}} man page somewhere on your system as {{ic|urxvtc}} (e.g., in {{ic|~/.config/openbox}}):<br />
<br />
{{bc|<br />
#!/bin/sh<br />
<br />
urxvtc "$@"<br />
if [ $? -eq 2 ]; then<br />
urxvtd -q -o -f<br />
urxvtc "$@"<br />
fi<br />
}}<br />
<br />
and save this one as {{ic|urxvtq}}:<br />
<br />
{{bc|<nowiki><br />
#!/bin/bash<br />
<br />
wid=$(xdotool search --classname urxvtq)<br />
if [ -z "$wid" ]; then<br />
/path/to/urxvtc -name urxvtq -geometry 80x28<br />
wid=$(xdotool search --classname urxvtq | head -1)<br />
xdotool windowfocus "$wid"<br />
xdotool key Control_L+l<br />
else<br />
if [ -z "$(xdotool search --onlyvisible --classname urxvtq 2>/dev/null)" ]; then<br />
xdotool windowmap "$wid"<br />
xdotool windowfocus "$wid"<br />
else<br />
xdotool windowunmap "$wid"<br />
fi<br />
fi<br />
</nowiki>}}<br />
<br />
A previous version of {{Pkg|xdotool}} introduced a bug which disabled recognition of visible windows and thus led some users to use the following scriptlet in place of the previous one. This is no longer necessary as of {{Pkg|xdotool}} >= 1.20100416.2809, but it has been left here for future reference.'<br />
<br />
{{bc|<nowiki><br />
#!/bin/bash<br />
<br />
wid=$(xprop -name urxvtq | grep 'WM_COMMAND' | awk -F ',' '{print $3}' | awk -F '"' '{print $2}')<br />
if [ -z "$wid" ]; then<br />
/path/to/urxvtc -name urxvtq -geometry 200x28<br />
wid=$(xprop -name urxvtq | grep 'WM_COMMAND' | awk -F ',' '{print $3}' | awk -F '"' '{print $2}')<br />
xdotool windowfocus "$wid"<br />
xdotool key Control_L+l<br />
else<br />
if [ -z "$(xprop -id "$wid" | grep 'window state: Normal' 2>/dev/null)" ]; then<br />
xdotool windowmap "$wid"<br />
xdotool windowfocus "$wid"<br />
else<br />
xdotool windowunmap "$wid"<br />
fi<br />
fi<br />
</nowiki>}}<br />
<br />
Make sure that you change {{Ic|/path/to/urxvtc}} to the actual path to the {{ic|urxvtc}} scriptlet that you saved above. We will be using {{ic|urxvtc}} to launch both regular instances of {{Ic|urxvt}} and the kuake-like instance.<br />
<br />
=== urxvtq with tabbing ===<br />
<br />
If you want to have tabs in your kuake-like {{ic|urxvtc}} (here called {{ic|urxvtq}}) just replace the third line in your {{ic|urxvtq}}:<br />
wid=$(xdotool search --name urxvtq)<br />
with:<br />
wid=$(xdotool search --name urxvtq | grep -m 1 "" )<br />
<br />
To activate tab support, you can either replace the fifth line of your {{ic|urxvtq}}:<br />
/path/to/urxvtc -name urxvtq -geometry 80x28<br />
with:<br />
/path/to/urxvtc -name urxvtq -pe tabbed -geometry 80x28<br />
or replace this line of your {{ic|~/.Xresources}} file:<br />
URxvt.perl-ext-common: default,matcher<br />
with<br />
URxvt.perl-ext-common: default,matcher,tabbed<br />
<br />
==== Tab control ====<br />
<br />
{| class="wikitable"<br />
! Key !! Description<br />
|-<br />
| Shift+Left || Switch to the tab left of the current one<br />
|-<br />
| Shift+Right || Switch to the tab right of the current one<br />
|-<br />
| Shift+Down || Create a new tab<br />
|}<br />
<br />
You can also use your mouse to switch the tabs by clicking the wished one and create a new tab by clicking on ''[NEW].\\''<br />
<br />
To close a tab just enter {{Ic|exit}} like you would to normally close a terminal.<br />
<br />
=== Openbox configuration ===<br />
<br />
Now add the following lines to the {{Ic|<applications>}} section of {{ic|~/.config/openbox/rc.xml}}:<br />
<br />
{{bc|1=<br />
<application name="urxvtq"><br />
<decor>no</decor><br />
<position force="yes"><br />
<x>center</x><br />
<y>0</y><br />
</position><br />
<desktop>all</desktop><br />
<layer>above</layer><br />
<skip_pager>yes</skip_pager><br />
<skip_taskbar>yes</skip_taskbar><br />
<maximized>Horizontal</maximized><br />
</application><br />
}}<br />
<br />
and add these lines to the {{Ic|<keyboard>}} section:<br />
<br />
{{bc|1=<br />
<keybind key="W-t"><br />
<action name="Execute"><br />
<command>/path/to/urxvtc</command><br />
</action><br />
</keybind><br />
<keybind key="W-grave"><br />
<action name="Execute"><br />
<execute>/path/to/urxvtq</execute><br />
</action><br />
</keybind><br />
}}<br />
<br />
Here too you need to change the {{Ic|/path/to/*}} lines to point to the scripts that you saved above. Save the file and then reconfigure Openbox. You should now be able to launch regular instances of urxvt with {{ic|Super+T}}, and toggle the kuake-like console with {{ic|Super+'''`'''}} (the grave key also known as the backtick).<br />
<br />
=== Further configuration ===<br />
<br />
The advantage of this configuration over the urxvt kuake Perl script is that Openbox provides more keybinding options such as modifier keys. The kuake script hijacks an entire physical key regardless of any modifier combination. Review the [http://icculus.org/openbox/index.php/Help:Bindings Openbox bindings documentation] for the full range or possibilities.<br />
<br />
The [http://icculus.org/openbox/index.php/Help:Applications Openbox per-app settings] can be used to further configure the behavior of the kuake-like console (e.g. screen position, layer, etc.). You may need to change the "geometry" parameter in the {{ic|urxvtq}} scriptlet to adjust the height of the console.<br />
<br />
=== Related scripts ===<br />
<br />
* hbekel has posted a generalized version of the {{ic|urxvtq}} [https://bbs.archlinux.org/viewtopic.php?pid=550380#p550380 here] which can be used to toggle any application using {{Pkg|xdotool}}.<br />
* http://www.jukie.net/~bart/blog/20070503013555 - A script for opening URLs with your keyboard instead of mouse with urxvt.<br />
<br />
== Troubleshooting ==<br />
<br />
=== ~/.Xresources is not being sourced ===<br />
<br />
In some cases where urxvt does not acknowledge {{ic|~/.Xresources}}, you may need to add {{ic|xrdb -merge ~/.Xresources}} to your {{ic|~/.xinitrc}} file. See [[X resources]] for more information.<br />
<br />
=== Transparency not working after upgrade to v9.09 ===<br />
<br />
The rxvt-unicode developers removed compatibility code for a lot of non standard wallpaper setters with this update. Using a non compatible wallpaper setter will break transparency support. Recommended wallpaper setters:<br />
<br />
* [[feh]]<br />
* hsetroot<br />
* esetroot<br />
<br />
To make true transparency work, make sure to comment URxvt.tintColor and URxvt.inheritPixmap.<br />
<br />
=== Remote hosts ===<br />
<br />
If you are logging into a remote host, you may encounter problems when running text-mode programs under rxvt-unicode. This can be fixed by installing {{Pkg|rxvt-unicode-terminfo}} on the remote host or by copying {{ic|/usr/share/terminfo/r/rxvt-unicode}} from your local machine to your host at {{ic|~/.terminfo/r/rxvt-unicode}}; same for rxvt-unicode-256color.<br />
<br />
Some remote systems do not change title automatically unless you specify TERM=xterm. To fix the issue add this line to .bashrc on the remote machine:<br />
<br />
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}:${PWD}\007"'<br />
<br />
=== Using rxvt-unicode as gmrun terminal ===<br />
<br />
Unlike some other terminals, urxvt expects the arguments to {{Ic|-e}} to be given separately, rather than grouped together with quotes. This causes trouble with gmrun, which assumes the opposite behavior. This can be worked around by putting an "eval" in front of gmrun's "Terminal" variable in {{ic|.gmrunrc}}:<br />
<br />
Terminal = eval urxvt<br />
TermExec = ${Terminal} -e<br />
<br />
(gmrun uses {{ic|/bin/sh}} to execute commands, so the "eval" is understood here.) The "eval" has the side-effect of "breaking up" the argument to {{Ic|-e}} in the same way that {{Ic|$@}} does in [[Bash]], making the command intelligible to urxvt.<br />
<br />
=== My numerical keypad acts weird and generates differing output? (e.g. in vim) ===<br />
<br />
Some Debian GNU/Linux users seem to have this problem, although no specific details were reported so far. It is possible that this is caused by the wrong TERM setting, although the details of whether and how this can happen are unknown, as TERM=rxvt should offer a compatible keymap. See the answer to the previous question, and please report if that helped.<br />
<br />
However, using the ''xmodmap'' program ({{Pkg|xorg-xmodmap}}), you can re-map your number pad keys back.<br />
<br />
1. Check the keycode that your numerical keypad (numpad) generates using {{ic|xev}} program.<br />
<br />
* Start the {{ic|xev}} program<br />
* Press your number pad keys and look for ''... keycode xxx ...'' in {{ic|xev}}'s output. For example, numpad 1 in my keyboard is also "End" key, that have a ''''keycode 87''''.<br />
<br />
2. Create or modify your xmodmap file, usually {{ic|~/.Xmodmap}}, with the content representing your keycode.<br />
<br />
Example of xmodmap file with number pad keycode:<br />
<br />
{{bc|1=<br />
keycode 63 = KP_Multiply<br />
keycode 79 = Home KP_7<br />
keycode 80 = Up KP_8<br />
keycode 81 = Prior KP_9<br />
keycode 82 = KP_Subtract<br />
keycode 83 = Left KP_4<br />
keycode 84 = KP_5<br />
keycode 85 = Right KP_6<br />
keycode 86 = KP_Add<br />
keycode 87 = End KP_1<br />
keycode 88 = Down KP_2<br />
keycode 89 = Next KP_3<br />
keycode 90 = Insert KP_0<br />
keycode 91 = Delete KP_Decimal<br />
keycode 112 = Prior<br />
keycode 117 = Next<br />
}}<br />
<br />
3. Load your xmodmap file at X session start-up.<br />
<br />
For example, in {{ic|~/.xinitrc}} file add:<br />
<br />
...<br />
xmodmap ~/.Xmodmap<br />
...<br />
<br />
=== Pseudo-tty ===<br />
<br />
The following error is likely caused by {{ic|/dev/pts}} having been mounted with the wrong options.<br />
<br />
urxvt: can't initialize pseudo-tty, aborting.<br />
<br />
Remove {{ic|/dev/pts}} from {{ic|/etc/fstab}} and fix the current mount options with:<br />
<br />
sudo mount -o remount,gid=5,mode=620 /dev/pts<br />
<br />
See also [https://mailman.archlinux.org/pipermail/arch-dev-public/2013-August/025332.html], {{bug|36548}}, and [https://bbs.archlinux.org/viewtopic.php?pid=1318127].<br />
<br />
=== Key combinations do not work ===<br />
<br />
See [http://vim.wikia.com/wiki/Get_Alt_key_to_work_in_terminal?useskin=monobook Get Alt key to work in terminal].<br />
<br />
=== Slow performance when drawing glyphs ===<br />
<br />
Some programs like alsamixer and xprop do not perform well with some graphics drivers and in consequence redraw very slowly. The option "skipBuiltinGlyphs" for {{ic|~/.Xresources}} or the command line option {{ic|-sbg}} may fix this. One possible solution is to add the following to {{ic|~/.Xresources}}:<br />
<br />
URxvt*skipBuiltinGlyphs: true<br />
<br />
== External resources ==<br />
<br />
* [http://software.schmorp.de/pkg/rxvt-unicode.html rxvt-unicode] - Official site<br />
* [http://cvs.schmorp.de/rxvt-unicode/ Source Code] - Browseable CVS<br />
* [http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.7.pod rxvt-unicode FAQ] - Official FAQ<br />
* [http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/doc/rxvt.1.pod rxvt-unicode Reference] - Official manual page<br />
* [http://pod.tst.eu/http://cvs.schmorp.de/rxvt-unicode/src/urxvt.pm urxvtperl] - Official Perl extension reference</div>I magnific0https://wiki.archlinux.org/index.php?title=PPTP_Client&diff=225268PPTP Client2012-09-26T15:53:30Z<p>I magnific0: /* Split Tunneling based on port by /etc/ppp/ip-up.d */</p>
<hr />
<div>[[Category:Virtual Private Network]]<br />
[[zh-CN:Microsoft VPN client setup with pptpclient]]<br />
pptpclient is a program implementing the Microsoft PPTP protocol. As such, it can be used to connect to a Microsoft VPN network (or any PPTP-based VPN) provided by a school or workplace.<br />
<br />
== Installing PPTP Client ==<br />
<br />
PPTP Client is provided by the {{Pkg|pptpclient}} package found in the [[Official Repositories|official repositories]].<br />
<br />
== Configure ==<br />
<br />
To configure pptpclient you will need to collect the following information from your network administrator:<br />
<br />
* The IP address or hostname of the VPN server<br />
* The name you wish to use for the tunnel.<br />
* The authentication (Windows) domain name. This is not provided or needed for certain networks.<br />
* The username you will use to connect.<br />
* The password you will use to connect.<br />
<br />
=== Edit The options.pptp File ===<br />
<br />
With your favorite text editor open {{ic|/etc/ppp/options.pptp}}. This file enables a lot of security for your VPN connection by default. If you have trouble connecting to your network, you can relax the options down. At a minimum, your {{ic|/etc/ppp/options.pptp}} file should contain:<br />
lock<br />
noauth<br />
nobsdcomp<br />
nodeflate<br />
<br />
=== Edit The chap-secrets File ===<br />
<br />
Next, open or create the {{ic|/etc/ppp/chap-secrets}} file. We will be storing your password in this file, so make sure that the permissions are set such that no-one besides root can read this file. <br />
chmod 0600 /etc/ppp/chap-secrets<br />
<br />
The file should have the following format:<br />
<DOMAIN>\\<USERNAME> PPTP <PASSWORD> *<br />
<br />
Or, if your connection does not require a domain:<br />
<USERNAME> PPTP <PASSWORD> *<br />
<br />
Simply replace each bracketed term in the examples with the appropriate value.<br />
<br />
{{Note|If your password contains a special character such as {{ic|$}} you should place the password in double quotation marks ({{ic|"}}).}}<br />
<br />
=== Name Your Tunnel ===<br />
<br />
With your favorite text editor create a {{ic|/etc/ppp/peers/<TUNNEL>}} file, where {{ic|<TUNNEL>}} is the name you wish to use for your VPN connection. The file should look like this:<br />
pty "pptp <SERVER> --nolaunchpppd"<br />
name <DOMAIN>\\<USERNAME><br />
remotename PPTP<br />
require-mppe-128<br />
file /etc/ppp/options.pptp<br />
ipparam <TUNNEL><br />
<br />
{{Note|As before, if your connection does not require a domain, omit {{ic|<DOMAIN>\\}} from the file you create}}<br />
<br />
{{Note|{{ic|remotename PPTP}} is used to find {{ic|<PASSWORD>}} in the {{ic|/etc/ppp/chap-secrets}} File.}}<br />
<br />
{{ic|<SERVER>}} is the remote address of the VPN server, {{ic|<DOMAIN>}} is the domain your user belongs to, {{ic|<USERNAME>}} is the name you will use to connect to the server, and {{ic|<TUNNEL>}} is the name of the connection.<br />
<br />
{{Note|If you do not need MPPE support, you should remove the {{ic|require-mppe-128}} option from this file and from {{ic|/etc/ppp/options.pptp}}}}<br />
<br />
== Making Your Connection ==<br />
<br />
To make sure that everything is configured properly, as root execute:<br />
# pon <TUNNEL> debug dump logfd 2 nodetach<br />
<br />
If everything has been configured correctly, the {{ic|pon}} command should not terminate. Once you are satisfied that it has connected successfully, you can terminate the command.<br />
<br />
{{Note|As an additional verification you can run {{ic|ip addr show}} and ensure that a new device, {{ic|ppp0}}, is available.}}<br />
<br />
To connect to your VPN normally, simply execute:<br />
# pon <TUNNEL><br />
<br />
Where {{ic|<TUNNEL>}} is the name of the tunnel you established earlier. Note that this command should be run as root.<br />
<br />
=== Routing ===<br />
<br />
Once you have connected to your VPN, you should be able to interact with anything available on the VPN server. To access anything on the remote network, you need to add a new route to your routing table.<br />
<br />
{{Note|Depending on your configuration, you may need to re-add the routing information every time you connect to your VPN.}}<br />
<br />
For more information on how to add routes, you can read this article which has many more examples: [http://pptpclient.sourceforge.net/routing.phtml PPTP Routing Howto]<br />
<br />
==== Split Tunneling ====<br />
<br />
Packets with a destination of your VPN's network should be routed through the VPN interface (usually {{ic|ppp0}}). To do this, you create the route:<br />
# ip route add 192.168.10.0/24 dev ppp0<br />
<br />
This will route all the traffic with a destination of 192.168.10.* through your VPN's interface, ({{ic|ppp0}}).<br />
<br />
==== Route All Traffic ====<br />
<br />
It may be desirable to route ''all'' traffic through your VPN connection. You can do this by running:<br />
# ip route add default dev ppp0<br />
<br />
{{Note|Routing all traffic through the VPN may result in slower over all connection speed because your traffic will be routed through the remote VPN before being routed normally.}}<br />
<br />
==== Route All Traffic by /etc/ppp/ip-up.d ====<br />
<br />
{{Note|All scripts in {{ic|/etc/ppp/ip-up.d/}} will called when the VPN connection is established.}}<br />
<br />
{{hc|/etc/ppp/ip-up.d/01-routes.sh|<nowiki><br />
#!/bin/bash<br />
<br />
# This script is called with the following arguments:<br />
# Arg Name<br />
# $1 Interface name<br />
# $2 The tty<br />
# $3 The link speed<br />
# $4 Local IP number<br />
# $5 Peer IP number<br />
# $6 Optional ``ipparam'' value foo<br />
<br />
route add default gw $4<br />
</nowiki>}}<br />
<br />
Make sure the script is executable.<br />
<br />
{{Note|This script currently uses {{Pkg|net-tools}} instead of {{Pkg|iproute2}} which the other examples use.}}<br />
<br />
==== Split Tunneling based on port by /etc/ppp/ip-up.d ====<br />
<br />
{{Note|All scripts in {{ic|/etc/ppp/ip-up.d/}} will called when the VPN connection is established.}}<br />
<br />
{{hc|/etc/ppp/ip-up.d/01-routebyport.sh|<nowiki><br />
#!/bin/bash<br />
<br />
# This script is called with the following arguments:<br />
# Arg Name<br />
# $1 Interface name<br />
# $2 The tty<br />
# $3 The link speed<br />
# $4 Local IP number<br />
# $5 Peer IP number<br />
# $6 Optional ``ipparam'' value foo<br />
<br />
echo 0 > /proc/sys/net/ipv4/conf/$1/rp_filter<br />
echo 1 > /proc/sys/net/ipv4/ip_forward<br />
echo 1 > /proc/sys/net/ipv4/ip_dynaddr<br />
<br />
ip route flush table vpn<br />
ip route add default via $5 dev $1 table vpn<br />
<br />
# forward only IRC ports over VPN<br />
iptables -t mangle -A OUTPUT -p tcp -m multiport --dports 6667,6697 -j MARK --set-mark 0x1<br />
iptables -t nat -A POSTROUTING -o $1 -j MASQUERADE<br />
<br />
ip rule add fwmark 0x1 pri 100 lookup vpn<br />
ip rule add from $4 pri 200 table vpn<br />
ip route flush cache<br />
</nowiki>}}<br />
<br />
Make sure the script is executable and that the vpn table is added to {{ic|/etc/iproute2/rt_tables}}<br />
<br />
201 vpn<br />
<br />
== Disconnecting ==<br />
<br />
To disconnect from your VPN simply execute:<br />
<br />
# poff <TUNNEL><br />
<br />
Where <TUNNEL> is the name of your connection.<br />
<br />
== Making A VPN Daemon and Connecting On Boot==<br />
<br />
You can create a simple daemon for your VPN connection by creating an appropriate {{ic|/etc/rc.d/*}} script:<br />
<br />
{{Note|As always, {{ic|<TUNNEL>}} is the name of your tunnel. {{ic|<ROUTING COMMAND>}} is the command you use to add the appropriate route to the routing table.}}<br />
<br />
{{Note|1=The ''stop'' functionality of this script '''will not work''' if the {{ic|updetach}} and {{ic|persist}} arguments are passed to {{ic|/usr/bin/pon}} when pon is started. The reason for this is that the {{ic|/usr/bin/poff}} script contains a bug when determining the PID of the specified {{ic|pppd}} process if arguments were passed to {{ic|pon}}.<br />
<br />
To resolve this issue, you can patch your {{ic|/usr/bin/poff}} file by making the following changes on line 93:<br />
{{bc|<nowiki>-PID=`ps axw | grep "[ /]pppd call $1 *\$" | awk '{print $1}'`<br />
+PID=`ps axw | grep "[ /]pppd call $1" | awk '{print $1}'`</nowiki>}}}}<br />
<br />
{{hc|/etc/rc.d/name-of-your-vpn|<nowiki><br />
#!/bin/bash<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
DAEMON=<TUNNEL>-vpn<br />
ARGS=<br />
<br />
[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON<br />
<br />
<br />
case "$1" in<br />
start)<br />
stat_busy "Starting $DAEMON"<br />
pon <TUNNEL> updetach persist &>/dev/null && <ROUTING COMMAND> &>/dev/null<br />
if [ $? = 0 ]; then<br />
add_daemon $DAEMON<br />
stat_done<br />
else<br />
stat_fail<br />
exit 1<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping $DAEMON"<br />
poff <TUNNEL> &>/dev/null<br />
if [ $? = 0 ]; then<br />
rm_daemon $DAEMON<br />
stat_done<br />
else<br />
stat_fail<br />
exit 1<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
sleep 1<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start|stop|restart}" <br />
esac<br />
</nowiki>}}<br />
<br />
{{Note|We call {{ic|pon}} in the script with two additional arguments: {{ic|updetach}} and {{ic|persist}}. The argument {{ic|updetach}} makes pon block until the connection has been established. The other argument, {{ic|persist}}, makes the network automatically reconnect in the event of a failure. To connect at boot add @<TUNNEL>-vpn to the end of your {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}.}}<br />
<br />
== Remarks ==<br />
<br />
You can find more information about configuring pptpclient at their website: [http://pptpclient.sourceforge.net/ pptpclient website]. The contents of this article where adapted from their Ubuntu How-To which also provides some hints on how to do things such as connecting on boot. These examples should be easy to adapt into daemons or other scripts to help automate your configuration.</div>I magnific0https://wiki.archlinux.org/index.php?title=PPTP_Client&diff=225267PPTP Client2012-09-26T15:52:45Z<p>I magnific0: /* Routing */</p>
<hr />
<div>[[Category:Virtual Private Network]]<br />
[[zh-CN:Microsoft VPN client setup with pptpclient]]<br />
pptpclient is a program implementing the Microsoft PPTP protocol. As such, it can be used to connect to a Microsoft VPN network (or any PPTP-based VPN) provided by a school or workplace.<br />
<br />
== Installing PPTP Client ==<br />
<br />
PPTP Client is provided by the {{Pkg|pptpclient}} package found in the [[Official Repositories|official repositories]].<br />
<br />
== Configure ==<br />
<br />
To configure pptpclient you will need to collect the following information from your network administrator:<br />
<br />
* The IP address or hostname of the VPN server<br />
* The name you wish to use for the tunnel.<br />
* The authentication (Windows) domain name. This is not provided or needed for certain networks.<br />
* The username you will use to connect.<br />
* The password you will use to connect.<br />
<br />
=== Edit The options.pptp File ===<br />
<br />
With your favorite text editor open {{ic|/etc/ppp/options.pptp}}. This file enables a lot of security for your VPN connection by default. If you have trouble connecting to your network, you can relax the options down. At a minimum, your {{ic|/etc/ppp/options.pptp}} file should contain:<br />
lock<br />
noauth<br />
nobsdcomp<br />
nodeflate<br />
<br />
=== Edit The chap-secrets File ===<br />
<br />
Next, open or create the {{ic|/etc/ppp/chap-secrets}} file. We will be storing your password in this file, so make sure that the permissions are set such that no-one besides root can read this file. <br />
chmod 0600 /etc/ppp/chap-secrets<br />
<br />
The file should have the following format:<br />
<DOMAIN>\\<USERNAME> PPTP <PASSWORD> *<br />
<br />
Or, if your connection does not require a domain:<br />
<USERNAME> PPTP <PASSWORD> *<br />
<br />
Simply replace each bracketed term in the examples with the appropriate value.<br />
<br />
{{Note|If your password contains a special character such as {{ic|$}} you should place the password in double quotation marks ({{ic|"}}).}}<br />
<br />
=== Name Your Tunnel ===<br />
<br />
With your favorite text editor create a {{ic|/etc/ppp/peers/<TUNNEL>}} file, where {{ic|<TUNNEL>}} is the name you wish to use for your VPN connection. The file should look like this:<br />
pty "pptp <SERVER> --nolaunchpppd"<br />
name <DOMAIN>\\<USERNAME><br />
remotename PPTP<br />
require-mppe-128<br />
file /etc/ppp/options.pptp<br />
ipparam <TUNNEL><br />
<br />
{{Note|As before, if your connection does not require a domain, omit {{ic|<DOMAIN>\\}} from the file you create}}<br />
<br />
{{Note|{{ic|remotename PPTP}} is used to find {{ic|<PASSWORD>}} in the {{ic|/etc/ppp/chap-secrets}} File.}}<br />
<br />
{{ic|<SERVER>}} is the remote address of the VPN server, {{ic|<DOMAIN>}} is the domain your user belongs to, {{ic|<USERNAME>}} is the name you will use to connect to the server, and {{ic|<TUNNEL>}} is the name of the connection.<br />
<br />
{{Note|If you do not need MPPE support, you should remove the {{ic|require-mppe-128}} option from this file and from {{ic|/etc/ppp/options.pptp}}}}<br />
<br />
== Making Your Connection ==<br />
<br />
To make sure that everything is configured properly, as root execute:<br />
# pon <TUNNEL> debug dump logfd 2 nodetach<br />
<br />
If everything has been configured correctly, the {{ic|pon}} command should not terminate. Once you are satisfied that it has connected successfully, you can terminate the command.<br />
<br />
{{Note|As an additional verification you can run {{ic|ip addr show}} and ensure that a new device, {{ic|ppp0}}, is available.}}<br />
<br />
To connect to your VPN normally, simply execute:<br />
# pon <TUNNEL><br />
<br />
Where {{ic|<TUNNEL>}} is the name of the tunnel you established earlier. Note that this command should be run as root.<br />
<br />
=== Routing ===<br />
<br />
Once you have connected to your VPN, you should be able to interact with anything available on the VPN server. To access anything on the remote network, you need to add a new route to your routing table.<br />
<br />
{{Note|Depending on your configuration, you may need to re-add the routing information every time you connect to your VPN.}}<br />
<br />
For more information on how to add routes, you can read this article which has many more examples: [http://pptpclient.sourceforge.net/routing.phtml PPTP Routing Howto]<br />
<br />
==== Split Tunneling ====<br />
<br />
Packets with a destination of your VPN's network should be routed through the VPN interface (usually {{ic|ppp0}}). To do this, you create the route:<br />
# ip route add 192.168.10.0/24 dev ppp0<br />
<br />
This will route all the traffic with a destination of 192.168.10.* through your VPN's interface, ({{ic|ppp0}}).<br />
<br />
==== Route All Traffic ====<br />
<br />
It may be desirable to route ''all'' traffic through your VPN connection. You can do this by running:<br />
# ip route add default dev ppp0<br />
<br />
{{Note|Routing all traffic through the VPN may result in slower over all connection speed because your traffic will be routed through the remote VPN before being routed normally.}}<br />
<br />
==== Route All Traffic by /etc/ppp/ip-up.d ====<br />
<br />
{{Note|All scripts in {{ic|/etc/ppp/ip-up.d/}} will called when the VPN connection is established.}}<br />
<br />
{{hc|/etc/ppp/ip-up.d/01-routes.sh|<nowiki><br />
#!/bin/bash<br />
<br />
# This script is called with the following arguments:<br />
# Arg Name<br />
# $1 Interface name<br />
# $2 The tty<br />
# $3 The link speed<br />
# $4 Local IP number<br />
# $5 Peer IP number<br />
# $6 Optional ``ipparam'' value foo<br />
<br />
route add default gw $4<br />
</nowiki>}}<br />
<br />
Make sure the script is executable.<br />
<br />
{{Note|This script currently uses {{Pkg|net-tools}} instead of {{Pkg|iproute2}} which the other examples use.}}<br />
<br />
==== Split Tunneling based on port by /etc/ppp/ip-up.d ====<br />
<br />
{{Note|All scripts in {{ic|/etc/ppp/ip-up.d/}} will called when the VPN connection is established.}}<br />
<br />
{{hc|/etc/ppp/ip-up.d/01-routebyport.sh|<nowiki><br />
#!/bin/bash<br />
<br />
# This script is called with the following arguments:<br />
# Arg Name<br />
# $1 Interface name<br />
# $2 The tty<br />
# $3 The link speed<br />
# $4 Local IP number<br />
# $5 Peer IP number<br />
# $6 Optional ``ipparam'' value foo<br />
<br />
echo 0 > /proc/sys/net/ipv4/conf/$1/rp_filter<br />
echo 1 > /proc/sys/net/ipv4/ip_forward<br />
echo 1 > /proc/sys/net/ipv4/ip_dynaddr<br />
<br />
ip route flush table vpn<br />
ip route add default via $5 dev $1 table vpn<br />
iptables -t mangle -A OUTPUT -p tcp -m multiport --dports 6667,6697 -j MARK --set-mark 0x1<br />
iptables -t nat -A POSTROUTING -o $1 -j MASQUERADE<br />
ip rule add fwmark 0x1 pri 100 lookup vpn<br />
ip rule add from $4 pri 200 table vpn<br />
ip route flush cache<br />
</nowiki>}}<br />
<br />
Make sure the script is executable and that the vpn table is added to {{ic|/etc/iproute2/rt_tables}}<br />
<br />
201 vpn<br />
<br />
== Disconnecting ==<br />
<br />
To disconnect from your VPN simply execute:<br />
<br />
# poff <TUNNEL><br />
<br />
Where <TUNNEL> is the name of your connection.<br />
<br />
== Making A VPN Daemon and Connecting On Boot==<br />
<br />
You can create a simple daemon for your VPN connection by creating an appropriate {{ic|/etc/rc.d/*}} script:<br />
<br />
{{Note|As always, {{ic|<TUNNEL>}} is the name of your tunnel. {{ic|<ROUTING COMMAND>}} is the command you use to add the appropriate route to the routing table.}}<br />
<br />
{{Note|1=The ''stop'' functionality of this script '''will not work''' if the {{ic|updetach}} and {{ic|persist}} arguments are passed to {{ic|/usr/bin/pon}} when pon is started. The reason for this is that the {{ic|/usr/bin/poff}} script contains a bug when determining the PID of the specified {{ic|pppd}} process if arguments were passed to {{ic|pon}}.<br />
<br />
To resolve this issue, you can patch your {{ic|/usr/bin/poff}} file by making the following changes on line 93:<br />
{{bc|<nowiki>-PID=`ps axw | grep "[ /]pppd call $1 *\$" | awk '{print $1}'`<br />
+PID=`ps axw | grep "[ /]pppd call $1" | awk '{print $1}'`</nowiki>}}}}<br />
<br />
{{hc|/etc/rc.d/name-of-your-vpn|<nowiki><br />
#!/bin/bash<br />
<br />
. /etc/rc.conf<br />
. /etc/rc.d/functions<br />
<br />
DAEMON=<TUNNEL>-vpn<br />
ARGS=<br />
<br />
[ -r /etc/conf.d/$DAEMON ] && . /etc/conf.d/$DAEMON<br />
<br />
<br />
case "$1" in<br />
start)<br />
stat_busy "Starting $DAEMON"<br />
pon <TUNNEL> updetach persist &>/dev/null && <ROUTING COMMAND> &>/dev/null<br />
if [ $? = 0 ]; then<br />
add_daemon $DAEMON<br />
stat_done<br />
else<br />
stat_fail<br />
exit 1<br />
fi<br />
;;<br />
stop)<br />
stat_busy "Stopping $DAEMON"<br />
poff <TUNNEL> &>/dev/null<br />
if [ $? = 0 ]; then<br />
rm_daemon $DAEMON<br />
stat_done<br />
else<br />
stat_fail<br />
exit 1<br />
fi<br />
;;<br />
restart)<br />
$0 stop<br />
sleep 1<br />
$0 start<br />
;;<br />
*)<br />
echo "usage: $0 {start|stop|restart}" <br />
esac<br />
</nowiki>}}<br />
<br />
{{Note|We call {{ic|pon}} in the script with two additional arguments: {{ic|updetach}} and {{ic|persist}}. The argument {{ic|updetach}} makes pon block until the connection has been established. The other argument, {{ic|persist}}, makes the network automatically reconnect in the event of a failure. To connect at boot add @<TUNNEL>-vpn to the end of your {{ic|DAEMONS}} array in {{ic|/etc/rc.conf}}.}}<br />
<br />
== Remarks ==<br />
<br />
You can find more information about configuring pptpclient at their website: [http://pptpclient.sourceforge.net/ pptpclient website]. The contents of this article where adapted from their Ubuntu How-To which also provides some hints on how to do things such as connecting on boot. These examples should be easy to adapt into daemons or other scripts to help automate your configuration.</div>I magnific0https://wiki.archlinux.org/index.php?title=X_resources&diff=223549X resources2012-09-17T05:23:04Z<p>I magnific0: /* Script #4 */</p>
<hr />
<div>[[de:Xdefaults]]<br />
[[ru:X resources]]<br />
[[Category:Dotfiles]]<br />
[[Category:X Server]]<br />
'''Xresources''' and '''Xdefaults''' are user-level configuration ''dotfiles'', typically located at {{ic|~/.Xresources}} and {{ic|~/.Xdefaults}}. They can be used to set [[Wikipedia:X resources|X resources]], which are configuration parameters for X client applications.<br />
<br />
They can do many operations, including:<br />
<br />
* defining terminal colours<br />
* configuring terminal preferences<br />
* setting DPI, antialiasing, hinting and other X font settings<br />
* changing the Xcursor theme<br />
* theming xscreensaver<br />
* altering preferences on low-level X applications (xclock ({{Pkg|xorg-xclock}}), {{Pkg|xpdf}}, {{Pkg|rxvt-unicode}}, etc.)<br />
<br />
{{Note|Using {{ic|~/.Xdefaults}} is deprecated, so this article will refer to {{ic|~/.Xresources}} only.}}<br />
<br />
==Getting started==<br />
<br />
===Parsing .Xresources===<br />
The file {{ic|~/.Xresources}} does not exist by default. Being a plain-text file, you can create and edit it with the text editor of your choice. Once present, it will be parsed by the {{ic|xrdb}} (Xorg resource database) program automatically when [[Xorg]] is started, storing the resources in the X server so the file does not need to be re-read. You must re-run {{ic|xrdb ~/.Xresources}} every time you change the file, or restart Xorg.<br />
<br />
To reread your .Xresources file, and throw away your old resources:<br />
<br />
xrdb ~/.Xresources<br />
<br />
To reread your .Xresources file, and keep your old resources:<br />
<br />
xrdb -merge ~/.Xresources<br />
<br />
{{Note|<br />
* If you use xrdb manually, you can put the file anywhere you want (for example, {{ic|~/.config/Xresources}}). However, when named {{ic|~/.Xresources}}, it will be loaded automatically by GDM, LightDM and possibly other DMs.<br />
* If you background the execution of xrdb in a chain of commands in {{ic|~/.xinitrc}}, the programs launched in the same chain might not be able to make use of it, so it is recommended to ''never'' background the xrdb command within {{ic|~/.xinitrc}}.<br />
* Resources loaded with xrdb are also accessible to ''remote'' X11 clients (such as those forwarded over SSH).<br />
* The older (deprecated) {{ic|~/.Xdefaults}} file is read every time you start an X11 program such as {{ic|xterm}}, but '''only''' if {{ic|xrdb}} has not '''ever''' been used in the current X session. [http://groups.google.com/group/comp.windows.x/msg/6c1c083711c35d84]<br />
}}<br />
<br />
===Adding to xinitrc===<br />
If you do not use a [[Desktop Environment|desktop environment]], you probably need to add the following line to your {{ic|~/.[[xinitrc]]}}:<br />
<nowiki>[[ -f ~/.Xresources ]] && xrdb -merge ~/.Xresources</nowiki><br />
<br />
===Default settings===<br />
To see the default settings for your installed X11 apps, look in {{ic|/usr/share/X11/app-defaults/}}.<br />
<br />
Detailed information on program specific resources is usually provided in the man page for that app. Xterms manpage is a good example, containing a list of resources and the default value.<br />
<br />
To see the current loaded resources:<br />
xrdb -query -all<br />
<br />
===Xresources syntax===<br />
====The basic syntax====<br />
The syntax of an Xresources file is as follows:<br />
'''name.Class.resource: value'''<br />
and here is a real world example:<br />
xscreensaver.Dialog.headingFont: -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1<br />
<br />
;name<br />
:The name of the application, such xterm, xpdf, etc<br />
<br />
;class<br />
:The classification used to group resources together. Class names are typically uppercase.<br />
<br />
;resource<br />
:The name of the resource whose value is to be changed. Resources are typically lowercase with uppercase concatenation.<br />
<br />
;value<br />
:The actual value of the resource. This can be 1 of 3 types:<br />
:* Integer (whole numbers)<br />
:* Boolean (true/false, yes/no, on/off)<br />
:* String (a string of characters) (for example a word (white), a color (#ffffff), or a path (/usr/bin/firefox))<br />
<br />
;delimiters<br />
:A period ('''.''') is used to signify each step down into the hierarchy -- in the above example we start at name, then descend into Class, and finally into the resource itself. A colon (''':''') is used to separate the resource declaration from the actual value.<br />
<br />
====Wildcard matching====<br />
The asterisk can be used as a wildcard, making it easy to write a single rule that can be applied to many different applications or elements. <br />
<br />
Using the previous example, if you want to apply the same font to all programs (not just xscreensaver) that contain the class name ''Dialog'' which contains the resource name ''headingFont'', you would write:<br />
'''*'''Dialog.headingFont: -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1<br />
<br />
If you want to apply this same rule to all programs that contain the resource ''headingFont'' regardless of its class, you would write:<br />
'''*'''headingFont: -*-fixed-bold-r-*-*-*-100-*-*-*-*-iso8859-1<br />
<br />
====Commenting====<br />
To add a comment to your Xresources file, simply prefix it with an exclamation point (!), for example:<br />
! This is a comment placed above some Xft settings<br />
Xft.dpi: 96 ! this is an inline comment<br />
<br />
! The following rule will be ignored because it has been commented out<br />
!Xft.antialias: true<br />
<br />
==Sample usage==<br />
The following samples should provide a good understanding of how application settings can be modified using an Xresources file. For full details, refer to the man page of the application in question.<br />
<br />
===Terminal colors===<br />
Most terminals, including [[xterm]] and [[urxvt]], support at least 16 basic colors. The following is an example of a 16-color scheme. The colors 0-7 are the 'normal' colors, while colors 8-15 are their 'bright' counterparts, used for highlighting and such. A good place to start when making your Xresources, is to define the default terminal colors: <br />
{{bc|<br />
! terminal colors ------------------------------------------------------------<br />
<br />
! tangoesque scheme<br />
*background: #111111<br />
*foreground: #babdb6<br />
! Black (not tango) + DarkGrey<br />
*color0: #000000<br />
*color8: #555753<br />
! DarkRed + Red<br />
*color1: #ff6565<br />
*color9: #ff8d8d<br />
! DarkGreen + Green<br />
*color2: #93d44f<br />
*color10: #c8e7a8<br />
! DarkYellow + Yellow<br />
*color3: #eab93d<br />
*color11: #ffc123<br />
! DarkBlue + Blue<br />
*color4: #204a87<br />
*color12: #3465a4<br />
! DarkMangenta + Mangenta<br />
*color5: #ce5c00<br />
*color13: #f57900<br />
!DarkCyan + Cyan (both not tango)<br />
*color6: #89b6e2<br />
*color14: #46a4ff<br />
! LightGrey + White<br />
*color7: #cccccc<br />
*color15: #ffffff<br />
}}<br />
<br />
See [[Man_Page#Colored_man_pages_on_xterm_or_rxvt-unicode]] for how to color bold and underlined text automatically xterm and rxvt.<br />
<br />
For more examples of color schemes, see the [[#Contributed examples]] section at the bottom of this article.<br />
<br />
===Xcursor resources===<br />
Set the theme and size of your mouse cursor:<br />
<br />
! Xcursor --------------------------------------------------------------------<br />
<br />
Xcursor.theme: Vanilla-DMZ-AA<br />
Xcursor.size: 22<br />
<br />
Available themes reside in {{ic|/usr/share/icons}} and local themes can be installed to {{ic|~/.icons}}.<br />
<br />
===Xft resources===<br />
You can define basic font resources without the need of a {{ic|fonts.conf}} file or a desktop environment. Note however, the use of a desktop environment and/or {{ic|fonts.conf}} can override these settings. Your best option is to use one or the other, but not both.<br />
<br />
! Xft settings ---------------------------------------------------------------<br />
<br />
Xft.dpi: 96<br />
Xft.antialias: true<br />
Xft.rgba: rgb<br />
Xft.hinting: true<br />
Xft.hintstyle: hintslight<br />
<br />
===Xterm resources===<br />
The following resources will open [[xterm]] in an 80x25 character window with a scroll-bar and scroll capability for the last 512 lines. The specified [[Fonts#Terminal|Terminus]] facename is a popular and clean terminal font.<br />
<br />
! xterm ----------------------------------------------------------------------<br />
<br />
xterm*geometry: 80x25<br />
xterm*faceName: terminus:bold:pixelsize=14<br />
!xterm*font: -*-dina-medium-r-*-*-16-*-*-*-*-*-*-*<br />
xterm*dynamicColors: true<br />
xterm*utf8: 2<br />
xterm*eightBitInput: true<br />
xterm*saveLines: 512<br />
xterm*scrollKey: true<br />
xterm*scrollTtyOutput: false<br />
xterm*scrollBar: true<br />
xterm*rightScrollBar: true<br />
xterm*jumpScroll: true<br />
xterm*multiScroll: true<br />
xterm*toolBar: false<br />
<br />
===rxvt-unicode (urxvt) resources===<br />
{{Pkg|rxvt-unicode}} features an extensive list of options which can be configured via {{ic|~/.Xresources}}. Refer to the urxvt man page or [[Urxvt#Creating_.7E.2F.Xresources|this wiki article]] for details.<br />
<br />
===Aterm preferences===<br />
Sample settings for aterm (very similar to urxvt):<br />
<br />
!aterm settings------------------------------------------------------------- <br />
<br />
aterm*background: black<br />
aterm*foreground: white<br />
aterm*transparent: true<br />
aterm*shading: 30<br />
aterm*cursorColor: gray<br />
aterm*saveLines: 2000<br />
!aterm*tinting: gray<br />
aterm*scrollBar: false<br />
!aterm*scrollBar_right: true<br />
aterm*transpscrollbar: true<br />
aterm*borderwidth: 0<br />
aterm*font: -*-terminus-*-*-*-*-*-*-*-*-*-*-*-*<br />
aterm*geometry: 80x25<br />
!aterm*fading: 70 <br />
<br />
===Xpdf resources===<br />
Following are some basic resources for [[xpdf]], a lightweight PDF viewer:<br />
<br />
! xpdf -----------------------------------------------------------------------<br />
<br />
xpdf*enableFreetype: yes<br />
xpdf*antialias: yes<br />
xpdf*foreground: black<br />
xpdf*background: white<br />
xpdf*urlCommand: /usr/bin/firefox %s<br />
<br />
Anything more detailed than the above you should be putting in {{ic|~/.xpdfrc}} instead. See the xpdf man page for more information. Note that {{ic|viKeys}} is deprecated.<br />
<br />
===Lal clock resources===<br />
<br />
! lal clock ------------------------------------------------------------------<br />
<br />
lal*font: Arial<br />
lal*fontsize: 12<br />
lal*bold: true<br />
lal*color: #ffffff<br />
lal*width: 150<br />
lal*format: %a %b %d %l:%M%P<br />
<br />
===Xclock preferences===<br />
Some basic xclock settings. See the xclock man page for all X resources.<br />
<br />
! xclock ---------------------------------------------------------------------<br />
<br />
xclock*update: 1<br />
xclock*analog: false<br />
xclock*Foreground: white<br />
xclock*background: black<br />
<br />
===X11-ssh-askpass resources===<br />
<br />
! x11-ssh-askpass ------------------------------------------------------------<br />
<br />
x11-ssh-askpass*font: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
x11-ssh-askpass*background: #000000<br />
x11-ssh-askpass*foreground: #ffffff<br />
x11-ssh-askpass.Button*background: #000000<br />
x11-ssh-askpass.Indicator*foreground: #ff9900<br />
x11-ssh-askpass.Indicator*background: #090909<br />
x11-ssh-askpass*topShadowColor: #000000<br />
x11-ssh-askpass*bottomShadowColor: #000000<br />
x11-ssh-askpass.*borderWidth: 1<br />
<br />
===XScreenSaver resources===<br />
The following is a sample [[Xscreensaver|XScreenSaver]] theme. For more information, refer to the XScreenSaver man page.<br />
<br />
{{Note|If the {{ic|~/.xscreensaver}} file exists, then these X resources will ''not'' be used.}}<br />
<br />
! xscreensaver ---------------------------------------------------------------<br />
<br />
!font settings<br />
xscreensaver.Dialog.headingFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.bodyFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.labelFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.unameFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.buttonFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.Dialog.dateFont: -*-dina-medium-r-*-*-12-*-*-*-*-*-*-*<br />
xscreensaver.passwd.passwdFont: -*-dina-bold-r-*-*-12-*-*-*-*-*-*-*<br />
!general dialog box (affects main hostname, username, password text)<br />
xscreensaver.Dialog.foreground: #ffffff<br />
xscreensaver.Dialog.background: #111111<br />
xscreensaver.Dialog.topShadowColor: #111111<br />
xscreensaver.Dialog.bottomShadowColor: #111111<br />
xscreensaver.Dialog.Button.foreground: #666666<br />
xscreensaver.Dialog.Button.background: #ffffff<br />
!username/password input box and date text colour<br />
xscreensaver.Dialog.text.foreground: #666666<br />
xscreensaver.Dialog.text.background: #ffffff<br />
xscreensaver.Dialog.internalBorderWidth:24<br />
xscreensaver.Dialog.borderWidth: 20<br />
xscreensaver.Dialog.shadowThickness: 2<br />
!timeout bar (background is actually determined by Dialog.text.background)<br />
xscreensaver.passwd.thermometer.foreground: #ff0000<br />
xscreensaver.passwd.thermometer.background: #000000<br />
xscreensaver.passwd.thermometer.width: 8<br />
!datestamp format--see the strftime(3) manual page for details<br />
xscreensaver.dateFormat: %I:%M%P %a %b %d, %Y<br />
<br />
===Xcalc resources===<br />
Following are some xcalc resources to colorize and customize buttons.<br />
<br />
!xcalc-----------------------------------------------------------------------<br />
<br />
xcalc*geometry: 200x275<br />
xcalc.ti.bevel.background: #111111<br />
xcalc.ti.bevel.screen.background: #000000<br />
xcalc.ti.bevel.screen.DEG.background: #000000<br />
xcalc.ti.bevel.screen.DEG.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.GRAD.background: #000000<br />
xcalc.ti.bevel.screen.GRAD.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.RAD.background: #000000<br />
xcalc.ti.bevel.screen.RAD.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.INV.background: #000000<br />
xcalc.ti.bevel.screen.INV.foreground: Red<br />
xcalc.ti.bevel.screen.LCD.background: #000000<br />
xcalc.ti.bevel.screen.LCD.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.LCD.shadowWidth: 0<br />
xcalc.ti.bevel.screen.M.background: #000000<br />
xcalc.ti.bevel.screen.M.foreground: LightSeaGreen<br />
xcalc.ti.bevel.screen.P.background: #000000<br />
xcalc.ti.bevel.screen.P.foreground: Yellow<br />
xcalc.ti.Command.foreground: White<br />
xcalc.ti.Command.background: #777777<br />
xcalc.ti.button5.background: Orange3<br />
xcalc.ti.button19.background: #611161<br />
xcalc.ti.button18.background: #611161<br />
xcalc.ti.button20.background: #611111<br />
!uncomment to change label on division button<br />
!xcalc.ti.button20.label: /<br />
xcalc.ti.button25.background: #722222<br />
xcalc.ti.button30.background: #833333<br />
xcalc.ti.button35.background: #944444<br />
xcalc.ti.button40.background: #a55555<br />
xcalc.ti.button22.background: #222262<br />
xcalc.ti.button23.background: #222262<br />
xcalc.ti.button24.background: #222272<br />
xcalc.ti.button27.background: #333373<br />
xcalc.ti.button28.background: #333373<br />
xcalc.ti.button29.background: #333373<br />
xcalc.ti.button32.background: #444484<br />
xcalc.ti.button33.background: #444484<br />
xcalc.ti.button34.background: #444484<br />
xcalc.ti.button37.background: #555595<br />
xcalc.ti.button38.background: #555595<br />
xcalc.ti.button39.background: #555595<br />
XCalc*Cursor: hand2<br />
XCalc*ShapeStyle: rectangle<br />
<br />
==Color scheme commands==<br />
Here are some fast bash commands you can run right in your shell.<br />
<br />
===Display all 256 colors===<br />
Prints all 256 colors across the screen, very quick.<br />
<nowiki>(x=`tput op` y=`printf %76s`;for i in {0..256};do o=00$i;echo -e ${o:${#o}-3:3} `tput setaf $i;tput setab $i`${y// /=}$x;done)</nowiki><br />
<br />
===Display tput escape codes===<br />
Replace 'tput op' with whatever tput you want to trace. '''op''' is the default foreground and background color.<br />
{{hc<br />
|<nowiki>$ ( strace -s5000 -e write tput op 2>&2 2>&1 ) | tee -a /dev/stderr | grep -o '"[^"]*"'</nowiki><br />
|033[\033[1;34m"\33[39;49m"\033[00m<br />
}}<br />
<br />
===Enumerating colors supported by terminals===<br />
The following command will let you discover all the terminals you have terminfo support for, and the number of colors each terminal supports. The possible values are: 8, 15, 16, 52, 64, 88 and 256.<br />
{{hc<br />
|<nowiki>$ for T in `find /usr/share/terminfo -type f -printf '%f '`;do echo "$T `tput -T $T colors`";done|sort -nk2</nowiki><br />
|Eterm-88color 88<br />
rxvt-88color 88<br />
xterm+88color 88<br />
xterm-88color 88<br />
Eterm-256color 256<br />
gnome-256color 256<br />
konsole-256color 256<br />
putty-256color 256<br />
rxvt-256color 256<br />
screen-256color 256<br />
screen-256color-bce 256<br />
screen-256color-bce-s 256<br />
screen-256color-s 256<br />
xterm+256color 256<br />
xterm-256color 256<br />
}}<br />
<br />
===Enumerating terminal capabilities===<br />
This command is useful to see what features that are supported by your terminal.<br />
{{hc<br />
|<nowiki>$ infocmp -1 | sed -nu 's/^[ \000\t]*//;s/[ \000\t]*$//;/[^ \t\000]\{1,\}/!d;/acsc/d;s/=.*,//p'|column -c80</nowiki><br />
|bel cuu ich kb2 kf15 kf3 kf44 kf59 mc0 rmso smul<br />
blink cuu1 il kbs kf16 kf30 kf45 kf6 mc4 rmul tbc<br />
bold cvvis il1 kcbt kf17 kf31 kf46 kf60 mc5 rs1 u6<br />
cbt dch ind kcub1 kf18 kf32 kf47 kf61 meml rs2 u7<br />
civis dch1 indn kcud1 kf19 kf33 kf48 kf62 memu sc u8<br />
clear dl initc kcuf1 kf2 kf34 kf49 kf63 op setab u9<br />
cnorm dl1 invis kcuu1 kf20 kf35 kf5 kf7 rc setaf vpa<br />
}}<br />
<br />
==Color scheme scripts==<br />
Any of the following scripts will display a chart of your current terminal color scheme. Handy for testing and whatnot.<br />
<br />
===Script #1===<br />
{{bc|1=<br />
#!/bin/bash<br />
#<br />
# This file echoes a bunch of color codes to the <br />
# terminal to demonstrate what's available. Each <br />
# line is the color code of one forground color,<br />
# out of 17 (default + 16 escapes), followed by a <br />
# test use of that color on all nine background <br />
# colors (default + 8 escapes).<br />
#<br />
<br />
T='gYw' # The test text<br />
<br />
echo -e "\n 40m 41m 42m 43m\<br />
44m 45m 46m 47m";<br />
<br />
for FGs in ' m' ' 1m' ' 30m' '1;30m' ' 31m' '1;31m' ' 32m' \<br />
'1;32m' ' 33m' '1;33m' ' 34m' '1;34m' ' 35m' '1;35m' \<br />
' 36m' '1;36m' ' 37m' '1;37m';<br />
do FG=${FGs// /}<br />
echo -en " $FGs \033[$FG $T "<br />
for BG in 40m 41m 42m 43m 44m 45m 46m 47m;<br />
do echo -en "$EINS \033[$FG\033[$BG $T \033[0m";<br />
done<br />
echo;<br />
done<br />
echo<br />
}}<br />
<br />
===Script #2===<br />
{{bc|1=<br />
#!/bin/bash<br />
# Original: http://frexx.de/xterm-256-notes/<br />
# http://frexx.de/xterm-256-notes/data/colortable16.sh<br />
# Modified by Aaron Griffin<br />
# and further by Kazuo Teramoto<br />
FGNAMES=(' black ' ' red ' ' green ' ' yellow' ' blue ' 'magenta' ' cyan ' ' white ')<br />
BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT')<br />
<br />
echo " ┌──────────────────────────────────────────────────────────────────────────┐"<br />
for b in {0..8}; do<br />
((b>0)) && bg=$((b+39))<br />
<br />
echo -en "\033[0m ${BGNAMES[b]} │ "<br />
<br />
for f in {0..7}; do<br />
echo -en "\033[${bg}m\033[$((f+30))m ${FGNAMES[f]} "<br />
done<br />
<br />
echo -en "\033[0m │"<br />
echo -en "\033[0m\n\033[0m │ "<br />
<br />
for f in {0..7}; do<br />
echo -en "\033[${bg}m\033[1;$((f+30))m ${FGNAMES[f]} "<br />
done<br />
<br />
echo -en "\033[0m │"<br />
echo -e "\033[0m"<br />
<br />
((b<8)) &&<br />
echo " ├──────────────────────────────────────────────────────────────────────────┤"<br />
done<br />
echo " └──────────────────────────────────────────────────────────────────────────┘"<br />
}}<br />
<br />
===Script #3===<br />
{{bc|1=<br />
#!/bin/bash<br />
# Original: http://frexx.de/xterm-256-notes/<br />
# http://frexx.de/xterm-256-notes/data/colortable16.sh<br />
# Modified by Aaron Griffin<br />
# and further by Kazuo Teramoto<br />
<br />
<br />
FGNAMES=(' black ' ' red ' ' green ' ' yellow' ' blue ' 'magenta' ' cyan ' ' white ')<br />
BGNAMES=('DFT' 'BLK' 'RED' 'GRN' 'YEL' 'BLU' 'MAG' 'CYN' 'WHT')<br />
echo " ----------------------------------------------------------------------------"<br />
for b in $(seq 0 8); do<br />
if [ "$b" -gt 0 ]; then<br />
bg=$(($b+39))<br />
fi<br />
<br />
echo -en "\033[0m ${BGNAMES[$b]} : "<br />
for f in $(seq 0 7); do<br />
echo -en "\033[${bg}m\033[$(($f+30))m ${FGNAMES[$f]} "<br />
done<br />
echo -en "\033[0m :"<br />
<br />
echo -en "\033[0m\n\033[0m : "<br />
for f in $(seq 0 7); do<br />
echo -en "\033[${bg}m\033[1;$(($f+30))m ${FGNAMES[$f]} "<br />
done<br />
echo -en "\033[0m :"<br />
echo -e "\033[0m"<br />
<br />
if [ "$b" -lt 8 ]; then<br />
echo " ----------------------------------------------------------------------------"<br />
fi<br />
done<br />
echo " ----------------------------------------------------------------------------"<br />
}}<br />
<br />
===Script #4===<br />
{{bc|1=<br />
#!/usr/bin/env lua<br />
<br />
function cl(e)<br />
return string.format('\27[%sm', e)<br />
end<br />
<br />
function print_fg(bg, pre)<br />
for fg = 30,37 do<br />
fg = pre..fg<br />
io.write(cl(bg), cl(fg), string.format(' %6s ', fg), cl(0))<br />
end<br />
end<br />
<br />
for bg = 40,47 do<br />
io.write(cl(0), ' ', bg, ' ')<br />
print_fg(bg, ' ')<br />
io.write('\n ')<br />
print_fg(bg, '1;')<br />
io.write('\n\n')<br />
end<br />
<br />
-- Andres P<br />
}}<br />
<br />
===Script #5===<br />
{{bc|1=<br />
#!/bin/bash<br />
#<br />
# ANSI color scheme script featuring Space Invaders<br />
#<br />
# Original: http://crunchbanglinux.org/forums/post/126921/#p126921<br />
# Modified by lolilolicon<br />
#<br />
<br />
f=3 b=4<br />
for j in f b; do<br />
for i in {0..7}; do<br />
printf -v $j$i %b "\e[${!j}${i}m"<br />
done<br />
done<br />
bld=$'\e[1m'<br />
rst=$'\e[0m'<br />
<br />
cat << EOF<br />
<br />
$f1 ▀▄ ▄▀ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4 ▀▄ ▄▀ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst<br />
$f1 ▄█▀███▀█▄ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4 ▄█▀███▀█▄ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst<br />
$f1█▀███████▀█ $f2▀▀███▀▀███▀▀ $f3▀█▀██▀█▀ $f4█▀███████▀█ $f5▀▀███▀▀███▀▀ $f6▀█▀██▀█▀$rst<br />
$f1▀ ▀▄▄ ▄▄▀ ▀ $f2 ▀█▄ ▀▀ ▄█▀ $f3▀▄ ▄▀ $f4▀ ▀▄▄ ▄▄▀ ▀ $f5 ▀█▄ ▀▀ ▄█▀ $f6▀▄ ▄▀$rst<br />
<br />
$bld$f1▄ ▀▄ ▄▀ ▄ $f2 ▄▄▄████▄▄▄ $f3 ▄██▄ $f4▄ ▀▄ ▄▀ ▄ $f5 ▄▄▄████▄▄▄ $f6 ▄██▄ $rst<br />
$bld$f1█▄█▀███▀█▄█ $f2███▀▀██▀▀███ $f3▄█▀██▀█▄ $f4█▄█▀███▀█▄█ $f5███▀▀██▀▀███ $f6▄█▀██▀█▄$rst<br />
$bld$f1▀█████████▀ $f2▀▀▀██▀▀██▀▀▀ $f3▀▀█▀▀█▀▀ $f4▀█████████▀ $f5▀▀▀██▀▀██▀▀▀ $f6▀▀█▀▀█▀▀$rst<br />
$bld$f1 ▄▀ ▀▄ $f2▄▄▀▀ ▀▀ ▀▀▄▄ $f3▄▀▄▀▀▄▀▄ $f4 ▄▀ ▀▄ $f5▄▄▀▀ ▀▀ ▀▀▄▄ $f6▄▀▄▀▀▄▀▄$rst<br />
<br />
<br />
$f7▌$rst<br />
<br />
$f7▌$rst<br />
<br />
$f7 ▄█▄ $rst<br />
$f7▄█████████▄$rst<br />
$f7▀▀▀▀▀▀▀▀▀▀▀$rst<br />
<br />
EOF<br />
}}<br />
<br />
===Script #6=== <br />
{{bc|1= <br />
#!/usr/bin/env ruby<br />
# coding: utf-8<br />
<br />
# ANSI color scheme script <br />
# Author: Ivaylo Kuzev < Ivo ><br />
# Original: http://crunchbanglinux.org/forums/post/134749/#p134749<br />
# Modified using Ruby.<br />
<br />
CL = "\e[0m"<br />
BO = "\e[1m"<br />
<br />
R = "\e[31m" <br />
G = "\e[32m"<br />
Y = "\e[33m"<br />
B = "\e[34m"<br />
P = "\e[35m"<br />
C = "\e[36m"<br />
<br />
print <<EOF <br />
<br />
#{BO}#{R} ██████ #{CL} #{BO}#{G}██████ #{CL}#{BO}#{Y} ██████#{CL} #{BO}#{B}██████ #{CL} #{BO}#{P} ██████#{CL} #{BO}#{C} ███████#{CL}<br />
#{BO}#{R} ████████#{CL} #{BO}#{G}██ ██ #{CL}#{BO}#{Y}██ #{CL} #{BO}#{B}██ ██#{CL} #{BO}#{P}██████ #{CL} #{BO}#{C} █████████#{CL}<br />
#{R} ██ ████#{CL} #{G}██ ████#{CL}#{Y} ████ #{CL} #{B}████ ██#{CL} #{P}████ #{CL} #{C}█████ #{CL}<br />
#{R} ██ ██#{CL} #{G}██████ #{CL}#{Y} ████████#{CL} #{B}██████ #{CL} #{P}████████#{CL} #{C}██ #{CL}<br />
<br />
EOF<br />
}}<br />
<br />
==Contributed examples==<br />
Check out these links for some real world examples of X resource files, contributed by fellow community members.<br />
{{Note|{{ic|~/.Xdefaults}} has the same syntax as {{ic|~/.Xresources}}, and it is recommended that you use {{ic|~/.Xresources}} because {{ic|~/.Xdefaults}} is deprecated upstream.}}<br />
<br />
* http://dotfiles.org/~buttons/.Xdefaults<br />
* http://code.suckless.org/hg/dextra/file/513faba2591f/dolby/Xdefaults<br />
* http://github.com/stxza/arch-linux-configs/tree/master/.Xdefaults<br />
* http://github.com/jelly/dotfiles/tree/master/.Xdefaults<br />
* https://github.com/sunaku/home/blob/master/.Xdefaults<br />
<br />
==See also==<br />
* [https://engineering.purdue.edu/ECN/Support/KB/Docs/UsingTheXdefaultsFil Using the Xdefaults File] - An in-depth article on how X interprets the Xdefaults file<br />
* [http://wiki.afterstep.org/index.php?title=Rxvt-Unicode_Configuration_Tutorial Rxvt-unicode Configuration Tutorial] - lots of information for urxvt users<br />
* [http://mkaz.com/ref/xterm_colors.html Example Colors and their names] - listing of example colors and their color names for xterm and other X-applications.<br />
* [http://web.archive.org/web/20090130061234/http://phraktured.net/terminal-colors/ Color Themes] - Extensive list of terminal color themes by Phraktured.<br />
* [http://xcolors.net/ Xcolors.net] List of user-contributed terminal color themes.</div>I magnific0