enable gtk

This commit is contained in:
crurak 2023-08-06 09:17:38 +02:00
parent 683bd41f4f
commit dfbab59b45
8 changed files with 474 additions and 332 deletions

View File

@ -4,10 +4,12 @@
./bat.nix
./dunst.nix
./git.nix
./gtk.nix
./hyprland.nix
./kitty.nix
./librewolf.nix
./neovim.nix
./waybar.nix
./xresources.nix
];
}

View File

@ -6,5 +6,23 @@
package = pkgs.papirus-icon-theme;
name = "Papirus";
};
settings = {
global = {
geometry = "1870x5-25+45";
width = 350;
separator_height = 5;
padding = 24;
horizontal_padding = 24;
frame_width = 3;
idle_threshold = 120;
alignment = "center";
word_wrap = "yes";
transparency = 5;
format = "<b>%s</b>: %b";
markup = "full";
min_icon_size = 32;
max_icon_size = 128;
};
};
};
}

21
home/gtk.nix Normal file
View File

@ -0,0 +1,21 @@
{ pkgs, ... }: {
gtk = {
enable = true;
cursorTheme = {
package = pkgs.phinger-cursor;
name = "phinger-cursors";
};
gtk3.extraConfig = {
gtk-decoration-layout = "menu";
gtk-xft-antialias = 1;
gtk-xft-hinting = 1;
gtk-xft-hintstyle = "hintfull";
gtk-xft-rgba = "rgb";
gtk-recent-files-enable = false;
};
iconTheme = {
package = pkgs.fluent-icon-theme;
name = "Fluent-dark";
};
};
}

View File

@ -3,10 +3,16 @@
in {
xdg.configFile."hypr/hyprland.conf".text = ''
env = XDG_CURRENT_DESKTOP,Hyprland
env = XDG_SESSION_TYPE,wayland
env = XDG_SESSION_DESKTOP,hyprland
env = GDK_BACKEND,wayland
env = QT_QPA_PLATFORM,wayland
general {
gaps_in = 0
gaps_out = -1
border_size = 0
gaps_in = 1
gaps_out = 1
border_size = 1
layout = master
}
@ -31,7 +37,7 @@ in {
special_scale_factor = 1
}
exec-once = waybar
$SUPER = ${modifier};
bind = $SUPER, Q, exec, kitty

View File

@ -1,429 +1,393 @@
{
xdg.configFile."waybar/config".text = /* json */ ''
{
"layer": "top",
"position": "bottom",
"height": 35,
"spacing": 4,
"margin-top": 0,
"margin-bottom":0,
"position": "top",
"mod": "dock",
"exclusive": true,
"passthrough": false,
"gtk-layer-shell": true,
"height": 0,
"modules-left": [
"clock",
"custom/weather",
"wlr/workspaces"
],
"modules-center": ["hyprland/window"],
"modules-right": [
"tray",
"custom/updates",
"custom/language",
"battery",
"backlight",
"pulseaudio",
"pulseaudio#microphone"
],
// Choose the order of the modules
"modules-left":[ "custom/launcher", "wlr/taskbar"],
"modules-center":["custom/media"],
"modules-right":["backlight", "battery", "battery#bat2", "idle_inhibitor", "custom/updater", "pulseaudio", "custom/snip", "custom/wallpaper", "tray", "clock", "custom/power"],
// Modules configuration
"wlr/taskbar": {
"format": "{icon}",
"icon-size": 20,
"icon-theme": "Star",
"tooltip-format": "{title}",
"hyprland/window": {
"format": "{}"
},
"wlr/workspaces": {
"disable-scroll": true,
"all-outputs": true,
"on-click": "activate",
"on-click-middle": "close",
"on-click-right": "minimize"
},
"keyboard-state": {
"numlock": true,
"capslock": true,
"format": " {name} {icon}",
"format-icons": {
"locked": "",
"unlocked": ""
//"format": "{icon}",
"persistent_workspaces": {
"1": [],
"2": [],
"3": [],
"4": [],
"5": [],
"6": [],
"7": [],
"8": [],
"9": [],
"10": []
}
},
"sway/language": {
"format": " {}",
"custom/updates": {
"format": " {}",
"interval": 7200, // every two hours
"exec": "i=$(checkupdates); echo \"$i\" |wc -l; echo \"$i\" |column -t |tr '\n' '\r'", // # of updates and tooltip details
"exec-if": "exit 0", // always run; consider advanced run conditions
"on-click": "kitty -e sudo pacman -Syu", // update system
"signal": 8
},
"idle_inhibitor": {
"format": "{icon}",
"format-icons": {
"activated": "",
"deactivated": ""
}
"custom/weather" : {
"tooltip" : true,
"format" : "{}",
"interval" : 30,
"exec" : "~/.config/waybar/waybar-wttr.py",
"return-type" : "json"
},
"tray": {
"icon-size": 20,
"icon-size": 13,
"spacing": 10
},
"clock": {
// "timezone": "America/New_York",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>",
"format-alt": "{:%Y-%m-%d}"
},
"cpu": {
"format": "{usage}% ",
"tooltip": false
},
"memory": {
"format": "{}% "
},
"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 80,
// "format-critical": "{temperatureC}°C {icon}",
"format": "{temperatureC}°C {icon}",
"format-icons": ["", "", ""]
"format": "{: %R %d/%m}",
"tooltip-format": "<big>{:%Y %B}</big>\n<tt><small>{calendar}</small></tt>"
},
"backlight": {
// "device": "acpi_video1",
"format": "{icon}",
"format-icons": ["", ""],
"on-click": "bash $HOME/.config/system_scripts/brightness up",
"on-click-right": "bash $HOME/.config/system_scripts/brightness down",
"on-scroll-up": "",
"on-scroll-down": ""
"device": "intel_backlight",
"format": "{icon} {percent}%",
"format-icons": ["", "", ""],
"on-scroll-up": "brightnessctl set 1%+",
"on-scroll-down": "brightnessctl set 1%-",
"min-length": 6
},
"battery": {
"states": {
// "good": 95,
"good": 95,
"warning": 30,
"critical": 15
"critical": 20
},
"format": "{icon}",
"format-charging": "{capacity}% ",
"format-plugged": "{capacity}% ",
"format": "{icon} {capacity}%",
"format-charging": " {capacity}%",
"format-plugged": " {capacity}%",
"format-alt": "{time} {icon}",
// "format-good": "", // An empty format will hide the module
// "format-full": "",
"format-icons": ["", "", "", "", ""]
},
"battery#bat2": {
"bat": "CMB1"
},
"network": {
// "interface": "wlp2*", // (Optional) To force the use of this interface
"format-wifi": "{essid} ({signalStrength}%) ",
"format-ethernet": "Connected ",
"tooltip-format": "{ifname} via {gwaddr} ",
"format-linked": "{ifname} (No IP) ",
"format-disconnected": "Disconnected ",
"format-alt": "{ifname}: {ipaddr}/{cidr}",
"on-click-right": "bash ~/.config/rofi/wifi_menu/rofi_wifi_menu"
"format-icons": ["", "", "", "", "", "", "", "", "", "", ""]
},
"pulseaudio": {
// "scroll-step": 1, // %, can be a float
"format": "{icon}",
"format-bluetooth": "{volume}% {icon}",
"format-bluetooth-muted": "{icon} {format_source}",
"format-muted": "{format_source}",
"format-source": "",
"format-source-muted": "",
"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": "",
"hands-free": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", "", ""]
"default": ["", "", ""]
}
},
"on-click": "bash $HOME/.config/system_scripts/volume up",
"on-click-right": "bash $HOME/.config/system_scripts/volume down",
"on-scroll-up": "",
"on-scroll-down": ""
},
"custom/media": {
"format": "{icon} {}",
"return-type": "json",
"max-length": 30,
"format-icons": {
"spotify": " ",
"default": ""
},
"escape": true,
"exec": "$HOME/.config/system_scripts/mediaplayer.py 2> /dev/null",
"on-click": "playerctl play-pause"
},
"custom/launcher":{
"format": "",
"on-click": "wofi --show drun",
"on-click-right": "killall wofi"
},
"custom/power":{
"format": " ",
"on-click": "nwg-bar",
"on-click-right": "killall nwg-bar"
},
"custom/updater":{
"format": "{} Updates",
"exec": "checkupdates | wc -l",
"exec-if": "[[ $(checkupdates | wc -l) != 0 ]]",
"interval": 15,
"on-click": "alacritty -e yay -Syu"
},
"custom/snip":{
"format": "",
"on-click": "grimshot --notify save area $HOME/Pictures/$(zenity --entry --text 'Set filename:' --entry-text '.png')"
},
"custom/wallpaper":{
"format": "",
"on-click": "bash ~/.config/system_scripts/pkill_bc"
"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
}
}
'';
xdg.configFile."waybar/style.css".text = /* css */ ''
* {
border: none;
border-radius: 0px;
/* `otf-font-awesome` is required to be installed for icons */
font-family: Material, Roboto, Helvetica, Arial, sans-serif;
font-size: 13px;
border-radius: 0;
font-family: Cartograph CF Nerd Font, monospace;
font-weight: bold;
font-size: 14px;
min-height: 0;
/*border-radius: 20px;*/
}
window#waybar {
background-image: linear-gradient(to right, #000000 0%, #434343 51%, #000000 100%);
color: #ffffff;
transition-property: background-color;
transition-duration: .5s;
background: rgba(21, 18, 27, 0);
color: #cdd6f4;
}
window#waybar.hidden {
opacity: 0.2;
tooltip {
background: #1e1e2e;
border-radius: 10px;
border-width: 2px;
border-style: solid;
border-color: #11111b;
}
#workspaces button {
background: #1f1f1f;
color: #ffffff;
border-radius: 20px;
padding: 5px;
color: #313244;
margin-right: 5px;
}
/* https://github.com/Alexays/Waybar/wiki/FAQ#the-workspace-buttons-have-a-strange-hover-effect */
#workspaces button:hover {
background: lightblue;
color: black;
border-bottom: 3px solid #ffffff;
#workspaces button.active {
color: #a6adc8;
}
#workspaces button.focused {
background: #1f1f1f;
}
#workspaces button.focused:hover {
background: lightblue;
color: black;
border-bottom: 3px solid #ffffff;
color: #a6adc8;
background: #eba0ac;
border-radius: 10px;
}
#workspaces button.urgent {
background-color: #eb4d4b;
color: #11111b;
background: #a6e3a1;
border-radius: 10px;
}
#mode {
background-color: #64727D;
border-bottom: 3px solid #ffffff;
#workspaces button:hover {
background: #11111b;
color: #cdd6f4;
border-radius: 10px;
}
#custom-language,
#custom-updates,
#custom-caffeine,
#custom-weather,
#window,
#clock,
#battery,
#cpu,
#memory,
#disk,
#temperature,
#backlight,
#network,
#pulseaudio,
#custom-media,
#custom-launcher,
#custom-power,
#custom-wallpaper,
#custom-updater,
#custom-snip,
#taskbar,
#network,
#workspaces,
#tray,
#mode,
#idle_inhibitor,
#mpd {
padding: 0 10px;
color: #ffffff;
}
#window,
#workspaces {
margin: 0px 4px;
}
/* If workspaces is the leftmost module, omit left margin */
.modules-left > widget:first-child > #workspaces {
margin-left: 0px;
}
/* If workspaces is the rightmost module, omit right margin */
.modules-right > widget:last-child > #workspaces {
margin-right: 0px;
}
#clock {
background-color: #090909;
color: #ffffff;
}
#battery {
background-color: #ffffff;
color: #000000;
}
#battery.charging, #battery.plugged {
color: #ffffff;
background-color: #26A65B;
}
@keyframes blink {
to {
background-color: #ffffff;
color: #000000;
}
}
#battery.critical:not(.charging) {
background-color: #f53c3c;
color: #ffffff;
animation-name: blink;
animation-duration: 0.5s;
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}
label:focus {
background-color: #000000;
}
#cpu {
color: #ffffff;
}
#memory {
color: #ffffff;
}
#disk {
color: #ffffff;
}
#backlight {
background-color: #90b1b1;
}
#pulseaudio {
color: #ffffff;
font-size: 18px;
}
#pulseaudio.muted {
color: red;
}
#custom-media {
color: whitesmoke;
margin: 5px;
font-size: 13px;
}
#custom-media.custom-spotify {
background-color: #8EC5FC;
background-image: linear-gradient(to right, #434343 0%, #000000 51%, #434343 100%);
color: whitesmoke;
margin-right: 5px;
}
#custom-media.custom-vlc {
background-color: #8EC5FC;
background-image: linear-gradient(to right, #434343 0%, #000000 51%, #434343 100%);
color: whitesmoke;
margin-right: 5px;
}
#custom-power{
background-image: linear-gradient(to left, #000000 0%, #000000 51%, #434343 100%);
font-size: 20px;
margin-right: 5px;
}
#custom-launcher{
background-image: linear-gradient(to right, #000000 0%, #000000 51%, #434343 100%);
font-size: 20px;
margin-left: 5px;
}
#custom-wallpaper{
color: white;
font-size:18px;
}
#custom-updater {
color: white;
}
#custom-snip {
color: white;
font-size: 20px;
}
#taskbar{
color: white;
}
#temperature {
color: #ffffff;
}
#temperature.critical {
background-color: #eb4d4b;
background: #1e1e2e;
padding: 0px 10px;
margin: 3px 0px;
margin-top: 10px;
border: 1px solid #181825;
}
#tray {
color: #ffffff;
border-radius: 10px;
margin-right: 10px;
}
#tray > .passive {
-gtk-icon-effect: dim;
color: #ffffff;
#workspaces {
background: #1e1e2e;
border-radius: 10px;
margin-left: 10px;
padding-right: 0px;
padding-left: 5px;
}
#tray > .needs-attention {
-gtk-icon-effect: highlight;
color: #ffffff;
#custom-caffeine {
color: #89dceb;
border-radius: 10px 0px 0px 10px;
border-right: 0px;
margin-left: 10px;
}
#idle_inhibitor {
font-size: 18px;
#custom-language {
color: #f38ba8;
border-left: 0px;
border-right: 0px;
}
#idle_inhibitor.activated {
color: #ffffff;
#custom-updates {
color: #f5c2e7;
border-radius: 10px 0px 0px 10px;
border-left: 0px;
border-right: 0px;
}
#language {
color: #ffffff;
min-width: 16px;
#window {
border-radius: 10px;
margin-left: 60px;
margin-right: 60px;
}
#keyboard-state {
background: #97e1ad;
color: #000000;
min-width: 16px;
#clock {
color: #fab387;
border-radius: 10px 0px 0px 10px;
margin-left: 5px;
border-right: 0px;
}
#keyboard-state > label {
padding: 0px 5px;
#network {
color: #f9e2af;
border-left: 0px;
border-right: 0px;
}
#keyboard-state > label.locked {
background: rgba(0, 0, 0, 0.2);
#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;
}
'';
xdg.configFile."waybar/waybar-wttr.py".text = /* python */ ''
#!/usr/bin/env python
import json
import requests
from datetime import datetime
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['FeelsLikeF']+"°").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]['FeelsLikeF'])
extrachar = ""
if tempint > 0 and tempint < 10:
extrachar = '+'
data['text'] = ''+WEATHER_CODES[weather['current_condition'][0]['weatherCode']] + \
" "+extrachar+weather['current_condition'][0]['FeelsLikeF']+"°"
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]['FeelsLikeF']}°\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['FeelsLikeF'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n"
print(json.dumps(data))
'';
}

10
home/xresources.nix Normal file
View File

@ -0,0 +1,10 @@
{
xresources.properties = {
"Xft.hinting" = true;
"Xft.antialias" = true;
"Xft.autohint" = false;
"Xft.lcdfilter" = "lcddefault";
"Xft.hintstyle" = "hintfull";
"Xft.rgba" = "rgb";
};
}

View File

@ -1,6 +1,7 @@
{ config, pkgs, ... }: {
environment.systemPackages = with pkgs; [
git
neofetch
tree
wget
];

120
scripts/waybar-wttr.py Normal file
View File

@ -0,0 +1,120 @@
#!/usr/bin/env python
import json
import requests
from datetime import datetime
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['FeelsLikeF']+"°").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]['FeelsLikeF'])
extrachar = ''
if tempint > 0 and tempint < 10:
extrachar = '+'
data['text'] = ''+WEATHER_CODES[weather['current_condition'][0]['weatherCode']] + \
" "+extrachar+weather['current_condition'][0]['FeelsLikeF']+"°"
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]['FeelsLikeF']}°\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['FeelsLikeF'])} {hour['weatherDesc'][0]['value']}, {format_chances(hour)}\n"
print(json.dumps(data))