add gh-cli

This commit is contained in:
danny 2024-12-14 16:55:50 +08:00
parent ab917700ee
commit 5b46a0b217
30 changed files with 680 additions and 356 deletions

34
home/config/waybar/config Normal file
View file

@ -0,0 +1,34 @@
{
"include": "~/.config/waybar/modules",
"layer": "top",
"exclusive": true,
"passthrough": false,
"position": "top",
"spacing": 3,
"fixed-center": true,
"ipc": true,
"margin-top": 0,
"margin-left": 0,
"margin-right": 0,
"margin-bottom": 0,
"modules-left": [
"hyprland/workspaces",
"clock",
"custom/cava",
"mpris"
],
"modules-center": [
"hyprland/window"
],
"modules-right": [
"wlr/taskbar",
"cpu",
"temperature",
"memory",
"custom/swaync",
"pulseaudio"
]
}

View file

@ -1,82 +0,0 @@
{
"layer": "top",
"position": "top",
"mod": "dock",
"exclusive": true,
"passthrough": false,
"gtk-layer-shell": true,
"height": 0,
"modules-left": [
"hyprland/workspaces"
],
"modules-center": ["hyprland/window"],
"modules-right": [
"tray",
"custom/updates",
"hyprland/language",
"pulseaudio",
"pulseaudio#microphone",
"clock",
"custom/weather"
],
"hyprland/window": {
"format": "{}"
},
"hyprland/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"on-click": "activate",
"persistent_workspaces": {
"1": []
}
},
"hyprland/language": {
"format": "{}",
"format-en": "US",
"format-ru": "RU",
"format-ka": "GE"
},
"custom/weather" : {
"tooltip" : true,
"format" : "{}",
"interval" : 30,
"exec" : "~/.config/waybar/scripts/waybar-wttr.py",
"return-type" : "json"
},
"tray": {
"icon-size": 16,
"spacing": 10
},
"clock": {
"format": "{: %R  %d/%m}",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
},
"pulseaudio": {
"format": "{icon} {volume}%",
"tooltip": false,
"format-muted": " Muted",
"on-click": "pamixer -t",
"on-scroll-up": "pamixer -i 5",
"on-scroll-down": "pamixer -d 5",
"scroll-step": 5,
"format-icons": {
"headphone": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
}
},
"pulseaudio#microphone": {
"format": "{format_source}",
"format-source": "🎙{volume}%",
"format-source-muted": "🎙Muted",
"on-click": "pamixer --default-source -t",
"on-scroll-up": "pamixer --default-source -i 5",
"on-scroll-down": "pamixer --default-source -d 5",
"scroll-step": 5
}
}

168
home/config/waybar/modules Normal file
View file

@ -0,0 +1,168 @@
{
"hyprland/workspaces": {
"active-only": false,
"all-outputs": true,
"format": "{icon}",
"show-special": false,
"on-click": "activate",
"on-scroll-up": "hyprctl dispatch workspace e+1",
"on-scroll-down": "hyprctl dispatch workspace e-1",
"persistent-workspaces": {
"1": [],
"2": [],
"3": [],
"4": [],
},
"format-icons": {
"active": "👁️‍🗨️",
"default": "🗨️",
},
},
"clock": {
"interval": 1,
"format": " 🕑 {:%H:%M} ",
"format-alt": " 🕑 {:%H:%M 🗓️ %Y, %d %B, %A} ",
"tooltip-format": "<tt><small>{calendar}</small></tt>",
"calendar": {
"mode" : "year",
"mode-mon-col" : 3,
"weeks-pos" : "right",
"on-scroll" : 1,
"format": {
"days": "<span color='#ebdbb2'><b>{}</b></span>",
"weeks": "<span color='#99ffdd'><b>W{}</b></span>",
"weekdays": "<span color='#ebdbb2'><b>{}</b></span>",
"today": "<span color='#ff6699'><b><u>{}</u></b></span>"
}
}
},
"actions": {
"on-click-right": "mode",
"on-click-forward": "tz_up",
"on-click-backward": "tz_down",
"on-scroll-up": "shift_up",
"on-scroll-down": "shift_down"
},
"cpu": {
"format": " {usage}% 🧠 ",
"interval": 1,
"on-click-right": "gnome-system-monitor"
},
"hyprland/window": {
"format": " {} ",
"max-length": 60,
"separate-outputs": true,
"offscreen-css" : true,
"offscreen-css-text": "(inactive)",
"rewrite": {
"(.*) — Mozilla Firefox": " $1",
"(.*) - fish": "> [$1]",
"(.*) - zsh": "> [$1]",
"(.*) - kitty": "> [$1]"
}
},
"memory": {
"interval": 10,
"format": " {percentage}% 📊 ",
"format-alt-click": "click",
"tooltip": true,
"tooltip-format": "{used:0.1f}GB/{total:0.1f}G",
"on-click-right": "kitty -c ~/.config/kitty/kitty.conf --title btop sh -c 'btop'"
},
"mpris": {
"interval": 10,
"format": " {title} ",
"format-paused": " {title} {status_icon} ",
"on-click": "playerctl play-pause",
"on-click-right": "playerctl next",
"scroll-step": 5.0,
"smooth-scrolling-threshold": 1,
"status-icons": {
"paused": "󰐎",
"playing": "🎶",
"stopped": ""
},
"max-length": 30
},
"pulseaudio": {
"format": " {volume}% {icon} ",
"format-bluetooth": " 󰂰 {volume}% {icon} ",
"format-muted": "🔇",
"format-icons": {
"headphone": "🔈",
"hands-free": "🔈",
"headset": "🔈",
"phone": "🔈",
"portable": "🔈",
"car": "🔈",
"default": ["🔈", "🔈", "🔈", "🔈"],
"ignored-sinks": ["Easy Effects Sink"]
},
"scroll-step": 5.0,
"on-click": "pavucontrol -t 3",
"tooltip-format": "{icon} {desc} | {volume}%",
"smooth-scrolling-threshold": 1
},
"temperature": {
"interval": 10,
"tooltip": true,
"hwmon-path": ["/sys/class/hwmon/hwmon1/temp1_input", "/sys/class/thermal/thermal_zone0/temp"],
"critical-threshold": 82,
"format-critical": "{temperatureC}°C {icon}",
"format": " {temperatureC}°C {icon} ",
"format-icons": ["🔥"],
"on-click-right": "kitty -c ~/.config/kitty/kitty.conf --title nvtop sh -c 'nvtop'"
},
"custom/swaync": {
"tooltip":true,
"format": " {} {icon} ",
"format-icons": {
"notification": "🔔<span foreground='red'><sup></sup></span>",
"none": "🔔",
"dnd-notification": "🔕<span foreground='red'><sup></sup></span>",
"dnd-none": "🔕",
"inhibited-notification": "🔔<span foreground='red'><sup></sup></span>",
"inhibited-none": "🔔",
"dnd-inhibited-notification": "🔕<span foreground='red'><sup></sup></span>",
"dnd-inhibited-none": "🔕"
},
"return-type": "json",
"exec-if": "which swaync-client",
"exec": "swaync-client -swb",
"on-click": "sleep 0.1 && swaync-client -t -sw",
"on-click-right": "swaync-client -d -sw",
"escape": true
},
"wlr/taskbar": {
"format": " {icon} ",
"icon-size": 20,
"all-outputs": false,
"tooltip-format": "{title}",
"on-click": "activate",
"on-click-middle": "close",
"ignore-list": [
"rofi",
"firefox",
"kitty",
"jetbrains-studio",
"Brave-browser",
"Spotify"
]
},
"custom/cava": {
"exec": "~/.config/scripts/waybarCava.sh",
"format": "{}",
"on-click": "kitty -c ~/.config/kitty/kitty.conf nvim -c cd ~/.config/"
}
}

View file

@ -1,133 +0,0 @@
#!/run/current-system/sw/bin/python
import json
from datetime import datetime
import requests
WEATHER_CODES = {
"113": "☀️ ",
"116": "",
"119": "☁️ ",
"122": "☁️ ",
"143": "☁️ ",
"176": "🌧️",
"179": "🌧️",
"182": "🌧️",
"185": "🌧️",
"200": "⛈️ ",
"227": "🌨️",
"230": "🌨️",
"248": "☁️ ",
"260": "☁️ ",
"263": "🌧️",
"266": "🌧️",
"281": "🌧️",
"284": "🌧️",
"293": "🌧️",
"296": "🌧️",
"299": "🌧️",
"302": "🌧️",
"305": "🌧️",
"308": "🌧️",
"311": "🌧️",
"314": "🌧️",
"317": "🌧️",
"320": "🌨️",
"323": "🌨️",
"326": "🌨️",
"329": "❄️ ",
"332": "❄️ ",
"335": "❄️ ",
"338": "❄️ ",
"350": "🌧️",
"353": "🌧️",
"356": "🌧️",
"359": "🌧️",
"362": "🌧️",
"365": "🌧️",
"368": "🌧️",
"371": "❄️",
"374": "🌨️",
"377": "🌨️",
"386": "🌨️",
"389": "🌨️",
"392": "🌧️",
"395": "❄️ ",
}
data = {}
weather = requests.get("https://wttr.in/?format=j1").json()
def format_time(time):
return time.replace("00", "").zfill(2)
def format_temp(temp):
return (hour["FeelsLikeC"] + "°").ljust(3)
def format_chances(hour):
chances = {
"chanceoffog": "Fog",
"chanceoffrost": "Frost",
"chanceofovercast": "Overcast",
"chanceofrain": "Rain",
"chanceofsnow": "Snow",
"chanceofsunshine": "Sunshine",
"chanceofthunder": "Thunder",
"chanceofwindy": "Wind",
}
conditions = []
for event in chances.keys():
if int(hour[event]) > 0:
conditions.append(chances[event] + " " + hour[event] + "%")
return ", ".join(conditions)
tempint = int(weather["current_condition"][0]["FeelsLikeC"])
extrachar = ""
if tempint > 0 and tempint < 10:
extrachar = "+"
data["text"] = (
""
+ WEATHER_CODES[weather["current_condition"][0]["weatherCode"]]
+ " "
+ extrachar
+ weather["current_condition"][0]["FeelsLikeC"]
+ "°"
)
data["tooltip"] = (
f"<b>{weather['current_condition'][0]['weatherDesc'][0]['value']} {weather['current_condition'][0]['temp_C']}°</b>\n"
)
data["tooltip"] += f"Feels like: {weather['current_condition'][0]['FeelsLikeC']}°\n"
data["tooltip"] += f"Wind: {weather['current_condition'][0]['windspeedKmph']}Km/h\n"
data["tooltip"] += f"Humidity: {weather['current_condition'][0]['humidity']}%\n"
for i, day in enumerate(weather["weather"]):
data["tooltip"] += f"\n<b>"
if i == 0:
data["tooltip"] += "Today, "
if i == 1:
data["tooltip"] += "Tomorrow, "
data["tooltip"] += f"{day['date']}</b>\n"
data["tooltip"] += f"⬆️ {day['maxtempF']}° ⬇️ {day['mintempF']}° "
data[
"tooltip"
] += f"🌅 {day['astronomy'][0]['sunrise']} 🌇 {day['astronomy'][0]['sunset']}\n"
for hour in day["hourly"]:
if i == 0:
if int(format_time(hour["time"])) < datetime.now().hour - 2:
continue
data[
"tooltip"
] += f"{format_time(hour['time'])} {WEATHER_CODES[hour['weatherCode']]} {format_temp(hour['FeelsLikeC'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n"
print(json.dumps(data))

178
home/config/waybar/style.css Executable file → Normal file
View file

@ -1,149 +1,81 @@
* {
border: none;
border-radius: 0;
font-family:
Jetbrains Mono Nerd Font,
monospace;
font-family: "JetBrainsMonoNerdFontMono";
font-weight: bold;
font-size: 14px;
min-height: 0;
font-size: 102%;
font-feature-settings: '"zero", "ss01", "ss02", "ss03", "ss04", "ss05", "cv31"';
padding: 1px;
}
window#waybar {
background: rgba(21, 18, 27, 0);
color: #cdd6f4;
background-color: rgba(0, 0, 0, 0);
transition-property: background-color;
transition-duration: .5s;
}
window#waybar.hidden {
opacity: 0.5;
}
window#waybar.empty {
background-color: transparent;
}
window#waybar.empty #window {
padding: 0px;
border: 0px;
background-color: transparent;
}
tooltip {
background: #1e1e2e;
border-radius: 10px;
border-width: 2px;
border-style: solid;
border-color: #11111b;
}
#workspaces button {
padding: 5px;
color: #313244;
margin-right: 5px;
}
#workspaces button.active {
color: #a6adc8;
}
#workspaces button.focused {
color: #a6adc8;
background: #eba0ac;
opacity: 1;
border-radius: 10px;
}
#workspaces button.urgent {
color: #11111b;
background: #a6e3a1;
border-radius: 10px;
tooltip label {
padding: 10px;
color: #ebdbb2;
}
#workspaces button:hover {
background: #11111b;
color: #cdd6f4;
border-radius: 10px;
}
#language,
#custom-updates,
#custom-caffeine,
#custom-weather,
#window,
#custom-cava,
#clock,
#battery,
#pulseaudio,
#cpu,
#memory,
#mpris,
#network,
#pulseaudio,
#temperature,
#workspaces,
#tray,
#backlight {
background: #1e1e2e;
padding: 0px 10px;
margin: 3px 0px;
margin-top: 10px;
border: 1px solid #181825;
}
#tray {
#custom-menu,
#custom-swaync {
border-radius: 10px;
margin-right: 10px;
}
#workspaces {
background: #1e1e2e;
border-radius: 10px;
margin-left: 10px;
padding-right: 0px;
padding-left: 5px;
}
#custom-caffeine {
color: #89dceb;
border-radius: 10px 0px 0px 10px;
border-right: 0px;
margin-left: 10px;
}
#custom-language {
color: #f38ba8;
border-left: 0px;
border-right: 0px;
}
#custom-updates {
color: #f5c2e7;
border-radius: 10px 0px 0px 10px;
border-left: 0px;
border-right: 0px;
color: #ebdbb2;
padding-top: 3px;
padding-bottom: 3px;
padding-left: 6px;
padding-right: 6px;
}
#window {
border-radius: 10px;
margin-left: 60px;
margin-right: 60px;
color: #ebdbb2;
padding-top: 3px;
padding-bottom: 3px;
padding-right: 6px;
padding-left: 6px;
border-radius: 12px;
}
#clock {
color: #fab387;
border-radius: 10px 0px 0px 10px;
margin-left: 5px;
border-right: 0px;
#workspaces button {
margin: 1px;
box-shadow: none;
text-shadow: none;
border-radius: 12px;
padding-left: 6px;
padding-right: 6px;
background-color: #ebdbb2;
color: #282828;
}
#network {
color: #f9e2af;
border-left: 0px;
border-right: 0px;
}
#pulseaudio {
color: #89b4fa;
border-left: 0px;
border-right: 0px;
}
#pulseaudio.microphone {
color: #cba6f7;
border-radius: 0px 10px 10px 0px;
border-left: 0px;
border-right: 0px;
margin-right: 5px;
}
#battery {
color: #a6e3a1;
border-radius: 0 10px 10px 0;
margin-right: 10px;
border-left: 0px;
}
#custom-weather {
border-radius: 0px 10px 10px 0px;
border-right: 0px;
margin-left: 0px;
#temperature.critical {
background-color: red;
}