Last active
August 27, 2021 02:52
-
-
Save cloudhan/feaefab402945b136a65f5938c8e6fa1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#r "C:\Program Files\workspacer\workspacer.Shared.dll" | |
#r "C:\Program Files\workspacer\plugins\workspacer.Bar\workspacer.Bar.dll" | |
#r "C:\Program Files\workspacer\plugins\workspacer.ActionMenu\workspacer.ActionMenu.dll" | |
#r "C:\Program Files\workspacer\plugins\workspacer.FocusIndicator\workspacer.FocusIndicator.dll" | |
using System; | |
using workspacer; | |
using workspacer.Bar; | |
using workspacer.ActionMenu; | |
using workspacer.FocusIndicator; | |
/* How to config | |
* ============= | |
* https://github.com/workspacer/workspacer/blob/a89d3449fc969053a65e849d0f9ce5d7f2ec0a8b/docs/content/config.md | |
* https://github.com/workspacer/workspacer/wiki/Customization | |
* | |
* How to bind keys | |
* ================ | |
* https://github.com/workspacer/workspacer/blob/a89d3449fc969053a65e849d0f9ce5d7f2ec0a8b/src/workspacer/Keybinds/KeybindManager.cs | |
*/ | |
Action<IConfigContext> doConfig = (context) => | |
{ | |
// Uncomment to switch update branch (or to disable updates) | |
//context.Branch = Branch.None; | |
context.AddBar(new BarPluginConfig(){ | |
FontName = "Sarasa Term SC", | |
FontSize = 12, | |
}); | |
context.AddFocusIndicator(); | |
var actionMenu = context.AddActionMenu(); | |
context.WorkspaceContainer.CreateWorkspaces("Web", "Code", "Other"); | |
context.CanMinimizeWindows = true; // false by default | |
var container = context.WorkspaceContainer; | |
var router = context.WindowRouter; | |
// ignored | |
router.AddFilter((window) => !window.ProcessFileName.Equals("Everything.exe")); | |
router.AddFilter((window) => !window.ProcessFileName.Equals("ScreenToGif.exe")); | |
router.AddFilter((window) => !window.Title.Contains("Snipaste")); | |
router.AddRoute((window) => window.ProcessFileName.Equals("Code.exe") ? container["Code"] : null); | |
router.AddRoute((window) => window.ProcessFileName.Equals("WindowsTerminal.exe") ? container["Code"] : null); | |
router.AddRoute((window) => window.ProcessFileName.Equals("cmd.exe") ? container["Code"] : null); | |
router.AddRoute((window) => window.ProcessFileName.Equals("pwsh.exe") ? container["Code"] : null); | |
router.AddRoute((window) => window.ProcessFileName.Equals("powershell.exe") ? container["Code"] : null); | |
router.AddRoute((window) => window.Title.Contains("Visual Studio") ? container["Code"] : null); | |
router.AddRoute((window) => window.Title.Contains("Google Chrome") ? container["Web"] : null); | |
router.AddRoute((window) => window.Title.Contains("Mozilla Firefox") ? container["Web"] : null); | |
router.AddRoute((window) => window.ProcessFileName.Equals("msedge.exe") ? container["Web"] : null); | |
KeyModifiers mod = KeyModifiers.Alt; | |
// swap these two keys | |
context.Keybinds.Unsubscribe(mod, Keys.Oemcomma); | |
context.Keybinds.Unsubscribe(mod, Keys.OemPeriod); | |
context.Keybinds.Subscribe(mod, Keys.Oemcomma, () => context.Workspaces.FocusedWorkspace.DecrementNumberOfPrimaryWindows(), "decrement # primary windows"); | |
context.Keybinds.Subscribe(mod, Keys.OemPeriod, () => context.Workspaces.FocusedWorkspace.IncrementNumberOfPrimaryWindows(), "increment # primary windows"); | |
// not used | |
context.Keybinds.Unsubscribe(mod, Keys.O); // conflict with VSCode's switch header source | |
context.Keybinds.Unsubscribe(mod | KeyModifiers.LShift, Keys.O); | |
// conflict | |
context.Keybinds.Unsubscribe(mod, Keys.Space); | |
context.Keybinds.Unsubscribe(mod, Keys.Left); | |
context.Keybinds.Unsubscribe(mod, Keys.Right); | |
}; | |
return doConfig; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment