Jul 02

Control VLC Media Player through D-Bus

By Xeross Posted in How-To's, Linux, Tech Leave a Comment

I recently switched back to VLC from MPD/MPC because VLC seems to play more formats and is easier to use/set-up. However I did want to keep my global keybindings, considering I couldn’t find an option in VLC to enable them and knowing that it has a D-Bus interface I decided to figure out how it works.

After some research I found out that VLC adheres to the Media Player Remote Interfacing Specification” (or MPRIS for short) for its D-BUS commands, which can be found here. To use it you can use the command line utility to send D-Bus messages dbus-send for example:

dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Stop

Which returns.

method return sender=:1.50 -> dest=:1.143 reply_serial=2

And stops the audio output.

The spec lists all the available commands however as I’ll only be using the org.mpris.MediaPlayer2.Player.* commands I made a simple wrapper script:

#!/bin/sh

# Simple proxy script to interface with VLC over DBUS
# Available commands can be found at http://specifications.freedesktop.org/mpris-spec/latest/Player_Node.html

dbus-send --print-reply --session --dest=org.mpris.MediaPlayer2.vlc /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.$1

Now I can simply call vlc-proxy <command> to control VLC.

References:

Aug 23

Customized Zenburn Palette For gnome-terminal

By Xeross Posted in Linux, Tech Comments (1)

I’ve recently switched to using Zenburn for Vim, and I like it a lot. Though I also wanted my terminal to match, so after some searching I found this palette setting for gnome-terminal.

However the colours didn’t match with the original colours, for example what used to be green ended up being the same colour as regular text.

So I’ve made some modifications and you can use the following palette setting to get a more ‘compatible’ Zenburn palette.

#3F3F3F3F3F3F:#CCCC93939393:#7F7F9F9F7F7F:#E3E3CECEABAB:#DFDFAFAF8F8F:#CCCC93939393:#8C8CD0D0D3D3:#DCDCDCDCCCCC:#3F3F3F3F3F3F:#CCCC93939393:#7F7F9F9F7F7F:#E3E3CECEABAB:#DFDFAFAF8F8F:#CCCC93939393:#8C8CD0D0D3D3:#DCDCDCDCCCCC

To apply it follow the instructions from the thread (Mirrored below in the case the link goes dead).

  1. Make sure that your menu bar is showing. If it is not, right click on the terminal window and select “Show menubar”.
  2. In the Edit menu, select “Profiles…”
  3. Create a new profile with whatever name you like.
  4. In your terminal, start the program “gconf-editor”.
  5. Navigate to “/apps/gnome-terminal/profiles/” and then to whatever you called the profile. If it does not show up with name, it might be called something like “Profile0″. If the latter is the case for you, check the “visible_name” property, which should match your chosen name.
  6. Double click on the “palette” property.
  7. Remove the current contents, and paste the above color palette string
  8. Close everything related to gconf-editor.
  9. Switch to the profile you selected via the Terminal’s Edit menu, and (if you want) change it to the default profile in Edit -> “Profiles…”.

Colour Preview

Tagged with:
Jul 27

Specify (Envelope) From address with mailx

By Xeross Posted in How-To's, Linux, SysAdmin, Tech Comments (2)

As I was setting up my Icinga install today I needed to modify the notification command so it had a specific from address, and it was using mailx.

So off I go onto google, etc. most of the answers said you could do something like:

mailx [args] [email protected] -- <sendmail options>

Turns out that that syntax doesn’t exist in the versions nowadays, luckily it turns out to be quite easy:

mailx [args] -S from="Name <[email protected]>"

Of course you can also only specify an email for the from parameter.

Anyway, hope this was helpful.

~Xeross

Tagged with:
Mar 12

Can’t change time/date on Xen guests

By Xeross Posted in How-To's, Linux, Tech Comments (3)

So I’ve encountered this problem with my VPS on 2host, for some reason the current time was 15 minutes behind the actual time the NTP servers were reporting.

I had NTPd running and everything but for some reason I couldn’t change the system clock in any way, it would just stay the same.

Luckily someone on the InspIRCd support channel mentioned a sysctl setting that would enable me to change the clock.

All you need to do is add

xen.independent_wallclock=1

To /etc/sysctl.conf and then reload sysctl.conf with “sysctl -p”

Something you also might need to do is append jiffies to the current clock source

echo "jiffies" >> /sys/devices/system/clocksource/clocksource0/current_clocksource

Credits/thanks go to linuxwave for the actual commands/info.