Is it possible to make my devTools dock to bottom by default?
I am completely new at electron, and this project took me 8 minutes to set up so excuse my design.
what i want
contents.openDevTools([options])
options Object (optional)
mode String - Opens the devtools with specified dock state, can be right, bottom, undocked, detach. Defaults to last used dock state. In undocked mode it's possible to dock back. In detach mode it's not.
So in your code in the Main process, it should be something like this
mainWindow.webContents.openDevTools({ mode: 'bottom' })
webContents API
This can be eaisly done as follows
window.webContents.openDevTools({ mode: "bottom"});
or as follows
mainWindow.webContents.openDevTools({ mode: 'detach' });
use { mode: 'undocked' } , then you can see the different options to put you devtool when it's launched, but maybe you can't use some mode, like bottom or right. good luck!
Related
I'm using avalonia (version 0.10.3 - but the same happened with 0.10.0 - on Net5.0 project) as the UI for a project and when I create for instance a splash or an about screen, the title bar must be invisible.
On windows this works just fine with these parameters in the window section :
CanResize="False"
ExtendClientAreaToDecorationsHint="True"
ExtendClientAreaChromeHints="NoChrome"
ExtendClientAreaTitleBarHeightHint="0"
Unfortunately, on Linux (mint - latest version with latest updates), the title bar remains visible (also if I set ExtendClientAreaTitleBarHeightHint="-1").
Is this a known issue or am I doing something wrong ?
I do not have a mac, but is that also the case for mac ?
X11 uses so-called "server decorations". Window frame is drawn by a window manager in a separate process, so it's not really possible to extend into that area.
You can still disable the frame completely and draw your own, but in general it's not really recommended since you will break advanced window interactions in basically every non-GNOME based Linux distro (GNOME doesn't care because it doesn't have any advanced window interactions).
In some future version Avalonia would use a custom-drawn frame for GNOME with a configuration option to ignore your user's preferences in favor of a fancy looking window border for other desktop environments as well, but it's not implemented yet.
I had a similar problem but I "solve it" by defining the window property as:
WindowState = WindowState.FullScreen;
Comparing with Normal or Maximized, with title bar in fullscreen remains hidden.
I am using awesome window manager (new to it). The normal keybinding for changing size for the window in tiling mode is Super+h & Super+L but it only resizes the terminal window (I am using alacrity & it is resizing that), but if I try to resize another window instance firefox, it is not resizing that. Any solution will be appreciated
I'd recommend https://github.com/lcpz/awesome-copycats for newcomers. Also this is a related question: What is incwfact and setwfact of awesome.client
Basically what you need is hidden in this documentation page:
https://awesomewm.org/doc/api/classes/tag.html
incmwfact: Increase master width factor
And here: https://awesomewm.org/doc/api/classes/client.html
incwfact: Change window factor of a client.
Example from my config:
K.win is the Mod4 Key which is the windows key on my keyboard.
I'm "expanding" the current window (client) to the location indicated by the arrow key. Actually I'd need some extra code for up/down to work correctly in all cases but I rarely have vertically stacked windows.
awful.key(
{K.win},
"Right",
function()
awful.tag.incmwfact(0.05)
end,
),
awful.key(
{K.win},
"Left",
function()
awful.tag.incmwfact(-0.05)
end,
),
awful.key(
{K.win},
"Down",
function()
awful.client.incwfact(-0.05)
end,
),
awful.key(
{K.win},
"Up",
function()
awful.client.incwfact(0.05)
end,
),
It'd be handy if there was a keyboard shortcut for hiding and showing the sidebar. Sublime has cmd+k+b and it's a quick way of gaining some screen real estate when you need it. Anybody know if this exists or if the user can add it manually to VS Code?
The command can be triggered via Ctrl+B on Windows and Linux or Cmd+B on the Mac.
There are 3 bars on the side, 2 left and 1 right:
the activity bar with 5 buttons
the primary sidebar toggled by clicking any of the activity bar buttons.
the minimap
All of these hotkeys and more (e.g. the terminal & output panel, Ctrl+J) are now visible through the View (Alt-V) and View>Appearance menus:
The activity bar has no toggle hotkey by default, but you can assign one like this:
{
"key": "ctrl+alt+b",
"command": "workbench.action.toggleActivityBarVisibility"
},
Or hide completely with "workbench.activityBar.visible": false
The sidebar toggle hotkey is Ctrl+B by default, but may be overridden by e.g. vim plugin, here's how to enforce or change it:
{
"key": "ctrl+b",
"command": "workbench.action.toggleSidebarVisibility"
},
The minimap can be hidden with "editor.minimap.enabled": false and toggled with editor.action.toggleMinimap since vscode 1.16.
And with the Sidebar-activity toggler extension, so you toggle both activity and sidebar together with one key mapping to sidebar-activity-toggler.toggleSidebarAndActivityBar
To Hide the 5 button Activity Bar we can now:
View -> Hide Activity Bar
This is in vscode 1.9, not sure which version it was introduced in.
As Benjamin Pasero's answer states you can use:
Ctrl+B on Windows and Linux
⌘ Cmd+B on the Mac.
but sometimes you have another keyboard shortcut with ⌘ Cmd+B, in my case I had it to format some React code. To reverse that you can use the following:
Code > Preferences > Keyboard Shortcuts (⌘+K ⌘+S) then search for B and disable the other shortcut command.
You can also change the it and put which ever shortcut you want, just search for Toggle Side Bar Visibility like this:
Just in case you be intended for hiding the right lateral "sidebar", also called minimap, there is no shortcut. But you can configure the settings with:
{"editor.minimap.enabled: false"}
One can also hide the activity bar with the following setting in settings.json:
"workbench.activityBar.visible": false
To hide/show the side bar:
Ctrl+B on Linux and Windows.
⌘ Cmd+B on Mac.
No need to edit Settings.json directly
Do the following:
Open the Keyboard Shortcuts by pressing ctrl+k & ctrl+s
Search: "Toggle Activity Bar Visibility"
Enter the keyboard shortcut
Done!
Activity bar visibility in visual studio code
Mac users,
⌘ + B or
⌘ + 0 - Worked Perfectly
In the VS code version 1.43, you can hide or show the side menu or activity bar by going under the 'VIEW' tab in the nav bar in the top margin of VS CODE(called the 'Menu Bar'). Go to View => Appearance, there you can check or uncheck different nav bars to show/hide each one.
If you have the top bar (Menu Bar) currently hidden press 'alt' key to bring it back then follow above instructions to check it to keep it there permanently if desired.
With the electron api, I can set the window's icon when calling the BrowserWindow constructor, like this:
mainWindow = new BrowserWindow({
icon: __dirname + '/electric-glowing-bear.png');
Unfortunately, I haven't been able to figure out how to update the icon after the fact. There seems to be a way to update the dock icon on Mac OS X, however, I am running Linux.
The purpose of this is so that I can 'badge' the icon with a number to indicate unread messages are waiting.
The only workaround I have found so far is to use a Tray icon, however, I would prefer to show the unread count in the dock / taskbar.
You can set BrowserWindow icon when creating windows at like this.
const {BrowserWindow} = require('electron')
let mainWindow = new BrowserWindow({icon: icon})
You can change BrowserWindow icon anytime like this.
mainWindow.setIcon(changeicon);
You can Taskbar icon overlay numbering anytime like this.
mainWindow.setOverlayIcon(overlayicon, description)
Windows overlay NativeImage - the icon to display on the bottom right corner of the taskbar icon. If this parameter is null, the overlay is cleared
description String - a description that will be provided to Accessibility screen readers
Sets a 16 x 16 pixel overlay onto the current taskbar icon, usually used to convey some sort of application status or to passively notify the user.
this should work as long as you have the appropriate files in place
const os = require('os'); // top of file
switch (os.platform()) {
case 'darwin':
mainWindow.setIcon('src/app/assets/icons/icon.icns');
break;
case 'win32':
mainWindow.setIcon('src/app/assets/icons/icon.ico');
break;
default:
mainWindow.setIcon('src/app/assets/icons/icon.png');
break;
}
Unfortunately this does not seem to be possible currently, at least not on Linux.
I need to set the background of a window to be transparent programmatically, once the window is already created.
This creates a new window with a transparent background.
Titanium.UI.createWindow({url:location.href,transparentBackground:true}).open()
Background transparency can also be set in the tiapp.xml, but I need to set it after the window is loaded.
I also tried the following
var win = Titanium.UI.getCurrentWindow();
win.backgroundColor = 'transparent';
which does not have any effect...
Is there a way to achieve that?
Perhaps you could create 2 windows with the same components, one transparent and one not. Once you want the transparent background to show close the other window?
or win.setBackgroundColor('transparent');
I pasted your code into a click event and it worked fine for me. All i did was change the url to 'app://index.html' for testing purposes.
$('.button').click(function(){
// test
Titanium.UI.createWindow({url:'app://index.html',transparentBackground:true}).open();
});
Have you opened the web inspector to check for js errors?
If you want the initial window to be transparent, add this
<transparent-background>false</transparent-background>
to
<window />
on the tiapp.xml file.