Configuring Your Desktop in Calculate Linux 11.9

Added by Elena GAVRILOVA about 7 years ago

language Russian

Our brand-new Calculate Linux 11.9 provides a new method of configuring user profiles. In this article, I will try to describe the procedure for Calculate Linux Desktop, focusing on the main operations.

Calculate Utilities

Calculate Utilities were written in Python. They operate throughout the installation and, which is even more important, the system configuration. To set up user profiles, the calculate-desktop package is used. Unlike other utilities, it lets you configure system files as well as user files (within the home directory). As simple as this:

cl-desktop alex
* alex's user account configured...

The setup is performed with the Calculate Utilities templates; we will see them a bit later.

Utility variables

Calculate Utilities have their own sets of variables. Calculate-desktop, for instance, includes variables used for user login/logout. To view these variables, execute cl-desktop -v user_name. Here is my example:

cl-desktop -v alex
...
os_linux_name [r] Calculate Linux Desktop
os_linux_shortname [r] CLD
os_linux_subname [r] KDE
os_linux_ver [r] 11.9
os_locale_lang [r] ru_RU
os_locale_language [r] ru
os_locale_xkb [r] us,ru(winkeys)
os_locale_xkbname [r] us,ru
os_net_hostname [w] calculate
os_root_type [r] hdd
os_x11_composite [r] on
os_x11_height [w] 1050
os_x11_standart [r] 1680x1050
os_x11_video_drv [r] nvidia
os_x11_width [w] 1680
ur_fullname [r] Alexander Tratsevskiy
ur_group [r] family
ur_home_path [r] /home/alex
ur_jid [r] 
ur_login [r] alex
ur_mail [r] 
...

Variable names must include type and destination. The said variables are very important for configuring a system: their values can be inserted in configuration files or used in conditionals.

Calculate templates

Several years before, when we were building a new engine, Calculate Next, for our site, we also wrote some methods to convert layout files to XML and vice versa. Even though we did not build the site engine after all, much of this experience was beneficial for other projects - namely, for creating Calculate Utilities 2.

In most cases, it will be enough to reset some parameters in the configuration file for a service or an application to work as you want them to. Our templates are based on this simple approach; they recognize nearly all popular configuration format, such as apache, bind, compiz, dhcp, dovecot, kde, ldap, openrc, plasma, postfix, procmail, proftpd, samba, squid, xml_gconf, xml_gconf_tree, xml_xfce and xml_xfcepanel. For other formats, you may use the raw format for text files, the bin format for binary files and the patch format for patch files.

Templates are not just configs that can be appended to the system files. They can contain conditionals, functions and, of course, variables. During the joining procedure, the template and the configuration file are converted to the XML format, then merged and after that, XML is converted back to the specified format of the configuration file and copied onto the system.

Example 1. Configuring trusted applications for kwallet (excerpt from kwallertc):

Calculate format=kde path=~/.kde4/share/config

Applications that access is allowed
[Auto Allow]
?os_locale_lang==en_US#
kdewallet=Kopete,KMail,Konqueror,Chromium,Chrome,Network Management,Akonadi Resource,KDE Daemon
os_locale_lang#
?os_locale_lang==ru_RU#
kdewallet=Kopete,KMail,Konqueror,Chromium,Chrome,Network Management,Источник данных Akonadi,Служба KDE
os_locale_lang#
...

For some time, KDE applications have been using localization. To avoid superfluity of locales, the language settings are checked and configured according to the system language.

Example 2. Creating a link to the browser icon that will be shown by default on the bottom panel in XFCE (excerpt from browser.desktop):

 
Calculate exists(/usr/share/applications/calculate-browser.desktop)!= link=/usr/share/applications/calculate-browser.desktop name=10000000030.desktop symbolic force

In the example above, a symlink pointing to the calculate-browser.desktop file is created under the name 10000000030.desktop; the system verifies if this file exists already. If such is the case, the file will be overwriten.

Paths for storing templates

While paths of Calculate Utilities would be of little interest to you, the templates' locations are of paramount importance, since you create your own templates based on these prototypes. For your convenience, all Calculate 2.2 templates are included in one and single package, calculate-templates. At install, the package contents is deployed in the directory /usr/share/calculate/templates. That is where you can find user profile settings. Directory names in templates are not fixed: they are defined in the .calculate_directory file in each respective directory. General rules for templates apply to the directory. Templates used by calculate-desktop are located in /usr/share/calculate/templates/desktop. The .calculate_directory file, which defines this directory, stores the header of the desktop directory template:

Calculate append=skip cl_name==calculate-desktop&&cl_ver>=2.2.1

Templates belonging to the package are explicitly stated, the version of the utilities is checked. User-defined application settings will be stored in the directory /usr/share/calculate/templates/desktop/desktop. For instance, the directory 60-mc-4.7 will contain configuration templates for Midnight Commander.

Configuration events

Calculate Linux uses Portage for managing packages. Portage is a very flexible tool which permits easy handling of third-party projects. By using the profile.bashrc script, Calculate Utilities are integrated with the emerge package manager via the system profile. System configuration with Calculate Utilities will be thus called whenever you install a package. Calculate-desktop looks for templates of the package that is being installed and, if needed, performs the setup. If the settings are not limited by the user profile, the package can modify system files, and Portage will accept them. Paths to the new files and to the files that have been modified, with their hashes, will remain in the local package database.

Apart from installing packages, many other events will be accompanied by software configuration. For instance, when a user logs in via KDM/GDM, if the user has no directory, it will be created and configured. This and other relevant events are described in specific variables, which are used to build conditionals in templates.

Package data

Templates intended for user profile configuration use the standard method of Calculate Utilities and store their settings in ~/.calculate/ini.env. This samba-like file includes 4 primary sections: «main» for main settings, «ver» for software versions, «update» for the flag that disables updating, for each program, and «resource» for the paths to standard user directories. In addition, you can have as many sections as you need; we in Calculate Ltd. use the «office» section to account for some settings that are important to us. When a domain user logs in, their profile is configured with templates. Such configuration is usually required when software is updated or if you want to record some application settings.

ini.env lets you enable or disable updates of one or several applications. You could, for instance, return to the initial program configuration.

Templates in Calculate Linux 11.9: What's new

In most cases, configuring the user profile at login was unnecessary. In Calculate Linux 11.9, we are finally making a clean difference between local users and domain users. While formerly, Calculate Utilities could modify the profiles of the logged in users only, for configuring software before the first start, now all local profiles are configured. Thanks to it, there is no more update before the system starts and logging in is up 5 seconds faster. Should there be any changes, the modified files will be printed when the package is being installed.

You will encounter no more difficulties either when installing from a new ISO image. At the first login, the update utilities will be launched. For instance, if you want to upgrate from KDE 4.6 to 4.7, only one configuration file, nepomukserverrc, will be modified by the template /usr/share/calculate/templates/desktop/desktop/20-kde-4.6-4.7/.kde4/share/config/nepomukserverrc, which contains the following:

Calculate format=kde

[Basic Settings]
Start Nepomuk=true

Before KDE 4.7, though, nobody seemed concerned if Nepomuk daemon was absent...

How we are different

Calculate Linux compared to other distributions

See how distributions compare in handling user profile configuration:
Ubuntu:
uses pre-configured system files; it may use Skel.
Sabayon:
uses the /etc/skel directory, which contains all settings, including configurations of packages that are not installed.
Calculate:
Calculate Utilities templates are used.

Pros and cons

  • pro: More flexibility in setup, in contrast to using /etc/skel, limited with static settings which do not allow you to configure the user login, the screen resolution, hardware-related features, etc.
  • pro: Configuring is done only for the programs installed on the system; if needed, settings can be deleted.
  • pro: Users can create their own templates, thus configuring applications to their liking.
  • pro: You can always revert the changes and use the original configuration.
  • pro: Smooth migration between software versions is supported.
  • con: We recommend to update utility templates before software update.

Calculate Utilities Templates
Template Variables
Storing User Profile Settings

Originally written by Alexander Tratsevskiy for Habrahabr, http://habrahabr.ru/blogs/linux/129658/


Comments

Comment

Added by jane song over 6 years ago

<strong><a href="http://www.hermes-birkinhandbags.com/hermes-birkin-c-20.html">Hermes Birkin Handbags</a></strong><br>
<strong><a href="http://www.hermes-birkinhandbags.com">Hermes Replica Handbags</a></strong><br>
<strong><a href="http://www.hermes-birkinhandbags.com">Replica Hermes Handbags</a></strong><br>
<strong><a href="http://www.hermes-birkinhandbags.com/hermes-birkin-c-20.html">Hermes Birkin Replica</a></strong><br>
<strong><a href="http://www.hermes-birkinhandbags.com">Hermes Bag Replica</a></strong><br>
<strong><a href="http://www.hermes-birkinhandbags.com/hermes-kelly-c-26.html">Hermes Kelly Handbag</a></strong>

Comment

Added by jane song over 6 years ago

<strong><a href="http://www.chanel-j12watch.com">Chanel Watch</a></strong><br>
<strong><a href="http://www.chanel-j12watch.com">Chanel J12</a></strong><br>
<strong><a href="http://www.chanel-j12watch.com">Chanel J12 Watch</a></strong><br>
<strong><a href="http://www.chanel-j12watch.com">Replica Chanel Watches</a></strong><br>
<strong><a href="http://www.chanel-j12watch.com">Chanel Ceramic Watch</a></strong><br>
<strong><a href="http://www.chanel-j12watch.com">Chanel Replica Watches</a></strong><br>
<strong><a href="http://www.chanel-j12watch.com">Chanel J12 Replica</a></strong><br>
<strong><a href="http://www.chanel-j12watch.com">Replica Chanel Watch</a></strong>

Thank you!