mirror of
https://github.com/anufrievroman/waypaper.git
synced 2024-11-22 07:22:19 +03:00
Add --monitor check and removed get_monitors.py with improved replacement code
--moniter argument checks now fails if --wallpaper or --random is not provided.\nRemoved and replaced get_monitors.py with authors suggestion. Now sets MONITORS_OPTIONS with one line in options.py instead of using a whole other module file.
This commit is contained in:
parent
413e6125d6
commit
67330ef928
@ -50,7 +50,11 @@ def run():
|
||||
cf.check_validity()
|
||||
|
||||
# Set monitor from user arguments
|
||||
if args.monitor:
|
||||
if args.monitor and not args.wallpaper and not args.random:
|
||||
print("--monitor Error! Requires an image to be set\nUse --wallpaper or --random")
|
||||
sys.exit(0)
|
||||
|
||||
if args.monitor and args.wallpaper or args.random:
|
||||
monitor = args.monitor
|
||||
|
||||
# Set wallpaper from user arguments
|
||||
|
@ -6,8 +6,8 @@ import shutil
|
||||
|
||||
from pathlib import Path
|
||||
from typing import List
|
||||
from screeninfo import get_monitors
|
||||
|
||||
from waypaper.options import get_monitor_names
|
||||
from waypaper.options import IMAGE_EXTENSIONS, BACKEND_OPTIONS, MONITOR_OPTIONS
|
||||
|
||||
|
||||
@ -112,3 +112,11 @@ def check_installed_backends() -> List[str]:
|
||||
if is_installed:
|
||||
installed_backends.append(backend)
|
||||
return installed_backends
|
||||
|
||||
|
||||
def get_monitor_names() -> List[str]:
|
||||
"""Obtain the list of plugged monitors"""
|
||||
connected_monitors: List[str] = []
|
||||
for m in get_monitors():
|
||||
connected_monitors.append(m.name)
|
||||
return connected_monitors
|
||||
|
@ -1,10 +0,0 @@
|
||||
from typing import List
|
||||
|
||||
from screeninfo import get_monitors
|
||||
|
||||
def get_monitor_names() -> List[str]:
|
||||
"""Obtain the list of plugged monitors"""
|
||||
connected_monitors: List[str] = []
|
||||
for m in get_monitors():
|
||||
connected_monitors.append(m.name)
|
||||
return connected_monitors
|
@ -1,5 +1,7 @@
|
||||
from typing import List, Dict
|
||||
from waypaper.getmonitors import get_monitor_names
|
||||
from screeninfo import get_monitors
|
||||
|
||||
connected_monitors: List[str] = [m.name for m in get_monitors()]
|
||||
|
||||
BACKEND_OPTIONS: List[str] = ["none", "swaybg", "swww", "feh", "wallutils", "hyprpaper", "mpvpaper"]
|
||||
FILL_OPTIONS: List[str] = ["fill", "stretch", "fit", "center", "tile"]
|
||||
@ -9,7 +11,7 @@ SORT_DISPLAYS: Dict[str, str] = {
|
||||
"namerev": "Name ↑",
|
||||
"date": "Date ↓",
|
||||
"daterev": "Date ↑"}
|
||||
MONITOR_OPTIONS: List[str] = get_monitor_names()
|
||||
MONITOR_OPTIONS: List[str] = connected_monitors
|
||||
|
||||
VIDEO_EXTENSIONS: List[str] = ['.webm', '.mkv', '.flv', '.vob', '.ogv', '.ogg', '.rrc', '.gifv', '.mng', '.mov',
|
||||
'.avi', '.qt', '.wmv', '.yuv', '.rm', '.asf', '.amv', '.mp4', '.m4p', '.m4v',
|
||||
|
Loading…
Reference in New Issue
Block a user