added layout switcher for archfw

This commit is contained in:
Rick van Lieshout 2025-01-13 22:49:28 +01:00
parent 617ba5815d
commit 8d2f51b64a
5 changed files with 88 additions and 9 deletions

View File

@ -1,8 +1,7 @@
Xft.antialias: true
Xft.hinting: true Xft.hinting: true
Xft.rgba: rgba
Xft.hintstyle: hintslight
Xcursor.size: 20
Xft.dpi: 150
rofi.dpi: 150 rofi.dpi: 150
Xcursor.size: 20
Xft.hintstyle: hintslight
Xft.rgba: rgba
Xft.antialias: true
Xft.dpi: 150

4
computers/archfw/.bashrc Normal file
View File

@ -0,0 +1,4 @@
#!/bin/bash
alias dock='bash ~/dotfiles/computers/archfw/displaySwitch.sh docked'
alias undock='bash ~/dotfiles/computers/archfw/displaySwitch.sh undocked'
alias displaySwitch='bash ~/dotfiles/computers/archfw/displaySwitch.sh'

View File

@ -0,0 +1,74 @@
#!/bin/bash
# Define the layouts
layouts=("undocked" "docked")
# Define the settings for each layout
declare -A undocked_settings=(
["Xft.antialias"]="true"
["Xft.hinting"]="true"
["Xft.rgba"]="rgba"
["Xft.hintstyle"]="hintslight"
["Xcursor.size"]="20"
["Xft.dpi"]="150"
["rofi.dpi"]="150"
)
declare -A docked_settings=(
["Xft.antialias"]="true"
["Xft.hinting"]="true"
["Xft.rgba"]="rgba"
["Xft.hintstyle"]="hintslight"
["Xcursor.size"]="20"
["Xft.dpi"]="120"
["rofi.dpi"]="120"
)
function updateXSettings() {
local dpi=$1
local dpi_value=$((dpi * 1024))
sed -i -E "/Xft\/DPI/s/[0-9]+/$dpi_value/" ~/.xsettingsd
killall -HUP xsettingsd
}
function applyLayout() {
local layout=$1
case $layout in
"undocked")
xrandr --output eDP --primary --mode 2880x1920 --pos 0x0 --rotate normal --output DisplayPort-0 --off --output DisplayPort-1 --off --output DisplayPort-2 --off --output DisplayPort-3 --off --output DisplayPort-4 --off --output DisplayPort-5 --off --output DisplayPort-6 --off --output DisplayPort-7 --off
updateXResources undocked_settings
updateXSettings 150
;;
"docked")
xrandr --output eDP --off --output DisplayPort-0 --off --output DisplayPort-1 --off --output DisplayPort-2 --off --output DisplayPort-3 --primary --mode 2560x1440 --pos 0x0 --rotate normal --output DisplayPort-4 --off --output DisplayPort-5 --off --output DisplayPort-6 --off --output DisplayPort-7 --off
updateXResources docked_settings
updateXSettings 120
;;
*)
echo "Unknown layout: $layout"
exit 1
;;
esac
}
function updateXResources() {
local -n settings=$1
true >~/.Xresources
for key in "${!settings[@]}"; do
echo "$key: ${settings[$key]}" >>~/.Xresources
done
xrdb -merge ~/.Xresources
}
layout=$1
if [ -z "$layout" ]; then
layout=$(zenity --list --title="Select Monitor Layout" --column="Layout" "${layouts[@]}")
fi
if [ -n "$layout" ]; then
applyLayout "$layout"
i3-msg restart
else
echo "No layout selected."
exit 1
fi

View File

@ -1,3 +1,5 @@
#!/bin/bash #!/bin/bash
MY_PATH=$PWD/computers/archfw MY_PATH=$PWD/computers/archfw
ln -sf "$MY_PATH/.Xresources" ~/.Xresources
# custom (laptop specific) bashrc thingies :)
ln -sf "$MY_PATH/.bashrc" ~/.custom

View File

@ -4,8 +4,8 @@
<property name="last-view" type="string" value="ThunarIconView"/> <property name="last-view" type="string" value="ThunarIconView"/>
<property name="last-icon-view-zoom-level" type="string" value="THUNAR_ZOOM_LEVEL_100_PERCENT"/> <property name="last-icon-view-zoom-level" type="string" value="THUNAR_ZOOM_LEVEL_100_PERCENT"/>
<property name="last-window-width" type="int" value="1416"/> <property name="last-window-width" type="int" value="1416"/>
<property name="last-window-height" type="int" value="917"/> <property name="last-window-height" type="int" value="1851"/>
<property name="last-window-maximized" type="bool" value="false"/> <property name="last-window-maximized" type="bool" value="true"/>
<property name="last-separator-position" type="int" value="229"/> <property name="last-separator-position" type="int" value="229"/>
<property name="misc-single-click" type="bool" value="false"/> <property name="misc-single-click" type="bool" value="false"/>
<property name="misc-thumbnail-mode" type="string" value="THUNAR_THUMBNAIL_MODE_ALWAYS"/> <property name="misc-thumbnail-mode" type="string" value="THUNAR_THUMBNAIL_MODE_ALWAYS"/>