Saturday, May 30, 2015
xdg-su not decorated with theme
LXDE on OpenSuse 13.2 uses xdg-su ass the GUI frontend to run applications using sudo. If it can't load gnomesu or kdesu then it presents a bland undecorated xterm window. This can be neatened by simply installing libgnomesu which is small with only 1 dependancy (it doesn't need a full gnome desktop!).
Install Screengrab for screenshots on OpenSuse
LXDE doesn't have a default screenshot grabber. Here's how to install Screengrab from source on OpenSuse 13.2:
Download the source code from:
A bug puts the libraries in the wrong location, we need to correct it:
Enjoy!
Download the source code from:
- http://screengrab.doomer.org/download/
- libqt4-devel
- gcc
- gcc-c++
- cmake
- cd ~/Downloads/Source/screengrab*
- mkdir build
- cd build
- cmake ../
- make
- sudo make install
A bug puts the libraries in the wrong location, we need to correct it:
- sudo mv /screengrab /usr/local/
- leafpad ~/.local/share/applications/screengrab.desktop
[Desktop Entry]
Name=Screengrab
Comment=Capture screenshots
GenericName=Screengrab
Exec=screengrab
Icon=screengrab
Terminal=false
StartupNotify=true
Type=Application
Categories=Graphics;
Enjoy!
Saturday, April 25, 2015
Remember screen brightness running Linux on MacBook
Running Sabayon Linux, with systemd, on a MacBook, the LCD backlight always resets to maximum brightness after reboot. This is an annoyance as it becomes necessary to adjust the brightness every time it is necessary to reboot the laptop.
To get the system to remember the brightness setting:
===============
Systemd service: /usr/lib/systemd/system/my-settings.service:
================
Enable the script and service:
To get the system to remember the brightness setting:
- Create a script that can save or restore the setting when called with a parameter.
- Create a (systemd) service that calls the script to save the setting on shutdown and restore the setting on startup.
#!/bin/sh
# Saves and restores settings for LCD and keyboard backlights.
if [ -z $1 ]; then
echo "Usage: my-settings.sh [save|restore]"
fi
# Set variables:
export LCD_BRIGHTNESS="/sys/devices/virtual/backlight/apple_backlight/brightness"
# Save setting:
case $1 in
"save")
echo Saving settings...
# if the settings folder does not exist, create it
if [ ! -e /etc/my-settings ]; then
mkdir /etc/my-settings
fi
# if the LCD_BRIGHTNESS file exists, then save a copy:
if [ -e $LCD_BRIGHTNESS ]; then
cat $LCD_BRIGHTNESS > /etc/my-settings/lcd
fi
;;
"restore")
# if saved setting exists, if LCD_BRIGHTNESS exists, echo the contents into the system device:
if [ -e /etc/my-settings/lcd ]; then
if [ -e $LCD_BRIGHTNESS ]; then
cat /etc/my-settings/lcd > $LCD_BRIGHTNESS
fi
fi
;;
esac
===============
Systemd service: /usr/lib/systemd/system/my-settings.service:
[Unit]
Description=Load/Save Keyboard & LCD backlight settings
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/bin/sh -c "/usr/local/bin/my-settings.sh restore"
ExecStop=/bin/sh -c "/usr/local/bin/my-settings.sh save"
[Install]
WantedBy=multi-user.target
================
Enable the script and service:
chmod +x /usr/local/bin/my-settings.sh
systemctl enable my-settings.service
systemctl start my-settings
Sunday, December 28, 2014
Monitor fans on HP Proliant ML150 G3 running Debian Lenny Linux
(This blog is in reference to a Debian Lenny AMD64 system)
hp-health is the package that is supposed to provide access to the fan status on HP Proliant servers. It is not easy to install hp-health on Debian Lenny. The ISO can be located by searching the HP website.
On my system the existence of 2 files for UPS monitoring software Winpower causes ldconfig error messages:
Having VMware Server 2 installed confuses the hp-health init script (/etc/init.d/hp-health), which is designed to have different behaviour for ESX servers. Applying an exit workaround in the procedure causes the script to appear to behave correctly, but the daemon fails to start.
Uninstallation of hp-health is also fraught with difficulty. It is necessary to alter the exit code on the init script just to get the script to continue with removal. The script will fail to remove /opt/hp/hp-health (and will attempt to remove /opt !). If you need to manually change the installation status you will need to edit /var/lib/dpkg/status to remove the hp-health section.
After doing all the work above it was found that ipmitool could easily be installed:
hp-health is the package that is supposed to provide access to the fan status on HP Proliant servers. It is not easy to install hp-health on Debian Lenny. The ISO can be located by searching the HP website.
On my system the existence of 2 files for UPS monitoring software Winpower causes ldconfig error messages:
- /usr/lib/libjspTru64Alpha.so
- /usr/lib/libjspAixPpc.so
Having VMware Server 2 installed confuses the hp-health init script (/etc/init.d/hp-health), which is designed to have different behaviour for ESX servers. Applying an exit workaround in the procedure causes the script to appear to behave correctly, but the daemon fails to start.
Uninstallation of hp-health is also fraught with difficulty. It is necessary to alter the exit code on the init script just to get the script to continue with removal. The script will fail to remove /opt/hp/hp-health (and will attempt to remove /opt !). If you need to manually change the installation status you will need to edit /var/lib/dpkg/status to remove the hp-health section.
After doing all the work above it was found that ipmitool could easily be installed:
apt-get install ipmitoolAnd the fan RPM's are shown with:
modprobe ipmi_msghandler
modprobe ipmi_devintf
modprobe ipmi_si
ipmitool sdr type fan(it takes a few seconds to probe).
Wednesday, August 13, 2014
Automate PDF printing from batch file command line
Adobe Reader is not suitable for printing PDF files using a batch file because it remains open after the print is done and there is no simple, safe & reliable mechanism to close it. Instead use Ghostscript commandline as shown below:
gswin32c -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=1 "C:\test.pdf"
*Must be a recent version of Ghostscript, e.g. 9.x
gswin32c -dPrinted -dBATCH -dNOPAUSE -dNOSAFER -q -dNumCopies=1 "C:\test.pdf"
*Must be a recent version of Ghostscript, e.g. 9.x
Sunday, August 3, 2014
GParted does not start in LXQt
Symptom: Clicking on GParted launcher has no effect. Log /var/log/messages shows:
The value for environment variable TERM contains suscipious content ...The cause was having set the TERM variable using LXQt Session Settings, Default Applications, Terminal Emulation to /usr/bin/lxterm. Changing back to xterm and logging out-in fixed the issue.
Sunday, June 15, 2014
Compiling a specific commit from Git
cd /usr/local/src
git clone [ProjectX]
cd [ProjectX]
git checkout [commit checksum from Github]
mkdir build
cd build
cmake ..
make
sudo make install
To return to the master version:
...
git checkout master
...
git clone [ProjectX]
cd [ProjectX]
git checkout [commit checksum from Github]
mkdir build
cd build
cmake ..
make
sudo make install
To return to the master version:
...
git checkout master
...
Subscribe to:
Posts (Atom)