Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hook script not executed in some environments #349

Open
antimatter84 opened this issue May 15, 2023 · 1 comment
Open

Hook script not executed in some environments #349

antimatter84 opened this issue May 15, 2023 · 1 comment

Comments

@antimatter84
Copy link

antimatter84 commented May 15, 2023

On a laptop I have saved two profiles:

  • 4k: a 4k monitor at home, where I only use the 4k monitor
  • work: laptop monitor + two Full HD monitors in the office

Both profiles have a postswitch shell script which will adjust the font scaling factor in Cinnamon. While I use factor 1.0 with the "work" profile, I use factor 1.2 with the "4k" profile due to the HiDPI nature of the 4k monitor.

However, the work profile won't run as the font factor is still at 1.2 after I connecting the docking station at my work place. I have to adjust by hand.
The hook script at home does apparently run, as the font factor is always set to 1.2 (even after a day at the office with factor 1.0).

Both hook scripts are executable :

#!/bin/bash
gsettings set org.cinnamon.desktop.interface text-scaling-factor 1.0

Can you help?

Env: Ubuntu 22.04, Cinnamon desktop, latest autorandr version

@antimatter84 antimatter84 changed the title Hook script not executed in some evironment Hook script not executed in some environments May 23, 2023
@Hammermaniac
Copy link

Same issue for me, I have scripts that uses hydrapaper to set wallpapers according to the environment being set — I also use Ubuntu 22.04 LTS.

Scripts are:

  1. ~/.config/autorandr/default/postswitch
#!/bin/bash
# Put in a number of wallpapers equal to your maximum monitors number
touch /tmp/autorandr.txt
(
    flatpak run org.gabmus.hydrapaper -d -c "$HOME/personal/wallpapers/wallpaper1.jpg" "$HOME/personal/wallpapers/wallpaper2.jpg" "$HOME/personal/wallpapers/wallpaper3.jpg"
) > /tmp/autorandr.txt 2>&1
  1. ~/.config/autorandr/postswitch
#!/bin/bash
# Put in a number of wallpapers equal to your maximum monitors number
touch /tmp/autorandr.txt
(
    flatpak run org.gabmus.hydrapaper -d -c "$HOME/personal/wallpapers/wallpaper1.jpg"
) > /tmp/autorandr.txt 2>&1

It works perfectly when connecting it to a docking station (which has 2 displays connected via Display Port), however I can see that the script doesn't even get executed when disconnecting from the docking station, because I manually delete the /tmp/autorandr.txt file before connected and disconnecting, the file only gets created and populated when reconnecting to the docking station.

However, when forcing the config in either case with autorandr --load undocked --force and autorandr --load default --force they both work flawlessly. I've also tried using 1 script utilizing xrandr --query | grep <display> but that didn't work either due to the script not even executing when disconnecting from the docking station.

I have found a workaround that I'm quite happy with — when I lock my workstation (Meta+L) before disconnecting from the docking station, the script does in fact execute and it works well. Still, I thought I might add this comment seeing as it seems to be something specific to Ubuntu 22.04.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants