x11/autorandr: Add a new port
Autorandr allows for auto-detecting displays and configuring them with xrandr. Although autorandr is present in the PyPI repositories, I decided to not prefix this package with py*- as no other package managers do that. Autorandr should be considered an end-user application. WWW: https://github.com/phillipberndt/autorandr
This commit is contained in:
parent
2f6e310152
commit
1d91011b3e
6 changed files with 113 additions and 0 deletions
|
@ -17,6 +17,7 @@
|
|||
SUBDIR += arandr
|
||||
SUBDIR += arcan-trayicon
|
||||
SUBDIR += aterm
|
||||
SUBDIR += autorandr
|
||||
SUBDIR += babl
|
||||
SUBDIR += bbappconf
|
||||
SUBDIR += bbdock
|
||||
|
|
54
x11/autorandr/Makefile
Normal file
54
x11/autorandr/Makefile
Normal file
|
@ -0,0 +1,54 @@
|
|||
PORTNAME= autorandr
|
||||
DISTVERSION= 1.12.1
|
||||
CATEGORIES= x11
|
||||
PATCH_SITES= https://github.com/phillipberndt/autorandr/commit/
|
||||
PATCHFILES= 2bc71d562765e2023b26a31c485769612e3eb91e.patch:-p1 # PR 282
|
||||
|
||||
MAINTAINER= 0mp@FreeBSD.org
|
||||
COMMENT= Auto-detect displays and configure them with xrandr
|
||||
|
||||
LICENSE= GPLv3
|
||||
LICENSE_FILE= ${WRKSRC}/gpl-3.0.txt
|
||||
|
||||
BUILD_DEPENDS= gsed:textproc/gsed
|
||||
RUN_DEPENDS= xrandr:x11/xrandr
|
||||
|
||||
USES= gmake pkgconfig python:3.3-3.10 shebangfix xorg
|
||||
# Use GitHub instead of MASTER_SITES=CHEESESHOP to get additional files like
|
||||
# the manual page and the license.
|
||||
USE_GITHUB= yes
|
||||
GH_ACCOUNT= phillipberndt
|
||||
USE_PYTHON= autoplist concurrent distutils
|
||||
USE_XORG= xcb
|
||||
|
||||
MAKE_ARGS= BASH_COMPLETIONS_DIR=${PREFIX}/share/bash-completion/completions \
|
||||
PREFIX=${PREFIX} \
|
||||
XDG_AUTOSTART_DIR=${PREFIX}/etc/xdg/autostart
|
||||
BINARY_ALIAS= sed=gsed
|
||||
|
||||
PLIST_FILES= bin/${PORTNAME}-launcher \
|
||||
etc/xdg/autostart/autorandr-launcher.desktop \
|
||||
share/bash-completion/completions/autorandr \
|
||||
share/man/man1/${PORTNAME}.1.gz
|
||||
|
||||
_EXTRA_BUILD_TARGETS= contrib/autorandr_launcher/autorandr-launcher
|
||||
_EXTRA_INSTALL_TARGETS= install_bash_completion install_launcher \
|
||||
install_manpage
|
||||
|
||||
# Regenerate the patches with:
|
||||
# make clean extract do-patch PATCHFILES=
|
||||
post-patch:
|
||||
${REINPLACE_CMD} 's|%%PREFIX%%|${PREFIX}|g' \
|
||||
${WRKSRC}/${PORTNAME}.py \
|
||||
${WRKSRC}/contrib/autorandr_launcher/autorandr_launcher.c
|
||||
|
||||
post-build:
|
||||
${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${BUILD_WRKSRC} ${MAKE_ARGS} \
|
||||
${_EXTRA_BUILD_TARGETS}
|
||||
|
||||
post-install:
|
||||
${SETENV} ${MAKE_ENV} ${MAKE_CMD} -C ${INSTALL_WRKSRC} ${MAKE_ARGS} \
|
||||
${_EXTRA_INSTALL_TARGETS}
|
||||
${STRIP_CMD} ${STAGEDIR}${PREFIX}/bin/${PORTNAME}-launcher
|
||||
|
||||
.include <bsd.port.mk>
|
5
x11/autorandr/distinfo
Normal file
5
x11/autorandr/distinfo
Normal file
|
@ -0,0 +1,5 @@
|
|||
TIMESTAMP = 1647355348
|
||||
SHA256 (phillipberndt-autorandr-1.12.1_GH0.tar.gz) = 2fa2fa6e76a208dc6e2f3a5c743aef14b8b3fd0ed18132e25f79cde3a00b0309
|
||||
SIZE (phillipberndt-autorandr-1.12.1_GH0.tar.gz) = 45550
|
||||
SHA256 (2bc71d562765e2023b26a31c485769612e3eb91e.patch) = e3e7335d2cd2aebe9fe8b633f570bbd22ecf0b82ada392ee5c8da1a2e41f6b34
|
||||
SIZE (2bc71d562765e2023b26a31c485769612e3eb91e.patch) = 3801
|
38
x11/autorandr/files/patch-autorandr.py
Normal file
38
x11/autorandr/files/patch-autorandr.py
Normal file
|
@ -0,0 +1,38 @@
|
|||
--- autorandr.py.orig 2021-12-22 12:28:03 UTC
|
||||
+++ autorandr.py
|
||||
@@ -121,6 +121,8 @@ Usage: autorandr [options]
|
||||
def is_closed_lid(output):
|
||||
if not re.match(r'(eDP(-?[0-9]\+)*|LVDS(-?[0-9]\+)*)', output):
|
||||
return False
|
||||
+ print("Checking for a closed lid via /proc is not supported on FreeBSD.", file=sys.stderr)
|
||||
+ return False
|
||||
lids = glob.glob("/proc/acpi/button/lid/*/state")
|
||||
if len(lids) == 1:
|
||||
state_file = lids[0]
|
||||
@@ -1114,7 +1116,7 @@ def exec_scripts(profile_path, script_name, meta_infor
|
||||
if profile_path:
|
||||
candidate_directories.append(profile_path)
|
||||
candidate_directories.append(user_profile_path)
|
||||
- for config_dir in os.environ.get("XDG_CONFIG_DIRS", "/etc/xdg").split(":"):
|
||||
+ for config_dir in os.environ.get("XDG_CONFIG_DIRS", "%%PREFIX%%/etc/xdg").split(":"):
|
||||
candidate_directories.append(os.path.join(config_dir, "autorandr"))
|
||||
|
||||
for folder in candidate_directories:
|
||||
@@ -1191,6 +1193,8 @@ def dispatch_call_to_sessions(argv):
|
||||
sys.exit(1)
|
||||
os.waitpid(child_pid, 0)
|
||||
|
||||
+ print("/proc is not supported on FreeBSD; aborting.", file=sys.stderr)
|
||||
+ sys.exit(1)
|
||||
for directory in os.listdir("/proc"):
|
||||
directory = os.path.join("/proc/", directory)
|
||||
if not os.path.isdir(directory):
|
||||
@@ -1321,7 +1325,7 @@ def main(argv):
|
||||
try:
|
||||
# Load profiles from each XDG config directory
|
||||
# The XDG spec says that earlier entries should take precedence, so reverse the order
|
||||
- for directory in reversed(os.environ.get("XDG_CONFIG_DIRS", "/etc/xdg").split(":")):
|
||||
+ for directory in reversed(os.environ.get("XDG_CONFIG_DIRS", "%%PREFIX%%/etc/xdg").split(":")):
|
||||
system_profile_path = os.path.join(directory, "autorandr")
|
||||
if os.path.isdir(system_profile_path):
|
||||
profiles.update(load_profiles(system_profile_path))
|
|
@ -0,0 +1,11 @@
|
|||
--- contrib/autorandr_launcher/autorandr_launcher.c.orig 2022-03-15 15:02:37 UTC
|
||||
+++ contrib/autorandr_launcher/autorandr_launcher.c
|
||||
@@ -38,7 +38,7 @@ static int ar_launch()
|
||||
pid_t pid = fork();
|
||||
if (pid == 0) {
|
||||
static char *argv[] =
|
||||
- { "/usr/bin/autorandr", "--change", "--default", "default", NULL };
|
||||
+ { "%%PREFIX%%/bin/autorandr", "--change", "--default", "default", NULL };
|
||||
execve(argv[0], argv, environ);
|
||||
exit(127);
|
||||
} else {
|
4
x11/autorandr/pkg-descr
Normal file
4
x11/autorandr/pkg-descr
Normal file
|
@ -0,0 +1,4 @@
|
|||
Automatically select an xrandr display configuration based on connected
|
||||
devices.
|
||||
|
||||
WWW: https://github.com/phillipberndt/autorandr
|
Loading…
Reference in a new issue