1
0
mirror of https://github.com/alrayyes/dotfiles/ synced 2023-11-14 15:56:30 +00:00

feat: determine chassis type automatically

This commit is contained in:
Ryan Kes 2022-10-09 17:53:25 +02:00
parent b61b703372
commit 81dac1aca5
6 changed files with 14 additions and 13 deletions

View File

@ -1,4 +1,5 @@
{{- $type := promptStringOnce . "type" "Computer type (desktop|laptop)" -}} {{- $chassisType := "desktop" }}
{{- $chassisType = (output "hostnamectl" "--json=short" | mustFromJson).Chassis }}
[data] [data]
type = {{ $type | quote }} chassisType = {{ $chassisType| quote }}

View File

@ -2,7 +2,7 @@
! Xft settings ! Xft settings
!------------------------------------------------------------------------------- !-------------------------------------------------------------------------------
{{ if ne .type "desktop" }}Xft.dpi: 160{{- end }} {{ if ne .chassisType "desktop" }}Xft.dpi: 160{{- end }}
Xft.antialias: false Xft.antialias: false
Xft.rgba: rgb Xft.rgba: rgb
Xft.hinting: true Xft.hinting: true

View File

@ -23,7 +23,7 @@ font:
style: Bold Italic style: Bold Italic
size: {{ if eq .type "desktop" }}6.5{{ else }}8.5{{- end }} size: {{ if eq .chassisType "desktop" }}6.5{{ else }}8.5{{- end }}
colors: colors:
primary: primary:

View File

@ -6,7 +6,7 @@ function start_if_not_running
if [ (pgrep -u (id -u) -x "$PROCESS_NAME" | wc -l) -lt 1 ] if [ (pgrep -u (id -u) -x "$PROCESS_NAME" | wc -l) -lt 1 ]
if type -q $argv[1] if.chassisType -q $argv[1]
eval "$argv[1] &" eval "$argv[1] &"
end end
end end
@ -15,7 +15,7 @@ end
###---Start app in alacritty if not running already---### ###---Start app in alacritty if not running already---###
function start_shell_if_not_running function start_shell_if_not_running
if [ (pgrep -u (id -u) -x $argv[1] | wc -l) -lt 1 ] if [ (pgrep -u (id -u) -x $argv[1] | wc -l) -lt 1 ]
if type -q $argv[1] if.chassisType -q $argv[1]
eval "alacritty --class $argv[1],$argv[1] -e $argv[1] &" eval "alacritty --class $argv[1],$argv[1] -e $argv[1] &"
end end
end end
@ -35,7 +35,7 @@ sxhkd &
setxkbmap -option caps:escape setxkbmap -option caps:escape
###---Monitors---### ###---Monitors---###
{{- if eq .type "desktop" }} {{- if eq .chassisType "desktop" }}
bspc monitor DP-3 -d 2 3 4 5 6 7 8 9 0 bspc monitor DP-3 -d 2 3 4 5 6 7 8 9 0
bspc monitor DP-2 -d 1 bspc monitor DP-2 -d 1
xrandr --output DP-3 --primary --mode 3840x2160 --rotate normal --output DP-2 --mode 2560x1440 --pos 0x0 --rotate left xrandr --output DP-3 --primary --mode 3840x2160 --rotate normal --output DP-2 --mode 2560x1440 --pos 0x0 --rotate left
@ -51,7 +51,7 @@ killall -q polybar
while pgrep -u (id -u) -x polybar >/dev/null while pgrep -u (id -u) -x polybar >/dev/null
sleep 1 sleep 1
end end
{{- if eq .type "desktop" }} {{- if eq .chassisType "desktop" }}
polybar-monitor1 & polybar-monitor1 &
polybar-monitor2 & polybar-monitor2 &
{{ else }} {{ else }}
@ -60,7 +60,7 @@ polybar framework-bottom &
{{- end }} {{- end }}
###---Wallpaper & opacity---### ###---Wallpaper & opacity---###
{{- if eq .type "desktop" }} {{- if eq .chassisType "desktop" }}
xwallpaper --output DP-2 --zoom ~/.cache/wall2.png --output DP-3 --zoom ~/.cache/wall1.png & xwallpaper --output DP-2 --zoom ~/.cache/wall2.png --output DP-3 --zoom ~/.cache/wall1.png &
{{ else }} {{ else }}
xwallpaper --output eDP-1 --zoom ~/.cache/wall1.png & xwallpaper --output eDP-1 --zoom ~/.cache/wall1.png &
@ -122,7 +122,7 @@ start_if_not_running emacs
start_if_not_running element-desktop start_if_not_running element-desktop
start_if_not_running element-desktop-nightly start_if_not_running element-desktop-nightly
start_if_not_running gpodder start_if_not_running gpodder
{{- if eq .type "desktop" }}start_if_not_running slack{{ end }} {{- if eq .chassisType "desktop" }}start_if_not_running slack{{ end }}
pkill -f cleanfullscreen pkill -f cleanfullscreen
~/.local/bin/cleanfullscreen & ~/.local/bin/cleanfullscreen &

View File

@ -25,7 +25,7 @@
idle_threshold = 120 idle_threshold = 120
{{- if eq .type "desktop" }} {{- if eq .chassisType "desktop" }}
font = JoyPixels 10, Hack Nerd Font Mono 10 font = JoyPixels 10, Hack Nerd Font Mono 10
{{ else }} {{ else }}
font = JoyPixels 12, Hack Nerd Font Mono 12 font = JoyPixels 12, Hack Nerd Font Mono 12

View File

@ -80,11 +80,11 @@ Print
#-----------------------------------------------------------App shortcuts-------------------------------------------------------------- #-----------------------------------------------------------App shortcuts--------------------------------------------------------------
# terminal emulator # terminal emulator
super + {{ if eq .type "desktop" }}Backspace{{ else }}Return{{- end }} super + {{ if eq .chassisType "desktop" }}Backspace{{ else }}Return{{- end }}
$TERMINAL $TERMINAL
# program launcher # program launcher
super + {{ if eq .type "desktop" }}Delete{{ else }}@space{{- end }} super + {{ if eq .chassisType "desktop" }}Delete{{ else }}@space{{- end }}
dmenu-frecency dmenu-frecency
# make sxhkd reload its configuration files: # make sxhkd reload its configuration files: