mirror of
https://github.com/arcan1s/arcanis.me.git
synced 2025-07-23 01:19:55 +00:00
more pretty md files
This commit is contained in:
@ -7,7 +7,11 @@ tags: zshrc, configuration, linux
|
||||
title: About zshrc
|
||||
short: about-zshrc
|
||||
---
|
||||
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 `.zshrc` and explain what it does and why it is needed. Also any comments or additions are welcome. It is a translated paper from Russian ([original](//archlinux.org.ru/forum/topic/12752/ "Forum thread")).
|
||||
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
|
||||
`.zshrc` and explain what it does and why it is needed. Also any comments or
|
||||
additions are welcome. It is a translated paper from Russian
|
||||
([original](//archlinux.org.ru/forum/topic/12752/ "Forum thread")).
|
||||
|
||||
<!--more-->
|
||||
|
||||
@ -19,13 +23,17 @@ First install recommended minima:
|
||||
pacman -Sy pkgfile zsh zsh-completions zsh-syntax-highlighting
|
||||
```
|
||||
|
||||
[pkgfile](//www.archlinux.org/packages/pkgfile/ "Archlinux package") is a very useful utility. Also this command will install shell, additional completion and syntax highlighting.
|
||||
[pkgfile](//www.archlinux.org/packages/pkgfile/ "Archlinux package") is a very
|
||||
useful utility. Also this command will install shell, additional completion and
|
||||
syntax highlighting.
|
||||
|
||||
## <a href="#configuration" class="anchor" id="configuration"><span class="octicon octicon-link"></span></a>Shell configuration
|
||||
|
||||
All options are avaible [here](//zsh.sourceforge.net/Doc/Release/Options.html "zsh documentation").
|
||||
All options are avaible [here](//zsh.sourceforge.net/Doc/Release/Options.html
|
||||
"zsh documentation").
|
||||
|
||||
Set history file and number of commands in cache of the current session and in the history file:
|
||||
Set history file and number of commands in cache of the current session and in
|
||||
the history file:
|
||||
|
||||
```bash
|
||||
# history
|
||||
@ -34,7 +42,8 @@ HISTSIZE=500000
|
||||
SAVEHIST=500000
|
||||
```
|
||||
|
||||
I can not remember all `Ctrl+` combinations so I bind keys to its default usages:
|
||||
I can not remember all `Ctrl+` combinations so I bind keys to its default
|
||||
usages:
|
||||
|
||||
```bash
|
||||
# bindkeys
|
||||
@ -48,7 +57,9 @@ bindkey '\e[5~' up-line-or-history # page-up
|
||||
bindkey '\e[6~' down-line-or-history # page-down
|
||||
```
|
||||
|
||||
But in this case `Up`/`Down` arrows are used to navigate through the history based on **already entered part** of a command. And `PgUp`/`PgDown` **will ignore** already entered part of a command.
|
||||
But in this case `Up`/`Down` arrows are used to navigate through the history
|
||||
based on **already entered part** of a command. And `PgUp`/`PgDown` **will
|
||||
ignore** already entered part of a command.
|
||||
|
||||
Command autocomplete:
|
||||
|
||||
@ -60,7 +71,9 @@ zstyle ':completion:*' insert-tab false
|
||||
zstyle ':completion:*' max-errors 2
|
||||
```
|
||||
|
||||
Full command autocomplete will be enabled. `insert-tab false` will enable autocomplete for **non-entered** commands. `max-errors` sets maximum number of errors that could be corrected.
|
||||
Full command autocomplete will be enabled. `insert-tab false` will enable
|
||||
autocomplete for **non-entered** commands. `max-errors` sets maximum number of
|
||||
errors that could be corrected.
|
||||
|
||||
Prompt:
|
||||
|
||||
@ -192,7 +205,10 @@ ZSH_HIGHLIGHT_STYLES[double-quoted-argument]='fg=yellow'
|
||||
#ZSH_HIGHLIGHT_STYLES[root]='bg=red'
|
||||
```
|
||||
|
||||
In first line highlighting is turned on. Next main, brackets and pattern highlighting are turned on. Patterns are set below (`rm -rf *` in the example). Also `root` and `cursor` highlighting may be turned on. Colors syntax is understandable, `fg` is font color, `bg` is background color.
|
||||
In first line highlighting is turned on. Next main, brackets and pattern
|
||||
highlighting are turned on. Patterns are set below (`rm -rf *` in the example).
|
||||
Also `root` and `cursor` highlighting may be turned on. Colors syntax is
|
||||
understandable, `fg` is font color, `bg` is background color.
|
||||
|
||||
## <a href="#prompt" class="anchor" id="prompt"><span class="octicon octicon-link"></span></a>$PROMPT and $RPROMPT
|
||||
|
||||
@ -219,7 +235,9 @@ else
|
||||
fi
|
||||
```
|
||||
|
||||
`fg` is font color, `bg` is background color. `_bold` and `_no_bold` regulate the tint. Commands should be in `%{ ... %}` so they do not appear. Avaible colors are:
|
||||
`fg` is font color, `bg` is background color. `_bold` and `_no_bold` regulate
|
||||
the tint. Commands should be in `%{ ... %}` so they do not appear. Avaible
|
||||
colors are:
|
||||
|
||||
```bash
|
||||
black
|
||||
@ -276,11 +294,14 @@ $returncode\
|
||||
"%{$fg_bold[white]%}]%{$reset_color%}"
|
||||
```
|
||||
|
||||
My RPROMPT shows current time, battery change and last returned code. `precmd()` is necessary for automatic updating. The construct `$(if.true.false)` is conditional statement in `zsh`.
|
||||
My RPROMPT shows current time, battery change and last returned code. `precmd()`
|
||||
is necessary for automatic updating. The construct `$(if.true.false)` is
|
||||
conditional statement in `zsh`.
|
||||
|
||||
## <a href="#aliases" class="anchor" id="aliases"><span class="octicon octicon-link"></span></a>Aliases
|
||||
|
||||
**Copy only those aliases that you need.** If any alias uses application that is not installed it will leads to fail of loading of configuration file.
|
||||
**Copy only those aliases that you need.** If any alias uses application that is
|
||||
not installed it will leads to fail of loading of configuration file.
|
||||
|
||||
Small useful (or maybe not) function:
|
||||
|
||||
@ -311,7 +332,8 @@ alias less='vimpager'
|
||||
alias zless='vimpager'
|
||||
```
|
||||
|
||||
Here are ls aliases (see [man ls](//unixhelp.ed.ac.uk/CGI/man-cgi?ls "Man page")):
|
||||
Here are ls aliases (see [man ls](//unixhelp.ed.ac.uk/CGI/man-cgi?ls "Man
|
||||
page")):
|
||||
|
||||
```bash
|
||||
alias ls='show_which ls && ls --color=auto --group-directories-first'
|
||||
@ -360,7 +382,8 @@ else
|
||||
fi
|
||||
```
|
||||
|
||||
Here are global aliases. If they are enable the command `cat foo g bar` will be equivalent the command `cat foo | grep bar`:
|
||||
Here are global aliases. If they are enable the command `cat foo g bar` will be
|
||||
equivalent the command `cat foo | grep bar`:
|
||||
|
||||
```bash
|
||||
# global alias
|
||||
@ -471,7 +494,8 @@ su () {
|
||||
}
|
||||
```
|
||||
|
||||
Function that replaces original `rm` command. If you type `rm` it will be equivalent moving to trash an you can easily restore a file:
|
||||
Function that replaces original `rm` command. If you type `rm` it will be
|
||||
equivalent moving to trash an you can easily restore a file:
|
||||
|
||||
```bash
|
||||
rm () {
|
||||
@ -532,7 +556,8 @@ yatest () {
|
||||
|
||||
## <a href="#variables" class="anchor" id="variables"><span class="octicon octicon-link"></span></a>Variables
|
||||
|
||||
It is recommended to set own variables in `~/.zshenv`. But I have everything stored in the single file.
|
||||
It is recommended to set own variables in `~/.zshenv`. But I have everything
|
||||
stored in the single file.
|
||||
|
||||
Here are path, mask of new files, editor and pager:
|
||||
|
||||
@ -546,7 +571,8 @@ export EDITOR="vim"
|
||||
export PAGER="vimpager"
|
||||
```
|
||||
|
||||
Here is hashes. If they are enable the command `~global` will be equivalent the command `/mnt/global`:
|
||||
Here is hashes. If they are enable the command `~global` will be equivalent the
|
||||
command `/mnt/global`:
|
||||
|
||||
```bash
|
||||
# hash
|
||||
|
@ -7,13 +7,21 @@ tags: archlinux, linux, building, qutim
|
||||
title: Building Qutim using Qt5
|
||||
short: building-qutim-using-qt5
|
||||
---
|
||||
[Qutim](//qutim.org) is a multiprotocol and cross platform messenger. It is written on `CPP` 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).
|
||||
[Qutim](//qutim.org) is a multiprotocol and cross platform messenger. It is
|
||||
written on `CPP` 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).
|
||||
|
||||
<!--more-->
|
||||
|
||||
# <a href="#problems" class="anchor" id="problems"><span class="octicon octicon-link"></span></a>What's wrong?
|
||||
|
||||
This package uses [qbs](//qt-project.org/wiki/qbs "Wiki") for building, which is a bit strange IMHO. A package, which is necessary for building, is [in AUR](//aur.archlinux.org/packages/qbs-git/ "AUR") . 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.
|
||||
This package uses [qbs](//qt-project.org/wiki/qbs "Wiki") for building, which is
|
||||
a bit strange IMHO. A package, which is necessary for building, is [in
|
||||
AUR](//aur.archlinux.org/packages/qbs-git/ "AUR"). 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.
|
||||
|
||||
# <a href="#prepare" class="anchor" id="prepare"><span class="octicon octicon-link"></span></a>Prepare
|
||||
|
||||
@ -26,21 +34,28 @@ yaourt -S --asdeps jreen-git qbs-git
|
||||
|
||||
### <a href="#qbs" class="anchor" id="qbs"><span class="octicon octicon-link"></span></a>qbs settings
|
||||
|
||||
You may read about qbs [on the link](//qt-project.org/wiki/qbs "Wiki") 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 (`~/.config/QtProject/qbs.conf`) looks like this:
|
||||
You may read about qbs [on the link](//qt-project.org/wiki/qbs "Wiki") 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 (`~/.config/QtProject/qbs.conf`) looks like
|
||||
this:
|
||||
|
||||
```bash
|
||||
qbs-setup-qt --detect
|
||||
qbs-detect-toolchains
|
||||
```
|
||||
|
||||
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 `clang` toolchain):
|
||||
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 `clang`
|
||||
toolchain):
|
||||
|
||||
```bash
|
||||
sed 's/clang\\/qt-5-2-0\\/g' -i ~/.config/QtProject/qbs.conf
|
||||
```
|
||||
|
||||
And there are other ways. You may edit the file manually or use `qbs-config-ui` or `qbs-config`.
|
||||
So, we have created the configuration file and put it into build directory:
|
||||
And there are other ways. You may edit the file manually or use `qbs-config-ui`
|
||||
or `qbs-config`. So, we have created the configuration file and put it into
|
||||
build directory:
|
||||
|
||||
```ini
|
||||
[General]
|
||||
@ -69,7 +84,7 @@ qutim\Qt\core\libPath=/usr/lib
|
||||
qutim\Qt\core\mkspecPath=/usr/lib/qt/mkspecs/linux-g++
|
||||
qutim\Qt\core\namespace=
|
||||
qutim\Qt\core\pluginPath=/usr/lib/qt/plugins
|
||||
qutim\Qt\core\qtConfig=minimal-config, small-config, medium-config, large-config, full-config, gtk2, gtkstyle, fontconfig, libudev, evdev, xlib, xcb-glx, xcb-xlib, xcb-sm, xrender, accessibility-atspi-bridge, linuxfb, c++11, accessibility, opengl, shared, qpa, reduce_exports, reduce_relocations, clock-gettime, clock-monotonic, mremap, getaddrinfo, ipv6ifname, getifaddrs, inotify, eventfd, system-jpeg, system-png, png, system-freetype, no-harfbuzz, system-zlib, nis, cups, iconv, glib, dbus, dbus-linked, openssl-linked, xcb, xinput2, alsa, pulseaudio, icu, concurrent, audio-backend, release
|
||||
qutim\Qt\core\qtConfig=minimal-config, small-config, medium-config,large-config, full-config, gtk2, gtkstyle, fontconfig, libudev, evdev, xlib,xcb-glx, xcb-xlib, xcb-sm, xrender, accessibility-atspi-bridge, linuxfb, c++11,accessibility, opengl, shared, qpa, reduce_exports, reduce_relocations,clock-gettime, clock-monotonic, mremap, getaddrinfo, ipv6ifname, getifaddrs,inotify, eventfd, system-jpeg, system-png, png, system-freetype, no-harfbuzz,system-zlib, nis, cups, iconv, glib, dbus, dbus-linked, openssl-linked, xcb,xinput2, alsa, pulseaudio, icu, concurrent, audio-backend, release
|
||||
qutim\Qt\core\version=5.2.0
|
||||
qutim\cpp\compilerName=clang++
|
||||
qutim\cpp\toolchainInstallPath=/usr/bin
|
||||
@ -91,7 +106,8 @@ diff -ruN qutim.orig/core/libqutim.qbs qutim/core/libqutim.qbs
|
||||
@@ -75,7 +75,7 @@
|
||||
cpp.linkerFlags: {
|
||||
var flags = base;
|
||||
if (qbs.toolchain.contains("clang") && qbs.targetOS.contains("linux"))
|
||||
if (qbs.toolchain.contains("clang") &&
|
||||
qbs.targetOS.contains("linux"))
|
||||
- flags = flags.concat("-stdlib=libc++ -lcxxrt");
|
||||
+ flags = flags.concat("-lc++abi");
|
||||
return flags;
|
||||
@ -102,9 +118,12 @@ diff -ruN qutim.orig/core/libqutim.qbs qutim/core/libqutim.qbs
|
||||
And the second one is Vk plugin:
|
||||
|
||||
```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
|
||||
+++ qutim/protocols/vkontakte/vreen/vreen.qbs 2014-01-06 15:46:47.142178486 +0400
|
||||
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
|
||||
+++ qutim/protocols/vkontakte/vreen/vreen.qbs 2014-01-06 15:46:47.142178486
|
||||
+0400
|
||||
@@ -5,6 +5,7 @@
|
||||
property string vreen_qml_path: "bin"
|
||||
property string vreen_lib_path: "lib"
|
||||
@ -142,7 +161,10 @@ cd qutim
|
||||
HOME=$(pwd) qbs -j $(nproc) -d ../build release profile:qutim
|
||||
```
|
||||
|
||||
I want to create a universal recipe for the building, thus we must set `$HOME` directory. Flag `-j` means number of jobs, `-d` means build directory, `release` means building type (debug, release), `profile` is used profile, which is described in the configuration file.
|
||||
I want to create a universal recipe for the building, thus we must set `$HOME`
|
||||
directory. Flag `-j` means number of jobs, `-d` means build directory, `release`
|
||||
means building type (debug, release), `profile` is used profile, which is
|
||||
described in the configuration file.
|
||||
|
||||
## <a href="#install" class="anchor" id="install"><span class="octicon octicon-link"></span></a>Installation
|
||||
|
||||
@ -150,7 +172,8 @@ I want to create a universal recipe for the building, thus we must set `$HOME` d
|
||||
HOME=$(pwd) sudo qbs install -d ../build --install-root "/usr" profile:qutim
|
||||
```
|
||||
|
||||
We must set root directory (`--install-root`), because without this option the package will be installed into `/` (`/bin` and `/lib`).
|
||||
We must set root directory (`--install-root`), because without this option the
|
||||
package will be installed into `/` (`/bin` and `/lib`).
|
||||
|
||||
## <a href="#pkgbuild" class="anchor" id="pkgbuild"><span class="octicon octicon-link"></span></a>PKGBUILD
|
||||
|
||||
|
@ -12,7 +12,13 @@ I decided to change my site. You may find short list of changes below.
|
||||
<!--more-->
|
||||
|
||||
## <a href="#list" class="anchor" id="list"><span class="octicon octicon-link"></span></a>The list of changes:
|
||||
* I rented a `arcanis.me` 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 [DNS-master](//www.nic.ru/dns/service/dns_hosting/ "Service page") 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:
|
||||
* I rented a `arcanis.me` 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
|
||||
[DNS-master](//www.nic.ru/dns/service/dns_hosting/ "Service page") 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:
|
||||
|
||||
```bash
|
||||
@ A 192.30.252.153
|
||||
@ -21,7 +27,8 @@ I decided to change my site. You may find short list of changes below.
|
||||
www CNAME @
|
||||
```
|
||||
|
||||
(Symbol `@` means you root domain.) And next wait for two hours. You may find out the result as follows:
|
||||
(Symbol `@` means you root domain.) And next wait for two hours. You may
|
||||
find out the result as follows:
|
||||
|
||||
```bash
|
||||
$ dig domain.name +nostats +nocomments +nocmd
|
||||
@ -33,8 +40,11 @@ I decided to change my site. You may find short list of changes below.
|
||||
...
|
||||
```
|
||||
|
||||
* Also I've created [my own repo](ftp://repo.arcanis.me/repo "Repository"), which will contain some AUR packages that I'm using. Support of both architectures is planned.
|
||||
* 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:
|
||||
* Also I've created [my own repo](ftp://repo.arcanis.me/repo "Repository"),
|
||||
which will contain some AUR packages that I'm using. Support of both
|
||||
architectures is planned.
|
||||
* 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:
|
||||
|
||||
```bash
|
||||
# only read rights
|
||||
@ -44,7 +54,9 @@ I decided to change my site. You may find short list of changes below.
|
||||
/home/arcanis/share.fs /srv/ftp/share ext4 defaults,rw 0 0
|
||||
```
|
||||
|
||||
Login on special user and option `anon_world_readable_only=YES` are used for prevent access to the music directory. Also here is my `/etc/vsftpd.conf` configuration file:
|
||||
Login on special user and option `anon_world_readable_only=YES` are used for
|
||||
prevent access to the music directory. Also here is my `/etc/vsftpd.conf`
|
||||
configuration file:
|
||||
|
||||
```bash
|
||||
anonymous_enable=YES
|
||||
@ -67,10 +79,12 @@ I decided to change my site. You may find short list of changes below.
|
||||
listen=YES
|
||||
```
|
||||
|
||||
Now let's add redirection from `repo.arcanis.me` to the needed IP address. To do this, add the following entry in DNS:
|
||||
Now let's add redirection from `repo.arcanis.me` to the needed IP address.
|
||||
To do this, add the following entry in DNS:
|
||||
|
||||
```bash
|
||||
repo A 89.249.170.38
|
||||
```
|
||||
|
||||
* Also there are plans to buy a server for compiling packages and hosting the repository, filesharing and backups.
|
||||
* Also there are plans to buy a server for compiling packages and hosting the
|
||||
repository, filesharing and backups.
|
||||
|
@ -13,13 +13,17 @@ It is a short paper devoted to creation own ArchLinux repository.
|
||||
|
||||
## <a href="#prepare" class="anchor" id="prepare"><span class="octicon octicon-link"></span></a>Prepare
|
||||
|
||||
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, `devtools` and `pacman`:
|
||||
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, `devtools` and `pacman`:
|
||||
|
||||
```bash
|
||||
pacman -Sy devtools
|
||||
```
|
||||
|
||||
[devtools](//www.archlinux.org/packages/devtools/ "Archlinux package") is script set for building automation in the clean chroot. I think most of Arch maintainers use it.
|
||||
[devtools](//www.archlinux.org/packages/devtools/ "Archlinux package") is script
|
||||
set for building automation in the clean chroot. I think most of Arch
|
||||
maintainers use it.
|
||||
|
||||
Let's create working directories and set colors:
|
||||
|
||||
@ -59,11 +63,15 @@ if [ ! -d "${STAGINGDIR}" ]; then
|
||||
fi
|
||||
```
|
||||
|
||||
`${REPODIR}/{i686,x86_64}` are directories for repository, `${PREPAREDIR}` is directory where compiled packages will be stored, `${STAGINGDIR}` is one where packages will be built.
|
||||
`${REPODIR}/{i686,x86_64}` are directories for repository, `${PREPAREDIR}` is
|
||||
directory where compiled packages will be stored, `${STAGINGDIR}` is one where
|
||||
packages will be built.
|
||||
|
||||
## <a href="#theory" class="anchor" id="theory"><span class="octicon octicon-link"></span></a>A bit of theory
|
||||
|
||||
Create directory, share it (using [ftp](/en/2014/03/06/site-changes/ "Site changes paper"), for example). It has two subdirectories - `i686` and `x86_64` - for each architecture respectively. And fill them with a set of packages.
|
||||
Create directory, share it (using [ftp](/en/2014/03/06/site-changes/ "Site
|
||||
changes paper"), for example). It has two subdirectories - `i686` and `x86_64` -
|
||||
for each architecture respectively. And fill them with a set of packages.
|
||||
|
||||
Updating repository may be split into the following steps:
|
||||
|
||||
@ -149,17 +157,22 @@ if [ ${USEGPG} == "yes" ]; then
|
||||
fi
|
||||
```
|
||||
|
||||
It is recommended to configure [gpg-agent](//wiki.archlinux.org/index.php/GPG#gpg-agent "ArchWiki").
|
||||
It is recommended to configure
|
||||
[gpg-agent](//wiki.archlinux.org/index.php/GPG#gpg-agent "ArchWiki").
|
||||
|
||||
### <a href="#list" class="anchor" id="list"><span class="octicon octicon-link"></span></a>Creating the list of packages
|
||||
|
||||
```bash
|
||||
# creating packages list
|
||||
cd "${PREPAREDIR}"
|
||||
i686_PACKAGES=$(/usr/bin/find * -name '*-i686.pkg.tar.xz' -o -name '*-any.pkg.tar.xz')
|
||||
x86_64_PACKAGES=$(/usr/bin/find * -name '*-x86_64.pkg.tar.xz' -o -name '*-any.pkg.tar.xz')
|
||||
echo -e "${bwhite}[II] ${bblue}=>${cclose} i686 packages: \n${bwhite}${i686_PACKAGES}${cclose}"
|
||||
echo -e "${bwhite}[II] ${bblue}=>${cclose} x86_64 packages: \n${bwhite}${x86_64_PACKAGES}${cclose}"
|
||||
i686_PACKAGES=$(/usr/bin/find * -name '*-i686.pkg.tar.xz' -o -name
|
||||
'*-any.pkg.tar.xz')
|
||||
x86_64_PACKAGES=$(/usr/bin/find * -name '*-x86_64.pkg.tar.xz' -o -name
|
||||
'*-any.pkg.tar.xz')
|
||||
echo -e "${bwhite}[II] ${bblue}=>${cclose} i686 packages:
|
||||
\n${bwhite}${i686_PACKAGES}${cclose}"
|
||||
echo -e "${bwhite}[II] ${bblue}=>${cclose} x86_64 packages:
|
||||
\n${bwhite}${x86_64_PACKAGES}${cclose}"
|
||||
```
|
||||
|
||||
### <a href="#updating" class="anchor" id="updating"><span class="octicon octicon-link"></span></a>Repository update
|
||||
@ -223,7 +236,8 @@ cd "${STAGINGDIR}"
|
||||
|
||||
### <a href="#symlinks" class="anchor" id="symlinks"><span class="octicon octicon-link"></span></a>Creating symlinks
|
||||
|
||||
You may want to create a directory, which will contain symlinks on actual packages with names, which does not contain version:
|
||||
You may want to create a directory, which will contain symlinks on actual
|
||||
packages with names, which does not contain version:
|
||||
|
||||
```bash
|
||||
# creating symlinks
|
||||
@ -248,7 +262,8 @@ fi
|
||||
|
||||
### <a href="#file" class="anchor" id="file"><span class="octicon octicon-link"></span></a>File
|
||||
|
||||
Here is [the scripts](//github.com/arcan1s/repo-scripts "GitHub"). Download source tarballs and run script (editing variables if it is necessary).
|
||||
Here is [the scripts](//github.com/arcan1s/repo-scripts "GitHub"). Download
|
||||
source tarballs and run script (editing variables if it is necessary).
|
||||
|
||||
## <a href="#using" class="anchor" id="using"><span class="octicon octicon-link"></span></a>Repository usage
|
||||
|
||||
|
@ -7,27 +7,89 @@ tags: настройка, linux, archlinux
|
||||
title: Apps which I use
|
||||
short: my-desktop
|
||||
---
|
||||
Here is a short paper devoted to the set of applications and extensions that I use everyday on my home computer.
|
||||
Here is a short paper devoted to the set of applications and extensions that I
|
||||
use everyday on my home computer.
|
||||
|
||||
<!--more-->
|
||||
|
||||
## <a href="#apps" class="anchor" id="apps"><span class="octicon octicon-link"></span></a>Applications
|
||||
|
||||
* **Shell** is zshrc and nothing else. You may find a small description of my settings [here](/en/2014/01/14/about-zshrc/ "About zshrc paper"). It is stored [here](//raw.githubusercontent.com/arcan1s/dotfiles/master/zshrc "File") (or [here](//raw.githubusercontent.com/arcan1s/dotfiles/master/zshrc_server "File")).
|
||||
* **DE** - I use KDE as Desktop Environment. And that's why most of apps are qt-based. Some KDE settings are below.
|
||||
* **Graphic editors** - [gwenview](//kde.org/applications/graphics/gwenview/ "Gwenview Homepage") is used for viewing images, [kolourpaint](//kde.org/applications/graphics/kolourpaint/ "Kolourpaint Homepage") is used for simple editing pixel images, [gimp](//www.gimp.org/ "Gimp Homepage") (without plugins, since they are not needed for me) - for editing and [inkskape](//www.inkscape.org/ "Inkskape Homepage") is used as editor of vector graphics.
|
||||
* **Browser** - I use Firefox. Some Firefox settings are below. Chromium is used as additional browser, elinks is used as console browser.
|
||||
* **IM client** is [qutIM](//qutim.org "Qutim Homepage"). It is a cross-platform, multiprotocol and full featured client. [Kopete](//kde.org/applications/internet/kopete/ "Kopete Homepage"), 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.
|
||||
* **Mail client** is [kmail](//kde.org/applications/internet/kmail/ "Kmail Homepage"). 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.
|
||||
* **IRC client** is [konversation](//konversation.kde.org/ "Konversation Homepage"). 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.
|
||||
* **Torrent client** is [transmission](//www.transmissionbt.com/ "Transmission Homepage") with Qt5 interface (it has gtk interface too). It is also used for server but without GUI.
|
||||
* **Video player** is [mpv](//mpv.io/ "Mpv Homepage"), since mplayer died and mplayer2 was born deadborn. Graphical frontend are not needed.
|
||||
* **Audio player** is [qmmp](//qmmp.ylsoftware.com/ "Qmmp Homepage"). It is a good winamp-like player. Flick of the wrist you may make a handy interface for it (simpleui).
|
||||
* **Audio/video editors**: [kdenlive](//kde-apps.org/content/show.php?content=29024 "Kdenlive Homepage") is used as video editor, [soundkonverter](//kde-apps.org/content/show.php?content=29024) is used as audio editor, [easytag](//wiki.gnome.org/Apps/EasyTAG "Easytag Homepage") 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.
|
||||
* **Office**: [Kingsoft Office](//wps-community.org/ "KO Homepage") 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.) [Kile](//kile.sourceforge.net/ "Kile Homepage") is used as LaTeX frontend. [Okular](//kde.org/applications/graphics/okular/ "Okular Homepage") is used as document viewer. And I use [GoldenDict](//goldendict.org/ "GoldenDict Homepage") as dictionary.
|
||||
* **Editors**: [kwrite](//www.kde.org/applications/utilities/kwrite/ "Kwrite Homepage") is used as a simple text editor, [kate](//www.kde.org/applications/utilities/kate/ "Kate Homepage") (and [cpp-helper](//zaufi.github.io/kate-cpp-helper-plugin.html "Plugin Homepage") plugin) is used as advanced text editor. And of course I use vim in console.
|
||||
* **Scientific soft**. Chemical visualizers are [vmd](//www.ks.uiuc.edu/Research/vmd/ "VMD Homepage"), [chimera](//www.cgl.ucsf.edu/chimera/ "Chimera Homepage") and [pymol](//pymol.org/ "Pymol Homepage"). Physics simulator is [step](//kde.org/applications/education/step/ "Step Homepage"). Calculator is [kalgebra](//kde.org/applications/education/kalgebra/ "Kalgebra Homepage") and console [ipython](//ipython.org/ "ipython Homepage"). [Qtiplot](//qtiplot.com/ "Qtiplot Homepage") is used for drawing graphs and data analysis (scidavis, which is its fork, unfortunately, is half-dead), [grace](//plasma-gate.weizmann.ac.il/Grace/ "Grace Homepage") is used for only drawing graphs. [Chemtool](//ruby.chemie.uni-freiburg.de/~martin/chemtool/chemtool.html "Chemtool Homepage") is used as alternative of ChemDraw.
|
||||
* **System applications**. File manager is [dolphin](//kde.org/applications/system/dolphin/ "Dolphin Homepage"), [doublecmd](//doublecmd.sourceforge.net/ "Doublecmd Homepage") is used as twin-panel manager. Terminal emulators are [yakuake](//yakuake.kde.org/ "Yakuake Homepage") and [urxvt](//software.schmorp.de/pkg/rxvt-unicode.html "Urxvt Homepage") (as windowed emulator). Archiver graphical interface is [ark](//kde.org/applications/utilities/ark/ "Ark Homepage").
|
||||
* **Shell** is zshrc and nothing else. You may find a small description of my
|
||||
settings [here](/en/2014/01/14/about-zshrc/ "About zshrc paper"). It is stored
|
||||
[here](//raw.githubusercontent.com/arcan1s/dotfiles/master/zshrc "File") (or
|
||||
[here](//raw.githubusercontent.com/arcan1s/dotfiles/master/zshrc_server
|
||||
"File")).
|
||||
* **DE** - I use KDE as Desktop Environment. And that's why most of apps are
|
||||
qt-based. Some KDE settings are below.
|
||||
* **Graphic editors** - [gwenview](//kde.org/applications/graphics/gwenview/
|
||||
"Gwenview Homepage") is used for viewing images,
|
||||
[kolourpaint](//kde.org/applications/graphics/kolourpaint/ "Kolourpaint
|
||||
Homepage") is used for simple editing pixel images, [gimp](//www.gimp.org/ "Gimp
|
||||
Homepage") (without plugins, since they are not needed for me) - for editing and
|
||||
[inkskape](//www.inkscape.org/ "Inkskape Homepage") is used as editor of vector
|
||||
graphics.
|
||||
* **Browser** - I use Firefox. Some Firefox settings are below. Chromium is used
|
||||
as additional browser, elinks is used as console browser.
|
||||
* **IM client** is [qutIM](//qutim.org "Qutim Homepage"). It is a
|
||||
cross-platform, multiprotocol and full featured client.
|
||||
[Kopete](//kde.org/applications/internet/kopete/ "Kopete Homepage"), 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.
|
||||
* **Mail client** is [kmail](//kde.org/applications/internet/kmail/ "Kmail
|
||||
Homepage"). 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.
|
||||
* **IRC client** is [konversation](//konversation.kde.org/ "Konversation
|
||||
Homepage"). 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.
|
||||
* **Torrent client** is [transmission](//www.transmissionbt.com/ "Transmission
|
||||
Homepage") with Qt5 interface (it has gtk interface too). It is also used for
|
||||
server but without GUI.
|
||||
* **Video player** is [mpv](//mpv.io/ "Mpv Homepage"), since mplayer died and
|
||||
mplayer2 was born deadborn. Graphical frontend are not needed.
|
||||
* **Audio player** is [qmmp](//qmmp.ylsoftware.com/ "Qmmp Homepage"). It is a
|
||||
good winamp-like player. Flick of the wrist you may make a handy interface for
|
||||
it (simpleui).
|
||||
* **Audio/video editors**:
|
||||
[kdenlive](//kde-apps.org/content/show.php?content=29024 "Kdenlive Homepage") is
|
||||
used as video editor,
|
||||
[soundkonverter](//kde-apps.org/content/show.php?content=29024) is used as audio
|
||||
editor, [easytag](//wiki.gnome.org/Apps/EasyTAG "Easytag Homepage") 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.
|
||||
* **Office**: [Kingsoft Office](//wps-community.org/ "KO Homepage") 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.) [Kile](//kile.sourceforge.net/ "Kile
|
||||
Homepage") is used as LaTeX frontend.
|
||||
[Okular](//kde.org/applications/graphics/okular/ "Okular Homepage") is used as
|
||||
document viewer. And I use [GoldenDict](//goldendict.org/ "GoldenDict Homepage")
|
||||
as dictionary.
|
||||
* **Editors**: [kwrite](//www.kde.org/applications/utilities/kwrite/ "Kwrite
|
||||
Homepage") is used as a simple text editor,
|
||||
[kate](//www.kde.org/applications/utilities/kate/ "Kate Homepage") (and
|
||||
[cpp-helper](//zaufi.github.io/kate-cpp-helper-plugin.html "Plugin Homepage")
|
||||
plugin) is used as advanced text editor. And of course I use vim in console.
|
||||
* **Scientific soft**. Chemical visualizers are
|
||||
[vmd](//www.ks.uiuc.edu/Research/vmd/ "VMD Homepage"),
|
||||
[chimera](//www.cgl.ucsf.edu/chimera/ "Chimera Homepage") and
|
||||
[pymol](//pymol.org/ "Pymol Homepage"). Physics simulator is
|
||||
[step](//kde.org/applications/education/step/ "Step Homepage"). Calculator is
|
||||
[kalgebra](//kde.org/applications/education/kalgebra/ "Kalgebra Homepage") and
|
||||
console [ipython](//ipython.org/ "ipython Homepage"). [Qtiplot](//qtiplot.com/
|
||||
"Qtiplot Homepage") is used for drawing graphs and data analysis (scidavis,
|
||||
which is its fork, unfortunately, is half-dead),
|
||||
[grace](//plasma-gate.weizmann.ac.il/Grace/ "Grace Homepage") is used for only
|
||||
drawing graphs.
|
||||
[Chemtool](//ruby.chemie.uni-freiburg.de/~martin/chemtool/chemtool.html
|
||||
"Chemtool Homepage") is used as alternative of ChemDraw.
|
||||
* **System applications**. File manager is
|
||||
[dolphin](//kde.org/applications/system/dolphin/ "Dolphin Homepage"),
|
||||
[doublecmd](//doublecmd.sourceforge.net/ "Doublecmd Homepage") is used as
|
||||
twin-panel manager. Terminal emulators are [yakuake](//yakuake.kde.org/ "Yakuake
|
||||
Homepage") and [urxvt](//software.schmorp.de/pkg/rxvt-unicode.html "Urxvt
|
||||
Homepage") (as windowed emulator). Archiver graphical interface is
|
||||
[ark](//kde.org/applications/utilities/ark/ "Ark Homepage").
|
||||
|
||||
## <a href="#kde" class="anchor" id="kde"><span class="octicon octicon-link"></span></a>KDE settings
|
||||
|
||||
@ -37,11 +99,26 @@ Here is a short paper devoted to the set of applications and extensions that I u
|
||||
{% include prj_scr.html %}
|
||||
</div>
|
||||
|
||||
QtCurve is used as Qt style, its settings may be found [here](//github.com/arcan1s/dotfiles/tree/master/qtcurve "GitHub"), window decorations are presented by QtCurve too. Cursor theme is [ecliz-small](//kde-look.org/content/show.php/Ecliz?content=110340 "Cursor Homepage"). Plasma theme is [volatile](//kde-look.org/content/show.php/Volatile?content=128110 "Theme Homepage"). Icon pack is [compass](//nitrux.in/ "Nitrux Homepage"). I use fonts which are based on Liberation.
|
||||
QtCurve is used as Qt style, its settings may be found
|
||||
[here](//github.com/arcan1s/dotfiles/tree/master/qtcurve "GitHub"), window
|
||||
decorations are presented by QtCurve too. Cursor theme is
|
||||
[ecliz-small](//kde-look.org/content/show.php/Ecliz?content=110340 "Cursor
|
||||
Homepage"). Plasma theme is
|
||||
[volatile](//kde-look.org/content/show.php/Volatile?content=128110 "Theme
|
||||
Homepage"). Icon pack is [compass](//nitrux.in/ "Nitrux Homepage"). I use fonts
|
||||
which are based on Liberation.
|
||||
|
||||
**Used widgets** (from left to right, top to bottom) are: [menubar](//launchpad.net/plasma-widget-menubar "Widget Homepage"), [homerun](//userbase.kde.org/Homerun "Widget Homepage") with transparent icon, [icontask](//kde-apps.org/content/show.php?content=144808 "Widget Homepage"), [netctl](/projects/netctl-gui/ "Widget Homepage"), default KDE tray, [colibri](//agateau.com/projects/colibri/ "Widget Homepage") for notifications, [Awesome Widgets](/projects/awesome-widgets "Widget Homepage").
|
||||
**Used widgets** (from left to right, top to bottom) are:
|
||||
[menubar](//launchpad.net/plasma-widget-menubar "Widget Homepage"),
|
||||
[homerun](//userbase.kde.org/Homerun "Widget Homepage") with transparent icon,
|
||||
[icontask](//kde-apps.org/content/show.php?content=144808 "Widget Homepage"),
|
||||
[netctl](/projects/netctl-gui/ "Widget Homepage"), default KDE tray,
|
||||
[colibri](//agateau.com/projects/colibri/ "Widget Homepage") for notifications,
|
||||
[Awesome Widgets](/projects/awesome-widgets "Widget Homepage").
|
||||
|
||||
As a bonus material [here](//github.com/arcan1s/dotfiles/blob/master/themes/yakuake/My%20color.colorscheme "GitHub") is a settings for konsole bright colors.
|
||||
As a bonus material
|
||||
[here](//github.com/arcan1s/dotfiles/blob/master/themes/yakuake/My%20color.
|
||||
colorscheme "GitHub") is a settings for konsole bright colors.
|
||||
|
||||
<div class="thumbnails">
|
||||
{% assign scrdesc = "Zsh demonstation" %}
|
||||
@ -58,18 +135,21 @@ I do not use a special settings, thus I get you a list of used add-ons:
|
||||
* **Auto Refresh** is used for auto update pages.
|
||||
* **Clone tab** adds "Clone tab" function.
|
||||
* **Close tab by double click**.
|
||||
* **New scrollbars** is used for customizing scrollbars, because original ones look horrible in Qt environment.
|
||||
* **New scrollbars** is used for customizing scrollbars, because original ones
|
||||
look horrible in Qt environment.
|
||||
* **NoScript** is used for I2P and Tor, for example.
|
||||
* **PrivateTab** adds private tab (not the window).
|
||||
* **Proxy Selector** adds an ability to use multiple proxies.
|
||||
* **QuickJava** is used with the same goal as NoScript.
|
||||
* **RSS icon in url bar**.
|
||||
* **Dictionaries for spellchecking** (eng/rus).
|
||||
* **Space Next**. If I tap a space at the bottom of a page, it will be perceived as pushing the "Next" button.
|
||||
* **Space Next**. If I tap a space at the bottom of a page, it will be perceived
|
||||
as pushing the "Next" button.
|
||||
* **Speed Dial** is a simple express panel.
|
||||
* **Status-4-Evar** is a normal status bar.
|
||||
* **tab delabelifier** minimizes inactive tabs.
|
||||
* **Tab Scope + Tab Scope Tweaker** is tab tooltip.
|
||||
* **accessKey** does not work now. But it is needed for easy navigation from keyboard (opera-like).
|
||||
* **accessKey** does not work now. But it is needed for easy navigation from
|
||||
keyboard (opera-like).
|
||||
* **FXOpera** is a normal minimalistic appearance.
|
||||
|
||||
|
@ -13,17 +13,28 @@ Paper, which describes how to remove the dependency on baloo in your system.
|
||||
|
||||
## <a href="#disclaimer" class="anchor" id="disclaimer"><span class="octicon octicon-link"></span></a>Disclaimer
|
||||
|
||||
I do not use this patch, 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).
|
||||
I do not use this patch, 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).
|
||||
|
||||
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 [article](//blog.andreascarpino.it/disabling-baloo-the-arch-way/ "Scarpino's blog").
|
||||
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
|
||||
[article](//blog.andreascarpino.it/disabling-baloo-the-arch-way/ "Scarpino's
|
||||
blog").
|
||||
|
||||
## <a href="#intro" class="anchor" id="intro"><span class="octicon octicon-link"></span></a>Introduction
|
||||
|
||||
In Archlinux **gwenview** and **kdepim** (and **baloo-widgets**) depend on baloo currently (2014-05-18). In the version 4.13.0 **kactivities** 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.
|
||||
In Archlinux **gwenview** and **kdepim** (and **baloo-widgets**) depend on baloo
|
||||
currently (2014-05-18). In the version 4.13.0 **kactivities** 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.
|
||||
|
||||
## <a href="#gwenview" class="anchor" id="gwenview"><span class="octicon octicon-link"></span></a>gwenview
|
||||
|
||||
It's all quite simple. Developers have taken care of the wishes of ordinary users and added a special flag:
|
||||
It's all quite simple. Developers have taken care of the wishes of ordinary
|
||||
users and added a special flag:
|
||||
|
||||
```cmake
|
||||
//Semantic info backend for Gwenview (Baloo/Fake/None)
|
||||
@ -42,8 +53,14 @@ cmake ../gwenview-${pkgver} \
|
||||
|
||||
## <a href="#kdepim" class="anchor" id="kdepim"><span class="octicon octicon-link"></span></a>kdepim
|
||||
|
||||
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 [here](//gist.github.com/arcan1s/b698bb586faef627b3bb "Gist") (4.13.3). Download the patch, apply it to the source code and recompile kdepim.
|
||||
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
|
||||
[here](//gist.github.com/arcan1s/b698bb586faef627b3bb "Gist") (4.13.3). Download
|
||||
the patch, apply it to the source code and recompile kdepim.
|
||||
|
||||
## <a href="#packages" class="anchor" id="packages"><span class="octicon octicon-link"></span></a>Packages
|
||||
|
||||
All Archlinux packages for both architectures may be found in [my repository](//wiki.archlinux.org/index.php/Unofficial_user_repositories#arcanisrepo "ArchWiki").
|
||||
All Archlinux packages for both architectures may be found in [my
|
||||
repository](//wiki.archlinux.org/index.php/Unofficial_user_repositories#arcanisrepo "ArchWiki").
|
||||
|
@ -7,19 +7,26 @@ tags: linux, development
|
||||
title: Writting own Shell completions. Zsh
|
||||
short: writting-own-completions-p1
|
||||
---
|
||||
<figure class="img"></figure> Some basics of creating a completion files for own application are described in these articles.
|
||||
<figure class="img"></figure>Some
|
||||
basics of creating a completion files for own application are described in these
|
||||
articles.
|
||||
|
||||
<!--more-->
|
||||
|
||||
## <a href="#preamble" class="anchor" id="preamble"><span class="octicon octicon-link"></span></a>Preamble
|
||||
|
||||
While developing [one of my projects](/ru/projects/netctl-gui "Netctl-gui project page") 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.
|
||||
While developing [one of my projects](/ru/projects/netctl-gui "Netctl-gui
|
||||
project page") 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.
|
||||
|
||||
## <a href="#introduction" class="anchor" id="introduction"><span class="octicon octicon-link"></span></a>Introduction
|
||||
|
||||
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).
|
||||
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).
|
||||
|
||||
Lets consider the example of my application, which has a part of help message that looks like this:
|
||||
Lets consider the example of my application, which has a part of help message
|
||||
that looks like this:
|
||||
|
||||
```bash
|
||||
netctl-gui [ -h | --help ] [ -e ESSID | --essid ESSID ] [ -с FILE | --config FILE ]
|
||||
@ -30,19 +37,27 @@ Here is a flag list:
|
||||
* flags `-h` and `--help` do not require any arguments;
|
||||
* flags `-e` and `--essid` require a string argument without completion;
|
||||
* flags `-c` and `--config` require a string argument, which is a file;
|
||||
* flags `-o` and `--open` require a string argument, there is a completion from files in the specified directory;
|
||||
* flags `-t` and `--tab` require a string argument, there is a completion from the specified array;
|
||||
* flag `--set-opts` requires a string argument, there is a completion from the specified array comma separated;
|
||||
* flags `-o` and `--open` require a string argument, there is a completion from
|
||||
files in the specified directory;
|
||||
* flags `-t` and `--tab` require a string argument, there is a completion from
|
||||
the specified array;
|
||||
* flag `--set-opts` requires a string argument, there is a completion from the
|
||||
specified array comma separated;
|
||||
|
||||
## <a href="#file" class="anchor" id="file"><span class="octicon octicon-link"></span></a>The file pattern
|
||||
|
||||
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):
|
||||
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):
|
||||
|
||||
```bash
|
||||
#compdef netctl-gui
|
||||
```
|
||||
|
||||
Next there is flags, additional functions and variables declarations. It should be noted that all functions and variables, which will be used for completions, **should return arrays**. In my case this scheme looks like this (I left empty these functions in this chapter):
|
||||
Next there is flags, additional functions and variables declarations. It should
|
||||
be noted that all functions and variables, which will be used for completions,
|
||||
**should return arrays**. In my case this scheme looks like this (I left empty
|
||||
these functions in this chapter):
|
||||
|
||||
```bash
|
||||
# variables
|
||||
@ -52,14 +67,17 @@ _netctl_gui_tabs=()
|
||||
_netctl_profiles() {}
|
||||
```
|
||||
|
||||
Then there are main functions, which will be called for completion of specific application. In my case this there is only one applications, so there is only one function:
|
||||
Then there are main functions, which will be called for completion of specific
|
||||
application. In my case this there is only one applications, so there is only
|
||||
one function:
|
||||
|
||||
```bash
|
||||
# work block
|
||||
_netctl-gui() {}
|
||||
```
|
||||
|
||||
And finally **without isolation in a separate function** there is a small shamanism, which declares a dependence "application-function":
|
||||
And finally **without isolation in a separate function** there is a small
|
||||
shamanism, which declares a dependence "application-function":
|
||||
|
||||
```bash
|
||||
case "$service" in
|
||||
@ -71,7 +89,19 @@ esac
|
||||
|
||||
## <a href="#flags" class="anchor" id="flags"><span class="octicon octicon-link"></span></a>Flags
|
||||
|
||||
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 `_arguments` command, which require a specific format of variables: `FLAG[description]:MESSAGE:ACTION`. 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: `{(FLAG_2)FLAG_1,(FLAG_1)FLAG_2}[description]:MESSAGE:ACTION`. 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: `{FLAG,FLAG}[description]:MESSAGE:ACTION`. `MESSAGE` is a message which will be shown, `ACTION` is an action which will be performed after this flag. In this tutorial `ACTION` will be following: `->STATE`.
|
||||
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 `_arguments` command, which require a specific format of
|
||||
variables: `FLAG[description]:MESSAGE:ACTION`. 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:
|
||||
`{(FLAG_2)FLAG_1,(FLAG_1)FLAG_2}[description]:MESSAGE:ACTION`. 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:
|
||||
`{FLAG,FLAG}[description]:MESSAGE:ACTION`. `MESSAGE` is a message which will be
|
||||
shown, `ACTION` is an action which will be performed after this flag. In this
|
||||
tutorial `ACTION` will be following: `->STATE`.
|
||||
|
||||
So, according to our requirements, flags declaration will be following:
|
||||
|
||||
@ -102,7 +132,9 @@ _netctl_gui_tabs=(
|
||||
)
|
||||
```
|
||||
|
||||
And there is a dynamic array, which should be generated each time. In my case it is a list of files in the specified directory (by the way it may be done by means of zsh):
|
||||
And there is a dynamic array, which should be generated each time. In my case it
|
||||
is a list of files in the specified directory (by the way it may be done by
|
||||
means of zsh):
|
||||
|
||||
```bash
|
||||
_netctl_profiles() {
|
||||
@ -112,7 +144,10 @@ _netctl_profiles() {
|
||||
|
||||
## <a href="#body" class="anchor" id="body"><span class="octicon octicon-link"></span></a>Function
|
||||
|
||||
Remember, there was something about a state above? It is stored in the variable `$state` and in this function we will check what it is to choose the appropriate action. At the beginning of the function we should call `_arguments` with our flags.
|
||||
Remember, there was something about a state above? It is stored in the variable
|
||||
`$state` and in this function we will check what it is to choose the appropriate
|
||||
action. At the beginning of the function we should call `_arguments` with our
|
||||
flags.
|
||||
|
||||
```bash
|
||||
_netctl-gui() {
|
||||
@ -146,6 +181,13 @@ _netctl-gui() {
|
||||
|
||||
## <a href="#conclusion" class="anchor" id="conclusion"><span class="octicon octicon-link"></span></a>Conclusion
|
||||
|
||||
File should be places to `/usr/share/zsh/site-functions/` with any name (it is recommended to set prefix to `_`). You may found the example [in my repository](//raw.githubusercontent.com/arcan1s/netctl-gui/master/sources/gui/zsh-completions "File").
|
||||
File should be places to `/usr/share/zsh/site-functions/` with any name (it is
|
||||
recommended to set prefix to `_`). You may found the example [in my
|
||||
repository](//raw.githubusercontent.com/arcan1s/netctl-gui/master/sources/gui/zsh-completions
|
||||
"File").
|
||||
|
||||
The additional information may be found in [zsh-completions](//github.com/zsh-users/zsh-completions "GitHub") repository. For example there is this [How-To](//github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org "Tutorial"). And also there are a lot of examples.
|
||||
The additional information may be found in
|
||||
[zsh-completions](//github.com/zsh-users/zsh-completions "GitHub") repository.
|
||||
For example there is this
|
||||
[How-To](//github.com/zsh-users/zsh-completions/blob/master/zsh-completions-howto.org
|
||||
"Tutorial"). And also there are a lot of examples.
|
||||
|
@ -7,19 +7,27 @@ tags: linux, development
|
||||
title: Writting own Shell completions. Bash
|
||||
short: writting-own-completions-p2
|
||||
---
|
||||
<figure class="img"></figure> Some basics of creating a completion files for own application are described in these articles.
|
||||
<figure class="img"></figure>Some
|
||||
basics of creating a completion files for own application are described in these
|
||||
articles.
|
||||
|
||||
<!--more-->
|
||||
|
||||
## <a href="#preamble" class="anchor" id="preamble"><span class="octicon octicon-link"></span></a>Preamble
|
||||
|
||||
While developing [one of my projects](/ru/projects/netctl-gui "Netctl-gui project page") 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.
|
||||
While developing [one of my projects](/ru/projects/netctl-gui "Netctl-gui
|
||||
project page") 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.
|
||||
|
||||
## <a href="#introduction" class="anchor" id="introduction"><span class="octicon octicon-link"></span></a>Introduction
|
||||
|
||||
Bash, [unlike zsh](/ru/2014/07/17/writting-own-completions-p1 "Zsh completions paper"), 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 `pacman` completion files in my system.
|
||||
Bash, [unlike zsh](/ru/2014/07/17/writting-own-completions-p1 "Zsh completions
|
||||
paper"), 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
|
||||
`pacman` completion files in my system.
|
||||
|
||||
Lets consider the example of the same my application. I remind you that a part of help message is as follows:
|
||||
Lets consider the example of the same my application. I remind you that a part
|
||||
of help message is as follows:
|
||||
|
||||
```bash
|
||||
netctl-gui [ -h | --help ] [ -e ESSID | --essid ESSID ] [ -с FILE | --config FILE ]
|
||||
@ -36,7 +44,10 @@ Here is a flag list:
|
||||
|
||||
## <a href="#file" class="anchor" id="file"><span class="octicon octicon-link"></span></a>The file pattern
|
||||
|
||||
Here **all** 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 `_netctl_profiles()` should be generated each time:
|
||||
Here **all** 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
|
||||
`_netctl_profiles()` should be generated each time:
|
||||
|
||||
```bash
|
||||
# variables
|
||||
@ -46,14 +57,17 @@ _netctl_gui_tabs=()
|
||||
_netctl_profiles() {}
|
||||
```
|
||||
|
||||
Then there are main functions, which will be called for completion of specific application. In my case this there is only one applications, so there is only one function:
|
||||
Then there are main functions, which will be called for completion of specific
|
||||
application. In my case this there is only one applications, so there is only
|
||||
one function:
|
||||
|
||||
```bash
|
||||
# work block
|
||||
_netctl-gui() {}
|
||||
```
|
||||
|
||||
And finally again **without isolation in a separate function** we create a dependence "function-application":
|
||||
And finally again **without isolation in a separate function** we create a
|
||||
dependence "function-application":
|
||||
|
||||
```bash
|
||||
complete -F _netctl_gui netctl-gui
|
||||
@ -61,7 +75,8 @@ complete -F _netctl_gui netctl-gui
|
||||
|
||||
## <a href="#flags" class="anchor" id="flags"><span class="octicon octicon-link"></span></a>Flags
|
||||
|
||||
As it was said above there is no specific format, so all available flags declare by array:
|
||||
As it was said above there is no specific format, so all available flags declare
|
||||
by array:
|
||||
|
||||
```bash
|
||||
_netctl_gui_arglist=(
|
||||
@ -99,7 +114,13 @@ _netctl_profiles() {
|
||||
|
||||
## <a href="#body" class="anchor" id="body"><span class="octicon octicon-link"></span></a>Function
|
||||
|
||||
The variable `COMPREPLY` responds for completion in Bash. To keep track of the current state function `_get_comp_words_by_ref` must be called with parameters `cur` (current flag) and `prev` (previous flag, it is the state). Also some point for case are needed (variables `want*`). Function `compgen` is used for completion generation. A list of words is given after flag `-W`. (Also there is flag `-F` 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.
|
||||
The variable `COMPREPLY` responds for completion in Bash. To keep track of the
|
||||
current state function `_get_comp_words_by_ref` must be called with parameters
|
||||
`cur` (current flag) and `prev` (previous flag, it is the state). Also some
|
||||
point for case are needed (variables `want*`). Function `compgen` is used for
|
||||
completion generation. A list of words is given after flag `-W`. (Also there is
|
||||
flag `-F` 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.
|
||||
|
||||
So, here is our function:
|
||||
|
||||
@ -140,4 +161,7 @@ _netctl_gui() {
|
||||
|
||||
## <a href="#conclusion" class="anchor" id="conclusion"><span class="octicon octicon-link"></span></a>Conclusion
|
||||
|
||||
File should be places to `/usr/share/bash-completion/completions/` with any name. You may found the example [in my repository](//raw.githubusercontent.com/arcan1s/netctl-gui/master/sources/gui/bash-completions "File").
|
||||
File should be places to `/usr/share/bash-completion/completions/` with any
|
||||
name. You may found the example [in my
|
||||
repository](//raw.githubusercontent.com/arcan1s/netctl-gui/master/sources/gui/bash-completions
|
||||
"File").
|
||||
|
@ -7,7 +7,10 @@ tags: awesome-widgets, pytextmonitor
|
||||
title: Migration Awesome Widgets (ex-PyTextMonitor) to version 2.0
|
||||
short: migration-to-v2
|
||||
---
|
||||
<figure class="img"></figure>Some significant changes occur in the version 2.0 (really, I didn't do anything which can break your desktop!) and user API was rewritten. This paper should help to migrate from older PyTextMonitor versions (<1.11.0) to new one (>2.0).
|
||||
<figure class="img"></figure> Some
|
||||
significant changes occur in the version 2.0 (really, I didn't do anything
|
||||
which can break your desktop!) and user API was rewritten. This paper should
|
||||
help to migrate from older PyTextMonitor versions (<1.11.0) to new one (>2.0).
|
||||
|
||||
<!--more-->
|
||||
|
||||
@ -15,18 +18,27 @@ short: migration-to-v2
|
||||
|
||||
Firstly, a series of new features, including:
|
||||
|
||||
* New widget - **Desktop panel**. It shows desktop list and select the active one. It can switch to the selected desktop by mouse clicking. Also it may set selected panels hidden.
|
||||
* New tags - `hddfreemb`, `hddfreegb`, `memusedmb`, `memusedgb`, `memfreemb`, `memfreegb`, `swapfreemb`, `swapfreegb`. And there are new tags related to new features - `desktop`, `ndesktop`, `tdesktops`.
|
||||
* New graphical tooltip - battery. It is twin colour (the colour depends on AC status).
|
||||
* New widget - **Desktop panel**. It shows desktop list and select the active
|
||||
one. It can switch to the selected desktop by mouse clicking. Also it may set
|
||||
selected panels hidden.
|
||||
* New tags - `hddfreemb`, `hddfreegb`, `memusedmb`, `memusedgb`, `memfreemb`,
|
||||
`memfreegb`, `swapfreemb`, `swapfreegb`. And there are new tags related to new
|
||||
features - `desktop`, `ndesktop`, `tdesktops`.
|
||||
* New graphical tooltip - battery. It is twin colour (the colour depends on AC
|
||||
status).
|
||||
|
||||
## <a href="#changes" class="anchor" id="changes"><span class="octicon octicon-link"></span></a>Significant changes
|
||||
|
||||
Secondly, there are some changes because of which the old settings **will not** more work. They are:
|
||||
Secondly, there are some changes because of which the old settings **will not**
|
||||
more work. They are:
|
||||
|
||||
* The main widget was rewritten to `С++`, so the project was renamed to **Awesome Widgets**, and the main widget was done to **Awesome Widget**
|
||||
* The main widget was rewritten to `С++`, so the project was renamed to
|
||||
**Awesome Widgets**, and the main widget was done to **Awesome Widget**
|
||||
* Configuration of battery and AC files **was moved to DataEngine**.
|
||||
* **The labels was removed**. Now the widget is a single label. You may set up text in the special browser.
|
||||
* According to removal of the label, tooltip **should be configured separately**.
|
||||
* **The labels was removed**. Now the widget is a single label. You may set up
|
||||
text in the special browser.
|
||||
* According to removal of the label, tooltip **should be configured
|
||||
separately**.
|
||||
* Align of text now can be configured only by using HTML tags.
|
||||
* According to fields combining several tags were renamed:
|
||||
* `custom` (time) -> `ctime`
|
||||
|
@ -7,7 +7,9 @@ tags: linux, systemd, ecryptfs
|
||||
title: How to encrypt home directory. For dummies
|
||||
short: ecnryption-home-directory
|
||||
---
|
||||
<figure class="img"></figure>This paper is about encryption home directory using ecryptfs and automount settins using systemd and key on flash card.
|
||||
<figure class="img"></figure>This
|
||||
paper is about encryption home directory using ecryptfs and automount settins
|
||||
using systemd and key on flash card.
|
||||
|
||||
<!--more-->
|
||||
|
||||
@ -26,7 +28,9 @@ short: ecnryption-home-directory
|
||||
|
||||
## <a href="#step1" class="anchor" id="step1"><span class="octicon octicon-link"></span></a>Step 1: Encryption
|
||||
|
||||
The widespread solution in the Internet is to use automatic utilities to do it. However in our case they are not suitable, since we need to import key / password signature, which is not possible in this case.
|
||||
The widespread solution in the Internet is to use automatic utilities to do it.
|
||||
However in our case they are not suitable, since we need to import key /
|
||||
password signature, which is not possible in this case.
|
||||
|
||||
The encryption can be done by the following command (lol):
|
||||
|
||||
@ -34,8 +38,10 @@ The encryption can be done by the following command (lol):
|
||||
mount -t ecryptfs /home/$USER /home/$USER
|
||||
```
|
||||
|
||||
While process it asks some question (I suggest to do first mounting in the interactive mode). The answers may be like following (see the comments),
|
||||
please note that if you change something, it will be changed in some lines below too:
|
||||
While process it asks some question (I suggest to do first mounting in the
|
||||
interactive mode). The answers may be like following (see the comments),
|
||||
please note that if you change something, it will be changed in some lines below
|
||||
too:
|
||||
|
||||
```bash
|
||||
# key or certificate. The second one is more reliable while you don't lose it %)
|
||||
@ -94,25 +100,31 @@ cp -a /home/$USER-org/. /home/$USER
|
||||
|
||||
## <a href="#step2" class="anchor" id="step2"><span class="octicon octicon-link"></span></a>Step 2: systemd automounting
|
||||
|
||||
Create file on flash card (I've used microSD) with the following text (you should insert your password):
|
||||
Create file on flash card (I've used microSD) with the following text (you
|
||||
should insert your password):
|
||||
|
||||
```bash
|
||||
passphrase_passwd=someverystronguniqpassword
|
||||
```
|
||||
|
||||
Add card automount (mount point is `/mnt/key`) to `fstab` with option `ro`, for example:
|
||||
Add card automount (mount point is `/mnt/key`) to `fstab` with option `ro`, for
|
||||
example:
|
||||
|
||||
```bash
|
||||
UUID=dc3ecb41-bc40-400a-b6bf-65c5beeb01d7 /mnt/key ext2 ro,defaults 0 0
|
||||
UUID=dc3ecb41-bc40-400a-b6bf-65c5beeb01d7 /mnt/key ext2 ro,defaults 0 0
|
||||
```
|
||||
|
||||
Let's configure home directory mounting. The mount options can be found in the following output:
|
||||
Let's configure home directory mounting. The mount options can be found in the
|
||||
following output:
|
||||
|
||||
```bash
|
||||
mount | grep ecryptfs
|
||||
```
|
||||
|
||||
I should note that there are not all options there, you need add `key`, `no_sig_cache`, `ecryptfs_passthrough` too. Thus systemd mount-unit should be like the following (if you are systemd-hater you can write the own daemon, because it doesn't work over `fstab` without modification (see below)).
|
||||
I should note that there are not all options there, you need add `key`,
|
||||
`no_sig_cache`, `ecryptfs_passthrough` too. Thus systemd mount-unit should be
|
||||
like the following (if you are systemd-hater you can write the own daemon,
|
||||
because it doesn't work over `fstab` without modification (see below)).
|
||||
|
||||
```bash
|
||||
# cat /etc/systemd/system/home-$USER.mount
|
||||
@ -130,7 +142,9 @@ Options=rw,nosuid,nodev,relatime,key=passphrase:passphrase_passwd_file=/mnt/key/
|
||||
WantedBy=local-fs.target
|
||||
```
|
||||
|
||||
`XXXXX` should be replaced to signature from options with which directory are currently mounting. Also you need to insert user name and edit path to file with password (and unit name) if it is needed. Autoload:
|
||||
`XXXXX` should be replaced to signature from options with which directory are
|
||||
currently mounting. Also you need to insert user name and edit path to file with
|
||||
password (and unit name) if it is needed. Autoload:
|
||||
|
||||
```bash
|
||||
systemctl enable home-$USER.mount
|
||||
@ -159,17 +173,22 @@ Enable:
|
||||
systemctl enable umount-key.service
|
||||
```
|
||||
|
||||
Reboot. Remove backups if all is ok. If not then you did a mistake, resurrect system from emergency mode.
|
||||
Reboot. Remove backups if all is ok. If not then you did a mistake, resurrect
|
||||
system from emergency mode.
|
||||
|
||||
## <a href="#whynotfstab" class="anchor" id="whynotfstab"><span class="octicon octicon-link"></span></a>Why not fstab?
|
||||
|
||||
In my case I could not to make flash mounting before home decryption. Thus I saw emergency mode on load in which I should just continue loading. There are two solutions in the Internet:
|
||||
In my case I could not to make flash mounting before home decryption. Thus I saw
|
||||
emergency mode on load in which I should just continue loading. There are two
|
||||
solutions in the Internet:
|
||||
|
||||
* Create entry with noauto option and then mount using the special command in `rc.local`.
|
||||
* Create entry with noauto option and then mount using the special command in
|
||||
`rc.local`.
|
||||
* Create entry with nofail option and then remount all partitions in `rc.local`.
|
||||
|
||||
In my opinion both of them are workarounds too much.
|
||||
|
||||
## <a href="#whynotpam" class="anchor" id="whynotpam"><span class="octicon octicon-link"></span></a>Why not pam?
|
||||
|
||||
Other solution is to mount using pam entry. In my case I have authentication without password on fingerprint so it doesn't work for me.
|
||||
Other solution is to mount using pam entry. In my case I have authentication
|
||||
without password on fingerprint so it doesn't work for me.
|
||||
|
@ -7,17 +7,25 @@ tags: awesome-widgets, pytextmonitor
|
||||
title: Awesome Widgets - bells and whistles
|
||||
short: aw-v21-bells-and-whistles
|
||||
---
|
||||
The paper deals with settings of a custom scripts and graphical bars in the new version of Awesome Widgets (2.1).
|
||||
The paper deals with settings of a custom scripts and graphical bars in the new
|
||||
version of Awesome Widgets (2.1).
|
||||
|
||||
<!--more-->
|
||||
|
||||
## <a href="#intro" class="anchor" id="intro"><span class="octicon octicon-link"></span></a>Introduction
|
||||
|
||||
For a start it is highly recommended copy file `$HOME/.kde4/share/config/extsysmon.conf` after widget update before you open widget settings, because old and new script settings are incompatible. Also I should note that these features can be configured from graphical interface, but I will describe how it can be done by simply editing the desktop file.
|
||||
For a start it is highly recommended copy file `$HOME/.kde4/share/config/extsysmon.conf`
|
||||
after widget update before you open widget settings, because old and new script
|
||||
settings are incompatible. Also I should note that these features can be
|
||||
configured from graphical interface, but I will describe how it can be done by
|
||||
simply editing the desktop file.
|
||||
|
||||
## <a href="#general" class="anchor" id="general"><span class="octicon octicon-link"></span></a>General
|
||||
|
||||
Items are stored in the two directories: `/usr/share/awesomewidgets/%TYPE%/` and `$HOME/.local/share/awesomewidgets/%TYPE%/` (path may be differ in depend from your distro). Settings in the home directory have a higher priority that global ones.
|
||||
Items are stored in the two directories: `/usr/share/awesomewidgets/%TYPE%/` and
|
||||
`$HOME/.local/share/awesomewidgets/%TYPE%/` (path may be differ in depend from
|
||||
your distro). Settings in the home directory have a higher priority that global
|
||||
ones.
|
||||
|
||||
## <a href="#bars" class="anchor" id="bars"><span class="octicon octicon-link"></span></a>Bars
|
||||
|
||||
@ -82,7 +90,9 @@ Directory is `upgrade`, configuration files have the following fields:
|
||||
|
||||
## <a href="#weather" class="anchor" id="weather"><span class="octicon octicon-link"></span></a>Weather
|
||||
|
||||
The weather uses data and API from [OpenWeatherMap](//openweathermap.org/ "OpenWeatherMap site"). Directory is `weather`, configuration files have the following fields:
|
||||
The weather uses data and API from [OpenWeatherMap](//openweathermap.org/
|
||||
"OpenWeatherMap site"). Directory is `weather`, configuration files have the
|
||||
following fields:
|
||||
|
||||
| Field | Required | Value | Default |
|
||||
|-------|----------|-------|---------|
|
||||
|
@ -7,7 +7,8 @@ tags: development, c++, cmake
|
||||
title: Add cppcheck and clang-format for a cmake project
|
||||
short: cppcheck-and-clang-format
|
||||
---
|
||||
A small How-To which describes how to add automatic code style checking and static analyser to a project on `C++` which uses `cmake` as a build system.
|
||||
A small How-To which describes how to add automatic code style checking and
|
||||
static analyser to a project on `C++` which uses `cmake` as a build system.
|
||||
|
||||
<!--more-->
|
||||
|
||||
@ -23,27 +24,45 @@ sources/
|
||||
|- second_component/
|
||||
```
|
||||
|
||||
**3rdparty** is a directory which contains additional libraries and which should be excluded from checking (`PROJECT_TRDPARTY_DIR` cmake variable is used to indicate path to this directory). Also let's assume that we have additional files (e.g. `*.qml`) in addition to common source files (`*.cpp`, `*.h`).
|
||||
**3rdparty** is a directory which contains additional libraries and which should
|
||||
be excluded from checking (`PROJECT_TRDPARTY_DIR` cmake variable is used to
|
||||
indicate path to this directory). Also let's assume that we have additional
|
||||
files (e.g. `*.qml`) in addition to common source files (`*.cpp`, `*.h`).
|
||||
|
||||
In addition the described below commands may be inserted to pre-commit hook; it allows us to troll colleagues which will be able to commit nothing till they read `CONTRIBUTING.md`.
|
||||
In addition the described below commands may be inserted to pre-commit hook; it
|
||||
allows us to troll colleagues which will be able to commit nothing till they
|
||||
read `CONTRIBUTING.md`.
|
||||
|
||||
## <a href="#cppcheck" class="anchor" id="cppcheck"><span class="octicon octicon-link"></span></a>cppcheck
|
||||
|
||||
As far as there are no good (out-of-box) static analysers in open source we will use it. Knowledgeable people say that [cppcheck](//cppcheck.sourceforge.net/ "cppcheck site") in case of good configuration it is better than the any alternative, but its configuration is the same that the new project creation. `cppcheck` shows obvious errors and recommend to fix them.
|
||||
As far as there are no good (out-of-box) static analysers in open source we will
|
||||
use it. Knowledgeable people say that [cppcheck](//cppcheck.sourceforge.net/
|
||||
"cppcheck site") in case of good configuration it is better than the any
|
||||
alternative, but its configuration is the same that the new project creation.
|
||||
`cppcheck` shows obvious errors and recommend to fix them.
|
||||
|
||||
### <a href="#cppcheck-run" class="anchor" id="cppcheck-run"><span class="octicon octicon-link"></span></a>Example of run
|
||||
|
||||
Here it is:
|
||||
|
||||
```bash
|
||||
cppcheck --enable=warning,performance,portability,information,missingInclude --std=c++11 --library=qt.cfg --template="[{severity}][{id}] {message} {callstack} (On {file}:{line})" --verbose --quiet path/to/source/files/or/directory
|
||||
cppcheck --enable=warning,performance,portability,information,missingInclude
|
||||
--std=c++11 --library=qt.cfg --template="[{severity}][{id}] {message}
|
||||
{callstack} (On {file}:{line})" --verbose --quiet
|
||||
path/to/source/files/or/directory
|
||||
```
|
||||
|
||||
* `--enable` says which notifications should be enabled. I've disabled `style` (we will use `clang-format` to do it), `unusedFunction` which shows false-positive for some methods.
|
||||
* `--enable` says which notifications should be enabled. I've disabled `style`
|
||||
(we will use `clang-format` to do it), `unusedFunction` which shows
|
||||
false-positive for some methods.
|
||||
* `--std` says which standard should be used.
|
||||
* `--library=qt.cfg` a configuration file, which describes how to check files. The developers recommend to read the following [manual](//cppcheck.sourceforge.net/manual.pdf "cppcheck manual"). I've used the ready template from `/usr/share/cppcheck/cfg/`.
|
||||
* `--library=qt.cfg` a configuration file, which describes how to check files.
|
||||
The developers recommend to read the following
|
||||
[manual](//cppcheck.sourceforge.net/manual.pdf "cppcheck manual"). I've used the
|
||||
ready template from `/usr/share/cppcheck/cfg/`.
|
||||
* `--template` is notification template.
|
||||
* `---verbose --quiet` are two "conflicting" options. The first one enables more verbose messages, the second one disables progress reports.
|
||||
* `---verbose --quiet` are two "conflicting" options. The first one enables more
|
||||
verbose messages, the second one disables progress reports.
|
||||
|
||||
### <a href="#cppcheck-cmake" class="anchor" id="cppcheck-cmake"><span class="octicon octicon-link"></span></a>cmake integration
|
||||
|
||||
@ -75,7 +94,10 @@ add_custom_target(
|
||||
)
|
||||
```
|
||||
|
||||
`cppcheck` may work with directories recursive, but I need to skip qml-files checking in my example, because this `cppcheck` will segfault on some of them. To do it source files search is used followed by the ejection of unnecessary files.
|
||||
`cppcheck` may work with directories recursive, but I need to skip qml-files
|
||||
checking in my example, because this `cppcheck` will segfault on some of them.
|
||||
To do it source files search is used followed by the ejection of unnecessary
|
||||
files.
|
||||
|
||||
Include to the project (`CMakeLists.txt`)...
|
||||
|
||||
@ -95,11 +117,16 @@ Then edit files to avoid warnings in the future.
|
||||
### <a href="#cppcheck-adds" class="anchor" id="cppcheck-adds"><span class="octicon octicon-link"></span></a>Adds
|
||||
|
||||
* You may add own directories to includes search, using `-I dir` option
|
||||
* You may drop files and/or directories from checking by using `-i path/to/file/or/directory` option.
|
||||
* You may drop files and/or directories from checking by using `-i
|
||||
path/to/file/or/directory` option.
|
||||
|
||||
## <a href="#clang" class="anchor" id="clang"><span class="octicon octicon-link"></span></a>clang-format
|
||||
|
||||
[clang-format](//clang.llvm.org/docs/ClangFormat.html "clang-format site") is used to automatic code style checking and correction. [astyle](//astyle.sourceforge.net/ "astyle site"), which has a very modest capabilities, and [uncrustify](//uncrustify.sourceforge.net/ "uncrustify site"), which on the contrary has too many options, should be mentioned from analogues.
|
||||
[clang-format](//clang.llvm.org/docs/ClangFormat.html "clang-format site") is
|
||||
used to automatic code style checking and correction.
|
||||
[astyle](//astyle.sourceforge.net/ "astyle site"), which has a very modest
|
||||
capabilities, and [uncrustify](//uncrustify.sourceforge.net/ "uncrustify site"),
|
||||
which on the contrary has too many options, should be mentioned from analogues.
|
||||
|
||||
### <a href="#clang-run" class="anchor" id="clang-run"><span class="octicon octicon-link"></span></a>Example of run
|
||||
|
||||
@ -109,7 +136,8 @@ clang-format -i -style=LLVM /path/to/source/files
|
||||
|
||||
(Unfortunately it **could not** work with directories recursive.)
|
||||
|
||||
* `-i` enables files auto replace (otherwise the result will be printed to stdout).
|
||||
* `-i` enables files auto replace (otherwise the result will be printed to
|
||||
stdout).
|
||||
* `-style` is a style preset selection or from file (`file`), see below.
|
||||
|
||||
### <a href="#clang-cmake" class="anchor" id="clang-cmake"><span class="octicon octicon-link"></span></a>cmake integration
|
||||
@ -137,7 +165,8 @@ add_custom_target(
|
||||
)
|
||||
```
|
||||
|
||||
There is the same method to get source files list as for `cppcheck`, because `clang-format` doesn't support recursive directory search.
|
||||
There is the same method to get source files list as for `cppcheck`, because
|
||||
`clang-format` doesn't support recursive directory search.
|
||||
|
||||
Include to the project (`CMakeLists.txt`)...
|
||||
|
||||
@ -156,10 +185,16 @@ No other actions required.
|
||||
|
||||
### <a href="#clang-adds" class="anchor" id="clang-adds"><span class="octicon octicon-link"></span></a>Adds
|
||||
|
||||
* Configuration. You may see all options on the [official site](//clang.llvm.org/docs/ClangFormat.html "clang-format site"). Also you may use [interactive tool](//clangformat.com/ "Site") to search for required options. To use the preset for your style use the following command:
|
||||
* Configuration. You may see all options on the [official
|
||||
site](//clang.llvm.org/docs/ClangFormat.html "clang-format site"). Also you may
|
||||
use [interactive tool](//clangformat.com/ "Site") to search for required
|
||||
options. To use the preset for your style use the following command:
|
||||
|
||||
```bash
|
||||
clang-format -style=LLVM -dump-config > .clang-format
|
||||
```
|
||||
|
||||
Then edit generated file `.clang-format`. To enable it you need set `-style=file` option, file should be placed to the any parent directory of each source file (e.g., to the project root). Also you may send required options to the command line directly, e.g. `-style="{BasedOnStyle: llvm, IndentWidth: 8}"`
|
||||
Then edit generated file `.clang-format`. To enable it you need set
|
||||
`-style=file` option, file should be placed to the any parent directory of each
|
||||
source file (e.g., to the project root). Also you may send required options to
|
||||
the command line directly, e.g. `-style="{BasedOnStyle: llvm, IndentWidth: 8}"`
|
||||
|
@ -7,5 +7,8 @@ tags: site
|
||||
title: URL changes
|
||||
short: url-changes
|
||||
---
|
||||
|
||||
I would like to inform you that I've changed site and repository URL from [arcanis.name](//arcanis.name) to [arcanis.me](//arcanis.me). It was done just because ME domain is more pretty. The old URLs will be still valid till Mar 2016 (date of the domain name registration), but at the moment I've setup URL redirection to the new URL. Sorry for any inconvenience.
|
||||
I would like to inform you that I've changed site and repository URL from
|
||||
[arcanis.name](//arcanis.name) to [arcanis.me](//arcanis.me). It was done just
|
||||
because ME domain is more pretty. The old URLs will be still valid till Mar 2016
|
||||
(date of the domain name registration), but at the moment I've setup URL
|
||||
redirection to the new URL. Sorry for any inconvenience.
|
||||
|
Reference in New Issue
Block a user