├── .editorconfig ├── .gitignore ├── Makefile ├── README.md ├── moonbrowser.desktop ├── moonbrowser.lua └── src └── moonbrowser-app.lua /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: https://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | # Unix-style newlines with a newline ending every file 7 | [*] 8 | end_of_line = lf 9 | insert_final_newline = false 10 | charset = utf-8 11 | 12 | # Matches multiple files with brace expansion notation 13 | # Set default charset 14 | [*.{js,lua,css}] 15 | charset = utf-8 16 | 17 | # 4 space indentation 18 | [*.{js,lua,css,html}] 19 | indent_style = tab 20 | indent_size = 4 21 | #indent_style = space 22 | 23 | # Tab indentation (no size specified) 24 | [Makefile] 25 | indent_style = tab 26 | 27 | 28 | # Matches the exact files either package.json or .travis.yml 29 | [{package.json,.travis.yml}] 30 | indent_style = space 31 | indent_size = 2 32 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | /moonbrowser 2 | /moonbrowser.luastatic.c -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | LUASTATIC = luastatic 2 | LUA = lua5.1 3 | LUA_INCLUDE = /usr/include/$(LUA) 4 | 5 | PREFIX = /usr/local 6 | BINDIR = $(PREFIX)/bin 7 | DESKTOP_DIR = $(PREFIX)/share/applications 8 | 9 | SRC = moonbrowser.lua src/moonbrowser-app.lua 10 | 11 | moonbrowser: 12 | $(LUASTATIC) $(SRC) -l$(LUA) -I$(LUA_INCLUDE) 13 | strip moonbrowser 14 | 15 | install: 16 | install -Dm775 moonbrowser $(DESTDIR)$(BINDIR)/moonbrowser 17 | install -Dm775 moonbrowser.desktop $(DESTDIR)$(DESKTOP_DIR)/moonbrowser.desktop 18 | 19 | uninstall: 20 | rm -rf $(DESTDIR)$(BINDIR)/moonbrowser 21 | rm -rf $(DESTDIR)$(DESKTOP_DIR)/moonbrowser.desktop 22 | 23 | clean: 24 | rm -rf moonbrowser.luastatic.c 25 | rm -rf moonbrowser 26 | 27 | .PHONY: moonbrowser -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # MoonBrowser 2 | MoonBrowser is a simple web browser in lua 3 | 4 | ## Screenshot 5 | 6 | ![screenshot](https://github.com/sodomon2/project-screenshot/blob/master/moonbrowser/screenshot.png?raw=true) 7 | 8 | ## Installation 9 | Note: in order to install `moonbrowser` you need to have [luastatic](https://github.com/ers35/luastatic) installed 10 | 11 | ``` 12 | git clone https://github.com/sodomon2/moonbrowser.git 13 | make moonbrowser 14 | [sudo] make install 15 | ``` 16 | 17 | ## Dependencies 18 | 19 | - [Lua](https://www.lua.org/download.html) 20 | - [Lua-lgi](https://github.com/pavouk/lgi) 21 | - [Webkit2](https://webkitgtk.org/) -------------------------------------------------------------------------------- /moonbrowser.desktop: -------------------------------------------------------------------------------- 1 | [Desktop Entry] 2 | Name=moonbrowser 3 | Type=Application 4 | Comment=MoonBrowser is a simple web browser in lua 5 | Icon=web-browser 6 | Exec=moonbrowser 7 | Terminal=false 8 | Categories=Network;WebBrowser; -------------------------------------------------------------------------------- /moonbrowser.lua: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env lua 2 | --[[-- 3 | @package MoonBrowser 4 | @filename moonbrowser.lua 5 | @version 2.0 6 | @author Diaz Urbaneja Victor Diego Alejandro 7 | @date 06.02.2021 08:50:42 -04 8 | --]] 9 | 10 | lgi = require("lgi") 11 | Gtk = lgi.require('Gtk', '3.0') 12 | Gdk = lgi.require('Gdk', '3.0') 13 | GLib = lgi.require('GLib', '2.0') 14 | Webkit = lgi.require('WebKit2','4.0') 15 | 16 | app = Gtk.Application() 17 | webview = Webkit.WebView() 18 | 19 | -- MoonBrowser 20 | require('src.moonbrowser-app') 21 | 22 | app:run() -------------------------------------------------------------------------------- /src/moonbrowser-app.lua: -------------------------------------------------------------------------------- 1 | --[[-- 2 | @package MoonBrowser 3 | @filename moonbrowser-app.lua 4 | @version 2.0 5 | @autor Diaz Urbaneja Victor Diego Alejandro 6 | @date 06.02.2021 08:50:42 -04 7 | ]] 8 | 9 | content = Gtk.Box { 10 | orientation = 'VERTICAL', 11 | Gtk.Box { 12 | expand = false, 13 | orientation = 'HORIZONTAL', 14 | Gtk.Button { 15 | relief = Gtk.ReliefStyle.NONE, 16 | Gtk.Image { icon_name = 'back-symbolic' }, 17 | on_clicked = function() webview:go_back() end 18 | }, 19 | Gtk.Button { 20 | relief = Gtk.ReliefStyle.NONE, 21 | Gtk.Image { icon_name = 'next-symbolic' }, 22 | on_clicked = function() webview:go_forward() end 23 | }, 24 | Gtk.Button { 25 | relief = Gtk.ReliefStyle.NONE, 26 | Gtk.Image { icon_name = 'reload-symbolic' }, 27 | on_clicked = function() webview:reload() end 28 | }, 29 | Gtk.Separator(), 30 | Gtk.Entry { id = 'entry_url', expand = true }, 31 | Gtk.Separator(), 32 | Gtk.Button { 33 | relief = Gtk.ReliefStyle.NONE, 34 | Gtk.Image { icon_name = 'gtk-home-symbolic' }, 35 | on_clicked = function() 36 | webview:load_uri('http://duckduckgo.com') 37 | content.child.entry_url.text = 'duckduckgo.com' 38 | end 39 | } 40 | }, 41 | Gtk.Box { 42 | orientation = 'VERTICAL', 43 | Gtk.ScrolledWindow { id = 'scroll', expand = true } 44 | }, 45 | } 46 | 47 | main_window = Gtk.Window { 48 | width_request = 800, 49 | height_request = 600, 50 | content 51 | } 52 | 53 | function moonbrowser_init() 54 | webview:load_uri('http://duckduckgo.com') 55 | main_window.child.entry_url.text = 'http://duckduckgo.com' 56 | end 57 | 58 | function webview:on_load_changed(event) 59 | print(event) 60 | if event == 'STARTED' then 61 | main_window.title = 'Loading Page' 62 | elseif event == 'FINISHED' then 63 | main_window.title = webview:get_title() 64 | end 65 | end 66 | 67 | function main_window:on_destroy() 68 | Gtk.main_quit() 69 | end 70 | 71 | function main_window.child.entry_url:on_key_release_event(event) 72 | if ( event.keyval == Gdk.KEY_Return ) then 73 | webview:load_uri('http://' and 'https://' .. main_window.child.entry_url.text) 74 | end 75 | end 76 | 77 | function app:on_activate() 78 | main_window.child.scroll:add(webview) 79 | main_window.child.entry_url.set_icon_from_icon_name( 80 | main_window.child.entry_url, 81 | 1, 82 | 'find-symbolic' 83 | ) 84 | main_window:show_all() 85 | moonbrowser_init() 86 | self:add_window(main_window) 87 | end 88 | 89 | --------------------------------------------------------------------------------