Linux and Unix Look And Feel How To

How to make a local application appear in plank

Create a local link in /home/user/.local/share/applications/appname.desktop
With the following contents:

[Desktop Entry]
Comment=
Exec=/home/user/Programs/appname/appname.py
Icon=/home/user/Programs/appname/icons/appname48.svg
Name=Awesom App
NoDisplay=false
Path[$e]=$HOME/Programs/appname
StartupNotify=true
Terminal=0
TerminalOptions=
Type=Application
X-KDE-SubstituteUID=false
X-KDE-Username=
StartupWMClass=appname.py


How to change theme size in Firefox and Thunderbird manually

In configuration change layout.css.devPixelsPerPx from default -1.0 to something like 1.3

To access configuration:
Firefox: type about:config in the url line
In Thunderbird go Preferences-> Advanced -> Config Editor


How to download all available wallpapers from apt-get stores

List
aptitutde -w 200 search wallpaper > list
Download .deb packages
aptitude download $(awk {print $2} list)
Unpack
for f in *.deb; do dpkg -x $f .; done

How to make Logitech MX Master side wheel work on linux

Get xbindkeys package. Create default config with
xbindkeys -d > ~/.xbindkeysrc

Map the wheel, which is simply a repetitive button trigger, to the left and right cursor buttons. Add the following to .xbindkeysrc

#horizontal scroll right
"xte 'key Right'"
    b:6
#horizontal scroll left
"xte 'key Left'"
    b:7

Set xbindkeys to run at login. On KDE open 'system settings', go to 'startup and shutdown' and add 'xbindkeys' application to the startup.

How to hide Firefox or other window title bar and still be able to resize it in KDE

  1. In System Settings open "Workplace Appearance"
  2. Select Oxygen (if not selected) and click "configure decoration..."
  3. Go to the "Window-Specific Overrides" tab
  4. Add main window override:
    1. Matching window property: Window Title
    2. Regural Expression to match: Mozilla Firefox
    3. Check Hide window title bar
  5. Add sub-windows override of the override
    1. Matching window property: Window Class Name
    2. Regural Expression to match: Firefox
    3. Make sure hide window title bar is not checked
    4. If you want check Background style and select Radial gradient and check Separator display and select Always Draw Separator
  6. Now add buttons to minimize, maximize and close Firefox in the customize toolbars interface of hte Firefox.

How to get current Xinerama setup information

xdpyinfo -ext XINERAMA | grep head

How to automatically apply keyboard mappings when a keyboard is plugged and unplugged

Especially useful for a MacBook Pro with an external PC style keyboard. First, create the mapping files per the following section. Then create the following two files in your code folders.

#!/bin/bash
sleep 1
DISPLAY=":0.0"
HOME=/home/user/
XAUTHORITY=$HOME/.Xauthority
export DISPLAY XAUTHORITY HOME
daskb_id=$(xinput -list | grep -i 'Microsoft.*keyboard' | grep -o id=[0-9]. | grep -o [0-9]. | head -1)
if [ "${daskb_id}" ]; then
        #  the deevice setting here does not work in ubuntu 12.04 for some reason. setxkbmap -device "${daskb_id}" -option altwin:swap_lalt_lwin
        $HOME/bin/keyboardTools/pc_kbd_layout
else
        $HOME/bin/keyboardTools/mac_kbd_layout
fi

And

#!/bin/bash
# use this screep to delay device detection until after completion of this script
/home/user/bin/keyboardTools/kbd_remapper &

Then run lsusb and get the vendor and the product code for you keyboard. Create the /etc/udev/rules.d/60-external-keyboard.rules file with the following contents

ACTION=="add", SUBSYSTEM=="input", ATTRS{idVendor}=="''first_code_here''", ATTRS{idProduct}=="''second_code_here''", RUN+="/home/user/bin/keyboardTools/kbd_udev"
ACTION=="remove", SUBSYSTEM=="input", ATTRS{idVendor}=="''first_code_here''", ATTRS{idProduct}=="''second_code_here''", RUN+="/home/user/bin/keyboardTools/kbd_udev"

Restart udev

sudo service udev restart 

Test and enjoy.


How to move Docky to a different display

gconf-editor /apps/docky-2/Docky/Interface/DockPreferences/Dock1

set MonitorNumber to 1 or 2 or 3 etc according to where you want it to go. While you are there set FadeOnHide to true, it will look nicer Restart Docky

How to add BSOD and ElectricSheep screensavers to KDE

First, get them from the repo. For Kubuntu it is

sudo aptitude install xscreensaver-screensaver-bsod electricsheep

Then put the following two files into /usr/share/kde4/services/ScreenSavers/

[Desktop Entry]
Encoding=UTF-8
Exec=/usr/lib/xscreensaver/bsod -root
Icon=kscreensaver
Type=Service
X-KDE-ServiceTypes=ScreenSaver
Actions=InWindow;Root;Setup;
X-KDE-Category=Fractals
Name=BSOD

[Desktop Action Setup]
Exec=kxsconfig bsod
Name=Setup...

[Desktop Action InWindow]
Exec=/usr/lib/xscreensaver/bsod -window-id %w
Name=Display in specified window
NoDisplay=true

[Desktop Action Root]
Exec=/usr/lib/xscreensaver/bsod -root
Name=Display in root window
NoDisplay=true

And

[Desktop Entry]
Encoding=UTF-8
Exec=electricsheep
Icon=kscreensaver
Type=Service
X-KDE-ServiceTypes=ScreenSaver
Actions=InWindow;Root;Setup;
X-KDE-Category=Fractals
Name=ElectricSheep

[Desktop Action Setup]
Exec=electricsheep-preferences
Name=Setup...

[Desktop Action InWindow]
Exec=electricsheep -window-id %w
Name=Display in specified window
NoDisplay=true

[Desktop Action Root]
Exec=electricsheep -window-id %w
Name=Display in root window
NoDisplay=true

You will see the new screeensavers under "Fractals" in the display section of the systemssettings tool.

How to speed up KDE

Tested and proven to work on Lucid Kubuntu with the backport of KDE 4.5.3.

  1. Get all the prereqs for the compilation:

sudo aptitude install build-essential cmake kdebase-workspace-dev


Get the source code for the KCM Qt Graphics System

  1. Unpack it to a folder. Start a terminal session, cd to the folder and dance the usual dance:

cmake -DCMAKE_INSTALL_PREFIX=/usr
make
sudo make install


Now wait a minute and open KDE system settings

  1. You should see "QT Graphics System" under "System Administration". Open it.
  2. Pick "Raster", click apply and restart your KDE session. Enjoy.
    • You can pick "OpenGL" if you are feeling adventurous. It did not work on T61 with Nvidia mobile.

For a video tutorial on this look here.

How to change font for the content of views in Eclipse

For some mysterious reason you can not do it in the Eclipse's UI via Window -> Preferences -> Appearance. You have to change the GTK theme Eclipse uses:

Create a gtkrc file (like: ~/.gtkrc-eclipse) with following content:

style "eclipse" {
       font_name = "Sans Serif 8"
}
class "GtkWidget" style "eclipse"

Then start your eclipse with the augmented GTK theme:

env GTK2_RC_FILES=/usr/share/themes/Clearlooks/gtk-2.0/gtkrc:/home/user/.gtkrc-eclipse '/opt/eclipse-3.3/eclipse'

How to change appearance of Gnome (GTK) apps when run as root under KDE

Copy your GTK-settings into the /root-directory. Note that the "-kde4" is missing in the root-folder.

sudo cp ~/.gtkrc-2.0-kde4 /root/.gtkrc-2.0

How to change opacity of a title bar in Gnome

gconf-editor

Navigate to apps/gwd in the GNOME Configuration Editor. These are the two values you need to change:

metacity_theme_active_opacity - (Transparently on active window’s title.)
metacity_theme_opacity - (Transparently on inactive windows’ titles.)

1 - no, 0 - full

How to switch from kscreensaver to xscreensaver

1: Turn off KDE's screen saver. Open the Control Center and select the Appearance & Themes / Screensaver page. Un-check Start Automatically. 2: Find your Autostart directory. Open the System Administration -> Paths page, and see what your Autostart path'' is set to: it will probably be ~/.kde/Autostart/ or something similar. 3: Make xscreensaver be an Autostart program. Create a .desktop file in your autostart directory called xscreensaver.desktop that contains the following five lines:


[Desktop Entry]
Exec=xscreensaver
Name=XScreenSaver
Type=Application
X-KDE-StartupNotify=false

4: Make the various "lock session" buttons call xscreensaver. Replace the file kdesktop_lock or krunner_lock or kscreenlocker in /usr/bin/ (or possibly in /usr/kde/3.5/bin/ or possibly in /usr/lib/kde4/libexec/ or /usr/libexec/kde4/, depending on the distro and phase of the moon) with these two lines:


#!/bin/sh
xscreensaver-command -lock

Make sure the file is executable (chmod a+x).

How to switch from gnome-screensaver to xscreensaver

1: Turn off gnome-screensaver. Open System / Preferences / Screensaver'' and uncheck both boxes. 2: Stop gnome-screensaver from launching at login.

gconftool-2 --type boolean -s /apps/gnome_settings_daemon/screensaver/start_screensaver false

Or, just uninstall the "gnome-screensaver" package entirely. 3: Launch xscreensaver at login. Open System / Preferences / Sessions / Startup Programs. Click Add and type xscreensaver''. 4: Tell Preferences to use the xscreensaver configurator. Edit /usr/share/applications/gnome-screensaver-preferences.desktop and change the Exec= line to say

Exec=xscreensaver-demo 

5: Make System / Quit / Lock Screen'' use xscreensaver. Backup gnome-screensaver-command first, as the following command will overwrite it

sudo ln -sf /usr/bin/xscreensaver-command /usr/bin/gnome-screensaver-command

How to make GTK apps look nice in KDE

sudo aptitude install kde-config-gtk qtcurve gtk-engines-qtcurve
in the app looks - gkt apps, set theme to qtcurve

How to enable or disable KDE compositing from the command line

export DISPLAY=:0.0
qdbus org.kde.kwin /KWin org.kde.KWin.toggleCompositing

How to add another resolution mode and set it in KDE after wake up from sleep

Sometimes KDE forgets the mode, or messes up resolutions on wake up. Here is how to fix it, from an example of DFP1 as the output device and the 3840x1200 being the problematic mode.

  • Set up the screens to work properly using "display" system setting.
  • Get the xrandr command line that it stores the settings in from the top of ~/.kde/share/config/krandrrc
  • Get the active resolution mode
xrandr -q | grep +
  • Convert the settings into a modeline using Coordinated Video Timings (CVT)
cvt 3840 1200 59.9
For reference: you could also try conversion using Generalized Timing Formula (GTF), which was a standard used before CVT
gtf 3840 1200 59.9
  • Create a bash script, based on the collected information:
#!/bin/bash

devconnected=$(xrandr -q | grep "DFP1 connected" > /dev/null ; echo $?)
if [ $devconnected == '0' ] ; then
  # Add the mode from the modeline
  xrandr --newmode "3840x1200_59.90"  385.67  3840 4096 4512 5184  1200 1201 1204 1242  -HSync +Vsync
  xrandr --addmode DFP1 "3840x1200_59.90"
  # Your xrandr commands from krandrrc here:
  xrandr --output LVDS --pos 3840x0 --mode 1680x1050 --refresh 59.8833
  xrandr --output DFP1 --pos 0x0 --mode 3840x1200 --refresh 59.8785
  xrandr --output DFP1 --primary
  # restart plasma (bug #260360, may not be necessary in the latest KDE)
  killall plasma-desktop
  sleep 2
  plasma-desktop &

fi

  • Now do the sleep/wake cycle or break your screen some other way, so it's missing needed resolution mode. Run the script with DFP1 as the argument to make sure it works. If you still experience issues sure that the new mode can fit within the maximum framebuffer size
xrandr | grep maximum
  • Add the script to be run when KDE starts using system-settings.


@HowTo @LinuxandUnix