Skip to content

Commit

Permalink
Changed README.md, Makefile, settings.json, xmrig, xmrigui.desktop, x…
Browse files Browse the repository at this point in the history
…mrigui.py, added support for other coins, opencl and cuda, changed version
  • Loading branch information
LinuxHeki committed Oct 20, 2021
1 parent fa2034f commit 82c7610
Show file tree
Hide file tree
Showing 8 changed files with 158 additions and 51 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.PHONY: build install uninstall clean deb

package = xmrigui_1.0-0_amd64
package = xmrigui_1.1-0_amd64

build:
pyinstaller --onefile -w xmrigui.py
Expand Down
35 changes: 22 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,34 @@ XMRiGUI is free and open-source crypto miner for Linux. It uses [XMRig](http://g

## Features
Coins:
* **Monero**
* Ravencoin (soon)
* Chukwa (soon)
* CCX (soon)
* Keva (soon)
* Dero (soon)
* Talleo (soon)
* Safex (soon)
* ArQmA (soon)
* NINJA (soon)
* Wownero (soon)
* Monero
* Ravencoin
* Uplexa
* Chukwa
* Chukwa v2
* CCX
* Keva
* Dero
* Talleo
* Safex
* ArQmA
* NINJA
* Wownero

Other cryptos **may** work if the algorithm is the same.

Mining backends:
* **CPU** x64
* **CPU** ARMv8 (soon)
* **OpenCL** for AMD GPUs (soon)
* **CUDA** for NVIDIA GPUs (soon)
* **OpenCL** for AMD GPUs
* **CUDA** for NVIDIA GPUs

If OpenCL doesn't work try to install [this driver](https://github.com/Diolinux/amd-opencl-pro-linux-resolve).
<br>

For CUDA to work you need to build [Cuda plugin](http://github.com/xmrig/xmrig-cuda#linux-usage) and put it into `/opt/xmrigui/`

**I NEVER TESTED OPENCL OR CUDA BECAUSE I DON'T HAVE THAT GOOD GPU! PLEASE TEST AND IF SOMETHING GOES WRONG PLEASE REPORT!**
<br>
<br>

Expand Down
6 changes: 5 additions & 1 deletion settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,9 @@
"user": "YOUR_MONERO_WALLET",
"password": "PASSWORD / YOUR_WORKER_NAME",
"donate": "1",
"threads": "0"
"threads": "0",
"cuda": false,
"opencl": false,
"cpu": true,
"coin": 0
}
Binary file modified xmrig
Binary file not shown.
2 changes: 1 addition & 1 deletion xmrigui.desktop
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[Desktop Entry]
Encoding=UTF-8
Version=1.0
Version=1.1
Type=Application
Terminal=false
Exec=/usr/local/bin/xmrigui
Expand Down
159 changes: 128 additions & 31 deletions xmrigui.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,27 @@ def call_instance():
class XMRiGUI(Gtk.Window):
def __init__(self):
super().__init__()
self.user = os.getlogin()
self.settings_path = f'/home/{self.user}/.config/xmrigui.json'
self.xmrig_path = '/opt/xmrigui/xmrig'
self.icon_path = '/usr/share/icons/hicolor/256x256/apps/xmrigui.png'
self.load_data()
self.config = self.get_config()
self.draw()
if self.config['mine']: self.start_mining(save=False)

def get_config(self):
config = '''{
"mine": false,
"pool": "POOL",
"user": "YOUR_MONERO_WALLET",
"password": "PASSWORD / YOUR_WORKER_NAME",
"donate": "1",
"threads": "0"
}
'''

try:
with open(self.settings_path, 'r') as f:
return json.loads(f.read())
with open(self.settings_path, 'r') as f: pass
try:
with open(self.settings_path, 'r') as f:
config = json.loads(f.read())
test = config['coin']
return config
except:
with open(self.settings_path, 'w') as f:
f.write(self.raw_config)
return json.loads(self.raw_config)
except:
with open(self.settings_path, 'x'): pass
with open(self.settings_path, 'w')as f: f.write(config)
return json.loads(config)
with open(self.settings_path, 'w') as f: f.write(self.raw_config)
return json.loads(self.raw_config)

def onSwitch(self, source, state):
if state: self.start_mining()
Expand All @@ -78,15 +73,19 @@ def start_mining(self, save=True):
if save:
self.config['mine'] = True
self.save('switch', restart=False)

pool = f' --url={self.config["pool"]}'
user = f' --user={self.config["user"]}'
password = f' --pass={self.config["password"]}'
donate = f' --donate-level={self.config["donate"]}'
if self.config['threads'] != '0': threads = f' --threads={self.config["threads"]}'
else: threads = ''

os.system(self.xmrig_path + ' --background --coin=monero' + pool + user + password + donate + threads)

args = ''
args += f' --algo={self.algos[self.config["coin"]]}'
args += f' --url={self.config["pool"]}'
args += f' --user={self.config["user"]}'
args += f' --pass={self.config["password"]}'
args += f' --donate-level={self.config["donate"]}'
if self.config['threads'] != '0': args += f' --threads={self.config["threads"]}'
if self.config['cuda']: args += f' --cuda --cuda-loader={self.cuda_plugin_path}'
if self.config['opencl']: args += ' --opencl'
if not self.config['cpu']: args += ' --no-cpu'

os.system(self.xmrig_path + ' --background' + args)

def stop_mining(self, save=True):
if save:
Expand All @@ -100,14 +99,19 @@ def save(self, source, restart=True):
self.config['password'] = self.pass_entry.get_text()
self.config['donate'] = self.donate_entry.get_text()
self.config['threads'] = self.threads_entry.get_text()
self.config['cuda'] = self.cuda_switch.get_active()
self.config['opencl'] = self.opencl_switch.get_active()
self.config['cpu'] = self.cpu_switch.get_active()
self.config['coin'] = self.crypto_chooser.get_active()
print(self.config['coin'])

with open(self.settings_path, 'w') as f: f.write(json.dumps(self.config))

if restart and self.config['mine']:
self.stop_mining()
self.start_mining()
self.stop_mining(save=False)
self.start_mining(save=False)

def draw(self):
def draw(self, update=True):
self.set_title('XMRiGUI')
self.icon = GdkPixbuf.Pixbuf.new_from_file(filename=self.icon_path)
self.set_icon(self.icon)
Expand Down Expand Up @@ -185,9 +189,102 @@ def draw(self):
self.settings.attach(self.donate_box, 1,0,1,1)
self.settings.attach(self.threads_box, 1,1,1,1)
self.settings.attach(self.save_button, 1,2,1,1)

self.advanched_settings = Gtk.Expander(label='Advanched options')
self.advanched_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, spacing=10)
self.advanched_grid = Gtk.Grid(column_homogeneous=True, row_spacing=10)

self.cuda_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL)
self.cuda_label = Gtk.Label(label='NVidia GPU')
self.cuda_switch = Gtk.Switch()
self.cuda_switch.connect('state-set', self.save)
self.cuda_switch.set_active(self.config['cuda'])
self.cuda_box.pack_start(self.cuda_label, True, False, 0)
self.cuda_box.pack_start(self.cuda_switch, True, False, 0)

self.opencl_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
self.opencl_label = Gtk.Label(label='AMD GPU')
self.opencl_switch = Gtk.Switch()
self.opencl_switch.connect('state-set', self.save)
self.opencl_switch.set_active(self.config['opencl'])
self.opencl_box.pack_start(self.opencl_label, True, False, 0)
self.opencl_box.pack_start(self.opencl_switch, True, False, 0)

self.cpu_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=5)
self.cpu_label = Gtk.Label(label='CPU')
self.cpu_switch = Gtk.Switch()
self.cpu_switch.connect('state-set', self.save)
self.cpu_switch.set_active(self.config['cpu'])
self.cpu_box.pack_start(self.cpu_label, True, False, 0)
self.cpu_box.pack_start(self.cpu_switch, True, False, 0)

self.crypto_chooser = Gtk.ComboBoxText()
self.crypto_chooser.set_entry_text_column(0)
self.crypto_chooser.connect("changed", self.save)
for crypto in self.cryptos: self.crypto_chooser.append_text(crypto)
if update: self.crypto_chooser.set_active(self.config['coin'])
else: self.crypto_chooser.set_active(self.config['coin']+1)

self.advanched_grid.attach(self.cuda_box, 0,0,1,1)
self.advanched_grid.attach(self.opencl_box, 0,1,1,1)
self.advanched_grid.attach(self.cpu_box, 0,2,1,1)
self.advanched_grid.attach(self.crypto_chooser, 1,0,1,2)
self.advanched_box.pack_start(self.advanched_grid, True, True, 20)
self.advanched_settings.add(self.advanched_box)

self.box.pack_start(self.main_box, True, True, 0)
self.box.pack_start(self.settings, True, True, 0)
self.box.pack_start(self.advanched_settings, True, True, 0)

def load_data(self):
self.user = os.getlogin()
self.settings_path = f'/home/{self.user}/.config/xmrigui.json'
self.xmrig_path = '/opt/xmrigui/xmrig'
self.icon_path = '/usr/share/icons/hicolor/256x256/apps/xmrigui.png'
self.cuda_plugin_path = '/opt/xmrigui/libxmrig-cuda.so'
self.cryptos = [
'Monero',
'Ravencoin',
'Uplexa',
'Chukwa',
'Chukwa v2',
'CCX',
'Keva',
'Dero',
'Talleo',
'Safex',
'ArQmA',
'NINJA',
'Wownero'
]
self.algos = [
'rx/0',
'kawpow',
'cn/upx2',
'argon2/chukwa',
'argon2/chukwav2',
'cn/ccx',
'rx/keva',
'astrobwt',
'cn-pico/tlo',
'rx/sfx',
'rx/arq',
'argon2/ninja',
'rx/wow'
]
self.raw_config = '''{
"mine": false,
"pool": "POOL",
"user": "YOUR_MONERO_WALLET",
"password": "PASSWORD / YOUR_WORKER_NAME",
"donate": "1",
"threads": "0",
"cuda": false,
"opencl": false,
"cpu": true,
"coin": 0
}
'''


class AppIndicator():
Expand Down Expand Up @@ -217,7 +314,7 @@ def quit(self, widget):

def show(self, widget):
self.window.config = self.window.get_config()
self.window.draw()
self.window.draw(update=False)
self.window.show_all()


Expand Down
3 changes: 0 additions & 3 deletions xmrigui_1.0-0_amd64/DEBIAN/rules

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: xmrigui
Source: xmrigui
Version: 1.0
Version: 1.1
Architecture: amd64
Maintainer: LinuxHeki <[email protected]>
Description: GUI for XMRig crypto miner
Expand Down

0 comments on commit 82c7610

Please sign in to comment.