Niri autostart functionality and init waybar configuration

This commit is contained in:
Curt Spark 2024-05-16 19:16:46 +01:00
parent f637641bf5
commit 3e1dc6cc69
9 changed files with 149 additions and 3 deletions

View File

@ -17,6 +17,7 @@ in
config = lib.mkIf cfg.enable { config = lib.mkIf cfg.enable {
# Config Files (typically $HOME/.config) # Config Files (typically $HOME/.config)
xdg.configFile = { xdg.configFile = {
"waybar".source = ./resources/home-manager/.config/waybar;
"niri/config.kdl".source = ./resources/home-manager/.config/niri/config.kdl; "niri/config.kdl".source = ./resources/home-manager/.config/niri/config.kdl;
"mako/config".source = ./resources/home-manager/.config/mako/config; "mako/config".source = ./resources/home-manager/.config/mako/config;
"foot/foot.ini".source = ./resources/home-manager/.config/foot/foot.ini; "foot/foot.ini".source = ./resources/home-manager/.config/foot/foot.ini;
@ -26,6 +27,17 @@ in
services.udiskie.enable = true; services.udiskie.enable = true;
services.udiskie.tray = "never"; services.udiskie.tray = "never";
# Automatically executed on niri startup
home.packages = with pkgs; [
(writeShellScriptBin "niri-autostart"
''
waybar &
mako &
swaybg -i ${config.home.homeDirectory}/Pictures/Wallpapers/justfriends.png &
wlsunset -l 51.5 -L 0.1 &
'')
];
home.sessionVariables = { home.sessionVariables = {
TERM = "foot"; TERM = "foot";
QT_QPA_PLATFORM = "wayland"; QT_QPA_PLATFORM = "wayland";
@ -42,6 +54,7 @@ in
programs.bash.profileExtra = '' programs.bash.profileExtra = ''
if [[ $(tty) == "/dev/tty1" ]]; then if [[ $(tty) == "/dev/tty1" ]]; then
niri --session niri --session
exit
fi fi
''; '';
}; };

View File

@ -30,6 +30,7 @@ in
mako # Notification Daemon mako # Notification Daemon
wlprop # Clone of X11 xprop for wayland (To get window class names etc) wlprop # Clone of X11 xprop for wayland (To get window class names etc)
wev # Clone of X11 xev for wayland wev # Clone of X11 xev for wayland
waybar # Status bar
lxqt.pcmanfm-qt # File Manager lxqt.pcmanfm-qt # File Manager
lxqt.lxqt-archiver # Archiver lxqt.lxqt-archiver # Archiver

View File

@ -187,9 +187,8 @@ layout {
// Add lines like this to spawn processes at startup. // Add lines like this to spawn processes at startup.
// Note that running niri as a session supports xdg-desktop-autostart, // Note that running niri as a session supports xdg-desktop-autostart,
// which may be more convenient to use. // which may be more convenient to use.
// spawn-at-startup "alacritty" "-e" "fish" // spawn-at-startup "foot" "-e" "man foot"
spawn-at-startup "mako" spawn-at-startup "niri-autostart"
// spawn-at-startup "wlsunset" "-l" "51.5" -L "0.1"
// Uncomment this line to ask the clients to omit their client-side decorations if possible. // Uncomment this line to ask the clients to omit their client-side decorations if possible.
// If the client will specifically ask for CSD, the request will be honored. // If the client will specifically ask for CSD, the request will be honored.

View File

@ -0,0 +1,50 @@
{
"layer": "top",
"position": "top",
"modules-left": [],
"modules-center": ["clock"],
"modules-right": ["network", "battery", "pulseaudio"],
"clock": {
"format": "{:%H:%M}",
"format-alt": "{:%a %b %d}",
"tooltip": false
},
"battery": {
"states": {
"good": 95,
"warning": 30,
"critical": 15
},
"bat":"BAT1",
"format": "{icon} {capacity}%",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
"format-discharging": " {capacity}%",
"format-alt": "{icon} {time}",
"format-icons": ["", "", "", "", ""]
},
"network": {
"format": "{ifname}",
"format-wifi": " {essid}",
"format-ethernet": " {ifname}",
"format-disconnected": "",
"tooltip-format-wifi": "{signalStrength}%",
"max-length": 20
},
"pulseaudio": {
"format": "{icon} {volume}%",
"format-bluetooth": "{icon} {volume}%",
"format-muted": "",
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", ""]
},
"scroll-step": 1,
"on-click": "pavucontrol"
}
}

View File

@ -0,0 +1,2 @@
language=$(swaymsg -r -t get_inputs | awk '/1:1:AT_Translated_Set_2_keyboard/;/xkb_active_layout_name/' | grep -A1 '\b1:1:AT_Translated_Set_2_keyboard\b' | grep "xkb_active_layout_name" | awk -F '"' '{print $4}')
echo $language

View File

@ -0,0 +1,14 @@
media=$(playerctl metadata -f "({{playerName}}) {{artist}} - {{title}}")
player_status=$(playerctl status)
if [[ $player_status = "Playing" ]]
then
song_status=''
elif [[ $player_status = "Paused" ]]
then
song_status=''
else
song_status='Music stopped'
fi
echo -e "$song_status $media"

View File

@ -0,0 +1,15 @@
network=$(ip route get 1.1.1.1 | grep -Po '(?<=dev\s)\w+' | cut -f1 -d ' ')
interface_easyname=$(dmesg | grep $network | grep renamed | awk 'NF>1{print $NF}')
ping=$(ping -c 1 www.google.com | tail -1| awk '{print $4}' | cut -d '/' -f 2 | cut -d '.' -f 1)
if ! [ $network ]
then
network_active="⛔"
elif [[ $interface_easyname == *"wlan"* ]]
then
network_active=""
else
network_active=""
fi
echo "{\"text\": \""$network_active $interface_easyname \\n \($ping ms\)"\"}"

View File

@ -0,0 +1,2 @@
ping=$(ping -c 1 www.google.com | tail -1| awk '{print $4}' | cut -d '/' -f 2 | cut -d '.' -f 1)
echo "($ping ms)"

View File

@ -0,0 +1,50 @@
* {
font-size: 12px;
font-family: "Terminus (TTF)";
}
window#waybar {
background: rgba(0,0,0,0);
}
#battery {
margin: 3px 0px 3px 0px;
background: #1d1f21;
padding: 5px;
color: #c5c8c6;
}
#clock {
margin: 3px 0px 3px 3px;
padding: 5px;
color: #FFF;
background: #1d1f21;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
color: #c5c8c6;
}
#custom-keyboard {
background: #1d1f21;
color: #c5c8c6;
padding: 5px 5px 5px 7px;
margin: 3px 0px 3px 3px;
border-top-left-radius: 10px;
border-bottom-left-radius: 10px;
}
#pulseaudio {
margin: 3px 3px 3px 0px;
padding: 5px 7px 5px 5px;
background: #1d1f21;
border-top-right-radius: 10px;
border-bottom-right-radius: 10px;
color: #c5c8c6;
}
#network {
background: #1d1f21;
color: #c5c8c6;
margin: 3px 0px 3px 0px;
padding: 5px;
}