I'm currently using alt + ctrl + left and alt + ctrl + right to cycle between workspaces:
...
, ((altModMask .|. controlMask, xK_Left),
prevWS)
, ((altModMask .|. controlMask, xK_Right),
nextWS)
This works fine for single monitor setup. However it is a bit confusing when using a dual monitor setup. This is because the workspace to be shown will change screen if currently visible on another screen. For instance if I have ws 1 on screen 0 and ws 2 on screen 1 and have the focus on screen 0:
1:term (2:web) 3:txt
When I now do a nextWS, ws 2, that was currently on screen 1 will be drawn to screen 0, while screen 1 will show ws 1.
(1:term) 2:web 3:txt
What I would like is a behaviour where prexWS and nextWS will jump over the workspace that is currently shown on the other monitor and only select a workspace that is currently not shown.
Are there such commands already or is there some xmonad.hs example that implements this?
Use XMonad.Actions.DynamicWorkspaceOrder from the xmonad-contrib:
import qualified XMonad.Actions.DynamicWorkspaceOrder as DO
...
, ((altModMask .|. controlMask, xK_Left),
DO.moveTo Prev HiddenNonEmptyWS)
, ((altModMask .|. controlMask, xK_Right),
DO.moveTo Next HiddenNonEmptyWS)
Related
I'm trying to create a Selenium script in Powershell that automatically buys something that I tell it to. I've gotten it past finding the item, and clicking the Buy Now button, but then this window pops up and I've tried what seems like 3000 different ways of failing to click the Place your order button. Web code to the right. Appears to be the "turbo-checkout-pyo-button", but finding it by ID, XPath, CSSselector, etc have all failed for me. It's not a wait issue. I've even thrown in an explicit (and overly long) 5 second delay to be sure this field is present and "should" be clickable. Any ideas?
I've tried all of these. They're all followed by $placeYourOrderBtn.click() (and have all failed):
$placeYourOrderBtn = $ChromeDriver.FindElementByXpath("//*[#id='turbo-checkout-pyo-button']")
$placeYourOrderBtn = $ChromeDriver.FindElementByXPath("//*[#id='turbo-checkout-place-order-button']")
$placeYourOrderBtn = $ChromeDriver.FindElementByXPath("//span[text() = Place your order]")
$placeYourOrderBtn = $ChromeDriver.FindElementById("turbo-checkout-place-order-button-announce")
$placeYourOrderBtn = $ChromeDriver.FindElementById("turbo-checkout-pyo-button")
$placeYourOrderBtn = $ChromeDriver.FindElementByCssSelector("#turbo-checkout-pyo-button")
I did this for a windows that sends email. You have to click the button to open the new window, then use "SwitchTo()" to change to the new window.
[void]$Webdriver.SwitchTo().Window($WebDriver.WindowHandles[1])
You may have to read the window handles attribute and query each one to determine which one you need to open.
This Problem occurs on the RPi (3B+, Raspbian Buster) only. I run the program on my Mac without any problems.
Short description of my program:
After entering the mainloop, the program enters a second thread with another loop (call it requestloop) when the designated button is pressed. The requestloop can be left by pressing the button again. This requestloop requests a xml table via url every 10 seconds which is then parsed with ElementTree, sorted and displayed in a wx.grid.Grid. I use grid.ForceRefresh to make sure the grid is updated.
I hope the following snippet helps to understand the above:
def on_btnrun(self, event):
global run
if self.btnrun.Label == "Start":
run = True
thrupt = threading.Thread(target=self.thrupdate)
thrupt.start()
self.btnrun.SetLabel("Ende")
elif self.btnrun.Label == "Ende":
run = False
self.btnrun.SetLabel("Start")
def thrupdate(self):
while run is True:
reset()
self.grid.ClearGrid()
update(self.grid)
self.grid.ForceRefresh()
time.sleep(10)
Problem:
Now as mentioned in the title the whole wx Window freezes after passing the requestloop between roughly 5 and 20 times. This happens completely randomly, I could not find any regularities. The program keeps running though, for it still prints the output in the terminal every cycle (I added this function for testing).
When I now open another window (eg. menu dropwdown) which lays over the wx Window it will be copied onto the wx Window and stay there after I closed it.
Here are some Images to better understand what I mean (ignore all other widgets that I didn't mention, they are just nonfunctional placeholders).
Image of the wx Window before it freezes
Image of the wx Window after it freezes
Image of the wx Window after opening and closing the dropdown menu
Extra-Info: while building wxPython on the RPi I got some warnings and everytime I run the program I get the following one (it says the actual time instead of time):
(program.py:1666): Gtk-Critical **: time: gtk_distribute_natural_allocation: assertion ‚extra_space >= 0‘ failed
Question:
I have no idea why any of this happens. Is wxPython not stable on Raspbian? Or did the build partly fail? Or is the RPi not having enough rendering capacity?
Solved it by using wx.CallAfter in the details of the update() method.
In my VsCode wxPython application under Windows, I bind the close event to my function as follows:
import wx
class MyFrame(wx.Frame):
def __init__(self, title):
wx.Frame.__init__(self, None, title = title, pos = (150, 0))
self.Bind(wx.EVT_CLOSE, self.OnClose)
# Other stuff ...
def OnClose(self, event):
print("closing")
self.Destroy()
app = wx.App()
top = MyFrame("My App")
top.Show()
app.MainLoop()
print("done")
Now I can see it's being called when I close the top level window (a wxFrame) as the closing and done messages appear. The window itself also disappears.
However VsCode thinks the application is still running since it has the debug controls still available:
and the console that ran it (Python debug console) does not come back with a prompt. It's not until I click on the stop button does the command prompt reappear in that console.
Interestingly, if I run the application outside of VsCode, it exits correctly, returning to the command prompt.
Try wx.Exit() in case you have something still open/running without realising it.
wx.Exit()
Exits application after calling wx.App.OnExit .
Should only be used in an emergency: normally the top-level frame should be deleted (after deleting all other frames) to terminate the application. See wx.CloseEvent and wx.App.
I am using the following script to 'maximize' the current application window on my mac.
It works fine when the frontmost application window is on the main / larger external display, or when my laptop is not connected to an external display.
However, when I am connected to an external display, and the window I am trying to maximize is on my laptop display (not the external, primary display), this script ends up enlarging the window to the dimensions of the larger display.
try
tell application "Finder" to set b to bounds of window of desktop
try
tell application (path to frontmost application as text)
set bounds of window 1 to {item 1 of b, 22, item 3 of b, item 4 of b}
end tell
on error
tell application "System Events" to tell window 1 of (process 1 where it is frontmost)
try
set position to {0, 22}
set size to {item 3 of b, (item 4 of b) - 22}
on error
click (button 1 of window 1 where subrole is "AXZoomButton")
end try
end tell
end try
end try
I believe the issue is the way I am getting the desired bounds, b:
bounds of window of desktop
This seems to always return the bounds of the primary display.
What I need is a way to detect the bounds of the display for the current running application that has keyboard and mouse in focus.
NB: I am totally cool if the solution to this is in Swift and not Apple Script.
Have you considered this:
tell application (path to frontmost application as text)
set zoomed of window 1 to true
end tell
I have a resize method in my js file :
$(window).resize(function(){
my_function();
});
In it i have loads of other functions which need to be called when the window is resized (for the responsive part of a website) ,i have not included all these functions as the problem i keep facing is the same in the one i am about to post.
It can't be simpler :
function my_function() {
console.log('1');
$('body').click(function(){
console.log('2');
});
}
my_function();
//when the function is called the console logs 1,when you click on the body ,it logs 2.
Now the problem, when I resize the window (for example : from full window to half in 2s),the resize() fires a couple of times (for example : 10 [every time it's different]).I know this because in the console the number 1 is called/logged 10 times as the window is being resized.Now,after i finished resizing the window, when i click on the body, the console logs the number 2 the same amount of times (10).
Why ? And how can i make it fire the click.function only once ?
Alex.
UPDATE 1 : in addition,every subsequent click on the body logs 2 another 10 times (so if i click 5 times,the console will log the number 2 50 times.