My home network has NFS homedirs, and so it doesn't matter which computer or laptop family members log into. They get all their files.
Now, one of the PC's has a 40 inch monitor, and users prefer a text-scaling-factor of 2 when using that PC.
Changing their personal settings means changing it back again; fortunately a system-wide default of 2 can be set on that PC, and apply to all users that don't override the system value.
Edit the text-scaling-factor in the schema:
sudo nano /usr/share/glib-2.0/schemas/org.gnome.desktop.interface.gschema.xml
and rebuild the schema:
sudo glib-compile-schemas /usr/share/glib-2.0/schemas
[from http://askubuntu.com/a/470253]
And then to reset the users custom value (if any):
gsettings reset org.gnome.desktop.interface text-scaling-factor
[from http://askubuntu.com/questions/60044/how-do-i-change-the-font-dpi-settings]
But doing the same for org.cinnamon.desktop as I do for org.gnome.desktop
text-scaling-factor
scaling-factor
cursor-size
Also default-zoom-level to larger and default-use-tighter-layouts to true, in /usr/share/glib-2.0/schemas/org.nemo.gschema.xml
Showing posts with label mint. Show all posts
Showing posts with label mint. Show all posts
Wednesday, 27 January 2016
Thursday, 7 January 2016
Switch hdmi audio when TV is off using cec-client
I have a HDMI TV used as a computer monitor.
When the TV is turned on, the audio plays through the TV, so that the TV remote volume control works.
When the TV is turned off, I want the audio to play through analog audio out so that I can still hear it.
I use the PulseEIGHT CEC controller and cec-client program to talk to the TV.
I have cec-client run as root under SOCAT to broadcast cec-data by UDP.
I have another SOCAT process running as the logged in user to pick up the data, monitor it for TV on/off status and move the playing audio streams.
It works, but is very rough.
In rc.local: /usr/local/bin/cec -s &
In gnome/cinnamon startup programs: /usr/local/bin/cec
And then the script:
When the TV is turned on, the audio plays through the TV, so that the TV remote volume control works.
When the TV is turned off, I want the audio to play through analog audio out so that I can still hear it.
I use the PulseEIGHT CEC controller and cec-client program to talk to the TV.
I have cec-client run as root under SOCAT to broadcast cec-data by UDP.
I have another SOCAT process running as the logged in user to pick up the data, monitor it for TV on/off status and move the playing audio streams.
It works, but is very rough.
In rc.local: /usr/local/bin/cec -s &
In gnome/cinnamon startup programs: /usr/local/bin/cec
And then the script:
#! /bin/bash
MYADDR=8 # because it is. I should probably read this from the cec-client output
# 0 and 1 and the audio device indexes associated with the device names
# later I will normalise these too, but "pacmd list" will show yours.
ext() {
pacmd set-default-sink alsa_output.pci-0000_00_1f.3.analog-stereo
for input in $( pacmd list-sink-inputs | sed -e 's/index: //;t;d' )
do pacmd move-sink-input $input 1
done
}
hdmi() {
pacmd set-default-sink alsa_output.pci-0000_01_00.1.hdmi-stereo-extra1
for input in $( pacmd list-sink-inputs | sed -e 's/index: //;t;d' )
do pacmd move-sink-input $input 0
done
}
cec_client() {
socat -u UDP4-RECV:4224,reuseaddr - | while read type _ _ dir rest
do # echo "$type $dir :$rest"
case "$rest" in
"0f:36") echo "POWER OFF" ; ext ;;
"(0): power status changed"*"to 'on'") echo "POWER ON" ; hdmi ;;
# *"($MYADDR) as inactive source"*) echo INACTIVE ; ext ;;
# *"($MYADDR) the active source"*) echo ACTIVATED ; hdmi ;;
# *active*) echo "$type $dir $rest" ;;
# mmkeys-mate2mpris2
esac
done
}
cec_server() {
read hostname _ < <( hostname )
hex_hostname=$( echo -n "${hostname%.*}" | od -tx1 | sed -e '1!d;s/0* //' )
<<< "tx 80 47 $hex_hostname" exec -a CEC socat -u -L/tmp/cec \
EXEC:'cec-client -t p -p 2' UDP-DATAGRAM:127.0.0.1:4224,broadcast &
wait
}
main() {
if test "$1" = "-s"
then cec_server
else cec_client
fi
}
main "$@"Friday, 26 September 2014
shell-shocked: Updaing bash on Linux Mint Olivia
shell-shocked: Updaing bash on Linux Mint Olivia
I've go some old laptops running Linux Mint, Olivia release, based on Ubuntu Raring Ringtail which is not a long term support, and so no ready fix is available.The bug is shown with this test
rm -f echo ; env X='() { (a)=>\' bash -c "echo date"; cat echo
bash: X: line 1: syntax error near unexpected token `='
bash: X: line 1: `'
bash: error importing function definition for `X'
Fri Sep 26 09:37:44 BST 2014
which wrongly creates a file called echo holding the output of the date command.Here is what is required to fix the bash shell-shocked bug.
1. Update the no-longer supported repositories to the new location:
(You should already have done this).You first need to make sure you have src-deb repositories enabled:
cd /etc/apt/sources.list.d/ test -r official-source-repositories.list || cp official-package-repositories.list official-source-repositories.list && sed -i -e 's/raring/trusty/g;s/^deb /^deb-src/' official-source-repositories.listAnd then update the server to old-releases:
sed -i -e 's/archive.ubuntu.com\|security.ubuntu.com/old-releases.ubuntu.com/g' official-package-repositories.list apt-get update
2. Install all updates for your system anyway
apt-get update apt-get upgrade
3. Build bash from the trusty sources
apt-get build-essential bash apt-get -b source bash
4. Install bash
dpkg -i bash*deb
5. Test the fix
# rm -f echo ; env X='() { (a)=>\' bash -c "echo date"; cat echo
bash: X: line 1: syntax error near unexpected token `='
bash: X: line 1: `'
bash: error importing function definition for `X'
date
cat: echo: No such file or directory
Tuesday, 26 August 2014
Google TV & Movies DRM on Mint/Ubuntu
Google Play Movies & TV works best under Chrome on Linux, but unless HTML5 is working for you, Flash is needed for playback and DRM Flash playback requires the long since deprecated HAL.
Fortunately an updated HAL is maintained for this purposes. The hal ppa is at:
https://launchpad.net/~mjblenner/+archive/ubuntu/ppa-hal
Most of these details are thanks to Justin Watt at askubuntu.com/questions/166760/how-do-i-play-movies-on-google-play who says:
Fortunately an updated HAL is maintained for this purposes. The hal ppa is at:
https://launchpad.net/~mjblenner/+archive/ubuntu/ppa-hal
Most of these details are thanks to Justin Watt at askubuntu.com/questions/166760/how-do-i-play-movies-on-google-play who says:
sudo add-apt-repository ppa:mjblenner/ppa-ha
sudo apt-get update
sudo apt-get install hal
cd ~/.adobe/Flash_Player
rm -rf NativeCache AssetCache APSPrivateData2
Wednesday, 19 March 2014
NFS/LDAP only at home
NOTE: This doesn't work reliable for only some users. It seems like nsswitch.conf needs faking earlier than that. A better answer might be to iptables-rst the ldap requests or something so that ldap fails quickly.
I have this pre-init script in /etc/init/autofs.conf
and these lines in my /etc/nsswitch.conf
When I'm on my home wireless network (detected by the access-point mac address, autofs will run to mount home directories, and ldap will be enabled and used to validate user accounts.
Otherwise it is a standalone laptop and will revert to built in accounts and home directories.
I have this pre-init script in /etc/init/autofs.conf
start on runlevel [2345] and net-device-up IFACE=wlan0 ... pre-start script modprobe -q autofs4 || true if iwconfig | grep 00:18:84:26:7E:1B then sed -e 's/ #ldap/ ldap/' /etc/nsswitch.conf > /var/tmp/nsswitch.conf && mount /var/tmp/nsswitch.conf /etc/nsswitch.conf -o bind else ! true fi end script
and these lines in my /etc/nsswitch.conf
passwd: compat #ldap group: compat #ldap shadow: compat #ldap
When I'm on my home wireless network (detected by the access-point mac address, autofs will run to mount home directories, and ldap will be enabled and used to validate user accounts.
Otherwise it is a standalone laptop and will revert to built in accounts and home directories.
Friday, 11 January 2013
Fix Charging on Acer ZG5
My Acer One ZG5 was not charging for the last year or so. I took it for repair to my local friendly and trusted Wizard Electronics but the chap there was too wise. Armed with the knowledge that it failed to charge two different batteries but yet would boot up under charger power he could conclude quite well that it was not the charger, the connector or the batteries and some troubleshooting on the system board was required. I already knew this of course which was why I took it to him; but he suggested it would be cheaper to replace the main board and a quick look at ebay prices for smashed screen netbooks showed that he was right.
However, to my surprise, while googling to find what the motherboard fault might be I found a clue that it might be (and was!) fixed with a BIOS update! http://www.acer.com/worldwide/support/download.htm and one version 3110 release later and I was charging both batteries again!
However, to my surprise, while googling to find what the motherboard fault might be I found a clue that it might be (and was!) fixed with a BIOS update! http://www.acer.com/worldwide/support/download.htm and one version 3110 release later and I was charging both batteries again!
Acer Aspire SD slots on bootup
My jmicron SD card slots not being recognized by Linux Mint unless a card was in the slot when booted. And there were two slots.
Tricks here http://ubuntuforums.org/showpost.php?p=10842957&postcount=62 that use
rebooting, and running:
Nothing else was required; no use of
early hacks
This post http://ubuntuforums.org/showpost.php?p=10842957&postcount=62 shows a way that works for me to re-scan and detect slots that now have a card in (although the card may need to be removed and re-inserted).
sudo echo 1 > /sys/bus/pci/rescan
Tricks here http://ubuntuforums.org/showpost.php?p=10842957&postcount=62 that use
setpci don't work for me, failing to select the device if it isn't already detected, or the pciehp driver which doesn't seem to be present on my installation.Success
I got auto-detection to work by following these tips https://bugs.launchpad.net/ubuntu/+source/linux/+bug/258446/comments/61 by adding the following files to/etc/modules
pciehp
acpiphp
jmb38x_ms
sdhci-pci
flash_bd
xd_card
jmb38x_xd
rebooting, and running:
update-initramfs -u so that those modules would be built in to the ramdisk; and then rebooting again.Nothing else was required; no use of
pciehp, no edit of /etc/default/grub.conf and no creation of files in /etc/modprobe.d/
Friday, 7 December 2012
Media Buttons on Mint 14 Nadia
Sadly keyboard multi-media control buttons still have no effect on Mint 14 when logged in using the Gnome2 fork Mate desktop.
Gladly, Matteo Italia has written a short python script to convert the DBUS events into MPRIS2 events.
http://pastebin.com/N0Jv2W5Y
Start the script on login and media keys work! Thanks Matteo
Gladly, Matteo Italia has written a short python script to convert the DBUS events into MPRIS2 events.
http://pastebin.com/N0Jv2W5Y
Start the script on login and media keys work! Thanks Matteo
#!/usr/bin/env python
'''Created on 30.05.2012
@author: Matteo Italia <mi_1@mitalia.net>'''
import dbusimport dbus.mainloop.glibimport gobject
app_name = 'mmkeys-mate2mpris2'Version=0.1
MediaKeysObjName = 'org.mate.SettingsDaemon'MediaKeysObjectPath = '/org/mate/SettingsDaemon/MediaKeys'MediaKeysInterface = 'org.mate.SettingsDaemon.MediaKeys'
MPRIS2Prefix = 'org.mpris.MediaPlayer2'
ActionMappings = { 'Play': 'PlayPause', 'Pause': 'Pause', 'Stop': 'Stop', 'Next': 'Next', 'Previous': 'Previous'}
def onMediaKeyPress(app_name, action): sb = dbus.SessionBus() # Get the compatible players players = [n for n in sb.list_names() if n.startswith(MPRIS2Prefix + ".") ]
# Send them the command for n in players: # TODO: it doesn't make sense to perform the action on *all* the players! # find a sensible criterion to choose the "best one" sb.get_object(n, '/org/mpris/MediaPlayer2').__getattr__(ActionMappings[action])()
if __name__ == '__main__':
# DBUS boilerplate dbus.mainloop.glib.DBusGMainLoop(set_as_default=True) sb = dbus.SessionBus()
# Get the media keys notificator object mediaKeysObj = sb.get_object(MediaKeysObjName, MediaKeysObjectPath)
# Register to receive media keys notifications mediaKeysObj.GrabMediaPlayerKeys(app_name, 0, dbus_interface=MediaKeysInterface) mediaKeysObj.connect_to_signal('MediaPlayerKeyPressed', onMediaKeyPress)
# Start the main loop mainLoop = gobject.MainLoop() mainLoop.run()
Subscribe to:
Posts (Atom)