Added audio device selector, new notification theme and much more. Rewritten some files and made a new README
382
README.md
@@ -1,62 +1,380 @@
|
||||
# Crylia Theme
|
||||
|
||||
This theme is inspired by simple bar and many other things that I think look good and fit my theme. AwesomeWM lets you configure your desktop as you want, no compromises, the sky is the limit!
|
||||
This is the reason I choose AwesomeWM.
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## FAQ - Wiki
|
||||
<div align="center">
|
||||
<h1>Crylia Theme</h1>
|
||||
</div>
|
||||
|
||||
---
|
||||
|
||||
If you feel lost, got a problem or just have a question, please check out the wiki first before opening an issue.
|
||||

|
||||
|
||||
## Quick Install
|
||||

|
||||
|
||||
---
|
||||
|
||||
### [Installation](https://github.com/Crylia/crylia-theme/wiki/Guide)
|
||||
<div align="center">
|
||||
<h1>Welcome to my dotfiles</h1>
|
||||
</div>
|
||||
<div align="center">
|
||||
|
||||
Installing this theme is rather easy, just copy the repo and put the awesome folder to ~/.config/
|
||||
But in order for it to work as seen you need some dependencies installed along the way. Here are the main components, but in order for everything to work go [here](https://github.com/Crylia/crylia-theme/wiki/Guide).
|
||||
An AwesomeWM theme inspired by everything I could find online and thought "Hey, that looks good!".
|
||||
|
||||
||Arch|Ubuntu|Why?|
|
||||
|:-:|:-:|:-:|:-:|
|
||||
|AwesomeWM|awesome|[Guide here](https://github.com/awesomeWM/awesome)|Its your Window Manager lol|
|
||||
|Rofi|rofi|[Guide here](https://github.com/davatorium/rofi)|For the application launcher|
|
||||
|Picom|picom-ibhagwan-git<sup>aur</sup>|[Guide here](https://github.com/jonaburg/picom/security)|Compositor, needed for transparency/blur/effects/animations etc|
|
||||
|||||
|
||||
This repository holds mainly my AwesomeWM theme but also some other rice's I've done over the years.
|
||||
|
||||
Everything you see is done purely because I hate myself and like to give myself a hard time.
|
||||
</div>
|
||||
|
||||
|
||||
## Information
|
||||
|
||||
---
|
||||
<image align="right" width="450px" src="assets/neofetch.png"/>
|
||||
|
||||
**My system setup**:
|
||||
|
||||
- **OS**: [Pop!_OS](https://pop.system76.com/)
|
||||
- **WM**: [AwesomeWM](https://github.com/awesomeWM/awesome)
|
||||
- **Terminal**: [Alacritty](https://github.com/alacritty/alacritty)
|
||||
- **Shell**: [ZSH](https://github.com/ohmyzsh/ohmyzsh)
|
||||
- **Compositor**: [Picom](https://github.com/jonaburg/picom)
|
||||
- **Application Launcher**: [Rofi](https://github.com/davatorium/rofi)
|
||||
- **File Manager**: [Thunar](https://github.com/xfce-mirror/thunar)
|
||||
- **Icons**: [Papirus-Dark](https://github.com/PapirusDevelopmentTeam/papirus-icon-theme)
|
||||
- **Cursor**: [Vimix-Cursors](https://github.com/vinceliuice/Vimix-cursors)
|
||||
- **Font**: [JetBrainsMonoNerdFont](https://www.nerdfonts.com/font-downloads)
|
||||
- **Editor**: [VS Code](https://code.visualstudio.com/)
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
---
|
||||
|
||||
#### Here are three levels of what you need
|
||||
|
||||
1. Dependencies you need to have in order for the rice to work
|
||||
2. Important dependencies but can be replaced, the theme might behave weird without these or without proper reconfiguration!
|
||||
3. Nice to have and are the default. Can be easily changed without any worries!
|
||||
|
||||
<details>
|
||||
<summary><b>1. Dependencies</b></summary>
|
||||
|
||||
#### **AwesomeWM**
|
||||
|
||||
>**Arch**
|
||||
|
||||
```bash
|
||||
yay -S awesome-git
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt build-dep awesome
|
||||
git clone https://github.com/awesomeWM/awesome.git
|
||||
make package
|
||||
sudo dpkg -i awesome*.deb
|
||||
```
|
||||
|
||||
#### **Rofi**
|
||||
|
||||
>**Arch**
|
||||
|
||||
```bash
|
||||
yay -S rofi-git
|
||||
```
|
||||
|
||||
>**Ubuntu**
|
||||
|
||||
Check [HERE](https://github.com/davatorium/rofi/blob/next/INSTALL.md) for how to build from source. Note **DO NOT INSTAL ROFI FROM APT IT WONT WORK**
|
||||
|
||||
#### **Picom**
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
yay -S picom-jonaburg-git
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
git clone https://github.com/jonaburg/picom
|
||||
cd picom
|
||||
meson --buildtype=release . build
|
||||
sudo ninja -C build install
|
||||
```
|
||||
|
||||
</details>
|
||||
<details>
|
||||
|
||||
<br>
|
||||
|
||||
<summary><b>2. Important Dependencies</b></summary>
|
||||
|
||||
#### **Papirus** - Icon Theme
|
||||
|
||||
***Make sure the theme is located at `/usr/share/icons/`***
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S papirus-icon-theme
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install papirus-icon-theme
|
||||
```
|
||||
|
||||
#### **pactl - PulseAudio Controler**
|
||||
|
||||
***All audio scripts depends on this***
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S pulseaudio-alsa
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install pulseaudio-utils
|
||||
```
|
||||
|
||||
#### **upower - Battery Info**
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S upower
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install upower
|
||||
```
|
||||
|
||||
#### **bluez/bluetoothctl - Bluetooth**
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S bluez bluez-utils
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install bluez bluez-utils
|
||||
```
|
||||
|
||||
#### **setxkbmap - Change Keyboard Layout**
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S xorg-setxkbmap
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install xorg
|
||||
```
|
||||
|
||||
#### **xfce4-power-manager - Backlight**
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S xfce4-power-manager
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install xfce4-power-manager
|
||||
```
|
||||
|
||||
#### **playerctl - Media control**
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S playerctl
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install playerctl
|
||||
```
|
||||
|
||||
#### **LightDM - Login/Logout/ScreenLock**
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S lightdm light-locker
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install lightdm light-locker
|
||||
```
|
||||
</details>
|
||||
|
||||
<details>
|
||||
<summary><b>3. Optional Dependencies</b></summary>
|
||||
|
||||
#### **Alacritty** - Default terminal
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S alacritty
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install alacritty
|
||||
```
|
||||
|
||||
#### **Thunar** - Default file manager
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S thunar
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install thunar
|
||||
```
|
||||
|
||||
#### **Flameshot - Screenshots**
|
||||
|
||||
> **Arch**
|
||||
|
||||
```bash
|
||||
sudo pacman -S flameshot
|
||||
```
|
||||
|
||||
> **Ubuntu**
|
||||
|
||||
```bash
|
||||
sudo apt install flameshot
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
#### Setup
|
||||
|
||||
Make sure to backup any data before you copy my theme over!
|
||||
|
||||
```bash
|
||||
git clone https://github.com/Crylia/crylia-theme
|
||||
cd crylia-theme
|
||||
cp -r awesome ~/.config/.
|
||||
cp -r picom.conf ~/.config/.
|
||||
cp -r rofi ~/.config/.
|
||||
```
|
||||
|
||||
Optional
|
||||
|
||||
```bash
|
||||
cp -r alacritty ~/.config/.
|
||||
```
|
||||
|
||||
## [Documentation | Wiki | FAQ](https://github.com/Crylia/crylia-theme/wiki/Documentation)
|
||||
|
||||
## Features
|
||||
|
||||
---
|
||||
|
||||
Some would say there are more features than a WM needs, I say you can never have enough features (as long as they make some sense).
|
||||
#### Some notable features
|
||||
|
||||
- [x] Multi screen support
|
||||
- [x] Interactive taskbar (left, right click and hover over)
|
||||
- [x] Interactive task/taglist and dock (left, right click and hover over)
|
||||
- [x] Session option to reboot, shutdown etc
|
||||
- [x] Multi keyboard layout support + switch widget
|
||||
- [x] Calendar widget (not interactive)
|
||||
- [x] Rofi application launcher and window switcher
|
||||
- [x] Volume / Brightness switcher
|
||||
- [X] Dock
|
||||
- [x] Volume / Brightness control widget
|
||||
- [X] Configurable Dock
|
||||
- [x] Systray
|
||||
- [x] GPU/CPU/RAM Temperature, Usage and Clock widget
|
||||
- [x] Full audio device selector
|
||||
- [x] Easy to configure dots
|
||||
- [x] Interactive notifications
|
||||
|
||||
Some stuff planned for the future
|
||||
#### Some stuff planned for the future
|
||||
|
||||
- [ ] Calendar OSD
|
||||
- [ ] GPU/CPU/RAM etc Temparature and Usage widget
|
||||
- [ ] Extended volume and microphone control
|
||||
- [ ] More bugs
|
||||
- [ ] I3 like layout / manual tiling
|
||||
|
||||
I've added various widgets you can choose or remove how you like it.
|
||||
<br>
|
||||
|
||||
__Including__:<br>
|
||||
Battery, Network (Wifi, Ethernet), Bluetooth, Volume, Keyboardlayout, Date (with Calendar), Time, Session options, Taglist, Tasklist, Layoutswitcher.
|
||||
There are many widgets to choose from
|
||||
|
||||
**Widget List**:
|
||||
|
||||
- Battery
|
||||
- Network (Wifi, Ethernet)
|
||||
- Bluetooth
|
||||
- Volume
|
||||
- Keyboardlayout
|
||||
- Date
|
||||
- Time
|
||||
- Session options
|
||||
- Taglist
|
||||
- Tasklist
|
||||
- Layoutswitcher
|
||||
- GPU/CPU/RAM Temperature/Usage and Clock speed.
|
||||
|
||||
## Gallery
|
||||
|
||||
---
|
||||
>
|
||||
>
|
||||
>Entire Desktop with two terminal open
|
||||
|
||||
>
|
||||
>
|
||||
>Lockscreen
|
||||
|
||||
>
|
||||
>
|
||||
>Volume OSD (Backlight looks similar)
|
||||
|
||||
>
|
||||
>
|
||||
>Switch In/Output devices easily
|
||||
|
||||
>
|
||||
>
|
||||
>Spotify example notification with working media control
|
||||
|
||||
>
|
||||
>
|
||||
>Top Left bar closeup
|
||||
|
||||
>
|
||||
>
|
||||
>Top Center bar closeup
|
||||
|
||||
>
|
||||
>
|
||||
>Top Right bar closeup
|
||||
|
||||
>
|
||||
>
|
||||
>Dock closeup
|
||||
|
||||
## Known bugs
|
||||
|
||||
|
||||
BIN
assets/DeviceChooser.png
Normal file
|
After Width: | Height: | Size: 130 KiB |
BIN
assets/EntireScreen_VolumeOSD.png
Normal file
|
After Width: | Height: | Size: 3.6 MiB |
BIN
assets/Notification1.png
Normal file
|
After Width: | Height: | Size: 40 KiB |
BIN
assets/TopCenter.png
Normal file
|
After Width: | Height: | Size: 7.8 KiB |
BIN
assets/TopLeftBar.png
Normal file
|
After Width: | Height: | Size: 14 KiB |
BIN
assets/TopRight.png
Normal file
|
After Width: | Height: | Size: 17 KiB |
|
Before Width: | Height: | Size: 2.9 MiB After Width: | Height: | Size: 2.9 MiB |
BIN
assets/dock.png
Normal file
|
After Width: | Height: | Size: 61 KiB |
|
Before Width: | Height: | Size: 1.3 MiB After Width: | Height: | Size: 1.3 MiB |
BIN
assets/neofetch.png
Normal file
|
After Width: | Height: | Size: 241 KiB |
@@ -38,7 +38,7 @@ return function(s, widgets)
|
||||
{
|
||||
widget,
|
||||
left = dpi(6),
|
||||
right = dpi(3),
|
||||
right = dpi(6),
|
||||
top = dpi(6),
|
||||
bottom = dpi(6),
|
||||
widget = wibox.container.margin
|
||||
|
||||
@@ -10,12 +10,12 @@ local wibox = require("wibox")
|
||||
|
||||
return function(screen, programs)
|
||||
|
||||
local function create_dock_element(class, program, name, is_steam, size)
|
||||
local function create_dock_element(class, program, name, user_icon, is_steam, size)
|
||||
if program == nil or class == nil then
|
||||
return
|
||||
end
|
||||
is_steam = is_steam or false
|
||||
|
||||
user_icon = user_icon or nil
|
||||
local dock_element = wibox.widget {
|
||||
{
|
||||
{
|
||||
@@ -23,9 +23,9 @@ return function(screen, programs)
|
||||
resize = true,
|
||||
forced_width = size,
|
||||
forced_height = size,
|
||||
image = Get_icon(user_vars.icon_theme, nil, program, class, is_steam),
|
||||
image = user_icon or Get_icon(user_vars.icon_theme, nil, program, class, is_steam),
|
||||
widget = wibox.widget.imagebox,
|
||||
id = "icon"
|
||||
id = "icon",
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin,
|
||||
@@ -104,7 +104,7 @@ return function(screen, programs)
|
||||
local dock_elements = { layout = wibox.layout.fixed.horizontal }
|
||||
|
||||
for i, p in ipairs(pr) do
|
||||
dock_elements[i] = create_dock_element(p[1], p[2], p[3], p[4], user_vars.dock_icon_size)
|
||||
dock_elements[i] = create_dock_element(p[1], p[2], p[3], p[4], p[5], user_vars.dock_icon_size)
|
||||
end
|
||||
|
||||
return dock_elements
|
||||
@@ -181,22 +181,14 @@ return function(screen, programs)
|
||||
}
|
||||
|
||||
local function check_for_dock_hide(s)
|
||||
local naughty = require("naughty")
|
||||
if #s.selected_tag:clients() < 1 then
|
||||
dock.visible = true
|
||||
return
|
||||
end
|
||||
if s == mouse.screen then
|
||||
--[[ if mouse.current_widget then
|
||||
if tostring(mouse.current_widget):match("fake") then
|
||||
dock.visible = true
|
||||
return
|
||||
end
|
||||
end ]]
|
||||
local visible = false
|
||||
for j, c in ipairs(s.selected_tag:clients()) do
|
||||
|
||||
--naughty.notify({ title = tostring(c.class) })
|
||||
if c.maximized or c.fullscreen then
|
||||
dock.visible = false
|
||||
return
|
||||
@@ -209,10 +201,6 @@ return function(screen, programs)
|
||||
else
|
||||
dock.visible = true
|
||||
end
|
||||
--[[ if visible then
|
||||
dock.visible = visible
|
||||
return
|
||||
end ]]
|
||||
end
|
||||
else
|
||||
dock.visible = false
|
||||
|
||||
@@ -23,29 +23,30 @@ awful.screen.connect_for_each_screen(
|
||||
require("src.modules.volume_osd")(s)
|
||||
require("src.modules.brightness_osd")(s)
|
||||
require("src.modules.titlebar")
|
||||
require("src.modules.volume_controller")(s)
|
||||
|
||||
-- Widgets
|
||||
s.battery = require("src.widgets.battery")()
|
||||
s.network = require("src.widgets.network")()
|
||||
s.audio = require("src.widgets.audio")()
|
||||
--s.battery = require("src.widgets.battery")()
|
||||
s.audio = require("src.widgets.audio")(s)
|
||||
s.date = require("src.widgets.date")()
|
||||
s.clock = require("src.widgets.clock")()
|
||||
s.bluetooth = require("src.widgets.bluetooth")()
|
||||
--s.bluetooth = require("src.widgets.bluetooth")()
|
||||
s.layoutlist = require("src.widgets.layout_list")()
|
||||
s.powerbutton = require("src.widgets.power")()
|
||||
s.kblayout = require("src.widgets.kblayout")(s)
|
||||
s.taglist = require("src.widgets.taglist")(s)
|
||||
s.tasklist = require("src.widgets.tasklist")(s)
|
||||
s.systray = require("src.widgets.systray")(s)
|
||||
s.cpu_usage = require("src.widgets.cpu_info")("usage")
|
||||
s.cpu_temp = require("src.widgets.cpu_info")("temp")
|
||||
s.cpu_freq = require("src.widgets.cpu_info")("freq", "average")
|
||||
s.ram_info = require("src.widgets.ram_info")()
|
||||
s.gpu_usage = require("src.widgets.gpu_info")("usage")
|
||||
s.gpu_temp = require("src.widgets.gpu_info")("temp")
|
||||
--s.cpu_freq = require("src.widgets.cpu_info")("freq", "average")
|
||||
|
||||
-- Add more of these if statements if you want to change
|
||||
-- the modules/widgets per screen.
|
||||
if s.index == 1 then
|
||||
s.systray = require("src.widgets.systray")(s)
|
||||
s.cpu_usage = require("src.widgets.cpu_info")("usage")
|
||||
s.cpu_temp = require("src.widgets.cpu_info")("temp")
|
||||
s.gpu_usage = require("src.widgets.gpu_info")("usage")
|
||||
s.gpu_temp = require("src.widgets.gpu_info")("temp")
|
||||
|
||||
require("crylia_bar.left_bar")(s, { s.layoutlist, s.systray, s.taglist })
|
||||
require("crylia_bar.center_bar")(s, { s.tasklist })
|
||||
require("crylia_bar.right_bar")(s, { s.gpu_usage, s.gpu_temp, s.cpu_usage, s.cpu_temp, s.audio, s.kblayout, s.date, s.clock, s.powerbutton })
|
||||
@@ -53,6 +54,9 @@ awful.screen.connect_for_each_screen(
|
||||
end
|
||||
|
||||
if s.index == 2 then
|
||||
s.network = require("src.widgets.network")()
|
||||
s.ram_info = require("src.widgets.ram_info")()
|
||||
|
||||
require("crylia_bar.left_bar")(s, { s.layoutlist, s.taglist })
|
||||
require("crylia_bar.center_bar")(s, { s.tasklist })
|
||||
require("crylia_bar.right_bar")(s, { s.ram_info, s.audio, s.kblayout, s.network, s.date, s.clock, s.powerbutton })
|
||||
|
||||
@@ -5,63 +5,63 @@ local globalkeys = require("../mappings/global_keys")
|
||||
local modkey = user_vars.modkey
|
||||
|
||||
for i = 1, 9 do
|
||||
globalkeys = gears.table.join(globalkeys,
|
||||
globalkeys = gears.table.join(globalkeys,
|
||||
|
||||
-- View tag only
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
tag:view_only()
|
||||
end
|
||||
client.emit_signal("tag::switched")
|
||||
end,
|
||||
{ description = "View Tag " .. i, group = "Tag" }
|
||||
),
|
||||
-- Brings the window over without chaning the tag, reverts automatically on tag change
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
end,
|
||||
{ description = "Toggle Tag " .. i, group = "Tag" }
|
||||
),
|
||||
-- Brings the window over without chaning the tag, reverts automatically on tag change
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
if client.focus then
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
client.focus:move_to_tag(tag)
|
||||
end
|
||||
end
|
||||
end,
|
||||
{ description = "Move focused client on tag " .. i, group = "Tag" }
|
||||
),
|
||||
-- Brings the window over without chaning the tag, reverts automatically on tag change
|
||||
awful.key(
|
||||
{ modkey, "Control", "Shift" },
|
||||
"#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
end,
|
||||
{ description = "Move focused client on tag " .. i, group = "Tag" }
|
||||
)
|
||||
-- View tag only
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
tag:view_only()
|
||||
end
|
||||
client.emit_signal("tag::switched")
|
||||
end,
|
||||
{ description = "View Tag " .. i, group = "Tag" }
|
||||
),
|
||||
-- Brings the window over without chaning the tag, reverts automatically on tag change
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
end,
|
||||
{ description = "Toggle Tag " .. i, group = "Tag" }
|
||||
),
|
||||
-- Brings the window over without chaning the tag, reverts automatically on tag change
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
if client.focus then
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
client.focus:move_to_tag(tag)
|
||||
end
|
||||
end
|
||||
end,
|
||||
{ description = "Move focused client on tag " .. i, group = "Tag" }
|
||||
),
|
||||
-- Brings the window over without chaning the tag, reverts automatically on tag change
|
||||
awful.key(
|
||||
{ modkey, "Control", "Shift" },
|
||||
"#" .. i + 9,
|
||||
function()
|
||||
local screen = awful.screen.focused()
|
||||
local tag = screen.tags[i]
|
||||
if tag then
|
||||
awful.tag.viewtoggle(tag)
|
||||
end
|
||||
end,
|
||||
{ description = "Move focused client on tag " .. i, group = "Tag" }
|
||||
)
|
||||
)
|
||||
end
|
||||
root.keys(globalkeys)
|
||||
|
||||
@@ -5,15 +5,15 @@ local gears = require("gears")
|
||||
local modkey = user_vars.modkey
|
||||
|
||||
return gears.table.join(
|
||||
awful.button({}, 1, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
end),
|
||||
awful.button({ modkey }, 1, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
awful.mouse.client.move(c)
|
||||
end),
|
||||
awful.button({ modkey }, 3, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
awful.mouse.client.resize(c)
|
||||
end)
|
||||
awful.button({}, 1, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
end),
|
||||
awful.button({ modkey }, 1, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
awful.mouse.client.move(c)
|
||||
end),
|
||||
awful.button({ modkey }, 3, function(c)
|
||||
c:emit_signal("request::activate", "mouse_click", { raise = true })
|
||||
awful.mouse.client.resize(c)
|
||||
end)
|
||||
)
|
||||
|
||||
@@ -5,53 +5,53 @@ local gears = require("gears")
|
||||
local modkey = user_vars.modkey
|
||||
|
||||
return gears.table.join(
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#41",
|
||||
function(c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
c:raise()
|
||||
end,
|
||||
{ description = "Toggle fullscreen", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#24",
|
||||
function(c)
|
||||
c:kill()
|
||||
end,
|
||||
{ description = "Close focused client", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#42",
|
||||
awful.client.floating.toggle,
|
||||
{ description = "Toggle floating window", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#58",
|
||||
function(c)
|
||||
c.maximized = not c.maximized
|
||||
c:raise()
|
||||
end,
|
||||
{ description = "(un)maximize", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#57",
|
||||
function(c)
|
||||
if c == client.focus then
|
||||
c.minimized = true
|
||||
else
|
||||
c.minimized = false
|
||||
if not c:isvisible() and c.first_tag then
|
||||
c.first_tag:view_only()
|
||||
end
|
||||
c:emit_signal('request::activate')
|
||||
c:raise()
|
||||
end
|
||||
end,
|
||||
{ description = "(un)hide", group = "Client" }
|
||||
)
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#41",
|
||||
function(c)
|
||||
c.fullscreen = not c.fullscreen
|
||||
c:raise()
|
||||
end,
|
||||
{ description = "Toggle fullscreen", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#24",
|
||||
function(c)
|
||||
c:kill()
|
||||
end,
|
||||
{ description = "Close focused client", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#42",
|
||||
awful.client.floating.toggle,
|
||||
{ description = "Toggle floating window", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#58",
|
||||
function(c)
|
||||
c.maximized = not c.maximized
|
||||
c:raise()
|
||||
end,
|
||||
{ description = "(un)maximize", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#57",
|
||||
function(c)
|
||||
if c == client.focus then
|
||||
c.minimized = true
|
||||
else
|
||||
c.minimized = false
|
||||
if not c:isvisible() and c.first_tag then
|
||||
c.first_tag:view_only()
|
||||
end
|
||||
c:emit_signal('request::activate')
|
||||
c:raise()
|
||||
end
|
||||
end,
|
||||
{ description = "(un)hide", group = "Client" }
|
||||
)
|
||||
)
|
||||
|
||||
@@ -3,6 +3,6 @@ local gears = require("gears")
|
||||
local awful = require("awful")
|
||||
|
||||
root.buttons = gears.table.join(
|
||||
awful.button({}, 4, awful.tag.viewnext),
|
||||
awful.button({}, 5, awful.tag.viewprev)
|
||||
awful.button({}, 4, awful.tag.viewnext),
|
||||
awful.button({}, 5, awful.tag.viewprev)
|
||||
)
|
||||
|
||||
@@ -7,378 +7,375 @@ local ruled = require("ruled")
|
||||
local modkey = user_vars.modkey
|
||||
|
||||
return gears.table.join(
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#39",
|
||||
hotkeys_popup.show_help,
|
||||
{ description = "Cheat sheet", group = "Awesome" }
|
||||
),
|
||||
-- Tag browsing
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#113",
|
||||
awful.tag.viewprev,
|
||||
{ description = "View previous tag", group = "Tag" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#114",
|
||||
awful.tag.viewnext,
|
||||
{ description = "View next tag", group = "Tag" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#66",
|
||||
awful.tag.history.restore,
|
||||
{ description = "Go back to last tag", group = "Tag" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#44",
|
||||
function()
|
||||
awful.client.focus.byidx(1)
|
||||
end,
|
||||
{ description = "Focus next client by index", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#45",
|
||||
function()
|
||||
awful.client.focus.byidx(-1)
|
||||
end,
|
||||
{ description = "Focus previous client by index", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#25",
|
||||
function()
|
||||
user_vars.main_menu:show()
|
||||
end,
|
||||
{ description = "Show context menu", group = "Awesome" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#44",
|
||||
function()
|
||||
awful.client.swap.byidx(1)
|
||||
end,
|
||||
{ description = "Swap with next client by index", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#45",
|
||||
function()
|
||||
awful.client.swap.byidx(-1)
|
||||
end,
|
||||
{ description = "Swap with previous client by index", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#44",
|
||||
function()
|
||||
awful.screen.focus_relative(1)
|
||||
end,
|
||||
{ description = "Focus the next screen", group = "Screen" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#45",
|
||||
function()
|
||||
awful.screen.focus_relative(-1)
|
||||
end,
|
||||
{ description = "Focus the previous screen", group = "Screen" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#30",
|
||||
awful.client.urgent.jumpto,
|
||||
{ description = "Jump to urgent client", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#36",
|
||||
function()
|
||||
awful.spawn(user_vars.terminal)
|
||||
end,
|
||||
{ description = "Open terminal", group = "Applications" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#27",
|
||||
awesome.restart,
|
||||
{ description = "Reload awesome", group = "Awesome" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#46",
|
||||
function()
|
||||
awful.tag.incmwfact(0.05)
|
||||
end,
|
||||
{ description = "Increase client width", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#43",
|
||||
function()
|
||||
awful.tag.incmwfact(-0.05)
|
||||
end,
|
||||
{ description = "Decrease client width", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#43",
|
||||
function()
|
||||
awful.tag.incncol(1, nil, true)
|
||||
end,
|
||||
{ description = "Increase the number of columns", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#46",
|
||||
function()
|
||||
awful.tag.incncol(-1, nil, true)
|
||||
end,
|
||||
{ description = "Decrease the number of columns", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#65",
|
||||
function()
|
||||
awful.layout.inc(-1)
|
||||
end,
|
||||
{ description = "Select previous layout", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#36",
|
||||
function()
|
||||
awful.layout.inc(1)
|
||||
end,
|
||||
{ description = "Select next layout", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#40",
|
||||
function()
|
||||
awful.spawn("rofi -show drun -theme ~/.config/rofi/rofi.rasi")
|
||||
end,
|
||||
{ descripton = "Application launcher", group = "Application" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#23",
|
||||
function()
|
||||
awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
|
||||
end,
|
||||
{ descripton = "Client switcher (alt+tab)", group = "Application" }
|
||||
),
|
||||
awful.key(
|
||||
{ "Mod1" },
|
||||
"#23",
|
||||
function()
|
||||
awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
|
||||
end,
|
||||
{ descripton = "Client switcher (alt+tab)", group = "Application" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#26",
|
||||
function()
|
||||
awful.spawn(user_vars.file_manager)
|
||||
end,
|
||||
{ descripton = "Open file manager", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#26",
|
||||
function()
|
||||
awesome.emit_signal("module::powermenu:show")
|
||||
end,
|
||||
{ descripton = "Session options", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"#107",
|
||||
function()
|
||||
awful.spawn(user_vars.screenshot_program)
|
||||
end,
|
||||
{ description = "Screenshot", group = "Applications" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioLowerVolume",
|
||||
function(c)
|
||||
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ -2%", function()
|
||||
awesome.emit_signal("widget::volume")
|
||||
awesome.emit_signal("module::volume_osd:show", true)
|
||||
awesome.emit_signal("module::slider:update")
|
||||
awesome.emit_signal("widget::volume_osd:rerun")
|
||||
end)
|
||||
end,
|
||||
{ description = "Lower volume", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioRaiseVolume",
|
||||
function(c)
|
||||
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ +2%", function()
|
||||
awesome.emit_signal("widget::volume")
|
||||
awesome.emit_signal("module::volume_osd:show", true)
|
||||
awesome.emit_signal("module::slider:update")
|
||||
awesome.emit_signal("widget::volume_osd:rerun")
|
||||
end)
|
||||
end,
|
||||
{ description = "Increase volume", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioMute",
|
||||
function(c)
|
||||
awful.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")
|
||||
awesome.emit_signal("widget::volume")
|
||||
awesome.emit_signal("module::volume_osd:show", true)
|
||||
awesome.emit_signal("module::slider:update")
|
||||
awesome.emit_signal("widget::volume_osd:rerun")
|
||||
end,
|
||||
{ description = "Mute volume", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86MonBrightnessUp",
|
||||
function(c)
|
||||
--awful.spawn("xbacklight -time 100 -inc 10%+")
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||
function(stdout)
|
||||
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " .. tostring(tonumber(stdout) + BACKLIGHT_SEPS), function(stdou2)
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#39",
|
||||
hotkeys_popup.show_help,
|
||||
{ description = "Cheat sheet", group = "Awesome" }
|
||||
),
|
||||
-- Tag browsing
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#113",
|
||||
awful.tag.viewprev,
|
||||
{ description = "View previous tag", group = "Tag" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#114",
|
||||
awful.tag.viewnext,
|
||||
{ description = "View next tag", group = "Tag" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#66",
|
||||
awful.tag.history.restore,
|
||||
{ description = "Go back to last tag", group = "Tag" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#44",
|
||||
function()
|
||||
awful.client.focus.byidx(1)
|
||||
end,
|
||||
{ description = "Focus next client by index", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#45",
|
||||
function()
|
||||
awful.client.focus.byidx(-1)
|
||||
end,
|
||||
{ description = "Focus previous client by index", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#25",
|
||||
function()
|
||||
user_vars.main_menu:show()
|
||||
end,
|
||||
{ description = "Show context menu", group = "Awesome" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#44",
|
||||
function()
|
||||
awful.client.swap.byidx(1)
|
||||
end,
|
||||
{ description = "Swap with next client by index", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#45",
|
||||
function()
|
||||
awful.client.swap.byidx(-1)
|
||||
end,
|
||||
{ description = "Swap with previous client by index", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#44",
|
||||
function()
|
||||
awful.screen.focus_relative(1)
|
||||
end,
|
||||
{ description = "Focus the next screen", group = "Screen" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#45",
|
||||
function()
|
||||
awful.screen.focus_relative(-1)
|
||||
end,
|
||||
{ description = "Focus the previous screen", group = "Screen" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#30",
|
||||
awful.client.urgent.jumpto,
|
||||
{ description = "Jump to urgent client", group = "Client" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#36",
|
||||
function()
|
||||
awful.spawn(user_vars.terminal)
|
||||
end,
|
||||
{ description = "Open terminal", group = "Applications" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#27",
|
||||
awesome.restart,
|
||||
{ description = "Reload awesome", group = "Awesome" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#46",
|
||||
function()
|
||||
awful.tag.incmwfact(0.05)
|
||||
end,
|
||||
{ description = "Increase client width", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#43",
|
||||
function()
|
||||
awful.tag.incmwfact(-0.05)
|
||||
end,
|
||||
{ description = "Decrease client width", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#43",
|
||||
function()
|
||||
awful.tag.incncol(1, nil, true)
|
||||
end,
|
||||
{ description = "Increase the number of columns", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Control" },
|
||||
"#46",
|
||||
function()
|
||||
awful.tag.incncol(-1, nil, true)
|
||||
end,
|
||||
{ description = "Decrease the number of columns", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#65",
|
||||
function()
|
||||
awful.layout.inc(-1)
|
||||
end,
|
||||
{ description = "Select previous layout", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#36",
|
||||
function()
|
||||
awful.layout.inc(1)
|
||||
end,
|
||||
{ description = "Select next layout", group = "Layout" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#40",
|
||||
function()
|
||||
awful.spawn("rofi -show drun -theme ~/.config/rofi/rofi.rasi")
|
||||
end,
|
||||
{ descripton = "Application launcher", group = "Application" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#23",
|
||||
function()
|
||||
awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
|
||||
end,
|
||||
{ descripton = "Client switcher (alt+tab)", group = "Application" }
|
||||
),
|
||||
awful.key(
|
||||
{ "Mod1" },
|
||||
"#23",
|
||||
function()
|
||||
awful.spawn("rofi -show window -theme ~/.config/rofi/window.rasi")
|
||||
end,
|
||||
{ descripton = "Client switcher (alt+tab)", group = "Application" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#26",
|
||||
function()
|
||||
awful.spawn(user_vars.file_manager)
|
||||
end,
|
||||
{ descripton = "Open file manager", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#26",
|
||||
function()
|
||||
awesome.emit_signal("module::powermenu:show")
|
||||
end,
|
||||
{ descripton = "Session options", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"#107",
|
||||
function()
|
||||
awful.spawn(user_vars.screenshot_program)
|
||||
end,
|
||||
{ description = "Screenshot", group = "Applications" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioLowerVolume",
|
||||
function(c)
|
||||
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ -2%", function()
|
||||
awesome.emit_signal("module::volume_osd:show", true)
|
||||
awesome.emit_signal("module::slider:update")
|
||||
awesome.emit_signal("widget::volume_osd:rerun")
|
||||
end)
|
||||
end,
|
||||
{ description = "Lower volume", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioRaiseVolume",
|
||||
function(c)
|
||||
awful.spawn.easy_async_with_shell("pactl set-sink-volume @DEFAULT_SINK@ +2%", function()
|
||||
awesome.emit_signal("module::volume_osd:show", true)
|
||||
awesome.emit_signal("module::slider:update")
|
||||
awesome.emit_signal("widget::volume_osd:rerun")
|
||||
end)
|
||||
end,
|
||||
{ description = "Increase volume", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioMute",
|
||||
function(c)
|
||||
awful.spawn("pactl set-sink-mute @DEFAULT_SINK@ toggle")
|
||||
awesome.emit_signal("module::volume_osd:show", true)
|
||||
awesome.emit_signal("module::slider:update")
|
||||
awesome.emit_signal("widget::volume_osd:rerun")
|
||||
end,
|
||||
{ description = "Mute volume", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86MonBrightnessUp",
|
||||
function(c)
|
||||
--awful.spawn("xbacklight -time 100 -inc 10%+")
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||
function(stdout)
|
||||
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " .. tostring(tonumber(stdout) + BACKLIGHT_SEPS), function(stdou2)
|
||||
|
||||
end)
|
||||
awesome.emit_signal("module::brightness_osd:show", true)
|
||||
awesome.emit_signal("module::brightness_slider:update")
|
||||
awesome.emit_signal("widget::brightness_osd:rerun")
|
||||
end
|
||||
)
|
||||
end,
|
||||
{ description = "Raise backlight brightness", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86MonBrightnessDown",
|
||||
function(c)
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||
function(stdout)
|
||||
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " .. tostring(tonumber(stdout) - BACKLIGHT_SEPS), function(stdout2)
|
||||
end)
|
||||
awesome.emit_signal("module::brightness_osd:show", true)
|
||||
awesome.emit_signal("module::brightness_slider:update")
|
||||
awesome.emit_signal("widget::brightness_osd:rerun")
|
||||
end
|
||||
)
|
||||
end,
|
||||
{ description = "Raise backlight brightness", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86MonBrightnessDown",
|
||||
function(c)
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||
function(stdout)
|
||||
awful.spawn.easy_async_with_shell("pkexec xfpm-power-backlight-helper --set-brightness " .. tostring(tonumber(stdout) - BACKLIGHT_SEPS), function(stdout2)
|
||||
|
||||
end)
|
||||
awesome.emit_signal("module::brightness_osd:show", true)
|
||||
awesome.emit_signal("module::brightness_slider:update")
|
||||
awesome.emit_signal("widget::brightness_osd:rerun")
|
||||
end
|
||||
)
|
||||
end,
|
||||
{ description = "Lower backlight brightness", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioPlay",
|
||||
function(c)
|
||||
awful.spawn("playerctl play-pause")
|
||||
end,
|
||||
{ description = "Play / Pause audio", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioNext",
|
||||
function(c)
|
||||
awful.spawn("playerctl next")
|
||||
end,
|
||||
{ description = "Play / Pause audio", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioPrev",
|
||||
function(c)
|
||||
awful.spawn("playerctl previous")
|
||||
end,
|
||||
{ description = "Play / Pause audio", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#65",
|
||||
function()
|
||||
awesome.emit_signal("kblayout::toggle")
|
||||
end,
|
||||
{ description = "Toggle keyboard layout", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#22",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[xprop | grep WM_CLASS | awk '{gsub(/"/, "", $4); print $4}']],
|
||||
function(stdout)
|
||||
if stdout then
|
||||
ruled.client.append_rule {
|
||||
rule = { class = stdout:gsub("\n", "") },
|
||||
properties = {
|
||||
floating = true
|
||||
},
|
||||
}
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"cat ~/.config/awesome/src/assets/rules.txt",
|
||||
function(stdout2)
|
||||
for class in stdout2:gmatch("%a+") do
|
||||
if class:match(stdout:gsub("\n", "")) then
|
||||
return
|
||||
end
|
||||
end
|
||||
awful.spawn.with_shell("echo -n '" .. stdout:gsub("\n", "") .. ";' >> ~/.config/awesome/src/assets/rules.txt")
|
||||
local c = mouse.screen.selected_tag:clients()
|
||||
for j, client in ipairs(c) do
|
||||
if client.class:match(stdout:gsub("\n", "")) then
|
||||
client.floating = true
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
)
|
||||
end)
|
||||
awesome.emit_signal("module::brightness_osd:show", true)
|
||||
awesome.emit_signal("module::brightness_slider:update")
|
||||
awesome.emit_signal("widget::brightness_osd:rerun")
|
||||
end
|
||||
)
|
||||
end,
|
||||
{ description = "Lower backlight brightness", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioPlay",
|
||||
function(c)
|
||||
awful.spawn("playerctl play-pause")
|
||||
end,
|
||||
{ description = "Play / Pause audio", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioNext",
|
||||
function(c)
|
||||
awful.spawn("playerctl next")
|
||||
end,
|
||||
{ description = "Play / Pause audio", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{},
|
||||
"XF86AudioPrev",
|
||||
function(c)
|
||||
awful.spawn("playerctl previous")
|
||||
end,
|
||||
{ description = "Play / Pause audio", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#65",
|
||||
function()
|
||||
awesome.emit_signal("kblayout::toggle")
|
||||
end,
|
||||
{ description = "Toggle keyboard layout", group = "System" }
|
||||
),
|
||||
awful.key(
|
||||
{ modkey },
|
||||
"#22",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[xprop | grep WM_CLASS | awk '{gsub(/"/, "", $4); print $4}']],
|
||||
function(stdout)
|
||||
if stdout then
|
||||
ruled.client.append_rule {
|
||||
rule = { class = stdout:gsub("\n", "") },
|
||||
properties = {
|
||||
floating = true
|
||||
},
|
||||
}
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"cat ~/.config/awesome/src/assets/rules.txt",
|
||||
function(stdout2)
|
||||
for class in stdout2:gmatch("%a+") do
|
||||
if class:match(stdout:gsub("\n", "")) then
|
||||
return
|
||||
end
|
||||
end
|
||||
awful.spawn.with_shell("echo -n '" .. stdout:gsub("\n", "") .. ";' >> ~/.config/awesome/src/assets/rules.txt")
|
||||
local c = mouse.screen.selected_tag:clients()
|
||||
for j, client in ipairs(c) do
|
||||
if client.class:match(stdout:gsub("\n", "")) then
|
||||
client.floating = true
|
||||
end
|
||||
end
|
||||
end
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#22",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[xprop | grep WM_CLASS | awk '{gsub(/"/, "", $4); print $4}']],
|
||||
function(stdout)
|
||||
if stdout then
|
||||
ruled.client.append_rule {
|
||||
rule = { class = stdout:gsub("\n", "") },
|
||||
properties = {
|
||||
floating = false
|
||||
},
|
||||
}
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[
|
||||
)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
),
|
||||
awful.key(
|
||||
{ modkey, "Shift" },
|
||||
"#22",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[xprop | grep WM_CLASS | awk '{gsub(/"/, "", $4); print $4}']],
|
||||
function(stdout)
|
||||
if stdout then
|
||||
ruled.client.append_rule {
|
||||
rule = { class = stdout:gsub("\n", "") },
|
||||
properties = {
|
||||
floating = false
|
||||
},
|
||||
}
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[
|
||||
REMOVE="]] .. stdout:gsub("\n", "") .. [[;"
|
||||
STR=$(cat ~/.config/awesome/src/assets/rules.txt)
|
||||
echo -n ${STR//$REMOVE/} > ~/.config/awesome/src/assets/rules.txt
|
||||
]],
|
||||
function(stdout2)
|
||||
local c = mouse.screen.selected_tag:clients()
|
||||
for j, client in ipairs(c) do
|
||||
if client.class:match(stdout:gsub("\n", "")) then
|
||||
client.floating = false
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
)
|
||||
function(stdout2)
|
||||
local c = mouse.screen.selected_tag:clients()
|
||||
for j, client in ipairs(c) do
|
||||
if client.class:match(stdout:gsub("\n", "")) then
|
||||
client.floating = false
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
)
|
||||
|
||||
@@ -10,9 +10,10 @@
|
||||
require("src.theme.user_variables")
|
||||
require("src.theme.init")
|
||||
require("src.core.error_handling")
|
||||
require("src.core.rules")
|
||||
require("src.core.signals")
|
||||
require("src.core.notifications")
|
||||
require("src.core.rules")
|
||||
require("mappings.global_buttons")
|
||||
require("mappings.bind_to_tags")
|
||||
require("crylia_bar.init")
|
||||
--require("src.tools.auto_starter")(user_vars.autostart)
|
||||
require("src.tools.auto_starter")(user_vars.autostart)
|
||||
|
||||
1
awesome/src/assets/icons/notifications/play-pause.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M3,5V19L11,12M13,19H16V5H13M18,5V19H21V5" /></svg>
|
||||
|
After Width: | Height: | Size: 335 B |
1
awesome/src/assets/icons/notifications/skip-next.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M16,18H18V6H16M6,18L14.5,12L6,6V18Z" /></svg>
|
||||
|
After Width: | Height: | Size: 330 B |
1
awesome/src/assets/icons/notifications/skip-prev.svg
Normal file
@@ -0,0 +1 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="24" height="24" viewBox="0 0 24 24"><path d="M6,18V6H8V18H6M9.5,12L18,6V18L9.5,12Z" /></svg>
|
||||
|
After Width: | Height: | Size: 332 B |
14
awesome/src/assets/layout/cornerne.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<svg width="260" height="260" xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<g transform="rotate(90, 130, 130)" id="svg_11">
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="20" width="60" height="60" id="svg_2" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="100" width="60" height="60" id="svg_3" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="180" width="60" height="60" id="svg_4" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="20" width="140" height="140" id="svg_5" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="180" width="60" height="60" id="svg_9" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="100" y="180" width="60" height="60" id="svg_10" rx="12" stroke-width="0"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 874 B |
12
awesome/src/assets/layout/cornernw.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<svg width="260" height="260" xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="20" width="60" height="60" id="svg_2" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="100" width="60" height="60" id="svg_3" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="180" width="60" height="60" id="svg_4" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="20" width="140" height="140" id="svg_5" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="180" width="60" height="60" id="svg_9" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="100" y="180" width="60" height="60" id="svg_10" rx="12" stroke-width="0"/>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 810 B |
14
awesome/src/assets/layout/cornerse.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<svg width="260" height="260" xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<g transform="rotate(180, 130, 130)" id="svg_11">
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="20" width="60" height="60" id="svg_2" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="100" width="60" height="60" id="svg_3" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="180" width="60" height="60" id="svg_4" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="20" width="140" height="140" id="svg_5" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="180" width="60" height="60" id="svg_9" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="100" y="180" width="60" height="60" id="svg_10" rx="12" stroke-width="0"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 875 B |
14
awesome/src/assets/layout/cornersw.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<svg width="260" height="260" xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<g transform="rotate(-90, 130, 130)" id="svg_11">
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="20" width="60" height="60" id="svg_2" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="100" width="60" height="60" id="svg_3" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="180" y="180" width="60" height="60" id="svg_4" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="20" width="140" height="140" id="svg_5" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="180" width="60" height="60" id="svg_9" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="100" y="180" width="60" height="60" id="svg_10" rx="12" stroke-width="0"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 875 B |
14
awesome/src/assets/layout/fairh.svg
Normal file
@@ -0,0 +1,14 @@
|
||||
<svg width="260" height="260" xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<g transform="rotate(90, 130, 130)" id="svg_8">
|
||||
<rect fill="#212121" stroke="#424242" x="140" y="20" width="100" height="60" id="svg_2" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="140" y="100" width="100" height="60" id="svg_3" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="140" y="180" width="100" height="60" id="svg_4" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="20" width="100" height="60" id="svg_5" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="100" width="100" height="60" id="svg_6" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="180" width="100" height="60" id="svg_7" rx="12" stroke-width="0"/>
|
||||
</g>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 875 B |
12
awesome/src/assets/layout/fairv.svg
Normal file
@@ -0,0 +1,12 @@
|
||||
<svg width="260" height="260" xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<rect fill="#212121" stroke="#424242" x="140" y="20" width="100" height="60" id="svg_2" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="140" y="100" width="100" height="60" id="svg_3" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="139.67742" y="180" width="100" height="60" id="svg_4" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="20" width="100" height="60" id="svg_5" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="100" width="100" height="60" id="svg_6" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="180" width="100" height="60" id="svg_7" rx="12" stroke-width="0"/>
|
||||
</g>
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 818 B |
@@ -1,64 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg width="260" height="260" xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<rect stroke-opacity="0" fill="#212121" stroke="#ffffff" x="60" y="200" width="180" height="40" id="svg_4" rx="12" stroke-width="0"/>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="20" width="160" height="160" id="svg_5" rx="12" stroke-width="0"/>
|
||||
<rect stroke-opacity="0" fill="#212121" stroke="#ffffff" x="200" y="60" width="40" height="180" id="svg_15" rx="12" stroke-width="0"/>
|
||||
<rect stroke-opacity="0" fill="#212121" stroke="#ffffff" x="200" y="60" width="20" height="160" id="svg_16" stroke-width="0"/>
|
||||
<rect stroke-opacity="0" fill="#212121" stroke="#ffffff" x="60" y="200" width="160" height="20" id="svg_17" stroke-width="0"/>
|
||||
<rect stroke-opacity="0" fill="#212121" stroke="#ffffff" x="160" y="160" width="20" height="20" id="svg_20" stroke-width="0"/>
|
||||
</g>
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
width="240"
|
||||
height="240"
|
||||
viewBox="0 0 240 240"
|
||||
sodipodi:docname="floating.svg"
|
||||
inkscape:version="0.92.4 5da689c313, 2019-01-14">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs6" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1321"
|
||||
inkscape:window-height="740"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
inkscape:pagecheckerboard="true"
|
||||
inkscape:zoom="3.4570311"
|
||||
inkscape:cx="-20.682487"
|
||||
inkscape:cy="34.133335"
|
||||
inkscape:window-x="45"
|
||||
inkscape:window-y="28"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg2" />
|
||||
<image
|
||||
width="200"
|
||||
height="200"
|
||||
preserveAspectRatio="none"
|
||||
style="image-rendering:optimizeQuality"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAC63pUWHRSYXcgcHJvZmlsZSB0eXBl IGV4aWYAAHja7ZdtktwoDIb/c4ocAUkIieNgPqpygz1+XrDd0z2Z3SS1+2er2pQBC1nI7wP0TBh/ fZ/hGy4qmUNS81xyjrhSSYUrOh7Pq+yaYtr1vtI1hOcXe3gMMEyCVs5Hq5d/hV0/XrjnoOPVHvwa Yb8CXQN3QFkzMzr9OUnY+bTTlUko4+zk4vac6sFn2+6U/eOed1p2Nus5PBuSQaWumEiYh5DEXfuZ gZx3xS27ZvhFMfSTWEBDcn8SBHn5vLuN8VmgF5HvXvis/qP3SXyul10+aZkvjdD5coD0a/G3xE8T yyMjfh0wuUN9IfLsPuc4v66mDEXztaK22HSHgeMByWW/llEMt6JvuxQUjzU2IO+xxQOlUSEGlRko UadKk8ZuGzWkmHiwoWVuLNvmYly4gRKBEQpNNinSxcGy8QhAmYQfudCet+z5Gjlm7gRXJgQjvPK3 JfzT4J+UMGdbElH0h1bIi9e6RhqL3KrhBSA0L266Bb7LhT8+rZ+1VBPclsyOD6zxOEMcSh9rSzZn gZ+iPbcQBetXAEiEuRXJkIBAzCRKmaIxGxF0dACqyJwl8QECpModSXISwXlk7LzmxjtG25eVMy8z ziaAUMnYTw5CFbBSUqwfS441VFU0qWpWUw9atGbJKWvO2fI65KqJJVPLZuZWrLp4cvXs5u7Fa+Ei OAO15GLFSym1cqiYqCJWhX+F5eBDjnTokQ87/ChHbVg+LTVtuVnzVlrt3KXjmOi5W/deeh0UBk6K kYaOPGz4KKNOrLUpM02dedr0WWZ9ULuo/lT+gBpd1HiTWn72oAZrMLtD0DpOdDEDMU4E4rYIYEHz YhadUuJFbjGLhbEplJGkLjah0yIGhGkQ66QHuw9yv8UtqP8WN/4VubDQ/RfkAtD9zO0Lan39zrVN 7NyFS9Mo2H3wqewBd4yo/m37DvQO9A70DvQO9A70DvT/DyQTfzzgn9jwA1+gnbQtmhjxAAABhWlD Q1BJQ0MgcHJvZmlsZQAAeJx9kT1Iw1AUhU9TRZGKgwVFHDJUJyuioo5ahSJUCLVCqw4mL/2DJg1J iouj4Fpw8Gex6uDirKuDqyAI/oA4OTopukiJ9yWFFjFeeLyP8+45vHcfINRKTLPaxgBNt81kPCam M6tixyuCCKAPo5iWmWXMSVICvvV1T71Ud1Ge5d/3Z3WrWYsBAZF4lhmmTbxBPLVpG5z3icOsIKvE 58QjJl2Q+JHrisdvnPMuCzwzbKaS88RhYjHfwkoLs4KpEU8SR1RNp3wh7bHKeYuzVqqwxj35C0NZ fWWZ67QGEcciliBBhIIKiijBRpR2nRQLSTqP+fgHXL9ELoVcRTByLKAMDbLrB/+D37O1chPjXlIo BrS/OM7HENCxC9SrjvN97Dj1EyD4DFzpTX+5Bsx8kl5tapEjoGcbuLhuasoecLkD9D8Zsim7UpCW kMsB72f0TRmg9xboWvPm1jjH6QOQolklboCDQ2A4T9nrPu/ubJ3bvz2N+f0AqXVyvRuPd5MAAAAG YktHRAAAAAAAAPlDu38AAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfkAwEXLw3L2R+kAAAA 1UlEQVR42u3bWwqDMBBG4ZPSZdQuqF1I19T1jftIX3yLFMReEucM+KYwfJI/MNFSayVznUheAgjQ 1h2Ygdr5FcBtL0BZCcEALoO8wACunwYYbVsoZoAAAggggAACCCCAAAIIIIAAAggggAACCCCAAAII IEBSgE1niUc8GnvXf3OWmA2gud8MEECApuaB+o9vADwGQYil130JesDvBN0FMofglBlgAp5bHzr/ YQ26BAQQQAABBBBAAAEEEEAAAY4I0PM4LX4B0OtMcXWGWPx32AwQIHW9ADONWkwCJwxXAAAAAElF TkSuQmCC "
|
||||
id="image10"
|
||||
x="20"
|
||||
y="20" />
|
||||
</svg>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 886 B |
@@ -1,64 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
<svg width="260" height="260" xmlns="http://www.w3.org/2000/svg">
|
||||
<g>
|
||||
<title>Layer 1</title>
|
||||
<rect fill="#212121" stroke="#424242" x="20" y="20" width="100" height="220" id="svg_1" rx="12" stroke-width="0" />
|
||||
<rect fill="#212121" stroke="#424242" x="140" y="20" width="100" height="100" id="svg_2" rx="12" stroke-width="0" />
|
||||
<rect fill="#212121" stroke="#424242" x="140" y="140" width="100" height="100" id="svg_3" rx="12" stroke-width="0" />
|
||||
</g>
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
version="1.1"
|
||||
id="svg2"
|
||||
width="240"
|
||||
height="240"
|
||||
viewBox="0 0 240 240"
|
||||
sodipodi:docname="tile.svg"
|
||||
inkscape:version="0.92.4 5da689c313, 2019-01-14">
|
||||
<metadata
|
||||
id="metadata8">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<defs
|
||||
id="defs6" />
|
||||
<sodipodi:namedview
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1"
|
||||
objecttolerance="10"
|
||||
gridtolerance="10"
|
||||
guidetolerance="10"
|
||||
inkscape:pageopacity="0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:window-width="1321"
|
||||
inkscape:window-height="740"
|
||||
id="namedview4"
|
||||
showgrid="false"
|
||||
inkscape:pagecheckerboard="true"
|
||||
inkscape:zoom="3.4570311"
|
||||
inkscape:cx="113.41698"
|
||||
inkscape:cy="20.959299"
|
||||
inkscape:window-x="45"
|
||||
inkscape:window-y="28"
|
||||
inkscape:window-maximized="0"
|
||||
inkscape:current-layer="svg2" />
|
||||
<image
|
||||
width="200"
|
||||
height="200"
|
||||
preserveAspectRatio="none"
|
||||
style="image-rendering:optimizeQuality"
|
||||
xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAC63pUWHRSYXcgcHJvZmlsZSB0eXBl IGV4aWYAAHja7ZdtktwoDIb/c4ocAUkIieNgPqpygz1+XrDd0z2Z3SS1+2er2pQBC1nI7wP0TBh/ fZ/hGy4qmUNS81xyjrhSSYUrOh7Pq+yaYtr1vtI1hOcXe3gMMEyCVs5Hq5d/hV0/XrjnoOPVHvwa Yb8CXQN3QFkzMzr9OUnY+bTTlUko4+zk4vac6sFn2+6U/eOed1p2Nus5PBuSQaWumEiYh5DEXfuZ gZx3xS27ZvhFMfSTSEDD25VOQV4+725jfBboReS7Fz6r/+h9Ep/rZZdPWuZLI3S+HCD9Wvwt8dPE 8siIXwdM7lBfiDy7zznOr6spQ9F8ragtNt1h4HhActmvZRTDrejbLgXFY40NyHts8UBpVIhBZQZK 1KnSpLHbRg0pJh5saJkby7a5GBduoERghEKTTYp0ccBqPAJQJuFHLrTnLXu+Ro6ZO8GVCcEIr/xt Cf80+CclzNmWRBT9oRXy4rWukcYit2p4AQjNi5tuge9y4Y9P62ct1QS3JbPjA2s8zhCH0sfaks1Z 4Kdozy1EwfoVABJhbkUyJCAQM4lSpmjMRgQdHYAqMmdJfIAAqXJHkowNgvPI2HnNjXeMti8rZ15m nE0AoZKxnxyEKmClpFg/lhxrqKpoUtWsph60aM2SU9acs+V1yFUTS6aWzcytWHXx5OrZzd2L18JF cAZqycWKl1Jq5VAxUUWsCv8Ky8GHHOnQIx92+FGO2rB8WmracrPmrbTauUvHMdFzt+699DooDJwU Iw0dedjwUUadWGtTZpo687Tps8z6oHZR/an8ATW6qPEmtfzsQQ3WYHaHoHWc6GIGYpwIxG0RwILm xSw6pcSL3GIWC2NTKCNJXWxCp0UMCNMg1kkPdh/kfotbUP8tbvwrcmGh+y/IBaD7mdsX1Pr6nWub 2LkLl6ZRsPvgU9kD7hhR/dv2Hegd6B3oHegd6B3oHej/H0gm/njAP7HhB3u4nbY7yMH4AAABhWlD Q1BJQ0MgcHJvZmlsZQAAeJx9kT1Iw1AUhU9TtSIVBwuKOGSoLloQFXHUKhShQqgVWnUweemP0KQh SXFxFFwLDv4sVh1cnHV1cBUEwR8QJ0cnRRcp8b6k0CLGC4/3cd49h/fuA4RaiWlW2xig6baZSsTF THZFDL0iiAD6MIIOmVnGrCQl4Vtf99RLdRfjWf59f1a3mrMYEBCJZ5hh2sTrxFObtsF5nzjCirJK fE48atIFiR+5rnj8xrngssAzI2Y6NUccIRYLLay0MCuaGvEkcVTVdMoXMh6rnLc4a6UKa9yTvzCc 05eXuE5rEAksYBESRCioYAMl2IjRrpNiIUXncR//gOuXyKWQawOMHPMoQ4Ps+sH/4PdsrfzEuJcU jgPtL47zMQSEdoF61XG+jx2nfgIEn4Ervekv14DpT9KrTS16BPRsAxfXTU3ZAy53gP4nQzZlVwrS EvJ54P2MvikL9N4CXave3BrnOH0A0jSr5A1wcAgMFyh7zefdna1z+7enMb8fKAtyidNZ3ucAAAAG YktHRAAAAAAAAPlDu38AAAAJcEhZcwAADdcAAA3XAUIom3gAAAAHdElNRQfkAwEXKxzFBfpSAAAA pUlEQVR42u3bQQpAIQgFwIzuf+X+Cdp8KgzHZaDQQC4eFHPOVrl6K14AqgOMxfnfxRCvzesbh696 U8+zAwAAAAAAAAAAAAAAAADgUMXm3q3zxiXoyDrPEwBQvG7tgKcywSyXX/XKBO0AAAAAAAAAAAAA AAAAvAAgE2wyQTsAQNaSCSa+/KpXJmgHAAAAAAAAAAAAAAAA4ARA6gxv97zwd9gTAFC6PgsFG4ct jyRYAAAAAElFTkSuQmCC "
|
||||
id="image10"
|
||||
x="20"
|
||||
y="20" />
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 477 B |
@@ -1 +1 @@
|
||||
Lutris;Steam;Io.elementary.appcenter;Repoman;Com.github.donadigo.eddy;Sysmontask;join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=Gnome-calculator;Virt-manager;Gwe;
|
||||
Lutris;Steam;Io.elementary.appcenter;Repoman;Com.github.donadigo.eddy;Sysmontask;join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=join?action=join&confno=9992624875&confid=dXRpZD1VVElEXzM0ODYxOTgyYzg0YzQ1Y2NiYmM0YWNiMzczODNiYjgxJnVzcz1TaU1YUnNEWG5BQWNBYnRpYklBNWE0MjRDNkpBMzMyVXRUc2pCX1YxVm5JY0hWeVRybGN5WjZZS2VBa1pvNkszOXdNWEVkVE9hTU54Z3BROFZFckhPR3Y4eGo0MlB0emNCZjNRLnNlM28yNy13YWpGYy1ReXEmdGlkPTcyNjEzNGRjYWJkZTQyYTNhNzJmZjVjYjVkNTU2YTYw&browser=Gnome-calculator;Virt-manager;Gwe;whatsdesk;Totem;
|
||||
@@ -4,30 +4,22 @@
|
||||
-- Awesome Libs
|
||||
local naughty = require("naughty")
|
||||
|
||||
if awesome.startup_errors then
|
||||
naughty.notify({
|
||||
preset = naughty.config.presets.critical,
|
||||
title = "! Not so Awesome ERROR !",
|
||||
text = awesome.startup_errors
|
||||
})
|
||||
end
|
||||
|
||||
do
|
||||
local in_error = false
|
||||
awesome.connect_signal(
|
||||
"debug::error",
|
||||
function(err)
|
||||
if in_error then
|
||||
return
|
||||
end
|
||||
in_error = true
|
||||
local in_error = false
|
||||
awesome.connect_signal(
|
||||
"debug::error",
|
||||
function(err)
|
||||
if in_error then
|
||||
return
|
||||
end
|
||||
in_error = true
|
||||
|
||||
naughty.notify({
|
||||
preset = naughty.config.presets.critical,
|
||||
title = "ERROR",
|
||||
text = tostring(err)
|
||||
})
|
||||
in_error = false
|
||||
end
|
||||
)
|
||||
naughty.notify({
|
||||
preset = naughty.config.presets.critical,
|
||||
title = "ERROR",
|
||||
text = tostring(err)
|
||||
})
|
||||
in_error = false
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
396
awesome/src/core/notifications.lua
Normal file
@@ -0,0 +1,396 @@
|
||||
-------------------------------
|
||||
-- The Notification defaults --
|
||||
-------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local color = require("src.theme.colors")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local menubar = require('menubar')
|
||||
local naughty = require("naughty")
|
||||
local wibox = require("wibox")
|
||||
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/notifications/"
|
||||
|
||||
-- TODO: Figure out how to use hover effects without messing up the actions
|
||||
|
||||
naughty.config.defaults.ontop = true
|
||||
naughty.config.defaults.icon_size = dpi(80)
|
||||
naughty.config.defaults.timeout = 3
|
||||
naughty.config.defaults.title = "System Notification"
|
||||
naughty.config.defaults.margin = dpi(10)
|
||||
naughty.config.defaults.position = "bottom_right"
|
||||
naughty.config.defaults.shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(10))
|
||||
end
|
||||
naughty.config.defaults.border_width = dpi(4)
|
||||
naughty.config.defaults.border_color = color["Grey800"]
|
||||
naughty.config.defaults.spacing = dpi(10)
|
||||
|
||||
naughty.connect_signal(
|
||||
'request::icon',
|
||||
function(n, context, hints)
|
||||
if context ~= 'app_icon' then return end
|
||||
local path = menubar.utils.lookup_icon(hints.app_icon) or
|
||||
menubar.utils.lookup_icon(hints.app_icon:lower())
|
||||
if path then
|
||||
n.icon = path
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
naughty.connect_signal(
|
||||
"request::display",
|
||||
function(n)
|
||||
|
||||
if n.urgency == "critical" then
|
||||
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>", color["RedA200"], n.title) or ""
|
||||
n.message = string.format("<span foreground='%s'>%s</span>", color["Red200"], n.message) or ""
|
||||
n.app_name = string.format("<span foreground='%s'>%s</span>", color["RedA400"], n.app_name) or ""
|
||||
n.bg = color["Grey900"]
|
||||
else
|
||||
n.title = string.format("<span foreground='%s' font='JetBrainsMono Nerd Font, ExtraBold 16'>%s</span>", color["Pink200"], n.title) or ""
|
||||
n.message = string.format("<span foreground='%s'>%s</span>", "#ffffffaa", n.message) or ""
|
||||
n.bg = color["Grey900"]
|
||||
n.timeout = n.timeout or 3
|
||||
end
|
||||
|
||||
local use_image = false
|
||||
|
||||
if n.app_name == "Spotify" then
|
||||
n.actions = {
|
||||
naughty.action {
|
||||
program = "Spotify",
|
||||
id = "skip-prev",
|
||||
icon = gears.color.recolor_image(icondir .. "skip-prev.svg", color["Cyan200"]),
|
||||
},
|
||||
naughty.action {
|
||||
program = "Spotify",
|
||||
id = "play-pause",
|
||||
icon = gears.color.recolor_image(icondir .. "play-pause.svg", color["Cyan200"]),
|
||||
},
|
||||
naughty.action {
|
||||
program = "Spotify",
|
||||
id = "skip-next",
|
||||
icon = gears.color.recolor_image(icondir .. "skip-next.svg", color["Cyan200"]),
|
||||
},
|
||||
}
|
||||
use_image = true
|
||||
end
|
||||
|
||||
local action_template_widget = {}
|
||||
|
||||
if use_image then
|
||||
action_template_widget = {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon_role",
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
id = "centered",
|
||||
valign = "center",
|
||||
halign = "center",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
forced_height = dpi(35),
|
||||
forced_width = dpi(35),
|
||||
fg = color["Cyan200"],
|
||||
bg = color["Grey800"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
widget = wibox.container.background,
|
||||
id = "bgrnd"
|
||||
},
|
||||
id = "mrgn",
|
||||
top = dpi(10),
|
||||
bottom = dpi(10),
|
||||
widget = wibox.container.margin,
|
||||
}
|
||||
else
|
||||
action_template_widget = {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "text_role",
|
||||
font = "JetBrainsMono Nerd Font, Regular 12",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "centered",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
fg = color["Green200"],
|
||||
bg = color["Grey800"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, dpi(6))
|
||||
end,
|
||||
widget = wibox.container.background,
|
||||
id = "bgrnd"
|
||||
},
|
||||
id = "mrgn",
|
||||
top = dpi(10),
|
||||
bottom = dpi(10),
|
||||
widget = wibox.container.margin,
|
||||
}
|
||||
end
|
||||
|
||||
local actions_template = wibox.widget {
|
||||
notification = n,
|
||||
base_layout = wibox.widget {
|
||||
spacing = dpi(40),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
widget_template = action_template_widget,
|
||||
style = {
|
||||
underline_normal = false,
|
||||
underline_selected = true,
|
||||
bg_normal = color["Grey100"],
|
||||
bg_selected = color["Grey200"]
|
||||
},
|
||||
widget = naughty.list.actions
|
||||
}
|
||||
|
||||
local w_template = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
markup = n.app_name or 'System Notification',
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
fg = color["Teal200"],
|
||||
widget = wibox.container.background
|
||||
},
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
nil,
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
font = user_vars.font.specify .. ", 10",
|
||||
text = "✕",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
start_angle = 4.71239,
|
||||
thickness = dpi(2),
|
||||
min_value = 0,
|
||||
max_value = 360,
|
||||
value = 360,
|
||||
widget = wibox.container.arcchart,
|
||||
id = "arc_chart"
|
||||
},
|
||||
id = "background",
|
||||
fg = color["Teal200"],
|
||||
bg = color["Grey900"],
|
||||
widget = wibox.container.background
|
||||
},
|
||||
strategy = "exact",
|
||||
width = dpi(20),
|
||||
height = dpi(20),
|
||||
widget = wibox.container.constraint,
|
||||
id = "const"
|
||||
},
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin,
|
||||
id = "arc_margin"
|
||||
},
|
||||
id = "arc_app_layout",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
id = "arc_app_bg",
|
||||
border_color = color["Grey800"],
|
||||
border_width = dpi(2),
|
||||
widget = wibox.container.background
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
image = n.icon,
|
||||
resize = true,
|
||||
widget = wibox.widget.imagebox,
|
||||
clip_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end,
|
||||
},
|
||||
width = naughty.config.defaults.icon_size,
|
||||
height = naughty.config.defaults.icon_size,
|
||||
strategy = "exact",
|
||||
widget = wibox.container.constraint
|
||||
},
|
||||
halign = "center",
|
||||
valign = "top",
|
||||
widget = wibox.container.place,
|
||||
},
|
||||
left = dpi(20),
|
||||
bottom = dpi(15),
|
||||
top = dpi(15),
|
||||
right = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
{
|
||||
{
|
||||
widget = naughty.widget.title,
|
||||
align = "left"
|
||||
},
|
||||
{
|
||||
widget = naughty.widget.message,
|
||||
align = "left"
|
||||
},
|
||||
{
|
||||
actions_template,
|
||||
widget = wibox.container.place
|
||||
},
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
left = dpi(10),
|
||||
bottom = dpi(10),
|
||||
top = dpi(10),
|
||||
right = dpi(20),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "widget_layout",
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
id = "min_size",
|
||||
strategy = "min",
|
||||
width = dpi(100),
|
||||
widget = wibox.container.constraint
|
||||
},
|
||||
id = "max_size",
|
||||
strategy = "max",
|
||||
width = Theme.notification_max_width or dpi(500),
|
||||
widget = wibox.container.constraint,
|
||||
},
|
||||
id = "background",
|
||||
bg = color["Grey900"],
|
||||
border_color = color["Grey800"],
|
||||
border_width = dpi(4),
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local close = w_template.max_size.min_size.widget_layout.arc_app_bg.arc_app_layout.arc_margin.const.background
|
||||
local arc = close.arc_chart
|
||||
|
||||
local timeout = n.timeout
|
||||
local remove_time = timeout
|
||||
|
||||
if timeout ~= 0 then
|
||||
arc.value = 360
|
||||
gears.timer {
|
||||
timeout = 0.1,
|
||||
call_now = true,
|
||||
autostart = true,
|
||||
callback = function()
|
||||
arc.value = (remove_time - 0) / (timeout - 0) * 360
|
||||
remove_time = remove_time - 0.1
|
||||
end
|
||||
}
|
||||
end
|
||||
|
||||
Hover_signal(close, color["Grey900"], color["Teal200"])
|
||||
|
||||
close:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
n:destroy()
|
||||
end
|
||||
)
|
||||
|
||||
w_template:connect_signal(
|
||||
"button::press",
|
||||
function(c, d, e, key)
|
||||
if key == 3 then
|
||||
n:destroy()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
local box = naughty.layout.box {
|
||||
notification = n,
|
||||
timeout = 3,
|
||||
type = "notification",
|
||||
screen = awful.screen.focused(),
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end,
|
||||
widget_template = w_template
|
||||
}
|
||||
|
||||
box.buttons = {}
|
||||
n.buttons = {}
|
||||
end
|
||||
)
|
||||
|
||||
naughty.connect_signal(
|
||||
"destroyed",
|
||||
function()
|
||||
|
||||
end
|
||||
)
|
||||
|
||||
-- Test notification
|
||||
--[[ naughty.notification {
|
||||
app_name = "System Notification",
|
||||
title = "A notification 2",
|
||||
message = "This is very informative and overflowing",
|
||||
icon = "/home/crylia/.config/awesome/src/assets/userpfp/crylia.png",
|
||||
urgency = "normal",
|
||||
timeout = 0,
|
||||
actions = {
|
||||
naughty.action {
|
||||
name = "Accept",
|
||||
},
|
||||
naughty.action {
|
||||
name = "Refuse",
|
||||
},
|
||||
naughty.action {
|
||||
name = "Ignore",
|
||||
},
|
||||
}
|
||||
} ]]
|
||||
|
||||
naughty.connect_signal(
|
||||
"invoked",
|
||||
function(_, action)
|
||||
if action.program == "Spotify" then
|
||||
if action.id == "skip-prev" then
|
||||
awful.spawn("playerctl previous")
|
||||
end
|
||||
if action.id == "play-pause" then
|
||||
awful.spawn("playerctl play-pause")
|
||||
end
|
||||
if action.id == "skip-next" then
|
||||
awful.spawn("playerctl next")
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
@@ -8,58 +8,58 @@ local beautiful = require("beautiful")
|
||||
local ruled = require("ruled")
|
||||
|
||||
awful.rules.rules = {
|
||||
{
|
||||
rule = {},
|
||||
properties = {
|
||||
border_width = beautiful.border_width,
|
||||
border_color = beautiful.border_normal,
|
||||
focus = awful.client.focus.filter,
|
||||
raise = true,
|
||||
keys = require("../../mappings/client_keys"),
|
||||
buttons = require("../../mappings/client_buttons"),
|
||||
screen = awful.screen.preferred,
|
||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen
|
||||
}
|
||||
},
|
||||
{
|
||||
rule_any = {
|
||||
instance = {},
|
||||
class = {
|
||||
"Arandr",
|
||||
"Lxappearance",
|
||||
"kdeconnect.app",
|
||||
"zoom",
|
||||
"file-roller",
|
||||
"File-roller"
|
||||
},
|
||||
name = {},
|
||||
role = {
|
||||
"AlarmWindow",
|
||||
"ConfigManager",
|
||||
"pop-up"
|
||||
}
|
||||
},
|
||||
properties = { floating = true, titlebars_enabled = true }
|
||||
},
|
||||
{
|
||||
id = "titlebar",
|
||||
rule_any = {
|
||||
type = { "normal", "dialog", "modal", "utility" }
|
||||
},
|
||||
properties = { titlebars_enabled = true }
|
||||
{
|
||||
rule = {},
|
||||
properties = {
|
||||
border_width = beautiful.border_width,
|
||||
border_color = beautiful.border_normal,
|
||||
focus = awful.client.focus.filter,
|
||||
raise = true,
|
||||
keys = require("../../mappings/client_keys"),
|
||||
buttons = require("../../mappings/client_buttons"),
|
||||
screen = awful.screen.preferred,
|
||||
placement = awful.placement.no_overlap + awful.placement.no_offscreen
|
||||
}
|
||||
},
|
||||
{
|
||||
rule_any = {
|
||||
instance = {},
|
||||
class = {
|
||||
"Arandr",
|
||||
"Lxappearance",
|
||||
"kdeconnect.app",
|
||||
"zoom",
|
||||
"file-roller",
|
||||
"File-roller"
|
||||
},
|
||||
name = {},
|
||||
role = {
|
||||
"AlarmWindow",
|
||||
"ConfigManager",
|
||||
"pop-up"
|
||||
}
|
||||
},
|
||||
properties = { floating = true, titlebars_enabled = true }
|
||||
},
|
||||
{
|
||||
id = "titlebar",
|
||||
rule_any = {
|
||||
type = { "normal", "dialog", "modal", "utility" }
|
||||
},
|
||||
properties = { titlebars_enabled = true }
|
||||
}
|
||||
}
|
||||
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"cat ~/.config/awesome/src/assets/rules.txt",
|
||||
function(stdout)
|
||||
for class in stdout:gmatch("%a+") do
|
||||
ruled.client.append_rule {
|
||||
rule = { class = class },
|
||||
properties = {
|
||||
floating = true
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
"cat ~/.config/awesome/src/assets/rules.txt",
|
||||
function(stdout)
|
||||
for class in stdout:gmatch("%a+") do
|
||||
ruled.client.append_rule {
|
||||
rule = { class = class },
|
||||
properties = {
|
||||
floating = true
|
||||
},
|
||||
}
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
@@ -4,155 +4,155 @@ local beautiful = require("beautiful")
|
||||
local gears = require("gears")
|
||||
|
||||
screen.connect_signal(
|
||||
"added",
|
||||
function()
|
||||
awesome.restart()
|
||||
end
|
||||
"added",
|
||||
function()
|
||||
awesome.restart()
|
||||
end
|
||||
)
|
||||
|
||||
screen.connect_signal(
|
||||
"removed",
|
||||
function()
|
||||
awesome.restart()
|
||||
end
|
||||
"removed",
|
||||
function()
|
||||
awesome.restart()
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
"manage",
|
||||
function(c)
|
||||
if awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then
|
||||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
c.shape = function(cr, width, height)
|
||||
if c.fullscreen or c.maximized then
|
||||
gears.shape.rectangle(cr, width, height)
|
||||
else
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end
|
||||
end
|
||||
"manage",
|
||||
function(c)
|
||||
if awesome.startup and not c.size_hints.user_porition and not c.size_hints.program_position then
|
||||
awful.placement.no_offscreen(c)
|
||||
end
|
||||
c.shape = function(cr, width, height)
|
||||
if c.fullscreen or c.maximized then
|
||||
gears.shape.rectangle(cr, width, height)
|
||||
else
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
'unmanage',
|
||||
function(c)
|
||||
if #awful.screen.focused().clients > 0 then
|
||||
awful.screen.focused().clients[1]:emit_signal(
|
||||
'request::activate',
|
||||
'mouse_enter',
|
||||
{
|
||||
raise = true
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
'unmanage',
|
||||
function(c)
|
||||
if #awful.screen.focused().clients > 0 then
|
||||
awful.screen.focused().clients[1]:emit_signal(
|
||||
'request::activate',
|
||||
'mouse_enter',
|
||||
{
|
||||
raise = true
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
'tag::switched',
|
||||
function(c)
|
||||
if #awful.screen.focused().clients > 0 then
|
||||
awful.screen.focused().clients[1]:emit_signal(
|
||||
'request::activate',
|
||||
'mouse_enter',
|
||||
{
|
||||
raise = true
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
'tag::switched',
|
||||
function(c)
|
||||
if #awful.screen.focused().clients > 0 then
|
||||
awful.screen.focused().clients[1]:emit_signal(
|
||||
'request::activate',
|
||||
'mouse_enter',
|
||||
{
|
||||
raise = true
|
||||
}
|
||||
)
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
|
||||
-- Sloppy focus
|
||||
client.connect_signal("mouse::enter", function(c)
|
||||
c:emit_signal("request::activate", "mouse_enter", { raise = false })
|
||||
c:emit_signal("request::activate", "mouse_enter", { raise = false })
|
||||
end)
|
||||
|
||||
-- Workaround for focused border color, why in the love of god doesnt it work with
|
||||
-- beautiful.border_focus
|
||||
client.connect_signal("focus", function(c)
|
||||
c.border_color = "#616161"
|
||||
c.border_color = "#616161"
|
||||
end)
|
||||
|
||||
client.connect_signal("unfocus", function(c)
|
||||
c.border_color = beautiful.border_normal
|
||||
c.border_color = beautiful.border_normal
|
||||
end)
|
||||
|
||||
function Hover_signal(widget, bg, fg)
|
||||
local old_wibox, old_cursor, old_bg, old_fg
|
||||
widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
if bg then
|
||||
old_bg = widget.bg
|
||||
if string.len(bg) == 7 then
|
||||
widget.bg = bg .. 'dd'
|
||||
else
|
||||
widget.bg = bg
|
||||
end
|
||||
end
|
||||
if fg then
|
||||
old_fg = widget.fg
|
||||
widget.fg = fg
|
||||
end
|
||||
local w = mouse.current_wibox
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
end
|
||||
)
|
||||
local old_wibox, old_cursor, old_bg, old_fg
|
||||
widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
if bg then
|
||||
old_bg = widget.bg
|
||||
if string.len(bg) == 7 then
|
||||
widget.bg = bg .. 'dd'
|
||||
else
|
||||
widget.bg = bg
|
||||
end
|
||||
end
|
||||
if fg then
|
||||
old_fg = widget.fg
|
||||
widget.fg = fg
|
||||
end
|
||||
local w = mouse.current_wibox
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
if bg then
|
||||
if bg then
|
||||
if string.len(bg) == 7 then
|
||||
widget.bg = bg .. 'bb'
|
||||
else
|
||||
widget.bg = bg
|
||||
end
|
||||
end
|
||||
end
|
||||
if fg then
|
||||
widget.fg = fg
|
||||
end
|
||||
widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
if bg then
|
||||
if bg then
|
||||
if string.len(bg) == 7 then
|
||||
widget.bg = bg .. 'bb'
|
||||
else
|
||||
widget.bg = bg
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
if fg then
|
||||
widget.fg = fg
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
widget:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
if bg then
|
||||
if bg then
|
||||
if string.len(bg) == 7 then
|
||||
widget.bg = bg .. 'dd'
|
||||
else
|
||||
widget.bg = bg
|
||||
end
|
||||
end
|
||||
end
|
||||
if fg then
|
||||
widget.fg = fg
|
||||
end
|
||||
widget:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
if bg then
|
||||
if bg then
|
||||
if string.len(bg) == 7 then
|
||||
widget.bg = bg .. 'dd'
|
||||
else
|
||||
widget.bg = bg
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
if fg then
|
||||
widget.fg = fg
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
widget:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
if bg then
|
||||
widget.bg = old_bg
|
||||
end
|
||||
if fg then
|
||||
widget.fg = old_fg
|
||||
end
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end
|
||||
end
|
||||
)
|
||||
widget:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
if bg then
|
||||
widget.bg = old_bg
|
||||
end
|
||||
if fg then
|
||||
widget.fg = old_fg
|
||||
end
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
@@ -15,222 +15,220 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/brightness/"
|
||||
BACKLIGHT_MAX_BRIGHTNESS = 0
|
||||
BACKLIGHT_SEPS = 0
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"pkexec xfpm-power-backlight-helper --get-max-brightness",
|
||||
function(stdout)
|
||||
BACKLIGHT_MAX_BRIGHTNESS = tonumber(stdout)
|
||||
BACKLIGHT_SEPS = BACKLIGHT_MAX_BRIGHTNESS / 100
|
||||
BACKLIGHT_SEPS = math.floor(BACKLIGHT_SEPS)
|
||||
end
|
||||
"pkexec xfpm-power-backlight-helper --get-max-brightness",
|
||||
function(stdout)
|
||||
BACKLIGHT_MAX_BRIGHTNESS = tonumber(stdout)
|
||||
BACKLIGHT_SEPS = BACKLIGHT_MAX_BRIGHTNESS / 100
|
||||
BACKLIGHT_SEPS = math.floor(BACKLIGHT_SEPS)
|
||||
end
|
||||
)
|
||||
|
||||
return function(s)
|
||||
|
||||
local brightness_osd_widget = wibox.widget {
|
||||
local brightness_osd_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
nil,
|
||||
{
|
||||
{
|
||||
{
|
||||
nil,
|
||||
{
|
||||
nil,
|
||||
{
|
||||
id = "icon",
|
||||
forced_height = dpi(220),
|
||||
image = icondir .. "brightness-high.svg",
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
id = "icon_margin2",
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
nil,
|
||||
id = "icon_margin1",
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
{
|
||||
{
|
||||
id = "label",
|
||||
text = "Brightness",
|
||||
align = "left",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
nil,
|
||||
{
|
||||
id = "value",
|
||||
text = "0%",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "label_value_layout",
|
||||
forced_height = dpi(48),
|
||||
layout = wibox.layout.align.horizontal,
|
||||
},
|
||||
{
|
||||
{
|
||||
id = "brightness_slider",
|
||||
bar_shape = gears.shape.rounded_rect,
|
||||
bar_height = dpi(10),
|
||||
bar_color = color["Grey800"] .. "88",
|
||||
bar_active_color = "#ffffff",
|
||||
handle_color = "#ffffff",
|
||||
handle_shape = gears.shape.circle,
|
||||
handle_width = dpi(10),
|
||||
handle_border_color = color["White"],
|
||||
maximum = 100,
|
||||
widget = wibox.widget.slider
|
||||
},
|
||||
id = "slider_layout",
|
||||
forced_height = dpi(24),
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_slider_layout",
|
||||
spacing = dpi(0),
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
id = "osd_layout",
|
||||
layout = wibox.layout.align.vertical
|
||||
nil,
|
||||
{
|
||||
id = "icon",
|
||||
forced_height = dpi(220),
|
||||
image = icondir .. "brightness-high.svg",
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
id = "icon_margin2",
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(24),
|
||||
right = dpi(24),
|
||||
widget = wibox.container.margin
|
||||
nil,
|
||||
id = "icon_margin1",
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
{
|
||||
{
|
||||
id = "label",
|
||||
text = "Brightness",
|
||||
align = "left",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
nil,
|
||||
{
|
||||
id = "value",
|
||||
text = "0%",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "label_value_layout",
|
||||
forced_height = dpi(48),
|
||||
layout = wibox.layout.align.horizontal,
|
||||
},
|
||||
{
|
||||
{
|
||||
id = "brightness_slider",
|
||||
bar_shape = gears.shape.rounded_rect,
|
||||
bar_height = dpi(10),
|
||||
bar_color = color["Grey800"] .. "88",
|
||||
bar_active_color = "#ffffff",
|
||||
handle_color = "#ffffff",
|
||||
handle_shape = gears.shape.circle,
|
||||
handle_width = dpi(10),
|
||||
handle_border_color = color["White"],
|
||||
maximum = 100,
|
||||
widget = wibox.widget.slider
|
||||
},
|
||||
id = "slider_layout",
|
||||
forced_height = dpi(24),
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_slider_layout",
|
||||
spacing = dpi(0),
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
bg = color["Grey900"] .. "88",
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
visible = true,
|
||||
type = "notification",
|
||||
forced_height = dpi(300),
|
||||
forced_width = dpi(300),
|
||||
offset = dpi(5),
|
||||
}
|
||||
id = "osd_layout",
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(24),
|
||||
right = dpi(24),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Grey900"] .. "88",
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
visible = true,
|
||||
type = "notification",
|
||||
forced_height = dpi(300),
|
||||
forced_width = dpi(300),
|
||||
offset = dpi(5),
|
||||
}
|
||||
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:connect_signal(
|
||||
"property::value",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||
function(stdout)
|
||||
local brightness_value = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
|
||||
-- Performance is horrible, or it overrides and executes at the same time as the keymappings
|
||||
--awful.spawn("xbacklight -set " .. brightness_value, false)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(tostring(brightness_value) .. "%")
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:connect_signal(
|
||||
"property::value",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"pkexec xfpm-power-backlight-helper --get-brightness",
|
||||
function(stdout)
|
||||
local brightness_value = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.label_value_layout.value:set_text(tostring(brightness_value) .. "%")
|
||||
|
||||
awesome.emit_signal(
|
||||
"widget::brightness:update",
|
||||
brightness_value
|
||||
)
|
||||
|
||||
if awful.screen.focused().show_brightness_osd then
|
||||
awesome.emit_signal(
|
||||
"module::brightness_osd:show",
|
||||
true
|
||||
)
|
||||
end
|
||||
|
||||
local icon = icondir .. "brightness"
|
||||
if brightness_value >= 0 and brightness_value < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif brightness_value >= 34 and brightness_value < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif brightness_value >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icon .. ".svg")
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
|
||||
local update_slider = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ pkexec xfpm-power-backlight-helper --get-brightness ]],
|
||||
function(stdout)
|
||||
stdout = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(stdout)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::brightness_slider:update",
|
||||
function()
|
||||
update_slider()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
awesome.emit_signal(
|
||||
"widget::brightness:update",
|
||||
function(value)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(value))
|
||||
end
|
||||
)
|
||||
brightness_value
|
||||
)
|
||||
|
||||
if awful.screen.focused().show_brightness_osd then
|
||||
awesome.emit_signal(
|
||||
"module::brightness_osd:show",
|
||||
true
|
||||
)
|
||||
end
|
||||
|
||||
local icon = icondir .. "brightness"
|
||||
if brightness_value >= 0 and brightness_value < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif brightness_value >= 34 and brightness_value < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif brightness_value >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.icon_margin1.icon_margin2.icon:set_image(icon .. ".svg")
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
|
||||
local update_slider = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ pkexec xfpm-power-backlight-helper --get-brightness ]],
|
||||
function(stdout)
|
||||
stdout = math.floor((tonumber(stdout) - 1) / (BACKLIGHT_MAX_BRIGHTNESS - 1) * 100)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(stdout)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::brightness_slider:update",
|
||||
function()
|
||||
update_slider()
|
||||
end
|
||||
)
|
||||
|
||||
local brightness_container = awful.popup {
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
bg = color["Grey900"] .. "00",
|
||||
stretch = false,
|
||||
visible = false,
|
||||
screen = s,
|
||||
placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 15)
|
||||
end
|
||||
}
|
||||
awesome.connect_signal(
|
||||
"widget::brightness:update",
|
||||
function(value)
|
||||
brightness_osd_widget.container.osd_layout.icon_slider_layout.slider_layout.brightness_slider:set_value(tonumber(value))
|
||||
end
|
||||
)
|
||||
|
||||
local hide_brightness_osd = gears.timer {
|
||||
timeout = 2,
|
||||
autostart = true,
|
||||
callback = function()
|
||||
brightness_container.visible = false
|
||||
end
|
||||
}
|
||||
update_slider()
|
||||
|
||||
brightness_container:setup {
|
||||
brightness_osd_widget,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
local brightness_container = awful.popup {
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
bg = color["Grey900"] .. "00",
|
||||
stretch = false,
|
||||
visible = false,
|
||||
screen = s,
|
||||
placement = function(c) awful.placement.centered(c, { margins = { top = dpi(200) } }) end,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 15)
|
||||
end
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::brightness_osd:rerun",
|
||||
function()
|
||||
if hide_brightness_osd.started then
|
||||
hide_brightness_osd:again()
|
||||
else
|
||||
hide_brightness_osd:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
local hide_brightness_osd = gears.timer {
|
||||
timeout = 2,
|
||||
autostart = true,
|
||||
callback = function()
|
||||
brightness_container.visible = false
|
||||
end
|
||||
}
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::brightness_osd:show",
|
||||
function()
|
||||
if s == mouse.screen then
|
||||
brightness_container.visible = true
|
||||
end
|
||||
end
|
||||
)
|
||||
brightness_container:setup {
|
||||
brightness_osd_widget,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
brightness_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
brightness_container.visible = true
|
||||
hide_brightness_osd:stop()
|
||||
end
|
||||
)
|
||||
awesome.connect_signal(
|
||||
"widget::brightness_osd:rerun",
|
||||
function()
|
||||
if hide_brightness_osd.started then
|
||||
hide_brightness_osd:again()
|
||||
else
|
||||
hide_brightness_osd:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
brightness_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
brightness_container.visible = true
|
||||
hide_brightness_osd:again()
|
||||
end
|
||||
)
|
||||
awesome.connect_signal(
|
||||
"module::brightness_osd:show",
|
||||
function()
|
||||
if s == mouse.screen then
|
||||
brightness_container.visible = true
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
brightness_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
brightness_container.visible = true
|
||||
hide_brightness_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
brightness_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
brightness_container.visible = true
|
||||
hide_brightness_osd:again()
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
@@ -1,183 +0,0 @@
|
||||
---------------------------------------
|
||||
-- This is the calendar_osd module --
|
||||
---------------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
|
||||
local awful = require("awful")
|
||||
local wibox = require("wibox")
|
||||
local gears = require("gears")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local color = require("src.theme.colors")
|
||||
|
||||
return function(s)
|
||||
local styles = {}
|
||||
|
||||
styles.month = {
|
||||
padding = 15,
|
||||
bg_color = color["Grey900"],
|
||||
border_width = 1,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.normal = {
|
||||
fg_color = color["Grey900"],
|
||||
font = user_vars.font.extrabold,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.focus = {
|
||||
fg_color = color["Grey900"],
|
||||
bg_color = color["Purple200"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.header = {
|
||||
fg_color = color["Grey900"],
|
||||
bg_color = color["Teal200"],
|
||||
markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
styles.weekday = {
|
||||
padding = 8,
|
||||
fg_color = color["Grey900"],
|
||||
bg_color = color["Teal200"],
|
||||
markup = function(t) return '<b>' .. t .. '</b>' end,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
local function decorate_cell(widget, flag, date)
|
||||
if flag == 'monthheader' and not styles.monthheader then
|
||||
flag = 'header'
|
||||
end
|
||||
local props = styles[flag] or {}
|
||||
if props.markup and widget.get_text and widget.set_markup then
|
||||
widget:set_markup(props.markup(widget:get_text()))
|
||||
end
|
||||
-- Change bg color for weekends
|
||||
local d = { year = date.year, month = (date.month or 1), day = (date.day or 1) }
|
||||
local weekday = tonumber(os.date('%w', os.time(d)))
|
||||
local default_bg = (weekday == 0 or weekday == 6) and color["Red200"] or color["White"]
|
||||
local ret = wibox.widget {
|
||||
{
|
||||
widget,
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
top = dpi(4),
|
||||
bottom = dpi(4),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
fg = props.fg_color or '#999999',
|
||||
bg = props.bg_color or default_bg,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
return ret
|
||||
end
|
||||
|
||||
local calendar = wibox.widget {
|
||||
date = os.date('*t'),
|
||||
fn_embed = decorate_cell,
|
||||
widget = wibox.widget.calendar.month,
|
||||
font = user_vars.font.extrabold,
|
||||
spacing = dpi(10)
|
||||
}
|
||||
|
||||
local calendar_osd_widget = wibox.widget {
|
||||
{
|
||||
widget = wibox.widget.textbox,
|
||||
fg = "#ffffff",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
font = "DS-Digital, Bold Italic 50",
|
||||
id = "digital_clock"
|
||||
},
|
||||
{
|
||||
widget = calendar
|
||||
},
|
||||
visible = true,
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
|
||||
local set_clock = function()
|
||||
calendar_osd_widget.digital_clock:set_text(os.date("%H:%M"))
|
||||
end
|
||||
|
||||
local calendar_clock_update = gears.timer {
|
||||
timeout = 5,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function()
|
||||
set_clock()
|
||||
end
|
||||
}
|
||||
|
||||
local calendar_osd_container = awful.popup {
|
||||
screen = s,
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
bg = color["Grey900"],
|
||||
stretch = false,
|
||||
visible = false,
|
||||
placement = function(c) awful.placement.top_right(c, { margins = { right = dpi(100), top = dpi(60) } }) end,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end
|
||||
}
|
||||
|
||||
local hide_osd = gears.timer {
|
||||
timeout = 0.25,
|
||||
autostart = true,
|
||||
callback = function()
|
||||
calendar_osd_container.visible = false
|
||||
end
|
||||
}
|
||||
|
||||
calendar_osd_container:setup {
|
||||
calendar_osd_widget,
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
|
||||
calendar_osd_container:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
calendar_osd_container.visible = true
|
||||
hide_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
calendar_osd_container:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
calendar_osd_container.visible = false
|
||||
hide_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::calendar_osd:stop",
|
||||
function()
|
||||
calendar_osd_container.visible = true
|
||||
hide_osd:stop()
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::calendar_osd:rerun",
|
||||
function()
|
||||
if hide_osd.started then
|
||||
hide_osd:again()
|
||||
else
|
||||
hide_osd:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
@@ -15,32 +15,32 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/powermenu/"
|
||||
|
||||
return function(s)
|
||||
|
||||
-- Profile picture imagebox
|
||||
local profile_picture = wibox.widget {
|
||||
image = icondir .. "defaultpfp.svg",
|
||||
resize = true,
|
||||
forced_height = dpi(200),
|
||||
clip_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 30)
|
||||
end,
|
||||
widget = wibox.widget.imagebox
|
||||
}
|
||||
-- Profile picture imagebox
|
||||
local profile_picture = wibox.widget {
|
||||
image = icondir .. "defaultpfp.svg",
|
||||
resize = true,
|
||||
forced_height = dpi(200),
|
||||
clip_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 30)
|
||||
end,
|
||||
widget = wibox.widget.imagebox
|
||||
}
|
||||
|
||||
-- Username textbox
|
||||
local profile_name = wibox.widget {
|
||||
align = 'center',
|
||||
valign = 'center',
|
||||
text = " ",
|
||||
font = "JetBrains Mono Bold 30",
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
-- Username textbox
|
||||
local profile_name = wibox.widget {
|
||||
align = 'center',
|
||||
valign = 'center',
|
||||
text = " ",
|
||||
font = "JetBrains Mono Bold 30",
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
|
||||
-- Get the profile script from /var/lib/AccountsService/icons/${USER}
|
||||
-- and copy it to the assets folder
|
||||
-- TODO: If the user doesnt have AccountsService look into $HOME/.faces
|
||||
local update_profile_picture = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
-- Get the profile script from /var/lib/AccountsService/icons/${USER}
|
||||
-- and copy it to the assets folder
|
||||
-- TODO: If the user doesnt have AccountsService look into $HOME/.faces
|
||||
local update_profile_picture = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
iconPath="/var/lib/AccountsService/icons/${USER}"
|
||||
userIconPath="${HOME}/.config/awesome/src/assets/userpfp/"
|
||||
if [[ -f "${userIconPath}" ]];
|
||||
@@ -65,23 +65,23 @@ return function(s)
|
||||
fi
|
||||
fi
|
||||
]=],
|
||||
function(stdout)
|
||||
if stdout then
|
||||
profile_picture:set_image(stdout:gsub("\n", ""))
|
||||
else
|
||||
profile_picture:set_image(icondir .. "defaultpfp.svg")
|
||||
end
|
||||
end
|
||||
)
|
||||
function(stdout)
|
||||
if stdout then
|
||||
profile_picture:set_image(stdout:gsub("\n", ""))
|
||||
else
|
||||
profile_picture:set_image(icondir .. "defaultpfp.svg")
|
||||
end
|
||||
end
|
||||
update_profile_picture()
|
||||
)
|
||||
end
|
||||
update_profile_picture()
|
||||
|
||||
-- Will determin the display style
|
||||
local namestyle = user_vars.namestyle
|
||||
-- Get the full username(if set) and the username + hostname
|
||||
local update_user_name = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
-- Will determin the display style
|
||||
local namestyle = user_vars.namestyle
|
||||
-- Get the full username(if set) and the username + hostname
|
||||
local update_user_name = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
fullname="$(getent passwd `whoami` | cut -d ':' -f 5)"
|
||||
user="$(whoami)"
|
||||
host="$(hostname)"
|
||||
@@ -95,227 +95,227 @@ return function(s)
|
||||
printf "Rick Astley"
|
||||
fi
|
||||
]=],
|
||||
function(stdout)
|
||||
if stdout:gsub("\n", "") == "Rick Astley" then
|
||||
profile_picture:set_image(awful.util.getdir("config") .. "src/assets/userpfp/" .. "rickastley.jpg")
|
||||
end
|
||||
profile_name:set_text(stdout)
|
||||
end
|
||||
)
|
||||
function(stdout)
|
||||
if stdout:gsub("\n", "") == "Rick Astley" then
|
||||
profile_picture:set_image(awful.util.getdir("config") .. "src/assets/userpfp/" .. "rickastley.jpg")
|
||||
end
|
||||
profile_name:set_text(stdout)
|
||||
end
|
||||
update_user_name()
|
||||
)
|
||||
end
|
||||
update_user_name()
|
||||
|
||||
-- Universal Button widget
|
||||
local button = function(name, icon, bg_color, callback)
|
||||
local item = wibox.widget {
|
||||
-- Universal Button widget
|
||||
local button = function(name, icon, bg_color, callback)
|
||||
local item = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
-- TODO: using gears.color to recolor a SVG will make it look super low res
|
||||
-- currently I recolor it in the .svg file directly, but later implement
|
||||
-- a better way to recolor a SVG
|
||||
-- image = gears.color.recolor_image(icon, color["Grey900"]),
|
||||
image = icon,
|
||||
resize = true,
|
||||
forced_height = dpi(30),
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
{
|
||||
text = name,
|
||||
font = "JetBrains Mono Bold 30",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
widget = wibox.layout.fixed.horizontal
|
||||
},
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
fg = color["Grey900"],
|
||||
bg = bg_color,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end,
|
||||
widget = wibox.container.background,
|
||||
id = 'background'
|
||||
{
|
||||
-- TODO: using gears.color to recolor a SVG will make it look super low res
|
||||
-- currently I recolor it in the .svg file directly, but later implement
|
||||
-- a better way to recolor a SVG
|
||||
-- image = gears.color.recolor_image(icon, color["Grey900"]),
|
||||
image = icon,
|
||||
resize = true,
|
||||
forced_height = dpi(30),
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
spacing = dpi(0),
|
||||
layout = wibox.layout.align.vertical
|
||||
}
|
||||
{
|
||||
{
|
||||
text = name,
|
||||
font = "JetBrains Mono Bold 30",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
widget = wibox.layout.fixed.horizontal
|
||||
},
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
fg = color["Grey900"],
|
||||
bg = bg_color,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end,
|
||||
widget = wibox.container.background,
|
||||
id = 'background'
|
||||
},
|
||||
spacing = dpi(0),
|
||||
layout = wibox.layout.align.vertical
|
||||
}
|
||||
|
||||
item:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
callback()
|
||||
end
|
||||
)
|
||||
|
||||
return item
|
||||
item:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
callback()
|
||||
end
|
||||
)
|
||||
|
||||
-- Create the power menu actions
|
||||
local suspend_command = function()
|
||||
awful.spawn("dm-tool lock & systemctl suspend")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
return item
|
||||
end
|
||||
|
||||
local logout_command = function()
|
||||
awesome.quit()
|
||||
end
|
||||
-- Create the power menu actions
|
||||
local suspend_command = function()
|
||||
awful.spawn("dm-tool lock & systemctl suspend")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
local lock_command = function()
|
||||
awful.spawn("dm-tool lock")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
local logout_command = function()
|
||||
awesome.quit()
|
||||
end
|
||||
|
||||
local shutdown_command = function()
|
||||
awful.spawn("shutdown now")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
local lock_command = function()
|
||||
awful.spawn("dm-tool lock")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
local reboot_command = function()
|
||||
awful.spawn("reboot")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
local shutdown_command = function()
|
||||
awful.spawn("shutdown now")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
-- Create the buttons with their command and name etc
|
||||
local shutdown_button = button("Shutdown", icondir .. "shutdown.svg", color["Blue200"], shutdown_command)
|
||||
local reboot_button = button("Reboot", icondir .. "reboot.svg", color["Red200"], reboot_command)
|
||||
local suspend_button = button("Suspend", icondir .. "suspend.svg", color["Yellow200"], suspend_command)
|
||||
local logout_button = button("Logout", icondir .. "logout.svg", color["Green200"], logout_command)
|
||||
local lock_button = button("Lock", icondir .. "lock.svg", color["Orange200"], lock_command)
|
||||
local reboot_command = function()
|
||||
awful.spawn("reboot")
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
|
||||
-- Signals to change color on hover
|
||||
Hover_signal(shutdown_button.background, color["Blue200"])
|
||||
Hover_signal(reboot_button.background, color["Red200"])
|
||||
Hover_signal(suspend_button.background, color["Yellow200"])
|
||||
Hover_signal(logout_button.background, color["Green200"])
|
||||
Hover_signal(lock_button.background, color["Orange200"])
|
||||
-- Create the buttons with their command and name etc
|
||||
local shutdown_button = button("Shutdown", icondir .. "shutdown.svg", color["Blue200"], shutdown_command)
|
||||
local reboot_button = button("Reboot", icondir .. "reboot.svg", color["Red200"], reboot_command)
|
||||
local suspend_button = button("Suspend", icondir .. "suspend.svg", color["Yellow200"], suspend_command)
|
||||
local logout_button = button("Logout", icondir .. "logout.svg", color["Green200"], logout_command)
|
||||
local lock_button = button("Lock", icondir .. "lock.svg", color["Orange200"], lock_command)
|
||||
|
||||
-- The powermenu widget
|
||||
local powermenu = wibox.widget {
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none",
|
||||
-- Signals to change color on hover
|
||||
Hover_signal(shutdown_button.background, color["Blue200"])
|
||||
Hover_signal(reboot_button.background, color["Red200"])
|
||||
Hover_signal(suspend_button.background, color["Yellow200"])
|
||||
Hover_signal(logout_button.background, color["Green200"])
|
||||
Hover_signal(lock_button.background, color["Orange200"])
|
||||
|
||||
-- The powermenu widget
|
||||
local powermenu = wibox.widget {
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none",
|
||||
nil,
|
||||
{
|
||||
{
|
||||
nil,
|
||||
{
|
||||
{
|
||||
nil,
|
||||
{
|
||||
nil,
|
||||
{
|
||||
{
|
||||
nil,
|
||||
{
|
||||
nil,
|
||||
{
|
||||
profile_picture,
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
nil,
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none"
|
||||
},
|
||||
spacing = dpi(50),
|
||||
{
|
||||
profile_name,
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
nil,
|
||||
{
|
||||
profile_picture,
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
{
|
||||
nil,
|
||||
{
|
||||
{
|
||||
shutdown_button,
|
||||
reboot_button,
|
||||
logout_button,
|
||||
lock_button,
|
||||
suspend_button,
|
||||
spacing = dpi(30),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
layout = wibox.layout.align.vertical
|
||||
nil,
|
||||
layout = wibox.layout.align.vertical,
|
||||
expand = "none"
|
||||
},
|
||||
spacing = dpi(50),
|
||||
{
|
||||
profile_name,
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
nil
|
||||
}
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
{
|
||||
nil,
|
||||
{
|
||||
{
|
||||
shutdown_button,
|
||||
reboot_button,
|
||||
logout_button,
|
||||
lock_button,
|
||||
suspend_button,
|
||||
spacing = dpi(30),
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
margins = dpi(0),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
nil,
|
||||
expand = "none",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
layout = wibox.layout.align.vertical
|
||||
},
|
||||
nil
|
||||
}
|
||||
|
||||
-- Container for the widget, covers the entire screen
|
||||
local powermenu_container = wibox {
|
||||
widget = powermenu,
|
||||
screen = s,
|
||||
type = "splash",
|
||||
visible = false,
|
||||
ontop = true,
|
||||
bg = "#21212188",
|
||||
height = s.geometry.height,
|
||||
width = s.geometry.width,
|
||||
x = s.geometry.x,
|
||||
y = s.geometry.y
|
||||
}
|
||||
-- Container for the widget, covers the entire screen
|
||||
local powermenu_container = wibox {
|
||||
widget = powermenu,
|
||||
screen = s,
|
||||
type = "splash",
|
||||
visible = false,
|
||||
ontop = true,
|
||||
bg = "#21212188",
|
||||
height = s.geometry.height,
|
||||
width = s.geometry.width,
|
||||
x = s.geometry.x,
|
||||
y = s.geometry.y
|
||||
}
|
||||
|
||||
-- Close on rightclick
|
||||
powermenu_container:buttons(
|
||||
gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function()
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
-- Close on Escape
|
||||
local powermenu_keygrabber = awful.keygrabber {
|
||||
autostart = false,
|
||||
stop_event = 'release',
|
||||
keypressed_callback = function(self, mod, key, command)
|
||||
if key == 'Escape' then
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
-- Signals
|
||||
awesome.connect_signal(
|
||||
"module::powermenu:show",
|
||||
-- Close on rightclick
|
||||
powermenu_container:buttons(
|
||||
gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function()
|
||||
if s == mouse.screen then
|
||||
powermenu_container.visible = true
|
||||
powermenu_keygrabber:start()
|
||||
end
|
||||
end
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::powermenu:hide",
|
||||
function()
|
||||
powermenu_keygrabber:stop()
|
||||
powermenu_container.visible = false
|
||||
end
|
||||
)
|
||||
-- Close on Escape
|
||||
local powermenu_keygrabber = awful.keygrabber {
|
||||
autostart = false,
|
||||
stop_event = 'release',
|
||||
keypressed_callback = function(self, mod, key, command)
|
||||
if key == 'Escape' then
|
||||
awesome.emit_signal("module::powermenu:hide")
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
-- Signals
|
||||
awesome.connect_signal(
|
||||
"module::powermenu:show",
|
||||
function()
|
||||
if s == mouse.screen then
|
||||
powermenu_container.visible = true
|
||||
powermenu_keygrabber:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"module::powermenu:hide",
|
||||
function()
|
||||
powermenu_keygrabber:stop()
|
||||
powermenu_container.visible = false
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
@@ -17,235 +17,236 @@ awful.titlebar.enable_tooltip = true
|
||||
awful.titlebar.fallback_name = 'Client'
|
||||
|
||||
local double_click_event_handler = function(double_click_event)
|
||||
if double_click_timer then
|
||||
double_click_timer:stop()
|
||||
double_click_timer = nil
|
||||
double_click_event()
|
||||
return
|
||||
end
|
||||
double_click_timer = gears.timer.start_new(
|
||||
0.20,
|
||||
function()
|
||||
double_click_timer = nil
|
||||
return false
|
||||
end
|
||||
)
|
||||
if double_click_timer then
|
||||
double_click_timer:stop()
|
||||
double_click_timer = nil
|
||||
double_click_event()
|
||||
return
|
||||
end
|
||||
double_click_timer = gears.timer.start_new(
|
||||
0.20,
|
||||
function()
|
||||
double_click_timer = nil
|
||||
return false
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local create_click_events = function(c)
|
||||
local buttons = gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
function()
|
||||
double_click_event_handler(function()
|
||||
if c.floating then
|
||||
c.float = false
|
||||
return
|
||||
end
|
||||
c.maximized = not c.maximized
|
||||
c:raise()
|
||||
end)
|
||||
c:activate { context = 'titlebar', action = 'mouse_move' }
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function()
|
||||
c:activate { context = 'titlebar', action = 'mouse_resize' }
|
||||
end
|
||||
)
|
||||
local buttons = gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
function()
|
||||
double_click_event_handler(function()
|
||||
if c.floating then
|
||||
c.float = false
|
||||
return
|
||||
end
|
||||
c.maximized = not c.maximized
|
||||
c:raise()
|
||||
end)
|
||||
c:activate { context = 'titlebar', action = 'mouse_move' }
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function()
|
||||
c:activate { context = 'titlebar', action = 'mouse_resize' }
|
||||
end
|
||||
)
|
||||
return buttons
|
||||
)
|
||||
return buttons
|
||||
end
|
||||
|
||||
local create_titlebar = function(c, bg, size)
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "left",
|
||||
bg = bg,
|
||||
size = size
|
||||
})
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "left",
|
||||
bg = bg,
|
||||
size = size
|
||||
})
|
||||
|
||||
titlebar:setup {
|
||||
titlebar:setup {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
awful.titlebar.widget.closebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color["Red200"],
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "closebutton"
|
||||
},
|
||||
{
|
||||
awful.titlebar.widget.maximizedbutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color["Yellow200"],
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "maximizebutton"
|
||||
},
|
||||
{
|
||||
awful.titlebar.widget.minimizebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color["Green200"],
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "minimizebutton"
|
||||
},
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "spacing"
|
||||
},
|
||||
margins = dpi(8),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
awful.titlebar.widget.closebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color["Red200"],
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "closebutton"
|
||||
},
|
||||
{
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
awful.titlebar.widget.maximizedbutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color["Yellow200"],
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "maximizebutton"
|
||||
},
|
||||
{
|
||||
{
|
||||
widget = awful.widget.clienticon(c)
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
awful.titlebar.widget.minimizebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color["Green200"],
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "minimizebutton"
|
||||
},
|
||||
layout = wibox.layout.align.vertical,
|
||||
id = "main"
|
||||
}
|
||||
Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.maximizebutton, color["Yellow200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"])
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "spacing"
|
||||
},
|
||||
margins = dpi(8),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
{
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
{
|
||||
{
|
||||
widget = awful.widget.clienticon(c)
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.align.vertical,
|
||||
id = "main"
|
||||
}
|
||||
Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.maximizebutton, color["Yellow200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"])
|
||||
end
|
||||
|
||||
local create_titlebar_dialog = function(c, bg, size)
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "left",
|
||||
bg = bg,
|
||||
size = size
|
||||
})
|
||||
local titlebar = awful.titlebar(c, {
|
||||
position = "left",
|
||||
bg = bg,
|
||||
size = size
|
||||
})
|
||||
|
||||
titlebar:setup {
|
||||
titlebar:setup {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
awful.titlebar.widget.closebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color["Red200"],
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "closebutton"
|
||||
},
|
||||
{
|
||||
awful.titlebar.widget.minimizebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color["Green200"],
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "minimizebutton"
|
||||
},
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "spacing"
|
||||
},
|
||||
margins = dpi(8),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
awful.titlebar.widget.closebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color["Red200"],
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "closebutton"
|
||||
},
|
||||
{
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
awful.titlebar.widget.minimizebutton(c),
|
||||
widget = wibox.container.background,
|
||||
bg = color["Green200"],
|
||||
shape = function(cr, height, width)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
id = "minimizebutton"
|
||||
},
|
||||
{
|
||||
{
|
||||
widget = awful.widget.clienticon(c)
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.align.vertical,
|
||||
id = "main"
|
||||
}
|
||||
Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"])
|
||||
spacing = dpi(10),
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "spacing"
|
||||
},
|
||||
margins = dpi(8),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
{
|
||||
buttons = create_click_events(c),
|
||||
layout = wibox.layout.flex.vertical
|
||||
},
|
||||
{
|
||||
{
|
||||
widget = awful.widget.clienticon(c)
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.align.vertical,
|
||||
id = "main"
|
||||
}
|
||||
Hover_signal(titlebar.main.margin.spacing.closebutton, color["Red200"])
|
||||
Hover_signal(titlebar.main.margin.spacing.minimizebutton, color["Green200"])
|
||||
end
|
||||
|
||||
local draw_titlebar = function(c)
|
||||
if c.type == 'normal' and not c.requests_no_titlebar then
|
||||
if c.class == 'Firefox' then
|
||||
create_titlebar(c, '#121212AA', 35)
|
||||
elseif c.name == "Steam" then
|
||||
create_titlebar(c, '#121212AA', 0)
|
||||
elseif c.name == "Settings" then
|
||||
create_titlebar(c, '#121212AA', 0)
|
||||
elseif c.class == "gcr-prompter" or c.class == "Gcr-prompter" then
|
||||
create_titlebar(c, '#121212AA', 0)
|
||||
else
|
||||
create_titlebar(c, '#121212AA', 35)
|
||||
end
|
||||
elseif c.type == 'dialog' then
|
||||
create_titlebar_dialog(c, '#121212AA', 35)
|
||||
if c.type == 'normal' and not c.requests_no_titlebar then
|
||||
if c.class == 'Firefox' then
|
||||
create_titlebar(c, '#121212AA', 35)
|
||||
elseif c.name == "Steam" then
|
||||
create_titlebar(c, '#121212AA', 0)
|
||||
elseif c.name == "Settings" then
|
||||
create_titlebar(c, '#121212AA', 0)
|
||||
elseif c.class == "gcr-prompter" or c.class == "Gcr-prompter" then
|
||||
create_titlebar(c, '#121212AA', 0)
|
||||
else
|
||||
create_titlebar(c, '#121212AA', 35)
|
||||
end
|
||||
elseif c.type == 'dialog' then
|
||||
create_titlebar_dialog(c, '#121212AA', 35)
|
||||
end
|
||||
end
|
||||
|
||||
client.connect_signal(
|
||||
"property::maximized",
|
||||
function(c)
|
||||
if c.maximized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
|
||||
elseif not c.minimized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
|
||||
end
|
||||
end
|
||||
"property::maximized",
|
||||
function(c)
|
||||
if c.maximized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
|
||||
elseif not c.minimized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
"request::titlebars",
|
||||
function(c)
|
||||
if c.maximized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
|
||||
elseif not c.minimized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
|
||||
end
|
||||
draw_titlebar(c)
|
||||
if not c.floating or c.maximized then
|
||||
awful.titlebar.hide(c, 'left')
|
||||
awful.titlebar.hide(c, 'right')
|
||||
awful.titlebar.hide(c, 'top')
|
||||
awful.titlebar.hide(c, 'bottom')
|
||||
end
|
||||
end
|
||||
"request::titlebars",
|
||||
function(c)
|
||||
if c.maximized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "unmaximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "unmaximize.svg"
|
||||
draw_titlebar(c)
|
||||
elseif not c.minimized then
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_active = icondir .. "maximize.svg"
|
||||
Theme.titlebar_maximized_button_inactive = icondir .. "maximize.svg"
|
||||
draw_titlebar(c)
|
||||
end
|
||||
if not c.floating or c.maximized then
|
||||
awful.titlebar.hide(c, 'left')
|
||||
awful.titlebar.hide(c, 'right')
|
||||
awful.titlebar.hide(c, 'top')
|
||||
awful.titlebar.hide(c, 'bottom')
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
client.connect_signal(
|
||||
'property::floating',
|
||||
function(c)
|
||||
if c.floating or (c.floating and c.maximized) then
|
||||
awful.titlebar.show(c, 'left')
|
||||
awful.titlebar.hide(c, 'right')
|
||||
awful.titlebar.hide(c, 'top')
|
||||
awful.titlebar.hide(c, 'bottom')
|
||||
else
|
||||
awful.titlebar.hide(c, 'left')
|
||||
awful.titlebar.hide(c, 'right')
|
||||
awful.titlebar.hide(c, 'top')
|
||||
awful.titlebar.hide(c, 'bottom')
|
||||
end
|
||||
end
|
||||
'property::floating',
|
||||
function(c)
|
||||
if c.floating or (c.floating and c.maximized) then
|
||||
awful.titlebar.show(c, 'left')
|
||||
awful.titlebar.hide(c, 'right')
|
||||
awful.titlebar.hide(c, 'top')
|
||||
awful.titlebar.hide(c, 'bottom')
|
||||
else
|
||||
awful.titlebar.hide(c, 'left')
|
||||
awful.titlebar.hide(c, 'right')
|
||||
awful.titlebar.hide(c, 'top')
|
||||
awful.titlebar.hide(c, 'bottom')
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
792
awesome/src/modules/volume_controller.lua
Normal file
@@ -0,0 +1,792 @@
|
||||
-----------------------------------
|
||||
-- This is the volume controller --
|
||||
-----------------------------------
|
||||
|
||||
-- Awesome Libs
|
||||
local awful = require("awful")
|
||||
local color = require("src.theme.colors")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local wibox = require("wibox")
|
||||
require("src.core.signals")
|
||||
|
||||
-- Icon directory path
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
|
||||
|
||||
-- Returns the volume controller
|
||||
return function(s)
|
||||
|
||||
local function create_device(name, node, sink)
|
||||
local device = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
image = "",
|
||||
id = "icon",
|
||||
resize = false,
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
{
|
||||
text = name,
|
||||
id = "node",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "device_layout",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
id = "device_margin",
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "background",
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
if sink == true then
|
||||
device:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awful.spawn.spawn("./.config/awesome/src/scripts/vol.sh set_sink " .. node)
|
||||
|
||||
awesome.emit_signal("update::background:vol", node)
|
||||
end
|
||||
)
|
||||
|
||||
--#region Signal Functions
|
||||
local old_wibox, old_cursor, old_bg, old_fg
|
||||
local bg = ""
|
||||
local fg = ""
|
||||
local mouse_enter = function()
|
||||
if bg then
|
||||
old_bg = device.background.bg
|
||||
device.background.bg = bg .. 'dd'
|
||||
end
|
||||
if fg then
|
||||
old_fg = device.background.fg
|
||||
device.background.fg = fg
|
||||
end
|
||||
local w = mouse.current_wibox
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
end
|
||||
|
||||
local button_press = function()
|
||||
if bg then
|
||||
if bg then
|
||||
if string.len(bg) == 7 then
|
||||
device.background.bg = bg .. 'bb'
|
||||
else
|
||||
device.background.bg = bg
|
||||
end
|
||||
end
|
||||
end
|
||||
if fg then
|
||||
device.background.fg = fg
|
||||
end
|
||||
end
|
||||
|
||||
local button_release = function()
|
||||
if bg then
|
||||
if bg then
|
||||
if string.len(bg) == 7 then
|
||||
device.background.bg = bg .. 'dd'
|
||||
else
|
||||
device.background.bg = bg
|
||||
end
|
||||
end
|
||||
end
|
||||
if fg then
|
||||
device.background.fg = fg
|
||||
end
|
||||
end
|
||||
|
||||
local mouse_leave = function()
|
||||
if bg then
|
||||
device.background.bg = old_bg
|
||||
end
|
||||
if fg then
|
||||
device.background.fg = old_fg
|
||||
end
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end
|
||||
end
|
||||
|
||||
device:connect_signal(
|
||||
"mouse::enter",
|
||||
mouse_enter
|
||||
)
|
||||
|
||||
device:connect_signal(
|
||||
"button::press",
|
||||
button_press
|
||||
)
|
||||
|
||||
device:connect_signal(
|
||||
"button::release",
|
||||
button_release
|
||||
)
|
||||
|
||||
device:connect_signal(
|
||||
"mouse::leave",
|
||||
mouse_leave
|
||||
)
|
||||
--#endregion
|
||||
|
||||
awesome.connect_signal(
|
||||
"update::background:vol",
|
||||
function(new_node)
|
||||
if node == new_node then
|
||||
old_bg = color["Purple200"]
|
||||
old_fg = color["Grey900"]
|
||||
bg = color["Purple200"]
|
||||
fg = color["Grey900"]
|
||||
device.background:set_bg(color["Purple200"])
|
||||
device.background:set_fg(color["Grey900"])
|
||||
else
|
||||
fg = color["Purple200"]
|
||||
bg = color["Grey700"]
|
||||
device.background:set_fg(color["Purple200"])
|
||||
device.background:set_bg(color["Grey700"])
|
||||
end
|
||||
end
|
||||
)
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ pactl get-default-sink ]],
|
||||
function(stdout)
|
||||
local node_active = stdout:gsub("\n", "")
|
||||
if node == node_active then
|
||||
bg = color["Purple200"]
|
||||
fg = color["Grey900"]
|
||||
device.background:set_bg(color["Purple200"])
|
||||
device.background:set_fg(color["Grey900"])
|
||||
else
|
||||
fg = color["Purple200"]
|
||||
bg = color["Grey700"]
|
||||
device.background:set_fg(color["Purple200"])
|
||||
device.background:set_bg(color["Grey700"])
|
||||
end
|
||||
end
|
||||
)
|
||||
else
|
||||
|
||||
device:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awful.spawn.spawn("./.config/awesome/src/scripts/mic.sh set_source " .. node)
|
||||
|
||||
awesome.emit_signal("update::background:mic", node)
|
||||
end
|
||||
)
|
||||
|
||||
--#region Signal Functions
|
||||
local old_wibox, old_cursor, old_bg, old_fg
|
||||
local bg = ""
|
||||
local fg = ""
|
||||
local mouse_enter = function()
|
||||
if bg then
|
||||
old_bg = device.background.bg
|
||||
device.background.bg = bg .. 'dd'
|
||||
end
|
||||
if fg then
|
||||
old_fg = device.background.fg
|
||||
device.background.fg = fg
|
||||
end
|
||||
local w = mouse.current_wibox
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
end
|
||||
|
||||
local button_press = function()
|
||||
if bg then
|
||||
if bg then
|
||||
if string.len(bg) == 7 then
|
||||
device.background.bg = bg .. 'bb'
|
||||
else
|
||||
device.background.bg = bg
|
||||
end
|
||||
end
|
||||
end
|
||||
if fg then
|
||||
device.background.fg = fg
|
||||
end
|
||||
end
|
||||
|
||||
local button_release = function()
|
||||
if bg then
|
||||
if bg then
|
||||
if string.len(bg) == 7 then
|
||||
device.background.bg = bg .. 'dd'
|
||||
else
|
||||
device.background.bg = bg
|
||||
end
|
||||
end
|
||||
end
|
||||
if fg then
|
||||
device.background.fg = fg
|
||||
end
|
||||
end
|
||||
|
||||
local mouse_leave = function()
|
||||
if bg then
|
||||
device.background.bg = old_bg
|
||||
end
|
||||
if fg then
|
||||
device.background.fg = old_fg
|
||||
end
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end
|
||||
end
|
||||
|
||||
device:connect_signal(
|
||||
"mouse::enter",
|
||||
mouse_enter
|
||||
)
|
||||
|
||||
device:connect_signal(
|
||||
"button::press",
|
||||
button_press
|
||||
)
|
||||
|
||||
device:connect_signal(
|
||||
"button::release",
|
||||
button_release
|
||||
)
|
||||
|
||||
device:connect_signal(
|
||||
"mouse::leave",
|
||||
mouse_leave
|
||||
)
|
||||
--#endregion
|
||||
|
||||
awesome.connect_signal(
|
||||
"update::background:mic",
|
||||
function(new_node)
|
||||
if node == new_node then
|
||||
old_bg = color["Blue200"]
|
||||
old_fg = color["Grey900"]
|
||||
bg = color["Blue200"]
|
||||
fg = color["Grey900"]
|
||||
device.background:set_bg(color["Blue200"])
|
||||
device.background:set_fg(color["Grey900"])
|
||||
else
|
||||
fg = color["Blue200"]
|
||||
bg = color["Grey700"]
|
||||
device.background:set_fg(color["Blue200"])
|
||||
device.background:set_bg(color["Grey700"])
|
||||
end
|
||||
end
|
||||
)
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ pactl get-default-source ]],
|
||||
function(stdout)
|
||||
local node_active = stdout:gsub("\n", "")
|
||||
if node == node_active then
|
||||
bg = color["Blue200"]
|
||||
fg = color["Grey900"]
|
||||
device.background:set_bg(color["Blue200"])
|
||||
device.background:set_fg(color["Grey900"])
|
||||
else
|
||||
fg = color["Blue200"]
|
||||
bg = color["Grey700"]
|
||||
device.background:set_fg(color["Blue200"])
|
||||
device.background:set_bg(color["Grey700"])
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
return device
|
||||
end
|
||||
|
||||
local dropdown_list_volume = wibox.widget {
|
||||
{
|
||||
{
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "volume_device_list"
|
||||
},
|
||||
id = "volume_device_background",
|
||||
bg = color["Grey800"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
left = dpi(10),
|
||||
right = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
local dropdown_list_microphone = wibox.widget {
|
||||
{
|
||||
{
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
id = "volume_device_list"
|
||||
},
|
||||
id = "volume_device_background",
|
||||
bg = color["Grey800"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.partially_rounded_rect(cr, width, height, false, false, true, true, 4)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
left = dpi(10),
|
||||
right = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
local volume_controller = wibox.widget {
|
||||
{
|
||||
{
|
||||
-- Audio Device selector
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
resize = false,
|
||||
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["Purple200"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
id = "icon"
|
||||
},
|
||||
id = "center",
|
||||
halign = "center",
|
||||
valign = "center",
|
||||
widget = wibox.container.place,
|
||||
},
|
||||
{
|
||||
{
|
||||
text = "Output Device",
|
||||
widget = wibox.widget.textbox,
|
||||
id = "device_name"
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "audio_volume",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "audio_bg",
|
||||
bg = color["Grey800"],
|
||||
fg = color["Purple200"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
id = "audio_selector_margin",
|
||||
left = dpi(10),
|
||||
right = dpi(10),
|
||||
top = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
id = "volume_list",
|
||||
widget = dropdown_list_volume,
|
||||
visible = false
|
||||
},
|
||||
-- Microphone selector
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
resize = false,
|
||||
image = gears.color.recolor_image(icondir .. "menu-down.svg", color["LightBlueA200"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
id = "icon",
|
||||
},
|
||||
id = "center",
|
||||
halign = "center",
|
||||
valign = "center",
|
||||
widget = wibox.container.place,
|
||||
},
|
||||
{
|
||||
{
|
||||
text = "Input Device",
|
||||
widget = wibox.widget.textbox,
|
||||
id = "device_name"
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "mic_volume",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "mic_bg",
|
||||
bg = color["Grey800"],
|
||||
fg = color["LightBlueA200"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
},
|
||||
id = "mic_selector_margin",
|
||||
left = dpi(10),
|
||||
right = dpi(10),
|
||||
top = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
{
|
||||
id = "mic_list",
|
||||
widget = dropdown_list_microphone,
|
||||
visible = false
|
||||
},
|
||||
-- Audio volume slider
|
||||
{
|
||||
{
|
||||
{
|
||||
resize = false,
|
||||
widget = wibox.widget.imagebox,
|
||||
image = gears.color.recolor_image(icondir .. "volume-high.svg", color["Purple200"]),
|
||||
id = "icon",
|
||||
},
|
||||
{
|
||||
{
|
||||
bar_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
bar_height = dpi(5),
|
||||
bar_color = color["Grey800"],
|
||||
bar_active_color = color["Purple200"],
|
||||
handle_color = color["Purple200"],
|
||||
handle_shape = gears.shape.circle,
|
||||
handle_border_color = color["Purple200"],
|
||||
handle_width = dpi(15),
|
||||
maximum = 100,
|
||||
forced_height = dpi(26),
|
||||
widget = wibox.widget.slider,
|
||||
id = "slider"
|
||||
},
|
||||
bottom = dpi(12),
|
||||
left = dpi(5),
|
||||
id = "slider_margin",
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "audio_volume",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
id = "audio_volume_margin",
|
||||
top = dpi(10),
|
||||
left = dpi(10),
|
||||
right = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
-- Microphone volume slider
|
||||
{
|
||||
{
|
||||
{
|
||||
resize = false,
|
||||
widget = wibox.widget.imagebox,
|
||||
image = gears.color.recolor_image(icondir .. "microphone.svg", color["Blue200"]),
|
||||
id = "icon"
|
||||
},
|
||||
{
|
||||
{
|
||||
bar_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
bar_height = dpi(5),
|
||||
bar_color = color["Grey800"],
|
||||
bar_active_color = color["Blue200"],
|
||||
handle_color = color["Blue200"],
|
||||
handle_shape = gears.shape.circle,
|
||||
handle_border_color = color["Blue200"],
|
||||
handle_width = dpi(15),
|
||||
maximum = 100,
|
||||
forced_height = dpi(26),
|
||||
widget = wibox.widget.slider,
|
||||
id = "slider"
|
||||
},
|
||||
left = dpi(5),
|
||||
id = "slider_margin",
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "mic_volume",
|
||||
layout = wibox.layout.align.horizontal
|
||||
},
|
||||
id = "mic_volume_margin",
|
||||
left = dpi(10),
|
||||
right = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "controller_layout",
|
||||
layout = wibox.layout.fixed.vertical
|
||||
},
|
||||
id = "controller_margin",
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Grey900"],
|
||||
border_color = color["Grey800"],
|
||||
border_width = dpi(4),
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 12)
|
||||
end,
|
||||
forced_width = dpi(400),
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
-- Variables for easier access and better readability
|
||||
local audio_selector_margin = volume_controller:get_children_by_id("audio_selector_margin")[1]
|
||||
local volume_list = volume_controller:get_children_by_id("volume_list")[1]
|
||||
local audio_bg = volume_controller:get_children_by_id("audio_bg")[1]
|
||||
local audio_volume = volume_controller:get_children_by_id("audio_volume")[1].center
|
||||
|
||||
-- Click event for the audio dropdown
|
||||
audio_selector_margin:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
volume_list.visible = not volume_list.visible
|
||||
if volume_list.visible then
|
||||
audio_bg.shape = function(cr, width, height)
|
||||
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
|
||||
end
|
||||
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"]))
|
||||
else
|
||||
audio_bg.shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"]))
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
-- Variables for easier access and better readability
|
||||
local mic_selector_margin = volume_controller:get_children_by_id("mic_selector_margin")[1]
|
||||
local mic_list = volume_controller:get_children_by_id("mic_list")[1]
|
||||
local mic_bg = volume_controller:get_children_by_id("mic_bg")[1]
|
||||
local mic_volume = volume_controller:get_children_by_id("mic_volume")[1].center
|
||||
|
||||
-- Click event for the microphone dropdown
|
||||
mic_selector_margin:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
mic_list.visible = not mic_list.visible
|
||||
if mic_list.visible then
|
||||
mic_selector_margin.mic_bg.shape = function(cr, width, height)
|
||||
gears.shape.partially_rounded_rect(cr, width, height, true, true, false, false, 4)
|
||||
end
|
||||
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-up.svg", color["Teal200"]))
|
||||
else
|
||||
mic_bg.shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 4)
|
||||
end
|
||||
mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "menu-down.svg", color["Teal200"]))
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
local audio_slider_margin = volume_controller:get_children_by_id("audio_volume_margin")[1].audio_volume.slider_margin.slider
|
||||
|
||||
-- Volume slider change event
|
||||
audio_slider_margin:connect_signal(
|
||||
"property::value",
|
||||
function()
|
||||
local volume = audio_slider_margin.value
|
||||
awful.spawn("pactl set-sink-volume @DEFAULT_SINK@ " .. tonumber(volume) .. "%")
|
||||
end
|
||||
)
|
||||
|
||||
local mic_slider_margin = volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider
|
||||
|
||||
-- Microphone slider change event
|
||||
mic_slider_margin:connect_signal(
|
||||
"property::value",
|
||||
function()
|
||||
local volume = mic_slider_margin.value
|
||||
awful.spawn("pactl set-source-volume @DEFAULT_SOURCE@ " .. tonumber(volume) .. "%")
|
||||
awesome.emit_signal("get::mic_volume", volume)
|
||||
end
|
||||
)
|
||||
|
||||
-- Main container
|
||||
local volume_controller_container = awful.popup {
|
||||
widget = wibox.container.background,
|
||||
ontop = true,
|
||||
bg = color["Grey900"],
|
||||
stretch = false,
|
||||
visible = false,
|
||||
screen = s,
|
||||
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(305), top = dpi(60) } }) end,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 12)
|
||||
end
|
||||
}
|
||||
|
||||
-- Get all audio devices from all sinks
|
||||
local function get_devices()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ pactl list sinks | grep -E 'node.name|alsa.card_name' | awk '{gsub(/"/, ""); for(i = 3;i < NF;i++) printf $i " "; print $NF}' ]],
|
||||
|
||||
function(stdout)
|
||||
local i, j = 1, 1
|
||||
local device_list = { layout = wibox.layout.fixed.vertical }
|
||||
|
||||
local node_names, alsa_names = {}, {}
|
||||
for node_name in stdout:gmatch("[^\n]+") do
|
||||
if (i % 2) == 0 then
|
||||
table.insert(node_names, node_name)
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
for alsa_name in stdout:gmatch("[^\n]+") do
|
||||
if (j % 2) == 1 then
|
||||
table.insert(alsa_names, alsa_name)
|
||||
end
|
||||
j = j + 1
|
||||
end
|
||||
|
||||
for k = 1, #alsa_names, 1 do
|
||||
device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], true)
|
||||
end
|
||||
dropdown_list_volume.volume_device_background.volume_device_list.children = device_list
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
get_devices()
|
||||
|
||||
-- Get all input devices from all sources
|
||||
local function get_input_devices()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ pactl list sources | grep -E "node.name|alsa.card_name" | awk '{gsub(/"/, ""); for(i = 3;i < NF;i++) printf $i " "; print $NF}' ]],
|
||||
|
||||
function(stdout)
|
||||
local i, j = 1, 1
|
||||
local device_list = { layout = wibox.layout.fixed.vertical }
|
||||
|
||||
local node_names, alsa_names = {}, {}
|
||||
for node_name in stdout:gmatch("[^\n]+") do
|
||||
if (i % 2) == 0 then
|
||||
table.insert(node_names, node_name)
|
||||
end
|
||||
i = i + 1
|
||||
end
|
||||
|
||||
for alsa_name in stdout:gmatch("[^\n]+") do
|
||||
if (j % 2) == 1 then
|
||||
table.insert(alsa_names, alsa_name)
|
||||
end
|
||||
j = j + 1
|
||||
end
|
||||
|
||||
for k = 1, #alsa_names, 1 do
|
||||
device_list[#device_list + 1] = create_device(alsa_names[k], node_names[k], false)
|
||||
end
|
||||
dropdown_list_microphone.volume_device_background.volume_device_list.children = device_list
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
get_input_devices()
|
||||
|
||||
-- Get microphone volume
|
||||
local function get_mic_volume()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"./.config/awesome/src/scripts/mic.sh volume",
|
||||
function(stdout)
|
||||
local volume = stdout:gsub("%%", ""):gsub("\n", "")
|
||||
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(volume))
|
||||
if volume > 0 then
|
||||
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone.svg", color["LightBlue200"]))
|
||||
else
|
||||
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
get_mic_volume()
|
||||
|
||||
-- Check if microphone is muted
|
||||
local function get_mic_mute()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"./.config/awesome/src/scripts/mic.sh mute",
|
||||
function(stdout)
|
||||
if stdout:match("yes") then
|
||||
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.slider_margin.slider:set_value(tonumber(0))
|
||||
volume_controller:get_children_by_id("mic_volume_margin")[1].icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
|
||||
else
|
||||
get_mic_volume()
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
get_mic_mute()
|
||||
|
||||
volume_controller_container:setup {
|
||||
volume_controller,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
}
|
||||
|
||||
-- Global signal called from src.widgets.audio.lua
|
||||
awesome.connect_signal(
|
||||
"get::volume",
|
||||
function(volume)
|
||||
volume = tonumber(volume)
|
||||
local icon = icondir .. "volume"
|
||||
if volume < 1 then
|
||||
icon = icon .. "-mute"
|
||||
|
||||
elseif volume >= 1 and volume < 34 then
|
||||
icon = icon .. "-low"
|
||||
elseif volume >= 34 and volume < 67 then
|
||||
icon = icon .. "-medium"
|
||||
elseif volume >= 67 then
|
||||
icon = icon .. "-high"
|
||||
end
|
||||
|
||||
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.slider_margin.slider:set_value(volume)
|
||||
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Purple200"]))
|
||||
end
|
||||
)
|
||||
|
||||
-- Global signal called from src.widgets.audio.lua
|
||||
awesome.connect_signal(
|
||||
"get::volume_mute",
|
||||
function(mute)
|
||||
if mute then
|
||||
volume_controller.controller_margin.controller_layout.audio_volume_margin.audio_volume.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute.svg", color["Purple200"]))
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"get::mic_volume",
|
||||
function(volume)
|
||||
if volume > 0 then
|
||||
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "microphone.svg", color["LightBlue200"]))
|
||||
else
|
||||
volume_controller:get_children_by_id("mic_volume_margin")[1].mic_volume.icon:set_image(gears.color.recolor_image(icondir .. "microphone-off.svg", color["LightBlue200"]))
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
-- Toggle container visibility
|
||||
awesome.connect_signal(
|
||||
"volume_controller::toggle",
|
||||
function(scr)
|
||||
if scr == s then
|
||||
volume_controller_container.visible = not volume_controller_container.visible
|
||||
end
|
||||
|
||||
end
|
||||
)
|
||||
|
||||
end
|
||||
27
awesome/src/scripts/mic.sh
Executable file
@@ -0,0 +1,27 @@
|
||||
#!/bin/bash
|
||||
|
||||
SINK=$(LC_ALL=C pactl get-default-source)
|
||||
|
||||
case $1 in
|
||||
|
||||
"volume")
|
||||
echo $(LC_ALL=C pactl get-source-volume $SINK | awk '{print $5}')
|
||||
;;
|
||||
|
||||
"mute")
|
||||
echo $(LC_ALL=C pactl get-source-mute $SINK)
|
||||
;;
|
||||
|
||||
"toggle_mute")
|
||||
$(LC_ALL=C pactl set-source-mute $SINK toggle)
|
||||
;;
|
||||
|
||||
"set_volume")
|
||||
$(LC_ALL=C pactl set-source-volume $SINK $2)
|
||||
;;
|
||||
|
||||
"set_source")
|
||||
$(LC_ALL=C pactl set-default-source $2)
|
||||
;;
|
||||
|
||||
esac
|
||||
@@ -2,10 +2,17 @@
|
||||
|
||||
SINK=$(LC_ALL=C pactl get-default-sink)
|
||||
|
||||
if [[ $1 == "volume" ]]
|
||||
then
|
||||
echo $(LC_ALL=C pactl get-sink-volume $SINK | awk '{print $5}')
|
||||
elif [[ $1 == "mute" ]]
|
||||
then
|
||||
echo $(LC_ALL=C pactl get-sink-mute $SINK)
|
||||
fi
|
||||
case $1 in
|
||||
|
||||
"volume")
|
||||
echo $(LC_ALL=C pactl get-sink-volume $SINK | awk '{print $5}')
|
||||
;;
|
||||
|
||||
"mute")
|
||||
echo $(LC_ALL=C pactl get-sink-mute $SINK)
|
||||
;;
|
||||
|
||||
"set_sink")
|
||||
$(LC_ALL=C pactl set-default-sink $2)
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -3,193 +3,209 @@
|
||||
-----------------------------------------------------
|
||||
|
||||
return {
|
||||
['White'] = '#ffffffdd',
|
||||
['Black'] = '#000000',
|
||||
['White'] = '#ffffffdd',
|
||||
['Black'] = '#000000',
|
||||
|
||||
['Grey50'] = '#fafafa',
|
||||
['Grey100'] = '#f5f5f5',
|
||||
['Grey200'] = '#eeeeee',
|
||||
['Grey300'] = '#e0e0e0',
|
||||
['Grey400'] = '#bdbdbd',
|
||||
['Grey500'] = '#9e9e9e',
|
||||
['Grey600'] = '#757575',
|
||||
['Grey700'] = '#616161',
|
||||
['Grey800'] = '#424242',
|
||||
['Grey900'] = '#212121',
|
||||
['Grey50'] = '#fafafa',
|
||||
['Grey100'] = '#f5f5f5',
|
||||
['Grey200'] = '#eeeeee',
|
||||
['Grey300'] = '#e0e0e0',
|
||||
['Grey400'] = '#bdbdbd',
|
||||
['Grey500'] = '#9e9e9e',
|
||||
['Grey600'] = '#757575',
|
||||
['Grey700'] = '#616161',
|
||||
['Grey800'] = '#424242',
|
||||
['Grey900'] = '#212121',
|
||||
|
||||
['Red50'] = '#ffebee',
|
||||
['Red100'] = '#ffcdd2',
|
||||
['Red200'] = '#ef9a9a',
|
||||
['Red300'] = '#e57373',
|
||||
['Red400'] = '#ef5350',
|
||||
['Red500'] = '#f44336',
|
||||
['Red600'] = '#e53935',
|
||||
['Red700'] = '#d32f2f',
|
||||
['Red800'] = '#c62828',
|
||||
['Red900'] = '#b71c1c',
|
||||
['RedA100'] = '#ff8a80',
|
||||
['RedA200'] = '#ff5252',
|
||||
['RedA400'] = '#ff1744',
|
||||
['RedA700'] = '#d50000',
|
||||
['Red50'] = '#ffebee',
|
||||
['Red100'] = '#ffcdd2',
|
||||
['Red200'] = '#ef9a9a',
|
||||
['Red300'] = '#e57373',
|
||||
['Red400'] = '#ef5350',
|
||||
['Red500'] = '#f44336',
|
||||
['Red600'] = '#e53935',
|
||||
['Red700'] = '#d32f2f',
|
||||
['Red800'] = '#c62828',
|
||||
['Red900'] = '#b71c1c',
|
||||
['RedA100'] = '#ff8a80',
|
||||
['RedA200'] = '#ff5252',
|
||||
['RedA400'] = '#ff1744',
|
||||
['RedA700'] = '#d50000',
|
||||
|
||||
['Pink50'] = '#fce4ec',
|
||||
['Pink100'] = '#f8bbd0',
|
||||
['Pink200'] = '#f48fb1',
|
||||
['Pink300'] = '#f06292',
|
||||
['Pink400'] = '#ec407a',
|
||||
['Pink500'] = '#e91e63',
|
||||
['Pink600'] = '#d81b60',
|
||||
['Pink700'] = '#c2185b',
|
||||
['Pink800'] = '#ad1457',
|
||||
['Pink900'] = '#880e4f',
|
||||
['PinkA100'] = '#ff80ab',
|
||||
['PinkA200'] = '#ff4081',
|
||||
['PinkA400'] = '#f50057',
|
||||
['PinkA700'] = '#c51162',
|
||||
['Pink50'] = '#fce4ec',
|
||||
['Pink100'] = '#f8bbd0',
|
||||
['Pink200'] = '#f48fb1',
|
||||
['Pink300'] = '#f06292',
|
||||
['Pink400'] = '#ec407a',
|
||||
['Pink500'] = '#e91e63',
|
||||
['Pink600'] = '#d81b60',
|
||||
['Pink700'] = '#c2185b',
|
||||
['Pink800'] = '#ad1457',
|
||||
['Pink900'] = '#880e4f',
|
||||
['PinkA100'] = '#ff80ab',
|
||||
['PinkA200'] = '#ff4081',
|
||||
['PinkA400'] = '#f50057',
|
||||
['PinkA700'] = '#c51162',
|
||||
|
||||
['Blue50'] = '#e3f2fd',
|
||||
['Blue100'] = '#bbdefb',
|
||||
['Blue200'] = '#90caf9',
|
||||
['Blue300'] = '#64b5f6',
|
||||
['Blue400'] = '#42a5f5',
|
||||
['Blue500'] = '#2196f3',
|
||||
['Blue600'] = '#1e88e5',
|
||||
['Blue700'] = '#1976d2',
|
||||
['Blue800'] = '#1565c0',
|
||||
['Blue900'] = '#0d47a1',
|
||||
['BlueA100'] = '#82b1ff',
|
||||
['BlueA200'] = '#448aff',
|
||||
['BlueA400'] = '#2979ff',
|
||||
['BlueA700'] = '#2962ff',
|
||||
['Blue50'] = '#e3f2fd',
|
||||
['Blue100'] = '#bbdefb',
|
||||
['Blue200'] = '#90caf9',
|
||||
['Blue300'] = '#64b5f6',
|
||||
['Blue400'] = '#42a5f5',
|
||||
['Blue500'] = '#2196f3',
|
||||
['Blue600'] = '#1e88e5',
|
||||
['Blue700'] = '#1976d2',
|
||||
['Blue800'] = '#1565c0',
|
||||
['Blue900'] = '#0d47a1',
|
||||
['BlueA100'] = '#82b1ff',
|
||||
['BlueA200'] = '#448aff',
|
||||
['BlueA400'] = '#2979ff',
|
||||
['BlueA700'] = '#2962ff',
|
||||
|
||||
['Yellow50'] = '#fffde7',
|
||||
['Yellow100'] = '#fff9c4',
|
||||
['Yellow200'] = '#fff59d',
|
||||
['Yellow300'] = '#fff176',
|
||||
['Yellow400'] = '#ffee58',
|
||||
['Yellow500'] = '#ffeb3b',
|
||||
['Yellow600'] = '#fdd835',
|
||||
['Yellow700'] = '#fbc02d',
|
||||
['Yellow800'] = '#f9a825',
|
||||
['Yellow900'] = '#f57f17',
|
||||
['YellowA100'] = '#ffff8d',
|
||||
['YellowA200'] = '#ffff00',
|
||||
['YellowA400'] = '#ffea00',
|
||||
['YellowA700'] = '#ffd600',
|
||||
['Yellow50'] = '#fffde7',
|
||||
['Yellow100'] = '#fff9c4',
|
||||
['Yellow200'] = '#fff59d',
|
||||
['Yellow300'] = '#fff176',
|
||||
['Yellow400'] = '#ffee58',
|
||||
['Yellow500'] = '#ffeb3b',
|
||||
['Yellow600'] = '#fdd835',
|
||||
['Yellow700'] = '#fbc02d',
|
||||
['Yellow800'] = '#f9a825',
|
||||
['Yellow900'] = '#f57f17',
|
||||
['YellowA100'] = '#ffff8d',
|
||||
['YellowA200'] = '#ffff00',
|
||||
['YellowA400'] = '#ffea00',
|
||||
['YellowA700'] = '#ffd600',
|
||||
|
||||
['Teal50'] = '#e0f2f1',
|
||||
['Teal100'] = '#b2dfdb',
|
||||
['Teal200'] = '#80cbc4',
|
||||
['Teal300'] = '#4db6ac',
|
||||
['Teal400'] = '#26a69a',
|
||||
['Teal500'] = '#009688',
|
||||
['Teal600'] = '#00897b',
|
||||
['Teal700'] = '#00796b',
|
||||
['Teal800'] = '#00695c',
|
||||
['Teal900'] = '#004d40',
|
||||
['TealA100'] = '#a7ffeb',
|
||||
['TealA200'] = '#64ffda',
|
||||
['TealA400'] = '#1de9b6',
|
||||
['TealA700'] = '#00bfa5',
|
||||
['Teal50'] = '#e0f2f1',
|
||||
['Teal100'] = '#b2dfdb',
|
||||
['Teal200'] = '#80cbc4',
|
||||
['Teal300'] = '#4db6ac',
|
||||
['Teal400'] = '#26a69a',
|
||||
['Teal500'] = '#009688',
|
||||
['Teal600'] = '#00897b',
|
||||
['Teal700'] = '#00796b',
|
||||
['Teal800'] = '#00695c',
|
||||
['Teal900'] = '#004d40',
|
||||
['TealA100'] = '#a7ffeb',
|
||||
['TealA200'] = '#64ffda',
|
||||
['TealA400'] = '#1de9b6',
|
||||
['TealA700'] = '#00bfa5',
|
||||
|
||||
['Green50'] = '#e8f5e9',
|
||||
['Green100'] = '#c8e6c9',
|
||||
['Green200'] = '#a5d6a7',
|
||||
['Green300'] = '#81c784',
|
||||
['Green400'] = '#66bb6a',
|
||||
['Green500'] = '#4caf50',
|
||||
['Green600'] = '#43a047',
|
||||
['Green700'] = '#388e3c',
|
||||
['Green800'] = '#2e7d32',
|
||||
['Green900'] = '#1b5e20',
|
||||
['GreenA100'] = '#b9f6ca',
|
||||
['GreenA200'] = '#69f0ae',
|
||||
['GreenA400'] = '#00e676',
|
||||
['GreenA700'] = '#00c853',
|
||||
['Green50'] = '#e8f5e9',
|
||||
['Green100'] = '#c8e6c9',
|
||||
['Green200'] = '#a5d6a7',
|
||||
['Green300'] = '#81c784',
|
||||
['Green400'] = '#66bb6a',
|
||||
['Green500'] = '#4caf50',
|
||||
['Green600'] = '#43a047',
|
||||
['Green700'] = '#388e3c',
|
||||
['Green800'] = '#2e7d32',
|
||||
['Green900'] = '#1b5e20',
|
||||
['GreenA100'] = '#b9f6ca',
|
||||
['GreenA200'] = '#69f0ae',
|
||||
['GreenA400'] = '#00e676',
|
||||
['GreenA700'] = '#00c853',
|
||||
|
||||
['Orange50'] = '#fff3e0',
|
||||
['Orange100'] = '#ffe0b2',
|
||||
['Orange200'] = '#ffcc80',
|
||||
['Orange300'] = '#ffb74d',
|
||||
['Orange400'] = '#ffa726',
|
||||
['Orange500'] = '#ff9800',
|
||||
['Orange600'] = '#fb8c00',
|
||||
['Orange700'] = '#f57c00',
|
||||
['Orange800'] = '#ef6c00',
|
||||
['Orange900'] = '#e65100',
|
||||
['OrangeA100'] = '#ffd180',
|
||||
['OrangeA200'] = '#ffab40',
|
||||
['OrangeA400'] = '#ff9100',
|
||||
['OrangeA700'] = '#ff6d00',
|
||||
['Orange50'] = '#fff3e0',
|
||||
['Orange100'] = '#ffe0b2',
|
||||
['Orange200'] = '#ffcc80',
|
||||
['Orange300'] = '#ffb74d',
|
||||
['Orange400'] = '#ffa726',
|
||||
['Orange500'] = '#ff9800',
|
||||
['Orange600'] = '#fb8c00',
|
||||
['Orange700'] = '#f57c00',
|
||||
['Orange800'] = '#ef6c00',
|
||||
['Orange900'] = '#e65100',
|
||||
['OrangeA100'] = '#ffd180',
|
||||
['OrangeA200'] = '#ffab40',
|
||||
['OrangeA400'] = '#ff9100',
|
||||
['OrangeA700'] = '#ff6d00',
|
||||
|
||||
['DeepOrange50'] = '#fbe9e7',
|
||||
['DeepOrange100'] = '#ffccbc',
|
||||
['DeepOrange200'] = '#ffab91',
|
||||
['DeepOrange300'] = '#ff8a65',
|
||||
['DeepOrange400'] = '#ff7043',
|
||||
['DeepOrange500'] = '#ff5722',
|
||||
['DeepOrange600'] = '#f4511e',
|
||||
['DeepOrange700'] = '#e64a19',
|
||||
['DeepOrange800'] = '#d84315',
|
||||
['DeepOrange900'] = '#bf360c',
|
||||
['DeepOrangeA100'] = '#ff9e80',
|
||||
['DeepOrangeA200'] = '#ff6e40',
|
||||
['DeepOrangeA400'] = '#ff3d00',
|
||||
['DeepOrangeA700'] = '#dd2c00',
|
||||
['DeepOrange50'] = '#fbe9e7',
|
||||
['DeepOrange100'] = '#ffccbc',
|
||||
['DeepOrange200'] = '#ffab91',
|
||||
['DeepOrange300'] = '#ff8a65',
|
||||
['DeepOrange400'] = '#ff7043',
|
||||
['DeepOrange500'] = '#ff5722',
|
||||
['DeepOrange600'] = '#f4511e',
|
||||
['DeepOrange700'] = '#e64a19',
|
||||
['DeepOrange800'] = '#d84315',
|
||||
['DeepOrange900'] = '#bf360c',
|
||||
['DeepOrangeA100'] = '#ff9e80',
|
||||
['DeepOrangeA200'] = '#ff6e40',
|
||||
['DeepOrangeA400'] = '#ff3d00',
|
||||
['DeepOrangeA700'] = '#dd2c00',
|
||||
|
||||
['Purple50'] = '#F3E5F5',
|
||||
['Purple100'] = '#E1BEE7',
|
||||
['Purple200'] = '#CE93D8',
|
||||
['Purple300'] = '#BA68C8',
|
||||
['Purple400'] = '#AB47BC',
|
||||
['Purple500'] = '#9C27B0',
|
||||
['Purple600'] = '#8E24AA',
|
||||
['Purple700'] = '#7B1FA2',
|
||||
['Purple800'] = '#6A1B9A',
|
||||
['Purple900'] = '#4A148C',
|
||||
['PurpleA100'] = '#EA80FC',
|
||||
['PurpleA200'] = '#E040FB',
|
||||
['PurpleA500'] = '#D500F9',
|
||||
['PurpleA700'] = '#AA00FF',
|
||||
['Purple50'] = '#F3E5F5',
|
||||
['Purple100'] = '#E1BEE7',
|
||||
['Purple200'] = '#CE93D8',
|
||||
['Purple300'] = '#BA68C8',
|
||||
['Purple400'] = '#AB47BC',
|
||||
['Purple500'] = '#9C27B0',
|
||||
['Purple600'] = '#8E24AA',
|
||||
['Purple700'] = '#7B1FA2',
|
||||
['Purple800'] = '#6A1B9A',
|
||||
['Purple900'] = '#4A148C',
|
||||
['PurpleA100'] = '#EA80FC',
|
||||
['PurpleA200'] = '#E040FB',
|
||||
['PurpleA500'] = '#D500F9',
|
||||
['PurpleA700'] = '#AA00FF',
|
||||
|
||||
['DeepPurple50'] = '#EDE7F6',
|
||||
['DeepPurple100'] = '#D1C4E9',
|
||||
['DeepPurple200'] = '#B39DDB',
|
||||
['DeepPurple300'] = '#9575CD',
|
||||
['DeepPurple400'] = '#7E57C2',
|
||||
['DeepPurple500'] = '#673AB7',
|
||||
['DeepPurple600'] = '#5E35B1',
|
||||
['DeepPurple700'] = '#512DA8',
|
||||
['DeepPurple800'] = '#4527A0',
|
||||
['DeepPurple900'] = '#311B92',
|
||||
['DeepPurpleA100'] = '#B388FF',
|
||||
['DeepPurpleA200'] = '#7C4DFF',
|
||||
['DeepPurpleA400'] = '#651FFF',
|
||||
['DeepPurpleA700'] = '#6200EA',
|
||||
['DeepPurple50'] = '#EDE7F6',
|
||||
['DeepPurple100'] = '#D1C4E9',
|
||||
['DeepPurple200'] = '#B39DDB',
|
||||
['DeepPurple300'] = '#9575CD',
|
||||
['DeepPurple400'] = '#7E57C2',
|
||||
['DeepPurple500'] = '#673AB7',
|
||||
['DeepPurple600'] = '#5E35B1',
|
||||
['DeepPurple700'] = '#512DA8',
|
||||
['DeepPurple800'] = '#4527A0',
|
||||
['DeepPurple900'] = '#311B92',
|
||||
['DeepPurpleA100'] = '#B388FF',
|
||||
['DeepPurpleA200'] = '#7C4DFF',
|
||||
['DeepPurpleA400'] = '#651FFF',
|
||||
['DeepPurpleA700'] = '#6200EA',
|
||||
|
||||
['LightBlue50'] = '#E1F5FE',
|
||||
['LightBlue100'] = '#B3E5FC',
|
||||
['LightBlue200'] = '#81D4FA',
|
||||
['LightBlue300'] = '#4FC3F7',
|
||||
['LightBlue400'] = '#29B6F6',
|
||||
['LightBlue500'] = '#03A9F4',
|
||||
['LightBlue600'] = '#039BE5',
|
||||
['LightBlue700'] = '#0288D1',
|
||||
['LightBlue800'] = '#0277BD',
|
||||
['LightBlue900'] = '#01579B',
|
||||
['LightBlueA100'] = '#80D8FF',
|
||||
['LightBlueA200'] = '#40C4FF',
|
||||
['LightBlueA400'] = '#00B0FF',
|
||||
['LightBlueA700'] = '#0091EA',
|
||||
['LightBlue50'] = '#E1F5FE',
|
||||
['LightBlue100'] = '#B3E5FC',
|
||||
['LightBlue200'] = '#81D4FA',
|
||||
['LightBlue300'] = '#4FC3F7',
|
||||
['LightBlue400'] = '#29B6F6',
|
||||
['LightBlue500'] = '#03A9F4',
|
||||
['LightBlue600'] = '#039BE5',
|
||||
['LightBlue700'] = '#0288D1',
|
||||
['LightBlue800'] = '#0277BD',
|
||||
['LightBlue900'] = '#01579B',
|
||||
['LightBlueA100'] = '#80D8FF',
|
||||
['LightBlueA200'] = '#40C4FF',
|
||||
['LightBlueA400'] = '#00B0FF',
|
||||
['LightBlueA700'] = '#0091EA',
|
||||
|
||||
['BlueGrey50'] = '#ECEFF1',
|
||||
['BlueGrey100'] = '#CFD8DC',
|
||||
['BlueGrey200'] = '#B0BEC5',
|
||||
['BlueGrey300'] = '#90A4AE',
|
||||
['BlueGrey400'] = '#78909C',
|
||||
['BlueGrey500'] = '#607D8B',
|
||||
['BlueGrey600'] = '#546E7A',
|
||||
['BlueGrey700'] = '#455A64',
|
||||
['BlueGrey800'] = '#37474F',
|
||||
['BlueGrey900'] = '#263238'
|
||||
['Cyan50'] = '#E0F7FA',
|
||||
['Cyan100'] = '#B2EBF2',
|
||||
['Cyan200'] = '#80DEEA',
|
||||
['Cyan300'] = '#4DD0E1',
|
||||
['Cyan400'] = '#26C6DA',
|
||||
['Cyan500'] = '#00BCD4',
|
||||
['Cyan600'] = '#00ACC1',
|
||||
['Cyan700'] = '#0097A7',
|
||||
['Cyan800'] = '#00838F',
|
||||
['Cyan900'] = '#006064',
|
||||
['CyanA100'] = '#84FFFF',
|
||||
['CyanA200'] = '#18FFFF',
|
||||
['CyanA400'] = '#00E5FF',
|
||||
['CyanA700'] = '#00B8D4',
|
||||
|
||||
|
||||
['BlueGrey50'] = '#ECEFF1',
|
||||
['BlueGrey100'] = '#CFD8DC',
|
||||
['BlueGrey200'] = '#B0BEC5',
|
||||
['BlueGrey300'] = '#90A4AE',
|
||||
['BlueGrey400'] = '#78909C',
|
||||
['BlueGrey500'] = '#607D8B',
|
||||
['BlueGrey600'] = '#546E7A',
|
||||
['BlueGrey700'] = '#455A64',
|
||||
['BlueGrey800'] = '#37474F',
|
||||
['BlueGrey900'] = '#263238'
|
||||
}
|
||||
|
||||
@@ -23,15 +23,14 @@ beautiful.wallpaper = user_vars.wallpaper
|
||||
screen.connect_signal(
|
||||
'request::wallpaper',
|
||||
function(s)
|
||||
-- If wallpaper is a function, call it with the screen
|
||||
if beautiful.wallpaper then
|
||||
if type(beautiful.wallpaper) == 'string' then
|
||||
gears.wallpaper.maximized(beautiful.wallpaper, s)
|
||||
else
|
||||
beautiful.wallpaper(s)
|
||||
end
|
||||
if beautiful.wallpaper then
|
||||
if type(beautiful.wallpaper) == 'string' then
|
||||
gears.wallpaper.maximized(beautiful.wallpaper, s)
|
||||
else
|
||||
beautiful.wallpaper(s)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
beautiful.init(Theme)
|
||||
|
||||
@@ -40,31 +40,22 @@ Theme.menu_fg_focus = color["White"]
|
||||
Theme.menu_border_color = color["Grey800"]
|
||||
Theme.menu_border_width = dpi(0)
|
||||
Theme.menu_shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_rect(cr, width, heigth, 5)
|
||||
gears.shape.rounded_rect(cr, width, heigth, 5)
|
||||
end
|
||||
|
||||
Theme.taglist_fg_focus = color["Grey900"]
|
||||
Theme.taglist_bg_focus = color["White"]
|
||||
|
||||
Theme.tooltip_border_color = color["Grey900"]
|
||||
Theme.tooltip_bg = color["Grey800"]
|
||||
Theme.tooltip_fg = color["White"]
|
||||
Theme.tooltip_border_width = dpi(0)
|
||||
Theme.tooltip_border_color = color["Grey800"]
|
||||
Theme.tooltip_bg = color["Grey900"]
|
||||
Theme.tooltip_fg = color["YellowA200"]
|
||||
Theme.tooltip_border_width = dpi(4)
|
||||
Theme.tooltip_gaps = dpi(15)
|
||||
Theme.tooltip_shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_rect(cr, width, heigth, 5)
|
||||
gears.shape.rounded_rect(cr, width, heigth, 5)
|
||||
end
|
||||
|
||||
Theme.notification_bg = color["Grey900"]
|
||||
Theme.notification_fg = color["White"]
|
||||
Theme.notification_border_width = dpi(0)
|
||||
Theme.notification_border_color = color["Grey900"]
|
||||
Theme.notification_shape = function(cr, width, heigth)
|
||||
gears.shape.rounded_rect(cr, width, heigth, 10)
|
||||
end
|
||||
Theme.notification_margin = dpi(10)
|
||||
Theme.notification_max_width = dpi(400)
|
||||
Theme.notification_max_height = dpi(1000)
|
||||
Theme.notification_icon_size = dpi(40)
|
||||
Theme.notification_spacing = dpi(20)
|
||||
|
||||
Theme.titlebar_close_button_normal = icondir .. "close.svg"
|
||||
Theme.titlebar_maximized_button_normal = icondir .. "maximize.svg"
|
||||
@@ -79,7 +70,7 @@ Theme.hotkeys_bg = color["Grey900"]
|
||||
Theme.hotkeys_fg = color["White"]
|
||||
Theme.hotkeys_border_width = 0
|
||||
Theme.hotkeys_shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end
|
||||
Theme.hotkeys_description_font = user_vars.font.bold
|
||||
|
||||
@@ -87,9 +78,14 @@ Theme.hotkeys_description_font = user_vars.font.bold
|
||||
local layout_path = Theme_path .. "../assets/layout/"
|
||||
|
||||
-- Here are the icons for the layouts defined, if you want to add more layouts go to main/layouts.lua
|
||||
Theme.layout_floating = gears.color.recolor_image(layout_path .. "floating.svg", color["Grey900"])
|
||||
Theme.layout_tile = gears.color.recolor_image(layout_path .. "tile.svg", color["Grey900"])
|
||||
--Theme.layout_dwindle = gears.color.recolor_image(layout_path .. "dwindle.svg", color["Grey900"])
|
||||
--Theme.layout_fairh = gears.color.recolor_image(layout_path .. "fairh.svg", color["Grey900"])
|
||||
--Theme.layout_fullscreen = gears.color.recolor_image(layout_path .. "fullscreen.svg", color["Grey900"])
|
||||
--Theme.layout_max = gears.color.recolor_image(layout_path .. "max.svg", color["Grey900"])
|
||||
Theme.layout_floating = layout_path .. "floating.svg"
|
||||
Theme.layout_tile = layout_path .. "tile.svg"
|
||||
Theme.layout_dwindle = layout_path .. "dwindle.svg"
|
||||
Theme.layout_fairh = layout_path .. "fairh.svg"
|
||||
Theme.layout_fairv = layout_path .. "fairv.svg"
|
||||
Theme.layout_fullscreen = layout_path .. "fullscreen.svg"
|
||||
Theme.layout_max = layout_path .. "max.svg"
|
||||
Theme.layout_cornerne = layout_path .. "cornerne.svg"
|
||||
Theme.layout_cornernw = layout_path .. "cornernw.svg"
|
||||
Theme.layout_cornerse = layout_path .. "cornerse.svg"
|
||||
Theme.layout_cornersw = layout_path .. "cornersw.svg"
|
||||
|
||||
@@ -8,84 +8,98 @@ local home = os.getenv("HOME")
|
||||
-- If you want different default programs, wallpaper path or modkey; edit this file.
|
||||
user_vars = {
|
||||
|
||||
-- Autotiling layouts
|
||||
layouts = {
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.floating,
|
||||
awful.layout.suit.fair,
|
||||
},
|
||||
-- Autotiling layouts
|
||||
layouts = {
|
||||
awful.layout.suit.tile,
|
||||
awful.layout.suit.tile.left,
|
||||
awful.layout.suit.tile.bottom,
|
||||
awful.layout.suit.tile.top,
|
||||
awful.layout.suit.floating,
|
||||
awful.layout.suit.fair,
|
||||
awful.layout.suit.fair.horizontal,
|
||||
awful.layout.suit.corner.nw,
|
||||
awful.layout.suit.corner.ne,
|
||||
awful.layout.suit.corner.sw,
|
||||
awful.layout.suit.corner.se,
|
||||
awful.layout.suit.magnifier,
|
||||
awful.layout.suit.max,
|
||||
awful.layout.suit.max.fullscreen,
|
||||
awful.layout.suit.spiral.dwindle,
|
||||
},
|
||||
|
||||
-- Icon theme from /usr/share/icons
|
||||
icon_theme = "Papirus-Dark",
|
||||
-- Icon theme from /usr/share/icons
|
||||
icon_theme = "Papirus-Dark",
|
||||
|
||||
-- Write the terminal command to start anything here
|
||||
autostart = {
|
||||
"picom --experimental-backends",
|
||||
"xfce4-power-manager",
|
||||
"light-locker --lock-on-suspend --lock-on-lid &",
|
||||
"flatpak run com.spotify.Client",
|
||||
"discord",
|
||||
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1"
|
||||
},
|
||||
-- Write the terminal command to start anything here
|
||||
autostart = {
|
||||
"picom --experimental-backends",
|
||||
"xfce4-power-manager",
|
||||
"light-locker --lock-on-suspend --lock-on-lid &",
|
||||
"flatpak run com.spotify.Client",
|
||||
"discord",
|
||||
"/usr/lib/policykit-1-gnome/polkit-gnome-authentication-agent-1",
|
||||
"setxkbmap -option caps:swapescape"
|
||||
},
|
||||
|
||||
-- Type 'ip a' and check your wlan and ethernet name
|
||||
network = {
|
||||
wlan = "wlo1",
|
||||
ethernet = "eno1"
|
||||
},
|
||||
-- Type 'ip a' and check your wlan and ethernet name
|
||||
network = {
|
||||
wlan = "wlo1",
|
||||
ethernet = "eno1"
|
||||
},
|
||||
|
||||
-- Set your font with this format:
|
||||
font = {
|
||||
regular = "JetBrainsMono Nerd Font, 14",
|
||||
bold = "JetBrainsMono Nerd Font, bold 14",
|
||||
extrabold = "JetBrainsMono Nerd Font, ExtraBold 14"
|
||||
},
|
||||
-- Set your font with this format:
|
||||
font = {
|
||||
regular = "JetBrainsMono Nerd Font, 14",
|
||||
bold = "JetBrainsMono Nerd Font, bold 14",
|
||||
extrabold = "JetBrainsMono Nerd Font, ExtraBold 14",
|
||||
specify = "JetBrainsMono Nerd Font"
|
||||
},
|
||||
|
||||
-- This is your default Terminal
|
||||
terminal = "alacritty",
|
||||
-- This is your default Terminal
|
||||
terminal = "alacritty",
|
||||
|
||||
-- This is the modkey 'mod4' = Super/Mod/WindowsKey, 'mod3' = alt...
|
||||
modkey = "Mod4",
|
||||
-- This is the modkey 'mod4' = Super/Mod/WindowsKey, 'mod3' = alt...
|
||||
modkey = "Mod4",
|
||||
|
||||
-- place your wallpaper at this path with this name, you could also try to change the path
|
||||
wallpaper = home .. "/.config/awesome/src/assets/fuji.jpg",
|
||||
-- place your wallpaper at this path with this name, you could also try to change the path
|
||||
wallpaper = home .. "/.config/awesome/src/assets/fuji.jpg",
|
||||
|
||||
-- Naming scheme for the powermenu, userhost = "user@hostname", fullname = "Firstname Surname", something else ...
|
||||
namestyle = "userhost",
|
||||
-- Naming scheme for the powermenu, userhost = "user@hostname", fullname = "Firstname Surname", something else ...
|
||||
namestyle = "userhost",
|
||||
|
||||
-- List every Keyboard layout you use here comma seperated. (run localectl list-keymaps to list all averiable keymaps)
|
||||
kblayout = { "de", "ru" },
|
||||
-- List every Keyboard layout you use here comma seperated. (run localectl list-keymaps to list all averiable keymaps)
|
||||
kblayout = { "de", "ru" },
|
||||
|
||||
-- Your filemanager that opens with super+e
|
||||
file_manager = "nemo",
|
||||
-- Your filemanager that opens with super+e
|
||||
file_manager = "thunar",
|
||||
|
||||
-- Screenshot program to make a screenshot when print is hit
|
||||
screenshot_program = "flameshot gui",
|
||||
-- Screenshot program to make a screenshot when print is hit
|
||||
screenshot_program = "flameshot gui",
|
||||
|
||||
-- If you use the dock here is how you control its size
|
||||
dock_icon_size = dpi(50),
|
||||
-- If you use the dock here is how you control its size
|
||||
dock_icon_size = dpi(50),
|
||||
|
||||
-- Add your programs exactly like in this example.
|
||||
-- First entry has to be how you would start the program in the terminal (just try it if you dont know yahoo it)
|
||||
-- Second can be what ever the fuck you want it to be (will be the displayed name if you hover over it)
|
||||
-- For steam games please use this format (look in .local/share/applications for the .desktop file, that will contain the number you need)
|
||||
-- {"394360", "Name", true} true will tell the func that it's a steam game
|
||||
-- Use xprop | grep WM_CLASS and use the *SECOND* string
|
||||
-- { WM_CLASS, program, name, isSteam }
|
||||
dock_programs = {
|
||||
{ "Alacritty", "alacritty", "Alacritty" },
|
||||
{ "firefox", "firefox", "Firefox" },
|
||||
{ "discord", "discord", "Discord" },
|
||||
{ "Spotify", "flatpak run com.spotify.Client", "Spotify" },
|
||||
{ "Code", "code", "Visual Studio Code" },
|
||||
{ "processing-app-Base", "arduino", "Arduino IDE" },
|
||||
{ "zoom", "zoom", "Zoom" },
|
||||
{ "Thunderbird", "thunderbird", "Thunderbird" },
|
||||
{ "Mattermost", "mattermost-desktop", "Mattermost" },
|
||||
{ "Blender", "blender", "Blender" },
|
||||
{ "Steam", "steam", "Steam" },
|
||||
{ "FreeCAD", "freecad", "FreeCAD" },
|
||||
{ "Nemo", "nemo", "Dateien" },
|
||||
{ "Paradox Launcher", "394360", "Hearts of Iron 4", true }
|
||||
}
|
||||
-- Add your programs exactly like in this example.
|
||||
-- First entry has to be how you would start the program in the terminal (just try it if you dont know yahoo it)
|
||||
-- Second can be what ever the fuck you want it to be (will be the displayed name if you hover over it)
|
||||
-- For steam games please use this format (look in .local/share/applications for the .desktop file, that will contain the number you need)
|
||||
-- {"394360", "Name", true} true will tell the func that it's a steam game
|
||||
-- Use xprop | grep WM_CLASS and use the *SECOND* string
|
||||
-- { WM_CLASS, program, name, user_icon, isSteam }
|
||||
dock_programs = {
|
||||
{ "Alacritty", "alacritty", "Alacritty" },
|
||||
{ "firefox", "firefox", "Firefox" },
|
||||
{ "discord", "discord", "Discord" },
|
||||
{ "Spotify", "flatpak run com.spotify.Client", "Spotify" },
|
||||
{ "Code", "code", "Visual Studio Code" },
|
||||
{ "processing-app-Base", "arduino", "Arduino IDE" },
|
||||
{ "Zoom", "flatpak run us.zoom.Zoom", "Zoom" },
|
||||
{ "Thunderbird", "thunderbird", "Thunderbird" },
|
||||
{ "Mattermost", "mattermost-desktop", "Mattermost" },
|
||||
{ "Blender", "blender", "Blender" },
|
||||
{ "Steam", "steam", "Steam" },
|
||||
{ "FreeCAD", "freecad", "FreeCAD" },
|
||||
{ "Thunar", "thunar", "Dateien" },
|
||||
{ "Windows", "virsh start Windows_11", "Windows 11", "/home/crylia/Bilder/windows.png", false, 50 }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
local awful = require("awful")
|
||||
|
||||
return function(table)
|
||||
for i, t in ipairs(table) do
|
||||
awful.spawn.with_shell(t);
|
||||
for _, t in ipairs(table) do
|
||||
awful.spawn(t);
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,74 +8,74 @@ local icon_cache = {}
|
||||
-- TODO: try with more icon themes
|
||||
function Get_icon(theme, client, program_string, class_string, is_steam)
|
||||
|
||||
client = client or nil
|
||||
program_string = program_string or nil
|
||||
class_string = class_string or nil
|
||||
is_steam = is_steam or nil
|
||||
client = client or nil
|
||||
program_string = program_string or nil
|
||||
class_string = class_string or nil
|
||||
is_steam = is_steam or nil
|
||||
|
||||
if theme and (client or program_string or class_string) then
|
||||
local clientName
|
||||
if is_steam then
|
||||
clientName = "steam_icon_" .. tostring(client) .. ".svg"
|
||||
elseif client then
|
||||
if client.class then
|
||||
clientName = string.lower(client.class:gsub(" ", "")) .. ".svg"
|
||||
elseif client.name then
|
||||
clientName = string.lower(client.name:gsub(" ", "")) .. ".svg"
|
||||
else
|
||||
if client.icon then
|
||||
return client.icon
|
||||
else
|
||||
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
|
||||
end
|
||||
end
|
||||
if theme and (client or program_string or class_string) then
|
||||
local clientName
|
||||
if is_steam then
|
||||
clientName = "steam_icon_" .. tostring(client) .. ".svg"
|
||||
elseif client then
|
||||
if client.class then
|
||||
clientName = string.lower(client.class:gsub(" ", "")) .. ".svg"
|
||||
elseif client.name then
|
||||
clientName = string.lower(client.name:gsub(" ", "")) .. ".svg"
|
||||
else
|
||||
if client.icon then
|
||||
return client.icon
|
||||
else
|
||||
if program_string then
|
||||
clientName = program_string .. ".svg"
|
||||
else
|
||||
clientName = class_string .. ".svg"
|
||||
end
|
||||
end
|
||||
|
||||
for index, icon in ipairs(icon_cache) do
|
||||
if icon:match(clientName) then
|
||||
return icon
|
||||
end
|
||||
end
|
||||
|
||||
local resolutions = { "128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16" }
|
||||
for i, res in ipairs(resolutions) do
|
||||
local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
|
||||
local ioStream = io.open(iconDir .. clientName, "r")
|
||||
if ioStream ~= nil then
|
||||
icon_cache[#icon_cache + 1] = iconDir .. clientName
|
||||
return iconDir .. clientName
|
||||
else
|
||||
clientName = clientName:gsub("^%l", string.upper)
|
||||
iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
|
||||
ioStream = io.open(iconDir .. clientName, "r")
|
||||
if ioStream ~= nil then
|
||||
icon_cache[#icon_cache + 1] = iconDir .. clientName
|
||||
return iconDir .. clientName
|
||||
elseif not class_string then
|
||||
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
|
||||
else
|
||||
clientName = class_string .. ".svg"
|
||||
iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
|
||||
ioStream = io.open(iconDir .. clientName, "r")
|
||||
if ioStream ~= nil then
|
||||
icon_cache[#icon_cache + 1] = iconDir .. clientName
|
||||
return iconDir .. clientName
|
||||
else
|
||||
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if client then
|
||||
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
|
||||
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
|
||||
end
|
||||
end
|
||||
else
|
||||
if program_string then
|
||||
clientName = program_string .. ".svg"
|
||||
else
|
||||
clientName = class_string .. ".svg"
|
||||
end
|
||||
end
|
||||
|
||||
for index, icon in ipairs(icon_cache) do
|
||||
if icon:match(clientName) then
|
||||
return icon
|
||||
end
|
||||
end
|
||||
|
||||
local resolutions = { "128x128", "96x96", "64x64", "48x48", "42x42", "32x32", "24x24", "16x16" }
|
||||
for i, res in ipairs(resolutions) do
|
||||
local iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
|
||||
local ioStream = io.open(iconDir .. clientName, "r")
|
||||
if ioStream ~= nil then
|
||||
icon_cache[#icon_cache + 1] = iconDir .. clientName
|
||||
return iconDir .. clientName
|
||||
else
|
||||
clientName = clientName:gsub("^%l", string.upper)
|
||||
iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
|
||||
ioStream = io.open(iconDir .. clientName, "r")
|
||||
if ioStream ~= nil then
|
||||
icon_cache[#icon_cache + 1] = iconDir .. clientName
|
||||
return iconDir .. clientName
|
||||
elseif not class_string then
|
||||
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
|
||||
else
|
||||
clientName = class_string .. ".svg"
|
||||
iconDir = "/usr/share/icons/" .. theme .. "/" .. res .. "/apps/"
|
||||
ioStream = io.open(iconDir .. clientName, "r")
|
||||
if ioStream ~= nil then
|
||||
icon_cache[#icon_cache + 1] = iconDir .. clientName
|
||||
return iconDir .. clientName
|
||||
else
|
||||
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
if client then
|
||||
return "/usr/share/icons/Papirus-Dark/128x128/apps/application-default-icon.svg"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--———————————No swiches?———————————
|
||||
|
||||
@@ -14,7 +14,7 @@ require("src.core.signals")
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/audio/"
|
||||
|
||||
-- Returns the audio widget
|
||||
return function()
|
||||
return function(s)
|
||||
|
||||
local audio_widget = wibox.widget {
|
||||
{
|
||||
@@ -78,6 +78,7 @@ return function()
|
||||
end
|
||||
audio_widget.container.audio_layout.label:set_text(volume .. "%")
|
||||
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"]))
|
||||
awesome.emit_signal("get::volume", volume)
|
||||
end
|
||||
)
|
||||
end
|
||||
@@ -90,8 +91,10 @@ return function()
|
||||
audio_widget.container.audio_layout.label.visible = false
|
||||
audio_widget.container:set_right(0)
|
||||
audio_widget.container.audio_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. "volume-mute" .. ".svg", color["Grey900"]))
|
||||
awesome.emit_signal("get::volume_mute", true)
|
||||
else
|
||||
audio_widget.container:set_right(10)
|
||||
awesome.emit_signal("get::volume_mute", false)
|
||||
get_volume()
|
||||
end
|
||||
end
|
||||
@@ -104,20 +107,18 @@ return function()
|
||||
audio_widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awesome.emit_signal("widget::volume")
|
||||
--awesome.emit_signal("module::volume_osd:show", true)
|
||||
awesome.emit_signal("module::slider:update")
|
||||
awesome.emit_signal("widget::volume_osd:rerun")
|
||||
awesome.emit_signal("volume_controller::toggle")
|
||||
awesome.emit_signal("volume_controller::toggle", s)
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"widget::volume",
|
||||
function(c)
|
||||
check_muted()
|
||||
end
|
||||
)
|
||||
gears.timer {
|
||||
timeout = 0.5,
|
||||
call_now = true,
|
||||
autostart = true,
|
||||
callback = check_muted
|
||||
}
|
||||
|
||||
check_muted()
|
||||
return audio_widget
|
||||
|
||||
@@ -17,185 +17,185 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/battery/"
|
||||
|
||||
-- Returns the battery widget
|
||||
return function()
|
||||
local battery_widget = wibox.widget {
|
||||
local battery_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "battery-unknown.svg", "#212121"),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
spacing = dpi(10),
|
||||
{
|
||||
visible = false,
|
||||
align = 'center',
|
||||
valign = 'center',
|
||||
id = "label",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "battery_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "battery-unknown.svg", "#212121"),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Purple200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
spacing = dpi(10),
|
||||
{
|
||||
visible = false,
|
||||
align = 'center',
|
||||
valign = 'center',
|
||||
id = "label",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "battery_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Purple200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local battery_tooltip = awful.tooltip {
|
||||
objects = { battery_widget },
|
||||
text = "",
|
||||
mode = "inside",
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
local battery_tooltip = awful.tooltip {
|
||||
objects = { battery_widget },
|
||||
text = "",
|
||||
mode = "inside",
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
|
||||
local get_battery_info = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ upower -i $(upower -e | grep BAT) | grep "time to " ]],
|
||||
function(stdout)
|
||||
if stdout == nil or stdout == '' then
|
||||
battery_tooltip:set_text('No Battery Found')
|
||||
return
|
||||
end
|
||||
local rem_time = ""
|
||||
if stdout:match("hour") then
|
||||
rem_time = "Hours"
|
||||
else
|
||||
rem_time = "Minutes"
|
||||
end
|
||||
local bat_time = stdout:match("%d+,%d") or stdout:match("%d+.%d") or ""
|
||||
if stdout:match("empty") then
|
||||
battery_tooltip:set_text("Remaining battery time: " .. bat_time .. " " .. rem_time)
|
||||
elseif stdout:match("time to full") then
|
||||
battery_tooltip:set_text("Battery fully charged in: " .. bat_time .. " " .. rem_time)
|
||||
end
|
||||
end
|
||||
)
|
||||
local get_battery_info = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ upower -i $(upower -e | grep BAT) | grep "time to " ]],
|
||||
function(stdout)
|
||||
if stdout == nil or stdout == '' then
|
||||
battery_tooltip:set_text('No Battery Found')
|
||||
return
|
||||
end
|
||||
local rem_time = ""
|
||||
if stdout:match("hour") then
|
||||
rem_time = "Hours"
|
||||
else
|
||||
rem_time = "Minutes"
|
||||
end
|
||||
local bat_time = stdout:match("%d+,%d") or stdout:match("%d+.%d") or ""
|
||||
if stdout:match("empty") then
|
||||
battery_tooltip:set_text("Remaining battery time: " .. bat_time .. " " .. rem_time)
|
||||
elseif stdout:match("time to full") then
|
||||
battery_tooltip:set_text("Battery fully charged in: " .. bat_time .. " " .. rem_time)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
get_battery_info()
|
||||
|
||||
local last_battery_check = os.time()
|
||||
local notify_critical_battery = true
|
||||
|
||||
local battery_warning = function()
|
||||
naughty.notification {
|
||||
icon = gears.color.recolor_image(icondir .. "battery-alert.svg", color["White"]),
|
||||
app_name = "System notification",
|
||||
title = "Battery is low",
|
||||
message = "Battery is almost empty",
|
||||
urgency = "critical"
|
||||
}
|
||||
end
|
||||
|
||||
local update_battery = function(status)
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[sh -c "upower -i $(upower -e | grep BAT) | grep percentage | awk '{print \$2}' |tr -d '\n%'"]],
|
||||
function(stdout)
|
||||
local battery_percentage = tonumber(stdout)
|
||||
|
||||
if not battery_percentage then
|
||||
return
|
||||
end
|
||||
|
||||
battery_widget.container.battery_layout.spacing = dpi(5)
|
||||
battery_widget.container.battery_layout.label.visible = true
|
||||
battery_widget.container.battery_layout.label:set_text(battery_percentage .. '%')
|
||||
|
||||
local icon = 'battery'
|
||||
|
||||
if status == 'fully-charged' or status == 'charging' and battery_percentage == 100 then
|
||||
icon = icon .. '-' .. 'charging'
|
||||
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
|
||||
return
|
||||
end
|
||||
|
||||
if battery_percentage > 0 and battery_percentage < 10 and status == 'discharging' then
|
||||
icon = icon .. '-' .. 'alert'
|
||||
if (os.difftime(os.time(), last_battery_check) > 300 or notify_critical_battery) then
|
||||
last_battery_check = os.time()
|
||||
notify_critical_battery = false
|
||||
battery_warning()
|
||||
end
|
||||
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
|
||||
return
|
||||
end
|
||||
|
||||
if battery_percentage > 0 and battery_percentage < 10 then
|
||||
icon = icon .. '-' .. status .. '-' .. 'outline'
|
||||
elseif battery_percentage >= 10 and battery_percentage < 20 then
|
||||
icon = icon .. '-' .. status .. '-' .. '10'
|
||||
elseif battery_percentage >= 20 and battery_percentage < 30 then
|
||||
icon = icon .. '-' .. status .. '-' .. '20'
|
||||
elseif battery_percentage >= 30 and battery_percentage < 40 then
|
||||
icon = icon .. '-' .. status .. '-' .. '30'
|
||||
elseif battery_percentage >= 40 and battery_percentage < 50 then
|
||||
icon = icon .. '-' .. status .. '-' .. '40'
|
||||
elseif battery_percentage >= 50 and battery_percentage < 60 then
|
||||
icon = icon .. '-' .. status .. '-' .. '50'
|
||||
elseif battery_percentage >= 60 and battery_percentage < 70 then
|
||||
icon = icon .. '-' .. status .. '-' .. '60'
|
||||
elseif battery_percentage >= 70 and battery_percentage < 80 then
|
||||
icon = icon .. '-' .. status .. '-' .. '70'
|
||||
elseif battery_percentage >= 80 and battery_percentage < 90 then
|
||||
icon = icon .. '-' .. status .. '-' .. '80'
|
||||
elseif battery_percentage >= 90 and battery_percentage < 100 then
|
||||
icon = icon .. '-' .. status .. '-' .. '90'
|
||||
end
|
||||
|
||||
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
|
||||
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
Hover_signal(battery_widget, color["Purple200"])
|
||||
|
||||
battery_widget:connect_signal(
|
||||
'button::press',
|
||||
function()
|
||||
awful.spawn("xfce4-power-manager-settings")
|
||||
end
|
||||
)
|
||||
|
||||
battery_widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
get_battery_info()
|
||||
end
|
||||
)
|
||||
|
||||
local last_battery_check = os.time()
|
||||
local notify_critical_battery = true
|
||||
|
||||
local battery_warning = function()
|
||||
naughty.notify({
|
||||
icon = gears.color.recolor_image(icondir .. "battery-alert.svg", color["White"]),
|
||||
app_name = "System notification",
|
||||
title = "Battery is low",
|
||||
message = "Battery is almost battery_labelempty",
|
||||
urgency = "critical"
|
||||
})
|
||||
watch(
|
||||
[[sh -c "upower -i $(upower -e | grep BAT) | grep state | awk '{print \$2}' | tr -d '\n'"]],
|
||||
5,
|
||||
function(widget, stdout)
|
||||
local status = stdout:gsub('%\n', '')
|
||||
if status == nil or status == '' then
|
||||
battery_widget.container.battery_layout.spacing = dpi(0)
|
||||
battery_widget.container.battery_layout.label.visible = false
|
||||
battery_tooltip:set_text('No battery found')
|
||||
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. 'battery-off' .. '.svg', "#212121")))
|
||||
end
|
||||
update_battery(status)
|
||||
end
|
||||
)
|
||||
|
||||
local update_battery = function(status)
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[sh -c "upower -i $(upower -e | grep BAT) | grep percentage | awk '{print \$2}' |tr -d '\n%'"]],
|
||||
function(stdout)
|
||||
local battery_percentage = tonumber(stdout)
|
||||
|
||||
if not battery_percentage then
|
||||
return
|
||||
end
|
||||
|
||||
battery_widget.container.battery_layout.spacing = dpi(5)
|
||||
battery_widget.container.battery_layout.label.visible = true
|
||||
battery_widget.container.battery_layout.label:set_text(battery_percentage .. '%')
|
||||
|
||||
local icon = 'battery'
|
||||
|
||||
if status == 'fully-charged' or status == 'charging' and battery_percentage == 100 then
|
||||
icon = icon .. '-' .. 'charging'
|
||||
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
|
||||
return
|
||||
end
|
||||
|
||||
if battery_percentage > 0 and battery_percentage < 10 and status == 'discharging' then
|
||||
icon = icon .. '-' .. 'alert'
|
||||
if (os.difftime(os.time(), last_battery_check) > 300 or notify_critical_battery) then
|
||||
last_battery_check = os.time()
|
||||
notify_critical_battery = false
|
||||
battery_warning()
|
||||
end
|
||||
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
|
||||
return
|
||||
end
|
||||
|
||||
if battery_percentage > 0 and battery_percentage < 10 then
|
||||
icon = icon .. '-' .. status .. '-' .. 'outline'
|
||||
elseif battery_percentage >= 10 and battery_percentage < 20 then
|
||||
icon = icon .. '-' .. status .. '-' .. '10'
|
||||
elseif battery_percentage >= 20 and battery_percentage < 30 then
|
||||
icon = icon .. '-' .. status .. '-' .. '20'
|
||||
elseif battery_percentage >= 30 and battery_percentage < 40 then
|
||||
icon = icon .. '-' .. status .. '-' .. '30'
|
||||
elseif battery_percentage >= 40 and battery_percentage < 50 then
|
||||
icon = icon .. '-' .. status .. '-' .. '40'
|
||||
elseif battery_percentage >= 50 and battery_percentage < 60 then
|
||||
icon = icon .. '-' .. status .. '-' .. '50'
|
||||
elseif battery_percentage >= 60 and battery_percentage < 70 then
|
||||
icon = icon .. '-' .. status .. '-' .. '60'
|
||||
elseif battery_percentage >= 70 and battery_percentage < 80 then
|
||||
icon = icon .. '-' .. status .. '-' .. '70'
|
||||
elseif battery_percentage >= 80 and battery_percentage < 90 then
|
||||
icon = icon .. '-' .. status .. '-' .. '80'
|
||||
elseif battery_percentage >= 90 and battery_percentage < 100 then
|
||||
icon = icon .. '-' .. status .. '-' .. '90'
|
||||
end
|
||||
|
||||
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. icon .. '.svg', "#212121")))
|
||||
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
Hover_signal(battery_widget, color["Purple200"])
|
||||
|
||||
battery_widget:connect_signal(
|
||||
'button::press',
|
||||
function()
|
||||
awful.spawn("xfce4-power-manager-settings")
|
||||
end
|
||||
)
|
||||
|
||||
battery_widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
get_battery_info()
|
||||
end
|
||||
)
|
||||
|
||||
watch(
|
||||
[[sh -c "upower -i $(upower -e | grep BAT) | grep state | awk '{print \$2}' | tr -d '\n'"]],
|
||||
5,
|
||||
function(widget, stdout)
|
||||
local status = stdout:gsub('%\n', '')
|
||||
if status == nil or status == '' then
|
||||
battery_widget.container.battery_layout.spacing = dpi(0)
|
||||
battery_widget.container.battery_layout.label.visible = false
|
||||
battery_tooltip:set_text('No battery found')
|
||||
battery_widget.container.battery_layout.icon_margin.icon_layout.icon:set_image(gears.surface.load_uncached(gears.color.recolor_image(icondir .. 'battery-off' .. '.svg', "#212121")))
|
||||
end
|
||||
update_battery(status)
|
||||
end
|
||||
)
|
||||
|
||||
return battery_widget
|
||||
return battery_widget
|
||||
end
|
||||
|
||||
@@ -16,116 +16,116 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/bluetooth/"
|
||||
|
||||
-- Returns the bluetooth widget
|
||||
return function()
|
||||
local bluetooth_widget = wibox.widget {
|
||||
local bluetooth_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "bluetooth-off.svg"),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "bluetooth-off.svg"),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
bg = color["Blue200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Blue200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local bluetooth_tooltip = awful.tooltip {
|
||||
objects = { bluetooth_widget },
|
||||
text = "",
|
||||
mode = "inside",
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
local bluetooth_tooltip = awful.tooltip {
|
||||
objects = { bluetooth_widget },
|
||||
text = "",
|
||||
mode = "inside",
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
|
||||
local bluetooth_state = "off"
|
||||
local connected_device = "nothing"
|
||||
local bluetooth_state = "off"
|
||||
local connected_device = "nothing"
|
||||
|
||||
awful.widget.watch(
|
||||
"rfkill list bluetooth",
|
||||
5,
|
||||
function(_, stdout)
|
||||
local icon = icondir .. "bluetooth"
|
||||
if stdout:match('Soft blocked: yes') or stdout:gsub("\n", "") == '' then
|
||||
icon = icon .. "-off"
|
||||
bluetooth_state = "off"
|
||||
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n")
|
||||
else
|
||||
icon = icon .. "-on"
|
||||
bluetooth_state = "on"
|
||||
awful.spawn.easy_async_with_shell(
|
||||
'./.config/awesome/src/scripts/bt.sh',
|
||||
function(stdout2)
|
||||
if stdout2 == nil or stdout2:gsub("\n", "") == "" then
|
||||
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently not connected")
|
||||
else
|
||||
connected_device = stdout2:gsub("%(", ""):gsub("%)", "")
|
||||
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently connected to:\n" .. connected_device)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
bluetooth_widget.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"]))
|
||||
end,
|
||||
bluetooth_widget
|
||||
)
|
||||
|
||||
-- Signals
|
||||
Hover_signal(bluetooth_widget, color["Blue200"])
|
||||
|
||||
bluetooth_widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"rfkill list bluetooth",
|
||||
function(stdout)
|
||||
if stdout:gsub("\n", "") ~= '' then
|
||||
if bluetooth_state == "off" then
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[
|
||||
rfkill unblock bluetooth
|
||||
sleep 1
|
||||
bluetoothctl power on
|
||||
]],
|
||||
function()
|
||||
naughty.notify({
|
||||
title = "System Notification",
|
||||
app_name = "Bluetooth",
|
||||
message = "Bluetooth activated"
|
||||
})
|
||||
end
|
||||
)
|
||||
else
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[
|
||||
bluetoothctl power off
|
||||
rfkill block bluetooth
|
||||
]],
|
||||
function()
|
||||
naughty.notify({
|
||||
title = "System Notification",
|
||||
app_name = "Bluetooth",
|
||||
message = "Bluetooth deactivated"
|
||||
})
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
awful.widget.watch(
|
||||
"rfkill list bluetooth",
|
||||
5,
|
||||
function(_, stdout)
|
||||
local icon = icondir .. "bluetooth"
|
||||
if stdout:match('Soft blocked: yes') or stdout:gsub("\n", "") == '' then
|
||||
icon = icon .. "-off"
|
||||
bluetooth_state = "off"
|
||||
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n")
|
||||
else
|
||||
icon = icon .. "-on"
|
||||
bluetooth_state = "on"
|
||||
awful.spawn.easy_async_with_shell(
|
||||
'./.config/awesome/src/scripts/bt.sh',
|
||||
function(stdout2)
|
||||
if stdout2 == nil or stdout2:gsub("\n", "") == "" then
|
||||
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently not connected")
|
||||
else
|
||||
connected_device = stdout2:gsub("%(", ""):gsub("%)", "")
|
||||
bluetooth_tooltip:set_text("Bluetooth is turned " .. bluetooth_state .. "\n" .. "You are currently connected to:\n" .. connected_device)
|
||||
end
|
||||
end
|
||||
)
|
||||
)
|
||||
end
|
||||
bluetooth_widget.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icon .. ".svg", color["Grey900"]))
|
||||
end,
|
||||
bluetooth_widget
|
||||
)
|
||||
|
||||
return bluetooth_widget
|
||||
-- Signals
|
||||
Hover_signal(bluetooth_widget, color["Blue200"])
|
||||
|
||||
bluetooth_widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"rfkill list bluetooth",
|
||||
function(stdout)
|
||||
if stdout:gsub("\n", "") ~= '' then
|
||||
if bluetooth_state == "off" then
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[
|
||||
rfkill unblock bluetooth
|
||||
sleep 1
|
||||
bluetoothctl power on
|
||||
]],
|
||||
function()
|
||||
naughty.notification {
|
||||
title = "System Notification",
|
||||
app_name = "Bluetooth",
|
||||
message = "Bluetooth activated"
|
||||
}
|
||||
end
|
||||
)
|
||||
else
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[
|
||||
bluetoothctl power off
|
||||
rfkill block bluetooth
|
||||
]],
|
||||
function()
|
||||
naughty.notification {
|
||||
title = "System Notification",
|
||||
app_name = "Bluetooth",
|
||||
message = "Bluetooth deactivated"
|
||||
}
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
|
||||
return bluetooth_widget
|
||||
end
|
||||
|
||||
@@ -16,63 +16,63 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/clock/"
|
||||
-- Returns the clock widget
|
||||
return function()
|
||||
|
||||
local clock_widget = wibox.widget {
|
||||
local clock_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "clock.svg", color["Grey900"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
spacing = dpi(10),
|
||||
{
|
||||
id = "label",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "clock_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "clock.svg", color["Grey900"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Orange200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
spacing = dpi(10),
|
||||
{
|
||||
id = "label",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "clock_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Orange200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local set_clock = function()
|
||||
clock_widget.container.clock_layout.label:set_text(os.date("%H:%M"))
|
||||
local set_clock = function()
|
||||
clock_widget.container.clock_layout.label:set_text(os.date("%H:%M"))
|
||||
end
|
||||
|
||||
-- Updates the clock every 5 seconds, worst case you are 5 seconds behind
|
||||
-- ¯\_(ツ)_/¯
|
||||
gears.timer {
|
||||
timeout = 5,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function()
|
||||
set_clock()
|
||||
end
|
||||
}
|
||||
|
||||
-- Updates the clock every 5 seconds, worst case you are 5 seconds behind
|
||||
-- ¯\_(ツ)_/¯
|
||||
local clock_update = gears.timer {
|
||||
timeout = 5,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function()
|
||||
set_clock()
|
||||
end
|
||||
}
|
||||
Hover_signal(clock_widget, color["Orange200"])
|
||||
|
||||
Hover_signal(clock_widget, color["Orange200"])
|
||||
|
||||
return clock_widget
|
||||
return clock_widget
|
||||
end
|
||||
|
||||
@@ -7,7 +7,6 @@ local awful = require("awful")
|
||||
local color = require("src.theme.colors")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local naughty = require("naughty")
|
||||
local watch = awful.widget.watch
|
||||
local wibox = require("wibox")
|
||||
require("src.core.signals")
|
||||
|
||||
@@ -16,77 +16,77 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/date/"
|
||||
-- Returns the date widget
|
||||
return function()
|
||||
|
||||
local date_widget = wibox.widget {
|
||||
local date_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "calendar.svg", color["Grey900"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
spacing = dpi(10),
|
||||
{
|
||||
id = "label",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "date_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "calendar.svg", color["Grey900"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Teal200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
spacing = dpi(10),
|
||||
{
|
||||
id = "label",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "date_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Teal200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local set_date = function()
|
||||
date_widget.container.date_layout.label:set_text(os.date("%a, %b %d"))
|
||||
local set_date = function()
|
||||
date_widget.container.date_layout.label:set_text(os.date("%a, %b %d"))
|
||||
end
|
||||
|
||||
-- Updates the date every minute, dont blame me if you miss silvester
|
||||
gears.timer {
|
||||
timeout = 60,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function()
|
||||
set_date()
|
||||
end
|
||||
}
|
||||
|
||||
-- Updates the date every minute, dont blame me if you miss silvester
|
||||
local date_updater = gears.timer {
|
||||
timeout = 60,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function()
|
||||
set_date()
|
||||
end
|
||||
}
|
||||
-- Signals
|
||||
Hover_signal(date_widget, color["Teal200"])
|
||||
|
||||
-- Signals
|
||||
Hover_signal(date_widget, color["Teal200"])
|
||||
date_widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
awesome.emit_signal("widget::calendar_osd:stop", true)
|
||||
end
|
||||
)
|
||||
|
||||
date_widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
awesome.emit_signal("widget::calendar_osd:stop", true)
|
||||
end
|
||||
)
|
||||
date_widget:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
awesome.emit_signal("widget::calendar_osd:rerun", true)
|
||||
end
|
||||
)
|
||||
|
||||
date_widget:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
awesome.emit_signal("widget::calendar_osd:rerun", true)
|
||||
end
|
||||
)
|
||||
|
||||
return date_widget
|
||||
return date_widget
|
||||
end
|
||||
|
||||
@@ -7,7 +7,6 @@ local awful = require("awful")
|
||||
local color = require("src.theme.colors")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local naughty = require("naughty")
|
||||
local watch = awful.widget.watch
|
||||
local wibox = require("wibox")
|
||||
require("src.core.signals")
|
||||
|
||||
@@ -14,326 +14,380 @@ require("src.core.signals")
|
||||
local icondir = awful.util.getdir("config") .. "src/assets/icons/kblayout/"
|
||||
|
||||
return function(s)
|
||||
local kblayout_widget = wibox.widget {
|
||||
local kblayout_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon",
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false,
|
||||
image = gears.color.recolor_image(icondir .. "keyboard.svg", color["Grey900"])
|
||||
},
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin,
|
||||
id = "icon_margin"
|
||||
},
|
||||
spacing = dpi(10),
|
||||
{
|
||||
id = "label",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "kblayout_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
id = "icon",
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false,
|
||||
image = gears.color.recolor_image(icondir .. "keyboard.svg", color["Grey900"])
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin,
|
||||
id = "icon_margin"
|
||||
},
|
||||
bg = color["Green200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
spacing = dpi(10),
|
||||
{
|
||||
id = "label",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "kblayout_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Green200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local function get_kblayout()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ setxkbmap -query | grep layout | awk '{print $2}' ]],
|
||||
function(stdout)
|
||||
local layout = stdout:gsub("\n", "")
|
||||
kblayout_widget.container.kblayout_layout.label.text = layout
|
||||
awesome.emit_signal("update::background:kblayout")
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local function create_kb_layout_item(keymap)
|
||||
-- TODO: Add more, too lazy rn
|
||||
local longname, shortname
|
||||
|
||||
local xkeyboard_country_code = {
|
||||
{ "af", "أفغانيش(Afghanistan)", "AFG" }, -- Afghanistan
|
||||
{ "al", "shqip(Albania)", "ALB" }, -- Albania
|
||||
{ "am", "հայերեն(Armenia)", "ARM" }, -- Armenia
|
||||
{ "ara", "عربي(Arab)", "ARB" }, -- Arabic
|
||||
{ "at", "Österreichisch (Austria)", "AUT" }, -- Austria
|
||||
{ "az", "Azərbaycan(Azerbaijan)", "AZE" }, -- Azerbaijan
|
||||
{ "ba", "bosanski(Bosnia and Herzegovina)", "BIH" }, -- Bosnia and Herzegovina
|
||||
{ "bd", "", "BGD" }, -- Bangladesh
|
||||
{ "be", "", "BEL" }, -- Belgium
|
||||
{ "bg", "", "BGR" }, -- Bulgaria
|
||||
{ "br", "", "BRA" }, -- Brazil
|
||||
{ "bt", "", "BTN" }, -- Bhutan
|
||||
{ "bw", "", "BWA" }, -- Botswana
|
||||
{ "by", "", "BLR" }, -- Belarus
|
||||
{ "ca", "", "CAN" }, -- Canada
|
||||
{ "cd", "", "COD" }, -- Congo
|
||||
{ "ch", "", "CHE" }, -- Switzerland
|
||||
{ "cm", "", "CMR" }, -- Cameroon
|
||||
{ "cn", "", "CHN" }, -- China
|
||||
{ "cz", "", "CZE" }, -- Czechia
|
||||
{ "de", "Deutsch (Germany)", "GER" }, -- Germany
|
||||
{ "dk", "", "DNK" }, -- Denmark
|
||||
{ "ee", "", "EST" }, -- Estonia
|
||||
{ "es", "", "ESP" }, -- Spain
|
||||
{ "et", "", "ETH" }, -- Ethiopia
|
||||
{ "eu", "?", "?" }, -- EurKey
|
||||
{ "fi", "", "FIN" }, -- Finland
|
||||
{ "fo", "", "FRO" }, -- Faroe Islands
|
||||
{ "fr", "", "FRA" }, -- France
|
||||
{ "gb", "English (Bri'ish)", "ENG" }, -- United Kingdom
|
||||
{ "ge", "", "GEO" }, -- Georgia
|
||||
{ "gh", "", "GHA" }, -- Ghana
|
||||
{ "gn", "", "GIN" }, -- Guinea
|
||||
{ "gr", "", "GRC" }, -- Greece
|
||||
{ "hr", "", "HRV" }, -- Croatia
|
||||
{ "hu", "", "HUN" }, -- Hungary
|
||||
{ "ie", "", "IRL" }, -- Ireland
|
||||
{ "il", "", "ISR" }, -- Israel
|
||||
{ "in", "", "IND" }, -- India
|
||||
{ "iq", "", "IRQ" }, -- Iraq
|
||||
{ "ir", "", "IRN" }, -- Iran
|
||||
{ "is", "", "ISL" }, -- Iceland
|
||||
{ "it", "", "ITA" }, -- Italy
|
||||
{ "jp", "", "JPN" }, -- Japan
|
||||
{ "ke", "", "KEN" }, -- Kenya
|
||||
{ "kg", "", "KGZ" }, -- Kyrgyzstan
|
||||
{ "kh", "", "KHM" }, -- Cambodia
|
||||
{ "kr", "", "KOR" }, -- Korea
|
||||
{ "kz", "", "KAZ" }, -- Kazakhstan
|
||||
{ "la", "", "LAO" }, -- Laos
|
||||
{ "latam", "?", "?" }, -- Latin America
|
||||
{ "latin", "?", "?" }, -- Latin
|
||||
{ "lk", "", "LKA" }, -- Sri Lanka
|
||||
{ "lt", "", "LTU" }, -- Lithuania
|
||||
{ "lv", "", "LVA" }, -- Latvia
|
||||
{ "ma", "", "MAR" }, -- Morocco
|
||||
{ "mao", "?", "?" }, -- Maori
|
||||
{ "me", "", "MNE" }, -- Montenegro
|
||||
{ "mk", "", "MKD" }, -- Macedonia
|
||||
{ "ml", "", "MLI" }, -- Mali
|
||||
{ "mm", "", "MMR" }, -- Myanmar
|
||||
{ "mn", "", "MNG" }, -- Mongolia
|
||||
{ "mt", "", "MLT" }, -- Malta
|
||||
{ "mv", "", "MDV" }, -- Maldives
|
||||
{ "ng", "", "NGA" }, -- Nigeria
|
||||
{ "nl", "", "NLD" }, -- Netherlands
|
||||
{ "no", "", "NOR" }, -- Norway
|
||||
{ "np", "", "NRL" }, -- Nepal
|
||||
{ "ph", "", "PHL" }, -- Philippines
|
||||
{ "pk", "", "PAK" }, -- Pakistan
|
||||
{ "pl", "", "POL" }, -- Poland
|
||||
{ "pt", "", "PRT" }, -- Portugal
|
||||
{ "ro", "", "ROU" }, -- Romania
|
||||
{ "rs", "", "SRB" }, -- Serbia
|
||||
{ "ru", "Русский (Russia)", "RUS" }, -- Russia
|
||||
{ "se", "", "SWE" }, -- Sweden
|
||||
{ "si", "", "SVN" }, -- Slovenia
|
||||
{ "sk", "", "SVK" }, -- Slovakia
|
||||
{ "sn", "", "SEN" }, -- Senegal
|
||||
{ "sy", "", "SYR" }, -- Syria
|
||||
{ "th", "", "THA" }, -- Thailand
|
||||
{ "tj", "", "TJK" }, -- Tajikistan
|
||||
{ "tm", "", "TKM" }, -- Turkmenistan
|
||||
{ "tr", "", "TUR" }, -- Turkey
|
||||
{ "tw", "", "TWN" }, -- Taiwan
|
||||
{ "tz", "", "TZA" }, -- Tanzania
|
||||
{ "ua", "", "UKR" }, -- Ukraine
|
||||
{ "us", "English (United States)", "USA" }, -- USA
|
||||
{ "uz", "", "UZB" }, -- Uzbekistan
|
||||
{ "vn", "", "VNM" }, -- Vietnam
|
||||
{ "za", "", "ZAF" } -- South Africa
|
||||
}
|
||||
|
||||
local layout = "";
|
||||
local get_kblayout = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ setxkbmap -query | grep layout | awk '{print $2}' ]],
|
||||
function(stdout)
|
||||
layout = stdout:gsub("\n", "")
|
||||
kblayout_widget.container.kblayout_layout.label.text = layout
|
||||
return layout
|
||||
end
|
||||
)
|
||||
return layout
|
||||
for _, c in ipairs(xkeyboard_country_code) do
|
||||
if c[1] == keymap then
|
||||
longname = c[2]
|
||||
shortname = c[3]
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
local function create_kb_layout_item(keymap)
|
||||
-- TODO: Add more, too lazy rn
|
||||
local longname, shortname
|
||||
|
||||
local xkeyboard_country_code = {
|
||||
{ "ad", "", "AND" }, -- Andorra
|
||||
{ "af", "", "AFG" }, -- Afghanistan
|
||||
{ "al", "", "ALB" }, -- Albania
|
||||
{ "am", "", "ARM" }, -- Armenia
|
||||
{ "ara", "", "ARB" }, -- Arabic
|
||||
{ "at", "", "AUT" }, -- Austria
|
||||
{ "az", "", "AZE" }, -- Azerbaijan
|
||||
{ "ba", "", "BIH" }, -- Bosnia and Herzegovina
|
||||
{ "bd", "", "BGD" }, -- Bangladesh
|
||||
{ "be", "", "BEL" }, -- Belgium
|
||||
{ "bg", "", "BGR" }, -- Bulgaria
|
||||
{ "br", "", "BRA" }, -- Brazil
|
||||
{ "bt", "", "BTN" }, -- Bhutan
|
||||
{ "bw", "", "BWA" }, -- Botswana
|
||||
{ "by", "", "BLR" }, -- Belarus
|
||||
{ "ca", "", "CAN" }, -- Canada
|
||||
{ "cd", "", "COD" }, -- Congo
|
||||
{ "ch", "", "CHE" }, -- Switzerland
|
||||
{ "cm", "", "CMR" }, -- Cameroon
|
||||
{ "cn", "", "CHN" }, -- China
|
||||
{ "cz", "", "CZE" }, -- Czechia
|
||||
{ "de", "Deutsch (Germany)", "GER" }, -- Germany
|
||||
{ "dk", "", "DNK" }, -- Denmark
|
||||
{ "ee", "", "EST" }, -- Estonia
|
||||
{ "es", "", "ESP" }, -- Spain
|
||||
{ "et", "", "ETH" }, -- Ethiopia
|
||||
{ "eu", "?", "?" }, -- EurKey
|
||||
{ "fi", "", "FIN" }, -- Finland
|
||||
{ "fo", "", "FRO" }, -- Faroe Islands
|
||||
{ "fr", "", "FRA" }, -- France
|
||||
{ "gb", "English (Bri'ish)", "ENG" }, -- United Kingdom
|
||||
{ "ge", "", "GEO" }, -- Georgia
|
||||
{ "gh", "", "GHA" }, -- Ghana
|
||||
{ "gn", "", "GIN" }, -- Guinea
|
||||
{ "gr", "", "GRC" }, -- Greece
|
||||
{ "hr", "", "HRV" }, -- Croatia
|
||||
{ "hu", "", "HUN" }, -- Hungary
|
||||
{ "ie", "", "IRL" }, -- Ireland
|
||||
{ "il", "", "ISR" }, -- Israel
|
||||
{ "in", "", "IND" }, -- India
|
||||
{ "iq", "", "IRQ" }, -- Iraq
|
||||
{ "ir", "", "IRN" }, -- Iran
|
||||
{ "is", "", "ISL" }, -- Iceland
|
||||
{ "it", "", "ITA" }, -- Italy
|
||||
{ "jp", "", "JPN" }, -- Japan
|
||||
{ "ke", "", "KEN" }, -- Kenya
|
||||
{ "kg", "", "KGZ" }, -- Kyrgyzstan
|
||||
{ "kh", "", "KHM" }, -- Cambodia
|
||||
{ "kr", "", "KOR" }, -- Korea
|
||||
{ "kz", "", "KAZ" }, -- Kazakhstan
|
||||
{ "la", "", "LAO" }, -- Laos
|
||||
{ "latam", "?", "?" }, -- Latin America
|
||||
{ "latin", "?", "?" }, -- Latin
|
||||
{ "lk", "", "LKA" }, -- Sri Lanka
|
||||
{ "lt", "", "LTU" }, -- Lithuania
|
||||
{ "lv", "", "LVA" }, -- Latvia
|
||||
{ "ma", "", "MAR" }, -- Morocco
|
||||
{ "mao", "?", "?" }, -- Maori
|
||||
{ "me", "", "MNE" }, -- Montenegro
|
||||
{ "mk", "", "MKD" }, -- Macedonia
|
||||
{ "ml", "", "MLI" }, -- Mali
|
||||
{ "mm", "", "MMR" }, -- Myanmar
|
||||
{ "mn", "", "MNG" }, -- Mongolia
|
||||
{ "mt", "", "MLT" }, -- Malta
|
||||
{ "mv", "", "MDV" }, -- Maldives
|
||||
{ "ng", "", "NGA" }, -- Nigeria
|
||||
{ "nl", "", "NLD" }, -- Netherlands
|
||||
{ "no", "", "NOR" }, -- Norway
|
||||
{ "np", "", "NRL" }, -- Nepal
|
||||
{ "ph", "", "PHL" }, -- Philippines
|
||||
{ "pk", "", "PAK" }, -- Pakistan
|
||||
{ "pl", "", "POL" }, -- Poland
|
||||
{ "pt", "", "PRT" }, -- Portugal
|
||||
{ "ro", "", "ROU" }, -- Romania
|
||||
{ "rs", "", "SRB" }, -- Serbia
|
||||
{ "ru", "Русски (Russia)", "RUS" }, -- Russia
|
||||
{ "se", "", "SWE" }, -- Sweden
|
||||
{ "si", "", "SVN" }, -- Slovenia
|
||||
{ "sk", "", "SVK" }, -- Slovakia
|
||||
{ "sn", "", "SEN" }, -- Senegal
|
||||
{ "sy", "", "SYR" }, -- Syria
|
||||
{ "th", "", "THA" }, -- Thailand
|
||||
{ "tj", "", "TJK" }, -- Tajikistan
|
||||
{ "tm", "", "TKM" }, -- Turkmenistan
|
||||
{ "tr", "", "TUR" }, -- Turkey
|
||||
{ "tw", "", "TWN" }, -- Taiwan
|
||||
{ "tz", "", "TZA" }, -- Tanzania
|
||||
{ "ua", "", "UKR" }, -- Ukraine
|
||||
{ "us", "English (United States)", "USA" }, -- USA
|
||||
{ "uz", "", "UZB" }, -- Uzbekistan
|
||||
{ "vn", "", "VNM" }, -- Vietnam
|
||||
{ "za", "", "ZAF" } -- South Africa
|
||||
}
|
||||
|
||||
for i, c in ipairs(xkeyboard_country_code) do
|
||||
if c[1] == keymap then
|
||||
longname = c[2]
|
||||
shortname = c[3]
|
||||
end
|
||||
end
|
||||
|
||||
local kb_layout_item = wibox.widget {
|
||||
local kb_layout_item = wibox.widget {
|
||||
{
|
||||
{
|
||||
-- Short name e.g. GER, ENG, RUS
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
-- Short name e.g. GER, ENG, RUS
|
||||
{
|
||||
{
|
||||
text = shortname,
|
||||
widget = wibox.widget.textbox,
|
||||
font = user_vars.font.extrabold,
|
||||
id = "kbmapname"
|
||||
},
|
||||
widget = wibox.container.margin,
|
||||
id = "margin2"
|
||||
},
|
||||
nil,
|
||||
{
|
||||
{
|
||||
text = longname,
|
||||
widget = wibox.widget.textbox,
|
||||
font = user_vars.font.bold,
|
||||
|
||||
},
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
spacing = dpi(15),
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
id = "container"
|
||||
},
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 10)
|
||||
end,
|
||||
bg = color["Grey800"],
|
||||
fg = color["White"],
|
||||
widget = wibox.container.background,
|
||||
id = "background"
|
||||
text = shortname,
|
||||
widget = wibox.widget.textbox,
|
||||
font = user_vars.font.extrabold,
|
||||
id = "shortname"
|
||||
},
|
||||
margins = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
Hover_signal(kb_layout_item.background, color["White"], color["Grey900"])
|
||||
kb_layout_item:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"setxkbmap " .. keymap,
|
||||
function(stdout)
|
||||
awesome.emit_signal("kblayout::hide:kbmenu")
|
||||
get_kblayout()
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
return kb_layout_item
|
||||
end
|
||||
|
||||
local function get_kblist()
|
||||
local kb_layout_items = {
|
||||
layout = wibox.layout.fixed.vertical
|
||||
}
|
||||
for i, keymap in pairs(user_vars.kblayout) do
|
||||
kb_layout_items[i] = create_kb_layout_item(keymap)
|
||||
end
|
||||
return kb_layout_items
|
||||
end
|
||||
|
||||
local kb_menu_widget = awful.popup {
|
||||
screen = s,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background,
|
||||
bg = color["Grey900"],
|
||||
fg = color["White"],
|
||||
width = dpi(100),
|
||||
max_height = dpi(600),
|
||||
visible = false,
|
||||
ontop = true,
|
||||
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(255), top = dpi(60) } }) end
|
||||
fg = color["Red200"],
|
||||
widget = wibox.container.background,
|
||||
id = "background2"
|
||||
},
|
||||
{
|
||||
{
|
||||
text = longname,
|
||||
widget = wibox.widget.textbox,
|
||||
font = user_vars.font.bold,
|
||||
id = "longname",
|
||||
},
|
||||
fg = color["Purple200"],
|
||||
widget = wibox.container.background,
|
||||
id = "background1"
|
||||
},
|
||||
spacing = dpi(15),
|
||||
layout = wibox.layout.fixed.horizontal,
|
||||
id = "container"
|
||||
},
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin,
|
||||
id = "margin"
|
||||
},
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 8)
|
||||
end,
|
||||
bg = color["Grey800"],
|
||||
fg = color["White"],
|
||||
widget = wibox.container.background,
|
||||
id = "background",
|
||||
keymap = keymap
|
||||
}
|
||||
|
||||
kb_menu_widget:setup(
|
||||
get_kblist()
|
||||
)
|
||||
|
||||
local function toggle_kb_layout()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"setxkbmap -query | grep layout: | awk '{print $2}'",
|
||||
function(stdout)
|
||||
for j, n in ipairs(user_vars.kblayout) do
|
||||
if stdout:match(n) then
|
||||
if j == #user_vars.kblayout then
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"setxkbmap " .. user_vars.kblayout[1],
|
||||
function()
|
||||
get_kblayout()
|
||||
end
|
||||
)
|
||||
else
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"setxkbmap " .. user_vars.kblayout[j + 1],
|
||||
function()
|
||||
get_kblayout()
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
-- TODO: Hover effects, this is more pain than I'm willing to take for now
|
||||
awesome.connect_signal(
|
||||
"update::background:kblayout",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ setxkbmap -query | grep layout | awk '{print $2}' ]],
|
||||
function(stdout)
|
||||
local layout = stdout:gsub("\n", "")
|
||||
if kb_layout_item.keymap == layout then
|
||||
kb_layout_item.bg = color["DeepPurple200"]
|
||||
kb_layout_item:get_children_by_id("background2")[1].fg = color["Grey900"]
|
||||
kb_layout_item:get_children_by_id("background1")[1].fg = color["Grey900"]
|
||||
else
|
||||
kb_layout_item.bg = color["Grey800"]
|
||||
kb_layout_item:get_children_by_id("background2")[1].fg = color["Red200"]
|
||||
kb_layout_item:get_children_by_id("background1")[1].fg = color["Purple200"]
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
awesome.connect_signal(
|
||||
"kblayout::toggle",
|
||||
function()
|
||||
toggle_kb_layout()
|
||||
end
|
||||
)
|
||||
|
||||
--kb_menu_widget:move_next_to(mouse.current_widget_geometry)
|
||||
-- Signals
|
||||
Hover_signal(kblayout_widget, color["Green200"])
|
||||
|
||||
local kblayout_keygrabber = awful.keygrabber {
|
||||
autostart = false,
|
||||
stop_event = 'release',
|
||||
keypressed_callback = function(self, mod, key, command)
|
||||
if key == 'Escape' then
|
||||
awesome.emit_signal("kblayout::hide:kbmenu")
|
||||
end
|
||||
end
|
||||
}
|
||||
|
||||
kblayout_widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
if kb_menu_widget.visible then
|
||||
kb_menu_widget.visible = false
|
||||
kblayout_keygrabber:stop()
|
||||
else
|
||||
kb_menu_widget.visible = true
|
||||
kblayout_keygrabber:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"kblayout::hide:kbmenu",
|
||||
function()
|
||||
kb_menu_widget.visible = false
|
||||
kblayout_keygrabber:stop()
|
||||
end
|
||||
)
|
||||
|
||||
get_kblayout()
|
||||
|
||||
kb_layout_item:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"setxkbmap " .. keymap,
|
||||
function()
|
||||
awesome.emit_signal("kblayout::hide:kbmenu")
|
||||
mousegrabber.stop()
|
||||
get_kblayout()
|
||||
end
|
||||
)
|
||||
end
|
||||
)
|
||||
return kb_layout_item
|
||||
end
|
||||
|
||||
local function get_kblist()
|
||||
local kb_layout_items = {
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
spacing = dpi(10)
|
||||
}
|
||||
for i, keymap in pairs(user_vars.kblayout) do
|
||||
kb_layout_items[i] = create_kb_layout_item(keymap)
|
||||
end
|
||||
local cont = {
|
||||
{
|
||||
kb_layout_items,
|
||||
margins = dpi(10),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
layout = wibox.layout.fixed.vertical,
|
||||
}
|
||||
return cont
|
||||
end
|
||||
|
||||
local kb_menu_widget = awful.popup {
|
||||
screen = s,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 12)
|
||||
end,
|
||||
widget = wibox.container.background,
|
||||
bg = color["Grey900"],
|
||||
fg = color["White"],
|
||||
border_width = dpi(4),
|
||||
border_color = color["Grey800"],
|
||||
width = dpi(100),
|
||||
max_height = dpi(600),
|
||||
visible = false,
|
||||
ontop = true,
|
||||
placement = function(c) awful.placement.align(c, { position = "top_right", margins = { right = dpi(255), top = dpi(60) } }) end
|
||||
}
|
||||
|
||||
kb_menu_widget:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
mousegrabber.run(
|
||||
function()
|
||||
kblayout_widget.bg = color["Green200"]
|
||||
if mouse.is_left_mouse_button_pressed then
|
||||
awesome.emit_signal("kblayout::hide:kbmenu")
|
||||
mousegrabber.stop()
|
||||
end
|
||||
return true
|
||||
end,
|
||||
"arrow"
|
||||
)
|
||||
end
|
||||
)
|
||||
|
||||
kb_menu_widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
mousegrabber.stop()
|
||||
end
|
||||
)
|
||||
|
||||
kb_menu_widget:setup(
|
||||
get_kblist()
|
||||
)
|
||||
|
||||
local function toggle_kb_layout()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"setxkbmap -query | grep layout: | awk '{print $2}'",
|
||||
function(stdout)
|
||||
for j, n in ipairs(user_vars.kblayout) do
|
||||
if stdout:match(n) then
|
||||
if j == #user_vars.kblayout then
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"setxkbmap " .. user_vars.kblayout[1],
|
||||
function()
|
||||
get_kblayout()
|
||||
end
|
||||
)
|
||||
else
|
||||
awful.spawn.easy_async_with_shell(
|
||||
"setxkbmap " .. user_vars.kblayout[j + 1],
|
||||
function()
|
||||
get_kblayout()
|
||||
end
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
awesome.connect_signal(
|
||||
"kblayout::toggle",
|
||||
function()
|
||||
toggle_kb_layout()
|
||||
end
|
||||
)
|
||||
|
||||
-- Signals
|
||||
Hover_signal(kblayout_widget, color["Green200"])
|
||||
|
||||
local kblayout_keygrabber = awful.keygrabber {
|
||||
autostart = false,
|
||||
stop_event = 'release',
|
||||
keypressed_callback = function(self, mod, key, command)
|
||||
awesome.emit_signal("kblayout::hide:kbmenu")
|
||||
mousegrabber.stop()
|
||||
end
|
||||
}
|
||||
|
||||
kblayout_widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
mousegrabber.stop()
|
||||
if kb_menu_widget.visible then
|
||||
kb_menu_widget.visible = false
|
||||
kblayout_keygrabber:stop()
|
||||
else
|
||||
kb_menu_widget.visible = true
|
||||
kblayout_keygrabber:start()
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
awesome.connect_signal(
|
||||
"kblayout::hide:kbmenu",
|
||||
function()
|
||||
kb_menu_widget.visible = false
|
||||
return kblayout_widget
|
||||
kblayout_keygrabber:stop()
|
||||
end
|
||||
)
|
||||
|
||||
get_kblayout()
|
||||
kb_menu_widget.visible = false
|
||||
return kblayout_widget
|
||||
end
|
||||
|
||||
@@ -12,35 +12,35 @@ require("src.core.signals")
|
||||
|
||||
-- Returns the layoutbox widget
|
||||
return function()
|
||||
local layout = wibox.widget {
|
||||
{
|
||||
{
|
||||
awful.widget.layoutbox(),
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
left = dpi(5),
|
||||
right = dpi(5),
|
||||
forced_width = dpi(40),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["LightBlue200"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
local layout = wibox.widget {
|
||||
{
|
||||
{
|
||||
awful.widget.layoutbox(),
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
left = dpi(5),
|
||||
right = dpi(5),
|
||||
forced_width = dpi(40),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["LightBlue200"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
-- Signals
|
||||
Hover_signal(layout, color["LightBlue200"])
|
||||
-- Signals
|
||||
Hover_signal(layout, color["LightBlue200"])
|
||||
|
||||
layout:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awful.layout.inc(-1)
|
||||
end
|
||||
)
|
||||
layout:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awful.layout.inc(-1)
|
||||
end
|
||||
)
|
||||
|
||||
return layout
|
||||
return layout
|
||||
end
|
||||
|
||||
@@ -16,68 +16,68 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/network/"
|
||||
|
||||
-- Insert your interfaces here, get the from ip a
|
||||
local interfaces = {
|
||||
wlan_interface = user_vars.network.wlan,
|
||||
lan_interface = user_vars.network.ethernet
|
||||
wlan_interface = user_vars.network.wlan,
|
||||
lan_interface = user_vars.network.ethernet
|
||||
}
|
||||
|
||||
local network_mode = nil
|
||||
|
||||
-- Returns the network widget
|
||||
return function()
|
||||
local startup = true
|
||||
local reconnect_startup = true
|
||||
local wifi_strength
|
||||
local network_widget = wibox.widget {
|
||||
local startup = true
|
||||
local reconnect_startup = true
|
||||
local wifi_strength
|
||||
local network_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = 'icon',
|
||||
image = gears.color.recolor_image(icondir .. "no-internet" .. ".svg", color["Grey900"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
spacing = dpi(10),
|
||||
{
|
||||
id = "label",
|
||||
visible = false,
|
||||
valign = "center",
|
||||
align = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "network_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
id = 'icon',
|
||||
image = gears.color.recolor_image(icondir .. "no-internet" .. ".svg", color["Grey900"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Red200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
spacing = dpi(10),
|
||||
{
|
||||
id = "label",
|
||||
visible = false,
|
||||
valign = "center",
|
||||
align = "center",
|
||||
widget = wibox.widget.textbox
|
||||
},
|
||||
id = "network_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Red200"],
|
||||
fg = color["Grey900"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local network_tooltip = awful.tooltip {
|
||||
text = "Loading",
|
||||
objects = { network_widget },
|
||||
mode = "inside",
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
local network_tooltip = awful.tooltip {
|
||||
text = "Loading",
|
||||
objects = { network_widget },
|
||||
mode = "inside",
|
||||
preferred_alignments = "middle",
|
||||
margins = dpi(10)
|
||||
}
|
||||
|
||||
local check_for_internet = [=[
|
||||
local check_for_internet = [=[
|
||||
status_ping=0
|
||||
packets="$(ping -q -w2 -c2 1.1.1.1 | grep -o "100% packet loss")"
|
||||
if [ ! -z "${packets}" ];
|
||||
@@ -92,181 +92,181 @@ return function()
|
||||
fi
|
||||
]=]
|
||||
|
||||
local update_startup = function()
|
||||
if startup then
|
||||
startup = false
|
||||
end
|
||||
local update_startup = function()
|
||||
if startup then
|
||||
startup = false
|
||||
end
|
||||
end
|
||||
|
||||
local update_reconnect_startup = function(status)
|
||||
reconnect_startup = status
|
||||
end
|
||||
|
||||
local update_tooltip = function(message)
|
||||
network_tooltip:set_markup(message)
|
||||
end
|
||||
|
||||
local network_notify = function(message, title, app_name, icon)
|
||||
naughty.notification {
|
||||
text = message,
|
||||
title = title,
|
||||
app_name = app_name,
|
||||
icon = gears.color.recolor_image(icon, color["White"]),
|
||||
timeout = 3
|
||||
}
|
||||
end
|
||||
|
||||
local update_wireless = function()
|
||||
network_mode = "wireless"
|
||||
|
||||
local notify_connected = function(essid)
|
||||
local message = "You are now connected to " .. essid
|
||||
local title = "Connection successfull"
|
||||
local app_name = "System Notification"
|
||||
local icon = icondir .. "wifi-strength-4.svg"
|
||||
network_notify(message, title, app_name, icon)
|
||||
end
|
||||
|
||||
local update_reconnect_startup = function(status)
|
||||
reconnect_startup = status
|
||||
local update_wireless_data = function(healthy)
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ iw dev ]] .. interfaces.wlan_interface .. [[ link ]],
|
||||
function(stdout)
|
||||
local essid = stdout:match("SSID: (.-)\n") or "N/A"
|
||||
local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A"
|
||||
local message = "Connected to <b>" .. essid .. "</b>\nSignal strength <b>" .. tostring(wifi_strength) .. "%</b>\n" .. "Bit rate <b>" .. tostring(bitrate) .. "</b>"
|
||||
|
||||
if healthy then
|
||||
update_tooltip(message)
|
||||
else
|
||||
update_tooltip("You are connected but have no internet" .. message)
|
||||
end
|
||||
|
||||
if reconnect_startup or startup then
|
||||
notify_connected(essid)
|
||||
update_reconnect_startup(false)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local update_tooltip = function(message)
|
||||
network_tooltip:set_markup(message)
|
||||
end
|
||||
|
||||
local network_notify = function(message, title, app_name, icon)
|
||||
naughty.notify({
|
||||
text = message,
|
||||
title = title,
|
||||
app_name = app_name,
|
||||
icon = gears.color.recolor_image(icon, color["White"]),
|
||||
timeout = 3
|
||||
})
|
||||
end
|
||||
|
||||
local update_wireless = function()
|
||||
network_mode = "wireless"
|
||||
|
||||
local notify_connected = function(essid)
|
||||
local message = "You are now connected to " .. essid
|
||||
local title = "Connection successfull"
|
||||
local app_name = "System Notification"
|
||||
local icon = icondir .. "wifi-strength-4.svg"
|
||||
network_notify(message, title, app_name, icon)
|
||||
local update_wireless_icon = function(strength)
|
||||
awful.spawn.easy_async_with_shell(
|
||||
check_for_internet,
|
||||
function(stdout)
|
||||
local icon = "wifi-strength"
|
||||
if not stdout:match("Connected but no internet") then
|
||||
if startup or reconnect_startup then
|
||||
awesome.emit_signal("system::network_connected")
|
||||
end
|
||||
icon = icon .. '-' .. tostring(strength)
|
||||
update_wireless_data(true)
|
||||
else
|
||||
icon = icon .. "-" .. tostring(strength)
|
||||
update_wireless_data(false)
|
||||
end
|
||||
|
||||
local update_wireless_data = function(healthy)
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ iw dev ]] .. interfaces.wlan_interface .. [[ link ]],
|
||||
function(stdout)
|
||||
local essid = stdout:match("SSID: (.-)\n") or "N/A"
|
||||
local bitrate = stdout:match("tx bitrate: (.+/s)") or "N/A"
|
||||
local message = "Connected to <b>" .. essid .. "</b>\nSignal strength <b>" .. tostring(wifi_strength) .. "%</b>\n" .. "Bit rate <b>" .. tostring(bitrate) .. "</b>"
|
||||
|
||||
if healthy then
|
||||
update_tooltip(message)
|
||||
else
|
||||
update_tooltip("You are connected but have no internet" .. message)
|
||||
end
|
||||
|
||||
if reconnect_startup or startup then
|
||||
notify_connected(essid)
|
||||
update_reconnect_startup(false)
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local update_wireless_icon = function(strength)
|
||||
awful.spawn.easy_async_with_shell(
|
||||
check_for_internet,
|
||||
function(stdout)
|
||||
local icon = "wifi-strength"
|
||||
if not stdout:match("Connected but no internet") then
|
||||
if startup or reconnect_startup then
|
||||
awesome.emit_signal("system::network_connected")
|
||||
end
|
||||
icon = icon .. '-' .. tostring(strength)
|
||||
update_wireless_data(true)
|
||||
else
|
||||
icon = icon .. "-" .. tostring(strength)
|
||||
update_wireless_data(false)
|
||||
end
|
||||
network_widget.container.network_layout.spacing = dpi(8)
|
||||
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"]))
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local update_wireless_strength = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ awk 'NR==3 {printf "%3.0f", ($3/70)*100}' /proc/net/wireless ]],
|
||||
function(stdout)
|
||||
if not tonumber(stdout) then
|
||||
return
|
||||
end
|
||||
wifi_strength = tonumber(stdout)
|
||||
network_widget.container.network_layout.spacing = dpi(8)
|
||||
network_widget.container.network_layout.label.visible = true
|
||||
network_widget.container.network_layout.label:set_text(tostring(wifi_strength .. "%"))
|
||||
local wifi_strength_rounded = math.floor(wifi_strength / 25 + 0.5)
|
||||
update_wireless_icon(wifi_strength_rounded)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
update_wireless_strength()
|
||||
update_startup()
|
||||
end
|
||||
|
||||
local update_wired = function()
|
||||
network_mode = "wired"
|
||||
|
||||
local notify_connected = function()
|
||||
local message = "You are now connected to " .. interfaces.lan_interface
|
||||
local title = "Connection successfull"
|
||||
local app_name = "System Notification"
|
||||
local icon = icondir .. "ethernet.svg"
|
||||
network_notify(message, title, app_name, icon)
|
||||
end
|
||||
|
||||
awful.spawn.easy_async_with_shell(
|
||||
check_for_internet,
|
||||
function(stdout)
|
||||
local icon = "ethernet"
|
||||
|
||||
if stdout:match("Connected but no internet") then
|
||||
icon = "no-internet"
|
||||
update_tooltip(
|
||||
"No internet"
|
||||
)
|
||||
else
|
||||
update_tooltip("You are connected to:\nEthernet Interface <b>" .. interfaces.lan_interface .. "</b>")
|
||||
if startup or reconnect_startup then
|
||||
awesome.emit_signal("system::network_connected")
|
||||
notify_connected()
|
||||
update_startup()
|
||||
end
|
||||
update_reconnect_startup(false)
|
||||
end
|
||||
network_widget.container.network_layout.label.visible = false
|
||||
network_widget.container.network_layout.spacing = dpi(0)
|
||||
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(icondir .. icon .. ".svg")
|
||||
end
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
local update_disconnected = function()
|
||||
local notify_wireless_disconnected = function(essid)
|
||||
local message = "WiFi has been disconnected"
|
||||
local title = "Connection lost"
|
||||
local app_name = "System Notification"
|
||||
local icon = icondir .. "wifi-strength-off-outline.svg"
|
||||
network_notify(message, title, app_name, icon)
|
||||
end
|
||||
local notify_wired_disconnected = function(essid)
|
||||
local message = "Ethernet has been unplugged"
|
||||
local title = "Connection lost"
|
||||
local app_name = "System Notification"
|
||||
local icon = icondir .. "no-internet.svg"
|
||||
network_notify(message, title, app_name, icon)
|
||||
end
|
||||
local icon = "wifi-strength-off-outline"
|
||||
if network_mode == "wireless" then
|
||||
icon = "wifi-strength-off-outline"
|
||||
if not reconnect_startup then
|
||||
update_reconnect_startup(true)
|
||||
notify_wireless_disconnected()
|
||||
end
|
||||
elseif network_mode == "wired" then
|
||||
icon = "no-internet"
|
||||
if not reconnect_startup then
|
||||
update_reconnect_startup(true)
|
||||
notify_wired_disconnected()
|
||||
end
|
||||
end
|
||||
network_widget.container.network_layout.label.visible = false
|
||||
update_tooltip("Network unreachable")
|
||||
network_widget.container.network_layout.spacing = dpi(0)
|
||||
network_widget.container.network_layout.spacing = dpi(8)
|
||||
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"]))
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
local check_network_mode = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
local update_wireless_strength = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[[ awk 'NR==3 {printf "%3.0f", ($3/70)*100}' /proc/net/wireless ]],
|
||||
function(stdout)
|
||||
if not tonumber(stdout) then
|
||||
return
|
||||
end
|
||||
wifi_strength = tonumber(stdout)
|
||||
network_widget.container.network_layout.spacing = dpi(8)
|
||||
network_widget.container.network_layout.label.visible = true
|
||||
network_widget.container.network_layout.label:set_text(tostring(wifi_strength .. "%"))
|
||||
local wifi_strength_rounded = math.floor(wifi_strength / 25 + 0.5)
|
||||
update_wireless_icon(wifi_strength_rounded)
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
update_wireless_strength()
|
||||
update_startup()
|
||||
end
|
||||
|
||||
local update_wired = function()
|
||||
network_mode = "wired"
|
||||
|
||||
local notify_connected = function()
|
||||
local message = "You are now connected to " .. interfaces.lan_interface
|
||||
local title = "Connection successfull"
|
||||
local app_name = "System Notification"
|
||||
local icon = icondir .. "ethernet.svg"
|
||||
network_notify(message, title, app_name, icon)
|
||||
end
|
||||
|
||||
awful.spawn.easy_async_with_shell(
|
||||
check_for_internet,
|
||||
function(stdout)
|
||||
local icon = "ethernet"
|
||||
|
||||
if stdout:match("Connected but no internet") then
|
||||
icon = "no-internet"
|
||||
update_tooltip(
|
||||
"No internet"
|
||||
)
|
||||
else
|
||||
update_tooltip("You are connected to:\nEthernet Interface <b>" .. interfaces.lan_interface .. "</b>")
|
||||
if startup or reconnect_startup then
|
||||
awesome.emit_signal("system::network_connected")
|
||||
notify_connected()
|
||||
update_startup()
|
||||
end
|
||||
update_reconnect_startup(false)
|
||||
end
|
||||
network_widget.container.network_layout.label.visible = false
|
||||
network_widget.container.network_layout.spacing = dpi(0)
|
||||
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(icondir .. icon .. ".svg")
|
||||
end
|
||||
)
|
||||
|
||||
end
|
||||
|
||||
local update_disconnected = function()
|
||||
local notify_wireless_disconnected = function(essid)
|
||||
local message = "WiFi has been disconnected"
|
||||
local title = "Connection lost"
|
||||
local app_name = "System Notification"
|
||||
local icon = icondir .. "wifi-strength-off-outline.svg"
|
||||
network_notify(message, title, app_name, icon)
|
||||
end
|
||||
local notify_wired_disconnected = function(essid)
|
||||
local message = "Ethernet has been unplugged"
|
||||
local title = "Connection lost"
|
||||
local app_name = "System Notification"
|
||||
local icon = icondir .. "no-internet.svg"
|
||||
network_notify(message, title, app_name, icon)
|
||||
end
|
||||
local icon = "wifi-strength-off-outline"
|
||||
if network_mode == "wireless" then
|
||||
icon = "wifi-strength-off-outline"
|
||||
if not reconnect_startup then
|
||||
update_reconnect_startup(true)
|
||||
notify_wireless_disconnected()
|
||||
end
|
||||
elseif network_mode == "wired" then
|
||||
icon = "no-internet"
|
||||
if not reconnect_startup then
|
||||
update_reconnect_startup(true)
|
||||
notify_wired_disconnected()
|
||||
end
|
||||
end
|
||||
network_widget.container.network_layout.label.visible = false
|
||||
update_tooltip("Network unreachable")
|
||||
network_widget.container.network_layout.spacing = dpi(0)
|
||||
network_widget.container.network_layout.icon_margin.icon_layout.icon:set_image(gears.color.recolor_image(icondir .. icon .. ".svg", color["Grey900"]))
|
||||
end
|
||||
|
||||
local check_network_mode = function()
|
||||
awful.spawn.easy_async_with_shell(
|
||||
[=[
|
||||
wireless="]=] .. tostring(interfaces.wlan_interface) .. [=["
|
||||
wired="]=] .. tostring(interfaces.lan_interface) .. [=["
|
||||
net="/sys/class/net/"
|
||||
@@ -301,37 +301,37 @@ return function()
|
||||
}
|
||||
print_network_mode
|
||||
]=],
|
||||
function(stdout)
|
||||
local mode = stdout:gsub("%\n", "")
|
||||
if stdout:match("No internet connected") then
|
||||
update_disconnected()
|
||||
elseif stdout:match("wireless") then
|
||||
update_wireless()
|
||||
elseif stdout:match("wired") then
|
||||
update_wired()
|
||||
end
|
||||
end
|
||||
)
|
||||
function(stdout)
|
||||
local mode = stdout:gsub("%\n", "")
|
||||
if stdout:match("No internet connected") then
|
||||
update_disconnected()
|
||||
elseif stdout:match("wireless") then
|
||||
update_wireless()
|
||||
elseif stdout:match("wired") then
|
||||
update_wired()
|
||||
end
|
||||
end
|
||||
|
||||
local network_updater = gears.timer {
|
||||
timeout = 5,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function()
|
||||
check_network_mode()
|
||||
end
|
||||
}
|
||||
|
||||
-- Signals
|
||||
Hover_signal(network_widget, color["Red200"])
|
||||
|
||||
network_widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awful.spawn("gnome-control-center wlan")
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
return network_widget
|
||||
gears.timer {
|
||||
timeout = 5,
|
||||
autostart = true,
|
||||
call_now = true,
|
||||
callback = function()
|
||||
check_network_mode()
|
||||
end
|
||||
}
|
||||
|
||||
-- Signals
|
||||
Hover_signal(network_widget, color["Red200"])
|
||||
|
||||
network_widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
awful.spawn("gnome-control-center wlan")
|
||||
end
|
||||
)
|
||||
|
||||
return network_widget
|
||||
end
|
||||
|
||||
@@ -15,49 +15,49 @@ local icondir = awful.util.getdir("config") .. "src/assets/icons/power/"
|
||||
|
||||
return function()
|
||||
|
||||
local power_widget = wibox.widget {
|
||||
local power_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
{
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "power.svg", color["Grey900"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
id = "power_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
id = "icon",
|
||||
image = gears.color.recolor_image(icondir .. "power.svg", color["Grey900"]),
|
||||
widget = wibox.widget.imagebox,
|
||||
resize = false
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
id = "icon_layout",
|
||||
widget = wibox.container.place
|
||||
},
|
||||
id = "icon_margin",
|
||||
top = dpi(2),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Red200"],
|
||||
fg = color["Grey800"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
id = "power_layout",
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "container",
|
||||
left = dpi(8),
|
||||
right = dpi(8),
|
||||
widget = wibox.container.margin
|
||||
},
|
||||
bg = color["Red200"],
|
||||
fg = color["Grey800"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
-- Signals
|
||||
Hover_signal(power_widget, color["Red200"])
|
||||
-- Signals
|
||||
Hover_signal(power_widget, color["Red200"])
|
||||
|
||||
power_widget:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
awesome.emit_signal("module::powermenu:show")
|
||||
end
|
||||
)
|
||||
power_widget:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
awesome.emit_signal("module::powermenu:show")
|
||||
end
|
||||
)
|
||||
|
||||
return power_widget
|
||||
return power_widget
|
||||
end
|
||||
|
||||
@@ -7,7 +7,6 @@ local awful = require("awful")
|
||||
local color = require("src.theme.colors")
|
||||
local dpi = require("beautiful").xresources.apply_dpi
|
||||
local gears = require("gears")
|
||||
local naughty = require("naughty")
|
||||
local watch = awful.widget.watch
|
||||
local wibox = require("wibox")
|
||||
require("src.core.signals")
|
||||
|
||||
@@ -12,37 +12,37 @@ local wibox = require("wibox")
|
||||
require("src.core.signals")
|
||||
|
||||
return function(s)
|
||||
local systray = wibox.widget {
|
||||
{
|
||||
{
|
||||
wibox.widget.systray(),
|
||||
widget = wibox.container.margin,
|
||||
id = 'st'
|
||||
},
|
||||
strategy = "exact",
|
||||
layout = wibox.container.constraint,
|
||||
id = "container"
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
bg = color["BlueGrey800"]
|
||||
}
|
||||
-- Signals
|
||||
Hover_signal(systray.container, color["Red200"])
|
||||
local systray = wibox.widget {
|
||||
{
|
||||
{
|
||||
wibox.widget.systray(),
|
||||
widget = wibox.container.margin,
|
||||
id = 'st'
|
||||
},
|
||||
strategy = "exact",
|
||||
layout = wibox.container.constraint,
|
||||
id = "container"
|
||||
},
|
||||
widget = wibox.container.background,
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
bg = color["BlueGrey800"]
|
||||
}
|
||||
-- Signals
|
||||
Hover_signal(systray.container, color["Red200"])
|
||||
|
||||
awesome.connect_signal("systray::update", function()
|
||||
local num_entries = awesome.systray()
|
||||
awesome.connect_signal("systray::update", function()
|
||||
local num_entries = awesome.systray()
|
||||
|
||||
if num_entries == 0 then
|
||||
systray.container.st:set_margins(0)
|
||||
else
|
||||
systray.container.st:set_margins(dpi(6))
|
||||
end
|
||||
end)
|
||||
if num_entries == 0 then
|
||||
systray.container.st:set_margins(0)
|
||||
else
|
||||
systray.container.st:set_margins(dpi(6))
|
||||
end
|
||||
end)
|
||||
|
||||
systray.container.st.widget:set_base_size(dpi(20))
|
||||
systray.container.st.widget:set_base_size(dpi(20))
|
||||
|
||||
return systray
|
||||
return systray
|
||||
end
|
||||
|
||||
@@ -6,235 +6,235 @@ local color = require("src.theme.colors")
|
||||
require("src.tools.icon_handler")
|
||||
|
||||
local list_update = function(widget, buttons, label, data, objects)
|
||||
widget:reset()
|
||||
widget:reset()
|
||||
|
||||
for i, object in ipairs(objects) do
|
||||
for i, object in ipairs(objects) do
|
||||
|
||||
local tag_icon = wibox.widget {
|
||||
nil,
|
||||
{
|
||||
id = "icon",
|
||||
resize = true,
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
nil,
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
local tag_icon = wibox.widget {
|
||||
nil,
|
||||
{
|
||||
id = "icon",
|
||||
resize = true,
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
nil,
|
||||
layout = wibox.layout.align.horizontal
|
||||
}
|
||||
|
||||
local tag_icon_margin = wibox.widget {
|
||||
tag_icon,
|
||||
forced_width = dpi(33),
|
||||
margins = dpi(3),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
local tag_icon_margin = wibox.widget {
|
||||
tag_icon,
|
||||
forced_width = dpi(33),
|
||||
margins = dpi(3),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
local tag_label = wibox.widget {
|
||||
text = "",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
visible = true,
|
||||
font = user_vars.font.extrabold,
|
||||
forced_width = dpi(25),
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
local tag_label = wibox.widget {
|
||||
text = "",
|
||||
align = "center",
|
||||
valign = "center",
|
||||
visible = true,
|
||||
font = user_vars.font.extrabold,
|
||||
forced_width = dpi(25),
|
||||
widget = wibox.widget.textbox
|
||||
}
|
||||
|
||||
local tag_label_margin = wibox.widget {
|
||||
tag_label,
|
||||
left = dpi(5),
|
||||
right = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
local tag_label_margin = wibox.widget {
|
||||
tag_label,
|
||||
left = dpi(5),
|
||||
right = dpi(5),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
|
||||
local tag_widget = wibox.widget {
|
||||
local tag_widget = wibox.widget {
|
||||
|
||||
id = "widget_margin",
|
||||
{
|
||||
id = "container",
|
||||
tag_label_margin,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
id = "widget_margin",
|
||||
{
|
||||
id = "container",
|
||||
tag_label_margin,
|
||||
layout = wibox.layout.fixed.horizontal
|
||||
},
|
||||
|
||||
fg = color["White"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
fg = color["White"],
|
||||
shape = function(cr, width, height)
|
||||
gears.shape.rounded_rect(cr, width, height, 5)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local function create_buttons(buttons, object)
|
||||
if buttons then
|
||||
local btns = {}
|
||||
for _, b in ipairs(buttons) do
|
||||
local btn = awful.button {
|
||||
modifiers = b.modifiers,
|
||||
button = b.button,
|
||||
on_press = function()
|
||||
b:emit_signal('press', object)
|
||||
end,
|
||||
widget = wibox.container.background
|
||||
}
|
||||
|
||||
local function create_buttons(buttons, object)
|
||||
if buttons then
|
||||
local btns = {}
|
||||
for _, b in ipairs(buttons) do
|
||||
local btn = awful.button {
|
||||
modifiers = b.modifiers,
|
||||
button = b.button,
|
||||
on_press = function()
|
||||
b:emit_signal('press', object)
|
||||
end,
|
||||
on_release = function()
|
||||
b:emit_signal('release', object)
|
||||
end
|
||||
}
|
||||
btns[#btns + 1] = btn
|
||||
end
|
||||
return btns
|
||||
on_release = function()
|
||||
b:emit_signal('release', object)
|
||||
end
|
||||
}
|
||||
btns[#btns + 1] = btn
|
||||
end
|
||||
|
||||
tag_widget:buttons(create_buttons(buttons, object))
|
||||
|
||||
local text, bg_color, bg_image, icon, args = label(object, tag_label)
|
||||
tag_label:set_text(object.index)
|
||||
if object.urgent == true then
|
||||
tag_widget:set_bg(color["RedA200"])
|
||||
tag_widget:set_fg(color["Grey900"])
|
||||
elseif object == awful.screen.focused().selected_tag then
|
||||
tag_widget:set_bg(color["White"])
|
||||
tag_widget:set_fg(color["Grey900"])
|
||||
else
|
||||
tag_widget:set_bg("#3A475C")
|
||||
end
|
||||
|
||||
-- Set the icon for each client
|
||||
for _, client in ipairs(object:clients()) do
|
||||
tag_label_margin:set_right(0)
|
||||
local icon = wibox.widget {
|
||||
{
|
||||
id = "icon_container",
|
||||
{
|
||||
id = "icon",
|
||||
resize = true,
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
widget = wibox.container.place
|
||||
},
|
||||
tag_icon_margin,
|
||||
forced_width = dpi(33),
|
||||
margins = dpi(6),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
icon.icon_container.icon:set_image(Get_icon(user_vars.icon_theme, client))
|
||||
tag_widget.container:setup({
|
||||
icon,
|
||||
strategy = "exact",
|
||||
layout = wibox.container.constraint,
|
||||
})
|
||||
end
|
||||
|
||||
local old_wibox, old_cursor, old_bg
|
||||
tag_widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
old_bg = tag_widget.bg
|
||||
if object == awful.screen.focused().selected_tag then
|
||||
tag_widget.bg = '#dddddd' .. 'dd'
|
||||
else
|
||||
tag_widget.bg = '#3A475C' .. 'dd'
|
||||
end
|
||||
local w = mouse.current_wibox
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
tag_widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
if object == awful.screen.focused().selected_tag then
|
||||
tag_widget.bg = '#bbbbbb' .. 'dd'
|
||||
else
|
||||
tag_widget.bg = '#3A475C' .. 'dd'
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
tag_widget:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
if object == awful.screen.focused().selected_tag then
|
||||
tag_widget.bg = '#dddddd' .. 'dd'
|
||||
else
|
||||
tag_widget.bg = '#3A475C' .. 'dd'
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
tag_widget:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
tag_widget.bg = old_bg
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
widget:add(tag_widget)
|
||||
widget:set_spacing(dpi(6))
|
||||
return btns
|
||||
end
|
||||
end
|
||||
|
||||
tag_widget:buttons(create_buttons(buttons, object))
|
||||
|
||||
local text, bg_color, bg_image, icon, args = label(object, tag_label)
|
||||
tag_label:set_text(object.index)
|
||||
if object.urgent == true then
|
||||
tag_widget:set_bg(color["RedA200"])
|
||||
tag_widget:set_fg(color["Grey900"])
|
||||
elseif object == awful.screen.focused().selected_tag then
|
||||
tag_widget:set_bg(color["White"])
|
||||
tag_widget:set_fg(color["Grey900"])
|
||||
else
|
||||
tag_widget:set_bg("#3A475C")
|
||||
end
|
||||
|
||||
-- Set the icon for each client
|
||||
for _, client in ipairs(object:clients()) do
|
||||
tag_label_margin:set_right(0)
|
||||
local icon = wibox.widget {
|
||||
{
|
||||
id = "icon_container",
|
||||
{
|
||||
id = "icon",
|
||||
resize = true,
|
||||
widget = wibox.widget.imagebox
|
||||
},
|
||||
widget = wibox.container.place
|
||||
},
|
||||
tag_icon_margin,
|
||||
forced_width = dpi(33),
|
||||
margins = dpi(6),
|
||||
widget = wibox.container.margin
|
||||
}
|
||||
icon.icon_container.icon:set_image(Get_icon(user_vars.icon_theme, client))
|
||||
tag_widget.container:setup({
|
||||
icon,
|
||||
strategy = "exact",
|
||||
layout = wibox.container.constraint,
|
||||
})
|
||||
end
|
||||
|
||||
local old_wibox, old_cursor, old_bg
|
||||
tag_widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
old_bg = tag_widget.bg
|
||||
if object == awful.screen.focused().selected_tag then
|
||||
tag_widget.bg = '#dddddd' .. 'dd'
|
||||
else
|
||||
tag_widget.bg = '#3A475C' .. 'dd'
|
||||
end
|
||||
local w = mouse.current_wibox
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
tag_widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
if object == awful.screen.focused().selected_tag then
|
||||
tag_widget.bg = '#bbbbbb' .. 'dd'
|
||||
else
|
||||
tag_widget.bg = '#3A475C' .. 'dd'
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
tag_widget:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
if object == awful.screen.focused().selected_tag then
|
||||
tag_widget.bg = '#dddddd' .. 'dd'
|
||||
else
|
||||
tag_widget.bg = '#3A475C' .. 'dd'
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
tag_widget:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
tag_widget.bg = old_bg
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
widget:add(tag_widget)
|
||||
widget:set_spacing(dpi(6))
|
||||
end
|
||||
end
|
||||
|
||||
local tag_list = function(s)
|
||||
return awful.widget.taglist(
|
||||
s,
|
||||
awful.widget.taglist.filter.noempty,
|
||||
gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
1,
|
||||
function(t)
|
||||
t:view_only()
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{ modkey },
|
||||
1,
|
||||
function(t)
|
||||
if client.focus then
|
||||
client.focus:move_to_tag(t)
|
||||
end
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function(t)
|
||||
if client.focus then
|
||||
client.focus:toggle_tag(t)
|
||||
end
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{ modkey },
|
||||
3,
|
||||
function(t)
|
||||
if client.focus then
|
||||
client.focus:toggle_tag(t)
|
||||
end
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
4,
|
||||
function(t)
|
||||
awful.tag.viewnext(t.screen)
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
5,
|
||||
function(t)
|
||||
awful.tag.viewprev(t.screen)
|
||||
end
|
||||
)
|
||||
),
|
||||
return awful.widget.taglist(
|
||||
s,
|
||||
awful.widget.taglist.filter.noempty,
|
||||
gears.table.join(
|
||||
awful.button(
|
||||
{},
|
||||
list_update,
|
||||
wibox.layout.fixed.horizontal()
|
||||
)
|
||||
1,
|
||||
function(t)
|
||||
t:view_only()
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{ modkey },
|
||||
1,
|
||||
function(t)
|
||||
if client.focus then
|
||||
client.focus:move_to_tag(t)
|
||||
end
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function(t)
|
||||
if client.focus then
|
||||
client.focus:toggle_tag(t)
|
||||
end
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{ modkey },
|
||||
3,
|
||||
function(t)
|
||||
if client.focus then
|
||||
client.focus:toggle_tag(t)
|
||||
end
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
4,
|
||||
function(t)
|
||||
awful.tag.viewnext(t.screen)
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
5,
|
||||
function(t)
|
||||
awful.tag.viewprev(t.screen)
|
||||
end
|
||||
)
|
||||
),
|
||||
{},
|
||||
list_update,
|
||||
wibox.layout.fixed.horizontal()
|
||||
)
|
||||
end
|
||||
|
||||
return tag_list
|
||||
|
||||
@@ -6,9 +6,7 @@ local color = require('src.theme.colors')
|
||||
|
||||
local list_update = function(widget, buttons, label, data, objects)
|
||||
widget:reset()
|
||||
local count
|
||||
for i, object in ipairs(objects) do
|
||||
count = i
|
||||
for _, object in ipairs(objects) do
|
||||
local task_widget = wibox.widget {
|
||||
{
|
||||
{
|
||||
@@ -56,7 +54,10 @@ local list_update = function(widget, buttons, label, data, objects)
|
||||
local task_tool_tip = awful.tooltip {
|
||||
objects = { task_widget },
|
||||
mode = "inside",
|
||||
align = "right",
|
||||
preferred_alignments = "middle",
|
||||
preferred_positions = "bottom",
|
||||
margins = dpi(10),
|
||||
gaps = 0,
|
||||
delay_show = 1
|
||||
}
|
||||
|
||||
@@ -115,51 +116,51 @@ local list_update = function(widget, buttons, label, data, objects)
|
||||
task_widget:connect_signal(
|
||||
"mouse::enter",
|
||||
function()
|
||||
old_bg = task_widget.bg
|
||||
if object == client.focus then
|
||||
task_widget.bg = '#dddddddd'
|
||||
else
|
||||
task_widget.bg = '#3A475Cdd'
|
||||
end
|
||||
local w = mouse.current_wibox
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
old_bg = task_widget.bg
|
||||
if object == client.focus then
|
||||
task_widget.bg = '#dddddddd'
|
||||
else
|
||||
task_widget.bg = '#3A475Cdd'
|
||||
end
|
||||
local w = mouse.current_wibox
|
||||
if w then
|
||||
old_cursor, old_wibox = w.cursor, w
|
||||
w.cursor = "hand1"
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
task_widget:connect_signal(
|
||||
"button::press",
|
||||
function()
|
||||
if object == client.focus then
|
||||
task_widget.bg = "#ffffffaa"
|
||||
else
|
||||
task_widget.bg = '#3A475Caa'
|
||||
end
|
||||
if object == client.focus then
|
||||
task_widget.bg = "#ffffffaa"
|
||||
else
|
||||
task_widget.bg = '#3A475Caa'
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
task_widget:connect_signal(
|
||||
"button::release",
|
||||
function()
|
||||
if object == client.focus then
|
||||
task_widget.bg = "#ffffffdd"
|
||||
else
|
||||
task_widget.bg = '#3A475Cdd'
|
||||
end
|
||||
if object == client.focus then
|
||||
task_widget.bg = "#ffffffdd"
|
||||
else
|
||||
task_widget.bg = '#3A475Cdd'
|
||||
end
|
||||
end
|
||||
)
|
||||
|
||||
task_widget:connect_signal(
|
||||
"mouse::leave",
|
||||
function()
|
||||
task_widget.bg = old_bg
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end
|
||||
task_widget.bg = old_bg
|
||||
if old_wibox then
|
||||
old_wibox.cursor = old_cursor
|
||||
old_wibox = nil
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
return widget
|
||||
@@ -174,24 +175,24 @@ local tasklist = function(s)
|
||||
{},
|
||||
1,
|
||||
function(c)
|
||||
if c == client.focus then
|
||||
c.minimized = true
|
||||
else
|
||||
c.minimized = false
|
||||
if not c:isvisible() and c.first_tag then
|
||||
c.first_tag:view_only()
|
||||
end
|
||||
c:emit_signal('request::activate')
|
||||
c:raise()
|
||||
if c == client.focus then
|
||||
c.minimized = true
|
||||
else
|
||||
c.minimized = false
|
||||
if not c:isvisible() and c.first_tag then
|
||||
c.first_tag:view_only()
|
||||
end
|
||||
c:emit_signal('request::activate')
|
||||
c:raise()
|
||||
end
|
||||
end
|
||||
),
|
||||
awful.button(
|
||||
{},
|
||||
3,
|
||||
function(c)
|
||||
c:kill()
|
||||
end
|
||||
c:kill()
|
||||
end
|
||||
)
|
||||
),
|
||||
{},
|
||||
|
||||