diff --git a/home-manager/features/desktop/dwm/.xinitrc b/home-manager/features/desktop/dwm/.xinitrc new file mode 100755 index 0000000..fe034a4 --- /dev/null +++ b/home-manager/features/desktop/dwm/.xinitrc @@ -0,0 +1,140 @@ +#!/bin/sh + +# screenlayout setup for odin +bash main.sh + +# start some nice programs +# if [ -d /etc/X11/xinit/xinitrc.d ] ; then +# for f in /etc/X11/xinit/xinitrc.d/?*.sh ; do +# # shellcheck source=/dev/null +# [ -x "$f" ] && . "$f" +# done +# unset f +# fi + +xset -b # disable bell + +export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket" + +# ssh agent setup +#eval `/usr/bin/ssh-agent` +# +#if test -f /usr/lib/openssh/x11-ssh-askpass # Archlinux +#then +# SSH_ASKPASS=/usr/lib/openssh/x11-ssh-askpass ssh-add < /dev/null +#fi +# +#if test -f /usr/lib/ssh/x11-ssh-askpass # Debian +#then +# SSH_ASKPASS=/usr/lib/ssh/x11-ssh-askpass ssh-add < /dev/null +#fi + +# theming +export QT_QPA_PLATFORMTHEME=qt5ct +export DESKTOP_SESSION=plasma +export XDG_CURRENT_DESKTOP=dwm + +# IMF configuration (fcitx5) +export GTK_IM_MODULE=fcitx +export QT_IM_MODULE=fcitx +export XMODIFIERS=@im=fcitx +export GLFW_IM_MODULE=ibus + +# some merges +xsetroot -cursor_name left_ptr & +# xrdb merge .Xresources & + +# compositor +picom -b --vsync & + +# fix android studio interface +export _JAVA_AWT_WM_NONREPARENTING=1 & + +# set keyboard layout +setxkbmap pl & +# IMF daemon +# fcitx5 -d & + +# enable local fonts in .fonts directory +# xset +fp /usr/share/fonts/local & +# xset +fp /usr/share/fonts/misc & +# xset +fp ~/.fonts & +# xset fp rehash & +# fc-cache -fv & + +# powersaving options +# xset s off & +# xset s noblank & +# xset s noexpose & +# xset s on & +# xset -dpms & +# xset s 900 & +xset +dpms & +xset dpms 1200 1800 2100 & +xset s on & +xset s 900 & + +# auths +# /usr/lib/mate-polkit/polkit-mate-authentication-agent-1 & +gnome-keyring-daemon & +# source /etc/X11/xinit/xinitrc.d/50-systemd-user.sh + +## Map super key to trigger rofi when used alone +# xcape -e 'Super_L=Super_L|Shift_L|space' & + +# wallpaper engine and theming +# nitrogen --restore & +# wal --backend colorz -i $HOME/.dots/nitrogen/.config/nitrogen/pexels-engin-akyurt-1435752.jpg & +. ~/.fehbg & +xrdb -merge ~/.config/.Xresources + +## Set screen locker +xss-lock -v -- betterlockscreen -l --time-format '%I:%M %p' & + +## Desktop portal +/usr/lib/xdg-desktop-portal-gtk & + +# notification daemon +dunst & + +## Screenshot daemon +flameshot & + +# Easyeffects daemon +# easyeffects --gapplication-service & + +## Telegram daemon +# telegram-desktop -startintray & + +## Caffeine-ng +# caffeine >/dev/null 2>&1 & + +## Ulauncher +# ulauncher --hide-window --no-window-shadow >/dev/null 2>&1 & + +# Emacs Server +# emacs --daemon & + +# Theme changing service +# xsettingsd & + +# Theming service +# dusk & + +# Alacritty config +# $HOME/.config/alacritty/theme-patcher.sh & + +## THINKPAD-SPECIFIC +#hash dockd && dockd --daemon & + +# status bar +bash bar.sh & disown + +# dbus-update-activation-environment --systemd DBUS_SESSION_BUS_ADDRESS DISPLAY XAUTHORITY + +# . /etc/X11/Xsession + +# redshift & + +# start dwm +exec dwm diff --git a/home-manager/features/desktop/dwm/bar.sh b/home-manager/features/desktop/dwm/bar.sh new file mode 100644 index 0000000..c4caa2e --- /dev/null +++ b/home-manager/features/desktop/dwm/bar.sh @@ -0,0 +1,179 @@ +#!/bin/bash + +function lighten_color() { + offset=20 + + hex_color=$1 + hex_color=${hex_color:1} + + red=${hex_color:0:2} + green=${hex_color:2:2} + blue=${hex_color:4:2} + + red_dec=$(printf "%d" 0x$red) + green_dec=$(printf "%d" 0x$green) + blue_dec=$(printf "%d" 0x$blue) + + if [[ $red_dec -lt 128 ]]; then + red_dec_l=$((red_dec+offset)) + green_dec_l=$((green_dec+offset)) + blue_dec_l=$((blue_dec+offset)) + else + red_dec_l=$((red_dec-offset)) + green_dec_l=$((green_dec-offset)) + blue_dec_l=$((blue_dec-offset)) + fi + + red=$(printf "%02X" $red_dec_l) + green=$(printf "%02X" $green_dec_l) + blue=$(printf "%02X" $blue_dec_l) + + echo "#$red$green$blue" +} + +# ^c$var^ = fg color +# ^b$var^ = bg color + +interval=0 + +# load colors +# . ~/.config/bar_themes/onedark + +# colors + +rosewater=#f4dbd6 +flamingo=#f0c6c6 +pink=#f5bde6 +mauve=#c6a0f6 +red=#fb4934 +maroon=#ee99a0 +peach=#f5a97f +yellow=#eed49f +green=#b8bb26 +teal=#8bd5ca +sky=#91d7e3 +sapphire=#7dc4e4 +blue=#8aadf4 +lavender=#b7bdf8 +text=#cad3f5 +subtext1=#b8c0e0 +subtext0=#a5adcb +overlay2=#939ab7 +overlay1=#8087a2 +overlay0=#6e738d +surface2=#5b6078 +surface1=#494d64 +surface0=#363a4f +base=#24273a +mantle=#1e2030 +crust=#181926 + +# Special +background=#282828 +foreground=#ebdbb2 +cursor=#ebdbb2 + +# Colors +color0=#05090e +color1=#425965 +color2=#016b86 +color3=#1f7284 +color4=#48717a +color5=#358292 +color6=#79796b +color7=#828486 +color8=#43464a +color9=#597787 +color10=#028FB3 +color11=#2A99B1 +color12=#6097A3 +color13=#47AEC3 +color14=#A2A28F +color15=#c0c1c2 + +background0=$(lighten_color $background) +background1=$(lighten_color $background0) +background2=$(lighten_color $background1) + +pulse () { + VOL=$(pamixer --get-volume) + STATE=$(pamixer --get-mute) + + printf "%s" "$SEP1" + if [ "$STATE" = "true" ] || [ "$VOL" -eq 0 ]; then + printf "AMUT%%" + elif [ "$VOL" -gt 0 ] && [ "$VOL" -le 33 ]; then + printf "A%s%%" "$VOL" + elif [ "$VOL" -gt 33 ] && [ "$VOL" -le 66 ]; then + printf "A%s%%" "$VOL" + else + printf "A%s%%" "$VOL" + fi + printf "%s\n" "$SEP2" +} + +cpu() { + cpu_val=$(grep -o "^[^ ]*" /proc/loadavg) + + printf "^c$background^ ^b$yellow^ 󰇄 " + printf "^c$background^ ^b$yellow^$cpu_val" +} + +battery() { + capacity_0="$(cat /sys/class/power_supply/BAT0/capacity)" + capacity_1="$(cat /sys/class/power_supply/BAT1/capacity)" + + capacity="$capacity_0+$capacity_1" + # capacity=$(((capacity_0 + capacity_1) / 2)) + + printf " B$capacity%% " +} + +brightness() { + value=$(cat /sys/class/backlight/*/brightness) + percentage=$(echo "scale=2; $value / 8.54" | bc) + printf "L%.0f%%" "$percentage" +} + +mem() { + printf "^c$background^^b$green^  " + printf "^c$background^^b$green^ $(free -h | awk '/^Mem/ { print $3 }' | sed s/i//g)" +} + +wlan() { + case "$(cat /sys/class/net/wl*/operstate 2>/dev/null)" in + up) printf "^c$background^ ^b$blue^ 󰤨 ^c$background^ ^b$blue^Connected" ;; + down) printf "^c$background^ ^b$blue^ 󰤭 ^c$background^ ^b$blue^Disconnected" ;; + esac +} + +clock() { + printf " $(date '+%I:%M %P') " +} + +today() { + printf " $(date '+%b %e') " +} + +net() { + if nc -zw1 c2yz.com 443; then + printf "^c$background^^b$green^ i " + else + printf "^c$background^^b$red^ ! " + fi +} + +while true; do + + # [ $interval = 0 ] || [ $(($interval % 3600)) = 0 ] && updates=$(pkg_updates) + # interval=$((interval + 1)) + + # sleep 1 && xsetroot -name "$updates $(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)" + # sleep 1 && xsetroot -name "$(battery) $(brightness) $(cpu) $(mem) $(wlan) $(clock)" + if hash dockd 2>/dev/null; then + sleep 1 && xsetroot -name "^c$foreground^^b$background1^ $(brightness) ^b$background0^ $(battery) $(net)^c$foreground^^b$background0^ $(today) ^b$background1^ $(clock) ^b$background2^ $(pulse) " + else + sleep 1 && xsetroot -name "^c$foreground^$(net)^c$foreground^^b$background0^ $(today) ^b$background1^ $(clock) ^b$background2^ $(pulse) " + fi + +done diff --git a/home-manager/features/desktop/dwm/default.nix b/home-manager/features/desktop/dwm/default.nix index 915fd71..793de84 100644 --- a/home-manager/features/desktop/dwm/default.nix +++ b/home-manager/features/desktop/dwm/default.nix @@ -5,8 +5,20 @@ ... }: { home.packages = with pkgs; [ - rofi - dmenu - st + rofi + dmenu + st + dunst + picom + xss-lock + flameshot + xdg-desktop-portal-gtk + xorg.xrdb + xorg.xrandr + xorg.xset + xorg.xsetroot + xorg.setxkbmap + gnome.gnome-keyring + feh ]; } diff --git a/hosts/common/default.nix b/hosts/common/default.nix index 37a6414..c4a3e29 100644 --- a/hosts/common/default.nix +++ b/hosts/common/default.nix @@ -7,7 +7,6 @@ ... }: { imports = [ - ./gui.nix ./locale.nix ./packages.nix ./services.nix diff --git a/hosts/thor/configuration.nix b/hosts/thor/configuration.nix index fa27722..15e08c0 100644 --- a/hosts/thor/configuration.nix +++ b/hosts/thor/configuration.nix @@ -21,6 +21,7 @@ # You can also split up your configuration and import pieces of it here: # ./users.nix ../common + ./gui.nix # Import your generated (nixos-generate-config) hardware configuration ./hardware-configuration.nix diff --git a/hosts/common/gui.nix b/hosts/thor/gui.nix similarity index 100% rename from hosts/common/gui.nix rename to hosts/thor/gui.nix diff --git a/hosts/zion/configuration.nix b/hosts/zion/configuration.nix index d2a1c5d..c30fb7f 100644 --- a/hosts/zion/configuration.nix +++ b/hosts/zion/configuration.nix @@ -21,6 +21,7 @@ # You can also split up your configuration and import pieces of it here: # ./users.nix ../common + ./gui.nix # nvidia drivers ./nvidia.nix diff --git a/hosts/zion/gui.nix b/hosts/zion/gui.nix new file mode 100644 index 0000000..30429f2 --- /dev/null +++ b/hosts/zion/gui.nix @@ -0,0 +1,51 @@ +{ + inputs, + outputs, + lib, + config, + pkgs, + ... +}: { + # X Server settings + services.xserver = { + enable = true; + layout = "pl"; + xkbVariant = ""; + + displayManager = { + lightdm = { + enable = false; + }; + startx = { + enable = true; + }; + }; + + windowManager = { + dwm = { + enable = true; + }; + }; + + desktopManager = { + xfce = { + enable = false; + }; + }; + + xrandrHeads = [ + { + output = "HDMI-0"; + } + { + output = "DP-2"; + primary = true; + rate = "74.92"; + } + { + output = "DP-0"; + rate = "74.92"; + } + ]; + }; +}