merge from linux config
This commit is contained in:
commit
c915560cdf
5 changed files with 60 additions and 2084 deletions
|
@ -1,62 +0,0 @@
|
||||||
# This is a sample commands.py. You can add your own commands here.
|
|
||||||
#
|
|
||||||
# Please refer to commands_full.py for all the default commands and a complete
|
|
||||||
# documentation. Do NOT add them all here, or you may end up with defunct
|
|
||||||
# commands when upgrading ranger.
|
|
||||||
|
|
||||||
# A simple command for demonstration purposes follows.
|
|
||||||
# -----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
from __future__ import (absolute_import, division, print_function)
|
|
||||||
|
|
||||||
# You can import any python module as needed.
|
|
||||||
import os
|
|
||||||
|
|
||||||
# You always need to import ranger.api.commands here to get the Command class:
|
|
||||||
from ranger.api.commands import Command
|
|
||||||
|
|
||||||
|
|
||||||
# Any class that is a subclass of "Command" will be integrated into ranger as a
|
|
||||||
# command. Try typing ":my_edit<ENTER>" in ranger!
|
|
||||||
class my_edit(Command):
|
|
||||||
# The so-called doc-string of the class will be visible in the built-in
|
|
||||||
# help that is accessible by typing "?c" inside ranger.
|
|
||||||
""":my_edit <filename>
|
|
||||||
|
|
||||||
A sample command for demonstration purposes that opens a file in an editor.
|
|
||||||
"""
|
|
||||||
|
|
||||||
# The execute method is called when you run this command in ranger.
|
|
||||||
def execute(self):
|
|
||||||
# self.arg(1) is the first (space-separated) argument to the function.
|
|
||||||
# This way you can write ":my_edit somefilename<ENTER>".
|
|
||||||
if self.arg(1):
|
|
||||||
# self.rest(1) contains self.arg(1) and everything that follows
|
|
||||||
target_filename = self.rest(1)
|
|
||||||
else:
|
|
||||||
# self.fm is a ranger.core.filemanager.FileManager object and gives
|
|
||||||
# you access to internals of ranger.
|
|
||||||
# self.fm.thisfile is a ranger.container.file.File object and is a
|
|
||||||
# reference to the currently selected file.
|
|
||||||
target_filename = self.fm.thisfile.path
|
|
||||||
|
|
||||||
# This is a generic function to print text in ranger.
|
|
||||||
self.fm.notify("Let's edit the file " + target_filename + "!")
|
|
||||||
|
|
||||||
# Using bad=True in fm.notify allows you to print error messages:
|
|
||||||
if not os.path.exists(target_filename):
|
|
||||||
self.fm.notify("The given file does not exist!", bad=True)
|
|
||||||
return
|
|
||||||
|
|
||||||
# This executes a function from ranger.core.acitons, a module with a
|
|
||||||
# variety of subroutines that can help you construct commands.
|
|
||||||
# Check out the source, or run "pydoc ranger.core.actions" for a list.
|
|
||||||
self.fm.edit_file(target_filename)
|
|
||||||
|
|
||||||
# The tab method is called when you press tab, and should return a list of
|
|
||||||
# suggestions that the user will tab through.
|
|
||||||
# tabnum is 1 for <TAB> and -1 for <S-TAB> by default
|
|
||||||
def tab(self, tabnum):
|
|
||||||
# This is a generic tab-completion function that iterates through the
|
|
||||||
# content of the current directory.
|
|
||||||
return self._tab_directory_content()
|
|
File diff suppressed because it is too large
Load diff
|
@ -1,6 +1,40 @@
|
||||||
-- vim:foldmethod=marker:foldlevel=1
|
-- vim:foldmethod=marker:foldlevel=1
|
||||||
local wezterm = require("wezterm")
|
local wezterm = require("wezterm")
|
||||||
|
|
||||||
|
local function get_os()
|
||||||
|
local target = wezterm.target_triple
|
||||||
|
if string.find(target, "linux") then
|
||||||
|
return "linux"
|
||||||
|
elseif string.find(target, "darwin") then
|
||||||
|
return "macos"
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
local opt
|
||||||
|
if get_os() == "linux" then
|
||||||
|
opt = {
|
||||||
|
window_padding = {
|
||||||
|
left = 0,
|
||||||
|
right = 0,
|
||||||
|
top = 0,
|
||||||
|
bottom = 0
|
||||||
|
},
|
||||||
|
font_size = 14,
|
||||||
|
sync = false
|
||||||
|
}
|
||||||
|
elseif get_os() == "macos" then
|
||||||
|
opt = {
|
||||||
|
window_padding = {
|
||||||
|
left = 2,
|
||||||
|
right = 2,
|
||||||
|
top = 2,
|
||||||
|
bottom = 2
|
||||||
|
},
|
||||||
|
font_size = 18,
|
||||||
|
sync = true
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
-- fonts I like, with the settings I prefer {{{
|
-- fonts I like, with the settings I prefer {{{
|
||||||
-- kept seperately from the rest of the config so that I can easily change them
|
-- kept seperately from the rest of the config so that I can easily change them
|
||||||
local fonts = {
|
local fonts = {
|
||||||
|
@ -91,32 +125,6 @@ wezterm.on("format-tab-title", function(tab, tabs, panes, config, hover, max_wid
|
||||||
end)
|
end)
|
||||||
-- }}}
|
-- }}}
|
||||||
|
|
||||||
local function get_os()
|
|
||||||
local target = wezterm.target_triple
|
|
||||||
if string.find(target, "linux") then
|
|
||||||
return "linux"
|
|
||||||
elseif string.find(target, "darwin") then
|
|
||||||
return "macos"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
local window_padding = {}
|
|
||||||
if get_os() == "linux" then
|
|
||||||
window_padding = {
|
|
||||||
left = 0,
|
|
||||||
right = 0,
|
|
||||||
top = 0,
|
|
||||||
bottom = 0,
|
|
||||||
}
|
|
||||||
elseif get_os() == "macos" then
|
|
||||||
window_padding = {
|
|
||||||
left = 2,
|
|
||||||
right = 2,
|
|
||||||
top = 2,
|
|
||||||
bottom = 2,
|
|
||||||
}
|
|
||||||
end
|
|
||||||
|
|
||||||
local act = wezterm.action
|
local act = wezterm.action
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -167,7 +175,7 @@ return {
|
||||||
{ key = "v", mods = "LEADER", action = "ActivateCopyMode" },
|
{ key = "v", mods = "LEADER", action = "ActivateCopyMode" },
|
||||||
},
|
},
|
||||||
-- font
|
-- font
|
||||||
font_size = 18,
|
font_size = opt.font_size,
|
||||||
font = fonts.victor,
|
font = fonts.victor,
|
||||||
use_fancy_tab_bar = false,
|
use_fancy_tab_bar = false,
|
||||||
tab_bar_at_bottom = true,
|
tab_bar_at_bottom = true,
|
||||||
|
@ -175,7 +183,7 @@ return {
|
||||||
tab_max_width = 32,
|
tab_max_width = 32,
|
||||||
-- window
|
-- window
|
||||||
window_decorations = "RESIZE",
|
window_decorations = "RESIZE",
|
||||||
window_padding = window_padding,
|
window_padding = opt.window_padding,
|
||||||
-- theme
|
-- theme
|
||||||
color_scheme = "Catppuccin Mocha",
|
color_scheme = "Catppuccin Mocha",
|
||||||
-- nightly only
|
-- nightly only
|
||||||
|
|
23
dot_local/bin/executable_media-status
Normal file
23
dot_local/bin/executable_media-status
Normal file
|
@ -0,0 +1,23 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
if ! [[ -x "$(command -v playerctl)" ]]; then
|
||||||
|
echo "install playerctl"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
while read -r LINE; do
|
||||||
|
if [[ $LINE == "No players found" ]]; then
|
||||||
|
ICON=""
|
||||||
|
OUTPUT=""
|
||||||
|
else
|
||||||
|
STATE=$(echo "$LINE" | cut -d " " -f1)
|
||||||
|
OUTPUT=$(echo "$LINE" | cut -d " " -f2-)
|
||||||
|
if [[ $STATE == "Paused" ]]; then
|
||||||
|
ICON=""
|
||||||
|
else
|
||||||
|
ICON=""
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$ICON" "${OUTPUT}"
|
||||||
|
done < <(playerctl metadata -f '{{status}} {{artist}} - {{title}}' -F)
|
|
@ -9,7 +9,7 @@ fi
|
||||||
while read -r LINE; do
|
while read -r LINE; do
|
||||||
if echo "$LINE" | grep -q 'Connected'; then
|
if echo "$LINE" | grep -q 'Connected'; then
|
||||||
# regex grep the relay, e.g. se7 for sweden-7
|
# regex grep the relay, e.g. se7 for sweden-7
|
||||||
OUTPUT=$(echo "$LINE" | grep -oE "\w{2}\d+")
|
OUTPUT=$(echo "$LINE" | grep -oP "\w{2}\d+")
|
||||||
ICON=" "
|
ICON=" "
|
||||||
else
|
else
|
||||||
ICON=" "
|
ICON=" "
|
||||||
|
|
Loading…
Reference in a new issue