added herbst, qutebrowser, and st configs

This commit is contained in:
Rudis Muiznieks 2022-04-07 18:49:13 -05:00
parent 25622e68d2
commit 1f1c31d1f2
10 changed files with 1462 additions and 0 deletions

4
.gitignore vendored
View File

@ -1 +1,5 @@
nvim/plugin
qutebrowser/bookmarks
qutebrowser/quickmarks
qutebrowser/qsettings
qutebrowser/qutepocket.secrets

120
herbstluftwm/ellison/autostart Executable file
View File

@ -0,0 +1,120 @@
#!/usr/bin/env bash
# this is a simple config for herbstluftwm
hc() {
herbstclient "$@"
}
hc emit_hook reload
if hc silent new_attr bool my_picom_is_running; then
picom -b
fi
xsetroot -solid "#080808" -cursor_name left_ptr &
feh --bg-fill ~/.config/herbstluftwm/wallpaper.jpg
# remove all existing keybindings
hc keyunbind --all
hc set default_frame_layout max
hc set_layout max
# keybindings
Mod=Mod4 # Use the super key as the main modifier
hc keybind $Mod-Shift-q quit
hc keybind $Mod-Control-r reload
hc keybind $Mod-Shift-c close
hc keybind $Mod-Return spawn st
hc keybind $Mod-Control-Return spawn qutebrowser
hc keybind Print spawn flameshot gui
hc keybind XF86AudioRaiseVolume spawn sh -c "pamixer -i 5; pamixer --get-volume >> \"$xobpipe\"; $refresh_panel"
hc keybind XF86AudioLowerVolume spawn sh -c "pamixer -d 5; pamixer --get-volume >> \"$xobpipe\"; $refresh_panel"
hc keybind XF86AudioMute spawn sh -c "pamixer -t; pamixer --get-volume-human | sed 's/muted/0/' >> \"$xobpipe\"; $refresh_panel"
hc keybind XF86Launch7 spawn sh -c "sleep 0.15 && xdotool keydown ctrl key w keyup ctrl"
# basic movement in tiling and floating mode
# focusing clients
hc keybind $Mod-Left focus left
hc keybind $Mod-Down focus down
hc keybind $Mod-Up focus up
hc keybind $Mod-Right focus right
# moving clients in tiling and floating mode
hc keybind $Mod-Shift-Left shift left
hc keybind $Mod-Shift-Down shift down
hc keybind $Mod-Shift-Up shift up
hc keybind $Mod-Shift-Right shift right
# layouting
hc keybind $Mod-f fullscreen toggle
hc keybind $Mod-Shift-f set_attr clients.focus.floating toggle
# The following cycles through the available layouts within a frame, but skips
# layouts, if the layout change wouldn't affect the actual window positions.
# I.e. if there are two windows within a frame, the grid layout is skipped.
hc keybind $Mod-space or , and . compare tags.focus.curframe_wcount = 2 . cycle_layout +1 vertical horizontal max vertical grid , cycle_layout +1
# mouse
hc mouseunbind --all
hc set focus_follows_mouse true
hc set focus_follows_monitor_boundaries true
hc mousebind $Mod-Button1 move
hc mousebind $Mod-Button3 resize
# focus
hc keybind $Mod-BackSpace cycle_monitor
hc keybind $Mod-Tab cycle_all +1
hc keybind $Mod-Shift-Tab cycle_all -1
hc keybind $Mod-Alt-Tab jumpto urgent
# theme
hc attr theme.tiling.reset 1
hc attr theme.floating.reset 1
hc set always_show_frame on
hc set frame_bg_transparent off
hc attr theme.active.color '#95e454'
hc attr theme.normal.color '#88b8f6'
hc attr theme.urgent.color '#e5796d'
hc attr theme.inner_color black
hc attr theme.border_width 1
hc attr theme.floating.border_width 2
hc attr theme.floating.outer_width 1
hc attr theme.floating.outer_color black
hc attr theme.background_color '#080808'
hc set window_gap 0
hc set frame_padding 0
hc set smart_window_surroundings on
hc set smart_frame_surroundings on
hc set mouse_recenter_gap 0
hc set frame_active_opacity 1
hc set frame_normal_opacity 1
hc set frame_bg_active_color '#0000000000'
hc set snap_distance 0
hc set snap_gap 0
# rules
hc unrule -F
#hc rule class=XTerm tag=3 # move all xterms to tag 3
hc rule focus=on # normally focus new clients
hc rule floatplacement=smart
#hc rule focus=off # normally do not focus new clients
# give focus to most common terminals
#hc rule class~'(.*[Rr]xvt.*|.*[Tt]erm|Konsole)' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(DIALOG|UTILITY|SPLASH)' floating=on
hc rule windowtype='_NET_WM_WINDOW_TYPE_DIALOG' focus=on
hc rule windowtype~'_NET_WM_WINDOW_TYPE_(NOTIFICATION|DOCK|DESKTOP)' manage=off
hc rule class='nvim-zen' fullscreen=on
hc set tree_style '╾│ ├└╼─┐'
# unlock, just to be sure
hc unlock
# do multi monitor setup here, e.g.:
# hc set_monitors 1280x1024+0+0 1280x1024+1280+0
# or simply:
hc detect_monitors

View File

@ -0,0 +1,28 @@
# If a config.py file exists, this file is ignored unless it's explicitly loaded
# via config.load_autoconfig(). For more information, see:
# https://github.com/qutebrowser/qutebrowser/blob/master/doc/help/configuring.asciidoc#loading-autoconfigyml
# DO NOT edit this file by hand, qutebrowser will overwrite it.
# Instead, create a config.py - see :help for details.
config_version: 2
settings:
bindings.commands:
global:
normal:
',p': spawn --userscript qutepocket
content.canvas_reading:
global: false
content.geolocation:
global: false
content.headers.accept_language:
global: en-US,en;q=0.5
content.headers.custom:
global:
accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
content.headers.user_agent:
global: Mozilla/5.0 (Windows NT 10.0; rv:68.0) Gecko/20100101 Firefox/68.0
content.notifications.enabled:
global: false
spellcheck.languages:
global:
- en-US

11
qutebrowser/config.py Normal file
View File

@ -0,0 +1,11 @@
import os
config.load_autoconfig()
c.colors.webpage.preferred_color_scheme = 'dark'
c.fonts.default_size = '12pt'
#c.zoom.default = '120%'
import glob
c.content.user_stylesheets = glob.glob(os.path.expanduser('~/.config/qutebrowser/styles/*.css'))

View File

@ -0,0 +1,52 @@
// ==UserScript==
// @include /^https?://(www\.|)hckrnews\.com/.*$/
// ==/UserScript==
GM_addStyle(`
body,
.form-actions {
background: #242424 !important;
color: #e3e0d7 !important;
}
a {
color: #cae682 !important;
}
.entries a.link {
color: #e3e0d7 !important;
}
.entries a.link:visited,
.entries .source {
color: #9c998e !important;
}
.entries .homepage {
color: #e5796d !important;
}
header a,
header a:hover {
color: #88b8f6 !important;
}
.entries a:hover {
background-color: #080808 !important;
color: #95e454 !important;
}
.entries .tab,
.menu .nav-pills > .active > a,
.menu .nav-pills > .active > a:hover {
background-color: #88b8f6 !important;
color: #080808 !important;
}
.nav > li > a:hover {
background-color: #080808 !important;
color: #e3e0d7 !important;
}
.entries .day {
border-color: #88b8f6 !important;
}`);

View File

@ -0,0 +1,13 @@
// ==UserScript==
// @name Reddit to Libreddit Redirect
// @namespace RedirectRedditToLibreddit
// @description redirect reddit links to libreddit
// @include https://www.reddit.com/
// @include https://www.reddit.com/r/*
// @include https://www.reddit.com/search*
// @version 1.01
// @grant none
// ==/UserScript==
var newurl = window.location.href.replace(/\/\/(www\.)?reddit.com\//, '//libreddit.spike.codes/');
window.location.replace(newurl);

View File

@ -0,0 +1,561 @@
// ==UserScript==
// @name Login reminder popup remover
// @name:it Rimuovi i popup di richiesta d'accesso
// @namespace StephenP
// @description Removes the nagging login popups and banners from mobile and desktop versions of Facebook, Instagram, Reddit, Twitter, Quora, Ask.fm, VK and from the mobile version of Youtube.
// @description:it Rimuovi i fastidiosi banner e popup di richiesta d'accesso dalle versioni mobile e desktop di Facebook, Instagram, Reddit, Twitter, Quora, Ask.fm, VK e dalla versione mobile di Youtube.
// @match https://*.facebook.com/*
// @exclude https://developers.facebook.com/*
// @exclude https://www.instagram.com/accounts/login/*
// @exclude https://twitter.com/intent/tweet?*
// @exclude https://mobile.twitter.com/intent/tweet?*
// @match https://www.instagram.com/*
// @match https://m.youtube.com/*
// @match https://www.youtube.com/*
// @match https://www.reddit.com/*
// @match https://twitter.com/*
// @match https://mobile.twitter.com/*
// @match https://*.quora.com/*
// @match https://ask.fm/*
// @match https://vk.com/*
// @match https://m.vk.com/*
// @include https://www.pinterest.tld/*
// @version 2.2.0
// @grant none
// @contributionURL https://nowpayments.io/donation/stephenpgreasyfork
// @icon data:image/x-icon;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgBAMAAACBVGfHAAAAG1BMVEXTrvFOWZTEN4aXQ6vcRGPsbUH2sVjlt7/////5Q3C9AAAAAXRSTlMAQObYZgAAANJJREFUKM+9z7EKwjAQgOFIqbPFpXMUmlHMoKsQsKtgsC9g3WMkWS2V3GN7SZrQwdl/68fdlRBCFtWac74jqYLHsvBUHjiA75lGCm6dMca6BPzg9hSzajPBcQjfbKAJFLXgTJOBqQYMqAx7pnCaDRko060W5xGhwlZk20Y4R6iIaHU3inYG3euGR3UG2b0k/lYg1AABPhLDTQoRbs7D1SYoJcTHCQZvf6PsH+H5GiEcJb0Pd0Q9wdLDXV5PdVyZRF7CYgDMz/6E9xyqdPR/sMiw+gKZRGTvTIJM4gAAAABJRU5ErkJggg==
// ==/UserScript==
var interval_0;
var interval_1;
var interval_2;
var interval_3;
var interval_4;
var mutationObserver_0;
var url;
(function(){
applyUserCss();
setInterval(checkPageChanged,1000);
})();
function checkPageChanged(){
if(document.location!=url){
console.log("Changed url from "+url+" to "+document.location.toString());
interval_4=setInterval(checkPageReady,500);
url=document.location.toString();
}
}
function applyUserCss(){//this function adds the css styling for removing popups to the head of the document, as soon as possible when the page is loaded. Other popups that can't be removed just with css selectors are removed later with the check() function
let st=document.createElement("STYLE");
if(document.location.href.includes("instagram.com")){
st.textContent=".u7YqG{z-index: 1} .xUdfV{z-index: 2} ._3sb-{z-index: 3} .G_hoz.LcKDX, ._7zNgw.GLdVF{z-index: 2} .FFVAD{z-index: 1} .tWeCl{z-index: 1} .v5DqJ, .RnEpo.Yx5HN, .RnEpo._Yhr4, .xZ2Xk, .tHaIX{display: none !important} body{overflow-y: scroll !important} .CzVzU>div{z-index: 4}";
}
else if(document.location.href.includes("twitter.com")){
//IF EDITING THIS LIST OF POPUPS, KEEP IT IN SYNC WITH THE POPUPS LISTED blockBannerTw
st.textContent="#layers>.css-1dbjc4n.r-aqfbo4.r-1p0dtai.r-1d2f490.r-12vffkv.r-1xcajam.r-zchlnj>.css-1dbjc4n.r-12vffkv>.css-1dbjc4n.r-12vffkv>.css-1dbjc4n.r-l5o3uw, .css-1dbjc4n.r-1awozwy.r-14lw9ot.r-1dgieki.r-1efd50x.r-5kkj8d.r-18u37iz.r-16y2uox.r-1a1dyw.r-1swwhx3.r-1j3t67a.r-1qxgc49, .css-1dbjc4n.r-1awozwy.r-1kihuf0.r-18u37iz.r-1pi2tsx.r-1777fci.r-1pjcn9w.r-1xcajam.r-ipm5af.r-g6jmlv, .css-1dbjc4n.r-aqfbo4.r-1d2f490.r-12vffkv.r-1xcajam.r-zchlnj.r-ipm5af{display: none !important}";
}
else if(document.location.href.includes("reddit.com")){
st.textContent=".m-blurred {filter: blur(0)} .XPromoNSFWBlocking__warning, .XPromoNSFWBlockingModal, .xPromoChoiceBanner, .XPromoPill, .XPromoPopup, .GetAppFooter, .XPromoInFeed, .XPromoBlockingModal, .PreviewDrawer, [data-testid=bottom-cell-wrapper]{display: none !important} .scroll-disabled {overflow-y: scroll !important; position: static !important} .NavFrame {overflow-y: scroll !important}";
}
else if(document.location.href.includes("quora.com/")){
st.textContent="*, #page_wrapper {filter: none !important} .new_signup_dialog{display: none !important} .q-platform--mobile{overflow-y: scroll !important; overflow-x: hidden !important;} .q-sticky{position: inherit !important}";
}
else if(document.location.href.includes("https://ask.fm/")){
st.textContent="body{overflow-y: scroll !important} .expired-countdown::after{display: none !important}";
}
else if(document.location.href.includes("vk.com/")){
st.textContent="body{overflow-y: scroll !important} .PageBottomBanner--unauth{display: none !important}";
}
else if(document.location.href.includes("//m.youtube.com")){
st.textContent=".upsell-dialog-lightbox{display: none !important} [modal-open-body]{position: inherit !important}";
}
else if(document.location.href.includes("//www.youtube.com")){
st.textContent="ytd-guide-signin-promo-renderer{display: none !important}";
}
else if(document.location.href.includes("facebook.com")){
st.textContent=".asf1osic.k4urcfbm.j9ispegn.poy2od1o.tw6a2znq.m7u2wfa4.d1544ag0.i3j981x3.rlt63pii.i09qtzwb.hybvsw6c{display: none !important}";
if((!document.location.href.includes("m.facebook.com"))&&(!document.location.href.includes("iphone.facebook.com"))&&(!document.location.href.includes("x.facebook.com"))&&(!document.location.href.includes("touch.facebook.com"))){
st.textContent+="#pagelet_growth_expanding_cta{display: none !important}";
}
else if(document.location.href.includes("touch.facebook.com")){
st.textContent+="._4b-b{display: none !important}";
}
}
else if(document.location.href.includes("quora.com")){
st.textContent=".signup_wall_wrapper>.BaseSignupForm._DialogSignupForm{display: none !important}";
}
else if(document.location.href.includes("https://www.pinterest.")){
st.textContent="[data-test-id=bottom-right-upsell], [data-test-id=giftWrap], [data-test-id=fullPageSignupModal], [data-test-id=floating-app-upsell], .FNs.XiG.zI7.iyn.Hsu{display: none !important} .article-row{-ms-overflow-style: auto !important;scrollbar-width: auto !important;} ::-webkit-scrollbar {display: block !important;} ::-webkit-scrollbar-thumb {background: grey;}";
}
document.getElementsByTagName("HEAD")[0].appendChild(st);
}
function checkPageReady(){
if((document.getElementsByTagName("BUTTON").length>0)||(document.getElementsByTagName("FORM").length>0)||(document.getElementsByClassName("signup_login_buttons").length>0)||(document.getElementById("layers")!==null)||(document.getElementById("mcont")!==null)){//If buttons are there, the page should have loaded. At least that's what I see...
console.log("Page is ready");
clearInterval(interval_4);
if(document.location.href.includes("facebook.com")){
interval_0=setInterval(blockPopupFB,500);
}
else if(document.location.href.includes("instagram.com")){
clearInterval(interval_2);
//The following observer checks if the popup is a login popup or a suggestion to use the app: if that's not the case, the popup is displayed.
const igPopupObserverConfig = { attributes: false, childList: true, subtree: false };
const igPopupObserverCallback = function(mutationsList, observeIgPopups) {
for(const mutation of mutationsList) {
if(mutation.addedNodes.length>0){
//console.log(mutation);
if(mutation.addedNodes[0].classList.contains("RnEpo")){
//console.log(!mutation.addedNodes[0].querySelector("[name='username']"));
if((!mutation.addedNodes[0].querySelector("[name='username']"))&&(!mutation.addedNodes[0].querySelector("[href*='/accounts/login/']"))){
let style="";
if(mutation.addedNodes[0].hasAttribute("style")){
style=mutation.addedNodes[0].getAttribute("style");
}
mutation.addedNodes[0].setAttribute("style","display: block !important;"+style);
}
}
}
}
};
const observeIgPopups = new MutationObserver(igPopupObserverCallback);
observeIgPopups.observe(document.body, igPopupObserverConfig);
//interval_1=setInterval(blockBannerIG,200);
if((document.location.href.includes('instagram.com/p/'))||(document.location.href.includes('instagram.com/tv/'))||(document.location.href.includes('/reel/'))){
if((document.location.href.includes('/tv/'))){
let igtvVideo=document.getElementsByTagName("VIDEO")[0];
let cln=igtvVideo.cloneNode(true);
insertAfter(cln,igtvVideo);
igtvVideo.remove();
}
interval_0=setInterval(allowVideoReplayStarterIG,500);
}
else if(document.location.href.includes('/channel')){
if(document.getElementsByClassName("coreSpriteSearchIcon").length>0){//only desktop version shows login popup on igtv
interval_2=setInterval(removePicturePopupIGTV,1000);
}
}
else if((document.location.href.includes('/reels/'))||
(document.location.href.includes('/guides/'))||
(document.location.href.includes('/guide/'))){
//do nothing;
}
else{//this should ideally only include the main page of the profile
//interval_2=setInterval(blockPopupIG,200);
let sectionLinks=document.getElementsByClassName("_9VEo1");
for(let sectionLink of sectionLinks){
if(sectionLink.href.includes("%2Ffeed%2F")){
let tmpSectionLink=sectionLink.cloneNode(true);
tmpSectionLink.href=document.location.href+"feed/";
sectionLink=sectionLink.parentNode.replaceChild(tmpSectionLink,sectionLink);
break;
}
}
interval_3=setInterval(removeRelatedAccounts,200);
interval_2=setInterval(removePicturePopup,500);
}
}
else if(document.location.href.includes("reddit.com")){//reddit has a wide range of different login reminders for installing the app or logging in when browsing from a phone
if(document.getElementsByClassName("TopNav__promoButton").length>0){
var isMobile=true;
if(document.getElementsByClassName("MobileButton").length==0){
isMobile=false;
}
redditPatch(isMobile);
}
}
else if(document.location.href.includes("quora.com/")){
quoraPatchObserver();
}
else if(document.location.href.includes("/twitter.com")){
blockBannerTW("d");
}
else if(document.location.href.includes("mobile.twitter.com")){
blockBannerTW("m");
}
else if(document.location.href.includes("https://ask.fm/")){
removeAskFmLoginPopup();
}
else if(document.location.href.includes("https://vk.com/")){
checkVKLoginPopup("d");
}
else if(document.location.href.includes("https://m.vk.com/")){
checkVKLoginPopup("m");
}
else if(document.location.href.includes("https://www.pinterest.")){
document.body.setAttribute("style", "overflow-y: auto !important");
}
}
else{
console.log("still non buttons");
}
}
function blockPopupFB(){
var popupFB;
var loc=document.location.href;
if((loc.includes("m.facebook.com"))||(loc.includes("iphone.facebook.com"))||(loc.includes("x.facebook.com"))){
popupFB=document.getElementById("popup_xout").parentNode.parentNode.parentNode;
}
if(popupFB==undefined){
popupFB=document.getElementsByClassName("_5hn6")[0];
if(popupFB==undefined){
popupFB=document.getElementById("login_popup_cta_form").parentNode.parentNode.parentNode.parentNode;
let scrollview=document.getElementById("scrollview");
scrollview.parentNode.lastChild.remove();
scrollview.style.scrollbarWidth="auto";
document.getElementsByClassName("asf1osic k4urcfbm j9ispegn poy2od1o tw6a2znq m7u2wfa4 d1544ag0 i3j981x3 rlt63pii i09qtzwb hybvsw6c")[0].remove();
}
}
if(popupFB!==undefined){
popupFB.parentNode.removeChild(popupFB);
clearInterval(interval_0);
}
}
function removeRelatedAccounts(){
//var t0=performance.now();
let morePostsBtn=document.getElementsByClassName('tCibT qq7_A z4xUb w5S7h')[0];
if(morePostsBtn!==undefined){
morePostsBtn.click();
clearInterval(interval_3);
}
else{
var closeButtons=document.getElementsByClassName("fUzmR");
if(closeButtons.length>0){
for(var i=0;i<closeButtons.length;i++){
//closeButtons[i].click();
}
clearInterval(interval_3);
}
}
//var t1=performance.now();
//alert(t1-t0);
}
function removePicturePopup(){
console.log("removing picture popup");
if(!document.location.href.includes("/p/")){
var photoLinks=document.getElementsByClassName("v1Nh3");
for(var i=0;i<photoLinks.length;i++){
if(photoLinks[i].getAttribute("class").includes("repaired")===false){
if(photoLinks[i].getElementsByTagName("IMG")[0].getAttribute("src")!==null){
var cln = photoLinks[i].children[0].cloneNode(true);
photoLinks[i].removeChild(photoLinks[i].children[0]);
photoLinks[i].appendChild(cln);
photoLinks[i].setAttribute("class",(photoLinks[i].getAttribute("class")+" repaired"));
photoLinks[i].children[0].setAttribute("target","_blank");
photoLinks[i].children[0].setAttribute("rel","noopener noreferrer");
photoLinks[i].children[0].children[0].children[0].children[0].style.visibility="visible";
}
}
}
}
}
function removePicturePopupIGTV(){
console.log("removing picture popup from igtv");
if(!document.location.href.includes("/tv/")){
var videoLinks=document.getElementsByClassName("_bz0w");
for(var i=0;i<videoLinks.length;i++){
if(videoLinks[i].getAttribute("class").includes("repaired")===false){
if(videoLinks[i].getElementsByClassName("lVhHa RNL1l")[0].style.backgroundSrc!==null){
var cln = videoLinks[i].cloneNode(true);
cln.setAttribute("class",(videoLinks[i].getAttribute("class")+" repaired"));
insertAfter(cln,videoLinks[i]);
videoLinks[i].remove();
}
}
}
}
}
function insertAfter(newNode, existingNode) {
existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);
}
/*function blockPopupIG(){ //kept for reference
if(document.getElementsByClassName("RnEpo")[0]!==undefined){
setScrollable();
}
}*/
/*function setScrollable(){ //kept for reference
document.body.style.overflow = "scroll !important";
}*/
function blockBannerTW(s){
/*if(s=='d'){
document.getElementsByClassName("css-1dbjc4n r-16y2uox r-1n0xq6e")[0].parentNode.parentNode.parentNode.parentNode.remove();
}
else{
var banner=document.getElementsByClassName("css-1dbjc4n r-1awozwy r-1pz39u2 r-18u37iz r-16y2uox")[0].parentNode;
if(banner!=='undefined'){
banner.parentNode.style.height="53px";
banner.remove();
}
banner=document.getElementsByClassName("css-1dbjc4n r-urgr8i r-97e31f")[0];
if(banner!=='undefined'){
banner.remove();
}
}*/
if(mutationObserver_0===undefined){
function callback_a(mutationList) {
mutationList.forEach(function(mutation) {
let largeLP;
//IF EDITING THIS LIST OF POPUPS, KEEP IT IN SYNC WITH THE POPUPS LISTED IN CUSTOM CSS
largeLP=document.querySelector(".css-1dbjc4n.r-aqfbo4.r-1d2f490.r-12vffkv.r-1xcajam.r-zchlnj.r-ipm5af");//big login popup triggered when clicking on "like" or "comment" (mobile)
if(largeLP===null){
largeLP=document.querySelector(".css-1dbjc4n.r-1awozwy.r-1kihuf0.r-18u37iz.r-1pi2tsx.r-1777fci.r-1pjcn9w.r-1xcajam.r-ipm5af.r-g6jmlv");//big login popup triggered when clicking on "like" or "comment" (desktop);
}
if(largeLP===null){
largeLP=document.querySelector(".css-1dbjc4n.r-1awozwy.r-14lw9ot.r-1dgieki.r-1efd50x.r-5kkj8d.r-18u37iz.r-16y2uox.r-1a1dyw.r-1swwhx3.r-1j3t67a.r-1qxgc49");//another popup (i don't remember which one)
}
if(largeLP===null){
largeLP=document.querySelector("#layers>.css-1dbjc4n.r-aqfbo4.r-1p0dtai.r-1d2f490.r-12vffkv.r-1xcajam.r-zchlnj>.css-1dbjc4n.r-12vffkv>.css-1dbjc4n.r-12vffkv>.css-1dbjc4n.r-l5o3uw");//another popup (i don't remember which one)
}
if(largeLP!==null){
if(mutation.target.style.overflow=="hidden"){//definitely not the right way to do it, but setting the style attributes with mutation.target.style doesn't work.
let restyle=mutation.target.getAttribute("style");
restyle=restyle.replace("overflow: hidden","overflow: auto scroll");
restyle=restyle.replace("margin-right: 17px","margin-right: auto");
restyle=restyle.replace("overscroll-behavior-y: none;","overscroll-behavior-y: auto");
restyle=restyle.replace("position: fixed","position: unset");
mutation.target.setAttribute("style",restyle);
}
}
});
}
mutationObserver_0 = new MutationObserver(callback_a);
mutationObserver_0.observe(document.documentElement, {attributes: true});
}
}
function redditPatch(isMobile){
const nav=document.getElementsByClassName("NavFrame__below-top-nav")[0];
const config = { attributes: false, childList: true, subtree: true };
var firstCheck=true;
var redditPic=document.body.getElementsByTagName("IMG");
const callback = function(mutationsList, observer) {
for(const mutation of mutationsList) {
if(isMobile){
let articles=mutation.target.getElementsByTagName("ARTICLE");
if(articles.length>0){
for (const article of articles){
if(!article.classList.contains("replaced")){
if((article.getElementsByTagName("video").length==0)&&(article.getElementsByClassName("slideImageMainDiv").length==0)){
var articleCopy=article.cloneNode(true);
articleCopy.classList.add("replaced");
article.replaceWith(articleCopy);
}
}
}
}
}
if(firstCheck==false){
redditPic=mutation.target.getElementsByTagName("IMG");
}
if(redditPic.length>0){
for(var i=0;i<redditPic.length;i++){
if((redditPic[i].getAttribute("src").includes("blur="))&&(redditPic[i].getAttribute("src").includes("/preview."))){
redditPic[i].setAttribute("src",redditPic[i].getAttribute("src").split("?")[0].replace("preview","i"));
}
}
firstCheck=false;
}
}
};
const bodyObserver = new MutationObserver(callback);
bodyObserver.observe(nav, config);
}
function quoraPatchObserver(){
var firstCheck=true;
var searchBox=document.createElement("DIV");
searchBox.className="q-flex qu-alignItems--center qu-justifyContent--center";
searchBox.style="box-sizing: border-box; display: flex; max-width: 100%;";
let a=document.createElement("INPUT");
a.id="search";
a.style="height: 44px; text-align: center; border-radius: 22px; background-color:white; width: 100%; margin: 0.5em";
a.className="selector_input text";
a.value="";
a.setAttribute("data-lpignore","true");
a.setAttribute("data-group","js-editable");
a.setAttribute("placeholder","Search");
a.setAttribute("w2cid","wS7KcEIg18");
searchBox.appendChild(a);
searchBox.addEventListener('keypress', function(e){searchQuora(e);});
try{
document.getElementsByClassName("q-sticky qu-zIndex--header")[0].appendChild(searchBox);
}
catch(e){
try{
document.getElementsByClassName("header_main")[0].appendChild(searchBox);
document.getElementsByClassName("query_title")[0].style.marginTop="2em";
}catch(err){console.log("Info: if you are browsing from a PC, this error is expected.");}
}
quoraPatch(firstCheck);
firstCheck=false;
const config = { attributes: true, childList: true, subtree: false };//this rough implementation is slower
const callback = function(mutationsList, observer) {
for(const mutation of mutationsList) {
quoraPatch(firstCheck);
}
};
const bodyObserver = new MutationObserver(callback);
bodyObserver.observe(document.body, config);
}
function quoraPatch(firstCheck){
var i;
var wall;
if(firstCheck==true){
wall=document.getElementsByClassName("q-box qu-overflow--hidden");
if(wall.length>1){
let bgColor=getComputedStyle(wall[0].parentNode.children[0]).backgroundColor;
if(bgColor=="rgba(68, 68, 68, 0.85)"){
wall[0].parentNode.children[0].remove();
wall[0].classList.remove("qu-overflow--hidden");
}
}
}
if(document.body.className.includes('signup_wall_prevent_scroll')){
document.body.classList.remove('signup_wall_prevent_scroll');
}
wall=document.getElementsByClassName('new_web_signup_wall_design');
if(wall.length>0){
wall[0].parentNode.parentNode.remove();//desktop
}
wall=document.getElementsByClassName('modal_bg new_signup_dialog');
if(wall.length>0){
wall[0].parentNode.remove();//mobile
}
wall=document.getElementsByClassName('q-absolute qu-full qu-bg--blue');
if(wall.length>0){
wall[0].parentNode.remove();//mobile
}
}
function searchQuora(e) {
if (e.key === 'Enter') {
window.open("https://www.quora.com/search?q="+document.getElementById("search").value,"_self");
}
}
function removeAskFmLoginPopup(){
try{
const closeButton=document.createElement("DIV");
closeButton.id="closeButton";
closeButton.style.padding="1em";
closeButton.style.right="1em";
closeButton.style.top="1em";
closeButton.style.position="absolute";
closeButton.textContent="X";
closeButton.style.borderRadius="3px";
closeButton.style.backgroundColor="#666666";
closeButton.style.color="#FFFFFF";
closeButton.style.cursor="pointer";
closeButton.addEventListener("click",function(e){document.getElementsByClassName("lightbox_overlay")[0].remove();});
var lightbox=document.getElementsByClassName("lightbox_overlay");
console.log(lightbox.length);
if(lightbox.length>0){
if(lightbox[0].getElementsByClassName("lightbox_content-conversion").length>0){
lightbox[0].parentNode.removeChild(lightbox[0]);
}
}
const callback = function(mutationsList, observer) {
for(const mutation of mutationsList) {
console.log("A");
for(let newNode of mutation.addedNodes){
if(newNode.className.includes("lightbox_overlay")){
if(newNode.getElementsByClassName("lightbox_content-conversion").length>0){
console.log("popup deleted");
newNode.parentNode.removeChild(newNode);
}
else{
newNode.appendChild(closeButton);
}
}
}
}
};
const config = { attributes: false, childList: true, subtree: true };
const observer = new MutationObserver(callback);
observer.observe(document.documentElement, config);
}
catch(err){console.log("ERROR: "+err);}
}
function checkVKLoginPopup(mode){
const popups=document.getElementsByClassName("UnauthActionBoxContainer");
if(popups.length>0){
removeVKLoginPopup(popups[0]);
}
const config = { attributes: false, childList: true, subtree: false };
const callback = function(mutationsList, observer) {
for(const mutation of mutationsList) {
for(let newNode of mutation.addedNodes){
if(newNode.className.includes("UnauthActionBoxContainer")){
removeVKLoginPopup(newNode,mode);
}
else if(newNode.getElementsByClassName("UnauthorizedActionModal")!==undefined){
removeVKLoginPopup(newNode,mode);
}
}
}
};
const observer = new MutationObserver(callback);
if(mode=="d"){
observer.observe(document.getElementById("box_layer"), config);
}
else{
observer.observe(document.body, config);
}
}
function removeVKLoginPopup(popup,mode){
popup.remove();
console.log("Popup removed");
if(mode=="d"){
document.getElementById("box_layer_bg").remove();
document.getElementById("box_layer_wrap").remove();
}
else{
document.getElementById("popup_wrap").remove();
document.getElementById("popup_overlay").remove();
}
}
function allowVideoReplayStarterIG(){
var imgBox=document.getElementsByClassName("pR7Pc");
if(imgBox.length>0){
let videoPlayer=imgBox[0].getElementsByTagName("VIDEO");
if(videoPlayer.length>0){
let moveTagCss=document.createElement("style");
moveTagCss.textContent=".LcKDX, ._7zNgw.GLdVF {bottom: 3em}";
document.body.appendChild(moveTagCss);
for (let vp of videoPlayer){
vp.controls=true;
}
}
allowVideoReplayIG(imgBox[0]);
clearInterval(interval_0);
}
else{
imgBox=document.getElementsByClassName("kPFhm B1JlO OAXCp");
if(imgBox.length>0){
let videoPlayer=imgBox[0].getElementsByTagName("VIDEO");
if(videoPlayer.length>0){
let moveTagCss=document.createElement("style");
moveTagCss.textContent=".LcKDX, ._7zNgw.GLdVF {bottom: 3em}";
document.body.appendChild(moveTagCss);
for (let vp of videoPlayer){
vp.controls=true;
}
}
allowVideoReplayIG(imgBox[0]);
clearInterval(interval_0);
}
}
}
function allowVideoReplayIG(imgBox){
console.log("add video controls");
const config = { attributes: false, childList: true, subtree: true };
const callback = function(mutationsList, observer) {
for(const mutation of mutationsList) {
for(let newNode of mutation.addedNodes){
let videoPlayer=newNode.getElementsByTagName("VIDEO");
if(videoPlayer.length>0){
for (var vp of videoPlayer){
vp.controls=true;
}
}
}
}
};
const observer = new MutationObserver(callback);
observer.observe(imgBox, config);
}

View File

@ -0,0 +1,84 @@
// ==UserScript==
// @include /^https?://news\.ycombinator\.com/.*$/
// ==/UserScript==
GM_addStyle(`
body {
background-color: #080808 !important;
color: #e3e0d7 !important;
}
#hnmain {
background-color: #242424 !important;
}
#hnmain td[bgcolor='#ff6600'] {
background-color: #88b8f6 !important;
}
img[src='y18.gif'] {
filter: invert(100%) !important;
}
#hnmain td[bgcolor='#ff6600'] a:link {
color: #080808 !important;
}
.comhead a:link,
.subtext a:visited,
.hnmore a:link,
a:visited {
color: #9c998e !important;
}
a:link {
color: #e3e0d7 !important;
}
a.storylink:hover {
color: #cae682 !important;
}
font[color='#3c963c'] {
color: #95e454 !important;
}
.c00,
.c00 a:link {
color: #e3e0d7 !important;
}
.c5a,
.c5a a:link,
.c5a a:visited,
.c73,
.c73 a:link,
.c73 a:visited,
.c82,
.c82 a:link,
.c82 a:visited,
.c88,
.c88 a:link,
.c88 a:visited,
.c9c,
.c9c a:link,
.c9c a:visited,
.cae,
.cae a:link,
.cae a:visited,
.cbe,
.cbe a:link,
.cbe a:visited,
.cce,
.cce a:link,
.cce a:visited,
.cdd,
.cdd a:link,
.cdd a:visited {
color: #e5796d !important;
}
.comment,
.title {
font-size: 12pt !important;
}`);

View File

@ -0,0 +1,114 @@
#!/usr/bin/env python3
# Copyright (c) 2017 Ondřej Kudlík (Kepi), https://kepi.cz
# qutepocket is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# qutepocket is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with qutebrowser. If not, see <http://www.gnu.org/licenses/>.
import os
from pocket import Pocket, PocketAutException, PocketException
CONSUMER_KEY = "70250-26f8e47a9dba2989767f4512"
REDIRECT_URI = "https://github.com/kepi/qutepocket/wiki/Authorized"
SECRET = os.environ['QUTE_CONFIG_DIR'] + '/qutepocket.secrets'
REQUEST = os.environ['QUTE_CONFIG_DIR'] + '/qutepocket.request'
FIFO = open(os.environ['QUTE_FIFO'], 'w')
def command(command):
FIFO.write(command + "\n")
def get_request_token():
request_token = pocket.get_request_token(REDIRECT_URI)
if not request_token:
exit(11)
with open(REQUEST, 'w') as request_file:
request_file.write(request_token)
auth_url = ("https://getpocket.com/auth/authorize"
"?request_token={0}"
"&redirect_uri={1}"
).format(request_token, REDIRECT_URI)
msg = ("Accept access, close opened page and use "
"Save to Pocket command again.")
command('open -t %s' % auth_url)
command('message-info "%s"' % msg)
exit(0)
def get_access_token():
try:
with open(REQUEST) as request_file:
request_token = request_file.read()
access_token = pocket.get_access_token(request_token)
print(access_token)
with open(SECRET, 'w') as request_file:
request_file.write(access_token)
os.remove(REQUEST)
msg = "Congratulation, qutepocket is authorized now :)"
command('message-info "%s"' % msg)
except PocketAutException:
os.remove(REQUEST)
get_request_token()
exit(12)
def reauthorize():
command('message-warning "Invalid secret token, trying to reauthorize."')
if os.path.isfile(SECRET):
os.remove(SECRET)
get_request_token()
def add():
try:
pocket.add(os.environ['QUTE_URL'], os.environ['QUTE_TITLE'])
command('message-info "Great, page is in your Pocket."')
except PocketException as e:
# secret token e
if e.error_code == 107:
reauthorize()
else:
command('message-warning "Error while Pocketing the page: %s %s"'
% (e.message, e.error_code))
if not os.path.isfile(SECRET):
access_token = ""
pocket = Pocket(CONSUMER_KEY, access_token)
if os.path.isfile(REQUEST):
get_access_token()
else:
get_request_token()
with open(SECRET) as secrets_file:
access_token = secrets_file.read()
pocket = Pocket(CONSUMER_KEY, access_token)
add()
FIFO.close()

475
st/config.h Normal file
View File

@ -0,0 +1,475 @@
/* See LICENSE file for copyright and license details. */
/*
* appearance
*
* font: see http://freedesktop.org/software/fontconfig/fontconfig-user.html
*/
static char *font = "monospace:pixelsize=18:antialias=true:autohint=true";
static int borderpx = 2;
/*
* What program is execed by st depends of these precedence rules:
* 1: program passed with -e
* 2: scroll and/or utmp
* 3: SHELL environment variable
* 4: value of shell in /etc/passwd
* 5: value of shell in config.h
*/
static char *shell = "/bin/sh";
char *utmp = NULL;
/* scroll program: to enable use a string like "scroll" */
char *scroll = NULL;
char *stty_args = "stty raw pass8 nl -echo -iexten -cstopb 38400";
/* identification sequence returned in DA and DECID */
char *vtiden = "\033[?6c";
/* Kerning / character bounding-box multipliers */
static float cwscale = 1.0;
static float chscale = 1.0;
/*
* word delimiter string
*
* More advanced example: L" `'\"()[]{}"
*/
wchar_t *worddelimiters = L" ";
/* selection timeouts (in milliseconds) */
static unsigned int doubleclicktimeout = 300;
static unsigned int tripleclicktimeout = 600;
/* alt screens */
int allowaltscreen = 1;
/* allow certain non-interactive (insecure) window operations such as:
setting the clipboard text */
int allowwindowops = 0;
/*
* draw latency range in ms - from new content/keypress/etc until drawing.
* within this range, st draws when content stops arriving (idle). mostly it's
* near minlatency, but it waits longer for slow updates to avoid partial draw.
* low minlatency will tear/flicker more, as it can "detect" idle too early.
*/
static double minlatency = 8;
static double maxlatency = 33;
/*
* blinking timeout (set to 0 to disable blinking) for the terminal blinking
* attribute.
*/
static unsigned int blinktimeout = 800;
/*
* thickness of underline and bar cursors
*/
static unsigned int cursorthickness = 2;
/*
* bell volume. It must be a value between -100 and 100. Use 0 for disabling
* it
*/
static int bellvolume = 0;
/* default TERM value */
char *termname = "st-256color";
/*
* spaces per tab
*
* When you are changing this value, don't forget to adapt the »it« value in
* the st.info and appropriately install the st.info in the environment where
* you use this st version.
*
* it#$tabspaces,
*
* Secondly make sure your kernel is not expanding tabs. When running `stty
* -a` »tab0« should appear. You can tell the terminal to not expand tabs by
* running following command:
*
* stty tabs
*/
unsigned int tabspaces = 8;
/* Terminal colors (16 first used in escape sequence) */
static const char *colorname[] = {
/* 8 normal colors */
"#313131",
"#e5786c",
"#94e453",
"#cbe784",
"#88b8f6",
"#d685ff",
"#88dbf6",
"#e3e0d7",
/* 8 bright colors */
"#313131",
"#e5786c",
"#94e453",
"#cbe784",
"#88b8f6",
"#d685ff",
"#88dbf6",
"#e3e0d7",
[255] = 0,
/* more colors can be added after 255 to use with DefaultXX */
"#cccccc",
"#555555",
"#141414",
};
/*
* Default colors (colorname index)
* foreground, background, cursor, reverse cursor
*/
unsigned int defaultfg = 7;
unsigned int defaultbg = 258;
unsigned int defaultcs = 256;
static unsigned int defaultrcs = 257;
/*
* Default shape of cursor
* 2: Block ("")
* 4: Underline ("_")
* 6: Bar ("|")
* 7: Snowman ("")
*/
static unsigned int cursorshape = 4;
/*
* Default columns and rows numbers
*/
static unsigned int cols = 80;
static unsigned int rows = 24;
/*
* Default colour and shape of the mouse cursor
*/
static unsigned int mouseshape = XC_xterm;
static unsigned int mousefg = 7;
static unsigned int mousebg = 0;
/*
* Color used to display font attributes when fontconfig selected a font which
* doesn't match the ones requested.
*/
static unsigned int defaultattr = 11;
/*
* Force mouse select/shortcuts while mask is active (when MODE_MOUSE is set).
* Note that if you want to use ShiftMask with selmasks, set this to an other
* modifier, set to 0 to not use it.
*/
static uint forcemousemod = ShiftMask;
/*
* Internal mouse shortcuts.
* Beware that overloading Button1 will disable the selection.
*/
static MouseShortcut mshortcuts[] = {
/* mask button function argument release */
{ XK_ANY_MOD, Button2, selpaste, {.i = 0}, 1 },
{ ShiftMask, Button4, ttysend, {.s = "\033[5;2~"} },
{ XK_ANY_MOD, Button4, ttysend, {.s = "\031"} },
{ ShiftMask, Button5, ttysend, {.s = "\033[6;2~"} },
{ XK_ANY_MOD, Button5, ttysend, {.s = "\005"} },
};
/* Internal keyboard shortcuts. */
#define MODKEY Mod1Mask
#define TERMMOD (ControlMask|ShiftMask)
static Shortcut shortcuts[] = {
/* mask keysym function argument */
{ XK_ANY_MOD, XK_Break, sendbreak, {.i = 0} },
/*{ ControlMask, XK_Print, toggleprinter, {.i = 0} },
{ ShiftMask, XK_Print, printscreen, {.i = 0} },
{ XK_ANY_MOD, XK_Print, printsel, {.i = 0} },*/
{ TERMMOD, XK_Prior, zoom, {.f = +1} },
{ TERMMOD, XK_Next, zoom, {.f = -1} },
{ TERMMOD, XK_Home, zoomreset, {.f = 0} },
{ TERMMOD, XK_C, clipcopy, {.i = 0} },
{ TERMMOD, XK_V, clippaste, {.i = 0} },
{ TERMMOD, XK_Y, selpaste, {.i = 0} },
{ ShiftMask, XK_Insert, selpaste, {.i = 0} },
{ TERMMOD, XK_Num_Lock, numlock, {.i = 0} },
{ XK_ANY_MOD, 0xFF57, clipcopy, {.i = 0} },
{ XK_ANY_MOD, 0xFF6D, clippaste, {.i = 0} },
};
/*
* Special keys (change & recompile st.info accordingly)
*
* Mask value:
* * Use XK_ANY_MOD to match the key no matter modifiers state
* * Use XK_NO_MOD to match the key alone (no modifiers)
* appkey value:
* * 0: no value
* * > 0: keypad application mode enabled
* * = 2: term.numlock = 1
* * < 0: keypad application mode disabled
* appcursor value:
* * 0: no value
* * > 0: cursor application mode enabled
* * < 0: cursor application mode disabled
*
* Be careful with the order of the definitions because st searches in
* this table sequentially, so any XK_ANY_MOD must be in the last
* position for a key.
*/
/*
* If you want keys other than the X11 function keys (0xFD00 - 0xFFFF)
* to be mapped below, add them to this array.
*/
static KeySym mappedkeys[] = { -1 };
/*
* State bits to ignore when matching key or button events. By default,
* numlock (Mod2Mask) and keyboard layout (XK_SWITCH_MOD) are ignored.
*/
static uint ignoremod = Mod2Mask|XK_SWITCH_MOD;
/*
* This is the huge key array which defines all compatibility to the Linux
* world. Please decide about changes wisely.
*/
static Key key[] = {
/* keysym mask string appkey appcursor */
{ XK_KP_Home, ShiftMask, "\033[2J", 0, -1},
{ XK_KP_Home, ShiftMask, "\033[1;2H", 0, +1},
{ XK_KP_Home, XK_ANY_MOD, "\033[H", 0, -1},
{ XK_KP_Home, XK_ANY_MOD, "\033[1~", 0, +1},
{ XK_KP_Up, XK_ANY_MOD, "\033Ox", +1, 0},
{ XK_KP_Up, XK_ANY_MOD, "\033[A", 0, -1},
{ XK_KP_Up, XK_ANY_MOD, "\033OA", 0, +1},
{ XK_KP_Down, XK_ANY_MOD, "\033Or", +1, 0},
{ XK_KP_Down, XK_ANY_MOD, "\033[B", 0, -1},
{ XK_KP_Down, XK_ANY_MOD, "\033OB", 0, +1},
{ XK_KP_Left, XK_ANY_MOD, "\033Ot", +1, 0},
{ XK_KP_Left, XK_ANY_MOD, "\033[D", 0, -1},
{ XK_KP_Left, XK_ANY_MOD, "\033OD", 0, +1},
{ XK_KP_Right, XK_ANY_MOD, "\033Ov", +1, 0},
{ XK_KP_Right, XK_ANY_MOD, "\033[C", 0, -1},
{ XK_KP_Right, XK_ANY_MOD, "\033OC", 0, +1},
{ XK_KP_Prior, ShiftMask, "\033[5;2~", 0, 0},
{ XK_KP_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
{ XK_KP_Begin, XK_ANY_MOD, "\033[E", 0, 0},
{ XK_KP_End, ControlMask, "\033[J", -1, 0},
{ XK_KP_End, ControlMask, "\033[1;5F", +1, 0},
{ XK_KP_End, ShiftMask, "\033[K", -1, 0},
{ XK_KP_End, ShiftMask, "\033[1;2F", +1, 0},
{ XK_KP_End, XK_ANY_MOD, "\033[4~", 0, 0},
{ XK_KP_Next, ShiftMask, "\033[6;2~", 0, 0},
{ XK_KP_Next, XK_ANY_MOD, "\033[6~", 0, 0},
{ XK_KP_Insert, ShiftMask, "\033[2;2~", +1, 0},
{ XK_KP_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_KP_Insert, ControlMask, "\033[L", -1, 0},
{ XK_KP_Insert, ControlMask, "\033[2;5~", +1, 0},
{ XK_KP_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
{ XK_KP_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
{ XK_KP_Delete, ControlMask, "\033[M", -1, 0},
{ XK_KP_Delete, ControlMask, "\033[3;5~", +1, 0},
{ XK_KP_Delete, ShiftMask, "\033[2K", -1, 0},
{ XK_KP_Delete, ShiftMask, "\033[3;2~", +1, 0},
{ XK_KP_Delete, XK_ANY_MOD, "\033[P", -1, 0},
{ XK_KP_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
{ XK_KP_Multiply, XK_ANY_MOD, "\033Oj", +2, 0},
{ XK_KP_Add, XK_ANY_MOD, "\033Ok", +2, 0},
{ XK_KP_Enter, XK_ANY_MOD, "\033OM", +2, 0},
{ XK_KP_Enter, XK_ANY_MOD, "\r", -1, 0},
{ XK_KP_Subtract, XK_ANY_MOD, "\033Om", +2, 0},
{ XK_KP_Decimal, XK_ANY_MOD, "\033On", +2, 0},
{ XK_KP_Divide, XK_ANY_MOD, "\033Oo", +2, 0},
{ XK_KP_0, XK_ANY_MOD, "\033Op", +2, 0},
{ XK_KP_1, XK_ANY_MOD, "\033Oq", +2, 0},
{ XK_KP_2, XK_ANY_MOD, "\033Or", +2, 0},
{ XK_KP_3, XK_ANY_MOD, "\033Os", +2, 0},
{ XK_KP_4, XK_ANY_MOD, "\033Ot", +2, 0},
{ XK_KP_5, XK_ANY_MOD, "\033Ou", +2, 0},
{ XK_KP_6, XK_ANY_MOD, "\033Ov", +2, 0},
{ XK_KP_7, XK_ANY_MOD, "\033Ow", +2, 0},
{ XK_KP_8, XK_ANY_MOD, "\033Ox", +2, 0},
{ XK_KP_9, XK_ANY_MOD, "\033Oy", +2, 0},
{ XK_Up, ShiftMask, "\033[1;2A", 0, 0},
{ XK_Up, Mod1Mask, "\033[1;3A", 0, 0},
{ XK_Up, ShiftMask|Mod1Mask,"\033[1;4A", 0, 0},
{ XK_Up, ControlMask, "\033[1;5A", 0, 0},
{ XK_Up, ShiftMask|ControlMask,"\033[1;6A", 0, 0},
{ XK_Up, ControlMask|Mod1Mask,"\033[1;7A", 0, 0},
{ XK_Up,ShiftMask|ControlMask|Mod1Mask,"\033[1;8A", 0, 0},
{ XK_Up, XK_ANY_MOD, "\033[A", 0, -1},
{ XK_Up, XK_ANY_MOD, "\033OA", 0, +1},
{ XK_Down, ShiftMask, "\033[1;2B", 0, 0},
{ XK_Down, Mod1Mask, "\033[1;3B", 0, 0},
{ XK_Down, ShiftMask|Mod1Mask,"\033[1;4B", 0, 0},
{ XK_Down, ControlMask, "\033[1;5B", 0, 0},
{ XK_Down, ShiftMask|ControlMask,"\033[1;6B", 0, 0},
{ XK_Down, ControlMask|Mod1Mask,"\033[1;7B", 0, 0},
{ XK_Down,ShiftMask|ControlMask|Mod1Mask,"\033[1;8B",0, 0},
{ XK_Down, XK_ANY_MOD, "\033[B", 0, -1},
{ XK_Down, XK_ANY_MOD, "\033OB", 0, +1},
{ XK_Left, ShiftMask, "\033[1;2D", 0, 0},
{ XK_Left, Mod1Mask, "\033[1;3D", 0, 0},
{ XK_Left, ShiftMask|Mod1Mask,"\033[1;4D", 0, 0},
{ XK_Left, ControlMask, "\033[1;5D", 0, 0},
{ XK_Left, ShiftMask|ControlMask,"\033[1;6D", 0, 0},
{ XK_Left, ControlMask|Mod1Mask,"\033[1;7D", 0, 0},
{ XK_Left,ShiftMask|ControlMask|Mod1Mask,"\033[1;8D",0, 0},
{ XK_Left, XK_ANY_MOD, "\033[D", 0, -1},
{ XK_Left, XK_ANY_MOD, "\033OD", 0, +1},
{ XK_Right, ShiftMask, "\033[1;2C", 0, 0},
{ XK_Right, Mod1Mask, "\033[1;3C", 0, 0},
{ XK_Right, ShiftMask|Mod1Mask,"\033[1;4C", 0, 0},
{ XK_Right, ControlMask, "\033[1;5C", 0, 0},
{ XK_Right, ShiftMask|ControlMask,"\033[1;6C", 0, 0},
{ XK_Right, ControlMask|Mod1Mask,"\033[1;7C", 0, 0},
{ XK_Right,ShiftMask|ControlMask|Mod1Mask,"\033[1;8C",0, 0},
{ XK_Right, XK_ANY_MOD, "\033[C", 0, -1},
{ XK_Right, XK_ANY_MOD, "\033OC", 0, +1},
{ XK_ISO_Left_Tab, ShiftMask, "\033[Z", 0, 0},
{ XK_Return, Mod1Mask, "\033\r", 0, 0},
{ XK_Return, XK_ANY_MOD, "\r", 0, 0},
{ XK_Insert, ShiftMask, "\033[4l", -1, 0},
{ XK_Insert, ShiftMask, "\033[2;2~", +1, 0},
{ XK_Insert, ControlMask, "\033[L", -1, 0},
{ XK_Insert, ControlMask, "\033[2;5~", +1, 0},
{ XK_Insert, XK_ANY_MOD, "\033[4h", -1, 0},
{ XK_Insert, XK_ANY_MOD, "\033[2~", +1, 0},
{ XK_Delete, ControlMask, "\033[M", -1, 0},
{ XK_Delete, ControlMask, "\033[3;5~", +1, 0},
{ XK_Delete, ShiftMask, "\033[2K", -1, 0},
{ XK_Delete, ShiftMask, "\033[3;2~", +1, 0},
{ XK_Delete, XK_ANY_MOD, "\033[P", -1, 0},
{ XK_Delete, XK_ANY_MOD, "\033[3~", +1, 0},
{ XK_BackSpace, XK_NO_MOD, "\177", 0, 0},
{ XK_BackSpace, Mod1Mask, "\033\177", 0, 0},
{ XK_Home, ShiftMask, "\033[2J", 0, -1},
{ XK_Home, ShiftMask, "\033[1;2H", 0, +1},
{ XK_Home, XK_ANY_MOD, "\033[H", 0, -1},
{ XK_Home, XK_ANY_MOD, "\033[1~", 0, +1},
{ XK_End, ControlMask, "\033[J", -1, 0},
{ XK_End, ControlMask, "\033[1;5F", +1, 0},
{ XK_End, ShiftMask, "\033[K", -1, 0},
{ XK_End, ShiftMask, "\033[1;2F", +1, 0},
{ XK_End, XK_ANY_MOD, "\033[4~", 0, 0},
{ XK_Prior, ControlMask, "\033[5;5~", 0, 0},
{ XK_Prior, ShiftMask, "\033[5;2~", 0, 0},
{ XK_Prior, XK_ANY_MOD, "\033[5~", 0, 0},
{ XK_Next, ControlMask, "\033[6;5~", 0, 0},
{ XK_Next, ShiftMask, "\033[6;2~", 0, 0},
{ XK_Next, XK_ANY_MOD, "\033[6~", 0, 0},
{ XK_F1, XK_NO_MOD, "\033OP" , 0, 0},
{ XK_F1, /* F13 */ ShiftMask, "\033[1;2P", 0, 0},
{ XK_F1, /* F25 */ ControlMask, "\033[1;5P", 0, 0},
{ XK_F1, /* F37 */ Mod4Mask, "\033[1;6P", 0, 0},
{ XK_F1, /* F49 */ Mod1Mask, "\033[1;3P", 0, 0},
{ XK_F1, /* F61 */ Mod3Mask, "\033[1;4P", 0, 0},
{ XK_F2, XK_NO_MOD, "\033OQ" , 0, 0},
{ XK_F2, /* F14 */ ShiftMask, "\033[1;2Q", 0, 0},
{ XK_F2, /* F26 */ ControlMask, "\033[1;5Q", 0, 0},
{ XK_F2, /* F38 */ Mod4Mask, "\033[1;6Q", 0, 0},
{ XK_F2, /* F50 */ Mod1Mask, "\033[1;3Q", 0, 0},
{ XK_F2, /* F62 */ Mod3Mask, "\033[1;4Q", 0, 0},
{ XK_F3, XK_NO_MOD, "\033OR" , 0, 0},
{ XK_F3, /* F15 */ ShiftMask, "\033[1;2R", 0, 0},
{ XK_F3, /* F27 */ ControlMask, "\033[1;5R", 0, 0},
{ XK_F3, /* F39 */ Mod4Mask, "\033[1;6R", 0, 0},
{ XK_F3, /* F51 */ Mod1Mask, "\033[1;3R", 0, 0},
{ XK_F3, /* F63 */ Mod3Mask, "\033[1;4R", 0, 0},
{ XK_F4, XK_NO_MOD, "\033OS" , 0, 0},
{ XK_F4, /* F16 */ ShiftMask, "\033[1;2S", 0, 0},
{ XK_F4, /* F28 */ ControlMask, "\033[1;5S", 0, 0},
{ XK_F4, /* F40 */ Mod4Mask, "\033[1;6S", 0, 0},
{ XK_F4, /* F52 */ Mod1Mask, "\033[1;3S", 0, 0},
{ XK_F5, XK_NO_MOD, "\033[15~", 0, 0},
{ XK_F5, /* F17 */ ShiftMask, "\033[15;2~", 0, 0},
{ XK_F5, /* F29 */ ControlMask, "\033[15;5~", 0, 0},
{ XK_F5, /* F41 */ Mod4Mask, "\033[15;6~", 0, 0},
{ XK_F5, /* F53 */ Mod1Mask, "\033[15;3~", 0, 0},
{ XK_F6, XK_NO_MOD, "\033[17~", 0, 0},
{ XK_F6, /* F18 */ ShiftMask, "\033[17;2~", 0, 0},
{ XK_F6, /* F30 */ ControlMask, "\033[17;5~", 0, 0},
{ XK_F6, /* F42 */ Mod4Mask, "\033[17;6~", 0, 0},
{ XK_F6, /* F54 */ Mod1Mask, "\033[17;3~", 0, 0},
{ XK_F7, XK_NO_MOD, "\033[18~", 0, 0},
{ XK_F7, /* F19 */ ShiftMask, "\033[18;2~", 0, 0},
{ XK_F7, /* F31 */ ControlMask, "\033[18;5~", 0, 0},
{ XK_F7, /* F43 */ Mod4Mask, "\033[18;6~", 0, 0},
{ XK_F7, /* F55 */ Mod1Mask, "\033[18;3~", 0, 0},
{ XK_F8, XK_NO_MOD, "\033[19~", 0, 0},
{ XK_F8, /* F20 */ ShiftMask, "\033[19;2~", 0, 0},
{ XK_F8, /* F32 */ ControlMask, "\033[19;5~", 0, 0},
{ XK_F8, /* F44 */ Mod4Mask, "\033[19;6~", 0, 0},
{ XK_F8, /* F56 */ Mod1Mask, "\033[19;3~", 0, 0},
{ XK_F9, XK_NO_MOD, "\033[20~", 0, 0},
{ XK_F9, /* F21 */ ShiftMask, "\033[20;2~", 0, 0},
{ XK_F9, /* F33 */ ControlMask, "\033[20;5~", 0, 0},
{ XK_F9, /* F45 */ Mod4Mask, "\033[20;6~", 0, 0},
{ XK_F9, /* F57 */ Mod1Mask, "\033[20;3~", 0, 0},
{ XK_F10, XK_NO_MOD, "\033[21~", 0, 0},
{ XK_F10, /* F22 */ ShiftMask, "\033[21;2~", 0, 0},
{ XK_F10, /* F34 */ ControlMask, "\033[21;5~", 0, 0},
{ XK_F10, /* F46 */ Mod4Mask, "\033[21;6~", 0, 0},
{ XK_F10, /* F58 */ Mod1Mask, "\033[21;3~", 0, 0},
{ XK_F11, XK_NO_MOD, "\033[23~", 0, 0},
{ XK_F11, /* F23 */ ShiftMask, "\033[23;2~", 0, 0},
{ XK_F11, /* F35 */ ControlMask, "\033[23;5~", 0, 0},
{ XK_F11, /* F47 */ Mod4Mask, "\033[23;6~", 0, 0},
{ XK_F11, /* F59 */ Mod1Mask, "\033[23;3~", 0, 0},
{ XK_F12, XK_NO_MOD, "\033[24~", 0, 0},
{ XK_F12, /* F24 */ ShiftMask, "\033[24;2~", 0, 0},
{ XK_F12, /* F36 */ ControlMask, "\033[24;5~", 0, 0},
{ XK_F12, /* F48 */ Mod4Mask, "\033[24;6~", 0, 0},
{ XK_F12, /* F60 */ Mod1Mask, "\033[24;3~", 0, 0},
{ XK_F13, XK_NO_MOD, "\033[1;2P", 0, 0},
{ XK_F14, XK_NO_MOD, "\033[1;2Q", 0, 0},
{ XK_F15, XK_NO_MOD, "\033[1;2R", 0, 0},
{ XK_F16, XK_NO_MOD, "\033[1;2S", 0, 0},
{ XK_F17, XK_NO_MOD, "\033[15;2~", 0, 0},
{ XK_F18, XK_NO_MOD, "\033[17;2~", 0, 0},
{ XK_F19, XK_NO_MOD, "\033[18;2~", 0, 0},
{ XK_F20, XK_NO_MOD, "\033[19;2~", 0, 0},
{ XK_F21, XK_NO_MOD, "\033[20;2~", 0, 0},
{ XK_F22, XK_NO_MOD, "\033[21;2~", 0, 0},
{ XK_F23, XK_NO_MOD, "\033[23;2~", 0, 0},
{ XK_F24, XK_NO_MOD, "\033[24;2~", 0, 0},
{ XK_F25, XK_NO_MOD, "\033[1;5P", 0, 0},
{ XK_F26, XK_NO_MOD, "\033[1;5Q", 0, 0},
{ XK_F27, XK_NO_MOD, "\033[1;5R", 0, 0},
{ XK_F28, XK_NO_MOD, "\033[1;5S", 0, 0},
{ XK_F29, XK_NO_MOD, "\033[15;5~", 0, 0},
{ XK_F30, XK_NO_MOD, "\033[17;5~", 0, 0},
{ XK_F31, XK_NO_MOD, "\033[18;5~", 0, 0},
{ XK_F32, XK_NO_MOD, "\033[19;5~", 0, 0},
{ XK_F33, XK_NO_MOD, "\033[20;5~", 0, 0},
{ XK_F34, XK_NO_MOD, "\033[21;5~", 0, 0},
{ XK_F35, XK_NO_MOD, "\033[23;5~", 0, 0},
};
/*
* Selection types' masks.
* Use the same masks as usual.
* Button1Mask is always unset, to make masks match between ButtonPress.
* ButtonRelease and MotionNotify.
* If no match is found, regular selection is used.
*/
static uint selmasks[] = {
[SEL_RECTANGULAR] = Mod1Mask,
};
/*
* Printable characters in ASCII, used to estimate the advance width
* of single wide characters.
*/
static char ascii_printable[] =
" !\"#$%&'()*+,-./0123456789:;<=>?"
"@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_"
"`abcdefghijklmnopqrstuvwxyz{|}~";