adi1090x / dynamic-wallpaper

A simple bash script to set wallpapers according to current time, using cron job scheduler.
GNU General Public License v3.0
1.91k stars 116 forks source link

Wallpaper doesn't change on startup #74

Closed JohnCosta27 closed 1 year ago

JohnCosta27 commented 3 years ago

Hi,

I find that the program works fine when changing the wallpaper every hour, but whenever I turn the computer on the wallpaper remains the same as it was when it turned off. This can be fixed manually by running "dwall -s " but I can't seem to do it automatically.

Here is system information.

System:    Kernel: 5.12.9-zen1-1-zen x86_64 bits: 64 compiler: gcc v: 11.1.0 
parameters: BOOT_IMAGE=/@/boot/vmlinuz-linux-zen root=UUID=dcdd569c-4c0c-43bb-8e1a-97cd54de1faf 
rw rootflags=subvol=@ quiet splash rd.udev.log_priority=3 vt.global_cursor_default=0 
systemd.unified_cgroup_hierarchy=1 loglevel=3 
Desktop: KDE Plasma 5.21.5 tk: Qt 5.15.2 info: latte-dock wm: kwin_x11 vt: 1 dm: SDDM 
Distro: Garuda Linux base: Arch Linux 
Machine:   Type: Laptop System: HP product: HP Pavilion Notebook v: Type1ProductConfigId serial: <filter> 
Chassis: type: 10 serial: <filter> 
Mobo: HP model: 8093 v: 89.32 serial: <filter> UEFI: Insyde v: F.74 date: 11/18/2015 
Battery:   ID-1: BAT0 charge: 4.3 Wh (16.2%) condition: 26.5/26.5 Wh (100.0%) volts: 14.1 min: 14.8 
model: Hewlett-Packard Primary type: Li-ion serial: N/A status: Discharging 
CPU:       Info: Dual Core model: Intel Core i3-5157U bits: 64 type: MT MCP arch: Broadwell family: 6 
model-id: 3D (61) stepping: 4 microcode: 2F cache: L2: 3 MiB 
flags: avx avx2 lm nx pae sse sse2 sse3 sse4_1 sse4_2 ssse3 bogomips: 19952 
Speed: 2396 MHz min/max: 500/2400 MHz Core speeds (MHz): 1: 2396 2: 2394 3: 2395 4: 2394 
Vulnerabilities: Type: itlb_multihit status: KVM: VMX unsupported 
Type: l1tf mitigation: PTE Inversion 
Type: mds mitigation: Clear CPU buffers; SMT vulnerable 
Type: meltdown mitigation: PTI 
Type: spec_store_bypass mitigation: Speculative Store Bypass disabled via prctl and seccomp 
Type: spectre_v1 mitigation: usercopy/swapgs barriers and __user pointer sanitization 
Type: spectre_v2 
mitigation: Full generic retpoline, IBPB: conditional, IBRS_FW, STIBP: conditional, RSB filling 
Type: srbds mitigation: Microcode 
Type: tsx_async_abort status: Not affected 
Graphics:  Device-1: Intel Iris Graphics 6100 vendor: Hewlett-Packard driver: i915 v: kernel 
bus-ID: 00:02.0 chip-ID: 8086:162b class-ID: 0300 
Device-2: Chicony HP Truevision HD type: USB driver: uvcvideo bus-ID: 1-3:2 chip-ID: 04f2:b50d 
class-ID: 0e02 serial: <filter> 
Display: x11 server: X.Org 1.20.11 compositor: kwin_x11 driver: loaded: intel 
unloaded: modesetting alternate: fbdev,vesa display-ID: :0 screens: 1 
Screen-1: 0 s-res: 1366x768 s-dpi: 96 s-size: 361x203mm (14.2x8.0") s-diag: 414mm (16.3") 
Monitor-1: eDP1 res: 1366x768 hz: 60 dpi: 102 size: 340x190mm (13.4x7.5") diag: 389mm (15.3") 
OpenGL: renderer: Mesa Intel Iris Graphics 6100 (BDW GT3) v: 4.6 Mesa 21.1.2 direct render: Yes 
Audio:     Device-1: Intel Broadwell-U Audio vendor: Hewlett-Packard driver: snd_hda_intel v: kernel 
bus-ID: 00:03.0 chip-ID: 8086:160c class-ID: 0403 
Device-2: Intel Wildcat Point-LP High Definition Audio vendor: Hewlett-Packard 
driver: snd_hda_intel v: kernel bus-ID: 00:1b.0 chip-ID: 8086:9ca0 class-ID: 0403 
Sound Server-1: ALSA v: k5.12.9-zen1-1-zen running: yes 
Sound Server-2: JACK v: 0.125.0 running: no 
Sound Server-3: PulseAudio v: 14.2 running: yes 
Sound Server-4: PipeWire v: 0.3.29 running: no 
Network:   Device-1: Intel Wireless 3165 driver: iwlwifi v: kernel port: 5040 bus-ID: 08:00.0 
chip-ID: 8086:3165 class-ID: 0280 
IF: wlo1 state: up mac: <filter> 
Device-2: Realtek RTL810xE PCI Express Fast Ethernet vendor: Hewlett-Packard driver: r8169 
v: kernel port: 3000 bus-ID: 09:00.0 chip-ID: 10ec:8136 class-ID: 0200 
IF: eno1 state: down mac: <filter> 
Bluetooth: Device-1: Intel Bluetooth wireless interface type: USB driver: btusb v: 0.8 bus-ID: 1-7:3 
chip-ID: 8087:0a2a class-ID: e001 
Report: bt-adapter ID: hci0 rfk-id: 0 state: up address: <filter> 
Drives:    Local Storage: total: 111.79 GiB used: 19.39 GiB (17.3%)
SMART Message: Unable to run smartctl. Root privileges required.
ID-1: /dev/sda maj-min: 8:0 vendor: Kingston model: SUV400S37120G size: 111.79 GiB block-size:
physical: 4096 B logical: 512 B speed: 6.0 Gb/s rotation: SSD serial: <filter> rev: 96R9
scheme: GPT
Partition: ID-1: / raw-size: 111.54 GiB size: 111.54 GiB (100.00%) used: 19.39 GiB (17.4%) fs: btrfs
dev: /dev/sda2 maj-min: 8:2
ID-2: /boot/efi raw-size: 256 MiB size: 252 MiB (98.46%) used: 546 KiB (0.2%) fs: vfat
dev: /dev/sda1 maj-min: 8:1
ID-3: /home raw-size: 111.54 GiB size: 111.54 GiB (100.00%) used: 19.39 GiB (17.4%) fs: btrfs
dev: /dev/sda2 maj-min: 8:2
ID-4: /var/log raw-size: 111.54 GiB size: 111.54 GiB (100.00%) used: 19.39 GiB (17.4%)
fs: btrfs dev: /dev/sda2 maj-min: 8:2
ID-5: /var/tmp raw-size: 111.54 GiB size: 111.54 GiB (100.00%) used: 19.39 GiB (17.4%)
fs: btrfs dev: /dev/sda2 maj-min: 8:2
Swap:      Kernel: swappiness: 10 (default 60) cache-pressure: 75 (default 100)
ID-1: swap-1 type: zram size: 1.92 GiB used: 0 KiB (0.0%) priority: 32767 dev: /dev/zram0
ID-2: swap-2 type: zram size: 1.92 GiB used: 0 KiB (0.0%) priority: 32767 dev: /dev/zram1
ID-3: swap-3 type: zram size: 1.92 GiB used: 0 KiB (0.0%) priority: 32767 dev: /dev/zram2
ID-4: swap-4 type: zram size: 1.92 GiB used: 0 KiB (0.0%) priority: 32767 dev: /dev/zram3
Sensors:   System Temperatures: cpu: 48.0 C mobo: N/A
Fan Speeds (RPM): N/A
Info:      Processes: 233 Uptime: 7m wakeups: 1 Memory: 7.69 GiB used: 2.53 GiB (32.9%) Init: systemd
v: 248 tool: systemctl Compilers: gcc: 11.1.0 clang: 12.0.0 Packages: pacman: 1252 lib: 295
Shell: fish v: 3.2.2 running-in: konsole inxi: 3.3.04
bnrobinson93 commented 3 years ago

Same issue here. Whereas it seems you're Arch based, I'm on Pop!_OS and tried creating an executable under /lib/systemd/system-sleep. For Arch users, I believe it'd be /usr/lib/pm-utils/sleep.d. The script does run on suspend/wake but the wallpaper does not run unless manually run after logging in. I've seen some have better luck with adding a line to their WM start script but that seems "hacky" and a standalone script to handle the update seems more stable, safer for the layperson (like me), and easier to update.

ekirchman commented 2 years ago

I used a systemd service, and it works quite well. I use Ubuntu, but it should work on any systemd system. I used this guide as reference.

I started by creating a bash script to run dwall set_dwall.sh, using the same environmental variables that I used in my crontab:

#!/bin/bash
env PATH=/usr/local/bin:/usr/bin DISPLAY=:0 DESKTOP_SESSION=Openbox DBUS_SESSION_BUS_ADDRESS="unix:path=/run/user/1000/bus" /usr/bin/dwall -s firewatch #switch out firewatch for wallpaper you want

Don't forget to add permissions: chmod +x /path/to/set_dwall.sh

From there, I created a systemd service, called /etc/systemd/system/dwall.service and it it, I made it like this, adding in my username and the env vars used in the crontab:

[Unit]
Description=Run set_dwall.sh
After=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

[Service]
ExecStart=/path/to/set_dwall.sh
User=my_user_name
Environment=All_vars_used_in crontab

[Install]
WantedBy=suspend.target hibernate.target hybrid-sleep.target suspend-then-hibernate.target

After that, I did a sudo systemctl enable dwall sudo systemctl start dwall and then sudo systemctl status dwall to check if everything was running fine. After suspending, and then resuming, it only takes a second before the wallpaper is updated to the one you want

amalthomas-exe commented 2 years ago

Is the issue solved ??

bnrobinson93 commented 2 years ago

Yes, that did the trick!

Message ID: @.***>

dtrunk90 commented 1 year ago

It's quite complicated with a systemd service. The readme mentions a @reboot cronjob but that didn't work for me so I just added the command at the end of my ~/.profile:

# Dynamic Wallpaper
env ... (all the variables here) dwall -s (the wallpaper set you want here)
adi1090x commented 1 year ago

Updated the readme.

dtrunk90 commented 1 year ago

@adi1090x bashrc file is not the right place for this. it's .profile. .bashrc will be executed on ssh logins as well.