workspacer icon indicating copy to clipboard operation
workspacer copied to clipboard

create workspacer-contrib style repo in order to allow for user submitted config snippets

Open rickbutton opened this issue 5 years ago • 5 comments

snippets for things like workarounds for bad apps, useful defaults, etc

not really a place for "how do you use this feature" stuff, but instead "if you use this bullshit version excel here is the config you need to make it work well", or "here is a sample config for this common user provided plugin"

rickbutton avatar Oct 01 '18 23:10 rickbutton

Commenting so I get updates

scottopell avatar Oct 02 '18 01:10 scottopell

I find this a pretty needed feature, the soon as possible, so new users can get a clue more easily...

spadino avatar Jul 27 '19 02:07 spadino

Super old thread but here would be my #1 suggestion for laptop users that like to connect a secondary display and use that in addition to their laptop. This avoids the annoying crash when disconnecting the laptop


try 
{
    sticky.CreateWorkspaces(monitors[1], "News", "Music", "Email");
}
catch  (System.IndexOutOfRangeException e)
{
   sticky.CreateWorkspaces(monitors[0], "News", "Music", "Email");
}

N1x0 avatar Nov 22 '20 16:11 N1x0

I wrote a little function that when called switches the shell over to full explorer.exe and closes workspacer. This is handy if one runs workspacer as shell replacement. Including it will require workspacer to be run with admin privilages as else it can't make the needed reg changes to trick the explorer.exe startup.

Calling LaunchExplorerShell will do everything for you, the other functions are util for it.


using System;
using System.Diagnostics;
using Microsoft.Win32;

static void LaunchExplorerShell(IConfigContext context)
{
    if (IsExplorerRunnig() || !SetStartupShell("explorer.exe"))
    {
        return;
    }

    Thread.Sleep(1000);
    RestartSiHost();
    Thread.Sleep(1000);

    var explorerProcess = new Process();
    explorerProcess.StartInfo.FileName = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe");
    if (explorerProcess.Start() != false)
    {
        Thread.Sleep(1000);
        SetStartupShell(GetCurrentExecutionDir());
        Thread.Sleep(1000);
        context.Quit();
    }
}

static bool IsExplorerRunnig()
{
    var processes = Process.GetProcessesByName("explorer");
    return processes.Count() != 0;
}

static string GetCurrentExecutionDir()
{
    var process = Process.GetCurrentProcess();
    return process?.MainModule?.FileName ?? string.Empty;
}

static void RestartSiHost()
{
    Process[] siHostProcesses = Process.GetProcessesByName("sihost");
    if (siHostProcesses.Any())
    {
        siHostProcesses.First().Kill(true);
        siHostProcesses.First().WaitForExit();
    }
}

static bool SetStartupShell(string shell)
{
    try
    {
        using (var key = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Winlogon", true))
        {
            key.SetValue("Shell", shell, RegistryValueKind.String);
        }

        return true;
    }
    catch
    {
        return false;
    }
}

denjukebox avatar Nov 03 '21 08:11 denjukebox

That's fantastic! I didn't considered the possibility to entirely swap the shell - as I did with litestep ages ago...

Would you mind to share how do you achieve that? Also, if you don't mind, I would love to have a look at your config, and how do you call this function, in order to learn better how workspacer works... 😅

spadino avatar Nov 03 '21 12:11 spadino