Adding Pause button for mpvpaper

This commit is contained in:
Roman 2024-11-16 23:42:57 +09:00
parent e62e39ae42
commit a2e9c726ae
2 changed files with 28 additions and 3 deletions

View File

@ -214,7 +214,12 @@ class App(Gtk.Window):
self.mpv_stop_button.connect("clicked", self.on_mpv_stop_button_clicked)
self.mpv_stop_button.set_tooltip_text(self.txt.tip_mpv_stop)
# Create a box to contain the bottom row of buttons with margin:
# Create mpv pause button:
self.mpv_pause_button = Gtk.Button(label=self.txt.msg_pause)
self.mpv_pause_button.connect("clicked", self.on_mpv_pause_button_clicked)
self.mpv_pause_button.set_tooltip_text(self.txt.tip_mpv_pause)
# Create a box to contain the bottom row of buttons:
self.bottom_button_box = Gtk.Box(orientation=Gtk.Orientation.HORIZONTAL, spacing=60)
self.bottom_button_box.set_margin_bottom(15)
self.main_box.pack_end(self.bottom_button_box, False, False, 0)
@ -360,6 +365,7 @@ class App(Gtk.Window):
self.options_box.remove(self.mpv_stop_button)
if self.cf.backend == "mpvpaper":
self.options_box.pack_end(self.mpv_stop_button, False, False, 0)
self.options_box.pack_end(self.mpv_pause_button, False, False, 0)
def fill_option_display(self):
"""Display fill option if backend is not hyprpaper"""
@ -668,6 +674,10 @@ class App(Gtk.Window):
"""On clicking mpv stop button, kill the mpvpaper"""
subprocess.Popen(["killall", "mpvpaper"])
def on_mpv_pause_button_clicked(self, widget) -> None:
"""On clicking mpv stop button, kill the mpvpaper"""
subprocess.Popen(f"echo 'cycle pause' | socat - /tmp/mpv-socket-{self.cf.selected_monitor}", shell=True)
def on_random_clicked(self, widget) -> None:
"""On clicking random button, set random wallpaper"""
self.set_random_wallpaper()

View File

@ -21,6 +21,7 @@ class English:
self.msg_refresh = "Refresh"
self.msg_clear = "Clear"
self.msg_stop = "Stop"
self.msg_pause = "Pause"
self.msg_search = "Search"
self.msg_random = "Random"
self.msg_exit = "Exit"
@ -59,6 +60,7 @@ class English:
self.tip_exit = "Exit the application"
self.tip_transition = "Choose transition type"
self.tip_mpv_stop = "Stop all mpv processes"
self.tip_mpv_pause = "Play/Pause video wallpaper"
class German:
@ -82,6 +84,7 @@ class German:
self.msg_random = "Zufällig"
self.msg_clear = "Löschen"
self.msg_stop = "Stopp"
self.msg_pause = "Pause"
self.msg_search = "Suchen"
self.msg_options = "Optionen"
self.msg_exit = "Beenden"
@ -119,7 +122,7 @@ class German:
self.tip_exit = "Das Programm beenden"
self.tip_transition = "Übergangstyp auswählen"
self.tip_mpv_stop = "Stoppe alle mpv-Prozesse"
self.tip_mpv_pause = "Pause Video-Wallpaper"
class French:
def __init__(self):
@ -142,6 +145,7 @@ class French:
self.msg_random = "Aléatoire"
self.msg_clear = "Effacer"
self.msg_stop = "Arrêter"
self.msg_pause = "Pause"
self.msg_search = "Rechercher"
self.msg_options = "Options"
self.msg_exit = "Quitter"
@ -179,6 +183,7 @@ class French:
self.tip_exit = "Quitter l'application"
self.tip_transition = "Choisissez le type de transition"
self.tip_mpv_stop = "Arrêter tous les processus mpv"
self.tip_mpv_pause = "Pause du fond d'écran vidéo"
class Polish:
def __init__(self):
@ -201,6 +206,7 @@ class Polish:
self.msg_random = "Losowo"
self.msg_clear = "Wyczyść"
self.msg_stop = "Zatrzymaj"
self.msg_pause = "Pauza"
self.msg_search = "Szukaj"
self.msg_options = "Opcje"
self.msg_exit = "Wyjście"
@ -238,6 +244,7 @@ class Polish:
self.tip_exit = "Wyjdź z aplikacji"
self.tip_transition = "Wybierz typ przejścia"
self.tip_mpv_stop = "Zatrzymaj wszystkie procesy mpv"
self.tip_mpv_pause = "Pauza tapety wideo"
class Russian:
def __init__(self):
@ -259,7 +266,8 @@ class Russian:
self.msg_refresh = "Обновить"
self.msg_random = "Случайно"
self.msg_clear = "Очистить"
self.msg_stop = "Остановить"
self.msg_stop = "Стоп"
self.msg_pause = "Пауза"
self.msg_search = "Поиск"
self.msg_options = "Опции"
self.msg_exit = "Выход"
@ -297,6 +305,7 @@ class Russian:
self.tip_exit = "Выйти из приложения"
self.tip_transition = "Выберите тип перехода"
self.tip_mpv_stop = "Остановить все mpv процессы"
self.tip_mpv_pause = "Плей/пауза видео-обоев"
class Belarusian:
@ -320,6 +329,7 @@ class Belarusian:
self.msg_random = "Выпадкова"
self.msg_clear = "Ачысціць"
self.msg_stop = "Стоп"
self.msg_pause = "Паўза"
self.msg_search = "Шукаць"
self.msg_options = "Опцыі"
self.msg_exit = "Вынахад"
@ -357,6 +367,7 @@ class Belarusian:
self.tip_exit = "Выйсці з прыкладання"
self.tip_transition = "Выберыце тып пераходу"
self.tip_mpv_stop = "Спыніць усе працэсы mpv"
self.tip_mpv_pause = "Паўза відэа-абояў"
class Chinese:
@ -380,6 +391,7 @@ class Chinese:
self.msg_random = "随机"
self.msg_clear = "清除"
self.msg_stop = "停止"
self.msg_pause = "暂停"
self.msg_search = "搜索"
self.msg_options = "选项"
self.msg_exit = "退出"
@ -417,6 +429,7 @@ class Chinese:
self.tip_exit = "退出应用程序"
self.tip_transition = "选择过渡类型"
self.tip_mpv_stop = "停止所有 mpv 进程"
self.tip_mpv_pause = "暂停视频壁纸"
class Spanish:
def __init__(self):
@ -439,6 +452,7 @@ class Spanish:
self.msg_random = "Aleatorio"
self.msg_clear = "Borrar"
self.msg_stop = "Detener"
self.msg_pause = "Pausa"
self.msg_search = "Buscar"
self.msg_options = "Opciones"
self.msg_exit = "Salir"
@ -476,6 +490,7 @@ class Spanish:
self.tip_exit = "Cerrar la aplicación"
self.tip_transition = "Elige el tipo de transición"
self.tip_mpv_stop = "Detener todos los procesos de mpv"
self.tip_mpv_pause = "Pausar fondo de pantalla de video"
def load_language(lang):