Browse Source

Made changes to some suckless utilities and some scripts

main
Yigit Colakoglu 4 years ago
parent
commit
a9612bd4cf
41 changed files with 4011 additions and 174 deletions
  1. +0
    -1
      .config/X11/xinitrc
  2. +1
    -1
      .config/htop/htoprc
  3. +0
    -1
      .config/vim/plugin/plugins.vim
  4. +4
    -4
      .config/weechat/sec.conf
  5. +6
    -5
      .config/zathura/zathurarc
  6. +1
    -0
      .local/bin/dmenu-books
  7. +0
    -1
      .local/bin/lf-ueberzug-previewer
  8. +50
    -50
      .local/bin/status-bar/weather
  9. +32
    -0
      .local/bin/zanotes
  10. +24
    -18
      .local/share/dwm/autostart.sh
  11. +1
    -0
      .local/src/dwm/config.h
  12. +1
    -9
      .local/src/dwm/dwm.c
  13. +3
    -3
      .local/src/dwm/keybinds.h
  14. +10
    -0
      .local/src/dwm/vanitygaps.c
  15. +3
    -3
      .local/src/slock/config.h
  16. BIN
      .local/src/slock/slock
  17. BIN
      .local/src/slock/slock.o
  18. +1
    -0
      .local/src/surf/.gitignore
  19. +212
    -0
      .local/src/surf/config.def.h
  20. +204
    -0
      .local/src/surf/config.def.h.orig
  21. +20
    -24
      .local/src/surf/config.h
  22. +138
    -0
      .local/src/surf/patches/surf-0.6-navhist.diff
  23. +59
    -0
      .local/src/surf/patches/surf-0.7-omnibar.diff
  24. +238
    -0
      .local/src/surf/patches/surf-0.7-smoothscrolling.diff
  25. +93
    -0
      .local/src/surf/patches/surf-2.0-externalpipe.diff
  26. +24
    -0
      .local/src/surf/patches/surf-2.0-homepage.diff
  27. +42
    -0
      .local/src/surf/patches/surf-bookmarks-20170722-723ff26.diff
  28. +67
    -0
      .local/src/surf/patches/surf-clipboard-20200112-a6a8878.diff
  29. +107
    -0
      .local/src/surf/patches/surf-history-20181009-2b71a22.diff
  30. +134
    -0
      .local/src/surf/patches/surf-modal-20190209-d068a38.diff
  31. +101
    -0
      .local/src/surf/patches/surf-multijs-20190325-d068a38.diff
  32. +26
    -0
      .local/src/surf/patches/surf-spacesearch-20170408-b814567.diff
  33. +138
    -0
      .local/src/surf/patches/surf-tip-navhist.diff
  34. BIN
      .local/src/surf/surf
  35. +15
    -52
      .local/src/surf/surf.c
  36. +2245
    -0
      .local/src/surf/surf.c.orig
  37. BIN
      .local/src/surf/surf.o
  38. BIN
      .local/src/surf/webext-surf.o
  39. BIN
      .local/src/surf/webext-surf.so
  40. +2
    -2
      .local/src/tabbed/config.h
  41. +9
    -0
      .profile

+ 0
- 1
.config/X11/xinitrc View File

@ -13,7 +13,6 @@ export XSESSION_PID="$$"
source ~/.config/config.env
pactl upload-sample /usr/share/sounds/freedesktop/stereo/bell.oga x11-bell
pactl load-module module-x11-bell sample=x11-bell display=$DISPLAY
xset b 100


+ 1
- 1
.config/htop/htoprc View File

@ -1,7 +1,7 @@
# Beware! This file is rewritten by htop when settings are changed in the interface.
# The parser is also very primitive, and not human-friendly.
fields=0 48 17 18 38 39 40 2 46 47 49 1
sort_key=47
sort_key=46
sort_direction=1
hide_threads=0
hide_kernel_threads=1


+ 0
- 1
.config/vim/plugin/plugins.vim View File

@ -5,7 +5,6 @@ Plug 'kaicataldo/material.vim'
Plug 'itchyny/lightline.vim'
Plug 'mengelbrecht/lightline-bufferline'
Plug 'lambdalisue/nerdfont.vim'
Plug 'glacambre/firenvim', { 'do': { _ -> firenvim#install(0) } }
" Addons
Plug 'scrooloose/nerdtree'


+ 4
- 4
.config/weechat/sec.conf View File

@ -17,7 +17,7 @@ salt = on
[data]
__passphrase__ = on
oftc_password = "6FFD2A3519D4EF0A5D536F3EAD0717147EF2A93A31DC5844ABB53C21D5BFA4F4FDC4B28C6DA9AEA0B054170930E0772524C7624269E448"
sec.data.oftc_password = "110CA4CD81D793862408231A441E72221A58E37AD083F3B3904C36BD8381C9F34B8607CB5236FDF51C6788E452B6C5DDAED582FBFB96A68D025008E43C738613BCFC"
freenode = "F99A5C9A8F4B3503935C8D304FD6306D92ACCA9737BDAC958C28BB84824EAD608171F122641CC75774B99979A506979987AE5E26D4A769D3CFD13B"
rizon_password = "114694D58027869628E47C77A9C4FECBC13AD1A4AE558B161B8ADCF3E027270E4210B61D5D2009BDCB5A127275DFFC15BB4EFF422FF192415EC22D348FB484A455CE"
oftc_password = "E2F75D4F911F906735F2F5B072F89A6AE19F978A500E8D608595158505C43A83B77C83059D1EBD9CE1B7DC136786C7C0968582CEC3A46B"
sec.data.oftc_password = "59879149B253DCD9452CEC7CB35B3507C15C0DD2DBF0E1C20E846D4B4EA954B5D1AD104B08171CA0770EBE95326F5F4A0B9650A67A117FA7B42E665940B0B4433D91"
freenode = "0998875CD96E436D77C601C8B25DE3ADF932C976FF6A2630752930B58177566D09219A82E691B3022F0AA08946AA5D719A892810ACC018DDC7D1A5"
rizon_password = "DC71B05DC33507FC77BF164E2CC436236696FB501D1A5CF883E16A7BC1E488FF35E8B31DEFCDBC386E6C4D8EE6CF964AA89BFD3E0C6880734493AB129D08CE72B342"

+ 6
- 5
.config/zathura/zathurarc View File

@ -19,8 +19,8 @@ set guioptions ""
# zathurarc-dark
set font "inconsolata 15"
set default-bg "#000000" #00
set default-fg "#F7F7F6" #01
set default-bg "#0f111a" #00
set default-fg "#8d91a0" #01
set statusbar-fg "#B0B0B0" #04
set statusbar-bg "#202020" #01
@ -47,11 +47,12 @@ set notification-bg "#90A959" #0B
set notification-fg "#151515" #00
set recolor "true"
set recolor-lightcolor "#000000" #00
set recolor-darkcolor "#E0E0E0" #06
set recolor-lightcolor "#0F111A" #00
set recolor-darkcolor "#E5E9F0" #06
set recolor-reverse-video "true"
set recolor-keephue "true"
#set recolor-keephue "true"
map <C-i> recolor
map <C-o> feedkeys ":exec zanotes $FILE<Return>"


+ 1
- 0
.local/bin/dmenu-books View File

@ -9,6 +9,7 @@ if [ "$(date -r "$XDG_CACHE_HOME/calibrelib" "+%d-%m-%Y")" = "$(date '+%d-%m-%Y'
books_raw=$(cat "$XDG_CACHE_HOME/calibrelib")
else
books_raw=$(calibredb --with-library "$LIBRARY" list --for-machine --fields="title,authors,formats")
echo "$books_raw" > "$XDG_CACHE_HOME/calibrelib"
fi
id="$(echo "$books_raw" |\


+ 0
- 1
.local/bin/lf-ueberzug-previewer View File

@ -89,7 +89,6 @@ case "$MIMETYPE" in
text/* | */xml)
# Syntax highlight
if [ "$( stat --printf='%s' -- "$file" )" -gt "$HIGHLIGHT_SIZE_MAX" ]; then
notify-send 123 123123
exit 2
fi
if [ "$( tput colors )" -ge 256 ]; then


+ 50
- 50
.local/bin/status-bar/weather View File

@ -6,54 +6,54 @@ weatherreport="${XDG_CACHE_HOME:-$HOME/.local/share}/weatherreport"
weatherreportjson="${XDG_CACHE_HOME:-$HOME/.local/share}/weatherreportjson"
WCODES=(
["113"]="^c#ebcb8b^ "
["116"]="^c#ebcb8b^"
["119"]="^c#ffffff^"
["122"]="^c#ffffff^ "
["143"]="^c#ffffff^ "
["176"]="^c#81a1c1^ "
["179"]="^c#81a1c1^ "
["182"]="^c#81a1c1^ "
["185"]="^c#81a1c1^ "
["113"]="^c#ebcb8b^"
["116"]="^c#ebcb8b^"
["119"]="^c#ffffff^"
["122"]="^c#ffffff^"
["143"]="^c#ffffff^"
["176"]="^c#81a1c1^"
["179"]="^c#81a1c1^"
["182"]="^c#81a1c1^"
["185"]="^c#81a1c1^"
["200"]="^c#81a1c1^ "
["227"]="^c#ffffff^ "
["230"]="^c#ffffff^ "
["248"]="^c#ffffff^ "
["260"]="^c#ffffff^ "
["263"]="^c#81a1c1^ "
["266"]="^c#81a1c1^ "
["281"]="^c#81a1c1^ "
["284"]="^c#81a1c1^ "
["293"]="^c#81a1c1^ "
["296"]="^c#81a1c1^ "
["299"]="^c#81a1c1^ "
["302"]="^c#81a1c1^ "
["305"]="^c#81a1c1^ "
["308"]="^c#81a1c1^ "
["311"]="^c#81a1c1^ "
["314"]="^c#81a1c1^ "
["317"]="^c#81a1c1^ "
["320"]="^c#ffffff^ "
["323"]="^c#81a1c1^ "
["326"]="^c#81a1c1^ "
["329"]="^c#ffffff^ "
["332"]="^c#ffffff^ "
["335"]="^c#81a1c1^ "
["338"]="^c#ffffff^ "
["350"]="^c#81a1c1^ "
["353"]="^c#81a1c1^ "
["356"]="^c#81a1c1^ "
["359"]="^c#81a1c1^ "
["362"]="^c#81a1c1^ "
["365"]="^c#81a1c1^ "
["368"]="^c#81a1c1^ "
["371"]="^c#81a1c1^ "
["374"]="^c#81a1c1^ "
["377"]="^c#81a1c1^ "
["386"]="^c#81a1c1^ "
["389"]="^c#81a1c1^ "
["392"]="^c#81a1c1^ "
["395"]="^c#81a1c1^ "
["227"]="^c#ffffff^"
["230"]="^c#ffffff^"
["248"]="^c#ffffff^"
["260"]="^c#ffffff^"
["263"]="^c#81a1c1^"
["266"]="^c#81a1c1^"
["281"]="^c#81a1c1^"
["284"]="^c#81a1c1^"
["293"]="^c#81a1c1^"
["296"]="^c#81a1c1^"
["299"]="^c#81a1c1^"
["302"]="^c#81a1c1^"
["305"]="^c#81a1c1^"
["308"]="^c#81a1c1^"
["311"]="^c#81a1c1^"
["314"]="^c#81a1c1^"
["317"]="^c#81a1c1^"
["320"]="^c#ffffff^"
["323"]="^c#81a1c1^"
["326"]="^c#81a1c1^"
["329"]="^c#ffffff^"
["332"]="^c#ffffff^"
["335"]="^c#81a1c1^"
["338"]="^c#ffffff^"
["350"]="^c#81a1c1^"
["353"]="^c#81a1c1^"
["356"]="^c#81a1c1^"
["359"]="^c#81a1c1^"
["362"]="^c#81a1c1^"
["365"]="^c#81a1c1^"
["368"]="^c#81a1c1^"
["371"]="^c#81a1c1^"
["374"]="^c#81a1c1^"
["377"]="^c#81a1c1^"
["386"]="^c#81a1c1^"
["389"]="^c#81a1c1^"
["392"]="^c#81a1c1^"
["395"]="^c#81a1c1^"
)
getforecast() { curl -sf "wttr.in/$LOCATION" > "$weatherreport" || exit 1 ;}
@ -67,11 +67,11 @@ showweather() {
data=$(echo -ne $(echo $data | cut -d' ' -f 1-4)" ${WCODES[$(echo $data | cut -d' ' -f 5)]}")
echo $data | awk -F' ' '{
if ($4 > 30)
print "^c#ffffff^ ^d^" $4 "kh "$5 " ^d^ " $1 "°C"
print "^c#ffffff^ ^d^" $4 "kh "$5 " ^d^" $1 "°C"
else if ($2 < $3)
print "^c#ffffff^ ^d^" $3 "% "$5 " ^d^ " $1 "°C"
print "^c#ffffff^ ^d^" $3 "% "$5 " ^d^" $1 "°C"
else
print "^c#81a1c1^ ^d^" $2 "% " $5 " ^d^ " $1 "°C"}'
print "^c#81a1c1^ ^d^" $2 "% " $5 " ^d^" $1 "°C"}'
}
case $BLOCK_BUTTON in


+ 32
- 0
.local/bin/zanotes View File

@ -0,0 +1,32 @@
#!/bin/bash
NOTES_FOLDER="$HOME/Documents/Notes"
JSON_DB="$NOTES_FOLDER/books.yml"
function exists_or_create() {
if [[ -f "$2" ]]; then
echo "Not Creating the note: File is already there"
else
echo -e "$1 \n$2"
echo -e "# Book: $1\n" > "$2"
cat <<EOF >> $JSON_DB
- book: "$1"
hash: "$(basename $2)"
date: "$(date '+%d/%m/%Y %H:%M:%S')"
EOF
fi
}
function add_annotation() {
xclip -out -selection clipboard >> "$1"
echo -e "\n> <!!>\n" >> $1
}
hashed_filename="$NOTES_FOLDER/$(md5sum "$1" | cut -f1 -d' ').md"
filename=$(basename "$@")
exists_or_create "$filename" "$hashed_filename"
add_annotation "$hashed_filename"

+ 24
- 18
.local/share/dwm/autostart.sh View File

@ -7,7 +7,31 @@ redshift -r -l "$LATLONG" > /dev/null 2> /dev/null &
dwmblocks > $XDG_RUNTIME_DIR/dwmblocks.out 2> $XDG_RUNTIME_DIR/dwmblocks.err &
~/.local/bin/devmon --exec-on-drive "notify-send -a '禍 drive mounted' '%l (%f) at %d '" \
--exec-on-remove "notify-send -a '禍 drive removed' '%l (%f) from %d '" \
--exec-on-unmount "notify-send -a '禍 drive unmounted' '%l (%f) from %d '" \
--no-unmount --no-gui &
clipmenud > $XDG_RUNTIME_DIR/clipmenud.out 2> $XDG_RUNTIME_DIR/clipmenud.err &
rm -f ~/.surf/tabbed-surf.xid
/bin/polkit-dumb-agent &
darkhttpd $HOME/.local/share/startpage/dist --port 9999 --daemon --addr 127.0.0.1
~/.local/bin/keyboard > $XDG_RUNTIME_DIR/keyboard.out 2> $XDG_RUNTIME_DIR/keyboard.err
dunst &
touch ~/.cache/nextcloud-track
xss-lock -- slock &
picom --no-fading-openclose &
xbanish -s &
#tmux new-session -s weechat -d weechat > /dev/null 2> /dev/null
~/.local/bin/firefox-sync
~/.local/bin/mailsync &
if [ "$NEXTCLOUD" = true ] ; then
@ -28,28 +52,10 @@ if [ "$ACTIVITYWATCHER" = true ] ; then
fi
mpd
mpDris2 &
touch ~/.cache/nextcloud-track
xss-lock -- slock &
picom --no-fading-openclose &
~/.local/bin/firefox-sync
curl 'http://yeetclock/setcolor?R=136&G=192&B=208' &
dunst &
xbanish -s &
tmux new-session -s weechat -d weechat > /dev/null 2> /dev/null
~/.local/bin/devmon --exec-on-drive "notify-send -a '禍 drive mounted' '%l (%f) at %d '" \
--exec-on-remove "notify-send -a '禍 drive removed' '%l (%f) from %d '" \
--exec-on-unmount "notify-send -a '禍 drive unmounted' '%l (%f) from %d '" \
--no-unmount --no-gui &
clipmenud > $XDG_RUNTIME_DIR/clipmenud.out 2> $XDG_RUNTIME_DIR/clipmenud.err &
rm -f ~/.surf/tabbed-surf.xid
/bin/polkit-dumb-agent &
darkhttpd $HOME/.local/share/startpage/dist --port 9999 --daemon --addr 127.0.0.1

+ 1
- 0
.local/src/dwm/config.h View File

@ -19,6 +19,7 @@ static const int nmaster = 1; /* number of clients in master area */
static const int resizehints = 0; /* 1 means respect size hints in tiled resizals */
#define FORCE_VSPLIT 1 /* nrowgrid layout: force two clients to always split vertically */
#define PERTAG_PATCH 1
#include "vanitygaps.c"
static const Layout layouts[] = {


+ 1
- 9
.local/src/dwm/dwm.c View File

@ -340,15 +340,6 @@ static xcb_connection_t *xcon;
#include "keybinds.h"
#include "rules.h"
struct Pertag {
unsigned int curtag, prevtag; /* current and previous tag */
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
};
/* compile-time check if all tags fit into an unsigned int bit array. */
struct NumTags { char limitexceeded[LENGTH(tags) > 31 ? -1 : 1]; };
@ -885,6 +876,7 @@ createmon(void)
m->pertag->curtag = m->pertag->prevtag = 1;
for (i = 0; i <= LENGTH(tags); i++) {
m->pertag->enablegaps[i] = 1;
m->pertag->nmasters[i] = m->nmaster;
m->pertag->mfacts[i] = m->mfact;


+ 3
- 3
.local/src/dwm/keybinds.h View File

@ -66,7 +66,7 @@ static const char *url[] = {"/home/yigit/.local/bin/dmenu_surf", NULL};
static const char *readbook[] = {"/home/yigit/.local/bin/dmenu-books", NULL};
static const char *edit[] = {"/home/yigit/.local/bin/dmenu-edit", NULL};
static const char *surf[] = {"/home/yigit/.local/bin/tabbed_surf", NULL};
static const char *google[] = {"/home/yigit/.local/bin/menu-surfraw", "google", NULL};
static const char *searx[] = {"/home/yigit/.local/bin/dmenu-searx", NULL};
static const char *youtube[] = {"/home/yigit/.local/bin/ytfzf_dmenu", NULL};
/* commands */
@ -92,7 +92,6 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_k, movestack, {.i = -1 } },
{ MODKEY|Mod1Mask, XK_t, setlayout, {.v = &layouts[0]} }, /*tiled*/
{ MODKEY|Mod1Mask, XK_f, setlayout, {.v = &layouts[1]} }, /*Spiral*/
{ MODKEY|Mod1Mask, XK_g, setlayout, {.v = &layouts[2]} }, /*Grid*/
{ MODKEY|Mod1Mask, XK_c, setlayout, {.v = &layouts[3]} }, /*center*/
{ MODKEY|Mod1Mask, XK_space, setlayout, {.v = &layouts[4]} }, /*Center floating*/
{ MODKEY|Mod1Mask, XK_m, setlayout, {.v = &layouts[5]} }, /*monocle*/
@ -105,6 +104,7 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_a, tag, {.ui = ~0 } },
{ MODKEY, XK_comma, focusmon, {.i = -1 } },
{ MODKEY, XK_period, focusmon, {.i = +1 } },
{ MODKEY|Mod1Mask, XK_g, togglegaps, {0} },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
{ MODKEY|ShiftMask, XK_period, tagmon, {.i = +1 } },
{ MODKEY|ShiftMask, XK_comma, tagmon, {.i = -1 } },
@ -144,7 +144,7 @@ static Key keys[] = {
{ MODKEY, XK_r, spawn, {.v = readbook} },
{ MODKEY|ShiftMask, XK_w, spawn, {.v = wallabag} },
{ MODKEY, XK_w, spawn, {.v = wiki} },
{ MODKEY, XK_g, spawn, {.v = google} },
{ MODKEY, XK_g, spawn, {.v = searx} },
{ MODKEY, XK_t, spawn, {.v = online_class} },
{ MODKEY|ShiftMask, XK_m, spawn, {.v = mconnect} },
{ MODKEY|ShiftMask, XK_d, spawn, {.v = udevil} },


+ 10
- 0
.local/src/dwm/vanitygaps.c View File

@ -25,6 +25,16 @@ static void getgaps(Monitor *m, int *oh, int *ov, int *ih, int *iv, unsigned int
static void getfacts(Monitor *m, int msize, int ssize, float *mf, float *sf, int *mr, int *sr);
static void setgaps(int oh, int ov, int ih, int iv);
struct Pertag {
unsigned int curtag, prevtag; /* current and previous tag */
int nmasters[LENGTH(tags) + 1]; /* number of windows in master area */
float mfacts[LENGTH(tags) + 1]; /* mfacts per tag */
unsigned int sellts[LENGTH(tags) + 1]; /* selected layouts */
const Layout *ltidxs[LENGTH(tags) + 1][2]; /* matrix of tags and layouts indexes */
int showbars[LENGTH(tags) + 1]; /* display bar for the current tag */
int enablegaps[LENGTH(tags) + 1];
};
/* Settings */
#if !PERTAG_PATCH
static int enablegaps = 1;


+ 3
- 3
.local/src/slock/config.h View File

@ -12,11 +12,11 @@ static const char *colorname[NUMCOLS] = {
static const int failonclear = 0;
/*Enable blur*/
//#define BLUR
#define BLUR
/*Set blur radius*/
static const int blurRadius=5;
static const int blurRadius=10;
/*Enable Pixelation*/
#define PIXELATION
//#define PIXELATION
/*Set pixelation radius*/
static const int pixelSize=10;


BIN
.local/src/slock/slock View File


BIN
.local/src/slock/slock.o View File


+ 1
- 0
.local/src/surf/.gitignore View File

@ -0,0 +1 @@
.ccls-cache

+ 212
- 0
.local/src/surf/config.def.h View File

@ -0,0 +1,212 @@
/* modifier 0 means no modifier */
static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */
static char *fulluseragent = ""; /* Or override the whole user agent string */
static char *styledir = "~/.surf/styles/";
static char *certdir = "~/.surf/certificates/";
static char *cachedir = "~/.surf/cache/";
static char *cookiefile = "~/.surf/cookies.txt";
<<<<<<<
=======
static char *scriptfiles[] = {
"~/.surf/script.js",
};
/* Webkit default features */
/* Highest priority value will be used.
>>>>>>>
static char **plugindirs = (char*[]){
"~/.surf/plugins/",
LIBPREFIX "/mozilla/plugins/",
NULL
};
/* Webkit default features */
/* Highest priority value will be used.
* Default parameters are priority 0
* Per-uri parameters are priority 1
* Command parameters are priority 2
*/
static Parameter defconfig[ParameterLast] = {
/* parameter Arg value priority */
[AcceleratedCanvas] = { { .i = 1 }, },
[AccessMicrophone] = { { .i = 0 }, },
[AccessWebcam] = { { .i = 0 }, },
[Certificate] = { { .i = 0 }, },
[CaretBrowsing] = { { .i = 0 }, },
[CookiePolicies] = { { .v = "@Aa" }, },
[DefaultCharset] = { { .v = "UTF-8" }, },
[DiskCache] = { { .i = 1 }, },
[DNSPrefetch] = { { .i = 0 }, },
[Ephemeral] = { { .i = 0 }, },
[FileURLsCrossAccess] = { { .i = 0 }, },
[FontSize] = { { .i = 12 }, },
[FrameFlattening] = { { .i = 0 }, },
[Geolocation] = { { .i = 0 }, },
[HideBackground] = { { .i = 0 }, },
[Inspector] = { { .i = 0 }, },
[Java] = { { .i = 1 }, },
[JavaScript] = { { .i = 1 }, },
[KioskMode] = { { .i = 0 }, },
[LoadImages] = { { .i = 1 }, },
[MediaManualPlay] = { { .i = 1 }, },
[Plugins] = { { .i = 1 }, },
[PreferredLanguages] = { { .v = (char *[]){ NULL } }, },
[RunInFullscreen] = { { .i = 0 }, },
[ScrollBars] = { { .i = 1 }, },
[ShowIndicators] = { { .i = 1 }, },
[SiteQuirks] = { { .i = 1 }, },
[SmoothScrolling] = { { .i = 0 }, },
[SpellChecking] = { { .i = 0 }, },
[SpellLanguages] = { { .v = ((char *[]){ "en_US", NULL }) }, },
[StrictTLS] = { { .i = 1 }, },
[Style] = { { .i = 1 }, },
[WebGL] = { { .i = 0 }, },
[ZoomLevel] = { { .f = 1.0 }, },
[ClipboardNotPrimary] = { { .i = 1 }, },
};
static UriParameters uriparams[] = {
{ "(://|\\.)suckless\\.org(/|$)", {
[JavaScript] = { { .i = 0 }, 1 },
[Plugins] = { { .i = 0 }, 1 },
}, },
};
/* default window size: width, height */
static int winsize[] = { 800, 600 };
static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
WEBKIT_FIND_OPTIONS_WRAP_AROUND;
#define PROMPT_GO "Go:"
#define PROMPT_FIND "Find:"
/* SETPROP(readprop, setprop, prompt)*/
#define SETPROP(r, s, p) { \
.v = (const char *[]){ "/bin/sh", "-c", \
"prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \
"| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\")\" " \
"| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
"surf-setprop", winid, r, s, p, NULL \
} \
}
/* DOWNLOAD(URI, referer) */
#define DOWNLOAD(u, r) { \
.v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
"curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \
" -e \"$3\" \"$4\"; read", \
"surf-download", useragent, cookiefile, r, u, NULL \
} \
}
/* PLUMB(URI) */
/* This called when some URI which does not begin with "about:",
* "http://" or "https://" should be opened.
*/
#define PLUMB(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \
"xdg-open \"$0\"", u, NULL \
} \
}
/* VIDEOPLAY(URI) */
#define VIDEOPLAY(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \
"mpv --really-quiet \"$0\"", u, NULL \
} \
}
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
* the list.
*/
static SiteSpecific styles[] = {
/* regexp file in $styledir */
{ ".*", "default.css" },
};
/* certificates */
/*
* Provide custom certificate for urls
*/
static SiteSpecific certs[] = {
/* regexp file in $certdir */
{ "://suckless\\.org/", "suckless.org.crt" },
};
#define MODKEY GDK_CONTROL_MASK
/* hotkeys */
/*
* If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
* edit the CLEANMASK() macro.
*/
static Key keys[] = {
/* modifier keyval function arg */
{ MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_KEY_c, stop, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
{ MODKEY, GDK_KEY_r, reload, { .i = 0 } },
{ MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
{ MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
/* vertical and horizontal scrolling, in viewport percentage */
{ MODKEY, GDK_KEY_j, scrollv, { .i = +10 } },
{ MODKEY, GDK_KEY_k, scrollv, { .i = -10 } },
{ MODKEY, GDK_KEY_space, scrollv, { .i = +50 } },
{ MODKEY, GDK_KEY_b, scrollv, { .i = -50 } },
{ MODKEY, GDK_KEY_i, scrollh, { .i = +10 } },
{ MODKEY, GDK_KEY_u, scrollh, { .i = -10 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
{ MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
{ MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
{ MODKEY, GDK_KEY_p, clipboard, { .i = 1 } },
{ MODKEY, GDK_KEY_y, clipboard, { .i = 0 } },
{ MODKEY, GDK_KEY_n, find, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
{ MODKEY, GDK_KEY_t, showcert, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } },
{ 0, GDK_KEY_F11, togglefullscreen, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_v, toggle, { .i = Plugins } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
};
/* button definitions */
/* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
static Button buttons[] = {
/* target event mask button function argument stop event */
{ OnLink, 0, 2, clicknewwindow, { .i = 0 }, 1 },
{ OnLink, MODKEY, 2, clicknewwindow, { .i = 1 }, 1 },
{ OnLink, MODKEY, 1, clicknewwindow, { .i = 1 }, 1 },
{ OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 },
{ OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 },
{ OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 },
};
#define HOMEPAGE "https://duckduckgo.com/"

+ 204
- 0
.local/src/surf/config.def.h.orig View File

@ -0,0 +1,204 @@
/* modifier 0 means no modifier */
static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */
static char *fulluseragent = ""; /* Or override the whole user agent string */
static char *scriptfile = "~/.surf/script.js";
static char *styledir = "~/.surf/styles/";
static char *certdir = "~/.surf/certificates/";
static char *cachedir = "~/.surf/cache/";
static char *cookiefile = "~/.surf/cookies.txt";
static char **plugindirs = (char*[]){
"~/.surf/plugins/",
LIBPREFIX "/mozilla/plugins/",
NULL
};
/* Webkit default features */
/* Highest priority value will be used.
* Default parameters are priority 0
* Per-uri parameters are priority 1
* Command parameters are priority 2
*/
static Parameter defconfig[ParameterLast] = {
/* parameter Arg value priority */
[AcceleratedCanvas] = { { .i = 1 }, },
[AccessMicrophone] = { { .i = 0 }, },
[AccessWebcam] = { { .i = 0 }, },
[Certificate] = { { .i = 0 }, },
[CaretBrowsing] = { { .i = 0 }, },
[CookiePolicies] = { { .v = "@Aa" }, },
[DefaultCharset] = { { .v = "UTF-8" }, },
[DiskCache] = { { .i = 1 }, },
[DNSPrefetch] = { { .i = 0 }, },
[Ephemeral] = { { .i = 0 }, },
[FileURLsCrossAccess] = { { .i = 0 }, },
[FontSize] = { { .i = 12 }, },
[FrameFlattening] = { { .i = 0 }, },
[Geolocation] = { { .i = 0 }, },
[HideBackground] = { { .i = 0 }, },
[Inspector] = { { .i = 0 }, },
[Java] = { { .i = 1 }, },
[JavaScript] = { { .i = 1 }, },
[KioskMode] = { { .i = 0 }, },
[LoadImages] = { { .i = 1 }, },
[MediaManualPlay] = { { .i = 1 }, },
[Plugins] = { { .i = 1 }, },
[PreferredLanguages] = { { .v = (char *[]){ NULL } }, },
[RunInFullscreen] = { { .i = 0 }, },
[ScrollBars] = { { .i = 1 }, },
[ShowIndicators] = { { .i = 1 }, },
[SiteQuirks] = { { .i = 1 }, },
[SmoothScrolling] = { { .i = 0 }, },
[SpellChecking] = { { .i = 0 }, },
[SpellLanguages] = { { .v = ((char *[]){ "en_US", NULL }) }, },
[StrictTLS] = { { .i = 1 }, },
[Style] = { { .i = 1 }, },
[WebGL] = { { .i = 0 }, },
[ZoomLevel] = { { .f = 1.0 }, },
[ClipboardNotPrimary] = { { .i = 1 }, },
};
static UriParameters uriparams[] = {
{ "(://|\\.)suckless\\.org(/|$)", {
[JavaScript] = { { .i = 0 }, 1 },
[Plugins] = { { .i = 0 }, 1 },
}, },
};
/* default window size: width, height */
static int winsize[] = { 800, 600 };
static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
WEBKIT_FIND_OPTIONS_WRAP_AROUND;
#define PROMPT_GO "Go:"
#define PROMPT_FIND "Find:"
/* SETPROP(readprop, setprop, prompt)*/
#define SETPROP(r, s, p) { \
.v = (const char *[]){ "/bin/sh", "-c", \
"prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \
"| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\")\" " \
"| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
"surf-setprop", winid, r, s, p, NULL \
} \
}
/* DOWNLOAD(URI, referer) */
#define DOWNLOAD(u, r) { \
.v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
"curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \
" -e \"$3\" \"$4\"; read", \
"surf-download", useragent, cookiefile, r, u, NULL \
} \
}
/* PLUMB(URI) */
/* This called when some URI which does not begin with "about:",
* "http://" or "https://" should be opened.
*/
#define PLUMB(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \
"xdg-open \"$0\"", u, NULL \
} \
}
/* VIDEOPLAY(URI) */
#define VIDEOPLAY(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \
"mpv --really-quiet \"$0\"", u, NULL \
} \
}
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
* the list.
*/
static SiteSpecific styles[] = {
/* regexp file in $styledir */
{ ".*", "default.css" },
};
/* certificates */
/*
* Provide custom certificate for urls
*/
static SiteSpecific certs[] = {
/* regexp file in $certdir */
{ "://suckless\\.org/", "suckless.org.crt" },
};
#define MODKEY GDK_CONTROL_MASK
/* hotkeys */
/*
* If you use anything else but MODKEY and GDK_SHIFT_MASK, don't forget to
* edit the CLEANMASK() macro.
*/
static Key keys[] = {
/* modifier keyval function arg */
{ MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_KEY_c, stop, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
{ MODKEY, GDK_KEY_r, reload, { .i = 0 } },
{ MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
{ MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
/* vertical and horizontal scrolling, in viewport percentage */
{ MODKEY, GDK_KEY_j, scrollv, { .i = +10 } },
{ MODKEY, GDK_KEY_k, scrollv, { .i = -10 } },
{ MODKEY, GDK_KEY_space, scrollv, { .i = +50 } },
{ MODKEY, GDK_KEY_b, scrollv, { .i = -50 } },
{ MODKEY, GDK_KEY_i, scrollh, { .i = +10 } },
{ MODKEY, GDK_KEY_u, scrollh, { .i = -10 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
{ MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
{ MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
{ MODKEY, GDK_KEY_p, clipboard, { .i = 1 } },
{ MODKEY, GDK_KEY_y, clipboard, { .i = 0 } },
{ MODKEY, GDK_KEY_n, find, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
{ MODKEY, GDK_KEY_t, showcert, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } },
{ 0, GDK_KEY_F11, togglefullscreen, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_v, toggle, { .i = Plugins } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
};
/* button definitions */
/* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
static Button buttons[] = {
/* target event mask button function argument stop event */
{ OnLink, 0, 2, clicknewwindow, { .i = 0 }, 1 },
{ OnLink, MODKEY, 2, clicknewwindow, { .i = 1 }, 1 },
{ OnLink, MODKEY, 1, clicknewwindow, { .i = 1 }, 1 },
{ OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 },
{ OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 },
{ OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 },
};
#define HOMEPAGE "https://duckduckgo.com/"

+ 20
- 24
.local/src/surf/config.h View File

@ -58,7 +58,7 @@ static Parameter defconfig[ParameterLast] = {
[Style] = { { .i = 1 }, },
[WebGL] = { { .i = 0 }, },
[ZoomLevel] = { { .f = 1.0 }, },
[ClipboardNotPrimary] = { { .i = 1 }, },
[ClipboardNotPrimary] = { { .i = 0 }, },
};
@ -173,27 +173,26 @@ static char *editscreen[] = { "/bin/sh", "-c", "edit_screen.sh", NULL };
*/
static Key keys[] = {
/* modifier keyval function arg */
{ 0, GDK_KEY_i, insert, { .i = 1 } },
{ 0, GDK_KEY_Escape, insert, { .i = 0 } },
{ MODKEY, GDK_KEY_o, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ 0, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ MODKEY, GDK_KEY_b, spawn, BM_ADD("_SURF_URI") },
{ MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_KEY_c, stop, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
{ MODKEY, GDK_KEY_r, reload, { .i = 0 } },
{ 0, GDK_KEY_l, navigate, { .i = +1 } },
{ 0, GDK_KEY_h, navigate, { .i = -1 } },
{ MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
{ MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
/* vertical and horizontal scrolling, in viewport percentage */
{ 0, GDK_KEY_j, scrollv, { .i = +10 } },
{ 0, GDK_KEY_k, scrollv, { .i = -10 } },
{ 0, GDK_KEY_space, scrollv, { .i = +50 } },
{ 0, GDK_KEY_b, scrollv, { .i = -50 } },
{ 0, GDK_KEY_u, scrollh, { .i = -10 } },
{ MODKEY, GDK_KEY_j, scrollv, { .i = +10 } },
{ MODKEY, GDK_KEY_k, scrollv, { .i = -10 } },
{ MODKEY, GDK_KEY_space, scrollv, { .i = +50 } },
{ MODKEY, GDK_KEY_b, scrollv, { .i = -50 } },
{ MODKEY, GDK_KEY_i, scrollh, { .i = +10 } },
{ MODKEY, GDK_KEY_u, scrollh, { .i = -10 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
@ -202,11 +201,11 @@ static Key keys[] = {
{ MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
{ MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
{ 0, GDK_KEY_p, clipboard, { .i = 1 } },
{ 0, GDK_KEY_y, clipboard, { .i = 0 } },
{ MODKEY, GDK_KEY_p, clipboard, { .i = 1 } },
{ MODKEY, GDK_KEY_y, clipboard, { .i = 0 } },
{ 0, GDK_KEY_n, find, { .i = +1 } },
{ GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
{ MODKEY, GDK_KEY_n, find, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
{ MODKEY, GDK_KEY_t, showcert, { 0 } },
@ -216,6 +215,7 @@ static Key keys[] = {
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_o, toggleinspector, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_c, toggle, { .i = CaretBrowsing } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_f, toggle, { .i = FrameFlattening } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_g, toggle, { .i = Geolocation } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_s, toggle, { .i = JavaScript } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_i, toggle, { .i = LoadImages } },
@ -223,10 +223,6 @@ static Key keys[] = {
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
{ MODKEY, GDK_KEY_u, externalpipe, { .v = linkselect_curwin } },
{ MODKEY, GDK_KEY_y, externalpipe, { .v = linkyank } },
{ MODKEY, GDK_KEY_v, externalpipe, { .v = editscreen } },
{ MODKEY , GDK_KEY_Return, spawn, SETURI("_SURF_GO") },
};
/* button definitions */
@ -234,8 +230,8 @@ static Key keys[] = {
static Button buttons[] = {
/* target event mask button function argument stop event */
{ OnLink, 0, 2, clicknewwindow, { .i = 0 }, 1 },
{ OnLink, MODKEY, 2, clicknewwindow, { .i = 0 }, 1 },
{ OnLink, MODKEY, 1, clicknewwindow, { .i = 0 }, 1 },
{ OnLink, MODKEY, 2, clicknewwindow, { .i = 1 }, 1 },
{ OnLink, MODKEY, 1, clicknewwindow, { .i = 1 }, 1 },
{ OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 },
{ OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 },
{ OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 },


+ 138
- 0
.local/src/surf/patches/surf-0.6-navhist.diff View File

@ -0,0 +1,138 @@
diff --git a/config.def.h b/config.def.h
index a221c86..9840736 100644
--- a/config.def.h
+++ b/config.def.h
@@ -32,6 +32,16 @@ static Bool hidebackground = FALSE;
} \
}
+#define SELNAV { \
+ .v = (char *[]){ "/bin/sh", "-c", \
+ "prop=\"`xprop -id $0 _SURF_HIST" \
+ " | sed -e 's/^.[^\"]*\"//' -e 's/\"$//' -e 's/\\\\\\n/\\n/g'" \
+ " | dmenu -i -l 10`\"" \
+ " && xprop -id $0 -f _SURF_NAV 8s -set _SURF_NAV \"$prop\"", \
+ winid, NULL \
+ } \
+}
+
/* DOWNLOAD(URI, referer) */
#define DOWNLOAD(d, r) { \
.v = (char *[]){ "/bin/sh", "-c", \
@@ -67,6 +77,7 @@ static Key keys[] = {
{ MODKEY, GDK_l, navigate, { .i = +1 } },
{ MODKEY, GDK_h, navigate, { .i = -1 } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_h, selhist, SELNAV },
{ MODKEY, GDK_j, scroll_v, { .i = +1 } },
{ MODKEY, GDK_k, scroll_v, { .i = -1 } },
diff --git a/surf.c b/surf.c
index cebd469..8b6d751 100644
--- a/surf.c
+++ b/surf.c
@@ -32,7 +32,7 @@ char *argv0;
#define COOKIEJAR_TYPE (cookiejar_get_type ())
#define COOKIEJAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COOKIEJAR_TYPE, CookieJar))
-enum { AtomFind, AtomGo, AtomUri, AtomLast };
+enum { AtomFind, AtomGo, AtomUri, AtomHist, AtomNav, AtomLast };
typedef union Arg Arg;
union Arg {
@@ -137,6 +137,8 @@ static void loadstatuschange(WebKitWebView *view, GParamSpec *pspec,
Client *c);
static void loaduri(Client *c, const Arg *arg);
static void navigate(Client *c, const Arg *arg);
+static void selhist(Client *c, const Arg *arg);
+static void navhist(Client *c, const Arg *arg);
static Client *newclient(void);
static void newwindow(Client *c, const Arg *arg, gboolean noembed);
static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
@@ -649,6 +651,59 @@ navigate(Client *c, const Arg *arg) {
webkit_web_view_go_back_or_forward(c->view, steps);
}
+static void
+selhist(Client *c, const Arg *arg) {
+ WebKitWebBackForwardList *lst;
+ WebKitWebHistoryItem *cur;
+ gint i;
+ gchar *out;
+ gchar *tmp;
+ gchar *line;
+
+ out = g_strdup("");
+
+ if(!(lst = webkit_web_view_get_back_forward_list(c->view)))
+ return;
+
+ for(i = webkit_web_back_forward_list_get_back_length(lst); i > 0; i--) {
+ if(!(cur = webkit_web_back_forward_list_get_nth_item(lst, -i)))
+ break;
+ line = g_strdup_printf("%d: %s\n", -i,
+ webkit_web_history_item_get_original_uri(cur));
+ tmp = g_strconcat(out, line, NULL);
+ g_free(out);
+ out = tmp;
+ }
+
+ if((cur = webkit_web_back_forward_list_get_nth_item(lst, 0))) {
+ line = g_strdup_printf("%d: %s", 0,
+ webkit_web_history_item_get_original_uri(cur));
+ tmp = g_strconcat(out, line, NULL);
+ g_free(out);
+ out = tmp;
+ }
+
+ for(i = 1; i <= webkit_web_back_forward_list_get_forward_length(lst); i++) {
+ if(!(cur = webkit_web_back_forward_list_get_nth_item(lst, i)))
+ break;
+ line = g_strdup_printf("\n%d: %s", i,
+ webkit_web_history_item_get_original_uri(cur));
+ tmp = g_strconcat(out, line, NULL);
+ g_free(out);
+ out = tmp;
+ }
+
+ setatom(c, AtomHist, out);
+ g_free(out);
+ spawn(c, arg);
+}
+
+static void
+navhist(Client *c, const Arg *arg) {
+ Arg a = { .i = atoi(arg->v) };
+ navigate(c, &a);
+}
+
static Client *
newclient(void) {
Client *c;
@@ -805,6 +860,7 @@ newclient(void) {
setatom(c, AtomFind, "");
setatom(c, AtomUri, "about:blank");
+ setatom(c, AtomHist, "");
if(hidebackground)
webkit_web_view_set_transparent(c->view, TRUE);
@@ -923,6 +979,9 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d) {
arg.v = getatom(c, AtomGo);
loaduri(c, &arg);
return GDK_FILTER_REMOVE;
+ } else if(ev->atom == atoms[AtomNav]) {
+ arg.v = getatom(c, AtomNav);
+ navhist(c, &arg);
}
}
}
@@ -1004,6 +1063,8 @@ setup(void) {
atoms[AtomFind] = XInternAtom(dpy, "_SURF_FIND", False);
atoms[AtomGo] = XInternAtom(dpy, "_SURF_GO", False);
atoms[AtomUri] = XInternAtom(dpy, "_SURF_URI", False);
+ atoms[AtomHist] = XInternAtom(dpy, "_SURF_HIST", False);
+ atoms[AtomNav] = XInternAtom(dpy, "_SURF_NAV", False);
/* dirs and files */
cookiefile = buildpath(cookiefile);

+ 59
- 0
.local/src/surf/patches/surf-0.7-omnibar.diff View File

@ -0,0 +1,59 @@
diff --git a/config.def.h b/config.def.h
index 93a3d49..05d81de 100644
--- a/config.def.h
+++ b/config.def.h
@@ -65,6 +65,18 @@ static Bool allowgeolocation = TRUE;
} \
}
+#define ONLOAD(u) { \
+ .v = (char *[]){"/bin/sh", "-c", \
+ "~/.surf/omnibar addhist \"$0\"", u, NULL \
+ } \
+}
+
+#define GOTO { \
+ .v = (char *[]){"/bin/sh", "-c", \
+ "~/.surf/omnibar goto \"$0\" \"$1\"", winid, "_SURF_GO", NULL \
+ } \
+}
+
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
@@ -112,7 +124,7 @@ static Key keys[] = {
{ MODKEY, GDK_o, source, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_o, inspector, { 0 } },
- { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
+ { MODKEY, GDK_g, spawn, GOTO },
{ MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
{ MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
diff --git a/surf.c b/surf.c
index f2170a4..c8fdab3 100644
--- a/surf.c
+++ b/surf.c
@@ -789,11 +789,11 @@ loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c)
WebKitWebDataSource *src;
WebKitNetworkRequest *request;
SoupMessage *msg;
- char *uri;
+ char *uri = geturi(c);
+ Arg arg;
switch (webkit_web_view_get_load_status (c->view)) {
case WEBKIT_LOAD_COMMITTED:
- uri = geturi(c);
if (strstr(uri, "https://") == uri) {
frame = webkit_web_view_get_main_frame(c->view);
src = webkit_web_frame_get_data_source(frame);
@@ -809,6 +809,8 @@ loadstatuschange(WebKitWebView *view, GParamSpec *pspec, Client *c)
setstyle(c, getstyle(uri));
break;
case WEBKIT_LOAD_FINISHED:
+ arg = (Arg)ONLOAD(uri);
+ spawn(NULL, &arg);
c->progress = 100;
updatetitle(c);
if (diskcache) {

+ 238
- 0
.local/src/surf/patches/surf-0.7-smoothscrolling.diff View File

@ -0,0 +1,238 @@
diff --git a/config.def.h b/config.def.h
index 93a3d49..fa7935c 100644
--- a/config.def.h
+++ b/config.def.h
@@ -83,50 +83,51 @@ static SiteStyle styles[] = {
* edit the CLEANMASK() macro.
*/
static Key keys[] = {
- /* modifier keyval function arg Focus */
- { MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } },
- { MODKEY, GDK_r, reload, { .b = FALSE } },
- { MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 } },
-
- { MODKEY, GDK_p, clipboard, { .b = TRUE } },
- { MODKEY, GDK_y, clipboard, { .b = FALSE } },
-
- { MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 } },
- { MODKEY|GDK_SHIFT_MASK,GDK_k, zoom, { .i = +1 } },
- { MODKEY|GDK_SHIFT_MASK,GDK_q, zoom, { .i = 0 } },
- { MODKEY, GDK_minus, zoom, { .i = -1 } },
- { MODKEY, GDK_plus, zoom, { .i = +1 } },
-
- { MODKEY, GDK_l, navigate, { .i = +1 } },
- { MODKEY, GDK_h, navigate, { .i = -1 } },
-
- { MODKEY, GDK_j, scroll_v, { .i = +1 } },
- { MODKEY, GDK_k, scroll_v, { .i = -1 } },
- { MODKEY, GDK_b, scroll_v, { .i = -10000 } },
- { MODKEY, GDK_space, scroll_v, { .i = +10000 } },
- { MODKEY, GDK_i, scroll_h, { .i = +1 } },
- { MODKEY, GDK_u, scroll_h, { .i = -1 } },
-
- { 0, GDK_F11, fullscreen, { 0 } },
- { 0, GDK_Escape, stop, { 0 } },
- { MODKEY, GDK_o, source, { 0 } },
- { MODKEY|GDK_SHIFT_MASK,GDK_o, inspector, { 0 } },
-
- { MODKEY, GDK_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
- { MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
- { MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
-
- { MODKEY, GDK_n, find, { .b = TRUE } },
- { MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } },
-
- { MODKEY|GDK_SHIFT_MASK,GDK_c, toggle, { .v = "enable-caret-browsing" } },
- { MODKEY|GDK_SHIFT_MASK,GDK_i, toggle, { .v = "auto-load-images" } },
- { MODKEY|GDK_SHIFT_MASK,GDK_s, toggle, { .v = "enable-scripts" } },
- { MODKEY|GDK_SHIFT_MASK,GDK_v, toggle, { .v = "enable-plugins" } },
- { MODKEY|GDK_SHIFT_MASK,GDK_a, togglecookiepolicy, { 0 } },
- { MODKEY|GDK_SHIFT_MASK,GDK_m, togglestyle, { 0 } },
- { MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars, { 0 } },
- { MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 0 } },
+ /* modifier keyval function arg Focus */
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_r, reload, { .b = TRUE } },
+ { MODKEY, GDK_KEY_r, reload, { .b = FALSE } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_p, print, { 0 } },
+
+ { MODKEY, GDK_KEY_p, clipboard, { .b = TRUE } },
+ { MODKEY, GDK_KEY_y, clipboard, { .b = FALSE } },
+
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_j, zoom, { .i = -1 } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_k, zoom, { .i = +1 } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_q, zoom, { .i = 0 } },
+ { MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
+ { MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
+
+ { MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
+ { MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
+
+ { MODKEY, GDK_KEY_j, scroll_v, { .i = +1 } },
+ { MODKEY, GDK_KEY_k, scroll_v, { .i = -1 } },
+ { MODKEY, GDK_KEY_b, scroll_v, { .i = -10000 } },
+ { MODKEY, GDK_KEY_space, scroll_v, { .i = +10000 } },
+ { MODKEY, GDK_KEY_i, scroll_h, { .i = +1 } },
+ { MODKEY, GDK_KEY_u, scroll_h, { .i = -1 } },
+
+ { 0, GDK_KEY_F11, fullscreen, { 0 } },
+ { 0, GDK_KEY_Escape, stop, { 0 } },
+ { MODKEY, GDK_KEY_o, source, { 0 } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_o, inspector, { 0 } },
+
+ { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO") },
+ { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
+ { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") },
+
+ { MODKEY, GDK_KEY_n, find, { .b = TRUE } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_n, find, { .b = FALSE } },
+
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_c, toggle, { .v = "enable-caret-browsing" } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_i, toggle, { .v = "auto-load-images" } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_s, toggle, { .v = "enable-scripts" } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_v, toggle, { .v = "enable-plugins" } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_a, togglecookiepolicy, { 0 } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_m, togglestyle, { 0 } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_b, togglescrollbars, { 0 } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_KEY_g, togglegeolocation, { 0 } },
+
};
/* button definitions */
diff --git a/config.mk b/config.mk
index 9f85ea4..a070f88 100644
--- a/config.mk
+++ b/config.mk
@@ -10,8 +10,8 @@ MANPREFIX = ${PREFIX}/share/man
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
-GTKINC = `pkg-config --cflags gtk+-2.0 webkit-1.0`
-GTKLIB = `pkg-config --libs gtk+-2.0 webkit-1.0`
+GTKINC = `pkg-config --cflags gtk+-3.0 webkitgtk-3.0`
+GTKLIB = `pkg-config --libs gtk+-3.0 webkitgtk-3.0`
# includes and libs
INCS = -I. -I/usr/include -I${X11INC} ${GTKINC}
diff --git a/surf.c b/surf.c
index 108485b..7a708d4 100644
--- a/surf.c
+++ b/surf.c
@@ -6,6 +6,7 @@
#include <X11/X.h>
#include <X11/Xatom.h>
#include <gtk/gtk.h>
+#include <gtk/gtkx.h>
#include <gdk/gdkx.h>
#include <gdk/gdk.h>
#include <gdk/gdkkeysyms.h>
@@ -100,7 +101,7 @@ typedef struct {
static Display *dpy;
static Atom atoms[AtomLast];
static Client *clients = NULL;
-static GdkNativeWindow embed = 0;
+static Window embed = 0;
static gboolean showxid = FALSE;
static char winid[64];
static gboolean usingproxy = 0;
@@ -627,9 +628,9 @@ getatom(Client *c, int a)
unsigned long ldummy;
unsigned char *p = NULL;
- XGetWindowProperty(dpy, GDK_WINDOW_XID(GTK_WIDGET(c->win)->window),
- atoms[a], 0L, BUFSIZ, False, XA_STRING,
- &adummy, &idummy, &ldummy, &ldummy, &p);
+ XGetWindowProperty(dpy, GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(c->win))),
+ atoms[a], 0L, BUFSIZ, False, XA_STRING,
+ &adummy, &idummy, &ldummy, &ldummy, &p);
if (p)
strncpy(buf, (char *)p, LENGTH(buf)-1);
else
@@ -873,6 +874,7 @@ newclient(void)
WebKitWebFrame *frame;
GdkGeometry hints = { 1, 1 };
GdkScreen *screen;
+ GdkWindow *window;
gdouble dpi;
char *ua;
@@ -902,6 +904,10 @@ newclient(void)
*/
gtk_window_set_role(GTK_WINDOW(c->win), "Surf");
}
+
+ gtk_widget_realize(GTK_WIDGET(c->win));
+ window = gtk_widget_get_window(GTK_WIDGET(c->win));
+
gtk_window_set_default_size(GTK_WINDOW(c->win), 800, 600);
g_signal_connect(G_OBJECT(c->win),
"destroy",
@@ -914,10 +920,10 @@ newclient(void)
addaccelgroup(c);
/* Pane */
- c->pane = gtk_vpaned_new();
+ c->pane = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
/* VBox */
- c->vbox = gtk_vbox_new(FALSE, 0);
+ c->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0);
gtk_paned_pack1(GTK_PANED(c->pane), c->vbox, TRUE, TRUE);
/* Webview */
@@ -999,8 +1005,8 @@ newclient(void)
gtk_widget_show(c->win);
gtk_window_set_geometry_hints(GTK_WINDOW(c->win), NULL, &hints,
GDK_HINT_MIN_SIZE);
- gdk_window_set_events(GTK_WIDGET(c->win)->window, GDK_ALL_EVENTS_MASK);
- gdk_window_add_filter(GTK_WIDGET(c->win)->window, processx, c);
+ gdk_window_set_events(window, GDK_ALL_EVENTS_MASK);
+ gdk_window_add_filter(window, processx, c);
webkit_web_view_set_full_content_zoom(c->view, TRUE);
runscript(frame);
@@ -1034,7 +1040,7 @@ newclient(void)
* It is equivalent to firefox's "layout.css.devPixelsPerPx" setting.
*/
if (zoomto96dpi) {
- screen = gdk_window_get_screen(GTK_WIDGET(c->win)->window);
+ screen = gdk_window_get_screen(window);
dpi = gdk_screen_get_resolution(screen);
if (dpi != -1) {
g_object_set(G_OBJECT(settings),
@@ -1073,7 +1079,7 @@ newclient(void)
if (showxid) {
gdk_display_sync(gtk_widget_get_display(c->win));
printf("%u\n",
- (guint)GDK_WINDOW_XID(GTK_WIDGET(c->win)->window));
+ (guint)GDK_WINDOW_XID(window));
fflush(NULL);
if (fclose(stdout) != 0)
die("Error closing stdout");
@@ -1281,7 +1287,7 @@ void
setatom(Client *c, int a, const char *v)
{
XSync(dpy, False);
- XChangeProperty(dpy, GDK_WINDOW_XID(GTK_WIDGET(c->win)->window),
+ XChangeProperty(dpy, GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(c->win))),
atoms[a], XA_STRING, 8, PropModeReplace,
(unsigned char *)v, strlen(v) + 1);
}
@@ -1302,7 +1308,7 @@ setup(void)
die("Can't install SIGHUP handler");
gtk_init(NULL, NULL);
- dpy = GDK_DISPLAY();
+ dpy = GDK_DISPLAY_XDISPLAY(gdk_display_get_default());
/* atoms */
atoms[AtomFind] = XInternAtom(dpy, "_SURF_FIND", False);
@@ -1634,7 +1640,7 @@ void
updatewinid(Client *c)
{
snprintf(winid, LENGTH(winid), "%u",
- (int)GDK_WINDOW_XID(GTK_WIDGET(c->win)->window));
+ (int)GDK_WINDOW_XID(gtk_widget_get_window(GTK_WIDGET(c->win))));
}
void

+ 93
- 0
.local/src/surf/patches/surf-2.0-externalpipe.diff View File

@ -0,0 +1,93 @@
diff --git a/surf.c b/surf.c
index 93a1629..ba53b94 100644
--- a/surf.c
+++ b/surf.c
@@ -217,6 +217,7 @@ static void togglefullscreen(Client *c, const Arg *a);
static void togglecookiepolicy(Client *c, const Arg *a);
static void toggleinspector(Client *c, const Arg *a);
static void find(Client *c, const Arg *a);
+static void externalpipe(Client *c, const Arg *a);
/* Buttons */
static void clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h);
@@ -241,6 +242,80 @@ char *argv0;
/* configuration, allows nested code to access above variables */
#include "config.h"
+static void
+externalpipe_execute(char* buffer, Arg *arg) {
+ int to[2];
+ void (*oldsigpipe)(int);
+
+ if (pipe(to) == -1)
+ return;
+
+ switch (fork()) {
+ case -1:
+ close(to[0]);
+ close(to[1]);
+ return;
+ case 0:
+ dup2(to[0], STDIN_FILENO); close(to[0]); close(to[1]);
+ execvp(((char **)arg->v)[0], (char **)arg->v);
+ fprintf(stderr, "st: execvp %s\n", ((char **)arg->v)[0]);
+ perror("failed");
+ exit(0);
+ }
+
+ close(to[0]);
+ oldsigpipe = signal(SIGPIPE, SIG_IGN);
+ write(to[1], buffer, strlen(buffer));
+ close(to[1]);
+ signal(SIGPIPE, oldsigpipe);
+}
+
+static void
+externalpipe_resource_done(WebKitWebResource *r, GAsyncResult *s, Arg *arg)
+{
+ GError *gerr = NULL;
+ guchar *buffer = webkit_web_resource_get_data_finish(r, s, NULL, &gerr);
+ if (gerr == NULL) {
+ externalpipe_execute((char *) buffer, arg);
+ } else {
+ g_error_free(gerr);
+ }
+ g_free(buffer);
+}
+
+static void
+externalpipe_js_done(WebKitWebView *wv, GAsyncResult *s, Arg *arg)
+{
+ WebKitJavascriptResult *j = webkit_web_view_run_javascript_finish(
+ wv, s, NULL);
+ if (!j) {
+ return;
+ }
+ JSCValue *v = webkit_javascript_result_get_js_value(j);
+ if (jsc_value_is_string(v)) {
+ char *buffer = jsc_value_to_string(v);
+ externalpipe_execute(buffer, arg);
+ g_free(buffer);
+ }
+ webkit_javascript_result_unref(j);
+}
+
+void
+externalpipe(Client *c, const Arg *arg)
+{
+ if (curconfig[JavaScript].val.i) {
+ webkit_web_view_run_javascript(
+ c->view, "window.document.documentElement.outerHTML",
+ NULL, externalpipe_js_done, arg);
+ } else {
+ WebKitWebResource *resource = webkit_web_view_get_main_resource(c->view);
+ if (resource != NULL) {
+ webkit_web_resource_get_data(
+ resource, NULL, externalpipe_resource_done, arg);
+ }
+ }
+}
+
void
usage(void)
{

+ 24
- 0
.local/src/surf/patches/surf-2.0-homepage.diff View File

@ -0,0 +1,24 @@
diff --git a/config.def.h b/config.def.h
--- a/config.def.h
+++ b/config.def.h
@@ -164,3 +164,5 @@ static Button buttons[] = {
{ OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 },
{ OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 },
};
+
+#define HOMEPAGE "https://duckduckgo.com/"
diff --git a/surf.c b/surf.c
--- a/surf.c
+++ b/surf.c
@@ -1751,7 +1751,11 @@ main(int argc, char *argv[])
if (argc > 0)
arg.v = argv[0];
else
+#ifdef HOMEPAGE
+ arg.v = HOMEPAGE;
+#else
arg.v = "about:blank";
+#endif
setup();
c = newclient(NULL);

+ 42
- 0
.local/src/surf/patches/surf-bookmarks-20170722-723ff26.diff View File

@ -0,0 +1,42 @@
diff --git a/config.def.h b/config.def.h
index 2e735bf..43ad9ab 100644
--- a/config.def.h
+++ b/config.def.h
@@ -69,8 +69,9 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
#define SETPROP(r, s, p) { \
.v = (const char *[]){ "/bin/sh", "-c", \
"prop=\"$(printf '%b' \"$(xprop -id $1 $2 " \
- "| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\")\" " \
- "| dmenu -p \"$4\" -w $1)\" && xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
+ "| sed \"s/^$2(STRING) = //;s/^\\\"\\(.*\\)\\\"$/\\1/\" && cat ~/.surf/bookmarks)\" " \
+ "| dmenu -l 10 -p \"$4\" -w $1)\" && " \
+ "xprop -id $1 -f $3 8s -set $3 \"$prop\"", \
"surf-setprop", winid, r, s, p, NULL \
} \
}
@@ -101,6 +102,17 @@ static WebKitFindOptions findopts = WEBKIT_FIND_OPTIONS_CASE_INSENSITIVE |
} \
}
+/* BM_ADD(readprop) */
+#define BM_ADD(r) {\
+ .v = (const char *[]){ "/bin/sh", "-c", \
+ "(echo $(xprop -id $0 $1) | cut -d '\"' -f2 " \
+ "| sed 's/.*https*:\\/\\/\\(www\\.\\)\\?//' && cat ~/.surf/bookmarks) " \
+ "| awk '!seen[$0]++' > ~/.surf/bookmarks.tmp && " \
+ "mv ~/.surf/bookmarks.tmp ~/.surf/bookmarks", \
+ winid, r, NULL \
+ } \
+}
+
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
@@ -132,6 +144,7 @@ static Key keys[] = {
{ MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
{ MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
+ { MODKEY, GDK_KEY_m, spawn, BM_ADD("_SURF_URI") },
{ 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_KEY_c, stop, { 0 } },

+ 67
- 0
.local/src/surf/patches/surf-clipboard-20200112-a6a8878.diff View File

@ -0,0 +1,67 @@
From a6a8878bb6a203b589d559025b94a78214f22878 Mon Sep 17 00:00:00 2001
From: Olivier Moreau <m242@protonmail.com>
Date: Sun, 12 Jan 2020 11:23:11 +0000
Subject: [PATCH] Added choice between PRIMARY and CLIPBOARD Gtk selections, as
a config option
---
config.def.h | 1 +
surf.c | 11 +++++++++--
2 files changed, 10 insertions(+), 2 deletions(-)
diff --git a/config.def.h b/config.def.h
index 34265f6..03bbe2b 100644
--- a/config.def.h
+++ b/config.def.h
@@ -48,6 +48,7 @@ static Parameter defconfig[ParameterLast] = {
[Style] = { { .i = 1 }, },
[WebGL] = { { .i = 0 }, },
[ZoomLevel] = { { .f = 1.0 }, },
+ [ClipboardNotPrimary] = { { .i = 1 }, },
};
static UriParameters uriparams[] = {
diff --git a/surf.c b/surf.c
index 2b54e3c..b8a9b2f 100644
--- a/surf.c
+++ b/surf.c
@@ -82,6 +82,7 @@ typedef enum {
Style,
WebGL,
ZoomLevel,
+ ClipboardNotPrimary,
ParameterLast
} ParamName;
@@ -291,6 +292,7 @@ static ParamName loadcommitted[] = {
SpellLanguages,
Style,
ZoomLevel,
+ ClipboardNotPrimary,
ParameterLast
};
@@ -1816,13 +1818,18 @@ showcert(Client *c, const Arg *a)
void
clipboard(Client *c, const Arg *a)
{
+ /* User defined choice of selection, see config.h */
+ GdkAtom selection = GDK_SELECTION_PRIMARY;
+ if (curconfig[ClipboardNotPrimary].val.i > 0)
+ selection = GDK_SELECTION_CLIPBOARD;
+
if (a->i) { /* load clipboard uri */
gtk_clipboard_request_text(gtk_clipboard_get(
- GDK_SELECTION_PRIMARY),
+ selection),
pasteuri, c);
} else { /* copy uri */
gtk_clipboard_set_text(gtk_clipboard_get(
- GDK_SELECTION_PRIMARY), c->targeturi
+ selection), c->targeturi
? c->targeturi : geturi(c), -1);
}
}
--
2.24.1

+ 107
- 0
.local/src/surf/patches/surf-history-20181009-2b71a22.diff View File

@ -0,0 +1,107 @@
diff -up surf-2.0/config.def.h surf-2.0-history/config.def.h
--- surf-2.0/config.def.h 2017-11-26 14:29:37.963786915 +0100
+++ surf-2.0-history/config.def.h 2017-11-26 19:48:31.300096237 +0100
@@ -6,6 +6,7 @@ static char *styledir = "~/.surf/s
static char *certdir = "~/.surf/certificates/";
static char *cachedir = "~/.surf/cache/";
static char *cookiefile = "~/.surf/cookies.txt";
+static char *historyfile = "~/.surf/history.txt";
/* Webkit default features */
/* Highest priority value will be used.
@@ -101,6 +102,11 @@ static WebKitFindOptions findopts = WEBK
} \
}
+#define SETURI(p) { .v = (char *[]){ "/bin/sh", "-c", \
+"prop=\"`surf_history_dmenu.sh`\" &&" \
+"xprop -id $1 -f $0 8s -set $0 \"$prop\"", \
+p, winid, NULL } }
+
/* styles */
/*
* The iteration will stop at the first match, beginning at the beginning of
@@ -181,6 +187,7 @@ static Key keys[] = {
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_b, toggle, { .i = ScrollBars } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_t, toggle, { .i = StrictTLS } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
+ { MODKEY , GDK_KEY_Return, spawn, SETURI("_SURF_GO") },
};
/* button definitions */
Only in surf-2.0-history/: config.h
Only in surf-2.0: .git
Only in surf-2.0-history/: surf
diff -up surf-2.0/surf.c surf-2.0-history/surf.c
--- surf-2.0/surf.c 2017-11-26 14:29:37.963786915 +0100
+++ surf-2.0-history/surf.c 2017-11-26 14:20:36.757100476 +0100
@@ -171,6 +171,7 @@ static void newwindow(Client *c, const A
static void spawn(Client *c, const Arg *a);
static void destroyclient(Client *c);
static void cleanup(void);
+static void updatehistory(const char *u, const char *t);
/* GTK/WebKit */
static WebKitWebView *newview(Client *c, WebKitWebView *rv);
@@ -336,10 +337,11 @@ setup(void)
curconfig = defconfig;
/* dirs and files */
- cookiefile = buildfile(cookiefile);
- scriptfile = buildfile(scriptfile);
- cachedir = buildpath(cachedir);
- certdir = buildpath(certdir);
+ cookiefile = buildfile(cookiefile);
+ historyfile = buildfile(historyfile);
+ scriptfile = buildfile(scriptfile);
+ cachedir = buildpath(cachedir);
+ certdir = buildpath(certdir);
gdkkb = gdk_seat_get_keyboard(gdk_display_get_default_seat(gdpy));
@@ -1042,12 +1044,28 @@ cleanup(void)
while (clients)
destroyclient(clients);
g_free(cookiefile);
+ g_free(historyfile);
g_free(scriptfile);
g_free(stylefile);
g_free(cachedir);
XCloseDisplay(dpy);
}
+void
+updatehistory(const char *u, const char *t)
+{
+ FILE *f;
+ f = fopen(historyfile, "a+");
+
+ char b[20];
+ time_t now = time (0);
+ strftime (b, 20, "%Y-%m-%d %H:%M:%S", localtime (&now));
+ fputs(b, f);
+
+ fprintf(f, " %s %s\n", u, t);
+ fclose(f);
+}
+
WebKitWebView *
newview(Client *c, WebKitWebView *rv)
{
@@ -1417,6 +1435,7 @@ loadfailedtls(WebKitWebView *v, gchar *u
return TRUE;
}
+
void
loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c)
{
@@ -1445,6 +1464,7 @@ loadchanged(WebKitWebView *v, WebKitLoad
break;
case WEBKIT_LOAD_FINISHED:
seturiparameters(c, uri, loadfinished);
+ updatehistory(uri, c->title);
/* Disabled until we write some WebKitWebExtension for
* manipulating the DOM directly.
evalscript(c, "document.documentElement.style.overflow = '%s'",
Only in surf-2.0-history/: surf.o

+ 134
- 0
.local/src/surf/patches/surf-modal-20190209-d068a38.diff View File

@ -0,0 +1,134 @@
From 74a98d9600c50d50b9323cf8e459c88eb15da557 Mon Sep 17 00:00:00 2001
From: efe <efe@efe.kim>
Date: Sat, 9 Feb 2019 13:16:51 -0500
Subject: [PATCH] Modal behaviour, 'i' to insert 'Esc' to get to the normal
mode
---
config.def.h | 53 +++++++++++++++++++++++++++-------------------------
surf.c | 14 +++++++++++++-
2 files changed, 41 insertions(+), 26 deletions(-)
diff --git a/config.def.h b/config.def.h
index 34265f6..8b7d5a2 100644
--- a/config.def.h
+++ b/config.def.h
@@ -130,41 +130,44 @@ static SiteSpecific certs[] = {
*/
static Key keys[] = {
/* modifier keyval function arg */
- { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
- { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
- { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
+ { 0, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
+ { 0, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
+ { 0, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
- { 0, GDK_KEY_Escape, stop, { 0 } },
- { MODKEY, GDK_KEY_c, stop, { 0 } },
+ { 0, GDK_KEY_i, insert, { .i = 1 } },
+ { 0, GDK_KEY_Escape, insert, { .i = 0 } },
- { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
- { MODKEY, GDK_KEY_r, reload, { .i = 0 } },
+ { 0, GDK_KEY_c, stop, { 0 } },
- { MODKEY, GDK_KEY_l, navigate, { .i = +1 } },
- { MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
+ { MODKEY, GDK_KEY_r, reload, { .i = 1 } },
+ { 0, GDK_KEY_r, reload, { .i = 0 } },
+
+ { 0, GDK_KEY_l, navigate, { .i = +1 } },
+ { 0, GDK_KEY_h, navigate, { .i = -1 } },
/* vertical and horizontal scrolling, in viewport percentage */
- { MODKEY, GDK_KEY_j, scrollv, { .i = +10 } },
- { MODKEY, GDK_KEY_k, scrollv, { .i = -10 } },
- { MODKEY, GDK_KEY_space, scrollv, { .i = +50 } },
- { MODKEY, GDK_KEY_b, scrollv, { .i = -50 } },
- { MODKEY, GDK_KEY_i, scrollh, { .i = +10 } },
- { MODKEY, GDK_KEY_u, scrollh, { .i = -10 } },
+ { 0, GDK_KEY_j, scrollv, { .i = +10 } },
+ { 0, GDK_KEY_k, scrollv, { .i = -10 } },
+ { 0, GDK_KEY_space, scrollv, { .i = +50 } },
+ { 0, GDK_KEY_b, scrollv, { .i = -50 } },
+ { 0, GDK_KEY_i, scrollh, { .i = +10 } },
+ { 0, GDK_KEY_u, scrollh, { .i = -10 } },
- { MODKEY|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
- { MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
- { MODKEY|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
- { MODKEY, GDK_KEY_minus, zoom, { .i = -1 } },
- { MODKEY, GDK_KEY_plus, zoom, { .i = +1 } },
+ { 0|GDK_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
+ { 0|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
+ { 0|GDK_SHIFT_MASK, GDK_KEY_q, zoom, { .i = 0 } },
+ { 0, GDK_KEY_minus, zoom, { .i = -1 } },
+ { 0|GDK_SHIFT_MASK, GDK_KEY_plus, zoom, { .i = +1 } },
+ { 0, GDK_KEY_equal, zoom, { .i = 0 } },
- { MODKEY, GDK_KEY_p, clipboard, { .i = 1 } },
- { MODKEY, GDK_KEY_y, clipboard, { .i = 0 } },
+ { 0, GDK_KEY_p, clipboard, { .i = 1 } },
+ { 0, GDK_KEY_y, clipboard, { .i = 0 } },
- { MODKEY, GDK_KEY_n, find, { .i = +1 } },
- { MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
+ { 0, GDK_KEY_n, find, { .i = +1 } },
+ { 0|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
- { MODKEY|GDK_SHIFT_MASK, GDK_KEY_p, print, { 0 } },
+ { MODKEY, GDK_KEY_p, print, { 0 } },
{ MODKEY, GDK_KEY_t, showcert, { 0 } },
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } },
diff --git a/surf.c b/surf.c
index 2b54e3c..f4cbe68 100644
--- a/surf.c
+++ b/surf.c
@@ -175,6 +175,7 @@ static void spawn(Client *c, const Arg *a);
static void msgext(Client *c, char type, const Arg *a);
static void destroyclient(Client *c);
static void cleanup(void);
+static int insertmode = 0;
/* GTK/WebKit */
static WebKitWebView *newview(Client *c, WebKitWebView *rv);
@@ -231,6 +232,7 @@ static void togglefullscreen(Client *c, const Arg *a);
static void togglecookiepolicy(Client *c, const Arg *a);
static void toggleinspector(Client *c, const Arg *a);
static void find(Client *c, const Arg *a);
+static void insert(Client *c, const Arg *a);
/* Buttons */
static void clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h);
@@ -1333,7 +1335,11 @@ winevent(GtkWidget *w, GdkEvent *e, Client *c)
updatetitle(c);
break;
case GDK_KEY_PRESS:
- if (!curconfig[KioskMode].val.i) {
+ if (!curconfig[KioskMode].val.i &&
+ !insertmode ||
+ CLEANMASK(e->key.state) == (MODKEY|GDK_SHIFT_MASK) ||
+ CLEANMASK(e->key.state) == (MODKEY) ||
+ gdk_keyval_to_lower(e->key.keyval) == (GDK_KEY_Escape)) {
for (i = 0; i < LENGTH(keys); ++i) {
if (gdk_keyval_to_lower(e->key.keyval) ==
keys[i].keyval &&
@@ -1947,6 +1953,12 @@ find(Client *c, const Arg *a)
}
}
+void
+insert(Client *c, const Arg *a)
+{
+ insertmode = (a->i);
+}
+
void
clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h)
{
--
2.20.1

+ 101
- 0
.local/src/surf/patches/surf-multijs-20190325-d068a38.diff View File

@ -0,0 +1,101 @@
From 8d8ca34a8e61733711e23ce43b88435bfdfd4962 Mon Sep 17 00:00:00 2001
From: knary <theknary@gmail.com>
Date: Mon, 25 Mar 2019 15:03:15 -0400
Subject: [PATCH] This patch replaces scriptfile with an array of
scriptfiles[]. This allows for the inclusion of multiple javascript files
instead of filling up one file with multiple script plugins.
---
config.def.h | 4 +++-
surf.c | 23 +++++++++++++++--------
2 files changed, 18 insertions(+), 9 deletions(-)
diff --git a/config.def.h b/config.def.h
index 34265f6..7d7d68e 100644
--- a/config.def.h
+++ b/config.def.h
@@ -1,11 +1,13 @@
/* modifier 0 means no modifier */
static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */
static char *fulluseragent = ""; /* Or override the whole user agent string */
-static char *scriptfile = "~/.surf/script.js";
static char *styledir = "~/.surf/styles/";
static char *certdir = "~/.surf/certificates/";
static char *cachedir = "~/.surf/cache/";
static char *cookiefile = "~/.surf/cookies.txt";
+static char *scriptfiles[] = {
+ "~/.surf/script.js",
+};
/* Webkit default features */
/* Highest priority value will be used.
diff --git a/surf.c b/surf.c
index 2b54e3c..34a75de 100644
--- a/surf.c
+++ b/surf.c
@@ -337,9 +337,11 @@ setup(void)
/* dirs and files */
cookiefile = buildfile(cookiefile);
- scriptfile = buildfile(scriptfile);
cachedir = buildpath(cachedir);
certdir = buildpath(certdir);
+ for (i = 0; i < LENGTH(scriptfiles); i++) {
+ scriptfiles[i] = buildfile(scriptfiles[i]);
+ }
gdkkb = gdk_seat_get_keyboard(gdk_display_get_default_seat(gdpy));
@@ -945,9 +947,11 @@ runscript(Client *c)
gchar *script;
gsize l;
- if (g_file_get_contents(scriptfile, &script, &l, NULL) && l)
- evalscript(c, "%s", script);
- g_free(script);
+ for (int i = 0; i < LENGTH(scriptfiles); i++) {
+ if (g_file_get_contents(scriptfiles[i], &script, &l, NULL) && l)
+ evalscript(c, "%s", script);
+ g_free(script);
+ }
}
void
@@ -1010,9 +1014,9 @@ newwindow(Client *c, const Arg *a, int noembed)
cmd[i++] = curconfig[Style].val.i ? "-M" : "-m" ;
cmd[i++] = curconfig[Inspector].val.i ? "-N" : "-n" ;
cmd[i++] = curconfig[Plugins].val.i ? "-P" : "-p" ;
- if (scriptfile && g_strcmp0(scriptfile, "")) {
+ if (scriptfiles[0] && g_strcmp0(scriptfiles[0], "")) {
cmd[i++] = "-r";
- cmd[i++] = scriptfile;
+ cmd[i++] = scriptfiles[0];
}
cmd[i++] = curconfig[JavaScript].val.i ? "-S" : "-s";
cmd[i++] = curconfig[StrictTLS].val.i ? "-T" : "-t";
@@ -1076,9 +1080,12 @@ cleanup(void)
close(pipein[0]);
close(pipeout[1]);
g_free(cookiefile);
- g_free(scriptfile);
g_free(stylefile);
g_free(cachedir);
+ for (int i = 0; i < LENGTH(scriptfiles); i++) {
+ g_free(scriptfiles[i]);
+ }
+
XCloseDisplay(dpy);
}
@@ -2067,7 +2074,7 @@ main(int argc, char *argv[])
defconfig[Plugins].prio = 2;
break;
case 'r':
- scriptfile = EARGF(usage());
+ scriptfiles[0] = EARGF(usage());
break;
case 's':
defconfig[JavaScript].val.i = 0;
--
2.21.0

+ 26
- 0
.local/src/surf/patches/surf-spacesearch-20170408-b814567.diff View File

@ -0,0 +1,26 @@
diff --git a/config.def.h b/config.def.h
index 6d3135e..75dc6a6 100644
--- a/config.def.h
+++ b/config.def.h
@@ -153,6 +153,8 @@ static Key keys[] = {
{ MODKEY|GDK_SHIFT_MASK, GDK_KEY_m, toggle, { .i = Style } },
};
+static char *searchengine = "https://duckduckgo.com/?q=";
+
/* button definitions */
/* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
static Button buttons[] = {
diff --git a/surf.c b/surf.c
index 93a1629..c20537e 100644
--- a/surf.c
+++ b/surf.c
@@ -476,6 +476,8 @@ loaduri(Client *c, const Arg *a)
} else if (!stat(uri, &st) && (path = realpath(uri, NULL))) {
url = g_strdup_printf("file://%s", path);
free(path);
+ } else if (*uri == ' ') {
+ url = g_strdup_printf("%s%s", searchengine, uri + 1);
} else {
url = g_strdup_printf("http://%s", uri);
}

+ 138
- 0
.local/src/surf/patches/surf-tip-navhist.diff View File

@ -0,0 +1,138 @@
diff --git a/config.def.h b/config.def.h
index 5245129..604028f 100644
--- a/config.def.h
+++ b/config.def.h
@@ -45,6 +45,16 @@ static Bool allowgeolocation = TRUE;
} \
}
+#define SELNAV { \
+ .v = (char *[]){ "/bin/sh", "-c", \
+ "prop=\"`xprop -id $0 _SURF_HIST" \
+ " | sed -e 's/^.[^\"]*\"//' -e 's/\"$//' -e 's/\\\\\\n/\\n/g'" \
+ " | dmenu -i -l 10`\"" \
+ " && xprop -id $0 -f _SURF_NAV 8s -set _SURF_NAV \"$prop\"", \
+ winid, NULL \
+ } \
+}
+
/* DOWNLOAD(URI, referer) */
#define DOWNLOAD(d, r) { \
.v = (char *[]){ "/bin/sh", "-c", \
@@ -99,6 +109,7 @@ static Key keys[] = {
{ MODKEY, GDK_l, navigate, { .i = +1 } },
{ MODKEY, GDK_h, navigate, { .i = -1 } },
+ { MODKEY|GDK_SHIFT_MASK,GDK_h, selhist, SELNAV },
{ MODKEY, GDK_j, scroll_v, { .i = +1 } },
{ MODKEY, GDK_k, scroll_v, { .i = -1 } },
diff --git a/surf.c b/surf.c
index 0fae80b..1c09336 100644
--- a/surf.c
+++ b/surf.c
@@ -36,7 +36,7 @@ char *argv0;
#define COOKIEJAR_TYPE (cookiejar_get_type ())
#define COOKIEJAR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), COOKIEJAR_TYPE, CookieJar))
-enum { AtomFind, AtomGo, AtomUri, AtomLast };
+enum { AtomFind, AtomGo, AtomUri, AtomHist, AtomNav, AtomLast };
enum {
ClkDoc = WEBKIT_HIT_TEST_RESULT_CONTEXT_DOCUMENT,
ClkLink = WEBKIT_HIT_TEST_RESULT_CONTEXT_LINK,
@@ -177,6 +177,8 @@ static void loadstatuschange(WebKitWebView *view, GParamSpec *pspec,
Client *c);
static void loaduri(Client *c, const Arg *arg);
static void navigate(Client *c, const Arg *arg);
+static void selhist(Client *c, const Arg *arg);
+static void navhist(Client *c, const Arg *arg);
static Client *newclient(void);
static void newwindow(Client *c, const Arg *arg, gboolean noembed);
static void pasteuri(GtkClipboard *clipboard, const char *text, gpointer d);
@@ -813,6 +815,59 @@ navigate(Client *c, const Arg *arg) {
webkit_web_view_go_back_or_forward(c->view, steps);
}
+static void
+selhist(Client *c, const Arg *arg) {
+ WebKitWebBackForwardList *lst;
+ WebKitWebHistoryItem *cur;
+ gint i;
+ gchar *out;
+ gchar *tmp;
+ gchar *line;
+
+ out = g_strdup("");
+
+ if(!(lst = webkit_web_view_get_back_forward_list(c->view)))
+ return;
+
+ for(i = webkit_web_back_forward_list_get_back_length(lst); i > 0; i--) {
+ if(!(cur = webkit_web_back_forward_list_get_nth_item(lst, -i)))
+ break;
+ line = g_strdup_printf("%d: %s\n", -i,
+ webkit_web_history_item_get_original_uri(cur));
+ tmp = g_strconcat(out, line, NULL);
+ g_free(out);
+ out = tmp;
+ }
+
+ if((cur = webkit_web_back_forward_list_get_nth_item(lst, 0))) {
+ line = g_strdup_printf("%d: %s", 0,
+ webkit_web_history_item_get_original_uri(cur));
+ tmp = g_strconcat(out, line, NULL);
+ g_free(out);
+ out = tmp;
+ }
+
+ for(i = 1; i <= webkit_web_back_forward_list_get_forward_length(lst); i++) {
+ if(!(cur = webkit_web_back_forward_list_get_nth_item(lst, i)))
+ break;
+ line = g_strdup_printf("\n%d: %s", i,
+ webkit_web_history_item_get_original_uri(cur));
+ tmp = g_strconcat(out, line, NULL);
+ g_free(out);
+ out = tmp;
+ }
+
+ setatom(c, AtomHist, out);
+ g_free(out);
+ spawn(c, arg);
+}
+
+static void
+navhist(Client *c, const Arg *arg) {
+ Arg a = { .i = atoi(arg->v) };
+ navigate(c, &a);
+}
+
static Client *
newclient(void) {
Client *c;
@@ -1014,6 +1069,7 @@ newclient(void) {
setatom(c, AtomFind, "");
setatom(c, AtomUri, "about:blank");
+ setatom(c, AtomHist, "");
if(hidebackground)
webkit_web_view_set_transparent(c->view, TRUE);
@@ -1153,6 +1209,9 @@ processx(GdkXEvent *e, GdkEvent *event, gpointer d) {
loaduri(c, &arg);
return GDK_FILTER_REMOVE;
+ } else if(ev->atom == atoms[AtomNav]) {
+ arg.v = getatom(c, AtomNav);
+ navhist(c, &arg);
}
}
}
@@ -1247,6 +1306,8 @@ setup(void) {
atoms[AtomFind] = XInternAtom(dpy, "_SURF_FIND", False);
atoms[AtomGo] = XInternAtom(dpy, "_SURF_GO", False);
atoms[AtomUri] = XInternAtom(dpy, "_SURF_URI", False);
+ atoms[AtomHist] = XInternAtom(dpy, "_SURF_HIST", False);
+ atoms[AtomNav] = XInternAtom(dpy, "_SURF_NAV", False);
/* dirs and files */
cookiefile = buildfile(cookiefile);

BIN
.local/src/surf/surf View File


+ 15
- 52
.local/src/surf/surf.c View File

@ -180,7 +180,6 @@ static void spawn(Client *c, const Arg *a);
static void msgext(Client *c, char type, const Arg *a);
static void destroyclient(Client *c);
static void cleanup(void);
static int insertmode = 0;
/* GTK/WebKit */
static WebKitWebView *newview(Client *c, WebKitWebView *rv);
@ -238,7 +237,6 @@ static void togglecookiepolicy(Client *c, const Arg *a);
static void toggleinspector(Client *c, const Arg *a);
static void find(Client *c, const Arg *a);
static void externalpipe(Client *c, const Arg *a);
static void insert(Client *c, const Arg *a);
/* Buttons */
static void clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h);
@ -431,15 +429,12 @@ setup(void)
/* dirs and files */
cookiefile = buildfile(cookiefile);
cachedir = buildpath(cachedir);
certdir = buildpath(certdir);
historyfile = buildfile(historyfile);
if (curconfig[Ephemeral].val.i)
cachedir = NULL;
else
cachedir = buildpath(cachedir);
for (i = 0; i < LENGTH(scriptfiles); i++) {
scriptfiles[i] = buildfile(scriptfiles[i]);
}
gdkkb = gdk_seat_get_keyboard(gdk_display_get_default_seat(gdpy));
if (socketpair(AF_UNIX, SOCK_DGRAM, 0, spair) < 0) {
@ -660,8 +655,6 @@ loaduri(Client *c, const Arg *a)
if (!stat(apath, &st) && (path = realpath(apath, NULL))) {
url = g_strdup_printf("file://%s", path);
free(path);
} else if (*uri == ' ') {
url = g_strdup_printf("%s%s", searchengine, uri + 1);
} else {
url = g_strdup_printf("http://%s", uri);
}
@ -736,9 +729,8 @@ updatetitle(Client *c)
title = g_strdup_printf("[%i%%] %s:%s | %s",
c->progress, togglestats, pagestats, name);
else
title = g_strdup_printf("%s %s:%s | %s",
insertmode ? "[INSERT] " : "",
pagestats, togglestats, name);
title = g_strdup_printf("%s:%s | %s",
togglestats, pagestats, name);
gtk_window_set_title(GTK_WINDOW(c->win), title);
g_free(title);
@ -751,16 +743,16 @@ void
gettogglestats(Client *c)
{
togglestats[0] = cookiepolicy_set(cookiepolicy_get());
togglestats[1] = curconfig[CaretBrowsing].val.i ? 'C' : '\0';
togglestats[2] = curconfig[Geolocation].val.i ? 'G' : '\0';
togglestats[3] = curconfig[DiskCache].val.i ? 'D' : '\0';
togglestats[4] = curconfig[LoadImages].val.i ? 'I' : '\0';
togglestats[5] = curconfig[JavaScript].val.i ? 'S' : '\0';
togglestats[6] = curconfig[Plugins].val.i ? 'V' : '\0';
togglestats[7] = curconfig[Style].val.i ? 'M' : '\0';
togglestats[8] = curconfig[FrameFlattening].val.i ? 'F' : '\0';
togglestats[9] = curconfig[Certificate].val.i ? 'X' : '\0';
togglestats[10] = curconfig[StrictTLS].val.i ? 'T' : '\0';
togglestats[1] = curconfig[CaretBrowsing].val.i ? 'C' : 'c';
togglestats[2] = curconfig[Geolocation].val.i ? 'G' : 'g';
togglestats[3] = curconfig[DiskCache].val.i ? 'D' : 'd';
togglestats[4] = curconfig[LoadImages].val.i ? 'I' : 'i';
togglestats[5] = curconfig[JavaScript].val.i ? 'S' : 's';
togglestats[6] = curconfig[Plugins].val.i ? 'V' : 'v';
togglestats[7] = curconfig[Style].val.i ? 'M' : 'm';
togglestats[8] = curconfig[FrameFlattening].val.i ? 'F' : 'f';
togglestats[9] = curconfig[Certificate].val.i ? 'X' : 'x';
togglestats[10] = curconfig[StrictTLS].val.i ? 'T' : 't';
togglestats[11] = '\0';
}
@ -1183,7 +1175,6 @@ cleanup(void)
close(spair[0]);
close(spair[1]);
g_free(cookiefile);
g_free(historyfile);
g_free(stylefile);
g_free(cachedir);
for (int i = 0; i < LENGTH(scriptfiles); i++) {
@ -1193,21 +1184,6 @@ cleanup(void)
XCloseDisplay(dpy);
}
void
updatehistory(const char *u, const char *t)
{
FILE *f;
f = fopen(historyfile, "a+");
char b[20];
time_t now = time (0);
strftime (b, 20, "%Y-%m-%d %H:%M:%S", localtime (&now));
fputs(b, f);
fprintf(f, " %s %s\n", u, t);
fclose(f);
}
WebKitWebView *
newview(Client *c, WebKitWebView *rv)
{
@ -1465,11 +1441,7 @@ winevent(GtkWidget *w, GdkEvent *e, Client *c)
updatetitle(c);
break;
case GDK_KEY_PRESS:
if (!curconfig[KioskMode].val.i &&
!insertmode ||
CLEANMASK(e->key.state) == (MODKEY|GDK_SHIFT_MASK) ||
CLEANMASK(e->key.state) == (MODKEY) ||
gdk_keyval_to_lower(e->key.keyval) == (GDK_KEY_Escape)) {
if (!curconfig[KioskMode].val.i) {
for (i = 0; i < LENGTH(keys); ++i) {
if (gdk_keyval_to_lower(e->key.keyval) ==
keys[i].keyval &&
@ -1627,7 +1599,6 @@ loadfailedtls(WebKitWebView *v, gchar *uri, GTlsCertificate *cert,
return TRUE;
}
void
loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c)
{
@ -1658,7 +1629,6 @@ loadchanged(WebKitWebView *v, WebKitLoadEvent e, Client *c)
break;
case WEBKIT_LOAD_FINISHED:
seturiparameters(c, uri, loadfinished);
updatehistory(uri, c->title);
/* Disabled until we write some WebKitWebExtension for
* manipulating the DOM directly.
evalscript(c, "document.documentElement.style.overflow = '%s'",
@ -2095,13 +2065,6 @@ find(Client *c, const Arg *a)
}
}
void
insert(Client *c, const Arg *a)
{
insertmode = (a->i);
updatetitle(c);
}
void
clicknavigate(Client *c, const Arg *a, WebKitHitTestResult *h)
{


+ 2245
- 0
.local/src/surf/surf.c.orig
File diff suppressed because it is too large
View File


BIN
.local/src/surf/surf.o View File


BIN
.local/src/surf/webext-surf.o View File


BIN
.local/src/surf/webext-surf.so View File


+ 2
- 2
.local/src/tabbed/config.h View File

@ -39,8 +39,8 @@ static Key keys[] = {
{ MODKEY|ShiftMask, XK_Return, focusonce, { 0 } },
{ MODKEY|ShiftMask, XK_Return, spawn, { 0 } },
{ ShiftMask, XK_k, rotate, { .i = +1 } },
{ ShiftMask, XK_j, rotate, { .i = -1 } },
{ MODKEY, XK_l, rotate, { .i = +1 } },
{ MODKEY, XK_h, rotate, { .i = -1 } },
{ Mod1Mask|ShiftMask, XK_j, movetab, { .i = -1 } },
{ Mod1Mask|ShiftMask, XK_k, movetab, { .i = +1 } },
{ MODKEY, XK_Tab, rotate, { .i = 0 } },


+ 9
- 0
.profile View File

@ -98,4 +98,13 @@ if [ "$DISPLAY" = "" ] && [ "$(tty)" = /dev/tty1 ]; then
fi
exit
fi
# Start sway if logged in from tty2
if [ "$DISPLAY" = "" ] && [ "$(tty)" = /dev/tty2 ]; then
if [ "$DBUS_SESSION_BUS_ADDRESS" = "" ] && [ ! $(command -v dbus-run-session) = "" ]; then
exec dbus-run-session sway 2> $XDG_RUNTIME_DIR/sway.err > $XDG_RUNTIME_DIR/sway
else
exec sway 2> $XDG_RUNTIME_DIR/sway.err > $XDG_RUNTIME_DIR/sway
fi
exit
fi

Loading…
Cancel
Save