feat: awesome on voidlinux

This commit is contained in:
Klesh Wong 2022-05-03 23:20:26 +08:00
parent edd07ed140
commit 2d0f9a4eef
20 changed files with 943 additions and 102 deletions

View File

@ -51,16 +51,6 @@ if [ -n "$WSL" ]; then
fi
# only for local machine with gui
if [ -z "$SSH_CLIENT" ] && [ -n "$DISPLAY" ] && has_cmd dash; then
log 'Setting up dash as default shell'
sudo /usr/bin/ln -sfT dash /usr/bin/sh
if [ "$(awk -F':' '/^'"$USER"'/{print $7}' /etc/passwd)" != "/bin/sh" ]; then
chsh -s /bin/sh
fi
fi
log 'Setting up fish'
lnsf "$DIR/fish/config.fish" "$XDG_CONFIG_HOME/fish/config.fish"
@ -106,3 +96,13 @@ set -U fish_pager_color_description B3A06D yellow
set -U fish_pager_color_prefix white --bold --underline
set -U fish_pager_color_progress brwhite --background=cyan
' > /dev/null
# only for local machine with gui
if [ -z "$SSH_CLIENT" ] && [ -n "$DISPLAY" ] && has_cmd dash; then
log 'Setting up dash as default shell'
sudo /usr/bin/ln -sfT dash /usr/bin/sh
if [ "$(awk -F':' '/^'"$USER"'/{print $7}' /etc/passwd)" != "/bin/sh" ]; then
chsh -s /bin/sh
fi
fi

View File

@ -29,7 +29,7 @@ if status is-interactive
# === bat configuration
set -gx BAT_THEME 'OneHalfDark'
set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
#set -gx MANPAGER "sh -c 'col -bx | bat -l man -p'"
# === dict.sh configuration
set -gx D_SELECTOR 'plainsel'

View File

@ -8,6 +8,14 @@ log 'Setting up nnn'
NNN_CONFIG_DIR="$XDG_CONFIG_HOME/nnn"
download_nnn_plugins() {
mkdir -p "$NNN_CONFIG_DIR/plugins"
HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/fzcd" https://github.com/jarun/nnn/raw/master/plugins/fzcd
HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/preview-tui" https://github.com/jarun/nnn/raw/master/plugins/preview-tui
HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/dragdrop" https://github.com/jarun/nnn/raw/master/plugins/dragdrop
chmod +x $NNN_CONFIG_DIR/plugins/*
}
# setup package mirror for CHINA
case "$PM" in
apt)
@ -18,14 +26,16 @@ case "$PM" in
mv nnn-static ~/.local/bin/nnn
rm -rf nnn.tar.gz
cd -
mkdir -p "$NNN_CONFIG_DIR/plugins"
HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/fzcd" https://github.com/jarun/nnn/raw/master/plugins/fzcd
HTTPS_PROXY=$GITHUB_PROXY curl -Lo "$NNN_CONFIG_DIR/plugins/preview-tui" https://github.com/jarun/nnn/raw/master/plugins/preview-tui
download_nnn_plugins
;;
pacman)
sudo pacman -S --noconfirm --needed nnn
cp -r /usr/share/nnn/plugins/. "$NNN_CONFIG_DIR"
;;
xbps)
sudo xbps-install -y nnn ueberzug dragon
download_nnn_plugins
;;
esac
# configuration

View File

@ -45,7 +45,6 @@ if ! has_cmd "$VIM"; then
sudo pacman -S --noconfirm --needed vim
if enhance_vim; then
sudo pip install pyvim
sudo pacman -S clang
fi
;;
esac

View File

@ -80,7 +80,7 @@ function! GetXCopyCmd()
if len(l:status) > 0
return "termux-clipboard-set"
endif
return "xsel -b"
return "xclip -selection clipboard"
endfunction
let g:xcopy = GetXCopyCmd()

9
env.sh
View File

@ -63,6 +63,13 @@ exitrepo() {
cd "$ODIR"
}
makeinstallrepo () {
intorepo "$1" "$DIR/repos/$2"
make && sudo make install
exitrepo
}
log() {
printf "\n\033[32m%s\033[0m\n" "$@"
}
@ -116,6 +123,8 @@ elif has_cmd pkg; then
}
elif has_cmd apt; then
PM=apt
elif has_cmd xbps-install; then
PM=xbps
fi
if [ "$PM" = "n/a" ]; then

53
gui/awesome.sh Executable file
View File

@ -0,0 +1,53 @@
#!/bin/sh
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
log 'Setting up awesome'
case "$PM" in
apt)
;;
pacman)
;;
xbps)
sudo xbps-install -y awesome
;;
esac
# necessary tools
$DIR/dmenu.sh
$DIR/slock.sh
$DRI/dict.sh
# install widgets
HTTPS_PROXY=$GITHUB_PROXY git clone https://github.com/klesh/awesome-wm-widgets.git "$XDG_CONFIG_HOME/awesome/awesome-wm-widgets"
# ~/.xinitrc
cat <<EOT > ~/.xinitrc
export XMODIFIERS="@im=ibus"
export QT_IM_MODULE=ibus
export GTK_IM_MODULE=xim
export VIM_MODE=enhanced
export DMENU_DEFAULT_OPTS='-i -c -fn monospace:13 -nb #222222 -nf #bbbbbb -sb #5b97f7 -sf #eeeeee -l 20'
export TMUX_SHELL=/usr/bin/fish
export XDG_RUNTIME_DIR=/tmp/runtime-klesh
exec dbus-run-session -- awesome 2> /tmp/awesome.log
EOT
# ~/.profile
cat <<'EOT' | sed "s|__PDIR__|$PDIR|g" > ~/.profile
export WINIP=localhost
export PATH=~/dotfiles/bin:~/.local/bin:$PATH
#Startx Automatically
if [ -z "$DISPLAY" ] && [ $(tty) = /dev/tty1 ]; then
startx
fi
EOT
# configuration
lnsf "$DIR/awesome/rc.lua" "$XDG_CONFIG_HOME/awesome/rc.lua"

704
gui/awesome/rc.lua Normal file
View File

@ -0,0 +1,704 @@
-- If LuaRocks is installed, make sure that packages installed through it are
-- found (e.g. lgi). If LuaRocks is not installed, do nothing.
pcall(require, "luarocks.loader")
-- Standard awesome library
local gears = require("gears")
local awful = require("awful")
require("awful.autofocus")
-- Widget and layout library
local wibox = require("wibox")
-- Theme handling library
local beautiful = require("beautiful")
-- Notification library
local naughty = require("naughty")
local menubar = require("menubar")
local hotkeys_popup = require("awful.hotkeys_popup")
local volume_widget = require('awesome-wm-widgets.volume-widget.volume')
local cpu_widget = require("awesome-wm-widgets.cpu-widget.cpu-widget")
local calendar_widget = require("awesome-wm-widgets.calendar-widget.calendar")
local logout_menu_widget = require("awesome-wm-widgets.logout-menu-widget.logout-menu")
local mpdarc_widget = require("awesome-wm-widgets.mpdarc-widget.mpdarc")
-- Enable hotkeys help widget for VIM and other apps
-- when client with a matching name is opened:
require("awful.hotkeys_popup.keys")
-- {{{ Error handling
-- Check if awesome encountered an error during startup and fell back to
-- another config (This code will only ever execute for the fallback config)
if awesome.startup_errors then
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, there were errors during startup!",
text = awesome.startup_errors })
end
-- Handle runtime errors after startup
do
local in_error = false
awesome.connect_signal("debug::error", function (err)
-- Make sure we don't go into an endless error loop
if in_error then return end
in_error = true
naughty.notify({ preset = naughty.config.presets.critical,
title = "Oops, an error happened!",
text = tostring(err) })
in_error = false
end)
end
-- }}}
-- {{{ Variable definitions
-- Themes define colours, icons, font and wallpapers.
beautiful.init(gears.filesystem.get_themes_dir() .. "default/theme.lua")
beautiful.useless_gap = 5
beautiful.border_width = 3
beautiful.border_focus = "#5b97f7"
beautiful.font_name = "agave Nerd Font Mono"
beautiful.wallpaper = "/home/klesh/Nextcloud/wallpapers/仙湖植物园3440x1440.jpg"
beautiful.font = "agave Nerd Font 12"
beautiful.notification_max_width = 400
-- This is used later as the default terminal and editor to run.
terminal = "alacritty -e fish"
editor = os.getenv("EDITOR") or "vim"
editor_cmd = terminal .. " -e " .. editor
-- Default modkey.
-- Usually, Mod4 is the key with a logo between Control and Alt.
-- If you do not like this or do not have such a key,
-- I suggest you to remap Mod4 to another key using xmodmap or other tools.
-- However, you can use another modifier like Mod1, but it may interact with others.
modkey = "Mod4"
-- Table of layouts to cover with awful.layout.inc, order matters.
awful.layout.layouts = {
awful.layout.suit.tile,
--awful.layout.suit.spiral.dwindle,
--awful.layout.suit.floating,
--awful.layout.suit.tile.left,
--awful.layout.suit.tile.bottom,
--awful.layout.suit.tile.top,
awful.layout.suit.fair,
--awful.layout.suit.fair.horizontal,
--awful.layout.suit.spiral,
awful.layout.suit.max,
--awful.layout.suit.max.fullscreen,
awful.layout.suit.magnifier,
awful.layout.suit.corner.nw,
-- awful.layout.suit.corner.ne,
-- awful.layout.suit.corner.sw,
-- awful.layout.suit.corner.se,
}
-- }}}
-- {{{ Menu
-- Create a launcher widget and a main menu
myawesomemenu = {
{ "hotkeys", function() hotkeys_popup.show_help(nil, awful.screen.focused()) end },
{ "manual", terminal .. " -e man awesome" },
{ "edit config", editor_cmd .. " " .. awesome.conffile },
{ "restart", awesome.restart },
{ "quit", function() awesome.quit() end },
}
mymainmenu = awful.menu({ items = { { "awesome", myawesomemenu, beautiful.awesome_icon },
{ "open terminal", terminal }
}
})
mylauncher = awful.widget.launcher({ image = beautiful.awesome_icon,
menu = mymainmenu })
-- Menubar configuration
menubar.utils.terminal = terminal -- Set the terminal for applications that require it
-- }}}
-- Keyboard map indicator and switcher
mykeyboardlayout = awful.widget.keyboardlayout()
-- {{{ Wibar
-- Create a textclock widget
mytextclock = wibox.widget.textclock()
local cw = calendar_widget({
theme = 'nord',
placement = 'top_right',
start_sunday = true,
radius = 8,
-- with customized next/previous (see table above)
previous_month_button = 1,
next_month_button = 3,
})
mytextclock:connect_signal("button::press", function(_, _, _, button)
if button == 1 then cw.toggle() end
end)
-- Create a wibox for each screen and add it
local taglist_buttons = 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, awful.tag.viewtoggle),
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)
)
local tasklist_buttons = gears.table.join(
awful.button({ }, 1, function (c)
if c == client.focus then
c.minimized = true
else
c:emit_signal(
"request::activate",
"tasklist",
{raise = true}
)
end
end),
awful.button({ }, 3, function()
awful.menu.client_list({ theme = { width = 250 } })
end),
awful.button({ }, 4, function ()
awful.client.focus.byidx(1)
end),
awful.button({ }, 5, function ()
awful.client.focus.byidx(-1)
end))
local function set_wallpaper(s)
-- Wallpaper
if beautiful.wallpaper then
local wallpaper = beautiful.wallpaper
-- If wallpaper is a function, call it with the screen
if type(wallpaper) == "function" then
wallpaper = wallpaper(s)
end
gears.wallpaper.maximized(wallpaper, s, true)
end
end
-- Rounded corner
local function rrect(cr, w, h)
gears.shape.rounded_rect(cr, w, h, 8)
end
client.connect_signal("manage", function (c)
c.shape = rrect
end)
-- Re-set wallpaper when a screen's geometry changes (e.g. different resolution)
screen.connect_signal("property::geometry", set_wallpaper)
beautiful.tasklist_shape = rrect
awful.screen.connect_for_each_screen(function(s)
-- Wallpaper
set_wallpaper(s)
-- Each screen has its own tag table.
awful.tag({ "1", "2", "3", "4", "5", "6", "7", "8", "9" }, s, awful.layout.layouts[1])
--awful.tag({"𝟭", "𝟮", "𝟯", "𝟰", "𝟱", "𝟲", "𝟳", "𝟴", "𝟵"}, s, awful.layout.layouts[1])
-- Create a promptbox for each screen
s.mypromptbox = awful.widget.prompt()
-- Create an imagebox widget which will contain an icon indicating which layout we're using.
-- We need one layoutbox per screen.
s.mylayoutbox = awful.widget.layoutbox(s)
s.mylayoutbox:buttons(gears.table.join(
awful.button({ }, 1, function () awful.layout.inc( 1) end),
awful.button({ }, 3, function () awful.layout.inc(-1) end),
awful.button({ }, 4, function () awful.layout.inc( 1) end),
awful.button({ }, 5, function () awful.layout.inc(-1) end)))
-- Create a taglist widget
s.mytaglist = awful.widget.taglist {
screen = s,
filter = awful.widget.taglist.filter.all,
buttons = taglist_buttons,
layout = {
spacing = 10,
layout = wibox.layout.fixed.horizontal,
}
}
-- Create a tasklist widget
s.mytasklist = awful.widget.tasklist {
screen = s,
filter = awful.widget.tasklist.filter.currenttags,
buttons = tasklist_buttons,
layout = {
spacing = 10,
layout = wibox.layout.fixed.horizontal,
}
}
-- Create the wibox
s.mywibox = awful.wibar({
position = "top",
screen = s,
height = 50,
opacity = 0.8,
bg = "#00000000"
})
-- Add widgets to the wibox
s.mywibox:setup(
{ -- margin
{ -- rounded backround
{ -- padding
{
layout = wibox.layout.align.horizontal,
{ -- Left widgets
layout = wibox.layout.fixed.horizontal,
spacing = beautiful.useless_gap,
s.mylayoutbox,
s.mytaglist,
s.mypromptbox,
},
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
spacing = 10,
--mykeyboardlayout,
mpdarc_widget,
volume_widget{
device = "default",
widget_type = "horizontal_bar",
with_icon = true,
bg_color = "#ffffff33"
},
cpu_widget({
width = 70,
step_width = 2,
step_spacing = 0,
color = '#434c5e'
}),
wibox.widget.systray(),
mytextclock,
logout_menu_widget{
onpoweroff = function() awful.spawn.with_shell("sudo poweroff") end,
onlogout = awful.quit,
onreboot = function() awful.spawn.with_shell("sudo shutdown -r now") end,
},
},
},
top = 5,
left = 20,
right = 20,
bottom = 5,
widget = wibox.container.margin,
},
widget = wibox.container.background,
bg = "#000000",
shape = rrect,
},
widget = wibox.container.margin,
top = 10,
left = 10,
right = 10,
bottom = 0,
})
end)
-- }}}
-- {{{ Mouse bindings
root.buttons(gears.table.join(
awful.button({ }, 3, function () mymainmenu:toggle() end),
awful.button({ }, 4, awful.tag.viewnext),
awful.button({ }, 5, awful.tag.viewprev)
))
-- }}}
-- {{{ Key bindings
globalkeys = gears.table.join(
awful.key({}, 'XF86AudioRaiseVolume', volume_widget.inc,
{ description = 'volume up', group = 'hotkeys' } ),
awful.key({}, 'XF86AudioLowerVolume', volume_widget.dec,
{ description = 'volume down', group = 'hotkeys'} ),
awful.key({}, 'XF86AudioMute', volume_widget.toggle,
{ description = 'toggle mute', group = 'hotkeys'} ),
awful.key({}, 'XF86AudioPlay', function() awful.spawn.with_shell("mpc toggle") end,
{ description = 'toggle play', group = 'hotkeys'} ),
awful.key({}, 'XF86AudioNext', function() awful.spawn.with_shell("mpc next") end,
{ description = 'toggle play', group = 'hotkeys'} ),
awful.key({}, 'XF86AudioPrev', function() awful.spawn.with_shell("mpc prev") end,
{ description = 'toggle play', group = 'hotkeys'} ),
awful.key({}, 'F1', function () awful.spawn.with_shell("flameshot gui") end,
{ description = 'toggle mute', group = 'hotkeys'} ),
awful.key({ modkey, }, "s", hotkeys_popup.show_help,
{description = "show help", group="awesome"}),
awful.key({ modkey, }, "Left", awful.tag.viewprev,
{description = "view previous", group = "tag"}),
awful.key({ modkey, }, "Right", awful.tag.viewnext,
{description = "view next", group = "tag"}),
awful.key({ modkey, }, "Escape", awful.tag.history.restore,
{description = "go back", group = "tag"}),
awful.key({ modkey, }, "j",
function ()
awful.client.focus.byidx( 1)
end,
{description = "focus next by index", group = "client"}
),
awful.key({ modkey, }, "k",
function ()
awful.client.focus.byidx(-1)
end,
{description = "focus previous by index", group = "client"}
),
awful.key({ modkey, }, "w", function () mymainmenu:show() end,
{description = "show main menu", group = "awesome"}),
-- Layout manipulation
awful.key({ modkey, "Shift" }, "j", function () awful.client.swap.byidx( 1) end,
{description = "swap with next client by index", group = "client"}),
awful.key({ modkey, "Shift" }, "k", function () awful.client.swap.byidx( -1) end,
{description = "swap with previous client by index", group = "client"}),
awful.key({ modkey, "Control" }, "j", function () awful.screen.focus_relative( 1) end,
{description = "focus the next screen", group = "screen"}),
awful.key({ modkey, "Control" }, "k", function () awful.screen.focus_relative(-1) end,
{description = "focus the previous screen", group = "screen"}),
awful.key({ modkey, }, "u", awful.client.urgent.jumpto,
{description = "jump to urgent client", group = "client"}),
awful.key({ modkey, }, "Tab",
function ()
awful.client.focus.history.previous()
if client.focus then
client.focus:raise()
end
end,
{description = "go back", group = "client"}),
-- Standard program
awful.key({ modkey, }, "Return", function () awful.spawn(terminal) end,
{description = "open a terminal", group = "launcher"}),
awful.key({ modkey, "Control" }, "r", awesome.restart,
{description = "reload awesome", group = "awesome"}),
awful.key({ modkey, "Shift" }, "q", awesome.quit,
{description = "quit awesome", group = "awesome"}),
awful.key({ modkey, }, "l", function () awful.tag.incmwfact( 0.05) end,
{description = "increase master width factor", group = "layout"}),
awful.key({ modkey, }, "h", function () awful.tag.incmwfact(-0.05) end,
{description = "decrease master width factor", group = "layout"}),
awful.key({ modkey, "Shift" }, "h", function () awful.tag.incnmaster( 1, nil, true) end,
{description = "increase the number of master clients", group = "layout"}),
awful.key({ modkey, "Shift" }, "l", function () awful.tag.incnmaster(-1, nil, true) end,
{description = "decrease the number of master clients", group = "layout"}),
awful.key({ modkey, "Control" }, "h", function () awful.tag.incncol( 1, nil, true) end,
{description = "increase the number of columns", group = "layout"}),
awful.key({ modkey, "Control" }, "l", function () awful.tag.incncol(-1, nil, true) end,
{description = "decrease the number of columns", group = "layout"}),
awful.key({ modkey, }, "space", function () awful.layout.inc( 1) end,
{description = "select next", group = "layout"}),
awful.key({ modkey, "Shift" }, "space", function () awful.layout.inc(-1) end,
{description = "select previous", group = "layout"}),
awful.key({ modkey, "Control" }, "n",
function ()
local c = awful.client.restore()
-- Focus restored client
if c then
c:emit_signal(
"request::activate", "key.unminimize", {raise = true}
)
end
end,
{description = "restore minimized", group = "client"}),
-- Prompt
awful.key({ modkey }, "r", function () awful.screen.focused().mypromptbox:run() end,
{description = "run prompt", group = "launcher"}),
awful.key({ modkey }, "x",
function ()
awful.prompt.run {
prompt = "Run Lua code: ",
textbox = awful.screen.focused().mypromptbox.widget,
exe_callback = awful.util.eval,
history_path = awful.util.get_cache_dir() .. "/history_eval"
}
end,
{description = "lua execute prompt", group = "awesome"}),
-- Launcher
awful.key({ modkey }, "p", function() awful.spawn.with_shell("dmenu_launcher") end,
{description = "dmenu launcher", group = "launcher"}),
-- Bookmark
awful.key({ modkey }, "b", function() awful.spawn.with_shell('BOOKMARK_SEARCHER="dmenu $DMENU_DEFAULT_OPTS" bm') end,
{description = "bookmark", group = "launcher"}),
-- Dict.sh
awful.key({ modkey }, "d", function() awful.spawn.with_shell('D_SELECTOR= d "$(xsel -o)"') end,
{description = "dict.sh", group = "launcher"})
)
clientkeys = gears.table.join(
awful.key({ modkey, }, "f",
function (c)
c.fullscreen = not c.fullscreen
c:raise()
end,
{description = "toggle fullscreen", group = "client"}),
awful.key({ modkey }, "q", function (c) c:kill() end,
{description = "close", group = "client"}),
awful.key({ modkey, "Control" }, "space", awful.client.floating.toggle ,
{description = "toggle floating", group = "client"}),
awful.key({ modkey, "Control" }, "Return", function (c) c:swap(awful.client.getmaster()) end,
{description = "move to master", group = "client"}),
awful.key({ modkey, }, "o", function (c) c:move_to_screen() end,
{description = "move to screen", group = "client"}),
awful.key({ modkey, }, "t", function (c) c.ontop = not c.ontop end,
{description = "toggle keep on top", group = "client"}),
awful.key({ modkey, }, "n",
function (c)
-- The client currently has the input focus, so it cannot be
-- minimized, since minimized clients can't have the focus.
c.minimized = true
end ,
{description = "minimize", group = "client"}),
awful.key({ modkey, }, "m",
function (c)
c.maximized = not c.maximized
c:raise()
end ,
{description = "(un)maximize", group = "client"}),
awful.key({ modkey, "Control" }, "m",
function (c)
c.maximized_vertical = not c.maximized_vertical
c:raise()
end ,
{description = "(un)maximize vertically", group = "client"}),
awful.key({ modkey, "Shift" }, "m",
function (c)
c.maximized_horizontal = not c.maximized_horizontal
c:raise()
end ,
{description = "(un)maximize horizontally", group = "client"})
)
-- Bind all key numbers to tags.
-- Be careful: we use keycodes to make it work on any keyboard layout.
-- This should map on the top row of your keyboard, usually 1 to 9.
for i = 1, 9 do
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
end,
{description = "view tag #"..i, group = "tag"}),
-- Toggle tag display.
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"}),
-- Move client to tag.
awful.key({ modkey, "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:move_to_tag(tag)
end
end
end,
{description = "move focused client to tag #"..i, group = "tag"}),
-- Toggle tag on focused client.
awful.key({ modkey, "Control", "Shift" }, "#" .. i + 9,
function ()
if client.focus then
local tag = client.focus.screen.tags[i]
if tag then
client.focus:toggle_tag(tag)
end
end
end,
{description = "toggle focused client on tag #" .. i, group = "tag"})
)
end
clientbuttons = 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)
)
-- Set keys
root.keys(globalkeys)
-- }}}
-- {{{ Rules
-- Rules to apply to new clients (through the "manage" signal).
awful.rules.rules = {
-- All clients will match this rule.
{ rule = { },
properties = { border_width = beautiful.border_width,
border_color = beautiful.border_normal,
focus = awful.client.focus.filter,
raise = true,
keys = clientkeys,
buttons = clientbuttons,
screen = awful.screen.preferred,
placement = awful.placement.no_overlap+awful.placement.no_offscreen
}
},
-- Floating clients.
{ rule_any = {
instance = {
"DTA", -- Firefox addon DownThemAll.
"copyq", -- Includes session name in class.
"pinentry",
},
class = {
"Arandr",
"Blueman-manager",
"Gpick",
"Kruler",
"MessageWin", -- kalarm.
"Sxiv",
"Tor Browser", -- Needs a fixed window size to avoid fingerprinting by screen size.
"Wpa_gui",
"veromix",
"xtightvncviewer"},
-- Note that the name property shown in xprop might be set slightly after creation of the client
-- and the name shown there might not match defined rules here.
name = {
"Event Tester", -- xev.
},
role = {
"AlarmWindow", -- Thunderbird's calendar.
"ConfigManager", -- Thunderbird's about:config.
"pop-up", -- e.g. Google Chrome's (detached) Developer Tools.
}
}, properties = { floating = true }},
-- Add titlebars to normal clients and dialogs
{ rule_any = {type = { "normal", "dialog" }
}, properties = { titlebars_enabled = false }
},
-- Set Firefox to always map on the tag named "2" on screen 1.
-- { rule = { class = "Firefox" },
-- properties = { screen = 1, tag = "2" } },
}
-- }}}
-- {{{ Signals
-- Signal function to execute when a new client appears.
client.connect_signal("manage", function (c)
-- Set the windows at the slave,
-- i.e. put it at the end of others instead of setting it master.
-- if not awesome.startup then awful.client.setslave(c) end
if awesome.startup
and not c.size_hints.user_position
and not c.size_hints.program_position then
-- Prevent clients from being unreachable after screen count changes.
awful.placement.no_offscreen(c)
end
end)
-- Add a titlebar if titlebars_enabled is set to true in the rules.
client.connect_signal("request::titlebars", function(c)
-- buttons for the titlebar
local buttons = gears.table.join(
awful.button({ }, 1, function()
c:emit_signal("request::activate", "titlebar", {raise = true})
awful.mouse.client.move(c)
end),
awful.button({ }, 3, function()
c:emit_signal("request::activate", "titlebar", {raise = true})
awful.mouse.client.resize(c)
end)
)
awful.titlebar(c) : setup {
{ -- Left
awful.titlebar.widget.iconwidget(c),
buttons = buttons,
layout = wibox.layout.fixed.horizontal
},
{ -- Middle
{ -- Title
align = "center",
widget = awful.titlebar.widget.titlewidget(c)
},
buttons = buttons,
layout = wibox.layout.flex.horizontal
},
{ -- Right
awful.titlebar.widget.floatingbutton (c),
awful.titlebar.widget.maximizedbutton(c),
awful.titlebar.widget.stickybutton (c),
awful.titlebar.widget.ontopbutton (c),
awful.titlebar.widget.closebutton (c),
layout = wibox.layout.fixed.horizontal()
},
layout = wibox.layout.align.horizontal
}
end)
-- Enable sloppy focus, so that focus follows mouse.
--client.connect_signal("mouse::enter", function(c)
--c:emit_signal("request::activate", "mouse_enter", {raise = false})
--end)
client.connect_signal("focus", function(c)
c.border_color = beautiful.border_focus
c.border_width = 3
end)
client.connect_signal("unfocus", function(c)
c.border_color = beautiful.border_normal
c.border_width = 0
end)
-- Cursor follow focus
local function move_mouse_onto_focused_client(c)
if mouse.object_under_pointer() ~= c then
local geometry = c:geometry()
local x = geometry.x + geometry.width/2
local y = geometry.y + geometry.height/2
mouse.coords({x = x, y = y}, true)
end
end
client.connect_signal("focus", move_mouse_onto_focused_client)
-- Autostart
awful.spawn.with_shell("picomdaemon")
awful.spawn.with_shell("pipewire")
awful.spawn.with_shell("pipewire-pulse")
awful.spawn.with_shell("! /bin/pgrep nextcloud && nextcloud")
awful.spawn.with_shell("ibus-daemon -drx")
awful.spawn.with_shell("flameshot")
awful.spawn.with_shell("mpd")
-- }}}

7
gui/dict.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
log 'Setting up dict.sh'
makeinstallrepo https://github.com/klesh/dict.sh.git dict.sh

7
gui/dmenu.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
log 'Setting up dmenu'
makeinstallrepo https://gitee.com/klesh/dmenu.git dmenu

View File

@ -6,6 +6,17 @@ DIR=$(dirname "$(readlink -f "$0")")
log 'Setting up fonts'
install_wqy_microhei() {
# official wqy-microhei package doesn't fix the Korean Glyphs stacking bug
# https://code.google.com/p/chromium/issues/detail?id=233851
# use debian package instead
DEB_PKG_NAME=fonts-wqy-microhei_0.2.0-beta-3_all.deb
if [ ! -f "/tmp/$DEB_PKG_NAME" ]; then
wget http://mirrors.163.com/debian/pool/main/f/fonts-wqy-microhei/$DEB_PKG_NAME -O /tmp/$DEB_PKG_NAME
fi
ar p "/tmp/$DEB_PKG_NAME" data.tar.xz | sudo tar Jxv -C /
}
case "$PM" in
apt)
# fonts
@ -26,19 +37,15 @@ case "$PM" in
ttf-dejavu \
noto-fonts-emoji \
gucharmap
# official wqy-microhei package doesn't fix the Korean Glyphs stacking bug
# https://code.google.com/p/chromium/issues/detail?id=233851
# use debian package instead
DEB_PKG_NAME=fonts-wqy-microhei_0.2.0-beta-3_all.deb
if [ ! -f "/tmp/$DEB_PKG_NAME" ]; then
wget http://mirrors.163.com/debian/pool/main/f/fonts-wqy-microhei/$DEB_PKG_NAME -O /tmp/$DEB_PKG_NAME
fi
ar p "/tmp/$DEB_PKG_NAME" data.tar.xz | sudo tar Jxv -C /
install_wqy_microhei
# install symbola for plain emojis(no-color) for st
if ! fc-list | grep -qi symbola; then
yay -S --noconfirm --needed ttf-symbola-free
fi
;;
xbps)
sudo xbps-install noto-fonts-emoji
install_wqy_microhei
esac
@ -62,14 +69,13 @@ install_nerdfont () {
rm -rf "$LOCAL_REPO_PATH"
}
#install_nerdfont Agave agave v2.1.0
#install_nerdfont Hermit Hurmit v2.1.0
install_nerdfont Agave agave v2.1.0
#install_nerdfont CascadiaCode Caskaydia v2.1.0
#install_nerdfont DaddyTimeMono DaddyTimeMono v2.1.0
log 'Setting up font rendering'
sudo ln -sf /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d
sudo ln -sf /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d
sudo ln -sf /etc/fonts/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d
sudo cp "$DIR/font/freetype2.sh" "/etc/profile.d/freetype2.sh"
lnsf "$DIR/font/fonts.conf" "$XDG_CONFIG_HOME/fontconfig/fonts.conf"
#log 'Setting up font rendering'
#sudo ln -sf /etc/fonts/conf.avail/70-no-bitmaps.conf /etc/fonts/conf.d
#sudo ln -sf /etc/fonts/conf.avail/10-sub-pixel-rgb.conf /etc/fonts/conf.d
#sudo ln -sf /etc/fonts/conf.avail/11-lcdfilter-default.conf /etc/fonts/conf.d
#sudo cp "$DIR/font/freetype2.sh" "/etc/profile.d/freetype2.sh"

0
gui/font/fonts.conf Executable file → Normal file
View File

View File

@ -34,7 +34,7 @@ db_file "~/.mpd/database"
# The special value "syslog" makes MPD use the local syslog daemon. This
# setting defaults to logging to syslog.
#
log_file "/dev/null"
log_file "/tmp/mpd.log"
#
# This setting sets the location of the file which stores the process ID
# for use of mpd --kill and some init scripts. This setting is disabled by
@ -94,7 +94,7 @@ bind_to_address "127.0.0.1"
# argument is recommended for troubleshooting, though can quickly stretch
# available resources on limited hardware storage.
#
#log_level "default"
log_level "verbose"
#
# Setting "restore_paused" to "yes" puts MPD into pause mode instead
# of starting playback after startup.
@ -203,15 +203,16 @@ input {
#
# An example of an ALSA output:
audio_output {
type "alsa"
name "My ALSA Device"
#audio_output {
# type "alsa"
# name "My ALSA Device"
# device "hw:0,0" # optional
# mixer_type "hardware" # optional
# mixer_device "default" # optional
# mixer_control "PCM" # optional
# mixer_index "0" # optional
}
#}
#
# An example of an OSS output:
#
@ -345,6 +346,10 @@ audio_output {
path "/tmp/mpd.fifo"
format "44100:16:2"
}
audio_output {
type "pipewire"
name "pipewire sound server"
}
###############################################################################

View File

@ -10,6 +10,7 @@ fi
GNUPG=$HOME/.gnupg
GPG_AGENT_CONF=$GNUPG/gpg-agent.conf
mkdir -p "$GNUPG"
chmod 700 "$GNUPG"
# install pass
case "$PM" in
@ -24,18 +25,22 @@ case "$PM" in
sudo apt install -y pinentry-gtk2
PINENTRY=$(command -v pinentry-gtk-2)
fi
SETTING="pinentry-program $PINENTRY"
;;
pacman)
sudo pacman -S --noconfirm --needed \
go \
browserpass
browserpass pinentry-qt
PINENTRY=$(command -v pinentry-qt)
;;
xbps)
sudo xbps-install -y go browserpass pass pinentry
PINENTRY=$(command -v pinentry-qt)
;;
esac
# longer password caching time
cat <<EOF > ~/.gnupg/gpg-agent.conf
$SETTING
pinentry-program $PINENTRY
default-cache-ttl 28800
max-cache-ttl 28800
EOF

View File

@ -21,12 +21,17 @@ case "$PM" in
pacman)
sudo pacman -S --noconfirm --needed uthash ninja meson libev libconfig
;;
xbps)
sudo xbps-install -y uthash ninja meson libev libev-devel libconfig \
libX11-devel xcb-util-renderutil-devel xcb-util-image-devel \
libXext-devel pixman-devel libconfig-devel pcre-devel libglvnd-devel dbus-devel
;;
esac
# build and install picom
#intorepo https://github.com/klesh/picom.git "$DIR/repos/picom"
#intorepo https://github.com/yshui/picom.git "$DIR/repos/picom"
intorepo https://github.com/ibhagwan/picom.git "$DIR/repos/picom"
intorepo https://github.com/yshui/picom.git "$DIR/repos/picom"
#intorepo https://github.com/ibhagwan/picom.git "$DIR/repos/picom"
meson --buildtype=release . build
sudo ninja -C build install
exitrepo

View File

@ -2,23 +2,23 @@
# Corners #
#################################
# requires: https://github.com/sdhand/compton
corner-radius = 7.0;
rounded-corners-exclude = [
#"window_type = 'normal'",
"class_g = 'awesome'",
"class_g = 'URxvt'",
"class_g = 'XTerm'",
"class_g = 'kitty'",
"class_g = 'Alacritty'",
#"class_g = 'Polybar'",
"class_g = 'code-oss'",
"class_g = 'firefox'",
"class_g = 'Thunderbird'"
];
round-borders = 3;
round-borders-exclude = [
#"class_g = 'TelegramDesktop'",
];
#corner-radius = 7.0;
#rounded-corners-exclude = [
##"window_type = 'normal'",
#"class_g = 'awesome'",
#"class_g = 'URxvt'",
#"class_g = 'XTerm'",
#"class_g = 'kitty'",
#"class_g = 'Alacritty'",
##"class_g = 'Polybar'",
#"class_g = 'code-oss'",
#"class_g = 'firefox'",
#"class_g = 'Thunderbird'"
#];
#round-borders = 3;
#round-borders-exclude = [
##"class_g = 'TelegramDesktop'",
#];
# Specify a list of border width rules, in the format `PIXELS:PATTERN`,
# Note we don't make any guarantee about possible conflicts with the
@ -27,12 +27,12 @@ round-borders-exclude = [
# example:
# round-borders-rule = [ "2:class_g = 'URxvt'" ];
#
round-borders-rule = [
"3:class_g = 'XTerm'",
"3:class_g = 'URxvt'",
"10:class_g = 'Alacritty'",
"15:class_g = 'Signal'"
];
#round-borders-rule = [
#"3:class_g = 'XTerm'",
#"3:class_g = 'URxvt'",
#"10:class_g = 'Alacritty'",
#"15:class_g = 'Signal'"
#];
#################################
# Shadows #
#################################

View File

@ -14,6 +14,9 @@ case "$PM" in
pacman)
sudo pacman -S --noconfirm --needed mpd mpc ncmpcpp mpv
;;
xbps)
sudo xbps-install -y mpd mpc ncmpcpp mpv
;;
esac
# symlink configuration
@ -26,12 +29,14 @@ lnsf "$DIR/ncmpcpp/bindings" "$XDG_CONFIG_HOME/ncmpcpp/bindings"
lnsf "$DIR/ncmpcpp/config" "$XDG_CONFIG_HOME/ncmpcpp/config"
# prevent system-wide mpd
sudo systemctl disable mpd
sudo systemctl stop mpd
if has_cmd systemctl; then
sudo systemctl disable mpd
sudo systemctl stop mpd
# enable for current user
systemctl --user enable mpd
systemctl --user start mpd
fi
mkdir -p "$HOME/.mpd/playlists"
# enable for current user
systemctl --user enable mpd
systemctl --user start mpd
# command to update your database: mpc update

7
gui/slock.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/sh
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
log 'Setting up slock'
makeinstallrepo https://gitee.com/klesh/slock.git slock

View File

@ -1,6 +1,4 @@
#!/bin/sh
set -e
DIR=$(dirname "$(readlink -f "$0")")
. "$DIR/../env.sh"
@ -21,17 +19,12 @@ esac
# clone / compile utilities and dwm itself
installrepo () {
intorepo "$1" "$DIR/repos/$2"
make && sudo make install
exitrepo
}
installrepo https://gitee.com/klesh/st.git st
installrepo https://gitee.com/klesh/dmenu.git dmenu
installrepo https://gitee.com/klesh/slock.git slock
installrepo https://gitee.com/klesh/dwm.git dwm
installrepo https://github.com/klesh/dict.sh.git dict.sh
$DIR/dmenu.sh
$DIR/slock.sh
$DRI/dict.sh
makeinstallrepo https://gitee.com/klesh/st.git st
makeinstallrepo https://gitee.com/klesh/dwm.git dwm
# config xinit to start for dwm
cat <<EOT > ~/.xinitrc

View File

@ -54,7 +54,8 @@ case "$PM" in
xclip xsel xdotool \
gnome-keyring libsecret \
flameshot scrot \
thunar gvfs-smb gvfs-mtp thunar-archive-plugin file-roller tumbler
thunar gvfs-smb gvfs-mtp thunar-archive-plugin file-roller tumbler \
clang
# bluetooth
if has_bluetooth; then
sudo pacman -S --noconfirm --needed \
@ -71,27 +72,52 @@ case "$PM" in
acpilght tlp
fi
;;
xbps)
sudo xbps-install -y xorg dbus gnome-keyring libgnome-keyring \
nitrogen xsel xdotool xclip flameshot clang pkg-config chrony \
Thunar gvfs-smb gvfs-mtp thunar-archive-plugin file-roller tumbler \
pipewire pipewire-pulse alsa-pipewire alsa-utils pulseaudio-utils pavucontrol libpulseaudio \
ibus ibus-rime \
base-devel libX11-devel libXft-devel libXinerama-devel
sudo mkdir -p /etc/alsa/conf.d
sudo ln -s /usr/share/alsa/alsa.conf.d/50-pipewire.conf /etc/alsa/conf.d
sudo ln -s /usr/share/alsa/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d
echo "Wubi"
echo "download rime-data-wubi from http://mirrors.163.com/ubuntu/pool/universe/r/rime-wubi/rime-data-wubi_0.0~git20200908.f1876f0-3_amd64.deb"
echo " ar x rime-data-wubi_0.0~git20200908.f1876f0-3_amd64.deb"
echo " unzstd data.zst"
echo " cd /"
echo " sudo tar xvf /home/klesh/Downloads/rime-data-wubi/data.tar"
echo " sudo vim /usr/share/rime-data/default.yaml"
echo "add wub86 to schema"
echo "restart ibus"
echo "add rime , done"
;;
esac
# start network
sudo systemctl enable NetworkManager
sudo systemctl start NetworkManager
sudo systemctl enable autorandr
sudo systemctl start autorandr
lnsf "$DIR/dunst/dunstrc" "$XDG_CONFIG_HOME/dunst/dunstrc"
lnsf "$DIR/thunar/uca.xml" "$XDG_CONFIG_HOME/Thunar/uca.xml"
echo for non-root user to change backlight, add following rule to /etc/udev/rules.d/backlight.rules
echo ```
echo ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="acpi_video0", GROUP="video", MODE="0664"
echo ```
echo for intel_backlight:
echo ```
echo RUN+="/bin/chgrp video /sys/class/backlight/intel_backlight/brightness"
echo RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness"
echo ```
# start network
if has_cmd systemctl; then
sudo systemctl enable NetworkManagerXF86AudioRaiseVolume
sudo systemctl start NetworkManager
sudo systemctl enable autorandr
sudo systemctl start autorandr
echo for amd ryzen laptop add "acpi_backlight=vendor" to /etc/default/grub and then run
echo sudo grub-mkconfig -o /boot/grub/grub.cfg
lnsf "$DIR/dunst/dunstrc" "$XDG_CONFIG_HOME/dunst/dunstrc"
echo for non-root user to change backlight, add following rule to /etc/udev/rules.d/backlight.rules
echo ```
echo ACTION=="add", SUBSYSTEM=="backlight", KERNEL=="acpi_video0", GROUP="video", MODE="0664"
echo ```
echo for intel_backlight:
echo ```
echo RUN+="/bin/chgrp video /sys/class/backlight/intel_backlight/brightness"
echo RUN+="/bin/chmod g+w /sys/class/backlight/intel_backlight/brightness"
echo ```
echo for amd ryzen laptop add "acpi_backlight=vendor" to /etc/default/grub and then run
echo sudo grub-mkconfig -o /boot/grub/grub.cfg
else
sudo ln -sf /etc/sv/chronyd /var/service/
fi