mirror of
https://github.com/anufrievroman/waypaper.git
synced 2024-08-17 12:10:24 +03:00
Compare commits
3 Commits
a9006aafa3
...
62e8ed9cfc
Author | SHA1 | Date | |
---|---|---|---|
|
62e8ed9cfc | ||
|
839dd839e2 | ||
|
b066d4e162 |
@ -178,12 +178,12 @@ class App(Gtk.Window):
|
||||
self.options_box.pack_end(self.refresh_button, False, False, 0)
|
||||
self.options_box.pack_end(self.random_button, False, False, 0)
|
||||
self.options_box.pack_end(self.sort_option_combo, False, False, 0)
|
||||
self.options_box.pack_end(self.color_picker_button, False, False, 0)
|
||||
self.options_box.pack_end(self.fill_option_combo, False, False, 0)
|
||||
self.options_box.pack_start(self.backend_option_combo, False, False, 0)
|
||||
self.button_row_alignment.add(self.options_box)
|
||||
|
||||
self.monitor_option_display()
|
||||
self.fill_option_display()
|
||||
self.color_picker_display()
|
||||
|
||||
# Connect the "q" key press event to exit the application
|
||||
self.connect("key-press-event", self.on_key_pressed)
|
||||
@ -266,7 +266,17 @@ class App(Gtk.Window):
|
||||
self.options_box.pack_start(self.monitor_option_combo, False, False, 0)
|
||||
|
||||
|
||||
def fill_option_display(self):
|
||||
"""Display fill option if backend is not hyprpaper"""
|
||||
self.options_box.remove(self.fill_option_combo)
|
||||
if self.cf.backend not in ['hyprpaper', 'none']:
|
||||
self.options_box.pack_end(self.fill_option_combo, False, False, 0)
|
||||
|
||||
def color_picker_display(self):
|
||||
"""Display color option if backend is not hyprpaper"""
|
||||
self.options_box.remove(self.color_picker_button)
|
||||
if self.cf.backend not in ['hyprpaper', 'none']:
|
||||
self.options_box.pack_end(self.color_picker_button, False, False, 0)
|
||||
|
||||
def check_backends(self):
|
||||
"""Before running the app, check which backends are installed or show the error"""
|
||||
@ -457,6 +467,8 @@ class App(Gtk.Window):
|
||||
self.cf.backend = self.backend_option_combo.get_active_text()
|
||||
self.cf.selected_monitor = "All"
|
||||
self.monitor_option_display()
|
||||
self.fill_option_display()
|
||||
self.color_picker_display()
|
||||
self.show_all()
|
||||
|
||||
|
||||
|
@ -34,10 +34,13 @@ def change_wallpaper(image_path, cf, monitor, txt):
|
||||
"tile": "no",
|
||||
}
|
||||
fill = fill_types[cf.fill_option.lower()]
|
||||
if "swaybg" in cf.installed_backends:
|
||||
try:
|
||||
if "swaybg" in cf.installed_backends:
|
||||
subprocess.Popen(["killall", "swaybg"])
|
||||
time.sleep(0.005)
|
||||
if "hyprpaper" in cf.installed_backends:
|
||||
subprocess.Popen(["killall", "hyprpaper"])
|
||||
time.sleep(0.005)
|
||||
except Exception as e:
|
||||
print(f"{txt.err_kill} {e}")
|
||||
subprocess.Popen(["swww-daemon"])
|
||||
@ -93,8 +96,12 @@ def change_wallpaper(image_path, cf, monitor, txt):
|
||||
if monitor == "All":
|
||||
monitor = ""
|
||||
wallpaper_command = ["hyprctl", "hyprpaper", "wallpaper", f"{monitor},{image_path}"]
|
||||
unload_command = ["hyprctl", "hyprpaper", "unload", "all"]
|
||||
subprocess.Popen(preload_command)
|
||||
time.sleep(0.1)
|
||||
subprocess.Popen(wallpaper_command)
|
||||
time.sleep(0.1)
|
||||
subprocess.Popen(unload_command)
|
||||
|
||||
elif cf.backend == "none":
|
||||
pass
|
||||
|
Loading…
Reference in New Issue
Block a user