Awesomewm: How to make a not-focusable client (google-chrome in Ubuntu) in default focusable? - awesome-wm

I want to make Google chrome focusable while using awesomeWM in Ubuntu 18.04. How can I do it?
I'm new to use awesomeWM as a window manager in Ubuntu 18.04, and I prefer Google chrome (not chromium, because my password manager don't work). I installed Chrome as a .deb package in official.
However, in default, Chrome spawned by <mod> + r and google-chrome cannot be focused by <mod> + space and don't obey to layouts.
Besides I found google-chrome's WM_CLASS is Google-chrome by xwininfo and xprop and refered to the doc, I added this code in my rc.lua:
{ rule = { class = "Google-chrome" },
properties = { focusable = true }
},
And reboot. I expect this code enables google-chrome focusable, but it was still not focusable.
How do I correct the code?

Is the problem that the window is not focusable or that it cannot be tiled? Based on your description, I wonder if Chrome is defaulting to a maximized state. If you're able, try pressing <mod> + m to unmaximize the client. If that works, add maximized_vertical = false and maximized_horizontal = false to the rule:
{ rule = { class = "Google-chrome" },
properties = { focusable = true,
maximized_vertical = false,
maximized_horizontal = false }
},

Related

Toggling dark/light mode in disqus

I have a website where I post articles. It's made up of Jekyll, and deployed by GitHub. The site has a button which switches light mode to dark mode and vice versa without any page refresh.
Today I have installed disqus code to it. And It comes with either dark or light mode. So I just added this to my toggler function:
const disqusThread = $('#disqus_thread')
const ps = $('#disqus_thread *')
tdm.onclick = function() {
disqusThread.css('background-color', '#111')
ps.attr('style', 'color: #fff !important')
.
.
.
Which does actually change the background, but in no way I can change the text colour. If I try filter: invert(100%) everything is nice, but the images are also looking inverted. Using #disqus_thread *:not(img) isn't working either.
If I open firefox's inspector tool, I see the properties has !important in them. So I can't change the style anymore. And switching back and forth isn't actually working even in basic CSS.
Is there any way to flip the colour without using filter?
I was also having this problem and my workaround on this was first, the toggle button will remove all the elements inside the disqus_thread div using the code:
mydiv = document.getElementById('disqus_thread');
while (mydiv.firstChild) {
mydiv.removeChild(mydiv.firstChild);
}
Then, the button will reload the Disqus comment section using the function:
var disqus_shortname = "sample-shortname";
var disqus_url = "sample-url";
var disqus_identifier = "sample-identifier";
var disqus_loaded = false;
function disqus() {
if (!disqus_loaded) {
disqus_loaded = true;
var e = document.createElement("script");
e.type = "text/javascript";
e.async = true;
e.src = "//" + disqus_shortname + ".disqus.com/embed.js";
(document.getElementsByTagName("head")[0]
||document.getElementsByTagName("body")[0]).appendChild(e);
}
}
Lastly, since Disqus comment section was on auto, it would check the inherited color and decide if it was gonna be light or dark mode which I read from https://help.disqus.com/en/articles/1717201-disqus-appearance-customizations.
How is the color scheme determined?
- The light scheme is loaded when the text color Disqus inherits from your site has >= 50% gray contrast: between color: #000000; and color: #787878;
- The dark scheme is loaded in all other instances.
Since, by toggling the button, the website would turn the color of the body to a darker color anyway, Disqus automatically inherits this and reloads to its dark mode with just the click of the toggle button.
I don't know if this will cause lags as I was experimenting on localhost and so far it wasn't lagging for me.
References:
https://css-tricks.com/snippets/javascript/remove-element/
https://help.disqus.com/en/articles/1717201-disqus-appearance-customizations.
https://www.labnol.org/internet/load-disqus-comments-on-click/28653/

How to prevent awesome from changing focus when a mouse click occurs?

I'm using AwesomeWM 4.2 under Xfce4.
I'm using xfpanel. In rc.lua, I have done the following to prevent the xfpanel getting focus:
-- from https://github.com/zhangkun83/awesome-config/blob/d947e70041fad3e5f34bb832162cacaac62736b1/rc.lua#L492)
{ rule = { type = "dock" },
properties = {
border_width = 0,
titlebars_enabled = false,
focusable = false
}},
This works insofar as now, I cannot put the focus on the xfpanel client using keyboard conrtrols.
However, when I click somewhere on the xfpanel (e.g., open the whisker menu, or click on the NetworkManager applet, ...), Awesome makes xfpanel the focused client.
I don't like this behavior because it means I have to explicitly shift focus back to where I was working before.
Is there a way to prevent awesome from changing focus when a mouse click
occurs?
If you don't want the default settings for docks, make that rule ignore "dock" clients. With this I mean: Find the awful.rules-rule with rule = {}, and change this into rule = {}, except = { type = "dock" },.
Since this default rule sets up button bindings (buttons = clientbuttons), this means that dock-clients will no longer get these button bindings.

How can i toggle the awesome wm in total fullscreen

I'm using the awesome wm and i want every window to be to the edge of my monitor without any taskbars or title bars.
Is there a way to do this?
I'm on ubuntu 16.04 LTS.
Yes this should be easy. Simply add the line
fullscreen = true,
to your awesome rules.
Your rules would look afterwards something like this:
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
fullscreen = true,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
}
},
The taskbar would be still there but it would be hidden behind the fullscreen window.
cheers

Scrolling a browser window with modal window, Drupal 6

I'm using Drupal 6 + dialog.module, Ctools(Axaj), jQuery 1.3.2, jQuery UI
When i'm open a modal dialog window the scrollbar of the browser is locked. I can scroll that if i use mouse scroll-wheel, but not by clicking or key-up, key-down functions.
What is the trouble? I can't find any block function in code like this:
sites/all/modules/dialog/dialog.js
Drupal.CTools.AJAX.commands.dialog_display = function(command) {
var $el = Drupal.Dialog.dialog,
o = {},
overrides = {};
// Ensure that the dialog wasn't closed before the request completed.
if ($el) {
$el.html(command.output).dialog('show');
// Merge all of the options together: defaults, overrides, and options
// specified by the command, then apply them.
overrides = {
// Remove any previously added buttons.
'buttons': {},
'title': command.title,
//'maxHeight': Math.floor($(window).height() * .8), // HACK // DISABLED
'minHeight' : 700, // HACK // I've set it, and dialog window automagically adjusted - we need central part with content have height = auto, so there is no scroll bar, and hence no problems with autocomplete popups in dialog windows
};
o = $.extend({}, Drupal.settings.Dialog.defaults, overrides, command.options);
$.each(o, function (i, v) { $el.dialog('option', i, v); });
if ($el.height() > o.maxHeight) {
$el.dialog('option', 'height', o.maxHeight);
$el.dialog('option', 'position', o.position);
// This is really ugly, but dialog gives us no way to call _size() in a
// sane way!
$el.data('dialog')._size();
}
Drupal.attachBehaviors($el);
}
};
And i didn'y find anything interesting in css files. What's the trouble?

Image smoothBitmapContent doesn't work?

recently I got a jagged image problem when scaling. I set my image components smoothBitmapContent true, and it works properly the first time, but if I reset the source, the images return jagged. It seems like the smoothBitmapContent property has been changed to false, but it doesn't work even if I set it to true in run time. Anyone knows how to fix this? Thanks.
Here's is my code:
<custom1:SmoothImage id="MJCard_3_36" x="286.5" y="56.65" scaleX="0.66" scaleY="0.83" smoothBitmapContent="true"/>
MJCard_3_36.source = seabedPicArr[index1-1][index2-1][index3-1];
I simply use a custom Image-extended class and switch smoothBitmapContent on, and I set the image's source in run time.
To enable smoothing with dynamically loaded images, you need to listen to Event.COMPLETE on Image. Then get content (it should be Bitmap) and set smoothing to true:
var image:Image = new Image();
image.addEventListener(Event.COMPLETE, onLoaded);
image.source = ...
function onLoaded(event:Event):void
{
event.target.content.smoothing = true;
}

Resources