Skip to content

Commit

Permalink
Sulfer 0.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
chm46e committed Mar 20, 2022
1 parent 2be0d08 commit 4bb90bb
Show file tree
Hide file tree
Showing 37 changed files with 2,320 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
build/
26 changes: 26 additions & 0 deletions meson.build
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
project('sulfer', 'c', version: '0.1.0',
default_options: ['warning_level=3', 'c_std=gnu18'])

cc = meson.get_compiler('c')
cfg_lib_dirs = ['/usr/local/lib/', '/usr/lib', '/usr/share/lib']
cfg_dep = cc.find_library('libconfuse', dirs: cfg_lib_dirs)

gtk_dep = dependency('gtk+-3.0')
x11_dep = dependency('x11', method: 'pkg-config')
webkit_dep = dependency('webkit2gtk-4.0', method: 'pkg-config')

src = ['src/sulfer.c', 'src/cfg/cfg.c', 'src/cfg/config.c', 'src/frame/frame.c', 'src/frame/handle.c', 'src/uri/uri.c', 'src/util/util.c', 'src/util/atom.c', 'src/util/path.c']

incs = include_directories('src/')
ldflags = ['-l:libconfuse.a', '-lgthread-2.0']

run_target('cp', command: ['cp', '-f', 'src/main.ui', '~/.config/sulfer/'])

exec = executable('sulfer', sources: src, dependencies : [gtk_dep, x11_dep, webkit_dep, cfg_dep], include_directories: incs, install: true, build_by_default: true)

custom_target('ui', depends: exec,
input: exec, output: 'main.ui',
command: ['src/sh/install.sh'],
build_by_default: true)

meson.add_install_script('src/sh/final.sh')
Binary file added res/logo/Logo-Sulfur-transparent.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
244 changes: 244 additions & 0 deletions res/logo/Logo-Sulfur-transparent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/logo/Logo-Sulfur-white.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/logo/logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/logo/logo2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added res/logo/logo3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions res/sulfer.desktop
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
[Desktop Entry]
Name=Sulfer
Exec=sulfer %u
Icon=sulfer
GenericName=Web Browser
Comment=Surf the web
Type=Application
Terminal=false
Categories=Network;WebBrowser;
StartupNotify=true
Keywords=Browser;Web;
Binary file added res/sulfer.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
100 changes: 100 additions & 0 deletions src/cfg/cfg.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
/*
* cfg/cfg.c:
* Intended for loading the configuration file via libconfuse
* by default: ~/.config/sulfer/sulfer.conf
*/

#include <confuse.h>
#include <string.h>
#include <stdlib.h>

#include "../util/util.h"

#include "cfg.h"

static conf_opt *config;

extern conf_opt *cfg_get(void)
{
return config;
}

extern conf_opt *cfg_load(char *name)
{
cfg_t *cfg;

config = ecalloc(conf_len, sizeof(conf_opt));

cfg_opt_t opts[] = {
CFG_STR("cache_prefix", "~/.cache/sulfer", CFGF_NONE),
CFG_BOOL("ephemeral", cfg_false, CFGF_NONE),
CFG_BOOL("java", cfg_true, CFGF_NONE),
CFG_BOOL("javascript", cfg_true, CFGF_NONE),
CFG_BOOL("xss_auditor", cfg_true, CFGF_NONE),
CFG_BOOL("js_auto_popups", cfg_false, CFGF_NONE),
CFG_STR("font_family", "sans-serif", CFGF_NONE),
CFG_INT("font_size", 16, CFGF_NONE),
CFG_STR("charset", "UTF_8", CFGF_NONE),
CFG_BOOL("developer_extras", cfg_false, CFGF_NONE),
CFG_BOOL("dns_prefetching", cfg_false, CFGF_NONE),
CFG_BOOL("caret_browsing", cfg_false, CFGF_NONE),
CFG_BOOL("media", cfg_true, CFGF_NONE),
CFG_BOOL("webaudio", cfg_true, CFGF_NONE),
CFG_BOOL("webgl", cfg_true, CFGF_NONE),
CFG_BOOL("site_quirks", cfg_true, CFGF_NONE),
CFG_BOOL("smooth_scrolling", cfg_true, CFGF_NONE),
CFG_STR("user_agent", "", CFGF_NONE),
CFG_INT("hardware_accel", 2, CFGF_NONE),
CFG_INT("cookie_policy", 2, CFGF_NONE),
CFG_BOOL("itp", cfg_true, CFGF_NONE),
CFG_BOOL("tls_error_policy", cfg_true, CFGF_NONE),
CFG_STR("search_engine", "searx", CFGF_NONE),
CFG_BOOL("dark_mode", cfg_true, CFGF_NONE),
CFG_BOOL("scrollbar", cfg_true, CFGF_NONE),
CFG_END()
};

cfg = cfg_init(opts, CFGF_NOCASE);
if(cfg_parse(cfg, name) == CFG_PARSE_ERROR)
die(1, "[ERROR] Unable to parse config: %s\n", name);

config[conf_cache_prefix].s = strdup(cfg_getstr(cfg, "cache_prefix"));
config[conf_ephemeral].i = cfg_getbool(cfg, "ephemeral");
config[conf_java].i = cfg_getbool(cfg, "java");
config[conf_javascript].i = cfg_getbool(cfg, "javascript");
config[conf_xss_auditor].i = cfg_getbool(cfg, "xss_auditor");
config[conf_js_auto_popups].i = cfg_getbool(cfg, "js_auto_popups");
config[conf_font_family].s = strdup(cfg_getstr(cfg, "font_family"));
config[conf_font_size].i = cfg_getint(cfg, "font_size");
config[conf_charset].s = strdup(cfg_getstr(cfg, "charset"));
config[conf_developer_extras].i = cfg_getbool(cfg, "developer_extras");
config[conf_dns_prefetching].i = cfg_getbool(cfg, "dns_prefetching");
config[conf_caret_browsing].i = cfg_getbool(cfg, "caret_browsing");
config[conf_media].i = cfg_getbool(cfg, "media");
config[conf_webaudio].i = cfg_getbool(cfg, "webaudio");
config[conf_webgl].i = cfg_getbool(cfg, "webgl");
config[conf_site_quirks].i = cfg_getbool(cfg, "site_quirks");
config[conf_smooth_scrolling].i = cfg_getbool(cfg, "smooth_scrolling");
config[conf_user_agent].s = strdup(cfg_getstr(cfg, "user_agent"));
config[conf_hardware_accel].i = cfg_getint(cfg, "hardware_accel");
config[conf_cookie_policy].i = cfg_getint(cfg, "cookie_policy");
config[conf_itp].i = cfg_getbool(cfg, "itp");
config[conf_tls_error_policy].i = cfg_getbool(cfg, "tls_error_policy");
config[conf_search_engine].s = strdup(cfg_getstr(cfg, "search_engine"));
config[conf_dark_mode].i = cfg_getbool(cfg, "dark_mode");
config[conf_scrollbar].i = cfg_getbool(cfg, "scrollbar");

cfg_free(cfg);

return config;
}

extern void cfg_cleanup(void)
{
free(config[conf_cache_prefix].s);
free(config[conf_font_family].s);
free(config[conf_charset].s);
free(config[conf_user_agent].s);
free(config[conf_search_engine].s);
free(config);
}
Loading

0 comments on commit 4bb90bb

Please sign in to comment.