mirror of
https://github.com/anufrievroman/waypaper.git
synced 2024-08-17 04:00:23 +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.refresh_button, False, False, 0)
|
||||||
self.options_box.pack_end(self.random_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.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.options_box.pack_start(self.backend_option_combo, False, False, 0)
|
||||||
self.button_row_alignment.add(self.options_box)
|
self.button_row_alignment.add(self.options_box)
|
||||||
|
|
||||||
self.monitor_option_display()
|
self.monitor_option_display()
|
||||||
|
self.fill_option_display()
|
||||||
|
self.color_picker_display()
|
||||||
|
|
||||||
# Connect the "q" key press event to exit the application
|
# Connect the "q" key press event to exit the application
|
||||||
self.connect("key-press-event", self.on_key_pressed)
|
self.connect("key-press-event", self.on_key_pressed)
|
||||||
@ -253,7 +253,7 @@ class App(Gtk.Window):
|
|||||||
|
|
||||||
else:
|
else:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Create a monitor option dropdown menu:
|
# Create a monitor option dropdown menu:
|
||||||
self.monitor_option_combo = Gtk.ComboBoxText()
|
self.monitor_option_combo = Gtk.ComboBoxText()
|
||||||
for monitor in monitor_names:
|
for monitor in monitor_names:
|
||||||
@ -266,7 +266,17 @@ class App(Gtk.Window):
|
|||||||
self.options_box.pack_start(self.monitor_option_combo, False, False, 0)
|
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):
|
def check_backends(self):
|
||||||
"""Before running the app, check which backends are installed or show the error"""
|
"""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.backend = self.backend_option_combo.get_active_text()
|
||||||
self.cf.selected_monitor = "All"
|
self.cf.selected_monitor = "All"
|
||||||
self.monitor_option_display()
|
self.monitor_option_display()
|
||||||
|
self.fill_option_display()
|
||||||
|
self.color_picker_display()
|
||||||
self.show_all()
|
self.show_all()
|
||||||
|
|
||||||
|
|
||||||
|
@ -34,12 +34,15 @@ def change_wallpaper(image_path, cf, monitor, txt):
|
|||||||
"tile": "no",
|
"tile": "no",
|
||||||
}
|
}
|
||||||
fill = fill_types[cf.fill_option.lower()]
|
fill = fill_types[cf.fill_option.lower()]
|
||||||
if "swaybg" in cf.installed_backends:
|
try:
|
||||||
try:
|
if "swaybg" in cf.installed_backends:
|
||||||
subprocess.Popen(["killall", "swaybg"])
|
subprocess.Popen(["killall", "swaybg"])
|
||||||
time.sleep(0.005)
|
time.sleep(0.005)
|
||||||
except Exception as e:
|
if "hyprpaper" in cf.installed_backends:
|
||||||
print(f"{txt.err_kill} {e}")
|
subprocess.Popen(["killall", "hyprpaper"])
|
||||||
|
time.sleep(0.005)
|
||||||
|
except Exception as e:
|
||||||
|
print(f"{txt.err_kill} {e}")
|
||||||
subprocess.Popen(["swww-daemon"])
|
subprocess.Popen(["swww-daemon"])
|
||||||
command = ["swww", "img", image_path]
|
command = ["swww", "img", image_path]
|
||||||
command.extend(["--resize", fill])
|
command.extend(["--resize", fill])
|
||||||
@ -93,8 +96,12 @@ def change_wallpaper(image_path, cf, monitor, txt):
|
|||||||
if monitor == "All":
|
if monitor == "All":
|
||||||
monitor = ""
|
monitor = ""
|
||||||
wallpaper_command = ["hyprctl", "hyprpaper", "wallpaper", f"{monitor},{image_path}"]
|
wallpaper_command = ["hyprctl", "hyprpaper", "wallpaper", f"{monitor},{image_path}"]
|
||||||
|
unload_command = ["hyprctl", "hyprpaper", "unload", "all"]
|
||||||
subprocess.Popen(preload_command)
|
subprocess.Popen(preload_command)
|
||||||
|
time.sleep(0.1)
|
||||||
subprocess.Popen(wallpaper_command)
|
subprocess.Popen(wallpaper_command)
|
||||||
|
time.sleep(0.1)
|
||||||
|
subprocess.Popen(unload_command)
|
||||||
|
|
||||||
elif cf.backend == "none":
|
elif cf.backend == "none":
|
||||||
pass
|
pass
|
||||||
|
Loading…
Reference in New Issue
Block a user