Compare commits

..

2 Commits

Author SHA1 Message Date
b2c70116a2 feat: more dwm stuff 2024-12-27 20:09:06 +01:00
6ffe616413 feat: dwm stuff 2024-12-27 19:59:52 +01:00
13 changed files with 614 additions and 2 deletions

143
home/dwm/.xinitrc Normal file
View File

@@ -0,0 +1,143 @@
#!/bin/sh
# screenlayout setup for odin
autorandr -c
# 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;
# export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/ssh-agent.socket"
# ssh-agent -d &
# 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
# 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 &
## 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 &
# some merges
# xrdb merge .Xresources &
# xsetroot -cursor_name left_ptr &
# start dwm
exec dwm

3
home/dwm/.zprofile Normal file
View File

@@ -0,0 +1,3 @@
if [ "$(tty)" = "/dev/tty1" ];then
exec startx
fi

181
home/dwm/bar.sh Normal file
View File

@@ -0,0 +1,181 @@
#!/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) "
xsetroot -cursor_name left_ptr
# fi
done

View File

@@ -0,0 +1,6 @@
{pkgs, ...}: {
services.betterlockscreen = {
enable = true;
package = pkgs.betterlockscreen;
};
}

View File

@@ -0,0 +1,22 @@
#version 330
in vec2 texcoord;
uniform float opacity;
uniform bool invert_color;
uniform sampler2D tex;
vec4 window_shader() {
vec4 c = texelFetch(tex, ivec2(texcoord), 0);
{
// Change vec4(1.0, 1.0, 1.0, 1.0) to your desired color
vec4 vdiff = abs(vec4(0.0, 0.0, 0.0, 1.0) - c);
float diff = max(max(max(vdiff.r, vdiff.g), vdiff.b), vdiff.a);
// Change 0.8 to your desired opacity
if (diff < 0.001)
c *= 0;
}
if (invert_color)
c = vec4(vec3(c.a, c.a, c.a) - vec3(c), c.a);
c *= opacity;
// vec4 default_post_processing(vec4 c);
return c;
}

86
home/dwm/default.nix Normal file
View File

@@ -0,0 +1,86 @@
{
lib,
config,
pkgs,
...
}: {
imports = [
./picom.nix
# ./rofi.nix
./flameshot.nix
./betterlockscreen.nix
./easyeffects.nix
# ./theming.nix
];
home.packages = with pkgs; [
dmenu
st
dunst
xss-lock
xdg-desktop-portal-gtk
xorg.xrdb
xorg.xrandr
xorg.xset
xorg.xsetroot
xorg.setxkbmap
xorg.xbacklight
xorg.libX11
xorg.libX11.dev
xorg.libxcb
xorg.libXft
xorg.libXinerama
xorg.xinit
xorg.xinput
brightnessctl
xclip
# gnome.gnome-keyring
feh
alsa-utils
nemo
pulseaudioFull
arandr
neomutt
ncmpcpp
ncspot
ncpamixer
lf
pamixer
w3m
bat
efibootmgr
eww
fontconfig
freetype
gnugrep
gparted
nfs-utils
openssl
polkit_gnome
ripgrep
stdenv
tldr
variety
virt-manager
xfce.thunar
dconf
];
home.file = {
".xinitrc" = {
source = ./.xinitrc;
};
".zprofile" = {
source = ./.zprofile;
};
".config/picom/black_to_transparent.frag" = {
source = ./black_to_transparent.frag;
};
# ".Xresources" = {
# text = ''
# Xcursor.theme: "Bibata-Modern-Classic"
# Xcursor.size: 18
# '';
# };
};
}

5
home/dwm/easyeffects.nix Normal file
View File

@@ -0,0 +1,5 @@
{pkgs, ...}: {
services.easyeffects = {
enable = true;
};
}

10
home/dwm/flameshot.nix Normal file
View File

@@ -0,0 +1,10 @@
{pkgs, ...}: {
services.flameshot = {
enable = true;
settings = {
General = {
showStartupLaunchMessage = false;
};
};
};
}

99
home/dwm/picom.nix Normal file
View File

@@ -0,0 +1,99 @@
{
lib,
config,
pkgs,
...
}: {
services.picom = {
enable = true;
package = pkgs.picom;
backend = "glx";
shadow = true;
shadowOpacity = 0.2;
shadowOffsets = [1 1];
shadowExclude = [
"name = 'Notification'"
"class_g = 'Conky'"
"_GTK_FRAME_EXTENTS@:c"
"override_redirect = 1 && !WM_CLASS@:s"
"class_g ?= 'Dmenu'"
"class_g ?= 'Dunst'"
"_NET_WM_STATE@:32a *= '_NET_WM_STATE_HIDDEN'"
"_GTK_FRAME_EXTENTS@:c"
"_NET_WM_STATE@:32a *= '_NET_WM_STATE_STICKY'"
"class_g ?= 'i3-frame'"
"class_g = 'Rofi'"
];
fade = true;
fadeSteps = [0.08 0.05];
vSync = true;
settings = {
shadow = {
radius = 3;
};
corner-radius = 9;
rounder-corners-exclude = [
"window_type = 'dock'"
"window_type = 'desktop'"
"class_g = 'Dunst'"
];
blur = {
method = "dual_kawase";
strength = 10;
background = false;
background-frame = false;
background-fixed = false;
};
blur-kern = "3x3box";
# xprop | grep -i 'class'
opacity-rule = [
"90:class_g = 'neovide'"
"90:class_g = 'code-oss'"
"90:class_g = 'discord'"
"90:class_g = 'Emacs'"
"90:class_g = 'TelegramDesktop'"
"90:class_g = 'Spotify'"
"90:class_g = 'easyeffects'"
"90:class_g = 'kitty'"
"90:class_g = 'Nemo'"
"97:class_g = 'firefox'"
];
# Exclude conditions for background blur.
# blur-background-exclude = []
blur-background-exclude = [
"window_type = 'dock'"
"window_type = 'desktop'"
"_GTK_FRAME_EXTENTS@:c"
];
mark-wmwin-focused = true;
mark-ovredir-focused = true;
detect-rounded-corners = true;
detect-client-opacity = true;
unredir-if-possible = false;
detect-transient = true;
detect-client-leader = true;
use-damage = true;
window-shader-fg-rule = [
# "black_to_transparent.frag:class_g = 'stalonetray'",
# "black_to_transparent.frag:class_g = 'Minecraft 1.7.10'",
# "black_to_transparent.frag:class_g = 'i3lock'"
# "black_to_transparent.frag:focused = true",
# "black_to_transparent.frag:focused != true",
#"sphere.glsl:focused != true"
#"nordify.glsl:class_g = 'miru'"
];
};
};
}

54
home/dwm/theming.nix Normal file
View File

@@ -0,0 +1,54 @@
{
lib,
config,
pkgs,
...
}: {
# enable gtk
gtk = {
enable = true;
cursorTheme = {
name = "Bibata-Modern-Classic";
package = pkgs.bibata-cursors;
};
theme = {
name = "gruvbox-dark";
package = pkgs.gruvbox-dark-gtk;
};
iconTheme = {
name = "oomox-gruvbox-dark";
package = pkgs.gruvbox-dark-icons-gtk;
};
};
# enable qt
qt = {
enable = true;
platformTheme = "qtct";
style = {
name = "kvantum";
};
};
xdg.configFile = {
"Kvantum/kvantum.kvconfig".text = ''
[General]
theme=GraphiteNordDark
'';
"Kvantum/GraphiteNord".source = "${pkgs.graphite-kde-theme}/share/Kvantum/GraphiteNord";
};
home.pointerCursor = {
gtk.enable = true;
x11.enable = true;
package = pkgs.bibata-cursors;
name = "Bibata-Modern-Classic";
size = 18;
};
xsession.pointerCursor = {
name = "Bibata-Modern-Classic";
size = 18;
};
}

View File

@@ -16,6 +16,8 @@
./programs/shell.nix
./programs/tmux.nix
./programs/vscodium.nix
./dwm
# ./programs/yazi.nix
# ./programs/zathura.nix

View File

@@ -48,6 +48,7 @@
# > desktop < #
# firefox
whatsapp-for-linux
telegram-desktop
google-chrome
chromium

View File

@@ -78,8 +78,8 @@
src = pkgs.fetchFromGitHub {
owner = "eRgo35";
repo = "dwm";
rev = "697d8236b237aa219595d54b0913acbc9582823f";
hash = "sha256-yFEQRrU+3pxiY5gPEV7lGaTF0tm8DLiQyBRRbrqD8hU=";
rev = "main";
hash = "sha256-eke33OtxUE4sObWCFEvjLZmG1Be1SWZs0Xygr++V/wc=";
};
};
};