Add eww and SSH
This commit is contained in:
parent
3fad5809b9
commit
7f324958a5
24 changed files with 309 additions and 16 deletions
30
home.nix
30
home.nix
|
|
@ -6,17 +6,19 @@
|
||||||
home.homeDirectory = "/home/pan";
|
home.homeDirectory = "/home/pan";
|
||||||
|
|
||||||
imports = [
|
imports = [
|
||||||
./programs/xdg
|
|
||||||
./programs/hypr
|
|
||||||
./programs/dunst
|
|
||||||
./programs/git
|
|
||||||
./programs/alacritty
|
./programs/alacritty
|
||||||
./programs/pywal
|
./programs/dunst
|
||||||
|
./programs/eww
|
||||||
./programs/fish
|
./programs/fish
|
||||||
./programs/nnn
|
./programs/git
|
||||||
./programs/rofi
|
./programs/hypr
|
||||||
./programs/nvim
|
|
||||||
./programs/mpv
|
./programs/mpv
|
||||||
|
./programs/nnn
|
||||||
|
./programs/nvim
|
||||||
|
./programs/pywal
|
||||||
|
./programs/rofi
|
||||||
|
./programs/ssh
|
||||||
|
./programs/xdg
|
||||||
];
|
];
|
||||||
|
|
||||||
home.packages = with pkgs; [
|
home.packages = with pkgs; [
|
||||||
|
|
@ -28,16 +30,12 @@
|
||||||
wget # Download web stuff
|
wget # Download web stuff
|
||||||
feh # Image viewer
|
feh # Image viewer
|
||||||
appimage-run # Lets you run app images
|
appimage-run # Lets you run app images
|
||||||
# Development stuff, can be removed
|
zathura # PDF viewer
|
||||||
|
ani-cli # Easy anime player
|
||||||
|
|
||||||
|
# Development stuff
|
||||||
nodejs # For compiling JS stuff
|
nodejs # For compiling JS stuff
|
||||||
jq # May be critical for scripts?
|
jq # May be critical for scripts?
|
||||||
|
|
||||||
# Check if want settings?
|
|
||||||
zathura # PDF viewer
|
|
||||||
|
|
||||||
# Expand into other areas
|
|
||||||
sshfs # SSH File system (SSH)
|
|
||||||
eww-wayland # eww widgets (EWW)
|
|
||||||
];
|
];
|
||||||
# home.file = {};
|
# home.file = {};
|
||||||
|
|
||||||
|
|
|
||||||
8
programs/eww/config/eww.scss
Normal file
8
programs/eww/config/eww.scss
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
box {
|
||||||
|
background-color: #1E1D2F;
|
||||||
|
color: #D9E0EE;
|
||||||
|
}
|
||||||
|
|
||||||
|
progressbar > trough {
|
||||||
|
min-width: 40px;
|
||||||
|
}
|
||||||
0
programs/eww/config/eww.yuck
Normal file
0
programs/eww/config/eww.yuck
Normal file
40
programs/eww/config/modules/bar.yuck
Normal file
40
programs/eww/config/modules/bar.yuck
Normal file
|
|
@ -0,0 +1,40 @@
|
||||||
|
(include "./widgets/components/hyprwindow.yuck")
|
||||||
|
(include "./widgets/components/hyprworkspaces.yuck")
|
||||||
|
(include "./widgets/components/internet.yuck")
|
||||||
|
(include "./widgets/components/japanesedate.yuck")
|
||||||
|
(include "./widgets/components/japaneseaudio.yuck")
|
||||||
|
|
||||||
|
(defwidget bar []
|
||||||
|
(centerbox :orientation "horizontal"
|
||||||
|
:style "padding: 0px 8px"
|
||||||
|
(box :halign "start"
|
||||||
|
:spacing 18
|
||||||
|
:space-evenly false
|
||||||
|
(hyprworkspaces)
|
||||||
|
(hyprwindow)
|
||||||
|
)
|
||||||
|
""
|
||||||
|
(box :halign "end"
|
||||||
|
:spacing 18
|
||||||
|
:space-evenly false
|
||||||
|
(eventbox :onhover "eww open preview"
|
||||||
|
:onhoverlost "eww close preview"
|
||||||
|
barplayer
|
||||||
|
)
|
||||||
|
(internet)
|
||||||
|
(japaneseaudio)
|
||||||
|
(japanesedate)
|
||||||
|
(label :style "color: #FAE3B0"
|
||||||
|
:text bartime
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defpoll bartime :interval "10s"
|
||||||
|
"date '+%H:%M'"
|
||||||
|
)
|
||||||
|
|
||||||
|
(deflisten barplayer :initial ""
|
||||||
|
"playerctl --follow metadata --format '{{ artist }} - {{ title }}' || true"
|
||||||
|
)
|
||||||
5
programs/eww/config/modules/components/hyprwindow.yuck
Normal file
5
programs/eww/config/modules/components/hyprwindow.yuck
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
(defwidget hyprwindow []
|
||||||
|
(label :text "${hyprwindow_listener}")
|
||||||
|
)
|
||||||
|
|
||||||
|
(deflisten hyprwindow_listener :initial "" "bash $XDG_CONFIG_HOME/eww/scripts/get-window-title")
|
||||||
17
programs/eww/config/modules/components/hyprworkspaces.yuck
Normal file
17
programs/eww/config/modules/components/hyprworkspaces.yuck
Normal file
|
|
@ -0,0 +1,17 @@
|
||||||
|
(defwidget hyprworkspaces []
|
||||||
|
(eventbox :onscroll "bash ~/.config/eww/scripts/change-active-workspace {} ${current_workspace}" :class "workspaces-widget"
|
||||||
|
(box :space-evenly false
|
||||||
|
:spacing 5
|
||||||
|
(for workspace in workspaces
|
||||||
|
(eventbox :onclick "hyprctl dispatch workspace ${workspace.id}"
|
||||||
|
(box :class "workspace-entry ${workspace.id == current_workspace ? "current" : ""} ${workspace.windows > 0 ? "occupied" : "empty"}"
|
||||||
|
(label :text "${workspace.id}")
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(deflisten workspaces :initial "[]" "bash $XDG_CONFIG_HOME/eww/scripts/get-workspaces")
|
||||||
|
(deflisten current_workspace :initial "1" "bash $XDG_CONFIG_HOME/eww/scripts/get-active-workspace")
|
||||||
18
programs/eww/config/modules/components/index.html
Normal file
18
programs/eww/config/modules/components/index.html
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<title>Directory listing for /eww/widgets/components/</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Directory listing for /eww/widgets/components/</h1>
|
||||||
|
<hr>
|
||||||
|
<ul>
|
||||||
|
<li><a href="hyprwindow.yuck">hyprwindow.yuck</a></li>
|
||||||
|
<li><a href="hyprworkspaces.yuck">hyprworkspaces.yuck</a></li>
|
||||||
|
<li><a href="japaneseaudio.yuck">japaneseaudio.yuck</a></li>
|
||||||
|
<li><a href="japanesedate.yuck">japanesedate.yuck</a></li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
8
programs/eww/config/modules/components/internet.yuck
Normal file
8
programs/eww/config/modules/components/internet.yuck
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
(defwidget internet []
|
||||||
|
(box :spacing 0 :space-evenly false :style "color: #f5c2e7"
|
||||||
|
network
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defpoll network :interval "30s"
|
||||||
|
"iwgetid -r")
|
||||||
11
programs/eww/config/modules/components/japaneseaudio.yuck
Normal file
11
programs/eww/config/modules/components/japaneseaudio.yuck
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
(defwidget japaneseaudio []
|
||||||
|
(eventbox :onscroll "bash -c 'if [ '{}' = 'up' ]; then pamixer -i 5; else pamixer -d 5; fi'"
|
||||||
|
(box :spacing 0 :space-evenly false :style "color: #96CDFB"
|
||||||
|
volume
|
||||||
|
"音"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defpoll volume :interval "1s"
|
||||||
|
"pamixer --get-volume")
|
||||||
|
|
@ -0,0 +1,9 @@
|
||||||
|
(defwidget japanesebattery []
|
||||||
|
(box :spacing 0 :space-evenly false :style "color: #FAB387"
|
||||||
|
power
|
||||||
|
"電"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defpoll power :interval "1m"
|
||||||
|
"cat /sys/class/power_supply/BAT1/capacity")
|
||||||
9
programs/eww/config/modules/components/japanesedate.yuck
Normal file
9
programs/eww/config/modules/components/japanesedate.yuck
Normal file
|
|
@ -0,0 +1,9 @@
|
||||||
|
(defwidget japanesedate []
|
||||||
|
(label :style "color: #DDB6F2"
|
||||||
|
:text japanesedate_time
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defpoll japanesedate_time :interval "100s"
|
||||||
|
"bash $XDG_CONFIG_HOME/eww/scripts/japanesedate"
|
||||||
|
)
|
||||||
16
programs/eww/config/modules/index.html
Normal file
16
programs/eww/config/modules/index.html
Normal file
|
|
@ -0,0 +1,16 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<title>Directory listing for /eww/widgets/</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Directory listing for /eww/widgets/</h1>
|
||||||
|
<hr>
|
||||||
|
<ul>
|
||||||
|
<li><a href="bar.yuck">bar.yuck</a></li>
|
||||||
|
<li><a href="components/">components/</a></li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
15
programs/eww/config/modules/powerbar.yuck
Normal file
15
programs/eww/config/modules/powerbar.yuck
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
(defwidget powerbar []
|
||||||
|
(box
|
||||||
|
:orientation "vertical"
|
||||||
|
:spacing 8
|
||||||
|
:space-evenly false
|
||||||
|
:style "color: #FAB387"
|
||||||
|
(progress
|
||||||
|
:orientation "v"
|
||||||
|
:value {100 - power})
|
||||||
|
"電"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defpoll power :interval "1m"
|
||||||
|
"cat /sys/class/power_supply/BAT1/capacity")
|
||||||
21
programs/eww/config/scripts/change-active-workspace
Normal file
21
programs/eww/config/scripts/change-active-workspace
Normal file
|
|
@ -0,0 +1,21 @@
|
||||||
|
#!/bin/sh
|
||||||
|
function clamp {
|
||||||
|
min=$1
|
||||||
|
max=$2
|
||||||
|
val=$3
|
||||||
|
python -c "print(max($min, min($val, $max)))"
|
||||||
|
}
|
||||||
|
|
||||||
|
direction=$1
|
||||||
|
current=$2
|
||||||
|
if test "$direction" = "down"
|
||||||
|
then
|
||||||
|
target=$(clamp 1 10 $(($current+1)))
|
||||||
|
echo "jumping to $target"
|
||||||
|
hyprctl dispatch workspace $target
|
||||||
|
elif test "$direction" = "up"
|
||||||
|
then
|
||||||
|
target=$(clamp 1 10 $(($current-1)))
|
||||||
|
echo "jumping to $target"
|
||||||
|
hyprctl dispatch workspace $target
|
||||||
|
fi
|
||||||
3
programs/eww/config/scripts/get-active-workspace
Normal file
3
programs/eww/config/scripts/get-active-workspace
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
hyprctl monitors -j | jq --raw-output .[0].activeWorkspace.id
|
||||||
|
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 grep '^workspace>>' | stdbuf -o0 awk -F '>>|,' '{print $2}'
|
||||||
3
programs/eww/config/scripts/get-window-title
Normal file
3
programs/eww/config/scripts/get-window-title
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
hyprctl activewindow -j | jq --raw-output .title
|
||||||
|
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | stdbuf -o0 grep '^activewindow>>' | stdbuf -o0 awk -F '>>|,' '{print $3}'
|
||||||
11
programs/eww/config/scripts/get-workspaces
Normal file
11
programs/eww/config/scripts/get-workspaces
Normal file
|
|
@ -0,0 +1,11 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
spaces (){
|
||||||
|
WORKSPACE_WINDOWS=$(hyprctl workspaces -j | jq 'map({key: .id | tostring, value: .windows}) | from_entries')
|
||||||
|
seq 1 10 | jq --argjson windows "${WORKSPACE_WINDOWS}" --slurp -Mc 'map(tostring) | map({id: ., windows: ($windows[.]//0)})'
|
||||||
|
}
|
||||||
|
|
||||||
|
spaces
|
||||||
|
socat -u UNIX-CONNECT:/tmp/hypr/$HYPRLAND_INSTANCE_SIGNATURE/.socket2.sock - | while read -r line; do
|
||||||
|
spaces
|
||||||
|
done
|
||||||
20
programs/eww/config/scripts/index.html
Normal file
20
programs/eww/config/scripts/index.html
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
|
<title>Directory listing for /eww/scripts/</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<h1>Directory listing for /eww/scripts/</h1>
|
||||||
|
<hr>
|
||||||
|
<ul>
|
||||||
|
<li><a href="change-active-workspace">change-active-workspace</a></li>
|
||||||
|
<li><a href="get-active-workspace">get-active-workspace</a></li>
|
||||||
|
<li><a href="get-window-title">get-window-title</a></li>
|
||||||
|
<li><a href="get-workspaces">get-workspaces</a></li>
|
||||||
|
<li><a href="japanesedate">japanesedate</a></li>
|
||||||
|
<li><a href="medpreview">medpreview</a></li>
|
||||||
|
</ul>
|
||||||
|
<hr>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
31
programs/eww/config/scripts/japanesedate
Normal file
31
programs/eww/config/scripts/japanesedate
Normal file
|
|
@ -0,0 +1,31 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
readarray -t dateparts <<<"$(date "+%0m月%0d日%n%u")"
|
||||||
|
|
||||||
|
echo -n "${dateparts[0]}["
|
||||||
|
|
||||||
|
case ${dateparts[1]} in
|
||||||
|
1)
|
||||||
|
echo -n "月"
|
||||||
|
;;
|
||||||
|
2)
|
||||||
|
echo -n "火"
|
||||||
|
;;
|
||||||
|
3)
|
||||||
|
echo -n "水"
|
||||||
|
;;
|
||||||
|
4)
|
||||||
|
echo -n "木"
|
||||||
|
;;
|
||||||
|
5)
|
||||||
|
echo -n "金"
|
||||||
|
;;
|
||||||
|
6)
|
||||||
|
echo -n "土"
|
||||||
|
;;
|
||||||
|
7)
|
||||||
|
echo -n "日"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
echo "]"
|
||||||
3
programs/eww/config/scripts/medpreview
Normal file
3
programs/eww/config/scripts/medpreview
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
playerctl --follow metadata mpris:artUrl | stdbuf -o0 cut -c 8-
|
||||||
0
programs/eww/config/variables.yuck
Normal file
0
programs/eww/config/variables.yuck
Normal file
32
programs/eww/config/windows.yuck
Normal file
32
programs/eww/config/windows.yuck
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
(include "./widgets/bar.yuck")
|
||||||
|
(include "./widgets/powerbar.yuck")
|
||||||
|
|
||||||
|
(defwindow bar0
|
||||||
|
:monitor 0
|
||||||
|
:geometry (geometry :width "100%"
|
||||||
|
:height "29px"
|
||||||
|
:anchor "top center")
|
||||||
|
:stacking "fg"
|
||||||
|
:exclusive true
|
||||||
|
(bar)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwindow preview
|
||||||
|
:monitor 0
|
||||||
|
:geometry (geometry :x "100px"
|
||||||
|
:y "5px"
|
||||||
|
:anchor "top right")
|
||||||
|
(image :path mediapreview)
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwindow powerbar0
|
||||||
|
:monitor 0
|
||||||
|
:geometry (geometry :x "100px"
|
||||||
|
:y "5px"
|
||||||
|
:anchor "top right")
|
||||||
|
(powerbar)
|
||||||
|
)
|
||||||
|
|
||||||
|
(deflisten mediapreview :initial "hello?"
|
||||||
|
"bash $XDG_CONFIG_HOME/eww/scripts/medpreview"
|
||||||
|
)
|
||||||
7
programs/eww/default.nix
Normal file
7
programs/eww/default.nix
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.eww.enable = true;
|
||||||
|
programs.eww.package = pkgs.eww-wayland;
|
||||||
|
programs.eww.configDir = ./config;
|
||||||
|
}
|
||||||
8
programs/ssh/default.nix
Normal file
8
programs/ssh/default.nix
Normal file
|
|
@ -0,0 +1,8 @@
|
||||||
|
{ config, pkgs, ... }:
|
||||||
|
|
||||||
|
{
|
||||||
|
programs.ssh.enable = true;
|
||||||
|
home.packages = with pkgs; [
|
||||||
|
sshfs # SSH File system
|
||||||
|
];
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue