This commit is contained in:
2025-05-03 01:16:02 +02:00
parent 4364cc2d16
commit 0f9f16c8b6
31 changed files with 529 additions and 296 deletions

View File

@@ -0,0 +1,8 @@
{}:
{
xdg.configFile."acpi" = {
recursive = true;
source = ./src;
};
}

View File

@@ -0,0 +1 @@
eww open powerpopup

View File

@@ -0,0 +1,2 @@
event=button/power.*
action=$HOME/.config/acpi/actions/power-button.sh

View File

@@ -0,0 +1,230 @@
;; /-- Variables -->
(defpoll windows
:interval "1s"
:initial "-"
`sh ~/.config/eww/scripts/xmonad_logs.sh`)
(defpoll micClass
:interval "1s"
:initial "micOff"
`sh ~/.config/eww/scripts/mic_class.sh`)
(defpoll micIcon
:interval "1s"
:initial "󰍭"
`sh ~/.config/eww/scripts/mic_icon.sh`)
(defpoll speakerClass
:interval "1s"
:initial "speakerOff"
`sh ~/.config/eww/scripts/speaker_class.sh`)
(defpoll speakerIcon
:interval "1s"
:initial ""
`sh ~/.config/eww/scripts/speaker_icon.sh`)
(defpoll speakerVolume
:interval "1s"
:initial "0"
`sh ~/.config/eww/scripts/speaker_volume.sh`)
(defpoll backlight
:interval "1s"
:initial "0"
`xbacklight -get`)
(defpoll cpu
:interval "1s"
:initial "0"
`sh ~/.config/eww/scripts/cpu.sh`)
(defpoll memory
:interval "1s"
:initial "0"
`sh ~/.config/eww/scripts/memory.sh`)
(defpoll batteryClass
:interval "1s"
:initial "speakerOff"
`sh ~/.config/eww/scripts/battery_class.sh`)
(defpoll batteryIcon
:interval "1s"
:initial ""
`sh ~/.config/eww/scripts/battery_icon.sh`)
(defpoll batteryVolume
:interval "1s"
:initial "0"
`sh ~/.config/eww/scripts/battery_volume.sh`)
(defpoll networkDown
:interval "1s"
:initial "0"
`sh ~/.config/eww/scripts/network_down.sh`)
(defpoll networkUp
:interval "1s"
:initial "0"
`sh ~/.config/eww/scripts/network_up.sh`)
(defpoll date
:interval "1s"
:initial "-"
`date '+ %a %d.%m.%y  %H:%M'`)
(defvar ws1 "ws-empty")
(defvar ws2 "ws-empty")
(defvar ws3 "ws-empty")
(defvar ws4 "ws-empty")
(defvar ws5 "ws-empty")
(defvar ws6 "ws-empty")
(defvar ws7 "ws-empty")
(defvar ws8 "ws-empty")
(defvar ws9 "ws-empty")
;; /-- Blocks -->
(defwidget widgetWorkspaces []
(box
:orientation "horizontal"
:class "workspace-buttons"
(button
:onclick "wmctrl -s 0"
:class "workspace-button ${ws1}"
(label
:text "1"))
(label
:text " ")
(button
:onclick "wmctrl -s 1"
:class "workspace-button ${ws2}"
(label
:text "2"))
(label
:text " ")
(button
:onclick "wmctrl -s 2"
:class "workspace-button ${ws3}"
(label
:text "3"))
(label
:text " ")
(button
:onclick "wmctrl -s 3"
:class "workspace-button ${ws4}"
(label
:text "4"))
(label
:text " ")
(button
:onclick "wmctrl -s 4"
:class "workspace-button ${ws5}"
(label
:text "5"))
(label
:text " ")
(button
:onclick "wmctrl -s 5"
:class "workspace-button ${ws6}"
(label
:text "6"))
(label
:text " ")
(button
:onclick "wmctrl -s 6"
:class "workspace-button ${ws7}"
(label
:text "7"))
(label
:text " ")
(button
:onclick "wmctrl -s 7"
:class "workspace-button ${ws8}"
(label
:text "8"))
(label
:text " ")
(button
:onclick "wmctrl -s 8"
:class "workspace-button ${ws9}"
(label
:text "9"))
(label
:text " ")))
(defwidget widgetWindows []
(label
:text "| ${windows}"))
(defwidget widgetMic []
(label
:class micClass
:text "${micIcon} "))
(defwidget widgetSpeaker []
(label
:class speakerClass
:text "${speakerIcon} ${speakerVolume}% "))
(defwidget widgetBacklight []
(label
:class "backlight"
:text " ${backlight}% "))
(defwidget widgetCpu []
(label
:class "cpu"
:text " ${cpu}% "))
(defwidget widgetMemory []
(label
:class "memory"
:text " ${memory}% "))
(defwidget widgetBattery []
(label
:class batteryClass
:text "${batteryIcon} ${batteryVolume}% "))
(defwidget widgetNetworkDown []
(label
:class "networkDown"
:text " ${networkDown}KiB "))
(defwidget widgetNetworkUp []
(label
:class "networkUp"
:text " ${networkUp}KiB "))
;; /-- Bar -->
(defwindow bar []
:geometry (geometry
:x "0px"
:y "0px"
:width "100%"
:height "25px"
:anchor "top center"
)
:reserve (struts
:distance "25px"
:side "top")
:windowtype "dock"
(box
:orientation "horizontal"
:space-evenly false
:class "bar"
(widgetWorkspaces)
(widgetWindows)
(box :hexpand true)
(widgetMic)
(widgetSpeaker)
(widgetBacklight)
(widgetCpu)
(widgetMemory)
(widgetBattery)
(widgetNetworkDown)
(widgetNetworkUp)
(label :text date)
)
)

View File

@@ -0,0 +1,76 @@
// <-- Preamble -->
// <-- Colors -->
$white-text: #f5e0dc;
$grey-text: #6c7086;
$grey-background: #1e1e2e;
$green: #a6e3a1;
$red: #f38ba8;
$yellow: #f9e2af;
$violet: #cba6f7;
$blue: #89b4fa;
$gold: #fab387;
// <-- Prepare all -->
* { all: unset; }
// <-- Bar -->
// <-- Widgets -->
// <-- Audio -->
.micOn {color: $green;}
.micOff {color: $red;}
.speakerOn {color: $green;}
.speakerOff {color: $red;}
// <-- Backlight -->
.backlight {color: $yellow;}
// <-- CPU & Memory -->
.cpu {color: $violet;}
.memory {color: $blue;}
// <-- Battery -->
.batteryFull {color: $gold;}
.batteryHalf {color: $green;}
.batteryEmpty {color: $red;}
.batteryCharging {color: $violet;}
.networkDown {color: $red;}
// <-- Network -->
.networkUp {color: $blue;}
// <-- Workspaces -->
.workspace-button {
background: $grey-background;
}
.ws-current {
color: $green;
}
.ws-visible {
color: $red;
}
.ws-hidden {
color: $white-text;
}
.ws-empty {
color: $grey-text;
}
// <-- Window -->
.bar {
padding: 0.2em 1em;
background: $grey-background;
color: $white-text;
font-family: "Fira Code";
font-size: 12px;
}
// <-- Powermenu -->
.powermenu-button {
background-color: #313244;
color: $white-text;
padding: 15px;
border: none;
border-radius: 6px;
font-size: 14px;
}
// <-- Window -->
.powermenu {
background-color: $grey-background;
padding: 20px;
}
.powermenuWindow {
background-color: transparent;
border: none;
box-shadow: none;
}

View File

@@ -1,50 +1,2 @@
<<<<<<< HEAD
(defwindow bar-primary
:monitor 0
:geometry (geometry :x "0px"
:y "0px"
:width "100%"
:height "25px"
:anchor "top center")
:stacking "fg"
:reserve (struts :distance 25px" :side "top")
:windowtype "dock"
:wm-ignore false
(box
:orientation "horizontal"
:halign "right"
(eventbox :onclick "notify-send Left"
:onrightclick "notify-send Right"
"Click Me!")
(rightSideBar)))
=======
(defwidget workspaces-and-windows []
(let content (split " " (file "/tmp/xmonad-eww-log"))
(let ws-list (take 9 content)
(let win-list (drop 9 content)
(box :orientation "vertical" :class "bar"
>>>>>>> test
;; Workspaces
(box :orientation "horizontal"
(for ws in ws-list
(let class (if (starts-with ws "[[")
"ws-current"
(if (starts-with ws "(")
"ws-visible"
"ws-hidden")))
(let name (string-trim ws "[]()")
(button :onclick (format "wmctrl -s %s" name)
:class class
(label :text name))))))
;; Open windows
(box :orientation "horizontal" :class "window-list"
(for win in win-list
(let class (if (starts-with win "*") "win-focused" "win")
(label :class class :text (string-trim win "*")))))
)
)
)
)
)
(include "./bar.yuck")
(include "./powerpopup.yuck")

View File

@@ -1,50 +0,0 @@
<<<<<<< HEAD
(defwindow bar-primary
:monitor 0
:geometry (geometry :x "0px"
:y "0px"
:width "100%"
:height "25px"
:anchor "top center")
:stacking "fg"
:reserve (struts :distance 25px" :side "top")
:windowtype "dock"
:wm-ignore false
(box
:orientation "horizontal"
:halign "right"
(eventbox :onclick "notify-send Left"
:onrightclick "notify-send Right"
"Click Me!")
(rightSideBar)))
=======
(defwidget workspaces-and-windows []
(let content (split " " (file "/tmp/xmonad-eww-log"))
(let ws-list (take 9 content)
(let win-list (drop 9 content)
(box :orientation "vertical" :class "bar"
>>>>>>> test
;; Workspaces
(box :orientation "horizontal"
(for ws in ws-list
(let class (if (starts-with ws "[[")
"ws-current"
(if (starts-with ws "(")
"ws-visible"
"ws-hidden")))
(let name (string-trim ws "[]()")
(button :onclick (format "wmctrl -s %s" name)
:class class
(label :text name))))))
;; Open windows
(box :orientation "horizontal" :class "window-list"
(for win in win-list
(let class (if (starts-with win "*") "win-focused" "win")
(label :class class :text (string-trim win "*")))))
)
)
)
)
)

View File

@@ -0,0 +1,49 @@
(defwidget powerpopup []
(box
:class "powermenu"
(button
:onclick "systemctl poweroff"
:class "powermenu-button"
(label
:text "⏻ "))
(label
:text " ")
(button
:onclick "loginctl lock-session"
:class "powermenu-button"
(label
:text ""))
(label
:text " ")
(button
:onclick "systemctl reboot"
:class "powermenu-button"
(label
:text ""))
(label
:text "")
(button
:onclick "loginctl terminate-user $USER"
:class "powermenu-button"
(label
:text ""))))
(defwidget powermenu [shutdown shutdown_icon reboot
reboot_icon logout logout_icon]
(box :class "powermenu" :spacing 5
:vexpand true :hexpand true
:valign "end" :halign "end"
:space-evenly false
(button :onclick shutdown shutdown_icon)
(button :onclick reboot reboot_icon)
(button :onclick logout logout_icon)))
(defwindow power []
:class "powermenuWindow"
:geometry (geometry
:width "200px"
:height "50px"
:anchor "center center"
:x "0%"
:y "0%")
(powerpopup)
)

View File

@@ -0,0 +1,14 @@
bat=$(cat /sys/class/power_supply/BAT0/capacity)
stat=$(cat /sys/class/power_supply/BAT0/status)
class="batteryFull"
if [[ $stat == "Charging" ]]; then
class="batteryCharging"
elif [[ $bat -le 10 ]]; then
class="batteryEmpty"
elif [[ $bat -le 80 ]]; then
class="batteryHalf"
fi
echo "$class"

View File

@@ -0,0 +1,16 @@
bat=$(cat /sys/class/power_supply/BAT0/capacity)
stat=$(cat /sys/class/power_supply/BAT0/status)
icon=""
if [[ $stat == "Charging" ]]; then
icon=""
elif [[ $bat -le 10 ]]; then
icon=""
elif [[ $bat -le 50 ]]; then
icon=""
elif [[ $bat -le 80 ]]; then
icon=""
fi
echo "$icon"

View File

@@ -0,0 +1,2 @@
bat=$(cat /sys/class/power_supply/BAT0/capacity)
echo "$bat"

View File

@@ -0,0 +1,5 @@
cpu_idle=$(top -bn1 | awk '/Cpu\(s\)/ {print $8}')
cpu_used=$(awk "BEGIN {print 100 - $cpu_idle}")
# Print only the numeric result
printf "%.0f\n" "$cpu_used"

View File

@@ -0,0 +1,6 @@
mem_info=$(free | grep Mem)
used=$(echo "$mem_info" | awk '{print $3}')
total=$(echo "$mem_info" | awk '{print $2}')
mem_used=$(awk "BEGIN {print int($used/$total * 100)}")
echo "$mem_used"

View File

@@ -0,0 +1,5 @@
if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q "yes"; then
echo "micOff"
else
echo "micOn"
fi

View File

@@ -0,0 +1,5 @@
if pactl get-source-mute @DEFAULT_SOURCE@ | grep -q "yes"; then
echo "󰍭" # muted
else
echo "󰍬" # unmuted
fi

View File

@@ -0,0 +1,11 @@
# You can change this if your interface is named differently (e.g., eth0, enp3s0)
INTERFACE=$(ip route get 1.1.1.1 | awk '{print $5; exit}')
RX_PREV=$(cat /sys/class/net/$INTERFACE/statistics/rx_bytes)
sleep 1
RX_CUR=$(cat /sys/class/net/$INTERFACE/statistics/rx_bytes)
# Calculate download/upload in KiB/s
RX_RATE=$(((RX_CUR - RX_PREV) / 1024))
# Output formatted for Eww
echo "${RX_RATE}"

View File

@@ -0,0 +1,8 @@
# You can change this if your interface is named differently (e.g., eth0, enp3s0)
INTERFACE=$(ip route get 1.1.1.1 | awk '{print $5; exit}')
TX_PREV=$(cat /sys/class/net/$INTERFACE/statistics/tx_bytes)
sleep 1
TX_CUR=$(cat /sys/class/net/$INTERFACE/statistics/tx_bytes)
TX_RATE=$(((TX_CUR - TX_PREV) / 1024))
echo "${TX_RATE}"

View File

@@ -0,0 +1,8 @@
mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%')
if [[ "$mute" == "yes" ]]; then
echo "speakerOff" # muted icon
else
echo "speakerOn" # high volume
fi

View File

@@ -0,0 +1,10 @@
mute=$(pactl get-sink-mute @DEFAULT_SINK@ | awk '{print $2}')
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%')
if [[ "$mute" == "yes" ]]; then
echo "" # muted icon
elif [[ "$volume" -le 100 ]]; then
echo "" # low volume
else
echo "" # high volume
fi

View File

@@ -0,0 +1,4 @@
volume=$(pactl get-sink-volume @DEFAULT_SINK@ | awk '{print $5}' | tr -d '%')
half_volume=$((volume / 2))
echo "$half_volume"

View File

@@ -1,4 +0,0 @@
tail -F /tmp/xmonad-eww-log | while read -r line; do
clean_line=$(echo "$line" | sed -E 's/<[^>]+>//g')
eww update xmonad_log="$clean_line"
done

View File

@@ -0,0 +1,19 @@
line=$(cat /tmp/xmonad-eww-log)
IFS='|' read -r workspaces windows <<<"$line"
# Workspaces
workspaceArray=($workspaces)
i=0
for ws in "${workspaceArray[@]}"; do
i=$((i + 1))
if [[ "$ws" == [\[]* ]]; then
eww update ws$i="ws-current"
elif [[ "$ws" == [\(]* ]]; then
eww update ws$i="ws-visible"
elif [[ "$ws" == [\{]* ]]; then
eww update ws$i="ws-hidden"
else
eww update ws$i="ws-empty"
fi
done
# Windows
echo "${windows}"

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 MiB

View File

@@ -10,10 +10,6 @@ in {
nerd-fonts.jetbrains-mono
texliveFull
clang-tools
<<<<<<< HEAD
=======
vimPlugins.catppuccin-nvim
>>>>>>> test
];
programs.neovim = {
@@ -34,6 +30,7 @@ in {
cmp_luasnip
conform-nvim
conjure
comment-nvim
dropbar-nvim
friendly-snippets
lazy-nvim
@@ -95,11 +92,7 @@ in {
neovim-remote
# Nix
nixd
<<<<<<< HEAD
nixfmt-classic
=======
nixfmt-rfc-style
>>>>>>> test
# Rust
rust-analyzer
# Bash

View File

@@ -29,11 +29,7 @@ return {
markdown = { "prettierd" },
json = { "prettierd" },
yaml = { "prettierd" },
<<<<<<< HEAD
nix = { "nixfmt-classic" },
=======
nix = { "nixfmt-rfc-style" },
>>>>>>> test
tex = { "latexindent" },
c = { "clang_format" },
cpp = { "clang_format" },
@@ -55,7 +51,6 @@ return {
},
clang_format = {
prepend_args = {
"--style=file:./.clang-format",
"--fallback-style=LLVM",
},
},

View File

@@ -19,7 +19,7 @@ import XMonad.Util.SpawnOnce (spawnOnce)
import XMonad.Hooks.ManageHelpers
main = do
xmonad . ewmhFullscreen . ewmh $ myConfig
xmonad . docks . ewmhFullscreen . ewmh $ myConfig
myConfig =
def
@@ -50,16 +50,15 @@ myKeys =
, ("M-c", spawn "firefox")
, ("M-y", spawn "signal-desktop")
, ("M-x", spawn "telegram-desktop")
, ("M-c", spawn "firefox")
, ("M-v", spawn "thunderbird")
, -- Brightness
("<XF86MonBrightnessUp>", spawn "xbacklight -inc 10")
, ("<XF86MonBrightnessDown>", spawn "xbacklight -dec 10")
, -- Audio
("<XF86AudioMute>", spawn "pulseaudio-ctl mute")
, ("<XF86AudioRaiseVolume>", spawn "pulseaudio-ctl up 5")
, ("<XF86AudioLowerVolume>", spawn "pulseaudio-ctl down 5")
, ("<XF86AudioMicMute>", spawn "pulseaudio-ctl mute-input")
("<XF86AudioMute>", spawn "pactl set-sink-mute @DEFAULT_SINK@ toggle")
, ("<XF86AudioRaiseVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ +10%")
, ("<XF86AudioLowerVolume>", spawn "pactl set-sink-volume @DEFAULT_SINK@ -10%")
, ("<XF86AudioMicMute>", spawn "pactl set-source-mute @DEFAULT_SOURCE@ toggle")
]
-- `removeKeysP` [ "M-S-q" ]
@@ -69,18 +68,18 @@ myXmobarPP =
def
{ ppOutput = \str -> do
writeFile "/tmp/xmonad-eww-log" str
, ppCurrent = wrap "[[" "]]"
, ppCurrent = wrap "[" "]"
, ppVisible = wrap "(" ")"
, ppHidden = wrap " " " "
, ppHidden = wrap "{" "}"
, ppHiddenNoWindows = id
, ppUrgent = wrap "!" "!"
, ppSep = " "
, ppSep = "|"
, ppOrder = \(ws : _ : _ : wins : _) -> [ws, wins]
, ppExtras = [logTitles formatFocused formatUnfocused]
}
where
formatFocused = wrap "*" "*" . ppWindow
formatUnfocused = id . ppWindow
formatFocused = wrap "(" ")" . ppWindow
formatUnfocused = wrap "[" "]" . ppWindow
ppWindow :: String -> String
ppWindow w = if null w then "???" else take 30 w
@@ -97,5 +96,5 @@ myManageHooks =
myStartupHook :: X ()
myStartupHook = do
spawnOnce "nextcloud --background"
spawnOnce "trayer --edge top --align left --widthtype request --height 25 --transparent true --alpha 0 --expand false --SetDockType true --SetPartialStrut true --monitor primary &"
spawnOnce "trayer --edge top --align left --widthtype request --height 25 --transparent true --alpha 0 --expand true --SetDockType true --SetPartialStrut true"
spawnOnce "eww open bar"

View File

@@ -28,7 +28,7 @@
path = "${config.xdg.dataHome}/zsh/zsh_history";
};
syntaxHighlighting = { enable = true; };
initExtra = ''
initContent = ''
export LD_LIBRARY_PATH="/nix/store/yjm4j9n85bcp42v5nkz2xifrp4a9s63k-sqlite-3.46.1/lib"o
export CHROME_EXECUTABLE="/run/current-system/sw/bin/google-chrome-stable"
neofetch