Just annotations of little "how to's", so I know I can find how to do something I've already done when I need to do it again, in case I don't remember anymore, which is not unlikely. Hopefully they can be useful to others, but I can't guarantee that it will work, or that it won't even make things worse.
Wrapper-script to launch a browser in private/incognito mode if keys control or shift are being held (thought for Openbox menus)
Tags openbox
While one can do something even more efficient with pure keybindings, or maybe merely first launching the normal window and then a private one, I thought that it was interesting. AFAIK it can't be done purely on Openbox' menu's functionalities alone.
This is set up for chrome and similar-enough derivations, where the private window is launched with "--incognito" which may need to be changed in different browsers, perhaps with some case/esac thing if one's planning to adapt it as a single script for different browsers somehow, rather than simpler a per-browser basis.
The key states to be grepped I found running this on a terminal:
Where the "dev" numbers listed are the ones I suspected would be my keyboard (actually 9), based on xinput -l. Then you press the keys and it will grep the code.
If one's holding control while clicking the Openbox menu item, the menu itself won't go away while one is holding it, so it's a bit weird in this regard, but it still work.
May not be a good idea for many reasons I can't imagine, but it's now a thing that sort of exists, hopefully it won't do any harm to anyone that may want to try it, but there's no guarantee.
Code:
#!/bin/bash xinput query-state 9 2>/dev/null | grep "key\[50\]=down\|key\[62\]=down\|key\[37\]=down\|key\[105\]=down" && incognito="--incognito" echo ${incognito/--} | aosd_cat & env NO_CHROME_KDE_FILE_DIALOG="1" /usr/bin/google-chrome ${incognito} $@ &
The key states to be grepped I found running this on a terminal:
Code:
n=0 ; while true ; do for dev in 5 11 9 16 ; do xinput query-state $dev 2>/dev/null | grep down && echo dev $dev ; done ; sleep 0.1 ; n=$((n+1)) ; ((n>1000)) && break ; done
If one's holding control while clicking the Openbox menu item, the menu itself won't go away while one is holding it, so it's a bit weird in this regard, but it still work.
May not be a good idea for many reasons I can't imagine, but it's now a thing that sort of exists, hopefully it won't do any harm to anyone that may want to try it, but there's no guarantee.
Total Comments 0