mirror of
https://github.com/donovanglover/nix-config.git
synced 2024-11-07 17:04:00 +01:00
meta: Move home-manager dwm config to separate module
Note that it's possible to use an autostart patch like https://dwm.suckless.org/patches/cool_autostart/ so startx isn't needed although this results in dwm starting before things like the status bar get set.
This commit is contained in:
parent
99fd8bf3f3
commit
6036d49620
84
home/dwm.nix
Normal file
84
home/dwm.nix
Normal file
@ -0,0 +1,84 @@
|
||||
{ config, pkgs, ... }:
|
||||
|
||||
let
|
||||
barScript = "dwm/bar.fish";
|
||||
in
|
||||
{
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
feh
|
||||
xclip
|
||||
scrot
|
||||
];
|
||||
|
||||
file.".xinitrc" = {
|
||||
executable = true;
|
||||
text = # bash
|
||||
''
|
||||
#!/usr/bin/env sh
|
||||
|
||||
export XDG_SESSION_TYPE=x11
|
||||
export GDK_BACKEND=x11
|
||||
export XDG_CURRENT_DESKTOP=dwm
|
||||
export GTK_IM_MODULE=fcitx
|
||||
export QT_IM_MODULE=fcitx
|
||||
export XMODIFIERS=@im=fcitx
|
||||
export SDL_IM_MODULE=fcitx
|
||||
export GLFW_IM_MODULE=ibus
|
||||
export GTK_CSD=0
|
||||
|
||||
xrdb -merge ~/.Xresources
|
||||
xset r rate 300 50
|
||||
feh --no-fehbg --bg-scale ${config.stylix.image}
|
||||
~/.config/${barScript} &
|
||||
picom --daemon
|
||||
${pkgs.nemo}/bin/nemo-desktop &
|
||||
fcitx5 &
|
||||
|
||||
while true; do
|
||||
dbus-launch --sh-syntax --exit-with-session dwm
|
||||
done
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
${barScript} = {
|
||||
executable = true;
|
||||
text = # fish
|
||||
''
|
||||
#!/usr/bin/env fish
|
||||
|
||||
function get_icon
|
||||
if test "$argv" -gt 90
|
||||
echo " "
|
||||
else if test "$argv" -gt 60
|
||||
echo " "
|
||||
else if test "$argv" -gt 30
|
||||
echo " "
|
||||
else if test "$argv" -gt 10
|
||||
echo " "
|
||||
else
|
||||
echo " "
|
||||
end
|
||||
end
|
||||
|
||||
function update_bar
|
||||
set VOLUME "音量:$(math "$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1) * 100")%"
|
||||
set TIME "$(date '+%x(%a)%R')"
|
||||
set capacity "$(cat /sys/class/power_supply/BAT0/capacity)"
|
||||
|
||||
set BATTERY "$(get_icon $capacity)$capacity%"
|
||||
|
||||
xsetroot -name " $VOLUME・$BATTERY・$TIME "
|
||||
end
|
||||
|
||||
while true
|
||||
update_bar
|
||||
|
||||
sleep 10s
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
}
|
@ -6,98 +6,14 @@
|
||||
}:
|
||||
|
||||
let
|
||||
inherit (lib) singleton;
|
||||
|
||||
inherit (config.lib.stylix.colors.withHashtag)
|
||||
base00
|
||||
base02
|
||||
base03
|
||||
base05
|
||||
;
|
||||
|
||||
barScript = "dwm/bar.fish";
|
||||
in
|
||||
{
|
||||
home-manager.sharedModules = singleton {
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
feh
|
||||
xclip
|
||||
scrot
|
||||
];
|
||||
|
||||
file.".xinitrc" = {
|
||||
executable = true;
|
||||
text = # bash
|
||||
''
|
||||
#!/usr/bin/env sh
|
||||
|
||||
export XDG_SESSION_TYPE=x11
|
||||
export GDK_BACKEND=x11
|
||||
export XDG_CURRENT_DESKTOP=dwm
|
||||
export GTK_IM_MODULE=fcitx
|
||||
export QT_IM_MODULE=fcitx
|
||||
export XMODIFIERS=@im=fcitx
|
||||
export SDL_IM_MODULE=fcitx
|
||||
export GLFW_IM_MODULE=ibus
|
||||
export GTK_CSD=0
|
||||
|
||||
xrdb -merge ~/.Xresources
|
||||
xset r rate 300 50
|
||||
feh --no-fehbg --bg-scale ${config.stylix.image}
|
||||
~/.config/${barScript} &
|
||||
picom --daemon
|
||||
${pkgs.nemo}/bin/nemo-desktop &
|
||||
fcitx5 &
|
||||
|
||||
while true; do
|
||||
dbus-launch --sh-syntax --exit-with-session dwm
|
||||
done
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
xdg.configFile = {
|
||||
${barScript} = {
|
||||
executable = true;
|
||||
text = # fish
|
||||
''
|
||||
#!/usr/bin/env fish
|
||||
|
||||
function get_icon
|
||||
if test "$argv" -gt 90
|
||||
echo " "
|
||||
else if test "$argv" -gt 60
|
||||
echo " "
|
||||
else if test "$argv" -gt 30
|
||||
echo " "
|
||||
else if test "$argv" -gt 10
|
||||
echo " "
|
||||
else
|
||||
echo " "
|
||||
end
|
||||
end
|
||||
|
||||
function update_bar
|
||||
set VOLUME "音量:$(math "$(wpctl get-volume @DEFAULT_AUDIO_SINK@ | choose 1) * 100")%"
|
||||
set TIME "$(date '+%x(%a)%R')"
|
||||
set capacity "$(cat /sys/class/power_supply/BAT0/capacity)"
|
||||
|
||||
set BATTERY "$(get_icon $capacity)$capacity%"
|
||||
|
||||
xsetroot -name " $VOLUME・$BATTERY・$TIME "
|
||||
end
|
||||
|
||||
while true
|
||||
update_bar
|
||||
|
||||
sleep 10s
|
||||
end
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
services = {
|
||||
xserver = {
|
||||
displayManager.startx.enable = true;
|
||||
|
Loading…
Reference in New Issue
Block a user