feat(eww): blablabla
This commit is contained in:
parent
62160f1282
commit
b31305e4d1
3 changed files with 145 additions and 11 deletions
|
@ -1,21 +1,40 @@
|
||||||
|
$edge_padding: 10px;
|
||||||
|
|
||||||
window {
|
window {
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
background-color: rgba(0, 0, 0, 0);
|
background-color: rgba(0, 0, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.main > box > * {
|
||||||
|
margin-left: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.main > box > :first-child {
|
||||||
|
margin-left: 0px;
|
||||||
|
}
|
||||||
|
|
||||||
.left {
|
.left {
|
||||||
padding-left: 5px;
|
padding-left: $edge_padding;
|
||||||
|
}
|
||||||
|
|
||||||
|
.right {
|
||||||
|
padding-right: $edge_padding;
|
||||||
}
|
}
|
||||||
|
|
||||||
.workspaces {
|
.workspaces {
|
||||||
font-family: Hack Nerd Font;
|
font-family: Hack Nerd Font;
|
||||||
}
|
}
|
||||||
|
|
||||||
.workspace-button:hover {
|
|
||||||
color: #c0ffc0;
|
|
||||||
transition: color 0.2s;
|
|
||||||
}
|
|
||||||
|
|
||||||
.workspace-active {
|
.workspace-active {
|
||||||
color: #20ff20;
|
color: #20ff20;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
:hover {
|
||||||
|
color: #c0ffc0;
|
||||||
|
transition: color 500ms;
|
||||||
|
transition: font-size 50ms;
|
||||||
|
}
|
||||||
|
|
||||||
|
:active {
|
||||||
|
font-size: 10pt;
|
||||||
|
}
|
||||||
|
|
|
@ -1,35 +1,136 @@
|
||||||
(deflisten workspaces
|
(deflisten workspaces-status
|
||||||
:initial "[]"
|
:initial "[]"
|
||||||
|
|
||||||
"./listen/niri/workspaces"
|
"./listen/niri/workspaces"
|
||||||
)
|
)
|
||||||
|
|
||||||
(defvar workspace-icon '{
|
(deflisten window-title "./listen/niri/window-title")
|
||||||
|
|
||||||
|
(deflisten notifications-status
|
||||||
|
:initial '{"dnd": false, "count": 0}'
|
||||||
|
|
||||||
|
"swaync-client --subscribe"
|
||||||
|
)
|
||||||
|
|
||||||
|
(defvar workspaces-icon '{
|
||||||
"admin": "",
|
"admin": "",
|
||||||
"everything": "",
|
"everything": "",
|
||||||
"apps": ""
|
"apps": ""
|
||||||
}')
|
}')
|
||||||
|
|
||||||
|
(defvar notifications-icon '{
|
||||||
|
"nothing": "",
|
||||||
|
"new": "",
|
||||||
|
"dnd": ""
|
||||||
|
}')
|
||||||
|
|
||||||
|
(defvar battery-icon '{
|
||||||
|
"Discharging": {
|
||||||
|
"0": "",
|
||||||
|
"10": "",
|
||||||
|
"20": "",
|
||||||
|
"30": "",
|
||||||
|
"40": "",
|
||||||
|
"50": "",
|
||||||
|
"60": "",
|
||||||
|
"70": "",
|
||||||
|
"80": "",
|
||||||
|
"90": "",
|
||||||
|
"100": ""
|
||||||
|
},
|
||||||
|
"Charging": {
|
||||||
|
"0": "",
|
||||||
|
"10": "",
|
||||||
|
"20": "",
|
||||||
|
"30": "",
|
||||||
|
"40": "",
|
||||||
|
"50": "",
|
||||||
|
"60": "",
|
||||||
|
"70": "",
|
||||||
|
"80": "",
|
||||||
|
"90": "",
|
||||||
|
"100": ""
|
||||||
|
}
|
||||||
|
}')
|
||||||
|
|
||||||
(defwidget workspaces []
|
(defwidget workspaces []
|
||||||
(box
|
(box
|
||||||
:class "workspaces"
|
:class "workspaces"
|
||||||
|
|
||||||
(for workspace in {workspaces}
|
(for workspace in {workspaces-status}
|
||||||
(eventbox
|
(eventbox
|
||||||
:onclick "niri msg action focus-workspace ${workspace.idx}"
|
:onclick "niri msg action focus-workspace ${workspace.idx}"
|
||||||
:width 25
|
:width 25
|
||||||
:class "workspace-button${workspace.is_active ? " workspace-active" : ""}"
|
:class "${workspace.is_active ? " workspace-active" : ""}"
|
||||||
|
|
||||||
"${"${workspace-icon?.[workspace.name]}" ?: ""} "
|
"${"${workspaces-icon?.[workspace.name]}" ?: ""} "
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(defwidget window-title []
|
||||||
|
(box (label
|
||||||
|
:limit-width 80
|
||||||
|
:text "${window-title ?: ""}"
|
||||||
|
))
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwidget notifications []
|
||||||
|
(box (eventbox
|
||||||
|
:onclick "swaync-client --toggle-panel"
|
||||||
|
:onmiddleclick "swaync-client --close-all"
|
||||||
|
:onrightclick "swaync-client --toggle-dnd"
|
||||||
|
:width 25
|
||||||
|
|
||||||
|
(label
|
||||||
|
:class "icons"
|
||||||
|
:text "${notifications-status.dnd
|
||||||
|
? "${notifications-icon.dnd}"
|
||||||
|
: notifications-status.count > 0
|
||||||
|
? "${notifications-icon.new}"
|
||||||
|
: "${notifications-icon.nothing}"} ${notifications-status.count}"
|
||||||
|
)
|
||||||
|
))
|
||||||
|
)
|
||||||
|
|
||||||
(defwidget time []
|
(defwidget time []
|
||||||
"${formattime(EWW_TIME, "%Y-%m-%d")} ${formattime(EWW_TIME, "%H:%M:%S")}"
|
"${formattime(EWW_TIME, "%Y-%m-%d")} ${formattime(EWW_TIME, "%H:%M:%S")}"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
(defwidget tray []
|
||||||
|
(box (systray
|
||||||
|
:icon-size 15
|
||||||
|
:spacing 10
|
||||||
|
))
|
||||||
|
)
|
||||||
|
|
||||||
|
(defwidget battery []
|
||||||
|
(label
|
||||||
|
:text "${EWW_BATTERY.BAT0.capacity == 100
|
||||||
|
? "${battery-icon[EWW_BATTERY.BAT0.status]["100"]}"
|
||||||
|
: EWW_BATTERY.BAT0.capacity >= 90
|
||||||
|
? "${battery-icon[EWW_BATTERY.BAT0.status]["90"]}"
|
||||||
|
: EWW_BATTERY.BAT0.capacity >= 80
|
||||||
|
? "${battery-icon[EWW_BATTERY.BAT0.status]["80"]}"
|
||||||
|
: EWW_BATTERY.BAT0.capacity >= 70
|
||||||
|
? "${battery-icon[EWW_BATTERY.BAT0.status]["70"]}"
|
||||||
|
: EWW_BATTERY.BAT0.capacity >= 60
|
||||||
|
? "${battery-icon[EWW_BATTERY.BAT0.status]["60"]}"
|
||||||
|
: EWW_BATTERY.BAT0.capacity >= 50
|
||||||
|
? "${battery-icon[EWW_BATTERY.BAT0.status]["50"]}"
|
||||||
|
: EWW_BATTERY.BAT0.capacity >= 40
|
||||||
|
? "${battery-icon[EWW_BATTERY.BAT0.status]["40"]}"
|
||||||
|
: EWW_BATTERY.BAT0.capacity >= 30
|
||||||
|
? "${battery-icon[EWW_BATTERY.BAT0.status]["30"]}"
|
||||||
|
: EWW_BATTERY.BAT0.capacity >= 20
|
||||||
|
? "${battery-icon[EWW_BATTERY.BAT0.status]["20"]}"
|
||||||
|
: EWW_BATTERY.BAT0.capacity >= 10
|
||||||
|
? "${battery-icon[EWW_BATTERY.BAT0.status]["10"]}"
|
||||||
|
: "${battery-icon[EWW_BATTERY.BAT0.status]["0"]}"} ${EWW_BATTERY.BAT0.capacity}%"
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
(defwindow dock
|
(defwindow dock
|
||||||
:monitor 0
|
:monitor 0
|
||||||
:geometry (geometry
|
:geometry (geometry
|
||||||
|
@ -43,22 +144,32 @@
|
||||||
:exclusive true
|
:exclusive true
|
||||||
|
|
||||||
(centerbox
|
(centerbox
|
||||||
|
:class "main"
|
||||||
|
|
||||||
(box
|
(box
|
||||||
:class "left"
|
:class "left"
|
||||||
:halign "start"
|
:halign "start"
|
||||||
:space-evenly false
|
:space-evenly false
|
||||||
|
|
||||||
(workspaces)
|
(workspaces)
|
||||||
|
(window-title)
|
||||||
)
|
)
|
||||||
|
|
||||||
(box
|
(box
|
||||||
:class "middle"
|
:class "middle"
|
||||||
|
:space-evenly false
|
||||||
|
|
||||||
|
(tray)
|
||||||
(time)
|
(time)
|
||||||
|
(notifications)
|
||||||
)
|
)
|
||||||
|
|
||||||
(box
|
(box
|
||||||
:class "right"
|
:class "right"
|
||||||
|
:halign "end"
|
||||||
|
:space-evenly false
|
||||||
|
|
||||||
|
(battery)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
4
ahrc-laptop/eww/listen/niri/window-title
Executable file
4
ahrc-laptop/eww/listen/niri/window-title
Executable file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/usr/bin/env sh
|
||||||
|
niri msg event-stream | grep --extended-regexp --line-buffered '^Window (focus|opened or) changed: ' | while read -r _line; do
|
||||||
|
niri msg --json focused-window | jq --raw-output '.title'
|
||||||
|
done
|
Loading…
Reference in a new issue