https://wiki.archlinux.org/api.php?action=feedcontributions&user=Ollbap&feedformat=atomArchWiki - User contributions [en]2024-03-29T13:14:00ZUser contributionsMediaWiki 1.41.0https://wiki.archlinux.org/index.php?title=KDE&diff=255580KDE2013-04-28T17:28:14Z<p>Ollbap: /* How to enable Cpufreq based power saving */</p>
<hr />
<div>[[Category:Desktop environments]]<br />
[[cs:KDE]]<br />
[[de:KDE]]<br />
[[es:KDE]]<br />
[[fr:KDE]]<br />
[[it:KDE]]<br />
[[ja:KDE]]<br />
[[pl:KDE]]<br />
[[ru:KDE]]<br />
[[tr:KDE_Masaüstü_Ortamı]]<br />
[[zh-CN:KDE]]<br />
[[zh-TW:KDE]]<br />
{{Article summary start}}<br />
{{Article summary text|For users on Linux and Unix, KDE offers a full suite of user workspace applications which allow interaction with these operating systems in a modern, graphical user interface. This article covers its installation, configuration, and troubleshooting.}}<br />
{{Article summary text|KDE uses the [[Qt]] toolkit.}}<br />
{{Article summary heading|Overview}}<br />
{{Article summary text|{{Graphical user interface overview}}}}<br />
{{Article summary heading|Related}}<br />
{{Article summary wiki|Plasma}}<br />
{{Article summary wiki|Qt}}<br />
{{Article summary wiki|KDM}}<br />
{{Article summary wiki|KDevelop 4}}<br />
{{Article summary wiki|Uniform Look for Qt and GTK Applications}}<br />
{{Article summary end}}<br />
<br />
From [http://www.kde.org/community/whatiskde/softwarecompilation.php KDE - KDE Software Compilation]:<br />
<br />
:''The KDE Software Compilation grew out of the history of the KDE Project. In its inception, KDE was formed to create a beautiful, functional and free desktop computing environment for Linux and similar operating systems. At the time, these systems lacked a graphical user environment that could rival the offerings from the larger proprietary operating system vendors. KDE was created to fill this gap.''<br />
<br />
:''The KDE Software Compilation is the set of libraries, workspaces, and applications produced by KDE that share this common heritage, and continue to use the synchronized release cycle. Software may move in and out of this semi-formally defined collection depending on the particular needs of the contributors who are working on that software, with exceptions made to ensure that binary compatibility remains at the library level throughout any major release of the compilation.''<br />
<br />
From [http://www.kde.org/download/ KDE - Getting KDE Software]:<br />
<br />
:''KDE software consists of a large number of individual applications and a desktop workspace as a shell to run these applications. You can run KDE applications just fine on any desktop environment. KDE applications are built to integrate well with your system's components. By using also KDE workspace, you get even better integration of your applications with the working environment while lowering system resource needs.''<br />
<br />
The KDE upstream has a well maintained [http://userbase.kde.org/ UserBase wiki]. Users can get detailed information about most KDE applications there.<br />
<br />
==Overview==<br />
'''KDE 4.10''' Software Compilation is the current major [[http://kde.org/announcements/ release of KDE]. Important hints for upgraders:<br />
* Always check if your mirror is '''up to date'''.<br />
* '''Do not force an update using pacman --force'''. If pacman complains about conflicts please '''file a bug report'''.<br />
* You can remove the meta packages and the sub packages you do not need after the update.<br />
* If you do not like split packages just keep using the kde-meta packages.<br />
<br />
==Installation==<br />
KDE 4.x is '''modular'''. You can install an entire set of packages or only install your preferred KDE applications.<br />
<br />
{{Note|If you do not have [[Xorg#Installation|Xorg]] installed on your system, be sure to install it before KDE.}}<br />
<br />
=== Full install ===<br />
[[pacman|Install]] {{Grp|kde}} or {{Grp|kde-meta}} available in the [[official repositories]]. For differences between {{Grp|kde}} and {{Grp|kde-meta}} see the [[KDE Packages]] article.<br />
<br />
=== Minimal install ===<br />
If you want to have a minimal installation of the KDE SC, install:<br />
* {{Grp|kdebase}}<br />
* {{Pkg|phonon-vlc}} or {{Pkg|phonon-gstreamer}} as phonon backend<br />
* A {{ic|ttf-*}} font package such as {{Pkg|ttf-dejavu}}. For more information see {{Bug|26012}}.<br />
<br />
=== Language pack ===<br />
If you need language files, install {{ic|kde-l10n-yourlanguagehere}} (e.g. {{Pkg|kde-l10n-de}} for the German language).<br />
<br />
For a full list of available languages see [https://www.archlinux.org/packages/extra/any/kde-l10n/ this link].<br />
<br />
==Starting KDE==<br />
<br />
Starting KDE depends on your preferences. Basically there are two ways of starting KDE. Using '''KDM''' or '''xinitrc'''.<br />
<br />
=== Using KDM (KDE Display Manager)===<br />
<br />
''It is highly recommended to get familiar with the [[Display Manager|full article]] concerning display managers, before you make any changes. See also [[KDM]] Wiki page.''<br />
<br />
[[Daemons|Enable/start]] {{ic|kdm.service}}.<br />
<br />
===Using xinitrc===<br />
''The meaning and usage of '''xinitrc''' is very well described [[Xinitrc|here]].<br />
<br />
{{pkg|kdebase-workspace}} provides startkde. Make sure it is installed. Then edit {{ic|~/.xinitrc}}, uncomment:<br />
exec startkde<br />
<br />
After a reboot and/or log-in, each execution of Xorg ('''startx''' or '''xinit''') will start KDE automatically.<br />
<br />
{{Note| If you want to start Xorg at boot, please read [[Start X at Login]] article.}}<br />
<br />
==Configuration==<br />
{{Note| Configuring KDE is primarily done in ''''System Settings''''. There are also a few other options available for the desktop with ''''Default Desktop Settings'''' when you right click the desktop.}}<br />
<br />
For other personalization options not covered below such as activities, different wallpapers on one cube, etc please refer to the [[Plasma]] wiki page.<br />
<br />
===Personalization===<br />
How to set up the KDE desktop to your personal style; use different Plasma themes, window decorations and icon themes. <br />
<br />
====Plasma Desktop====<br />
[[Plasma]] is a desktop integration technology that provides many functions from displaying the wallpaper, adding widgets to the desktop, and handling the panels or "taskbar".<br />
<br />
=====Themes=====<br />
[http://kde-look.org/index.php?xcontentmode=76 Plasma themes] can be installed through the Desktop Settings control panel. Plasma themes define how your panels and plasmoids look like. If you like to have them installed system-wide, themes can be found in both the official repositories and [https://aur.archlinux.org/packages.php?O=0&K=plasmatheme&do_Search=Go AUR].<br />
<br />
=====Widgets=====<br />
Plasmoids are little scripted or coded KDE apps that enhance the functionality of your desktop. There are two kinds, plasmoid scripts and plasmoid binaries.<br />
<br />
Plasmoid binaries must be installed using PKGBUILDS from [https://aur.archlinux.org/packages.php?O=0&K=plasmoid&do_Search=Go&PP=25&SO=d&SB=v AUR]. Or write your own PKGBUILD.<br />
<br />
The easiest way to install plasmoid scripts is by right-clicking onto a panel or the desktop:<br />
<br />
Add Widgets -> Get new Widgets -> Download Widgets<br />
<br />
This will present a nice frontend for [http://www.kde-look.org/ kde-look.org] and allows you to (un)install or update third-party plasmoid scripts with just one click.<br />
<br />
Most plasmoids are not created officially by KDE developers. You can also try installing Mac OS X widgets, Microsoft Windows Vista/7 widgets, Google Widgets, and even SuperKaramba widgets.<br />
<br />
=====Sound applet in the System Tray=====<br />
<br />
Install Kmix ({{Pkg|kdemultimedia-kmix}}) from the official repositories and start it from the appliocation launcher. Since KDE autostarts programs from the previous session, the program need not be started manually every time one logs in.<br />
<br />
====Window Decorations====<br />
[http://kde-look.org/index.php?xcontentmode=75 Window decorations] can be changed in<br />
System Settings -> Workspace Appearance -> Window Decorations<br />
There you can also directly download and install more themes with one click and some are available on [https://aur.archlinux.org/packages.php?O=0&K=kdestyle&do_Search=Go&PP=25&SO=d&SB=v AUR].<br />
<br />
====Icon Themes====<br />
Not many full system icons themes are available for KDE 4. You can open up '''System Settings > Application Appearance > Icons''' and browse for new ones or install them manually. Many of them can be found on [http://www.kde-look.org/ kde-look.org].<br />
<br />
Official logos, icons, CD labels and other artwork for Arch Linux are provided in the {{Pkg|archlinux-artwork}} package. After installing you can find such artwork at {{ic|/usr/share/archlinux/}}.<br />
<br />
====Fonts====<br />
===== Fonts in KDE look poor =====<br />
Try installing the {{Pkg|ttf-dejavu}} and {{Pkg|ttf-liberation}} packages. <br />
<br />
After the installation, be sure to log out and back in. You should not have to modify any settings in the "Fonts" panel of the KDE System Settings application.<br />
<br />
If you have personally set up how your [[Fonts]] render, be aware that System Settings may alter their appearance. When you go '''System Settings > Appearance > Fonts''' System Settings will likely alter your font configuration file ({{ic|fonts.conf}}). <br />
<br />
There is no way to prevent this but if you set the values to match your {{ic|fonts.conf}} file the expected font rendering will return (it will require you to restart your application or in a few cases for you to have to restart your desktop). <br />
<br />
Note too that Gnomes' Font Preferences will also do this if you use both desktop environments.<br />
<br />
===== Fonts are huge or seems disproportional =====<br />
Try to force fonts DPI to '''96''' on '''System Settings > Application Appearance > Fonts.'''<br />
<br />
If it does not work try set DPI directly on Xorg configuration [[Xorg#Setting_DPI_manually|here]].<br />
<br />
====Space efficiency====<br />
<br />
Users with small screens (eg Netbooks) can change some setting to make KDE more space efficient. See [http://userbase.kde.org/KWin#Using_with_small_screens_(eg_Netbooks) upstream wiki] for more info. Also you can use [http://www.kde.org/workspaces/plasmanetbook/ KDE's Plasma Netbook] which is a workspace made specifically for small, lightweight netbook devices.<br />
<br />
=== Networking ===<br />
You can choose from the following tools:<br />
* NetworkManager. See [[NetworkManager#KDE4|NetworkManager]] for more information.<br />
* Wicd and its KDE front end {{AUR|wicd-kde}}. See [[Wicd]] for more information.<br />
<br />
=== Printing ===<br />
{{Tip|Use the [[CUPS]] web interface for faster configuration.}}<br />
<br />
The printers are configured in this way can be found in applications KDE. <br />
<br />
You can also choose the printer configuration through '''System Settings -> Printer Configuration'''. To use this method, you must first install the packages {{Pkg|kdeutils-print-manager}} and {{Pkg|cups}}.<br />
<br />
You need to start the avahi-daemon and cupsd daemons first or you will get the following error: <br />
{{bc|The service 'Printer Configuration' does not provide an interface 'KCModule' <br />
with keyword 'system-config- printer-kde/system-config-printer-kde.py' <br />
The factory does not support creating components of the specified type.<br />
}}<br />
<br />
If you are getting the following error, you need to give the user rights to manage printers: <br />
There was an error during CUPS operation: 'cups-authorization-canceled'<br />
<br />
For CUPS, this is set in {{ic|/etc/cups/cupsd.conf}}.<br />
<br />
Adding '''lp''' to '''SystemGroup''' allows anyone who can print to configure printers. You can, of course, add another group instead of '''lp'''.<br />
{{hc|/etc/cups/cupsd.conf|# Administrator user group...<br />
SystemGroup sys root lp}}<br />
<br />
===Samba/Windows support===<br />
If you want to have access to Windows services install [[Samba]] (package {{Pkg|samba}}).<br />
<br />
You may then configure your Samba shares through <br />
<br />
System Settings -> Sharing -> Samba<br />
<br />
=== KDE Desktop Activities ===<br />
KDE Desktop Activities are Plasma based "virtual desktop"-like set of Plasma Widgets where you can independently configure widgets as if you had more than one screens/desktops. <br />
<br />
On your desktop, click the Cashew Plasmoid and on the pop-up window press "Activities".<br />
<br />
A plasma bar will appear at the bottom of the screen which presents you the current Plasma Desktop Activities which exist. You can then navigate between them by pressing their correspondent icon.<br />
<br />
===Power Saving===<br />
KDE has an integrated power saving service called "'''Powerdevil Power Management'''" that may adjust the power saving profile of the system and/or the brightness of the screen (if supported).<br />
<br />
==== How to enable Cpufreq based power saving ====<br />
'''NOTE: Cpufreq seems have been dropped from arch linux in favour of [[cpupower]] ([https://github.com/mate-desktop/mate-applets/issues/11 ref]) '''<br />
<br />
Since KDE 4.6, CPU frequency scaling is no longer managed by KDE. Instead it is assumed to be handled automatically by the the hardware and/or kernel. Arch uses {{ic|ondemand}} as default cpufreq governor from kernel vesion 3.3. See [[cpufreq|wiki article on cpufreq]].<br />
<br />
If you are happy with setting your governor once at boot (with the {{ic|cpufreq}} daemon script, for example) then this section is not relevant and can be skipped.<br />
<br />
1. If you have not already done so, install the {{Pkg|cpufrequtils}} package (for the '''cpufreq-set''' utility).<br />
<br />
2. Next, you will need to grant access to '''cpufreq-set''' for the appropriate users by configuring [[sudo]]. For example, if you are part of the ''wheel'' group, you could use {{ic|visudo}} to add<br />
%wheel ALL = (ALL) NOPASSWD: /usr/bin/cpufreq-set<br />
to your {{ic|sudoers}} file.<br />
<br />
3. From '''System Settings > Power Management > Power Profiles''' select a profile to edit or create a new one. Check the '''Run Script''' option and add an appropriate {{ic|cpufreq-set}} command for the selected power profile. For example, your "Powersave" profile might have:<br />
sudo cpufreq-set -r -g ondemand<br />
Your "Performance" profile might have<br />
sudo cpufreq-set -r -g performance<br />
<br />
{{Note | The ''cpufreq-set'' examples above may be insufficient for setting the governor for all processors/cores.<br />
For some CPU families the {{ic|-r}} switch may not set the governor for all cores/cpus and instead only set the governor for CPU 0. In this case you will need to write a script to iterate through all your cores. A simple script for a four core system could look like:<br />
#!/bin/bash<br />
for i in {0..3}; do<br />
sudo /usr/bin/cpufreq-set -c${i} -gondemand<br />
done<br />
}}<br />
<br />
{{Note | You can check which governors are active with {{ic|cpufreq-info -o}} or less intuitively by inspecting {{ic|/sys/devices/system/cpu/cpu*/cpufreq/scaling_governor}}.<br />
}}<br />
<br />
===Monitoring changes on local files and directories===<br />
KDE now uses '''inotify''' directly from the kernel with '''kdirwatch''' (included in kdelibs), so Gamin or FAM are no longer needed. You may want to install this {{AUR|kdirwatch}} from AUR which is a GUI frontend for kdirwatch.<br />
<br />
==System Administration==<br />
===Set keyboard layout in order switch language inputs===<br />
In order to do that, navigate to <br />
System Settings > Hardware > Input Devices > Keyboard<br />
There you may choose your keyboard model at first.<br />
{{Note| It is preferable that, if you use Evdev, that means Xorg automatic configuration for keyboards, you should choose "Evdev-managed keyboard".}}<br />
In the "'''Layouts'''" tab, you choose the languages you may want to use by pressing the "Add Layout" button and therefore the variant and the language.<br />
In the "'''Advanced'''" tab, you can choose the keyboard combination you want in order to change the layouts in the "Key(s) to change layout" sub-menu.<br />
<br />
===Terminate Xorg-server through KDE system settings===<br />
Navigate to <br />
System Settings -> Input Devices -> Keyboard -> Advanced (tab) > "Key Sequence to kill the X server" submenu<br />
and tick the checkbox.<br />
<br />
===Useful KCM===<br />
KCM means KConfig Module. This modules help you to configure you system providing a interface on System Settings.<br />
<br />
'''Configuration for look&feel of your GTK apps.'''<br />
* {{AUR|kde-gtk-config}} (formerly known as chakra-gtk-config).<br />
* {{AUR|kcm-gtk}}<br />
* {{AUR|kcm-qt-graphicssystem}}<br />
<br />
'''Configuration for the GRUB2 bootloader.'''<br />
* {{AUR|grub2-editor}}<br />
* {{AUR|kcm-grub2}}<br />
<br />
'''Configuration for Synaptics driver based touchpads.'''<br />
* {{Pkg|synaptiks}}<br />
* {{AUR|kcm_touchpad}}<br />
<br />
'''Configuration for [[Firewalls#ufw|UFW]]'''<br />
* {{AUR|kcm-ufw}}<br />
<br />
'''Configuration for [[PolicyKit]]'''<br />
* {{AUR|kcm-polkit-kde-git}}<br />
<br />
'''Configuration for Wacom Tablet'''<br />
* {{AUR|kcm-wacomtablet}}<br />
<br />
More KCM can be found [http://kde-apps.org/index.php?xcontentmode=273 here].<br />
<br />
==Desktop Search and Semantic Desktop==<br />
According to [https://en.wikipedia.org/wiki/Semantic_desktop Wikipedia], ''"the Semantic Desktop is a collective term for ideas related to changing a computer's user interface and data handling capabilities so that data is more easily shared between different applications or tasks and so that data that once could not be automatically processed by a computer can be (automatically processed)."''<br />
<br />
The KDE implementation of this concept is tied to (as of KDE 4.10) two major pieces of software, Akonadi and Nepomuk. Between the two of them, these programs look at your data and make an easily searchable index of it. The idea behind these pieces of software is to make your system "aware" of your data and give it context using meta-data and user-supplied tags.<br />
<br />
Soprano and Virtuoso are two dependencies of the Nepomuk Semantic Desktop. Since the relationship between the two major components and their dependencies is not very clear, the following sections try to shed some light on their inner workings.<br />
<br />
===Virtuoso and Soprano===<br />
<br />
The database used to store all the metadata used by the semantic desktop is a ''[https://en.wikipedia.org/wiki/Resource_Description_Framework Resource Description Framework (RDF)]'' database called Virtuoso. Internally, Virtuoso may be looked as a relational database. (A [https://en.wikipedia.org/wiki/Relational_model relational database] is different from a traditional single-table based database in the sense that it uses multiple tables related by a single key in order to store data.) It is currently controlled by OpenLink, and is available under commercial and an open source license.<br />
<br />
From the [http://techbase.kde.org/Projects/Nepomuk/ComponentOverview#Soprano KDE Techbase], ''Soprano is a Qt abstraction over databases. It provides a friendly Qt-based API for accessing different RDF stores. It currently supports 3 database backends - Sesame, Redland and Virtuoso. The KDE Semantic Stack only works with Virtuoso. Soprano also provides additional features such as serializing, parsing RDF data, and a client server architecture that is heavily used in Nepomuk.''<br />
<br />
===Nepomuk===<br />
Nepomuk stands for "Networked Environment for Personal, Ontology-based Management of Unified Knowledge". It is what allows all the tagging and labeling of files as well to take place and also serves as the way to actually read the Virtuoso databases. It provides an API to application developers which allows them to read the data collected by it.<br />
<br />
In the past, the "Strigi" service was used to collect data about the various files present on the system. However, due to many reasons, the most important of them being CPU and Memory usage, Strigi was replaced by a homegrown indexing service which is integrated with Nepomuk-Core.<br />
<br />
For further information about Nepomuk, [http://techbase.kde.org/Projects/Nepomuk/ComponentOverview#Nepomuk_Components this page] is a good resource. However, some of the information in the previous page has been rendered outdated according to [http://vhanda.in/blog/2012/11/nepomuk-without-strigi/ this blog post].<br />
<br />
====Using and configuring Nepomuk====<br />
<br />
In order to search using Nepouk on the KDE desktop, press '''ALT+F2''' and type in your query. Nepomuk is enabled by default. It can be turned on and off in<br />
System Settings -> Desktop Search<br />
<br />
Nepomuk has to keep track of a lot of files. It is for this reason that it is recommended to increase the number of files that can be watched with inotify. In order to do that this command is a good option.<br />
sysctl fs.inotify.max_user_watches=524288<br />
<br />
To do it persistently:<br />
echo "fs.inotify.max_user_watches = 524288" >> /etc/sysctl.conf<br />
<br />
Restart Nepomuk to see the changes.<br />
<br />
====KDE without Nepomuk====<br />
If you wish to run KDE without Nepomuk, there exists a {{AUR|nepomuk-core-fake}} package in the AUR.<br />
{{Warning|As of now, Dolphin depends on {{Pkg|nepomuk-widgets}} and hence will break if used with the fake Nepomuk package}}<br />
<br />
===Akonadi===<br />
Akonadi is a system meant to act as a local cache for PIM data, regardless of its origin, which can be then used by other applications. This includes the user's emails, contacts, calendars, events, journals, alarms, notes, and so on. It interfaces with the Nepomuk libraries to provide searching capabilities.<br />
<br />
Akonadi does not store any data by itself: the storage format depends on the nature of the data (for example, contacts may be stored in vcard format).<br />
<br />
For more information on Akonadi and its relationship with Nepomuk, see [http://blogs.kde.org/node/4503] and [http://cmollekopf.wordpress.com/2013/02/13/kontact-nepomuk-integration-why-data-from-akonadi-is-indexed-in-nepomuk/].<br />
<br />
==== Disabling Akonadi ====<br />
See this [http://userbase.kde.org/Akonadi#Disabling_the_Akonadi_subsystem section in the KDE userbase].<br />
<br />
==== Database configuration ====<br />
Start {{ic|akonaditray}} from package {{Pkg|kdepim-runtime}}. Right click on it and select '''configure'''. In the Akonadi server configure tab, you can:<br />
* Configuring Akonadi to use MySQL Server running on the System<br />
* Configuring Akonadi to use sqlite<br />
<br />
====Running KDE without Akonadi====<br />
The package {{AUR|akonadi-fake}} is a good option for those who wish to run KDE without Akonadi.<br />
<br />
==Phonon==<br />
===What is Phonon?===<br />
''Phonon is the multimedia API for KDE 4. Phonon was created to allow KDE 4 to be independent of any single multimedia framework such as GStreamer or xine and to provide a stable API for KDE 4's lifetime. It was done for various reasons: to create a simple KDE/Qt style multimedia API, to better support native multimedia frameworks on Windows and Mac OS X, and to fix problems of frameworks becoming unmaintained or having API or ABI instability.<br />
''<br />
<br />
from Wikipedia.<br />
<br />
'''Phonon''' is being widely used within KDE, for both audio (e.g., the System notifications or KDE audio apps) and video (e.g., the Dolphin video thumbnails).<br />
<br />
===Which backend should I choose?===<br />
You can choose between various backends, like GStreamer ({{Pkg|phonon-gstreamer}}) or VLC ({{Pkg|phonon-vlc}}) available in [[Official Repositories|extra]], Xine ({{AUR|phonon-xine}}) or MPlayer ({{AUR|phonon-mplayer-git}}) available on [[Arch User Repository|AUR]]. Most users will want GStreamer or VLC which have the best upstream support. Note that multiple backends can be installed at once and you can switch between them via System Settings -> Multimedia -> Phonon -> Backend.<br />
<br />
{{Note|According to the [http://userbase.kde.org/Phonon#Backend_libraries KDE UserBase], Phonon-MPlayer and Phonon-Xine are currently unmaintained}}<br />
<br />
According to [https://www.archlinux.org/news/kde-sc-46-to-extra/ announcement of KDE 4.6 in Arch] and [http://mail.kde.org/pipermail/phonon-backends/2011-February/000500.html mail in Phonon dev list], users should prefer GStreamer over VLC due to the feature difference.<br />
<br />
== Useful Applications ==<br />
The official set of KDE applications may be found [http://www.kde.org/applications/ here].<br />
<br />
=== Yakuake ===<br />
[http://yakuake.kde.org/ This] application provides a Quake-like terminal emulator, which is toggled visible using the F12 key. It also has support for multiple tabs. Yakuake can be installed by package {{pkg|yakuake}}.<br />
<br />
=== KDE Telepathy ===<br />
[http://community.kde.org/KTp KDE Telepathy] is a project with the goal to closely integrate Instant Messaging with the KDE desktop. It utilizes the Telepathy framework as a backend, and is intended to replace Kopete.<br />
<br />
To install all Telepathy protocols install the {{grp|telepathy}} group.<br />
To use the KDE Telepathy client, install the {{pkg|kde-telepathy-meta}} package that includes all the packages contained in the {{grp|kde-telepathy}} group .<br />
<br />
== Tips and tricks ==<br />
=== Configure KWin to use OpenGL ES ===<br />
Beginning with KWin version 4.8 it is possible to use the separately built binary '''kwin_gles''' as a replacement for kwin. It behaves almost the same as the kwin executable in OpenGL2 mode with the slight difference that it uses ''egl'' instead of ''glx'' as the native platform interface. To test kwin_gles you just have to run {{ic|kwin_gles --replace}} in Konsole.<br />
If you want to make this change permanent you have to create a script in {{Ic|`kde4-config --localprefix`/env/}} which exports {{Ic|1=KDEWM=kwin_gles}}.<br />
<br />
=== Enabling video thumbnails under Konqueror/Dolphin file managers ===<br />
For thumbnails of videos in konqueror and dolphin install {{Pkg|kdemultimedia-mplayerthumbs}} or {{Pkg|kdemultimedia-ffmpegthumbs}}.<br />
<br />
=== Speed up application startup ===<br />
User Rob wrote on his blog this "[http://kdemonkey.blogspot.nl/2008/04/magic-trick.html magic trick]" to improve applications start up by 50-150ms.<br />
To enable it, create this folder in your home:<br />
{{bc|$ mkdir -p ~/.compose-cache}}<br />
<br />
"For those curious about what is going on here, this enables an optimization which Lubos (of general KDE speediness fame) came up with some time ago and was then rewritten and integrated into libx11. Ordinarily on startup applications read input method information from {{ic|/usr/share/X11/locale/<your locale>/Compose}}. This Compose file is quite long (>5000 lines for the en_US.UTF-8 one) and takes some time to process. libX11 can create a cache of the parsed information which is much quicker to read subsequently, but it will only re-use an existing cache or create a new one in {{ic|~/.compose-cache}} if the directory already exists." [Cit. Rob]<br />
<br />
===Hiding partitions===<br />
In Dolphin, it is as simple as right-clicking on the partition in the 'Places' sidebar and selecting 'Hide <partition>'. Otherwise...<br />
<br />
If you wish to prevent your internal partitions from appearing in your file manager, you can create an udev rule, for example {{ic|/etc/udev/rules.d/10-local.rules}}:<br />
<br />
KERNEL=="sda[0-9]", ENV{UDISKS_IGNORE}="1"<br />
<br />
The same thing for a certain partition:<br />
<br />
KERNEL=="sda1", ENV{UDISKS_IGNORE}="1"<br />
KERNEL=="sda2", ENV{UDISKS_IGNORE}="1"<br />
<br />
=== Konqueror Tips ===<br />
==== Disabling Smart Key Tooltips (Browser) ====<br />
To disable those smart key tooltips in Konqueror (pressing {{keypress|CTRL}} on a web page), open {{Ic|~/.kde4/share/config/konquerorrc}} and add this section:<br />
<br />
{{bc|1=<br />
[Access Keys]<br />
Enabled=false<br />
}}<br />
<br />
==== Disabling The Sidebar Tab (Filemanager) ====<br />
To disable this small sidebar tab on the left side, open {{Ic|~/.kde4/share/config/konqsidebartng.rc}} and set {{Ic|HideTabs}} to {{Ic|true}}.<br />
<br />
==== Using WebKit ====<br />
WebKit is an open source browser engine developed by Apple Inc. It is a derivative from the KHTML and KJS libraries and contains many improvements. WebKit is used by Safari, Google Chrome and rekonq.<br />
<br />
It is possible to use WebKit in Konqueror instead of KHTML. First install the {{Pkg|kwebkitpart}} package.<br />
<br />
Then, after executing Konqueror, press '''Settings > Configure Konqueror'''. <br />
<br />
On the "General" submenu, select the "WebKit" as the "Default web browser engine".<br />
<br />
=== Firefox integration ===<br />
See [[Firefox#KDE_integration]].<br />
<br />
==Troubleshooting==<br />
===Getting current state of KWin for support and debug purposes===<br />
This command prints out a wonderful summary of the current state of KWin including used options, used compositing backend and relevant OpenGL driver capabilities. [http://blog.martin-graesslin.com/blog/2012/03/on-getting-help-for-kwin-and-helping-kwin/ See more at Martin's blog]<br />
<br />
qdbus org.kde.kwin /KWin supportInformation<br />
<br />
===KDE4 does not finish loading===<br />
There might be a situation in which the graphic driver might create a conflict when starting KDE4. This situation happens after the login but before finishing loading the desktop, making the user wait indefinitely at the loading screen. Until now the only users confirmed to be affected by this are the ones that use Nvidia drivers and KDE4.<br />
<br />
A solution for Nvidia users is to edit the file at {{ic|/home/user/.kde4/share/config/kwinrc}} and change the option '''Enabled=true''' to '''false''' in the '''[Compositing]''' section. For more information look at this [https://bbs.archlinux.org/viewtopic.php?pid=932598 thread].<br />
<br />
If a minimal install was done, make sure you installed the required font by your phonon backend listed here: [[KDE#Minimal_install]]<br />
<br />
===KDE and Qt programs look bad when in a different window manager===<br />
If you are using KDE or Qt programs but not in a full KDE session (specifically, you did not run "startkde"), then as of KDE 4.6.1 you will need to tell Qt how to find KDE's styles (Oxygen, QtCurve etc.)<br />
<br />
You just need to set the environment variable QT_PLUGIN_PATH. E.g. put<br />
<br />
export QT_PLUGIN_PATH=$HOME/.kde4/lib/kde4/plugins/:/usr/lib/kde4/plugins/<br />
<br />
into your {{ic|/etc/profile}} (or {{ic|~/.profile}} if you do not have root access). qtconfig should then be able to find your kde styles and everything should look nice again!<br />
<br />
Alternatively, you can symlink the Qt styles directory to the KDE styles one:<br />
# ln -s /usr/lib/kde4/plugins/styles/ /usr/lib/qt/plugins/styles<br />
<br />
Under Gnome you can try to install the package libgnomeui.<br />
<br />
===KDE and Qt programs look bad after upgrade (using kwin)===<br />
The problem is caused by old cache. Run the following to rebuild it<br />
<br />
$ rm ~/.config/Trolltech.conf<br />
$ kbuildsycoca4 --noincremental<br />
<br />
from https://bbs.archlinux.org/viewtopic.php?id=135301<br />
<br />
=== Graphical related issues ===<br />
==== Low 2D desktop performance (or) Artifacts appear when on 2D ====<br />
===== GPU driver problem =====<br />
Make sure you have the proper driver for your card installed, so that your desktop is at least 2D accelerated. Follow these articles for more information: [[ATI]], [[NVIDIA]], [[Intel]] for more information, in order to make sure that everything is all right.<br />
The open-source ATI and Intel drivers and the proprietary (binary) Nvidia driver should theoretically provide the best 2D and 3D acceleration.<br />
<br />
===== The Raster engine workaround =====<br />
If this does not solve your problems, maybe your driver does not provide a good '''XRender''' acceleration which the current Qt painter engine relies on by default. <br />
<br />
You can change the painter engine to software based only by invoking the application with the "'''-graphicssystem raster'''" command line. This rendering engine can be set as the default one by recompiling Qt with the same as configure option, "'''-graphicssystem raster'''". <br />
<br />
The raster paint engine enables the CPU to do the majority of the painting, as opposed to the GPU. You may get better performance, depending on your system. This is basically a work-around for the terrible Linux driver stack, since the CPU should obviously not be doing graphical computations since it is designed for fewer threads of greater complexity, as opposed to the GPU which is many threads but lesser computational strength. So, only use Raster engine if you are having problems or your GPU is much slower than you CPU, otherwise is better to use XRender.<br />
<br />
Since Qt 4.7+, recompiling Qt is not needed. Simply export '''QT_GRAPHICSSYSTEM=raster''', or "opengl", or "native" (for the default). Raster depends on the CPU, OpenGL depends on the GPU and high driver support, and Native is just using the X11 rendering (mixture, usually).<br />
<br />
'''The best and automatic way to do that''' is to install {{AUR|kcm-qt-graphicssystem}} from AUR and configure this particular Qt setting through<br />
<br />
System Settings > Qt Graphics System<br />
<br />
For more information, consult this [http://apachelog.wordpress.com/2010/09/05/qt-graphics-system-kcm/ KDE Developer blog entry] and/or this [http://labs.trolltech.com/blogs/2009/12/18/qt-graphics-and-performance-the-raster-engine/ Qt Developer blog entry].<br />
<br />
==== Low 3D desktop performance====<br />
KDE begins with desktop effects enabled. Older cards may be insufficient for 3D desktop acceleration. You can disable desktop effects in <br />
System Settings -> Desktop Effects<br />
or you can toggle desktop effects with {{Keypress|Alt+Shift+F12}}.<br />
<br />
{{Note| You may encounter such problems with 3D desktop performance even when using a more powerful graphics card, but using catalyst proprietary driver (fglrx). This driver is known for having issues with 3D acceleration. Visit [[ATI|the ATi Wiki page]] for more troubleshooting.}}<br />
<br />
==== Desktop compositing is disabled on my system with a modern Nvidia GPU ====<br />
Sometimes, KWin may have settings in its configuration file ('''kwinrc''') that ''may'' cause a problem on re-activating the 3D desktop '''OpenGL''' compositing. That could be caused randomly (for example, due to a sudden Xorg crash or restart, and it gets corrupted), so, in case that happens, delete your {{ic|~/.kde4/share/config/kwinrc}} file and relogin. The KWin settings will turn to the KDE default ones and the problem should be probably gone.<br />
<br />
==== Flickering in fullscreen when compositing is enabled ====<br />
As of KDE SC 4.6.0, there is an option in systemsettings -> Desktop Effect -> Advanced -> "Suspend desktop effects for fullscreen windows" Uncheck it would tell kwin to disable unredirect fullscren.<br />
<br />
===Sound problems under KDE===<br />
====ALSA related problems====<br />
{{Note|First make sure you have {{pkg|alsa-lib}} and {{pkg|alsa-utils}} installed.}}<br />
<br />
====="Falling back to default" messages when trying to listen to any sound in KDE=====<br />
When you encounter such messages:<br />
:The audio playback device ''<name-of-the-sound-device>'' does not work.<br />
:Falling back to default<br />
Go to<br />
System Settings -> Multimedia -> Phonon<br />
and set the device named "'''default'''" above all the other devices in each box you see.<br />
<br />
=====I cannot play MP3 files when using the GStreamer Phonon backend=====<br />
That can be solved by installing the GStreamer plugins (package {{Pkg|gstreamer0.10-plugins}}. If you still encounter problems, you can try changing the Phonon backend used by installing another such as {{Pkg|phonon-vlc}}.<br />
Then make sure the backend is preferred via:<br />
System Settings -> Multimedia -> Phonon -> Backend (tab)<br />
<br />
===I want a fresh installation of KDE for my system. What should I do?===<br />
Just rename the settings directory of KDE (just in case you will want to go back to your original settings):<br />
mv ~/.kde4 ~/.kde4-backup<br />
<br />
===Plasma desktop behaves strangely===<br />
Plasma issues are usually caused by unstable '''plasmoids''' or '''plasma themes'''. First, find which was the last plasmoid or plasma theme you had installed and disable it or uninstall it. <br />
<br />
So, if your desktop suddenly exhibits "locking up", this is likely caused by a faulty installed widget. If you cannot remember which widget you installed before the problem began(sometimes it can be an irregular problem), try to track it down by removing each widget until the problem ceases. Then you can uninstall the widget, and file a bug report (bugs.kde.org) '''only if it is an official widget'''. If it is not, I recommend you find the entry on kde-look.org and inform the developer of that widget about the issue (detailing steps to reproduce, etc).<br />
<br />
If you cannot find the problem, but you do not want ''all'' the KDE settings to be lost, do:<br />
<br />
rm -r ~/.kde4/share/config/plasma*<br />
<br />
This command will '''delete all plasma related configs''' of your user and when you will relogin into KDE, you will have the '''default''' settings back. You should know that this action '''cannot be undone'''. You ought to create a backup folder and copy all the plasma related configs in it.<br />
<br />
===Konsole does not save commands' history===<br />
By default console commands' history is saved only when you type 'exit' in console. When you close Konsole with 'x' in the corner it does not happen.<br />
To enable autosaving after every command execution you should add following lines into your .bashrc<br />
shopt -s histappend<br />
[[ "${PROMPT_COMMAND}" ]] && PROMPT_COMMAND="$PROMPT_COMMAND;history -a" || PROMPT_COMMAND="history -a"<br />
<br />
===KDE password prompts display three bullets per char===<br />
You can change it under '''System Settings > Account Details'''. At '''Password & User Account''' the options are:<br />
*Show one bullet for each letter<br />
*Show three bullets for each letter<br />
*Show nothing<br />
<br />
===Nepomukserver process still autostart even with semantic desktop disabled===<br />
Go to ''' System Settings > Startup and Shutdown > Service Manager > Startup Services''' and uncheck the Nepomuk Search Module.<br />
<br />
===File Indexer Service not working even after enabling everything properly===<br />
Use the following command to find Nepomuk's configuration files.<br />
find $HOME/.kde4/share/ -name "*nepomuk*"<br />
Delete all files and folders in the output and then restart KDE.<br />
<br />
===Desktop does not respond for several seconds at startup===<br />
There is a bug in either [https://bugs.freedesktop.org/show_bug.cgi?id=58758 pulseaudio] or [https://bugs.kde.org/show_bug.cgi?id=312560 kde] that makes the desktop not being usable for a few seconds after it has showed up (for example if you click on the K-menu it does not appears until that waiting time has elapsed).<br />
<br />
The workaround is to disable {{ic|/etc/xdg/autostart/pulseaudio.desktop}} by adding the following line at the end (do not omit the semicolon):<br />
<br />
NotShowIn=KDE;<br />
<br />
Note that you could also remove that file, or renaming it (to pulseaudio.desktop.disable or the like) but then it will not load in other Desktop Managers, and will be restored by a package update.<br />
<br />
'''''Source:''' http://linuxadvantage.blogspot.fr/2013/01/kde-rather-slow-to-start-pulseaudio.html''<br />
<br />
===KDE Notifications do not go away even after being dismissed===<br />
This is a known [https://bugs.kde.org/show_bug.cgi?id=311413 bug] filed in December. It has a patch, but there seems to be no target release specified to fix it. [https://bbs.archlinux.org/viewtopic.php?id=160308 This discussion] may be referred to for more details.<br />
<br />
===Mysterious hangs/slowness after upgrade===<br />
Try cleaning up your cache. Sometimes after an upgrade, the old cache might introduce strange, hard to debug behaviour such as unkillable shells, hangs when changing various settings and several other problems such as ark being unable to unrar or unzip or amarok not recognizing any of your musics.<br />
<br />
To clean up your cache run as your normal user:<br />
<br />
rm ~/.config/Trolltech.conf<br />
kbuildsycoca4 --noincremental<br />
<br />
Hopefully, your problems are now fixed.<br />
<br />
==Other KDE projects==<br />
<br />
=== Official kde-unstable ===<br />
When KDE is reaching beta or RC milestone, KDE "unstable" packages are uploaded to the [kde-unstable] repo. They stay there until KDE is declared stable and passes to [extra].<br />
<br />
You may add it by adding:<br />
<br />
[kde-unstable]<br />
SigLevel = PackageRequired<br />
Include = /etc/pacman.d/mirrorlist<br />
<br />
to {{ic|/etc/pacman.conf}}<br />
<br />
# kde-unstable is based upon testing. Therefore, you need to enable the repositories in the following order: '''kde-unstable, testing, core, extra, community-testing, community'''. <br />
# To update from a previous KDE installation, run: <code>pacman -Syu</code> or <code>pacman -S kde-unstable/kde</code><br />
# If you don't have KDE installed, you might have difficulties to install it by using groups (limitation of pacman)<br />
# '''Subscribe and read the arch-dev-public mailing list'''<br />
# Make sure [[#Distro_and_Upstream_bug_report|you make bug reports]] if you find any issues.<br />
<br />
=== Trinity ===<br />
From the release of KDE 4.x, the developers dropped support for KDE 3.5.x. Trinity Desktop Environment is a fork of KDE3 developed by Timothy Pearson ([http://trinitydesktop.org/ trinitydesktop.org]). This project aims to keep the KDE3.5 computing style alive, as well as polish off any rough edges that were present as of KDE 3.5.10. See [[Trinity]] for more info.<br />
<br />
{{Warning| KDE 3 is no longer maintained and supported by the KDE developers. The "Trinity KDE" is maintained by the Trinity project commmunity. Use KDE 3 on your own risk, regarding any bugs, performance issues or security risks.}}<br />
<br />
==Bugs==<br />
===Distro and Upstream bug report===<br />
It is preferrable that if you find a minor or serious bug, you should visit [https://bugs.archlinux.org the Arch Bug Tracker] or/and [http://bugs.kde.org KDE Bug Tracker] in order to report that. Make sure that you be clear on what you want to report.<br />
<br />
If you have any issue and you write about in on the Arch forums, first make sure that you have '''FULLY''' updated your system using a good sync mirror (check [https://www.archlinux.de/?page=MirrorStatus here]) or try [[Reflector]].<br />
<br />
KDE 4 config files are usually located at <br />
<br />
~/.kde4/share/config/<br />
<br />
and for app-specific configs <br />
<br />
~/.kde4/share/apps/<br />
<br />
==External Links==<br />
* [http://www.kde.org KDE Homepage]<br />
* [http://bugs.kde.org KDE Bug Tracker]<br />
* [https://bugs.archlinux.org Arch Linux Bug Tracker]<br />
* [http://websvn.kde.org KDE WebSVN]</div>Ollbaphttps://wiki.archlinux.org/index.php?title=Bash/Prompt_customization&diff=94855Bash/Prompt customization2010-02-02T19:40:39Z<p>Ollbap: /* Return value visualisation */</p>
<hr />
<div>[[Category:Eye candy (English)]]<br />
[[Category:Command shells (English)]]<br />
[[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|Color_Bash_Prompt}}<br />
{{i18n_entry|Español|Colorear_Indicador_Bash (Español)}}<br />
{{i18n_entry|Italiano|Colorare_il_prompt_Bash_(Italiano)}}<br />
{{i18n_links_end}}<br />
<br />
There are a variety of possibilities for [[Bash]]'s prompt (PS1), and customizing it can help you be more productive at the command line. You can add additional information to your prompt, or you can simply add color to it to make the prompt stand out.<br />
<br />
==Basic prompts==<br />
The following settings are useful for distinguishing the root prompt from non-root users.<br />
<br />
*Edit Bash's personal configuration file:<br />
$ nano ~/.bashrc<br />
<br />
*Comment out the default prompt:<br />
#PS1='[\u@\h \W]\$ '<br />
<br />
*Add the following green prompt for regular users:<br />
export PS1='\[\e[1;32m\][\u@\h \W]\$\[\e[0m\] '<br />
<br />
*Edit root's Bash file:<br />
# nano /root/.bash_profile<br />
<br />
*Assign a red prompt for root:<br />
export PS1='\[\e[1;31m\][\u@\h \W]\$\[\e[0m\] '<br />
<br />
==Advanced prompts==<br />
<br />
===List of colors for prompt and Bash===<br />
Add this to your Bash file(s) to define colors for prompt and commands:<br />
<pre>txtblk='\e[0;30m' # Black - Regular<br />
txtred='\e[0;31m' # Red<br />
txtgrn='\e[0;32m' # Green<br />
txtylw='\e[0;33m' # Yellow<br />
txtblu='\e[0;34m' # Blue<br />
txtpur='\e[0;35m' # Purple<br />
txtcyn='\e[0;36m' # Cyan<br />
txtwht='\e[0;37m' # White<br />
bldblk='\e[1;30m' # Black - Bold<br />
bldred='\e[1;31m' # Red<br />
bldgrn='\e[1;32m' # Green<br />
bldylw='\e[1;33m' # Yellow<br />
bldblu='\e[1;34m' # Blue<br />
bldpur='\e[1;35m' # Purple<br />
bldcyn='\e[1;36m' # Cyan<br />
bldwht='\e[1;37m' # White<br />
unkblk='\e[4;30m' # Black - Underline<br />
undred='\e[4;31m' # Red<br />
undgrn='\e[4;32m' # Green<br />
undylw='\e[4;33m' # Yellow<br />
undblu='\e[4;34m' # Blue<br />
undpur='\e[4;35m' # Purple<br />
undcyn='\e[4;36m' # Cyan<br />
undwht='\e[4;37m' # White<br />
bakblk='\e[40m' # Black - Background<br />
bakred='\e[41m' # Red<br />
badgrn='\e[42m' # Green<br />
bakylw='\e[43m' # Yellow<br />
bakblu='\e[44m' # Blue<br />
bakpur='\e[45m' # Purple<br />
bakcyn='\e[46m' # Cyan<br />
bakwht='\e[47m' # White<br />
txtrst='\e[0m' # Text Reset</pre><br />
<br />
To use in commands from your shell environment:<br />
$ echo -e "${txtblu}test"<br />
<font color='blue'>test</font><br />
$ echo -e "${bldblu}test"<br />
<font color='lightblue'><b>test</b></font><br />
$ echo -e "${undblu}test"<br />
<font color='lightblue'><b><u>test</u></b></font><br />
$ echo -e "${bakblu}test"<br />
<span style="color: white; background-color: lightblue"><b>test</b></span><br />
<br />
To use in a prompt (note double quotes and <nowiki>\[ \]</nowiki> used by the shell to count proper length):<br />
PS1="\[$txtblu\]foo\[$txtred\] bar\[$txtrst\] baz : "<br />
<br />
===Prompt escapes===<br />
The various Bash prompt escapes listed in the manpage:<br />
Bash allows these prompt strings to be customized by inserting a<br />
number of ''backslash-escaped special characters'' that are<br />
decoded as follows:<br />
<br />
\a an ASCII bell character (07)<br />
\d the date in "Weekday Month Date" format (e.g., "Tue May 26")<br />
\D{format} the format is passed to strftime(3) and the result<br />
is inserted into the prompt string an empty format<br />
results in a locale-specific time representation.<br />
The braces are required<br />
\e an ASCII escape character (033)<br />
\h the hostname up to the first `.'<br />
\H the hostname<br />
\j the number of jobs currently managed by the shell<br />
\l the basename of the shell's terminal device name<br />
\n newline<br />
\r carriage return<br />
\s the name of the shell, the basename of $0 (the portion following<br />
the final slash)<br />
\t the current time in 24-hour HH:MM:SS format<br />
\T the current time in 12-hour HH:MM:SS format<br />
\@ the current time in 12-hour am/pm format<br />
\A the current time in 24-hour HH:MM format<br />
\u the username of the current user<br />
\v the version of bash (e.g., 2.00)<br />
\V the release of bash, version + patch level (e.g., 2.00.0)<br />
\w the current working directory, with $HOME abbreviated with a tilde<br />
\W the basename of the current working directory, with $HOME<br />
abbreviated with a tilde<br />
\! the history number of this command<br />
\# the command number of this command<br />
\$ if the effective UID is 0, a #, otherwise a $<br />
\nnn the character corresponding to the octal number nnn<br />
\\ a backslash<br />
\[ begin a sequence of non-printing characters, which could be used<br />
to embed a terminal control sequence into the prompt<br />
\] end a sequence of non-printing characters<br />
<br />
The command number and the history number are usually different:<br />
the history number of a command is its position in the history<br />
list, which may include commands restored from the history file<br />
(see HISTORY below), while the command number is the position in<br />
the sequence of commands executed during the current shell session.<br />
After the string is decoded, it is expanded via parameter<br />
expansion, command substitution, arithmetic expansion, and quote<br />
removal, subject to the value of the promptvars shell option (see<br />
the description of the shopt command under SHELL BUILTIN COMMANDS<br />
below).<br />
<br />
===Positioning the cursor===<br />
The following sequence sets the cursor position:<br />
\[\033[<row>;<column>f\]<br />
<br />
The current cursor position can be saved using:<br />
\[\033[s\]<br />
<br />
To restore a position, use the following sequence: <br />
\[\033[u\]<br />
<br />
The following example uses these sequences to display the time in the upper right corner:<br />
PS1=">\[\033[s\]\[\033[1;\$((COLUMNS-4))f\]\$(date +%H:%M)\[\033[u\]"<br />
<br />
The environment variable ''COLUMNS'' contains the number of columns of the terminal. The above example substracts 4 from its value in order to justify the five character wide output of ''date'' at the right border.<br />
<br />
===Return value visualisation===<br />
Add this line if you want to see the return value of the last executed command. This should work with any kind of prompt as long as it does not need PROMPT_COMMAND:<br />
<nowiki>PROMPT_COMMAND='RET=$?; if [[ $RET -eq 0 ]]; then echo -ne "\033[0;32m$RET\033[0m ;)"; else echo -ne "\033[0;31m$RET\033[0m ;("; fi; echo -n " "'</nowiki><br />
<br />
It will look like this:<br />
<font color="green">0</font><b> ;) </b>harvie@harvie-ntb ~/ $ true<br />
<font color="green">0</font><b> ;) </b>harvie@harvie-ntb ~/ $ false<br />
<font color="red">1</font><b> ;( </b>harvie@harvie-ntb ~/ $ <br />
Zero is green and non-zero is red. There is also the smiley indication (replace it with anything you want); so your prompt will smile if the last operation was succesful.<br />
<br />
====Advanced return value visualisation====<br />
If you want colors, you need to set ''$RED'' and ''$GREEN'' values:<br />
RED='\e[0;31m'<br />
GREEN='\e[0;32m'<br />
<br />
You have to specify these values in Bash's configuration files:<br />
<pre><br />
#return value visualisation<br />
PROMPT_COMMAND='RET=$?;'<br />
RET_VALUE='$(echo $RET)' #Ret value not colorized - you can modify it.<br />
RET_SMILEY='$(if [[ $RET=0 ]]; then echo -ne "\[$GREEN\];)"; else echo -ne "\[$RED\];("; fi;)'<br />
</pre><br />
<br />
Then you can use ''$RET_VALUE'' and ''$RET_SMILEY'' variables in the prompt. Note that you need use double quotes:<br />
#prompt<br />
PS1="$RET_VALUE $RET_SMILEY : "<br />
<br />
This will give you basic prompt:<br />
0 <font color="green">;)</font> : true<br />
0 <font color="green">;)</font> : false<br />
1 <font color="red">;(</font> : <br />
<br />
But you will probably want to use ''$RET_VALUE'' or ''$RET_SMILEY'' in your own prompt, like this:<br />
<pre><br />
PS1="\[$WHITE\]$RET_VALUE $RET_SMILEY \[$BLUE\]\u\[$RED\]@\[$EBLUE\]\h\[$WHITE\] \W \[$ERED\]\\$\[$EWHITE\] "<br />
</pre><br />
<br />
===Wolfman's===<br />
After reading through most of the [http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/index.html Bash Prompt Howto], the author developed a color bash prompt that displays the last 25 characters of the current working directory. This prompt should work well on terminals with a black background. The following code goes in file {{Filename|~/.bashrc}}.<br />
<br />
*Add the bash_prompt_command function. If you have a couple directories with long names or start entering a lot of subdirectories, this function will keep the command prompt from wrapping around the screen by displaying at most the last pwdmaxlen characters from the PWD. This code was taken from the ''Bash Prompt Howto''<nowiki>'s</nowiki> section on [http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x783.html Controlling the Size and Appearance of $PWD] and modified to replace the user's home directory with a tilde.<br />
##################################################<br />
# Fancy PWD display function<br />
##################################################<br />
# The home directory (HOME) is replaced with a ~<br />
# The last pwdmaxlen characters of the PWD are displayed<br />
# Leading partial directory names are striped off<br />
# /home/me/stuff -> ~/stuff if USER=me<br />
# /usr/share/big_dir_name -> ../share/big_dir_name if pwdmaxlen=20<br />
##################################################<br />
bash_prompt_command() {<br />
# How many characters of the $PWD should be kept<br />
local pwdmaxlen=25<br />
# Indicate that there has been dir truncation<br />
local trunc_symbol=".."<br />
local dir=${PWD##*/}<br />
pwdmaxlen=$(( ( pwdmaxlen < ${#dir} ) ? ${#dir} : pwdmaxlen ))<br />
NEW_PWD=${PWD/#$HOME/\~}<br />
local pwdoffset=$(( ${#NEW_PWD} - pwdmaxlen ))<br />
if [ ${pwdoffset} -gt "0" ]<br />
then<br />
NEW_PWD=${NEW_PWD:$pwdoffset:$pwdmaxlen}<br />
NEW_PWD=${trunc_symbol}/${NEW_PWD#*/}<br />
fi<br />
}<br />
<br />
*The next fragment generates the command prompt and various colors are defined. The user's color for the username, hostname, and prompt ($ or #) is set to cyan, and if the user is root (root's UID is always 0), set the color to red. The command prompt is set to a colored version of Arch's default with the NEW_PWD from the last function.<br />
<br />
:Also, make sure that your color variables are enclosed in double and not single quote marks. Using single quote marks seems to give Bash problems with line wrapping correctly.<br />
bash_prompt() {<br />
case $TERM in<br />
xterm*|rxvt*)<br />
local TITLEBAR='\[\033]0;\u:${NEW_PWD}\007\]'<br />
;;<br />
*)<br />
local TITLEBAR=""<br />
;;<br />
esac<br />
local NONE="\[\033[0m\]" # unsets color to term's fg color<br />
<br />
# regular colors<br />
local K="\[\033[0;30m\]" # black<br />
local R="\[\033[0;31m\]" # red<br />
local G="\[\033[0;32m\]" # green<br />
local Y="\[\033[0;33m\]" # yellow<br />
local B="\[\033[0;34m\]" # blue<br />
local M="\[\033[0;35m\]" # magenta<br />
local C="\[\033[0;36m\]" # cyan<br />
local W="\[\033[0;37m\]" # white<br />
<br />
# emphasized (bolded) colors<br />
local EMK="\[\033[1;30m\]"<br />
local EMR="\[\033[1;31m\]"<br />
local EMG="\[\033[1;32m\]"<br />
local EMY="\[\033[1;33m\]"<br />
local EMB="\[\033[1;34m\]"<br />
local EMM="\[\033[1;35m\]"<br />
local EMC="\[\033[1;36m\]"<br />
local EMW="\[\033[1;37m\]"<br />
<br />
# background colors<br />
local BGK="\[\033[40m\]"<br />
local BGR="\[\033[41m\]"<br />
local BGG="\[\033[42m\]"<br />
local BGY="\[\033[43m\]"<br />
local BGB="\[\033[44m\]"<br />
local BGM="\[\033[45m\]"<br />
local BGC="\[\033[46m\]"<br />
local BGW="\[\033[47m\]"<br />
<br />
local UC=$W # user's color<br />
[ $UID -eq "0" ] && UC=$R # root's color<br />
<br />
PS1="$TITLEBAR ${EMK}[${UC}\u${EMK}@${UC}\h ${EMB}\${NEW_PWD}${EMK}]${UC}\\$ ${NONE}"<br />
# without colors: PS1="[\u@\h \${NEW_PWD}]\\$ "<br />
# extra backslash in front of \$ to make bash colorize the prompt<br />
}<br />
<br />
*Finally, append this code. This ensures that the NEW_PWD variable will be updated when you cd somewhere else, and it sets the PS1 variable, which contains the command prompt.<br />
PROMPT_COMMAND=bash_prompt_command<br />
bash_prompt<br />
unset bash_prompt<br />
<br />
==Set xterm window title==<br />
You can use the {{Codeline|<nowiki>${XTERM_TITLE}</nowiki>}} variable at the beginning of the prompt to set [[xterm]] title (if available) to directory@user@hostname. Or you can modify it using regular [[#Prompt escapes|prompt escape sequences]]:<br />
<pre><br />
#set xterm title<br />
case "$TERM" in<br />
xterm | xterm-color)<br />
XTERM_TITLE='\[\033]0;\W@\u@\H\007\]'<br />
;;<br />
esac;<br />
</pre><br />
<br />
==External links==<br />
* Forum Discussions:<br />
** [http://bbs.archlinux.org/viewtopic.php?id=1817 BASH prompt]<br />
** [http://bbs.archlinux.org/viewtopic.php?id=50885 What's your PS1?]<br />
* http://www.tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html<br />
* http://www.shelluser.net/~giles/bashprompt/prompts/index.html</div>Ollbaphttps://wiki.archlinux.org/index.php?title=Broadcom_wireless&diff=92544Broadcom wireless2010-01-17T08:43:28Z<p>Ollbap: /* Interfaces swapped every time */</p>
<hr />
<div>[[Category:Communication and network (English)]][[Category:HOWTOs (English)]]<br />
{{i18n_links_start}}<br />
{{i18n_entry|English|Broadcom_BCM4312}}<br />
{{i18n_entry|简体中文|broadcom_BCM4312 (简体中文)}}<br />
{{i18n_links_end}}<br />
= Introduction =<br />
<br />
{{Note | Although this wiki entry is titled 4312, the driver is useful for many other Broadcom cards.}}<br />
<br />
Finally Broadcom has released a linux driver for most of its wireless chipsets. See the [http://ubuntuforums.org/showthread.php?t=914697 Ubuntu forums] and the [http://forums.debian.net/viewtopic.php?p=174719&sid=801a8f97aa7112c8c1c4f9294ad5d3e9 Debian forums]. It seems to work with all modern 43xx Broadcom cards. Up until recently the only way to get some of these working, such as 4328, was via [[ndiswrapper|ndiswrapper]]. Broadcom chipsets are used in most Dell laptops, among others.<br />
<br />
Unfortunately, the driver does not work with hidden ESSID's.<br />
<br />
= Determine whether you actually have one of these cards =<br />
Here is a list of cards which work with this driver,<br />
<br />
<pre><br />
14e4:432b "Broadcom Corporation BCM4322 802.11a/b/g/n Wireless LAN Controller"<br />
14e4:4329 "Broadcom Corporation BCM43XG"<br />
14e4:4328 "Broadcom Corporation BCM4328 802.11a/b/g/n"<br />
14e4:4315 "Broadcom Corporation BCM4312 802.11b/g"<br />
14e4:4313 "Broadcom Corporation BCM4310 Ethernet Controller"<br />
14e4:4312 "Broadcom Corporation BCM4312 802.11a/b/g"<br />
14e4:4311 "Broadcom Corporation BCM4311 802.11b/g WLAN"<br />
14e4:432d<br />
14e4:432c<br />
14e4:432a<br />
</pre><br />
<br />
Type in console (mind the letter case)<br />
lspci | grep BCM43<br />
If you have some other Broadcom model you might try the [[Wireless#b43|b43]] driver.<br />
<br />
= Driver installation =<br />
== Get the driver == <br />
There's a PKGBUILD in [http://aur.archlinux.org/packages.php?ID=19514 AUR].<br />
Or, you can download the driver from [http://www.broadcom.com/support/802.11/linux_sta.php here],<br />
where you will also find a README file.<br />
<br />
== Load the kernel module ==<br />
Before loading the module, remove 'b43, or any other module you are using for your wireless card:<br />
# rmmod b43<br />
Load the module:<br />
# modprobe lib80211_crypt_tkip<br />
# modprobe wl<br />
# insmod /lib/modules/2.6.30-ARCH/kernel/drivers/net/wireless/wl.ko<br />
<br />
You might also need to generate modules.dep and map file again by:<br />
# depmod -a<br />
<br />
Now you can make the change permanent by including lib80211_crypt_tkip in your MODULES array in {{Filename|/etc/rc.conf}}.<br />
<br />
MODULES=(lib80211_crypt_tkip, ...<br />
<br />
Or if you installed module via AUR package you just need:<br />
# rmmod b43 # (or any other module you are using for your wireless card)<br />
# modprobe wl<br />
<br />
Now in iwconfig you should see a wireless device (for example eth1). You might need to restart your computer to see the device in iwconfig.<br />
<br />
To make the module load at boot just add in {{Filename|[[rc.conf]]}}:<br />
MODULES=(lib80211_crypt_tkip wl !b43 !ssb ...<br />
By blacklisting the 'b43' and 'ssb' modules, you will prevent the kernel from autoloading them instead of the desired modules.<br />
<br />
==Note on using multiple Broadcom kernel modules==<br />
<br />
In my Dell Inspiron Laptop, i have a Broadcom BCM4401 Ethernet card and a Broadcom BCM4328 Wireless card. If I just remove b43, I can load the wl driver, but no wireless card shows up. However, if i first remove the b44 (and ssb) driver for my ethernet card, and then load the wl driver, I get a wireless eth0. Afterwards, I can load b44 again, to have an ethernet eth1.<br />
<br />
Short version:<br />
* Put "lib80211_crypt_tkip" and "wl" at the BEFORE b44 (if you have it) position in MODULES= in /etc/rc.conf<br />
* Don't forget to blacklist b43<br />
* Your wireless card will be eth0<br />
* Your ethernet card will be eth1<br />
* Both will work fine<br />
<br />
<br />
= Troubleshooting =<br />
== Interfaces swapped every time == <br />
This is a common problem with this driver. And the next process works for me with the BCM4312 following the [http://wiki.archlinux.org/index.php/Udev#Mixed_Up_Devices.2C_Sound.2FNetwork_Cards_Changing_Order_Each_Boot udev post]:<br />
<br />
Create a file called <code>/etc/udev/rules.d/10-network.rules</code> and bind the MAC address of each of your cards to a certain interface name<br />
<br />
<pre>SUBSYSTEM=="net", ATTR{address}=="aa:bb:cc:dd:ee:ff", NAME="eth0"<br />
SUBSYSTEM=="net", ATTR{address}=="ff:ee:dd:cc:bb:aa", NAME="eth1"</pre><br />
<br />
'''Where:'''<br />
* NAME="eth0" is the name of the interface that you want, for example the same name "eth0". You can use other names, for example "lan0" for eth0 or "wlan0" for eth1. <br />
* To get the MAC address of each card, use this command: <code>udevadm info -a -p /sys/class/net/<yourdevice> | grep address</code>. Please, note that this is case sensitive and you must use '''lower-case'''.<br />
But first you need know if eth0 isn't eth1 or vice versa, you can perform a scan: <code>iwlist scan</code> <br />
So if eth0 is really eth1 then the MAC of eth1 is that of eth0.<br />
<br />
Don't forget to update your /etc/rc.conf and other configfiles using the old ethX notation!<br />
<br />
== Module wl does not work after a kernel upgrade ==<br />
This is because the driver is compiled with the current kernel, you need recompile the driver with the new kernel for the module to function properly. Bear this in mind when doing kernel updates.<br />
<br />
== Device not showing up ==<br />
Be sure of trying "ifconfig -a", "ifconfig" only sometimes doesn't show all network interfaces.<br />
<br />
Here is one short script that helped me out, because I was loading modules incorrectly:<br />
<pre>#!/bin/bash<br />
<br />
rmmod b43 ssb wl lib80211_crypt_tkip lib80211<br />
<br />
modprobe lib80211_crypt_tkip<br />
modprobe wl<br />
<br />
depmod -a</pre><br />
<br />
This helped me when sometimes I couldn't get the interface to show up. Else, I recommend adding the modules at rc.conf:<br />
<pre>MODULES=([...] !b43 !ssb !lib80211 lib80211_crypt_tkip wl)</pre><br />
<br />
Worked for me in a Dell Latitude 2100 with Broadom BCM5764M (eth) and BCM4312 (wifi).</div>Ollbap