Merge branch 'master' of github.com:kristoferssolo/solorice

This commit is contained in:
Kristofers Solo 2022-06-02 15:36:22 +03:00
commit 4e4089a261
3 changed files with 79 additions and 24 deletions

View File

@ -2,9 +2,8 @@
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
pcall(require, "luarocks.loader")
-- Awesome Wm Widgets
-- AwesomeWM Widgets
local cpu_widget = require("awesome-wm-widgets.cpu-widget.cpu-widget")
local brightness_widget = require("awesome-wm-widgets.brightness-widget.brightness")
local spotify_widget = require("awesome-wm-widgets.spotify-widget.spotify")
local volume_widget = require("awesome-wm-widgets.volume-widget.volume")
local net_speed_widget = require("awesome-wm-widgets.net-speed-widget.net-speed")
@ -29,6 +28,32 @@ local hotkeys_popup = require("awful.hotkeys_popup")
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
-- OpenWeather API
-- !Create file ~/.config/awesome/weather and paste API from OpenWeather, latitude and longitude, each on separate lines
local weather_file = '/home/kristofers/.config/awesome/weather' -- absolute path to `weather` file
-- see if the file exists
local function file_exists(file)
local f = io.open(file, "rb")
if f then f:close() end
return f ~= nil
end
-- get all lines from a file, returns an empty
-- list/table if the file does not exist
local function lines_from(file)
if not file_exists(file) then return {} end
local lines = {}
for line in io.lines(file) do
lines[#lines + 1] = line
end
return lines
end
local weather_output = lines_from(weather_file)
local API = weather_output[1]
local latitude = tonumber(weather_output[2])
local longitude = tonumber(weather_output[3])
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
@ -244,8 +269,8 @@ awful.screen.connect_for_each_screen(function(s)
max_lenght = -1,
}),
weather_widget({
api_key = '3bc28ba1ee6eeaf28af31d9d948aecd1',
coordinates = { 56.861415323546815, 24.386162623793343 },
api_key = API,
coordinates = { latitude, longitude },
show_daily_forecast = true,
}),
--volume_widget{
@ -274,6 +299,9 @@ globalkeys = gears.table.join(
awful.key({}, "Pause", function() awful.spawn.with_shell("playerctl -a play-pause") end,
{ description = "pause/play", group = "media controls" }),
awful.key({ "Control" }, "Pause", function() awful.spawn.with_shell("playerctl -a pause") end,
{ description = "pause all", group = "media controls" }),
awful.key({}, "#117", function() awful.spawn.with_shell("playerctl next") end,
{ description = "play next", group = "media controls" }),

View File

@ -30,6 +30,32 @@ local hotkeys_popup = require("awful.hotkeys_popup")
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
-- OpenWeather API
-- !Create file ~/.config/awesome/weather and paste API from OpenWeather, latitude and longitude, each on separate lines
local weather_file = '/home/kristofers/.config/awesome/weather' -- absolute path to `weather` file
-- see if the file exists
local function file_exists(file)
local f = io.open(file, "rb")
if f then f:close() end
return f ~= nil
end
-- get all lines from a file, returns an empty
-- list/table if the file does not exist
local function lines_from(file)
if not file_exists(file) then return {} end
local lines = {}
for line in io.lines(file) do
lines[#lines + 1] = line
end
return lines
end
local weather_output = lines_from(weather_file)
local API = weather_output[1]
local latitude = tonumber(weather_output[2])
local longitude = tonumber(weather_output[3])
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
@ -255,8 +281,8 @@ awful.screen.connect_for_each_screen(function(s)
tooltip = true,
},
weather_widget({
api_key = '3bc28ba1ee6eeaf28af31d9d948aecd1',
coordinates = { 56.86140361300421, 24.386173343039193 },
api_key = API,
coordinates = { latitude, longitude },
show_hourly_forecst = true,
show_daily_forecast = true,
}),

View File

@ -117,29 +117,30 @@ bindkey -M vicmd '^e' edit-command-line
bindkey -M visual '^[[P' vi-delete
# Aliases
alias airpods='bluetoothctl connect C8:B1:CD:E0:14:4F'
alias battery='acpi'
alias code='vscodium'
alias cp='cp -iv' # Confirm before overwriting something
alias mv='mv -iv'
alias rm='rm -vI'
alias mkdir='mkdir -pv'
alias df='df -h' # Human-readable sizes
alias diff='diff --color=auto'
alias dv='doasedit'
alias free='free -m' # Show sizes in MB
alias gitu='git add . && git commit && git push'
alias ls='exa -a --icons --group-directories-first'
alias grep='grep --color=auto'
alias grep='rg'
alias ip='ip -color=auto'
alias lf='lfrun'
alias v='nvim'
alias dv='doasedit'
alias ls='exa -a --icons --group-directories-first'
alias matrix='unimatrix -s 95'
alias mkdir='mkdir -pv'
alias mv='mv -iv'
alias nsxiv='nsxiv -a'
alias pman='doas pacman'
alias battery='acpi'
alias airpods='bluetoothctl connect C8:B1:CD:E0:14:4F'
alias py='python'
alias rm='rm -vI'
alias v='nvim'
alias weather='curl wttr.in/'
alias ww='nvim ~/vimwiki/index.wiki'
alias py='python'
alias grep='grep --color=auto'
alias diff='diff --color=auto'
alias ip='ip -color=auto'
alias grep='rg'
alias code='vscodium'
source /usr/share/zsh/plugins/fast-syntax-highlighting/fast-syntax-highlighting.plugin.zsh 2>/dev/null