pika-gnome-layouts/src/etc/nobara/scripts/nobara-layouts/nobara-layouts.py

205 lines
9.0 KiB
Python
Raw Normal View History

2022-09-23 19:59:44 +02:00
import gi
gi.require_version("Gtk", "3.0")
from gi.repository import Gtk, Gio
import subprocess
import os
import os.path
from pathlib import Path
class Application:
### MAIN WINDOW ###
def __init__(self):
self.column_names = False
self.drop_nan = False
self.df = None
application_id="org.nobara.layouts"
self.builder = Gtk.Builder()
self.builder.add_from_file("/etc/nobara/scripts/nobara-layouts/nobara-layouts.ui")
self.builder.connect_signals(self)
win = self.builder.get_object("main_window")
win.connect("destroy", Gtk.main_quit)
self.window = self.builder.get_object("main_window")
self.window.show()
settings = Gio.Settings.new("org.nobara.layouts")
print(settings.get_int("layout-num"))
win10toggle = self.builder.get_object("win10_button")
win10toggle.set_active(True)
win10toggle.pressed()
2022-09-23 20:53:07 +02:00
### Layouts ###
2022-09-24 09:21:08 +02:00
def on_win10_button_pressed(self, widget):
2022-09-23 20:53:07 +02:00
settings = Gio.Settings.new("org.nobara.layouts")
2022-09-24 09:21:08 +02:00
settings.set_int("layout-num", 1)
2022-09-23 20:53:07 +02:00
def test2(self, widget):
print("test2")
def test3(self, widget):
print("test3")
def test4(self, widget):
print("test4")
2022-09-23 19:59:44 +02:00
2022-09-23 20:53:07 +02:00
### Settings ###
2022-09-24 10:13:36 +02:00
desktop_switch = self.builder.get_object("desktop_switch")
2022-09-23 20:53:07 +02:00
desktop_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep ding@rastersoft.com"], shell=True)
if (desktop_output.returncode) == 0:
desktop_switch.set_active(True)
2022-09-23 23:12:30 +02:00
2022-09-23 23:32:49 +02:00
audio_switch = self.builder.get_object("audio_switch")
audio_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep volume-mixer@evermiss.net"], shell=True)
if (audio_output.returncode) == 0:
audio_switch.set_active(True)
blur_switch = self.builder.get_object("blur_switch")
blur_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep blur-my-shell@aunetx"], shell=True)
if (blur_output.returncode) == 0:
blur_switch.set_active(True)
tray_switch = self.builder.get_object("tray_switch")
tray_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep trayIconsReloaded@selfmade.pl"], shell=True)
if (tray_output.returncode) == 0:
tray_switch.set_active(True)
2022-09-24 10:13:36 +02:00
2022-09-23 23:32:49 +02:00
workspace_switch = self.builder.get_object("workspace_switch")
workspace_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep auto-move-windows@gnome-shell-extensions.gcampax.github.com"], shell=True)
if (workspace_output.returncode) == 0:
workspace_switch.set_active(True)
2022-09-24 10:13:36 +02:00
2022-09-24 08:37:06 +02:00
x11_switch = self.builder.get_object("x11_switch")
x11_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep x11gestures@joseexposito.github.io"], shell=True)
if (x11_output.returncode) == 0:
x11_switch.set_active(True)
2022-09-24 10:13:36 +02:00
2022-09-24 08:37:06 +02:00
clipboard_switch = self.builder.get_object("clipboard_switch")
clipboard_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep gnome-clipboard@b00f.github.io"], shell=True)
if (clipboard_output.returncode) == 0:
clipboard_switch.set_active(True)
2022-09-24 09:14:36 +02:00
supergfxctl_switch = self.builder.get_object("supergfxctl_switch")
2022-09-24 10:13:36 +02:00
supergfxctl_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep supergfxctl-gex@asus-linux.org"], shell=True)
2022-09-24 09:14:36 +02:00
if (supergfxctl_output.returncode) == 0:
supergfxctl_switch.set_active(True)
2022-09-24 10:13:36 +02:00
caffeine_switch = self.builder.get_object("caffeine_switch")
caffeine_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep espresso@coadmunkee.github.com"], shell=True)
if (caffeine_output.returncode) == 0:
caffeine_switch.set_active(True)
2022-09-24 09:14:36 +02:00
kde_switch = self.builder.get_object("kde_switch")
2022-09-24 10:13:36 +02:00
kde_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep gsconnect@andyholmes.github.io"], shell=True)
2022-09-24 09:14:36 +02:00
if (kde_output.returncode) == 0:
kde_switch.set_active(True)
weather_switch = self.builder.get_object("weather_switch")
2022-09-24 09:21:08 +02:00
weather_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep openweather-extension@jenslody.de"], shell=True)
2022-09-24 09:14:36 +02:00
if (weather_output.returncode) == 0:
weather_switch.set_active(True)
spacebar_switch = self.builder.get_object("spacebar_switch")
2022-09-24 09:21:08 +02:00
spacebar_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep space-bar@luchrioh"], shell=True)
2022-09-24 09:14:36 +02:00
if (spacebar_output.returncode) == 0:
spacebar_switch.set_active(True)
2022-09-24 10:13:36 +02:00
2022-09-24 09:14:36 +02:00
stats_switch = self.builder.get_object("stats_switch")
2022-09-24 09:21:08 +02:00
stats_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep Vitals@CoreCoding.com"], shell=True)
2022-09-24 09:14:36 +02:00
if (stats_output.returncode) == 0:
stats_switch.set_active(True)
2022-09-24 10:13:36 +02:00
2022-09-24 09:16:59 +02:00
hid_switch = self.builder.get_object("hid_switch")
2022-09-24 09:21:08 +02:00
hid_output = subprocess.run(["gsettings get org.gnome.shell enabled-extensions | grep wireless-hid@chlumskyvaclav.gmail.com"], shell=True)
2022-09-24 09:16:59 +02:00
if (hid_output.returncode) == 0:
hid_switch.set_active(True)
2022-09-24 10:13:36 +02:00
#### Desktop Switch ####
def on_desktop_switch_active_notify(self, switch, state):
if switch.get_active() == True :
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/desktop.sh"], shell=True)
pass
#### Audio Switch ####
def on_audio_switch_active_notify(self, switch, state):
if switch.get_active() == True :
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/audio.sh"], shell=True)
pass
#### Blur Switch ####
def on_blur_switch_active_notify(self, switch, state):
if switch.get_active() == True :
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/blur.sh"], shell=True)
pass
#### Tray Switch ####
def on_tray_switch_active_notify(self, switch, state):
if switch.get_active() == True :
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/tray.sh"], shell=True)
pass
#### workspace Switch ####
def on_workspace_switch_active_notify(self, switch, state):
if switch.get_active() == True :
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/workspace.sh"], shell=True)
pass
#### x11 Switch ####
def on_x11_switch_active_notify(self, switch, state):
if switch.get_active() == True :
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/x11.sh"], shell=True)
pass
#### clipboard Switch ####
def on_clipboard_switch_active_notify(self, switch, state):
if switch.get_active() == True :
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/clipboard.sh"], shell=True)
pass
#### caffeine Switch ####
def on_caffeine_switch_active_notify(self, switch, state):
if switch.get_active() == True:
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/caffeine.sh"], shell=True)
pass
#### supergfxctl Switch ####
def on_supergfxctl_switch_active_notify(self, switch, state):
if switch.get_active() == True:
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/supergfxctl.sh"], shell=True)
pass
#### kde Switch ####
def on_kde_switch_active_notify(self, switch, state):
if switch.get_active() == True:
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/kde.sh"], shell=True)
pass
#### weather Switch ####
def on_weather_switch_active_notify(self, switch, state):
if switch.get_active() == True:
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/weather.sh"], shell=True)
pass
#### spacebar Switch ####
def on_spacebar_switch_active_notify(self, switch, state):
if switch.get_active() == True:
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/spacebar.sh"], shell=True)
pass
#### stats Switch ####
def on_stats_switch_active_notify(self, switch, state):
if stats_switch.get_active() == True:
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/stats.sh"], shell=True)
else:
print("test")
pass
#### hid Switch ####
def on_hid_switch_active_notify(self, switch, state):
if switch.get_active() == True:
2022-09-24 09:16:59 +02:00
subprocess.run(["/etc/nobara/scripts/nobara-layouts/settings-scripts/hid.sh"], shell=True)
2022-09-24 10:13:36 +02:00
pass
2022-09-24 09:16:59 +02:00
2022-09-23 19:59:44 +02:00
Application()
Gtk.main()