Переглянути джерело

Split waybar into two menus plus improvements

master
Dejvino 3 роки тому
джерело
коміт
d14b331a6d
7 змінених файлів з 288 додано та 22 видалено
  1. +2
    -0
      README.md
  2. +113
    -0
      config/sway/config
  3. +9
    -9
      config/waybar/config
  4. +129
    -0
      config/waybar/config_left
  5. +20
    -13
      config/waybar/style.css
  6. BIN
      screenshot.jpg
  7. +15
    -0
      usr/local/bin/waybar_battery

+ 2
- 0
README.md Переглянути файл

@@ -3,6 +3,8 @@
Linux UI customized to resemble a Fallout Pip-Boy. To be used with the PINE64 PinePhone running Arch Linux ARM, enclosed in the PinePhoneBoy harness.

## Screenshots
![Main screen](screenshot.jpg)

### Radio tab
![Radio](screenshots/radio.jpg)



+ 113
- 0
config/sway/config Переглянути файл

@@ -0,0 +1,113 @@
### Output configuration
#
# Default wallpaper (more resolutions are available in /usr/share/backgrounds/sway/)
#output * bg /usr/share/backgrounds/sway/Sway_Wallpaper_Blue_1920x1080.png fill
output * bg ~/Desktop/background.png fill

set $GREEN "#00AA00FF"
set $LGREEN "#00FF00FF"
set $DGREEN "#006600FF"
set $BLACK "#000000FF"
client.focused $GREEN $BLACK $GREEN $LGREEN $DGREEN
client.unfocused $DGREEN $BLACK $DGREEN $DGREEN $DGREEN

#
# Workspaces:
#
set $W1 '1:STAT'
set $W2 '2:INV'
set $W3 '3:DATA'
set $W4 '4:MAP'
set $W5 '5:RADIO'
set $W6 '6:6'
set $W7 '7:7'
set $W8 '8:8'
set $W9 '9:9'

set $WSTAT $W1
set $WINV $W2
set $WDATA $W3
set $WMAP $W4
set $WRADIO $W5

# Switch to workspace
bindsym $mod+1 workspace $W1
bindsym $mod+2 workspace $W2
bindsym $mod+3 workspace $W3
bindsym $mod+4 workspace $W4
bindsym $mod+5 workspace $W5
bindsym $mod+6 workspace $W6
bindsym $mod+7 workspace $W7
bindsym $mod+8 workspace $W8
bindsym $mod+9 workspace $W9
bindsym $mod+0 workspace $W10
# Move focused container to workspace
bindsym $mod+Shift+1 move container to workspace $W1
bindsym $mod+Shift+2 move container to workspace $W2
bindsym $mod+Shift+3 move container to workspace $W3
bindsym $mod+Shift+4 move container to workspace $W4
bindsym $mod+Shift+5 move container to workspace $W5
bindsym $mod+Shift+6 move container to workspace $W6
bindsym $mod+Shift+7 move container to workspace $W7
bindsym $mod+Shift+8 move container to workspace $W8
bindsym $mod+Shift+9 move container to workspace $W9
bindsym $mod+Shift+0 move container to workspace $W10
# Note: workspaces can have any name you want, not just numbers.
# We just use 1-10 as the default.

#
# Power Button
#
set $pplock 'swayphone_power_sleep'
set $ppunlock 'swayphone_power_wakeup'
set $lockapp swaylock
set $lock '$lockapp -f -c 000000'
set $unlock 'killall $lockapp'
## wish this worked...
#bindsym XF86PowerOff exec $lock
#bindsym --locked XF86PowerOff exec $unlock
# alternative:
bindcode 124 exec $lock; exec $pplock
bindcode --locked 124 exec $unlock; exec $ppunlock

exec swayidle -w \
timeout 15 'swaymsg exec $lock; $pplock' \
resume 'swaymsg exec $unlock; $ppunlock' \
before-sleep 'swaymsg exec $lock; $pplock'

# Scale the touchscreen LCD UI
output DSI-1 scale 2

# Bind input and output for correct rotation support
input 1046:4097:Goodix_Capacitive_TouchScreen map_to_output DSI-1
#output DSI-1 transform 0
#output DSI-1 transform 90
output DSI-1 transform 270

# Keyboard
exec "squeekboard"

# Status Bar
exec "waybar -c ~/.config/waybar/config -b side"
exec "waybar -c ~/.config/waybar/config_left -b side_left"

# Restore backlight
exec 'swayphone_power_wakeup'

# INV
exec "portfolio-fm"
for_window [app_id="portfolio-fm"] move workspace $WINV; border none

# DATA
exec "epiphany"
for_window [app_id="epiphany"] move workspace $WDATA; border none

# RADIO
exec "killall mpd ; mpd"
exec "xfmpc"
for_window [app_id="xfmpc"] move workspace $WRADIO; border none

# Welcome message
exec "mako" # notify daemon
exec "sleep 2; notify-send 'Welcome!' 'Your Pip-Boy is ready to be used.' --icon=dialog-information"


+ 9
- 9
config/waybar/config Переглянути файл

@@ -11,8 +11,7 @@
"modules-left": [
"clock#time",
"clock#date",
"battery",
"custom/terminal",
//"battery", // broken for some reason...
"sway/workspaces"
],
@@ -20,12 +19,13 @@
],

"modules-right": [
"cpu",
"memory",
// "cpu",
// "memory",
// "disk",
"network",
"backlight",
"pulseaudio",
// "network",
// "backlight",
// "pulseaudio",
"custom/terminal",
"custom/kill",
"tray"
],
@@ -119,12 +119,12 @@

"custom/kill": {
"on-click": "swaymsg kill",
"format": "[KILL]"
"format": "💀"
},

"custom/terminal": {
"on-click": "termite",
"format": "[TERM]"
"format": "#>_"
},




+ 129
- 0
config/waybar/config_left Переглянути файл

@@ -0,0 +1,129 @@
{
// ☢

//GLOBAL
"layer": "top",

"position": "left",
"width": 15,

"modules-left": [
"cpu",
"memory",
//"battery", // broken for some reason...
"custom/battery",
"temperature",
"disk",
"backlight",
"pulseaudio",
],
"modules-center": [
],

"modules-right": [
//"custom/terminal",
"custom/keyshow",
"custom/keyhide"
],

//MODULES

"custom/battery": {
"exec": "waybar_battery",
"interval": "2",
"return-type": "json",
"format": "⚛ {}"
},
"custom/kill": {
"on-click": "swaymsg kill",
"format": "☠"
},

"custom/keyshow": {
"on-click": "swayphone_keyboard_show",
"format": "K↥"
},

"custom/keyhide": {
"on-click": "swayphone_keyboard_hide",
"format": "K↧"
},

"custom/terminal": {
"on-click": "termite",
"format": ">_"
},

"cpu": {
"interval": 5,
"tooltip": false,
"format": " {usage}%", //Icon: microchip
"states": {
"warning": 70,
"critical": 90
},
"on-click": "termite -e \"htop --sort-key=PERCENT_CPU\""
},

"memory": {
"interval": 5,
"format": " {}%", // Icon: memory
"states": {
"warning": 70,
"critical": 90
},
"on-click": "termite -e \"htop --sort-key=PERCENT_MEM\""
},

"temperature": {
// "thermal-zone": 2,
// "hwmon-path": "/sys/class/hwmon/hwmon2/temp1_input",
"critical-threshold": 60,
"format-critical": " {temperatureC}°C",
"format": " {temperatureC}°C"
},

"network": {
"interval": 5,
"format-wifi": "  {essid}", // Icon: wifi
"format-ethernet": " {ifname}", // Icon: ethernet
"format-disconnected": "Disconnected",
"tooltip-format": "{ifname}: {ipaddr}",
"on-click": "swaymsg exec \"termite -e nmtui\""
},

"pulseaudio": {
"scroll-step": 1,
"format": "{icon} {volume}%",
"format-bluetooth": "{icon} {volume}%",
"format-muted": "",
"format-icons": {
"headphones": "",
"handsfree": "",
"headset": "",
"phone": "",
"portable": "",
"car": "",
"default": ["", ""]
},
"on-click": "pavucontrol"
},

"disk": {
"interval": 5,
"format": "✇ {percentage_used:2}%", // alt: 
"path": "/"
},

"backlight": {
// "device": "acpi_video1",
"format": "{icon} {percent}% ",
"states": [0,50],
"format-icons": ["", ""],
"on-click": "termite -e swayphone_backlightselect"
},
}



+ 20
- 13
config/waybar/style.css Переглянути файл

@@ -26,9 +26,13 @@
#mode,
#network,
#pulseaudio,
#temperature,
#custom-battery,
#custom-alsa,
#custom-kill,
#custom-terminal,
#custom-keyshow,
#custom-keyhide,
#tray {
padding-left: 8px;
padding-right: 8px;
@@ -57,16 +61,30 @@
#backlight {
}

#custom-battery.charging {
}
#custom-battery.discharging {
color: green;
}

#battery {
animation-timing-function: linear;
animation-iteration-count: infinite;
animation-direction: alternate;
}

#battery.warning {
#battery.warning,
#temperature.warning,
#cpu.warning {
color: orange;
}

#battery.critical,
#cpu.critical,
#temperature.critical {
color: red;
}

#clock.date {
font-weight: bold;
}
@@ -76,17 +94,6 @@
font-size: 12px;
}

#cpu {
}

#cpu.warning {
color: orange;
}

#cpu.critical {
color: orange;
}

#memory {
animation-timing-function: linear;
animation-iteration-count: infinite;
@@ -107,7 +114,7 @@
}

#network.disconnected {
color: orange;
color: gray;
}

#pulseaudio {


BIN
screenshot.jpg Переглянути файл

Перед Після
Ширина: 1440  |  Висота: 720  |  Розмір: 54 KiB

+ 15
- 0
usr/local/bin/waybar_battery Переглянути файл

@@ -0,0 +1,15 @@
#!/bin/bash

READBAT="cat /sys/class/power_supply/axp20x-battery/uevent"
GETVAL="cut -d= -f2"
LOWERCASE="tr '[:upper:]' '[:lower:]'"

STATUS=`$READBAT | grep STATUS | $GETVAL | $LOWERCASE`
CHARGE=`$READBAT | grep CAPACITY | $GETVAL`

TEXT="$CHARGE%"
CLASS=$STATUS


echo {\"text\": \"$TEXT\", \"class\": \"$CLASS\"}


Завантаження…
Відмінити
Зберегти