Friday, November 30, 2012

Arbitrary screen capture in KDE


A nice post at floatingsun, explains how to get screen capture functionality in KDE similar to what you get with the Compiz screenshot plugin. Basically you set up shortcut and have it run the previously unknown to me application
kbackgroundsnapshot -region 

If you copy and paste from the linked website you will need to replace the hyphen with a "minus sign". Anyway, this command lets you select any screen region and puts a .png on your desktop.

In arch I had to install the kdegraphics-ksnapshot package.

It also locked up on me when I tried to press escape to exit without selecting anything, I had to CTRL+ALT+F1 and kill it from command line.

But that's one of the key things I've been missing from Compiz.

Monday, November 26, 2012

Sorting "find" results by date

I have been meaning to look this up for a while now. Sometimes I save a file, but I'm not sure in which folder. I use "ls -ltrh" all the time to sort contents of a folder by reverse time so the most recently modified items appear at the bottom (very useful example is ls -ltrh /var/log to find most recently modified log files).

The following command will use the results of  the find command to do the same thing over multiple folders. Its too complex to type all the time, so I put it in a script in my personal script folder. Another good idea would be to alias it.


    find . -type f -printf '%T@ %p\n' | sort -k 1nr | sed 's/^[^ ]* //' | head -n 10

This example shows only the 10 most recent files (head -n 10) and doesn't filter filenames in any way. It also only examines normal files, not folders or other.

MPRIS players in KDE


I've switched to Arch Linux and a KDE desktop. I love cairo-dock/compiz but it seems like its hard to get compiz to work consistently any more due to gnome etc... loading their own compositing tools that keep trying to take control.

So far I like Arch a lot, and I'm surprised to find that applications tend to run significantly quicker and use less RAM. Notably Windows in VirtualBox and Office 2010 under WINE which were both pretty slug like in Ubuntu.

Anyway, one of the issues is getting the play/pause button on my keyboard to work with Pithos, its assigned only for Amarok by default under KDE. This post gives a method of creating scripts for play/pause, stop, next, previous and reassigning multimedia keys to run them.

Sunday, November 25, 2012

Kile's 1024 character line limit

For some reason Kile (and Kate?)has a configurable line length limit.
When editing .tex documents its easy to exceed the default of 1024 characters and if you open a file with lines longer than the default it gives an error and sets the document to read only.

Go into settings->Configure Kile and select Editor->Open/Save set the line length limit to 0 and there will be no limit.

Wednesday, November 14, 2012

Maximize Minimize button discovery

I just found something by accident after all these years (well it may be a new feature...).

Right clicking on the maximize button maximizes a window only in the width direction.
Middle click maximizes in only the height direction.
Clicking either a second time restores back to original.

Tuesday, November 13, 2012

Using the script command

For years I've wondered why the script command gives no output in Ubuntu. I still don't know the answer, but I just found that by using the "-q" option it works!

-q is supposed to be for "quiet" mode, which I guess turns off the little messages like "script started". But it causes script to actually produce a script.
$ script -q <filename>

Thursday, November 8, 2012

Reset USB ports in Ubuntu 12.10

From http://davidjb.com/blog/2012/06/restartreset-usb-in-ubuntu-12-04-without-rebooting

If your USB port gets mangled and a device isn't working as it should:

  tward $ lspci | grep USB 
  00:1a.0 USB controller: ...
  00:1d.0 USB controller: ...

Then do the following:

  tward $ echo -n "00:1a.0" | \
          sudo tee /sys/bus/pci/drivers/ehci_hcd/unbind
  tward $ echo -n "00:1a.0" | \
          sudo tee /sys/bus/pci/drivers/ehci_hcd/bind

For each of the above controllers. 

Be aware that after you write to unbind, anything connected to that particular USB controller will be unavailable until you write to bind on the next command. So if your keyboard is connected to one of those, you may be in trouble.

Note: See the comment below for an updated procedure.

Thursday, November 1, 2012

Disable overlay scrollbars in Ubuntu 12.10 (Quantal)

Since I upgraded to 12.10, (Quantal) I have have all sorts of issues because apparently gnome is moving away from compiz and using something of their own, but I'm using cairo-session which uses gnome-session, ... Whatever anyway ubuntu-tweak isn't working completely for me and the stupid overlay tool bars kept reappearing. The command below disables them:
gsettings set com.canonical.desktop.interface scrollbar-mode normal
Another thing that's not persisting is window focus mode:
dconf write /org/gnome/desktop/wm/preferences/focus-mode \'sloppy\'
dconf write /org/gnome/desktop/wm/preferences/auto-raise false