alex-courtis / xlayoutdisplay

Detects and arranges linux display outputs, using XRandR for detection and xrandr for arrangement.
Apache License 2.0
178 stars 15 forks source link

Follow XDG Base Directory Specification #11

Closed stnley closed 3 years ago

stnley commented 3 years ago

I think it would be an improvement if the config file locations followed XDG spec. I like to keep my .dotfiles out of my $HOME directory. Perhaps if $XDG_CONFIG_HOME is set use that before $HOME as the spec indicates?

I may try my hand a PR but I don't know C++ so it may take some time :smiley:

https://github.com/alex-courtis/xlayoutdisplay/blob/68b8f5811707ea72479b97c00fccf3e9385a790a/src/util.h#L38

alex-courtis commented 3 years ago

Created PR https://github.com/alex-courtis/xlayoutdisplay/pull/12

I'd be grateful if you reviewed and tested that branch @stnley

stnley commented 3 years ago

@alex-courtis That works perfectly!

~/.config
❯ pwd                          
/home/michael/.config

~/.config
❯ echo $XDG_CONFIG_HOME        
/home/michael/.config

~/.config
❯ ls -la | grep .xlayoutdisplay
lrwxrwxrwx  1 michael michael   53 Jun 30 11:08 .xlayoutdisplay -> /home/michael/.dotfiles/xlayoutdisplay/xlayoutdisplay

~/.config
❯ cat .xlayoutdisplay                           
# all options here will be overridden by command line options

# mirror outputs using the lowest common resolution
#mirror=true

# order of outputs
#order=DP-1
#order=HDMI-0

# primary output
#primary=eDP-0

# suppress output
#quiet=true

# override calculated DPI
dpi=192

~/.config
❯ xlayoutdisplay -n
eDP-1 connected 31cm/17cm
 + 1920x1080 60Hz
   1920x1080 60Hz
   1920x1080 60Hz
   1920x1080 60Hz
  !1920x1080 60Hz
   1680x1050 60Hz
   1680x1050 60Hz
   1400x1050 60Hz
   1600x900 60Hz
   1600x900 60Hz
   1600x900 60Hz
   1600x900 60Hz
   1280x1024 60Hz
   1400x900 60Hz
   1400x900 60Hz
   1280x960 60Hz
   1440x810 60Hz
   1440x810 60Hz
   1368x768 60Hz
   1368x768 60Hz
   1280x800 60Hz
   1280x800 60Hz
   1280x800 60Hz
   1280x800 60Hz
   1280x720 60Hz
   1280x720 60Hz
   1280x720 60Hz
   1280x720 60Hz
   1024x768 60Hz
   1024x768 60Hz
   960x720 60Hz
   928x696 60Hz
   896x672 60Hz
   1024x576 60Hz
   1024x576 60Hz
   1024x576 60Hz
   1024x576 60Hz
   960x600 60Hz
   960x600 60Hz
   960x540 60Hz
   960x540 60Hz
   960x540 60Hz
   960x540 60Hz
   800x600 60Hz
   800x600 60Hz
   800x600 56Hz
   840x525 60Hz
   840x525 60Hz
   864x486 60Hz
   864x486 60Hz
   700x525 60Hz
   800x450 60Hz
   800x450 60Hz
   640x512 60Hz
   700x450 60Hz
   700x450 60Hz
   640x480 60Hz
   640x480 60Hz
   720x405 60Hz
   720x405 59Hz
   684x384 60Hz
   684x384 60Hz
   640x400 60Hz
   640x400 60Hz
   640x360 60Hz
   640x360 60Hz
   640x360 60Hz
   640x360 59Hz
   512x384 60Hz
   512x288 60Hz
   512x288 60Hz
   480x270 60Hz
   480x270 60Hz
   400x300 60Hz
   400x300 56Hz
   432x243 60Hz
   432x243 60Hz
   320x240 60Hz
   360x202 60Hz
   360x202 59Hz
   320x180 60Hz
   320x180 59Hz
HDMI-1 disconnected
DP-1 active 80cm/33cm 3440x1440+0+0 60Hz
*+!3440x1440 60Hz
   2560x1440 60Hz
   2560x1080 60Hz
   2560x1080 60Hz
   2560x1080 60Hz
   1720x1440 60Hz
   1920x1080 60Hz
   1920x1080 50Hz
   1920x1080 60Hz
   1920x1080 60Hz
   1920x1080 50Hz
   1920x1080 60Hz
   1600x1200 60Hz
   1280x1024 75Hz
   1280x1024 60Hz
   1280x800 60Hz
   1152x864 75Hz
   1280x720 60Hz
   1280x720 50Hz
   1280x720 60Hz
   1024x768 75Hz
   1024x768 60Hz
   800x600 75Hz
   800x600 60Hz
   720x576 50Hz
   720x480 60Hz
   720x480 60Hz
   640x480 75Hz
   640x480 60Hz
   640x480 60Hz
   720x400 70Hz
DP-2 disconnected
DP-3 disconnected
DP-4 disconnected
*current +preferred !optimal

laptop lid closed

calculated DPI 108 for output DP-1
overriding with provided DPI 192

xrandr \
 --dpi 192 \
 --output eDP-1 --off \
 --output HDMI-1 --off \
 --output DP-1 --mode 3440x1440 --rate 60 --pos 0x0 --primary \
 --output DP-2 --off \
 --output DP-3 --off \
 --output DP-4 --off

echo "Xft.dpi: 192" | xrdb -merge
alex-courtis commented 3 years ago

Thank you @stnley

Merged, with AUR 1.2.0 release incoming.