223 Commits

Author SHA1 Message Date
eeeck 85d2bb6cad Install on global path 2025-12-30 11:35:30 +01:00
eeeck 1fcada4536 Change cronjob to once a week
Sync less regularly since upstream repo is updated seldom
2025-11-11 15:41:32 +01:00
eeeck 1d1cbc83f5 Fix issue with pathspec 'master' 2025-11-11 15:01:15 +01:00
eeeck 3f21829810 Fix master branch name 2025-11-11 14:56:44 +01:00
eeeck 63fe59c7de Regularly fetch from upstream 2025-10-19 23:53:53 +02:00
Quentin Rameau 48517e586c Fix (2) some typo for kiosk mode in the man-page
Looks like I didn't pay enough attention the first time,
that's what you get for pushing without review!

Thanks to Hiltjo for spotting this!
2025-04-19 12:02:45 +02:00
Quentin Rameau ca380ccb93 Add configuration option for PDF-JS-viewer 2025-04-18 13:56:14 +02:00
Artyom Bologov 22cc5ceee2 Support PDFs 2025-04-18 13:38:56 +02:00
Quentin Rameau c3b3b95f4a Fix some typo for kiosk mode in the man-page
Thanks to Tim Dickson <dickson.tim@googlemail.com> for spotting it!
2025-01-05 12:02:38 +01:00
Quentin Rameau 7f1156f9b0 Build against Webkit 4.1
Seems that this is needed for libsoup3.
2025-01-05 12:02:38 +01:00
Quentin Rameau b3ba9f5991 Request HTTPS by default instead of HTTP
This might be more reasonable privacy-wise in 2025.
2025-01-05 12:02:38 +01:00
Quentin Rameau 9ef79bf710 webext: Process full messages
Piped messages would not always be fully sent in a single read.
Do a bit of message reassembly.
2024-03-24 15:27:20 +01:00
Quentin Rameau d5f45bffe0 webext: Free JavaScript objects
Webkit documentation says JavaScript objects refcount is always
increased, and has to be released always.
2024-03-24 15:27:20 +01:00
Quentin Rameau b48be75179 Fix message sizes for web extension communication 2024-03-17 09:13:56 +01:00
Quentin Rameau 2ea91766bb webext: Remove unused functions
Communication from web extension to surf isn't used,
this code can always be brought back if needed.
2024-03-17 08:22:18 +01:00
Quentin Rameau 7513a622e3 Update get frame name function
webkit_navigation_policy_decision_get_frame_name has been deprecated
since 2.40.
2024-03-17 08:22:18 +01:00
Quentin Rameau 4bab57968d Remove setting processing model
The processing model we want is actually the only one supported
since 2.40.
2024-03-17 08:22:18 +01:00
Quentin Rameau 5e591b89a1 Update deprecated JavaScript eval function
Function webkit_web_view_run_javascript has been deprecated since 2.40.
2024-03-17 08:22:18 +01:00
Quentin Rameau 85bfff1083 Move TLS parameters handling to datamanager
Using web context is deprecated since 2.32.
2024-03-17 08:22:18 +01:00
Quentin Rameau 3f4292b7cc Remove Java support toggle
This has been deprecated since 2.38.
2024-03-17 08:22:18 +01:00
Quentin Rameau 175710126c Remove frame flattening toggle
This has been deprecated since 2.38.
2024-03-17 08:22:18 +01:00
Quentin Rameau f1d47112d6 Add webkit URI scheme 2024-03-17 08:22:17 +01:00
Quentin Rameau 30f5464eb1 Fix usage message: -Pp don't exist anymore
Thanks to Eric Pruitt <eric.pruitt@gmail.com> for reporting!
2023-11-18 12:48:19 +01:00
Petr Vaněk e9b7ec6722 webext: add missing gio/gunixfdlist.h includes
This resolves two set of warnings pointed by compiler
-Wimplicit-function-declaration and -Wint-conversion, where the later
one can result with segfault caused by invalid cast from int to pointer.

Fixes: 665a709b52 ("webext: Exchange fd over webkit messages")
2022-10-22 13:07:19 +02:00
Quentin Rameau 665a709b52 webext: Exchange fd over webkit messages
This is more complex, but webkit2gtk prevents passing file descriptors
to processes in 2.38.0.
2022-10-16 17:39:05 +02:00
Quentin Rameau 609ea1c8e6 Do not reload page when toggling dark mode
This change had actually been applied in previous commit d3ee652
by mistake.
2022-05-04 03:31:58 +02:00
Quentin Rameau 38cb1632bf Fix dark mode parameter application 2022-04-10 18:50:02 +02:00
Quentin Rameau d3ee652860 Only get webkit context and settings once 2022-04-10 18:49:35 +02:00
Quentin Rameau 1f5b8f3bd1 Add dark mode toggle
This sets dark gtk theme variant,
which should make webkit2gtk use dark css variant
from websites that provide it.
2022-04-10 16:35:24 +02:00
Quentin Rameau 11dca18a2d Improve non-ASCII character search handling
Before, the XA_STRING would only let use ASCII characters properly.
Now UTF-8 characters should be handled correctly.
2021-07-19 22:27:50 +02:00
Quentin Rameau 238d2273b5 Improve SETPROP xprop parsing
This handles correctly quotes, backslashes, etc.
2021-07-19 22:27:32 +02:00
Quentin Rameau 761ea9e4c6 Fix togglestats array 2021-05-21 00:16:17 +02:00
Quentin Rameau bcd7d74e61 Update LICENSE file 2021-05-10 00:44:36 +02:00
Quentin Rameau 327cca048b Fix distfile generation 2021-05-10 00:37:46 +02:00
Quentin Rameau d75c3ded0b Bump version to 2.1 2021-05-08 16:53:53 +02:00
Quentin Rameau 4540b4a97c Remove accelerated canvas parameter
This has been deprecated since release 2.32.
2021-04-30 08:48:19 +02:00
Quentin Rameau fce76429b8 Remove external plugin handling
This has been deprecated since release 2.32.
2021-04-30 08:47:20 +02:00
Quentin Rameau 7dcce9e1b9 Makefile: use explicit targets
Some make implementation have trouble with following inference rules
indirection
2020-11-07 18:43:11 +01:00
Quentin Rameau 262c3ee24a webext: Fix missing flags for gio 2020-11-07 15:32:46 +01:00
Quentin Rameau 55c65b21f6 Simplify communication with webext 2020-11-01 16:59:12 +01:00
Quentin Rameau 5f81d4a99f Set title on committed load 2020-11-01 16:59:12 +01:00
Quentin Rameau e92fd1aa5f Communicate through a Unix socket instead of a pipe pair 2020-11-01 16:59:12 +01:00
Quentin Rameau f61cfc720c Add support for ephemeral (zero disk access) 2020-11-01 16:59:12 +01:00
Quentin Rameau 6850365d7c Add support for configuring plugins directories 2020-11-01 16:59:12 +01:00
Quentin Rameau 8d5e2b3a40 Remove common 2020-11-01 16:59:11 +01:00
Quentin Rameau 21fcbc004e Makefile: rework how webextensions are handled 2019-02-10 19:50:25 +01:00
efe d068a3878b Fix vertical scroll directions in the config file 2019-02-09 00:25:39 +01:00
Leonardo Taccari bf46e40f3a Makefile: fix a typo in clean: target 2019-02-07 21:28:15 +01:00
Quentin Rameau 890b2fc396 Makefile: include common to webext 2019-02-06 10:53:05 +01:00
Quentin Rameau b9cd3bb0bc Makefile: fix a typo for the webext CFLAGS
Thanks to Justin Keogh <suckless@v6y.net> for spotting this
2019-02-06 10:22:15 +01:00
Quentin Rameau 02541c3146 Send message size inside messages through pipes 2018-10-15 13:15:54 +02:00
Leonardo Taccari 2b71a22755 Use pkg-config for X11{INC,LIB} 2018-10-09 21:50:20 +02:00
Quentin Rameau 16beb6f8ac Makefile: fix dependencies 2018-10-09 12:41:00 +02:00
Quentin Rameau 4e7371317c Fix, again, webext directory in Makefile 2018-10-08 14:25:37 +02:00
Quentin Rameau 47e39851ca Fix webext directory in Makefile 2018-10-08 14:12:51 +02:00
Quentin Rameau 3321c42d36 Remove libtool depencency, reorganise Makefile
We don't need libtool anymore, just build the library directly.
This lets us simplify the Makefile too.
2018-10-08 13:51:51 +02:00
Quentin Rameau e7c629b258 Unobfuscate Makefile 2018-10-08 13:51:51 +02:00
Quentin Rameau 660413256f ext: get the right DOM on msg
When navigating history, the document-loaded signal isn't triggered and
we can't directly get back the previous webview, so we have no other
choice than to look it up everytime a new message is received.
2018-10-08 11:38:03 +02:00
Quentin Rameau 1901359efa Add a file for shared functions
New common.[hc] files where shared functions between surf and
webkitextension will be put. First addition is die().
2018-10-08 11:38:03 +02:00
Quentin Rameau 7ea0c2f7f8 Communicate with webextension via a pipe 2018-10-08 11:38:03 +02:00
Quentin Rameau 1bd6d20102 ext: first commit for surf lib 2018-10-08 11:38:03 +02:00
Quentin Rameau 0bd553a078 Request cookiemanager only once at creation 2018-10-08 11:38:03 +02:00
Quentin Rameau c60523a702 Exit more gracefully on web process crash. 2018-10-08 11:38:03 +02:00
nzl befe481a9b Allow tilde expansion in loaduri
also fixed a bug that ~foo/ was expanded to /home/fo/o/
2018-10-08 11:38:03 +02:00
Eddie Thieda d6954e1541 Fixed wording in FAQ.md 2018-06-18 12:34:52 +02:00
Quentin Rameau 6f6b343721 Force printing the winid when requested
Do not wait for the libc to decide flushing buffers, force it ourselves.

Thanks to koniu for reporting the issue.
2018-06-09 21:55:20 +02:00
Jochen Sprickerhof 81f0452bc6 Document SIGHUP in manpage 2018-02-23 13:39:35 +01:00
nzl d2e4989c3c Script text shouldn't go through formatted conversion 2018-02-23 13:39:35 +01:00
Eon S. Jeon 7817d0ec83 Add support for WebGL
Allows enabling and disabling WebGL support built into WebKit.
The feature is turned off by default.
2018-02-23 13:39:35 +01:00
Quentin Rameau 723ff26c36 Disable media autoplay by default 2017-06-03 10:23:40 +02:00
Quentin Rameau a0c3c80ee6 Store modified parameters list 2017-05-30 10:33:36 +02:00
Quentin Rameau a8bf206827 Use priority values instead of “forced” parameters
This makes parameter handling a bit easier and lets the user override
parameters as he sees fit.
2017-05-22 12:38:49 +02:00
Quentin Rameau a0ef4ba41d Get rid of config parameter MACROs
There's no need to obfuscate so much what is done, the user can deal
with a few extra knobs to set instead.
2017-05-22 12:38:49 +02:00
Quentin Rameau d3e974f4ea Get rid of integer member b in Arg
There's no need to keep another integer member there, use directly the i
integer one.
2017-05-22 12:38:49 +02:00
Quentin Rameau 70c1b548ab Only apply parameters when needed
Specify which parameter should be applied on which load state.
2017-05-22 12:38:49 +02:00
Quentin Rameau 2223417c91 Fix handling of uri-specific parameters
We need to (re)apply uri-specific parameters for each new uri even if
the parameter has already been set to get the correct value.

Thanks to Julien STEINHAUSER <julien.steinhauser@orange.fr> for the
report!
2017-05-22 12:38:49 +02:00
Quentin Rameau a1328457cf Unset previous user styles before applying another one 2017-05-22 12:38:49 +02:00
Constantine Bytensky 25652669ef Add config option for cross requests from file URLs
I use it to open local .xml files with .xsl style-sheets.
2017-05-22 12:38:49 +02:00
Quentin Rameau bcd05ae321 Add config option for microphone and webcam access 2017-05-21 17:13:02 +02:00
Quentin Rameau f5be376ccc Fix synchronization issue with atoms
Be sure to sync after setting an atom.
Sync too before reading one.
2017-05-12 00:30:51 +02:00
Quentin Rameau 5e2216c414 There's no need to call geturi() again in loadchanged
Also call the variable “uri” instead of “title” which was ambiguous
regarding what it is.
2017-05-12 00:30:45 +02:00
Quentin Rameau 4a1876eb80 Add config option for smooth scrolling activation 2017-05-11 15:33:42 +02:00
Quentin Rameau 93a3e4cda0 Add config option for Java activation 2017-05-11 15:27:27 +02:00
Quentin Rameau 298e688933 Add config option for setting default charset.
This will be used for pages with no specified charset.
2017-05-11 15:23:22 +02:00
Quentin Rameau 745a319baf Improve parameters handling
There's no need to reload all parameters each time a new url is loaded,
instead set only custom parameters and restore those to defaults when
needed.
2017-05-11 09:22:43 +02:00
ssd b115434720 Change PROMPT_GO from "URL:" to "Go:"
This looks more apropriate because URL is too specific and _SURF_GO can
be set to other things.
2017-05-11 09:22:43 +02:00
Quentin Rameau 47b145f2ec Add prompts for SETPROP
Imported from __20h__ repo, thanks to him and Ben Woolley.
2017-05-08 11:34:00 +02:00
Quentin Rameau b8b0c05035 Embed dmenu into the surf window by default 2017-05-08 11:33:59 +02:00
Quentin Rameau dca4264863 Simplify DOWNLOAD macro
No need to spawn an extra sh.
Use short flags for curl and quote operands.
Replace sleep with read, let the user close the download window instead
of waiting for an arbitrary time.
Rename d to reflect what it's used for.
Reorder sh positional arguments.
Set $0 to a command name and shift other positional parameters to
clarify the "sh -c" command.
2017-05-08 11:33:55 +02:00
Quentin Rameau 654d527f87 Simplify SETPROP macro
Get rid of xargs by using a subshell instead.
Use two replacement commands in sed because back-references in BRE are
too differently implemented in different libc.
Rename p, q, to reflect what they're used for.
Reorder sh positional arguments.
Set $0 to a command name and shift other positional parameters to
clarify the "sh -c" command.
2017-05-08 11:30:20 +02:00
Quentin Rameau d984d12de7 Simplify usage()
There's no real need for using the real executable call name, especially
with basename requiring special care.
2017-05-04 10:29:02 +02:00
Quentin Rameau 2901145301 Simplify version message 2017-05-04 10:27:07 +02:00
Ivan Tham e23d5c1c45 Use Ctrl-t for showcert instead of Ctrl-x 2017-05-02 17:20:11 +02:00
Quentin Rameau 5936806949 Cleanup and fix formatage issues in surf.1 2017-05-01 01:09:52 +02:00
Quentin Rameau 0df9f79d95 Fix forgotten options in surf.1 2017-05-01 01:08:27 +02:00
Hiltjo Posthuma edddfbc14a setcert: check uri before adding a certificate
Also directly check for https scheme, we won't need a certificate for
others.
2017-04-30 11:39:15 +02:00
Hiltjo Posthuma 21d81a71cc fix mini typo 2017-04-30 00:10:11 +02:00
Hiltjo Posthuma b466bb5bbd surf.1: remove trailing spaces 2017-04-30 00:09:07 +02:00
Quentin Rameau cc887cf2ab Add forgotten tT indicator description in surf.1 2017-04-29 17:59:09 +02:00
Quentin Rameau 0326e42bb3 Add forgotten fF indicator description in surf.1 2017-04-29 17:59:08 +02:00
Quentin Rameau d66904675d Add a flag for custom certificates
I don't think a keybinding would be useful here because we can't
remove a custom certificate which is alread set anyway.
I'll add it if somebody convince me of it's usefulness.
2017-04-29 17:59:08 +02:00
Quentin Rameau 7823ab6fc0 Move xid printing option from -x to -w 2017-04-29 17:59:08 +02:00
Quentin Rameau 9eda6f5dd5 Add a keybinding to show current TLS certificate 2017-04-29 17:59:07 +02:00
Quentin Rameau 1dc3cd513a Display an error message and certificate on tls error 2017-04-29 16:34:48 +02:00
Quentin Rameau c870098b82 Arrange Makefile
Let the user specify his own C and LD FLAGS.
Remove unuseful and non portable CFLAGS like pendantic and Wall.
2017-04-29 16:34:47 +02:00
Quentin Rameau db7922f173 Free temporary certificate in setcert 2017-04-29 14:34:02 +02:00
Quentin Rameau 0d1e670ac3 Do not build SiteSpecific file when regex is invalid 2017-04-28 13:09:39 +02:00
Quentin Rameau 3c2c0a6525 Add support for using custom certificates per url 2017-04-28 12:58:36 +02:00
Quentin Rameau eb32dd6eca Avoid using global name stylefile in setstyle() 2017-04-27 15:41:16 +02:00
Quentin Rameau d0e3c69e59 Change site styles structure for a more generic one 2017-04-27 15:02:40 +02:00
Quentin Rameau 5c52733984 Fix 27cec48 Add a flag/keybinding for strict TLS
Forgot to add changes in main(), usage() and newwindow() too.
2017-04-23 18:31:32 +02:00
Quentin Rameau 2940d2bd07 Fix a981959 Move -t stylefile flag to -C stylefile
Forgot to modify usage() and newwindow() too.
2017-04-23 18:28:06 +02:00
Quentin Rameau 4b752834d8 Fix possible oob access of cmd in newwindow()
Thanks to tarug0 for spotting this!
2017-04-23 18:27:43 +02:00
Quentin Rameau ac837f43b9 Bump year in program 2017-04-20 00:10:46 +02:00
Quentin Rameau 27cec48408 Add a flag and toggle keybinding for strict TLS 2017-04-20 00:10:45 +02:00
Quentin Rameau a981959124 Move -t stylefile flag to -C stylefile 2017-04-20 00:09:01 +02:00
Quentin Rameau ee854bb095 Rename SSL instances to TLS 2017-04-19 17:45:20 +02:00
Quentin Rameau 0247e91b00 Set strict ssl by default and handle insecure content
Non-https content in https pages is now handled separately from https
connection establishment.
2017-04-19 17:41:23 +02:00
Quentin Rameau 2355c20e92 Add a configure option for default window size 2017-04-19 19:10:21 +02:00
Quentin Rameau b814567e2b Bump version to 2.0
We're using the new scheme: 2.x is for webkit2
2017-03-28 18:17:45 +02:00
Quentin Rameau 0cb1597801 Add contributors to the LICENSE 2017-03-28 18:17:03 +02:00
Quentin Rameau 7e02344a61 Install Atoms before initializing gtk
There a race condition in gtkplug/socket which is raised when setting
Atoms.
Use this workaround until
https://bugzilla.gnome.org/show_bug.cgi?id=778680 is fixed.
2017-03-22 17:20:36 +01:00
Michael Stevens 1abb2ebe7a Fix spelling of otherwise in surf.1
Add more spelling to surf.

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2017-03-22 17:01:36 +01:00
Quentin Rameau 37e43501d8 Fix font-size setting parameter value type in newview 2017-03-06 11:00:04 +01:00
Quentin Rameau da5290a41a Add support for loading Webkit extensions 2016-09-22 10:21:31 +02:00
Charles Lehner c64c368d86 Reload on SIGHUP
ratiueratuie rstiure tiurest aruite rautie rautier tiue rtaruit ratiuera
This patch makes surf reload its pages when it receives a SIGHUP signal.
This makes it easier for shell scripts to trigger surf to reload.

I'm aware of using xdotool to trigger ctrl+r keypresses for reloading
but I wasn't able to get that to work in a general way. [1]

I'm sending this here in case surf maintainers and users would like to
include this in core - if not I will submit it to the wiki.

Regards,
Charles

[1] http://surf.suckless.org/files/autorefresh

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2016-07-08 15:02:42 +02:00
Quentin Rameau 4c41d363b7 Add a few configuration options
“enable-accelerated-2d-canvas”
“media-playback-requires-user-gesture”
“enable-site-specific-quirks”

Lookup those at
https://webkitgtk.org/reference/webkit2gtk/stable/WebKitSettings.html
2016-07-05 17:32:44 +02:00
Quentin Rameau 5a02d3e500 Fix GdkDisplay assignment in setup()
Init GTK before trying to get the default display.
2016-07-05 13:35:44 +02:00
Quentin Rameau f9714ab838 Get rid of getkbdevice
The GTK guys nicely took in account our request and pushed in a
convenience function to get default keyboard device.
2016-07-05 13:01:56 +02:00
Christoph Lohmann 8682a4dffb Fixing the last patch to the surf style. 2016-07-05 13:01:56 +02:00
Dmitry Bogatov cee8f0186c Check $HOME and home dir of $USER before getpwuid()->pw_dir
getpwnam(3) recommends to use $HOME instead of getpwuid()->pw_dir,
as it allows users to point programs to a different path.

Using getpwuid() also breaks namespaces-related use cases,
like `unshare -r`.

Patch was submitted by Dmitry Bogatov on the Debian bug tracker:
https://bugs.debian.org/825397

Signed-off-by: Christoph Lohmann <20h@r-36.net>
2016-07-05 13:01:56 +02:00
Quentin Rameau 3530d18d8e Fix url parsing in load() 2016-07-05 13:01:56 +02:00
Quentin Rameau 7ca9421a69 Apply domain parameters each time url is changed
Urls are only changed at load (initial requested one), or while
redirected. When the page is committed, url is already final.
2016-07-05 13:01:56 +02:00
Quentin Rameau 1206b2c587 Fix inspector toggling
Always get the inspector object, and let the user eventually close it
even if it's disabled for the current page.
2016-07-05 13:01:56 +02:00
Quentin Rameau c8fdd4d583 Rectify how parameters are handled in setparameter()
Access parameters through given Arg parameter instead of accessing
global parameters.
2016-07-05 13:01:56 +02:00
Quentin Rameau 6e019362c5 Fix parameter initialization and assignment 2016-07-05 13:01:56 +02:00
Quentin Rameau 75e3fe5b95 Adapting the whole surf structure to new settings 2016-07-05 13:01:56 +02:00
Quentin Rameau 11b34c0814 Adapt default parameters to new config style 2016-07-05 13:01:56 +02:00
Quentin Rameau 2aa1c38aed Introduce new data structure for handling settings 2016-07-05 13:01:56 +02:00
Dmitrij D. Czarkoff d04fb9bff3 Disable globbing in curl command
Curl is invoked for downloading particular files.  Without "-g" flag it would
apply globbing rules to URLs, which may end badly in case URL is not properly
quoted.
2016-03-06 09:34:07 +01:00
Quentin Rameau af7522006b Get rid of JavaScript for scrolling in views
This is still a hack, until WebKitGTK gives us a more practical and
stable way to do that. Manipulating directly the DOM inside a
webextension is a pain and only usable with unstable API atm.
2016-03-02 14:46:14 +01:00
Quentin Rameau 50befe4a95 Modify linking parameter 2016-03-02 14:44:06 +01:00
Christoph Lohmann 581075796a Import the arg.h from st which fixed the oob bug. 2016-03-02 14:38:34 +01:00
Quentin Rameau 934705c420 Fix title handling
Don't forget to always set the title to the current uri, this way it's
up to date when there is no title on the page (ie for local file
exploration).
Thanks to pickfire for reporting the issue.
2015-12-01 12:31:42 +01:00
Quentin Rameau ee04671220 Fix clickexternplayer(), no need to test the target again 2015-11-24 23:18:06 +01:00
Quentin Rameau c069b76f1b Fix user agent command-line parameter
Thanks to yui for seeing that!
2015-11-23 22:13:32 +01:00
Quentin Rameau 981ade6eeb Add webkit language settings
You can now set your prefered website languages in order.
It is also possible to enable spell checking in the same way.
2015-11-22 19:13:48 +01:00
Quentin Rameau 00f9dcdf43 Fix key handling
I had forgotten to compare configured key values against lowered pressed
key values.
Integrated keypress() into winevent().
2015-11-22 17:44:40 +01:00
Quentin Rameau 971856a579 Fix target uri handling when leaving window
Introduce a new string pointer overtitle in Client to be able to keep
the targeturi intact while modifying the former for overriding or not
the window title.
Connect to GDK_ENTER_NOTIFY to restore overtitle when refocusing on
window.
2015-11-22 16:45:22 +01:00
Quentin Rameau d0020bad4f Adapt togglestyle()
We can't apply an empty stylesheet anymore, instead remove any previous
stylesheet.
2015-11-22 15:31:15 +01:00
Quentin Rameau c3a827d621 Modify decideresource() and favicon handling
Return as soon as the request has been processed.
No need to modify the favicon uri, just ignore it.
2015-11-22 15:19:10 +01:00
Quentin Rameau b70a966aa6 Style change in newview(), sort signals order 2015-11-22 13:51:05 +01:00
Quentin Rameau cdc80731fb Fix error handling in spawn()
Be more specific about process name and exit with an error.
2015-11-22 13:44:31 +01:00
Quentin Rameau b87123ac9b Modify default handling of cookiepolicy functions
It's more obvious this way that the default is to always accept cookies
and not the other way around.
2015-11-22 13:33:28 +01:00
Quentin Rameau d4ac9fb6f4 Simplify handling of c->title 2015-11-22 13:24:24 +01:00
Quentin Rameau 10105c8b87 Fix pasteuri()
The uri check had been inverted.
2015-11-22 13:15:39 +01:00
Quentin Rameau 7c24c61ab2 Style fix in sigchld() 2015-11-22 12:22:23 +01:00
Quentin Rameau 890ab510ea Replace use of EXIT_* constants to 0 and 1 2015-11-22 12:17:05 +01:00
Quentin Rameau 3e017b1a89 Fix WM_CLASS and WM_WINDOW_ROLE properties
Instead of forcing class and instance names, which is what GTK does by
default anyway, allow the user to set the instance name, but keep the
general class as “Surf”.
Is we won't support a “-name” parameter and don't implement a parsing of
RESOURCE_NAME env variable, let's fallback on the third behaviour, use
the name of the calling executable.
That would let the user do things like 'ln -s ./surf ./surf-other;
./surf-other' and set different parameters for the two instances (in dwm
for example).
Try to generate a unique WM_WINDOW_ROLE (within the surf process)
composed of “Surf” and the view ID.
2015-11-22 11:53:19 +01:00
Quentin Rameau bd17d359d6 Remove window hints settings
Setting minimum size to 1x1 is not necessary as this is the default.
2015-11-22 03:00:03 +01:00
Quentin Rameau 60c58fbf17 Style indentation fix 2015-11-22 02:25:07 +01:00
Quentin Rameau 2fb122c012 Continue making chars const 2015-11-22 02:22:38 +01:00
Quentin Rameau 6e68af115d Correct and simplify buttonreleased() gdk event
The passed event is a GdkEvent (or GdkEventButton), but not a
GdkEventKey.
Access the struct directly.
2015-11-22 02:10:18 +01:00
Quentin Rameau fef80cd56c Un(g)boolify to separate GTK dependant code from the rest 2015-11-22 02:03:26 +01:00
Quentin Rameau 6124176b89 Use char instead of gchar and make them const when possible 2015-11-22 01:52:13 +01:00
Quentin Rameau 11fa5a7a4d Style update for indentation 2015-11-22 01:42:34 +01:00
Quentin Rameau 954a718197 Add mouse function to play medias in external player
Control + left click launches mpv with the target media url.
2015-11-21 19:53:29 +01:00
Quentin Rameau 26eb2f761c Update credits 2015-11-21 19:24:19 +01:00
Quentin Rameau bc46e954f2 Style change in includes order 2015-11-21 19:22:11 +01:00
Quentin Rameau 432f3c6b53 Style change in functions ordering
Try to group and order functions in a logical manner.
Same thing for config keybindings.
2015-11-21 19:14:08 +01:00
Quentin Rameau 7e9a85a5cb Cleanup remaining unused variables and copystr() 2015-11-20 17:42:25 +01:00
Quentin Rameau adc650f399 Adapt newwindow()
Reorder cmdline options alphabetically and try to keep settings as they
have been toggled in this surf client.
2015-11-20 17:39:45 +01:00
Quentin Rameau 5bca222339 Adapt user agent handling
Now we can only append Surf version to the default WebKit user agent
instead of setting the whole string (while this remains possible to do).
2015-11-20 17:12:00 +01:00
Quentin Rameau e6cefa584e Adapt updatetitle()
Now always show loading progress, still print mouse over link uri before
page uri. Process simplyfied because we use const strings.
2015-11-20 16:59:15 +01:00
Quentin Rameau b5096b1c8f Adapt toggle statistics
Rename *togglestat to plural *togglestats, add frame flatenning
indicator, resize array in consequence.
Use a static index instead of a dynamic one as we always use all values
anyway.
2015-11-20 16:53:52 +01:00
Quentin Rameau 690118133d Adapt page statistics
Rename *pagestat to plural *pagestats, and resize array to reflect
missing proxy parameter.
2015-11-20 16:48:18 +01:00
Quentin Rameau 84611a5d29 Adapt loaduri()
Better handling of different URIs. Filter out “about:” scheme, dont
touch URI if it contains a complete scheme (we assume "://", denotes
one), else test if given path is an actual reachable file on the
filesystem, else prepend arbitrary http:// scheme.
2015-11-20 16:39:53 +01:00
Quentin Rameau 5def2e51da Adapt config MACROs SETPROP, DOWNLOAD, PLUMB
As we now use directly const strings from WebKitGTK, “constify” arg void
pointer.
2015-11-20 16:35:13 +01:00
Quentin Rameau 2d1e422368 Rename mouse functions to clickFUNCTION() 2015-11-20 16:27:02 +01:00
Quentin Rameau 82abf5154f Adapt toggle(), clean some config parameters
Regroup all toggles in an enum and handle them with a unique function
via a switch. That lets us take different actions for each toggle.
Add a frame flatenning and a dns preteching options.
2015-11-20 15:48:04 +01:00
Quentin Rameau 526b974c33 Adapt find()
Slightly new behaviour: searching again for the same string (via MOD+/)
resets the search (ie restarts search from document top).
Searching for an empty string stops the search (ie all highlights are
removed).
2015-11-20 01:12:28 +01:00
Quentin Rameau 320e4e4388 Adapt zoom() 2015-11-20 01:03:32 +01:00
Quentin Rameau acec16e685 Adapt navigate() 2015-11-20 01:00:38 +01:00
Quentin Rameau 42fdc77f5e Remove togglescrollbars()
We do not have access to scrollbars and will have to manipulate DOM to
do that.
2015-11-20 00:58:14 +01:00
Quentin Rameau a53dc90171 Adapt scrolling
In fact, we have a scrolling handle ersatz for now using JavaScript
calls as we don't have access anymore to scrollbars.
We'll have to manipulate the DOM directly (later).
2015-11-20 00:53:14 +01:00
Quentin Rameau c4f01cd18b Adapt inspector handling
The inspector is now easily manageable via API, there's no need for
keeping its state in the Client.
2015-11-20 00:46:11 +01:00
Quentin Rameau 0b5b798eb2 Adapt print() 2015-11-20 00:34:23 +01:00
Quentin Rameau 2c2a7b608e Simplify building of stylefiles path
We can directly use style file pointers instead of using temporary
string pointers.
2015-11-20 00:34:22 +01:00
Quentin Rameau ba8617e4ee Adapt setstyle()
We can't anymore pass a simple path to a stylefile, we have to read the
entire file to create a stylesheet and apply it to the view.
2015-11-20 00:34:22 +01:00
Quentin Rameau 701815a5f2 Adapt clipboard()
Replace linkhover with target uri and add some comments
2015-11-20 00:34:22 +01:00
Quentin Rameau d6794e0d75 Rename fullscreen() to togglefullscreen()
And handle c->fullscreen value in winevent(). This way we keep track of
fullscreen state even if we did not directly initiate the fullscreen.
2015-11-20 00:34:22 +01:00
Quentin Rameau b4e78555d0 Replace titlechangeleave() with catch-all winevent()
All GtkWidget events have the same function prototype with the generic
GdkEvent as parameter. This will let us handle everything in the switch.
2015-11-20 00:34:22 +01:00
Quentin Rameau d9cecc8932 Adapt JavaScript functions
Removed eval(), evalscript() is now sufficient and can directly execute
passed JavaScript string.
2015-11-20 00:34:22 +01:00
Quentin Rameau 72905b8bfc Remove windowobjectcleared(), execute scripts on load finished
The “window-object-cleared” signal is not directly accessible for
specific WebViews now. We'll have to use an Extension or rewrite the
JavaScript running functions.
2015-11-20 00:34:22 +01:00
Quentin Rameau bb1fc4195f Add createwindow() for GtkWindow creation
Move there window creation from showview().
2015-11-20 00:34:22 +01:00
Quentin Rameau 2e1fb87361 Add closeview() for JavaScript window closing
Simply call gtk_widget_destroy() on the window. Then GtkWindow closing
process will take care of the rest.
2015-11-20 00:34:21 +01:00
Quentin Rameau 04d46d1791 Remove (delete :>) deletion_interface() 2015-11-20 00:34:21 +01:00
Quentin Rameau 76940a9ab5 Integrate beforerequest() into decidepolicy() 2015-11-20 00:34:21 +01:00
Quentin Rameau d542773e75 Remove contextmenu() and menuactivate() for "context-menu" signal
Those were added because “right click menu to copy the link URI will now
work” (would not work) in 2013. It's been a while since that works without
intervention.
2015-11-20 00:34:21 +01:00
Quentin Rameau f6a35e5fbf Adapted buttonrelease()
Use the current hit test (c->mousepos) to determine where the mouse
pointer is.
It is possible to link an action to a click and still propagate the
event after that by setting the “stop event” parameter of a Button to 0.
2015-11-20 00:34:21 +01:00
Quentin Rameau 96188f83f0 Replace initdownload() and intercept global download requests.
Attach to download requests on WebKitContext, this way we can easily
manage all types of downloads (coming from views or not).
2015-11-20 00:34:21 +01:00
Quentin Rameau 26a2dbac65 Adapted progresschanged() 2015-11-20 00:34:21 +01:00
Quentin Rameau 58c4e18975 Manage ssl errors with GTlsCertificateFlags
Keep a GTlsCertificateFlags in Client for TLS errors.
If we don't use a ssl connection, set it to a value greater than maximum
error flag value (which is G_TLS_CERTIFICATE_VALIDATE_ALL for all
possible errors).
2015-11-20 00:34:20 +01:00
Quentin Rameau e9ec482049 Replace loadstatuschanged() with loadchanged() 2015-11-20 00:34:20 +01:00
Quentin Rameau bce814b30a Replace decidewindow() and decidedownload() with decidepolicy()
Now all the requests are triggered by one signal.
We then handle each type, resource download, navigation, newwindow, in
separate functions.
2015-11-20 00:34:20 +01:00
Quentin Rameau 1f99df029c Replace createwindow() with createview()
We can now perform some filtering before opening a new view (window)
when requested by JavaScript (either random or by a click).
2015-11-20 00:34:20 +01:00
Quentin Rameau 92d7ba7ed8 Replace geopolicyrequested() with permissionrequested()
The permission-request signal can now ask for than a geolocation
authorisation (though we only handle that for now).
2015-11-20 00:34:20 +01:00
Quentin Rameau 42c6c90366 Replace linkhover() with mousetargetchanged()
The “linkhover” can now be more than a simple link (image, video, etc.).
As we can't anymore perform a hit test when we want, we have to keep the
last known hit test to be able to know where the mouse is on the next
click event.
2015-11-20 00:34:20 +01:00
Quentin Rameau b9530ad5d1 Modify the context name of the hit tests
These relate more to the position of the pointer when an event occurs.
2015-11-20 00:34:20 +01:00
Quentin Rameau 60f574e4b7 Adapted titlechange()
Do not copy title strings, just carry over the const pointer.
2015-11-20 00:34:20 +01:00
Quentin Rameau 0f3e3bf669 Move all necessary initialisation to newview()
Most all the settings and callbacks are set before view creation.
Create a related view (with inherited settings) if asked to.
2015-11-20 00:34:19 +01:00
Quentin Rameau ad538bb00a Add newview() and forward related views
View creation is now done in a separate function.
That helps identifying the workflow and let us easily carry related
view (client) when asked by the WebKit for a new one.
2015-11-20 00:34:19 +01:00
Quentin Rameau 421486db18 Add showview()
Only show the window when and if the view is ready.
Move all the window rendering there.
2015-11-20 00:34:14 +01:00
Quentin Rameau f86977a6fa Separate the rendering engine process
Use one WebKitWebProcess per view instead of one for all views.
More information in the API documentation.
2015-11-20 00:23:59 +01:00
Quentin Rameau b0f35be17b No option to enforce 96DPI anymore on WebKit2 2015-11-20 00:23:59 +01:00
Quentin Rameau 42829cdad0 Scrolling is now handled through WebKit
We don't have access anymore to the scrolling process and have to rely
entirely on WebKit.
We could be able to manage scrolling and bars directly by manipulating
the DOM via a WebKitExtension. To be continued…
2015-11-20 00:23:59 +01:00
Quentin Rameau 94f2f2eace SSL policy is now handled through WebKit 2015-11-20 00:23:59 +01:00
Quentin Rameau e39b7e623c Disk cache is now handled through WebKit 2015-11-20 00:23:59 +01:00
Quentin Rameau 7c34b37786 Cookies are now handled through WebKit
Remove all soup cookie handling and use provided interface.
2015-11-20 00:23:54 +01:00
Quentin Rameau 4415c475f7 Remove source(), it has been removed from webkit2gtk
WebKit2GTK doesn't provide a direct way to view source anymore, we'll
have to do that ourselves with a GtkSourceView if we still need that.
2015-11-18 14:59:13 +01:00
Quentin Rameau b7cc1ae964 Remove proxy stuff, it's now handled by WebView 2015-11-18 14:59:13 +01:00
Quentin Rameau abcf5f06ed Switch headers to webkit2 2015-11-18 14:59:13 +01:00
Quentin Rameau 566b452b46 Port surf to gtk3 2015-11-17 17:05:05 +01:00
11 changed files with 2305 additions and 1644 deletions
+31
View File
@@ -0,0 +1,31 @@
name: Sync Upstream (12h)
on:
schedule:
- cron: "0 0 * * 0"
workflow_dispatch:
jobs:
sync:
runs-on: ubuntu-latest
steps:
- name: Checkout fork
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: surf-webkit2
- name: Add upstream remote
run: |
git remote add upstream https://git.suckless.org/surf || true
git fetch upstream
- name: Merge upstream into surf-webkit2
run: |
git config user.name "gitea-runner[bot]"
git config user.email "gitea-runner[bot]@noreply.erickahmed.com"
git merge upstream/surf-webkit2 --strategy-option ours --no-edit || true
- name: Push merged branch
run: |
git push origin surf-webkit2
+5 -5
View File
@@ -1,10 +1,10 @@
# Frequently Asked Questions # Frequently Asked Questions
## Surf is starting up slowly. What might happen? ## Surf is starting up slowly. What might be causing this?
The first suspect for such a behaviour is the plugin handling. Run surf The first suspect for such behaviour is the plugin handling. Run surf on
on the commandline and see if there are errors because of »nspluginwrap the commandline and see if there are errors because of nspluginwrapper”
per« or failed RPCs to them. If that is true, go to ~/.mozilla/plugins or failed RPCs to them. If that is true, go to ~/.mozilla/plugins and
and try removing stale links to plugins not on your system anymore. This try removing stale links to plugins not on your system anymore. This
will stop surf from trying to load them. will stop surf from trying to load them.
+36 -3
View File
@@ -1,8 +1,41 @@
MIT/X Consortium License MIT/X Consortium License
© 2011-2012 Troels Henriksen <athas@sigkill.at> © 2009-2010 Enno Boland <tox@s01.de>
© 2009-2011 Enno Boland <g s01 de> © 2009 Thomas Menari <spaceinvader@chaotika.org>
© 2012 Christoph Lohmann <20h@r-36.net> © 2009 Simon Rozet <simon@rozet.name>
© 2009 Andrew Antle <andrew.antle@gmail.com>
© 2010-2011 pancake <nopcode.org>
© 2011-2013 Anselm R Garbe <anselm@garbe.us>
© 2011-2012 Troels Henriksen <athas@sigkill.dk>
© 2011 Connor Lane Smith <cls@lubutu.com>
© 2012-2017 Christoph Lohmann <20h@r-36.net>
© 2013 Shayan Pooya <shayan@liveve.org>
© 2013 Jens Nyberg <jens.nyberg@gmail.com>
© 2013 Carlos J. Torres <vlaadbrain@gmail.com>
© 2013 Alexander Sedov <alex0player@gmail.com>
© 2013 Nick White <git@njw.me.uk>
© 2013 David Dufberg <david@dufberg.se>
© 2014-2021 Quentin Rameau <quinq@fifth.space>
© 2014-2016 Markus Teich <markus.teich@stusta.mhn.de>
© 2015 Jakukyo Friel <weakish@gmail.com>
© 2015 Ben Woolley <tautolog@gmail.com>
© 2015 Greg Reagle <greg.reagle@umbc.edu>
© 2015 GhostAV <ghostav@riseup.net>
© 2015-2017 Ivan Tham <pickfire@riseup.net>
© 2015 Alexander Huemer <alexander.huemer@xx.vu>
© 2015 Michael Stevens <mstevens@etla.org>
© 2015 Felix Janda <felix.janda@posteo.de>
© 2016 Charles Lehner <cel@celehner.com>
© 2016 Dmitry Bogatov <KAction@gnu.org>
© 2017 Hiltjo Posthuma <hiltjo@codemadness.org>
© 2017 ssd <ssd@mailless.org>
© 2017 Constantine Bytensky <kostya3@gmail.com>
© 2017 Eon S. Jeon <esjeon@hyunmu.am>
© 2017 Jochen Sprickerhof <git@jochen.sprickerhof.de>
© 2018 nzl <uruabi@gmail.com>
© 2018 Eddie Thieda <eddie.thieda@gmail.com>
© 2018 Leonardo Taccari <iamleot@gmail.com>
© 2019 efe <efe@efe.kim>
Permission is hereby granted, free of charge, to any person obtaining a Permission is hereby granted, free of charge, to any person obtaining a
copy of this software and associated documentation files (the "Software"), copy of this software and associated documentation files (the "Software"),
+53 -38
View File
@@ -1,61 +1,76 @@
# surf - simple browser # surf - simple browser
# See LICENSE file for copyright and license details. # See LICENSE file for copyright and license details.
.POSIX:
include config.mk include config.mk
SRC = surf.c SRC = surf.c
OBJ = ${SRC:.c=.o} WSRC = webext-surf.c
OBJ = $(SRC:.c=.o)
WOBJ = $(WSRC:.c=.o)
WLIB = $(WSRC:.c=.so)
all: options surf all: options surf $(WLIB)
options: options:
@echo surf build options: @echo surf build options:
@echo "CFLAGS = ${CFLAGS}" @echo "CC = $(CC)"
@echo "LDFLAGS = ${LDFLAGS}" @echo "CFLAGS = $(SURFCFLAGS) $(CFLAGS)"
@echo "CC = ${CC}" @echo "WEBEXTCFLAGS = $(WEBEXTCFLAGS) $(CFLAGS)"
@echo "LDFLAGS = $(LDFLAGS)"
.c.o: surf: $(OBJ)
@echo CC $< $(CC) $(SURFLDFLAGS) $(LDFLAGS) -o $@ $(OBJ) $(LIBS)
@${CC} -c ${CFLAGS} $<
${OBJ}: config.h config.mk $(OBJ) $(WOBJ): config.h common.h config.mk
config.h: config.h:
@echo creating $@ from config.def.h cp config.def.h $@
@cp config.def.h $@
surf: ${OBJ} $(OBJ): $(SRC)
@echo CC -o $@ $(CC) $(SURFCFLAGS) $(CFLAGS) -c $(SRC)
@${CC} -o $@ surf.o ${LDFLAGS}
$(WLIB): $(WOBJ)
$(CC) -shared -Wl,-soname,$@ $(LDFLAGS) -o $@ $? $(WEBEXTLIBS)
$(WOBJ): $(WSRC)
$(CC) $(WEBEXTCFLAGS) $(CFLAGS) -c $(WSRC)
clean: clean:
@echo cleaning rm -f surf $(OBJ)
@rm -f surf ${OBJ} surf-${VERSION}.tar.gz rm -f $(WLIB) $(WOBJ)
dist: clean distclean: clean
@echo creating dist tarball rm -f config.h surf-$(VERSION).tar.gz
@mkdir -p surf-${VERSION}
@cp -R LICENSE Makefile config.mk config.def.h README \ dist: distclean
surf-open.sh arg.h TODO.md surf.png \ mkdir -p surf-$(VERSION)
surf.1 ${SRC} surf-${VERSION} cp -R LICENSE Makefile config.mk config.def.h README \
@tar -cf surf-${VERSION}.tar surf-${VERSION} surf-open.sh arg.h TODO.md surf.png \
@gzip surf-${VERSION}.tar surf.1 common.h $(SRC) $(WSRC) surf-$(VERSION)
@rm -rf surf-${VERSION} tar -cf surf-$(VERSION).tar surf-$(VERSION)
gzip surf-$(VERSION).tar
rm -rf surf-$(VERSION)
install: all install: all
@echo installing executable file to ${DESTDIR}${PREFIX}/bin mkdir -p $(DESTDIR)$(PREFIX)/bin
@mkdir -p ${DESTDIR}${PREFIX}/bin cp -f surf $(DESTDIR)$(PREFIX)/bin
@cp -f surf ${DESTDIR}${PREFIX}/bin chmod 755 $(DESTDIR)$(PREFIX)/bin/surf
@chmod 755 ${DESTDIR}${PREFIX}/bin/surf mkdir -p $(DESTDIR)$(LIBDIR)
@echo installing manual page to ${DESTDIR}${MANPREFIX}/man1 cp -f $(WLIB) $(DESTDIR)$(LIBDIR)
@mkdir -p ${DESTDIR}${MANPREFIX}/man1 for wlib in $(WLIB); do \
@sed "s/VERSION/${VERSION}/g" < surf.1 > ${DESTDIR}${MANPREFIX}/man1/surf.1 chmod 644 $(DESTDIR)$(LIBDIR)/$$wlib; \
@chmod 644 ${DESTDIR}${MANPREFIX}/man1/surf.1 done
mkdir -p $(DESTDIR)$(MANPREFIX)/man1
sed "s/VERSION/$(VERSION)/g" < surf.1 > $(DESTDIR)$(MANPREFIX)/man1/surf.1
chmod 644 $(DESTDIR)$(MANPREFIX)/man1/surf.1
uninstall: uninstall:
@echo removing executable file from ${DESTDIR}${PREFIX}/bin rm -f $(DESTDIR)$(PREFIX)/bin/surf
@rm -f ${DESTDIR}${PREFIX}/bin/surf rm -f $(DESTDIR)$(MANPREFIX)/man1/surf.1
@echo removing manual page from ${DESTDIR}${MANPREFIX}/man1 for wlib in $(WLIB); do \
@rm -f ${DESTDIR}${MANPREFIX}/man1/surf.1 rm -f $(DESTDIR)$(LIBDIR)/$$wlib; \
done
- rmdir $(DESTDIR)$(LIBDIR)
.PHONY: all options clean dist install uninstall .PHONY: all options distclean clean dist install uninstall
+27 -20
View File
@@ -3,39 +3,46 @@
* by 20h * by 20h
*/ */
#ifndef __ARG_H__ #ifndef ARG_H__
#define __ARG_H__ #define ARG_H__
extern char *argv0; extern char *argv0;
#define USED(x) ((void)(x)) /* use main(int argc, char *argv[]) */
#define ARGBEGIN for (argv0 = *argv, argv++, argc--;\ #define ARGBEGIN for (argv0 = *argv, argv++, argc--;\
argv[0] && argv[0][1]\ argv[0] && argv[0][0] == '-'\
&& argv[0][0] == '-';\ && argv[0][1];\
argc--, argv++) {\ argc--, argv++) {\
char _argc;\ char argc_;\
char **_argv;\ char **argv_;\
int brk_;\
if (argv[0][1] == '-' && argv[0][2] == '\0') {\ if (argv[0][1] == '-' && argv[0][2] == '\0') {\
argv++;\ argv++;\
argc--;\ argc--;\
break;\ break;\
}\ }\
for (argv[0]++, _argv = argv; argv[0][0];\ for (brk_ = 0, argv[0]++, argv_ = argv;\
argv[0][0] && !brk_;\
argv[0]++) {\ argv[0]++) {\
if (_argv != argv)\ if (argv_ != argv)\
break;\ break;\
_argc = argv[0][0];\ argc_ = argv[0][0];\
switch (_argc) switch (argc_)
#define ARGEND }\ #define ARGEND }\
USED(_argc);\ }
}\
USED(argv);\
USED(argc);
#define EARGF(x) ((argv[1] == NULL)? ((x), abort(), (char *)0) :\ #define ARGC() argc_
(argc--, argv++, argv[0]))
#define EARGF(x) ((argv[0][1] == '\0' && argv[1] == NULL)?\
((x), abort(), (char *)0) :\
(brk_ = 1, (argv[0][1] != '\0')?\
(&argv[0][1]) :\
(argc--, argv++, argv[0])))
#define ARGF() ((argv[0][1] == '\0' && argv[1] == NULL)?\
(char *)0 :\
(brk_ = 1, (argv[0][1] != '\0')?\
(&argv[0][1]) :\
(argc--, argv++, argv[0])))
#endif #endif
+1
View File
@@ -0,0 +1 @@
#define MSGBUFSZ 8
+145 -92
View File
@@ -1,58 +1,88 @@
/* modifier 0 means no modifier */ /* modifier 0 means no modifier */
static char *useragent = "Mozilla/5.0 (X11; U; Unix; en-US) " static int surfuseragent = 1; /* Append Surf version to default WebKit user agent */
"AppleWebKit/537.15 (KHTML, like Gecko) " static char *fulluseragent = ""; /* Or override the whole user agent string */
"Chrome/24.0.1295.0 Safari/537.15 Surf/"VERSION;
static char *scriptfile = "~/.surf/script.js"; static char *scriptfile = "~/.surf/script.js";
static char *styledir = "~/.surf/styles/"; static char *styledir = "~/.surf/styles/";
static char *cachefolder = "~/.surf/cache/"; static char *certdir = "~/.surf/certificates/";
static char *cachedir = "~/.surf/cache/";
static Bool kioskmode = FALSE; /* Ignore shortcuts */
static Bool showindicators = TRUE; /* Show indicators in window title */
static Bool zoomto96dpi = TRUE; /* Zoom pages to always emulate 96dpi */
static Bool runinfullscreen = FALSE; /* Run in fullscreen mode by default */
static guint defaultfontsize = 12; /* Default font size */
static gfloat zoomlevel = 1.0; /* Default zoom level */
/* Soup default features */
static char *cookiefile = "~/.surf/cookies.txt"; static char *cookiefile = "~/.surf/cookies.txt";
static char *cookiepolicies = "Aa@"; /* A: accept all; a: accept nothing,
* @: accept all except third party */
static char *cafile = "/etc/ssl/certs/ca-certificates.crt";
static Bool strictssl = FALSE; /* Refuse untrusted SSL connections */
static time_t sessiontime = 3600;
/* Webkit default features */ /* Webkit default features */
static Bool enablescrollbars = TRUE; /* Highest priority value will be used.
static Bool enablespatialbrowsing = TRUE; * Default parameters are priority 0
static Bool enablediskcache = TRUE; * Per-uri parameters are priority 1
static int diskcachebytes = 5 * 1024 * 1024; * Command parameters are priority 2
static Bool enableplugins = TRUE; */
static Bool enablescripts = TRUE; static Parameter defconfig[ParameterLast] = {
static Bool enableinspector = TRUE; /* parameter Arg value priority */
static Bool enablestyle = TRUE; [AccessMicrophone] = { { .i = 0 }, },
static Bool loadimages = TRUE; [AccessWebcam] = { { .i = 0 }, },
static Bool hidebackground = FALSE; [Certificate] = { { .i = 0 }, },
static Bool allowgeolocation = TRUE; [CaretBrowsing] = { { .i = 0 }, },
[CookiePolicies] = { { .v = "@Aa" }, },
[DarkMode] = { { .i = 0 }, },
[DefaultCharset] = { { .v = "UTF-8" }, },
[DiskCache] = { { .i = 1 }, },
[DNSPrefetch] = { { .i = 0 }, },
[Ephemeral] = { { .i = 0 }, },
[FileURLsCrossAccess] = { { .i = 0 }, },
[FontSize] = { { .i = 12 }, },
[Geolocation] = { { .i = 0 }, },
[HideBackground] = { { .i = 0 }, },
[Inspector] = { { .i = 0 }, },
[JavaScript] = { { .i = 1 }, },
[KioskMode] = { { .i = 0 }, },
[LoadImages] = { { .i = 1 }, },
[MediaManualPlay] = { { .i = 1 }, },
[PDFJSviewer] = { { .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 }, },
};
#define SETPROP(p, q) { \ static UriParameters uriparams[] = {
.v = (char *[]){ "/bin/sh", "-c", \ { "(://|\\.)suckless\\.org(/|$)", {
"prop=\"`xprop -id $2 $0 " \ [JavaScript] = { { .i = 0 }, 1 },
"| sed \"s/^$0(STRING) = \\(\\\\\"\\?\\)\\(.*\\)\\1$/\\2/\" " \ }, },
"| xargs -0 printf %b | dmenu`\" &&" \ };
"xprop -id $2 -f $1 8s -set $1 \"$prop\"", \
p, q, winid, NULL \ /* 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 "r" " \
"| sed -e 's/^"r"(UTF8_STRING) = \"\\(.*\\)\"/\\1/' " \
" -e 's/\\\\\\(.\\)/\\1/g')\" " \
"| dmenu -p '"p"' -w $1)\" " \
"&& xprop -id $1 -f "s" 8u -set "s" \"$prop\"", \
"surf-setprop", winid, NULL \
} \
} }
/* DOWNLOAD(URI, referer) */ /* DOWNLOAD(URI, referer) */
#define DOWNLOAD(d, r) { \ #define DOWNLOAD(u, r) { \
.v = (char *[]){ "/bin/sh", "-c", \ .v = (const char *[]){ "st", "-e", "/bin/sh", "-c",\
"st -e /bin/sh -c \"curl -L -J -O --user-agent '$1'" \ "curl -g -L -J -O -A \"$1\" -b \"$2\" -c \"$2\"" \
" --referer '$2' -b $3 -c $3 '$0';" \ " -e \"$3\" \"$4\"; read", \
" sleep 5;\"", \ "surf-download", useragent, cookiefile, r, u, NULL \
d, useragent, r, cookiefile, NULL \ } \
} \
} }
/* PLUMB(URI) */ /* PLUMB(URI) */
@@ -60,9 +90,16 @@ static Bool allowgeolocation = TRUE;
* "http://" or "https://" should be opened. * "http://" or "https://" should be opened.
*/ */
#define PLUMB(u) {\ #define PLUMB(u) {\
.v = (char *[]){ "/bin/sh", "-c", \ .v = (const char *[]){ "/bin/sh", "-c", \
"xdg-open \"$0\"", u, NULL \ "xdg-open \"$0\"", u, NULL \
} \ } \
}
/* VIDEOPLAY(URI) */
#define VIDEOPLAY(u) {\
.v = (const char *[]){ "/bin/sh", "-c", \
"mpv --really-quiet \"$0\"", u, NULL \
} \
} }
/* styles */ /* styles */
@@ -70,11 +107,20 @@ static Bool allowgeolocation = TRUE;
* The iteration will stop at the first match, beginning at the beginning of * The iteration will stop at the first match, beginning at the beginning of
* the list. * the list.
*/ */
static SiteStyle styles[] = { static SiteSpecific styles[] = {
/* regexp file in $styledir */ /* regexp file in $styledir */
{ ".*", "default.css" }, { ".*", "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 #define MODKEY GDK_CONTROL_MASK
/* hotkeys */ /* hotkeys */
@@ -83,59 +129,66 @@ static SiteStyle styles[] = {
* edit the CLEANMASK() macro. * edit the CLEANMASK() macro.
*/ */
static Key keys[] = { static Key keys[] = {
/* modifier keyval function arg Focus */ /* modifier keyval function arg */
{ MODKEY|GDK_SHIFT_MASK,GDK_r, reload, { .b = TRUE } }, { MODKEY, GDK_KEY_g, spawn, SETPROP("_SURF_URI", "_SURF_GO", PROMPT_GO) },
{ MODKEY, GDK_r, reload, { .b = FALSE } }, { MODKEY, GDK_KEY_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ MODKEY|GDK_SHIFT_MASK,GDK_p, print, { 0 } }, { MODKEY, GDK_KEY_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND", PROMPT_FIND) },
{ MODKEY, GDK_p, clipboard, { .b = TRUE } }, { 0, GDK_KEY_Escape, stop, { 0 } },
{ MODKEY, GDK_y, clipboard, { .b = FALSE } }, { MODKEY, GDK_KEY_c, stop, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_j, zoom, { .i = -1 } }, { MODKEY|GDK_SHIFT_MASK, GDK_KEY_r, reload, { .i = 1 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_k, zoom, { .i = +1 } }, { MODKEY, GDK_KEY_r, reload, { .i = 0 } },
{ 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_KEY_l, navigate, { .i = +1 } },
{ MODKEY, GDK_h, navigate, { .i = -1 } }, { MODKEY, GDK_KEY_h, navigate, { .i = -1 } },
{ MODKEY, GDK_j, scroll_v, { .i = +1 } }, /* vertical and horizontal scrolling, in viewport percentage */
{ MODKEY, GDK_k, scroll_v, { .i = -1 } }, { MODKEY, GDK_KEY_j, scrollv, { .i = +10 } },
{ MODKEY, GDK_b, scroll_v, { .i = -10000 } }, { MODKEY, GDK_KEY_k, scrollv, { .i = -10 } },
{ MODKEY, GDK_space, scroll_v, { .i = +10000 } }, { MODKEY, GDK_KEY_space, scrollv, { .i = +50 } },
{ MODKEY, GDK_i, scroll_h, { .i = +1 } }, { MODKEY, GDK_KEY_b, scrollv, { .i = -50 } },
{ MODKEY, GDK_u, scroll_h, { .i = -1 } }, { MODKEY, GDK_KEY_i, scrollh, { .i = +10 } },
{ MODKEY, GDK_KEY_u, scrollh, { .i = -10 } },
{ 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_SHIFT_MASK, GDK_KEY_j, zoom, { .i = -1 } },
{ MODKEY, GDK_f, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") }, { MODKEY|GDK_SHIFT_MASK, GDK_KEY_k, zoom, { .i = +1 } },
{ MODKEY, GDK_slash, spawn, SETPROP("_SURF_FIND", "_SURF_FIND") }, { 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_n, find, { .b = TRUE } }, { MODKEY, GDK_KEY_p, clipboard, { .i = 1 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_n, find, { .b = FALSE } }, { MODKEY, GDK_KEY_y, clipboard, { .i = 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_c, toggle, { .v = "enable-caret-browsing" } }, { MODKEY, GDK_KEY_n, find, { .i = +1 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_i, toggle, { .v = "auto-load-images" } }, { MODKEY|GDK_SHIFT_MASK, GDK_KEY_n, find, { .i = -1 } },
{ 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_KEY_p, print, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_a, togglecookiepolicy, { 0 } }, { MODKEY, GDK_KEY_t, showcert, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_m, togglestyle, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_b, togglescrollbars, { 0 } }, { MODKEY|GDK_SHIFT_MASK, GDK_KEY_a, togglecookiepolicy, { 0 } },
{ MODKEY|GDK_SHIFT_MASK,GDK_g, togglegeolocation, { 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_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_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_SHIFT_MASK, GDK_KEY_d, toggle, { .i = DarkMode } },
}; };
/* button definitions */ /* button definitions */
/* click can be ClkDoc, ClkLink, ClkImg, ClkMedia, ClkSel, ClkEdit, ClkAny */ /* target can be OnDoc, OnLink, OnImg, OnMedia, OnEdit, OnBar, OnSel, OnAny */
static Button buttons[] = { static Button buttons[] = {
/* click event mask button function argument */ /* target event mask button function argument stop event */
{ ClkLink, 0, 2, linkopenembed, { 0 } }, { OnLink, 0, 2, clicknewwindow, { .i = 0 }, 1 },
{ ClkLink, MODKEY, 2, linkopen, { 0 } }, { OnLink, MODKEY, 2, clicknewwindow, { .i = 1 }, 1 },
{ ClkLink, MODKEY, 1, linkopen, { 0 } }, { OnLink, MODKEY, 1, clicknewwindow, { .i = 1 }, 1 },
{ ClkAny, 0, 8, navigate, { .i = -1 } }, { OnAny, 0, 8, clicknavigate, { .i = -1 }, 1 },
{ ClkAny, 0, 9, navigate, { .i = +1 } }, { OnAny, 0, 9, clicknavigate, { .i = +1 }, 1 },
{ OnMedia, MODKEY, 1, clickexternplayer, { 0 }, 1 },
}; };
+20 -18
View File
@@ -1,30 +1,32 @@
# surf version # surf version
VERSION = 0.7 VERSION = 2.1
# Customize below to fit your system # Customize below to fit your system
# paths # paths
PREFIX = /usr/local PREFIX = /usr
MANPREFIX = ${PREFIX}/share/man MANPREFIX = $(PREFIX)/share/man
LIBPREFIX = $(PREFIX)/lib
LIBDIR = $(LIBPREFIX)/surf
X11INC = /usr/X11R6/include X11INC = `pkg-config --cflags x11`
X11LIB = /usr/X11R6/lib X11LIB = `pkg-config --libs x11`
GTKINC = `pkg-config --cflags gtk+-2.0 webkit-1.0` GTKINC = `pkg-config --cflags gtk+-3.0 gcr-3 webkit2gtk-4.1`
GTKLIB = `pkg-config --libs gtk+-2.0 webkit-1.0` GTKLIB = `pkg-config --libs gtk+-3.0 gcr-3 webkit2gtk-4.1`
WEBEXTINC = `pkg-config --cflags webkit2gtk-4.1 webkit2gtk-web-extension-4.1 gio-2.0`
WEBEXTLIBS = `pkg-config --libs webkit2gtk-4.1 webkit2gtk-web-extension-4.1 gio-2.0`
# includes and libs # includes and libs
INCS = -I. -I/usr/include -I${X11INC} ${GTKINC} INCS = $(X11INC) $(GTKINC)
LIBS = -L/usr/lib -lc -L${X11LIB} -lX11 ${GTKLIB} -lgthread-2.0 LIBS = $(X11LIB) $(GTKLIB) -lgthread-2.0
# flags # flags
CPPFLAGS = -DVERSION=\"${VERSION}\" -D_DEFAULT_SOURCE CPPFLAGS = -DVERSION=\"$(VERSION)\" -DGCR_API_SUBJECT_TO_CHANGE \
CFLAGS = -std=c99 -pedantic -Wall -Os ${INCS} ${CPPFLAGS} -DLIBPREFIX=\"$(LIBPREFIX)\" -DWEBEXTDIR=\"$(LIBDIR)\" \
LDFLAGS = -g ${LIBS} -D_DEFAULT_SOURCE
SURFCFLAGS = -fPIC $(INCS) $(CPPFLAGS)
WEBEXTCFLAGS = -fPIC $(WEBEXTINC)
# Solaris # compiler
#CFLAGS = -fast ${INCS} -DVERSION=\"${VERSION}\" #CC = c99
#LDFLAGS = ${LIBS}
# compiler and linker
CC = cc
+61 -67
View File
@@ -3,15 +3,15 @@
surf \- simple webkit-based browser surf \- simple webkit-based browser
.SH SYNOPSIS .SH SYNOPSIS
.B surf .B surf
.RB [-bBdDfFgGiIkKmMnNpPsSvx] .RB [-bBdDfFgGiIkKmMnNpPsStTvwxX]
.RB [-a\ cookiepolicies] .RB [-a\ cookiepolicies]
.RB [-c\ cookiefile] .RB [-c\ cookiefile]
.RB [-C\ stylefile]
.RB [-e\ xid] .RB [-e\ xid]
.RB [-r\ scriptfile] .RB [-r\ scriptfile]
.RB [-t\ stylefile]
.RB [-u\ useragent] .RB [-u\ useragent]
.RB [-z\ zoomlevel] .RB [-z\ zoomlevel]
.RB "URI" .RB [URI]
.SH DESCRIPTION .SH DESCRIPTION
surf is a simple Web browser based on WebKit/GTK+. It is able surf is a simple Web browser based on WebKit/GTK+. It is able
to display websites and follow links. It supports the XEmbed protocol to display websites and follow links. It supports the XEmbed protocol
@@ -21,25 +21,30 @@ one can point surf to another URI by setting its XProperties.
.TP .TP
.B \-a cookiepolicies .B \-a cookiepolicies
Define the order of Define the order of
.I cookie policies. .I cookie policies\fR.
The default is "Aa@" but could be The default is "@Aa" but could be
redefined in the redefined in the
.I config.h, .IR config.h ,
with "A" meaning to with "A" meaning to
accept all cookies, "a" to deny all cookies and "@", which tells surf to accept all cookies, "a" to deny all cookies and "@", which tells surf to
accept no third party cookies. accept no third party cookies.
.TP .TP
.B \-b .B \-b
Disable Scrollbars Disable Scrollbars.
.TP .TP
.B \-B .B \-B
Enable Scrollbars Enable Scrollbars.
.TP .TP
.B \-c cookiefile .B \-c cookiefile
Specify the Specify the
.I cookiefile .I cookiefile
to use. to use.
.TP .TP
.B \-C stylefile
Specify the user
.IR stylefile .
This does disable the site-specific styles.
.TP
.B \-d .B \-d
Disable the disk cache. Disable the disk cache.
.TP .TP
@@ -48,7 +53,7 @@ Enable the disk cache.
.TP .TP
.B \-e xid .B \-e xid
Reparents to window specified by Reparents to window specified by
.I xid. .IR xid .
.TP .TP
.B \-f .B \-f
Start surf in windowed mode (not fullscreen). Start surf in windowed mode (not fullscreen).
@@ -63,16 +68,16 @@ Disable giving the geolocation to websites.
Enable giving the geolocation to websites. Enable giving the geolocation to websites.
.TP .TP
.B \-i .B \-i
Disable Images Disable Images.
.TP .TP
.B \-I .B \-I
Enable Images Enable Images.
.TP .TP
.B \-k .B \-k
Disable kiosk mode (disable key strokes and right click) Disable kiosk mode (enable key strokes and right click).
.TP .TP
.B \-K .B \-K
Enable kiosk mode (disable key strokes and right click) Enable kiosk mode (disable key strokes and right click).
.TP .TP
.B \-m .B \-m
Disable application of user style sheets. Disable application of user style sheets.
@@ -86,28 +91,23 @@ Disable the Web Inspector (Developer Tools).
.B \-N .B \-N
Enable the Web Inspector (Developer Tools). Enable the Web Inspector (Developer Tools).
.TP .TP
.B \-p .B \-r scriptfile
Disable Plugins
.TP
.B \-P
Enable Plugins
.TP
.B \-r scriptfile
Specify the user Specify the user
.I scriptfile. .IR scriptfile .
.TP .TP
.B \-s .B \-s
Disable Javascript Disable Javascript.
.TP .TP
.B \-S .B \-S
Enable Javascript Enable Javascript.
.TP .TP
.B \-t stylefile .B \-t
Specify the user Disable strict TLS check.
.I stylefile.
This does disable the site-specific styles.
.TP .TP
.B \-u useragent .B \-T
Enable strict TLS check.
.TP
.B \-u useragent
Specify the Specify the
.I useragent .I useragent
which surf should use. which surf should use.
@@ -115,16 +115,21 @@ which surf should use.
.B \-v .B \-v
Prints version information to standard output, then exits. Prints version information to standard output, then exits.
.TP .TP
.B \-x .B \-w
Prints xid to standard output. This can be used to script the browser in for Prints xid to standard output. This can be used to script the browser in for
example example
.BR xdotool(1). .BR xdotool(1) .
.TP .TP
.B \-z zoomlevel .B -x
Disable custom certificates.
.TP
.B -X
Enable custom certificates.
.TP
.B \-z zoomlevel
Specify the Specify the
.I zoomlevel .I zoomlevel
which surf should use. which surf should use.
.BR xprop(1).
.SH USAGE .SH USAGE
.B Escape .B Escape
Stops loading current page or stops download. Stops loading current page or stops download.
@@ -157,10 +162,10 @@ Scroll horizontally to the left.
Zooms page in. Zooms page in.
.TP .TP
.B Ctrl\-Shift\-j or Ctrl\-- .B Ctrl\-Shift\-j or Ctrl\--
Zooms page out Zooms page out.
.TP .TP
.B Ctrl\-Shift\-q .B Ctrl\-Shift\-q
Resets Zoom Resets Zoom.
.TP .TP
.B Ctrl\-f and Ctrl\-/ .B Ctrl\-f and Ctrl\-/
Opens the search-bar. Opens the search-bar.
@@ -189,12 +194,12 @@ Reloads the website without using the cache.
.B Ctrl\-y .B Ctrl\-y
Copies current URI to primary selection. Copies current URI to primary selection.
.TP .TP
.B Ctrl\-o .B Ctrl\-t
Show the sourcecode of the current page. Display the current TLS certificate in a popup window.
.TP .TP
.B Ctrl\-Shift\-a .B Ctrl\-Shift\-a
Toggle through the the Toggle through the the
.I cookie policies. .I cookie policies\fR.
This will not reload the page. This will not reload the page.
.TP .TP
.B Ctrl\-Shift\-b .B Ctrl\-Shift\-b
@@ -203,12 +208,15 @@ Toggle scrollbars. This will reload the page.
.B Ctrl\-Shift\-c .B Ctrl\-Shift\-c
Toggle caret browsing. This will reload the page. Toggle caret browsing. This will reload the page.
.TP .TP
.B Ctrl\-Shift\-d
Toggle dark mode.
.TP
.B Ctrl\-Shift\-i .B Ctrl\-Shift\-i
Toggle auto-loading of images. This will reload the page. Toggle auto-loading of images. This will reload the page.
.TP .TP
.B Ctrl\-Shift\-m .B Ctrl\-Shift\-m
Toggle if the Toggle if the
.I stylefile .I stylefile
file should be loaded. This will reload the page. file should be loaded. This will reload the page.
.TP .TP
.B Ctrl\-Shift\-o .B Ctrl\-Shift\-o
@@ -217,9 +225,8 @@ Open the Web Inspector (Developer Tools) window for the current page.
.B Ctrl\-Shift\-s .B Ctrl\-Shift\-s
Toggle script execution. This will reload the page. Toggle script execution. This will reload the page.
.TP .TP
.B Ctrl\-Shift\-v .B Ctrl\-Shift\-t
Toggle the enabling of plugins on that surf instance. This will reload the Toggle strict TLS check. This will reload the page.
page.
.TP .TP
.B F11 .B F11
Toggle fullscreen mode. Toggle fullscreen mode.
@@ -251,11 +258,14 @@ images
.B s S .B s S
scripts scripts
.TP .TP
.B v V
plugins
.TP
.B m M .B m M
styles styles
.TP
.B x X
custom certificates
.TP
.B t T
strict TLS
.SH INDICATORS OF WEB PAGE .SH INDICATORS OF WEB PAGE
The second part of the indicators specifies modes of the web page itself. The second part of the indicators specifies modes of the web page itself.
.SS First character: encryption .SS First character: encryption
@@ -264,7 +274,7 @@ The second part of the indicators specifies modes of the web page itself.
unencrypted unencrypted
.TP .TP
.B T .B T
encrypted (SSL) encrypted (TLS)
.TP .TP
.B U .B U
attempted encryption but failed attempted encryption but failed
@@ -279,33 +289,17 @@ using proxy
.B SURF_USERAGENT .B SURF_USERAGENT
If this variable is set upon startup, surf will use it as the If this variable is set upon startup, surf will use it as the
.I useragent .I useragent
string string.
.TP .TP
.B http_proxy .B http_proxy
If this variable is set and not empty upon startup, surf will use it as the http proxy If this variable is set and not empty upon startup, surf will use it as the http proxy.
.TP .SH SIGNALS
.B no_proxy Surf will reload the current page on
If both http_proxy is set and no_proxy contain a .BR SIGHUP .
.BR comma-separated
list of domain extensions and both is not empty upon startup, proxy will
.BR not
be used for each of the elements in no_proxy.
.SH PLUGINS
For using plugins in surf, first determine your running architecture. Then get
the appropriate plugin for that architecture and copy it to
.BR /usr/lib/browser-plugins
or
.BR /usr/lib64/browser-plugins.
Surf should load them automatically.
.BR
If you want to use a 32bit plugin on a 64bit system,
.BR nspluginwrapper(1)
will help you.
.SH SEE ALSO .SH SEE ALSO
.BR dmenu(1), .BR dmenu(1),
.BR xprop(1), .BR xprop(1),
.BR tabbed(1), .BR tabbed(1),
.BR nspluginwrapper(1),
.BR xdotool(1) .BR xdotool(1)
.SH BUGS .SH BUGS
Please report them! Please report them!
+1760 -1401
View File
File diff suppressed because it is too large Load Diff
+166
View File
@@ -0,0 +1,166 @@
#include <sys/socket.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <inttypes.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <gio/gio.h>
#include <gio/gunixfdlist.h>
#include <webkit2/webkit-web-extension.h>
#include <webkitdom/webkitdom.h>
#include <webkitdom/WebKitDOMDOMWindowUnstable.h>
#include "common.h"
#define LENGTH(x) (sizeof(x) / sizeof(x[0]))
static WebKitWebExtension *webext;
static int sock;
/*
* Return:
* 0 No data processed: need more data
* > 0 Amount of data processed or discarded
*/
static size_t
evalmsg(char *msg, size_t sz)
{
char js[48];
WebKitWebPage *page;
JSCContext *jsc;
JSCValue *jsv;
if (!(page = webkit_web_extension_get_page(webext, msg[0])))
return sz;
if (sz < 2)
return 0;
jsc = webkit_frame_get_js_context(webkit_web_page_get_main_frame(page));
jsv = NULL;
switch (msg[1]) {
case 'h':
if (sz < 3) {
sz = 0;
break;
}
sz = 3;
snprintf(js, sizeof(js),
"window.scrollBy(window.innerWidth/100*%hhd,0);",
msg[2]);
jsv = jsc_context_evaluate(jsc, js, -1);
break;
case 'v':
if (sz < 3) {
sz = 0;
break;
}
sz = 3;
snprintf(js, sizeof(js),
"window.scrollBy(0,window.innerHeight/100*%hhd);",
msg[2]);
jsv = jsc_context_evaluate(jsc, js, -1);
break;
default:
fprintf(stderr, "%s:%d:evalmsg: unknown cmd(%zu): '%#x'\n",
__FILE__, __LINE__, sz, msg[1]);
}
g_object_unref(jsc);
if (jsv)
g_object_unref(jsv);
return sz;
}
static gboolean
readsock(GIOChannel *s, GIOCondition c, gpointer unused)
{
static char msg[MSGBUFSZ];
static size_t msgoff;
GError *gerr = NULL;
size_t sz;
gsize rsz;
if (g_io_channel_read_chars(s, msg+msgoff, sizeof(msg)-msgoff, &rsz, &gerr) !=
G_IO_STATUS_NORMAL) {
if (gerr) {
fprintf(stderr, "webext: error reading socket: %s\n",
gerr->message);
g_error_free(gerr);
}
return TRUE;
}
if (msgoff >= sizeof(msg)) {
fprintf(stderr, "%s:%d:%s: msgoff: %zu", __FILE__, __LINE__, __func__, msgoff);
return FALSE;
}
for (rsz += msgoff; rsz; rsz -= sz) {
sz = evalmsg(msg, rsz);
if (sz == 0) {
/* need more data */
break;
}
if (sz != rsz) {
/* continue processing message */
memmove(msg, msg+sz, rsz-sz);
}
}
msgoff = rsz;
return TRUE;
}
static void
pageusermessagereply(GObject *o, GAsyncResult *r, gpointer page)
{
WebKitUserMessage *m;
GUnixFDList *gfd;
GIOChannel *gchansock;
const char *name;
int nfd;
m = webkit_web_page_send_message_to_view_finish(page, r, NULL);
name = webkit_user_message_get_name(m);
if (strcmp(name, "surf-pipe") != 0) {
fprintf(stderr, "webext-surf: Unknown User Reply: %s\n", name);
return;
}
gfd = webkit_user_message_get_fd_list(m);
if ((nfd = g_unix_fd_list_get_length(gfd)) != 1) {
fprintf(stderr, "webext-surf: Too many file-descriptors: %d\n", nfd);
return;
}
sock = g_unix_fd_list_get(gfd, 0, NULL);
gchansock = g_io_channel_unix_new(sock);
g_io_channel_set_encoding(gchansock, NULL, NULL);
g_io_channel_set_flags(gchansock, g_io_channel_get_flags(gchansock)
| G_IO_FLAG_NONBLOCK, NULL);
g_io_channel_set_close_on_unref(gchansock, TRUE);
g_io_add_watch(gchansock, G_IO_IN, readsock, NULL);
}
void
pagecreated(WebKitWebExtension *e, WebKitWebPage *p, gpointer unused)
{
WebKitUserMessage *msg;
msg = webkit_user_message_new("page-created", NULL);
webkit_web_page_send_message_to_view(p, msg, NULL, pageusermessagereply, p);
}
G_MODULE_EXPORT void
webkit_web_extension_initialize(WebKitWebExtension *e)
{
webext = e;
g_signal_connect(G_OBJECT(e), "page-created",
G_CALLBACK(pagecreated), NULL);
}