Efficient desktop environment under Windows 10 using virtual desktops and Vdesk

You probably know the feeling: You are working in your editor and want to jump to Emacs or another program opened on your computer. You Alt-Tab your way through Chrome, Word, Tetris, and lots of other programs and then you move to fast and just click past Excel. Here is a typical desktop when I am working.

2017-05-07 16_19_35-

You could use your mouse and just click on the window showing when you press Alt-Tab or click on the small icon in the task bar. But I don’t like using the mouse and love to have everything below my finger tips.

Windows 10 has a nice feature to have virtual desktops. You can have multiple desktops with specific programs opened. For example, one virtual desktop with outlook, skype and other programs relating to communication, one with your code editor for programming and writing as well as Excel, etc. Here is an introduction to working with virtual desktops.

One problem is that you can’t save these virtual desktops, so you have to install them again when you restart your computer. Vdesk is a free, nice utility to do this for you. Just install it and write a small script (you can find all the technicalities here. Just save the code in a batch file and add it to your autostart folder. This folder can be found by running the command “shell:autostart”:

2017-05-07 16_42_12-Run

Here is a small example of a script (“vdeskstart.bat”) that produces two virtual desks:

vdesk create:2
desk on:2 run:”C:\emacs\bin\runemacs.exe”
timeout /T 25
vdesk on:1 run:”C:\Program Files (x86)\Microsoft Office\root\Office16\OUTLOOK.EXE”

(the timeout is necessary as Emacs needs about 25 seconds to start).

This creates at start-up two virtual desktops and opens Emacs and Chrome in the first and Outlook in the second virtual desktop. You can now work in a virtual desk with your favorite coding tools, switch easily if you want to do some emailing. The coding virtual desktop now only has the programs in the background you really need.

Jumping to the other virtual desktop is easy. Just hit Ctrl-Windows and arrow left or right and you cycle through the desktops. Or you hit on the task view icon in the task bar and click, and you will see your virtual desktops you can choose from:

2017-05-07 16_30_00-Posteingang - renger@vannieuwkoop.ch - Outlook

More on problems with HiRes screens

In one of my previous posts, I showed how to adjust the properties of the executable of a program under Windows 10 that has a fuzzy look: Right-click on the executable and choose “”the “ Compatibility” tab where you have to activate the “Disable display scaling on high DPI settings”. This trick works fine for non-windows programs. However, Outlook or Excel still look terrible.

If you go to http://windows10_dpi_blurry_fix.xpexplorer.com/ you can download a free, small utility, where you can set your overall DPI-Settings back those from Windows 8 (which doesn’t have this problem).

2017-02-01 13_50_48-XP Explorer - Windows 10 DPI Fix

Just click on “Use Windows 8.1 DPI scaling (our fix)” and you are set.

Generating headings for project files

I use the free software AutoHotkey (AHK) for automation of many things. One of those things is generating headings for my project file. I developed a simple AHK-script that asks me for the project name, the topic and then inserts the heading with additional information like my name, my E-mail address and a keyword for subversion.

The script is quite simple and I have adopted it for headings for several project files (tex, R and gams). The only difference being the characters used to comment out a line.

Here is the script

The line with ::tplt:: shows the characters that when typed start the template script (in this case for a tex-file). The lines with “Inputbox” produce a box where I can enter information


In this case, I enter the project name. What follows is the input box for the subject and then some additional information. Note, that the command “send” needs a variable (between %-values), therefore, everything  without variables should be on the same line.

Here the result for a new gams project file:


You can easily adapt this script for your own use.

Blurry look of programs on your high display screen

My new ThinkPad T460s is lighter (1.4kg instead of 1.8kg), thinner and has more memory (20Gb) than my previous one (T430s). It has a much better screen with 1920 x 1080 pixels. This last feature is nice, but some of my programs get a fuzzy look as they are not yet adapted to this kind of display.

For example, Evernote is not ready for scaling on high DPI settings. If you look in the discussions on this issue, for programmers this seems to be a rather daunting task. Evernote explicitly does not promise anything in that direction (and it is an issue since 2013…).

The problem is resolved quite easily (although you probably have to do it again after updating the program):

  • search for the executable on your computer (in this case Evernote.exe)
  • right click on the file name and choose properties
  • in “properties” choose “compatibility” and (if the program is set up for all users), choose “Change settings for all users” and click on “Disable display scaling on high DPI settings”.


Afterwards, your Evernote (or other programs with the same problem) are crystal clear again.

Backing up your subversion repository on a remote Windows server using batch files

My subversion repository is on a server by Webfaction (probably the best and cheapest way to host your repository. I have 100 Gigabyte space). I used to have a backup script that would save the backup on the same server, which then was transferred to my Windows 8 computer. Because I wanted to replace the complete backup with a new one, I ran into problems, as the backup procress was taking to much of the server CPU. Support pointed me to svnradmin, which is a tool comming with the command tools of tortoisesvn (otherwise you will find these tools on Collabnet).

I searched the net and found some nice scripts to run this process automatically. I have two batch files. The first one runs the complete backup which is run once, the second one is a daily backup, that checks if there are new revsions and then starts to backup these.

The first batch file (fullbackup.bat) looks like this:

I agree: this looks rather cryptic. The first line takes the first 3 items from the output of the date/t DOS-command is something like: 16.07.2015 (depending on your settings, this might be differt). The for command now reads this and separates this information in three parts (i,j,k) where the delimiter is given as “.”.  This information is assigned to the variable “datesvn” and will be stored as 20150716. The second line does the same kind of trick with the time. The third line gets the actual revision on my computer. I than set the filename where everything should be saved to the directory the batch file resides (in this case, it would be something like “d:\svnbackup\SVN_20150716_1305_rev1_3995.dmp”. The next line does the actual dump using svnrdump. Now I have a full backup I can build on. The last line saves the number of the last revision to a file. This whole process can take a couple of hours, if you have a big repository. You can also adjust this script, so you split the backup for revisions ranges like 1:1000, 1001:2000, etc.

The second batch file will check if there are new revisions and if necessary start an incremental backup:

It looks for the last revison in the text file, checks if there are new revisions and then runs the same kind of procedure as before. This batch file can be run on a regular basis using the task scheduler from Windows.

Using Windows Desktop Search to search for text in files with another extension than "txt"

I use Windows Search quite often on my notebook to look for a file, E-Mail or a program. In Windows you just hit the Windows Key and start typing, which is very convenient.
If you want to start a program you just start typing the program name and hit enter Excel, hit the key and type “exc” and enter, and off you go.
The normal search (files or text within files) is also very powerful. Here is a site which explains the syntax: http://msdn.microsoft.com/en-us/library/aa965711(v=vs.85).aspx and here is a good article http://www.howtogeek.com/73065/learn-the-advanced-search-operators-in-windows-7/ on how to use it.
One problem with Windows Search is, that it doesn’t do a text search in my Gams files. I was looking for a file with the word “CPLEX” in it. I knew, I wrote that file last year, but it did not show up in my search. The solution is telling Windows Desktop Search that it should also index the file contents of Gams files. You can do this by going to your Control Panel, click on Indexing Options and then on Advanced Options. Look for the “gms” extension and change the indexing form “Index Properties Only” to “Index Properties and File Contents” (see below). I also removed a lot of file types, I never want to search for.
Here is an example of the windows desktop search in Windows 8 (I searched for the term “urban” in Gams files):

Upgrading to Windows 8 in only 5 minutes

A few months ago I installed Windows 8 on my workstation (Microsoft was offering a cheap upgrage, so being Dutch and always looking for cheap offers, I bought the upgrade). My workstation had some problems, and I did  not want to set it up from scratch with Windows 7 again. It runs fine since then. It has some nice features and no issues until now.
windows-8-wallpaper_171433-1920x1200.jpg (800x500 pixels)
The Microsoft offer is still valid until the end of January, so I decided to upgrade my Windows 7 notebook too, as I will use this one probably for the next 3 years (Lenovo T430s). I just upgraded and did not install Windows from scratch. It took me 5 minutes (most of the time the upgrade did not need any action from my side). No issues at all. All Windows software (for example, visual studio) was updated automatically.
The only thing I don’t like, is the opening desktop (tiles everywhere and no touchscreen) without the start button, so I installed Start8 (it costs 4.99$) and now I have my “normal” Windows 7 desktop (with some nice modifications back again:
Important update:
One important warning: I just discovered, that the path system variable is almost empty after installing and I had to manually adjust it, so my command line scripts for Powershell, Gams and other programs can run. So before you upgrade: copy your path system variable and put it back in place after the upgrade!


Integrating Emacs in your file explorer

Sometimes I have files that I want to open with Emacs, but I haven’t set the program to open to Emacs (for example, a log-file or .emacs). I found a nice hack for Windows machines in the internet (http://www.johndcook.com/emacs_windows.html#explorer).
Just create a file emacs.reg with the following text and adjust the path to your settings.
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\*\Shell\Open In Emacs\Command]
@=”\”C:\\bin\\Emacs-23.1\\bin\\emacsclientw.exe\” -a \”C:\\bin\\Emacs-23.1\\bin\\runemacs.exe\” \”%1\””
Before you double click on this file, save your registry (you never know…). After double clicking you will have a extra option in your right-click menu in your explorer, which starts Emacs, if Emacs is not running and start the client if it is already running.

Using more than one Dropbox folder using Dropboxifier

Dropbox is a nice tool for synchronizing files over different computers. One problem is that you have to put your files in the Dropbox folder. I often make small changes to my settings in Emacs, so I used to have my home directory for Emacs in my Dropbox folder.
You can choose where to put your Dropbox folder on your machine, however, you can only have one Dropbox folder. What to do, if you want to synchronize your whole Emacs program directory (or any other directory you don’t want to move to your Dropbox folder)?
There is a nice open source utility called dropboxifier (http://dropboxifier.codeplex.com/) that allows you to put a symbolic link in your Dropbox folder. The folder remains in the original position but Dropbox treats it as if it is in the Dropbox folder. This utility can also be used for Skydrive or Google Drive.
Examples of my use of dropboxifier:
  • As you probably know, you can easily copy your Emacs directory to another computer. If the home directory on the other computer is properly set, you can start directly working with it. Using dropboxifier I nowadays sync the whole Emacs directory and don’t have to bother, when I update or add packages on one computer.  They are automatically installed on the other computer.
  • I have a directory called “Inbox”. I use if for all the files I download (and don’t want to put in a project or other directory) and for “scratch” files, small files I use for testing stuff (for example, if I answer a question in a mailing list, I, if necessary, usually test my answer with a small file). I use dropboxifier for this folder too (of course, I could have put the whole directory in my Dropbox folder, but than it is hidden deep down in my folder hierarchy). Note, that in the figure above, I still have to add the symbolic link on my other computer. I use my inbox folder also for all my downloads (you can change the download folder in your browser easily).
Note that I don’t use this for my project directories and files, because for this task I use my version control system.

Disable the insert key

I just got my new Lenovo notebook (T430s). Compared with the previous version of this laptop, one important change is the keyboard. Lenovo now favors the chiclet or island style “Precision” keyboard. No page up and down in the upper right corner and the delete key in the upper most right corner next to the insert key.
I never use the insert key and often hit it accidentally.
I looked for ways to disable the insert-key (I can’t remember I have ever used it in the past years). I found the following (taken from http://superuser.com/questions/31794/windows-insert-key-anti-functionality-accidentally-triggers-how-to-stop-it-perm ):
Almost anyone who has used a wordprocessor has accidentally hit the Insert key and overwritten when they thought they were editing. This article describes a simple way to disable the Insert key on your keyboard.
Whenever you press a key, a windows message is created, which contains a key code that uniquely identifies the key pressed. Programmes (like Microsoft Word) look for keypress messages and take actions based on the key code in the message. By mapping the insert key press event to null, windows send a message containing null for the key code when the Insert key is pressed. Programmes receiving the message, therefore, do not perform the action associated with an insert key press event, freeing you from having to worry about overwriting things again.
  1. Go to Start → Run → regedit
  2. Go to HKLM\System\CurrentControlSet\Control\Keyboard Layout
  3. Right-click on the right half of the screen and choose New → Binary Value
  4. Name the new Value Scancode Map
  5. Enter 000000000000000002000000000052E000000000
  6. Close regedit
  7. Reboot.
Optional: you can take the Insert key off of your keyboard when done.
If you do this with Windows7 regedit, you have to enter the hex value in rows of 8 bytes, like this:
EDIT correction for the address
Value Data:0
0000    00 00 00 00 00 00 00 000
0008    02 00 00 00 00 00 52 E00
0010    00 00 00 00