Difference between revisions of "Tips And Tricks"

From Trinity Desktop Project Wiki
Jump to navigation Jump to search
imported>Michele Calgaro
(Initial creation. tdesudo TnT)
 
m (→‎Application tricks: Make Kate commands table collapsed by default)
 
(47 intermediate revisions by 8 users not shown)
Line 1: Line 1:
  +
This page is meant as a container of tips and tricks collected over time, addressing topics and issues brought up by TDE users.<noinclude>
[[Category:Documentation]]
 
[[Category:TipsAndTricks]]
 
   
  +
Also see the users' [[User FAQ | Frequently Asked Questions]] page.
This page is meant as a container of tips and tricks collected over time, addressing topics and issues brought up by TDE users.
 
   
  +
='''sudo and tdesudo'''=
 
  +
__TOC__
If you use sudo or a sudo-based distribution (such as Ubuntu), it is highly recommended that you install the tdesudo-trinity package as well. This allows to run programs that require root priviledge from the TDE menu using your own password.
 
  +
If tdesudo-trinity is not installed, you will be asked for the root password instead.
 
  +
More details can be found [http://bugs.pearsoncomputing.net/show_bug.cgi?id=2563 here]
 
  +
<!-- ---------------------------------------- -->
  +
== Installing Trinity ==
  +
Tips and tricks relevant to obtaining a well-functioning Trinity installation.
  +
  +
=== Upgrading from older versions or KDE3 ===
  +
  +
==== Upgrading from KDE3 or from TDE 3.5.x to R14.0.x ====
  +
If you are migrating from KDE3 or upgrading from TDE 3.5.x, you can reuse your own settings in TDE R14.0.x.
  +
When logging into R14.0.x for the first time, TDE will automatically execute a script which will migrate as many of your KDE3/TDE3.5.x settings as possible. At the end of the process, your KDE3/TDE3.5.x profile will still exist (unchanged) and a new TDE profile will have been created inside the <tt>'''~/.trinity'''</tt> folder.
  +
  +
{{TipBox
  +
|caption=Note
  +
|text=Please refrain from renaming your <tt>.kde</tt> into <tt>.trinity</tt> before running R14.0.x. If you do so, the migration process will not take part and some applications may not run smoothly after that. See [http://bugs.pearsoncomputing.net/show_bug.cgi?id=2356 here] for an example of problems that may arise if you rename your <tt>.kde</tt> folder manually.
  +
}}
  +
  +
==== Upgrading from an old version (pre Dec/2014) ====
  +
Depending on your previous version of TDE, the file /etc/trinity/tdm/tdmrc may change from a script-generated file to a config file.
  +
It is advisable to accept the newer file if you are upgrading from an old version to TDE >= R14.0.0.
  +
  +
  +
<!-- ---------------------------------------- -->
  +
== Configuring Trinity ==
  +
Tips and tricks for custom fine-tuning and configurations.
  +
  +
=== Using sudo and tdesudo ===
  +
If you use sudo or a sudo-based distribution (such as Ubuntu), it is highly recommended that you install the <tt>tdesudo-trinity</tt> package as well. This allows to run programs that require root priviledge from the TDE menu using your own password.
  +
If <tt>tdesudo-trinity</tt> is not installed, you will be asked for the root password instead.
  +
More details can be found [http://bugs.pearsoncomputing.net/show_bug.cgi?id=2563 here].
  +
  +
=== Un-Bogging down an older system ===
  +
Your system runs pretty well until Firefox, an office application, or some other application with high CPU usage demands too many cycles and your system then ‘freezes’ for seconds or minutes until the application gets finished.
  +
  +
A simple, but somewhat tedious, solution is to add <code>nice</code> to the launcher for each. Using LibreOffice as an example, add <code>nice -n 2</code> before the command:
  +
  +
<code>TDE Menu >> Office >> LibreOffice >> {right click} >> Edit Item</code>
  +
  +
Change the ‘Command’ entry from <code>libreoffice %U</code> to <code>nice -n 2 libreoffice %U</code>.
  +
  +
Then find every other entry for LibreOffice (LibreOffice Base, LibreOffice Draw, LibreOffice Math, LibreOffice Impress, etc.) and do the same.
  +
  +
Other ‘usual suspects’ to make nice are: browsers, BitTorrent clients, GUI Diff tools, and, occasionally, PDF viewers.
  +
  +
Generally anything ‘real-time’ you should leave alone (movies, games, editors).
  +
  +
These were used on a Core2 Duo (P7570 @ 2.26GHz, CPU Mark: 926):
  +
  +
{| class="wikitable" style="text-align: center;"
  +
!Nice level
  +
!Application Name
  +
|-
  +
|1
  +
|Kmail
  +
|-
  +
|2
  +
|LibreOffice
  +
|-
  +
|3
  +
|Firefox
  +
|-
  +
|4
  +
|qBittorrent
  +
|-
  +
|}
  +
  +
=== Assigning a mouse click as part of a keyboard shortcut ===
  +
There are multiple ways to accomplish this. The best arguably was the first method, which has been lost to time.
  +
  +
In these examples we are trying to achieve:
  +
  +
<code>{Windows Key} + {left mouse click} = Minimize application under mouse cursor</code>
  +
  +
Change what you need to achieve what you want.
  +
  +
==== Method 1: Lost ====
  +
  +
As the name says it’s been lost. What is remembered is that:
  +
  +
* No additional software had to be installed
  +
* The change was exceedingly minor.
  +
  +
==== Method 2: <tt>xbindkeys</tt> + <tt>xdotool</tt> ====
  +
  +
Buggy. This works, but the <tt>xdotool</tt> command used occasionally leaves an unfinished half-keystroke hanging.
  +
  +
'''Step 1.''' Go to:
  +
  +
<code>Trinity Control Center >> Regional & Accessibility >> Keyboard Shortcuts >> Shortcuts Schemes >> Global Shortcuts >> Windows</code>
  +
  +
Set "Minimize Window" to “Win+Space”.
  +
  +
'''Step 2.''' Issue these command(s) as root or using sudo:
  +
  +
<syntaxhighlight lang="shell-session">
  +
# apt-get install xbindkeys
  +
# apt-get install xdotool
  +
# apt-get install xbindkeys-config # optional
  +
</syntaxhighlight>
  +
  +
'''Step 3.''' Edit <tt>$HOME/.xbindkeysrc</tt>.
  +
  +
Add the following lines:
  +
  +
<!-- 'shell' is probably the closest match(?) -->
  +
<syntaxhighlight lang="shell">
  +
#MinimizeWindowUnderMouse
  +
"xdotool click --clearmodifiers 1 key super+space"
  +
m:0x40 + c:133 + b:1 + release</nowiki>
  +
</syntaxhighlight>
  +
  +
{{Box
  +
|caption=Note
  +
|text=xbindkeys does not like superfluous comments within its definitions. Leaving prior entries commented out within the config definition caused odd and inconsistent results.
  +
|icon=Messagebox_info.png
  +
|background=#E9F0FF
  +
|highlight=#93B2FF
  +
}}
  +
  +
'''Step 4.''' Issue these commands as yourself (not as root):
  +
  +
<syntaxhighlight lang="shell-session">
  +
$ killall xbindkeys
  +
$ xbindkeys
  +
</syntaxhighlight>
  +
  +
'''Step 5.''' To minimize any window:
  +
  +
Move the cursor over a window, hold down the Windows key and click the left mouse button.
  +
  +
==== Method 3: <tt>xbindkeys</tt>, <tt>dcop</tt> and/or <tt>gdbus</tt> ====
  +
  +
Basically the same as <tt>xbindkeys</tt> + <tt>xdotool</tt> but replacing <tt>xdotool</tt> with either a <tt>dcop</tt> or <tt>gdbus</tt> command. This is probably less ‘buggy’ than <tt>xdotool</tt>, but unfortunately the writer doesn’t understand enough about either to make this work.
  +
  +
=== Enabling image thumbnails in Konqueror for external devices opened via popup after plugging in ===
  +
  +
When an external device (e.g. USB flash drive) is plugged in, choosing "Open in New Window" in the TDE popup window will open the device under the <tt>system:/</tt> path prefix. Image thumbnail display is not enabled per default for this location type in Konqueror. To enable image thumbnails for <tt>system:/</tt> paths, adhere to the following:
  +
  +
# In Konqueror from the menubar select <code>Settings >> Configure Konqueror...</code>.
  +
# Select <code>Previews & Metadata</code> on the left.
  +
# Under <code>Local Protocols</code> tick the checkbox for <code>system</code>.
  +
# Press <code>Apply</code>.
  +
  +
<!-- ---------------------------------------- -->
  +
== Look and feel ==
  +
Tips and tricks concerning the appearance of Trinity desktop and applications.
  +
  +
=== Adding a separator between windows button in the title bar ===
  +
Open <code>TDE Control Center >> Appearance & Themes >> Window Decorations</code> and then select the <code>Buttons</code> tab.
  +
  +
In the middle of the screen there is a list of available buttons. Drag a separator (<code>--- spacer ---</code>) on the title bar of the sample window, between the buttons where you want to space to appear.
  +
  +
Check the preview in the bottom part of the window and modify again as required.
  +
  +
Confirm when done.
  +
  +
=== Enlarging Kicker taskbar buttons to only occupy a single row ===
  +
  +
When the configured Kicker panel size surpasses a certain pixel count, the taskbar will start getting segmented into multiple rows, leading to taskbar buttons being placed in a grid.
  +
To prevent this, the minimum height of taskbar buttons can be increased to enforce a single row of taskbar buttons.
  +
  +
To achieve this, you have to add the following line into section <tt>[General]</tt> in your <tt>$TDEHOME/share/config/ktaskbarrc</tt>:
  +
  +
<syntaxhighlight lang="ini">
  +
MinimumButtonHeight=38
  +
</syntaxhighlight>
  +
  +
Select a <tt>MinimumButtonHeight</tt> that matches the pixel size of the Kicker panel as configured in <code>Trinity Control Center >> Desktop >> Panels >> Arrangement</code> (when the size is set to "Custom").
  +
Restart the Kicker panel after changing the configuration line.
  +
  +
As an example, for a panel height of 38 pixels this adjustment can be done via Konsole (or another terminal emulator) in the following manner:
  +
  +
<syntaxhighlight lang="shell-session">
  +
$ kwriteconfig --file $TDEHOME/share/config/ktaskbarrc --group General --key MinimumButtonHeight 38
  +
$ dcop kicker kicker restart
  +
</syntaxhighlight>
  +
  +
Hint: you may also additionally set <code>MinimumButtonWidth</code> in the same group to control how much minimum horizontal space (in pixels) a single taskbar button should occupy on its own.
  +
  +
=== Removing captions from K-Menu ===
  +
You have to add the following line into section <tt>[menus]</tt> in your <tt>$TDEHOME/share/config/kickerrc</tt>:
  +
  +
<syntaxhighlight lang="ini">
  +
ShowMenuTitles=false
  +
</syntaxhighlight>
  +
  +
You also have to restart Kicker for the change to take effect.
  +
  +
The quickest way to do all of this is via Konsole (or another terminal emulator):
  +
  +
<syntaxhighlight lang="shell-session">
  +
$ kwriteconfig --file $TDEHOME/share/config/kickerrc --group menus --key ShowMenuTitles false
  +
$ dcop kicker kicker restart
  +
</syntaxhighlight>
  +
  +
=== Increasing icon size in K-Menu ===
  +
You have to add the following line into section <tt>[menus]</tt> in your <tt>$TDEHOME/share/config/kickerrc</tt>:
  +
  +
<syntaxhighlight lang="ini">
  +
MenuEntryHeight=22
  +
</syntaxhighlight>
  +
  +
You can adjust the number to any icon size you see fit. You have to restart Kicker for the change to take effect.
  +
  +
The quickest way to do all of this is via Konsole (or another terminal emulator):
  +
  +
<syntaxhighlight lang="shell-session">
  +
$ kwriteconfig --file $TDEHOME/share/config/kickerrc --group menus --key MenuEntryHeight 22
  +
$ dcop kicker kicker restart
  +
</syntaxhighlight>
  +
  +
=== Using a custom side image for classic K-Menu ===
  +
  +
''The following only applies to the classic K-Menu enabled by setting "TDE menu style" to "Trinity Classic" in the "Menus" section of <code>Trinity Control Center >> Desktop >> Panels</code>.''
  +
  +
# Create <code>$TDEHOME/share/apps/kicker/pics/</code> if it doesn't exist.
  +
# Place custom <code>kside.png</code> and <code>kside_tile.png</code> files into <code>$TDEHOME/share/apps/kicker/pics/</code>.
  +
# In <code>Trinity Control Center >> Desktop >> Panels</code> under "Menus" enable "Show side image".
  +
  +
<code>kside.png</code> is the side image itself, while <code>kside_tile.png</code> is the image that fills the space above the side image if the latter does not fully fit the menu.
  +
  +
Hint: you may find the default <tt>kside.png</tt> and <tt>kside_tile.png</tt> files within <tt>$TDEDIR/share/apps/kicker/pics/</tt>.
  +
  +
Changes to the image files will only apply when the Kicker gets restarted. To trigger this, you can use <code>dcop kicker kicker restart</code>.
  +
  +
=== Using a custom image for the logout prompt ===
  +
  +
# Create <code>$TDEHOME/share/apps/ksmserver/pics/</code> if it doesn't exist.
  +
# Place a custom <code>shutdownkonq.png</code> into <code>$TDEHOME/share/apps/ksmserver/pics/</code>.
  +
  +
Hint: you may find the default image within <tt>$TDEDIR/share/apps/ksmserver/pics/</tt>.
  +
  +
=== Use another window manager with TDE ===
  +
It is possible to use TDE with a different window manager than the one which comes by default. There are a lot of window managers out there, though, so TDE might not recognize their presence and thus not offer them as a choice in the Control Center. This is the case when you can use the advanced methods mentioned here to use TDE with another WM.
  +
  +
[[File:TDE+E16 thumb.png|thumb|link=File:TDE+E16.png|Trinity Desktop with E16 as window manager]]
  +
  +
==== Method 1: the easy way ====
  +
The easy way is, of course, to go to <code>TDE Control Center >> Desktop >> Window decorations</code>, switch to the Window Manager tab and then select your preferred window manager from the drop-down menu.
  +
  +
==== Method 2: autostart TDE components from WM ====
  +
You can autostart Trinity and the components you need if your window manager supports autostart. In this case the window manager is started first. An <tt>.xinitrc</tt> file can also do the trick.
  +
  +
Make sure your window manager executes the first command (and any of the other ones for other desktop components you might want to use). For a more-or-less complete TDE session use all of them:
  +
  +
{| class="wikitable"
  +
!Command
  +
!Description
  +
|-
  +
|<tt>starttde</tt>
  +
|''(required) Initializes required Trinity components.<span style="color:#FF0000">*</span>''
  +
|-
  +
|<tt>kicker &</tt>
  +
|''The Kicker panel.''
  +
|-
  +
|<tt>kdesktop --waitforkded &</tt>
  +
|''The Desktop.''
  +
|-
  +
|<tt>khotkeys &</tt>
  +
|''Keyboard shortcuts handler.''
  +
|}
  +
  +
<span style="color:#FF0000">''(* Trinity apps would do this anyway, but it's nice to have it ready for them.)''</span>
  +
  +
As for starting the WM itself, you can choose to use your window manager's session via your display manager.
  +
  +
Note that this is not considered a full TDE session and that your mileage may vary. For a better way of handling this see Method 2 below.
  +
  +
==== Method 3: using WM as part of a TDE session ====
  +
You can make TDE use your window manager instead of TWin by passing an environment variable to the <tt>starttde</tt> script. This variable is named <code>$TDEWM</code> and accepts the executable name (or full path) of your window manager. For example, to start TDE with Fluxbox as a window manager:
  +
  +
<syntaxhighlight lang="shell-session">
  +
$ TDEWM=fluxbox startx /opt/trinity/starttde # adjust to your system
  +
</syntaxhighlight>
  +
  +
{{Box
  +
|caption=Note
  +
|text=Due to a mistake, Trinity releases before R14.0.11 use the <code>$TWIN</code> variable instead.
  +
|icon=Messagebox_info.png
  +
|background=#E9F0FF
  +
|highlight=#93B2FF
  +
}}
  +
  +
  +
To make this permanent:
  +
  +
* If you use a <tt>.xinitrc</tt> file, then the only thing to do is to put the line there.
  +
* If you use a display manager, you'll need to create a script and an X session file.
  +
  +
Create a script like this one:
  +
  +
<syntaxhighlight lang="shell">
  +
#!/bin/sh
  +
export TDEWM=your_window_manager # for R14.0.11 and higher
  +
export TWIN=your_window_manager # for pre-R14.0.11 TDE versions
  +
exec starttde
  +
</syntaxhighlight>
  +
  +
Replace <code>your_window_manager</code> with the correct value. Save it and make it executable.
  +
  +
Then, create a .desktop file in <tt>/usr/share/xsessions</tt>, like this one:
  +
  +
<syntaxhighlight lang="ini">
  +
[Desktop Entry]
  +
Encoding=UTF-8
  +
Type=XSession
  +
Name=(Session name)
  +
Comment=(An optional session comment)
  +
Exec=/path/to/the/script/you/just/saved
  +
</syntaxhighlight>
  +
  +
Insert the values as needed. Save it and logout. From the sessions menu choose the session you just created. Login normally. TDE should start with the window manager of your choice.
  +
  +
=== Changing alternating row colors ===
  +
Alternating row colors in Konqueror, KMail, and probably a lot more, can be set in the Colors section of Trinity Control Center:
  +
<code>TCC >> Appearance & Themes >> Colors >> Widget Color >> [Dropdown] Alternate Background in Lists</code>
  +
  +
  +
<!-- ---------------------------------------- -->
  +
== Application tricks ==
  +
Tips and tricks concerning Trinity applications (such as KMail, Kopete, Amarok etc.)
  +
  +
=== Kmail: Sanitize and Decrypt E-Mails ===
  +
[[Kmail_Sanitize_and_Decrypt_Mails|Kmail Sanitize and Decrypt Mails]] shows an example on how to create a filter in kmail that removes unwanted headers and automaticly decrypts incomming mails.
  +
  +
=== Kate: Using the built-in command line ===
  +
You can quickly apply some special settings to an open file without leaving your keyboard, by using the built-in command line in any application that uses the Kate editing part (e.g. Kate itself, KWrite, TDevelop). Press F7 to open it. It will show as a single text field below the document. When you enter a command, it will automatically offer completions, so no need to worry if you are not sure about a command's name (or sometimes even arguments!). Also, the prompt preserves the history of previous successful command runs, which can be navigated using Up/Down movement keys.
  +
  +
You can apply one command per time, the syntax is <code>COMMAND [ARGUMENTS...]</code>. You can set the values for all the variables that you can set through the modeline comment prefixed with "set-" (see the relevant section in the Kate documentation if unsure).
  +
  +
For example, to automatically replace tabs with spaces you can enter: <code>set-replace-tabs true</code>.
  +
To set tab width to 4 spaces: <code>set-tab-width 4</code>.
  +
To change the highlighting to Python: <code>set-highlighting Python</code>.
  +
  +
Of course, the built-in command line also comes with some more advanced commands. External tools and plugins can also add their own commands! You can get a full list of available commands by running <code>help list</code> and get help related to a command by running <code>help <command></code>.
  +
  +
See the table below for some useful commands:
  +
{|class="wikitable mw-collapsible mw-collapsed" style="width: 100%"
  +
!Command
  +
!Arguments
  +
!Description
  +
|-
  +
|help
  +
|[command]
  +
|Show a help message in a tooltip. If no argument is provided, shows a generic help message on using the command line. If the special argument <code>list</code> is specified, lists all available commands. If a command name is provided, tries to find help information related to that command.
  +
|-
  +
|char
  +
|hex, octal or base 9+1
  +
|Inserts a Unicode or ASCII character based on its numeric value (e.g. 0x1234, x1234, 01231, 1234).
  +
|-
  +
|date
  +
|[format string]
  +
|Inserts current date according to the specified format string. If invalid, the default (<code>yyyy-MM-dd hh:mm:ss</code>) is used instead.
  +
|-
  +
|find
  +
|[:[bcerpsw]] string
  +
|Finds the first occurrence of <code>string</code> in the document. Modifiers can be specified after the command by appending a ":", e.g. <code>find:se hello</code>. The meaning of the modifiers is: '''b''' for searching backwards, '''c''' for searching from the current cursor position, '''e''' for searching only inside the selection, '''r''' for evaluating <code>string</code> as a regular expression, '''p''' for showing a prompt each time an occurrence of <code>string</code> is about to be replaced (<code>replace</code> command only), '''s''' makes search case-sensitive and '''w''' makes search look for whole words only, not substrings.
  +
|-
  +
|ifind
  +
|[:[bcrs]] string
  +
|Finds the first occurrence of <code>string</code> interactively. It performs the search again each time a key is pressed.
  +
|-
  +
|replace
  +
|[:[bcerpsw]] string [replacement]
  +
|Replaces all occurrences of <code>string</code> with <code>replacement</code>. If <code>replacement</code> is omitted, it is assumed to be an empty string. For explanation of the modifiers see the description of <code>find</code>.
  +
|-
  +
|indent
  +
|NONE
  +
|Indent current line or selection by one tab stop
  +
|-
  +
|unindent
  +
|NONE
  +
|Unindent current line or selection by one tab stop
  +
|-
  +
|cleanindent
  +
|NONE
  +
|Reset identation of current line or selection
  +
|-
  +
|comment
  +
|NONE
  +
|Comment current line or selection
  +
|-
  +
|uncomment
  +
|NONE
  +
|Uncomment current line or selection
  +
|-
  +
|kill-line
  +
|NONE
  +
|Kills current line, regardless of selection.
  +
|-
  +
|set-indent-mode
  +
|number > 0
  +
|Sets the current indentation mode
  +
|-
  +
|set-highlight
  +
|string
  +
|Set highlighting mode for the current document
  +
|-
  +
|set-tab-width
  +
|number > 0
  +
|Set tab width to <code>number</code> spaces.
  +
|-
  +
|set-indent-width
  +
|number > 0
  +
|Set indentation width to <code>number</code>.
  +
|-
  +
|set-word-wrap-column
  +
|number > 0
  +
|Set column on which word wrapping should occur.
  +
|-
  +
|goto
  +
|number > 0
  +
|Go to line <code>number</code>.
  +
|-
  +
|set-icon-border
  +
|boolean
  +
|Whether to show icon border
  +
|-
  +
|set-folding-markers
  +
|boolean
  +
|Whether to show folding markers
  +
|-
  +
|set-line-numbers
  +
|boolean
  +
|Whether to show line numbers
  +
|-
  +
|set-show-indent
  +
|boolean
  +
|Whether to show indent lines
  +
|-
  +
|set-replace-tabs
  +
|boolean
  +
|Whether to replace tabs with spaces
  +
|-
  +
|set-remove-trailing-space
  +
|boolean
  +
|Whether to automatically remove trailing whitespaces.
  +
|-
  +
|set-remove-trailing-space-save
  +
|boolean
  +
|Whether to remove trailing whitespaces on saving.
  +
|-
  +
|set-show-tabs
  +
|boolean
  +
|Whether to show tab characters. Has no effect on space characters.
  +
|-
  +
|set-indent-spaces
  +
|boolean
  +
|Whether to use spaces instead of tabs for indentation.
  +
|-
  +
|set-mixed-indent
  +
|boolean
  +
|If enabled, enables <code>space-indent</code> and, if <code>indent-width</code> is zero, sets it to <code>tab-width / 2</code>.
  +
|-
  +
|set-word-wrap
  +
|boolean
  +
|Whether to enable word wrapping.
  +
|-
  +
|set-wrap-cursor
  +
|boolean
  +
|Whether the cursor wraps with the text or can assume arbitrary positions in the document. Lines are automatically compensated with the needed spaces.
  +
|-
  +
|run-myself
  +
|NONE
  +
|Execute the current document's text in the built-in Javascript interpreter
  +
|}
  +
  +
Sed-like expressions are also accepted, e.g.:
  +
<code>s/afternoon/abend/g</code>
  +
  +
== Useful scripts ==
  +
A collection of snippets and useful scripts which can help in automating some tasks in TDE.
  +
  +
=== Lock session and turn off screen ===
  +
This shell script locks the session and after 3 seconds turns the screen off:
  +
  +
<syntaxhighlight lang="bash">
  +
#!/bin/bash
  +
dcop kdesktop KScreensaverIface lock
  +
sleep 3
  +
xset dpms force standby
  +
</syntaxhighlight>
  +
  +
For a ‘GUI’ you can add an Applet to your Panel that calls the shell script.
  +
  +
=== Log out of current TDE session ===
  +
  +
You can log out of the current TDE session and possibly shut down the system automatically (depending on your TDE configuration) using this command:
  +
  +
<syntaxhighlight lang="shell-session">
  +
$ dcop kdesktop default logout <confirm> <type> <mode>
  +
</syntaxhighlight>
  +
  +
You can append three parameters ("confirm", "type", "mode") to determine the
  +
logout behaviour according to the following values:
  +
  +
  +
'''First parameter: "confirm"'''
  +
{| class="wikitable" width="600px"
  +
|-
  +
! Value
  +
! Explanation
  +
|-
  +
| -1
  +
| ''Obey the user's confirmation setting''
  +
|-
  +
| 0
  +
| ''Don't confirm, shutdown without asking''
  +
|-
  +
| 1
  +
| ''Always confirm, ask even if the user turned it off''
  +
|}
  +
  +
  +
'''Second parameter: "type"'''
  +
{| class="wikitable" width="600px"
  +
|-
  +
! Value
  +
! Explanation
  +
|-
  +
| -1
  +
| Select previous action or the default if it's the first time
  +
|-
  +
| 0
  +
| Only log out
  +
|-
  +
| 1
  +
| Log out and reboot the machine
  +
|-
  +
| 2
  +
| Log out and halt the machine
  +
|}
  +
  +
  +
'''Third parameter: "mode"'''
  +
{| class="wikitable" width="600px"
  +
|-
  +
! Value
  +
! Explanation
  +
|-
  +
| -1
  +
| Select previous mode (or the default one, if it's the first time)
  +
|-
  +
| 0
  +
| Schedule a shutdown (halt or reboot) for the time all active sessions have exited
  +
|-
  +
| 1
  +
| Shut down, if no sessions are active. Otherwise do nothing
  +
|-
  +
| 2
  +
| Force shutdown. Kill any possibly active sessions
  +
|-
  +
| 3
  +
| Pop up a dialog asking the user what to do if sessions are still active
  +
|}
  +
  +
  +
'''Full stop example'''
  +
  +
This command will log out and halt the machine, killing any sessions and will never prompt the user:
  +
  +
<syntaxhighlight lang="shell-session">
  +
$ dcop ksmserver default logout 0 2 2
  +
</syntaxhighlight>
  +
  +
=== Hide suspension related buttons from the shutdown dialog ===
  +
There is currently no GUI option for this, but it can be achieved by a simple configuration script.<br/>
  +
Create the file '~/.trinity/share/config/power-managerrc' and put the
  +
following two lines inside:
  +
  +
<syntaxhighlight lang="bash">
  +
disableSuspend=true
  +
disableHibernate=true
  +
</syntaxhighlight>
  +
  +
The next time the shutdown dialog is displayed, only the Logout, Shutdown and Restart buttons will be shown.<br/>
  +
Freeze, Suspend, Hybrid suspend, Hibernate buttons will not be displayed.
  +
  +
== Troubleshooting ==
  +
  +
=== Error: TDE mediamanager is not running ===
  +
You might encounter this error if you try to run KDesktop, Konqueror or any other TDE application that tries to access storage media outside of a standard TDE session (e.g. from a window manager session).
  +
  +
To solve this, add the following lines to your window manager's autostart script:
  +
<syntaxhighlight lang="shell">
  +
tdeinit
  +
dcop kded kded loadModule mediamanager
  +
</syntaxhighlight>
  +
  +
=== Unable to change display brightness with NVidia cards ===
  +
If you are unable to change the display brightness, the problem could be the nvidia driver in use.
  +
The following tip works for some users and it is worth a try.
  +
  +
In <tt>/etc/default/grub</tt> add <code>acpi_backlight=vendor</code> and/or <code>nvidia.NVreg_EnableBacklightHandler=1</code> to
  +
the variable <tt>GRUB_CMDLINE_LINUX_DEFAULT</tt> and reboot. Then controlling the display brightness using TDE
  +
and multimedia (or Fn combination) keys should/may work.
  +
  +
Example:
  +
  +
<syntaxhighlight lang="shell">
  +
GRUB_CMDLINE_LINUX_DEFAULT="quiet nvidia.NVreg_EnableBacklightHandler=1 acpi_backlight=vendor"
  +
</syntaxhighlight>
  +
  +
=== Unable to find mime type application/octet-stream ===
  +
This error can occur due to a known bug with the TDE MIME system.
  +
  +
There are two known methods to fix this:
  +
  +
==== Method 1: Graphical ====
  +
# Go to <code>TDE Control Centre > TDE Components > File Associations</code>
  +
# Click on the <code>Add...</code> button at the bottom
  +
# Select the <code>application</code> group from the drop-down menu
  +
# In the name field type: <tt>octet-stream</tt>
  +
# Click OK to close the dialog
  +
# Apply the settings
  +
  +
==== Method 2: Via CLI ====
  +
<syntaxhighlight lang="shell-session">
  +
$ cat > ~/.trinity/share/mimelnk/application/octet-stream.desktop << EOF
  +
[Desktop Entry]
  +
Comment=octet-stream
  +
Hidden=false
  +
Icon=
  +
MimeType=application/octet-stream
  +
Patterns=
  +
Type=MimeType
  +
EOF
  +
</syntaxhighlight>
  +
  +
= See also =
  +
* [http://web.archive.org/web/20060924164505/http://wiki.kde.org/tiki-index.php?page=Tips+and+Tricks Tips and Tricks on the old KDE TikiWiki]
  +
* [http://web.archive.org/web/20060924165408/http://wiki.kde.org/tiki-index.php?page=Performance+Tips KDE3 Performance Tips on the old KDE TikiWiki]
  +
* [http://web.archive.org/web/20060924164932/http://wiki.kde.org/tiki-index.php?page=Secret+Config+Settings Secret config settings on the old KDE TikiWiki]
  +
  +
[[Category:Documentation]]
  +
[[Category:Community]]
  +
[[Category:TipsAndTricks]]
  +
</noinclude>

Latest revision as of 20:30, 15 August 2024

This page is meant as a container of tips and tricks collected over time, addressing topics and issues brought up by TDE users.

Also see the users' Frequently Asked Questions page.



Installing Trinity

Tips and tricks relevant to obtaining a well-functioning Trinity installation.

Upgrading from older versions or KDE3

Upgrading from KDE3 or from TDE 3.5.x to R14.0.x

If you are migrating from KDE3 or upgrading from TDE 3.5.x, you can reuse your own settings in TDE R14.0.x. When logging into R14.0.x for the first time, TDE will automatically execute a script which will migrate as many of your KDE3/TDE3.5.x settings as possible. At the end of the process, your KDE3/TDE3.5.x profile will still exist (unchanged) and a new TDE profile will have been created inside the ~/.trinity folder.

Messagebox info.png
Note
Please refrain from renaming your .kde into .trinity before running R14.0.x. If you do so, the migration process will not take part and some applications may not run smoothly after that. See here for an example of problems that may arise if you rename your .kde folder manually.

Upgrading from an old version (pre Dec/2014)

Depending on your previous version of TDE, the file /etc/trinity/tdm/tdmrc may change from a script-generated file to a config file. It is advisable to accept the newer file if you are upgrading from an old version to TDE >= R14.0.0.


Configuring Trinity

Tips and tricks for custom fine-tuning and configurations.

Using sudo and tdesudo

If you use sudo or a sudo-based distribution (such as Ubuntu), it is highly recommended that you install the tdesudo-trinity package as well. This allows to run programs that require root priviledge from the TDE menu using your own password. If tdesudo-trinity is not installed, you will be asked for the root password instead. More details can be found here.

Un-Bogging down an older system

Your system runs pretty well until Firefox, an office application, or some other application with high CPU usage demands too many cycles and your system then ‘freezes’ for seconds or minutes until the application gets finished.

A simple, but somewhat tedious, solution is to add nice to the launcher for each. Using LibreOffice as an example, add nice -n 2 before the command:

TDE Menu >> Office >> LibreOffice >> {right click} >> Edit Item

Change the ‘Command’ entry from libreoffice %U to nice -n 2 libreoffice %U.

Then find every other entry for LibreOffice (LibreOffice Base, LibreOffice Draw, LibreOffice Math, LibreOffice Impress, etc.) and do the same.

Other ‘usual suspects’ to make nice are: browsers, BitTorrent clients, GUI Diff tools, and, occasionally, PDF viewers.

Generally anything ‘real-time’ you should leave alone (movies, games, editors).

These were used on a Core2 Duo (P7570 @ 2.26GHz, CPU Mark: 926):

Nice level Application Name
1 Kmail
2 LibreOffice
3 Firefox
4 qBittorrent

Assigning a mouse click as part of a keyboard shortcut

There are multiple ways to accomplish this. The best arguably was the first method, which has been lost to time.

In these examples we are trying to achieve:

{Windows Key} + {left mouse click} = Minimize application under mouse cursor

Change what you need to achieve what you want.

Method 1: Lost

As the name says it’s been lost. What is remembered is that:

  • No additional software had to be installed
  • The change was exceedingly minor.

Method 2: xbindkeys + xdotool

Buggy. This works, but the xdotool command used occasionally leaves an unfinished half-keystroke hanging.

Step 1. Go to:

Trinity Control Center >> Regional & Accessibility >> Keyboard Shortcuts >> Shortcuts Schemes >> Global Shortcuts >> Windows

Set "Minimize Window" to “Win+Space”.

Step 2. Issue these command(s) as root or using sudo:

# apt-get install xbindkeys
# apt-get install xdotool
# apt-get install xbindkeys-config # optional

Step 3. Edit $HOME/.xbindkeysrc.

Add the following lines:

#MinimizeWindowUnderMouse
"xdotool click --clearmodifiers 1 key super+space"
   m:0x40 + c:133 + b:1 + release</nowiki>
Messagebox info.png
Note
xbindkeys does not like superfluous comments within its definitions. Leaving prior entries commented out within the config definition caused odd and inconsistent results.

Step 4. Issue these commands as yourself (not as root):

$ killall xbindkeys
$ xbindkeys

Step 5. To minimize any window:

Move the cursor over a window, hold down the Windows key and click the left mouse button.

Method 3: xbindkeys, dcop and/or gdbus

Basically the same as xbindkeys + xdotool but replacing xdotool with either a dcop or gdbus command. This is probably less ‘buggy’ than xdotool, but unfortunately the writer doesn’t understand enough about either to make this work.

Enabling image thumbnails in Konqueror for external devices opened via popup after plugging in

When an external device (e.g. USB flash drive) is plugged in, choosing "Open in New Window" in the TDE popup window will open the device under the system:/ path prefix. Image thumbnail display is not enabled per default for this location type in Konqueror. To enable image thumbnails for system:/ paths, adhere to the following:

  1. In Konqueror from the menubar select Settings >> Configure Konqueror....
  2. Select Previews & Metadata on the left.
  3. Under Local Protocols tick the checkbox for system.
  4. Press Apply.

Look and feel

Tips and tricks concerning the appearance of Trinity desktop and applications.

Adding a separator between windows button in the title bar

Open TDE Control Center >> Appearance & Themes >> Window Decorations and then select the Buttons tab.

In the middle of the screen there is a list of available buttons. Drag a separator (--- spacer ---) on the title bar of the sample window, between the buttons where you want to space to appear.

Check the preview in the bottom part of the window and modify again as required.

Confirm when done.

Enlarging Kicker taskbar buttons to only occupy a single row

When the configured Kicker panel size surpasses a certain pixel count, the taskbar will start getting segmented into multiple rows, leading to taskbar buttons being placed in a grid. To prevent this, the minimum height of taskbar buttons can be increased to enforce a single row of taskbar buttons.

To achieve this, you have to add the following line into section [General] in your $TDEHOME/share/config/ktaskbarrc:

MinimumButtonHeight=38

Select a MinimumButtonHeight that matches the pixel size of the Kicker panel as configured in Trinity Control Center >> Desktop >> Panels >> Arrangement (when the size is set to "Custom"). Restart the Kicker panel after changing the configuration line.

As an example, for a panel height of 38 pixels this adjustment can be done via Konsole (or another terminal emulator) in the following manner:

$ kwriteconfig --file $TDEHOME/share/config/ktaskbarrc --group General --key MinimumButtonHeight 38
$ dcop kicker kicker restart

Hint: you may also additionally set MinimumButtonWidth in the same group to control how much minimum horizontal space (in pixels) a single taskbar button should occupy on its own.

Removing captions from K-Menu

You have to add the following line into section [menus] in your $TDEHOME/share/config/kickerrc:

ShowMenuTitles=false

You also have to restart Kicker for the change to take effect.

The quickest way to do all of this is via Konsole (or another terminal emulator):

$ kwriteconfig --file $TDEHOME/share/config/kickerrc --group menus --key ShowMenuTitles false
$ dcop kicker kicker restart

Increasing icon size in K-Menu

You have to add the following line into section [menus] in your $TDEHOME/share/config/kickerrc:

MenuEntryHeight=22

You can adjust the number to any icon size you see fit. You have to restart Kicker for the change to take effect.

The quickest way to do all of this is via Konsole (or another terminal emulator):

$ kwriteconfig --file $TDEHOME/share/config/kickerrc --group menus --key MenuEntryHeight 22
$ dcop kicker kicker restart

Using a custom side image for classic K-Menu

The following only applies to the classic K-Menu enabled by setting "TDE menu style" to "Trinity Classic" in the "Menus" section of Trinity Control Center >> Desktop >> Panels.

  1. Create $TDEHOME/share/apps/kicker/pics/ if it doesn't exist.
  2. Place custom kside.png and kside_tile.png files into $TDEHOME/share/apps/kicker/pics/.
  3. In Trinity Control Center >> Desktop >> Panels under "Menus" enable "Show side image".

kside.png is the side image itself, while kside_tile.png is the image that fills the space above the side image if the latter does not fully fit the menu.

Hint: you may find the default kside.png and kside_tile.png files within $TDEDIR/share/apps/kicker/pics/.

Changes to the image files will only apply when the Kicker gets restarted. To trigger this, you can use dcop kicker kicker restart.

Using a custom image for the logout prompt

  1. Create $TDEHOME/share/apps/ksmserver/pics/ if it doesn't exist.
  2. Place a custom shutdownkonq.png into $TDEHOME/share/apps/ksmserver/pics/.

Hint: you may find the default image within $TDEDIR/share/apps/ksmserver/pics/.

Use another window manager with TDE

It is possible to use TDE with a different window manager than the one which comes by default. There are a lot of window managers out there, though, so TDE might not recognize their presence and thus not offer them as a choice in the Control Center. This is the case when you can use the advanced methods mentioned here to use TDE with another WM.

Trinity Desktop with E16 as window manager

Method 1: the easy way

The easy way is, of course, to go to TDE Control Center >> Desktop >> Window decorations, switch to the Window Manager tab and then select your preferred window manager from the drop-down menu.

Method 2: autostart TDE components from WM

You can autostart Trinity and the components you need if your window manager supports autostart. In this case the window manager is started first. An .xinitrc file can also do the trick.

Make sure your window manager executes the first command (and any of the other ones for other desktop components you might want to use). For a more-or-less complete TDE session use all of them:

Command Description
starttde (required) Initializes required Trinity components.*
kicker & The Kicker panel.
kdesktop --waitforkded & The Desktop.
khotkeys & Keyboard shortcuts handler.

(* Trinity apps would do this anyway, but it's nice to have it ready for them.)

As for starting the WM itself, you can choose to use your window manager's session via your display manager.

Note that this is not considered a full TDE session and that your mileage may vary. For a better way of handling this see Method 2 below.

Method 3: using WM as part of a TDE session

You can make TDE use your window manager instead of TWin by passing an environment variable to the starttde script. This variable is named $TDEWM and accepts the executable name (or full path) of your window manager. For example, to start TDE with Fluxbox as a window manager:

$ TDEWM=fluxbox startx /opt/trinity/starttde # adjust to your system
Messagebox info.png
Note
Due to a mistake, Trinity releases before R14.0.11 use the $TWIN variable instead.


To make this permanent:

  • If you use a .xinitrc file, then the only thing to do is to put the line there.
  • If you use a display manager, you'll need to create a script and an X session file.

Create a script like this one:

#!/bin/sh
export TDEWM=your_window_manager # for R14.0.11 and higher
export TWIN=your_window_manager  # for pre-R14.0.11 TDE versions
exec starttde

Replace your_window_manager with the correct value. Save it and make it executable.

Then, create a .desktop file in /usr/share/xsessions, like this one:

[Desktop Entry]
Encoding=UTF-8
Type=XSession
Name=(Session name)
Comment=(An optional session comment)
Exec=/path/to/the/script/you/just/saved

Insert the values as needed. Save it and logout. From the sessions menu choose the session you just created. Login normally. TDE should start with the window manager of your choice.

Changing alternating row colors

Alternating row colors in Konqueror, KMail, and probably a lot more, can be set in the Colors section of Trinity Control Center: TCC >> Appearance & Themes >> Colors >> Widget Color >> [Dropdown] Alternate Background in Lists


Application tricks

Tips and tricks concerning Trinity applications (such as KMail, Kopete, Amarok etc.)

Kmail: Sanitize and Decrypt E-Mails

Kmail Sanitize and Decrypt Mails shows an example on how to create a filter in kmail that removes unwanted headers and automaticly decrypts incomming mails.

Kate: Using the built-in command line

You can quickly apply some special settings to an open file without leaving your keyboard, by using the built-in command line in any application that uses the Kate editing part (e.g. Kate itself, KWrite, TDevelop). Press F7 to open it. It will show as a single text field below the document. When you enter a command, it will automatically offer completions, so no need to worry if you are not sure about a command's name (or sometimes even arguments!). Also, the prompt preserves the history of previous successful command runs, which can be navigated using Up/Down movement keys.

You can apply one command per time, the syntax is COMMAND [ARGUMENTS...]. You can set the values for all the variables that you can set through the modeline comment prefixed with "set-" (see the relevant section in the Kate documentation if unsure).

For example, to automatically replace tabs with spaces you can enter: set-replace-tabs true. To set tab width to 4 spaces: set-tab-width 4. To change the highlighting to Python: set-highlighting Python.

Of course, the built-in command line also comes with some more advanced commands. External tools and plugins can also add their own commands! You can get a full list of available commands by running help list and get help related to a command by running help <command>.

See the table below for some useful commands:

Command Arguments Description
help [command] Show a help message in a tooltip. If no argument is provided, shows a generic help message on using the command line. If the special argument list is specified, lists all available commands. If a command name is provided, tries to find help information related to that command.
char hex, octal or base 9+1 Inserts a Unicode or ASCII character based on its numeric value (e.g. 0x1234, x1234, 01231, 1234).
date [format string] Inserts current date according to the specified format string. If invalid, the default (yyyy-MM-dd hh:mm:ss) is used instead.
find [:[bcerpsw]] string Finds the first occurrence of string in the document. Modifiers can be specified after the command by appending a ":", e.g. find:se hello. The meaning of the modifiers is: b for searching backwards, c for searching from the current cursor position, e for searching only inside the selection, r for evaluating string as a regular expression, p for showing a prompt each time an occurrence of string is about to be replaced (replace command only), s makes search case-sensitive and w makes search look for whole words only, not substrings.
ifind [:[bcrs]] string Finds the first occurrence of string interactively. It performs the search again each time a key is pressed.
replace [:[bcerpsw]] string [replacement] Replaces all occurrences of string with replacement. If replacement is omitted, it is assumed to be an empty string. For explanation of the modifiers see the description of find.
indent NONE Indent current line or selection by one tab stop
unindent NONE Unindent current line or selection by one tab stop
cleanindent NONE Reset identation of current line or selection
comment NONE Comment current line or selection
uncomment NONE Uncomment current line or selection
kill-line NONE Kills current line, regardless of selection.
set-indent-mode number > 0 Sets the current indentation mode
set-highlight string Set highlighting mode for the current document
set-tab-width number > 0 Set tab width to number spaces.
set-indent-width number > 0 Set indentation width to number.
set-word-wrap-column number > 0 Set column on which word wrapping should occur.
goto number > 0 Go to line number.
set-icon-border boolean Whether to show icon border
set-folding-markers boolean Whether to show folding markers
set-line-numbers boolean Whether to show line numbers
set-show-indent boolean Whether to show indent lines
set-replace-tabs boolean Whether to replace tabs with spaces
set-remove-trailing-space boolean Whether to automatically remove trailing whitespaces.
set-remove-trailing-space-save boolean Whether to remove trailing whitespaces on saving.
set-show-tabs boolean Whether to show tab characters. Has no effect on space characters.
set-indent-spaces boolean Whether to use spaces instead of tabs for indentation.
set-mixed-indent boolean If enabled, enables space-indent and, if indent-width is zero, sets it to tab-width / 2.
set-word-wrap boolean Whether to enable word wrapping.
set-wrap-cursor boolean Whether the cursor wraps with the text or can assume arbitrary positions in the document. Lines are automatically compensated with the needed spaces.
run-myself NONE Execute the current document's text in the built-in Javascript interpreter

Sed-like expressions are also accepted, e.g.: s/afternoon/abend/g

Useful scripts

A collection of snippets and useful scripts which can help in automating some tasks in TDE.

Lock session and turn off screen

This shell script locks the session and after 3 seconds turns the screen off:

#!/bin/bash
dcop kdesktop KScreensaverIface lock
sleep 3
xset dpms force standby

For a ‘GUI’ you can add an Applet to your Panel that calls the shell script.

Log out of current TDE session

You can log out of the current TDE session and possibly shut down the system automatically (depending on your TDE configuration) using this command:

$ dcop kdesktop default logout <confirm> <type> <mode>

You can append three parameters ("confirm", "type", "mode") to determine the logout behaviour according to the following values:


First parameter: "confirm"

Value Explanation
-1 Obey the user's confirmation setting
0 Don't confirm, shutdown without asking
1 Always confirm, ask even if the user turned it off


Second parameter: "type"

Value Explanation
-1 Select previous action or the default if it's the first time
0 Only log out
1 Log out and reboot the machine
2 Log out and halt the machine


Third parameter: "mode"

Value Explanation
-1 Select previous mode (or the default one, if it's the first time)
0 Schedule a shutdown (halt or reboot) for the time all active sessions have exited
1 Shut down, if no sessions are active. Otherwise do nothing
2 Force shutdown. Kill any possibly active sessions
3 Pop up a dialog asking the user what to do if sessions are still active


Full stop example

This command will log out and halt the machine, killing any sessions and will never prompt the user:

$ dcop ksmserver default logout 0 2 2

Hide suspension related buttons from the shutdown dialog

There is currently no GUI option for this, but it can be achieved by a simple configuration script.
Create the file '~/.trinity/share/config/power-managerrc' and put the following two lines inside:

disableSuspend=true
disableHibernate=true

The next time the shutdown dialog is displayed, only the Logout, Shutdown and Restart buttons will be shown.
Freeze, Suspend, Hybrid suspend, Hibernate buttons will not be displayed.

Troubleshooting

Error: TDE mediamanager is not running

You might encounter this error if you try to run KDesktop, Konqueror or any other TDE application that tries to access storage media outside of a standard TDE session (e.g. from a window manager session).

To solve this, add the following lines to your window manager's autostart script:

tdeinit
dcop kded kded loadModule mediamanager

Unable to change display brightness with NVidia cards

If you are unable to change the display brightness, the problem could be the nvidia driver in use. The following tip works for some users and it is worth a try.

In /etc/default/grub add acpi_backlight=vendor and/or nvidia.NVreg_EnableBacklightHandler=1 to the variable GRUB_CMDLINE_LINUX_DEFAULT and reboot. Then controlling the display brightness using TDE and multimedia (or Fn combination) keys should/may work.

Example:

GRUB_CMDLINE_LINUX_DEFAULT="quiet nvidia.NVreg_EnableBacklightHandler=1 acpi_backlight=vendor"

Unable to find mime type application/octet-stream

This error can occur due to a known bug with the TDE MIME system.

There are two known methods to fix this:

Method 1: Graphical

  1. Go to TDE Control Centre > TDE Components > File Associations
  2. Click on the Add... button at the bottom
  3. Select the application group from the drop-down menu
  4. In the name field type: octet-stream
  5. Click OK to close the dialog
  6. Apply the settings

Method 2: Via CLI

$ cat > ~/.trinity/share/mimelnk/application/octet-stream.desktop << EOF
[Desktop Entry]
Comment=octet-stream
Hidden=false
Icon=
MimeType=application/octet-stream
Patterns=
Type=MimeType
EOF

See also