Adding eww

This commit is contained in:
Miguel Palhas
2024-10-02 18:31:30 +01:00
parent 52dff5d699
commit a99c965d05
6 changed files with 452 additions and 34 deletions
+3
View File
@@ -4,6 +4,7 @@
inputs.nixvim.homeManagerModules.nixvim
../common/programs/default.nix
../common/programs/hyprland.nix
../common/programs/eww.nix
../common/programs/kitty.nix
];
@@ -23,6 +24,8 @@
];
};
programs.kitty.settings.font_size = 8;
colorscheme = inputs.nix-colors.colorSchemes.catppuccin-frappe;
programs = {
+421
View File
@@ -0,0 +1,421 @@
{ config, pkgs, ... }: {
home.packages = [ pkgs.eww ];
xdg.configFile = {
"eww/eww.yuck".text = ''
;; Variables
(defpoll clock_time :interval "5s" "date +\%I:%M")
(defpoll clock_date :interval "1m" "date '+%d/%m'")
(defpoll volume_percent :interval "3s" :initial 0 "pactl get-sink-volume @DEFAULT_SINK@ | head -n1 | cut -d'/' -f 2 | xargs | tr -d '%'")
;; (defpoll brightness_percent :interval "5s" "brightnessctl -m -d intel_backlight | awk -F, '{print substr($4, 0, length($4)-1)}' | tr -d '%'")
(defpoll bwindowrulesattery :interval "15s" "./scripts/battery --bat")
(defpoll battery_status :interval "1m" "./scripts/battery --bat-st")
(defpoll memory :interval "5s" :initial 0 "scripts/memory")
(defpoll cpu :interval "5s" :initial 0 "scripts/cpu")
(defpoll cputemp :interval "5s" :initial 0 "scripts/cputemp")
(defpoll memory_used_mb :interval "2m" "scripts/mem-ad used")
(defpoll memory_total_mb :interval "2m" "scripts/mem-ad total")
(defpoll memory_free_mb :interval "2m" "scripts/mem-ad free")
(defvar bar_hover false)
(deflisten workspace "scripts/workspace")
(defvar eww "/home/naps62/.bin/eww -c $HOME/.config/eww")
(defvar exec_audio_control "hyprctl dispatch exec '[center]' pavucontrol")
(defvar exec_nmtui "hyprctl dispatch exec '[center]' 'kitty --class eww-nmtui -e nmtui'")
(defvar exec_workspace_scroll "echo {} | sed -e 's/up/-1/g' -e 's/down/+1/g' | xargs hyprctl dispatch workspace")
(defpoll network_name :interval "1m" "~/.config/eww/scripts/network name")
(defpoll network_icon :interval "1m" "~/.config/eww/scripts/network icon")
(defpoll network_class :interval "1m" "~/.config/eww/scripts/network class")
;;
;; widgets
;;
(defwidget widget_network []
(box :class "network" :space-evenly "false"
(button :class "${network_class}" :onclick exec_nmtui "${network_icon} ${network_name}")))
(defwidget widget_workspaces []
(eventbox :onscroll exec_workspace_scroll
(literal :content workspace))
)
;; (defwidget widget_battery []
;; (circular-progress :value battery
;; :class "circle battery"
;; :thickness 4
;; (button
;; :class "icon"
;; :tooltip "battery on ${battery}%"
;; "󰂁")))
(defwidget widget_cputemp []
(circular-progress :value cputemp
:class "circle cputemp"
:thickness 4
(button
:class "icon"
:onclick "$HOME/.config/eww/scripts/pop system"
"󰔏")))
(defwidget widget_ram []
(circular-progress :value memory
:class "circle memory"
:thickness 4
(button
:class "icon"
:tooltip "using ${memory}% ram"
:onclick "$HOME/.config/eww/scripts/pop system"
"󰍛")))
(defwidget widget_cpu []
(circular-progress :value cpu
:class "circle cpu"
:thickness 4
(button
:class "icon"
:tooltip "using ${memory}% CPU"
:onclick "$HOME/.config/eww/scripts/pop system"
"󰻠")))
(defwidget widget_space []
(box :class "space"))
(defwidget widget_clock []
(box :class "clock"
(label :text clock_time :class "clock-time")
(button :class "clock-date" clock_date)))
(defwidget widget_volume []
(box :class "volume" :space-evenly "false"
(button :onclick exec_audio_control "󰕾")
(scale :class "slider"
:value volume_percent
:tooltip "${volume_percent}%"
:max 100
:min 0
:onchange "pactl set-sink-volume @DEFAULT_SINK@ {}%" )))
;; (defwidget widget_bright []
;; (eventbox :onhover "${eww} update br_reveal=true" :onhoverlost "${eww} update br_reveal=false"
;; (box :class "module-2" :space-evenly "false" :orientation "h" :spacing "3"
;; (label :text "" :class "bright_icon" :tooltip "brightness")
;; (revealer :transition "slideleft"
;; :reveal br_reveal
;; :duration "350ms"
;; (scale :class "slider brightness"
;; :value brightness_percent
;; :orientation "h"
;; :tooltip "${brightness_percent}%"
;; :max 100
;; :min 0
;; :onchange "brightnessctl set {}%" )))))
;;
;; bar layout
;;
(defwidget left []
(box :orientation "h"
:space-evenly false
:halign "start"
(widget_workspaces)))
(defwidget center []
(box :orientation "h"
:space-evenly false
:halign "center"
(box)))
(defwidget right []
(box :orientation "h"
:space-evenly false
:halign "end"
;; (widget_bright)
(widget_volume)
(widget_network)
(widget_space)
;; (widget_battery)
(widget_ram)
(widget_cpu)
(widget_cputemp)
(widget_space)
(systray)
(widget_space)
(widget_clock)
(widget_space)))
(defwidget bar_inner []
(box
:orientation "h"
(left)
(right)))
;;
;; main window
;;
(defwindow bar
:geometry (
geometry
:x "0%"
:y "0px"
:width "2080px"
:anchor "top center")
:windowtype "dock"
:monitor 0
:exclusive true
(bar_inner))
'';
"eww/eww.scss".text = ''
//
// catppuccin-mocha
//
$rosewater: #f5e0dc;
$flamingo: #f2cdcd;
$pink: #ff3ac6;
$mauve: #cba6f7;
$red: #f38ba8;
$maroon: #eba0ac;
$peach: #f9e2af;
$yellow: #f9e2af;
$green: #a6e3a1;
$teal: #94e2d5;
$sky: #89dceb;
$sapphire: #74c7ec;
$blue: #89b4fa;
$lavender: #b4befe;
$text: #cdd6f4;
$subtext1: #bac2de;
$subtext0: #a6adc8;
$overlay2: #9399b2;
$overlay1: #7f849c;
$overlay0: #6c7086;
$surface2: #585b70;
$surface1: #45475a;
$surface0: #313244;
$base: #1e1e2e;
$mantle: #181825;
$crust: #11111b;
:not(menu):not(menuitem) {
all: unset;
font-family:
Material Design Icons,
FiraCode Nerd Font;
}
//
// color theming
//
tooltip.background,
.window,
menu,
menuitem,
.bar {
background-color: $crust;
}
.memory * {
color: $mauve;
}
.cpu * {
color: $peach;
}
.cputemp * {
color: $red;
}
.battery * {
color: $red;
}
.clock {
color: $text;
}
//
// General
//
.bar {
// min-height: 30px;
font-size: 16;
transition: all 0.1s ease-out;
border-radius: 0px 0px 10 10;
}
.bar {
opacity: 1;
}
.space {
margin: 0px 10px;
}
//
// tooltip
//
tooltip.background {
border-radius: 10px;
}
tooltip label {
}
//
// clock
//
.clock-time {
font-weight: bold;
margin-right: 5px;
}
//
// circular bars
//
.circle {
border-radius: 10px;
margin: 0 5;
}
.circle .icon {
font-size: 16px;
padding: 10px;
}
//
// sliders
//
.slider,
.slider trough highlight {
border-radius: 10px;
}
//
// network
//
.network,
.volume {
margin: 0 5px;
& button {
margin-right: 10;
}
.connected {
color: $green;
}
.disconnected {
color: $peach;
}
}
//
// brightness
//
.bright_icon {
font-size: 12;
color: #e4c9af;
}
//
// sliders
//
.slider trough highlight {
background-image: linear-gradient(
to right,
$yellow 30%,
$peach 50%,
$red 100% * 50
);
}
scale trough {
background-color: $surface1;
border-radius: 16px;
min-height: 10px;
min-width: 100px;
}
//
// systray
//
menu {
border-radius: 16px;
}
menuitem {
padding: 8px;
border-radius: 8px;
color: $text;
background-color: $surface2;
&:disabled {
color: $overlay2;
}
}
//
// workspaces
//
.w0,
.w01,
.w02,
.w03,
.w04,
.w05,
.w06,
.w011,
.w022,
.w033,
.w044,
.w055,
.w066 {
border-radius: 10px;
font-size: 16px;
padding: 5px 5;
min-height: 25px;
min-width: 60px;
}
// Unoccupied
.w0 {
color: $overlay0;
}
// Occupied
.w01,
.w02,
.w03,
.w04,
.w05,
.w06 {
color: $text;
}
// Focused
.w011,
.w022,
.w033,
.w044,
.w055,
.w066 {
font-size: 16px;
background-color: $sky;
color: $crust;
font-weight: bold;
}
'';
};
}
+7 -7
View File
@@ -98,13 +98,13 @@
"$mod, mouse_up, workspace, e-1"
# media
"XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
"XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
"XF86AudioNext, exec, playerctl next"
"XF86AudioPrev, exec, playerctl previous"
"XF86AudioPlay, exec, playerctl play-pause"
"XF86MonBrightnessUp, exec, light -A 10"
"XF86MonBrightnessDown, exec, light -U 10"
", XF86AudioRaiseVolume, exec, wpctl set-volume -l 1.5 @DEFAULT_AUDIO_SINK@ 5%+"
", XF86AudioLowerVolume, exec, wpctl set-volume @DEFAULT_AUDIO_SINK@ 5%-"
", XF86AudioNext, exec, playerctl next"
", XF86AudioPrev, exec, playerctl previous"
", XF86AudioPlay, exec, playerctl play-pause"
", XF86MonBrightnessUp, exec, light -A 10"
", XF86MonBrightnessDown, exec, light -U 10"
];
};
};
+19 -19
View File
@@ -8,35 +8,35 @@
enabled_layouts = "tall, grid, fat, splits";
# font
font_family = "FiraCode Nerd Font Reg";
font_family = "FiraCode Nerd Font Regular";
bold_font = "FiraCode Nerd Font Bold";
italic_font = "VictorMono Nerd Font Mono Oblique";
bold_italic_font = "VictorMono Nerd Font Mono Bold Oblique";
font_size = 12;
disable_ligatures = "cursor";
# keys
keybindings = {
"kitty_mod+t" = "new_tab_with_cmd";
"kitty_mod+enter" = "new_window_with_cwd";
"kitty_mod+r" = "set_tab_title";
};
"kitty_mod+u" = "previous_tab";
"kitty_mod+i" = "next_tab";
keybindings = {
"kitty_mod+t" = "new_tab_with_cmd";
"kitty_mod+enter" = "new_window_with_cwd";
"kitty_mod+r" = "set_tab_title";
"ctrl+shift+l" = "next_layout";
"ctrl+shift+left" = "resize_window narrower";
"ctrl+shift+right" = "resize_window right";
"kitty_mod+u" = "previous_tab";
"kitty_mod+i" = "next_tab";
"ctrl+shift+0x27" = "change_font_size all +2.0";
"ctrl+shift+minus" = "change_font_size all -2.0";
"ctrl+shift+backspace" = "change_font_size all 0";
"ctrl+shift+l" = "next_layout";
"ctrl+shift+left" = "resize_window narrower";
"ctrl+shift+right" = "resize_window right";
"kitty_mod+h" = "neighboring_window left";
"kitty_mod+j" = "neighboring_window down";
"kitty_mod+k" = "neighboring_window up";
"kitty_mod+l" = "neighboring_window right";
};
"ctrl+shift+0x27" = "change_font_size all +2.0";
"ctrl+shift+minus" = "change_font_size all -2.0";
"ctrl+shift+backspace" = "change_font_size all 0";
"kitty_mod+h" = "neighboring_window left";
"kitty_mod+j" = "neighboring_window down";
"kitty_mod+k" = "neighboring_window up";
"kitty_mod+l" = "neighboring_window right";
};
};
}
-6
View File
@@ -35,10 +35,4 @@ in {
hashedPassword =
"$y$j9T$0p/ZYQsSA/FroVjV59pI/0$LKyzass6W9GjJR0GLWI6xhVrLi0b5AYYMR3MvQKNK11";
};
fileSystems."mnt/nfs" = {
device = "192.168.122.1:/home/naps62/projects/nixos";
fsType = "nfs";
options = [ "rw" "soft" ];
};
}
+2 -2
View File
@@ -11,6 +11,7 @@
pkgs.obs-studio
pkgs.calibre
pkgs.gimp
pkgs.font-manager
# communication
pkgs.slack
@@ -21,7 +22,6 @@
pkgs.bruno
pkgs.bun
pkgs.fira-code
];
fonts = {
@@ -38,7 +38,7 @@
defaultFonts = {
serif = [ "Libertine" ];
sansSerif = [ "Ubuntu" ];
monospace = [ "FiraCode" ];
monospace = [ "FiraCode" "VictorMono" ];
};
};
};