mirror of
https://github.com/arcan1s/arcanis.me.git
synced 2025-04-24 15:27:17 +00:00
updated papers
Refactoring of an English part is done
This commit is contained in:
parent
7ecdf0935c
commit
af702d8511
@ -1,8 +1,8 @@
|
||||
<figure class="sign" style="float:none;">
|
||||
{% if page.category == "ru" %}
|
||||
<a href="/resources/screenshots/{{ scrname }}.png" title="Полный размер">
|
||||
<a href="/resources/screenshots/{{ scrname }}.png" title="Полный размер" type="image/png">
|
||||
{% else %}
|
||||
<a href="/resources/screenshots/{{ scrname }}.png" title="Full size">
|
||||
<a href="/resources/screenshots/{{ scrname }}.png" title="Full size" type="image/png">
|
||||
{% endif %}
|
||||
<img src="/resources/preview/{{ scrname }}_prev.jpg" alt="{{ scrname }}">
|
||||
</a><br>
|
||||
|
@ -6,19 +6,22 @@ hasTr: true
|
||||
tags: zshrc, configuration, linux
|
||||
title: About zshrc
|
||||
short: about-zshrc
|
||||
description: It is first paper in my blog (I think I need something here for tests =)). There are many similar articles, and I'll not be an exception. I just want to show my <code>.zshrc</code> and explain what it does and why it is needed. Also any comments or additions are welcome. It is a translated paper from Russian (<a href="http://archlinux.org.ru/forum/topic/12752/">original</a>).
|
||||
description: It is first paper in my blog (I think I need something here for tests =)). There are many similar articles, and I'll not be an exception. I just want to show my <code>.zshrc</code> and explain what it does and why it is needed. Also any comments or additions are welcome. It is a translated paper from Russian (<a href="http://archlinux.org.ru/forum/topic/12752/" title="Forum thread">original</a>).
|
||||
---
|
||||
<h2><a name="prepare" class="anchor" href="#prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
|
||||
<h2><a href="#prepare" class="anchor" name="prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
|
||||
<p>First install recommended minima:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting
|
||||
{% endhighlight %}
|
||||
<p><a href="https://www.archlinux.org/packages/pkgfile/">pkgfile</a> is a very useful utility. Also this command will install shell, additional completion and syntax highlighting.</p>
|
||||
|
||||
<h2><a name="configuration" class="anchor" href="#configuration"><span class="octicon octicon-link"></span></a>Shell configuration</h2>
|
||||
<p>All options are avaible <a href="http://zsh.sourceforge.net/Doc/Release/Options.html">here</a>.</p>
|
||||
<p><a href="https://www.archlinux.org/packages/pkgfile/" title="Archlinux package">pkgfile</a> is a very useful utility. Also this command will install shell, additional completion and syntax highlighting.</p>
|
||||
|
||||
<h2><a href="#configuration" class="anchor" name="configuration"><span class="octicon octicon-link"></span></a>Shell configuration</h2>
|
||||
<p>All options are avaible <a href="http://zsh.sourceforge.net/Doc/Release/Options.html" title="zsh documentation">here</a>.</p>
|
||||
|
||||
<p>Set history file and number of commands in cache of the current session and in the history file:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# history
|
||||
HISTFILE=~/.zsh_history
|
||||
@ -27,6 +30,7 @@ SAVEHIST=500000
|
||||
{% endhighlight %}
|
||||
|
||||
<p>I can not remember all <code>Ctrl+</code> combinations so I bind keys to its default usages:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# bindkeys
|
||||
bindkey '^[[A' up-line-or-search # up arrow for back-history-search
|
||||
@ -38,9 +42,11 @@ bindkey '\e[4~' end-of-line # end
|
||||
bindkey '\e[5~' up-line-or-history # page-up
|
||||
bindkey '\e[6~' down-line-or-history # page-down
|
||||
{% endhighlight %}
|
||||
|
||||
<p>But in this case <code>Up</code>/<code>Down</code> arrows are used to navigate through the history based on <b>already entered part</b> of a command. And <code>PgUp</code>/<code>PgDown</code> <b>will ignore</b> already entered part of a command.</p>
|
||||
|
||||
<p>Command autocomplete:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# autocomplete
|
||||
autoload -U compinit
|
||||
@ -48,9 +54,11 @@ compinit
|
||||
zstyle ':completion:*' insert-tab false
|
||||
zstyle ':completion:*' max-errors 2
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Full command autocomplete will be enabled. <code>insert-tab false</code> will enable autocomplete for <b>non-entered</b> commands. <code>max-errors</code> sets maximum number of errors that could be corrected.</p>
|
||||
|
||||
<p>Prompt:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# promptinit
|
||||
autoload -U promptinit
|
||||
@ -58,6 +66,7 @@ promptinit
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Enable colors:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# colors
|
||||
autoload -U colors
|
||||
@ -66,53 +75,71 @@ colors
|
||||
|
||||
<p>Here are some other options.</p>
|
||||
<p>Change directory without <code>cd</code>:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# autocd
|
||||
setopt autocd
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Correcting of typos (and question template):</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# correct
|
||||
setopt CORRECT_ALL
|
||||
SPROMPT="Correct '%R' to '%r' ? ([Y]es/[N]o/[E]dit/[A]bort) "
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Disable f#$%ing beep:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# disable beeps
|
||||
unsetopt beep
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Enable calculator:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# calc
|
||||
autoload zcalc
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Append history (<b>do not recreate</b> the history file):</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# append history
|
||||
setopt APPEND_HISTORY
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Do not save dups to history file:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# ignore spaces in history
|
||||
setopt HIST_IGNORE_ALL_DUPS
|
||||
{% endhighlight %}
|
||||
|
||||
<p>...and additional spaces:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# ignore dups in history
|
||||
setopt HIST_IGNORE_SPACE
|
||||
{% endhighlight %}
|
||||
|
||||
<p>...and blank lines too:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# reduce blanks in history
|
||||
setopt HIST_REDUCE_BLANKS
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Enable <code>pkgfile</code>:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# pkgfile
|
||||
source /usr/share/doc/pkgfile/command-not-found.zsh
|
||||
{% endhighlight %}
|
||||
|
||||
<h2><a name="highlighting" class="anchor" href="#highlighting"><span class="octicon octicon-link"></span></a>Syntax highlighting</h2>
|
||||
<h2><a href="#highlighting" class="anchor" name="highlighting"><span class="octicon octicon-link"></span></a>Syntax highlighting</h2>
|
||||
|
||||
{% highlight bash %}
|
||||
# highlighting
|
||||
source /usr/share/zsh/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
@ -159,10 +186,12 @@ ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow'
|
||||
# root example
|
||||
#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
|
||||
{% endhighlight %}
|
||||
|
||||
<p>In first line highlighting is turned on. Next main, brackets and pattern highlighting are turned on. Patterns are set below (<code>rm -rf *</code> in the example). Also <code>root</code> and <code>cursor</code> highlighting may be turned on. Colors syntax is understandable, <code>fg</code> is font color, <code>bg</code> is background color.</p>
|
||||
|
||||
<h2><a name="prompt" class="anchor" href="#prompt"><span class="octicon octicon-link"></span></a>$PROMPT and $RPROMPT</h2>
|
||||
<h2><a href="#prompt" class="anchor" name="prompt"><span class="octicon octicon-link"></span></a>$PROMPT and $RPROMPT</h2>
|
||||
<p>The general idea is the use single <code>.zshrc</code> for root and normal user:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# PROMPT && RPROMPT
|
||||
if [[ $EUID == 0 ]]; then
|
||||
@ -185,6 +214,7 @@ fi
|
||||
{% endhighlight %}
|
||||
|
||||
<p><code>fg</code> is font color, <code>bg</code> is background color. <code>_bold</code> and <code>_no_bold</code> regulate the tint. Commands should be in <code>%{ ... %}</code> so they do not appear. Avaible colors are:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
black
|
||||
red
|
||||
@ -197,6 +227,7 @@ white
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Avaible variables are:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
%n - the username
|
||||
%m - the computer's hostname (truncated to the first period)
|
||||
@ -213,6 +244,7 @@ white
|
||||
{% endhighlight %}
|
||||
|
||||
<p>RPROMPT (<code>acpi</code> package is necessary):</p>
|
||||
|
||||
{% highlight bash %}
|
||||
precmd () {
|
||||
# battery charge
|
||||
@ -237,12 +269,14 @@ $(batcharge)\
|
||||
$returncode\
|
||||
"%{$fg_bold[white]%}]%{$reset_color%}"
|
||||
{% endhighlight %}
|
||||
|
||||
<p>My RPROMPT shows current time, battery change and last returned code. <code>precmd()</code> is necessary for automatic updating. The construct <code>$(if.true.false)</code> is conditional statement in <code>zsh</code>.</p>
|
||||
|
||||
<h2><a name="aliases" class="anchor" href="#aliases"><span class="octicon octicon-link"></span></a>Aliases</h2>
|
||||
<h2><a href="#aliases" class="anchor" name="aliases"><span class="octicon octicon-link"></span></a>Aliases</h2>
|
||||
<p><b>Copy only those aliases that you need.</b> If any alias uses application that is not installed it will leads to fail of loading of configuration file.</p>
|
||||
|
||||
<p>Small useful (or maybe not) function:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
show_which() {
|
||||
OUTPUT=$(which $1 | cut -d " " -f7-)
|
||||
@ -251,6 +285,7 @@ show_which() {
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Here is the first group of aliases:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
## alias
|
||||
# colored grep
|
||||
@ -269,7 +304,8 @@ alias less='vimpager'
|
||||
alias zless='vimpager'
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Here are ls aliases (see <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?ls">man ls</a>):</p>
|
||||
<p>Here are ls aliases (see <a href="http://unixhelp.ed.ac.uk/CGI/man-cgi?ls" title="Man page">man ls</a>):</p>
|
||||
|
||||
{% highlight bash %}
|
||||
alias ls='show_which ls && ls --color=auto --group-directories-first'
|
||||
alias ll='show_which ll && ls -l --human-readable'
|
||||
@ -282,6 +318,7 @@ alias lm='show_which lm && la | more'
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Here are aliases to quick file view from console (just type a file name!):</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# alias -s
|
||||
alias -s {avi,mpeg,mpg,mov,m2v,mkv}=mpv
|
||||
@ -293,6 +330,7 @@ alias -s {html,htm}=opera
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Here are "sudo" aliases:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# sudo alias
|
||||
if [[ $EUID == 0 ]]; then
|
||||
@ -316,6 +354,7 @@ fi
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Here are global aliases. If they are enable the command <code>cat foo g bar</code> will be equivalent the command <code>cat foo | grep bar</code>:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# global alias
|
||||
alias -g g="| grep"
|
||||
@ -325,7 +364,7 @@ alias -g h="| head"
|
||||
alias -g dn="&> /dev/null &"
|
||||
{% endhighlight %}
|
||||
|
||||
<h2><a name="functions" class="anchor" href="#functions"><span class="octicon octicon-link"></span></a>Functions</h2>
|
||||
<h2><a href="#functions" class="anchor" name="functions"><span class="octicon octicon-link"></span></a>Functions</h2>
|
||||
<p>Here is a special function for <code>xrandr</code>:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
@ -352,6 +391,7 @@ projctl () {
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Unfortunately I can not remember <code>tar</code> flags thus I use special functions:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# function to extract archives
|
||||
# EXAMPLE: unpack file
|
||||
@ -405,6 +445,7 @@ pack () {
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Here is a special function for <code>su</code>:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
su () {
|
||||
CHECKSU=0
|
||||
@ -423,6 +464,7 @@ su () {
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Function that replaces original <code>rm</code> command. If you type <code>rm</code> it will be equivalent moving to trash an you can easily restore a file:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
rm () {
|
||||
# error check
|
||||
@ -466,6 +508,7 @@ rm () {
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Functions with automatic rehash after installing/removing packages are:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
pacman () {
|
||||
/usr/bin/sudo /usr/bin/pacman $* && echo "$*" | grep -q "S\|R\|U" && rehash
|
||||
@ -478,12 +521,14 @@ yatest () {
|
||||
/usr/bin/yaourt --config /etc/pactest.conf $* && echo "$*" | grep -q "S\|R\|U" && rehash
|
||||
}
|
||||
{% endhighlight %}
|
||||
<p>But autocomplete for <code>yaourt -Ss</code> <a href="https://github.com/zsh-users/zsh-completions/pull/205">will require</a> root privileges.</p>
|
||||
|
||||
<h2><a name="variables" class="anchor" href="#variables"><span class="octicon octicon-link"></span></a>Variables</h2>
|
||||
<p>But autocomplete for <code>yaourt -Ss</code> <a href="https://github.com/zsh-users/zsh-completions/pull/205" title="Issue">will require</a> root privileges.</p>
|
||||
|
||||
<h2><a href="#variables" class="anchor" name="variables"><span class="octicon octicon-link"></span></a>Variables</h2>
|
||||
<p>It is recommended to set own variables in <code>~/.zshenv</code>. But I have everything stored in the single file.</p>
|
||||
|
||||
<p>Here are path, mask of new files, editor and pager:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# path
|
||||
export PATH="$PATH:$HOME/.local/bin"
|
||||
@ -495,6 +540,7 @@ export PAGER="vimpager"
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Here is hashes. If they are enable the command <code>~global</code> will be equivalent the command <code>/mnt/global</code>:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# hash
|
||||
hash -d global=/mnt/global
|
||||
@ -504,8 +550,12 @@ hash -d u1=/mnt/usbdev1
|
||||
hash -d u2=/mnt/usbdev
|
||||
{% endhighlight %}
|
||||
|
||||
<h2><a name="screenshot" class="anchor" href="#screenshot"><span class="octicon octicon-link"></span></a>Screenshot</h2>
|
||||
<p><a href="/resources/screenshots/zshrc_demo.png"><img src="/resources/preview/zshrc_demo_prev.jpg"></a></p>
|
||||
<h2><a href="#screenshot" class="anchor" name="screenshot"><span class="octicon octicon-link"></span></a>Screenshot</h2>
|
||||
<p>
|
||||
{% assign scrdesc = "Zsh demonstation" %}
|
||||
{% assign scrname = "zshrc_demo" %}
|
||||
{% include prj_scr.html %}
|
||||
</p>
|
||||
|
||||
<h2><a name="file" class="anchor" href="#file"><span class="octicon octicon-link"></span></a>File</h2>
|
||||
<p><a href="https://raw.github.com/arcan1s/dotfiles/master/zshrc">Here is</a> my <code>.zshrc</code>.</p>
|
||||
<h2><a href="#file" class="anchor" name="file"><span class="octicon octicon-link"></span></a>File</h2>
|
||||
<p><a href="https://raw.github.com/arcan1s/dotfiles/master/zshrc" title="GitHub">Here is</a> my <code>.zshrc</code>.</p>
|
||||
|
@ -6,30 +6,36 @@ hasTr: true
|
||||
tags: archlinux, linux, building, qutim
|
||||
title: Building Qutim using Qt5
|
||||
short: building-qutim-using-qt5
|
||||
description: <a href="http://qutim.org">Qutim</a> is a multiprotocol and cross platform messenger. It is written on <code>CPP</code> using Qt library. The project is actively developed. In this paper I will say about building this package in Archlinux using Qt5 library (instead of Qt4 which is used in current AUR packages).
|
||||
description: <a href="http://qutim.org" title="Qutim Homepage">Qutim</a> is a multiprotocol and cross platform messenger. It is written on <code>CPP</code> using Qt library. The project is actively developed. In this paper I will say about building this package in Archlinux using Qt5 library (instead of Qt4 which is used in current AUR packages).
|
||||
---
|
||||
<h2><a name="problems" class="anchor" href="#problems"><span class="octicon octicon-link"></span></a>What's wrong?</h2>
|
||||
<p>This package uses <a href="http://qt-project.org/wiki/qbs">qbs</a> for building, which is a bit strange IMHO. A package, which is necessary for building, is <a href="https://aur.archlinux.org/packages/qbs-git/">in AUR </a>. I recommend to use git version of the package. When I asked Andrea Scarpino (who maintains KDE and Qt packages into the official repos) about qbs, he told me "we will support it in time". And I agree with him, the project seems to be a little unstable.</p>
|
||||
<h2><a href="#problems" class="anchor" name="problems"><span class="octicon octicon-link"></span></a>What's wrong?</h2>
|
||||
<p>This package uses <a href="http://qt-project.org/wiki/qbs" title="Wiki">qbs</a> for building, which is a bit strange IMHO. A package, which is necessary for building, is <a href="https://aur.archlinux.org/packages/qbs-git/" title="AUR">in AUR </a>. I recommend to use git version of the package. When I asked Andrea Scarpino (who maintains KDE and Qt packages into the official repos) about qbs, he told me "we will support it in time". And I agree with him, the project seems to be a little unstable.</p>
|
||||
|
||||
<h2><a name="prepare" class="anchor" href="#prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
|
||||
<h2><a href="#prepare" class="anchor" name="prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
|
||||
<p>Install dependences. I had used <code>namcap</code>, so maybe I missed something:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
pacman -Sy --asdeps clang git libc++abi qt5-quick1 qt5-x11extras
|
||||
yaourt -S --asdeps jreen-git qbs-git
|
||||
{% endhighlight %}
|
||||
|
||||
<h3><a name="qbs" class="anchor" href="#qbs"><span class="octicon octicon-link"></span></a>qbs settings</h3>
|
||||
<p>You may read about qbs <a href="http://qt-project.org/wiki/qbs">on the link</a> or see examples which are provides by the package. qbs uses configuration file that firstly you must create and secondly it is stored in your home directory. In theory a configuration file creating ((<code>~/.config/QtProject/qbs.conf</code>)) looks like this:</p>
|
||||
<h3><a href="#qbs" class="anchor" name="qbs"><span class="octicon octicon-link"></span></a>qbs settings</h3>
|
||||
<p>You may read about qbs <a href="http://qt-project.org/wiki/qbs" title="Wiki">on the link</a> or see examples which are provides by the package. qbs uses configuration file that firstly you must create and secondly it is stored in your home directory. In theory a configuration file creating ((<code>~/.config/QtProject/qbs.conf</code>)) looks like this:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
qbs-setup-qt --detect
|
||||
qbs-detect-toolchains
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Firstly we find Qt libraries. Then we find toolchains (such as compilers). And next we must insert a toolchain into Qt profile (for example, we need <code>clang</code> toolchain):</p>
|
||||
|
||||
{% highlight bash %}
|
||||
sed 's/clang\\/qt-5-2-0\\/g' -i ~/.config/QtProject/qbs.conf
|
||||
{% endhighlight %}
|
||||
|
||||
<p>And there are other ways. You may edit the file manually or use <code>qbs-config-ui</code> or <code>qbs-config</code>.</p>
|
||||
<p>So, we have created the configuration file and put it into build directory:</p>
|
||||
|
||||
{% highlight ini %}
|
||||
[General]
|
||||
|
||||
@ -65,10 +71,12 @@ qutim\qbs\architecture=x86_64
|
||||
qutim\qbs\endianness=little
|
||||
qutim\qbs\toolchain=clang, llvm, gcc
|
||||
{% endhighlight %}
|
||||
<p><a href="/resources/docs/qutim-qt5-git/qbs-qutim.conf">qbs-qutim.conf</a></p>
|
||||
|
||||
<h3><a name="patch" class="anchor" href="#patch"><span class="octicon octicon-link"></span></a>Patch for sources</h3>
|
||||
<p><a href="/resources/docs/qutim-qt5-git/qbs-qutim.conf" title="File" type="text/plain">qbs-qutim.conf</a></p>
|
||||
|
||||
<h3><a href="#patch" class="anchor" name="patch"><span class="octicon octicon-link"></span></a>Patch for sources</h3>
|
||||
<p>The first problem is <code>clang</code> (at least in Archlinux):</p>
|
||||
|
||||
{% highlight diff %}
|
||||
diff -ruN qutim.orig/core/libqutim.qbs qutim/core/libqutim.qbs
|
||||
--- qutim.orig/core/libqutim.qbs 2014-01-06 15:39:56.000000000 +0400
|
||||
@ -83,7 +91,9 @@ diff -ruN qutim.orig/core/libqutim.qbs qutim/core/libqutim.qbs
|
||||
}
|
||||
|
||||
{% endhighlight %}
|
||||
|
||||
<p>And the second one is Vk plugin:</p>
|
||||
|
||||
{% highlight diff %}
|
||||
diff -ruN qutim.orig/protocols/vkontakte/vreen/vreen.qbs qutim/protocols/vkontakte/vreen/vreen.qbs
|
||||
--- qutim.orig/protocols/vkontakte/vreen/vreen.qbs 2014-01-06 15:41:42.000000000 +0400
|
||||
@ -97,9 +107,11 @@ diff -ruN qutim.orig/protocols/vkontakte/vreen/vreen.qbs qutim/protocols/vkontak
|
||||
property string vreen_version_major: 1
|
||||
property string vreen_version_minor: 9
|
||||
{% endhighlight %}
|
||||
<p><a href="/resources/docs/qutim-qt5-git/qutim-qbs-1.1.patch">qutim-qbs-1.1.patch</a></p>
|
||||
|
||||
<h3><a name="sources" class="anchor" href="#sources"><span class="octicon octicon-link"></span></a>Get sources</h3>
|
||||
<p><a href="/resources/docs/qutim-qt5-git/qutim-qbs-1.1.patch" title="File" type="text/plain">qutim-qbs-1.1.patch</a></p>
|
||||
|
||||
<h3><a href="#sources" class="anchor" name="sources"><span class="octicon octicon-link"></span></a>Get sources</h3>
|
||||
|
||||
{% highlight bash %}
|
||||
# clone repo
|
||||
git clone https://github.com/euroelessar/qutim
|
||||
@ -116,20 +128,25 @@ cd ..
|
||||
patch -p0 -i qutim-qbs-1.1.patch
|
||||
{% endhighlight %}
|
||||
|
||||
<h2><a name="build" class="anchor" href="#build"><span class="octicon octicon-link"></span></a>Building</h2>
|
||||
<h2><a href="#build" class="anchor" name="build"><span class="octicon octicon-link"></span></a>Building</h2>
|
||||
|
||||
{% highlight bash %}
|
||||
cd qutim
|
||||
HOME=$(pwd) qbs -j $(nproc) -d ../build release profile:qutim
|
||||
{% endhighlight %}
|
||||
|
||||
<p>I want to create a universal recipe for the building, thus we must set <code>$HOME</code> directory. Flag <code>-j</code> means number of jobs, <code>-d</code> means build directory, <code>release</code> means building type (debug, release), <code>profile</code> is used profile, which is described in the configuration file.</p>
|
||||
|
||||
<h2><a name="install" class="anchor" href="#install"><span class="octicon octicon-link"></span></a>Installation</h2>
|
||||
<h2><a href="#install" class="anchor" name="install"><span class="octicon octicon-link"></span></a>Installation</h2>
|
||||
|
||||
{% highlight bash %}
|
||||
HOME=$(pwd) sudo qbs install -d ../build --install-root "/usr" profile:qutim
|
||||
{% endhighlight %}
|
||||
|
||||
<p>We must set root directory (<code>--install-root</code>), because without this option the package will be installed into <code>/</code> (<code>/bin</code> and <code>/lib</code>).</p>
|
||||
|
||||
<h2><a name="pkgbuild" class="anchor" href="#pkgbuild"><span class="octicon octicon-link"></span></a>PKGBUILD</h2>
|
||||
<h2><a href="#pkgbuild" class="anchor" name="pkgbuild"><span class="octicon octicon-link"></span></a>PKGBUILD</h2>
|
||||
|
||||
{% highlight bash %}
|
||||
pkgname=qutim-qt5-git
|
||||
_gitname=qutim
|
||||
@ -182,4 +199,5 @@ package() {
|
||||
HOME="${srcdir}" qbs install -d ../build --install-root "${pkgdir}/usr" profile:qutim
|
||||
}
|
||||
{% endhighlight %}
|
||||
<p><a href="/resources/docs/qutim-qt5-git/PKGBUILD">PKGBUILD</a></p>
|
||||
|
||||
<p><a href="/resources/docs/qutim-qt5-git/PKGBUILD" title="File" type="text/plain">PKGBUILD</a></p>
|
||||
|
@ -8,16 +8,19 @@ title: Site changes
|
||||
short: site-changes
|
||||
description: I decided to change my site. You may find short list of changes below.
|
||||
---
|
||||
<h2><a name="list" class="anchor" href="#list"><span class="octicon octicon-link"></span></a>The list of changes:</h2>
|
||||
<h2><a href="#list" class="anchor" name="list"><span class="octicon octicon-link"></span></a>The list of changes:</h2>
|
||||
<ul>
|
||||
<li>I rented a <code>arcanis.name</code> domain. Now I have a normal address, as well as all normal people have it. Small description of how to do it. Firstly, you should rent domain and activate DNS editing (it is called <a href="http://www.nic.ru/dns/service/dns_hosting/">DNS-master</a> for Ru-center). I pay about $30 in year. Then you should create CNAME file in your repository; this file has line with your domain name. And finally you should create two DNS records for your domain:
|
||||
<li>I rented a <code>arcanis.name</code> domain. Now I have a normal address, as well as all normal people have it. Small description of how to do it. Firstly, you should rent domain and activate DNS editing (it is called <a href="http://www.nic.ru/dns/service/dns_hosting/" title="Service page">DNS-master</a> for Ru-center). I pay about $30 in year. Then you should create CNAME file in your repository; this file has line with your domain name. And finally you should create two DNS records for your domain:
|
||||
|
||||
{% highlight bash %}
|
||||
@ A 192.30.252.153
|
||||
@ A 192.30.252.154
|
||||
# redirection from www.*
|
||||
www CNAME @
|
||||
{% endhighlight %}
|
||||
|
||||
(Symbol <code>@</code> means you root domain.) And next wait for two hours. You may find out the result as follows:
|
||||
|
||||
{% highlight bash %}
|
||||
$ dig domain.name +nostats +nocomments +nocmd
|
||||
; <<>> DiG 9.9.2-P2 <<>> domain.name +nostats +nocomments +nocmd
|
||||
@ -26,9 +29,11 @@ $ dig domain.name +nostats +nocomments +nocmd
|
||||
domain.name. 912 IN A 192.30.252.153
|
||||
domain.name. 912 IN A 192.30.252.154
|
||||
...
|
||||
{% endhighlight %}</li>
|
||||
<li>Also I've created <a href="ftp://repo.arcanis.name/repo">my own repo</a>, which will contain some AUR packages that I'm using. Support of both architectures is planned.</li>
|
||||
{% endhighlight %}
|
||||
</li>
|
||||
<li>Also I've created <a href="ftp://repo.arcanis.name/repo" title="Repository">my own repo</a>, which will contain some AUR packages that I'm using. Support of both architectures is planned.</li>
|
||||
<li>Since the repo requires ftp protocol, I've changed samba shared folders to ftp. The problem of access has been resolved by using mount options:
|
||||
|
||||
{% highlight bash %}
|
||||
# only read rights
|
||||
/home/arcanis/music /srv/ftp/music ext4 defaults,bind,ro 0 0
|
||||
@ -36,8 +41,10 @@ domain.name. 912 IN A 192.30.252.154
|
||||
# read and write rights (the file has size 2 Gb)
|
||||
/home/arcanis/share.fs /srv/ftp/share ext4 defaults,rw 0 0
|
||||
{% endhighlight %}
|
||||
|
||||
Login on special user and option <code>anon_world_readable_only=YES</code> are used for prevent access to the music directory.
|
||||
Also here is my <code>/etc/vsftpd.conf</code> configuration file:
|
||||
|
||||
{% highlight bash %}
|
||||
anonymous_enable=YES
|
||||
anon_root=/srv/ftp
|
||||
@ -62,6 +69,7 @@ Now let's add redirection from <code>repo.arcanis.name</code> to the needed IP a
|
||||
{% highlight bash %}
|
||||
repo A 89.249.170.38
|
||||
{% endhighlight %}
|
||||
|
||||
</li>
|
||||
<li>Also there are plans to buy a server for compiling packages and hosting the repository, filesharing and backups.</li>
|
||||
</ul>
|
||||
|
@ -8,13 +8,17 @@ title: Creating own repository
|
||||
short: creating-custom-repo
|
||||
description: It is a short paper devoted to creation own ArchLinux repository.
|
||||
---
|
||||
<h2><a name="prepare" class="anchor" href="#prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
|
||||
<h2><a href="#prepare" class="anchor" name="prepare"><span class="octicon octicon-link"></span></a>Prepare</h2>
|
||||
<p>First find a server and desire to have sex with it. It is recommended to use Archlinux on it, but it is not necessarily - because you may create special root for Archlinux. Also you need two packages, <code>devtools</code> and <code>pacman</code>:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
pacman -Sy devtools
|
||||
{% endhighlight %}
|
||||
<p><a href="https://www.archlinux.org/packages/devtools/">devtools</a> is script set for building automation in the clean chroot. I think most of Arch maintainers use it.</p>
|
||||
|
||||
<p><a href="https://www.archlinux.org/packages/devtools/" title="Archlinux package">devtools</a> is script set for building automation in the clean chroot. I think most of Arch maintainers use it.</p>
|
||||
|
||||
<p>Let's create working directories and set colors:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# colors
|
||||
if [ ${USECOLOR} == "yes" ]; then
|
||||
@ -50,10 +54,11 @@ if [ ! -d "${STAGINGDIR}" ]; then
|
||||
mkdir -p "${STAGINGDIR}" || error_mes "unknown"
|
||||
fi
|
||||
{% endhighlight %}
|
||||
|
||||
<p><code>${REPODIR}/{i686,x86_64}</code> are directories for repository, <code>${PREPAREDIR}</code> is directory where compiled packages will be stored, <code>${STAGINGDIR}</code> is one where packages will be built.</p>
|
||||
|
||||
<h2><a name="theory" class="anchor" href="#theory"><span class="octicon octicon-link"></span></a>A bit of theory</h2>
|
||||
<p>Create directory, share it (using <a href="/2014/03/06/site-changes/">ftp</a>, for example). It has two subdirectories - <code>i686</code> and <code>x86_64</code> - for each architecture respectively. And fill them with a set of packages.</p>
|
||||
<h2><a href="#theory" class="anchor" name="theory"><span class="octicon octicon-link"></span></a>A bit of theory</h2>
|
||||
<p>Create directory, share it (using <a href="/2014/03/06/site-changes/" title="Site changes paper">ftp</a>, for example). It has two subdirectories - <code>i686</code> and <code>x86_64</code> - for each architecture respectively. And fill them with a set of packages.</p>
|
||||
<p>Updating repository may be split into the following steps:</p>
|
||||
<ol>
|
||||
<li>Creating PKGBUILDs (or updating them from AUR).</li>
|
||||
@ -68,15 +73,17 @@ fi
|
||||
<li>Cleaning.</li>
|
||||
</ol>
|
||||
|
||||
<h3><a name="pkgbuild" class="anchor" href="#pkgbuild"><span class="octicon octicon-link"></span></a>Creating PKGBUILDs</h3>
|
||||
<h3><a href="#pkgbuild" class="anchor" name="pkgbuild"><span class="octicon octicon-link"></span></a>Creating PKGBUILDs</h3>
|
||||
<p>Download source tarballs from AUR:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
cd "${STAGINGDIR}"
|
||||
yaourt -G package-name
|
||||
{% endhighlight %}
|
||||
|
||||
<h3><a name="building" class="anchor" href="#building"><span class="octicon octicon-link"></span></a>Packages building</h3>
|
||||
<h3><a href="#building" class="anchor" name="building"><span class="octicon octicon-link"></span></a>Packages building</h3>
|
||||
<p>Build each package automatically:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
func_build() {
|
||||
if [ ${USECOLOR} == "yes" ]; then
|
||||
@ -114,14 +121,17 @@ echo -e "${bwhite}[II]${cclose} Building packages"
|
||||
cd "${STAGINGDIR}"
|
||||
/usr/bin/find -name 'PKGBUILD' -type f -execdir /usr/bin/bash -c "func_build "${PREPAREDIR}" "${ROOTDIR}"" \;
|
||||
{% endhighlight %}
|
||||
|
||||
<p>It is recommended to add the following lines to <code>/etc/sudoers</code>:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
username ALL=NOPASSWD: /usr/bin/staging-i686-build
|
||||
username ALL=NOPASSWD: /usr/bin/staging-x86_64-build
|
||||
username ALL=NOPASSWD: /usr/bin/multilib-staging-build
|
||||
{% endhighlight %}
|
||||
|
||||
<h3><a name="signing" class="anchor" href="#signing"><span class="octicon octicon-link"></span></a>Packages signing</h3>
|
||||
<h3><a href="#signing" class="anchor" name="signing"><span class="octicon octicon-link"></span></a>Packages signing</h3>
|
||||
|
||||
{% highlight bash %}
|
||||
# signing
|
||||
if [ ${USEGPG} == "yes" ]; then
|
||||
@ -132,9 +142,11 @@ if [ ${USEGPG} == "yes" ]; then
|
||||
done
|
||||
fi
|
||||
{% endhighlight %}
|
||||
<p>It is recommended to configure <a href="https://wiki.archlinux.org/index.php/GPG#gpg-agent">gpg-agent</a>.</p>
|
||||
|
||||
<h3><a name="list" class="anchor" href="#list"><span class="octicon octicon-link"></span></a>Creating the list of packages</h3>
|
||||
<p>It is recommended to configure <a href="https://wiki.archlinux.org/index.php/GPG#gpg-agent" title="ArchWiki">gpg-agent</a>.</p>
|
||||
|
||||
<h3><a href="#list" class="anchor" name="list"><span class="octicon octicon-link"></span></a>Creating the list of packages</h3>
|
||||
|
||||
{% highlight bash %}
|
||||
# creating packages list
|
||||
cd "${PREPAREDIR}"
|
||||
@ -144,15 +156,18 @@ echo -e "${bwhite}[II] ${bblue}=>${cclose} i686 packages: \n${bwhite}${i686_PACK
|
||||
echo -e "${bwhite}[II] ${bblue}=>${cclose} x86_64 packages: \n${bwhite}${x86_64_PACKAGES}${cclose}"
|
||||
{% endhighlight %}
|
||||
|
||||
<h3><a name="updating" class="anchor" href="#updating"><span class="octicon octicon-link"></span></a>Repository update</h3>
|
||||
<h3><a href="#updating" class="anchor" name="updating"><span class="octicon octicon-link"></span></a>Repository update</h3>
|
||||
<p>Here is a function for removal packages from database and repository:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
func_remove() {
|
||||
_PACKAGE="$1"
|
||||
/usr/bin/rm -f "${_PACKAGE}"{,.sig}
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
<p><code>i686</code> repository update:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# updating i686 repo
|
||||
echo -e "${bwhite}[II]${cclose} Updating ${bwhite}i686${cclose} repo"
|
||||
@ -169,7 +184,9 @@ for PACKAGE in ${i686_PACKAGES}; do
|
||||
/usr/bin/repo-add --files ${DBNAME}.files.tar.gz "${PACKAGE}"
|
||||
done
|
||||
{% endhighlight %}
|
||||
|
||||
<p><code>x86_64</code> repository update:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# updating x86_64 repo
|
||||
echo -e "${bwhite}[II]${cclose} Updating ${bwhite}x86_64${cclose} repo"
|
||||
@ -187,7 +204,8 @@ for PACKAGE in ${x86_64_PACKAGES}; do
|
||||
done
|
||||
{% endhighlight %}
|
||||
|
||||
<h3><a name="clear" class="anchor" href="#clear"><span class="octicon octicon-link"></span></a>Cleaning</h3>
|
||||
<h3><a href="#clear" class="anchor" name="clear"><span class="octicon octicon-link"></span></a>Cleaning</h3>
|
||||
|
||||
{% highlight bash %}
|
||||
# clear
|
||||
cd "${PREPAREDIR}"
|
||||
@ -196,8 +214,9 @@ cd "${STAGINGDIR}"
|
||||
/usr/bin/rm -rf *
|
||||
{% endhighlight %}
|
||||
|
||||
<h3><a name="symlinks" class="anchor" href="#symlinks"><span class="octicon octicon-link"></span></a>Creating symlinks</h3>
|
||||
<h3><a href="#symlinks" class="anchor" name="symlinks"><span class="octicon octicon-link"></span></a>Creating symlinks</h3>
|
||||
<p>You may want to create a directory, which will contain symlinks on actual packages with names, which does not contain version:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
# creating symlinks
|
||||
if [ ${SYMLINK} == "yes" ]; then
|
||||
@ -219,11 +238,12 @@ if [ ${SYMLINK} == "yes" ]; then
|
||||
fi
|
||||
{% endhighlight %}
|
||||
|
||||
<h3><a name="file" class="anchor" href="#file"><span class="octicon octicon-link"></span></a>File</h3>
|
||||
<p>Here is <a href="https://github.com/arcan1s/repo-scripts">the scripts</a>. Download source tarballs and run script (editing variables if it is necessary).</p>
|
||||
<h3><a href="#file" class="anchor" name="file"><span class="octicon octicon-link"></span></a>File</h3>
|
||||
<p>Here is <a href="https://github.com/arcan1s/repo-scripts" title="GitHub">the scripts</a>. Download source tarballs and run script (editing variables if it is necessary).</p>
|
||||
|
||||
<h2><a name="using" class="anchor" href="#using"><span class="octicon octicon-link"></span></a>Repository usage</h2>
|
||||
<h2><a href="#using" class="anchor" name="using"><span class="octicon octicon-link"></span></a>Repository usage</h2>
|
||||
<p>Just add following lines to <code>/etc/pacman.conf</code>:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
[$REPONAME]
|
||||
Server = ftp://$REPOADDRESS/repo/$arch
|
||||
|
@ -8,25 +8,24 @@ title: Loveless
|
||||
short: loveless
|
||||
description: Here is a small poem from Final Fantasy VII Crisis Core.
|
||||
---
|
||||
<h2><a name="prologue" class="anchor" href="#prologue"><span class="octicon octicon-link"></span></a>Prologue</h2>
|
||||
<p>
|
||||
When the war of the beasts brings about the world's end<br>
|
||||
<h2><a href="#prologue" class="anchor" name="prologue"><span class="octicon octicon-link"></span></a>Prologue</h2>
|
||||
<p>When the war of the beasts brings about the world's end<br>
|
||||
The goddess descends from the sky<br>
|
||||
Wings of light and dark spread afar<br>
|
||||
She guides us to bliss, her gift everlasting.</p>
|
||||
<h2><a name="acti" class="anchor" href="#acti"><span class="octicon octicon-link"></span></a>Act I</h2>
|
||||
<h2><a href="#acti" class="anchor" name="acti"><span class="octicon octicon-link"></span></a>Act I</h2>
|
||||
<p>Infinite in mystery is the gift of the Goddess<br>
|
||||
We seek it thus, and take to the sky<br>
|
||||
Ripples form on the water's surface<br>
|
||||
The wandering soul knows no rest.</p>
|
||||
<h2><a name="actii" class="anchor" href="#actii"><span class="octicon octicon-link"></span></a>Act II</h2>
|
||||
<h2><a href="#actii" class="anchor" name="actii"><span class="octicon octicon-link"></span></a>Act II</h2>
|
||||
<p>There is no hate, only joy<br>
|
||||
For you are beloved by the goddess<br>
|
||||
Hero of the dawn, Healer of worlds<br>
|
||||
Dreams of the morrow hath the shattered soul<br>
|
||||
Pride is lost<br>
|
||||
Wings stripped away, the end is nigh.</p>
|
||||
<h2><a name="actiii" class="anchor" href="#actiii"><span class="octicon octicon-link"></span></a>Act III</h2>
|
||||
<h2><a href="#actiii" class="anchor" name="actiii"><span class="octicon octicon-link"></span></a>Act III</h2>
|
||||
<p>My friend, do you fly away now?<br>
|
||||
To a world that abhors you and I?<br>
|
||||
All that awaits you is a somber morrow<br>
|
||||
@ -35,7 +34,7 @@ My friend, your desire<br>
|
||||
Is the bringer of life, the gift of the goddess<br>
|
||||
Even if the morrow is barren of promises<br>
|
||||
Nothing shall forestall my return.</p>
|
||||
<h2><a name="activ" class="anchor" href="#activ"><span class="octicon octicon-link"></span></a>Act IV</h2>
|
||||
<h2><a href="#activ" class="anchor" name="activ"><span class="octicon octicon-link"></span></a>Act IV</h2>
|
||||
<p>My friend, the fates are cruel<br>
|
||||
There are no dreams, no honor remains<br>
|
||||
The arrow has left, the bow of the goddess<br>
|
||||
@ -46,7 +45,7 @@ And your eternal slumber<br>
|
||||
Legend shall speak<br>
|
||||
Of sacrifice at world's end<br>
|
||||
The wind sails over the water's surface.</p>
|
||||
<h2><a name="actv" class="anchor" href="#actv"><span class="octicon octicon-link"></span></a>Act V</h2>
|
||||
<h2><a href="#actv" class="anchor" name="actv"><span class="octicon octicon-link"></span></a>Act V</h2>
|
||||
<p>Even if the morrow is barren of promises<br>
|
||||
Nothing shall forestall my return<br>
|
||||
To become the dew that quenches the land<br>
|
||||
|
@ -8,53 +8,59 @@ title: Apps which I use
|
||||
short: my-desktop
|
||||
description: Here is a short paper devoted to the set of applications and extensions that I use everyday on my home computer.
|
||||
---
|
||||
<h2><a name="apps" class="anchor" href="#apps"><span class="octicon octicon-link"></span></a>Applications</h2>
|
||||
<h2><a href="#apps" class="anchor" name="apps"><span class="octicon octicon-link"></span></a>Applications</h2>
|
||||
<ul>
|
||||
<li><p><b>Shell</b> is zshrc and nothing else. You may find a small description of my settings <a href="/2014/01/14/about-zshrc/">here</a>. They are stored <a href="https://raw.githubusercontent.com/arcan1s/dotfiles/master/zshrc">here</a> (or <a href="https://raw.githubusercontent.com/arcan1s/dotfiles/master/zshrc_server">here</a>).</p></li>
|
||||
<li><p><b>Shell</b> is zshrc and nothing else. You may find a small description of my settings <a href="/2014/01/14/about-zshrc/" title="About zshrc paper">here</a>. It is stored <a href="https://raw.githubusercontent.com/arcan1s/dotfiles/master/zshrc" title="File" type="text/plain">here</a> (or <a href="https://raw.githubusercontent.com/arcan1s/dotfiles/master/zshrc_server" title="File" type="text/plain">here</a>).</p></li>
|
||||
|
||||
<li><p><b>DE</b> - I use KDE as Desktop Environment. And that's why most of apps are qt-based. Some KDE settings are below.</p></li>
|
||||
|
||||
<li><p><b>Graphic editors</b> - <a href="http://kde.org/applications/graphics/gwenview/">gwenview</a> is used for viewing images, <a href="http://kde.org/applications/graphics/kolourpaint/">kolourpaint</a> is used for simple editing pixel images, <a href="http://www.gimp.org/">gimp</a> (without plugins, since they are not needed for me) - for editing and <a href="http://www.inkscape.org/">inkskape</a> is used as editor of vector graphics.</p></li>
|
||||
<li><p><b>Graphic editors</b> - <a href="http://kde.org/applications/graphics/gwenview/" title="Gwenview Homepage">gwenview</a> is used for viewing images, <a href="http://kde.org/applications/graphics/kolourpaint/" title="Kolourpaint Homepage">kolourpaint</a> is used for simple editing pixel images, <a href="http://www.gimp.org/" title="Gimp Homepage">gimp</a> (without plugins, since they are not needed for me) - for editing and <a href="http://www.inkscape.org/" title="Inkskape Homepage">inkskape</a> is used as editor of vector graphics.</p></li>
|
||||
|
||||
<li><p><b>Browser</b> - I use Firefox. Some Firefox settings are below. Chromium is used as additional browser, elinks is used as console browser.</p></li>
|
||||
|
||||
<li><p><b>IM client</b> is <a href="http://qutim.org">qutIM</a>. It is a cross-platform, multiprotocol and full featured client. <a href="http://kde.org/applications/internet/kopete/">Kopete</a>, which I used before it, crashes, does not work correctly and does not work normally with codepage. Also I don't use a console client since I use a tablet IM. And I use Skype for skype obviously.</p></li>
|
||||
<li><p><b>IM client</b> is <a href="http://qutim.org" title="Qutim Homepage">qutIM</a>. It is a cross-platform, multiprotocol and full featured client. <a href="http://kde.org/applications/internet/kopete/" title="Kopete Homepage">Kopete</a>, which I used before it, crashes, does not work correctly and does not work normally with codepage. Also I don't use a console client since I use a tablet IM. And I use Skype for skype obviously.</p></li>
|
||||
|
||||
<li><p><b>Mail client</b> is <a href="http://kde.org/applications/internet/kmail/">kmail</a>. It is a full featured client (and I use most of them), looks pretty and it is easy to use. If it will be DE-undepended it will be better.</p></li>
|
||||
<li><p><b>Mail client</b> is <a href="http://kde.org/applications/internet/kmail/" title="Kmail Homepage">kmail</a>. It is a full featured client (and I use most of them), looks pretty and it is easy to use. If it will be DE-undepended it will be better.</p></li>
|
||||
|
||||
<li><p><b>IRC client</b> is <a href="http://konversation.kde.org/">konversation</a>. It is a simple IRC client. Though as far as I remember qutIM also supports IRC protocol, I prefre to use a special IRC client.</p></li>
|
||||
<li><p><b>IRC client</b> is <a href="http://konversation.kde.org/" title="Konversation Homepage">konversation</a>. It is a simple IRC client. Though as far as I remember qutIM also supports IRC protocol, I prefre to use a special IRC client.</p></li>
|
||||
|
||||
<li><p><b>Torrent client</b> is <a href="http://www.transmissionbt.com/">transmission</a> with Qt5 interface (it has gtk interface too). It is also used for server but without GUI.</p></li>
|
||||
<li><p><b>Torrent client</b> is <a href="http://www.transmissionbt.com/" title="Transmission Homepage">transmission</a> with Qt5 interface (it has gtk interface too). It is also used for server but without GUI.</p></li>
|
||||
|
||||
<li><p><b>Video player</b> is <a href="http://mpv.io/">mpv</a>, since mplayer died and mplayer2 was born deadborn. Graphical frontend are not needed.</p></li>
|
||||
<li><p><b>Video player</b> is <a href="http://mpv.io/" title="Mpv Homepage">mpv</a>, since mplayer died and mplayer2 was born deadborn. Graphical frontend are not needed.</p></li>
|
||||
|
||||
<li><p><b>Audio player</b> is <a href="http://qmmp.ylsoftware.com/">qmmp</a>. It is a good winamp-like player. Flick of the wrist you may make a handy interface for it (simpleui).</p></li>
|
||||
<li><p><b>Audio player</b> is <a href="http://qmmp.ylsoftware.com/" title="Qmmp Homepage">qmmp</a>. It is a good winamp-like player. Flick of the wrist you may make a handy interface for it (simpleui).</p></li>
|
||||
|
||||
<li><p><b>Audio/video editors</b>: <a href="http://kde-apps.org/content/show.php?content=29024">kdenlive</a> is used as video editor, <a href="http://kde-apps.org/content/show.php?content=29024">soundkonverter</a> is used as audio editor, <a href="https://wiki.gnome.org/Apps/EasyTAG">easytag</a> is used for editing audio tags (unfortunately, it is a gtk-based, but I didn't find a better tool for it). And command line and scripts written on bash are used too.</p></li>
|
||||
<li><p><b>Audio/video editors</b>: <a href="http://kde-apps.org/content/show.php?content=29024" title="Kdenlive Homepage">kdenlive</a> is used as video editor, <a href="http://kde-apps.org/content/show.php?content=29024">soundkonverter</a> is used as audio editor, <a href="https://wiki.gnome.org/Apps/EasyTAG" title="Easytag Homepage">easytag</a> is used for editing audio tags (unfortunately, it is a gtk-based, but I didn't find a better tool for it). And command line and scripts written on bash are used too.</p></li>
|
||||
|
||||
<li><p><b>Office</b>: <a href="http://wps-community.org/">Kingsoft Office</a> is used as alternative of Microsoft Office; it has no any feature, but it looks normally, it is qt-based and it is said that it has a good support for standart formats. (Linux version has an alfa stage.) <a href="http://kile.sourceforge.net/">Kile</a> is used as LaTeX frontend. <a href="http://kde.org/applications/graphics/okular/">Okular</a> is used as document viewer. And I use <a href="http://goldendict.org/">GoldenDict</a> as dictionary.</p></li>
|
||||
<li><p><b>Office</b>: <a href="http://wps-community.org/" title="KO Homepage">Kingsoft Office</a> is used as alternative of Microsoft Office; it has no any feature, but it looks normally, it is qt-based and it is said that it has a good support for standart formats. (Linux version has an alfa stage.) <a href="http://kile.sourceforge.net/" title="Kile Homepage">Kile</a> is used as LaTeX frontend. <a href="http://kde.org/applications/graphics/okular/" title="Okular Homepage">Okular</a> is used as document viewer. And I use <a href="http://goldendict.org/" title="GoldenDict Homepage">GoldenDict</a> as dictionary.</p></li>
|
||||
|
||||
<li><p><b>Editors</b>: <a href="http://www.kde.org/applications/utilities/kwrite/">kwrite</a> is used as a simple text editor, <a href="http://www.kde.org/applications/utilities/kate/">kate</a> (and <a href="http://zaufi.github.io/kate-cpp-helper-plugin.html">cpp-helper</a> plugin) is used as advanced text editor. And I begin to use <a href="https://atom.io/">atom</a> now. And of cource I use vim in console.</p></li>
|
||||
<li><p><b>Editors</b>: <a href="http://www.kde.org/applications/utilities/kwrite/" title="Kwrite Homepage">kwrite</a> is used as a simple text editor, <a href="http://www.kde.org/applications/utilities/kate/" title="Kate Homepage">kate</a> (and <a href="http://zaufi.github.io/kate-cpp-helper-plugin.html" title="Plugin Homepage">cpp-helper</a> plugin) is used as advanced text editor. And of course I use vim in console.</p></li>
|
||||
|
||||
<li><p><b>Scientific soft</b>. Chemical visualizers are <a href="http://www.ks.uiuc.edu/Research/vmd/">vmd</a>, <a href="http://www.cgl.ucsf.edu/chimera/">chimera</a> and <a href="http://pymol.org/">pymol</a>. Physics simulator is <a href="http://kde.org/applications/education/step/">step</a>. Calculator is <a href="http://kde.org/applications/education/kalgebra/">kalgebra</a> and console <a href="http://ipython.org/">ipython</a>. <a href="http://qtiplot.com/">Qtiplot</a> is used for drawing graphs and data analysis (scidavis, which is its fork, unfortunately, is half-dead), <a href="http://plasma-gate.weizmann.ac.il/Grace/">grace</a> is used for only drawing graphs. <a href="http://ruby.chemie.uni-freiburg.de/~martin/chemtool/chemtool.html">Chemtool</a> is used as alternative of ChemDraw.</p></li>
|
||||
<li><p><b>Scientific soft</b>. Chemical visualizers are <a href="http://www.ks.uiuc.edu/Research/vmd/" title="VMD Homepage">vmd</a>, <a href="http://www.cgl.ucsf.edu/chimera/" title="Chimera Homepage">chimera</a> and <a href="http://pymol.org/" title="Pymol Homepage">pymol</a>. Physics simulator is <a href="http://kde.org/applications/education/step/" title="Step Homepage">step</a>. Calculator is <a href="http://kde.org/applications/education/kalgebra/" title="Kalgebra Homepage">kalgebra</a> and console <a href="http://ipython.org/" title="ipython Homepage">ipython</a>. <a href="http://qtiplot.com/" title="Qtiplot Homepage">Qtiplot</a> is used for drawing graphs and data analysis (scidavis, which is its fork, unfortunately, is half-dead), <a href="http://plasma-gate.weizmann.ac.il/Grace/" title="Grace Homepage">grace</a> is used for only drawing graphs. <a href="http://ruby.chemie.uni-freiburg.de/~martin/chemtool/chemtool.html" title="Chemtool Homepage">Chemtool</a> is used as alternative of ChemDraw.</p></li>
|
||||
|
||||
<li><p><b>System applications</b>. File manager is <a href="http://kde.org/applications/system/dolphin/">dolphin</a>, <a href="http://doublecmd.sourceforge.net/">doublecmd</a> is used as twin-panel manager. Terminal emulators are <a href="http://yakuake.kde.org/">yakuake</a> and <a href="http://software.schmorp.de/pkg/rxvt-unicode.html">urxvt</a> (as windowed emulator). Archiver graphical interface is <a href="http://kde.org/applications/utilities/ark/">ark</a>.</p></li>
|
||||
<li><p><b>System applications</b>. File manager is <a href="http://kde.org/applications/system/dolphin/" title="Dolphin Homepage">dolphin</a>, <a href="http://doublecmd.sourceforge.net/" title="Doublecmd Homepage">doublecmd</a> is used as twin-panel manager. Terminal emulators are <a href="http://yakuake.kde.org/" title="Yakuake Homepage">yakuake</a> and <a href="http://software.schmorp.de/pkg/rxvt-unicode.html" title="Urxvt Homepage">urxvt</a> (as windowed emulator). Archiver graphical interface is <a href="http://kde.org/applications/utilities/ark/" title="Ark Homepage">ark</a>.</p></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<h2><a name="kde" class="anchor" href="#kde"><span class="octicon octicon-link"></span></a>KDE settings</h2>
|
||||
<p>Here is a screenshot:<br>
|
||||
<a href="/resources/screenshots/kde.png"><img src="/resources/preview/kde_prev.jpg"></a></p>
|
||||
<h2><a href="#kde" class="anchor" name="kde"><span class="octicon octicon-link"></span></a>KDE settings</h2>
|
||||
<p>
|
||||
{% assign scrdesc = "KDE screenshot" %}
|
||||
{% assign scrname = "kde" %}
|
||||
{% include prj_scr.html %}
|
||||
</p>
|
||||
|
||||
<p>QtCurve is used as Qt style, its settings may be found <a href="https://github.com/arcan1s/dotfiles/tree/master/qtcurve">here</a>, window decorations are presented by QtCurve too. Cursor theme is <a href="http://kde-look.org/content/show.php/Ecliz?content=110340">ecliz-small</a>. Plasma theme is <a href="http://kde-look.org/content/show.php/Volatile?content=128110">volatile</a>. Icon pack is <a href="http://nitrux.in/">compass</a>. I use fonts which are based on Liberation.</p>
|
||||
<p>QtCurve is used as Qt style, its settings may be found <a href="https://github.com/arcan1s/dotfiles/tree/master/qtcurve" title="GitHub">here</a>, window decorations are presented by QtCurve too. Cursor theme is <a href="http://kde-look.org/content/show.php/Ecliz?content=110340" title="kde-look">ecliz-small</a>. Plasma theme is <a href="http://kde-look.org/content/show.php/Volatile?content=128110" title="kde-look">volatile</a>. Icon pack is <a href="http://nitrux.in/" title="Nitrux Homepage">compass</a>. I use fonts which are based on Liberation.</p>
|
||||
|
||||
<p><b>Used widgets</b> (from left to right, top to bottom) are: <a href="https://launchpad.net/plasma-widget-menubar">menubar</a>, <a href="http://userbase.kde.org/Homerun">homerun</a> with transparent icon, <a href="http://kde-apps.org/content/show.php?content=144808">icontask</a>, <a href="/projects/netctl-gui/">netctl</a>, default KDE tray, <a href="http://agateau.com/projects/colibri/">colibri</a> for notifications, <a href="/projects/pytextmonitor">pytextmonitor</a>.</p>
|
||||
<p><b>Used widgets</b> (from left to right, top to bottom) are: <a href="https://launchpad.net/plasma-widget-menubar" title="Widget Homepage">menubar</a>, <a href="http://userbase.kde.org/Homerun" title="Widget Homepage">homerun</a> with transparent icon, <a href="http://kde-apps.org/content/show.php?content=144808" title="Widget Homepage">icontask</a>, <a href="/projects/netctl-gui/" title="Widget Homepage">netctl</a>, default KDE tray, <a href="http://agateau.com/projects/colibri/" title="Widget Homepage">colibri</a> for notifications, <a href="/projects/pytextmonitor" title="Widget Homepage">pytextmonitor</a>.</p>
|
||||
|
||||
<p>As a bonus material <a href="https://github.com/arcan1s/dotfiles/blob/master/themes/yakuake/My%20color.colorscheme">here</a> is a settings for konsole bright colors:<br>
|
||||
<a href="/resources/screenshots/zshrc_demo.png"><img src="/resources/preview/zshrc_demo_prev.jpg"></a></p>
|
||||
<p>As a bonus material <a href="https://github.com/arcan1s/dotfiles/blob/master/themes/yakuake/My%20color.colorscheme" title="GitHub">here</a> is a settings for konsole bright colors.</p>
|
||||
<p>
|
||||
{% assign scrdesc = "Zsh demonstation" %}
|
||||
{% assign scrname = "zshrc_demo" %}
|
||||
{% include prj_scr.html %}
|
||||
</p>
|
||||
|
||||
|
||||
<h2><a name="firefox" class="anchor" href="#firefox"><span class="octicon octicon-link"></span></a>Firefox settings</h2>
|
||||
<h2><a href="#firefox" class="anchor" name="firefox"><span class="octicon octicon-link"></span></a>Firefox settings</h2>
|
||||
<p>I do not use a special settings, thus I get you a list of used add-ons:</p>
|
||||
<ul>
|
||||
<li><p><b>Adblock plus</b>.</p></li>
|
||||
|
@ -8,21 +8,24 @@ title: Disabling baloo, gentoo-way
|
||||
short: disabling-baloo
|
||||
description: Paper, which describes how to remove the dependency on baloo in your system.
|
||||
---
|
||||
<h2><a name="disclaimer" class="anchor" href="#disclaimer"><span class="octicon octicon-link"></span></a>Disclaimer</h2>
|
||||
<h2><a href="#disclaimer" class="anchor" name="disclaimer"><span class="octicon octicon-link"></span></a>Disclaimer</h2>
|
||||
<p>I do not use this pacth, since I prefer less destructive methods. However, apparently all works fine, because there is no any claims. Since this patch was created in a few minutes, it removes all baloo's calls from source files (maybe I'll create a normal patch sometime).</p>
|
||||
|
||||
<p>On other hand, I highly recommend to people, who do not use baloo for some reason, disable it from the settings menu (it was added it 4.13.1) or read this <a href="http://blog.andreascarpino.it/disabling-baloo-the-arch-way/">article</a>.</p>
|
||||
<p>On other hand, I highly recommend to people, who do not use baloo for some reason, disable it from the settings menu (it was added it 4.13.1) or read this <a href="http://blog.andreascarpino.it/disabling-baloo-the-arch-way/" title="Scarpino's blog">article</a>.</p>
|
||||
|
||||
<h2><a name="intro" class="anchor" href="#intro"><span class="octicon octicon-link"></span></a>Introduction</h2>
|
||||
<h2><a href="#intro" class="anchor" name="intro"><span class="octicon octicon-link"></span></a>Introduction</h2>
|
||||
<p>In Archlinux <b>gwenview</b> and <b>kdepim</b> (and <b>baloo-widgets</b>) depend on baloo currently (2014-05-18). In the version 4.13.0 <b>kactivities</b> depends on baloo too (and I don't know why); but this dependency was not required explicitly, so it was enough just to rebuild the package by removing baloo from the list of dependencies.</p>
|
||||
|
||||
<h2><a name="gwenview" class="anchor" href="#gwenview"><span class="octicon octicon-link"></span></a>gwenview</h2>
|
||||
<h2><a href="#gwenview" class="anchor" name="gwenview"><span class="octicon octicon-link"></span></a>gwenview</h2>
|
||||
<p>It's all quite simple. Developers have taken care of the wishes of ordinary users and added a special flag:</p>
|
||||
|
||||
{% highlight cmake %}
|
||||
//Semantic info backend for Gwenview (Baloo/Fake/None)
|
||||
GWENVIEW_SEMANTICINFO_BACKEND:STRING=Baloo
|
||||
{% endhighlight %}
|
||||
|
||||
<p>Thus, we add requred cmake flag to the build script:</p>
|
||||
|
||||
{% highlight bash %}
|
||||
cmake ../gwenview-${pkgver} \
|
||||
-DCMAKE_BUILD_TYPE=Release \
|
||||
@ -31,8 +34,8 @@ cmake ../gwenview-${pkgver} \
|
||||
-DGWENVIEW_SEMANTICINFO_BACKEND=None
|
||||
{% endhighlight %}
|
||||
|
||||
<h2><a name="kdepim" class="anchor" href="#kdepim"><span class="octicon octicon-link"></span></a>kdepim</h2>
|
||||
<p>Since everything was done in a hurry, I prefer to look at the source code using grep and to find all references to baloo. Needed strings (they are links to ballo in CMakeLists.txt, baloo's function calls and header declarations) were commented (I added some fake calls to the source code). You may find the patch <a href="https://gist.github.com/arcan1s/b698bb586faef627b3bb">here</a> (4.13.3). Download the patch, apply it to the source code and recompile kdepim.</p>
|
||||
<h2><a href="#kdepim" class="anchor" name="kdepim"><span class="octicon octicon-link"></span></a>kdepim</h2>
|
||||
<p>Since everything was done in a hurry, I prefer to look at the source code using grep and to find all references to baloo. Needed strings (they are links to ballo in CMakeLists.txt, baloo's function calls and header declarations) were commented (I added some fake calls to the source code). You may find the patch <a href="https://gist.github.com/arcan1s/b698bb586faef627b3bb" title="Gist">here</a> (4.13.3). Download the patch, apply it to the source code and recompile kdepim.</p>
|
||||
|
||||
<h2><a name="packages" class="anchor" href="#packages"><span class="octicon octicon-link"></span></a>Packages</h2>
|
||||
<p>All Archlinux packages for both architectures may be found in <a href="https://wiki.archlinux.org/index.php/Unofficial_user_repositories#arcanisrepo">my repository</a>.</p>
|
||||
<h2><a href="#packages" class="anchor" name="packages"><span class="octicon octicon-link"></span></a>Packages</h2>
|
||||
<p>All Archlinux packages for both architectures may be found in <a href="https://wiki.archlinux.org/index.php/Unofficial_user_repositories#arcanisrepo" title="ArchWiki">my repository</a>.</p>
|
||||
|
@ -6,12 +6,12 @@ layout: paper
|
||||
tags: linux, development
|
||||
title: Writting own Shell completions. Zsh
|
||||
short: writting-own-completions-p1
|
||||
description: <img hspace="10" hspace="10" align="right" src="/resources/papers/zsh_completion.png"> Some basics of creating a completion files for own application are described in these articles.
|
||||
description: <figure class="sign"><img src="/resources/papers/zsh_completion.png" alt="bash_completion"></figure> Some basics of creating a completion files for own application are described in these articles.
|
||||
---
|
||||
<h2><a name="preamble" class="anchor" href="#preamble"><span class="octicon octicon-link"></span></a>Preamble</h2>
|
||||
<h2><a href="#preamble" class="anchor" name="preamble"><span class="octicon octicon-link"></span></a>Preamble</h2>
|
||||
<p>While developing <a href="/ru/projects/netctl-gui">one of my projects</a> I have wanted to add completion files. I have already tried to create these files, but I was too lazy to read some manuals about it.</p>
|
||||
|
||||
<h2><a name="introduction" class="anchor" href="#introduction"><span class="octicon octicon-link"></span></a>Introduction</h2>
|
||||
<h2><a href="#introduction" class="anchor" name="introduction"><span class="octicon octicon-link"></span></a>Introduction</h2>
|
||||
<p>There are some possible ways to create zsh completion file. In this article I will describe only one of them, which provides a lot of opportunities, but does not require a lot of costs (such as regular expressions).</p>
|
||||
|
||||
<p>Lets consider the example of my application, which has a part of help message that looks like this:</p>
|
||||
@ -32,7 +32,7 @@ netctl-gui [ -h | --help ] [ -e ESSID | --essid ESSID ] [ -с FILE | --config FI
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h2><a name="file" class="anchor" href="#file"><span class="octicon octicon-link"></span></a>The file pattern</h2>
|
||||
<h2><a href="#file" class="anchor" name="file"><span class="octicon octicon-link"></span></a>The file pattern</h2>
|
||||
<p>It must be specified in the header that it is a completion file and application for which it will complete (may be string if this file provides completions for several applications):
|
||||
|
||||
{% highlight bash %}
|
||||
@ -65,9 +65,10 @@ case "$service" in
|
||||
;;
|
||||
esac
|
||||
{% endhighlight %}
|
||||
|
||||
</p>
|
||||
|
||||
<h2><a name="flags" class="anchor" href="#flags"><span class="octicon octicon-link"></span></a>Flags</h2>
|
||||
<h2><a href="#flags" class="anchor" name="flags"><span class="octicon octicon-link"></span></a>Flags</h2>
|
||||
<p>As it was said above, there are some different ways to create these files. In particular they differ in the flag declaration and their further processing. In my case I will use <code>_arguments</code> command, which require a specific format of variables: <code>FLAG[description]:MESSAGE:ACTION</code>. The last two fields are not required and, as you will see below, are not needed in some cases. If you want to add two flags for an action (short and long format), then the format is a little bit complicated: <code>{(FLAG_2)FLAG_1,(FLAG_1)FLAG_2}[description]:MESSAGE:ACTION</code>. It should be noted that if you want to create completions for two flags but some flags have not a second format. you will should to add following line: <code>{FLAG,FLAG}[description]:MESSAGE:ACTION</code>. <code>MESSAGE</code> is a message which will be shown, <code>ACTION</code> is an action which will be performed after this flag. In this tutorial <code>ACTION</code> will be following: <code>->STATE</code>.</p>
|
||||
|
||||
<p>So, according to our requirements, flags declaration will be following:
|
||||
@ -82,9 +83,10 @@ _netctl_gui_arglist=(
|
||||
{'--set-opts','--set-opts'}'[set options for this run, comma separated]:comma separated:->settings'
|
||||
)
|
||||
{% endhighlight %}
|
||||
|
||||
</p>
|
||||
|
||||
<h2><a name="variables" class="anchor" href="#variables"><span class="octicon octicon-link"></span></a>Arrays of variables</h2>
|
||||
<h2><a href="#variables" class="anchor" name="variables"><span class="octicon octicon-link"></span></a>Arrays of variables</h2>
|
||||
<p>In my case there are two static arrays (which will not be changed):
|
||||
|
||||
{% highlight bash %}
|
||||
@ -106,9 +108,10 @@ _netctl_profiles() {
|
||||
print $(find /etc/netctl -maxdepth 1 -type f -printf "%f\n")
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
</p>
|
||||
|
||||
<h2><a name="body" class="anchor" href="#body"><span class="octicon octicon-link"></span></a>Function</h2>
|
||||
<h2><a href="#body" class="anchor" name="body"><span class="octicon octicon-link"></span></a>Function</h2>
|
||||
<p>Remember, there was something about a state above? It is stored in the variable <code>$state</code> and in this function we will check what it is to choose the appropriate action. At the beginning of the function we should call <code>_arguments</code> with our flags.
|
||||
|
||||
{% highlight bash %}
|
||||
@ -140,9 +143,10 @@ _netctl-gui() {
|
||||
esac
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
</p>
|
||||
|
||||
<h2><a name="conclusion" class="anchor" href="#conclusion"><span class="octicon octicon-link"></span></a>Conclusion</h2>
|
||||
<p>File should be places to <code>/usr/share/zsh/site-functions/</code> with any name (it is recommended to set prefix to <code>_</code>). You may found the example <a href="https://raw.githubusercontent.com/arcan1s/netctl-gui/master/sources/gui/zsh-completions">in my repository</a>.</p>
|
||||
<h2><a href="#conclusion" class="anchor" name="conclusion"><span class="octicon octicon-link"></span></a>Conclusion</h2>
|
||||
<p>File should be places to <code>/usr/share/zsh/site-functions/</code> with any name (it is recommended to set prefix to <code>_</code>). You may found the example <a href="https://raw.githubusercontent.com/arcan1s/netctl-gui/master/sources/gui/zsh-completions" title="File" type="text/plain">in my repository</a>.</p>
|
||||
|
||||
<p>The additional information may be found in <a href="https://github.com/zsh-users/zsh-completions">zsh-completions</a> repository. For example there is this <a href="https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org">How-To</a>. And also there are a lot of examples.</p>
|
||||
<p>The additional information may be found in <a href="https://github.com/zsh-users/zsh-completions" title="GitHub">zsh-completions</a> repository. For example there is this <a href="https://github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org" title="Tutorial">How-To</a>. And also there are a lot of examples.</p>
|
||||
|
@ -6,13 +6,13 @@ layout: paper
|
||||
tags: linux, development
|
||||
title: Writting own Shell completions. Bash
|
||||
short: writting-own-completions-p2
|
||||
description: <img hspace="10" hspace="10" align="right" src="/resources/papers/bash_completion.png"> Some basics of creating a completion files for own application are described in these articles.
|
||||
description: <figure class="sign"><img src="/resources/papers/bash_completion.png" alt="bash_completion"></figure> Some basics of creating a completion files for own application are described in these articles.
|
||||
---
|
||||
<h2><a name="preamble" class="anchor" href="#preamble"><span class="octicon octicon-link"></span></a>Preamble</h2>
|
||||
<p>While developing <a href="/ru/projects/netctl-gui">one of my projects</a> I have wanted to add completion files. I have already tried to create these files, but I was too lazy to read some manuals about it.</p>
|
||||
<h2><a href="#preamble" class="anchor" name="preamble"><span class="octicon octicon-link"></span></a>Preamble</h2>
|
||||
<p>While developing <a href="/ru/projects/netctl-gui" title="Netctl-gui project page">one of my projects</a> I have wanted to add completion files. I have already tried to create these files, but I was too lazy to read some manuals about it.</p>
|
||||
|
||||
<h2><a name="introduction" class="anchor" href="#introduction"><span class="octicon octicon-link"></span></a>Introduction</h2>
|
||||
<p>Bash, <a href="/ru/2014/07/17/writting-own-completions-p1">unlike zsh</a>, demands some dirty workarounds for completions. Cursory have Googled, I have not found a more or less normal tutorials, so it is based on the available <code>pacman</code> completion files in my system.</p>
|
||||
<h2><a href="#introduction" class="anchor" name="introduction"><span class="octicon octicon-link"></span></a>Introduction</h2>
|
||||
<p>Bash, <a href="/ru/2014/07/17/writting-own-completions-p1" title="Zsh completions paper">unlike zsh</a>, demands some dirty workarounds for completions. Cursory have Googled, I have not found a more or less normal tutorials, so it is based on the available <code>pacman</code> completion files in my system.</p>
|
||||
|
||||
<p>Lets consider the example of the same my application. I remind you that a part of help message is as follows:</p>
|
||||
|
||||
@ -32,7 +32,7 @@ netctl-gui [ -h | --help ] [ -e ESSID | --essid ESSID ] [ -с FILE | --config FI
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<h2><a name="file" class="anchor" href="#file"><span class="octicon octicon-link"></span></a>The file pattern</h2>
|
||||
<h2><a href="#file" class="anchor" name="file"><span class="octicon octicon-link"></span></a>The file pattern</h2>
|
||||
<p>Here <b>all</b> variables must return an array. And there no specific formats. First we declare the flags and then we describe all other variables. As I am not going to describe the functions in more detail below I remind you that <code>_netctl_profiles()</code> should be generated each time:
|
||||
|
||||
{% highlight bash %}
|
||||
@ -55,9 +55,10 @@ And finally again <b>without isolation in a separate function</b> we create a de
|
||||
{% highlight bash %}
|
||||
complete -F _netctl_gui netctl-gui
|
||||
{% endhighlight %}
|
||||
|
||||
</p>
|
||||
|
||||
<h2><a name="flags" class="anchor" href="#flags"><span class="octicon octicon-link"></span></a>Flags</h2>
|
||||
<h2><a href="#flags" class="anchor" name="flags"><span class="octicon octicon-link"></span></a>Flags</h2>
|
||||
<p>As it was said above there is no specific format, so all available flags declare by array:
|
||||
|
||||
{% highlight bash %}
|
||||
@ -75,9 +76,10 @@ _netctl_gui_arglist=(
|
||||
'--set-opts'
|
||||
)
|
||||
{% endhighlight %}
|
||||
|
||||
</p>
|
||||
|
||||
<h2><a name="variables" class="anchor" href="#variables"><span class="octicon octicon-link"></span></a>Arrays of variables</h2>
|
||||
<h2><a href="#variables" class="anchor" name="variables"><span class="octicon octicon-link"></span></a>Arrays of variables</h2>
|
||||
<p>I just give a function that looked like this in zsh:
|
||||
|
||||
{% highlight bash %}
|
||||
@ -93,9 +95,10 @@ _netctl_profiles() {
|
||||
echo $(find /etc/netctl -maxdepth 1 -type f -printf "%f\n")
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
</p>
|
||||
|
||||
<h2><a name="body" class="anchor" href="#body"><span class="octicon octicon-link"></span></a>Function</h2>
|
||||
<h2><a href="#body" class="anchor" name="body"><span class="octicon octicon-link"></span></a>Function</h2>
|
||||
<p>The variable <code>COMPREPLY</code> responds for completion in Bash. To keep track of the current state function <code>_get_comp_words_by_ref</code> must be called with parameters <code>cur</code> (current flag) and <code>prev</code> (previous flag, it is the state). Also some point for case are needed (variables <code>want*</code>). Function <code>compgen</code> is used for completion generation. A list of words is given after flag <code>-W</code>. (Also there is flag <code>-F</code> which requires a function as argument, but it gives warning for me.) The last argument is a current string to which you want to generate completion.</p>
|
||||
|
||||
<p>So, here is our function:
|
||||
@ -134,7 +137,8 @@ _netctl_gui() {
|
||||
true
|
||||
}
|
||||
{% endhighlight %}
|
||||
|
||||
</p>
|
||||
|
||||
<h2><a name="conclusion" class="anchor" href="#conclusion"><span class="octicon octicon-link"></span></a>Conclusion</h2>
|
||||
<p>File should be places to <code>/usr/share/bash-completion/completions/</code> with any name. You may found the example <a href="https://raw.githubusercontent.com/arcan1s/netctl-gui/master/sources/gui/bash-completions">in my repository</a>.</p>
|
||||
<h2><a href="#conclusion" class="anchor" name="conclusion"><span class="octicon octicon-link"></span></a>Conclusion</h2>
|
||||
<p>File should be places to <code>/usr/share/bash-completion/completions/</code> with any name. You may found the example <a href="https://raw.githubusercontent.com/arcan1s/netctl-gui/master/sources/gui/bash-completions" title="File" type="text/plain">in my repository</a>.</p>
|
||||
|
@ -38,7 +38,7 @@ GS/CS d-(+) s: a-- C++++ UL+++>$ P L++ E--- W++ N !o !K w- !O M- !V PS+@ PE Y PG
|
||||
{% endhighlight %}
|
||||
|
||||
<figure class="sign">
|
||||
<a href="/resources/screenshots/photo_siicm.png" title="Full size">
|
||||
<a href="/resources/screenshots/photo_siicm.png" title="Full size" type="image/png">
|
||||
<img src="/resources/preview/photo_siicm_prev.jpg" alt="Photo">
|
||||
</a>
|
||||
<figcaption>Photo by Grineva O.V.</figcaption>
|
||||
@ -63,7 +63,7 @@ GS/CS d-(+) s: a-- C++++ UL+++>$ P L++ E--- W++ N !o !K w- !O M- !V PS+@ PE Y PG
|
||||
<blockquote cite="https://wiki.archlinux.org/index.php/AUR_Trusted_User_Guidelines/">
|
||||
The Trusted User (TU) is a member of the community charged with keeping the AUR in working order. He/she maintains popular packages (communicating with and sending patches upstream as needed), and votes in administrative matters. A TU is elected from active community members by current TUs in a democratic process. TUs are the only members who have a final say in the direction of the AUR.
|
||||
</blockquote>
|
||||
<p align="right">
|
||||
<p style="text-align:right;">
|
||||
© <a href="https://wiki.archlinux.org/index.php/AUR_Trusted_User_Guidelines/" title="ArchWiki">ArchWiki</a>
|
||||
</p>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user