How to start the new Windows Terminal with multiple panes by default? - windows-terminal

Is there a setting to split the new Windows Terminal into multiple panes by default? For example to start with two columns and the second column split into two horizontal parts?

This feature is currently in preview mode and the way it works might change in the future, but currently this can be accomplished by adding startupActions to your settings.json.
For example, to start with two panes, split vertically and to move the cursor to the left pane (it will stay on the last created pane default), your settings.json should look like this:
{
"$schema": "https://aka.ms/terminal-profiles-schema",
"defaultProfile": "{00000000-0000-0000-0000-000000000001}",
"launchMode": "maximized",
"startupActions": "split-pane; move-focus left", // This is the new line you need
"profiles": {
"defaults": {
},
"list": [
{
"guid": "{00000000-0000-0000-0000-000000000001}",
"acrylicOpacity": 0.9,
"useAcrylic": true,
"closeOnExit": true,
"colorScheme": "Solarized Dark",
"commandline": "\"%PROGRAMFILES%\\Git\\usr\\bin\\bash.exe\" --login -i -l",
"cursorColor": "#FFFFFF",
"cursorShape": "bar",
"fontFace": "Consolas",
"fontSize": 10,
"historySize": 9001,
"icon": "%PROGRAMFILES%\\Git\\mingw64\\share\\git\\git-for-windows.ico",
"name": "GitBash",
"padding": "15, 5, 10, 55",
"snapOnInput": true,
"startingDirectory": "%USERPROFILE%\\Desktop"
}
]
},
"schemes": [],
"keybindings": []
}
Some of the commands that you can use are new-tab, split-pane, focus-tab, move-focus...

Related

Change "Command + dot" (Break) keyboard shortcut in Terminal Mac which is not in the menu bar

There are many keyboard shortcuts on macOS Monterey 12
https://support.apple.com/en-gb/guide/terminal/trmlshtcts/mac
but some of them are not present in the menu bar so I can not disable them using System Preferences -> Keyboard -> Shortcuts -> App shortcuts
For example for Command + dot (synonyms: cmd+full stop, command-period) is mapped to Break (like Ctrl + c) but I would like to use CMD+. for other things (like open particular window using Automator).
I end up using Karabiner elements.
Start by reading
https://karabiner-elements.pqrs.org
than play with some of the examples
https://ke-complex-modifications.pqrs.org
and at the end you can add custom manipulator that will change CMD+. to CMD+\ inside terminal app.
# .config/karabiner/karabiner.json
{
"conditions": [
{
"bundle_identifiers": [
"^com\\.apple\\.Terminal$"
],
"type": "frontmost_application_if"
}
],
"from": {
"key_code": "period",
"modifiers": {
"mandatory": [
"left_command"
]
}
},
"to": [
{
"key_code": "backslash",
"modifiers": [
"left_command"
]
}
],
"type": "basic"
},

How to get my cursor on a new line after the highlight line of OhMyPosh theme?

I want the cursor to be on a new line
currently it is on the same line as the highlight line.
I have tried adding "newline" : true, but it didn't work.
How can I resolve it ?
I'm pretty new to Oh My Posh installed on my Mac. I've found very little about what to do to add a \n at the end of the prompt in the documentation. I've even tried what I've read in this dev.to powershell article by adding this block at the end of the json file...
...
{
"type": "prompt",
"alignment": "left",
"newline": true,
"segments": [
{
"type": "text",
"style": "plain",
"foreground": "#007ACC",
"properties": {
"prefix": "",
"text": "\uE602"
}
}
]
}
...
...but it didn't work for me. At best I can only get a "newline": true with an empty line between executed commands, e.g.:
 ~/Downloads  $
 ~/Downloads  $
instead of the desired
 ~/Downloads 
$
 ~/Downloads 
$
SO!
Even if it might be the less elegant workaround I simply found any "trailing_diamond": "\ue0b4" in the omp.json file and (by tries and errors) added to almost all them \n$:
...
"trailing_diamond": "\ue0b4\n$ "
...
EDIT:
Found a new solution
I stumbled upon a GitHub Issue comment by JanDeDobbeleer (owner of JanDeDobbeleer/oh-my-posh) which is something I'm pretty sure I hadn't found on the documentation, especially in the arguments listed in Type.
Adding a new block with just type property and just newline as argument works like a the charm 😉:
{
"type": "newline"
},
Despite what I thought, the last approach is now deprecated!
The solution would still be to use a block (first and last examples) as the last item in the blocks array/list
{
"$schema": ... ,
...
"blocks": [
{
"type": "prompt",
"alignment": "left",
"segments": [
...
]
},
{
...
},
{
"alignment": "left",
"newline": true,
"segments": [{
"foreground": "#007ACC",
"style": "plain",
"template": "\ue602 ",
"type": "text"
}],
"type": "prompt"
},
]
}
Check first your #function Prompt() in your profile path.
If it includes, as shown here, $nonewline, then you might have to set nonewline to false, instead of newline to true.

Rebinding next/previous tab in Firefox without a plugin

I use a tool called Autokey on Linux so that I can bind next/previous tab to the hotkeys that I want across all applications. For the most part, the built in OSX key mapper does the job when I need to use a mac. The problem is that it can only trigger actions that appear as a menu item in an application and Firefox doesn't actually have a 'Next tab' or 'Previous tab' menu item like Chrome does.
I'd rather not install a Firefox plugin just to keybind certain functionality. They always end up messing me up on other operations systems or getting outdated. Is it possible to create an extension that contributes menu items to Firefox so I can just use the built in keyboard shortcut utility in OSX? Are there other ways of getting the keybinds I want?
I ended up solving this with Karabiner in a way that is more analogous to how Autokey works. Here is the json config that maps my preferred next/previous keybind to the thing Firefox (and iTerm) needs.
{
"global": {
"check_for_updates_on_startup": true,
"show_in_menu_bar": true,
"show_profile_name_in_menu_bar": false
},
"profiles": [
{
"complex_modifications": {
"parameters": {
"basic.simultaneous_threshold_milliseconds": 50,
"basic.to_delayed_action_delay_milliseconds": 500,
"basic.to_if_alone_timeout_milliseconds": 250,
"basic.to_if_held_down_threshold_milliseconds": 500,
"mouse_motion_to_scroll.speed": 100
},
"rules": [
{
"manipulators": [
{
"type": "basic",
"description": "next tab in firefox",
"from": {
"key_code": "l",
"modifiers": {
"mandatory": ["left_control", "left_gui"]
}
},
"to": [
{
"key_code": "tab",
"modifiers": ["left_control"]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"org.mozilla.firefox",
"com.googlecode.iterm2"
]
}
]
},
{
"type": "basic",
"description": "prev tab in firefox",
"from": {
"key_code": "h",
"modifiers": {
"mandatory": ["left_control", "left_gui"]
}
},
"to": [
{
"key_code": "tab",
"modifiers": ["left_control", "left_shift"]
}
],
"conditions": [
{
"type": "frontmost_application_if",
"bundle_identifiers": [
"org.mozilla.firefox",
"com.googlecode.iterm2"
]
}
]
}
]
}
]
}
}
]
}
I use an Ergodox keyboard and the way I programmed it makes my left alt key appear as left_gui.

AMMaps - how to use target= _blank

I am able to set theURL to be clicked when someone clicks on a province but it opens in the current window, I would like it to open in 'new' or '_blank'.
"dataProvider": {
"map": "canadaHigh",
"areas": data,
"urlField": "url",
"urlTarget": "new"
}
You can't set urlTarget at the mapData/dataProvider level. Unfortunately the documentation is a bit misleading at the moment. I notified the team about this and they're looking into it.
The correct way to set the urlTarget is in each individual mapArea/mapImage, for example:
"dataProvider": {
"map": "worldLow",
"areas": [{
"id": "CA",
"urlTarget": "_blank",
"url": "http://google.ca"
}, {
"id": "US",
"urlTarget": "_blank",
"url": "http://google.com"
}]
},
Demo

kartograph svg map is empty when using "polygons" bounds mode

I 'm trying to generate svg maps from the GEOFLA shapefiles.
Using 'bbox' bounds mode with manually setting the bbox values works well :
{
"layers": [{
"id": "depts",
"src": "data/DEPARTEMENTS/DEPARTEMENT.shp",
"filter": {"CODE_REG": "24"},
"simplify": {
"method": "distance",
"tolerance": 8
},
"attributes": "all"
}],
"bounds": {
"mode": "bbox",
"data": [-4.5, 42, 8, 48],
},
"export": {
"width": 600,
"ratio": 0.8
}
}
But when setting the bounds mode to 'polygons', then i get an empty svg map :
{
"layers": [{
"id": "depts",
"src": "data/DEPARTEMENTS/DEPARTEMENT.shp",
"filter": {"CODE_REG": "24"},
"simplify": {
"method": "distance",
"tolerance": 8
},
"attributes": "all"
}],
"bounds": {
"mode": "polygons",
"data": {
"layer": "depts"
},
"padding": 0.06
},
"export": {
"width": 600,
"ratio": 0.8
}
}
I had a look in kartograph files and i noticed that the "get_features" method in "map.py" return a Polygon which coordinates doesn't intersect with the features geometry previouly extracted from the shapefile.
Then, each feature are throw away in the "get_features" method of the "maplayer.py" file when checking if feature geometry intersects with the "layer.map.view_poly" property.
I had a similar problem using GEOFLA file projection.
The solution I've found is basically to change my shapefile projection using QGIS. My idea was to use the projection of the shapefile given in installation guide which worked for me.
Get example shape file from kartograph installation page
Load this vector layer in QGIS Add your GEOFLASH layer in QGIS
Right-click on GEOFLASH layer and "Save as..." menu
In the save window, give a new name for your layer (eg : DEPARTEMENT_WGS84.shp)
Click CSR button and select the test layer projection (WGS 84 / EPSG:4326)
Click OK
Check the new shape file has correct projection :
cat DEPARTEMENT_WGS84.prj
GEOGCS["GCS_WGS_1984",DATUM["D_WGS_1984",SPHEROID["WGS_1984",6378137,298.257223563]],PRIMEM["Greenwich",0],UNIT["Degree",0.017453292519943295]]
Now your script should work fine using new shape file.

Resources