From 57e5cfd545500592edca938b876245f5bb069ac2 Mon Sep 17 00:00:00 2001 From: paul-loedige Date: Sun, 15 Oct 2023 20:28:14 +0200 Subject: [PATCH] switched to automatic laptop/desktop config --- Alacritty/.config/alacritty/alacritty.yml | 2 +- git/zippey | 1 - .../.config/powerline-shell/theme.py | 71 ------------------- qtile/.config/qtile/Bars.py | 8 +-- qtile/.config/qtile/Keys.py | 10 +-- qtile/.config/qtile/autostart.sh | 16 ++++- qtile/.config/qtile/defines.py | 20 ++++++ screen-layout/.screenlayout/layout.sh | 2 - 8 files changed, 45 insertions(+), 85 deletions(-) delete mode 160000 git/zippey delete mode 100644 powerline-shell/.config/powerline-shell/theme.py delete mode 100755 screen-layout/.screenlayout/layout.sh diff --git a/Alacritty/.config/alacritty/alacritty.yml b/Alacritty/.config/alacritty/alacritty.yml index f23599a..d9a4c44 100644 --- a/Alacritty/.config/alacritty/alacritty.yml +++ b/Alacritty/.config/alacritty/alacritty.yml @@ -18,7 +18,7 @@ font: family: UbuntuMonoNerdFont style: Bold Italic - size: 14 + size: 11 # Colors (Gruvbox dark) colors: diff --git a/git/zippey b/git/zippey deleted file mode 160000 index f037ce9..0000000 --- a/git/zippey +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f037ce9e9b968fa053f95cd2804a248021ffcb41 diff --git a/powerline-shell/.config/powerline-shell/theme.py b/powerline-shell/.config/powerline-shell/theme.py deleted file mode 100644 index 97f9d3e..0000000 --- a/powerline-shell/.config/powerline-shell/theme.py +++ /dev/null @@ -1,71 +0,0 @@ - -from powerline_shell.themes.default import DefaultColor - - -class Color(DefaultColor): - USERNAME_FG = 230 - USERNAME_BG = 240 - USERNAME_ROOT_BG = 124 - - HOSTNAME_FG = 230 - HOSTNAME_BG = 238 - - HOME_SPECIAL_DISPLAY = True - HOME_BG = 4 # blueish - HOME_FG = 15 # white - PATH_BG = 237 # dark grey - PATH_FG = 250 # light grey - CWD_FG = 254 # nearly-white grey - SEPARATOR_FG = 244 - - READONLY_BG = 124 - READONLY_FG = 254 - - SSH_BG = 166 # medium orange - SSH_FG = 254 - - REPO_CLEAN_BG = 148 # a light green color - REPO_CLEAN_FG = 0 # black - REPO_DIRTY_BG = 161 # pink/red - REPO_DIRTY_FG = 15 # white - - JOBS_FG = 39 - JOBS_BG = 238 - - CMD_PASSED_BG = 236 - CMD_PASSED_FG = 15 - CMD_FAILED_BG = 161 - CMD_FAILED_FG = 15 - - SVN_CHANGES_BG = 148 - SVN_CHANGES_FG = 22 # dark green - - GIT_AHEAD_BG = 240 - GIT_AHEAD_FG = 250 - GIT_BEHIND_BG = 240 - GIT_BEHIND_FG = 250 - GIT_STAGED_BG = 22 - GIT_STAGED_FG = 15 - GIT_NOTSTAGED_BG = 130 - GIT_NOTSTAGED_FG = 15 - GIT_UNTRACKED_BG = 52 - GIT_UNTRACKED_FG = 15 - GIT_CONFLICTED_BG = 9 - GIT_CONFLICTED_FG = 15 - - GIT_STASH_BG = 221 - GIT_STASH_FG = 0 - - VIRTUAL_ENV_BG = 35 # a mid-tone green - VIRTUAL_ENV_FG = 00 - - BATTERY_NORMAL_BG = 22 - BATTERY_NORMAL_FG = 7 - BATTERY_LOW_BG = 196 - BATTERY_LOW_FG = 7 - - AWS_PROFILE_FG = 39 - AWS_PROFILE_BG = 238 - - TIME_FG = 250 - TIME_BG = 238 diff --git a/qtile/.config/qtile/Bars.py b/qtile/.config/qtile/Bars.py index 8d7aa1d..6fd1503 100644 --- a/qtile/.config/qtile/Bars.py +++ b/qtile/.config/qtile/Bars.py @@ -1,19 +1,19 @@ from libqtile import widget, bar -from defines import base_color -from defines import blue_color +from defines import base_color, blue_color +from defines import ChassisType, chassis_type from Widgets import Left_widgets, volume_widget, System_widgets, end_widgets, Laptop_widgets widget_defaults = dict( background=base_color, font='Ubuntu Mono', fontsize=18, - padding=3, + padding=1 if chassis_type == ChassisType.LAPTOP else 3, ) extension_defaults = widget_defaults.copy() main_bar_fontsize=22 -main_bar_height=28 +main_bar_height=24 if chassis_type == ChassisType.LAPTOP else 28 secondary_bar_height=24 secondary_bar_fontsize=18 diff --git a/qtile/.config/qtile/Keys.py b/qtile/.config/qtile/Keys.py index cc22ba4..3ec4d91 100644 --- a/qtile/.config/qtile/Keys.py +++ b/qtile/.config/qtile/Keys.py @@ -1,7 +1,7 @@ from libqtile.config import Key, Drag, Click from libqtile.command import lazy -from defines import mod, term +from defines import mod, term, ChassisType, chassis_type keys = [ #screen lock & hibernation @@ -56,11 +56,11 @@ keys = [ Key([mod],'Return',lazy.spawn("rofi -show drun -show-icons -modi drun"),desc="launch rofi (drun)"), # audio hotkeys - Key([], 'XF86AudioRaiseVolume', lazy.spawn('pulseaudio-ctl up 1'), desc="increase speaker volume"), - Key([], 'XF86AudioLowerVolume', lazy.spawn('pulseaudio-ctl down 1'), desc="decrease speaker volume"), + Key([], 'XF86AudioRaiseVolume', lazy.spawn(f'pulseaudio-ctl up {5 if chassis_type == ChassisType.LAPTOP else 1}'), desc="increase speaker volume"), + Key([], 'XF86AudioLowerVolume', lazy.spawn(f'pulseaudio-ctl down {5 if chassis_type == ChassisType.LAPTOP else 1}'), desc="decrease speaker volume"), Key([], 'XF86AudioMute', lazy.spawn('pulseaudio-ctl mute'), desc="toggle speaker mute"), - Key(['control'], 'XF86AudioRaiseVolume', lazy.spawn('amixer set Capture 1%+'), desc="increase mic volume"), - Key(['control'], 'XF86AudioLowerVolume', lazy.spawn('amixer set Capture 1%-'), desc="decrease mic volume"), + Key(['control'], 'XF86AudioRaiseVolume', lazy.spawn(f'amixer set Capture {5 if chassis_type == ChassisType.LAPTOP else 1}%+'), desc="increase mic volume"), + Key(['control'], 'XF86AudioLowerVolume', lazy.spawn(f'amixer set Capture {5 if chassis_type == ChassisType.LAPTOP else 1}%-'), desc="decrease mic volume"), Key(['control'], 'XF86AudioMute', lazy.spawn('amixer set Capture toggle'), desc="toggle mic mute"), Key([], 'XF86AudioMicMute', lazy.spawn('amixer set Capture toggle'), desc="toggle mic mute"), diff --git a/qtile/.config/qtile/autostart.sh b/qtile/.config/qtile/autostart.sh index aa48670..da0dcec 100755 --- a/qtile/.config/qtile/autostart.sh +++ b/qtile/.config/qtile/autostart.sh @@ -3,7 +3,7 @@ sleep 1& nitrogen --restore & /usr/lib/geoclue-2.0/demos/agent& bash .screenlayout/layout.sh & -# pulseaudio-ctl set 50 & +pulseaudio-ctl set 50 & dunst & nextcloud & timeshift & @@ -16,3 +16,17 @@ blueman-applet & thunderbird & fcitx5 -d& emacs --daemon & +# Use hostnamectl to get system information +chassis_type=$(hostnamectl status | grep "Chassis:" | awk '{print $2}') + +# Check if the chassis type is "laptop" +if [ "$chassis_type" == "laptop" ]; then + xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Tapping Enabled" 1 + xinput set-prop "SynPS/2 Synaptics TouchPad" "libinput Natural Scrolling Enabled" 1 + cbatticon & + # set font size for alacritty + sed -i 's/size: [0-9][0-9]/size: 11/' ~/.config/alacritty/alacritty.yml +else + # set font size for alacritty + sed -i 's/size: [0-9][0-9]/size: 14/' ~/.config/alacritty/alacritty.yml +fi diff --git a/qtile/.config/qtile/defines.py b/qtile/.config/qtile/defines.py index 966b534..8337edb 100644 --- a/qtile/.config/qtile/defines.py +++ b/qtile/.config/qtile/defines.py @@ -1,3 +1,6 @@ +from enum import Enum +import subprocess + term = 'alacritty' focus_color = '#076678' border_width = 2 @@ -7,6 +10,23 @@ hotkey_file='/home/paul/Hotkeys' main_screen_res = [3440,1440] top_screen_res = [1440,900] +#region chassis type detection +class ChassisType(Enum): + DESKTOP = 0 + LAPTOP = 1 + +def detect_chassis_type() -> ChassisType: + try: + output = subprocess.check_output(["hostnamectl", "status"], universal_newlines=True) + except subprocess.CalledProcessError as e: + print("Error running hostnamectl:", e) + exit(1) + return ChassisType.LAPTOP if "Chassis: laptop" in output else ChassisType.DESKTOP + +chassis_type = detect_chassis_type() +#endregion + + #region colors light_foreground_color = ['#fbf1c7','#fbf1c7'] dark_foreground_color = ['#282828','#282828'] diff --git a/screen-layout/.screenlayout/layout.sh b/screen-layout/.screenlayout/layout.sh deleted file mode 100755 index 3f5fb15..0000000 --- a/screen-layout/.screenlayout/layout.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -xrandr --output DVI-I-1 --primary --mode 1440x900 --pos 2080x0 --rotate normal --output DP-1 --off --output DP-2 --off --output DP-3 --mode 3440x1440 --pos 1080x900 --rotate normal --output HDMI-1 --mode 1920x1080 --pos 0x571 --rotate left