Migrate to snowfall lib
This commit is contained in:
94
modules/home/wayland/apps/dunst/default.nix
Executable file
94
modules/home/wayland/apps/dunst/default.nix
Executable file
@ -0,0 +1,94 @@
|
||||
{ lib, config, pkgs, ... }: {
|
||||
|
||||
config = lib.mkIf (config.homecfg.wm == "Wayland") {
|
||||
home.packages = with pkgs; [ libnotify ];
|
||||
services.dunst = {
|
||||
enable = true;
|
||||
#waylandDisplay = "DP-2";
|
||||
settings = {
|
||||
global = {
|
||||
follow = "mouse";
|
||||
height = "200";
|
||||
width = "400";
|
||||
scale = "0";
|
||||
origin = "top-right";
|
||||
offset = "4x40";
|
||||
notification_limit = "0";
|
||||
progress_bar = "true";
|
||||
progress_bar_height = "10";
|
||||
progress_bar_frame_width = "0";
|
||||
progress_bar_min_width = "350";
|
||||
progress_bar_max_width = "400";
|
||||
indicate_hidden = "yes";
|
||||
transparency = "0";
|
||||
separator_height = "2";
|
||||
padding = "12";
|
||||
horizontal_padding = "15";
|
||||
text_icon_padding = "0";
|
||||
frame_width = "2";
|
||||
frame_color = "#${config.colorScheme.colors.base03}";
|
||||
separator_color = "auto";
|
||||
sort = "yes";
|
||||
font = "IBM Plex Mono 14";
|
||||
markup = "full";
|
||||
format = ''<b>%s</b>\n<span size="small">%b</span>'';
|
||||
alignment = "center";
|
||||
vertical_alignment = "center";
|
||||
show_age_threshold = "60";
|
||||
ellipsize = "end";
|
||||
ignore_newline = "no";
|
||||
stack_duplicates = "true";
|
||||
hide_duplicate_count = "false";
|
||||
show_indicators = "yes";
|
||||
min_icon_size = 32;
|
||||
max_icon_size = 64;
|
||||
|
||||
icon_path =
|
||||
"/usr/share/icons/gnome/128x128/status/:/usr/share/icons/gnome/128x128/devices/";
|
||||
icon_theme = "Papirus, Adwaita";
|
||||
enable_recursive_icon_lookup = "true";
|
||||
|
||||
sticky_history = "yes";
|
||||
history_length = "20";
|
||||
|
||||
dmenu = "wofi --show dmenu -p dunst:";
|
||||
browser = "/usr/bin/xdg-open";
|
||||
always_run_script = "true";
|
||||
title = "Dunst";
|
||||
class = "Dunst";
|
||||
corner_radius = "10";
|
||||
ignore_dbusclose = "false";
|
||||
layer = "top";
|
||||
force_xwayland = "true";
|
||||
force_xinerama = "false";
|
||||
|
||||
mouse_left_click = "close_current";
|
||||
mouse_middle_click = "context";
|
||||
mouse_right_click = "do_action";
|
||||
|
||||
};
|
||||
urgency_low = {
|
||||
background = "#${config.colorScheme.colors.base00}";
|
||||
foreground = "#${config.colorScheme.colors.base07}";
|
||||
frame_color = "#${config.colorScheme.colors.base03}";
|
||||
timeout = "3";
|
||||
highlight = "#${config.colorScheme.colors.base0B}";
|
||||
};
|
||||
urgency_normal = {
|
||||
background = "#${config.colorScheme.colors.base00}";
|
||||
foreground = "#${config.colorScheme.colors.base07}";
|
||||
frame_color = "#${config.colorScheme.colors.base03}";
|
||||
timeout = "5";
|
||||
highlight = "#${config.colorScheme.colors.base0C}";
|
||||
};
|
||||
urgency_critical = {
|
||||
background = "#${config.colorScheme.colors.base00}";
|
||||
foreground = "#${config.colorScheme.colors.base0F}";
|
||||
frame_color = "#${config.colorScheme.colors.base03}";
|
||||
timeout = "10";
|
||||
highlight = "#${config.colorScheme.colors.base0E}";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
31
modules/home/wayland/apps/eww/css/_calendar.scss
Executable file
31
modules/home/wayland/apps/eww/css/_calendar.scss
Executable file
@ -0,0 +1,31 @@
|
||||
.calendar-win {
|
||||
@include window;
|
||||
background-color: $bg;
|
||||
color: $fg;
|
||||
padding: .2em;
|
||||
}
|
||||
|
||||
calendar {
|
||||
padding: 5px;
|
||||
|
||||
:selected {
|
||||
color: $base0C;
|
||||
}
|
||||
|
||||
.header {
|
||||
color: $base05;
|
||||
}
|
||||
|
||||
.highlight {
|
||||
color: $base0C;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.button {
|
||||
color: $base0C;
|
||||
}
|
||||
|
||||
:indeterminate {
|
||||
color: $base03;
|
||||
}
|
||||
}
|
123
modules/home/wayland/apps/eww/css/_sidebar.scss
Executable file
123
modules/home/wayland/apps/eww/css/_sidebar.scss
Executable file
@ -0,0 +1,123 @@
|
||||
.system-menu-box {
|
||||
@include window;
|
||||
background-color: $bg;
|
||||
color: $fg;
|
||||
}
|
||||
|
||||
.separator {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
.top-row {
|
||||
margin: 1rem 1.5rem 0;
|
||||
|
||||
.time { font-size: 2rem; }
|
||||
|
||||
.date-box {
|
||||
margin: 0 1rem;
|
||||
|
||||
label { font-size: 1.1rem; }
|
||||
|
||||
.date {
|
||||
background: unset;
|
||||
margin: 0 .5rem 0 0;
|
||||
padding: 0;
|
||||
}
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: $bg1;
|
||||
border-radius: 16px;
|
||||
margin-bottom: .1rem;
|
||||
padding: 0 .5rem;
|
||||
|
||||
label { font-size: 1.5rem; }
|
||||
&:hover { background-color: $bg1; }
|
||||
}
|
||||
}
|
||||
|
||||
.system-row {
|
||||
margin: .5rem .7rem;
|
||||
|
||||
label {
|
||||
font-size: 1rem;
|
||||
margin: 0 .1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.element {
|
||||
@include rounding;
|
||||
background-color: $bg1;
|
||||
margin: .3rem;
|
||||
|
||||
button {
|
||||
@include rounding;
|
||||
padding: 1rem 3rem;
|
||||
|
||||
label {
|
||||
font-size: 1.5rem;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background-color: rgba(255, 255, 255, 0.2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.sliders {
|
||||
@include rounding;
|
||||
background-color: $bg1;
|
||||
margin: .5rem 1rem;
|
||||
padding: .6rem 1rem;
|
||||
|
||||
scale {
|
||||
margin-right: -1rem;
|
||||
min-width: 21.5rem;
|
||||
|
||||
trough { margin-right: 0; }
|
||||
}
|
||||
|
||||
box { margin: .2rem 0; }
|
||||
label { font-size: 1.2rem; }
|
||||
}
|
||||
|
||||
.volume-slider-box,
|
||||
.brightness-slider-box {
|
||||
trough { background-color: $base02; }
|
||||
}
|
||||
|
||||
.volume-bar highlight {
|
||||
@include rounding;
|
||||
background-image: linear-gradient(to right, $base0B, $base0C);
|
||||
}
|
||||
|
||||
.brightness-bar highlight {
|
||||
@include rounding;
|
||||
background-image: linear-gradient(to right, $base0A, $base0B);
|
||||
}
|
||||
|
||||
.bottom-row {
|
||||
margin: .5rem 1rem;
|
||||
|
||||
.battery-icon { font-size: 2rem; }
|
||||
.battery-wattage { color: $base0A; }
|
||||
|
||||
.battery-status {
|
||||
color: $base04;
|
||||
margin: 0 .5rem;
|
||||
}
|
||||
}
|
||||
|
||||
.bt-connected {
|
||||
background-color: $base0C;
|
||||
color: $base00;
|
||||
|
||||
button:hover { background-color: rgba(0, 0, 0, .3); }
|
||||
}
|
||||
|
||||
.net-connected {
|
||||
background-color: $base0C;
|
||||
color: $base00;
|
||||
|
||||
button:hover { background-color: rgba(0, 0, 0, .3); }
|
||||
}
|
76
modules/home/wayland/apps/eww/css/_system.scss
Executable file
76
modules/home/wayland/apps/eww/css/_system.scss
Executable file
@ -0,0 +1,76 @@
|
||||
.membar {
|
||||
color: $base08;
|
||||
}
|
||||
|
||||
.cpubar {
|
||||
color: $base0C;
|
||||
}
|
||||
|
||||
.batbar {
|
||||
color: $base0B;
|
||||
}
|
||||
|
||||
.membar,
|
||||
.cpubar,
|
||||
.batbar {
|
||||
background-color: $bg1;
|
||||
}
|
||||
|
||||
.iconmem {
|
||||
color: $base08;
|
||||
}
|
||||
|
||||
.iconcpu {
|
||||
color: $base0C;
|
||||
}
|
||||
|
||||
.icon-text {
|
||||
font-size: 3rem;
|
||||
padding: .7rem;
|
||||
}
|
||||
|
||||
.sys-text-sub {
|
||||
color: $fg;
|
||||
}
|
||||
|
||||
.sys-text-mem,
|
||||
.sys-text-cpu {
|
||||
font-size: 1rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.sys-icon-mem,
|
||||
.sys-icon-cpu {
|
||||
font-size: 1.5rem;
|
||||
margin: 1.5rem;
|
||||
}
|
||||
|
||||
.system-info-box {
|
||||
@include rounding;
|
||||
background-color: $bg1;
|
||||
margin: .5rem 1rem;
|
||||
padding: .5rem;
|
||||
}
|
||||
|
||||
.sys-mem,
|
||||
.sys-cpu {
|
||||
background-color: $bg;
|
||||
}
|
||||
|
||||
.sys-icon-mem,
|
||||
.sys-text-mem,
|
||||
.sys-mem {
|
||||
color: $base08;
|
||||
}
|
||||
|
||||
.sys-icon-cpu,
|
||||
.sys-text-cpu,
|
||||
.sys-cpu {
|
||||
color: $base0C;
|
||||
}
|
||||
|
||||
.sys-box {
|
||||
margin: .3em;
|
||||
|
||||
box { margin-left: 1rem; }
|
||||
}
|
43
modules/home/wayland/apps/eww/default.nix
Executable file
43
modules/home/wayland/apps/eww/default.nix
Executable file
@ -0,0 +1,43 @@
|
||||
{ lib, config, pkgs, ... }: {
|
||||
|
||||
config = lib.mkIf (config.homecfg.wm == "Wayland") {
|
||||
home.packages = with pkgs; [ eww-wayland jaq ];
|
||||
|
||||
xdg.configFile."eww" = {
|
||||
source = lib.cleanSourceWith {
|
||||
filter = name: _type:
|
||||
let baseName = baseNameOf (toString name);
|
||||
in !(lib.hasSuffix ".nix" baseName) && (baseName != "_colors.scss");
|
||||
src = lib.cleanSource ./.;
|
||||
};
|
||||
|
||||
recursive = true;
|
||||
};
|
||||
|
||||
# colors file
|
||||
xdg.configFile."eww/css/_colors.scss".text = ''
|
||||
$base00: #${config.colorScheme.colors.base00};
|
||||
$base01: #${config.colorScheme.colors.base01};
|
||||
$base02: #${config.colorScheme.colors.base02};
|
||||
$base03: #${config.colorScheme.colors.base03};
|
||||
$base04: #${config.colorScheme.colors.base04};
|
||||
$base05: #${config.colorScheme.colors.base05};
|
||||
$base06: #${config.colorScheme.colors.base06};
|
||||
$base07: #${config.colorScheme.colors.base07};
|
||||
$base08: #${config.colorScheme.colors.base08};
|
||||
$base09: #${config.colorScheme.colors.base09};
|
||||
$base0A: #${config.colorScheme.colors.base0A};
|
||||
$base0B: #${config.colorScheme.colors.base0B};
|
||||
$base0C: #${config.colorScheme.colors.base0C};
|
||||
$base0D: #${config.colorScheme.colors.base0D};
|
||||
$base0E: #${config.colorScheme.colors.base0E};
|
||||
$base0F: #${config.colorScheme.colors.base0F};
|
||||
|
||||
|
||||
$fg: $base07;
|
||||
$bg: $base00;
|
||||
$bg1: $base01;
|
||||
$border: $base03;
|
||||
'';
|
||||
};
|
||||
}
|
109
modules/home/wayland/apps/eww/eww.scss
Executable file
109
modules/home/wayland/apps/eww/eww.scss
Executable file
@ -0,0 +1,109 @@
|
||||
@import 'css/colors';
|
||||
|
||||
@mixin rounding {
|
||||
border-radius: 16px;
|
||||
}
|
||||
|
||||
@mixin window {
|
||||
border: 2px solid $base03;
|
||||
margin: 5px 5px 10px;
|
||||
@include rounding;
|
||||
}
|
||||
|
||||
* {
|
||||
all: unset;
|
||||
font-family: "IBM Plex Mono";
|
||||
transition: 200ms ease;
|
||||
}
|
||||
|
||||
@import 'css/calendar';
|
||||
@import 'css/sidebar';
|
||||
@import 'css/system';
|
||||
|
||||
.bar {
|
||||
background-color: $bg;
|
||||
color: $fg;
|
||||
border-bottom: 2px solid $base03;
|
||||
|
||||
label {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
tooltip {
|
||||
background: $bg;
|
||||
border: 1px solid $border;
|
||||
border-radius: 8px;
|
||||
|
||||
label {
|
||||
font-size: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.icon,
|
||||
.icon label { font-family: Material Design Icons; }
|
||||
|
||||
.ws {
|
||||
border-radius: 2rem;
|
||||
margin: .7rem .25rem;
|
||||
}
|
||||
|
||||
.focused {
|
||||
background-color: $bg;
|
||||
border-radius: 1rem;
|
||||
margin: .3rem;
|
||||
padding: .25rem;
|
||||
}
|
||||
|
||||
.module { margin: 0 5px; }
|
||||
|
||||
.hour {
|
||||
font-weight: bold;
|
||||
padding-left: 5px;
|
||||
}
|
||||
|
||||
.minute {
|
||||
padding-right: .7rem;
|
||||
}
|
||||
|
||||
.date {
|
||||
background: $bg;
|
||||
color: $base0C;
|
||||
|
||||
label {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.bright-icon { color: $base09; }
|
||||
.module-bt { font-size: 1.2rem; }
|
||||
|
||||
scale trough {
|
||||
background-color: $bg1;
|
||||
border-radius: 24px;
|
||||
margin: 0 1rem;
|
||||
min-height: 10px;
|
||||
min-width: 70px;
|
||||
}
|
||||
|
||||
.workspaces { margin-left: 10px; }
|
||||
|
||||
.grey {
|
||||
background-color: $base02;
|
||||
}
|
||||
|
||||
.red {
|
||||
background-color: $base0F;
|
||||
}
|
||||
|
||||
.orange {
|
||||
background-color: $base08;
|
||||
}
|
||||
|
||||
.green {
|
||||
background-color: $base0B;
|
||||
}
|
||||
|
||||
.blue {
|
||||
background-color: $base0C;
|
||||
}
|
44
modules/home/wayland/apps/eww/eww.yuck
Executable file
44
modules/home/wayland/apps/eww/eww.yuck
Executable file
@ -0,0 +1,44 @@
|
||||
(include "./modules/clock.yuck")
|
||||
(include "./modules/net.yuck")
|
||||
(include "./modules/sys.yuck")
|
||||
(include "./modules/variables.yuck")
|
||||
(include "./modules/workspaces.yuck")
|
||||
|
||||
(include "./windows/calendar.yuck")
|
||||
(include "./windows/system.yuck")
|
||||
|
||||
(defwidget left []
|
||||
(box
|
||||
:space-evenly false
|
||||
:halign "start"
|
||||
(workspaces)))
|
||||
|
||||
(defwidget right []
|
||||
(box
|
||||
:space-evenly false
|
||||
:halign "end"
|
||||
(sys)
|
||||
(clock_module)))
|
||||
|
||||
(defwidget center []
|
||||
(box
|
||||
:space-evenly false
|
||||
:halign "center"
|
||||
))
|
||||
|
||||
(defwidget bar-box []
|
||||
(centerbox
|
||||
(left)
|
||||
(center)
|
||||
(right)))
|
||||
|
||||
(defwindow bar
|
||||
:monitor 0
|
||||
:geometry (geometry :x "0%"
|
||||
:y "0%"
|
||||
:width "100%"
|
||||
:height "32px"
|
||||
:anchor "top center")
|
||||
:stacking "fg"
|
||||
:exclusive true
|
||||
(bar-box))
|
24
modules/home/wayland/apps/eww/modules/clock.yuck
Executable file
24
modules/home/wayland/apps/eww/modules/clock.yuck
Executable file
@ -0,0 +1,24 @@
|
||||
(defvar date_rev false)
|
||||
|
||||
(defwidget clock_module []
|
||||
(eventbox
|
||||
:onhover "${EWW_CMD} update date_rev=true"
|
||||
:onhoverlost "${EWW_CMD} update date_rev=false"
|
||||
(overlay
|
||||
:class "module"
|
||||
(box
|
||||
:space-evenly false
|
||||
(label
|
||||
:text {time.hour}
|
||||
:class "hour")
|
||||
(label
|
||||
:text ":")
|
||||
(label
|
||||
:text {time.minute}
|
||||
:class "minute"))
|
||||
(revealer
|
||||
:reveal date_rev
|
||||
(button
|
||||
:class "date"
|
||||
:onclick "${EWW_CMD} open --toggle calendar"
|
||||
{time.date})))))
|
7
modules/home/wayland/apps/eww/modules/net.yuck
Executable file
7
modules/home/wayland/apps/eww/modules/net.yuck
Executable file
@ -0,0 +1,7 @@
|
||||
(defwidget net []
|
||||
(button
|
||||
:class "module icon"
|
||||
:onclick "gnome-control-center &"
|
||||
:tooltip {net.name}
|
||||
:style "color: ${net.color};"
|
||||
{net.icon}))
|
30
modules/home/wayland/apps/eww/modules/sys.yuck
Executable file
30
modules/home/wayland/apps/eww/modules/sys.yuck
Executable file
@ -0,0 +1,30 @@
|
||||
(defwidget sys []
|
||||
(box
|
||||
:class "module"
|
||||
:space-evenly false
|
||||
:spacing 5
|
||||
(circular-progress
|
||||
:value {EWW_CPU.avg}
|
||||
:class "cpubar"
|
||||
:thickness 3
|
||||
(button
|
||||
:onclick "${EWW_CMD} open --toggle system-menu"
|
||||
(label :class "icon-text" :text "")))
|
||||
|
||||
(circular-progress
|
||||
:value {memory.percent}
|
||||
:class "membar"
|
||||
:thickness 3
|
||||
(button
|
||||
:onclick "${EWW_CMD} open --toggle system-menu"
|
||||
(label :class "icon-text" :text "")))
|
||||
|
||||
(circular-progress
|
||||
:value {battery.percentage}
|
||||
:class "batbar"
|
||||
:style "color: ${battery.color};"
|
||||
:thickness 3
|
||||
(button
|
||||
:tooltip "${battery.percentage}%"
|
||||
:onclick "${EWW_CMD} open --toggle system-menu"
|
||||
(label :class "icon-text" :text "")))))
|
17
modules/home/wayland/apps/eww/modules/variables.yuck
Executable file
17
modules/home/wayland/apps/eww/modules/variables.yuck
Executable file
@ -0,0 +1,17 @@
|
||||
(defvar bright_reveal false)
|
||||
(defvar bt_rev false)
|
||||
(defvar net_rev false)
|
||||
(defvar time_rev false)
|
||||
(defvar vol_reveal false)
|
||||
|
||||
(defpoll time :interval "5s" `date +'{"date": "%d/%m", "hour": "%H", "minute": "%M", "day": "%A"}'`)
|
||||
|
||||
(deflisten flightmode "scripts/flightmode")
|
||||
(deflisten powermode "scripts/powermode")
|
||||
(deflisten battery "scripts/battery")
|
||||
(deflisten bluetooth "scripts/bluetooth")
|
||||
(deflisten brightness "scripts/brightness")
|
||||
(deflisten memory "scripts/memory")
|
||||
(deflisten net "scripts/net")
|
||||
(deflisten volume "scripts/volume")
|
||||
(deflisten workspace "scripts/workspaces")
|
13
modules/home/wayland/apps/eww/modules/workspaces.yuck
Executable file
13
modules/home/wayland/apps/eww/modules/workspaces.yuck
Executable file
@ -0,0 +1,13 @@
|
||||
(defwidget workspaces []
|
||||
(eventbox
|
||||
:onscroll "echo {} | sed -e \"s/up/-1/g\" -e \"s/down/+1/g\" | xargs hyprctl dispatch workspace"
|
||||
(box
|
||||
:class "module workspaces"
|
||||
(for ws in workspace
|
||||
(button
|
||||
:onclick "hyprctl dispatch workspace ${ws.number}"
|
||||
:class "ws icon ${ws.color}"
|
||||
; :tooltip {ws.tooltip}
|
||||
(box
|
||||
:class `${ws.focused ? "focused" : ""}`
|
||||
:height 3))))))
|
61
modules/home/wayland/apps/eww/scripts/battery
Executable file
61
modules/home/wayland/apps/eww/scripts/battery
Executable file
@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
icons=("" "" "" "" "" "" "" "" "" "" "")
|
||||
num_icons=$(awk -v n="${#icons[@]}" 'BEGIN{print 100 / n}')
|
||||
BATTERY="/sys/class/power_supply/BAT0"
|
||||
|
||||
geticon() {
|
||||
level=$(awk -v n="$CAPACITY" -v c="$num_icons" 'BEGIN{print int(n/c-1)}')
|
||||
echo "${icons[$level]}"
|
||||
}
|
||||
|
||||
status() {
|
||||
if [ "$STATE" = "Charging" ]; then
|
||||
echo -n "charging"
|
||||
|
||||
if [ "$RATE" -gt 0 ]; then
|
||||
echo ", $(gettime) left"
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
elif [ "$STATE" = "Discharging" ]; then
|
||||
echo "$(gettime)h left"
|
||||
else
|
||||
echo "fully charged"
|
||||
fi
|
||||
}
|
||||
|
||||
color() {
|
||||
[ "$CAPACITY" -le 20 ] && echo '#f38ba8' || echo '#a6e3a1'
|
||||
}
|
||||
|
||||
wattage() {
|
||||
awk -v rate="$RATE" -v uw="1000000" 'BEGIN{print sprintf("%.1f W", rate/uw)}'
|
||||
}
|
||||
|
||||
gettime() {
|
||||
FULL=$(cat $BATTERY/energy_full)
|
||||
NOW=$(cat $BATTERY/energy_now)
|
||||
|
||||
if [ "$RATE" -gt 0 ]; then
|
||||
if [ "$STATE" = "Discharging" ]; then
|
||||
EX="$NOW / $RATE"
|
||||
else
|
||||
EX="($FULL - $NOW) / $RATE"
|
||||
fi
|
||||
date -u -d@"$(awk -v ex="$EX" 'BEGIN{print ex * 3600}')" +%H:%M
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -d "$BATTERY" ]; then
|
||||
while true; do
|
||||
RATE=$(cat $BATTERY/power_now)
|
||||
CAPACITY=$(cat $BATTERY/capacity)
|
||||
STATE=$(cat $BATTERY/status)
|
||||
|
||||
echo '{ "icon": "'$(geticon)'", "percentage": '$CAPACITY', "wattage": "'$(wattage)'", "status": "'$(status)'", "color": "'$(color)'" }'
|
||||
sleep 5
|
||||
done
|
||||
else
|
||||
echo '{ "icon": "", "percentage": 0, "wattage": "", "status": "", "color": "#a6e3a1" }'
|
||||
fi
|
30
modules/home/wayland/apps/eww/scripts/brightness
Executable file
30
modules/home/wayland/apps/eww/scripts/brightness
Executable file
@ -0,0 +1,30 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function get_time_ms {
|
||||
date -u +%s%3N
|
||||
}
|
||||
|
||||
icons=("" "" "")
|
||||
|
||||
gen_output() {
|
||||
icon="${icons[$(awk -v n="$(brillo)" 'BEGIN{print int(n/34)}')]}"
|
||||
prcnt=$(brillo | xargs printf "%.*f\n" "0")
|
||||
echo '{"percent": '$prcnt', "icon": "'$icon'"}'
|
||||
}
|
||||
|
||||
if [[ $(brillo 2>/dev/stdout 1>/dev/null | head -n1 | awk '{print $1}') == "No" ]]; then
|
||||
echo '{"percent": 100, "icon": ""}'
|
||||
elif [ "$1" = "" ]; then
|
||||
# initial
|
||||
last_time=$(get_time_ms)
|
||||
gen_output
|
||||
|
||||
udevadm monitor | rg --line-buffered "backlight" | while read -r _; do
|
||||
current_time=$(get_time_ms)
|
||||
delta=$((current_time - last_time))
|
||||
if [[ $delta -gt 50 ]]; then
|
||||
gen_output
|
||||
last_time=$(get_time_ms)
|
||||
fi
|
||||
done
|
||||
fi
|
23
modules/home/wayland/apps/eww/scripts/flightmode
Executable file
23
modules/home/wayland/apps/eww/scripts/flightmode
Executable file
@ -0,0 +1,23 @@
|
||||
#!/bin/sh
|
||||
|
||||
icon() {
|
||||
[ "$STATUS" = "no" ] && echo "" || echo ""
|
||||
}
|
||||
|
||||
toggle() {
|
||||
if [ "$STATUS" = "no" ]; then
|
||||
rfkill block all
|
||||
else
|
||||
rfkill unblock all
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" = "toggle" ]; then
|
||||
toggle
|
||||
else
|
||||
icon
|
||||
rfkill event | while read -r _; do
|
||||
STATUS="$(rfkill list | sed -n 2p | awk '{print $3}')"
|
||||
icon
|
||||
done
|
||||
fi
|
14
modules/home/wayland/apps/eww/scripts/memory
Executable file
14
modules/home/wayland/apps/eww/scripts/memory
Executable file
@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
total="$(free --si | rg Mem | awk '{print $2}')"
|
||||
|
||||
human() {
|
||||
awk -v mem="$1" 'BEGIN{print sprintf("%.1f%s", mem/1000/(mem > 1000000 ? 1000 : 1), mem > 1000000 ? "G" : "M")}'
|
||||
}
|
||||
|
||||
free --si -s 3 | rg --line-buffered Mem | while read -r line; do
|
||||
used=$(echo "$line" | awk '{print $3}')
|
||||
perc=$(awk -v used="$used" -v total="$total" 'BEGIN{print sprintf("%.f", used/total*100)}')
|
||||
|
||||
echo '{"total": "'$(human "$total")'", "used": "'$(human "$used")'", "percent": '$perc'}'
|
||||
done
|
72
modules/home/wayland/apps/eww/scripts/net
Executable file
72
modules/home/wayland/apps/eww/scripts/net
Executable file
@ -0,0 +1,72 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function get_time_ms {
|
||||
date -u +%s%3N
|
||||
}
|
||||
|
||||
icons=("" "" "" "" "")
|
||||
|
||||
function toggle() {
|
||||
status=$(rfkill | grep wlan | awk '{print $4}')
|
||||
|
||||
if [ "$status" = "unblocked" ]; then
|
||||
rfkill block wlan
|
||||
else
|
||||
rfkill unblock wlan
|
||||
fi
|
||||
}
|
||||
|
||||
function gen_wifi() {
|
||||
signal=$(cat /proc/net/wireless | head -n3 | tail -n1 | awk '{print $3}')
|
||||
level=$(awk -v n="$signal" 'BEGIN{print int((n-1)/20)}')
|
||||
if [ "$level" -gt 4 ]; then
|
||||
level=4
|
||||
fi
|
||||
|
||||
icon=${icons[$level]}
|
||||
color="#cba6f7"
|
||||
class="net-connected"
|
||||
name=$(wpa_cli status | grep \^ssid= | sed 's/ssid=//g')
|
||||
}
|
||||
|
||||
function gen_ethernet() {
|
||||
icon=""
|
||||
class="net-connected"
|
||||
color="#cba6f7"
|
||||
name=Wired
|
||||
}
|
||||
|
||||
function make_content() {
|
||||
local ethernet wifi
|
||||
ethernet=$(ip link | rg "^[0-9]+: en[po]+" | head -n1 | sed 's/[a-zA-Z0-9_,><:\ -]*state //g' | sed 's/ mode [a-zA-Z0-9 ]*//g')
|
||||
wifi=$(wpa_cli status | rg "^wpa_state=" | sed 's/wpa_state=//g')
|
||||
|
||||
# test ethernet first
|
||||
if [[ $ethernet == "UP" ]]; then
|
||||
gen_ethernet
|
||||
elif [[ $wifi == "COMPLETED" ]]; then
|
||||
gen_wifi
|
||||
else
|
||||
icon=""
|
||||
color="#988ba2"
|
||||
class="net-disconnected"
|
||||
name="Disconnected"
|
||||
fi
|
||||
|
||||
echo '{"icon": "'$icon'", "name": "'$name'", "color": "'$color'", "class": "'$class'"}'
|
||||
}
|
||||
|
||||
if [ "$1" = "toggle" ]; then
|
||||
toggle
|
||||
else
|
||||
last_time=$(get_time_ms)
|
||||
make_content
|
||||
ip monitor | while read -r _; do
|
||||
current_time=$(get_time_ms)
|
||||
delta=$((current_time - last_time))
|
||||
if [[ $delta -gt 50 ]]; then
|
||||
make_content
|
||||
last_time=$(get_time_ms)
|
||||
fi
|
||||
done
|
||||
fi
|
20
modules/home/wayland/apps/eww/scripts/powermode
Executable file
20
modules/home/wayland/apps/eww/scripts/powermode
Executable file
@ -0,0 +1,20 @@
|
||||
#!/bin/sh
|
||||
|
||||
icon() {
|
||||
[ "$STATUS" = "no" ] && echo "" || echo ""
|
||||
}
|
||||
|
||||
toggle() {
|
||||
if [ "$STATUS" = "no" ]; then
|
||||
echo ""
|
||||
else
|
||||
echo ""
|
||||
fi
|
||||
}
|
||||
|
||||
if [ "$1" = "toggle" ]; then
|
||||
toggle
|
||||
icon
|
||||
else
|
||||
icon
|
||||
fi
|
64
modules/home/wayland/apps/eww/scripts/volume
Executable file
64
modules/home/wayland/apps/eww/scripts/volume
Executable file
@ -0,0 +1,64 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
function get_time_ms {
|
||||
date -u +%s%3N
|
||||
}
|
||||
|
||||
volicons=("" "" "")
|
||||
|
||||
vol() {
|
||||
wpctl get-volume @DEFAULT_AUDIO_"$1"@ | awk '{print int($2*100)}'
|
||||
}
|
||||
ismuted() {
|
||||
wpctl get-volume @DEFAULT_AUDIO_"$1"@ | rg -qi muted
|
||||
echo -n $?
|
||||
}
|
||||
setvol() {
|
||||
wpctl set-volume @DEFAULT_AUDIO_"$1"@ "$(awk -v n="$2" 'BEGIN{print (n / 100)}')"
|
||||
}
|
||||
setmute() {
|
||||
wpctl set-mute @DEFAULT_AUDIO_"$1"@ toggle
|
||||
}
|
||||
|
||||
gen_output() {
|
||||
percent="$(vol "SINK")"
|
||||
lvl=$(awk -v n="$percent" 'BEGIN{print int(n/34)}')
|
||||
ismuted=$(ismuted "SINK")
|
||||
|
||||
if [ "$ismuted" = 1 ]; then
|
||||
icon="${volicons[$lvl]}"
|
||||
else
|
||||
icon=""
|
||||
fi
|
||||
|
||||
echo '{"icon": "'$icon'", "percent": '$(vol "SINK")', "microphone": '$(vol "SOURCE")'}'
|
||||
}
|
||||
|
||||
if [ "$1" = "mute" ]; then
|
||||
if [ "$2" != "SOURCE" ] && [ "$2" != "SINK" ]; then
|
||||
echo "Can only mute SINK or SOURCE"
|
||||
exit 1
|
||||
fi
|
||||
setmute "$2"
|
||||
elif [ "$1" = "setvol" ]; then
|
||||
if [ "$2" != "SOURCE" ] && [ "$2" != "SINK" ]; then
|
||||
echo "Can only set volume for SINK or SOURCE"
|
||||
exit 1
|
||||
elif [ "$3" -lt 0 ] || [ "$3" -gt 100 ]; then
|
||||
echo "Volume must be between 0 and 100"
|
||||
exit 1
|
||||
fi
|
||||
setvol "$2" "$3"
|
||||
else
|
||||
last_time=$(get_time_ms)
|
||||
gen_output
|
||||
|
||||
pw-cli -m 2>/dev/null | rg --line-buffered "PipeWire:Interface:Client" | while read -r event; do
|
||||
current_time=$(get_time_ms)
|
||||
delta=$((current_time - last_time))
|
||||
if [[ $delta -gt 50 ]]; then
|
||||
gen_output
|
||||
last_time=$(get_time_ms)
|
||||
fi
|
||||
done
|
||||
fi
|
86
modules/home/wayland/apps/eww/scripts/workspaces
Executable file
86
modules/home/wayland/apps/eww/scripts/workspaces
Executable file
@ -0,0 +1,86 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
colors=("blue" "orange" "green" "red")
|
||||
empty="grey"
|
||||
|
||||
# get initial focused workspace
|
||||
focusedws=$(hyprctl -j monitors | jaq -r '.[] | select(.focused == true) | .activeWorkspace.id')
|
||||
|
||||
declare -A o=([1]=0 [2]=0 [3]=0 [4]=0 [5]=0 [6]=0 [7]=0 [8]=0 [9]=0 [10]=0)
|
||||
declare -A monitormap
|
||||
declare -A workspaces
|
||||
|
||||
# set color for each workspace
|
||||
status() {
|
||||
if [ "${o[$1]}" -eq 1 ]; then
|
||||
mon=${monitormap[${workspaces[$1]}]}
|
||||
echo -n "${colors[$mon]}"
|
||||
else
|
||||
echo -n "$empty"
|
||||
fi
|
||||
}
|
||||
|
||||
# handle workspace create/destroy
|
||||
workspace_event() {
|
||||
while read -r k v; do workspaces[$k]="$v"; done < <(hyprctl -j workspaces | jaq -jr '.[] | .id, " ", .monitor, "\n"')
|
||||
}
|
||||
# handle monitor (dis)connects
|
||||
monitor_event() {
|
||||
while read -r k v; do monitormap["$k"]=$v; done < <(hyprctl -j monitors | jaq -jr '.[] | .name, " ", .id, "\n"')
|
||||
}
|
||||
|
||||
# get all apps titles in a workspace
|
||||
applist() {
|
||||
ws="$1"
|
||||
|
||||
apps=$(hyprctl -j clients | jaq -jr '.[] | select(.workspace.id == '"$ws"') | .title + "\\n"')
|
||||
echo -En "${apps%"\n"}"
|
||||
}
|
||||
|
||||
# generate the json for eww
|
||||
generate() {
|
||||
echo -n '['
|
||||
|
||||
for i in {1..10}; do
|
||||
echo -n ''"$([ "$i" -eq 1 ] || echo ,)" '{"number": "'"$i"'", "color": "'"$(status "$i")"'", "focused": '"$([ "$focusedws" = "$i" ] && echo "true" || echo "false")"'}' #, "tooltip": "'$(applist "$i")'" }'
|
||||
done
|
||||
|
||||
echo ']'
|
||||
}
|
||||
|
||||
# setup
|
||||
|
||||
# add monitors
|
||||
monitor_event
|
||||
|
||||
# add workspaces
|
||||
workspace_event
|
||||
|
||||
# check occupied workspaces
|
||||
for num in "${!workspaces[@]}"; do
|
||||
o[$num]=1
|
||||
done
|
||||
# generate initial widget
|
||||
generate
|
||||
|
||||
# main loop
|
||||
socat -u UNIX-CONNECT:/tmp/hypr/"$HYPRLAND_INSTANCE_SIGNATURE"/.socket2.sock - | rg --line-buffered "workspace|mon(itor)?" | while read -r line; do
|
||||
case ${line%>>*} in
|
||||
"workspace")
|
||||
focusedws=${line#*>>}
|
||||
;;
|
||||
"focusedmon")
|
||||
focusedws=${line#*,}
|
||||
;;
|
||||
"createworkspace")
|
||||
o[${line#*>>}]=1
|
||||
;;
|
||||
"destroyworkspace")
|
||||
o[${line#*>>}]=0
|
||||
;;
|
||||
"monitor"*)
|
||||
monitor_event
|
||||
;;
|
||||
esac
|
||||
generate
|
||||
done
|
14
modules/home/wayland/apps/eww/windows/calendar.yuck
Executable file
14
modules/home/wayland/apps/eww/windows/calendar.yuck
Executable file
@ -0,0 +1,14 @@
|
||||
(defwidget calendar-win []
|
||||
(box
|
||||
:class "calendar-win"
|
||||
(calendar)))
|
||||
|
||||
(defwindow calendar
|
||||
:monitor 0
|
||||
:geometry (geometry
|
||||
:x "0%"
|
||||
:y "0%"
|
||||
:anchor "top right"
|
||||
:width "0px"
|
||||
:height "0px")
|
||||
(calendar-win))
|
188
modules/home/wayland/apps/eww/windows/system.yuck
Executable file
188
modules/home/wayland/apps/eww/windows/system.yuck
Executable file
@ -0,0 +1,188 @@
|
||||
(defwidget system-menu []
|
||||
(box
|
||||
:class "system-menu-box"
|
||||
:space-evenly false
|
||||
:orientation "v"
|
||||
(centerbox
|
||||
:class "top-row"
|
||||
(box
|
||||
(label
|
||||
:class "time"
|
||||
:text "${time.hour}:${time.minute}")
|
||||
(box
|
||||
:class "date-box"
|
||||
:space-evenly false
|
||||
(label
|
||||
:class "date"
|
||||
:text {time.date}
|
||||
)
|
||||
(label
|
||||
:class "day"
|
||||
:text {time.day}
|
||||
)
|
||||
)
|
||||
)
|
||||
(label)
|
||||
(box
|
||||
:space-evenly false
|
||||
:halign "end"
|
||||
(button
|
||||
:halign "end"
|
||||
:class "power-button icon"
|
||||
:onclick "wlogout -p layer-shell -c 10 -m 500 &"
|
||||
""
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
(centerbox
|
||||
:class "system-row"
|
||||
(box
|
||||
:class "net-box"
|
||||
:space-evenly false
|
||||
:orientation "v"
|
||||
(box
|
||||
:class "element icon ${net.class}"
|
||||
(button
|
||||
:class "net-button"
|
||||
:onclick "scripts/net toggle"
|
||||
{net.icon}
|
||||
)
|
||||
)
|
||||
(label
|
||||
:text {net.name}
|
||||
:xalign 0.5
|
||||
:limit-width 15
|
||||
)
|
||||
)
|
||||
|
||||
(box
|
||||
:class "flightmode-box"
|
||||
:space-evenly false
|
||||
:orientation "v"
|
||||
(box
|
||||
:class "element"
|
||||
(button
|
||||
:class "flightmode-button"
|
||||
:onclick "scripts/flightmode toggle"
|
||||
flightmode
|
||||
)
|
||||
)
|
||||
(label
|
||||
:text "Flight Mode"
|
||||
:xalign 0.5
|
||||
:limit-width 16
|
||||
)
|
||||
)
|
||||
|
||||
(box
|
||||
:class "powermode-box"
|
||||
:space-evenly false
|
||||
:orientation "v"
|
||||
(box
|
||||
:class "element"
|
||||
(button
|
||||
:class "powermode-button"
|
||||
:onclick "scripts/powermode toggle"
|
||||
powermode))
|
||||
(label
|
||||
:text "Power Mode"
|
||||
:xalign 0.5
|
||||
:limit-width 16)))
|
||||
|
||||
(box
|
||||
:class "sliders"
|
||||
:orientation "v"
|
||||
(box
|
||||
:class "volume-slider-box"
|
||||
:space-evenly false
|
||||
(button
|
||||
:class "volume-icon icon"
|
||||
:onclick "scripts/volume mute SINK"
|
||||
{volume.icon})
|
||||
(scale
|
||||
:class "volume-bar"
|
||||
:value {volume.percent}
|
||||
:onchange "scripts/volume setvol SINK {}"))
|
||||
(box
|
||||
:class "brightness-slider-box"
|
||||
:space-evenly false
|
||||
(button
|
||||
:class "brightness-slider-icon icon"
|
||||
{brightness.icon})
|
||||
(scale
|
||||
:class "brightness-bar"
|
||||
:value {brightness.percent}
|
||||
:onchange "brillo -S {}")))
|
||||
|
||||
(box
|
||||
:class "system-info-box"
|
||||
|
||||
; cpu
|
||||
(box
|
||||
:class "sys-box"
|
||||
:space-evenly false
|
||||
:halign "start"
|
||||
(circular-progress
|
||||
:value "${EWW_CPU.avg}"
|
||||
:class "sys-cpu"
|
||||
:thickness 3
|
||||
(label
|
||||
:text ""
|
||||
:class "sys-icon-cpu icon"))
|
||||
(box
|
||||
:orientation "v"
|
||||
:vexpand false
|
||||
(label
|
||||
:text "CPU"
|
||||
:halign "start"
|
||||
:class "sys-text-cpu")
|
||||
(label
|
||||
:text "${round(EWW_CPU.avg,2)}%"
|
||||
:halign "start"
|
||||
:class "sys-text-sub")
|
||||
(label
|
||||
:text "${EWW_CPU.cores[0].freq} MHz"
|
||||
:halign "start"
|
||||
:class "sys-text-sub")))
|
||||
|
||||
; memory
|
||||
(box
|
||||
:class "sys-box"
|
||||
:space-evenly false
|
||||
:halign "end"
|
||||
(circular-progress
|
||||
:value {memory.percent}
|
||||
:class "sys-mem"
|
||||
:thickness 3
|
||||
(label
|
||||
:text ""
|
||||
:class "sys-icon-mem icon"))
|
||||
(box
|
||||
:orientation "v"
|
||||
(label
|
||||
:text "RAM"
|
||||
:halign "start"
|
||||
:class "sys-text-mem")
|
||||
(label
|
||||
:text "${memory.used} | ${memory.total}"
|
||||
:halign "start"
|
||||
:class "sys-text-sub"
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
(label)
|
||||
)
|
||||
)
|
||||
|
||||
(defwindow system-menu
|
||||
:stacking "fg"
|
||||
:monitor 0
|
||||
:geometry (geometry
|
||||
:x "0"
|
||||
:y "0"
|
||||
:width "0%"
|
||||
:height "0%"
|
||||
:anchor "right top")
|
||||
(system-menu))
|
103
modules/home/wayland/apps/waylock/default.nix
Executable file
103
modules/home/wayland/apps/waylock/default.nix
Executable file
@ -0,0 +1,103 @@
|
||||
{ lib, pkgs, config, ... }: {
|
||||
config = lib.mkIf (config.homecfg.wm == "Wayland") {
|
||||
|
||||
home.packages = with pkgs; [ swayidle swaylock-effects wlogout ];
|
||||
|
||||
xdg.configFile."swaylock/config".text = ''
|
||||
screenshots
|
||||
grace=5
|
||||
effect-pixelate=5
|
||||
fade-in=0.2
|
||||
|
||||
ignore-empty-password
|
||||
font=IBM Plex Mono
|
||||
|
||||
color=${config.colorscheme.colors.base00}00
|
||||
|
||||
indicator-radius=100
|
||||
indicator-thickness=30
|
||||
|
||||
separator-color=${config.colorscheme.colors.base00}00
|
||||
|
||||
inside-color=${config.colorscheme.colors.base0C}00
|
||||
inside-clear-color=${config.colorscheme.colors.base08}FF
|
||||
inside-caps-lock-color=${config.colorscheme.colors.base09}00
|
||||
inside-ver-color=${config.colorscheme.colors.base0C}FF
|
||||
inside-wrong-color=${config.colorscheme.colors.base0F}FF
|
||||
|
||||
|
||||
ring-color=${config.colorscheme.colors.base00}00
|
||||
ring-clear-color=${config.colorscheme.colors.base00}00
|
||||
ring-caps-lock-color=${config.colorscheme.colors.base00}00
|
||||
ring-ver-color=${config.colorscheme.colors.base00}00
|
||||
ring-wrong-color=${config.colorscheme.colors.base00}00
|
||||
|
||||
line-color=${config.colorscheme.colors.base00}00
|
||||
line-clear-color=${config.colorscheme.colors.base00}00
|
||||
line-caps-lock-color=${config.colorscheme.colors.base00}00
|
||||
line-ver-color=${config.colorscheme.colors.base00}00
|
||||
line-wrong-color=${config.colorscheme.colors.base00}00
|
||||
|
||||
text-color=${config.colorscheme.colors.base00}00
|
||||
text-clear-color=${config.colorscheme.colors.base00}00
|
||||
text-caps-lock-color=${config.colorscheme.colors.base00}00
|
||||
text-ver-color=${config.colorscheme.colors.base00}00
|
||||
text-wrong-color=${config.colorscheme.colors.base00}00
|
||||
|
||||
|
||||
key-hl-color=${config.colorscheme.colors.base0C}FF
|
||||
bs-hl-color=${config.colorscheme.colors.base08}FF
|
||||
caps-lock-key-hl-color=${config.colorscheme.colors.base09}FF
|
||||
caps-lock-bs-hl-color=${config.colorscheme.colors.base09}FF
|
||||
'';
|
||||
|
||||
xdg.configFile."wlogout/style.css".text = ''
|
||||
window {
|
||||
font-family: Material Design Icons;
|
||||
font-size: 64pt;
|
||||
color: #${config.colorscheme.colors.base07};
|
||||
background-color: alpha(#${config.colorscheme.colors.base00},0.6);
|
||||
}
|
||||
|
||||
button {
|
||||
border-radius:7px;
|
||||
border: 2px solid #${config.colorscheme.colors.base03};
|
||||
color: #${config.colorscheme.colors.base07};
|
||||
padding: 20px;
|
||||
background-color: alpha(#${config.colorscheme.colors.base00},0.8);
|
||||
transition: box-shadow 0.2s ease-in-out, background-color 0.2s ease-in-out;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: alpha(#${config.colorscheme.colors.base02},0.8);
|
||||
}
|
||||
|
||||
button:focus {
|
||||
background-color: alpha(#${config.colorscheme.colors.base02},1.0);
|
||||
border: 2px solid #${config.colorscheme.colors.base05};
|
||||
}
|
||||
|
||||
'';
|
||||
|
||||
xdg.configFile."wlogout/layout".text = ''
|
||||
{
|
||||
"label" : "lock",
|
||||
"action" : "swaylock",
|
||||
"text" : "",
|
||||
"keybind" : "l"
|
||||
}
|
||||
{
|
||||
"label" : "reboot",
|
||||
"action" : "systemctl reboot",
|
||||
"text" : "",
|
||||
"keybind" : "r"
|
||||
}
|
||||
{
|
||||
"label" : "shutdown",
|
||||
"action" : "systemctl poweroff",
|
||||
"text" : "",
|
||||
"keybind" : "s"
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
68
modules/home/wayland/apps/wofi/default.nix
Executable file
68
modules/home/wayland/apps/wofi/default.nix
Executable file
@ -0,0 +1,68 @@
|
||||
{ lib, config, pkgs, ... }: {
|
||||
|
||||
config = lib.mkIf (config.homecfg.wm == "Wayland") {
|
||||
home.packages = with pkgs; [ wofi ];
|
||||
xdg.configFile."wofi/config".text = ''
|
||||
width=280
|
||||
lines=10
|
||||
xoffset=5
|
||||
yoffset=5
|
||||
location=2
|
||||
prompt=
|
||||
filter_rate=100
|
||||
allow_markup=false
|
||||
no_actions=true
|
||||
halign=fill
|
||||
orientation=vertical
|
||||
content_halign=fill
|
||||
insensitive=true
|
||||
allow_images=true
|
||||
image_size=16
|
||||
hide_scroll=true
|
||||
'';
|
||||
xdg.configFile."wofi/style.css".text = ''
|
||||
window {
|
||||
margin: 0px;
|
||||
border-radius:7px;
|
||||
background-color: #${config.colorscheme.colors.base00};
|
||||
}
|
||||
|
||||
#input {
|
||||
all: unset;
|
||||
min-height: 20px;
|
||||
padding: 4px 10px;
|
||||
margin: 4px;
|
||||
border: none;
|
||||
color: #${config.colorscheme.colors.base07};
|
||||
font-weight: bold;
|
||||
background-color: #${config.colorscheme.colors.base01};
|
||||
outline: #${config.colorscheme.colors.base04};
|
||||
}
|
||||
|
||||
#input:selected {
|
||||
color: #${config.colorscheme.colors.base0C};
|
||||
}
|
||||
|
||||
#inner-box {
|
||||
font-weight: bold;
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
#outer-box {
|
||||
margin: 0px;
|
||||
padding: 3px;
|
||||
border-radius: 7px;
|
||||
border: 2px solid #${config.colorscheme.colors.base03};
|
||||
}
|
||||
|
||||
#text:selected {
|
||||
color: #${config.colorscheme.colors.base00};
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
#entry:selected {
|
||||
background-color: #${config.colorscheme.colors.base07};
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
69
modules/home/wayland/base/default.nix
Normal file
69
modules/home/wayland/base/default.nix
Normal file
@ -0,0 +1,69 @@
|
||||
{ lib, config, pkgs, ... }:
|
||||
let
|
||||
dbus-hyprland-environment = pkgs.writeTextFile {
|
||||
name = "dbus-hyprland-environment";
|
||||
destination = "/bin/dbus-hyprland-environment";
|
||||
executable = true;
|
||||
text = ''
|
||||
dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP=hyprland
|
||||
systemctl --user stop pipewire pipewire-media-session xdg-desktop-portal xdg-desktop-portal-wlr
|
||||
systemctl --user start pipewire wireplumber pipewire-media-session xdg-desktop-portal xdg-desktop-portal-hyprland
|
||||
'';
|
||||
};
|
||||
in {
|
||||
config = lib.mkIf (config.homecfg.wm == "Wayland") {
|
||||
|
||||
home.packages = with pkgs; [
|
||||
dbus-hyprland-environment
|
||||
wayland
|
||||
|
||||
grim
|
||||
slurp
|
||||
swappy
|
||||
cliphist
|
||||
wl-clipboard
|
||||
|
||||
wlr-randr
|
||||
wdisplays
|
||||
kanshi
|
||||
|
||||
glib
|
||||
|
||||
brillo
|
||||
swww
|
||||
];
|
||||
|
||||
xdg.mimeApps = {
|
||||
enable = true;
|
||||
defaultApplications = {
|
||||
"x-scheme-handler/discord-409416265891971072" =
|
||||
[ "discord-409416265891971072.desktop" ];
|
||||
"x-scheme-handler/discord-402572971681644545" =
|
||||
[ "discord-402572971681644545.desktop" ];
|
||||
"x-scheme-handler/discord-696343075731144724" =
|
||||
[ "discord-696343075731144724.desktop" ];
|
||||
"x-scheme-handler/http" = [ "firefox.desktop" ];
|
||||
"x-scheme-handler/https" = [ "firefox.desktop" ];
|
||||
"x-scheme-handler/chrome" = [ "firefox.desktop" ];
|
||||
"text/html" = [ "firefox.desktop" ];
|
||||
"application/x-extension-htm" = [ "firefox.desktop" ];
|
||||
"application/x-extension-html" = [ "firefox.desktop" ];
|
||||
"application/x-extension-shtml" = [ "firefox.desktop" ];
|
||||
"application/xhtml+xml" = [ "firefox.desktop" ];
|
||||
"application/x-extension-xhtml" = [ "firefox.desktop" ];
|
||||
"application/x-extension-xht" = [ "firefox.desktop" ];
|
||||
|
||||
"application/pdf" = [ "org.pwmt.zathura-pdf-mupdf.desktop" ];
|
||||
"text/plain" = [ "vscodium.desktop" ];
|
||||
|
||||
"video/mp4" = [ "mpv.desktop" ];
|
||||
|
||||
"image/png" = [ "imv-dir.desktop" ];
|
||||
"image/jpg" = [ "imv-dir.desktop" ];
|
||||
};
|
||||
associations = {
|
||||
removed = { "application/pdf" = [ "krita_pdf.desktop" ]; };
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
230
modules/home/wayland/hyprland/config.nix
Executable file
230
modules/home/wayland/hyprland/config.nix
Executable file
@ -0,0 +1,230 @@
|
||||
{ lib, config, pkgs, ... }: {
|
||||
config = lib.mkIf (config.homecfg.wm == "Wayland") {
|
||||
home.packages = with pkgs; [ hyprland ];
|
||||
wayland.windowManager.hyprland = {
|
||||
enable = true;
|
||||
xwayland.enable = true;
|
||||
extraConfig = ''
|
||||
|
||||
monitor=,preferred,auto,1
|
||||
|
||||
input {
|
||||
kb_layout = us, ru
|
||||
kb_variant = intl, phonetic
|
||||
kb_model = pc104
|
||||
kb_options = grp:ctrls_toggle
|
||||
kb_rules =
|
||||
|
||||
follow_mouse = 1
|
||||
|
||||
sensitivity = 0 # -0.5 # -1.0 - 1.0, 0 means no modification.
|
||||
force_no_accel = true
|
||||
|
||||
touchpad {
|
||||
natural_scroll=no
|
||||
disable_while_typing=true
|
||||
scroll_factor=1
|
||||
disable_while_typing=0
|
||||
tap-to-click=0
|
||||
}
|
||||
}
|
||||
|
||||
misc {
|
||||
disable_hyprland_logo=true
|
||||
animate_mouse_windowdragging=false
|
||||
animate_manual_resizes=false
|
||||
}
|
||||
|
||||
general {
|
||||
gaps_in = 8
|
||||
gaps_out = 15
|
||||
border_size = 2
|
||||
|
||||
#col.active_border = rgb(${config.colorScheme.colors.base05})
|
||||
#col.inactive_border = rgb(${config.colorScheme.colors.base03})
|
||||
#col.group_border_active = rgb(${config.colorScheme.colors.base05})
|
||||
#col.group_border = rgb(${config.colorScheme.colors.base03})
|
||||
|
||||
layout = dwindle
|
||||
}
|
||||
|
||||
decoration {
|
||||
rounding = 7
|
||||
|
||||
blur {
|
||||
enabled = true
|
||||
size = 2
|
||||
passes = 1
|
||||
new_optimizations = true
|
||||
}
|
||||
#multisample_edges = true
|
||||
|
||||
#opactity
|
||||
inactive_opacity = 1.0
|
||||
active_opacity = 1.0
|
||||
fullscreen_opacity = 1.0
|
||||
|
||||
# shadow
|
||||
drop_shadow = no
|
||||
shadow_range = 60
|
||||
shadow_offset = 0 5
|
||||
shadow_render_power = 4
|
||||
col.shadow = rgba(00000099)
|
||||
}
|
||||
|
||||
animations {
|
||||
enabled = false
|
||||
}
|
||||
|
||||
dwindle {
|
||||
pseudotile = yes
|
||||
# force_split = 0
|
||||
preserve_split = yes
|
||||
}
|
||||
|
||||
master {
|
||||
new_is_master = true
|
||||
}
|
||||
|
||||
gestures {
|
||||
workspace_swipe = off
|
||||
}
|
||||
|
||||
exec-once = eww open bar & dunst
|
||||
|
||||
exec-once = swww init
|
||||
|
||||
exec-once = dbus-update-activation-environment --systemd WAYLAND_DISPLAY XDG_CURRENT_DESKTOP
|
||||
exec-once = /nix/store/$(ls -la /nix/store | grep 'polkit-gnome' | grep '4096' | awk '{print $9}' | sed -n '$p')/libexec/polkit-gnome-authentication-agent-1 &
|
||||
|
||||
exec-once = wl-paste --type text --watch cliphist store #Stores only text data
|
||||
exec-once = wl-paste --type image --watch cliphist store #Stores only image data
|
||||
|
||||
exec-once = swayidle -w timeout 600 'swaylock' before-sleep 'swaylock'
|
||||
|
||||
|
||||
#windowrules
|
||||
windowrulev2 = noshadow, floating:0
|
||||
|
||||
windowrulev2 = float, title:^(flying_kitty)$
|
||||
windowrulev2 = size 1100 600, title:^(flying_kitty)$
|
||||
windowrulev2 = move center, title:^(flying_kitty)$
|
||||
windowrulev2 = animation slide, title:^(flying_kitty)$
|
||||
windowrulev2 = float, title:^(Volume Control)$
|
||||
windowrulev2 = float, title:^(Picture-in-Picture)$
|
||||
windowrulev2 = float, title:^(Steam)$
|
||||
windowrulev2 = fullscreen, title:^(wlogout)$
|
||||
windowrulev2 = float, title:^(wlogout)$
|
||||
|
||||
windowrulev2 = workspace 2 silent, class:^(org.telegram.desktop)$
|
||||
windowrulev2 = workspace 2 silent, class:^(discord)$
|
||||
|
||||
windowrulev2 = workspace 8 silent, class:^(org.keepassxc.KeePassXC)$
|
||||
windowrulev2 = workspace 8 silent, title:^(Nextcloud)$
|
||||
windowrulev2 = workspace 8 silent, class:^(Tk)$,title:^(Server Configuration)$
|
||||
|
||||
#SPECIAL FLOATERS
|
||||
windowrulev2 = float,class:^(org.keepassxc.KeePassXC)$,title:^(KeePassXC - Access Request)$
|
||||
windowrulev2 = pin,class:^(org.keepassxc.KeePassXC)$,title:^(KeePassXC - Access Request)$
|
||||
windowrulev2 = float,class:^(org.keepassxc.KeePassXC)$,title:^(Unlock Database - KeePassXC)$
|
||||
windowrulev2 = pin,class:^(org.keepassxc.KeePassXC)$,title:^(Unlock Database - KeePassXC)$
|
||||
windowrulev2 = float,title:^(Open)$
|
||||
windowrulev2 = float,title:^(Choose Files)$
|
||||
windowrulev2 = float,title:^(Save As)$
|
||||
windowrulev2 = float,title:^(Confirm to replace files)$
|
||||
windowrulev2 = float,title:^(File Operation Progress)$
|
||||
windowrulev2 = float,class:^(firefox)$,title:^(Picture-in-Picture)$
|
||||
windowrulev2 = pin,class:^(firefox)$,title:^(Picture-in-Picture)$
|
||||
windowrulev2 = nofullscreenrequest,class:^(firefox)$,title:^(Picture-in-Picture)$
|
||||
windowrulev2 = float,class:^(firefox)$,title:^(Firefox — Sharing Indicator)$
|
||||
windowrulev2 = nofullscreenrequest,class:^(firefox)$,title:^(Firefox — Sharing Indicator)$
|
||||
windowrulev2 = float,class:^(firefox)$,title:^(Extension:.* Mozilla Firefox)$
|
||||
windowrulev2 = nofullscreenrequest,class:^(firefox)$,title:^(Extension:.* Mozilla Firefox)$
|
||||
windowrulev2 = float,class:^(org.telegram.desktop)$,title:^(Media viewer)$
|
||||
windowrulev2 = center,class:^(org.telegram.desktop)$,title:^(Media viewer)$
|
||||
|
||||
#binds
|
||||
$mainMod = SUPER
|
||||
|
||||
bind = SUPER, RETURN, exec, kitty
|
||||
|
||||
bind = SUPER_SHIFT, RETURN,togglespecialworkspace,
|
||||
# bind = SUPER_SHIFT, RETURN, exec, kitty --title flying_kitty --single-instance
|
||||
bind = SUPER, Q, killactive,
|
||||
bind = SUPER, T, togglefloating,
|
||||
bind = SUPER, F, fullscreen,
|
||||
|
||||
bind = SUPER, D, exec, wofi -modi --show drun
|
||||
bind = SUPER SHIFT,D,exec, ~/.config/hypr/themes/apatheia/eww/launch_bar
|
||||
|
||||
bind = SUPER, V, exec, cliphist list | wofi -dmenu | cliphist decode | wl-copy
|
||||
bind = , Print, exec, grim -g "$(slurp -d)" - | swappy -f -
|
||||
|
||||
bind = SUPER, L, exec, swaylock
|
||||
|
||||
|
||||
bind = SUPER, P, pseudo, # dwindle
|
||||
bind = SUPER, J, togglesplit, # dwindle
|
||||
bind = SUPER, G, togglegroup
|
||||
bind = SUPER, tab, changegroupactive
|
||||
|
||||
bind = SUPER, left, movefocus, l
|
||||
bind = SUPER, right, movefocus, r
|
||||
bind = SUPER, up, movefocus, u
|
||||
bind = SUPER, down, movefocus, d
|
||||
|
||||
bind = SUPER, 1, workspace, 1
|
||||
bind = SUPER, 2, workspace, 2
|
||||
bind = SUPER, 3, workspace, 3
|
||||
bind = SUPER, 4, workspace, 4
|
||||
bind = SUPER, 5, workspace, 5
|
||||
bind = SUPER, 6, workspace, 6
|
||||
bind = SUPER, 7, workspace, 7
|
||||
bind = SUPER, 8, workspace, 8
|
||||
bind = SUPER, 9, workspace, 9
|
||||
bind = SUPER, 0, workspace, 10
|
||||
|
||||
bind = SUPER SHIFT, 1, movetoworkspacesilent, 1
|
||||
bind = SUPER SHIFT, 2, movetoworkspacesilent, 2
|
||||
bind = SUPER SHIFT, 3, movetoworkspacesilent, 3
|
||||
bind = SUPER SHIFT, 4, movetoworkspacesilent, 4
|
||||
bind = SUPER SHIFT, 5, movetoworkspacesilent, 5
|
||||
bind = SUPER SHIFT, 6, movetoworkspacesilent, 6
|
||||
bind = SUPER SHIFT, 7, movetoworkspacesilent, 7
|
||||
bind = SUPER SHIFT, 8, movetoworkspacesilent, 8
|
||||
bind = SUPER SHIFT, 9, movetoworkspacesilent, 9
|
||||
bind = SUPER SHIFT, 0, movetoworkspacesilent, 10
|
||||
|
||||
bind = SUPER, mouse_down, workspace, e+1
|
||||
bind = SUPER, mouse_up, workspace, e-1
|
||||
|
||||
bindm = SUPER, mouse:272, movewindow
|
||||
bindm = SUPER, mouse:273, resizewindow
|
||||
bind = , XF86AudioPlay, exec, playerctl play-pause
|
||||
bind = , XF86AudioPrev, exec, playerctl previous
|
||||
bind = , XF86AudioNext, exec, playerctl next
|
||||
bind = , XF86AudioRaiseVolume, exec, amixer -q sset 'Master' 5%+
|
||||
bind = , XF86AudioLowerVolume, exec, amixer -q sset 'Master' 5%-
|
||||
bind = , XF86AudioMute, exec, amixer -q sset 'Master' toggle
|
||||
bind = , XF86MonBrightnessUp, exec, brillo -A 5
|
||||
bind = , XF86MonBrightnessDown, exec, brillo -U 5
|
||||
|
||||
exec-once = [workspace special silent] kitty --title flying_kitty
|
||||
exec-once = sh ~/.config/startup.sh
|
||||
'';
|
||||
};
|
||||
|
||||
xdg.configFile."startup.sh".text = ''
|
||||
#!/bin/sh
|
||||
sleep 2
|
||||
keepassxc &
|
||||
firefox &
|
||||
jellyfin-mpv-shim &
|
||||
easyeffects --gapplication-service &
|
||||
|
||||
sleep 2
|
||||
nextcloud &
|
||||
telegram-desktop&
|
||||
'';
|
||||
};
|
||||
}
|
6
modules/home/wayland/hyprland/default.nix
Executable file
6
modules/home/wayland/hyprland/default.nix
Executable file
@ -0,0 +1,6 @@
|
||||
{ lib, config, pkgs, ... }: {
|
||||
imports = [ ./config.nix ];
|
||||
config = lib.mkIf (config.homecfg.wm == "Wayland") {
|
||||
wayland.windowManager.hyprland = { enable = true; };
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user