lemonbar: move more actions to modules
This commit is contained in:
@@ -24,17 +24,6 @@ class bar_mode(Enum):
|
||||
|
||||
mode = bar_mode.normal
|
||||
|
||||
def date_comm(args):
|
||||
subprocess.Popen(['yad', '--no-buttons', '--calendar', '--sticky'
|
||||
, '--on-top' , '--class' , '"YADWIN"', '--posx=1650', '--posy=24'
|
||||
, '--close-on-unfocus'])
|
||||
|
||||
def lang_comm(args):
|
||||
subprocess.Popen(['sh', '/home/kuba/.i3/scripts/lang.sh', 'next'])
|
||||
def dpms_comm(args):
|
||||
subprocess.Popen(['sh', '/home/kuba/.i3/scripts/dpmsctl.sh'])
|
||||
def adj_br(args):
|
||||
subprocess.Popen(['/home/kuba/.i3/scripts/adjbr.sh', '-b', config.fifo_file_executor])
|
||||
def i3msg_comm(args):
|
||||
subprocess.Popen(args.split())
|
||||
def set_mode(args):
|
||||
@@ -54,9 +43,6 @@ def bluetooth(args):
|
||||
screen_send_cmd('bluetoothctl ' + inp)
|
||||
|
||||
show_secs = False
|
||||
def toggle_secs(args):
|
||||
global show_secs
|
||||
show_secs = not show_secs
|
||||
|
||||
# Keymaps
|
||||
def_keymap = 'pl'
|
||||
@@ -67,13 +53,8 @@ def set_lang(args):
|
||||
lang = args.split()[1]
|
||||
keymaps[cur_class] = lang
|
||||
|
||||
commands_dict = {'toggle_secs': toggle_secs
|
||||
,'date': date_comm
|
||||
,'dpms': dpms_comm
|
||||
,'i3-msg': i3msg_comm
|
||||
,'switch_lang': lang_comm
|
||||
commands_dict = {'i3-msg': i3msg_comm
|
||||
,'mode': set_mode
|
||||
,'adj_br': adj_br
|
||||
,'setlang': set_lang
|
||||
,'bluetooth': bluetooth
|
||||
}
|
||||
|
||||
@@ -96,8 +96,10 @@ class ConkyFastModule(LemonModule):
|
||||
parser.g_parser.register_unit(self.time)
|
||||
|
||||
self.register_action('wlan' , self.nmtui)
|
||||
self.register_action('load', self.htop)
|
||||
self.register_action('pavu' , self.pavu)
|
||||
self.register_action('date' , self.date_comm)
|
||||
self.register_action('toggle_secs' , self.toggle_secs)
|
||||
|
||||
def _stop_module(self):
|
||||
if self.p_handle is not None:
|
||||
self.p_handle.terminate()
|
||||
@@ -133,14 +135,18 @@ class ConkyFastModule(LemonModule):
|
||||
p = subprocess.Popen(['xterm', '-class', 'FLOAT_TERM', '-e', 'nmtui'])
|
||||
common.kill_on_unfocus.append(p.pid)
|
||||
|
||||
def htop(self):
|
||||
p = subprocess.Popen(['xterm', '-class', 'FLOAT_TERM', '-e', 'htop'])
|
||||
common.kill_on_unfocus.append(p.pid)
|
||||
|
||||
def pavu(self):
|
||||
p = subprocess.Popen(['pavucontrol', '--class=FLOAT_PAVU'])
|
||||
common.kill_on_unfocus.append(p.pid)
|
||||
|
||||
def date_comm(args):
|
||||
subprocess.Popen(['yad', '--no-buttons', '--calendar', '--sticky'
|
||||
, '--on-top' , '--class' , '"YADWIN"', '--posx=1650', '--posy=24'
|
||||
, '--close-on-unfocus'])
|
||||
|
||||
def toggle_secs(args):
|
||||
common.show_secs = not common.show_secs
|
||||
|
||||
class ConkySlowModule(LemonModule):
|
||||
|
||||
def __init__(self):
|
||||
@@ -166,6 +172,11 @@ class ConkySlowModule(LemonModule):
|
||||
parser.g_parser.register_unit(self.battery)
|
||||
parser.g_parser.register_unit(self.language)
|
||||
|
||||
self.register_action('load' , self.htop)
|
||||
self.register_action('lang' , self.lang_comm)
|
||||
self.register_action('adj_br' , self.adj_br)
|
||||
self.register_action('dpms' , self.dpms_comm)
|
||||
|
||||
def _stop_module(self):
|
||||
parser.g_parser.remove_unit(self.sys_load)
|
||||
parser.g_parser.remove_unit(self.disk)
|
||||
@@ -214,6 +225,19 @@ class ConkySlowModule(LemonModule):
|
||||
def parse_language(self, data):
|
||||
self.language.items = [(config.icon_lang, data[0])]
|
||||
|
||||
def htop(self):
|
||||
p = subprocess.Popen(['xterm', '-class', 'FLOAT_TERM', '-e', 'htop'])
|
||||
common.kill_on_unfocus.append(p.pid)
|
||||
|
||||
def lang_comm(args):
|
||||
subprocess.Popen(['sh', '/home/kuba/.i3/scripts/lang.sh', 'next'])
|
||||
|
||||
def dpms_comm(args):
|
||||
subprocess.Popen(['sh', '/home/kuba/.i3/scripts/dpmsctl.sh'])
|
||||
|
||||
def adj_br(args):
|
||||
subprocess.Popen(['/home/kuba/.i3/scripts/adjbr.sh', '-b', config.fifo_file_executor])
|
||||
|
||||
class i3Module(LemonModule):
|
||||
# Handles outputs (displays), workspaces and active window
|
||||
# TODO trigger formatting
|
||||
|
||||
Reference in New Issue
Block a user