Aug 142010
 

Note: This program is only for the current grub version (1.98+), and does not work with grub-legacy (0.xx). Older grub-choose-default versions work with grub-legacy, see GrubChooseDefaultLegacy.

Control Grub Default through a GUI

Do you have a dual boot system? Isn’t it annoying when you want to reboot from Linux into Windows or vice-versa, and you have to wait for the machine to shut down, the BIOS to initialize just so that you can now select the OS that you want to boot into?

grub-choose-default gives you a GUI that you can use to easily select the next default for grub and you can go and grab a snack while your computer reboots without having to wait for anything.

It’s a very simple program that just reads your grub menu entries and then lets you click on the one you want to be the next default.

How It Works

Since grub2 reached version 1.98, setting the default boot entry through the “grub environment” is supported. From Linux, the grub-set-default command is available again, just as before with grub-legacy. Under Windows grub’s code is used to edit the environment directly.

Cross Platform

grub-choose-default is available both for Linux and Windows. It should also work on other Unices, but has not been tested (user reports are welcome).

Under Linux it reads /boot/grub/grub.cfg and sets your choice using grub-set-default.

Under Windows you need to get access to your Linux /boot. If you are running ext2/3, then you can use Ext2IFS, which gives you access to your ext2/3 partitions as regular drives under Windows. Although this software doesn’t work perfectly under Windows 7, there are usable workarounds. See README.win32 in the sources, or read the introductory text of the installer for further information. Grub-set-default currently needs direct file access and thus does not work with /boot on reiserfs or other filesystems (unless someone can point me to a similar FS driver as Ext2IFS).

Then grub-choose-default searches all your drives for boot/grub/grub.cfg or a grub/grub.cfg. The grub directory can be specified in the configuration file, which is located in the Profile folder’s “Application Data” subdirectory grub-choose-default. Add the line ”grub_dir=D:\grub” to the end of the file, and remember to escape backslashes.

Ending the Session

Most of the time you will want to reboot after setting the new grub entry. How to end a session is specific to the desktop environment in Linux, and in the reboot/ directory are example scripts of how to end a session. The user can install the script of his choice in $XDG_CONFIG_DIR/grub-choose-default/reboot.

Prerequisites

  • GTK 2.16+
  • GIO (on Windows)
  • Python (for building from source)

Older Versions

The page for the old version of grub-choose-default, which is compatible with grub 0.xx, can be found at GrubChooseDefaultLegacy.

Screenshot

License

grub-choose-default is released under the GNU GPL v2. The NSIS installer script is using GNU GPL v3, and the waf scripts the EXPAT license.

The development version can be found at http://github.com/squisher/grub-choose-default .

Ubuntu packages for karmic are at https://launchpad.net/~bugs-da/+archive/grub-choose-default/

  • 2014-04-22 – Version 1.1
    Improved grub.cfg parsing. Sub-menu support.
    • Sources: grub-choose-default-1.1.tar.bz2, SHA1
    • Cleaned up tarball was released 2014-04-27, the previous version’s SHA1 was 50f14db42b7f1a04381455627083562583604b54
    • Windows Installer: Not ready yet, please bug me if you are interested.
  • 2010-08-14 – Version 1.0
    Support to set default for next reboot only. Allow workaround for Windows 7.

Contact

Comments, bug reports, etc. are very welcome. Please look for my email address in the included README file.

Apr 182010
 

Note: This program is only for grub-legacy (0.9x). Current grub versions, 1.98+, are supported by more recent grub-choose-default versions, see GrubChooseDefault.

Do you have a dual boot system? Isn’t it annoying when you want to reboot from Linux into Windows or vice-versa, and you have to wait for the machine to shut down, BIOS to initialize just so that you can now select the OS that you want to boot into?

grub-choose-default gives you a GUI that you can use to easily select the next default for grub and you can go and grab a snack while your computer reboots without having to wait for anything.

It’s a very simple program that just reads your grub menu entries and then lets you click on the one you want to be the next default.

In grub’s menu.lst file you need to specify default saved, so that grub consults the file default in the grub directory to see which entry it should boot. That file is then modified by grub-choose-default

grub-choose-default is written in Python (which is required to be installed at the moment) and works under Linux and Windows.

Under Linux it reads /boot/grub/menu.lst and writes your choice to /boot/grub/default

Under Windows you need to get access to your Linux /boot. If you are running ext2/3, then you can use Ext2IFS, which gives you access to your ext2/3 partitions as regular drives under Windows. grub-set-default currently needs this and thus does not work with /boot on reiserfs or other filesystems (unless someone can point me to a similar FS driver as for Ext2IFS).
Then grub-choose-default searches all your drives for a grub/menu.lst or a boot/grub/menu.lst. There currently is no way to specify manually where menu.lst resides, please let me know if this is needed.

Introduced in version 0.2 is the ability to reboot right after the new grub default has been set. Under Linux there are many different ways to start the logging off procedure — dependent on the desktop environment that you are using. For that reason (and since any program ran through sudo won’t be able to interact with the desktop environment of the regular user), the reboot is handled by a wrapper script. See the reboot/ subdirectory for supplied scripts. At the moment only scripts for xfce4 and gnome have been included, but it shouldn’t be very hard to adjust them to your current desktop environment. If you do so, please email me your script, and I’ll include it in the next release.

  • Python
  • Python Tk module (included by default under Windows, for Linux might be an extra package (i.e. python-tk for Debian)
  • Windows: Access to /boot as regular files (see above)

grub-choose-default is released under the GNU GPL v2

  • 2008-05-29 – Version 0.3Applying patches from Kjell Braden to fix minor crashes and to add a man page.
  • 2007-08-06 – Version 0.2Addition of reboot feature, checking menu.lst for correct default saved settings.
  • 2007-01-18 – Version 0.1First public release, please check for bugs!

Comments, bug reports, etc. are very welcome. Please look for my email address in the included README file.

Feb 042010
 

Two small utilities for use with old-school dual head setups: namely not
twinview / one big desktop, but rather two X screens. See gentoo wiki for some setup help.

I use this setup because the wrapping the mouse is very smooth, it is very useful to have the logical separation of both screens and now I can easily switch focus and mouse between them just by using the keyboard. Additionally, when I play some nice games in wine, I can lock the mouse into each individual screen, and by need be switch by using the keyboard shortcut.

You xorg.conf needs to contain something similar to:

Section "ServerLayout"
        Identifier      "Default Layout"
        Screen          0 "Screen 0" 3000 0
        Screen          1 "Screen 1" 0 0 #leftOf "Screen 0"
EndSection

for these utilities to work.

mouse-switchscreen

Change the mouse cursor from one screen to the other. Remembers the previous
mouse position for each screen.

The previous mouse-switchscreen has been renamed to mouse-wrapscreen (see below), since the name was confusing.

mouse-wrapscreen

If you have an xorg.conf where both X screens are “separated” on the X
coordinates, then the mouse cursor cannot cross. Which is sometimes desired,
and sometimes not. Using mouse-wrapscreen you can configure them to be
“uncrossable”, and then run it in the background when you do want to be able
to cross the cursor.

Warning (2010-02-04): Mouse-wrapscreen seems to lock up the X server after a recent upgrade on my system. The symptom is that the cursor will just jump back and forth between screens, preventing any other interaction between the user and the X server. The reason is unknown, probably mouse-wrapscreen is triggering a bug in X. If you have any further information or ideas, please contact the author.

”Note: Both use XWarpCursor, which was necessary with xorg 7.4. I haven’t tried
it on older versions of xorg.”

Both tools are based on a program by David Antliff. See the header of the
respective .c files for a brief changelog.

Releases

  • 0.5 (2009-05-17)
    Update for xorg 7.4 and integrate “switchscreen” (prev. homepage is defunct)

http://dsp.mcbf.net/releases/dualscreen-mouse-utils-0.5.tar.gz

Related work

There is switchscreen out there by Sampo Niskanen, however it does not seem to remember the mouse position for each screen.

Nov 282009
 

Version 0.4, released 2009-11-27: http://dsp.mcbf.net/checkcopy/checkcopy-0.4.tar.bz2

Checkcopy is a copy program which computes checksums on the fly to verify them
and/or write them out to disk.

This program will copy one or more files / directories to a destination,
and compute its checksum on the fly. If checksum files are getting copied
over, their contents are parsed and compared to the computed checksums. If no
checksum was found for a file, then the computed one is written to disk.

So in the end at the destination every file has a checksum stored on disk, and all files which already had a checksum are verified.

Checkcopy uses GIO, and as such operates on local and remote files /
destinations.

Known Issues

W A R N I N G:
Similarly to how `cp’ works, checkcopy currently overwrites destination
files without warning!

Usage

1. The source files / directories have to be specified on the command line.
So running just “checkcopy” is not going to get you anywhere. See TODO.

2. The destination is can be predetermined, preselected, or simply selected.
a. If a destination was specified by the -d switch, then the user
will not get asked.
b. If a default destination was specified by the -D switch, then a file
chooser will get displayed, starting at the specified URI.
c. Otherwise, a file chooser will be shown with the current directory as the
starting location.

This should allow easy bindings in file managers.

Before the files are being copied, they are scanned for checksum files.
Currently only files ending in .md5, .sha, .sha1 and CHECKSUM are detected as
containing checksums. Its contents are then parsed, and remembered.

While the files are copied, the checksum is created. If a checksum is on file,
it will get compared. If no checksum was previously discovered, the computed
one is written to disk as /foo/bar/${DESTINATION}/${DESTINATION}.CHECKSUM
(currently always as sha1).

Requirements

checkcopy requires the following libraries to be installed:

  • gtk+ toolkit:
    Checkcopy was tested with gtk 2.18.3, but gtk 2.16 would probably suffice.
  • gio:
    All file operations are based on GIO functions.
  • libxfce4util:
    Required for some utility functions.

Development

The development code can be found at http://github.com/squisher/checkcopy/

Feedback

Please check the TODO file for the current plan for checkcopy.

All comments, feedback, and bug reports are very welcome! Please email the
author at david@mcbf.net .

Nov 282009
 

Version 0.1, released 2008-07-20
This program is deprecated. Please now use checkcopy, which has more functionality and is more reliable.

This program will copy one or more files / directories to a destination,
and compute an md5 checksum on the fly. Currently the .md5 files are generated
per directory.

Usage

The source files / directories have to be specified on the command line. Then
a dialog will pop up asking you for the destination, unless it was also
specified on the command line (-d switch).

This should allow easy bindings in file managers.

W A R N I N G

  Similarly to how `cp' works, md5copy currently overwrites destination
  files without warning!

The checksum will be saved in one .md5 file per directory. So if you have a
layout like:

a/
  sub1/
    (some files)
  sub2/
    (some files)

you would end up with the following checksum files:

  • a/sub1/sub1.md5
  • a/sub2/sub2.md5

Note that there is no a/a.md5, because there were no files (just directories)
inside of a/.

I recommend the program cfv to verify files. cfv has the ‘-r’ switch, which
allows you to verify a whole directory structure copied with md5copy.

Internals

At the moment md5copy is slightly unoptimized to copy a large number of small files, since the total size of the copy operation is calculated first.

The mhash library is used to compute the checksum. This should make md5copy pretty reliable, and at no point in testing there was ever an incorrect checksum.

md5copy should be pretty fast. The reading part was inspired by GNU coreutil’s md5sum. GUI, copy and hashing are all run in separate threads, so the hashing should not slow down the copying (although this statement has not benchmarked very well).

Requirements

md5copy requires the following libraries to be installed:

  • gtk+ toolkit:
    it was tested with gtk 2.12.11, but probably gtk 2.10 would suffice
  • mhash library:
    it was tested with 0.9.9 (libmhash2 in Debian)

the manpage refers to 0.9.2, so I assume that’s the minimum required

Feedback / Bugs

I’m interested in feedback! Did it work fast? Could you tune something in settings.h? Did you find a bug? Let me know by sending an email to david at x.mcbf.net (remove the x. to get a valid email address)

Download

Jun 042009
 

I adapted a little program to help with a dual monitor setup and two separate X screens. It allows you to configure the X screens to be apart (so that you can play games without having the mouse cross over), but still have the convenience of a crossing cursor when needed.

For a little more detail see http://gentoo-wiki.com/HOWTO_Dual_Monitors#Switchscreen.

Releases

  • Deprecated Warning: This utility will now be developed as part of DualscreenMouseUtils. Check there for the newest release.
  • Bugfix: place cursor on the correct x coordinate after switching screens2008-08-15 : Download v0.3b
  • Bugfix: screens can now have different resolutions.2008-08-13 : Download v0.3
  • Small update: detect current screen reliably, option to specify the relation of the two screens.Download v0.2
Feb 242008
 

Ekiga is a nice linux voip program. Yet it has the limitation that its sound support does not understand .asoundrc devices. As a work around you can use an environment variable in .asoundrc to set the default device specially for ekiga.

But what if you want to have the ring sound on a different alsa device than the actual conversation? This is what I need with my DotAsoundrc, because my headphones are plugged in all the time. So I wrote a little python script, which uses dbus to connect to ekiga and plays the ring tone on a different device.

Download

Jan 092008
 

pidgin-away

pidgin-away.py lets you specify a new away message from the command line. Great for usage from within scripts. I wrote it so that when I start a game I can automatically set my status to away, and return to available when I’m done playing. Any questions or bugs, send me an email (contact information is in the script).

Download

  • 2007-06-25 – Version 0.2: small bugfixes
  • 2007-05-20 – Version 0.1

skype-away

skype-away.py lets you read or set the current status. Any questions or bugs, send me an email (contact information is in the script).

Download