Get OS name using python
This commit is contained in:
parent
981f5fd09b
commit
6dc3108747
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
import math
|
import math
|
||||||
import functools
|
import functools
|
||||||
|
import platform
|
||||||
import html as html_utils
|
import html as html_utils
|
||||||
|
|
||||||
import sip
|
import sip
|
||||||
@ -202,7 +203,7 @@ class WebEngineCaret(browsertab.AbstractCaret):
|
|||||||
@pyqtSlot(usertypes.KeyMode)
|
@pyqtSlot(usertypes.KeyMode)
|
||||||
def _on_mode_entered(self, mode):
|
def _on_mode_entered(self, mode):
|
||||||
self._tab.run_js_async(
|
self._tab.run_js_async(
|
||||||
javascript.assemble('caret', 'setInitialCursor'))
|
javascript.assemble('caret', 'setInitialCursor', platform.platform()))
|
||||||
|
|
||||||
@pyqtSlot(usertypes.KeyMode)
|
@pyqtSlot(usertypes.KeyMode)
|
||||||
def _on_mode_left(self):
|
def _on_mode_left(self):
|
||||||
|
@ -494,9 +494,6 @@ window._qutebrowser.caret = (function() { // eslint-disable-line max-statements,
|
|||||||
|
|
||||||
CaretBrowsing.blinkFlag = true;
|
CaretBrowsing.blinkFlag = true;
|
||||||
|
|
||||||
CaretBrowsing.isWindows =
|
|
||||||
window.navigator.userAgent.indexOf("Windows") !== -1;
|
|
||||||
|
|
||||||
CaretBrowsing.isControlThatNeedsArrowKeys = function(node) { // eslint-disable-line complexity,max-len
|
CaretBrowsing.isControlThatNeedsArrowKeys = function(node) { // eslint-disable-line complexity,max-len
|
||||||
if (!node) {
|
if (!node) {
|
||||||
return false;
|
return false;
|
||||||
@ -590,9 +587,9 @@ window._qutebrowser.caret = (function() { // eslint-disable-line max-statements,
|
|||||||
document.body.appendChild(node);
|
document.body.appendChild(node);
|
||||||
};
|
};
|
||||||
|
|
||||||
CaretBrowsing.setInitialCursor = function() {
|
CaretBrowsing.setInitialCursor = function(platform) {
|
||||||
const sel = window.getSelection();
|
CaretBrowsing.isWindows = platform === "Windows";
|
||||||
if (sel.rangeCount > 0) {
|
if (window.getSelection().rangeCount > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -960,7 +957,7 @@ window._qutebrowser.caret = (function() { // eslint-disable-line max-statements,
|
|||||||
CaretBrowsing.isCaretVisible =
|
CaretBrowsing.isCaretVisible =
|
||||||
(CaretBrowsing.isEnabled && CaretBrowsing.isWindowFocused);
|
(CaretBrowsing.isEnabled && CaretBrowsing.isWindowFocused);
|
||||||
if (CaretBrowsing.isCaretVisible && !CaretBrowsing.caretElement) {
|
if (CaretBrowsing.isCaretVisible && !CaretBrowsing.caretElement) {
|
||||||
CaretBrowsing.setInitialCursor();
|
CaretBrowsing.setInitialCursor(CaretBrowsing.isWindows);
|
||||||
CaretBrowsing.updateCaretOrSelection(true);
|
CaretBrowsing.updateCaretOrSelection(true);
|
||||||
if (CaretBrowsing.caretElement) {
|
if (CaretBrowsing.caretElement) {
|
||||||
CaretBrowsing.blinkFunctionId = window.setInterval(
|
CaretBrowsing.blinkFunctionId = window.setInterval(
|
||||||
@ -1012,9 +1009,9 @@ window._qutebrowser.caret = (function() { // eslint-disable-line max-statements,
|
|||||||
|
|
||||||
const funcs = {};
|
const funcs = {};
|
||||||
|
|
||||||
funcs.setInitialCursor = () => {
|
funcs.setInitialCursor = (platform) => {
|
||||||
if (!CaretBrowsing.initiated) {
|
if (!CaretBrowsing.initiated) {
|
||||||
CaretBrowsing.setInitialCursor();
|
CaretBrowsing.setInitialCursor(platform);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user