https://wiki.archlinux.org/api.php?action=feedcontributions&user=Granitosaurus&feedformat=atomArchWiki - User contributions [en]2024-03-28T22:09:42ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=Rofimoji&diff=696830Rofimoji2021-09-20T04:46:19Z<p>Granitosaurus: Created page with "[https://github.com/fdw/rofimoji rofimoji] is a unicode character picker integrated with rofi. == Installation == Install the {{Pkg|rofimoji}} package. == Usage ==..."</p>
<hr />
<div>[https://github.com/fdw/rofimoji rofimoji] is a unicode character picker integrated with [[rofi]].<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{Pkg|rofimoji}} package.<br />
<br />
== Usage ==<br />
<br />
# Call rofi with {{ic|rofi -modi "emoji:<path to rofimoji.py>" -show emoji}}<br />
# Search for the character you want<br />
# Hit enter to exexute your default action;<br />
# Alt+Shift+1 for copying to the clipboard Alt+Shift+3 for the "clipboard" insertion method alt+1 inserts the most recently used character (alt+2 for the second most recently one etc.)</div>Granitosaurushttps://wiki.archlinux.org/index.php?title=Greenclip&diff=696827Greenclip2021-09-20T04:32:22Z<p>Granitosaurus: add system unit enable example for more explicit details</p>
<hr />
<div>[[Category:Application launchers]]<br />
[[es:Greenclip]]<br />
[[ja:Greenclip]]<br />
[https://github.com/erebe/greenclip Greenclip] is a simple [[clipboard manager]] designed to be integrated with [[rofi]] and written in Haskell.<br />
<br />
== Installation ==<br />
<br />
[[Install]] the {{AUR|rofi-greenclip}} package.<br />
<br />
[[Start/enable]] the user unit {{ic|greenclip.service}}:<br />
# systemctl --user enable greenclip.service<br />
<br />
== Usage ==<br />
<br />
# Spawn the daemon with {{ic|/usr/bin/greenclip daemon}} or start/enable the user unit as mentioned in [[#Installation]]<br />
# Show entries as a list within [[rofi]] using: {{ic|rofi -modi "clipboard:greenclip print" -show clipboard -run-command '{cmd}'}}<br />
# The entry that you have selected will be in your [[clipboard]] now<br />
# Configuration file is placed in {{ic|~/.config/greenclip.toml}}<br />
# To clear all clipboard history, run {{ic|greenclip clear}}</div>Granitosaurushttps://wiki.archlinux.org/index.php?title=Python&diff=543445Python2018-09-25T05:02:51Z<p>Granitosaurus: /* Alternative shells */ added ptpython</p>
<hr />
<div>[[Category:Programming languages]]<br />
[[de:Python]]<br />
[[es:Python]]<br />
[[ja:Python]]<br />
[[ko:Python]]<br />
[[ru:Python]]<br />
[[zh-hans:Python]]<br />
{{Related articles start}}<br />
{{Related|Python package guidelines}}<br />
{{Related|Python/Virtual environment}}<br />
{{Related|mod_wsgi}}<br />
{{Related|Django}}<br />
{{Related articles end}}<br />
From [[Wikipedia:Python (programming language)|Wikipedia]]:<br />
<br />
:Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax allows programmers to express concepts in fewer lines of code than possible in languages such as C++ or Java. The language provides constructs intended to enable writing clear programs on both a small and large scale.<br />
:Python supports multiple programming paradigms, including object-oriented, imperative and functional programming or procedural styles. It features a dynamic type system and automatic memory management and has a large and comprehensive standard library.<br />
<br />
== Installation ==<br />
<br />
{{Expansion|Mention other implementations: [[PyPy]], {{Pkg|jython}} and {{Pkg|cython}}.}}<br />
<br />
=== Python 3 ===<br />
<br />
Python 3 is the latest version of the language, and is incompatible with Python 2. The language is mostly the same, but many details, especially how built-in objects like dictionaries and strings work, have changed considerably, and a lot of deprecated features have finally been removed. Also, the standard library has been reorganized in a few prominent places. For an overview of the differences, visit [https://wiki.python.org/moin/Python2orPython3 Python2orPython3] and the relevant [http://getpython3.com/diveintopython3/porting-code-to-python-3-with-2to3.html chapter] in Dive into Python 3.<br />
<br />
To install the latest version of Python 3, [[install]] the {{Pkg|python}} package.<br />
<br />
If you would like to build the latest RC/betas from source, visit [https://www.python.org/downloads/ Python Downloads]. The [[Arch User Repository]] also contains good [[PKGBUILD]]s. If you do decide to build the RC, note that the binary (by default) installs to {{ic|/usr/local/bin/python3.x}}.<br />
<br />
=== Python 2 ===<br />
<br />
To get the latest version of Python 2, [[install]] the {{Pkg|python2}} package.<br />
<br />
Python 2 will happily run alongside Python 3. You need to specify {{ic|python2}} in order to run this version.<br />
<br />
Any program requiring Python 2 needs to point to {{ic|/usr/bin/python2}}, instead of {{ic|/usr/bin/python}}, which points to Python 3. To do so, open the program or script in a [[List of applications/Documents#Text editors|text editor]] and change the first line. The line will show one of the following:<br />
<br />
#!/usr/bin/env python<br />
<br />
or<br />
<br />
#!/usr/bin/python<br />
<br />
In both cases, just change {{ic|python}} to {{ic|python2}} and the program will then use Python 2 instead of Python 3.<br />
<br />
Another way to force the use of python2 without altering the scripts is to call it explicitly with {{ic|python2}}:<br />
<br />
$ python2 ''myScript.py''<br />
<br />
Finally, you may not be able to control the script calls, but there is a way to trick the environment. It only works if the scripts use {{ic|#!/usr/bin/env python}}. It will not work with {{ic|#!/usr/bin/python}}. This trick relies on {{ic|env}} searching for the first corresponding entry in the {{ic|PATH}} variable.<br />
<br />
First create a dummy folder:<br />
<br />
$ mkdir ~/bin<br />
<br />
Then add a symlink {{ic|python}} to ''python2'' and the config scripts in it:<br />
<br />
$ ln -s /usr/bin/python2 ~/bin/python<br />
$ ln -s /usr/bin/python2-config ~/bin/python-config<br />
<br />
Finally put the new folder ''at the beginning'' of your {{ic|PATH}} variable:<br />
<br />
$ export PATH=~/bin:$PATH<br />
<br />
{{Note|This method of changing [[environment variables]] is not permanent and is only active in the current terminal session.}}<br />
<br />
To check which python interpreter is being used by {{ic|env}}, use the following command:<br />
<br />
$ which python<br />
<br />
A similar approach in tricking the environment, which also relies on {{ic|#!/usr/bin/env python}} to be called by the script in question, is to use a [[#Virtual environment|virtual environment]].<br />
<br />
=== Old versions ===<br />
<br />
{{warning|Python versions before 2.7 and 3.4 have not received any updates&mdash;including security patches&mdash;since at least 2014. Using older versions for Internet-facing applications or untrusted code may be dangerous and is not recommended.}}<br />
<br />
Old versions of Python are available via the [[AUR]] and may be useful for historical curiosity, old applications that do not run on current versions, or for testing Python programs intended to run on a distribution that comes with an older version:<br />
<br />
* Python 3.6: {{AUR|python36}}<br />
* Python 3.5: {{AUR|python35}}<br />
* Python 3.4: {{AUR|python34}}<br />
* Python 2.6: {{AUR|python26}}<br />
* Python 2.5: {{AUR|python25}}<br />
* Python 1.5: {{AUR|python15}}<br />
<br />
Extra modules/libraries for old versions of Python may be found on the AUR by searching for {{ic|python<''version without period''>}}, e.g. searching for "python26" for 2.6 modules.<br />
<br />
== Package management ==<br />
<br />
Although a great number of Python packages are readily available in the [[official repositories]] and the [[AUR]], the Python ecosystem provides its own package managers for use with [https://pypi.org/ PyPI], the Python Package Index:<br />
<br />
* {{App|pip|The PyPA tool for installing Python packages.|https://pip.pypa.io/|{{Pkg|python-pip}}, {{Pkg|python2-pip}}}}<br />
* {{App|setuptools|Easily download, build, install, upgrade, and uninstall Python packages.|https://setuptools.readthedocs.io/|{{Pkg|python-setuptools}}, {{Pkg|python2-setuptools}}}}<br />
<br />
For a brief history and feature comparison between the two, see [https://packaging.python.org/pip_easy_install/#pip-vs-easy-install pip vs easy_install]. Authoritative best practices in Python package management are detailed [https://packaging.python.org/ here].<br />
<br />
If you must use ''pip'', use a [[#Virtual environment|virtual environment]], or {{ic|pip install --user}} to avoid conflicts with packages in {{ic|/usr}}. It is always preferred to [[System maintenance#Use the package manager to install software|use pacman to install software]].<br />
<br />
{{Note|There are also tools integrating ''pip'' with ''pacman'' by automatically generating PKGBUILDs for specified pip-packages: see [[Creating packages#PKGBUILD generators]].}}<br />
<br />
{{Tip|[https://docs.pipenv.org/ pipenv] provides a single CLI for [https://github.com/pypa/pipfile Pipfile], ''pip'' and [[virtualenv]]. It is available as {{Pkg|python-pipenv}} and {{Pkg|python2-pipenv}}.}}<br />
<br />
== Widget bindings ==<br />
<br />
The following [[Wikipedia:Widget toolkit|widget toolkit]] bindings are available:<br />
<br />
* {{App|TkInter|Tk bindings|https://wiki.python.org/moin/TkInter|standard module}}<br />
* {{App|pyQt|[[Qt]] bindings|https://riverbankcomputing.com/software/pyqt/intro|{{AUR|python2-pyqt4}} {{Pkg|python2-pyqt5}} {{AUR|python-pyqt4}} {{Pkg|python-pyqt5}}}}<br />
* {{App|pySide|[[Qt]] bindings|https://wiki.qt.io/PySide|{{AUR|python2-pyside}} {{AUR|python-pyside}}}}<br />
* {{App|pyGTK|[[GTK+|GTK+ 2]] bindings|http://www.pygtk.org/|{{Pkg|pygtk}}}}<br />
* {{App|PyGObject|[[GTK+|GTK+ 2/3]] bindings via GObject Introspection|https://wiki.gnome.org/PyGObject/|{{Pkg|python2-gobject2}} {{Pkg|python2-gobject}} {{Pkg|python-gobject2}} {{Pkg|python-gobject}}}}<br />
* {{App|wxPython|wxWidgets bindings|https://wxpython.org/|{{Pkg|python2-wxpython3}} {{Pkg|python-wxpython}}}}<br />
<br />
To use these with Python, you may need to install the associated widget kits.<br />
<br />
== Tips and tricks ==<br />
<br />
=== Alternative shells ===<br />
* {{App|ptpython|Fancy interface for the Python interpreter based on [https://github.com/jonathanslenders/python-prompt-toolkit prompt-toolkit] input interface.|https://github.com/jonathanslenders/ptpython|{{aur|ptpython}} {{aur|ptpython2}}}}<br />
* {{App|bpython|Fancy interface for the Python interpreter.|https://bpython-interpreter.org/|{{Pkg|bpython}} {{Pkg|bpython2}}}}<br />
* {{App|[[Wikipedia:IPython|IPython]]|Enhanced interactive Python shell.|https://ipython.org/|{{Pkg|ipython}} {{Pkg|ipython2}}}}<br />
* {{App|[[Jupyter]] Notebook|Web interface to IPython.|https://jupyter.org/|{{Pkg|jupyter-notebook}}}}<br />
<br />
=== Virtual environment ===<br />
<br />
Python provides tools to create isolated environments in which you can install packages without interfering with the other virtual environments nor with the system Python's packages. It could change the ''python'' interpreter used for a specific application. <br />
<br />
See [[Python/Virtual environment]] for details.<br />
<br />
=== Tab completion in Python2 shell ===<br />
<br />
Since Python 3.4 [https://docs.python.org/3/tutorial/interactive.html tab completion] is enabled by default, for Python 2 you can manually enable it by adding the following lines to a file referenced by the {{ic|PYTHONSTARTUP}} environment variable: [https://algorithmicallyrandom.blogspot.co.at/2009/09/tab-completion-in-python-shell-how-to.html]<br />
<br />
import rlcompleter<br />
import readline<br />
readline.parse_and_bind("tab: complete")<br />
<br />
== Troubleshooting ==<br />
=== Dealing with version problem in build scripts ===<br />
<br />
{{Style|This is an ugly hack, instead explain how to recursively fix shebangs with {{ic|find}} and {{ic|sed}}.}}<br />
<br />
Many projects' build scripts assume {{ic|python}} to be Python 2, and that would eventually result in an error — typically complaining that {{ic|print 'foo'}} is invalid syntax. Luckily, many of them call ''python'' from the {{ic|PATH}} environment variable instead of hardcoding {{ic|#!/usr/bin/python}} in the shebang line, and the Python scripts are all contained within the project tree. So, instead of modifying the build scripts manually, there is a workaround. Create {{ic|/usr/local/bin/python}} with content like this:<br />
<br />
{{hc|/usr/local/bin/python|<nowiki><br />
#!/bin/bash<br />
script=$(readlink -f -- "$1")<br />
case "$script" in (/path/to/project1/*|/path/to/project2/*|/path/to/project3*)<br />
exec python2 "$@"<br />
;;<br />
esac<br />
<br />
exec python3 "$@"<br />
</nowiki>}}<br />
<br />
Where {{ic|<nowiki>/path/to/project1/*|/path/to/project2/*|/path/to/project3*</nowiki>}} is a list of patterns separated by {{ic|<nowiki>|</nowiki>}} matching all project trees. For some scripts, the path may not be the first parameter, for example Google SDK it sends "-S" as the first parameter. The readlink command should change to {{ic|1=script=$(readlink -f -- "$1")}}.<br />
<br />
Do not forget to make it [[executable]]. Afterwards scripts within the specified project trees will be run with Python 2.<br />
<br />
== See also ==<br />
<br />
* [http://shop.oreilly.com/product/0636920028154.do O'Reilly's Learning Python, 5th edition] commercial<br />
* [http://www.diveintopython.net/ Dive Into Python], [http://getpython3.com/diveintopython3/ Dive Into Python3]<br />
* [https://python.swaroopch.com/ A Byte of Python]<br />
* [https://learnpythonthehardway.org/ Learn Python the Hard Way]<br />
* [https://learnpython.org/ Learn Python]<br />
* [https://stephensugden.com/crash_into_python/ Crash into Python] (assumes familiarity with other programming languages)<br />
* [https://www.apress.com/book/9781590598726 Beginning Game Development with Python and Pygame] commercial<br />
* [http://www.greenteapress.com/thinkpython/ Think Python]<br />
* [https://pythonspot.com Pythonspot]<br />
* [https://overiq.com/python/3.4/intro-to-python/ OverIQ Python Tutorial]<br />
* [https://www.techbeamers.com/python-tutorial-step-by-step/ Python Tutorial to Learn Step by Step]<br />
* [https://github.com/vinta/awesome-python awesome-python] - A curated list of Python frameworks, libraries, software and resources.<br />
* [https://github.com/mahmoud/boltons boltons] - Constructs/recipes/snippets that would be handy in the standard library.</div>Granitosaurushttps://wiki.archlinux.org/index.php?title=Ranger&diff=506951Ranger2018-01-12T13:35:06Z<p>Granitosaurus: Add Official User Guide to "See Also"</p>
<hr />
<div>{{DISPLAYTITLE:ranger}}<br />
[[Category:File managers]]<br />
[[ar:Ranger]]<br />
[[fr:ranger]]<br />
[[ja:Ranger]]<br />
[[zh-hans:Ranger]]<br />
{{Related articles start}}<br />
{{Related|Midnight Commander}}<br />
{{Related|vifm}}<br />
{{Related articles end}}<br />
[http://ranger.nongnu.org/ ranger] is a text-based file manager written in Python. Directories are displayed in one pane with three columns. Moving between them is accomplished with keystrokes, bookmarks, the mouse or the command history. File previews and directory contents show automatically for the current selection.<br />
<br />
Features include: vi-style key bindings, bookmarks, selections, tagging, tabs, command history, the ability to make symbolic links, several console modes, and a task view. ''ranger'' has customizable commands and key bindings, including bindings to external scripts. The closest competitor is [[Vifm]], which has two panes and vi-style key bindings, but fewer features overall.<br />
<br />
== Installation ==<br />
[[Install]] the {{Pkg|ranger}} package, or {{AUR|ranger-git}} for the development version.<br />
<br />
== Usage ==<br />
<br />
To start ranger, launch a [[List of applications#Terminal emulators|terminal]] and run {{ic|ranger}}.<br />
<br />
{| class="wikitable"<br />
|+<br />
! Key !! Command<br />
|-<br />
| {{ic|?}} || Open the manual or list keybindings, commands and settings<br />
|-<br />
| {{ic|l}}, {{ic|Enter}} || Launch files<br />
|}<br />
<br />
== Configuration ==<br />
<br />
After startup, ''ranger'' creates a directory {{ic|~/.config/ranger}}. To copy the default configuration to this directory issue the following command:<br />
<br />
ranger --copy-config=all<br />
<br />
* {{ic|rc.conf}} - startup commands and key bindings<br />
* {{ic|commands.py}} - commands which are launched with {{ic|:}}<br />
* {{ic|rifle.conf}} - applications used when a given type of file is launched.<br />
<br />
{{ic|rc.conf}} only needs to include changes from the default file as both are loaded. For {{ic|commands.py}}, if you do not include the whole file, put this line at the top:<br />
<br />
from ranger.api.commands import *<br />
<br />
To add a keybind that moves files to your trash directory {{ic|~/.local/share/Trash/files/}} with {{ic|DD}}, add to {{ic|~/.config/ranger/rc.conf}}:<br />
<br />
map DD shell mv /home/${USER}/.local/share/Trash/files/ %s<br />
<br />
See {{man|1|ranger}} for general configuration.<br />
<br />
=== Defining commands ===<br />
<br />
Continuing the above example, add the following entry to {{ic|~/.config/ranger/commands.py}} to empty the trash directory {{ic|~/.Trash}}.<br />
<br />
{{bc|<nowiki><br />
class empty(Command):<br />
""":empty<br />
<br />
Empties the trash directory ~/.Trash<br />
"""<br />
<br />
def execute(self):<br />
self.fm.run("rm -rf /home/myname/.Trash/{*,.[^.]*}")<br />
</nowiki>}}<br />
<br />
To use it, type {{ic|:empty}} and {{ic|Enter}} with tab completion as desired.<br />
<br />
{{Warning|{{ic|[^.]}} is an essential part of the above command. Without it, all files and directories of the form {{ic|..*}} will be deleted, wiping out everything in your home directory.}}<br />
<br />
=== Color schemes ===<br />
<br />
Ranger comes with four color schemes: {{ic|default}}, {{ic|jungle}}, {{ic|snow}} and {{ic|solarized}}.<br />
You can change your color scheme using:<br />
<br />
set colorscheme ''scheme''<br />
<br />
Custom color schemes can be placed in {{ic|~/.config/ranger/colorschemes}}.<br />
<br />
=== File association ===<br />
<br />
Ranger uses its own file opener called {{ic|rifle}}.<br />
It's configured in {{ic|~/.config/ranger/rifle.conf}}. Run {{ic|1=ranger --copy-config=rifle}} if it does not exist. For example, the following line <br />
makes {{Pkg|kile}} the default program for tex files:<br />
<br />
ext tex = kile "$@"<br />
<br />
To open all files with {{Pkg|xdg-utils}}:<br />
<br />
has xdg-open, flag f = xdg-open "$1"<br />
<br />
== Tips and tricks ==<br />
<br />
{{Template:Style|bad style}}<br />
<br />
=== Archives ===<br />
<br />
These commands use {{Pkg|atool}} to perform archive operations.<br />
<br />
==== Archive extraction ====<br />
<br />
The following command implements archive extraction by copying (yy) one or more archive files and then executing {{ic|:extracthere}} on the desired directory.<br />
<br />
{{bc|<nowiki><br />
import os<br />
from ranger.core.loader import CommandLoader<br />
<br />
class extracthere(Command):<br />
def execute(self):<br />
""" Extract copied files to current directory """<br />
copied_files = tuple(self.fm.copy_buffer)<br />
<br />
if not copied_files:<br />
return<br />
<br />
def refresh(_):<br />
cwd = self.fm.get_directory(original_path)<br />
cwd.load_content()<br />
<br />
one_file = copied_files[0]<br />
cwd = self.fm.thisdir<br />
original_path = cwd.path<br />
au_flags = ['-X', cwd.path]<br />
au_flags += self.line.split()[1:]<br />
au_flags += ['-e']<br />
<br />
self.fm.copy_buffer.clear()<br />
self.fm.cut_buffer = False<br />
if len(copied_files) == 1:<br />
descr = "extracting: " + os.path.basename(one_file.path)<br />
else:<br />
descr = "extracting files from: " + os.path.basename(one_file.dirname)<br />
obj = CommandLoader(args=['aunpack'] + au_flags \<br />
+ [f.path for f in copied_files], descr=descr)<br />
<br />
obj.signal_bind('after', refresh)<br />
self.fm.loader.add(obj)<br />
</nowiki>}}<br />
<br />
==== Compression ====<br />
<br />
The following command allows the user to compress several files on the current directory by marking them and then calling {{ic|:compress ''package name''}}. It supports name suggestions by getting the basename of the current directory and appending several possibilities for the extension. You need to have {{pkg|atool}} installed. Otherwise you will see an error message when you create the archive.<br />
<br />
{{bc|<nowiki><br />
import os<br />
from ranger.core.loader import CommandLoader<br />
<br />
class compress(Command):<br />
def execute(self):<br />
""" Compress marked files to current directory """<br />
cwd = self.fm.thisdir<br />
marked_files = cwd.get_selection()<br />
<br />
if not marked_files:<br />
return<br />
<br />
def refresh(_):<br />
cwd = self.fm.get_directory(original_path)<br />
cwd.load_content()<br />
<br />
original_path = cwd.path<br />
parts = self.line.split()<br />
au_flags = parts[1:]<br />
<br />
descr = "compressing files in: " + os.path.basename(parts[1])<br />
obj = CommandLoader(args=['apack'] + au_flags + \<br />
[os.path.relpath(f.path, cwd.path) for f in marked_files], descr=descr)<br />
<br />
obj.signal_bind('after', refresh)<br />
self.fm.loader.add(obj)<br />
<br />
def tab(self):<br />
""" Complete with current folder name """<br />
<br />
extension = ['.zip', '.tar.gz', '.rar', '.7z']<br />
return ['compress ' + os.path.basename(self.fm.thisdir.path) + ext for ext in extension]<br />
</nowiki>}}<br />
<br />
=== External drives ===<br />
<br />
External drives can be automatically mounted with [[udev]] or [[udisks]]. Drives mounted under {{ic|/media}} can be easily accessed by pressing {{ic|gm}} (go, media).<br />
<br />
=== Image mounting ===<br />
<br />
The following command assumes you are using [[CDemu]] as your image mounter and some kind of system like [[autofs]] which mounts the virtual drive to a specified location ('/media/virtualrom' in this case). '''Do not forget to change mountpath to reflect your system settings'''.<br />
<br />
To mount an image (or images) to a cdemud virtual drive from ranger you select the image files and then type ':mount' on the console. The mounting may actually take some time depending on your setup (in mine it may take as long as one minute) so the command uses a custom loader that waits until the mount directory is mounted and then opens it on the background in tab 9.<br />
<br />
{{bc|<nowiki><br />
import os, time<br />
from ranger.core.loader import Loadable<br />
from ranger.ext.signals import SignalDispatcher<br />
from ranger.ext.shell_escape import *<br />
<br />
class MountLoader(Loadable, SignalDispatcher):<br />
"""<br />
Wait until a directory is mounted<br />
"""<br />
def __init__(self, path):<br />
SignalDispatcher.__init__(self)<br />
descr = "Waiting for dir '" + path + "' to be mounted"<br />
Loadable.__init__(self, self.generate(), descr)<br />
self.path = path<br />
<br />
def generate(self):<br />
available = False<br />
while not available:<br />
try:<br />
if os.path.ismount(self.path):<br />
available = True<br />
except:<br />
pass<br />
yield<br />
time.sleep(0.03)<br />
self.signal_emit('after')<br />
<br />
class mount(Command):<br />
def execute(self):<br />
selected_files = self.fm.thisdir.get_selection()<br />
<br />
if not selected_files:<br />
return<br />
<br />
space = ' '<br />
self.fm.execute_command("cdemu -b system unload 0")<br />
self.fm.execute_command("cdemu -b system load 0 " + \<br />
space.join([shell_escape(f.path) for f in selected_files]))<br />
<br />
mountpath = "/media/virtualrom/"<br />
<br />
def mount_finished(path):<br />
currenttab = self.fm.current_tab<br />
self.fm.tab_open(9, mountpath)<br />
self.fm.tab_open(currenttab)<br />
<br />
obj = MountLoader(mountpath)<br />
obj.signal_bind('after', mount_finished)<br />
self.fm.loader.add(obj)<br />
</nowiki>}}<br />
<br />
=== New tab in current folder ===<br />
<br />
You may have noticed there are two shortcuts for opening a new tab in home ({{ic|g}}{{ic|n}} and {{ic|Ctrl+n}}). Let us rebind {{ic|Ctrl+n}}:<br />
{{hc|rc.conf|<nowiki><br />
map <c-n> eval fm.tab_new('%d')<br />
</nowiki>}}<br />
<br />
=== PDF file preview ===<br />
By default ranger will preview PDF files as text. However, you can preview PDF files as an image in ranger by first converting the PDF file to an image. Ranger stores the image previews in {{ic|~/.cache/ranger/}}. You either need to create this directory manually or set {{ic|preview_images}} to {{ic|true}} in {{ic|~/.config/ranger/rc.conf}} to tell {{ic|ranger}} to create it automatically at the next start. However, note that {{ic|preview_images}} does not need to be set to {{ic|true}} the whole time to preview PDF file as images, only {{ic|~/.cache/ranger}} directory is needed.<br />
<br />
Ranger can preview images using, for example, {{Pkg|w3m}}; see {{ic|~/.config/ranger/rc.conf}} for all available preview methods.<br />
<br />
Replace the default {{ic|try pdftotext}} command in {{ic|~/.config/ranger/scope.sh}} with the following:<br />
<br />
try pdftoppm -jpeg -singlefile "$path" "${cached//.jpg}" && exit 6 || exit 1;;<br />
<br />
In this example the {{ic|pdftoppm}} utility from {{Pkg|poppler}} is used to create the image preview. Other (usually slower) options are available, for example {{Pkg|ghostscript}} or {{Pkg|imagemagick}}.<br />
<br />
=== Shell tips ===<br />
<br />
==== Synchronize path ====<br />
<br />
''ranger'' provides a shell [[Bash/Functions|function]] {{ic|/usr/share/doc/ranger/examples/bash_automatic_cd.sh}}. Running {{ic|ranger-cd}} instead of {{ic|ranger}} will automatically ''cd'' to the last browsed folder.<br />
<br />
If you launch ranger from a graphical launcher (such as {{ic|$TERMCMD -e ranger}}, where TERMCMD is an X terminal), you cannot use {{ic|ranger-cd}}. Create an executable script:<br />
<br />
{{hc|ranger-launcher.sh|<nowiki><br />
#!/bin/sh<br />
export RANGERCD=true<br />
$TERMCMD<br />
</nowiki>}}<br />
<br />
and add at the ''very end'' of your shell configuration:<br />
<br />
{{hc|.''shell''rc|<nowiki><br />
$RANGERCD && unset RANGERCD && ranger-cd<br />
</nowiki>}}<br />
<br />
This will launch {{ic|ranger-cd}} only if the {{ic|RANGERCD}} variable is set. It is important to unset this variable again, otherwise launching a subshell from this terminal will automatically relaunch {{ic|ranger}}.<br />
<br />
==== Start a shell from ranger ====<br />
<br />
With the previous method you can switch to a shell in last browsed path simply by leaving ranger. However you may not want to quit ranger for several reasons (numerous opened tabs, copy in progress, etc.).<br />
You can start a shell from ranger ({{ic|S}} by default) without losing your ranger session. Unfortunately, the shell will not switch to the current folder automatically. Again, this can be solved with an executable script:<br />
<br />
{{hc|shellcd|<nowiki><br />
#!/bin/sh<br />
export AUTOCD="$(realpath "$1")"<br />
<br />
$SHELL<br />
</nowiki>}}<br />
<br />
and - as before - add this to at the very end of your shell configuration:<br />
<br />
{{hc|shellrc|<nowiki><br />
cd "$AUTOCD"<br />
</nowiki>}}<br />
<br />
Now you can change your shell binding for ranger:<br />
<br />
{{hc|rc.conf|<br />
map S shell shellcd %d<br />
}}<br />
<br />
Alternatively, you can make use of your shell history file if it has any. For instance, you could do this for [[zsh#Dirstack|zsh]]:<br />
<br />
{{hc|shellcd|<nowiki><br />
## Prepend argument to zsh dirstack.<br />
BUF="$(realpath "$1")<br />
$(grep -v "$(realpath "$1")" "$ZDIRS")"<br />
echo "$BUF" > "$ZDIRS"<br />
<br />
zsh<br />
</nowiki>}}<br />
<br />
Change ZDIRS for your dirstack.<br />
<br />
===== A simpler solution =====<br />
<br />
{{hc|rc.conf|<nowiki><br />
map S shell bash -c "cd %d; bash"<br />
</nowiki>}}<br />
This could probably be adapted to other shells as well.<br />
Instead of just running a shell (like the default config), this will run {{ic|cd}} in a shell, then execute a interactive shell which will not immediately exit so that you can continue with what you wanted.<br />
<br />
==== Preventing nested ranger instances ====<br />
<br />
You can start a shell in the current directory with {{ic|S}}, when you exit the shell you get back to your ranger instance.<br />
<br />
When you however forget that you already are in a ranger shell and start ranger again you end up with ranger running a shell running ranger.<br />
<br />
To prevent this you can create the following function in your [[Autostarting#Shells|shell's startup file]]:<br />
<br />
ranger() {<br />
if [ -z "$RANGER_LEVEL" ]; then<br />
/usr/bin/ranger "$@"<br />
else<br />
exit<br />
fi<br />
}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Artifacts in image preview ===<br />
<br />
Borderless columns may cause stripes in image previews. [https://bbs.linuxdistrocommunity.com/showthread.php?tid=1051] In {{ic|~/.config/ranger/rc.conf}} set:<br />
<br />
set draw_borders true<br />
<br />
== See also ==<br />
<br />
* [https://bbs.archlinux.org/viewtopic.php?id=93025 BBS thread]<br />
* [http://dotshare.it/category/fms/ranger/ DotShare.it configurations]<br />
* [https://github.com/hut/ranger GitHub]<br />
* [https://github.com/ranger/ranger/wiki/Official-user-guide Official User Guide]<br />
* [https://www.digitalocean.com/community/tutorials/installing-and-using-ranger-a-terminal-file-manager-on-a-ubuntu-vps Installing and using ranger]<br />
* [https://lists.nongnu.org/mailman/listinfo/ranger-users Mailing list]<br />
* [https://bloerg.net/2012/10/17/ranger-file-manager.html Ranger tutorial]</div>Granitosaurushttps://wiki.archlinux.org/index.php?title=GTK&diff=498684GTK2017-11-24T17:24:55Z<p>Granitosaurus: Update "flat-plat" to "materia theme" as per package rename</p>
<hr />
<div>[[Category:Widget toolkits]]<br />
[[cs:GTK+]]<br />
[[de:GTK+]]<br />
[[es:GTK+]]<br />
[[it:GTK+]]<br />
[[ja:GTK+]]<br />
[[ru:GTK+]]<br />
[[zh-hans:GTK+]]<br />
{{Related articles start}}<br />
{{Related|Uniform look for Qt and GTK applications}}<br />
{{Related|Qt}}<br />
{{Related|GNU Project}}<br />
{{Related|GTK+/Development}}<br />
{{Related articles end}}<br />
From the [http://www.gtk.org GTK+ website]:<br />
:GTK+, or the GIMP Toolkit, is a multi-platform toolkit for creating graphical user interfaces. Offering a complete set of widgets, GTK+ is suitable for projects ranging from small one-off tools to complete application suites.<br />
<br />
GTK+, The GIMP Toolkit, was initially made by the [[GNU Project]] for the [[GIMP]] but is now a very popular toolkit with bindings for many languages. This article will explore the tools used to configure the GTK+ theme, style, icon, font and font size, and also detail manual configuration.<br />
<br />
== Installation ==<br />
<br />
Two versions of GTK+ are currently available in the [[official repositories]]. They can be [[install]]ed with the following packages:<br />
* '''GTK+ 3.x''' is available with the {{Pkg|gtk3}} package.<br />
* '''GTK+ 2.x''' is available with the {{Pkg|gtk2}} package.<br />
* '''GTK+ 1.x''' is available with the {{AUR|gtk}} package.<br />
<br />
== Themes ==<br />
<br />
In GTK+ 2, the default theme is ''Raleigh'', but Arch Linux has a custom configuration file at {{ic|/usr/share/gtk-2.0/gtkrc}}, which sets the default theme to ''Adwaita''. In GTK+ 3, the default theme is ''Adwaita'', but ''HighContrast'', ''HighContrastInverse'' and ''Raleigh'' themes are also included.<br />
<br />
To force a specific theme, you can set environment variables.<br />
* For GTK+ 2, use the {{ic|GTK2_RC_FILES}} environment variable, for example:<br />
$ GTK2_RC_FILES=/usr/share/themes/Industrial/gtk-2.0/gtkrc gimp<br />
:will launch GIMP with the Industrial theme.<br />
* For GTK+ 3, use the {{ic|GTK_THEME}} environment variable, for example:<br />
$ GTK_THEME=Adwaita:dark gnome-calculator<br />
:will launch GNOME Calculator with the dark variant of Adwaita theme.<br />
<br />
More themes can be installed from the official repositories or the [[AUR]].<br />
<br />
'''GTK+ 2 and GTK+ 3.20 or newer are supported:'''<br />
* {{App|Adapta| An adaptive Gtk+ theme based on Material Design Guidelines. Includes: ''Adapta'', ''Adapta-Eta'', ''Adapta-Nokto'', ''Adapta-Nokto-Eta''|https://github.com/tista500/Adapta|{{Pkg|adapta-gtk-theme}}}}<br />
* {{App|Arc|A flat theme with a modern look and transparent elements. Includes: ''Arc'', ''Arc-Dark'', ''Arc-Darker''|https://github.com/horst3180/arc-theme|with transparency: {{Pkg|arc-gtk-theme}}, without transparency: {{Pkg|arc-solid-gtk-theme}}}}<br />
* {{App|Breeze|GTK+ version of KDE's default widget theme. Includes: ''Breeze'', ''Breeze-Dark''|https://cgit.kde.org/breeze-gtk.git|{{Pkg|breeze-gtk}}}}<br />
* {{App|Deepin|Default theme for the Deepin desktop. Includes: ''deepin'', ''deepin-dark''|https://github.com/linuxdeepin/deepin-gtk-theme|{{Pkg|deepin-gtk-theme}}}}<br />
* {{App|GNOME Standard Themes|Default themes for the GNOME desktop. Includes: ''Adwaita'', ''Adwaita-dark'', ''HighContrast''|https://github.com/GNOME/gnome-themes-standard|{{Pkg|gnome-themes-standard}}}}<br />
* {{App|MATE Themes|Default themes for the MATE desktop. Includes: ''BlackMATE'', ''Blue-Submarine'', ''BlueMenta'', ''ContrastHighInverse'', ''Green-Submarine'', ''GreenLaguna'', ''Menta'', ''TraditionalGreen'', ''TraditionalOk''|https://github.com/mate-desktop/mate-themes|{{Pkg|mate-themes}}}}<br />
* {{App|Numix|A flat and light theme with a modern look (GNOME, Openbox, Unity, Xfce). Includes: ''Numix''|https://github.com/shimmerproject/Numix|{{Pkg|numix-gtk-theme}}}}<br />
* {{App|Blackbird|Dark Desktop Suite for Xfce.|https://github.com/shimmerproject/Blackbird|{{AUR|xfce-theme-blackbird}}}}<br />
* {{App|Materia Theme| A Material Design-like flat theme for GTK3, GTK2, and GNOME-Shell.|https://github.com/nana-4/materia-theme|{{AUR|materia-theme}}}}<br />
* {{App|Gnome-breeze|A GTK theme created to match with the new Plasma 5 Breeze.|https://github.com/dirruk1/gnome-breeze|{{AUR|gnome-breeze-git}}}}<br />
* {{App|Greybird|A grey and blue Xfce theme, used by default in Xubuntu 12.04.|https://github.com/shimmerproject/Greybird|{{AUR|xfce-theme-greybird}}}}<br />
* {{App|Vertex|Theme for GTK 3, GTK 2, Gnome-Shell and Cinnamon.|https://github.com/horst3180/vertex-theme|{{AUR|vertex-themes}}}}<br />
* {{App|Zuki|Themes for GTK, gnome-shell and more.|https://github.com/lassekongo83/zuki-themes|{{AUR|zuki-themes-git}}}}<br />
<br />
'''Only GTK+ 2 is supported:'''<br />
* {{App|GTK+ Engines|Theme engines for GTK+ 2. Includes: ''Clearlooks'', ''Crux'', ''Industrial'', ''Mist'', ''Redmond'', ''ThinIce''|https://github.com/GNOME/gtk-engines|{{Pkg|gtk-engines}}}}<br />
* {{App|Xfce Gtk+ Engine|Xfce Gtk+-2.0 engine and themes|http://git.xfce.org/xfce/gtk-xfce-engine/|{{Pkg|gtk-xfce-engine}}}}<br />
* {{App|Oxygen-Gtk|Port of the default KDE widget theme (Oxygen) to GTK2|https://cgit.kde.org/oxygen-gtk.git|{{Pkg|oxygen-gtk2}}}}<br />
* {{App|Aurora Gtk Engine|Latest member of the Clearlooks family.|http://gnome-look.org/content/show.php/Aurora+Gtk+Engine?content&#61;56438|{{Pkg|gtk-engine-aurora}}}}<br />
* {{App|QtCurve|A configurable set of widget styles for KDE and Gtk.|https://cgit.kde.org/qtcurve.git|{{Pkg|qtcurve-gtk2}}}}<br />
<br />
There are a number of additional GTK+ themes in the [[AUR]]: [https://aur.archlinux.org/packages.php?K=gtk-theme search for gtk-theme], [https://aur.archlinux.org/packages.php?K=gtk2-theme search for gtk2-theme].<br />
<br />
{{Note|Because GTK+ 3 changes rapidly, GTK+ 3 themes often require re-working after a GTK+ 3 release. For this reason, not all GTK+ 3 themes may look as intended when used with the latest GTK+ 3 version.}}<br />
<br />
=== GTK+ and Qt ===<br />
<br />
If you have GTK+ and Qt (KDE) applications on your desktop then you know that their looks do not blend well. If you wish to make your GTK+ styles match your Qt styles please read [[Uniform look for Qt and GTK applications]].<br />
<br />
== Configuration tools ==<br />
<br />
Most major [[desktop environments]] provide tools to configure the GTK+ theme, icons, font and font size, and manage these settings via [http://standards.freedesktop.org/xsettings-spec/xsettings-spec-0.5.html XSettings]:<br />
* If you use [[Cinnamon]], use Themes tool (''cinnamon-settings themes''): go to ''System Settings > Themes''.<br />
* If you use [[Enlightenment]]: go to ''Settings > All > Look > Application Theme''.<br />
* If you use [[GNOME]], use GNOME Tweak Tool (''gnome-tweak-tool''): install {{Pkg|gnome-tweak-tool}}.<br />
* If you use [[MATE]], use the Appearance Preferences tool (''mate-appearance-properties''): go to ''System > Settings > Appearance''.<br />
* If you use [[Xfce]], use the Appearance tool: go to ''Settings > Appearance''.<br />
<br />
Other GUI tools generally overwrite the [[#Configuration|configuration files]].<br />
<br />
'''Both GTK+ 2 and GTK+ 3 are supported:'''<br />
* {{App|KDE GTK Configurator|Application that allows you to change style and font of GTK+ 2 and Gtk+ 3 applications.|https://cgit.kde.org/kde-gtk-config.git|{{Pkg|kde-gtk-config}}}}<br />
:After installation, {{ic|kde-gtk-config}} can also be found in ''System Settings > Application Style > GTK''.<br />
* {{App|LXAppearance|Desktop independent GTK+ 2 and GTK+ 3 style configuration tool from the LXDE project (it does not require other parts of the LXDE desktop).|http://wiki.lxde.org/en/LXAppearance|{{Pkg|lxappearance}}}}<br />
* {{App|Oo-mox| Graphical application for generating different color variations of Numix and Flat-Plat themes (GTK+ 2 and 3), Archdroid and Gnome-Colors icon themes. Also allows generating pre-scaled GTK+ 2 themes for HiDPI displays. |https://github.com/actionless/oomox|{{AUR|oomox}}}}<br />
<br />
'''Only GTK+ 2 is supported:'''<br />
* {{App|GTK+ Change Theme|Little program that lets you change your GTK+ 2.0 theme (considered a better alternative to ''switch2'').|http://plasmasturm.org/code/gtk-chtheme/|{{Pkg|gtk-chtheme}}}}<br />
* {{App|GTK+ Preference Tool|GTK+ theme selector and font switcher.|http://gtk-win.sourceforge.net/home/index.php/Main/GTKPreferenceTool|{{Pkg|gtk2_prefs}}}}<br />
* {{App|GTK+ Theme Switch|Simple GTK+ theme switcher.|http://muhri.net/nav.php3?node&#61;gts|{{Pkg|gtk-theme-switch2}}}}<br />
<br />
== Configuration ==<br />
<br />
GTK+ settings can be specified manually in configuration files, but desktop environments and applications can override these settings. Depending on GTK+ version, these files are located at:<br />
* GTK+ 2 user specific: {{ic|~/.gtkrc-2.0}}<br />
* GTK+ 2 system wide: {{ic|/etc/gtk-2.0/gtkrc}}<br />
* GTK+ 3 user specific: {{ic|$XDG_CONFIG_HOME/gtk-3.0/settings.ini}}, or {{ic|$HOME/.config/gtk-3.0/settings.ini}} if {{ic|$XDG_CONFIG_HOME}} is not set<br />
* GTK+ 3 system wide: {{ic|/etc/gtk-3.0/settings.ini}}<br />
<br />
{{Note|<br />
*See the [http://library.gnome.org/devel/gtk3/stable/GtkSettings.html#GtkSettings.properties GTK+ 3 ''GtkSettings'' properties] (and [http://library.gnome.org/devel/gtk2/stable/GtkSettings.html#GtkSettings.properties GTK+ 2 properties]) in the GTK+ programming reference manual for the full list of currently supported GTK+ configuration options.<br />
*Some of the settings described below (such as {{ic|gtk-icon-sizes}}) are deprecated and ignored since GTK+ 3.10.<br />
*If you edit your GTK+ configuration files, only newly started applications will display the changes.}}<br />
<br />
=== Basic theme configuration ===<br />
<br />
To manually change the GTK+ theme, icons, font and font size, add the following to the configuration files, for example:<br />
<br />
'''GTK+ 2:'''<br />
{{hc|~/.gtkrc-2.0|2=<br />
gtk-icon-theme-name = "Adwaita"<br />
gtk-theme-name = "Adwaita"<br />
gtk-font-name = "DejaVu Sans 11"<br />
}}<br />
<br />
'''GTK+ 3:'''<br />
{{hc|$XDG_CONFIG_HOME/gtk-3.0/settings.ini|2=<br />
[Settings]<br />
gtk-icon-theme-name = Adwaita<br />
gtk-theme-name = Adwaita<br />
gtk-font-name = DejaVu Sans 11<br />
}}<br />
<br />
{{Note|The icon theme name is the name defined in the theme's index file, ''not'' the name of its directory.}}<br />
<br />
=== Dark theme variant ===<br />
<br />
Some GTK+ 3 themes contain a dark theme variant, but it's only used by default when the application requests it explicitly. To use dark theme variant with all GTK+ 3 applications, set:<br />
<br />
gtk-application-prefer-dark-theme = true<br />
<br />
=== Keyboard shortcuts ===<br />
<br />
Keyboard shortcuts (otherwise known as ''accelerators'' in GTK+) may be changed by hovering the mouse over the respective menu item, and pressing the desired key combination. To enable this feature, set:<br />
<br />
gtk-can-change-accels = 1<br />
<br />
==== Emacs keybindings ====<br />
To get Emacs-like keybindings in gtk apps:<br />
<br />
For GTK2, add {{ic|1=gtk-key-theme-name = "Emacs"}} to {{ic|~/.gtkrc-2.0}}.<br />
<br />
For GTK3 add the following to the noted file:<br />
<br />
{{hc|1=~/.config/gtk-3.0/settings.ini|2=<br />
[Settings]<br />
gtk-key-theme-name = Emacs}}<br />
<br />
Then run:<br />
<br />
$ gsettings set org.gnome.desktop.interface gtk-key-theme "Emacs"<br />
<br />
XFCE has a similar setting:<br />
<br />
$ xfconf-query -c xsettings -p /Gtk/KeyThemeName -s Emacs<br />
<br />
The config files in {{ic|/usr/share/themes/Emacs/}} determine what the Emacs bindings are, and can be changed.<br />
Copying sections to the users {{ic|~/.gtkrc-2.0}} file allows for changes on a per user basis.<br />
<br />
=== GNOME menu delay ===<br />
<br />
This setting controls the delay between pointing the mouse at a menu and that menu opening. This delay is measured in milliseconds.<br />
<br />
gtk-menu-popup-delay = 0<br />
<br />
=== Reduce widget sizes ===<br />
<br />
If you have a small screen or you just do not like big icons and widgets, you can resize things easily. <br />
<br />
To have icons without text in toolbars ([https://developer.gnome.org/gtk3/stable/gtk3-Standard-Enumerations.html#GtkToolbarStyle valid values]), use<br />
<br />
gtk-toolbar-style = GTK_TOOLBAR_ICONS<br />
<br />
To use smaller icons, use a line like this:<br />
<br />
gtk-icon-sizes = "panel-menu=16,16:panel=16,16:gtk-menu=16,16:gtk-large-toolbar=16,16\<br />
:gtk-small-toolbar=16,16:gtk-button=16,16"<br />
<br />
Or to remove icons from buttons completely:<br />
<br />
gtk-button-images = 0<br />
<br />
You can also remove icons from menus:<br />
<br />
gtk-menu-images = 0<br />
<br />
See also [http://martin.ankerl.com/2008/10/10/how-to-make-a-compact-gnome-theme/] and [http://gnome-look.org/content/show.php/Simple+eGTK?content=119812].<br />
<br />
=== File-Chooser Startup-Location ===<br />
<br />
Open the file-chooser within the '''current-working-directory''' and not the '''recent''' location. Normally the '''current-working-directory''' is '''home-directory'''.<br />
<br />
'''GTK+ 3'''<br />
<br />
Modify DConf with ''gsettings'', as the database file ($XDG_CONFIG_HOME/dconf/users) is binary:<br />
<br />
$ gsettings set org.gtk.Settings.FileChooser startup-mode cwd<br />
<br />
'''GTK+ 2'''<br />
<br />
Modify {{ic|~/.config/gtk-2.0/gtkfilechooser.ini}} configuration file:<br />
<br />
{{hc|~/.config/gtk-2.0/gtkfilechooser.ini|<br />
StartupMode&#61;cwd}}<br />
<br />
=== Legacy scrolling behavior ===<br />
<br />
{{Note|This setting is not obeyed by all GTK+ applications.}}<br />
{{Tip|Legacy scrolling behaviour can be achieved reliably simply by using right click instead of left click.}}<br />
<br />
Prior to GTK+ 3.6, clicking on either side of the slider in the scrollbar would move the scrollbar in the direction of the click by approximately one page. Since GTK+ 3.6, the slider will move directly to the position of the click. This behaviour can be reverted in some applications by creating the file with the content below:<br />
<br />
{{hc|~/.config/gtk-3.0/settings.ini|<nowiki><br />
[Settings]<br />
gtk-primary-button-warps-slider = false<br />
</nowiki>}}<br />
<br />
=== Disable overlay scrollbars ===<br />
<br />
Since GTK+ 3.15, overlay scrollbars are enabled by default, meaning that scrollbars will be shown only on mouseover in GTK+ 3 applications. This behavior can be reverted by setting the following environment variable: {{ic|1=GTK_OVERLAY_SCROLLING=0}}. <br />
<br />
See [[Environment variables#Graphical applications]].<br />
<br />
==== Remove overlay scroll indicators ====<br />
<br />
The positions of the overlay scrollbars are indicated by thin dashed lines in the application window. These dashed lines will be present even when overlay scrolling is disabled using the environment variable discussed in the section above. To remove the indicator lines, create the following file:<br />
<br />
{{hc|~/.config/gtk-3.0/gtk.css|<br />
/* Remove dotted lines from GTK+ 3 applications */<br />
undershoot.top, undershoot.right, undershoot.bottom, undershoot.left { background-image: none; }<br />
}}<br />
<br />
== GDK backends ==<br />
<br />
GDK (the underlying abstraction layer of GTK+) supports multiple backends to display GTK+ applications. The default backend is ''x11''.<br />
<br />
=== Broadway backend ===<br />
The GDK Broadway backend provides support for displaying GTK+ applications in a web browser, using HTML5 and web sockets. <br />
[https://developer.gnome.org/gtk3/3.8/gtk-broadway.html]<br />
<br />
When using broadwayd, specify the display number to use, prefixed with a colon, similar to X. The default display number is 1.<br />
<br />
$ display_number&#61;:5<br />
Start it.<br />
$ broadwayd $display_number <br />
<br />
Port Used on default<br />
port &#61; 8080 + $display_number<br />
<br />
Point your browser to http://127.0.0.1:port<br />
<br />
To Start apps<br />
<br />
$ GDK_BACKEND&#61;broadway BROADWAY_DISPLAY&#61;$display_number ''<<app>>''<br />
<br />
Alternatively can set address and port<br />
<br />
$ broadwayd --port $port_number --address $address $display_number<br />
<br />
=== Wayland backend ===<br />
<br />
The GDK [[Wayland]] backend can be enabled by setting the {{ic|GDK_BACKEND&#61;wayland}} environment variable.<br />
<br />
{{Tip|To disable GTK window decorations in Wayland, [[install]] the {{AUR|gtk3-optional-csd}} package and set the environment variable {{ic|1=GTK_CSD=0}}.}}<br />
<br />
== Troubleshooting ==<br />
<br />
=== Different themes between GTK+ 2 and GTK+ 3 applications ===<br />
<br />
In general, if a selected theme has support for both GTK+ 2 and GTK+ 3, the theme will be applied to all GTK+ 2 and GTK+ 3 applications. If a selected theme has support for only GTK+ 2, it will be used for GTK+ 2 applications and the default GTK+ theme will be used for GTK+ 3 applications. If the selected theme has support for only GTK+ 3, it will be used for GTK+ 3 applications and the default GTK+ theme will be used for GTK+ 2 applications. Thus for application theme consistency, it is best to use a theme which has support for both GTK+ 2 and GTK+ 3.<br />
<br />
You could find what themes installed on your system have both an GTK+ 2 and GTK+ 3 version by using this command (does not work with names containing spaces):<br />
find $(find ~/.themes /usr/share/themes/ -wholename "*/gtk-3.0" | sed -e "s/^\(.*\)\/gtk-3.0$/\1/") -wholename "*/gtk-2.0" | sed -e "s/.*\/\(.*\)\/gtk-2.0/\1"/<br />
<br />
=== Theme not applied to root applications ===<br />
<br />
As user theme files ({{ic|$XDG_CONFIG_HOME/gtk-3.0/settings.ini}}, {{ic|~/.gtkrc-2.0}}) are not read by other accounts, the selected theme will not apply to [[Running_X_apps_as_root|X applications run as root]]. Possible solutions include:<br />
<br />
* Create symlinks, e.g<br />
# ln -s /home/[username]/.gtkrc-2.0 /etc/gtk-2.0/gtkrc<br />
# ln -s /home/[username]/.config/gtk-3.0/settings.ini /etc/gtk-3.0/settings.ini<br />
* Configure system-wide theme files: {{ic|/etc/gtk-3.0/settings.ini}} (GTK+ 3) or {{ic|/etc/gtk-2.0/gtkrc}} (GTK+ 2)<br />
* Adjust the theme as root<br />
# gksu lxappearance<br />
* Use a settings daemon (this is what most desktop environments do). A desktop-agnostic variant using [http://standards.freedesktop.org/xsettings-spec/xsettings-spec-0.5.html XSettings] is available in the [[AUR]] under {{aur|xsettingsd-git}}.<br />
<br />
=== Client-side decorations ===<br />
<br />
GTK 3.12 introduced [http://blogs.gnome.org/mclasen/2013/12/05/client-side-decorations-in-themes/ client-side decorations], which move the title-bar away from the window manager. This may present issues such as [http://redmine.audacious-media-player.org/boards/1/topics/1135 double title-bars], no title-bar at all or [https://github.com/chjj/compton/issues/189 double shadows] with compositing enabled.<br />
<br />
To remove the shadow and gap around windows (for example in combination with a tiling window manager), create the following file:<br />
<br />
{{hc|~/.config/gtk-3.0/gtk.css|<nowiki>.window-frame, .window-frame:backdrop {<br />
box-shadow: 0 0 0 black;<br />
border-style: none;<br />
margin: 0;<br />
border-radius: 0;<br />
}<br />
<br />
.titlebar {<br />
border-radius: 0;<br />
}<br />
<br />
.window-frame.csd.popup {<br />
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.13);<br />
}<br />
<br />
.header-bar {<br />
background-image: none;<br />
background-color: #ededed;<br />
box-shadow: none;<br />
}<br />
/* You may want to use this if you don't like the double title.<br />
GtkLabel.title {<br />
opacity: 0;<br />
}*/<br />
</nowiki>}}<br />
<br />
To adjust the buttons in the header bar, use the {{ic|gtk-decoration-layout}} setting. [https://developer.gnome.org/gtk3/stable/GtkSettings.html#GtkSettings--gtk-decoration-layout] The below examples removes all buttons:<br />
<br />
{{hc|~/.config/gtk-3.0/settings.ini|2=<br />
gtk-decoration-layout=menu:<br />
}}<br />
<br />
=== cedilla ç/Ç instead of ć/Ć ===<br />
<br />
See [https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/518056], and [https://bugs.launchpad.net/ubuntu/+source/gtk+2.0/+bug/518056/comments/37] for a workaround using Xcompose (US international layout).<br />
<br />
===Suppress warning about accessibility bus===<br />
<br />
If you do not use any [https://wiki.gnome.org/Accessibility Gnome Accessibility] features, you may receive warnings like:<br />
<br />
WARNING **: Couldn't connect to accessibility bus:<br />
<br />
To suppress these warnings, execute programs with {{ic|1=NO_AT_BRIDGE=1}} or set that as a global [[environment variable]].<br />
<br />
=== Titlebar background color mismatch ===<br />
<br />
If you are using a [[window manager]] which uses a window decoration theme that mimics the GTK+ theme background color, you may find that the titlebar color no longer completely matches the application color in some GTK+ 3 applications. As a workaround, create the following file:<br />
{{hc|~/.config/gtk-3.0/gtk.css|<br />
/* Always use background color */<br />
GtkWindow {<br />
background-color: @theme_bg_color;<br />
}<br />
<br />
/* Fix tooltip background override */<br />
.tooltip {<br />
background-color: rgba(0, 0, 0, 0.8);<br />
}<br />
<br />
.tooltip * {<br />
background-color: transparent;<br />
}<br />
<br />
/* Fix Nautilus desktop window background override */<br />
NautilusWindow {<br />
background-color: transparent; <br />
}<br />
}}<br />
<br />
=== Wrong focus events with tiling window managers ===<br />
<br />
{{Note|1=This disables touchscreen support for GTK3 applications. [https://bugzilla.gnome.org/show_bug.cgi?id=677329#c14]}}<br />
<br />
[[Define]] {{ic|1=GDK_CORE_DEVICE_EVENTS=1}} to use GTK2 style input, instead of xinput2. [https://bugzilla.gnome.org/show_bug.cgi?id=677329#c10]<br />
<br />
=== Thumbnail support for GTK+ 2 file dialog ===<br />
<br />
Install {{AUR|gtk2-patched-filechooser-icon-view}} to have the option to view files as thumbnails instead of list in the GTK+ file chooser.<br />
<br />
=== Button/menu icons in some apps in GNOME Wayland session ===<br />
<br />
Your {{ic|~/.config/gtk-3.0/settings.ini}} file is misconfigured. This can happend if you try other GTK+ based desktop environments. These are the offending values:<br />
<br />
{{hc|~/.config/gtk-3.0/settings.ini|<nowiki>[Settings]<br />
gtk-button-images=1<br />
gtk-menu-images=1</nowiki>}}<br />
<br />
Simply set them to 0 or remove the whole file to use GNOME defaults.<br />
<br />
=== Printers not shown in the GTK print dialog ===<br />
<br />
From GTK 3.22 onwards, one needs to additionally install {{Pkg|gtk3-print-backends}} to get the list of printers in the GTK print dialog.<br />
<br />
Note for those who do not want to install polkit (and do not want to hassle with AUR packages like {{AUR|gtk3-light}}{{Broken package link|package not found}} {{AUR|gtk3-nobroadway-nowayland-nocolord}} {{AUR|gtk3-print-backends-nocolord}} {{AUR|colord-nopolkit}}): Although colord is needed for printing if GTK or gtk3-print-backends were compiled with colord support, printing works fine without polkit installed; at least with a monochrome printer and package versions gtk3-print-backends=3.22.19-2 and colord=1.4.1-1.<br />
<br />
=== Some GTK+ 2 themes only change the UI color palette ===<br />
<br />
Depending on the theme of choice's support for GTK+ 2, UI controls may still have the default Raleigh appearance, possibly with a different color palette. This is due to these themes requiring the GTK+ 2 Murrine engine, which is missing (GTK+ 2 programs should complain about it on their standard error output). Install the {{Pkg|gtk-engine-murrine}} package.<br />
<br />
== Examples ==<br />
<br />
GTK+ 2 configuration example:<br />
<br />
{{hc|~/.gtkrc-2.0|2=<br />
# GTK theme<br />
include "/usr/share/themes/Clearlooks/gtk-2.0/gtkrc"<br />
<br />
# Font<br />
style "myfont" {<br />
font_name = "DejaVu Sans 8"<br />
}<br />
widget_class "*" style "myfont"<br />
gtk-font-name = "DejaVu Sans 8"<br />
<br />
# Icon theme<br />
gtk-icon-theme-name = "Tango"<br />
<br />
# Toolbar style<br />
gtk-toolbar-style = GTK_TOOLBAR_ICONS<br />
}}<br />
<br />
GTK+ 3 example of a configuration as converted from GTK+ 2.x to GTK+ 3.x by {{Pkg|lxappearance}}:<br />
<br />
{{hc|$XDG_CONFIG_HOME/gtk-3.0/settings.ini|2=<br />
[Settings] <br />
gtk-theme-name=TraditionalOk<br />
gtk-icon-theme-name=Fog<br />
gtk-font-name=Luxi Sans 12<br />
gtk-cursor-theme-name=mate<br />
gtk-cursor-theme-size=24<br />
gtk-toolbar-style=GTK_TOOLBAR_BOTH_HORIZ<br />
gtk-toolbar-icon-size=GTK_ICON_SIZE_LARGE_TOOLBAR<br />
gtk-button-images=1<br />
gtk-menu-images=1<br />
gtk-enable-event-sounds=0<br />
gtk-enable-input-feedback-sounds=0<br />
gtk-xft-antialias=1<br />
gtk-xft-hinting=1<br />
gtk-xft-hintstyle=hintslight<br />
gtk-xft-rgba=rgb<br />
}}<br />
<br />
== See also ==<br />
<br />
* [http://www.gtk.org/ The official GTK+ website]<br />
* [[Wikipedia:GTK+|Wikipedia article about GTK+]]<br />
* [http://developer.gnome.org/gtk-tutorial/stable/ GTK+ 2.0 Tutorial]<br />
* [http://developer.gnome.org/gtk3/stable/ GTK+ 3 Reference Manual]<br />
* [http://developer.gnome.org/gtkmm-tutorial/stable/ gtkmm Tutorial]<br />
* [http://developer.gnome.org/gtkmm/stable/ gtkmm Reference Manual]</div>Granitosaurushttps://wiki.archlinux.org/index.php?title=Apache_Kafka&diff=473138Apache Kafka2017-04-06T11:28:57Z<p>Granitosaurus: /* Installation */</p>
<hr />
<div>[[Category:Networking]]<br />
[[ja:Apache Kafka]]<br />
[https://kafka.apache.org Apache Kafka] is a distributed streaming platform that:<br />
<br />
<br />
# Lets you publish and subscribe to streams of records. In this respect it is similar to a message queue or enterprise messaging system.<br />
# Lets you store streams of records in a fault-tolerant way.<br />
# Lets you process streams of records as they occur.<br />
<br />
== Installation ==<br />
<br />
Install the {{AUR|kafka}} package. <br />
Start {{ic|kafka.service}} with systemctl which should also atomatically enable/start {{ic|zookeeper@kafka.service}} as well.<br />
<br />
== Usage ==<br />
<br />
For usage see [https://kafka.apache.org/quickstart#quickstart_createtopic official documentation]<br />
<br />
== Clients ==<br />
<br />
* C - {{AUR|librdkafka-git}} <br />
* Python - https://github.com/dpkp/kafka-python <br />
* Php - {{AUR|php-rdkafka}} <br />
* Perl - {{AUR|perl16-pkafka}}</div>Granitosaurushttps://wiki.archlinux.org/index.php?title=Apache_Kafka&diff=473137Apache Kafka2017-04-06T11:24:47Z<p>Granitosaurus: Add page for apache kafka.</p>
<hr />
<div>[[Category:Networking]]<br />
[[ja:Apache Kafka]]<br />
[https://kafka.apache.org Apache Kafka] is a distributed streaming platform that:<br />
<br />
<br />
# Lets you publish and subscribe to streams of records. In this respect it is similar to a message queue or enterprise messaging system.<br />
# Lets you store streams of records in a fault-tolerant way.<br />
# Lets you process streams of records as they occur.<br />
<br />
== Installation ==<br />
<br />
Install the {{AUR|kafka}} package. <br />
Start {{ic|kafka.service}} with systemctl which should also atomatically enable/start {{ic|zookeeper@kafka.service}} automatically<br />
<br />
<br />
== Usage ==<br />
<br />
For usage see [https://kafka.apache.org/quickstart#quickstart_createtopic official documentation]<br />
<br />
== Clients ==<br />
<br />
* C - {{AUR|librdkafka-git}} <br />
* Python - https://github.com/dpkp/kafka-python <br />
* Php - {{AUR|php-rdkafka}} <br />
* Perl - {{AUR|perl16-pkafka}}</div>Granitosaurushttps://wiki.archlinux.org/index.php?title=RabbitMQ&diff=473134RabbitMQ2017-04-06T10:03:55Z<p>Granitosaurus: /* Configuration */ added info about config location and docs</p>
<hr />
<div>[[Category:Networking]]<br />
[[ja:RabbitMQ]]<br />
[https://www.rabbitmq.com/ RabbitMQ] is a messaging broker, an intermediary for messaging. It gives your applications a common platform to send and receive messages, and your messages a safe place to live until received.<br />
<br />
== Installation ==<br />
<br />
Install the {{Pkg|rabbitmq}} package.<br />
<br />
== Configuration ==<br />
<br />
No configuration should be needed. Simply [[start]] the {{ic|rabbitmq}} service. <br />
<br />
Default configuration file location {{ic|/etc/rabbitmq/rabbitmq-env.conf}}. See more about configuration [https://www.rabbitmq.com/configure.html on the official docs]<br />
<br />
== Troubleshooting ==<br />
<br />
=== Changed hostname ===<br />
<br />
If you have changed your hostname after you installed rabbitmq, it will no longer be able to start.<br />
This is due to the {{ic|NODENAME}} specified in {{ic|/etc/rabbitmq/rabbitmq-env.conf}}.<br />
Update it to reflect your new hostname, for example:<br />
<br />
{{hc|/etc/rabbitmq/rabbitmq-env.conf|<nowiki><br />
NODENAME=rabbit@my-new-hostname<br />
...<br />
</nowiki>}}<br />
<br />
=== Upgraded RabbitMQ to latest version and cannot start ===<br />
<br />
This might cause your {{ic|/etc/rabbitmq/rabbitmq-env.conf}} to get the wrong {{ic|NODENAME}}.<br />
For example, it might cause it to add another {{ic|@hostname}} part. In any case, this can be fixed by following [[#Changed hostname]].<br />
<br />
=== Erlang cookie error ===<br />
<br />
Failure to authenticate might be caused by a wrong rabbitmq HOME setting:<br />
Authentication failed (rejected by the remote node), please check the Erlang cookie<br />
...<br />
home dir: /root<br />
<br />
Home can be set in the configuration file:<br />
<br />
{{hc|/etc/rabbitmq/rabbitmq-env.conf|<nowiki><br />
...<br />
HOME=/var/lib/rabbitmq<br />
...<br />
</nowiki>}}</div>Granitosaurushttps://wiki.archlinux.org/index.php?title=CouchDB&diff=471672CouchDB2017-03-23T10:23:20Z<p>Granitosaurus: /* Installation */ Added note that service should be started before setting up the database.</p>
<hr />
<div>[[Category:Database management systems]]<br />
[[ja:Couchdb]]<br />
''"Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript."'' - [http://couchdb.apache.org/ CouchDB homepage]<br />
<br />
== Installation ==<br />
<br />
Install the {{Pkg|couchdb}} package.<br />
<br />
By default, the package depends on {{Pkg|erlang-nox}} without GTK, for headless servers. You can also install the standard version, {{Pkg|erlang}}, that does require GTK.<br />
<br />
After installation [[Systemd#Using units|Start/Enable]] the {{ic|couchdb.service}} daemon and visit: [http://127.0.0.1:5984/_utils/#setup http://127.0.0.1:5984/_utils/#setup] to setup the database and admin user account. <br />
If you select single node setup you might need to create few databases manually via http api:<br />
<br />
curl -X PUT http://127.0.0.1:5984/_users<br />
curl -X PUT http://127.0.0.1:5984/_replicator<br />
curl -X PUT http://127.0.0.1:5984/_global_changes<br />
<br />
see [http://docs.couchdb.org/en/2.0.0/install/index.html#single-node-setup Single Node Setup] for more.<br />
<br />
== Usage ==<br />
<br />
[[Systemd#Using units|Start/Enable]] the {{ic|couchdb.service}} daemon.<br />
<br />
Test to see if the service is running by running {{ic|curl <nowiki>http://127.0.0.1:5984/</nowiki>}}. Ping will not work (it's not supposed to unlike on other systems where it does). Note that in order to access this instance of CouchDB from another system you'll need to configure it (see below).<br />
<br />
=== Using Futon admin interface ===<br />
<br />
You can now access the Futon admin interface by going to [http://localhost:5984/_utils http://localhost:5984/_utils].<br />
<br />
== Configuration ==<br />
<br />
Change the default port, bind address, log-level and other useful nuggets in {{ic|/etc/couchdb/local.ini}}.<br />
<br />
{{Tip|Set {{ic|bind_address}} to {{ic|0.0.0.0}} to access CouchDB from any computer other than local.}}<br />
<br />
If you want to run CouchDB on port 80 you will have to run the daemon as root or use an iptables rule such as:<br />
<br />
$ iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 5984<br />
<br />
{{Note|Do not modify {{ic|/etc/couchdb/default.ini}} as it gets overwritten whenever couchdb is updated, copy any values you would like to change and put them in {{ic|/etc/couchdb/local.ini}}. Also be sure to restart {{ic|couchdb.service}} after changes to this file.}}<br />
<br />
=== Creating a self-signed certificate ===<br />
<br />
If you would like to use ssl with a self-signed certificate you can create one like this:<br />
<br />
# cd /etc/couchdb<br />
# openssl req -new -x509 -nodes -newkey rsa:4096 -keyout server.key -out server.crt<br />
<br />
Then uncomment httpsd and update the paths in {{ic|[daemons]}} and {{ic|[ssl]}} sections:<br />
<br />
{{hc|/etc/couchdb/local.ini|2=<br />
[daemons]<br />
httpsd = {couch_httpd, start_link, [https]}<br />
<br />
[ssl]<br />
cert_file = /etc/couchdb/server.crt<br />
key_file = /etc/couchdb/server.key<br />
}}<br />
<br />
Futon can be accessed over SSL on port 6984 via [https://localhost:6984/_utils/ https://localhost:6984/_utils/].<br />
<br />
=== Creating administrator users ===<br />
<br />
Before a server admin is configured, all clients have admin privileges. To create an admin user, click on "Fix this" link at bottom right of Futon interface.<br />
<br />
See [http://lizconlan.github.com/sandbox/securing-couchdb.html create a read-only database] for locking down databases and further security.<br />
<br />
== See also ==<br />
<br />
* [http://couchdb.apache.org/ Official CouchDB page]<br />
* [http://wiki.apache.org/couchdb/FrontPage CouchDB Wiki]<br />
* [http://guide.couchdb.org/ CouchDB - The Definitive Guide]<br />
* [http://lizconlan.github.com/sandbox/securing-couchdb.html create a read-only database]</div>Granitosaurushttps://wiki.archlinux.org/index.php?title=CouchDB&diff=471671CouchDB2017-03-23T10:20:50Z<p>Granitosaurus: /* Usage */ -XGET is redundant here, curl defaults to GET</p>
<hr />
<div>[[Category:Database management systems]]<br />
[[ja:Couchdb]]<br />
''"Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript."'' - [http://couchdb.apache.org/ CouchDB homepage]<br />
<br />
== Installation ==<br />
<br />
Install the {{Pkg|couchdb}} package.<br />
<br />
By default, the package depends on {{Pkg|erlang-nox}} without GTK, for headless servers. You can also install the standard version, {{Pkg|erlang}}, that does require GTK.<br />
<br />
After installation visit: [http://127.0.0.1:5984/_utils/#setup http://127.0.0.1:5984/_utils/#setup] to setup the database and admin user account. <br />
If you select single node setup you might need to create few databases manually via http api:<br />
<br />
curl -X PUT http://127.0.0.1:5984/_users<br />
curl -X PUT http://127.0.0.1:5984/_replicator<br />
curl -X PUT http://127.0.0.1:5984/_global_changes<br />
<br />
see [http://docs.couchdb.org/en/2.0.0/install/index.html#single-node-setup Single Node Setup] for more. <br />
<br />
== Usage ==<br />
<br />
[[Systemd#Using units|Start/Enable]] the {{ic|couchdb.service}} daemon.<br />
<br />
Test to see if the service is running by running {{ic|curl <nowiki>http://127.0.0.1:5984/</nowiki>}}. Ping will not work (it's not supposed to unlike on other systems where it does). Note that in order to access this instance of CouchDB from another system you'll need to configure it (see below).<br />
<br />
=== Using Futon admin interface ===<br />
<br />
You can now access the Futon admin interface by going to [http://localhost:5984/_utils http://localhost:5984/_utils].<br />
<br />
== Configuration ==<br />
<br />
Change the default port, bind address, log-level and other useful nuggets in {{ic|/etc/couchdb/local.ini}}.<br />
<br />
{{Tip|Set {{ic|bind_address}} to {{ic|0.0.0.0}} to access CouchDB from any computer other than local.}}<br />
<br />
If you want to run CouchDB on port 80 you will have to run the daemon as root or use an iptables rule such as:<br />
<br />
$ iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 5984<br />
<br />
{{Note|Do not modify {{ic|/etc/couchdb/default.ini}} as it gets overwritten whenever couchdb is updated, copy any values you would like to change and put them in {{ic|/etc/couchdb/local.ini}}. Also be sure to restart {{ic|couchdb.service}} after changes to this file.}}<br />
<br />
=== Creating a self-signed certificate ===<br />
<br />
If you would like to use ssl with a self-signed certificate you can create one like this:<br />
<br />
# cd /etc/couchdb<br />
# openssl req -new -x509 -nodes -newkey rsa:4096 -keyout server.key -out server.crt<br />
<br />
Then uncomment httpsd and update the paths in {{ic|[daemons]}} and {{ic|[ssl]}} sections:<br />
<br />
{{hc|/etc/couchdb/local.ini|2=<br />
[daemons]<br />
httpsd = {couch_httpd, start_link, [https]}<br />
<br />
[ssl]<br />
cert_file = /etc/couchdb/server.crt<br />
key_file = /etc/couchdb/server.key<br />
}}<br />
<br />
Futon can be accessed over SSL on port 6984 via [https://localhost:6984/_utils/ https://localhost:6984/_utils/].<br />
<br />
=== Creating administrator users ===<br />
<br />
Before a server admin is configured, all clients have admin privileges. To create an admin user, click on "Fix this" link at bottom right of Futon interface.<br />
<br />
See [http://lizconlan.github.com/sandbox/securing-couchdb.html create a read-only database] for locking down databases and further security.<br />
<br />
== See also ==<br />
<br />
* [http://couchdb.apache.org/ Official CouchDB page]<br />
* [http://wiki.apache.org/couchdb/FrontPage CouchDB Wiki]<br />
* [http://guide.couchdb.org/ CouchDB - The Definitive Guide]<br />
* [http://lizconlan.github.com/sandbox/securing-couchdb.html create a read-only database]</div>Granitosaurushttps://wiki.archlinux.org/index.php?title=CouchDB&diff=471572CouchDB2017-03-22T13:46:05Z<p>Granitosaurus: Adjusted installation instructions to include necessary setup step via fauxton web gui</p>
<hr />
<div>[[Category:Database management systems]]<br />
[[ja:Couchdb]]<br />
''"Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript."'' - [http://couchdb.apache.org/ CouchDB homepage]<br />
<br />
== Installation ==<br />
<br />
Install the {{Pkg|couchdb}} package.<br />
<br />
By default, the package depends on {{Pkg|erlang-nox}} without GTK, for headless servers. You can also install the standard version, {{Pkg|erlang}}, that does require GTK.<br />
<br />
After installation visit: [http://127.0.0.1:5984/_utils/#setup http://127.0.0.1:5984/_utils/#setup] to setup the database and admin user account. <br />
If you select single node setup you might need to create few databases manually via http api:<br />
<br />
curl -X PUT http://127.0.0.1:5984/_users<br />
curl -X PUT http://127.0.0.1:5984/_replicator<br />
curl -X PUT http://127.0.0.1:5984/_global_changes<br />
<br />
see [http://docs.couchdb.org/en/2.0.0/install/index.html#single-node-setup Single Node Setup] for more. <br />
<br />
== Usage ==<br />
<br />
[[Systemd#Using units|Start/Enable]] the {{ic|couchdb.service}} daemon.<br />
<br />
Test to see if the service is running by running {{ic|curl -XGET <nowiki>http://127.0.0.1:5984/</nowiki>}}. Ping will not work (it's not supposed to unlike on other systems where it does). Note that in order to access this instance of CouchDB from another system you'll need to configure it (see below).<br />
<br />
=== Using Futon admin interface ===<br />
<br />
You can now access the Futon admin interface by going to [http://localhost:5984/_utils http://localhost:5984/_utils].<br />
<br />
== Configuration ==<br />
<br />
Change the default port, bind address, log-level and other useful nuggets in {{ic|/etc/couchdb/local.ini}}.<br />
<br />
{{Tip|Set {{ic|bind_address}} to {{ic|0.0.0.0}} to access CouchDB from any computer other than local.}}<br />
<br />
If you want to run CouchDB on port 80 you will have to run the daemon as root or use an iptables rule such as:<br />
<br />
$ iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-ports 5984<br />
<br />
{{Note|Do not modify {{ic|/etc/couchdb/default.ini}} as it gets overwritten whenever couchdb is updated, copy any values you would like to change and put them in {{ic|/etc/couchdb/local.ini}}. Also be sure to restart {{ic|couchdb.service}} after changes to this file.}}<br />
<br />
=== Creating a self-signed certificate ===<br />
<br />
If you would like to use ssl with a self-signed certificate you can create one like this:<br />
<br />
# cd /etc/couchdb<br />
# openssl req -new -x509 -nodes -newkey rsa:4096 -keyout server.key -out server.crt<br />
<br />
Then uncomment httpsd and update the paths in {{ic|[daemons]}} and {{ic|[ssl]}} sections:<br />
<br />
{{hc|/etc/couchdb/local.ini|2=<br />
[daemons]<br />
httpsd = {couch_httpd, start_link, [https]}<br />
<br />
[ssl]<br />
cert_file = /etc/couchdb/server.crt<br />
key_file = /etc/couchdb/server.key<br />
}}<br />
<br />
Futon can be accessed over SSL on port 6984 via [https://localhost:6984/_utils/ https://localhost:6984/_utils/].<br />
<br />
=== Creating administrator users ===<br />
<br />
Before a server admin is configured, all clients have admin privileges. To create an admin user, click on "Fix this" link at bottom right of Futon interface.<br />
<br />
See [http://lizconlan.github.com/sandbox/securing-couchdb.html create a read-only database] for locking down databases and further security.<br />
<br />
== See also ==<br />
<br />
* [http://couchdb.apache.org/ Official CouchDB page]<br />
* [http://wiki.apache.org/couchdb/FrontPage CouchDB Wiki]<br />
* [http://guide.couchdb.org/ CouchDB - The Definitive Guide]<br />
* [http://lizconlan.github.com/sandbox/securing-couchdb.html create a read-only database]</div>Granitosaurus