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