DaemonForums  

Go Back   DaemonForums > OpenBSD > OpenBSD Packages and Ports

OpenBSD Packages and Ports Installation and upgrading of packages and ports on OpenBSD.

Reply
 
Thread Tools Display Modes
  #1   (View Single Post)  
Old 27th October 2023
unicorn unicorn is offline
Fdisk Soldier
 
Join Date: Apr 2020
Posts: 60
Default openbsd-backgrounds

I had installed openbsd-backgrounds, how to use it? thanks
Reply With Quote
  #2   (View Single Post)  
Old 27th October 2023
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,105
Default

If you are using the default X11 display manager xenodm(1), then /usr/local/bin/openbsd-wallpaper will be executed for you on log in. If not, you'll have to provision the script manually.
Reply With Quote
  #3   (View Single Post)  
Old 28th October 2023
unicorn unicorn is offline
Fdisk Soldier
 
Join Date: Apr 2020
Posts: 60
Default

I use xendom, but it's the same as before, there's no wallpaper shown.
Reply With Quote
  #4   (View Single Post)  
Old 28th October 2023
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,105
Default

Check provisioning. Do you have the xwallpaper package installed? It is not an automatically installed dependency, but the package description for openbsd-backgrounds description notes it as a requirement. It probably should be a dependency so that it gets automatically installed.
Code:
$ pkg_info openbsd-backgrounds
Information for inst:openbsd-backgrounds-3.1

Comment:
pictures for your background by OpenBSD developers

Description:
This is a compilation of photos taken by OpenBSD developers,
suitable for use as background pictures.

Those pictures have been released under CC-By 4.0 by the individual artists.

This comes with a small script (openbsd-wallpaper)
that requires a recent xwallpaper to run

Maintainer: Marc Espie <[deprecated]>

WWW: https://github.com/marcespie/openbsd-backgrounds
Reply With Quote
  #5   (View Single Post)  
Old 28th October 2023
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,105
Default

My mistake, xwallpaper is already is identified as a dependency, and has been since 2019. So xwallpaper should be already installed.

I misremembered my provisioning. I'm sorry.

I had manually edited /etc/X11/xenodm/Xsetup_0, which -- by default -- has a call to /usr/local/bin/openbsd-wallpaper commented out. I'd uncommented it.
Reply With Quote
  #6   (View Single Post)  
Old 15th January 2024
unicorn unicorn is offline
Fdisk Soldier
 
Join Date: Apr 2020
Posts: 60
Default

I had uncommented lines below # then uncomment in /etc/X11/xenodm/Xsetup_0, and then run command rcctl restart xenodm && exit, but wallpaper didn't show up.
Reply With Quote
  #7   (View Single Post)  
Old 15th January 2024
jggimi's Avatar
jggimi jggimi is offline
More noise than signal
 
Join Date: May 2008
Location: USA
Posts: 8,105
Default

Double check your changes. The contents of /etc/X11/xenodm/Xsetup_0 should look like this:
Code:
#!/bin/sh
# $OpenBSD: Xsetup_0.in,v 1.1 2021/08/30 15:38:27 matthieu Exp $

prefix="/usr/X11R6"
exec_prefix="${prefix}"

${exec_prefix}/bin/xsetroot -fg \#6f6f6f -bg \#bfbfbf -bitmap ${prefix}/include/X11/bitmaps/root_weave

${exec_prefix}/bin/xconsole -geometry 480x130-0-0 -daemon -notify -verbose -fn fixed -exitOnFail

#  install package openbsd-backgrounds
#  then uncomment:
#
 if test -x /usr/local/bin/openbsd-wallpaper
 then
     /usr/local/bin/openbsd-wallpaper
 fi

 sxpm OpenBSD.xpm &
Reply With Quote
  #8   (View Single Post)  
Old 16th January 2024
unicorn unicorn is offline
Fdisk Soldier
 
Join Date: Apr 2020
Posts: 60
Default

it's OK now, very good wallpapers!
Reply With Quote
  #9   (View Single Post)  
Old 20th January 2024
unicorn unicorn is offline
Fdisk Soldier
 
Join Date: Apr 2020
Posts: 60
Default

How to let wallpaper automatically fill my screen? the wallpaper is not fullscreen
Reply With Quote
Old 20th January 2024
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
The Deliverator
 
Join Date: Dec 2015
Location: London
Posts: 495
Default

You could edit /usr/local/bin/openbsd-wallpaper and change line 51 to:
Code:
    args="$args --output $display --zoom $pic"
That will result in image clipping though; the standard --maximize option doesn't clip but adds black bars instead, which I presume is what you mean by "not fullscreen".

The --zoom option is actually the default so you could also just delete "--maximize" from that line.
Reply With Quote
Old 22nd January 2024
unicorn unicorn is offline
Fdisk Soldier
 
Join Date: Apr 2020
Posts: 60
Default

why my openbsd-wallpaper file's content differ from your's? my file have more than 100 lines. Shoud I replace it with your code?
my wallpaper has black blank on both sides horizontally.

Last edited by unicorn; 22nd January 2024 at 01:37 AM.
Reply With Quote
Old 22nd January 2024
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
The Deliverator
 
Join Date: Dec 2015
Location: London
Posts: 495
Default

I linked to OpenBSD's GitHub mirror, which shows the contents of the file in -current, the file hasn't been changed in 2 years so I am surprised yours is different.

Do you have a line with "--maximize"? If you share your version of the script I can tell you what to change.

Please remember to use [code][/code] tags when posting terminal output. Thanks.
Reply With Quote
Old 22nd January 2024
unicorn unicorn is offline
Fdisk Soldier
 
Join Date: Apr 2020
Posts: 60
Default

see my file
Code:
#! /usr/bin/perl
# 
# Copyright (c) 2019 Marc Espie <espie@openbsd.org>
# 
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
# 
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# 
use strict;
use warnings;

use List::Util;
use File::Find;
use OpenBSD::Subst;

sub farey
{
	my ($x, $N) = @_;
    	my ($a, $b) = (0, 1);
    	my ($c, $d) = (1, 0);
	while ($b <= $N && $d <= $N) {
		my $mediant = ($a+$c)/($b+$d);
		if ($x == $mediant) {
			if ($b + $d <= $N) {
				return ($a+$c, $b+$d);
			} elsif ($d > $b) {
				return ($c, $d);
			} else {
				return ($a, $b);
			}
		} elsif ($x > $mediant) {
			($a, $b) = ($a+$c, $b+$d);
		} else {
			($c, $d) = ($a+$c, $b+$d);
		}
	}
	if ($b > $N) {
		return ($c, $d);
	} else {
		return ($a, $b);
	}
}

sub add_dir
{
	my ($l, $dir) = @_;
	if (!-d $dir) {
		$dir = 'pictures';
	}
	find(
	    sub { 
		push @$l, $File::Find::name if -f $_; 
	    }, $dir);
}

my $s = OpenBSD::Subst->new;
$s->add('TRUEPREFIX' => '/usr/local');
$s->add('LOCALBASE' => '/usr/local');

my $prefix = $s->do('/usr/local');
my $localbase = $s->do('/usr/local');

if (!-x "$localbase/bin/xwallpaper") {
	print STDERR "You must pkg_add xwallpaper\n";
	exit 1;
}
my $imagedir = "$prefix/share/openbsd-backgrounds";
if (@ARGV != 0) {
	$imagedir = shift;
}
$ENV{PATH} = "${localbase}/bin:/usr/bin:/usr/X11R6/bin";

open(my $pipe, "-|", "xrandr") or die "Can't run xrandr: $!";
my $monitors = {};

while (<$pipe>) {
	chomp;
	next unless m/\bconnected\b/;
	my ($name, undef, @r) = split(/\s+/, $_);
	my $monitor = $monitors->{$name} = {name => $name};
	if ($r[0] eq 'primary') {
		$monitor->{primary} = 1;
		shift @r;
	}
	my $res = shift @r;
	if ($res =~ m/(\d+)x(\d+)\+\d+\+\d+/) {
		($monitor->{a}, $monitor->{b}) = farey($1/$2, 25);
	}
	$monitor->{portrait} = ($r[0] eq 'left' or $r[0] eq 'right');
}
close($pipe);

chdir($imagedir) or die $!;

my @command = (qw(xwallpaper));
# build the command on each monitor
for my $m (values %$monitors) {
	my @l;
	my $ratio = "$m->{a}:$m->{b}";
	my $i = "aspect-$ratio";
	# let's cheat a bit
	if (!-r $i && $ratio eq '5:8') {
		$i = 'aspect-9:16';
	}
	if (-r $i) {
		open my $file, "<", $i;
		while (<$file>) {
			chomp;
			if (m/^\+(.*)/) {
				add_dir(\@l, $1);
			}
			push(@l, $_);
		}
	} else {
		my $dir = $m->{a} < $m->{b} ? "portrait" : "landscape";
		add_dir(\@l, $dir);
	}
	@l = (List::Util::shuffle @l);
	my @r = split(/\s+/, $l[0]);
	unshift(@r, '--maximize') if @r == 1;
	push(@command, '--output', $m->{name}, @r);
}
print "Running ", join(' ', @command), "\n";
exec {$command[0]} @command;
Reply With Quote
Old 22nd January 2024
Head_on_a_Stick's Avatar
Head_on_a_Stick Head_on_a_Stick is offline
Real Name: Matthew
The Deliverator
 
Join Date: Dec 2015
Location: London
Posts: 495
Default

From the bottom of the script, 5th line up:
Quote:
Originally Posted by unicorn View Post
Code:
	unshift(@r, '--maximize') if @r == 1;
	push(@command, '--output', $m->{name}, @r);
}
print "Running ", join(' ', @command), "\n";
exec {$command[0]} @command;
Change '--maximize' to '--zoom'.

Disclaimer: I don't know perl
__________________
Para todos todo, para nosotros nada
Reply With Quote
Old 23rd January 2024
unicorn unicorn is offline
Fdisk Soldier
 
Join Date: Apr 2020
Posts: 60
Default

it works! thanks man
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:28 PM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Content copyright © 2007-2010, the authors
Daemon image copyright ©1988, Marshall Kirk McKusick