Awesome WM - Application's fullscreen mode without taking whole screen - awesome-wm

i'm looking for a way to let applications using their own fullscreen mode but without resizing their own windows.
For example, i want to watch a video on a web browser in fullscreen mode to hide all other bars/content of the browser/website except the video but i want to keep my display layout to see other apps at the same time.
Any ideas?
Thanks !

I did not test the following, but it might work. The idea of the rule is that it is used to detect which windows should not be fullscreend. It is a normal awful.rules-rule. All clients which do not match the rule are handled normally by awful.ewmh.geometry.
local rule = { class = "Firefox" }
client.disconnect_signal("request::geometry", awful.ewmh.geometry)
client.connect_signal("request::geometry", function(c, context, ...)
if context ~= "fullscreen" or not awful.rules.match(c, rule) then
awful.ewmh.geometry(c, context, ...)
end
end)
Edit: To toggle this behaviour I suggest the following:
local no_fullscreen = true
local rule = { class = "Firefox" }
client.disconnect_signal("request::geometry", awful.ewmh.geometry)
client.connect_signal("request::geometry", function(c, context, ...)
if not no_fullscreen or context ~= "fullscreen" or not awful.rules.match(c, rule) then
awful.ewmh.geometry(c, context, ...)
end
end)
Then add a key binding with callback function function() no_fullscreen = not no_fullscreen end.

Related

How i can to raise QFileDialog to the foreground if functions raise(),activeWindow() and other didn't work?

I'm using go-qt bindings (therecipe).
I faced such a problem that I cannot bring the window with the file dialog forward, I tried all the functions (and their combinations) that I could find on the Internet, but none of them did not help bring the dialog up.
I try to use this function:
fileDialog.SetWindowFlag(core.Qt__WindowStaysOnTopHint,true)
fileDialog.ActivateWindow()
fileDialog.SetWindowState(core.Qt__WindowActive)
fileDialog.SetWindowState(core.Qt__WindowMinimized|core.Qt__WindowActive)
fileDialog.Raise()
fileDialog.SetFocus2()
I also noticed a feature that if you call the dialog again after fileDialog.Exec (), then it will be displayed on top of all windows as needed.
code for this case
var fileDialog = widgets.NewQFileDialog2(nil, "Open Directory", "", "")
if fileDialog.Exec() != int(widgets.QDialog__Accepted) {
return
}
if fileDialog.Exec() != int(widgets.QDialog__Accepted) {
return
}
Code for function where I'm using Dialog:
func choseFile(){
var fileDialog = widgets.NewQFileDialog2(nil, "Open Directory", "", "")
fileDialog.SetAcceptMode(widgets.QFileDialog__AcceptOpen)
fileDialog.SetFileMode(widgets.QFileDialog__ExistingFile)
fileDialog.SetWindowFlag(core.Qt__WindowStaysOnTopHint,true)
if fileDialog.Exec() != int(widgets.QDialog__Accepted) {
return
}
fmt.Println(fileDialog.SelectedFiles()[0])
}
Problem might be related to native dialogs (in my case I am using ubuntu), so I put the flag DontUseNativeDialog. Then the problem was solved.
filename := widgets.QFileDialog_GetOpenFileName(ac.MainWindow,"Open Directory","","","",widgets.QFileDialog__DontUseNativeDialog)
upd: Its works even if the first argument is nil.

Setting eraser type to bitmap for PencilKit (iOS)

Using PencilKit for iOS, how do I set the eraser tool to .bitmap for PKToolPicker?
I can't find any setting for PKToolPicker. Trying to use PKCanvasView to observe and set the tool's eraserType as .bitmap also does not work.
override func toolPickerSelectedToolDidChange(_ toolPicker: PKToolPicker) {
var tool = toolPicker.selectedTool as? PKEraserTool
if tool != nil {
tool?.eraserType = .bitmap
}
}
The PKEraser is a struct, so when you change its eraserType, you're actually modifying a copy of the tool that's being used in the canvas.
What you need to do is simply set the PKCanvasView tool property and it will work.
override func toolPickerSelectedToolDidChange(_ toolPicker: PKToolPicker) {
var tool = toolPicker.selectedTool as? PKEraserTool
if tool != nil {
tool?.eraserType = .bitmap
}
// this line below will do the trick
canvasView.tool = tool
}
Let me know if it worked! 😊
Applies to iOS 13 and iOS 14
To set the toolpicker's selected tool as a bitmap eraser (where toolPicker is the PKToolPicker):
toolPicker?.selectedTool = PKEraserTool(.bitmap)
To set the canvas view's tool to a bitmap eraser (where canvasView is the PKCanvasView):
canvasView.tool = PKEraserTool(.bitmap)
This code, based on your example, will keep the toolpicker's erase tool as bitmap(pixel eraser) even if vector(object eraser) was chosen. (tested on iOS 14)
func toolPickerSelectedToolDidChange(_ toolPicker: PKToolPicker) {
if toolPicker.selectedTool is PKEraserTool {
toolPicker.selectedTool = PKEraserTool(.bitmap)
}
}

How do I turn off the Accessibility Inspector in the iOS 9 simulator?

The accessibility inspector is turned on by my KIF tests (apparently it's necessary for KIF to work.) Problem is, its window occludes controls some subsequent UI tests need to tap on and those tests fail.
How can I turn the Accessibility Inspector off when my KIF tests are done with it so my UI Tests can run?
(Turning it off "manually" from the simulator's Settings app is not a solution—I'm looking for something I can call from code, set in the target or...?)
It is not on by default. You must turn it on manually.
I saw the following on Stew Gleadow's blog.
You just need to change the line:
CFPreferencesSetValue(CFSTR("ApplicationAccessibilityEnabled"), kCFBooleanFalse, accessibilityDomain, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
change kCFBooleanTrue to kCFBooleanFalse.
+ (void)_enableAccessibilityInSimulator {
NSAutoreleasePool *autoreleasePool = [[NSAutoreleasePool alloc] init];
NSString *appSupportLocation = #"/System/Library/PrivateFrameworks/AppSupport.framework/AppSupport";
NSDictionary *environment = [[NSProcessInfo processInfo] environment];
NSString *simulatorRoot = [environment objectForKey:#"IPHONE_SIMULATOR_ROOT"];
if (simulatorRoot) {
appSupportLocation = [simulatorRoot stringByAppendingString:appSupportLocation];
}
void *appSupportLibrary = dlopen([appSupportLocation fileSystemRepresentation], RTLD_LAZY);
CFStringRef (*copySharedResourcesPreferencesDomainForDomain)(CFStringRef domain) = dlsym(appSupportLibrary, "CPCopySharedResourcesPreferencesDomainForDomain");
if (copySharedResourcesPreferencesDomainForDomain) {
CFStringRef accessibilityDomain = copySharedResourcesPreferencesDomainForDomain(CFSTR("com.apple.Accessibility"));
if (accessibilityDomain) {
CFPreferencesSetValue(CFSTR("ApplicationAccessibilityEnabled"), kCFBooleanFalse, accessibilityDomain, kCFPreferencesAnyUser, kCFPreferencesAnyHost);
CFRelease(accessibilityDomain);
}
}
[autoreleasePool drain];
}

How to set focus on a client under mouse cursor when a tag is changed?

When I switch to another tag, a new client gets selected, but it is sometimes not a client that I have my mouse cursor over. To get a client under my mouse pointer focused, I have to either click somewhere on it, or switch to it with Mod4+j / k, or move mouse cursor out and back on that client.
I want awesome to give focus to a client that is under the mouse cursor whenever a tag is changed. How do I do that?
I found a function mouse.object_under_pointer() that finds the client I need, but I don't know when to call that function. Should I connect a handler to some particular signal? I tried connecting to various signals from Signals page on the wiki and checking with naughty.notify() if that is the right signal, but none of them were triggered when I was switching between tags.
This code did the trick, however there should be a better way to do this than setting up a huge 200 ms timer (smaller timeouts didn't properly focus some clients for me, but you can try setting a smaller one).
tag.connect_signal(
"property::selected",
function (t)
local selected = tostring(t.selected) == "false"
if selected then
local focus_timer = timer({ timeout = 0.2 })
focus_timer:connect_signal("timeout", function()
local c = awful.mouse.client_under_pointer()
if not (c == nil) then
client.focus = c
c:raise()
end
focus_timer:stop()
end)
focus_timer:start()
end
end
)
tag is this global object, so you should just place this code anywhere in your rc.lua.
Two things should be done:
First, you should remove require("awful.autofocus") from your config, so that this module no longer tries to focus some client via the focus history when you switch tags.
Then, this code works for me:
do
local pending = false
local glib = require("lgi").GLib
tag.connect_signal("property::selected", function()
if not pending then
pending = true
glib.idle_add(glib.PRIORITY_DEFAULT_IDLE, function()
pending = false
local c = mouse.current_client
if c then
client.focus = c
end
return false
end)
end
end)
end
This uses GLib directly to get a callback for when no other events are pending. This should mean that "everything else" was handled.
I know this is pretty old, but it helped me to come up with this
function focus_client_under_mouse()
gears.timer( { timeout = 0.1,
autostart = true,
single_shot = true,
callback = function()
local n = mouse.object_under_pointer()
if n ~= nil and n ~= client.focus then
client.focus = n end
end
} )
end
screen.connect_signal( "tag::history::update", focus_client_under_mouse )

VideoDisplay fullscreen

How does one do fullscreen with VideoDisplay?
I am using:
stage.fullScreenSourceRect = new Rectangle(video.x, video.y, video.width, video.height);
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.displayState = StageDisplayState.FULL_SCREEN;
But this does not allow me to go back to normal screen, not even i use:
stage.displayState = StageDisplayState.NORMAL
Thanks,
I cannot test this right now but you have written stage.displayState == StageDisplayState.NORMAL with == instead of =.
Instead of assigning the value StageDisplayState.NORMAL to stage.displayState you simply compare the two.
From the playbook dev support forums, you do not use StateDisplay in playbook for video maximization because the screen already runs in StageDisplay.FULLSCREEN_INTERACTIVE so it doesn't work - set the video dimensions to the size of the screen. And then back again to reduce.

Resources